@liberseek/boft-cli-win32-arm64 0.8.7 → 0.8.9

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 (68) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +59 -6
  4. package/app/console-web.js +1376 -1053
  5. package/app/desktop-controller.mjs +239 -57
  6. package/app/host-runtime.mjs +32921 -24901
  7. package/app/plugins/antigravity/assets/icon.svg +1 -1
  8. package/app/plugins/antigravity/plugin.mjs +9491 -4266
  9. package/app/plugins/claude-code/plugin.mjs +580 -116
  10. package/app/plugins/codebuddy/plugin.mjs +85 -8
  11. package/app/plugins/codex-usage/plugin.mjs +70 -6
  12. package/app/plugins/copilot/plugin.mjs +62 -6
  13. package/app/plugins/cursor-cli/plugin.mjs +62 -6
  14. package/app/plugins/deepseek-harness/plugin.mjs +87 -11
  15. package/app/plugins/devin/plugin.mjs +61 -6
  16. package/app/plugins/grok/plugin.mjs +320 -223
  17. package/app/plugins/hermes/plugin.mjs +61 -6
  18. package/app/plugins/kimi-code/plugin.mjs +87 -16
  19. package/app/plugins/kiro-cli/plugin.mjs +62 -6
  20. package/app/plugins/muse/plugin.mjs +61 -6
  21. package/app/plugins/omp/plugin.mjs +195 -31
  22. package/app/plugins/opencode/plugin.mjs +88 -15
  23. package/app/plugins/pi/plugin.mjs +207 -32
  24. package/app/plugins/qoder/plugin.mjs +99 -7
  25. package/app/plugins/qoder-cn/plugin.mjs +99 -7
  26. package/app/plugins/qwen-code/plugin.mjs +62 -6
  27. package/app/plugins/workbuddy/plugin.mjs +89 -11
  28. package/app/plugins/zcode/plugin.mjs +70 -6
  29. package/app/renderer-extension.js +1767 -1187
  30. package/app/web/assets/index-C2OA-eHT.js +201 -0
  31. package/app/web/assets/index-DJW4bmyx.css +1 -0
  32. package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
  33. package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
  34. package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
  35. package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
  36. package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
  37. package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
  38. package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
  39. package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
  40. package/app/web/codexhost-settings.js +1383 -1056
  41. package/app/web/index.html +4 -3
  42. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +11 -11
  45. package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +28 -28
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  53. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  54. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  55. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  56. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  57. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  58. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  59. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  60. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  61. package/app/web-modules/server.mjs +2458 -1615
  62. package/bin/boft.exe +0 -0
  63. package/libexec/boft-node-repl.exe +0 -0
  64. package/libexec/boft-shim.exe +0 -0
  65. package/libexec/boft-updater.exe +0 -0
  66. package/package.json +1 -1
  67. package/app/web/assets/index-CP6wY-1D.css +0 -1
  68. package/app/web/assets/index-Da35Phrd.js +0 -199
