@codexhost/cli-win32-x64 0.29.2 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +94 -20
  4. package/app/console-web.js +123 -31
  5. package/app/desktop-controller.mjs +113 -37
  6. package/app/host-runtime.mjs +3963 -2280
  7. package/app/plugins/antigravity/plugin.mjs +94 -20
  8. package/app/plugins/claude-code/plugin.mjs +105 -28
  9. package/app/plugins/codebuddy/plugin.mjs +767 -202
  10. package/app/plugins/codex-usage/plugin.mjs +112 -38
  11. package/app/plugins/copilot/plugin.mjs +94 -20
  12. package/app/plugins/cursor-cli/plugin.mjs +94 -20
  13. package/app/plugins/deepseek-harness/plugin.mjs +94 -20
  14. package/app/plugins/devin/plugin.mjs +94 -20
  15. package/app/plugins/grok/plugin.mjs +94 -20
  16. package/app/plugins/hermes/plugin.mjs +94 -20
  17. package/app/plugins/kimi-code/plugin.mjs +94 -20
  18. package/app/plugins/kiro-cli/plugin.mjs +94 -20
  19. package/app/plugins/omp/plugin.mjs +94 -20
  20. package/app/plugins/opencode/plugin.mjs +94 -20
  21. package/app/plugins/pi/plugin.mjs +94 -20
  22. package/app/plugins/qoder/plugin.mjs +94 -20
  23. package/app/plugins/qoder-cn/plugin.mjs +94 -20
  24. package/app/plugins/qwen-code/plugin.mjs +94 -20
  25. package/app/plugins/workbuddy/plugin.mjs +798 -202
  26. package/app/plugins/zcode/plugin.mjs +94 -20
  27. package/app/renderer-extension.js +702 -440
  28. package/app/web/assets/abnfDiagram-XWFEHMT6-Bqy7uOSy.js +1 -0
  29. package/app/web/assets/architectureDiagram-CSQXQB3N-6aaP1YoM.js +36 -0
  30. package/app/web/assets/blockDiagram-BEDRHYPZ-B4QSFXe0.js +140 -0
  31. package/app/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
  32. package/app/web/assets/c4Diagram-M2UUVUY5-BYE-C8Gq.js +38 -0
  33. package/app/web/assets/chunk-2Q5K7J3B-CiEM-GTd.js +1 -0
  34. package/app/web/assets/chunk-3GCGMST5-hzY9BiB1.js +1 -0
  35. package/app/web/assets/chunk-5VM5RSS4-DYXznY0H.js +15 -0
  36. package/app/web/assets/chunk-7U7NFRK5-Bzw5MDPr.js +88 -0
  37. package/app/web/assets/chunk-CNRTWJTD-DMbxMfi3.js +1 -0
  38. package/app/web/assets/chunk-D5HYT7QG-By0ZVBtD.js +1 -0
  39. package/app/web/assets/chunk-EBZ3SEQC-Yyu_sMV7.js +2 -0
  40. package/app/web/assets/chunk-JWPE2WC7-DDzqxIPT.js +1 -0
  41. package/app/web/assets/chunk-KTR4FSNJ-GlKqhtpl.js +1 -0
  42. package/app/web/assets/chunk-XXDRQBXY-DNc-CvYu.js +1 -0
  43. package/app/web/assets/classDiagram-v2-KXABOMEV-4_PFS2N_.js +217 -0
  44. package/app/web/assets/cose-bilkent-JH36ORCC-BE3foHUY.js +1 -0
  45. package/app/web/assets/cynefin-EF2NZ3EQ-D2PqrYZ3.js +141 -0
  46. package/app/web/assets/cynefinDiagram-NJNITYFG-DOObpTbq.js +62 -0
  47. package/app/web/assets/cytoscape.esm-Cm0uQArZ.js +332 -0
  48. package/app/web/assets/d3-scale-4DPf7zan.js +1 -0
  49. package/app/web/assets/dagre-KIHZ2IZ3-Znm2jin9.js +4 -0
  50. package/app/web/assets/diagram-7YQZDPLS-ByZMD-uA.js +41 -0
  51. package/app/web/assets/diagram-QBROCOUO-BiRShpnN.js +200 -0
  52. package/app/web/assets/diagram-RJJCUUZO-D9wLVoK2.js +30 -0
  53. package/app/web/assets/diagram-WERXNKYE-BSbIh-yC.js +24 -0
  54. package/app/web/assets/diagram-YHHI257C-DMWrHMc8.js +3 -0
  55. package/app/web/assets/diagram-YR4HJLHV-C4sBAFb1.js +24 -0
  56. package/app/web/assets/ebnfDiagram-N527522P-BZLloaoQ.js +1 -0
  57. package/app/web/assets/elk-O5DQBFGD-Da3e5tn5.js +27 -0
  58. package/app/web/assets/erDiagram-K3K3BIDK-B2lKAIZF.js +99 -0
  59. package/app/web/assets/flowDiagram-Z6JWZHQI-q2EY_kmB.js +213 -0
  60. package/app/web/assets/ganttDiagram-3PRQTZWP-BGrNZ20b.js +292 -0
  61. package/app/web/assets/gitGraphDiagram-VXDFKS5L-DIZNXREy.js +106 -0
  62. package/app/web/assets/graph-D8UmR1vK.js +1 -0
  63. package/app/web/assets/grid-E2QIVN74-0cUkPG69.js +1 -0
  64. package/app/web/assets/{index-aSHN2MIG.css → index-BbmB5VLj.css} +1 -1
  65. package/app/web/assets/{index-0TnaYwHS.js → index-PN7K-15_.js} +78 -78
  66. package/app/web/assets/infoDiagram-EZ3ZOAHP-BHhUTQCn.js +2 -0
  67. package/app/web/assets/ishikawaDiagram-S3EKX5GW-DPOxtl4c.js +70 -0
  68. package/app/web/assets/journeyDiagram-POQNLL5X-D8RyXckG.js +139 -0
  69. package/app/web/assets/kanban-definition-BH5XI6FM-COJv3Hyh.js +89 -0
  70. package/app/web/assets/langs/{graphql-ChAeyPkT.js → graphql-D6Z3qcRW.js} +1 -1
  71. package/app/web/assets/langs/{http-BvreBIbD.js → http-XiU9G9In.js} +1 -1
  72. package/app/web/assets/langs/{php-D8omCIuJ.js → php-DL3xwS-7.js} +1 -1
  73. package/app/web/assets/langs/{rst-Do7RLLCS.js → rst-DudRVJ9g.js} +1 -1
  74. package/app/web/assets/langs/{ruby-rH_O_vse.js → ruby-_FqsfqJi.js} +1 -1
  75. package/app/web/assets/langs/{svelte-xZy73wAj.js → svelte-ClsVJoBT.js} +1 -1
  76. package/app/web/assets/langs/{vue-C4DW8agZ.js → vue-BiKMXCyK.js} +1 -1
  77. package/app/web/assets/mermaid.core-DYdcDKIt.js +314 -0
  78. package/app/web/assets/mindmap-definition-WVAN44T4-DnYIM4ja.js +98 -0
  79. package/app/web/assets/pegDiagram-D4NLKWP3-Ds3GAEJ6.js +1 -0
  80. package/app/web/assets/pieDiagram-36ENHN4W-BhLUJGEB.js +39 -0
  81. package/app/web/assets/quadrantDiagram-ZQUDMS73-DwtX-IxK.js +7 -0
  82. package/app/web/assets/railroadDiagram-JIZHGYPL-D2vmTTnJ.js +1 -0
  83. package/app/web/assets/render-VIF2ZAQL-DGU1ql-Z.js +2 -0
  84. package/app/web/assets/requirementDiagram-AXW2TVFA-u3j1sKkI.js +84 -0
  85. package/app/web/assets/sankeyDiagram-FBCJTAIF-k-An9VHW.js +40 -0
  86. package/app/web/assets/sequenceDiagram-3LA2ROMG-DUjbYb4R.js +169 -0
  87. package/app/web/assets/sizeCapture-2Q2CQKSF-DATTL7FZ.js +1 -0
  88. package/app/web/assets/stateDiagram-v2-ATKHQDJO-cCJX5M2u.js +291 -0
  89. package/app/web/assets/swimlanes-YQL5WMAO-B7grWEWt.js +1 -0
  90. package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +8 -0
  91. package/app/web/assets/timeline-definition-7Z437IG3-BhsLa6l1.js +120 -0
  92. package/app/web/assets/usecaseDiagram-RDK6N6HP-CkPQYmQw.js +370 -0
  93. package/app/web/assets/vendor-BKfNgqAm.js +666 -0
  94. package/app/web/assets/vennDiagram-SHRQU5PJ-CufZSwvw.js +34 -0
  95. package/app/web/assets/wardleyDiagram-F3OXNVQS-CSkfpFOA.js +78 -0
  96. package/app/web/assets/xychartDiagram-GDYJKCDI-BhZf9scK.js +7 -0
  97. package/app/web/codexhost-settings.js +57 -57
  98. package/app/web/index.html +3 -3
  99. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  100. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  101. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
  102. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  104. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +12 -12
  105. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
  106. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
  107. package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
  108. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  109. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  110. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  111. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  112. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -72
  113. package/app/web-modules/licenses/DSH-THIRD_PARTY_NOTICES.md +1 -1
  114. package/app/web-modules/server.mjs +724 -259
  115. package/bin/codexhost.exe +0 -0
  116. package/libexec/codexhost-node-repl.exe +0 -0
  117. package/libexec/codexhost-screenshot.exe +0 -0
  118. package/libexec/codexhost-shell.exe +0 -0
  119. package/libexec/codexhost-shim.exe +0 -0
  120. package/libexec/codexhost-updater.exe +0 -0
  121. package/package.json +1 -1
  122. package/app/web/assets/vendor-C9g2bw8s.js +0 -410