@@ -119,7 +119,7 @@ function ii(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}//
119
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
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 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():te(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():te(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)}function Eo(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 Do=Ha([L(),z(),B(),Pa()]);function Oo(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 ko=Co(Oo,{message:`JSON value must not contain circular references`}),Ao=xo(()=>Ha([Do,V(Ao),Xa(L(),Ao)])),jo=ko.pipe(Ao);ko.pipe(V(Ao));let Mo=ko.pipe(Xa(L(),Ao)),No=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(Eo([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Po=L().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Fo=e=>L().min(1).max(e).refine(e=>e.trim().length>0),Io=Xa(Po,H({label:Fo(256).optional(),description:Fo(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Lo=Xa(Po,Fo(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Ro=L().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),zo=Ro.brand(),K=Ro.brand(),Bo=Ro.brand();Ro.brand(),Ro.brand();let Vo=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Ho=Vo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Uo=H({modes:V(H({id:Ho,label:Vo.max(256),description:Vo.max(1024).optional(),dangerous:B().optional(),localizations:Io.optional()}).strict()).min(1).max(32),defaultModeId:Ho}).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:Ho}).strict();let Wo=z().int().safe().nonnegative(),Go=z().finite().nonnegative(),Ko=z().finite().min(0).max(100),qo=H({value:Go,turnId:L().min(1).max(1024),at:Wo}).strict();H({outputTokensPerSecond:qo.optional(),timeToFirstOutputMs:qo.extend({value:Wo}).optional()}).strict();let Jo=e=>Lo.refine(t=>Object.values(t).every(t=>t.length<=e)),Yo=H({composerIndicators:V(H({kind:G(`countdown`),id:L().min(1).max(64),expiresAtUnix:Wo,label:Jo(256).optional(),tooltip:Jo(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:Wo.optional(),cachedInputTokens:Wo.optional(),cacheWriteInputTokens:Wo.optional(),outputTokens:Wo.optional(),outputTokensPerSecond:Go.optional(),apiOutputTokensPerSecond:Go.optional(),reasoningOutputTokens:Wo.optional(),totalTokens:Wo.optional(),totalCostUsd:Go.optional(),totalCredits:Go.optional(),contextUsagePercent:Go.optional(),cacheHitRatePercent:Ko.optional(),contextWindowTokens:Wo.optional(),contextUsedTokens:Wo.optional(),planFiveHourUsedPercent:Ko.optional(),planFiveHourResetsAtUnix:Wo.optional(),planSevenDayUsedPercent:Ko.optional(),planSevenDayResetsAtUnix:Wo.optional(),sessionCacheHitRatePercent:Ko.optional(),timeToFirstOutputMs:Wo.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`]})}),Xo=z().finite().min(0).max(100),Zo=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Qo=H({id:L().min(1).max(256),label:L().min(1).max(256),localizations:Io.optional()}).strict(),$o=H({product:L().min(1),periodType:Zo.optional(),scope:Qo.optional(),localizations:Io.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),usagePercent:Xo,resetsAt:L().min(1).optional()}).strict(),es=H({availableCount:z().int().safe().positive(),nextExpiresAt:L().min(1).optional(),expiresAt:V(L().min(1)).min(1).max(32).optional()}).strict(),ts=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().trim().min(1).max(32).optional(),label:L().min(1).optional(),usedPercent:Xo.optional(),remaining:z().finite().optional(),scope:Qo.optional(),localizations:Io.optional(),resetsAt:L().min(1).optional(),periodType:Zo,productUsage:V($o).min(1).optional(),resetCredits:es.optional()}).strict().superRefine((e,t)=>{e.usedPercent===void 0&&e.remaining===void 0&&t.addIssue({code:`custom`,message:`Account credits must include usedPercent or remaining`}),e.remaining!==void 0&&!e.unit&&t.addIssue({code:`custom`,message:`Account remaining credits require a unit`,path:[`unit`]})});H({threadId:K,refresh:G(`exact`).optional()}).strict(),H({threadId:K,usage:Yo.nullable(),accountCredits:ts.optional(),accountCreditsSupported:B().optional()}).strict();let ns=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),rs=H({id:ns.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),is=ns.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),as=ns.max(256),os=H({id:is,label:ns.max(256)}).strict(),ss=H({ref:rs,label:ns.max(256),resolvedModelLabel:as.optional(),fastModel:rs.optional(),supportedThinkingOptionIds:V(is).optional()}).strict(),cs=V(os).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)}),ls=H({models:V(ss),defaultModel:rs.optional(),thinkingOptions:cs,defaultThinkingOptionId:is.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`]})}),us=H({fork:B(),forkAcrossCwd:B(),rollbackLastTurn:B()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ds=W([`live`,`atCreate`]),fs=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:ds.default(`live`)}).strict(),history:us,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),input:H({image:B()}).strict().optional(),steer:B().optional()}).strict();H({effectiveModel:rs.optional(),resolvedModelLabel:as.optional(),effectiveThinkingOptionId:is.optional(),availableThinkingOptions:cs.optional(),effectivePermissionModeId:Ho.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 ps=H({open:G(!0)}).strict();Ha([H({status:G(`ready`),catalog:ls,permissionModes:Uo.optional(),capabilities:fs,webUi:ps.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:No}).strict()]),H({harnessId:zo,cwd:ns.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional()}).strict(),H({harnessId:zo}).strict(),H({}).strict(),H({threadId:K,model:rs}).strict(),H({threadId:K,thinkingOptionId:is}).strict(),H({threadId:K,includeReferenceCapability:B().optional()}).strict(),Wa(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:rs.optional(),resolvedModelLabel:as.optional(),effectiveThinkingOptionId:is.optional(),effectivePermissionModeId:Ho.optional(),history:us.optional(),supportsThreadReferences:G(!0).optional()}).strict(),H({owner:G(`external`),harnessId:ns.max(256),transportModelId:ns.max(1024),effectiveModel:rs.optional(),resolvedModelLabel:as.optional(),effectiveThinkingOptionId:is.optional(),availableThinkingOptions:cs.optional(),effectivePermissionModeId:Ho.optional(),history:us,usage:Yo.optional(),subagent:B().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(zo)}).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:Bo,clientUserMessageId:L().min(1),delivery:W([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),W([`activeTurn`,`newTurn`]),H({delivery:W([`official`,`activeTurn`,`newTurn`])}).strict(),H({threadIds:V(L().min(1))}).strict(),H({threadId:L().min(1).max(1024),pinned:B()}).strict(),H({prompt:L().max(16384).optional()}).strict(),H({projects:V(H({id:L(),name:L(),rootPaths:V(L())})),assignments:Xa(L(),L()),projectless:V(L()),pinned:V(L())});let hs=Xa(L(),Ia()),gs=H({epoch:L().uuid(),sequence:z().int().nonnegative()});Wa(`type`,[H({type:G(`skills-changed`),cursor:gs,cwd:L().optional()}),H({type:G(`display-settings-changed`),cursor:gs}),H({type:G(`preferences-changed`),cursor:gs,revision:z().int().nonnegative()}),H({type:G(`hello`),version:G(1),cursor:gs,reset:B()}),H({type:G(`changed`),cursor:gs,threadId:L().min(1),method:L().min(1)})]);let _s=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()}))})]),vs=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(_s)})]),ys=H({requestId:Ha([L(),z().int()]),threadId:L(),kind:W([`approval`,`question`]),interaction:vs,request:hs}),bs=H({id:L().min(1),clientUserMessageId:L().min(1),input:V(hs),presentationInput:V(hs).nullable().optional()}).passthrough();H({fields:V(H({path:V(Ha([L(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let xs=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(),Ss=H({id:L().min(1).max(512),fingerprint:L().min(1).max(128)});H({threadId:L().min(1),knownTurns:V(Ss).max(64).optional(),truncateToolOutput:B().optional()});let Cs=H({harnessId:L().min(1),nativeSessionId:L().min(1)});H({cursor:gs,activeTurnId:L().min(1).nullable().optional(),command:H({name:L().min(1),turn:xs}).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:Cs.optional(),turns:V(xs).length(0)}).passthrough(),turnsPage:H({data:V(xs).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:rs.optional(),effectiveThinkingOptionId:is.optional(),effectivePermissionModeId:Ho.optional()}),queue:H({items:V(bs),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(ys)}),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:hs}),H({includeArchived:B().optional(),officialCursor:H({live:L().nullable(),archived:L().nullable().optional()}).strict().optional()}).strict(),H({threads:V(Mo),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),Ts=H({available:B()}).strict();H({path:L().min(1),mimeType:ws}).strict();let Es=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]),Ds=Wa(`ok`,[H({ok:G(!0),text:L()}).strict(),H({ok:G(!1),error:H({code:Es}).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 Os=H({name:L().min(1).regex(/^[^\s[\]]+$/u),description:L().optional(),path:L().min(1),scope:W([`project`,`global`]),source:L().min(1)}).strict(),ks=H({revision:z().int().nonnegative(),complete:B(),skills:V(Os),warnings:V(L()).optional()}).strict();H({cwd:L().min(1).optional()}).strict();let As=`codexhost-skill`;function js(e){let t=/[\s()]/u.test(e.path)?`<${e.path}>`:e.path;return`[$${e.name}](${t} "Read this skill")`}let Ms=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:L().min(1)}).strict(),Ns=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()})]),Ps=H({state:Ns,error:L().optional()}).strict(),Fs=Wa(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:L()})]),Is=H({lan:B(),autostart:Fs}).strict(),Ls=H({expiresAt:L().optional(),issuing:B(),failure:H({detail:L().optional(),retryAt:L(),paused:B()}).optional()}),Rs=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:Ls}),H({status:G(`missing-certificate`),url:L(),certificate:Ls}),H({status:G(`stopped`),reason:W([`replaced`,`rejected`,`unsupported-version`])})]),zs=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()),Bs=L().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),Vs=W([`official`,`self-hosted`]),Hs=H({secret:L().min(1),lastUsedAt:z().nullable(),networkUrls:V(Ms),directCandidates:V(Ms).optional(),tailscale:Ns,background:Is.optional(),relay:H({state:Rs,enabled:B(),kind:Vs,officialHost:L(),customHost:L().optional(),officialHostname:L().optional(),customHostname:L().optional(),quotaUntil:L().optional()}).strict().optional()}).strict(),Us=H({url:L()}).strict(),Ws=U({threadId:L().min(1).max(1024),view:W([`result`,`messages`]),cursor:L().min(1).max(8192).optional(),limit:z().int().min(1).max(100).optional()}),Gs=H({id:L().min(1).max(256),harnessId:L().min(1),label:L().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),Ks=L().regex(/^[a-z][a-z0-9-]{0,47}$/),qs=H({name:Ks,source:Gs,importedAt:L()}).strict(),Js=Wa(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:L().min(1).max(256),name:Ks,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:L().min(1).max(256),name:Ks,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:Ks,confirmed:G(!0)}).strict()]),Ys=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(Gs),targets:V(H({harnessId:L(),providers:V(W([`openai-codex`,`xai`])),imports:V(qs),others:V(Ys).default([])}).strict())}).strict(),H({targetHarnessId:L().min(1).max(128).optional(),request:Js}).strict(),H({events:B()});let Xs=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:Xs.nullable()}),U({}),U({entries:Xs,initializeOnly:B().optional()});let Zs=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let Qs=L().regex(/^external$/u),$s=zo.transform(e=>String(e)),ec=U({model:rs.optional(),thinkingOptionId:is.optional(),permissionModeId:Ho.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),tc=U({lastHarness:zo.optional(),byHarness:Xa($s,ec)}),nc=L().min(1).max(1024),rc=U({idleRelease:Zs.optional(),favorites:Xa($s,V(nc).max(2048)).default({}),newThread:tc.optional()});U({scope:Qs,revision:z().int().nonnegative(),values:rc}),U({scope:Qs.default(`external`)});let ic=Wa(`kind`,[U({kind:G(`idleRelease`),value:Zs}),U({kind:G(`favorite`),harnessId:zo,modelId:nc,enabled:B()}),U({kind:G(`favorites`),harnessId:zo,modelIds:V(nc).max(2048)}),U({kind:G(`newThread`),lastHarness:zo.optional(),harnessId:zo.optional(),configuration:ec.optional()})]);U({scope:Qs.default(`external`),operations:V(ic).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(Qs,rc)});let ac=z().finite().nonnegative(),oc=U({input:ac,output:ac,cacheRead:ac.optional(),cacheWrite:ac.optional(),cacheWrite1h:ac.optional()}),sc=L().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:L(),entries:V(U({key:L(),price:oc})),error:L().nullable()}),U({}),U({key:sc,price:oc.nullable(),previousKey:sc.optional()}),U({model:sc});let cc=U({official:B().optional(),canonicalModelId:L().min(1).optional(),provider:L().min(1).max(512),model:L().min(1).max(512),price:oc});U({price:oc.nullable(),suggestions:V(cc).max(6).optional()});let lc=[`today`,`7d`,`30d`,`90d`,`all`],uc=z().int().min(0).max(2**53-1),dc=L().regex(/^\d{4}-\d{2}-\d{2}$/u),fc=L().min(1).max(128),pc=L().min(1).max(512),mc=L().min(1).max(4096);U({range:W(lc),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:fc.optional(),model:pc.nullable().optional(),project:mc.nullable().optional(),date:dc.optional()});let hc=U({requests:uc,inputTokens:uc,cachedInputTokens:uc,cacheWriteInputTokens:uc,cacheKnownInputTokens:uc,cacheHitCachedInputTokens:uc,cacheHitInputTokens:uc,outputTokens:uc,reasoningOutputTokens:uc,costUsd:z().finite().min(0),unpricedRequests:uc,unmeteredRequests:uc}),gc=hc.shape,_c=U({harness:fc,sessionId:L().min(1).max(512),project:mc.nullable(),title:L().min(1).max(200).optional(),models:V(pc).max(16),firstAtMs:uc,lastAtMs:uc,...gc});U({range:W(lc),from:dc.nullable(),to:dc,filters:U({harness:fc.nullable(),model:pc.nullable(),unknownModel:B(),project:mc.nullable(),unknownProject:B(),date:dc.nullable()}),reading:U({complete:B(),sources:uc,read:uc}),failures:V(U({harness:fc,message:L().max(2048)})).max(256),options:U({harnesses:V(fc).max(256),models:V(pc.nullable()).max(4096),projects:V(mc.nullable()).max(4096)}),modelLabels:V(U({harness:fc,model:pc,label:pc})).max(4096).optional(),credits:V(U({harness:fc,model:pc.nullable(),credits:z().finite().min(0),reportedRequests:uc,requests:uc})).max(4096).optional(),totals:hc,daily:V(U({date:dc,harness:fc,...gc})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...gc})).max(168),byHarness:V(U({harness:fc,...gc})).max(256),byModel:V(U({model:pc.nullable(),...gc,harnessPricedRequests:uc})).max(4096),byProject:V(U({project:mc.nullable(),...gc})).max(4096),sessions:V(_c).max(100),recentSessions:V(_c).max(100).optional()}),H({threadId:K}),H({discarded:B()});let vc=Wa(`type`,[H({id:L().min(1),type:G(`choice`),prompt:L(),options:V(H({value:L().min(1),label:L(),description:L().optional()})).min(1),multiple:B(),allowOther:B(),optional:B()}),H({id:L().min(1),type:G(`text`),prompt:L(),multiline:B(),secret:G(!1),optional:B(),placeholder:L().optional(),prefill:L().optional()})]),yc=H({interactionId:L().min(1),turnId:L().min(1),title:L().optional(),questions:V(vc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});U({threadId:L().min(1)}),H({questions:V(yc)}),U({threadId:L().min(1),turnId:L().min(1),interactionId:L().min(1),answers:Xa(L(),V(L())),cancelled:B().default(!1)}),H({accepted:G(!0)});let bc=H({path:L(),oldText:L().nullable(),newText:L()});H({sessionId:L().min(1),turn:z().int().nonnegative(),path:L().min(1).optional()});let xc=H({diffs:V(bc)});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()});let Sc=L().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(zo),Cc=Sc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),wc=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`),Tc=pa().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Ec=H({en:L().max(4096),"zh-CN":L().max(4096).optional()}).strict(),Dc=H({commands:V(H({terminal:L().max(256),command:L().max(4096)}).strict()).max(8),before:Ec.optional(),after:Ec.optional(),downloads:V(H({label:L().max(128),url:Tc}).strict()).max(8).optional()}).strict(),Oc={id:Sc,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:Dc.optional(),notice:Ec.optional(),launchCommand:G(!0).optional(),links:H({website:Tc.optional(),documentation:Tc.optional(),installation:Tc.optional()}).strict().optional()};H({manifestVersion:G(1),...Oc,adapterApiVersion:z().int().positive(),entry:wc,icon:wc.optional()}).strict();let kc=L().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Ac=H({...Oc,icon:kc.optional()}).strict();H({}).strict(),H({plugins:V(Ac.extend({id:Cc})).max(128)}).strict(),H({version:G(1),enabled:V(Sc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),H({harnessId:Cc}).strict().extend({enabled:B()}),H({enabled:B()}).strict(),U({title:L().trim().min(1).max(200),type:W([`info`,`warning`,`danger`]),body:L().trim().min(1).max(16384)}),U({}),U({url:L().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/long-context/get.codexhost/harness/long-context/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=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Mc=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:L(),title:L(),harnessId:L(),state:jc,reason:Mc,inactiveMs:z().nonnegative()}),U({threadId:K,turnId:Bo});let Nc=H({amount:z().finite().nonnegative(),currency:L().trim().min(1).max(8),label:L().trim().min(1).max(128).optional()}).strict(),Pc=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:ts.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:zo,harnessName:L().trim().min(1).max(128)},Rc=H(Lc).strict();H({}).strict(),H({sources:V(Rc).max(128)}).strict(),H({harnessId:zo,refresh:B().optional()}).strict(),H({...Lc,account:Ic.nullable(),accounts:V(Ic).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Fc(Pc.extend(Lc))).max(128)}).strict(),H({harnessId:Cc,model:rs.optional(),thinkingOptionId:is.optional(),permissionModeId:Ho.optional(),prewarm:G(!0).optional()}).strict();let zc=L().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:Cc}).strict().extend({path:zc.nullable()}),H({path:zc.nullable(),restartRequired:B()}).strict(),H({harnessId:zo,action:W([`check`,`update`,`install`])}).strict();let Bc=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:Lo.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:Bc}).strict(),H({taskId:L().uuid(),status:G(`failed`),error:H({code:z().int(),message:L().min(1).max(2048)}).strict()}).strict()]);let Vc=L().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Hc=L().trim().min(1),Uc=W([`api`,`chatgpt`]),Wc=/^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;function Gc(e){return e.length>0&&e.length<=2048&&Wc.test(e)}H({url:L().max(2048).refine(Gc,`External URL must be http(s)`)}).strict(),H({}).strict();let Kc=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`]),qc=H({accountId:Vc,label:Hc.max(256),email:L().email().max(320).optional(),planType:Kc.optional(),authKind:Uc.optional(),authIdentity:Hc.max(256).optional(),siteUrl:L().refine(Gc,`Account site URL must be http(s)`).optional()}).strict(),Jc=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Vc.nullable(),phase:Jc,revision:z().int().nonnegative(),instanceId:Hc.max(1024).optional(),accounts:V(qc).max(1)}).strict(),H({accountId:Vc,refresh:B().optional()}).strict(),H({accountId:Vc,usage:Yo.nullable(),accountCredits:ts.optional(),freshness:W([`live`,`cached`]),observedAt:L().datetime().nullable()}).strict();let Yc=1e3,Xc=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Zc=Xc.max(1024),Qc=H({nativeSessionId:Zc,title:Xc.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:Xc.max(16384),running:B().nullable()}).strict();H({}).strict();let $c=H({harnesses:V(H({harnessId:Cc,name:Xc.max(128)}).strict()).max(128)}).strict();H({harnessId:Cc,query:L().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(Yc).optional()}).strict();let el=H({candidates:V(Qc).max(Yc),total:z().int().nonnegative().safe()}).strict();H({harnessId:Cc,nativeSessionId:Zc}).strict();let tl=H({threadId:Xc.max(1024).pipe(K)}).strict(),nl=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),rl=Zc,il=Qc;H({}).strict(),H({candidates:V(il).max(1e3)}).strict(),H({nativeSessionId:rl}).strict(),H({threadId:nl.max(1024).pipe(K)}).strict(),H({threadId:K,lastTurnId:Bo}).strict(),H({threadId:K}).strict();let al=L().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:al,invocation:L().min(1).max(128),label:L().trim().min(1).max(128),description:L().trim().min(1).max(512).optional(),localizations:Io.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:zo,cwd:L().min(1).optional()}).strict(),H({threadId:K}).strict(),H({threadId:K,commandId:al,turnId:Bo.optional(),arguments:Mo.optional()}).strict(),H({accepted:G(!0),turnId:Bo.optional()}).strict();let ol=G(`2.0`).optional(),sl=Ra().optional(),cl=L().min(1),ll=Ha([L(),z().int()]),ul=H({code:z().int(),message:L(),data:jo.optional()}).catchall(jo).superRefine(Eo([`data`]));Ha([H({jsonrpc:ol,id:ll,method:cl,params:jo.optional(),result:sl,error:sl}).catchall(jo).superRefine(Eo([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:ol,id:sl,method:cl,params:jo.optional(),result:sl,error:sl}).catchall(jo).superRefine(Eo([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:ol,id:ll,method:sl,params:sl,result:jo,error:sl}).catchall(jo).superRefine(Eo([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:ol,id:ll,method:sl,params:sl,result:sl,error:ul}).catchall(jo).superRefine(Eo([`jsonrpc`,`method`,`params`,`result`]))]);let dl=L().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:zo,nativeSessionId:dl,locator:jo.optional(),formatVersion:G(1)}).superRefine(Eo([`locator`])),U({harnessId:zo,nativeSessionId:dl,nativeTurnKey:dl,formatVersion:G(1)}),U({harnessId:zo,nativeSessionId:dl,checkpointId:dl,locator:jo.optional(),formatVersion:G(1)}).superRefine(Eo([`locator`]));let fl=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`]),ml=U({version:fl,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 hl=L().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);U({currentVersion:fl,installation:pl.nullable(),latestVersion:fl.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:L().min(1).max(2e4).nullable(),releaseNotesUrl:hl.nullable(),status:ml.nullable(),error:L().min(1).max(500).nullable()}),U({status:ml}),U({status:ml.nullable()});let gl=/^[a-z0-9][a-z0-9-]*$/u;function _l(e){if(!gl.test(e))throw Error(`Invalid delegation mention Harness id: ${e}`);return`subagent://codexhost.${e}`}function vl(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function yl(e){return`[@${vl(e.label)}](${_l(e.harnessId)})`}function bl(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 xl=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:L().nullable(),installedVersion:L().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:xl,targetVersion:L().nullable(),error:L().nullable()})});let Sl=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 Cl=L().min(1).max(1024),wl={hostId:Cl.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Tl={...wl,threadId:Cl},El=Wa(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`list`),...wl,cursor:L().nullable(),archived:B()}),U({kind:G(`read`),...Tl}),U({kind:G(`configure`),...Tl,epoch:Cl,modelId:Cl.optional(),thinkingOptionId:Cl.optional(),permissionModeId:Cl.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`),...Tl,epoch:Cl,text:L().min(1).max(8e3),requestId:Cl.optional()}),U({kind:G(`interrupt`),...Tl,epoch:Cl,turnId:Cl}),U({kind:G(`rename`),...Tl,epoch:Cl,name:L().min(1).max(512)}),U({kind:G(`archive`),...Tl,epoch:Cl,archived:B()}),U({kind:G(`respond`),...Tl,epoch:Cl,requestId:Ha([Cl,z().int()]),result:Xa(L(),Ia())})]),Dl=L().min(1).max(1024),Ol=H({hostId:Dl,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()}),kl=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:El}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:Dl.refine(e=>e!==`local`),input:Ws}),U({action:G(`save`),draft:kl,previous:Ol.nullable()}),U({action:G(`remove`),previous:Ol}),U({action:G(`connect`),hostId:Dl,enabled:B()}),U({action:G(`state`),hostId:Dl}),U({action:G(`runtime`),hostId:Dl}),U({action:G(`update`),hostId:Dl.refine(e=>e!==`local`),version:Sl.shape.version})]),Ha([U({result:jo}),U({error:U({code:z().int(),message:L()})})]);let Al=L().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),jl=Ha([L(),H({en:L()}).catchall(L())]),Ml=H({title:jl.optional(),description:jl.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()}),Nl=H({extensions:V(H({id:Al,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:Ml.optional(),loadError:L().optional()})),loadedIds:V(Al),safeMode:B(),storeError:L().optional()}),Pl=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:Pl.optional()}).strict(),H({id:Al,enabled:B()}).strict(),H({id:Al}).strict(),G(1);function Fl(){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 Il=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function Ll(e){return typeof e==`string`&&Il.some(t=>t===e)}var Rl=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:Fl(),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 Rl(e,t,n)}return r.result.value}let zl={status:async()=>Ts.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 Ds.parse(await n.json())}},Bl=2e4,Vl=(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})}),Hl={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await Ul(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await Vl(500,e)}}};async function Ul(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(Bl),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(Ll(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(Bl),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 Wl(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 Gl={relay:async(e,t)=>Rs.parse(await q(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>q(`codexhost/lanSet`,{enabled:e}),autostart:async e=>Fs.parse(await q(`codexhost/autostartSet`,{enabled:e})),serve:async e=>Ps.parse(await q(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>Hs.parse(await q(`codexhost/accessTokenGet`,{})),regenerate:async()=>Hs.parse(await q(`codexhost/accessTokenRegenerate`,{}))},Kl={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`,{})},ql={sources:async()=>$c.parse(await q(`codexhost/importSources`,{})),candidates:async e=>el.parse(await q(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>tl.parse(await q(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},Jl={read:async(e,t,n)=>xc.parse(await q(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},Yl={send:(e,t,n)=>q(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},Xl={list:async e=>ks.parse(await q(`codexhost/skills/list`,{sessionId:e}))},Zl={inspect:e=>q(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>q(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},Ql=`codexhost-native`;function $l(e){let t=bl(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:Ql,ref:n,label:e,clipboardText:n}}let eu=`codexhost-delegation`;function tu(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([Zl.inspect(t),e.commandUi.reservedNames({sessionId:t})]).then(([e,t])=>({catalog:e,reserved:t}))},n.set(t,i)),i},_=({sessionId:t},r)=>{c.add(r);let i=e.sessions.list.subscribe(r),a=e.modelDirectories.harnessCatalog.subscribe(r);return()=>{c.delete(r),i(),a(),n.delete(t)}};e.effect(()=>t.generation.subscribe(()=>{s++,n.clear(),u()}),`ui-codexhost: browser connection generation`),e.effect(()=>e.sessions.list.subscribe(()=>{let t=!1,r=e.sessions.list.getSnapshot().byId;for(let[e,i]of n)i.connection!==r[e]?.projectionValues?.nativeConnection?.state&&(n.delete(e),t=!0);t&&u()}),`ui-codexhost: discovery connection generation`);let v=(t,n)=>{let r=t.session.sessionId,i=p(r);if(!d(r)||i){h(r,i??l(`discovery.stale`));return}let a=e.sessions.scope(r),s=m(r);a&&s?.state.getSnapshot().draftRev===t.span.draftRev&&(t.span.start===t.span.end||a.bail(a,`slash/input-consume-token`,{guard:{kind:`span`,span:t.span}})===!0)&&(o.add(r),u(),Zl.execute(r,n).catch(e=>h(r,`${l(`discovery.unconfirmed`)} ${e instanceof Error?e.message:String(e)}`)).finally(()=>{o.delete(r),u()}))};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`#`,`@`],name:Ql,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:$l(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:eu,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=yl({harnessId:n.id,label:n.name});return{insert:{source:eu,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function nu(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:Xl.list(e)},n.set(e,r)),r};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`@`,`#`],name:As,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(`
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():te(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():te(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)}function Eo(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 Do=Ha([L(),z(),B(),Pa()]);function Oo(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 ko=Co(Oo,{message:`JSON value must not contain circular references`}),Ao=xo(()=>Ha([Do,V(Ao),Xa(L(),Ao)])),jo=ko.pipe(Ao);ko.pipe(V(Ao));let Mo=ko.pipe(Xa(L(),Ao)),No=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(Eo([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Po=L().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Fo=e=>L().min(1).max(e).refine(e=>e.trim().length>0),Io=Xa(Po,H({label:Fo(256).optional(),description:Fo(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Lo=Xa(Po,Fo(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`);function Ro(e,t){if(!e)return;let n=t.split(`-`)[0]??t;for(let r of[t,n])if(Object.hasOwn(e,r))return e[r]}function zo(e,t){let n=Ro(e.localizations,t),r=Ro(e.localizations,t.split(`-`)[0]??t);return{label:n?.label??r?.label??e.label,description:n?.description??r?.description??e.description}}let Bo=L().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Vo=Bo.brand(),K=Bo.brand(),Ho=Bo.brand();Bo.brand(),Bo.brand();let Uo=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Wo=Uo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Go=H({modes:V(H({id:Wo,label:Uo.max(256),description:Uo.max(1024).optional(),dangerous:B().optional(),localizations:Io.optional()}).strict()).min(1).max(32),defaultModeId:Wo}).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:Wo}).strict();let Ko=z().int().safe().nonnegative(),qo=z().finite().nonnegative(),Jo=z().finite().min(0).max(100),Yo=H({version:Ha([G(3),G(4)]).optional(),requestId:L().min(1),turnId:L().min(1).max(1024),outputTokens:Ko,startedAtMs:Ko,completedAtMs:Ko}).strict().refine(e=>e.completedAtMs>e.startedAtMs),Xo=H({version:Ha([G(2),G(3),G(4)]).optional(),value:qo,turnId:L().min(1).max(1024),at:Ko}).strict();H({outputTimings:V(Yo).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:Xo.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:Xo.extend({value:Ko}).optional()}).strict();let Zo=e=>Lo.refine(t=>Object.values(t).every(t=>t.length<=e)),Qo=H({composerIndicators:V(H({kind:G(`countdown`),id:L().min(1).max(64),expiresAtUnix:Ko,label:Zo(256).optional(),tooltip:Zo(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:Ko.optional(),cachedInputTokens:Ko.optional(),cacheWriteInputTokens:Ko.optional(),outputTokens:Ko.optional(),outputTokensPerSecond:qo.optional(),sessionOutputTokensPerSecond:qo.optional(),apiOutputTokensPerSecond:qo.optional(),reasoningOutputTokens:Ko.optional(),totalTokens:Ko.optional(),totalCostUsd:qo.optional(),totalCredits:qo.optional(),contextUsagePercent:qo.optional(),cacheHitRatePercent:Jo.optional(),contextWindowTokens:Ko.optional(),contextUsedTokens:Ko.optional(),planFiveHourUsedPercent:Jo.optional(),planFiveHourResetsAtUnix:Ko.optional(),planSevenDayUsedPercent:Jo.optional(),planSevenDayResetsAtUnix:Ko.optional(),sessionCacheHitRatePercent:Jo.optional(),timeToFirstOutputMs:Ko.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`]})}),$o=z().finite().min(0).max(100),es=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ts=H({id:L().min(1).max(256),label:L().min(1).max(256),localizations:Io.optional()}).strict(),ns=H({product:L().min(1),periodType:es.optional(),scope:ts.optional(),localizations:Io.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),usagePercent:$o,resetsAt:L().min(1).optional()}).strict(),rs=H({availableCount:z().int().safe().positive(),nextExpiresAt:L().min(1).optional(),expiresAt:V(L().min(1)).min(1).max(32).optional()}).strict(),is=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().trim().min(1).max(32).optional(),label:L().min(1).optional(),usedPercent:$o.optional(),remaining:z().finite().optional(),scope:ts.optional(),localizations:Io.optional(),resetsAt:L().min(1).optional(),periodType:es,productUsage:V(ns).min(1).optional(),resetCredits:rs.optional()}).strict().superRefine((e,t)=>{e.usedPercent===void 0&&e.remaining===void 0&&t.addIssue({code:`custom`,message:`Account credits must include usedPercent or remaining`}),e.remaining!==void 0&&!e.unit&&t.addIssue({code:`custom`,message:`Account remaining credits require a unit`,path:[`unit`]})});H({threadId:K,refresh:G(`exact`).optional()}).strict(),H({threadId:K,usage:Qo.nullable(),accountCredits:is.optional(),accountCreditsSupported:B().optional()}).strict();let as=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),os=H({id:as.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),ss=as.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),cs=as.max(256),ls=H({id:ss,label:as.max(256)}).strict(),us=H({ref:os,label:as.max(256),resolvedModelLabel:cs.optional(),fastModel:os.optional(),supportedThinkingOptionIds:V(ss).optional()}).strict(),ds=V(ls).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)}),fs=H({models:V(us),defaultModel:os.optional(),thinkingOptions:ds,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`]})}),ps=H({fork:B(),forkAcrossCwd:B(),rollbackLastTurn:B()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ms=W([`live`,`atCreate`]),hs=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:ms.default(`live`)}).strict(),history:ps,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),input:H({image:B()}).strict().optional(),steer:B().optional()}).strict();H({effectiveModel:os.optional(),resolvedModelLabel:cs.optional(),effectiveThinkingOptionId:ss.optional(),availableThinkingOptions:ds.optional(),effectivePermissionModeId:Wo.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 gs=H({open:G(!0)}).strict();Ha([H({status:G(`ready`),catalog:fs,permissionModes:Go.optional(),capabilities:hs,webUi:gs.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:No}).strict()]),H({harnessId:Vo,cwd:as.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional()}).strict(),H({harnessId:Vo}).strict(),H({}).strict(),H({threadId:K,model:os}).strict(),H({threadId:K,thinkingOptionId:ss}).strict(),H({threadId:K,includeReferenceCapability:B().optional()}).strict(),Wa(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:os.optional(),resolvedModelLabel:cs.optional(),effectiveThinkingOptionId:ss.optional(),effectivePermissionModeId:Wo.optional(),history:ps.optional(),supportsThreadReferences:G(!0).optional()}).strict(),H({owner:G(`external`),harnessId:as.max(256),transportModelId:as.max(1024),effectiveModel:os.optional(),resolvedModelLabel:cs.optional(),effectiveThinkingOptionId:ss.optional(),availableThinkingOptions:ds.optional(),effectivePermissionModeId:Wo.optional(),history:ps,usage:Qo.optional(),subagent:B().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 _s=Wa(`owner`,[H({threadId:K,owner:G(`codex`)}).strict(),H({threadId:K,owner:G(`external`),harnessId:L().max(256).pipe(Vo)}).strict()]);H({threads:V(_s).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:Ho,clientUserMessageId:L().min(1),delivery:W([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),W([`activeTurn`,`newTurn`]),H({delivery:W([`official`,`activeTurn`,`newTurn`])}).strict(),H({threadId:K}).strict(),H({confirmed:B()}).strict(),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 vs=Xa(L(),Ia()),ys=H({epoch:L().uuid(),sequence:z().int().nonnegative()});Wa(`type`,[H({type:G(`skills-changed`),cursor:ys,cwd:L().optional()}),H({type:G(`harness-inspection-changed`),cursor:ys,harnessId:L().min(1)}),H({type:G(`display-settings-changed`),cursor:ys}),H({type:G(`preferences-changed`),cursor:ys,revision:z().int().nonnegative()}),H({type:G(`hello`),version:G(1),cursor:ys,reset:B()}),H({type:G(`changed`),cursor:ys,threadId:L().min(1),method:L().min(1)})]);let bs=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()}))})]),xs=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(bs)})]),Ss=H({requestId:Ha([L(),z().int()]),threadId:L(),kind:W([`approval`,`question`]),interaction:xs,request:vs}),Cs=H({id:L().min(1),clientUserMessageId:L().min(1),input:V(vs),presentationInput:V(vs).nullable().optional()}).passthrough();H({fields:V(H({path:V(Ha([L(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let ws=H({id:L().min(1),status:L().min(1),codexhostTurnOutcome:H({status:G(`unknown`),reason:L()}).optional(),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(),Ts=H({id:L().min(1).max(512),fingerprint:L().min(1).max(128)});H({threadId:L().min(1),knownTurns:V(Ts).max(64).optional(),truncateToolOutput:B().optional()});let Es=H({harnessId:L().min(1),nativeSessionId:L().min(1)});H({cursor:ys,activeTurnId:L().min(1).nullable().optional(),command:H({name:L().min(1),turn:ws,subsequentTurnId:L().min(1).optional()}).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:Es.optional(),turns:V(ws).length(0)}).passthrough(),turnsPage:H({data:V(ws).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:os.optional(),effectiveThinkingOptionId:ss.optional(),effectivePermissionModeId:Wo.optional()}),queue:H({items:V(Cs),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(Ss)}),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:vs}),H({includeArchived:B().optional(),officialCursor:H({live:L().nullable(),archived:L().nullable().optional()}).strict().optional()}).strict(),H({threads:V(Mo),ownership:V(_s),archivedThreadIds:V(K),officialCursor:H({live:L().nullable(),archived:L().nullable().optional()}).strict().optional()}).strict();let Ds=L().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i),Os=H({available:B()}).strict();H({path:L().min(1),mimeType:Ds}).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`]),As=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(),Ms=H({revision:z().int().nonnegative(),complete:B(),skills:V(js),warnings:V(L()).optional()}).strict();H({cwd:L().min(1).optional()}).strict();let Ns=`codexhost-skill`;function Ps(e){let t=/[\s()]/u.test(e.path)?`<${e.path}>`:e.path;return`[$${e.name}](${t} "Read this skill")`}let Fs=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:L().min(1)}).strict(),Is=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()})]),Ls=H({state:Is,error:L().optional()}).strict(),Rs=Wa(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:L()})]),zs=H({lan:B(),autostart:Rs}).strict(),Bs=H({expiresAt:L().optional(),issuing:B(),failure:H({detail:L().optional(),retryAt:L(),paused:B()}).optional()}),Vs=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:Bs}),H({status:G(`missing-certificate`),url:L(),certificate:Bs}),H({status:G(`stopped`),reason:W([`replaced`,`rejected`,`unsupported-version`])})]),Hs=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()),Us=L().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),Ws=W([`official`,`self-hosted`]),Gs=H({secret:L().min(1),lastUsedAt:z().nullable(),networkUrls:V(Fs),directCandidates:V(Fs).optional(),tailscale:Is,background:zs.optional(),relay:H({state:Vs,enabled:B(),kind:Ws,officialHost:L(),customHost:L().optional(),officialHostname:L().optional(),customHostname:L().optional(),quotaUntil:L().optional()}).strict().optional()}).strict(),Ks=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()}),qs=H({id:L().min(1).max(256),harnessId:L().min(1),label:L().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),Js=L().regex(/^[a-z][a-z0-9-]{0,47}$/),Ys=H({name:Js,source:qs,importedAt:L()}).strict(),Xs=Wa(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:L().min(1).max(256),name:Js,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:L().min(1).max(256),name:Js,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:Js,confirmed:G(!0)}).strict()]),Zs=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(qs),targets:V(H({harnessId:L(),providers:V(W([`openai-codex`,`xai`])),imports:V(Ys),others:V(Zs).default([])}).strict())}).strict(),H({targetHarnessId:L().min(1).max(128).optional(),request:Xs}).strict(),H({events:B()});let Qs=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:Qs.nullable()}),U({}),U({entries:Qs,initializeOnly:B().optional()});let $s=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let ec=L().regex(/^external$/u),tc=Vo.transform(e=>String(e)),nc=U({model:os.optional(),thinkingOptionId:ss.optional(),permissionModeId:Wo.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),rc=U({lastHarness:Vo.optional(),byHarness:Xa(tc,nc)}),ic=L().min(1).max(1024),ac=U({idleRelease:$s.optional(),favorites:Xa(tc,V(ic).max(2048)).default({}),newThread:rc.optional()});U({scope:ec,revision:z().int().nonnegative(),values:ac}),U({scope:ec.default(`external`)});let oc=Wa(`kind`,[U({kind:G(`idleRelease`),value:$s}),U({kind:G(`favorite`),harnessId:Vo,modelId:ic,enabled:B()}),U({kind:G(`favorites`),harnessId:Vo,modelIds:V(ic).max(2048)}),U({kind:G(`newThread`),lastHarness:Vo.optional(),harnessId:Vo.optional(),configuration:nc.optional()})]);U({scope:ec.default(`external`),operations:V(oc).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(ec,ac)});function sc(e,t,n){if(e.periodType&&e.periodType!==`unknown`&&(e.scope||!e.label)){let r=n(e.periodType);return e.scope?`${zo(e.scope,t).label} · ${r}`:r}return zo({label:e.label??e.product??n(`unknown`),...e.localizations?{localizations:e.localizations}:{}},t).label}function cc(e){return e===`five_hour`?0:e===`seven_day`?1:e===`weekly`?2:e===`monthly`?3:4}function lc(e,t,n,r=n){let i=[{label:e.label,periodType:e.periodType,scope:e.scope,localizations:e.localizations,usedPercent:e.usedPercent,used:e.used,limit:e.limit,unit:e.unit,resetsAt:e.resetsAt,isPrimary:!0},...(e.productUsage??[]).map(e=>({product:e.product,periodType:e.periodType,scope:e.scope,localizations:e.localizations,usedPercent:e.usagePercent,used:e.used,limit:e.limit,unit:e.unit,resetsAt:e.resetsAt,isPrimary:!1}))],a=/* @__PURE__ */ new Map;for(let e of i)e.scope&&a.set(e.scope.id,(a.get(e.scope.id)??0)+1);let o=/* @__PURE__ */ new Map;for(let e of i){let i=e.scope&&(a.get(e.scope.id)??0)>=2?e.scope:void 0,s=i?`scope:${i.id}`:`default`,c=o.get(s);c||(c=i?{id:i.id,title:zo(i,t).label,windows:[]}:{windows:[]},o.set(s,c));let l=!i&&e.scope&&e.periodType&&e.periodType!==`unknown`?zo(e.scope,t).label:void 0,u=i&&e.periodType&&e.periodType!==`unknown`?r(e.periodType):l&&e.periodType&&e.periodType!==`unknown`?n(e.periodType):sc(e,t,n);c.windows.push({order:i?cc(e.periodType):0,window:{label:u,...l?{scopeLabel:l}:{},usedPercent:e.usedPercent??0,...e.used===void 0?{}:{used:e.used},...e.limit===void 0?{}:{limit:e.limit},...e.unit===void 0?{}:{unit:e.unit},...e.resetsAt===void 0?{}:{resetsAt:e.resetsAt},isPrimary:e.isPrimary}})}return[...o.values()].map(({windows:e,...t})=>({...t,windows:(t.title===void 0?e:[...e].sort((e,t)=>e.order-t.order)).map(e=>e.window)}))}function uc(e,t){let n=typeof e==`number`?e*1e3:Date.parse(e);return Number.isFinite(n)?Math.max(0,Math.ceil((n-t)/6e4)):null}function dc(e){return e===`zh-CN`||e.startsWith(`zh-`)}function fc(e){if(e>=1440){let t=Math.floor(e/1440),n=Math.floor(e%1440/60);return n>0?`${t}d${n}h`:`${t}d`}let t=Math.floor(e/60),n=e%60;return t>0?n>0?`${t}h${n}m`:`${t}h`:`${n}m`}function pc(e,t,n=Date.now()){let r=uc(e,n);if(r===null)return null;let i=dc(t);if(r===0)return i?`即将重置`:`Resets soon`;if(r>=1440){let e=Math.floor(r/1440),t=Math.floor(r%1440/60);return i?t>0?`${e} 天 ${t} 小时后重置`:`${e} 天后重置`:t>0?`Resets in ${e}d ${t}h`:`Resets in ${e}d`}let a=Math.floor(r/60),o=r%60;return a>0?i?o>0?`${a} 小时 ${o} 分后重置`:`${a} 小时后重置`:o>0?`Resets in ${a}h ${o}m`:`Resets in ${a}h`:i?`${o} 分钟后重置`:`Resets in ${o}m`}function mc(e,t,n=Date.now()){let r=uc(e,n);return r===null?null:r===0?dc(t)?`即将重置`:`Resets soon`:fc(r)}function hc(e,t,n=Date.now()){let r=uc(e,n);if(r===null)return null;let i=dc(t);if(r===0)return i?`即将到期`:`expires soon`;let a=fc(r);return i?`${a} 后到期`:`in ${a}`}let gc=z().finite().nonnegative(),_c=U({input:gc,output:gc,cacheRead:gc.optional(),cacheWrite:gc.optional(),cacheWrite1h:gc.optional()}),vc=L().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:L(),entries:V(U({key:L(),price:_c})),error:L().nullable()}),U({}),U({key:vc,price:_c.nullable(),previousKey:vc.optional()}),U({model:vc});let yc=U({official:B().optional(),canonicalModelId:L().min(1).optional(),provider:L().min(1).max(512),model:L().min(1).max(512),price:_c});U({price:_c.nullable(),suggestions:V(yc).max(6).optional()});let bc=[`today`,`7d`,`30d`,`90d`,`all`],xc=z().int().min(0).max(2**53-1),Sc=L().regex(/^\d{4}-\d{2}-\d{2}$/u),Cc=L().min(1).max(128),wc=L().min(1).max(512),Tc=L().min(1).max(4096);U({range:W(bc),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:Cc.optional(),model:wc.nullable().optional(),project:Tc.nullable().optional(),date:Sc.optional()});let Ec=U({requests:xc,inputTokens:xc,cachedInputTokens:xc,cacheWriteInputTokens:xc,cacheKnownInputTokens:xc,cacheHitCachedInputTokens:xc,cacheHitInputTokens:xc,outputTokens:xc,reasoningOutputTokens:xc,costUsd:z().finite().min(0),unpricedRequests:xc,unmeteredRequests:xc}),Dc=Ec.shape,Oc=U({harness:Cc,sessionId:L().min(1).max(512),project:Tc.nullable(),title:L().min(1).max(200).optional(),models:V(wc).max(16),firstAtMs:xc,lastAtMs:xc,...Dc});U({range:W(bc),from:Sc.nullable(),to:Sc,filters:U({harness:Cc.nullable(),model:wc.nullable(),unknownModel:B(),project:Tc.nullable(),unknownProject:B(),date:Sc.nullable()}),reading:U({complete:B(),sources:xc,read:xc}),failures:V(U({harness:Cc,message:L().max(2048)})).max(256),options:U({harnesses:V(Cc).max(256),models:V(wc.nullable()).max(4096),projects:V(Tc.nullable()).max(4096)}),modelLabels:V(U({harness:Cc,model:wc,label:wc})).max(4096).optional(),credits:V(U({harness:Cc,model:wc.nullable(),credits:z().finite().min(0),reportedRequests:xc,requests:xc})).max(4096).optional(),totals:Ec,daily:V(U({date:Sc,harness:Cc,...Dc})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Dc})).max(168),byHarness:V(U({harness:Cc,...Dc})).max(256),byModel:V(U({model:wc.nullable(),...Dc,harnessPricedRequests:xc})).max(4096),byProject:V(U({project:Tc.nullable(),...Dc})).max(4096),sessions:V(Oc).max(100),recentSessions:V(Oc).max(100).optional()}),H({threadId:K}),H({discarded:B()});let kc=Wa(`type`,[H({id:L().min(1),type:G(`choice`),prompt:L(),options:V(H({value:L().min(1),label:L(),description:L().optional()})).min(1),multiple:B(),allowOther:B(),optional:B()}),H({id:L().min(1),type:G(`text`),prompt:L(),multiline:B(),secret:G(!1),optional:B(),placeholder:L().optional(),prefill:L().optional()})]),Ac=H({interactionId:L().min(1),turnId:L().min(1),title:L().optional(),questions:V(kc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});U({threadId:L().min(1)}),H({questions:V(Ac)}),U({threadId:L().min(1),turnId:L().min(1),interactionId:L().min(1),answers:Xa(L(),V(L())),cancelled:B().default(!1)}),H({accepted:G(!0)});let jc=H({path:L(),oldText:L().nullable(),newText:L()});H({sessionId:L().min(1),turn:z().int().nonnegative(),path:L().min(1).optional()});let Mc=H({diffs:V(jc)});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()});let Nc=L().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(Vo),Pc=Nc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Fc=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`),Ic=pa().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Lc=H({en:L().max(4096),"zh-CN":L().max(4096).optional()}).strict(),Rc=H({commands:V(H({terminal:L().max(256),command:L().max(4096)}).strict()).max(8),before:Lc.optional(),after:Lc.optional(),downloads:V(H({label:L().max(128),url:Ic}).strict()).max(8).optional()}).strict(),zc={id:Nc,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:Rc.optional(),notice:Lc.optional(),launchCommand:G(!0).optional(),links:H({website:Ic.optional(),documentation:Ic.optional(),installation:Ic.optional()}).strict().optional()};H({manifestVersion:G(1),...zc,adapterApiVersion:z().int().positive(),entry:Fc,icon:Fc.optional()}).strict();let Bc=L().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Vc=H({...zc,icon:Bc.optional()}).strict();H({}).strict(),H({plugins:V(Vc.extend({id:Pc})).max(128)}).strict(),H({version:G(1),enabled:V(Nc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),H({harnessId:Pc}).strict().extend({enabled:B()}),H({enabled:B()}).strict(),U({title:L().trim().min(1).max(200),type:W([`info`,`warning`,`danger`]),body:L().trim().min(1).max(16384)}),U({}),U({url:L().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/long-context/get.codexhost/harness/long-context/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 Hc=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Uc=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:L(),title:L(),harnessId:L(),state:Hc,reason:Uc,inactiveMs:z().nonnegative()}),U({threadId:K,turnId:Ho});let Wc=H({amount:z().finite().nonnegative(),currency:L().trim().min(1).max(8),label:L().trim().min(1).max(128).optional()}).strict(),Gc=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:is.optional(),balance:Wc.optional()}).strict();function Kc(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let qc=Kc(Gc),Jc={harnessId:Vo,harnessName:L().trim().min(1).max(128)},Yc=H(Jc).strict();H({}).strict(),H({sources:V(Yc).max(128)}).strict(),H({harnessId:Vo,refresh:B().optional()}).strict(),H({...Jc,account:qc.nullable(),accounts:V(qc).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Kc(Gc.extend(Jc))).max(128)}).strict(),H({harnessId:Pc,model:os.optional(),thinkingOptionId:ss.optional(),permissionModeId:Wo.optional(),prewarm:G(!0).optional()}).strict();let Xc=L().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:Pc}).strict().extend({path:Xc.nullable()}),H({path:Xc.nullable(),restartRequired:B()}).strict(),H({harnessId:Vo,action:W([`check`,`update`,`install`])}).strict();let Zc=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:Lo.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:Zc}).strict(),H({taskId:L().uuid(),status:G(`failed`),error:H({code:z().int(),message:L().min(1).max(2048)}).strict()}).strict()]);let Qc=L().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),$c=L().trim().min(1),el=W([`api`,`chatgpt`]),tl=/^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;function nl(e){return e.length>0&&e.length<=2048&&tl.test(e)}H({url:L().max(2048).refine(nl,`External URL must be http(s)`)}).strict(),H({}).strict();let rl=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`]),il=H({accountId:Qc,label:$c.max(256),email:L().email().max(320).optional(),planType:rl.optional(),authKind:el.optional(),authIdentity:$c.max(256).optional(),siteUrl:L().refine(nl,`Account site URL must be http(s)`).optional()}).strict(),al=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Qc.nullable(),phase:al,revision:z().int().nonnegative(),instanceId:$c.max(1024).optional(),accounts:V(il).max(1)}).strict(),H({accountId:Qc,refresh:B().optional()}).strict(),H({accountId:Qc,usage:Qo.nullable(),accountCredits:is.optional(),freshness:W([`live`,`cached`]),observedAt:L().datetime().nullable()}).strict();let ol=1e3,sl=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),cl=sl.max(1024),ll=H({nativeSessionId:cl,title:sl.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:sl.max(16384),running:B().nullable()}).strict();H({}).strict();let ul=H({harnesses:V(H({harnessId:Pc,name:sl.max(128)}).strict()).max(128)}).strict();H({harnessId:Pc,query:L().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(ol).optional()}).strict();let dl=H({candidates:V(ll).max(ol),total:z().int().nonnegative().safe()}).strict();H({harnessId:Pc,nativeSessionId:cl}).strict();let fl=H({threadId:sl.max(1024).pipe(K)}).strict(),pl=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ml=cl,hl=ll;H({}).strict(),H({candidates:V(hl).max(1e3)}).strict(),H({nativeSessionId:ml}).strict(),H({threadId:pl.max(1024).pipe(K)}).strict(),H({threadId:K,lastTurnId:Ho}).strict(),H({threadId:K}).strict();let gl=L().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:gl,invocation:L().min(1).max(128),label:L().trim().min(1).max(128),description:L().trim().min(1).max(512).optional(),localizations:Io.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:Vo,cwd:L().min(1).optional()}).strict(),H({threadId:K}).strict(),H({threadId:K,commandId:gl,turnId:Ho.optional(),arguments:Mo.optional()}).strict(),H({accepted:G(!0),turnId:Ho.optional()}).strict();let _l=G(`2.0`).optional(),vl=Ra().optional(),yl=L().min(1),bl=Ha([L(),z().int()]),xl=H({code:z().int(),message:L(),data:jo.optional()}).catchall(jo).superRefine(Eo([`data`]));Ha([H({jsonrpc:_l,id:bl,method:yl,params:jo.optional(),result:vl,error:vl}).catchall(jo).superRefine(Eo([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:_l,id:vl,method:yl,params:jo.optional(),result:vl,error:vl}).catchall(jo).superRefine(Eo([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:_l,id:bl,method:vl,params:vl,result:jo,error:vl}).catchall(jo).superRefine(Eo([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:_l,id:bl,method:vl,params:vl,result:vl,error:xl}).catchall(jo).superRefine(Eo([`jsonrpc`,`method`,`params`,`result`]))]);let Sl=L().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:Vo,nativeSessionId:Sl,locator:jo.optional(),formatVersion:G(1)}).superRefine(Eo([`locator`])),U({harnessId:Vo,nativeSessionId:Sl,nativeTurnKey:Sl,formatVersion:G(1)}),U({harnessId:Vo,nativeSessionId:Sl,checkpointId:Sl,locator:jo.optional(),formatVersion:G(1)}).superRefine(Eo([`locator`]));let Cl=L().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),wl=W([`npm`,`windows-installer`,`macos-dmg`]),Tl=U({version:Cl,installation:wl,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 El=L().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`),Dl=U({currentVersion:Cl,installation:wl.nullable(),latestVersion:Cl.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:L().min(1).max(2e4).nullable(),releaseNotesUrl:El.nullable(),status:Tl.nullable(),error:L().min(1).max(500).nullable()});U({status:Tl}),U({status:Tl.nullable()});let Ol=/^[a-z0-9][a-z0-9-]*$/u;function kl(e){if(!Ol.test(e))throw Error(`Invalid delegation mention Harness id: ${e}`);return`subagent://codexhost.${e}`}function Al(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function jl(e){return`[@${Al(e.label)}](${kl(e.harnessId)})`}function Ml(e){let t=e.trim().replace(/^\//u,``);if(!t||/\s/u.test(t))throw Error(`Invalid Harness command: ${e}`);return`subagent://codexhost-command.${encodeURIComponent(t).replace(/[()]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`}RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Nl=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:L().nullable(),installedVersion:L().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:Nl,targetVersion:L().nullable(),error:L().nullable()})});let Pl=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 Fl=L().min(1).max(1024),Il={hostId:Fl.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Ll={...Il,threadId:Fl},Rl=Wa(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`status`),...Ll}),U({kind:G(`list`),...Il,cursor:L().nullable(),archived:B()}),U({kind:G(`read`),...Ll,page:U({cursor:L().min(1).max(8192).nullable(),epoch:Fl.optional(),sortDirection:W([`asc`,`desc`]).optional(),limit:z().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),U({kind:G(`usage`),...Ll,epoch:Fl}),U({kind:G(`configure`),...Ll,epoch:Fl,modelId:Fl.optional(),thinkingOptionId:Fl.optional(),permissionModeId:Fl.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`),...Ll,epoch:Fl,text:L().min(1).max(8e3),requestId:Fl.optional()}),U({kind:G(`interrupt`),...Ll,epoch:Fl,turnId:Fl}),U({kind:G(`rename`),...Ll,epoch:Fl,name:L().min(1).max(512)}),U({kind:G(`archive`),...Ll,epoch:Fl,archived:B()}),U({kind:G(`respond`),...Ll,epoch:Fl,requestId:Ha([Fl,z().int()]),result:Xa(L(),Ia())})]),zl=L().min(1).max(1024),Bl=H({hostId:zl,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()}),Vl=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:Rl}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:zl.refine(e=>e!==`local`),input:Ks}),U({action:G(`save`),draft:Vl,previous:Bl.nullable()}),U({action:G(`remove`),previous:Bl}),U({action:G(`connect`),hostId:zl,enabled:B()}),U({action:G(`state`),hostId:zl}),U({action:G(`runtime`),hostId:zl}),U({action:G(`update`),hostId:zl.refine(e=>e!==`local`),version:Pl.shape.version})]),Ha([U({result:jo}),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 Hl=L().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Ul=Ha([L(),H({en:L()}).catchall(L())]),Wl=H({title:Ul.optional(),description:Ul.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()}),Gl=H({extensions:V(H({id:Hl,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:Wl.optional(),loadError:L().optional()})),loadedIds:V(Hl),safeMode:B(),storeError:L().optional()}),Kl=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:Kl.optional()}).strict(),H({id:Hl,enabled:B()}).strict(),H({id:Hl}).strict(),G(1);function ql(){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 Jl=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function Yl(e){return typeof e==`string`&&Jl.some(t=>t===e)}var Xl=class extends Error{code;details;constructor(e,t,n){super(e),this.code=t,this.details=n}};async function Zl(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:ql(),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 Xl(e,t,n)}return r.result.value}async function Ql(e){let t=await fetch(`api/ch/v1/rpc`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({method:`codexhost/update/check`,params:{}}),signal:e});if(!t.ok)throw Error(`HTTP ${String(t.status)}`);let n=await t.json();if(n.error)throw Error(n.error.message??`Update check failed`);return Dl.parse(n.result)}let $l={status:async()=>Os.parse(await Zl(`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 As.parse(await n.json())}},eu=2e4,tu=(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})}),nu={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await ru(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await tu(500,e)}}};async function ru(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(eu),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(Yl(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(eu),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 iu(e){let t=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:e});if(!t.ok)return{authenticated:!1,local:!1};let n=await t.json();return{authenticated:n.authenticated===!0,local:n.local===!0}}async function au(e){let t=await iu(e);return t.authenticated&&t.local}async function ou(e){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{await navigator.clipboard.writeText(e);return}catch(e){if(typeof window<`u`&&window.isSecureContext)throw e}if(typeof document>`u`||document.body===null)throw Error(`Clipboard unavailable`);let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t);try{if(t.select(),t.setSelectionRange(0,e.length),!document.execCommand(`copy`))throw Error(`Clipboard copy rejected`)}finally{t.remove()}}let su={relay:async(e,t)=>Vs.parse(await Zl(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>Zl(`codexhost/lanSet`,{enabled:e}),autostart:async e=>Rs.parse(await Zl(`codexhost/autostartSet`,{enabled:e})),serve:async e=>Ls.parse(await Zl(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>Gs.parse(await Zl(`codexhost/accessTokenGet`,{})),regenerate:async()=>Gs.parse(await Zl(`codexhost/accessTokenRegenerate`,{}))},cu={config:()=>Zl(`codexhost/pushConfig`,{}),subscribe:e=>Zl(`codexhost/pushSubscribe`,{subscription:e,userAgent:navigator.userAgent}),unsubscribe:e=>Zl(`codexhost/pushUnsubscribe`,{endpoint:e}),test:()=>Zl(`codexhost/pushTest`,{})},lu={sources:async()=>ul.parse(await Zl(`codexhost/importSources`,{})),candidates:async e=>dl.parse(await Zl(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>fl.parse(await Zl(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},uu={read:async(e,t,n)=>Mc.parse(await Zl(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},du={send:(e,t,n)=>Zl(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},fu={list:async e=>Ms.parse(await Zl(`codexhost/skills/list`,{sessionId:e}))},pu={inspect:e=>Zl(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>Zl(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},mu=`codexhost-native`;function hu(e){let t=Ml(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:mu,ref:n,label:e,clipboardText:n}}let gu=`codexhost-delegation`;function _u(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([pu.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(),pu.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:mu,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:hu(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:gu,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=jl({harnessId:n.id,label:n.name});return{insert:{source:gu,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function vu(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:fu.list(e)},n.set(e,r)),r};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`@`,`#`],name:Ns,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
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=js(a);return{insert:{source:As,ref:o,label:a.name,appearance:`skill`,clipboardText:o}}}}))}function ru(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let iu=`codexhost-thread`,au=/(?<![\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 su(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function cu(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 lu(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${su(e)})`;return{source:iu,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function uu(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 du(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>uu(e,t);e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:iu,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)??(ru(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:lu(o)}}}),`ui-codexhost: Thread reference discovery`)}function fu(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(lu(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 pu={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var mu=class{capture;store=(0,s.createSnapshotStore)(pu);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:Ll(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(pu),n!==void 0&&URL.revokeObjectURL(n.url)}};let hu=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function gu(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function _u(e){return Math.max(4,Math.round(e/250))}function vu(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 yu(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 bu(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 xu(e,t){return{x:t===`tl`||t===`bl`?e.x+e.width:e.x,y:t===`tl`||t===`tr`?e.y+e.height:e.y}}function Su(e,t,n,r){return{...e,x:Math.min(Math.max(e.x+t,0),r.width-e.width),y:Math.min(Math.max(e.y+n,0),r.height-e.height)}}function Cu(e,t,n,r){e.save(),e.fillStyle=`rgba(0, 0, 0, 0.55)`,e.beginPath(),e.rect(0,0,n.width,n.height),e.rect(t.x,t.y,t.width,t.height),e.fill(`evenodd`),e.strokeStyle=`#fff`,e.lineWidth=2*r,e.strokeRect(t.x,t.y,t.width,t.height),e.fillStyle=`#fff`;for(let[n,i]of[[t.x,t.y],[t.x+t.width,t.y],[t.x,t.y+t.height],[t.x+t.width,t.y+t.height]])e.beginPath(),e.arc(n,i,7*r,0,Math.PI*2),e.fill();e.restore()}let wu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(wu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=wu,e.textContent=`.Q216aa_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.Q216aa_stage{position:absolute;top:50%;left:50%}.Q216aa_top,.Q216aa_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.Q216aa_top *,.Q216aa_bottom *{pointer-events:auto}.Q216aa_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.Q216aa_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.Q216aa_hidden{visibility:hidden;opacity:0}.Q216aa_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.Q216aa_spacer{flex:1}.Q216aa_text,.Q216aa_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}.Q216aa_text[aria-pressed=true]{background:#ffffff52}.Q216aa_text:disabled{opacity:.4;cursor:default}.Q216aa_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.Q216aa_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.Q216aa_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.Q216aa_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.Q216aa_area[data-annotating]{cursor:crosshair}.Q216aa_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}.Q216aa_canvas{background:#000;max-width:none;display:block}.Q216aa_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.Q216aa_compose{flex:1 0 100%;gap:8px;display:flex}.Q216aa_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}.Q216aa_message::placeholder{color:#ffffff8c}.Q216aa_primary:disabled{opacity:.5;cursor:default}.Q216aa_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%)}.Q216aa_cropHint,.Q216aa_cropSize{color:#ffffffbf;font-size:13px}.Q216aa_cropSize{font-variant-numeric:tabular-nums}.Q216aa_wide .Q216aa_compose{flex:320px}`,document.head.appendChild(e)}var J={area:`Q216aa_area`,bar:`Q216aa_bar`,bottom:`Q216aa_bottom`,canvas:`Q216aa_canvas`,compose:`Q216aa_compose`,cropHint:`Q216aa_cropHint`,cropSize:`Q216aa_cropSize`,error:`Q216aa_error`,hidden:`Q216aa_hidden`,hint:`Q216aa_hint`,message:`Q216aa_message`,primary:`Q216aa_primary`,root:`Q216aa_root`,spacer:`Q216aa_spacer`,stage:`Q216aa_stage`,swatch:`Q216aa_swatch`,text:`Q216aa_text`,top:`Q216aa_top`,wide:`Q216aa_wide`,zoomBadge:`Q216aa_zoomBadge`};function Tu(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 Eu,Du=`codexhost.screenshot.zoom-hint`,Ou=[`pen`,`rect`,`arrow`];function ku(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 Au({src:e,t,onClose:n,onAttach:i,onSend:o}){let[s,l]=(0,r.useState)(),u=ku(s?.url??e),[d,f]=(0,r.useState)(Eu??0),p=e=>{Eu=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)(hu[0]),[E,D]=(0,r.useState)([]),[O,k]=(0,r.useState)(),[ee,A]=(0,r.useState)(),[te,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(Du)!==`1`}catch{return!1}}),[ce,le]=(0,r.useState)(!1),ue=(0,r.useRef)(),de=(0,r.useRef)(null),[fe,pe]=(0,r.useState)(()=>Tu(!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(Tu(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(Du,`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}:gu(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:_u(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 O===void 0?E:[...E,O])vu(t,e,Ne);g&&v!==void 0&&Cu(t,v,{width:e.width,height:e.height},1/Math.max(xe*be,.01))}},[u,E,O,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,k(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:bu(n,t,28/(xe*be));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:xu(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(yu(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Pe(e);t!==void 0&&k({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(Su(r.before,t.x-r.start.x,t.y-r.start.y,n)):y(yu(r.kind===`new`?r.from:r.anchor,t,n))}else if(O!==void 0){let t=Pe(e);if(t===void 0)return;k({...O,points:O.tool===`pen`?[...O.points,t]:[O.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),O!==void 0&&!t&&D(e=>[...e,O]),k(void 0)},ze=()=>{Te.current.clear(),Ee.current=void 0,De.current=void 0,x.current=void 0,j.current=void 0,k(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?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(n),blob:n}),D([]),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?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(e),blob:e}),D([]),h(!1)))},`image/png`)},qe=async()=>{try{let t=i(s?.blob??await(await fetch(e)).blob());t===null?n():A(t)}catch{A(t(`desktop.annotate.failed`))}},Je=async()=>{if(!ie){ae(!0),A(void 0);try{let t=await o(s?.blob??await(await fetch(e)).blob(),re.trim());t===null?n():A(t)}catch{A(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{A(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} ${te||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} ${te||Ze?``:J.hidden} ${Xe?J.wide:``}`,children:[ee!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,className:J.error,children:ee}),/* @__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:[Ou.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}),hu.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:()=>D(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:()=>D([]),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 ju=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ju)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=ju,e.textContent=`._8v5QXa_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}._8v5QXa_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}._8v5QXa_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._8v5QXa_entry:disabled{opacity:.45;cursor:default}._8v5QXa_entry[aria-busy=true]{opacity:1;cursor:progress}._8v5QXa_spinner{flex:none;animation:.8s linear infinite _8v5QXa_spin;display:inline-flex}._8v5QXa_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}._8v5QXa_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}._8v5QXa_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}._8v5QXa_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}._8v5QXa_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}._8v5QXa_elapsed{font-variant-numeric:tabular-nums;font-size:11px}._8v5QXa_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}._8v5QXa_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}._8v5QXa_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 _8v5QXa_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){._8v5QXa_spinner{animation:none}}@media (pointer:coarse){._8v5QXa_entry{width:40px;height:44px}._8v5QXa_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var Mu={alert:`_8v5QXa_alert`,bubble:`_8v5QXa_bubble`,busy:`_8v5QXa_busy`,caption:`_8v5QXa_caption`,dismiss:`_8v5QXa_dismiss`,elapsed:`_8v5QXa_elapsed`,entry:`_8v5QXa_entry`,entryBusy:`_8v5QXa_entryBusy`,float:`_8v5QXa_float`,spin:`_8v5QXa_spin`,spinner:`_8v5QXa_spinner`};function Nu({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:Pu}];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=Fu(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?`${Mu.entry} ${Mu.entryBusy}`:Mu.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:Mu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Mu.elapsed,children:[f,`s`]})]}):/* @__PURE__ */ (0,a.jsx)(Pu,{size:16})})})}function Pu({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 Fu(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 Iu;function Lu(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 Ru(){return{x:window.innerWidth-60-12,y:72}}function zu({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=Fu(u.startedAt),[g,_]=(0,r.useState)(()=>Lu(Iu??Ru())),[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=>Lu(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:Bu(p.loaded),total:p.total===void 0?`?`:Bu(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,_(Lu({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?Iu=g:t||C())};return(0,c.createPortal)(/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Mu.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,a.jsxs)(`button`,{type:`button`,className:Mu.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:Mu.busy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Mu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Mu.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Mu.alert,children:`!`})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Mu.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:Mu.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,a.jsx)(Au,{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 Bu(e){return`${(e/1048576).toFixed(1)} MB`}var Vu=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 Hu=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Hu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Hu,e.textContent=`.iQSvMq_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}.iQSvMq_entry[data-live]{width:var(--voice-bar-width)}.iQSvMq_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}.iQSvMq_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.iQSvMq_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.iQSvMq_icon:focus-visible,.iQSvMq_round:focus-visible,.iQSvMq_send:focus-visible,.iQSvMq_done:focus-visible,.iQSvMq_primary:focus-visible,.iQSvMq_secondary:focus-visible,.iQSvMq_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.iQSvMq_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}.iQSvMq_round,.iQSvMq_send,.iQSvMq_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}.iQSvMq_round:hover:not(:disabled),.iQSvMq_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.iQSvMq_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.iQSvMq_wave,.iQSvMq_quiet{flex:none;width:90px;height:20px}.iQSvMq_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.iQSvMq_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.iQSvMq_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.iQSvMq_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.iQSvMq_sendFace,.iQSvMq_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.iQSvMq_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.iQSvMq_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.iQSvMq_send:hover:not(:disabled){filter:brightness(1.08)}.iQSvMq_send:disabled,.iQSvMq_done:disabled{opacity:.4;cursor:default}.iQSvMq_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite iQSvMq_spin}.iQSvMq_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.iQSvMq_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}.iQSvMq_strip .iQSvMq_round,.iQSvMq_strip .iQSvMq_done{width:26px;height:26px;position:relative}.iQSvMq_strip .iQSvMq_round:before,.iQSvMq_strip .iQSvMq_done:before{content:"";position:absolute;inset:-9px}.iQSvMq_strip .iQSvMq_meter{flex:1}.iQSvMq_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}.iQSvMq_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.iQSvMq_notice p{flex:220px;margin:0}.iQSvMq_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}.iQSvMq_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.iQSvMq_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.iQSvMq_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.iQSvMq_primary,.iQSvMq_secondary,.iQSvMq_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.iQSvMq_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.iQSvMq_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.iQSvMq_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.iQSvMq_secondary:hover,.iQSvMq_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes iQSvMq_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.iQSvMq_entry{transition:none}.iQSvMq_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.iQSvMq_entry{--voice-entry-size:44px}.iQSvMq_strip{margin-block:7px}.iQSvMq_icon{width:44px;height:44px}.iQSvMq_primary,.iQSvMq_secondary,.iQSvMq_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var Y={actions:`iQSvMq_actions`,bar:`iQSvMq_bar`,card:`iQSvMq_card`,cardHead:`iQSvMq_cardHead`,cardText:`iQSvMq_cardText`,done:`iQSvMq_done`,doneFace:`iQSvMq_doneFace`,entry:`iQSvMq_entry`,icon:`iQSvMq_icon`,meter:`iQSvMq_meter`,notice:`iQSvMq_notice`,primary:`iQSvMq_primary`,quiet:`iQSvMq_quiet`,quietButton:`iQSvMq_quietButton`,round:`iQSvMq_round`,secondary:`iQSvMq_secondary`,send:`iQSvMq_send`,sendFace:`iQSvMq_sendFace`,spin:`iQSvMq_spin`,spinner:`iQSvMq_spinner`,status:`iQSvMq_status`,statusText:`iQSvMq_statusText`,strip:`iQSvMq_strip`,timer:`iQSvMq_timer`,wave:`iQSvMq_wave`};let Uu=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function Wu(e){return(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var Gu=class{stacked=!1;listeners=/* @__PURE__ */ new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.stacked;set(e){if(e!==this.stacked){this.stacked=e;for(let e of this.listeners)e()}}};let Ku=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,qu=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function Ju({voice:e,blocks:t,tray:n,sessionId:o,inputActions:s,useInput:c,useSession:l,t:u}){let d=Wu(e),[f,p]=(0,r.useState)(!1),m=(0,r.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,r.useRef)(null),g=Ku(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;zl.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)(Xu,{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:Uu,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 Yu({voice:e,tray:t,onActiveChange:n,t:i}){let o=Wu(e),s=(0,r.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&Ku(o);return(0,r.useLayoutEffect)(()=>n(s),[s,n]),(0,r.useLayoutEffect)(()=>()=>n(!1),[n]),s?/* @__PURE__ */ (0,a.jsx)(Xu,{voice:e,state:o,locked:!1,layout:`strip`,t:i}):null}function Xu({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:qu(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)(Zu,{})})})}):null,/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:Uu,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 Zu(){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 Qu({voice:e,t}){let n=Wu(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:qu(n.seconds)})}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,a.jsx)($u,{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)($u,{label:t(`voice.discard`),onClick:e.discard})]})}function $u({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 ed({size:e}){return/* @__PURE__ */ (0,a.jsx)(i.IconDownloadOutlineRegular,{size:e})}function td({size:e,renderAction:t,openSection:n,t:i}){let[o,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=new AbortController;return Wl(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 nd({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 rd=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(rd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=rd,e.textContent=`.DWEYcq_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}.DWEYcq_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.DWEYcq_detail{color:var(--dsw-alias-label-tertiary)}.DWEYcq_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}.DWEYcq_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.DWEYcq_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var id={copy:`DWEYcq_copy`,detail:`DWEYcq_detail`,retry:`DWEYcq_retry`,status:`DWEYcq_status`};function ad(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 sd(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function cd(){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 ld(){let e=await sd();await navigator.serviceWorker.ready;let t=await e.pushManager.getSubscription();if(t===null){let{publicKey:n}=await Kl.config();t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ad(n)})}await Kl.subscribe(t.toJSON())}async function ud(){let e=await Notification.requestPermission();return e===`granted`?(await ld(),`on`):e===`denied`?`denied`:`off`}async function dd(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await Kl.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function fd(){`serviceWorker`in navigator&&sd().catch(()=>void 0)}function pd(){`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window&&Notification.permission===`granted`&&ld().catch(()=>void 0)}let md=5e3,hd=(0,s.createSnapshotStore)(!1);function gd(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(md)});if(e.status===401){window.location.reload();return}s=e.status===200}catch{}n=!1,!(r||e.getSnapshot()!==`connecting`)&&(s&&(i=0,hd.set(!1)),t=setTimeout(()=>{s||(i+=1,hd.set(i>=2)),a()},Math.max(0,md-(Date.now()-o))))},o=()=>{e.getSnapshot()===`connecting`?a():(clearTimeout(t),i=0,hd.set(!1))},s=e.subscribe(o);return o(),()=>{r=!0,clearTimeout(t),hd.set(!1),s()}}async function _d(){await dd().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 vd({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)(hd.subscribe,hd.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:id.status,role:`status`,"data-web-connection":v,"data-native-connection":u===`reconnecting`?u:void 0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:id.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:s(`connection.${v}`)}),y===void 0?null:/* @__PURE__ */ (0,a.jsx)(`span`,{className:id.detail,children:s(`connection.lastSynced`,{time:new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:id.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 yd({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:id.status,role:n.state===`error`?`alert`:`status`,"data-session-opening":n.state,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:id.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(n.state===`loading`?`opening.loading`:`opening.error`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:id.detail,children:n.sessionId}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:id.detail,children:n.message}):null]}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:id.retry,onClick:()=>e.retryOpening(),children:t(`connection.retry`)}):null]})}let bd=`@deepseek-ai/dsh-client-ui-codexhost/HostUsageDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(bd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=bd,e.textContent=`.k3cPXq_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}.k3cPXq_anchor[data-composer-stat=codexhost-quota]{order:-1}.k3cPXq_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}.k3cPXq_pill:hover,.k3cPXq_pill:focus-visible,.k3cPXq_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.k3cPXq_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.k3cPXq_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}.k3cPXq_panel header{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:500;line-height:22px}.k3cPXq_context{margin-top:10px}.k3cPXq_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.k3cPXq_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.k3cPXq_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.k3cPXq_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.k3cPXq_group{margin-top:12px}.k3cPXq_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 5px;font-size:12px;font-weight:600}.k3cPXq_group dl{gap:5px;margin:0;display:grid}.k3cPXq_detail{grid-template-columns:minmax(120px,auto) minmax(0,1fr);gap:0 16px;display:grid}.k3cPXq_detail dt,.k3cPXq_detail dd,.k3cPXq_detail p{min-width:0;margin:0}.k3cPXq_detail dt{color:var(--dsw-alias-label-tertiary)}.k3cPXq_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.k3cPXq_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.k3cPXq_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.k3cPXq_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.k3cPXq_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}.k3cPXq_quotaRow+.k3cPXq_quotaRow,.k3cPXq_quotaGroup+.k3cPXq_quotaGroup{margin-top:11px}.k3cPXq_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.k3cPXq_quotaDescription{min-width:0}.k3cPXq_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}.k3cPXq_quotaGroup:first-child .k3cPXq_quotaRow:first-child .k3cPXq_quotaDescription>span{font-size:12.5px;font-weight:600}.k3cPXq_quotaGroup:first-child .k3cPXq_quotaRow:first-child .k3cPXq_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.k3cPXq_quotaGroup:first-child .k3cPXq_quotaRow:first-child .k3cPXq_remainingValue{font-size:26px;font-weight:700}.k3cPXq_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.k3cPXq_quotaGroup:first-child .k3cPXq_quotaRow:first-child p{font-size:11px}.k3cPXq_quotaPanel .k3cPXq_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.k3cPXq_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}@media (width<=640px){.k3cPXq_anchor{max-width:min(280px,56vw)}}`,document.head.appendChild(e)}var X={anchor:`k3cPXq_anchor`,context:`k3cPXq_context`,contextRow:`k3cPXq_contextRow`,detail:`k3cPXq_detail`,group:`k3cPXq_group`,label:`k3cPXq_label`,panel:`k3cPXq_panel`,pill:`k3cPXq_pill`,progressFill:`k3cPXq_progressFill`,progressTrack:`k3cPXq_progressTrack`,quotaDescription:`k3cPXq_quotaDescription`,quotaFill:`k3cPXq_quotaFill`,quotaGroup:`k3cPXq_quotaGroup`,quotaHeading:`k3cPXq_quotaHeading`,quotaPanel:`k3cPXq_quotaPanel`,quotaRing:`k3cPXq_quotaRing`,quotaRow:`k3cPXq_quotaRow`,remainingLabel:`k3cPXq_remainingLabel`,remainingValue:`k3cPXq_remainingValue`,ringTrack:`k3cPXq_ringTrack`};let xd={visibility:`hidden`,left:0,top:0};function Sd(e,t=1){return e.toFixed(t).replace(/\.?0+$/u,``)}function Cd(e){return e<1e3?String(Math.round(e)):e<1e6?`${Sd(e/1e3)}K`:e<1e9?`${Sd(e/1e6)}M`:`${Sd(e/1e9)}B`}function wd(e){return`${Sd(e)}%`}function Td(e){return e.contextUsagePercent??(e.contextUsedTokens!==void 0&&e.contextWindowTokens!==void 0?e.contextUsedTokens/e.contextWindowTokens*100:void 0)}function Ed(e,t){return`${e>=100?Math.round(e):Sd(e)} ${t(`usage.unit.tps`)}`}function Dd(e,t){return e<1e3?`${Math.round(e)} ${t(`usage.unit.ms`)}`:`${Sd(e/1e3)} ${t(`usage.unit.seconds`)}`}function Od(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 kd(e,t){return`${e>0&&e<.001?`<0.001`:Sd(e,3)} ${t(`usage.unit.credits`)}`}function Ad(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 jd(e,t,n){return e===void 0||t===void 0?``:`${Sd(e,2)} / ${Sd(t,2)}${n?` ${n}`:``}`}function Md(e,t){if(e===null)return[];let n=[e.cacheHitRatePercent===void 0?null:`${t(`usage.cache.short`)} ${wd(e.cacheHitRatePercent)}`,e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond===void 0?null:`API ${Ed(e.apiOutputTokensPerSecond,t)}`:Ed(e.outputTokensPerSecond,t),Od(e)].filter(e=>e!==null);if(n.length>0)return n;if(e.totalTokens!==void 0)return[`${Cd(e.totalTokens)} ${t(`usage.unit.tokens`)}`];let r=Td(e);return r===void 0?[]:[`${t(`usage.context`)}: ${wd(r)}`]}function Nd(e,t){let n=[];if(e!==null){let r=[],i=Od(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:kd(e.totalCredits,t)}),e.sessionCacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.average`),value:wd(e.sessionCacheHitRatePercent)}),e.cacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.latest`),value:wd(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:Ed(e.apiOutputTokensPerSecond,t)}):a.push({label:t(`usage.speed`),value:Ed(e.outputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&a.push({label:t(`usage.ttft`),value:Dd(e.timeToFirstOutputMs,t)}),a.length&&n.push({label:t(`usage.group.turn`),rows:a});let o=[];(e.inputTokens!==void 0||e.outputTokens!==void 0)&&o.push({label:t(`usage.tokens.io`),value:`${e.inputTokens===void 0?`—`:Cd(e.inputTokens)} / ${e.outputTokens===void 0?`—`:Cd(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?`—`:Cd(e.cachedInputTokens)} / ${Cd(e.cacheWriteInputTokens)}`:Cd(e.cachedInputTokens??0)}),e.totalTokens!==void 0&&o.push({label:t(`usage.tokens.total`),value:Cd(e.totalTokens)}),o.length&&n.push({label:t(`usage.group.tokens`),rows:o})}return n}function Pd(e){return Math.min(100,Math.max(0,100-e))}function Fd(e){return e<=10?`#c45c4a`:e<=30?`#c9a227`:`#3d9a64`}function Id(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=Ad(a,n);t.push({label:r,value:wd(Pd(i)),remaining:Pd(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=jd(t.used,t.limit,t.unit);if(i.push({label:e(t.periodType,t.label??n(`usage.group.quota`),t.scope),value:wd(Pd(t.usedPercent)),remaining:Pd(t.usedPercent),note:[a?`${n(`usage.quota`)}: ${a}`:null,Ad(t.resetsAt,n)].filter(Boolean).join(` · `)}),t.resetCredits){let e=Ad(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=jd(r.used,r.limit,r.unit);i.push({label:e(r.periodType,r.product,r.scope),value:wd(Pd(r.usagePercent)),remaining:Pd(r.usagePercent),note:[t?`${n(`usage.quota`)}: ${t}`:null,Ad(r.resetsAt,n)].filter(Boolean).join(` · `)})}i.length&&r.push({label:n(`usage.group.quota`),rows:i})}return r}function Ld({usage:e,t}){if(e===null)return null;let n=Td(e);if(n===void 0)return null;let r=e.contextWindowTokens===void 0?wd(n):`${wd(n)} / ${Cd(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 Rd({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 zd({useProjection:e,t}){let n=e(`codexhostUsage`),i=n?.usage??null,o=n?.accountCredits,s=(0,r.useMemo)(()=>Md(i,t),[i,t]),c=(0,r.useMemo)(()=>Nd(i,t),[i,t]),l=(0,r.useMemo)(()=>Id(i,o,t),[i,o,t]),u=l.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),d=i!==null&&Td(i)!==void 0,f=s.join(` · `);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[u&&/* @__PURE__ */ (0,a.jsx)(Bd,{stat:`codexhost-quota`,panelStyle:{"--quota-color":Fd(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:Fd(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":Fd(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)(Bd,{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)(Ld,{usage:i,t}),/* @__PURE__ */ (0,a.jsx)(Rd,{groups:c})]})]})}function Bd({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??xd},role:`dialog`,"aria-label":n,onPointerEnter:v,onPointerLeave:y,children:s}),document.body)]})}let Vd=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Vd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Vd,e.textContent=`.HpjsdG_page{flex-direction:column;gap:24px;min-width:0;display:flex}.HpjsdG_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.HpjsdG_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}.HpjsdG_description,.HpjsdG_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}.HpjsdG_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.HpjsdG_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}.HpjsdG_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}.HpjsdG_status[data-active=true]:before{background:#65af91}.HpjsdG_connection{flex-direction:column;gap:24px;display:flex}.HpjsdG_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}.HpjsdG_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}.HpjsdG_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}.HpjsdG_qrButton{cursor:pointer;background:#fff;border:none;border-radius:12px;padding:8px;line-height:0;display:block;position:relative;overflow:hidden}.HpjsdG_qr{filter:blur(10px);opacity:.35;pointer-events:none;user-select:none;width:144px;height:144px;display:block}.HpjsdG_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}.HpjsdG_qrCover small{font-size:11px;line-height:16px}.HpjsdG_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}.HpjsdG_qrButton:focus-visible,.HpjsdG_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}.HpjsdG_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}.HpjsdG_routes{border:0;min-width:0;margin:0;padding:0}.HpjsdG_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}.HpjsdG_routeGroup,.HpjsdG_extraRoutes{flex-direction:column;gap:8px;display:flex}.HpjsdG_routeGroup,.HpjsdG_extraRoutes>.HpjsdG_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}.HpjsdG_routeGroup{gap:0;overflow:hidden}.HpjsdG_routeFamily,.HpjsdG_routeGroup>.HpjsdG_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}.HpjsdG_extraRoutes>.HpjsdG_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}.HpjsdG_routeGroup>.HpjsdG_route:has(input:checked),.HpjsdG_routeFamily:has(.HpjsdG_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}.HpjsdG_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}.HpjsdG_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}.HpjsdG_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}.HpjsdG_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}.HpjsdG_extraRoutes>.HpjsdG_route{border-radius:10px}.HpjsdG_route:hover{background:var(--dsw-alias-interactive-bg-hover)}.HpjsdG_route:has(input:disabled){cursor:default;opacity:.7}.HpjsdG_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}.HpjsdG_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}.HpjsdG_route>.HpjsdG_routeText{flex:1}.HpjsdG_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}.HpjsdG_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}.HpjsdG_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}.HpjsdG_addressRow{flex-wrap:wrap;gap:8px;display:flex}.HpjsdG_addressRow>button{flex:none}.HpjsdG_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}.HpjsdG_addressMenu{flex:140px;min-width:0}.HpjsdG_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}.HpjsdG_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.HpjsdG_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}.HpjsdG_addressTrigger:disabled{cursor:default;opacity:.7}.HpjsdG_other{min-width:0}.HpjsdG_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}.HpjsdG_page>.HpjsdG_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}.HpjsdG_page>.HpjsdG_other summary{color:var(--dsw-alias-label-secondary)}.HpjsdG_extraRoutes{margin-top:8px}.HpjsdG_connectionHelp{flex-direction:column;gap:10px;display:flex}.HpjsdG_relayFields,.HpjsdG_relayField{gap:4px;min-width:0;display:grid}.HpjsdG_relayFields{gap:10px}.HpjsdG_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}.HpjsdG_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}.HpjsdG_relayPreviewAddress span{flex-direction:column;display:flex}.HpjsdG_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}.HpjsdG_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}.HpjsdG_relayTutorial li+li{margin-top:6px}.HpjsdG_relayTutorial code{display:block}.HpjsdG_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}.HpjsdG_ready svg{color:#65af91;flex:none;margin-top:2px}.HpjsdG_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}.HpjsdG_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}.HpjsdG_manageRow+.HpjsdG_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}.HpjsdG_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}.HpjsdG_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}.HpjsdG_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.HpjsdG_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}.HpjsdG_dangerOutline{color:var(--dsw-alias-state-error-primary)}.HpjsdG_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}.HpjsdG_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}.HpjsdG_actions{flex-wrap:wrap;gap:8px;display:flex}.HpjsdG_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.HpjsdG_confirm{width:min(440px,100%)}.HpjsdG_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}.HpjsdG_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}.HpjsdG_qrModal{width:min(420px,100%)}.HpjsdG_largeQr{border-radius:12px;width:100%;height:auto;display:block}@media (width<=600px){.HpjsdG_page{gap:16px}.HpjsdG_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}.HpjsdG_scan{border-right:0;align-self:center;padding-right:0}.HpjsdG_manage{padding:0 12px}.HpjsdG_stopRow{padding:16px 12px}.HpjsdG_routeAddress{flex-basis:100%;margin-left:0}.HpjsdG_title{font-size:20px}.HpjsdG_status{font-size:11px}}`,document.head.appendChild(e)}var Z={actions:`HpjsdG_actions`,addressMenu:`HpjsdG_addressMenu`,addressRow:`HpjsdG_addressRow`,addressTrigger:`HpjsdG_addressTrigger`,badge:`HpjsdG_badge`,confirm:`HpjsdG_confirm`,connection:`HpjsdG_connection`,connectionDetails:`HpjsdG_connectionDetails`,connectionHelp:`HpjsdG_connectionHelp`,connectionMain:`HpjsdG_connectionMain`,dangerConfirm:`HpjsdG_dangerConfirm`,dangerOutline:`HpjsdG_dangerOutline`,description:`HpjsdG_description`,error:`HpjsdG_error`,extraRoutes:`HpjsdG_extraRoutes`,fieldTitle:`HpjsdG_fieldTitle`,header:`HpjsdG_header`,input:`HpjsdG_input`,largeQr:`HpjsdG_largeQr`,link:`HpjsdG_link`,manage:`HpjsdG_manage`,manageActions:`HpjsdG_manageActions`,manageRow:`HpjsdG_manageRow`,manageText:`HpjsdG_manageText`,manageTitle:`HpjsdG_manageTitle`,meta:`HpjsdG_meta`,notice:`HpjsdG_notice`,other:`HpjsdG_other`,page:`HpjsdG_page`,qr:`HpjsdG_qr`,qrButton:`HpjsdG_qrButton`,qrCover:`HpjsdG_qrCover`,qrModal:`HpjsdG_qrModal`,qrPlaceholder:`HpjsdG_qrPlaceholder`,ready:`HpjsdG_ready`,relayField:`HpjsdG_relayField`,relayFields:`HpjsdG_relayFields`,relayPreview:`HpjsdG_relayPreview`,relayPreviewAddress:`HpjsdG_relayPreviewAddress`,relayTutorial:`HpjsdG_relayTutorial`,remoteList:`HpjsdG_remoteList`,route:`HpjsdG_route`,routeAddress:`HpjsdG_routeAddress`,routeFamily:`HpjsdG_routeFamily`,routeGroup:`HpjsdG_routeGroup`,routePanel:`HpjsdG_routePanel`,routeText:`HpjsdG_routeText`,routeTitle:`HpjsdG_routeTitle`,routes:`HpjsdG_routes`,scan:`HpjsdG_scan`,status:`HpjsdG_status`,stopRow:`HpjsdG_stopRow`,subRoute:`HpjsdG_subRoute`,subRoutes:`HpjsdG_subRoutes`,title:`HpjsdG_title`};function Hd(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 Gl.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 Ud({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),Gl.autostart(e).then(async()=>{n(await Gl.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function Wd(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function Gd({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?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,r.useState)(h),v=g===h&&t.customHost?t.customHost:g?`relay.${g}`:``,y=v!==(t.customHost??``),b=zs.safeParse(v).success,x=g!==``&&(!zs.safeParse(g).success||!b&&y),S=(0,r.useId)(),[C,w]=(0,r.useState)(d?``:f?.split(`.`)[0]??``),[T,E]=(0,r.useState)(``),D=(0,r.useId)(),O=C!==``&&(d?!/^[a-z0-9]{4,20}$/.test(C):!Bs.safeParse(C).success||`${C}.${g}`===v||g!==``&&!zs.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,te=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`):Wd(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(k?.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??``})}),m&&/* @__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:te})]}),p!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(p).toLocaleString()})}),ee&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:k.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&&f===void 0?{name:C,invite:T}:{},...d?{}:{name:C,...y?{host:v}:{}}})},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: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,a.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,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.name`),/* @__PURE__ */ (0,a.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,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:C||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:g||`example.com`}),/* @__PURE__ */ (0,a.jsx)(`small`,{children:c(`connectDevices.selfRelay.host`)})]})]})]}),v&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:v})})]}),d&&f===void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.relayFields,children:[/* @__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: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,a.jsx)(`p`,{id:D,className:Z.meta,children:c(`connectDevices.relay.nameHint`)}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.inviteLabel`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Z.input,value:T,onChange:e=>E(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||m||(d?f===void 0&&O:v===``||x||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 Kd=/* @__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))(Kd||{});let qd=[0,1],Jd=[1,0],Yd=[2,3],Xd=[3,2],Zd={L:qd,M:Jd,Q:Yd,H:Xd},Qd=/^\d*$/,$d=/^[A-Z0-9 $%*+./:-]*$/,ef=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,tf=[[-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]],nf=[[-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 rf=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,Kd.Timing),this.setFunctionModule(e,6,e%2==0,Kd.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,Kd.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,Kd.Alignment)}setFunctionModule(e,t,n,r=Kd.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==xf(t,n))throw RangeError(`Invalid argument`);let r=nf[n[0]][t],i=tf[n[0]][t],a=Math.floor(bf(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Sf(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=Cf(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(bf(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 af(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 sf=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 cf=[1,10,12,14],lf=[2,9,11,13],uf=[4,8,16,16];function df(e,t){return e[Math.floor((t+7)/17)+1]}function ff(e){let t=[];for(let n of e)af(n,8,t);return new sf(uf,e.length,t)}function pf(e){if(!gf(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);af(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new sf(cf,e.length,t)}function mf(e){if(!_f(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=ef.indexOf(e.charAt(n))*45;r+=ef.indexOf(e.charAt(n+1)),af(r,11,t)}return n<e.length&&af(ef.indexOf(e.charAt(n)),6,t),new sf(lf,e.length,t)}function hf(e){return e===``?[]:gf(e)?[pf(e)]:_f(e)?[mf(e)]:[ff(yf(e))]}function gf(e){return Qd.test(e)}function _f(e){return $d.test(e)}function vf(e,t){let n=0;for(let r of e){let e=df(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function yf(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 bf(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 xf(e,t){return Math.floor(bf(e)/8)-tf[t[0]][e]*nf[t[0]][e]}function Sf(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]=wf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=wf(n,2)}return t}function Cf(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]^=wf(t,e))}return n}function wf(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 Tf(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=xf(o,t)*8,i=vf(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Jd,Yd,Xd])a&&s<=xf(o,e)*8&&(t=e);let c=[];for(let t of e){af(t.mode[0],4,c),af(t.numChars,df(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=xf(o,t)*8;af(0,Math.min(4,l-c.length),c),af(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)af(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 rf(o,t,u,i)}function Ef(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`?hf(e):Array.isArray(e)?[ff(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Tf(c,Zd[n],i,a,o,r),u=Df({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Df(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=Kd.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 Of({value:e,label:t,className:n}){let{size:i,path:o}=(0,r.useMemo)(()=>{let t=Ef(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 kf({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 Af={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`},jf={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},Mf={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},Nf=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function Pf({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:_)??Nf.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,D]=(0,r.useState)(!1),[O,k]=(0,r.useState)(`idle`),ee=(0,r.useId)(),A=g.filter(e=>e.kind===`relay`?x===h:e.kind===x),te=A.find(e=>e.url===S)??A[0],ne=!n&&te!==void 0&&u.some(e=>e.url===te.url),j=ne?`${te.url}#token=${p}`:void 0,re=ne?jf[x]:void 0,M=x===`tailscale-https`,ie=M?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&te!==void 0,ae=Nf.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)(()=>{k(`idle`),T(void 0)},[j]),(0,r.useEffect)(()=>{if(O===`idle`)return;let e=setTimeout(()=>k(`idle`),2e3);return()=>clearTimeout(e)},[O]);let le=e=>{if(y(e))return e===`relay`?m?.officialHost:m?.customHost;let t=e===`tailscale-https`&&oe?te:e===`tailscale-https`?g.find(t=>t.kind===e)??g.find(e=>e.kind===`tailscale`):e===x?te: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:ee,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(Af[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(Mf[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)(Of,{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)(Gd,{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`)})]})]}),te!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.addressRow,children:[A.length>1?/* @__PURE__ */ (0,a.jsx)(i.Menu,{open:E,onClose:()=>D(!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:()=>D(!E),children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:new URL(te.url).host}),/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{})]}),items:A.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:te.url,onSelect:e=>{D(!1),C(e)}}):/* @__PURE__ */ (0,a.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:Z.input,value:new URL(te.url).host,readOnly:!0}),j!==void 0&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:t,onClick:()=>{navigator.clipboard.writeText(j).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,a.jsx)(kf,{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:`${ee}-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:`${ee}-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)(Of,{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 Ff=e=>e instanceof Error?e.message:String(e);function If(e){if(e instanceof Rl&&e.code===`auth/disabled`)return{kind:`disabled`};if(e instanceof Rl&&e.code===`auth/local-access-required`){let t=Us.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:Ff(e)}}function Lf({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 Rf({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)(Lf,{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),_d().catch(e=>{c(!1),u(t(`connectDevices.actionFailed`,{message:Ff(e)}))})}})]})}function zf({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=Hd(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 Gl.get().then(t=>{e||n({kind:`ready`,data:t})},t=>{e||n(If(t))}),()=>{e=!0}},[]);let _=t.kind===`ready`?t.data.relay?.state:void 0,v=_!==void 0&&Wd(_);(0,r.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{Gl.get().then(m,()=>void 0)},2e3);return()=>clearTimeout(e)},[v,t,m]);let y=async()=>{let e=await Gl.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:Ff(t)}));try{await y()}catch{}}finally{l(!1)}},x=e=>{b(async()=>{if(e===`direct`){let{changed:e}=await Gl.lan(!0);e?h.start(!0):await y()}else{let e=await Gl.serve(!0);if(e.error!==void 0)throw Error(e.error);await y()}})},S=async()=>{let t=await y();t.relay?.enabled&&(await Gl.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 Gl.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 Gl.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)(Rf,{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: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)),te=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":k&&h.target===null,children:e(h.target===null?k?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,a.jsx)(Pf,{data:C,busy:g,restarting:h.target!==null,onEnable:x,onRelay:(e,t)=>{b(async()=>{await Gl.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:te===void 0?e(`connectDevices.neverUsed`):e(`connectDevices.lastUsed`,{time:e(`connectDevices.relative.${te.unit}`,{n:te.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`)})]})]}),O!==void 0&&/* @__PURE__ */ (0,a.jsx)(Ud,{state:O,disabled:g,restored:m,t:e})]}),ee&&/* @__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)(Lf,{t:e,title:e(o===`stop`?`connectDevices.stopTitle`:`connectDevices.regenerateTitle`),description:o===`stop`?`${e(`connectDevices.stopDescription`)}${A?` ${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 Gl.regenerate()),s(null)})}})]})}async function Bf(e,t,n){let r=`codexhost/uiExtensions/${e}`,i=await fetch(`api/${r}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:Fl(),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 Rl(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return Nl.parse(a.result?.value)}let Vf={list:e=>Bf(`list`,{},e),install:(e,t)=>Bf(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>Bf(`setEnabled`,{id:e,enabled:t}),remove:e=>Bf(`remove`,{id:e})},Hf=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host does not provide \1$/u,Uf=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host provides (.+)$/u,Wf=/^web-assets: \S+ declares runtime version requirements, but the browser Host version snapshot is unavailable$/u,Gf=/^web-assets: \S+ requires unavailable browser module (\S+)$/u;function Kf(e,t){return Hf.test(e)||Gf.test(e)?t(`extensions.unsupported`):Uf.test(e)?t(`extensions.versionMismatch`):Wf.test(e)?t(`extensions.hostVersionSnapshotMissing`):e.replace(/^web-assets:\s+/u,``)}let qf=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=qf,e.textContent=`.mpCnrG_dialog{width:min(560px,100%);max-height:min(800px,100%)}.mpCnrG_content{min-height:0;overflow-y:auto}.mpCnrG_body,.mpCnrG_footer,.mpCnrG_field{flex-direction:column;min-width:0;display:flex}.mpCnrG_body{gap:12px}.mpCnrG_footer{flex:1;gap:20px}.mpCnrG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.mpCnrG_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}.mpCnrG_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.mpCnrG_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.mpCnrG_field input:disabled,.mpCnrG_registry select:disabled{opacity:.6}.mpCnrG_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.mpCnrG_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}.mpCnrG_guideToggle:hover{color:var(--dsw-alias-label-primary)}.mpCnrG_guideToggle[aria-expanded=true] .mpCnrG_chevron{transform:rotate(180deg)}.mpCnrG_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}.mpCnrG_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}.mpCnrG_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}.mpCnrG_guide p{margin:8px 0 4px}.mpCnrG_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.mpCnrG_scope,.mpCnrG_hint,.mpCnrG_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.mpCnrG_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.mpCnrG_wide{width:100%}`,document.head.appendChild(e)}var Jf={body:`mpCnrG_body`,chevron:`mpCnrG_chevron`,content:`mpCnrG_content`,dialog:`mpCnrG_dialog`,error:`mpCnrG_error`,field:`mpCnrG_field`,footer:`mpCnrG_footer`,guide:`mpCnrG_guide`,guideToggle:`mpCnrG_guideToggle`,hint:`mpCnrG_hint`,options:`mpCnrG_options`,registry:`mpCnrG_registry`,scope:`mpCnrG_scope`,wide:`mpCnrG_wide`};let Yf={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function Xf({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:Jf.dialog,contentClassName:Jf.content,footer:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Jf.footer,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Jf.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{type:`submit`,form:y,variant:`primary`,className:Jf.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,a.jsxs)(`form`,{id:y,className:Jf.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=Pl.safeParse(d===`custom`?p:Yf[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:Jf.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:Jf.error,role:`alert`,children:o}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Jf.options,children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Jf.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{className:Jf.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:Jf.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:Jf.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:Jf.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,a.jsxs)(`div`,{id:b,className:Jf.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:Jf.hint,children:e(`extensions.registryHint`)})]})]})})}let Zf=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Zf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Zf,e.textContent=`.hpnV1q_page,.hpnV1q_rowText{flex-direction:column;min-width:0;display:flex}.hpnV1q_page{gap:28px}.hpnV1q_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.hpnV1q_heading{flex:280px;min-width:0}.hpnV1q_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.hpnV1q_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.hpnV1q_intro .hpnV1q_iconButton{width:24px;height:24px;margin-top:-2px}.hpnV1q_intro .hpnV1q_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.hpnV1q_hint,.hpnV1q_meta,.hpnV1q_notice,.hpnV1q_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.hpnV1q_notice{color:var(--dsw-alias-label-secondary)}.hpnV1q_error,.hpnV1q_danger{color:var(--dsw-alias-state-error-primary)}.hpnV1q_actions,.hpnV1q_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.hpnV1q_actions{flex:none}.hpnV1q_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}.hpnV1q_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.hpnV1q_iconButton:disabled{opacity:.5;cursor:default}.hpnV1q_open:focus-visible,.hpnV1q_iconButton:focus-visible,.hpnV1q_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.hpnV1q_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}.hpnV1q_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.hpnV1q_button:disabled{opacity:.6;cursor:default}.hpnV1q_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.hpnV1q_group{min-width:0}.hpnV1q_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}.hpnV1q_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.hpnV1q_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.hpnV1q_row:hover,.hpnV1q_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.hpnV1q_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}.hpnV1q_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}.hpnV1q_packageImage{object-fit:contain}.hpnV1q_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.hpnV1q_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.hpnV1q_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.hpnV1q_row:hover .hpnV1q_chevron,.hpnV1q_row:focus-within .hpnV1q_chevron{opacity:1}.hpnV1q_rowText{flex:1;gap:4px}.hpnV1q_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.hpnV1q_rowNotice{flex-basis:100%;padding-left:62px}.hpnV1q_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}.hpnV1q_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.hpnV1q_detail .hpnV1q_rowText{gap:8px}.hpnV1q_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}.hpnV1q_recovery{gap:8px 16px;margin-top:4px}.hpnV1q_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.hpnV1q_page{gap:24px}.hpnV1q_open{gap:10px}.hpnV1q_artwork{border-radius:10px;width:40px;height:40px}.hpnV1q_row,.hpnV1q_row .hpnV1q_actions{gap:4px}.hpnV1q_chevron{display:none}.hpnV1q_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Q={actions:`hpnV1q_actions`,artwork:`hpnV1q_artwork`,back:`hpnV1q_back`,button:`hpnV1q_button`,chevron:`hpnV1q_chevron`,count:`hpnV1q_count`,danger:`hpnV1q_danger`,description:`hpnV1q_description`,detail:`hpnV1q_detail`,error:`hpnV1q_error`,group:`hpnV1q_group`,groupTitle:`hpnV1q_groupTitle`,header:`hpnV1q_header`,heading:`hpnV1q_heading`,hint:`hpnV1q_hint`,iconButton:`hpnV1q_iconButton`,intro:`hpnV1q_intro`,link:`hpnV1q_link`,list:`hpnV1q_list`,meta:`hpnV1q_meta`,name:`hpnV1q_name`,notice:`hpnV1q_notice`,open:`hpnV1q_open`,packageImage:`hpnV1q_packageImage`,page:`hpnV1q_page`,recovery:`hpnV1q_recovery`,row:`hpnV1q_row`,rowNotice:`hpnV1q_rowNotice`,rowText:`hpnV1q_rowText`,source:`hpnV1q_source`,summary:`hpnV1q_summary`,title:`hpnV1q_title`};function Qf({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 $f({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 ep(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 tp(e){if(e instanceof Rl&&e.code===`auth/local-access-required`){let t=Us.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 np({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 Vf.list(e.signal).then(t=>{e.signal.aborted||o({kind:`ready`,data:t})},t=>{e.signal.aborted||o(tp(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=tp(t);return n.kind===`non-local`?o(n):f(e(`extensions.actionFailed`,{message:Kf(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`,()=>Vf.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,...ep(T,t)},D=(e,t)=>{v(e,()=>Vf.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`,()=>Vf.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)(Xf,{t:e,open:s,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>Vf.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}=ep(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)($f,{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)(Qf,{url:n.projectUrl,t:e}),/* @__PURE__ */ (0,a.jsx)(i.Switch,{label:s,checked:r,disabled:w||C!==void 0,onChange:e=>D(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:Kf(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)($f,{src:E.meta?.icon}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,a.jsx)(Qf,{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,()=>Vf.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=>D(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:Kf(E.loadError,e)})})]}),y]})}let rp=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(rp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=rp,e.textContent=`.xuyymG_row{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:8px;padding:16px 0;display:flex}.xuyymG_rowText{flex-direction:column;flex:220px;gap:4px;min-width:0;display:flex}.xuyymG_actions{gap:8px;display:flex}.xuyymG_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.xuyymG_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.xuyymG_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}.xuyymG_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.xuyymG_button:focus-visible{outline-offset:2px;outline:2px solid}.xuyymG_button:disabled{opacity:.6;cursor:default}@media (width<=600px){.xuyymG_row{flex-direction:column;align-items:stretch;gap:12px}.xuyymG_rowText{flex:auto}.xuyymG_actions{grid-auto-columns:1fr;grid-auto-flow:column;display:grid}}`,document.head.appendChild(e)}var ip={actions:`xuyymG_actions`,button:`xuyymG_button`,desc:`xuyymG_desc`,row:`xuyymG_row`,rowText:`xuyymG_rowText`,title:`xuyymG_title`};function ap({t:e}){let[t,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(!1),[s,c]=(0,r.useState)(null);(0,r.useEffect)(()=>{cd().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:ip.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:ip.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:ip.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:ip.desc,role:s===null?void 0:`alert`,children:u})]}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:ip.actions,children:[t===`on`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:ip.button,disabled:i,onClick:()=>{Kl.test()},children:e(`notifications.test`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:ip.button,disabled:i,onClick:()=>{l(t===`on`?dd:ud)},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=`.lNmzTG_section{padding:16px 0}.lNmzTG_row{flex-wrap:wrap;align-items:center;gap:12px 24px;display:flex}.lNmzTG_text{flex:180px;min-width:0}.lNmzTG_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.lNmzTG_description,.lNmzTG_guide{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.lNmzTG_description{margin-top:4px}.lNmzTG_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}.lNmzTG_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.lNmzTG_button:focus-visible{outline-offset:2px;outline:2px solid}.lNmzTG_button:disabled{opacity:.6;cursor:default}.lNmzTG_guide{margin-top:12px}.lNmzTG_guide p{margin:8px 0 0}@media (width<=600px){.lNmzTG_row{flex-direction:column;align-items:stretch;gap:12px}.lNmzTG_text{flex:auto}}`,document.head.appendChild(e)}var sp={button:`lNmzTG_button`,description:`lNmzTG_description`,guide:`lNmzTG_guide`,row:`lNmzTG_row`,section:`lNmzTG_section`,text:`lNmzTG_text`,title:`lNmzTG_title`};function cp({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:sp.section,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:sp.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:sp.text,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:sp.title,children:t(`pwa.title`)}),d!==null&&/* @__PURE__ */ (0,a.jsx)(`div`,{id:l,className:sp.description,role:n===`failed`?`alert`:`status`,children:d})]}),n!==`installed`&&/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:sp.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:sp.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 lp=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(lp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=lp,e.textContent=`.K3vHcW_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.K3vHcW_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.K3vHcW_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.K3vHcW_heading{flex:320px;min-width:0}.K3vHcW_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.K3vHcW_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.K3vHcW_refresh{flex:none;margin-top:2px}.K3vHcW_tabs{flex-wrap:wrap;gap:8px;display:flex}.K3vHcW_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}.K3vHcW_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.K3vHcW_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}.K3vHcW_tab:focus-visible,.K3vHcW_search:focus-visible,.K3vHcW_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.K3vHcW_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.K3vHcW_tab:disabled{opacity:.5;cursor:default}.K3vHcW_searchField{display:block;position:relative}.K3vHcW_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.K3vHcW_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}.K3vHcW_search::placeholder{color:var(--dsw-alias-label-tertiary)}.K3vHcW_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)}.K3vHcW_search:focus-visible{outline:none}.K3vHcW_search:disabled{opacity:.6}.K3vHcW_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}.K3vHcW_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)}.K3vHcW_calloutIcon{flex:none;margin-top:2px}.K3vHcW_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}.K3vHcW_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}.K3vHcW_row+.K3vHcW_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.K3vHcW_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.K3vHcW_row:hover:before,.K3vHcW_row:hover+.K3vHcW_row:before{opacity:0}.K3vHcW_rowText{flex:1;min-width:0}.K3vHcW_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.K3vHcW_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}.K3vHcW_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.K3vHcW_metaIcon{opacity:.8;flex:none}.K3vHcW_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.K3vHcW_action{flex:none;min-width:64px}.K3vHcW_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.K3vHcW_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}.K3vHcW_emptyIcon{color:var(--dsw-alias-label-tertiary)}.K3vHcW_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}.K3vHcW_pageSize{align-items:center;gap:8px;display:inline-flex}.K3vHcW_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}.K3vHcW_select:disabled{opacity:.6;cursor:default}.K3vHcW_pager{align-items:center;gap:6px;display:inline-flex}.K3vHcW_range{font-variant-numeric:tabular-nums;margin-right:6px}.K3vHcW_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var $={action:`K3vHcW_action`,callout:`K3vHcW_callout`,calloutIcon:`K3vHcW_calloutIcon`,empty:`K3vHcW_empty`,emptyIcon:`K3vHcW_emptyIcon`,footer:`K3vHcW_footer`,header:`K3vHcW_header`,heading:`K3vHcW_heading`,inner:`K3vHcW_inner`,list:`K3vHcW_list`,metaIcon:`K3vHcW_metaIcon`,metaItem:`K3vHcW_metaItem`,metaText:`K3vHcW_metaText`,page:`K3vHcW_page`,pageButton:`K3vHcW_pageButton`,pageSize:`K3vHcW_pageSize`,pager:`K3vHcW_pager`,range:`K3vHcW_range`,refresh:`K3vHcW_refresh`,row:`K3vHcW_row`,rowMeta:`K3vHcW_rowMeta`,rowText:`K3vHcW_rowText`,rowTitle:`K3vHcW_rowTitle`,search:`K3vHcW_search`,searchField:`K3vHcW_searchField`,searchIcon:`K3vHcW_searchIcon`,select:`K3vHcW_select`,status:`K3vHcW_status`,subtitle:`K3vHcW_subtitle`,tab:`K3vHcW_tab`,tabIcon:`K3vHcW_tabIcon`,tabs:`K3vHcW_tabs`,title:`K3vHcW_title`};function up(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 dp(e){return e instanceof Error?e.message:String(e)}function fp({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),[D,O]=(0,r.useState)({}),k=(0,r.useRef)(!1),ee=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=new AbortController;return ee.current=e,()=>e.abort()},[]),(0,r.useEffect)(()=>{let e=!0;return S(null),ql.sources().then(({harnesses:t})=>{e&&(o(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(dp(t))}),()=>{e=!1}},[h]),(0,r.useEffect)(()=>{if(s===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{ql.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(dp(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[s,l,d,p,h]);let A=(0,r.useMemo)(()=>/^(\/Users\/[^/]+|\/home\/[^/]+)/u.exec(_?.[0]?.cwd??``)?.[1],[_]),te=e=>A!==void 0&&(e===A||e.startsWith(`${A}/`))?`~${e.slice(A.length)}`:e,ne=async n=>{let r=ee.current?.signal;if(s===null||k.current||!r||r.aborted)return;let i=JSON.stringify([s,n.nativeSessionId]),a=D[i];k.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await ql.importSession(s,n.nativeSessionId);if(a=e.threadId,r.aborted)return;O(t=>({...t,[i]:e.threadId}))}r.aborted||await e(a,r)}catch(e){r.aborted||w(t(a?`openFailed`:`importFailed`,{message:dp(e)}))}finally{k.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=D[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:te(e.cwd)})]}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:$.metaItem,children:[/* @__PURE__ */ (0,a.jsx)(i.IconClockOutlineRegular,{size:13,className:$.metaIcon}),up(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 pp=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(pp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=pp,e.textContent=`.Ux8MVa_host{min-width:0;display:block}.Ux8MVa_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var mp={error:`Ux8MVa_error`,host:`Ux8MVa_host`};let hp;function gp(){return hp??=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 hp=void 0,e}),hp}function _p({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(``),gp().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:mp.error,children:e(`settings.unavailable`,{message:s})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:mp.host})]})}let vp={"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.`},yp={"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":`录音文件不可用。`},bp=`codexhostImport`,xp=`codexhost-import`,Sp=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`inputTriggers`,`theme`,`connection`],Cp=[[`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 wp(e){e.effect(()=>e.locale.register(bp,{zh:yp,en:vp}),`ui-codexhost: dictionaries`);let t=e.locale.bind(bp),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:bp,inject:()=>({installation:n})},cp)),e.provide(`chatMessageEditing`,Yl),e.provide(`chatTurnDiffs`,Jl),e.inject([`conversation`,`uiSession`],fu),e.inject([`conversation`],e=>{let t=new mu(Hl.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:bp,inject:()=>i},Nu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:bp,inject:()=>({screenshot:t,drafts:r})},zu));let a=new Vu(zl.transcribe),o=new Gu;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:bp,inject:()=>({voice:a,blocks:e.conversation.blocks,tray:o})},Ju)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:bp,inject:()=>({voice:a,tray:o})},Yu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:bp,inject:()=>({voice:a})},Qu)),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=>{tu(e),nu(e)});let i=t=>{let n=cu(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)(nd,{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:au,subscribe:t=>e.sessions.list.subscribe(t)})}),du(e);let a={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:xp,locale:bp,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)}})},fp)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:xp,order:10,label:()=>t(`panel`),locale:bp},ed)),e.inject([`settingsNavigation`],e=>{e.slots.inject(`sidebar.primary.action`,()=>e.slots.register({name:`sidebar.primary.action`,id:`codexhost-remote-access`,locale:bp,inject:()=>({openSection:t=>e.settingsNavigation.openSection(t)})},td))}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:bp},ap));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:bp,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},np)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:1,label:()=>t(`remoteAccess`),locale:bp},zf)),Cp.forEach(([n,r,i])=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:i,label:()=>t(r),locale:bp,inject:()=>({pageId:n,locale:o,colorScheme:s})},_p))});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})},nd));e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:bp,inject:()=>({list:e.sessions.list,connection:e.get(`connection`)})},vd)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.session-opening`,locale:bp,inject:()=>({navigation:e.uiWorkspace})},yd)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:bp},zd)),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`),fd(),pd(),e.effect(()=>gd(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=bp,n.PANEL_ID=xp,n.apply=wp,n.inject=Sp,t.exports}});
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=Ps(a);return{insert:{source:Ns,ref:o,label:a.name,appearance:`skill`,clipboardText:o}}}}))}function yu(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let bu=`codexhost-thread`,xu=/(?<![\w:/])(?:codex:\/\/threads\/|thread:\/\/)[^\s<>()\[\]`"',。!?;:、]+(?<![.,;])/gu;function Su(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 Cu(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function wu(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 Tu(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Cu(e)})`;return{source:bu,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Eu(e,t){let n=e.sessions.list.getSnapshot().byId[t];return n!==void 0&&e.sessions.subagentAddress(t)===void 0&&(Su(n)!==void 0||n.blank&&n.projectionValues?.harnessIdentity!=null)}function Du(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>Eu(e,t);e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:bu,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=Su(t);if(n===void 0)return[];let r=u.get(e)??(yu(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,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:Su(a);return!r(t.session.sessionId)||o===void 0||n===t.session.sessionId||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)?`handled`:{insert:Tu(o)}}}),`ui-codexhost: Thread reference discovery`)}function Ou(e){let t=()=>{if(e.layout.panelInfo.getSnapshot().activePanelId===null)return e.uiSession.adapter.current.getSnapshot().key},n=n=>{let r=t();if(r===void 0||n===r)return;let i=e.sessions.binding(r);if(i===void 0)return;let a=()=>{let t=e.sessions.list.getSnapshot().byId[n];if(!(t===void 0||t.id!==n||e.sessions.binding(n)?.session.getSnapshot().removed===!0||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)))return Su(t)};if(a()===void 0)return;let o=e.conversation.input.captureReferenceInsertion(i);if(o===void 0)return;let s=!1,c=()=>((t()!==r||e.sessions.binding(r)!==i||e.workspaces.list.getSnapshot().archivedSessionIds.includes(r)||a()===void 0)&&(s=!0),!s&&o.getSnapshot());return{getSnapshot:c,subscribe:t=>{let n=()=>{c(),t()},r=[e.sessions.list.subscribe(n),e.uiSession.adapter.current.subscribe(n),e.workspaces.list.subscribe(n),e.layout.panelInfo.subscribe(n),o.subscribe(n)];return()=>r.forEach(e=>e())},insert:()=>{let e=c();s=!0;let t=a();return!(!e||t===void 0||!o.insert(Tu(t)))}}};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:n})},o.ReferenceSessionMenuItem))}let ku={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var Au=class{capture;store=(0,s.createSnapshotStore)(ku);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:Yl(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(ku),n!==void 0&&URL.revokeObjectURL(n.url)}};let ju=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function Mu(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function Nu(e){return Math.max(4,Math.round(e/250))}function Pu(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 Fu(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 Iu(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 Lu(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 Ru(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 zu(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 Bu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Bu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Bu,e.textContent=`.Q216aa_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.Q216aa_stage{position:absolute;top:50%;left:50%}.Q216aa_top,.Q216aa_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.Q216aa_top *,.Q216aa_bottom *{pointer-events:auto}.Q216aa_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.Q216aa_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.Q216aa_hidden{visibility:hidden;opacity:0}.Q216aa_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.Q216aa_spacer{flex:1}.Q216aa_text,.Q216aa_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}.Q216aa_text[aria-pressed=true]{background:#ffffff52}.Q216aa_text:disabled{opacity:.4;cursor:default}.Q216aa_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.Q216aa_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.Q216aa_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.Q216aa_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.Q216aa_area[data-annotating]{cursor:crosshair}.Q216aa_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}.Q216aa_canvas{background:#000;max-width:none;display:block}.Q216aa_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.Q216aa_compose{flex:1 0 100%;gap:8px;display:flex}.Q216aa_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}.Q216aa_message::placeholder{color:#ffffff8c}.Q216aa_primary:disabled{opacity:.5;cursor:default}.Q216aa_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%)}.Q216aa_cropHint,.Q216aa_cropSize{color:#ffffffbf;font-size:13px}.Q216aa_cropSize{font-variant-numeric:tabular-nums}.Q216aa_wide .Q216aa_compose{flex:320px}`,document.head.appendChild(e)}var q={area:`Q216aa_area`,bar:`Q216aa_bar`,bottom:`Q216aa_bottom`,canvas:`Q216aa_canvas`,compose:`Q216aa_compose`,cropHint:`Q216aa_cropHint`,cropSize:`Q216aa_cropSize`,error:`Q216aa_error`,hidden:`Q216aa_hidden`,hint:`Q216aa_hint`,message:`Q216aa_message`,primary:`Q216aa_primary`,root:`Q216aa_root`,spacer:`Q216aa_spacer`,stage:`Q216aa_stage`,swatch:`Q216aa_swatch`,text:`Q216aa_text`,top:`Q216aa_top`,wide:`Q216aa_wide`,zoomBadge:`Q216aa_zoomBadge`};function Vu(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 Hu,Uu=`codexhost.screenshot.zoom-hint`,Wu=[`pen`,`rect`,`arrow`];function Gu(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 Ku({src:e,t,onClose:n,onAttach:i,onSend:o}){let[s,l]=(0,r.useState)(),u=Gu(s?.url??e),[d,f]=(0,r.useState)(Hu??0),p=e=>{Hu=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)(ju[0]),[E,D]=(0,r.useState)([]),[O,k]=(0,r.useState)(),[ee,A]=(0,r.useState)(),[te,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(Uu)!==`1`}catch{return!1}}),[ce,le]=(0,r.useState)(!1),ue=(0,r.useRef)(),de=(0,r.useRef)(null),[fe,pe]=(0,r.useState)(()=>Vu(!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(Vu(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(Uu,`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}:Mu(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:Nu(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 O===void 0?E:[...E,O])Pu(t,e,Ne);g&&v!==void 0&&zu(t,v,{width:e.width,height:e.height},1/Math.max(xe*be,.01))}},[u,E,O,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,k(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:Iu(n,t,28/(xe*be));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:Lu(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(Fu(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Pe(e);t!==void 0&&k({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(Ru(r.before,t.x-r.start.x,t.y-r.start.y,n)):y(Fu(r.kind===`new`?r.from:r.anchor,t,n))}else if(O!==void 0){let t=Pe(e);if(t===void 0)return;k({...O,points:O.tool===`pen`?[...O.points,t]:[O.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),O!==void 0&&!t&&D(e=>[...e,O]),k(void 0)},ze=()=>{Te.current.clear(),Ee.current=void 0,De.current=void 0,x.current=void 0,j.current=void 0,k(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?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(n),blob:n}),D([]),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?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(e),blob:e}),D([]),h(!1)))},`image/png`)},qe=async()=>{try{let t=i(s?.blob??await(await fetch(e)).blob());t===null?n():A(t)}catch{A(t(`desktop.annotate.failed`))}},Je=async()=>{if(!ie){ae(!0),A(void 0);try{let t=await o(s?.blob??await(await fetch(e)).blob(),re.trim());t===null?n():A(t)}catch{A(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{A(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:q.root,role:`dialog`,"aria-modal":`true`,"aria-label":t(`desktop.label`),children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:q.stage,style:Qe,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:`${q.bar} ${q.top} ${te||Ze?``:q.hidden}`,children:g?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:Ue,children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.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:q.text,onClick:()=>{b.current++,h(!1)},children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.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:q.text,"aria-label":t(`desktop.close`),onClick:n,children:`✕`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.spacer}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.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:q.text,onClick:()=>p(d===90?270:90),children:t(`desktop.flip`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:()=>Ve(`crop`),children:t(`desktop.crop`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:()=>Ve(`annotate`),children:t(`desktop.annotate`)})]})}),/* @__PURE__ */ (0,a.jsxs)(`div`,{ref:_e,className:q.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:q.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:q.zoomBadge,onClick:Me,children:[String(Math.round(xe*100)),`% · `,t(`desktop.zoom.fit`)]})]}),oe&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:q.hint,role:`status`,children:t(`desktop.hint`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${q.bottom} ${te||Ze?``:q.hidden} ${Xe?q.wide:``}`,children:[ee!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,className:q.error,children:ee}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:q.bar,children:g?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.cropHint,children:t(`desktop.crop.hint`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.spacer}),v!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:q.cropSize,children:[String(Math.round(v.width)),` × `,String(Math.round(v.height))]})]}):m?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[Wu.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,"aria-pressed":S===e,onClick:()=>C(e),children:t(`desktop.tool.${e}`)},e)),/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.spacer}),ju.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.swatch,style:{background:e},"aria-label":e,"aria-pressed":w===e,onClick:()=>T(e)},e)),/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.spacer}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,disabled:E.length===0,onClick:()=>D(e=>e.slice(0,-1)),children:t(`desktop.annotate.undo`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,disabled:E.length===0,onClick:()=>D([]),children:t(`desktop.annotate.clear`)})]}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:q.compose,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{ref:de,className:q.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:q.primary,disabled:ie,onClick:()=>void Je(),children:t(`desktop.send`)})]}),s!==void 0&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:()=>l(void 0),children:t(`desktop.annotate.reset`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:q.spacer}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:()=>void Ye(),children:t(`desktop.save`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:q.text,onClick:()=>void qe(),children:t(`desktop.attach`)})]})})]})]})}),document.body)}let qu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=qu,e.textContent=`._8v5QXa_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}._8v5QXa_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}._8v5QXa_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._8v5QXa_entry:disabled{opacity:.45;cursor:default}._8v5QXa_entry[aria-busy=true]{opacity:1;cursor:progress}._8v5QXa_spinner{flex:none;animation:.8s linear infinite _8v5QXa_spin;display:inline-flex}._8v5QXa_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}._8v5QXa_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}._8v5QXa_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}._8v5QXa_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}._8v5QXa_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}._8v5QXa_elapsed{font-variant-numeric:tabular-nums;font-size:11px}._8v5QXa_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}._8v5QXa_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}._8v5QXa_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 _8v5QXa_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){._8v5QXa_spinner{animation:none}}@media (pointer:coarse){._8v5QXa_entry{width:40px;height:44px}._8v5QXa_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var Ju={alert:`_8v5QXa_alert`,bubble:`_8v5QXa_bubble`,busy:`_8v5QXa_busy`,caption:`_8v5QXa_caption`,dismiss:`_8v5QXa_dismiss`,elapsed:`_8v5QXa_elapsed`,entry:`_8v5QXa_entry`,entryBusy:`_8v5QXa_entryBusy`,float:`_8v5QXa_float`,spin:`_8v5QXa_spin`,spinner:`_8v5QXa_spinner`};function Yu({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:Xu}];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=Zu(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?`${Ju.entry} ${Ju.entryBusy}`:Ju.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:Ju.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Ju.elapsed,children:[f,`s`]})]}):/* @__PURE__ */ (0,a.jsx)(Xu,{size:16})})})}function Xu({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 Zu(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 Qu;function $u(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 ed(){return{x:window.innerWidth-60-12,y:72}}function td({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=Zu(u.startedAt),[g,_]=(0,r.useState)(()=>$u(Qu??ed())),[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=>$u(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:nd(p.loaded),total:p.total===void 0?`?`:nd(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,_($u({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?Qu=g:t||C())};return(0,c.createPortal)(/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ju.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,a.jsxs)(`button`,{type:`button`,className:Ju.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:Ju.busy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Ju.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Ju.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Ju.alert,children:`!`})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Ju.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:Ju.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,a.jsx)(Ku,{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 nd(e){return`${(e/1048576).toFixed(1)} MB`}var rd=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 id=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(id)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=id,e.textContent=`.iQSvMq_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}.iQSvMq_entry[data-live]{width:var(--voice-bar-width)}.iQSvMq_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}.iQSvMq_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.iQSvMq_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.iQSvMq_icon:focus-visible,.iQSvMq_round:focus-visible,.iQSvMq_send:focus-visible,.iQSvMq_done:focus-visible,.iQSvMq_primary:focus-visible,.iQSvMq_secondary:focus-visible,.iQSvMq_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.iQSvMq_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}.iQSvMq_round,.iQSvMq_send,.iQSvMq_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}.iQSvMq_round:hover:not(:disabled),.iQSvMq_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.iQSvMq_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.iQSvMq_wave,.iQSvMq_quiet{flex:none;width:90px;height:20px}.iQSvMq_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.iQSvMq_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.iQSvMq_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.iQSvMq_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.iQSvMq_sendFace,.iQSvMq_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.iQSvMq_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.iQSvMq_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.iQSvMq_send:hover:not(:disabled){filter:brightness(1.08)}.iQSvMq_send:disabled,.iQSvMq_done:disabled{opacity:.4;cursor:default}.iQSvMq_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite iQSvMq_spin}.iQSvMq_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.iQSvMq_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}.iQSvMq_strip .iQSvMq_round,.iQSvMq_strip .iQSvMq_done{width:26px;height:26px;position:relative}.iQSvMq_strip .iQSvMq_round:before,.iQSvMq_strip .iQSvMq_done:before{content:"";position:absolute;inset:-9px}.iQSvMq_strip .iQSvMq_meter{flex:1}.iQSvMq_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}.iQSvMq_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.iQSvMq_notice p{flex:220px;margin:0}.iQSvMq_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}.iQSvMq_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.iQSvMq_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.iQSvMq_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.iQSvMq_primary,.iQSvMq_secondary,.iQSvMq_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.iQSvMq_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.iQSvMq_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.iQSvMq_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.iQSvMq_secondary:hover,.iQSvMq_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes iQSvMq_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.iQSvMq_entry{transition:none}.iQSvMq_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.iQSvMq_entry{--voice-entry-size:44px}.iQSvMq_strip{margin-block:7px}.iQSvMq_icon{width:44px;height:44px}.iQSvMq_primary,.iQSvMq_secondary,.iQSvMq_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var J={actions:`iQSvMq_actions`,bar:`iQSvMq_bar`,card:`iQSvMq_card`,cardHead:`iQSvMq_cardHead`,cardText:`iQSvMq_cardText`,done:`iQSvMq_done`,doneFace:`iQSvMq_doneFace`,entry:`iQSvMq_entry`,icon:`iQSvMq_icon`,meter:`iQSvMq_meter`,notice:`iQSvMq_notice`,primary:`iQSvMq_primary`,quiet:`iQSvMq_quiet`,quietButton:`iQSvMq_quietButton`,round:`iQSvMq_round`,secondary:`iQSvMq_secondary`,send:`iQSvMq_send`,sendFace:`iQSvMq_sendFace`,spin:`iQSvMq_spin`,spinner:`iQSvMq_spinner`,status:`iQSvMq_status`,statusText:`iQSvMq_statusText`,strip:`iQSvMq_strip`,timer:`iQSvMq_timer`,wave:`iQSvMq_wave`};let ad=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function od(e){return(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var sd=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 cd=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,ld=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function ud({voice:e,blocks:t,tray:n,sessionId:o,inputActions:s,useInput:c,useSession:l,t:u}){let d=od(e),[f,p]=(0,r.useState)(!1),m=(0,r.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,r.useRef)(null),g=cd(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;$l.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:J.entry,"data-composer-tray":m?`stacked`:`inline`,"data-live":g&&!m?``:void 0,children:g&&!m?/* @__PURE__ */ (0,a.jsx)(fd,{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:ad,children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.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 dd({voice:e,tray:t,onActiveChange:n,t:i}){let o=od(e),s=(0,r.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&cd(o);return(0,r.useLayoutEffect)(()=>n(s),[s,n]),(0,r.useLayoutEffect)(()=>()=>n(!1),[n]),s?/* @__PURE__ */ (0,a.jsx)(fd,{voice:e,state:o,locked:!1,layout:`strip`,t:i}):null}function fd({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`?J.bar:J.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:J.round,"aria-label":o(`voice.cancel`),onClick:()=>e.cancel(),children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseOutlineMedium,{size:14})})}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.meter,children:s?t.silent?/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.quiet,role:`status`,children:o(`voice.silent`)}):/* @__PURE__ */ (0,a.jsx)(`svg`,{className:J.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:J.status,role:`status`,title:l,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spinner,"aria-hidden":`true`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.statusText,children:l})]})}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.timer,role:`timer`,children:ld(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:J.send,"aria-label":o(`voice.send`),disabled:n||!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.send(),children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.sendFace,children:/* @__PURE__ */ (0,a.jsx)(pd,{})})})}):null,/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:ad,children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.done,"aria-label":o(`voice.stop`),disabled:!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.stop(),children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.doneFace,children:/* @__PURE__ */ (0,a.jsx)(i.IconStopFillMedium,{size:9})})})})]})}function pd(){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 md({voice:e,t}){let n=od(e);if(n.phase===`cancelled`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.notice,role:`status`,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{children:t(`voice.cancelled`,{time:ld(n.seconds)})}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,a.jsx)(hd,{label:t(`voice.discard`),onClick:e.discard})]});if(n.phase===`text`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.card,role:`region`,"aria-label":t(`voice.label`),children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.cardHead,children:[/* @__PURE__ */ (0,a.jsx)(i.IconMicrophoneOutlineMedium,{size:14}),t(`voice.unplaced`)]}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:J.cardText,children:n.text}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.actions,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.quietButton,onClick:e.discard,children:t(`voice.discard`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.secondary,onClick:()=>void navigator.clipboard.writeText(n.text??``).catch(()=>{}),children:t(`voice.copy`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.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:J.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?J.secondary:J.primary,onClick:()=>e.rerecord(),children:t(`voice.rerecord`)}):null,s?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.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:J.secondary,onClick:()=>e.rerecord(),children:t(`voice.tryAgain`)}):null,/* @__PURE__ */ (0,a.jsx)(hd,{label:t(`voice.discard`),onClick:e.discard})]})}function hd({label:e,onClick:t}){return/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.round,"aria-label":e,onClick:t,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseOutlineMedium,{size:14})})}function gd({size:e}){return/* @__PURE__ */ (0,a.jsx)(i.IconDownloadOutlineRegular,{size:e})}let _d=`@deepseek-ai/dsh-client-ui-codexhost/DocumentDownload.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(_d)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=_d,e.textContent=`._6i4tZa_tool{box-sizing:border-box;width:28px;height:28px;color:var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-sm);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:6px;line-height:1;text-decoration:none;display:inline-flex}._6i4tZa_tool svg{width:15px;height:15px}._6i4tZa_tool:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}`,document.head.appendChild(e)}var vd={tool:`_6i4tZa_tool`};function yd({absolutePath:e,sessionId:t,label:n,openFolderLabel:o,openFolderFailedLabel:s,revealFolder:c}){let l=new URLSearchParams({sessionId:t,path:e}),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),m=e=>{let t=e?`${s} ${e}`:s;p(e=>({seq:(e?.seq??0)+1,text:t}))};return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{label:o,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:vd.tool,"aria-label":o,disabled:u,onClick:()=>{d(!0),(async()=>{try{let t=await c(e);t.ok||m(t.error.message)}catch(e){m(e instanceof Error?e.message:void 0)}finally{d(!1)}})()},children:/* @__PURE__ */ (0,a.jsx)(i.IconFolderOpenOutlineRegular,{})})}),/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{label:n,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,a.jsx)(`a`,{href:`/api/workspace-file/download?${l}`,download:!0,className:vd.tool,"aria-label":n,children:/* @__PURE__ */ (0,a.jsx)(i.IconDownloadOutlineRegular,{})})}),f&&/* @__PURE__ */ (0,a.jsx)(i.Toast,{text:f.text,onDone:()=>p(null)},f.seq)]})}function bd({size:e,renderAction:t,openSection:n,t:i}){let[o,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=new AbortController;return au(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 xd({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 Sd=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Sd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Sd,e.textContent=`.DWEYcq_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}.DWEYcq_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.DWEYcq_detail{color:var(--dsw-alias-label-tertiary)}.DWEYcq_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}.DWEYcq_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.DWEYcq_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var Cd={copy:`DWEYcq_copy`,detail:`DWEYcq_detail`,retry:`DWEYcq_retry`,status:`DWEYcq_status`};function wd(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 Td(){let e=/iPad|iPhone|iPod/u.test(navigator.userAgent),t=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0;return e&&!t}async function Ed(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function Dd(){return!(`serviceWorker`in navigator)||!(`PushManager`in window)||!(`Notification`in window)?Td()?`needs-install`:`unsupported`:Notification.permission===`denied`?`denied`:await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription()==null?`off`:`on`}async function Od(){let e=await Ed();await navigator.serviceWorker.ready;let t=await e.pushManager.getSubscription();if(t===null){let{publicKey:n}=await cu.config();t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:wd(n)})}await cu.subscribe(t.toJSON())}async function kd(){let e=await Notification.requestPermission();return e===`granted`?(await Od(),`on`):e===`denied`?`denied`:`off`}async function Ad(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await cu.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function jd(){`serviceWorker`in navigator&&Ed().catch(()=>void 0)}function Md(){`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window&&Notification.permission===`granted`&&Od().catch(()=>void 0)}let Nd=5e3,Pd=(0,s.createSnapshotStore)(!1),Fd=0,Id=/* @__PURE__ */ new Set;async function Ld(e){if(Fd+=1,Fd===1)for(let e of Id)e();try{return await e()}finally{if(--Fd,Fd===0)for(let e of Id)e()}}function Rd(e){let t,n,r=!1,i=0,a=document.visibilityState!==`hidden`,o=()=>!r&&Fd===0&&a&&document.visibilityState!==`hidden`&&e.getSnapshot()===`connecting`,s=()=>{clearTimeout(t),n?.abort(),n=void 0,i=0,Pd.set(!1)},c=async()=>{if(n!==void 0||!o())return;let e=new AbortController;n=e,clearTimeout(t),t=setTimeout(()=>e.abort(),Nd);let r=Date.now(),a=!1,s=!1;try{let t=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:e.signal});e.signal.aborted||(s=t.status===401,a=t.status===200)}catch{}n===e&&o()&&(n=void 0,clearTimeout(t),s?window.location.reload():(a&&(i=0,Pd.set(!1)),t=setTimeout(()=>{o()&&(a||(i+=1,Pd.set(i>=2)),c())},Math.max(0,Nd-(Date.now()-r)))))},l=()=>{o()?c():s()},u=()=>{let e=document.visibilityState!==`hidden`;e!==a&&(a=e,s(),l())},d=e=>{e.persisted&&u()},f=e.subscribe(l);return Id.add(l),document.addEventListener(`visibilitychange`,u),window.addEventListener(`pageshow`,d),l(),()=>{r=!0,s(),f(),Id.delete(l),document.removeEventListener(`visibilitychange`,u),window.removeEventListener(`pageshow`,d)}}async function zd(){await Ad().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,retryHistory:s,t:c}){let l=(0,r.useSyncExternalStore)(o.state.subscribe,o.state.getSnapshot),u=(0,r.useSyncExternalStore)(Pd.subscribe,Pd.getSnapshot),d=(0,r.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.nativeConnection?.state),f=(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}),p=(0,r.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.remoteHistoryError),m=t(e=>e.openState),h=t(e=>e.openError),[g,_]=(0,r.useState)(),v=g?.id===e&&!!g?.busy,y=g?.id===e?g?.error:void 0,b=()=>{if(e===void 0||v)return;let t=e;_({id:t,busy:!0}),s(t).then(()=>_(e=>e?.id===t?{id:t,busy:!1}:e),e=>_(n=>n?.id===t?{id:t,busy:!1,error:e instanceof Error?e.message:String(e)}:n))},[x,S]=(0,r.useState)(``),C=`${e}:${f??``}`,w=l===void 0||l===`connecting`,T=(0,i.useSustainedRecovery)(w),E=l===`disconnected`?`offline`:w?u?`computer`:T?l===void 0?`checking`:`reconnecting`:void 0:d===`reconnecting`?`host`:m===`error`&&!p?`error`:void 0,D=t(e=>E===void 0?void 0:e.lastSyncedAt);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[E?/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Cd.status,role:`status`,"data-web-connection":E,"data-native-connection":d===`reconnecting`?d:void 0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Cd.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:c(`connection.${E}`)}),D===void 0?null:/* @__PURE__ */ (0,a.jsx)(`span`,{className:Cd.detail,children:c(`connection.lastSynced`,{time:new Date(D).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Cd.retry,disabled:E===`error`&&v,onClick:E===`error`?b:()=>o.reconnect(),children:c(E===`error`&&v?`connection.retryingHistory`:`connection.retry`)})]}):null,p||E===`error`&&(y||h)?/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Cd.status,role:`alert`,"data-remote-history-error":p?.code,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Cd.copy,children:[p?/* @__PURE__ */ (0,a.jsx)(`span`,{children:c(`connection.historyStale`)}):null,/* @__PURE__ */ (0,a.jsx)(`span`,{className:Cd.detail,children:y??p?.message??h?.message})]}),p?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Cd.retry,disabled:v,onClick:b,children:c(v?`connection.retryingHistory`:`connection.retryHistory`)}):null]}):null,f&&x!==C?/* @__PURE__ */ (0,a.jsx)(i.Toast,{text:f,holdMs:8e3,onDone:()=>S(C)},C):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:Cd.status,role:n.state===`error`?`alert`:`status`,"data-session-opening":n.state,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Cd.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(n.state===`loading`?`opening.loading`:`opening.error`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Cd.detail,children:n.sessionId}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:Cd.detail,children:n.message}):null]}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Cd.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=`.k3cPXq_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}.k3cPXq_anchor[data-composer-stat=codexhost-quota]{order:-1}.k3cPXq_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;touch-action:manipulation;background:0 0;border:none;border-radius:999px;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.k3cPXq_pill:focus-visible,.k3cPXq_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}@media (hover:hover) and (pointer:fine){.k3cPXq_pill:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}.k3cPXq_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.k3cPXq_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(288px,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:12px;font-size:12px;line-height:18px;position:fixed;overflow:auto}.k3cPXq_panel header{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:20px}.k3cPXq_context{margin-top:8px}.k3cPXq_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.k3cPXq_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.k3cPXq_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.k3cPXq_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.k3cPXq_group{margin-top:8px}.k3cPXq_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 3px;font-size:11px;font-weight:600}.k3cPXq_group dl{gap:3px;margin:0;display:grid}.k3cPXq_detail{grid-template-columns:minmax(100px,auto) minmax(0,1fr);gap:0 12px;display:grid}.k3cPXq_detail dt,.k3cPXq_detail dd,.k3cPXq_detail p{min-width:0;margin:0}.k3cPXq_detail dt{color:var(--dsw-alias-label-tertiary)}.k3cPXq_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.k3cPXq_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.k3cPXq_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.k3cPXq_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.k3cPXq_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}.k3cPXq_quotaRow+.k3cPXq_quotaRow{margin-top:9px}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_quotaRow+.k3cPXq_quotaRow{margin-top:8px}.k3cPXq_quotaGroup+.k3cPXq_quotaGroup{border-top:1px solid color-mix(in srgb, currentColor 12%, transparent);margin-top:11px;padding-top:10px}.k3cPXq_quotaGroupTitle{color:currentColor;margin:0 0 7px;font-size:12px;font-weight:600;line-height:1.3}.k3cPXq_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_quotaHeading{align-items:baseline;gap:8px;margin-bottom:4px}.k3cPXq_quotaDescription{min-width:0}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_quotaDescription{color:color-mix(in srgb, currentColor 82%, transparent);align-items:baseline;gap:6px;display:inline-flex}.k3cPXq_quotaInlineNote{color:color-mix(in srgb, currentColor 52%, transparent);white-space:nowrap;font-size:11px}.k3cPXq_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}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_quotaHeading strong{font-size:13px;font-weight:600}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_quotaRow[data-hero-row] .k3cPXq_quotaHeading strong{margin-top:-6px;font-size:22px;font-weight:700;line-height:1}.k3cPXq_quotaGroup:first-child:not([data-scoped-group]) .k3cPXq_quotaRow:first-child .k3cPXq_quotaDescription>span{font-size:12.5px;font-weight:600}.k3cPXq_quotaGroup:first-child:not([data-scoped-group]) .k3cPXq_quotaRow:first-child .k3cPXq_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.k3cPXq_quotaGroup:first-child:not([data-scoped-group]) .k3cPXq_quotaRow:first-child .k3cPXq_remainingValue{font-size:26px;font-weight:700}.k3cPXq_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.k3cPXq_quotaGroup:first-child:not([data-scoped-group]) .k3cPXq_quotaRow:first-child p{font-size:11px}.k3cPXq_quotaPanel .k3cPXq_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.k3cPXq_quotaGroup[data-scoped-group] .k3cPXq_progressTrack{height:4px}.k3cPXq_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}.k3cPXq_resetCreditsFooter{border-top:1px solid color-mix(in srgb, currentColor 12%, transparent);justify-content:space-between;align-items:center;gap:8px;margin-top:11px;padding-top:10px;font-size:12px;display:flex}.k3cPXq_resetCreditsLeft{align-items:center;gap:6px;min-width:0;display:inline-flex}.k3cPXq_resetCreditsIcon{fill:none;width:14px;height:14px;stroke:color-mix(in srgb, currentColor 62%, transparent);stroke-width:1.35px;stroke-linecap:round;stroke-linejoin:round;flex:none}.k3cPXq_resetCreditsCopy{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:color-mix(in srgb, currentColor 88%, transparent);overflow:hidden}.k3cPXq_resetCreditsExpiry{color:color-mix(in srgb, currentColor 54%, transparent);font-size:10.5px}.k3cPXq_resetCreditsPill{font-variant-numeric:tabular-nums;white-space:nowrap;color:color-mix(in srgb, var(--reset-credits-color) 86%, currentColor);background:color-mix(in srgb, var(--reset-credits-color) 16%, transparent);border:1px solid color-mix(in srgb, var(--reset-credits-color) 28%, transparent);border-radius:999px;flex:none;align-items:center;padding:2px 7px;font-size:11.5px;font-weight:600;line-height:1.35;display:inline-flex}@media (width<=640px){.k3cPXq_anchor{max-width:min(280px,56vw)}}`,document.head.appendChild(e)}var Y={anchor:`k3cPXq_anchor`,context:`k3cPXq_context`,contextRow:`k3cPXq_contextRow`,detail:`k3cPXq_detail`,group:`k3cPXq_group`,label:`k3cPXq_label`,panel:`k3cPXq_panel`,pill:`k3cPXq_pill`,progressFill:`k3cPXq_progressFill`,progressTrack:`k3cPXq_progressTrack`,quotaDescription:`k3cPXq_quotaDescription`,quotaFill:`k3cPXq_quotaFill`,quotaGroup:`k3cPXq_quotaGroup`,quotaGroupTitle:`k3cPXq_quotaGroupTitle`,quotaHeading:`k3cPXq_quotaHeading`,quotaInlineNote:`k3cPXq_quotaInlineNote`,quotaPanel:`k3cPXq_quotaPanel`,quotaRing:`k3cPXq_quotaRing`,quotaRow:`k3cPXq_quotaRow`,remainingLabel:`k3cPXq_remainingLabel`,remainingValue:`k3cPXq_remainingValue`,resetCreditsCopy:`k3cPXq_resetCreditsCopy`,resetCreditsExpiry:`k3cPXq_resetCreditsExpiry`,resetCreditsFooter:`k3cPXq_resetCreditsFooter`,resetCreditsIcon:`k3cPXq_resetCreditsIcon`,resetCreditsLeft:`k3cPXq_resetCreditsLeft`,resetCreditsPill:`k3cPXq_resetCreditsPill`,ringTrack:`k3cPXq_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,n=`usage.reset.at`){if(e===void 0)return null;let r=new Date(typeof e==`number`?e*1e3:e);if(Number.isNaN(r.getTime()))return null;let i=/* @__PURE__ */ new Date,a=r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate(),o=t(`usage.dateLocale`);return t(n,{time:a?t(`usage.reset.today`,{time:r.toLocaleTimeString(o,{hour:`numeric`,minute:`2-digit`})}):r.toLocaleString(o,{month:o===`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.sessionOutputTokensPerSecond!==void 0)return[Jd(e.sessionOutputTokensPerSecond,t)];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=[];e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond!==void 0&&r.push({label:t(`usage.speed.api`),value:Jd(e.apiOutputTokensPerSecond,t)}):r.push({label:t(`usage.speed`),value:Jd(e.outputTokensPerSecond,t)}),e.sessionOutputTokensPerSecond!==void 0&&r.push({label:t(`usage.speed.average`),value:Jd(e.sessionOutputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&r.push({label:t(`usage.ttft`),value:Yd(e.timeToFirstOutputMs,t)}),r.length&&n.push({label:t(`usage.group.performance`),rows:r});let i=[];e.cacheHitRatePercent!==void 0&&i.push({label:t(`usage.cache.latest`),value:Kd(e.cacheHitRatePercent)}),e.sessionCacheHitRatePercent!==void 0&&i.push({label:t(`usage.cache.average`),value:Kd(e.sessionCacheHitRatePercent)}),i.length&&n.push({label:t(`usage.group.cache`),rows:i});let a=[];e.totalCredits!==void 0&&a.push({label:t(`usage.credits`),value:Zd(e.totalCredits,t)}),a.length&&n.push({label:t(`usage.group.session`),rows:a});let o=[],s=Xd(e);s!==null&&o.push({label:e.costSource===`publicPrice`?t(`usage.cost.estimate`):t(`usage.cost`),value:s,...e.unpricedModels?.length?{note:`${t(`usage.unpriced`)}: ${e.unpricedModels.join(`, `)}`}:{}}),(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){if(!e)return`#3d9a64`;let n=Date.parse(e);if(!Number.isFinite(n))return`#3d9a64`;let r=n-t;return r<=288e5?`#c45c4a`:r<=864e5?`#c9a227`:`#3d9a64`}function of(e,t,n,r){let i=[],a=n(`usage.dateLocale`),o=e=>{if(e===void 0)return{text:null,title:void 0};let t=Qd(e,n)??void 0;return{text:pc(e,a,r)??t??null,title:t}};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=o(a);t.push({label:r,value:Kd(nf(i)),remaining:nf(i),...e.text?{note:e.text}:{},...e.title?{noteTitle:e.title}:{}})}t.length&&i.push({label:n(`usage.group.plan`),rows:t})}if(t){let e=lc(t,a,e=>n(e===`five_hour`?`usage.plan.fiveHour`:e===`seven_day`?`usage.plan.sevenDay`:e===`weekly`?`usage.plan.weekly`:e===`monthly`?`usage.plan.monthly`:`usage.group.quota`),e=>n(e===`five_hour`?`usage.plan.fiveHour.short`:e===`seven_day`?`usage.plan.sevenDay.short`:e===`weekly`?`usage.plan.weekly.short`:e===`monthly`?`usage.plan.monthly.short`:`usage.group.quota`));for(let[t,s]of e.entries()){let e=s.title!==void 0,c=[];for(let t of s.windows){let i=$d(t.used,t.limit,t.unit),s=e?{text:t.resetsAt!==void 0&&t.usedPercent>0?mc(t.resetsAt,a,r)??Qd(t.resetsAt,n):null,title:t.resetsAt===void 0?void 0:Qd(t.resetsAt,n)??void 0}:o(t.resetsAt),l=[i?e?i:`${n(`usage.quota`)}: ${i}`:null,s.text].filter(Boolean).join(` · `);c.push({label:t.label,...t.scopeLabel?{scopeLabel:t.scopeLabel}:{},value:Kd(nf(t.usedPercent)),remaining:nf(t.usedPercent),...l?{note:l}:{},...s.title?{noteTitle:s.title}:{}})}c.length&&i.push({label:s.title??(t===0?n(`usage.group.quota`):`${n(`usage.group.quota`)}-${t}`),...s.title?{title:s.title}:{},rows:c})}}return i}function sf({resetCredits:e,t,nowMs:n}){let r=t(`usage.dateLocale`),i=Qd(e.nextExpiresAt,t,`usage.expires.at`)??void 0,o=e.nextExpiresAt===void 0?null:hc(e.nextExpiresAt,r,n)??i,s=af(e.nextExpiresAt,n);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.resetCreditsFooter,style:{"--reset-credits-color":s},children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.resetCreditsLeft,title:i,children:[/* @__PURE__ */ (0,a.jsxs)(`svg`,{className:Y.resetCreditsIcon,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M2.25 5.25a1 1 0 0 1 1-1h9.5a1 1 0 0 1 1 1v1.45a1.3 1.3 0 0 0 0 2.6v1.45a1 1 0 0 1-1 1h-9.5a1 1 0 0 1-1-1V9.3a1.3 1.3 0 0 0 0-2.6V5.25Z`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M6 4.5v7`,strokeDasharray:`1.5 1.8`})]}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.resetCreditsCopy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(`usage.resetCredits.short`)}),o&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.resetCreditsExpiry,children:[` · `,o]})]})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.resetCreditsPill,children:t(`usage.resetCredits.count`,{count:String(e.availableCount)})})]})}function cf({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:Y.context,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.contextRow,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(`usage.context`)}),/* @__PURE__ */ (0,a.jsx)(`strong`,{children:r})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Y.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:Y.progressFill,style:{width:`${Math.min(100,Math.max(0,n))}%`}})})]})}function lf({groups:e}){return e.map(e=>/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Y.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:Y.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 uf({useProjection:e,t}){let n=e(`codexhostUsage`),i=n?.usage??null,o=n?.accountCredits,[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{if(!s)return;u(Date.now());let e=window.setInterval(()=>u(Date.now()),6e4);return()=>window.clearInterval(e)},[s]);let d=(0,r.useMemo)(()=>ef(i,t),[i,t]),f=(0,r.useMemo)(()=>tf(i,t),[i,t]),p=(0,r.useMemo)(()=>of(i,o,t,l),[i,o,t,l]),m=(0,r.useMemo)(()=>p.findIndex(e=>e.title!==void 0),[p]),h=p.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),g=i!==null&&qd(i)!==void 0,_=d.join(` · `);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[h&&/* @__PURE__ */ (0,a.jsxs)(df,{stat:`codexhost-quota`,onOpenChange:c,panelStyle:{"--quota-color":rf(h.remaining??100)},label:`${t(`usage.quota.remaining`)}: ${h.value}`,title:t(`usage.quota.details`),trigger:/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`svg`,{className:Y.quotaRing,style:{stroke:rf(h.remaining??100)},viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(`circle`,{className:Y.ringTrack,cx:`10`,cy:`10`,r:`7`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`10`,cy:`10`,r:`7`,pathLength:`100`,strokeDasharray:`${h.remaining} 100`,transform:`rotate(-90 10 10)`})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:h.value})]}),children:[p.map((e,n)=>/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Y.quotaGroup,"data-scoped-group":e.title?``:void 0,"aria-label":e.label,children:[e.title&&/* @__PURE__ */ (0,a.jsx)(`h4`,{className:Y.quotaGroupTitle,children:e.title}),e.rows.map((r,i)=>/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.quotaRow,"data-hero-row":n===m&&i===0?``:void 0,style:{"--quota-color":rf(r.remaining??100)},children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.quotaHeading,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.quotaDescription,title:e.title&&!r.note?r.noteTitle:void 0,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:r.scopeLabel?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:r.scopeLabel}),` · `,r.label]}):r.label}),e.title?r.note&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.quotaInlineNote,title:r.noteTitle,children:[`· `,r.note]}):r.note&&/* @__PURE__ */ (0,a.jsx)(`p`,{title:r.noteTitle,children:r.note})]}),/* @__PURE__ */ (0,a.jsxs)(`strong`,{children:[r.remaining!==void 0&&!e.title&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.remainingLabel,children:[t(`usage.quota.remaining`),` `]}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.remainingValue,children:r.value})]})]}),r.remaining!==void 0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:Y.progressTrack,role:`progressbar`,"aria-label":`${r.scopeLabel?`${r.scopeLabel} · ${r.label}`:r.label}: ${t(`usage.quota.remaining`)}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.remaining,children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.quotaFill,style:{width:`${r.remaining}%`}})})]},`${r.scopeLabel??``}:${r.label}:${i}`))]},e.label)),o?.resetCredits&&/* @__PURE__ */ (0,a.jsx)(sf,{resetCredits:o.resetCredits,t,nowMs:l})]}),d.length>0&&(f.length>0||g)&&/* @__PURE__ */ (0,a.jsxs)(df,{stat:`codexhost-usage`,label:`${t(`usage.title`)}: ${_}`,title:t(`usage.details`),trigger:/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.label,children:_}),children:[/* @__PURE__ */ (0,a.jsx)(`header`,{children:t(`usage.title`)}),/* @__PURE__ */ (0,a.jsx)(cf,{usage:i,t}),/* @__PURE__ */ (0,a.jsx)(lf,{groups:f})]})]})}function df({stat:e,label:t,title:n,trigger:o,children:s,panelStyle:l,onOpenChange:u}){let[d,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{u?.(d)},[u,d]);let p=(0,r.useRef)(!1),m=(0,r.useRef)(null),h=(0,r.useRef)(null),g=(0,r.useRef)(null),_=(0,r.useRef)(null),v=(0,r.useRef)(null),y=(0,i.useAnchoredPosition)({open:d,anchorRef:_,panelRef:v,side:`top`,gap:8,margin:12}),b=(0,r.useCallback)(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),x=(0,r.useCallback)(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)},[]),S=(0,r.useCallback)(()=>{b(),x(),p.current=!1,f(!1)},[x,b]),C=(0,r.useCallback)(()=>{x(),!d&&(b(),m.current=window.setTimeout(()=>{m.current=null,f(!0)},160))},[x,b,d]),w=(0,r.useCallback)(()=>{b(),x(),h.current=window.setTimeout(()=>{h.current=null,!p.current&&_.current?.matches(`:hover`)!==!0&&v.current?.matches(`:hover`)!==!0&&!_.current?.contains(document.activeElement)&&f(!1)},140)},[x,b]);return(0,i.useDismissOnOutsidePointer)(_,d,e=>{e||S()},v),(0,r.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&S()},t=e=>{e.target instanceof Node&&v.current?.contains(e.target)||S()};return document.addEventListener(`keydown`,e),window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),()=>{document.removeEventListener(`keydown`,e),window.removeEventListener(`scroll`,t,!0)}},[S,d]),(0,r.useEffect)(()=>()=>{m.current!==null&&window.clearTimeout(m.current),h.current!==null&&window.clearTimeout(h.current)},[]),/* @__PURE__ */ (0,a.jsxs)(`span`,{ref:_,className:Y.anchor,"data-composer-stat":e,onPointerEnter:e=>{e.pointerType===`mouse`&&C()},onPointerLeave:e=>{e.pointerType===`mouse`&&w()},children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.pill,"aria-label":t,"aria-haspopup":`dialog`,"aria-expanded":d,onFocus:e=>{e.currentTarget.matches(`:focus-visible`)&&(x(),f(!0))},onBlur:w,onPointerDown:e=>{e.pointerType===`mouse`?g.current=null:g.current={x:e.clientX,y:e.clientY,moved:!1}},onPointerMove:e=>{let t=g.current;t&&!t.moved&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>8&&(t.moved=!0)},onPointerCancel:()=>{g.current&&(g.current.moved=!0)},onClick:()=>{let e=g.current;g.current=null,!e?.moved&&(b(),x(),d&&p.current?S():(p.current=!0,f(!0)))},children:o}),d&&(0,c.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{ref:v,className:`${Y.panel} ${e===`codexhost-quota`?Y.quotaPanel:``}`,style:{...l,...y??Ud},role:`dialog`,"aria-label":n,onPointerEnter:e=>{e.pointerType===`mouse`&&x()},onPointerLeave:e=>{e.pointerType===`mouse`&&w()},children:s}),document.body)]})}let ff=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ff)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=ff,e.textContent=`.HpjsdG_page{flex-direction:column;gap:24px;min-width:0;display:flex}.HpjsdG_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.HpjsdG_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}.HpjsdG_description,.HpjsdG_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}.HpjsdG_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.HpjsdG_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}.HpjsdG_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}.HpjsdG_status[data-active=true]:before{background:#65af91}.HpjsdG_connection{flex-direction:column;gap:24px;display:flex}.HpjsdG_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}.HpjsdG_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}.HpjsdG_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}.HpjsdG_qrButton{color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:12px;flex-direction:column;align-items:center;gap:8px;padding:0;display:flex}.HpjsdG_qrButton:disabled{cursor:default;opacity:.7}.HpjsdG_qrFrame{background:#fff;border-radius:12px;padding:8px;line-height:0;display:block;position:relative;overflow:hidden}.HpjsdG_qr{pointer-events:none;user-select:none;width:144px;height:144px;display:block}.HpjsdG_qrObscured{filter:blur(10px);opacity:.35}.HpjsdG_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}.HpjsdG_qrCover small{font-size:11px;line-height:16px}.HpjsdG_qrAction{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.HpjsdG_qrButton:hover:not(:disabled) .HpjsdG_qrAction{color:var(--dsw-alias-label-primary)}.HpjsdG_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}.HpjsdG_qrButton:focus-visible,.HpjsdG_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}.HpjsdG_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}.HpjsdG_routes{border:0;min-width:0;margin:0;padding:0}.HpjsdG_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}.HpjsdG_routeGroup,.HpjsdG_extraRoutes{flex-direction:column;gap:8px;display:flex}.HpjsdG_routeGroup,.HpjsdG_extraRoutes>.HpjsdG_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}.HpjsdG_routeGroup{gap:0;overflow:hidden}.HpjsdG_routeFamily,.HpjsdG_routeGroup>.HpjsdG_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}.HpjsdG_extraRoutes>.HpjsdG_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}.HpjsdG_routeGroup>.HpjsdG_route:has(input:checked),.HpjsdG_routeFamily:has(.HpjsdG_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}.HpjsdG_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}.HpjsdG_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}.HpjsdG_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}.HpjsdG_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}.HpjsdG_extraRoutes>.HpjsdG_route{border-radius:10px}.HpjsdG_route:hover{background:var(--dsw-alias-interactive-bg-hover)}.HpjsdG_route:has(input:disabled){cursor:default;opacity:.7}.HpjsdG_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}.HpjsdG_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}.HpjsdG_route>.HpjsdG_routeText{flex:1}.HpjsdG_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}.HpjsdG_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}.HpjsdG_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}.HpjsdG_addressRow{flex-wrap:wrap;gap:8px;display:flex}.HpjsdG_addressRow>button{flex:none}.HpjsdG_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}.HpjsdG_addressMenu{flex:140px;min-width:0}.HpjsdG_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}.HpjsdG_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.HpjsdG_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}.HpjsdG_addressTrigger:disabled{cursor:default;opacity:.7}.HpjsdG_other{min-width:0}.HpjsdG_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}.HpjsdG_page>.HpjsdG_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}.HpjsdG_page>.HpjsdG_other summary{color:var(--dsw-alias-label-secondary)}.HpjsdG_extraRoutes{margin-top:8px}.HpjsdG_connectionHelp{flex-direction:column;gap:10px;display:flex}.HpjsdG_relayFields,.HpjsdG_relayField{gap:4px;min-width:0;display:grid}.HpjsdG_relayFields{gap:10px}.HpjsdG_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}.HpjsdG_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}.HpjsdG_relayPreviewAddress span{flex-direction:column;display:flex}.HpjsdG_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}.HpjsdG_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}.HpjsdG_relayTutorial li+li{margin-top:6px}.HpjsdG_relayTutorial code{display:block}.HpjsdG_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}.HpjsdG_ready svg{color:#65af91;flex:none;margin-top:2px}.HpjsdG_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}.HpjsdG_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}.HpjsdG_manageRow+.HpjsdG_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}.HpjsdG_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}.HpjsdG_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}.HpjsdG_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.HpjsdG_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}.HpjsdG_dangerOutline{color:var(--dsw-alias-state-error-primary)}.HpjsdG_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}.HpjsdG_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}.HpjsdG_actions{flex-wrap:wrap;gap:8px;display:flex}.HpjsdG_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.HpjsdG_confirm{width:min(440px,100%)}.HpjsdG_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}.HpjsdG_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}@media (width<=600px){.HpjsdG_page{gap:16px}.HpjsdG_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}.HpjsdG_scan{border-right:0;align-self:center;padding-right:0}.HpjsdG_manage{padding:0 12px}.HpjsdG_stopRow{padding:16px 12px}.HpjsdG_routeAddress{flex-basis:100%;margin-left:0}.HpjsdG_title{font-size:20px}.HpjsdG_status{font-size:11px}}`,document.head.appendChild(e)}var X={actions:`HpjsdG_actions`,addressMenu:`HpjsdG_addressMenu`,addressRow:`HpjsdG_addressRow`,addressTrigger:`HpjsdG_addressTrigger`,badge:`HpjsdG_badge`,confirm:`HpjsdG_confirm`,connection:`HpjsdG_connection`,connectionDetails:`HpjsdG_connectionDetails`,connectionHelp:`HpjsdG_connectionHelp`,connectionMain:`HpjsdG_connectionMain`,dangerConfirm:`HpjsdG_dangerConfirm`,dangerOutline:`HpjsdG_dangerOutline`,description:`HpjsdG_description`,error:`HpjsdG_error`,extraRoutes:`HpjsdG_extraRoutes`,fieldTitle:`HpjsdG_fieldTitle`,header:`HpjsdG_header`,input:`HpjsdG_input`,link:`HpjsdG_link`,manage:`HpjsdG_manage`,manageActions:`HpjsdG_manageActions`,manageRow:`HpjsdG_manageRow`,manageText:`HpjsdG_manageText`,manageTitle:`HpjsdG_manageTitle`,meta:`HpjsdG_meta`,notice:`HpjsdG_notice`,other:`HpjsdG_other`,page:`HpjsdG_page`,qr:`HpjsdG_qr`,qrAction:`HpjsdG_qrAction`,qrButton:`HpjsdG_qrButton`,qrCover:`HpjsdG_qrCover`,qrFrame:`HpjsdG_qrFrame`,qrObscured:`HpjsdG_qrObscured`,qrPlaceholder:`HpjsdG_qrPlaceholder`,ready:`HpjsdG_ready`,relayField:`HpjsdG_relayField`,relayFields:`HpjsdG_relayFields`,relayPreview:`HpjsdG_relayPreview`,relayPreviewAddress:`HpjsdG_relayPreviewAddress`,relayTutorial:`HpjsdG_relayTutorial`,remoteList:`HpjsdG_remoteList`,route:`HpjsdG_route`,routeAddress:`HpjsdG_routeAddress`,routeFamily:`HpjsdG_routeFamily`,routeGroup:`HpjsdG_routeGroup`,routePanel:`HpjsdG_routePanel`,routeText:`HpjsdG_routeText`,routeTitle:`HpjsdG_routeTitle`,routes:`HpjsdG_routes`,scan:`HpjsdG_scan`,status:`HpjsdG_status`,stopRow:`HpjsdG_stopRow`,subRoute:`HpjsdG_subRoute`,subRoutes:`HpjsdG_subRoutes`,title:`HpjsdG_title`};function pf(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 su.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 mf({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:X.manageRow,"data-background-controls":!0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.manageTitle,children:o(`connectDevices.autostart`)}),e.autostart.status===`invalid`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.error,children:e.autostart.reason}),l!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{role:`alert`,className:X.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),su.autostart(e).then(async()=>{n(await su.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function hf(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function gf({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=Hs.safeParse(y).success,S=_!==``&&(!Hs.safeParse(_).success||!x&&b),C=(0,r.useId)(),[w,T]=(0,r.useState)(d?``:p?.split(`.`)[0]??``),[E,D]=(0,r.useState)(``),O=(0,r.useId)(),k=w!==``&&(d?!/^[a-z0-9]{4,20}$/.test(w):!Us.safeParse(w).success||`${w}.${_}`===y||_!==``&&!Hs.safeParse(`${w}.${_}`).success),ee=`certificate`in u?u.certificate.failure:void 0,A=ee?.paused===!0,te=u.status===`connected`&&!A&&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`):te?c(`connectDevices.relay.hint`):u.status===`stopped`?c(`connectDevices.relay.${u.reason}`):A?c(`connectDevices.relay.paused`):u.status===`off`?c(d?`connectDevices.relay.off`:`connectDevices.selfRelay.off`):hf(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(ee?.retryAt??``).toLocaleString()}):c(`connectDevices.relay.quota`);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.connectionHelp,"data-relay-status":u.status,children:[d&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.meta,children:t.officialHost}),!d&&l&&t.enabled&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.meta,children:c(`connectDevices.selfRelay.address`,{host:t.customHost??``})}),h&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.notice,children:c(`connectDevices.relay.closeFirst`)}),/* @__PURE__ */ (0,a.jsxs)(`p`,{className:te?X.ready:X.notice,role:`status`,children:[te&&/* @__PURE__ */ (0,a.jsx)(i.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:ne})]}),m!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(m).toLocaleString()})}),A&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.meta,children:ee.detail??c(`connectDevices.relay.unreachable`)}),u.status===`off`?/* @__PURE__ */ (0,a.jsxs)(`form`,{className:X.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:X.relayFields,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${X.relayField} ${X.notice}`,children:[c(`connectDevices.selfRelay.host`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:X.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?X.error:X.meta,role:S?`alert`:void 0,children:c(S?`connectDevices.selfRelay.invalidHost`:`connectDevices.selfRelay.hostHint`)}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${X.relayField} ${X.notice}`,children:[c(`connectDevices.selfRelay.name`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:X.input,value:w,placeholder:`mycomputer`,onChange:e=>T(e.target.value.toLowerCase()),"aria-invalid":k,"aria-describedby":O,autoCapitalize:`none`,spellCheck:!1,disabled:n||h})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{id:O,className:k?X.error:X.meta,role:k?`alert`:void 0,children:c(k?`connectDevices.selfRelay.invalidName`:`connectDevices.selfRelay.nameHint`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.relayPreview,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.notice,children:c(`connectDevices.selfRelay.previewTitle`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.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:X.meta,children:c(`connectDevices.selfRelay.address`,{host:y})})]}),d&&p===void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.relayFields,children:[f&&/* @__PURE__ */ (0,a.jsxs)(`p`,{className:X.meta,children:[c(`connectDevices.relay.beta`),` `,/* @__PURE__ */ (0,a.jsx)(`a`,{className:X.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:`${X.relayField} ${X.notice}`,children:[c(`connectDevices.relay.name`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:X.input,value:w,onChange:e=>T(e.target.value),pattern:`[a-z0-9]{4,20}`,"aria-invalid":k,"aria-describedby":O,autoCapitalize:`none`,spellCheck:!1,disabled:n})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{id:O,className:X.meta,children:c(`connectDevices.relay.nameHint`)}),f&&/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${X.relayField} ${X.notice}`,children:[c(`connectDevices.relay.inviteLabel`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:X.input,value:E,onChange:e=>D(e.target.value),autoCapitalize:`none`,spellCheck:!1,disabled:n})]})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:X.actions,children:/* @__PURE__ */ (0,a.jsx)(i.Button,{type:`submit`,variant:`primary`,disabled:n||h||(d?p===void 0&&k:y===``||S||k),"aria-busy":n,children:c(n?`connectDevices.preparing`:`connectDevices.relay.enable`)})})]}):/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.actions,children:[!te&&/* @__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 _f=/* @__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))(_f||{});let vf=[0,1],yf=[1,0],bf=[2,3],xf=[3,2],Sf={L:vf,M:yf,Q:bf,H:xf},Cf=/^\d*$/,wf=/^[A-Z0-9 $%*+./:-]*$/,Tf=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,Ef=[[-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 Of=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,_f.Timing),this.setFunctionModule(e,6,e%2==0,_f.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,Af(r,e));this.setFunctionModule(8,7,Af(r,6)),this.setFunctionModule(8,8,Af(r,7)),this.setFunctionModule(7,8,Af(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Af(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Af(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Af(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=Af(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,_f.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,_f.Alignment)}setFunctionModule(e,t,n,r=_f.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Gf(t,n))throw RangeError(`Invalid argument`);let r=Df[n[0]][t],i=Ef[n[0]][t],a=Math.floor(Wf(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Kf(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=qf(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(Wf(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]=Af(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 kf(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 Af(e,t){return!!(e>>>t&1)}var jf=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 Mf=[1,10,12,14],Nf=[2,9,11,13],Pf=[4,8,16,16];function Ff(e,t){return e[Math.floor((t+7)/17)+1]}function If(e){let t=[];for(let n of e)kf(n,8,t);return new jf(Pf,e.length,t)}function Lf(e){if(!Bf(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);kf(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new jf(Mf,e.length,t)}function Rf(e){if(!Vf(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=Tf.indexOf(e.charAt(n))*45;r+=Tf.indexOf(e.charAt(n+1)),kf(r,11,t)}return n<e.length&&kf(Tf.indexOf(e.charAt(n)),6,t),new jf(Nf,e.length,t)}function zf(e){return e===``?[]:Bf(e)?[Lf(e)]:Vf(e)?[Rf(e)]:[If(Uf(e))]}function Bf(e){return Cf.test(e)}function Vf(e){return wf.test(e)}function Hf(e,t){let n=0;for(let r of e){let e=Ff(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Uf(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 Wf(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 Gf(e,t){return Math.floor(Wf(e)/8)-Ef[t[0]][e]*Df[t[0]][e]}function Kf(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]=Jf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Jf(n,2)}return t}function qf(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]^=Jf(t,e))}return n}function Jf(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 Yf(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=Gf(o,t)*8,i=Hf(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[yf,bf,xf])a&&s<=Gf(o,e)*8&&(t=e);let c=[];for(let t of e){kf(t.mode[0],4,c),kf(t.numChars,Ff(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Gf(o,t)*8;kf(0,Math.min(4,l-c.length),c),kf(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)kf(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 Of(o,t,u,i)}function Xf(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`?zf(e):Array.isArray(e)?[If(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Yf(c,Sf[n],i,a,o,r),u=Zf({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 Zf(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=_f.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 Qf({value:e,label:t,className:n}){let{size:i,path:o}=(0,r.useMemo)(()=>{let t=Xf(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 $f({t:e}){return/* @__PURE__ */ (0,a.jsxs)(`details`,{className:X.other,"data-self-relay-help":!0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:e(`connectDevices.selfRelay.helpTitle`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.connectionHelp,children:[/* @__PURE__ */ (0,a.jsxs)(`ol`,{className:X.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:X.meta,children:e(`connectDevices.selfRelay.noDomain`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:X.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 ep={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`},tp={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},np={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},rp=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function ip({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:_)??rp.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,D]=(0,r.useState)(!1),[O,k]=(0,r.useState)(`idle`),ee=(0,r.useId)(),A=g.filter(e=>e.kind===`relay`?x===h:e.kind===x),te=A.find(e=>e.url===S)??A[0],ne=!n&&te!==void 0&&u.some(e=>e.url===te.url),j=ne?`${te.url}#token=${p}`:void 0,re=j!==void 0&&w===j,M=ne?tp[x]:void 0,ie=x===`tailscale-https`,ae=ie?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&te!==void 0,oe=rp.filter(e=>e!==`lan`&&!y(e)&&e!==`tailscale-https`&&e!==`tailscale`&&g.some(t=>t.kind===e)),se=x===`tailscale-https`||x===`tailscale`,ce=g.some(e=>e.kind===`tailscale`),le=e=>{v(e),C(void 0)};(0,r.useEffect)(()=>{k(`idle`),T(void 0)},[j]),(0,r.useEffect)(()=>{if(O===`idle`)return;let e=setTimeout(()=>k(`idle`),2e3);return()=>clearTimeout(e)},[O]);let ue=e=>{if(y(e))return e===`relay`?m?.officialHost:m?.customHost;let t=e===`tailscale-https`&&se?te:e===`tailscale-https`?g.find(t=>t.kind===e)??g.find(e=>e.kind===`tailscale`):e===x?te:g.find(t=>t.kind===e);return t===void 0?void 0:new URL(t.url).host},de=e=>/* @__PURE__ */ (0,a.jsxs)(`label`,{className:X.route,"data-connect-route":e,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:ee,checked:e===`tailscale-https`?se:x===e,disabled:t,onChange:()=>le(e)}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:X.routeText,children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:X.routeTitle,children:[l(ep[e]),y(e)&&m?.enabled&&e===h&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.badge,children:l(`connectDevices.relay.inUse`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.routeAddress,children:ue(e)})]}),(e===`lan`||e===`tailscale-https`||e===`relay`||e===`self-hosted-relay`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,children:l(np[e])})]})]},e);return/* @__PURE__ */ (0,a.jsxs)(`section`,{className:X.connection,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.connectionMain,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:X.scan,children:j===void 0?/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.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:X.qrButton,"aria-label":l(re?`connectDevices.hideQr`:`connectDevices.viewQr`),"aria-pressed":re,disabled:t,onClick:()=>T(re?void 0:j),children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:X.qrFrame,children:[/* @__PURE__ */ (0,a.jsx)(Qf,{value:j,label:l(`connectDevices.qrLabel`),className:re?X.qr:`${X.qr} ${X.qrObscured}`}),!re&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:X.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`)})]})]}),re&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.qrAction,children:l(`connectDevices.hideQr`)})]})}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.connectionDetails,children:[y(x)&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(gf,{kind:x===`relay`?`official`:`self-hosted`,relay:m,busy:t,onChange:s,onRefresh:c,t:l},x),!y(x)&&(!ne||M!==void 0)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.connectionHelp,"data-tailscale-status":ie&&d.status!==`serving`?d.status:void 0,children:[M===void 0?n?/* @__PURE__ */ (0,a.jsx)(`p`,{role:`status`,className:X.notice,children:l(`connectDevices.restarting`)}):ie?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.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:X.meta,children:d.target}),d.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.error,children:d.message}),d.status===`not-installed`&&/* @__PURE__ */ (0,a.jsx)(`a`,{className:X.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:X.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:X.meta,children:l(`connectDevices.httpsPersistence`)})]}):/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.notice,children:l(ae?`connectDevices.enableImpact`:f===void 0?`connectDevices.localListener`:`connectDevices.noAddress`)}):/* @__PURE__ */ (0,a.jsxs)(`p`,{className:X.ready,children:[/* @__PURE__ */ (0,a.jsx)(i.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:l(M)})]}),!ne&&!n&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.actions,children:[ae&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`primary`,disabled:t,"aria-busy":t,onClick:()=>o(ie?`https`:`direct`),children:l(t?`connectDevices.preparing`:`connectDevices.enableQr`)}),(ie||!ae)&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:t,onClick:c,children:l(`connectDevices.refresh`)})]})]}),te!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.addressRow,children:[A.length>1?/* @__PURE__ */ (0,a.jsx)(i.Menu,{open:E,onClose:()=>D(!1),portal:!0,className:X.addressMenu,anchor:/* @__PURE__ */ (0,a.jsxs)(`button`,{"aria-label":l(`connectDevices.address`),type:`button`,className:`${X.input} ${X.addressTrigger}`,disabled:t,"aria-haspopup":`menu`,"aria-expanded":E,onClick:()=>D(!E),children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:new URL(te.url).host}),/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{})]}),items:A.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:te.url,onSelect:e=>{D(!1),C(e)}}):/* @__PURE__ */ (0,a.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:X.input,value:new URL(te.url).host,readOnly:!0}),j!==void 0&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:t,onClick:()=>{ou(j).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,a.jsx)($f,{t:l})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.routePanel,children:[/* @__PURE__ */ (0,a.jsxs)(`fieldset`,{className:X.routes,disabled:t,children:[/* @__PURE__ */ (0,a.jsx)(`legend`,{className:X.fieldTitle,children:l(`connectDevices.connectVia`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.routeGroup,children:[m!==void 0&&/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[de(`relay`),de(`self-hosted-relay`)]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.routeFamily,children:[de(`tailscale-https`),se&&ce&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.subRoutes,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:X.subRoute,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:`${ee}-tailscale`,checked:x===`tailscale-https`,onChange:()=>le(`tailscale-https`)}),l(`connectDevices.tailscaleViaHttps`)]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:X.subRoute,"data-connect-route":`tailscale`,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:`${ee}-tailscale`,checked:x===`tailscale`,onChange:()=>le(`tailscale`)}),l(`connectDevices.tailscaleViaIp`)]})]})]}),de(`lan`)]})]}),oe.length>0&&/* @__PURE__ */ (0,a.jsxs)(`details`,{className:X.other,open:oe.includes(x)?!0:void 0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:l(`connectDevices.otherMethods`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:X.extraRoutes,children:oe.map(de)})]})]})]})}let ap=e=>e instanceof Error?e.message:String(e);function op(e){return e instanceof Xl&&e.code===`auth/disabled`?{kind:`disabled`}:{kind:`failed`,message:ap(e)}}function sp({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:X.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:X.dangerConfirm,disabled:r,"aria-busy":r,onClick:c,children:n})]}),children:o!==null&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.error,role:`alert`,children:o})})}function cp({t:e}){let[t,n]=(0,r.useState)({kind:`loading`}),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(null),[u,d]=(0,r.useState)(!1),[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(!1),g=(0,r.useCallback)(e=>n({kind:`ready`,data:e}),[]),_=pf(g,e(`connectDevices.restartTimeout`)),v=u||_.target!==null;(0,r.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(!1),2e3);return()=>clearTimeout(e)},[m]),(0,r.useEffect)(()=>{let e=new AbortController;return iu(e.signal).then(t=>{e.signal.aborted||s(t.authenticated&&!t.local)}).catch(()=>void 0),su.get().then(t=>{e.signal.aborted||n({kind:`ready`,data:t})},t=>{e.signal.aborted||n(op(t))}),()=>{e.abort()}},[]);let y=t.kind===`ready`?t.data.relay?.state:void 0,b=y!==void 0&&hf(y);(0,r.useEffect)(()=>{if(!b)return;let e=setTimeout(()=>{su.get().then(g,()=>void 0)},2e3);return()=>clearTimeout(e)},[b,t,g]);let x=async()=>{let e=await su.get();return g(e),e},S=async t=>{d(!0),p(null),_.fail(void 0);try{await t()}catch(t){p(e(`connectDevices.actionFailed`,{message:ap(t)}));try{await x()}catch{}}finally{d(!1)}},C=e=>{S(async()=>{if(e===`direct`){let{changed:e}=await su.lan(!0);e?_.start(!0):await x()}else{let e=await su.serve(!0);if(e.error!==void 0)throw Error(e.error);await x()}})},w=async()=>{let t=await x();t.relay?.enabled&&(await su.relay(!1),t=await x());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 su.serve(!1);if(r.error!==void 0)throw Error(r.error);t=await x()}if(t.tailscale.status===`error`)throw Error(t.tailscale.message);if(t.background?.lan){let{changed:e}=await su.lan(!1);e?_.start(!1):await x()}l(null)};if(t.kind===`loading`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.meta,children:e(`connectDevices.loading`)});if(t.kind===`disabled`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.notice,"data-connect-notice":`disabled`,children:e(`connectDevices.disabled`)});if(t.kind===`failed`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.error,role:`alert`,children:e(`connectDevices.loadFailed`,{message:t.message})});let{data:T}=t,{secret:E,lastUsedAt:D,networkUrls:O,tailscale:k,background:ee}=T,A=O.length>0||ee?.lan===!0,te=ee?.lan===!0||k.status===`serving`||T.relay?.enabled===!0,ne=O.some(e=>e.kind===`public`||ee===void 0&&[`lan`,`tailscale`,`virtual`].includes(e.kind)),j=D===null?void 0:(0,i.relativeTime)(D,Date.now()),re=f??_.error;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.page,"data-connect-devices":!0,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:X.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:X.title,children:e(`connectDevices.title`)}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.description,children:e(`connectDevices.subtitle`)})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.status,"data-active":A&&_.target===null,children:e(_.target===null?A?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,a.jsx)(ip,{data:T,busy:v,restarting:_.target!==null,onEnable:C,onRelay:(e,t)=>{S(async()=>{await su.relay(e,t),await x()})},onRefresh:()=>{S(async()=>{await x()})},t:e}),c===null&&re!=null&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,className:X.error,children:re}),/* @__PURE__ */ (0,a.jsxs)(`section`,{className:X.manage,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageRow,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.manageTitle,children:e(`connectDevices.tokenTitle`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,title:D===null?void 0:new Date(D).toLocaleString(),children:j===void 0?e(`connectDevices.neverUsed`):e(`connectDevices.lastUsed`,{time:e(`connectDevices.relative.${j.unit}`,{n:j.n})})})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageActions,children:[/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:v,onClick:()=>{p(null),ou(E).then(()=>h(!0),()=>p(e(`connectDevices.copyFailed`)))},children:e(m?`connectDevices.copied`:`connectDevices.copyToken`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:v,onClick:()=>{p(null),l(`regenerate`)},children:e(`connectDevices.regenerate`)})]})]}),ee!==void 0&&/* @__PURE__ */ (0,a.jsx)(mf,{state:ee,disabled:v,restored:g,t:e}),o&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageRow,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.manageTitle,children:e(`connectDevices.signOutRowTitle`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,children:e(`connectDevices.signOutHint`)})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:X.manageActions,children:/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:v,onClick:()=>{p(null),l(`signOut`)},children:e(`connectDevices.signOut`)})})]})]}),te&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${X.manageRow} ${X.stopRow}`,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.manageTitle,children:e(`connectDevices.stopTitleShort`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,children:e(`connectDevices.stopHint`)})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:X.manageActions,children:/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,className:X.dangerOutline,disabled:v,onClick:()=>{p(null),l(`stop`)},children:e(`connectDevices.stop`)})})]}),/* @__PURE__ */ (0,a.jsxs)(`details`,{className:X.other,"data-remote-options":!0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:e(`connectDevices.help`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.remoteList,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:X.notice,children:e(`connectDevices.keepAwake`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.routeText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.routeTitle,children:`Tailscale`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,children:e(`connectDevices.remote.tailscale`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:X.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tailscaleLink`)})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.routeText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.routeTitle,children:e(`connectDevices.remote.tunnelTitle`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.meta,children:e(`connectDevices.remote.tunnel`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:X.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`)})]})]})]}),c!==null&&(()=>{let t=c===`stop`?{title:e(`connectDevices.stopTitle`),description:`${e(`connectDevices.stopDescription`)}${ne?` ${e(`connectDevices.stopUnmanaged`)}`:``}`,confirmLabel:e(`connectDevices.stopConfirm`),action:w}:c===`signOut`?{title:e(`connectDevices.signOutTitle`),description:e(`connectDevices.signOutDescription`),confirmLabel:e(`connectDevices.signOutConfirm`),action:zd}:{title:e(`connectDevices.regenerateTitle`),description:e(`connectDevices.regenerateDescription`),confirmLabel:e(`connectDevices.regenerateConfirm`),action:async()=>{await Ld(async()=>{g(await su.regenerate()),Md()}),l(null)}};return/* @__PURE__ */ (0,a.jsx)(sp,{t:e,title:t.title,description:t.description,confirmLabel:t.confirmLabel,busy:v,error:f,onClose:()=>l(null),onConfirm:()=>{S(t.action)}})})()]})}async function lp(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:ql(),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 Xl(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return Gl.parse(a.result?.value)}let up={list:e=>lp(`list`,{},e),install:(e,t)=>lp(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>lp(`setEnabled`,{id:e,enabled:t}),remove:e=>lp(`remove`,{id:e})},dp=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host does not provide \1$/u,fp=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host provides (.+)$/u,pp=/^web-assets: \S+ declares runtime version requirements, but the browser Host version snapshot is unavailable$/u,mp=/^web-assets: \S+ requires unavailable browser module (\S+)$/u;function hp(e,t){return dp.test(e)||mp.test(e)?t(`extensions.unsupported`):fp.test(e)?t(`extensions.versionMismatch`):pp.test(e)?t(`extensions.hostVersionSnapshotMissing`):e.replace(/^web-assets:\s+/u,``)}let gp=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=gp,e.textContent=`.mpCnrG_dialog{width:min(560px,100%);max-height:min(800px,100%)}.mpCnrG_content{min-height:0;overflow-y:auto}.mpCnrG_body,.mpCnrG_footer,.mpCnrG_field{flex-direction:column;min-width:0;display:flex}.mpCnrG_body{gap:12px}.mpCnrG_footer{flex:1;gap:20px}.mpCnrG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.mpCnrG_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}.mpCnrG_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.mpCnrG_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.mpCnrG_field input:disabled,.mpCnrG_registry select:disabled{opacity:.6}.mpCnrG_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.mpCnrG_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}.mpCnrG_guideToggle:hover{color:var(--dsw-alias-label-primary)}.mpCnrG_guideToggle[aria-expanded=true] .mpCnrG_chevron{transform:rotate(180deg)}.mpCnrG_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}.mpCnrG_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}.mpCnrG_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}.mpCnrG_guide p{margin:8px 0 4px}.mpCnrG_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.mpCnrG_scope,.mpCnrG_hint,.mpCnrG_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.mpCnrG_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.mpCnrG_wide{width:100%}`,document.head.appendChild(e)}var _p={body:`mpCnrG_body`,chevron:`mpCnrG_chevron`,content:`mpCnrG_content`,dialog:`mpCnrG_dialog`,error:`mpCnrG_error`,field:`mpCnrG_field`,footer:`mpCnrG_footer`,guide:`mpCnrG_guide`,guideToggle:`mpCnrG_guideToggle`,hint:`mpCnrG_hint`,options:`mpCnrG_options`,registry:`mpCnrG_registry`,scope:`mpCnrG_scope`,wide:`mpCnrG_wide`};let vp={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function yp({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:_p.dialog,contentClassName:_p.content,footer:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:_p.footer,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:_p.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{type:`submit`,form:y,variant:`primary`,className:_p.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,a.jsxs)(`form`,{id:y,className:_p.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=Kl.safeParse(d===`custom`?p:vp[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:_p.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:_p.error,role:`alert`,children:o}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:_p.options,children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:_p.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{className:_p.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:_p.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:_p.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:_p.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,a.jsxs)(`div`,{id:b,className:_p.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:_p.hint,children:e(`extensions.registryHint`)})]})]})})}let bp=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(bp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=bp,e.textContent=`.hpnV1q_page,.hpnV1q_rowText{flex-direction:column;min-width:0;display:flex}.hpnV1q_page{gap:28px}.hpnV1q_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.hpnV1q_heading{flex:280px;min-width:0}.hpnV1q_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.hpnV1q_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.hpnV1q_intro .hpnV1q_iconButton{width:24px;height:24px;margin-top:-2px}.hpnV1q_intro .hpnV1q_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.hpnV1q_hint,.hpnV1q_meta,.hpnV1q_notice,.hpnV1q_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.hpnV1q_notice{color:var(--dsw-alias-label-secondary)}.hpnV1q_error,.hpnV1q_danger{color:var(--dsw-alias-state-error-primary)}.hpnV1q_actions,.hpnV1q_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.hpnV1q_actions{flex:none}.hpnV1q_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}.hpnV1q_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.hpnV1q_iconButton:disabled{opacity:.5;cursor:default}.hpnV1q_open:focus-visible,.hpnV1q_iconButton:focus-visible,.hpnV1q_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.hpnV1q_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}.hpnV1q_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.hpnV1q_button:disabled{opacity:.6;cursor:default}.hpnV1q_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.hpnV1q_group{min-width:0}.hpnV1q_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}.hpnV1q_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.hpnV1q_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.hpnV1q_row:hover,.hpnV1q_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.hpnV1q_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}.hpnV1q_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}.hpnV1q_packageImage{object-fit:contain}.hpnV1q_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.hpnV1q_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.hpnV1q_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.hpnV1q_row:hover .hpnV1q_chevron,.hpnV1q_row:focus-within .hpnV1q_chevron{opacity:1}.hpnV1q_rowText{flex:1;gap:4px}.hpnV1q_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.hpnV1q_rowNotice{flex-basis:100%;padding-left:62px}.hpnV1q_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}.hpnV1q_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.hpnV1q_detail .hpnV1q_rowText{gap:8px}.hpnV1q_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}.hpnV1q_recovery{gap:8px 16px;margin-top:4px}.hpnV1q_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.hpnV1q_page{gap:24px}.hpnV1q_open{gap:10px}.hpnV1q_artwork{border-radius:10px;width:40px;height:40px}.hpnV1q_row,.hpnV1q_row .hpnV1q_actions{gap:4px}.hpnV1q_chevron{display:none}.hpnV1q_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Z={actions:`hpnV1q_actions`,artwork:`hpnV1q_artwork`,back:`hpnV1q_back`,button:`hpnV1q_button`,chevron:`hpnV1q_chevron`,count:`hpnV1q_count`,danger:`hpnV1q_danger`,description:`hpnV1q_description`,detail:`hpnV1q_detail`,error:`hpnV1q_error`,group:`hpnV1q_group`,groupTitle:`hpnV1q_groupTitle`,header:`hpnV1q_header`,heading:`hpnV1q_heading`,hint:`hpnV1q_hint`,iconButton:`hpnV1q_iconButton`,intro:`hpnV1q_intro`,link:`hpnV1q_link`,list:`hpnV1q_list`,meta:`hpnV1q_meta`,name:`hpnV1q_name`,notice:`hpnV1q_notice`,open:`hpnV1q_open`,packageImage:`hpnV1q_packageImage`,page:`hpnV1q_page`,recovery:`hpnV1q_recovery`,row:`hpnV1q_row`,rowNotice:`hpnV1q_rowNotice`,rowText:`hpnV1q_rowText`,source:`hpnV1q_source`,summary:`hpnV1q_summary`,title:`hpnV1q_title`};function xp({url:e,t}){if(e===void 0)return null;let n=new URL(e).hostname===`github.com`;return/* @__PURE__ */ (0,a.jsx)(`a`,{className:Z.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 Sp({src:e}){let[t,n]=(0,r.useState)();return/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.artwork,"aria-hidden":`true`,children:e!==void 0&&e!==t?/* @__PURE__ */ (0,a.jsx)(`img`,{src:e,width:32,height:32,alt:``,className:Z.packageImage,"data-extension-icon":!0,onError:()=>n(e)}):/* @__PURE__ */ (0,a.jsx)(i.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 wp(e){return e instanceof Xl&&e.code===`auth/disabled`?{kind:`disabled`}:{kind:`failed`,message:e instanceof Error?e.message:String(e)}}function Tp({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 up.list(e.signal).then(t=>{e.signal.aborted||o({kind:`ready`,data:t})},t=>{e.signal.aborted||o(wp(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=wp(t);return n.kind===`disabled`?o(n):f(e(`extensions.actionFailed`,{message:hp(n.message,e)})),!1}finally{_.current=!1,u(null)}},y=/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.recovery,children:[/* @__PURE__ */ (0,a.jsx)(`a`,{className:Z.link,href:`/extensions`,children:e(`extensions.recovery`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:Z.link,href:`/?extensions=off`,children:e(`extensions.builtinsOnly`)})]});if(n.kind===`loading`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.hint,children:e(`extensions.loading`)});if(n.kind===`disabled`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.page,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,"data-web-extensions-notice":`disabled`,children:e(`extensions.authDisabled`)}),y]});if(n.kind===`failed`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.page,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:e(`extensions.loadFailed`,{message:n.message})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:d}),/* @__PURE__ */ (0,a.jsx)(`div`,{children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Z.button,disabled:l!==null,onClick:()=>void v(`refresh`,()=>up.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,()=>up.setEnabled(e,t))};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.page,"data-web-extensions":!0,children:[E===void 0?/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Z.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.heading,children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:Z.title,children:e(`settings.extensions`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.intro,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.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:Z.iconButton,"aria-label":e(`extensions.info`),children:/* @__PURE__ */ (0,a.jsx)(i.IconInfoOutlineRegular,{size:15})})})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Z.iconButton,"aria-label":e(`extensions.refresh`),title:e(`extensions.refresh`),disabled:w,"aria-busy":l===`refresh`,onClick:()=>void v(`refresh`,()=>up.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:Z.back,onClick:()=>{g(null),m(null),f(null)},children:[/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{}),e(`settings.extensions`)]}),/* @__PURE__ */ (0,a.jsx)(yp,{t:e,open:s,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>up.install(e,t),()=>c(!1))}),S&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:e(`extensions.safeMode`)}),C!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:e(`extensions.storeError`,{message:C})}),d!==null&&!s&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:d}),E===void 0?b.length===0?/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.hint,children:e(`extensions.empty`)}):/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Z.group,children:[/* @__PURE__ */ (0,a.jsxs)(`h3`,{className:Z.groupTitle,children:[e(`extensions.installed`),` `,/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.count,children:b.length})]}),/* @__PURE__ */ (0,a.jsx)(`ul`,{className:Z.list,children:b.map(n=>{let r=n.enabledTargets.includes(`web`),o=x.includes(n.id),{title:s,description:c}=Cp(n,t);return/* @__PURE__ */ (0,a.jsxs)(`li`,{className:Z.row,"data-web-extension":n.id,children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Z.open,"aria-label":s,onClick:()=>{g(n.id),m(null)},children:[/* @__PURE__ */ (0,a.jsx)(Sp,{src:n.meta?.icon}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Z.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.name,title:s,children:s}),c!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.summary,title:c,children:c}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Z.meta,children:[n.version,` · DSH ·`,` `,e(r?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{className:Z.chevron})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,a.jsx)(xp,{url:n.projectUrl,t:e}),/* @__PURE__ */ (0,a.jsx)(i.Switch,{label:s,checked:r,disabled:w||C!==void 0,onChange:e=>D(n.id,e)})]}),r!==o&&!S&&n.loadError===void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Z.notice} ${Z.rowNotice}`,children:e(`extensions.pendingRestart`)}),n.loadError!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Z.error} ${Z.rowNotice}`,role:`alert`,children:e(`extensions.extensionError`,{message:hp(n.loadError,e)})}),n.meta?.error!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Z.notice} ${Z.rowNotice}`,children:e(`extensions.metadataError`,{message:n.meta.error})})]},n.id)})})]}):/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Z.detail,"data-web-extension-detail":E.id,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Z.header,children:[/* @__PURE__ */ (0,a.jsx)(Sp,{src:E.meta?.icon}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,a.jsx)(xp,{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?Z.danger:void 0,disabled:w||C!==void 0,onClick:()=>{p===E.id?v(E.id,()=>up.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=>D(E.id,e)})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:Z.title,children:E.title}),E.title!==E.name&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:E.name}),E.description!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.description,children:E.description}),/* @__PURE__ */ (0,a.jsxs)(`p`,{className:Z.meta,children:[E.version,` · DSH ·`,` `,e(E.enabledTargets.includes(`web`)?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.source,children:e(`extensions.source`,{source:E.source})}),E.meta?.error!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:e(`extensions.metadataError`,{message:E.meta.error})}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:e(`extensions.restart`)}),x.includes(E.id)&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.hint,children:e(`extensions.includedAtStartup`)}),p===E.id&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:e(`extensions.confirmRemove`,{name:E.name})}),E.loadError!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:e(`extensions.extensionError`,{message:hp(E.loadError,e)})})]}),y]})}let Ep=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ep)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Ep,e.textContent=`.xuyymG_row{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:8px;padding:16px 0;display:flex}.xuyymG_rowText{flex-direction:column;flex:220px;gap:4px;min-width:0;display:flex}.xuyymG_actions{gap:8px;display:flex}.xuyymG_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.xuyymG_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.xuyymG_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}.xuyymG_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.xuyymG_button:focus-visible{outline-offset:2px;outline:2px solid}.xuyymG_button:disabled{opacity:.6;cursor:default}@media (width<=600px){.xuyymG_row{flex-direction:column;align-items:stretch;gap:12px}.xuyymG_rowText{flex:auto}.xuyymG_actions{grid-auto-columns:1fr;grid-auto-flow:column;display:grid}}`,document.head.appendChild(e)}var Dp={actions:`xuyymG_actions`,button:`xuyymG_button`,desc:`xuyymG_desc`,row:`xuyymG_row`,rowText:`xuyymG_rowText`,title:`xuyymG_title`};function Op({t:e}){let[t,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(!1),[s,c]=(0,r.useState)(null);(0,r.useEffect)(()=>{Dd().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:Dp.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Dp.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Dp.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Dp.desc,role:s===null?void 0:`alert`,children:u})]}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Dp.actions,children:[t===`on`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Dp.button,disabled:i,onClick:()=>{cu.test()},children:e(`notifications.test`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Dp.button,disabled:i,onClick:()=>{l(t===`on`?Ad:kd)},children:e(t===`on`?`notifications.disable`:`notifications.enable`)})]})]})}let kp=`@deepseek-ai/dsh-client-ui-codexhost/PwaInstallRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(kp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=kp,e.textContent=`.lNmzTG_section{padding:16px 0}.lNmzTG_row{flex-wrap:wrap;align-items:center;gap:12px 24px;display:flex}.lNmzTG_text{flex:180px;min-width:0}.lNmzTG_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.lNmzTG_description,.lNmzTG_guide{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.lNmzTG_description{margin-top:4px}.lNmzTG_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}.lNmzTG_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.lNmzTG_button:focus-visible{outline-offset:2px;outline:2px solid}.lNmzTG_button:disabled{opacity:.6;cursor:default}.lNmzTG_guide{margin-top:12px}.lNmzTG_guide p{margin:8px 0 0}@media (width<=600px){.lNmzTG_row{flex-direction:column;align-items:stretch;gap:12px}.lNmzTG_text{flex:auto}}`,document.head.appendChild(e)}var Ap={button:`lNmzTG_button`,description:`lNmzTG_description`,guide:`lNmzTG_guide`,row:`lNmzTG_row`,section:`lNmzTG_section`,text:`lNmzTG_text`,title:`lNmzTG_title`};function jp({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:Ap.section,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ap.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ap.text,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Ap.title,children:t(`pwa.title`)}),d!==null&&/* @__PURE__ */ (0,a.jsx)(`div`,{id:l,className:Ap.description,role:n===`failed`?`alert`:`status`,children:d})]}),n!==`installed`&&/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Ap.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:Ap.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 Mp=`wallpaper`,Np=`current`,Pp=`codexhost.web.wallpaper-meta.v1`,Fp=`data-codexhost-wallpaper`,Ip=`data-codexhost-wallpaper-previewing`,Lp=`--ch-wallpaper-opacity`,Rp=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/avif`],zp=new Set(Rp);function Bp(e){if(typeof e!=`number`||!Number.isFinite(e))return 25;let t=Math.round(e);return t<0?0:t>100?100:t}function Vp(){try{let e=localStorage.getItem(Pp);if(!e)return null;let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t;return typeof n.hasImage!=`boolean`||typeof n.updatedAt!=`number`||!Number.isFinite(n.updatedAt)?null:{hasImage:n.hasImage,opacity:Bp(n.opacity),updatedAt:n.updatedAt}}catch{return null}}function Hp(e){try{localStorage.setItem(Pp,JSON.stringify(e))}catch{}}function Up(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(/* @__PURE__ */ Error(`IndexedDB unavailable`));return}let n=indexedDB.open(`codexhost.web.wallpaper.v1`,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Mp)||e.createObjectStore(Mp)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??/* @__PURE__ */ Error(`IndexedDB open failed`))})}async function Wp(){let e=await Up();try{return await new Promise((t,n)=>{let r=e.transaction(Mp,`readonly`).objectStore(Mp).get(Np);r.onsuccess=()=>{let e=r.result;!e||!(e.blob instanceof Blob)||e.blob.size===0?t(null):t({blob:e.blob,name:typeof e.name==`string`&&e.name.trim()!==``?e.name:``,opacity:Bp(e.opacity),updatedAt:typeof e.updatedAt==`number`&&Number.isFinite(e.updatedAt)?e.updatedAt:0})},r.onerror=()=>n(r.error??/* @__PURE__ */ Error(`IndexedDB read failed`))})}finally{e.close()}}async function Gp(e){let t=await Up();try{await new Promise((n,r)=>{let i=t.transaction(Mp,`readwrite`);i.objectStore(Mp).put(e,Np),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??/* @__PURE__ */ Error(`IndexedDB write failed`)),i.onabort=()=>r(i.error??/* @__PURE__ */ Error(`IndexedDB write aborted`))})}finally{t.close()}}async function Kp(){let e=await Up();try{await new Promise((t,n)=>{let r=e.transaction(Mp,`readwrite`);r.objectStore(Mp).delete(Np),r.oncomplete=()=>t(),r.onerror=()=>n(r.error??/* @__PURE__ */ Error(`IndexedDB delete failed`)),r.onabort=()=>n(r.error??/* @__PURE__ */ Error(`IndexedDB delete aborted`))})}finally{e.close()}}async function qp(e){if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e),n=t.width>0&&t.height>0;return t.close(),n}catch{return!1}if(typeof Image>`u`)return!1;let t=URL.createObjectURL(e);try{return await new Promise(e=>{let n=new Image;n.onload=()=>e(n.naturalWidth>0&&n.naturalHeight>0),n.onerror=()=>e(!1),n.src=t})}finally{URL.revokeObjectURL(t)}}var Jp=class{listeners=/* @__PURE__ */ new Set;snapshot;objectUrl=null;activeBlob=null;layerElement=null;channel=null;opacityFlushTimer=null;opSeq=0;lastUpdatedAt=0;disposed=!1;constructor(){let e=Vp();if(this.snapshot=Object.freeze({hasImage:!1,imageUrl:null,name:null,opacity:e?.opacity??25,loading:!0,error:null}),typeof BroadcastChannel<`u`)try{this.channel=new BroadcastChannel(`codexhost.web.wallpaper.v1`),this.channel.onmessage=e=>{this.handleChannelMessage(e.data)}}catch{this.channel=null}typeof window<`u`&&window.addEventListener(`storage`,this.handleStorageEvent),this.reloadFromStorage()}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;async upload(e){if(this.disposed)return!1;if(typeof indexedDB>`u`)return this.updateSnapshot({error:`unsupported-storage`,loading:!1}),!1;if(!zp.has(e.type))return this.updateSnapshot({error:`invalid-format`,loading:!1}),!1;if(e.size===0||e.size>20971520)return this.updateSnapshot({error:e.size>20971520?`file-too-large`:`decode-failed`,loading:!1}),!1;let t=++this.opSeq;this.updateSnapshot({loading:!0,error:null});let n=await qp(e);if(this.disposed||t!==this.opSeq)return!1;if(!n)return this.updateSnapshot({loading:!1,error:`decode-failed`}),!1;let r=this.snapshot.opacity>0?this.snapshot.opacity:25,i=this.nextTimestamp(),a=e.slice(0,e.size,e.type),o=e.name.trim();try{await Gp({blob:a,name:o,opacity:r,updatedAt:i})}catch{return!this.disposed&&t===this.opSeq&&this.updateSnapshot({loading:!1,error:`storage-failed`}),!1}return this.disposed||t!==this.opSeq?!1:(this.clearPendingOpacityFlush(),this.lastUpdatedAt=i,this.replaceObjectUrl(a),this.updateSnapshot({hasImage:!0,imageUrl:this.objectUrl,name:o||null,opacity:r,loading:!1,error:null}),this.applyDom(),Hp({hasImage:!0,opacity:r,updatedAt:i}),this.postChannel({type:`reload`,updatedAt:i}),!0)}setOpacity(e){if(this.disposed)return;let t=Bp(e);if(this.snapshot.opacity===t&&this.snapshot.error===null)return;let n=this.nextTimestamp();this.lastUpdatedAt=n,this.updateSnapshot({opacity:t,error:null}),this.applyDom(),Hp({hasImage:this.snapshot.hasImage,opacity:t,updatedAt:n}),this.postChannel({type:`opacity`,opacity:t,updatedAt:n}),this.snapshot.hasImage&&this.activeBlob!==null&&this.scheduleOpacityFlush(t,n)}async remove(){if(this.disposed)return;let e=++this.opSeq;if(this.clearPendingOpacityFlush(),this.setPreviewing(!1),typeof indexedDB<`u`)try{await Kp()}catch{!this.disposed&&e===this.opSeq&&this.updateSnapshot({loading:!1,error:`storage-failed`});return}if(this.disposed||e!==this.opSeq)return;let t=this.nextTimestamp();this.lastUpdatedAt=t,this.replaceObjectUrl(null),this.updateSnapshot({hasImage:!1,imageUrl:null,name:null,loading:!1,error:null}),this.applyDom(),Hp({hasImage:!1,opacity:this.snapshot.opacity,updatedAt:t}),this.postChannel({type:`reload`,updatedAt:t})}setPreviewing(e){typeof document<`u`&&(!this.disposed&&e&&this.snapshot.hasImage?document.body.setAttribute(Ip,``):document.body.removeAttribute(Ip))}dispose(){this.disposed||(this.disposed=!0,this.opSeq+=1,this.clearPendingOpacityFlush(),typeof window<`u`&&window.removeEventListener(`storage`,this.handleStorageEvent),this.channel?.close(),this.channel=null,this.replaceObjectUrl(null),typeof document<`u`&&(document.body.removeAttribute(Fp),document.body.removeAttribute(Ip),document.body.style.removeProperty(Lp)),this.layerElement?.remove(),this.layerElement=null,this.listeners.clear())}handleStorageEvent=e=>{if(this.disposed||e.key!==`codexhost.web.wallpaper-meta.v1`)return;let t=Vp();!t||t.updatedAt<=this.lastUpdatedAt||(t.hasImage===this.snapshot.hasImage?(this.lastUpdatedAt=t.updatedAt,this.updateSnapshot({opacity:t.opacity,error:null}),this.applyDom()):this.reloadFromStorage())};handleChannelMessage(e){if(this.disposed||typeof e!=`object`||!e)return;let t=e;typeof t.updatedAt!=`number`||t.updatedAt<=this.lastUpdatedAt||(t.type===`reload`?this.reloadFromStorage():t.type===`opacity`&&(this.lastUpdatedAt=t.updatedAt,this.updateSnapshot({opacity:Bp(t.opacity),error:null}),this.applyDom()))}async reloadFromStorage(){if(this.disposed)return;if(typeof indexedDB>`u`){this.updateSnapshot({loading:!1});return}let e=++this.opSeq;try{let t=await Wp();if(this.disposed||e!==this.opSeq)return;let n=Vp();if(!t){this.replaceObjectUrl(null);let e=n?.opacity??this.snapshot.opacity;this.lastUpdatedAt=Math.max(this.lastUpdatedAt,n?.updatedAt??0),this.updateSnapshot({hasImage:!1,imageUrl:null,name:null,opacity:e,loading:!1,error:null}),this.applyDom();return}let r=n&&n.updatedAt>t.updatedAt?n.opacity:Bp(t.opacity);this.lastUpdatedAt=Math.max(t.updatedAt,n?.updatedAt??0),this.replaceObjectUrl(t.blob),this.updateSnapshot({hasImage:!0,imageUrl:this.objectUrl,name:t.name||null,opacity:r,loading:!1,error:null}),this.applyDom()}catch{!this.disposed&&e===this.opSeq&&this.updateSnapshot({loading:!1})}}scheduleOpacityFlush(e,t){this.clearPendingOpacityFlush(),this.opacityFlushTimer=setTimeout(()=>{this.opacityFlushTimer=null,!this.disposed&&this.snapshot.hasImage&&this.activeBlob!==null&&Gp({blob:this.activeBlob,name:this.snapshot.name??``,opacity:e,updatedAt:t}).catch(()=>{})},150)}nextTimestamp(){return Math.max(Date.now(),this.lastUpdatedAt+1)}clearPendingOpacityFlush(){this.opacityFlushTimer!==null&&(clearTimeout(this.opacityFlushTimer),this.opacityFlushTimer=null)}postChannel(e){try{this.channel?.postMessage(e)}catch{}}replaceObjectUrl(e){this.objectUrl!==null&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.activeBlob=e,e!==null&&typeof URL<`u`&&typeof URL.createObjectURL==`function`&&(this.objectUrl=URL.createObjectURL(e))}applyDom(){if(typeof document>`u`||this.disposed)return;let e=document.body,{hasImage:t,imageUrl:n,opacity:r}=this.snapshot;if(!t||n===null)e.removeAttribute(Fp),e.removeAttribute(Ip),e.style.removeProperty(Lp),this.layerElement?.remove(),this.layerElement=null;else{if(this.layerElement===null){let e=document.createElement(`div`);e.setAttribute(`data-codexhost-wallpaper-layer`,``),e.setAttribute(`aria-hidden`,`true`),this.layerElement=e}this.layerElement.style.backgroundImage=`url(${JSON.stringify(n)})`,this.layerElement.isConnected||e.prepend(this.layerElement),e.style.setProperty(Lp,String(r/100)),r>0?e.setAttribute(Fp,``):e.removeAttribute(Fp)}}updateSnapshot(e){let t=Object.freeze({...this.snapshot,...e});if(t.hasImage!==this.snapshot.hasImage||t.imageUrl!==this.snapshot.imageUrl||t.name!==this.snapshot.name||t.opacity!==this.snapshot.opacity||t.loading!==this.snapshot.loading||t.error!==this.snapshot.error){this.snapshot=t;for(let e of this.listeners)e()}}};let Yp=`@deepseek-ai/dsh-client-ui-codexhost/WallpaperRow.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=`.PASCNW_section{flex-direction:column;display:flex}.PASCNW_row{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:12px 24px;padding:16px 0;display:flex}.PASCNW_opacityRow{border-top:1px solid var(--dsw-alias-border-l1);padding-top:12px}body[data-codexhost-wallpaper-previewing] .PASCNW_opacityRow,body[data-codexhost-wallpaper-previewing] .PASCNW_opacityRow *{visibility:visible!important}body[data-codexhost-wallpaper-previewing] .PASCNW_opacityRow{background:var(--dsw-alias-bg-layer-2)}.PASCNW_text{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}.PASCNW_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.PASCNW_desc{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.PASCNW_error{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}.PASCNW_fileInput{display:none}.PASCNW_controls{flex:none;align-items:center;gap:8px;display:flex}.PASCNW_preview{border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l3);flex:none;width:52px;height:36px;position:relative;overflow:hidden}.PASCNW_previewImage{background-position:50%;background-repeat:no-repeat;background-size:cover;position:absolute;inset:0}.PASCNW_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:none;flex:none;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.PASCNW_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.PASCNW_button:focus-visible{outline-offset:2px;outline:2px solid}.PASCNW_button:disabled{opacity:.6;cursor:default}.PASCNW_sliderWrap{flex:0 240px;align-items:center;gap:12px;min-width:180px;display:flex}.PASCNW_slider{--ch-slider-progress:25%;-webkit-appearance:none;appearance:none;cursor:pointer;background:0 0;flex:1;min-width:120px;height:24px;margin:0;padding:0}.PASCNW_slider:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px;border-radius:var(--dsw-radius-xs,4px)}.PASCNW_slider::-webkit-slider-runnable-track{background:linear-gradient(to right, var(--dsw-alias-state-business-primary) 0%, var(--dsw-alias-state-business-primary) var(--ch-slider-progress), var(--dsw-alias-border-l3) var(--ch-slider-progress), var(--dsw-alias-border-l3) 100%);border-radius:999px;height:6px}.PASCNW_slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;border:1px solid var(--dsw-alias-border-l4);background:var(--dsw-static-neutral-00,#fff);border-radius:50%;width:18px;height:18px;margin-top:-6px;box-shadow:0 1px 3px #00000038}.PASCNW_slider::-moz-range-track{background:var(--dsw-alias-border-l3);border-radius:999px;height:6px}.PASCNW_slider::-moz-range-progress{background:var(--dsw-alias-state-business-primary);border-radius:999px;height:6px}.PASCNW_slider::-moz-range-thumb{border:1px solid var(--dsw-alias-border-l4);background:var(--dsw-static-neutral-00,#fff);border-radius:50%;width:18px;height:18px;box-shadow:0 1px 3px #00000038}.PASCNW_opacityValue{text-align:right;font-variant-numeric:tabular-nums;min-width:40px;color:var(--dsw-alias-label-secondary);flex:none;font-size:13px;line-height:20px}@media (width<=600px){.PASCNW_row{flex-direction:column;align-items:stretch;gap:12px}.PASCNW_text{flex:auto}.PASCNW_controls{flex-wrap:wrap;justify-content:flex-start}.PASCNW_button{min-height:44px}.PASCNW_sliderWrap{flex:auto;width:100%}.PASCNW_slider{height:36px}}`,document.head.appendChild(e)}var Xp={button:`PASCNW_button`,controls:`PASCNW_controls`,desc:`PASCNW_desc`,error:`PASCNW_error`,fileInput:`PASCNW_fileInput`,opacityRow:`PASCNW_opacityRow`,opacityValue:`PASCNW_opacityValue`,preview:`PASCNW_preview`,previewImage:`PASCNW_previewImage`,row:`PASCNW_row`,section:`PASCNW_section`,slider:`PASCNW_slider`,sliderWrap:`PASCNW_sliderWrap`,text:`PASCNW_text`,title:`PASCNW_title`};function Zp({wallpaper:e,t}){let n=(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot),i=(0,r.useRef)(null),o=(0,r.useId)();(0,r.useEffect)(()=>()=>{e.setPreviewing(!1)},[e]);let s=()=>{e.setPreviewing(!0);let t=()=>{e.setPreviewing(!1),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),window.removeEventListener(`blur`,t)};window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),window.addEventListener(`blur`,t)},c=t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n!==void 0&&e.upload(n)},l=n.error===null?n.hasImage?n.name?t(`wallpaper.activeNamed`,{name:n.name}):t(`wallpaper.active`):t(`wallpaper.description`):t(`wallpaper.error.${n.error}`);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Xp.section,"data-wallpaper-settings":!0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Xp.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Xp.text,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Xp.title,children:t(`wallpaper.title`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:n.error===null?Xp.desc:Xp.error,role:n.error===null?void 0:`alert`,children:l})]}),/* @__PURE__ */ (0,a.jsx)(`input`,{ref:i,type:`file`,accept:Rp.join(`,`),className:Xp.fileInput,tabIndex:-1,"aria-hidden":`true`,"data-wallpaper-file-input":!0,onChange:c}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Xp.controls,children:[n.hasImage&&n.imageUrl!==null&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:Xp.preview,"data-wallpaper-preview":!0,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(`div`,{className:Xp.previewImage,style:{backgroundImage:`url(${JSON.stringify(n.imageUrl)})`,opacity:n.opacity/100}})}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Xp.button,disabled:n.loading,"data-wallpaper-upload":!0,onClick:()=>{i.current?.click()},children:t(n.hasImage?`wallpaper.replace`:`wallpaper.upload`)}),n.hasImage&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Xp.button,disabled:n.loading,"data-wallpaper-remove":!0,onClick:()=>{e.remove()},children:t(`wallpaper.remove`)})]})]}),n.hasImage&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${Xp.row} ${Xp.opacityRow}`,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Xp.text,children:/* @__PURE__ */ (0,a.jsx)(`label`,{htmlFor:o,className:Xp.title,children:t(`wallpaper.opacity`)})}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Xp.sliderWrap,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{id:o,type:`range`,min:0,max:100,step:1,value:n.opacity,"aria-valuetext":`${n.opacity}%`,className:Xp.slider,style:{"--ch-slider-progress":`${n.opacity}%`},"data-wallpaper-opacity":!0,onPointerDown:s,onChange:t=>{e.setOpacity(Number(t.currentTarget.value))}}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Xp.opacityValue,"data-wallpaper-opacity-value":!0,children:[n.opacity,`%`]})]})]})]})}let Qp=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Qp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Qp,e.textContent=`.K3vHcW_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.K3vHcW_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.K3vHcW_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.K3vHcW_heading{flex:320px;min-width:0}.K3vHcW_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.K3vHcW_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.K3vHcW_refresh{flex:none;margin-top:2px}.K3vHcW_tabs{flex-wrap:wrap;gap:8px;display:flex}.K3vHcW_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}.K3vHcW_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.K3vHcW_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}.K3vHcW_tab:focus-visible,.K3vHcW_search:focus-visible,.K3vHcW_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.K3vHcW_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.K3vHcW_tab:disabled{opacity:.5;cursor:default}.K3vHcW_searchField{display:block;position:relative}.K3vHcW_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.K3vHcW_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}.K3vHcW_search::placeholder{color:var(--dsw-alias-label-tertiary)}.K3vHcW_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)}.K3vHcW_search:focus-visible{outline:none}.K3vHcW_search:disabled{opacity:.6}.K3vHcW_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}.K3vHcW_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)}.K3vHcW_calloutIcon{flex:none;margin-top:2px}.K3vHcW_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}.K3vHcW_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}.K3vHcW_row+.K3vHcW_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.K3vHcW_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.K3vHcW_row:hover:before,.K3vHcW_row:hover+.K3vHcW_row:before{opacity:0}.K3vHcW_rowText{flex:1;min-width:0}.K3vHcW_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.K3vHcW_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}.K3vHcW_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.K3vHcW_metaIcon{opacity:.8;flex:none}.K3vHcW_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.K3vHcW_action{flex:none;min-width:64px}.K3vHcW_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.K3vHcW_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}.K3vHcW_emptyIcon{color:var(--dsw-alias-label-tertiary)}.K3vHcW_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}.K3vHcW_pageSize{align-items:center;gap:8px;display:inline-flex}.K3vHcW_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}.K3vHcW_select:disabled{opacity:.6;cursor:default}.K3vHcW_pager{align-items:center;gap:6px;display:inline-flex}.K3vHcW_range{font-variant-numeric:tabular-nums;margin-right:6px}.K3vHcW_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var Q={action:`K3vHcW_action`,callout:`K3vHcW_callout`,calloutIcon:`K3vHcW_calloutIcon`,empty:`K3vHcW_empty`,emptyIcon:`K3vHcW_emptyIcon`,footer:`K3vHcW_footer`,header:`K3vHcW_header`,heading:`K3vHcW_heading`,inner:`K3vHcW_inner`,list:`K3vHcW_list`,metaIcon:`K3vHcW_metaIcon`,metaItem:`K3vHcW_metaItem`,metaText:`K3vHcW_metaText`,page:`K3vHcW_page`,pageButton:`K3vHcW_pageButton`,pageSize:`K3vHcW_pageSize`,pager:`K3vHcW_pager`,range:`K3vHcW_range`,refresh:`K3vHcW_refresh`,row:`K3vHcW_row`,rowMeta:`K3vHcW_rowMeta`,rowText:`K3vHcW_rowText`,rowTitle:`K3vHcW_rowTitle`,search:`K3vHcW_search`,searchField:`K3vHcW_searchField`,searchIcon:`K3vHcW_searchIcon`,select:`K3vHcW_select`,status:`K3vHcW_status`,subtitle:`K3vHcW_subtitle`,tab:`K3vHcW_tab`,tabIcon:`K3vHcW_tabIcon`,tabs:`K3vHcW_tabs`,title:`K3vHcW_title`};function $p(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 em(e){return e instanceof Error?e.message:String(e)}function tm({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),[D,O]=(0,r.useState)({}),k=(0,r.useRef)(!1),ee=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=new AbortController;return ee.current=e,()=>e.abort()},[]),(0,r.useEffect)(()=>{let e=!0;return S(null),lu.sources().then(({harnesses:t})=>{e&&(o(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(em(t))}),()=>{e=!1}},[h]),(0,r.useEffect)(()=>{if(s===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{lu.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(em(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[s,l,d,p,h]);let A=(0,r.useMemo)(()=>/^(\/Users\/[^/]+|\/home\/[^/]+)/u.exec(_?.[0]?.cwd??``)?.[1],[_]),te=e=>A!==void 0&&(e===A||e.startsWith(`${A}/`))?`~${e.slice(A.length)}`:e,ne=async n=>{let r=ee.current?.signal;if(s===null||k.current||!r||r.aborted)return;let i=JSON.stringify([s,n.nativeSessionId]),a=D[i];k.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await lu.importSession(s,n.nativeSessionId);if(a=e.threadId,r.aborted)return;O(t=>({...t,[i]:e.threadId}))}r.aborted||await e(a,r)}catch(e){r.aborted||w(t(a?`openFailed`:`importFailed`,{message:em(e)}))}finally{k.current=!1,r.aborted||E(null)}},j=()=>{v(null),f(0),w(null)};return/* @__PURE__ */ (0,a.jsx)(`div`,{className:Q.page,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.inner,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.heading,children:[/* @__PURE__ */ (0,a.jsx)(`h1`,{className:Q.title,children:t(`title`)}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.subtitle,children:t(`subtitle`)})]}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,size:`sm`,className:Q.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:Q.status,children:t(`noSources`)}),n!==null&&n.length>1&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:Q.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:Q.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:Q.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:Q.searchField,children:[/* @__PURE__ */ (0,a.jsx)(i.IconSearchOutlineRegular,{size:16,className:Q.searchIcon}),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Q.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:Q.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,a.jsx)(i.IconWarningOutlineRegular,{size:16,className:Q.calloutIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(`error`,{message:x})})]}),C!==null&&/* @__PURE__ */ (0,a.jsxs)(`div`,{role:`alert`,className:Q.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,a.jsx)(i.IconWarningOutlineRegular,{size:16,className:Q.calloutIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:C})]}),x===null&&(n===null||s!==null&&_===null)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.status,children:[/* @__PURE__ */ (0,a.jsx)(i.StateDot,{state:`ongoing`}),t(`loading`)]}),_!==null&&_.length===0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.empty,children:[/* @__PURE__ */ (0,a.jsx)(i.IconSearchOutlineRegular,{size:22,className:Q.emptyIcon}),t(`empty`)]}),_!==null&&_.length>0&&/* @__PURE__ */ (0,a.jsx)(`ul`,{className:Q.list,children:_.map(e=>{let n=D[JSON.stringify([s,e.nativeSessionId])];return/* @__PURE__ */ (0,a.jsxs)(`li`,{className:Q.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Q.rowTitle,children:e.title??t(`untitled`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.rowMeta,children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Q.metaItem,title:e.cwd,children:[/* @__PURE__ */ (0,a.jsx)(i.IconFolderCloseRegular,{size:13,className:Q.metaIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.metaText,children:te(e.cwd)})]}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Q.metaItem,children:[/* @__PURE__ */ (0,a.jsx)(i.IconClockOutlineRegular,{size:13,className:Q.metaIcon}),$p(e.updatedAt)]})]})]}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:n?`outline`:`primary`,size:`sm`,className:Q.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:Q.footer,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:Q.pageSize,children:[t(`pageSize`),/* @__PURE__ */ (0,a.jsx)(`select`,{className:Q.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:Q.pager,children:[_!==null&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.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:Q.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:Q.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 nm=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(nm)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=nm,e.textContent=`.Ux8MVa_host{min-width:0;display:block}.Ux8MVa_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var rm={error:`Ux8MVa_error`,host:`Ux8MVa_host`};let im;function am(){return im??=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 im=void 0,e}),im}function om({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(``),am().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:rm.error,children:e(`settings.unavailable`,{message:s})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:rm.host})]})}let sm=`@deepseek-ai/dsh-client-ui-codexhost/SettingsLauncher.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(sm)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=sm,e.textContent=`.N4gKha_trigger{box-sizing:border-box;border-radius:var(--dsw-radius-md);cursor:pointer;min-width:0;height:42px;color:var(--dsw-alias-label-primary);background:0 0;border:none;flex:1;align-items:center;gap:8px;margin:0;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex}.N4gKha_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.N4gKha_trigger[data-wide=false]{flex:none;justify-content:center;gap:0;width:36px;height:36px;padding:0}.N4gKha_icon{flex:none;display:inline-flex;position:relative}.N4gKha_badge{background:#3b82f6;border-radius:50%;width:8px;height:8px;position:absolute;top:-3px;right:-3px}.N4gKha_label{white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var cm={badge:`N4gKha_badge`,icon:`N4gKha_icon`,label:`N4gKha_label`,trigger:`N4gKha_trigger`};function lm({wide:e,settingsOpen:t,settingsShortcut:n,openSettings:o,connection:s,openSection:c,t:l}){let u=(0,r.useSyncExternalStore)(s.state.subscribe,s.state.getSnapshot)===`connected`,[d,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!u||t)return;let e=new AbortController;return Ql(AbortSignal.any([e.signal,AbortSignal.timeout(5e3)])).then(t=>{!e.signal.aborted&&(t.error===null||t.latestVersion!==null)&&f(t.updateAvailable)}).catch(()=>void 0),()=>e.abort()},[u,t]);let p=l(d?`settings.updateAvailable`:`settings.open`);return/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{disabled:t,label:p,shortcutKeys:n?.keys,children:/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:cm.trigger,"data-wide":e,"data-update-available":d||void 0,"aria-label":p,"aria-keyshortcuts":n?.aria,"aria-haspopup":`dialog`,"aria-expanded":t,onClick:()=>{d?c(`codexhost-updates`):o()},children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:cm.icon,children:[/* @__PURE__ */ (0,a.jsx)(i.IconSettingsOutlineMedium,{size:e?16:18}),d?/* @__PURE__ */ (0,a.jsx)(`span`,{className:cm.badge,"aria-hidden":`true`}):null]}),e?/* @__PURE__ */ (0,a.jsx)(`span`,{className:cm.label,children:l(`settings.open`)}):null]})})}let um={"file.download":`Download`,"file.openFolder":`Open containing folder`,"file.openFolder.failed":`Could not open the containing folder.`,"discovery.agents":`Delegation Agents`,"discovery.sessions":`Sessions`,"discovery.commands":`Native commands`,"discovery.skills":`Skills`,"discovery.offline":`Host disconnected`,"discovery.pending":`A command request is pending`,"discovery.busy":`Thread busy; direct commands cannot be queued`,"discovery.stale":`The selection expired. Open the menu and select again.`,"discovery.unconfirmed":`Command not confirmed. Check Thread progress before retrying; no automatic resend.`,"discovery.conflict":`Invocation conflicts with an interface command`,"discovery.static":`Static catalog: project commands 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.open":`Settings`,"settings.updateAvailable":`Settings · A new version is available`,"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`,"connection.historyStale":`Messages and task status may be out of date`,"connection.retryHistory":`Retry history`,"connection.retryingHistory":`Retrying…`,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.performance":`Performance`,"usage.group.cache":`Cache`,"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.average":`Average 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.resetCredits.short":`Reset credits`,"usage.resetCredits.count":`{count} left`,"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.fiveHour.short":`5-hour`,"usage.plan.sevenDay":`7-day limit`,"usage.plan.sevenDay.short":`7-day`,"usage.plan.weekly":`Weekly limit`,"usage.plan.weekly.short":`Weekly`,"usage.plan.monthly":`Monthly limit`,"usage.plan.monthly.short":`Monthly`,"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.expires.at":`Expires {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.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.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.signOutRowTitle":`This device`,"connectDevices.signOutHint":`Clear this browser's sign-in without affecting other devices.`,"connectDevices.signOutTitle":`Sign out of this device?`,"connectDevices.signOutDescription":`Signing back in needs the access token from the computer or another signed-in device. 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.authDisabled":`Authentication must be enabled to manage interface extensions.`,"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.`,"wallpaper.title":`Background image`,"wallpaper.description":`Upload a local image as the background`,"wallpaper.active":``,"wallpaper.activeNamed":`{name}`,"wallpaper.upload":`Upload image`,"wallpaper.replace":`Change image`,"wallpaper.remove":`Remove`,"wallpaper.opacity":`Background opacity`,"wallpaper.error.unsupported-storage":`Local browser storage is unavailable, so background images cannot be saved.`,"wallpaper.error.invalid-format":`Choose a PNG, JPEG, WebP, GIF, or AVIF image.`,"wallpaper.error.file-too-large":`Image exceeds the 20 MiB limit.`,"wallpaper.error.decode-failed":`Could not decode this image file.`,"wallpaper.error.storage-failed":`Could not save the background image in this browser.`},dm={"file.download":`下载`,"file.openFolder":`打开所在文件夹`,"file.openFolder.failed":`打开所在文件夹失败。`,"discovery.agents":`委派 Agent`,"discovery.sessions":`会话`,"discovery.commands":`原生命令`,"discovery.skills":`Skills`,"discovery.offline":`Host 已断线`,"discovery.pending":`命令请求正在提交`,"discovery.busy":`会话正忙,直接命令不能排队`,"discovery.stale":`选择已失效,请重新打开菜单选择。`,"discovery.unconfirmed":`命令结果未确认,请先检查会话进度再决定是否重试;不会自动重发。`,"discovery.conflict":`调用名与界面命令冲突`,"discovery.static":`静态目录:项目命令在会话启动后加载。`,"skills.project":`项目`,"skills.global":`全局`,"skills.loading":`正在加载 Skills…`,"skills.retry":`重试 Skill 库`,"skills.warnings":`部分 Skill 无法读取`,"skills.failed":`Skill 库不可用:`,"discovery.empty":`未提供原生命令。`,"discovery.retry":`重试原生命令目录`,"discovery.failed":`原生命令目录不可用:`,remoteAccess:`远程访问`,"settings.open":`设置`,"settings.updateAvailable":`设置 · 有新版本可用`,"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":`重试`,"connection.historyStale":`消息与任务状态可能未更新`,"connection.retryHistory":`重新读取历史`,"connection.retryingHistory":`正在重试…`,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.performance":`性能`,"usage.group.cache":`缓存`,"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.average":`平均输出速度(TPS)`,"usage.speed.api":`输出速度(API)`,"usage.ttft":`首 token(TTFT)`,"usage.cost":`费用`,"usage.cost.estimate":`费用估算`,"usage.credits":`已用 Credits`,"usage.resetCredits":`可用重置次数`,"usage.resetCredits.short":`可用重置次数`,"usage.resetCredits.count":`{count} 次`,"usage.context":`上下文占用`,"usage.tokens.io":`输入 / 输出`,"usage.tokens.cacheRead":`缓存读取`,"usage.tokens.cacheReadWrite":`缓存读取 / 写入`,"usage.tokens.total":`总数`,"usage.plan.fiveHour":`5 小时额度`,"usage.plan.fiveHour.short":`5 小时`,"usage.plan.sevenDay":`7 天额度`,"usage.plan.sevenDay.short":`7 天`,"usage.plan.weekly":`周额度`,"usage.plan.weekly.short":`周额度`,"usage.plan.monthly":`月额度`,"usage.plan.monthly.short":`月额度`,"usage.quota":`配额占用`,"usage.quota.remaining":`剩余`,"usage.quota.details":`额度详情`,"usage.resets":`重置时间`,"usage.dateLocale":`zh-CN`,"usage.reset.today":`今天 {time}`,"usage.reset.at":`{time} 重置`,"usage.expires.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.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.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.signOutRowTitle":`当前设备`,"connectDevices.signOutHint":`清除当前浏览器的登录状态,不影响其他设备。`,"connectDevices.signOutTitle":`退出这台设备的登录?`,"connectDevices.signOutDescription":`重新登录需要访问令牌,可从电脑或其他已登录设备获取。其他设备不受影响。`,"connectDevices.signOutConfirm":`退出登录`,"connectDevices.cancel":`取消`,"connectDevices.close":`关闭`,"connectDevices.localListener":`当前前台 Web 无法在此更改 IP 监听。你可以使用 Tailscale HTTPS,或查看配置文档。`,"extensions.description":`为 Web 添加 DSH 主题和面板。扩展对连接此 Web 服务的所有页面生效,安装后可在这里启用。`,"extensions.authDisabled":`未启用访问认证时不能管理界面扩展。`,"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":`录音文件不可用。`,"wallpaper.title":`背景图片`,"wallpaper.description":`上传本地图片作为背景`,"wallpaper.active":``,"wallpaper.activeNamed":`{name}`,"wallpaper.upload":`上传图片`,"wallpaper.replace":`更换图片`,"wallpaper.remove":`移除`,"wallpaper.opacity":`背景透明度`,"wallpaper.error.unsupported-storage":`当前浏览器不支持本地存储,无法保存背景图片。`,"wallpaper.error.invalid-format":`请选择 PNG、JPEG、WebP、GIF 或 AVIF 格式的图片。`,"wallpaper.error.file-too-large":`图片超过 20 MiB 上限。`,"wallpaper.error.decode-failed":`无法读取该图片文件。`,"wallpaper.error.storage-failed":`无法在当前浏览器保存背景图片。`},$=`codexhostImport`,fm=`codexhost-import`,pm=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`remote.session`,`inputTriggers`,`theme`,`connection`],mm=[[`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 hm(e){e.effect(()=>e.locale.register($,{zh:dm,en:um}),`ui-codexhost: dictionaries`);let t=e.locale.bind($);e.slots.inject(`sidebar.right.tab.document.actions`,()=>e.slots.register({name:`sidebar.right.tab.document.actions`,id:`codexhost-download`,inject:n=>({sessionId:n,label:t(`file.download`),openFolderLabel:t(`file.openFolder`),openFolderFailedLabel:t(`file.openFolder.failed`),revealFolder:t=>e.remote.session.openWorkspacePath({path:t,action:`reveal`})})},yd));let 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:$,inject:()=>({installation:n})},jp));let i=new Jp;e.effect(()=>()=>i.dispose(),`ui-codexhost: wallpaper`),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.wallpaper`,order:10.5,locale:$,inject:()=>({wallpaper:i})},Zp)),e.provide(`chatMessageEditing`,du),e.provide(`chatTurnDiffs`,uu),e.inject([`conversation`,`uiSession`],Ou),e.inject([`conversation`],e=>{let t=new Au(nu.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:$,inject:()=>i},Yu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:$,inject:()=>({screenshot:t,drafts:r})},td));let a=new rd($l.transcribe),o=new sd;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:$,inject:()=>({voice:a,blocks:e.conversation.blocks,tray:o})},ud)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:$,inject:()=>({voice:a,tray:o})},dd)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:$,inject:()=>({voice:a})},md)),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=>{_u(e),vu(e)});let a=t=>{let n=wu(t);if(n===void 0)return;let r=n,i=e.sessions.list.getSnapshot().byId[r],a=i===void 0?void 0:Su(i);if(a!==void 0)return{sessionId:r,title:a.title}};e.provide(`chatLinks`,{describe:t=>{let n=a(t);if(n!==void 0)return{title:n.title,icon:(0,r.createElement)(xd,{sessionId:n.sessionId,list:e.sessions.list})}},resolve:Object.assign(t=>{let n=a(t);if(n===void 0)return;let r=new URL(window.location.href);return r.searchParams.set(`session`,n.sessionId),{href:r.href,open:()=>{a(t)!==void 0&&e.uiWorkspace.openSession(n.sessionId)}}},{autoLinkPattern:xu,subscribe:t=>e.sessions.list.subscribe(t)})}),Du(e);let o={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:fm,locale:$,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`));o.openSession(n)}})},tm)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:fm,order:10,label:()=>t(`panel`),locale:$},gd)),e.inject([`settingsNavigation`],e=>{e.slots.inject(`settings.launcher`,()=>e.slots.register({name:`settings.launcher`,locale:$,inject:()=>({connection:e.get(`connection`),openSection:t=>e.settingsNavigation.openSection(t)})},lm)),e.slots.inject(`sidebar.primary.action`,()=>e.slots.register({name:`sidebar.primary.action`,id:`codexhost-remote-access`,locale:$,inject:()=>({openSection:t=>e.settingsNavigation.openSection(t)})},bd))}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:$},Op));let s={get:()=>e.locale.getLocale().active,subscribe:t=>e.locale.subscribe(t)},c={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:$,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},Tp)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:1,label:()=>t(`remoteAccess`),locale:$},cp)),mm.forEach(([n,r,i])=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:i,label:()=>t(r),locale:$,inject:()=>({pageId:n,locale:s,colorScheme:c})},om))});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})},xd));e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:$,inject:()=>({list:e.sessions.list,connection:e.get(`connection`),retryHistory:t=>e.sessions.retryHistory(t)})},Bd)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.session-opening`,locale:$,inject:()=>({navigation:e.uiWorkspace})},Vd)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:$},uf)),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`),jd(),Md(),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}`),o.openSession(t))})();let l=e=>{let t=e.data;t?.type===`codexhost/open-session`&&typeof t.sessionId==`string`&&o.openSession(t.sessionId)};`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,l),e.effect(()=>()=>{navigator.serviceWorker.removeEventListener(`message`,l)},`ui-codexhost: service worker messages`))}return n.NS=$,n.PANEL_ID=fm,n.apply=hm,n.inject=pm,t.exports}});