@@ -1,5 +1,5 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];pinnedWorkspaceIds=[];threadSections=[];state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;pinnedWorkspaceRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,{immediate:!0,recordRemoved:!0}),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(c(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async deleteSession(e){let t=await this.remote.deleteSession({sessionId:e});return t.ok&&(this.pendingArchives.delete(e),this.archivedSessionIds.includes(e)&&this.installArchived(this.archivedSessionIds.filter(t=>t!==e)),this.pinnedSessionIds.includes(e)&&this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),t}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.pinnedWorkspaceRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.installPinnedWorkspaces(e.pinnedWorkspaceIds??[]),this.threadSections=e.threadSections??[],this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}async setWorkspacePinned(e){let t=++this.pinnedWorkspaceRequestSeq,n=await this.remote.setWorkspacePinned(e);return n.ok&&t===this.pinnedWorkspaceRequestSeq&&this.installPinnedWorkspaces(n.value.pinnedWorkspaceIds),n}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}moveWorkspaceToSection(e){return this.remote.moveWorkspaceToSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replacePinnedWorkspaces(e){this.pinnedWorkspaceRequestSeq++,this.installPinnedWorkspaces(e)}replaceThreadSections(e){this.threadSections=e,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),pinnedWorkspaceIds:this.pinnedWorkspaceIds,threadSections:this.threadSections,state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installPinnedWorkspaces(e){e.length===this.pinnedWorkspaceIds.length&&e.every((e,t)=>e===this.pinnedWorkspaceIds[t])||(this.pinnedWorkspaceIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t={}){let{immediate:n=!1,recordRemoved:r=!1}=t;r&&!s(e)&&this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let i=this.pinnedWorkspaceIds.filter(t=>t!==e);i.length!==this.pinnedWorkspaceIds.length&&(this.pinnedWorkspaceIds=i);let a=this.items.filter(t=>t.workspaceId!==e);a.length===this.items.length?n&&this.invalidate(!0):(this.items=a,this.invalidate(n))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e){return e.startsWith(`remote-workspace:`)}function c(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var l=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},d=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new l(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new l(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw f(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw f(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw f(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new u(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw f(`session unarchive`,t.error)}async deleteSession(e){let t=await this.model.deleteSession(e);if(!t.ok)throw f(`session delete`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw f(`session pin`,t.error)}async moveSessionToSection(e,t){let n=await this.model.moveSessionToSection({sessionId:e,sectionId:t});if(!n.ok)throw f(`move to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async moveWorkspaceToSection(e,t){let n=await this.model.moveWorkspaceToSection({workspaceId:e,sectionId:t});if(!n.ok)throw f(`move project to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw f(`session unpin`,t.error)}async setWorkspacePinned(e,t){let n=await this.model.setWorkspacePinned({workspaceId:e,pinned:t});if(!n.ok)throw f(t?`pin`:`unpin`,n.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw f(`move`,r.error);return r.value.workspace}};function f(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let p=[`remote`,`remote.workspace`];function m(e){let t=new o(e.remote.workspace);new d(e,t);let n=h(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function h(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{g(t.accept,e)},failed:t.failed})}function g(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`pinnedWorkspaces`:e.replacePinnedWorkspaces(t.pinnedWorkspaceIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections);return;
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];pinnedWorkspaceIds=[];threadSections=[];threadSectionsV1;state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;pinnedWorkspaceRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,{immediate:!0,recordRemoved:!0}),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(c(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async deleteSession(e){let t=await this.remote.deleteSession({sessionId:e});return t.ok&&(this.pendingArchives.delete(e),this.archivedSessionIds.includes(e)&&this.installArchived(this.archivedSessionIds.filter(t=>t!==e)),this.pinnedSessionIds.includes(e)&&this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),t}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.pinnedWorkspaceRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.installPinnedWorkspaces(e.pinnedWorkspaceIds??[]),this.threadSections=e.threadSections??[],this.threadSectionsV1=e.threadSectionsV1,this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}async setWorkspacePinned(e){let t=++this.pinnedWorkspaceRequestSeq,n=await this.remote.setWorkspacePinned(e);return n.ok&&t===this.pinnedWorkspaceRequestSeq&&this.installPinnedWorkspaces(n.value.pinnedWorkspaceIds),n}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}moveWorkspaceToSection(e){return this.remote.moveWorkspaceToSection(e)}createThreadSection(e){return this.remote.createThreadSection(e)}updateThreadSection(e){return this.remote.updateThreadSection(e)}deleteThreadSection(e){return this.remote.deleteThreadSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replacePinnedWorkspaces(e){this.pinnedWorkspaceRequestSeq++,this.installPinnedWorkspaces(e)}replaceThreadSections(e,t){this.threadSections=e,this.threadSectionsV1=t,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),pinnedWorkspaceIds:this.pinnedWorkspaceIds,threadSections:this.threadSections,...this.threadSectionsV1?{threadSectionsV1:!0}:{},state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installPinnedWorkspaces(e){e.length===this.pinnedWorkspaceIds.length&&e.every((e,t)=>e===this.pinnedWorkspaceIds[t])||(this.pinnedWorkspaceIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t={}){let{immediate:n=!1,recordRemoved:r=!1}=t;r&&!s(e)&&this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let i=this.pinnedWorkspaceIds.filter(t=>t!==e);i.length!==this.pinnedWorkspaceIds.length&&(this.pinnedWorkspaceIds=i);let a=this.items.filter(t=>t.workspaceId!==e);a.length===this.items.length?n&&this.invalidate(!0):(this.items=a,this.invalidate(n))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e){return e.startsWith(`remote-workspace:`)}function c(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var l=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},d=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new l(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new l(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw p(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw p(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw p(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new u(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw p(`session unarchive`,t.error)}async deleteSession(e){let t=await this.model.deleteSession(e);if(!t.ok)throw p(`session delete`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw p(`session pin`,t.error)}async moveSessionToSection(e,t,n,r){let i=await this.model.moveSessionToSection({sessionId:e,sectionId:t,...n===void 0?{}:{beforeSessionId:n},...r===void 0?{}:{expectedSourceSectionId:r}});if(!i.ok){let e=i.error.code,t=i.error.details,n=`hostCode`in t?t.hostCode:void 0;if(e===`gateway/internal`||e===`gateway/cancelled`||e===`host/disconnected`||e===`host/resync`||e===`remote/offline`||e===`host/rejected`&&(n===-32093||n===-32094))return{status:`unknown`};throw p(`move to section`,i.error)}if(i.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async moveWorkspaceToSection(e,t){let n=await this.model.moveWorkspaceToSection({workspaceId:e,sectionId:t});if(!n.ok)throw p(`move project to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async createThreadSection(e){return f(`create thread section`,await this.model.createThreadSection({name:e}))}async updateThreadSection(e,t){return f(`update thread section`,await this.model.updateThreadSection({sectionId:e,name:t}))}async deleteThreadSection(e){return f(`delete thread section`,await this.model.deleteThreadSection({sectionId:e}))}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw p(`session unpin`,t.error)}async setWorkspacePinned(e,t){let n=await this.model.setWorkspacePinned({workspaceId:e,pinned:t});if(!n.ok)throw p(t?`pin`:`unpin`,n.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw p(`move`,r.error);return r.value.workspace}};function f(e,t){if(t.ok)return t.value;if(t.error.code===`gateway/internal`||t.error.code===`gateway/cancelled`)return{status:`unknown`};throw p(e,t.error)}function p(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let m=[`remote`,`remote.workspace`];function h(e){let t=new o(e.remote.workspace);new d(e,t);let n=g(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function g(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(!0,t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{_(t.accept,e)},failed:t.failed})}function _(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`pinnedWorkspaces`:e.replacePinnedWorkspaces(t.pinnedWorkspaceIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections,t.threadSectionsV1);return;
2
2
  /* v8 ignore next -- the generated Remote codec validates this closed union */
3
- default:return _(t)}}
3
+ default:return v(t)}}
4
4
  /* v8 ignore next 3 -- closed-union backstop after generated Remote validation */
5
- function _(e){throw Error(`unreachable Workspace increment: ${JSON.stringify(e)}`)}return n.ClientWorkspaceModel=o,n.WorkspaceArchiveError=u,n.WorkspaceController=d,n.WorkspaceCreateError=l,n.apply=m,n.createWorkspaceStateStream=h,n.inject=p,t.exports}});
5
+ function v(e){throw Error(`unreachable Workspace increment: ${JSON.stringify(e)}`)}return n.ClientWorkspaceModel=o,n.WorkspaceArchiveError=u,n.WorkspaceController=d,n.WorkspaceCreateError=l,n.apply=h,n.createWorkspaceStateStream=g,n.inject=m,t.exports}});
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-locale`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("@deepseek-ai/dsh-client-ui-primitives"),a=e("react/jsx-runtime"),o=e("@deepseek-ai/dsh-client-store");function s(e){if(typeof e!=`object`||!e||!(`languages`in e)||!Array.isArray(e.languages)||!e.languages.every(e=>typeof e==`string`)||!(`preference`in e)||e.preference!==null&&typeof e.preference!=`string`)throw TypeError(`locale: invalid native initialization data`);return{languages:e.languages,preference:e.preference}}function c(e){return e==null}function l(e){return e&&typeof e==`object`&&!Array.isArray(e)}function u(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function d(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function f(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let p=Symbol.for(`cosmokit.volatile.write`);function m(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>m(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,m(n,t)])))}finally{t.delete(e)}}function h(e){let t=m(e);return Object.freeze({get:()=>t,[p]:e=>{t=e}})}function g(e){return typeof e==`object`&&!!e&&p in e}function _(e,t){return arguments.length===1?t=>_(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function v(e){return _(`ArrayBuffer`,e)||_(`SharedArrayBuffer`,e)}function y(e){return v(e)||ArrayBuffer.isView(e)}let b;(function(e){e.is=v,e.isSource=y;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(b||={}),b.fromBase64,b.toBase64,b.fromHex,b.toHex;function x(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(_(`Date`,e))return new Date(e.valueOf());if(_(`RegExp`,e))return new RegExp(e.source,e.flags);if(v(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(x,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(x,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function S(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(g(e)||g(t))return g(e)&&g(t);if(!n&&c(e)&&c(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(_(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(_(`URL`),(e,t)=>e.href===t.href)??a(_(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(v,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let C;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(C||={});let w=Symbol.for(`schemastery`),T=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var E=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[T]}};Object.defineProperty(E.prototype,T,{value:!0});let D=function(e){let t=function(e,n={}){return D.resolve(e,t,n)[0]};if(e.refs){let t=d(e.refs,e=>new D(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&d(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,D.prototype),t.meta||={},t.toString=t.toString.bind(t),t};D.prototype=Object.create(Function.prototype),D.prototype[w]=!0,Object.defineProperty(D.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:D.resolve(e,this,{})[0]}}catch(e){if(E.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),D.ValidationError=E,D.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},D.prototype.set=function(e,t){return this.dict[e]=t,this},D.prototype.push=function(e){return this.list.push(e),this};function ee(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function O(e){return e?.$value??e?.$inner}function k(e){return u(e??{},e=>!e.startsWith(`$`))}D.prototype.i18n=function(e){let t=D(this),n=ee(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=d(t.dict,(t,n)=>t.i18n(d(e,e=>O(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(d(e,(e={})=>Array.isArray(O(e))?O(e)[n]:Array.isArray(e)?e[n]:k(e)))),t.inner&&=t.inner.i18n(d(e,e=>O(e)?O(e):k(e))),t.sKey&&=t.sKey.i18n(d(e,e=>e?.$key)),t},D.prototype.extra=function(e,t){let n=D(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(D.prototype,{[e](t=!0){let n=D(this);return n.meta={...n.meta,[e]:t},n}});D.prototype.deprecated=function(){let e=D(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},D.prototype.experimental=function(){let e=D(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},D.prototype.pattern=function(e){let t=D(this),n=f(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},D.prototype.simplify=function(e){if(g(e)&&(e=e.get()),S(e,this.meta.default,this.type===`dict`))return null;if(c(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!c(r))&&(t[n]=r)}return S(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return D.resolve(e,t,{}),t.simplify(e)}catch{}return e},D.prototype.toString=function(e){return R[this.type]?.(this,e)??`Schema<${this.type}>`},D.prototype.role=function(e,t){let n=D(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(D.prototype,{[e](t){let n=D(this);return n.meta={...n.meta,[e]:t},n}});D.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let A={},j=Symbol(`checked-volatile-schema`);function M(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new E(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))M(i,[...t,n],a,r);if(e.sKey&&M(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[w])&&M(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)M(e.list[n],[...t,String(n)],!0,r)}D.extend=function(e,t){A[e]=t},D.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[j]||(M(t,n.path),n={...n,[j]:!0}),t.meta?.volatile){let i=D(t);i.meta={...t.meta,volatile:!1};let[a,o]=D.resolve(e,i,n,r);try{return[h(a),o]}catch(e){throw new E(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(c(e)&&t.type!==`lazy`){if(t.meta.required)throw new E(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&c(i);)r=r.list[0],i=r?.meta.default;if(c(i))return[e];e=x(i)}let i=A[t.type];if(!i)throw new E(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},D.from=function(e){if(c(e))return D.any();if([`string`,`number`,`boolean`].includes(typeof e))return D.const(e).required();if(e[w])return e;if(typeof e==`function`)switch(e){case String:return D.string().required();case Number:return D.number().required();case Boolean:return D.boolean().required();case Function:return D.function().required();default:return D.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},D.lazy=function(e){let t=new D({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[w]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},D.natural=function(){return D.number().step(1).min(0)},D.percent=function(){return D.number().step(.01).min(0).max(1).role(`slider`)},D.date=function(){return D.union([D.is(Date),D.transform(D.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new E(`invalid date "${e}"`,t);return n},!0)])},D.regExp=function(e=``){return D.union([D.is(RegExp),D.transform(D.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new E(e.message,n)}},!0)])},D.arrayBuffer=function(e){return D.union([D.is(ArrayBuffer),D.is(SharedArrayBuffer),D.transform(D.any(),(e,t)=>{if(b.isSource(e))return b.fromSource(e);throw new E(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[D.transform(D.string(),(t,n)=>{try{return e===`base64`?b.fromBase64(t):b.fromHex(t)}catch(e){throw new E(e.message,n)}},!0)]:[]])},D.extend(`lazy`,(e,t,n,r)=>(t.inner[w]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},M(t.inner,n.path,!0)),D.resolve(e,t.inner,n,r))),D.extend(`any`,e=>[e]),D.extend(`never`,(e,t,n)=>{throw new E(`expected nullable but got ${e}`,n)}),D.extend(`const`,(e,{value:t},n)=>{if(S(e,t))return[t];throw new E(`expected ${t} but got ${e}`,n)});function N(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new E(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new E(`expected ${n} >= ${o} but got ${e}`,r)}D.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new E(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new E(`expect string to match regexp ${r}`,n)}return N(e.length,t,`string length`,n),[e]});function P(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function F(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(P(e,i)-P(t,i))%P(n,i)===0}D.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new E(`expected number but got ${e}`,n);N(e,t,`number`,n);let{step:r}=t;if(r&&!F(e,t.min??0,r))throw new E(`expected number multiple of ${r} but got ${e}`,n);return[e]}),D.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new E(`expected boolean but got ${e}`,n)}),D.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new E(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new E(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),D.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new E(`expected function but got ${e}`,n)}),D.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new E(`expected ${t.name} but got ${e}`,n)}{if(c(e))throw new E(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new E(`expected ${t} but got ${e}`,n)}});function I(e,t,n,r){try{let[i,a]=D.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?h(n.meta.default):n.meta.default}}D.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new E(`expected array but got ${e}`,r);return N(e.length,n,`array length`,r,!c(t.meta.default)),[e.map((n,i)=>I(e,i,t,r))]}),D.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!l(e))throw new E(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=D.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=I(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),D.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new E(`expected array but got ${e}`,n);let i=t.map((t,r)=>I(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function L(e,t){for(let n in t)n in e||(e[n]=t[n])}D.extend(`object`,(e,{dict:t},n,r)=>{if(!l(e))throw new E(`expected object but got ${e}`,n);let i={};for(let r in t){let a=I(e,r,t[r],n);(!c(a)||r in e)&&(i[r]=a)}return r||L(i,e),[i]}),D.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return D.resolve(e,n,r,i)}catch(e){a.push(e)}throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),D.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=D.resolve(e,i,r,!0)[0];if(!c(t)){if(c(a))a=t;else if(typeof a!=typeof t)throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)L(a??={},t);else if(a!==t)throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&l(e)&&L(a,e),[a]}),D.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=D.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let R={};function z(e,t,n){R[e]=n,Object.assign(D,{[e](...n){let r=new D({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??D.string();break;case`inner`:r.inner=D.from(n[t]);break;case`list`:r.list=n[t].map(D.from);break;case`dict`:r.dict=d(n[t],D.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}z(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),z(`any`,[],()=>`any`),z(`never`,[],()=>`never`),z(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),z(`string`,[],()=>`string`),z(`number`,[],()=>`number`),z(`boolean`,[],()=>`boolean`),z(`bitset`,[`bits`],()=>`bitset`),z(`function`,[],()=>`function`),z(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),z(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),z(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),z(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),z(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),z(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),z(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let B=`preference`,V=/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u,te=[`zh`,`en`],ne={[B]:D.string().pattern(V).required(!1)};D.object(ne);let H={ok:`确定`,cancel:`取消`,close:`关闭`,copy:`复制`,copied:`复制成功`,"codeBlock.title":`代码块`,"codeBlock.wrap":`自动换行`,"codeBlock.unwrap":`取消自动换行`,"copy.failed":`复制失败`,"copy.value":`复制值`,"copy.json":`复制 JSON`,"copy.path":`复制属性路径`,"copy.prettyJson":`复制格式化 JSON`,"copy.compactJson":`复制紧凑 JSON`,"copy.optionsHint":`{action};右键点击可选择复制方式`,retry:`重试`,loading:`加载中…`,"load.failed":`加载失败`,submit:`提交`,submitting:`正在提交…`,next:`下一步`,previous:`上一步`,skip:`跳过`,delete:`删除`,edit:`编辑`,save:`保存`,search:`搜索`,more:`更多`,collapse:`收起`,expand:`展开`,back:`返回`,"brand.localBuild":`DSH 本地构建`,"workspace.defaultName":`默认工作区`,unknown:`未知`,none:`无`,truncated:`已截断`,"json.label":`JSON`,"markdown.footnotes":`脚注`,"markdown.truncatedCharacters":`… 已截断,共 {total} 字符`,"number.thousand":`{value}K`,"number.million":`{value}M`},U={ok:`OK`,cancel:`Cancel`,close:`Close`,copy:`Copy`,copied:`Copied`,"codeBlock.title":`Code block`,"codeBlock.wrap":`Wrap lines`,"codeBlock.unwrap":`Do not wrap lines`,"copy.failed":`Copy failed`,"copy.value":`Copy value`,"copy.json":`Copy JSON`,"copy.path":`Copy property path`,"copy.prettyJson":`Copy pretty JSON`,"copy.compactJson":`Copy compact JSON`,"copy.optionsHint":`{action}; right-click for copy options`,retry:`Retry`,loading:`Loading…`,"load.failed":`Failed to load`,submit:`Submit`,submitting:`Submitting…`,next:`Next`,previous:`Previous`,skip:`Skip`,delete:`Delete`,edit:`Edit`,save:`Save`,search:`Search`,more:`More`,collapse:`Collapse`,expand:`Expand`,back:`Back`,"brand.localBuild":`DSH Local Build`,"workspace.defaultName":`Default workspace`,unknown:`Unknown`,none:`None`,truncated:`Truncated`,"json.label":`JSON`,"markdown.footnotes":`Footnotes`,"markdown.truncatedCharacters":`… truncated at {total} characters`,"number.thousand":`{value}K`,"number.million":`{value}M`},W={"language.title":`Language / 语言`},G={"language.title":`Language / 语言`};function K({t:e,setLocale:t,useStore:n}){let o=(0,r.useId)(),s=n(e=>e.active),c=n(e=>e.options);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:i.preferenceRowStyles.row,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.rowText,children:/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.title,id:o,children:e(`language.title`)})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.choices,role:`group`,"aria-labelledby":o,children:c.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:i.preferenceRowStyles.choice,lang:e.id,"aria-pressed":e.id===s,onClick:()=>{e.id!==s&&t(e.id)},children:e.label},e.id))})]})}function q(){return(0,o.defineStore)({init:()=>({active:``,options:[],revision:-1}),actions:{sync:(e,t,n,r)=>{r<=e.revision||(e.active=t,e.options=n,e.revision=r)}}})}let J=`common`,Y=`settings.locale`,X={zh:{label:`中文`,fallback:`en`},en:{label:`English`}},re=Object.freeze(te.map(e=>Object.freeze({id:e,...X[e]})));function Z(e){return e.toLowerCase()}function ie(e){if(!V.test(e.id))throw Error(`locale id "${e.id}" is not a BCP 47-style tag`);if(e.label.trim()===``)throw Error(`locale label must not be empty`);if(!V.test(e.fallback))throw Error(`locale fallback "${e.fallback}" is not a BCP 47-style tag`);return Object.freeze({id:e.id,label:e.label,fallback:e.fallback})}function ae(e){if(typeof document>`u`)return;let t=e.active===`zh`?`zh-CN`:e.active;document.documentElement.lang!==t&&(document.documentElement.lang=t)}var Q=class{bootstrap;dicts=/* @__PURE__ */ new Map;bound=/* @__PURE__ */ new Map;catalog=/* @__PURE__ */ new Map;fallbackChains=/* @__PURE__ */ new Map;snapshot;listeners=/* @__PURE__ */ new Set;ctx;host;provisional;preference;constructor(e,t,n){this.bootstrap=n,this.ctx=e,this.host=t;for(let e of re)this.catalog.set(Z(e.id),e);let r=this.localeList();this.provisional=$(r,n?.languages),this.preference=n?.preference??void 0,this.snapshot=Object.freeze({active:this.resolveActive(),locales:r,revision:0}),t!==void 0&&(e.effect(()=>t.subscribe(()=>{this.adopt(t)}),`locale: settings scope adoption`),this.adopt(t))}getLocale(){return this.snapshot}resolveText(e){return typeof e==`string`?e:this.fallbackChain(this.snapshot.active).reduceRight((t,n)=>e[Z(n)]??t,e.en)}getSnapshot(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setLocale(e){let t=this.catalog.get(Z(e));if(t===void 0)throw Error(`locale "${e}" is not registered`);this.preference=t.id,this.snapshot.active!==t.id&&this.publish(t.id,!0),this.host?.set(B,t.id)}addLanguage(e){let t=ie(e),n=Z(t.id);if(this.catalog.has(n))throw Error(`locale "${t.id}" is already registered`);let r=this.catalog.get(Z(t.fallback));if(r===void 0)throw Error(`locale fallback "${t.fallback}" is not registered`);let i=Object.freeze({...t,fallback:r.id});this.catalog.set(n,i);try{this.assertFallbackChain(i.id)}catch(e){throw this.catalog.delete(n),e}return this.publishCatalog(),()=>{this.catalog.get(n)===i&&(this.catalog.delete(n),this.publishCatalog())}}adopt(e){let t=e.getSnapshot().value;if(t===void 0)return;this.preference=t.preference;let n=this.resolveActive();this.snapshot.active!==n&&this.publish(n,!0)}publishCatalog(){this.fallbackChains.clear();let e=this.localeList();this.provisional=$(e,this.bootstrap?.languages);let t=this.resolveActive();this.publish(t,t!==this.snapshot.active,e)}resolveActive(){return this.preference===void 0?this.provisional:this.catalog.get(Z(this.preference))?.id??this.provisional}localeList(){return Object.freeze([...this.catalog.values()])}assertFallbackChain(e){let t=/* @__PURE__ */ new Set,n=this.catalog.get(Z(e));for(;n!==void 0;){let e=Z(n.id);if(t.has(e))throw Error(`locale fallback cycle includes "${n.id}"`);if(t.add(e),e===Z(`en`))return;
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-locale`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("@deepseek-ai/dsh-client-ui-primitives"),a=e("react/jsx-runtime"),o=e("@deepseek-ai/dsh-client-store");function s(e){if(typeof e!=`object`||!e||!(`languages`in e)||!Array.isArray(e.languages)||!e.languages.every(e=>typeof e==`string`)||!(`preference`in e)||e.preference!==null&&typeof e.preference!=`string`)throw TypeError(`locale: invalid native initialization data`);return{languages:e.languages,preference:e.preference}}function c(e){return e==null}function l(e){return e&&typeof e==`object`&&!Array.isArray(e)}function u(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function d(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function f(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let p=Symbol.for(`cosmokit.volatile.write`);function m(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>m(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,m(n,t)])))}finally{t.delete(e)}}function h(e){let t=m(e);return Object.freeze({get:()=>t,[p]:e=>{t=e}})}function g(e){return typeof e==`object`&&!!e&&p in e}function _(e,t){return arguments.length===1?t=>_(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function v(e){return _(`ArrayBuffer`,e)||_(`SharedArrayBuffer`,e)}function y(e){return v(e)||ArrayBuffer.isView(e)}let b;(function(e){e.is=v,e.isSource=y;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(b||={}),b.fromBase64,b.toBase64,b.fromHex,b.toHex;function x(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(_(`Date`,e))return new Date(e.valueOf());if(_(`RegExp`,e))return new RegExp(e.source,e.flags);if(v(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(x,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(x,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function S(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(g(e)||g(t))return g(e)&&g(t);if(!n&&c(e)&&c(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(_(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(_(`URL`),(e,t)=>e.href===t.href)??a(_(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(v,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let C;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(C||={});let w=Symbol.for(`schemastery`),T=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var E=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[T]}};Object.defineProperty(E.prototype,T,{value:!0});let D=function(e){let t=function(e,n={}){return D.resolve(e,t,n)[0]};if(e.refs){let t=d(e.refs,e=>new D(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&d(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,D.prototype),t.meta||={},t.toString=t.toString.bind(t),t};D.prototype=Object.create(Function.prototype),D.prototype[w]=!0,Object.defineProperty(D.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:D.resolve(e,this,{})[0]}}catch(e){if(E.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),D.ValidationError=E,D.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},D.prototype.set=function(e,t){return this.dict[e]=t,this},D.prototype.push=function(e){return this.list.push(e),this};function ee(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function O(e){return e?.$value??e?.$inner}function k(e){return u(e??{},e=>!e.startsWith(`$`))}D.prototype.i18n=function(e){let t=D(this),n=ee(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=d(t.dict,(t,n)=>t.i18n(d(e,e=>O(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(d(e,(e={})=>Array.isArray(O(e))?O(e)[n]:Array.isArray(e)?e[n]:k(e)))),t.inner&&=t.inner.i18n(d(e,e=>O(e)?O(e):k(e))),t.sKey&&=t.sKey.i18n(d(e,e=>e?.$key)),t},D.prototype.extra=function(e,t){let n=D(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(D.prototype,{[e](t=!0){let n=D(this);return n.meta={...n.meta,[e]:t},n}});D.prototype.deprecated=function(){let e=D(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},D.prototype.experimental=function(){let e=D(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},D.prototype.pattern=function(e){let t=D(this),n=f(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},D.prototype.simplify=function(e){if(g(e)&&(e=e.get()),S(e,this.meta.default,this.type===`dict`))return null;if(c(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!c(r))&&(t[n]=r)}return S(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return D.resolve(e,t,{}),t.simplify(e)}catch{}return e},D.prototype.toString=function(e){return R[this.type]?.(this,e)??`Schema<${this.type}>`},D.prototype.role=function(e,t){let n=D(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(D.prototype,{[e](t){let n=D(this);return n.meta={...n.meta,[e]:t},n}});D.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let A={},j=Symbol(`checked-volatile-schema`);function M(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new E(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))M(i,[...t,n],a,r);if(e.sKey&&M(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[w])&&M(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)M(e.list[n],[...t,String(n)],!0,r)}D.extend=function(e,t){A[e]=t},D.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[j]||(M(t,n.path),n={...n,[j]:!0}),t.meta?.volatile){let i=D(t);i.meta={...t.meta,volatile:!1};let[a,o]=D.resolve(e,i,n,r);try{return[h(a),o]}catch(e){throw new E(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(c(e)&&t.type!==`lazy`){if(t.meta.required)throw new E(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&c(i);)r=r.list[0],i=r?.meta.default;if(c(i))return[e];e=x(i)}let i=A[t.type];if(!i)throw new E(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},D.from=function(e){if(c(e))return D.any();if([`string`,`number`,`boolean`].includes(typeof e))return D.const(e).required();if(e[w])return e;if(typeof e==`function`)switch(e){case String:return D.string().required();case Number:return D.number().required();case Boolean:return D.boolean().required();case Function:return D.function().required();default:return D.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},D.lazy=function(e){let t=new D({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[w]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},D.natural=function(){return D.number().step(1).min(0)},D.percent=function(){return D.number().step(.01).min(0).max(1).role(`slider`)},D.date=function(){return D.union([D.is(Date),D.transform(D.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new E(`invalid date "${e}"`,t);return n},!0)])},D.regExp=function(e=``){return D.union([D.is(RegExp),D.transform(D.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new E(e.message,n)}},!0)])},D.arrayBuffer=function(e){return D.union([D.is(ArrayBuffer),D.is(SharedArrayBuffer),D.transform(D.any(),(e,t)=>{if(b.isSource(e))return b.fromSource(e);throw new E(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[D.transform(D.string(),(t,n)=>{try{return e===`base64`?b.fromBase64(t):b.fromHex(t)}catch(e){throw new E(e.message,n)}},!0)]:[]])},D.extend(`lazy`,(e,t,n,r)=>(t.inner[w]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},M(t.inner,n.path,!0)),D.resolve(e,t.inner,n,r))),D.extend(`any`,e=>[e]),D.extend(`never`,(e,t,n)=>{throw new E(`expected nullable but got ${e}`,n)}),D.extend(`const`,(e,{value:t},n)=>{if(S(e,t))return[t];throw new E(`expected ${t} but got ${e}`,n)});function N(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new E(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new E(`expected ${n} >= ${o} but got ${e}`,r)}D.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new E(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new E(`expect string to match regexp ${r}`,n)}return N(e.length,t,`string length`,n),[e]});function P(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function F(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(P(e,i)-P(t,i))%P(n,i)===0}D.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new E(`expected number but got ${e}`,n);N(e,t,`number`,n);let{step:r}=t;if(r&&!F(e,t.min??0,r))throw new E(`expected number multiple of ${r} but got ${e}`,n);return[e]}),D.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new E(`expected boolean but got ${e}`,n)}),D.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new E(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new E(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),D.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new E(`expected function but got ${e}`,n)}),D.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new E(`expected ${t.name} but got ${e}`,n)}{if(c(e))throw new E(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new E(`expected ${t} but got ${e}`,n)}});function I(e,t,n,r){try{let[i,a]=D.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?h(n.meta.default):n.meta.default}}D.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new E(`expected array but got ${e}`,r);return N(e.length,n,`array length`,r,!c(t.meta.default)),[e.map((n,i)=>I(e,i,t,r))]}),D.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!l(e))throw new E(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=D.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=I(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),D.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new E(`expected array but got ${e}`,n);let i=t.map((t,r)=>I(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function L(e,t){for(let n in t)n in e||(e[n]=t[n])}D.extend(`object`,(e,{dict:t},n,r)=>{if(!l(e))throw new E(`expected object but got ${e}`,n);let i={};for(let r in t){let a=I(e,r,t[r],n);(!c(a)||r in e)&&(i[r]=a)}return r||L(i,e),[i]}),D.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return D.resolve(e,n,r,i)}catch(e){a.push(e)}throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),D.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=D.resolve(e,i,r,!0)[0];if(!c(t)){if(c(a))a=t;else if(typeof a!=typeof t)throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)L(a??={},t);else if(a!==t)throw new E(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&l(e)&&L(a,e),[a]}),D.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=D.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let R={};function z(e,t,n){R[e]=n,Object.assign(D,{[e](...n){let r=new D({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??D.string();break;case`inner`:r.inner=D.from(n[t]);break;case`list`:r.list=n[t].map(D.from);break;case`dict`:r.dict=d(n[t],D.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}z(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),z(`any`,[],()=>`any`),z(`never`,[],()=>`never`),z(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),z(`string`,[],()=>`string`),z(`number`,[],()=>`number`),z(`boolean`,[],()=>`boolean`),z(`bitset`,[`bits`],()=>`bitset`),z(`function`,[],()=>`function`),z(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),z(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),z(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),z(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),z(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),z(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),z(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let B=`preference`,V=/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u,te=[`zh`,`en`],ne={[B]:D.string().pattern(V).required(!1)};D.object(ne);let H={ok:`确定`,cancel:`取消`,close:`关闭`,copy:`复制`,copied:`复制成功`,"codeBlock.title":`代码块`,"codeBlock.wrap":`自动换行`,"codeBlock.unwrap":`取消自动换行`,"copy.failed":`复制失败`,"copy.value":`复制值`,"copy.json":`复制 JSON`,"copy.path":`复制属性路径`,"copy.prettyJson":`复制格式化 JSON`,"copy.compactJson":`复制紧凑 JSON`,"copy.optionsHint":`{action};右键点击可选择复制方式`,retry:`重试`,loading:`加载中…`,"load.failed":`加载失败`,submit:`提交`,submitting:`正在提交…`,next:`下一步`,previous:`上一步`,skip:`跳过`,delete:`删除`,edit:`编辑`,save:`保存`,search:`搜索`,more:`更多`,collapse:`收起`,expand:`展开`,back:`返回`,"brand.localBuild":`DSH 本地构建`,"workspace.defaultName":`默认工作区`,unknown:`未知`,none:`无`,truncated:`已截断`,"json.label":`JSON`,"markdown.footnotes":`脚注`,"markdown.mermaid.diagram":`Mermaid 图表`,"markdown.mermaid.source":`查看源码`,"markdown.mermaid.failed":`图表暂时无法显示,已保留源码。`,"markdown.truncatedCharacters":`… 已截断,共 {total} 字符`,"number.thousand":`{value}K`,"number.million":`{value}M`},U={ok:`OK`,cancel:`Cancel`,close:`Close`,copy:`Copy`,copied:`Copied`,"codeBlock.title":`Code block`,"codeBlock.wrap":`Wrap lines`,"codeBlock.unwrap":`Do not wrap lines`,"copy.failed":`Copy failed`,"copy.value":`Copy value`,"copy.json":`Copy JSON`,"copy.path":`Copy property path`,"copy.prettyJson":`Copy pretty JSON`,"copy.compactJson":`Copy compact JSON`,"copy.optionsHint":`{action}; right-click for copy options`,retry:`Retry`,loading:`Loading…`,"load.failed":`Failed to load`,submit:`Submit`,submitting:`Submitting…`,next:`Next`,previous:`Previous`,skip:`Skip`,delete:`Delete`,edit:`Edit`,save:`Save`,search:`Search`,more:`More`,collapse:`Collapse`,expand:`Expand`,back:`Back`,"brand.localBuild":`DSH Local Build`,"workspace.defaultName":`Default workspace`,unknown:`Unknown`,none:`None`,truncated:`Truncated`,"json.label":`JSON`,"markdown.footnotes":`Footnotes`,"markdown.mermaid.diagram":`Mermaid diagram`,"markdown.mermaid.source":`View source`,"markdown.mermaid.failed":`Unable to display diagram. Source is shown below.`,"markdown.truncatedCharacters":`… truncated at {total} characters`,"number.thousand":`{value}K`,"number.million":`{value}M`},W={"language.title":`Language / 语言`},G={"language.title":`Language / 语言`};function K({t:e,setLocale:t,useStore:n}){let o=(0,r.useId)(),s=n(e=>e.active),c=n(e=>e.options);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:i.preferenceRowStyles.row,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.rowText,children:/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.title,id:o,children:e(`language.title`)})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:i.preferenceRowStyles.choices,role:`group`,"aria-labelledby":o,children:c.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:i.preferenceRowStyles.choice,lang:e.id,"aria-pressed":e.id===s,onClick:()=>{e.id!==s&&t(e.id)},children:e.label},e.id))})]})}function q(){return(0,o.defineStore)({init:()=>({active:``,options:[],revision:-1}),actions:{sync:(e,t,n,r)=>{r<=e.revision||(e.active=t,e.options=n,e.revision=r)}}})}let J=`common`,Y=`settings.locale`,X={zh:{label:`中文`,fallback:`en`},en:{label:`English`}},re=Object.freeze(te.map(e=>Object.freeze({id:e,...X[e]})));function Z(e){return e.toLowerCase()}function ie(e){if(!V.test(e.id))throw Error(`locale id "${e.id}" is not a BCP 47-style tag`);if(e.label.trim()===``)throw Error(`locale label must not be empty`);if(!V.test(e.fallback))throw Error(`locale fallback "${e.fallback}" is not a BCP 47-style tag`);return Object.freeze({id:e.id,label:e.label,fallback:e.fallback})}function ae(e){if(typeof document>`u`)return;let t=e.active===`zh`?`zh-CN`:e.active;document.documentElement.lang!==t&&(document.documentElement.lang=t)}var Q=class{bootstrap;dicts=/* @__PURE__ */ new Map;bound=/* @__PURE__ */ new Map;catalog=/* @__PURE__ */ new Map;fallbackChains=/* @__PURE__ */ new Map;snapshot;listeners=/* @__PURE__ */ new Set;ctx;host;provisional;preference;constructor(e,t,n){this.bootstrap=n,this.ctx=e,this.host=t;for(let e of re)this.catalog.set(Z(e.id),e);let r=this.localeList();this.provisional=$(r,n?.languages),this.preference=n?.preference??void 0,this.snapshot=Object.freeze({active:this.resolveActive(),locales:r,revision:0}),t!==void 0&&(e.effect(()=>t.subscribe(()=>{this.adopt(t)}),`locale: settings scope adoption`),this.adopt(t))}getLocale(){return this.snapshot}resolveText(e){return typeof e==`string`?e:this.fallbackChain(this.snapshot.active).reduceRight((t,n)=>e[Z(n)]??t,e.en)}getSnapshot(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setLocale(e){let t=this.catalog.get(Z(e));if(t===void 0)throw Error(`locale "${e}" is not registered`);this.preference=t.id,this.snapshot.active!==t.id&&this.publish(t.id,!0),this.host?.set(B,t.id)}addLanguage(e){let t=ie(e),n=Z(t.id);if(this.catalog.has(n))throw Error(`locale "${t.id}" is already registered`);let r=this.catalog.get(Z(t.fallback));if(r===void 0)throw Error(`locale fallback "${t.fallback}" is not registered`);let i=Object.freeze({...t,fallback:r.id});this.catalog.set(n,i);try{this.assertFallbackChain(i.id)}catch(e){throw this.catalog.delete(n),e}return this.publishCatalog(),()=>{this.catalog.get(n)===i&&(this.catalog.delete(n),this.publishCatalog())}}adopt(e){let t=e.getSnapshot().value;if(t===void 0)return;this.preference=t.preference;let n=this.resolveActive();this.snapshot.active!==n&&this.publish(n,!0)}publishCatalog(){this.fallbackChains.clear();let e=this.localeList();this.provisional=$(e,this.bootstrap?.languages);let t=this.resolveActive();this.publish(t,t!==this.snapshot.active,e)}resolveActive(){return this.preference===void 0?this.provisional:this.catalog.get(Z(this.preference))?.id??this.provisional}localeList(){return Object.freeze([...this.catalog.values()])}assertFallbackChain(e){let t=/* @__PURE__ */ new Set,n=this.catalog.get(Z(e));for(;n!==void 0;){let e=Z(n.id);if(t.has(e))throw Error(`locale fallback cycle includes "${n.id}"`);if(t.add(e),e===Z(`en`))return;
2
2
  /* v8 ignore next -- English is the only built-in terminal and every
3
3
  * language accepted by addLanguage has a required fallback. */
4
4
  if(n.fallback===void 0)throw Error(`locale "${n.id}" fallback chain does not reach "en"`);let r=this.catalog.get(Z(n.fallback));if(r===void 0)throw Error(`locale fallback "${n.fallback}" is not registered`);n=r}}fallbackChain(e){let t=Z(e),n=this.fallbackChains.get(t);if(n!==void 0)return n;let r=[],i=/* @__PURE__ */ new Set,a=this.catalog.get(t);for(;a!==void 0&&!i.has(Z(a.id));){let e=Z(a.id);i.add(e),r.push(a.id),a=a.fallback===void 0?void 0:this.catalog.get(Z(a.fallback))}i.has(Z(`en`))||r.push(`en`);let o=Object.freeze(r);return this.fallbackChains.set(t,o),o}register(e,t,n){let r=typeof t==`string`?[[t,n]]:Object.entries(t);for(let[e]of r)if(!V.test(e))throw Error(`locale id "${e}" is not a BCP 47-style tag`);let i=this.dicts.get(e);i||(i=/* @__PURE__ */ new Map,this.dicts.set(e,i));for(let[t]of r)if(i.has(Z(t)))throw Error(`locale namespace "${e}" already has locale "${t}"`);for(let[e,t]of r)i.set(Z(e),t);return this.publish(this.snapshot.active,!1),()=>{let t=this.dicts.get(e);