@codexhost/cli-win32-arm64 0.26.0 → 0.27.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 (62) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +1 -1
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +8348 -2803
  5. package/app/console-web.js +8145 -2710
  6. package/app/desktop-controller.mjs +7641 -2296
  7. package/app/host-runtime.mjs +18017 -8327
  8. package/app/plugins/antigravity/plugin.mjs +16709 -3208
  9. package/app/plugins/claude-code/plugin.mjs +8165 -2608
  10. package/app/plugins/codebuddy/plugin.mjs +8118 -2760
  11. package/app/plugins/codex-usage/plugin.mjs +7638 -2302
  12. package/app/plugins/copilot/plugin.mjs +7790 -2432
  13. package/app/plugins/cursor-cli/plugin.mjs +7983 -2647
  14. package/app/plugins/deepseek-harness/plugin.mjs +8211 -2829
  15. package/app/plugins/devin/plugin.mjs +7803 -2467
  16. package/app/plugins/grok/plugin.mjs +8068 -2732
  17. package/app/plugins/hermes/plugin.mjs +7969 -2489
  18. package/app/plugins/kimi-code/plugin.mjs +7985 -2560
  19. package/app/plugins/kiro-cli/plugin.mjs +7905 -2569
  20. package/app/plugins/omp/plugin.mjs +7939 -2603
  21. package/app/plugins/opencode/manifest.json +1 -1
  22. package/app/plugins/opencode/plugin.mjs +8409 -3015
  23. package/app/plugins/pi/plugin.mjs +7956 -2620
  24. package/app/plugins/qoder/plugin.mjs +8204 -2829
  25. package/app/plugins/qoder-cn/plugin.mjs +8204 -2829
  26. package/app/plugins/qwen-code/plugin.mjs +7923 -2587
  27. package/app/plugins/workbuddy/plugin.mjs +8123 -2782
  28. package/app/plugins/zcode/plugin.mjs +7767 -2431
  29. package/app/renderer-extension.js +10104 -3313
  30. package/app/web/assets/index-D9l7_ThH.js +199 -0
  31. package/app/web/assets/index-nw2RXcDu.css +1 -0
  32. package/app/web/codexhost-settings.js +99 -90
  33. package/app/web/index.html +2 -2
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +98 -106
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +102 -111
  36. package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +2 -2
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +4 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +107 -116
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +106 -115
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +128 -137
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-shortcuts/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +94 -103
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +112 -121
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +4 -4
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +103 -112
  51. package/app/web/plugins/deepseek-ai__dsh-typert-registry/client.js +8 -8
  52. package/app/web/plugins.json +2 -1
  53. package/app/web-modules/node_modules/@deepseek-ai/dsh-client-modules/index.js +2 -2
  54. package/app/web-modules/server.mjs +11917 -5645
  55. package/bin/codexhost.exe +0 -0
  56. package/libexec/codexhost-node-repl.exe +0 -0
  57. package/libexec/codexhost-shell.exe +0 -0
  58. package/libexec/codexhost-shim.exe +0 -0
  59. package/libexec/codexhost-updater.exe +0 -0
  60. package/package.json +1 -1
  61. package/app/web/assets/index-BDWdtbFT.js +0 -203
  62. package/app/web/assets/index-jLAmV7OU.css +0 -1
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-shortcuts`,factory:e=>{var t={exports:{}};t.exports;let n=e("@deepseek-ai/cordis"),r=e("@deepseek-ai/dsh-client-store"),i=e("@deepseek-ai/dsh-client-ui-primitives"),a={Slash:`/`,Comma:`,`,Period:`.`,Backslash:`\\`,Backquote:"`",Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Semicolon:`;`,Quote:`'`,Enter:`Enter`,Escape:`Esc`,Space:`Space`,Tab:`Tab`,Backspace:`Backspace`,Delete:`Delete`,ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`},o=[`control`,`alt`,`shift`,`meta`];function s(e,t){let n=[e.code,...e.secondCode===void 0?[]:[e.secondCode]];n.sort();for(let e of n)if(!/^(Key[A-Z]|Digit[0-9]|F([1-9]|1[0-9]|2[0-4]))$/u.test(e)&&!Object.hasOwn(a,e))throw Error(`Unsupported shortcut code: ${e}`);if(n.length===2&&n[0]===n[1])throw Error(`Shortcut keys must be distinct`);let r=new Set(e.modifiers.map(e=>e===`primary`?t===`macos`?`meta`:`control`:e));return{code:n[0],...n[1]===void 0?{}:{secondCode:n[1]},modifiers:o.filter(e=>r.has(e))}}function c(e){let t=e.secondCode===void 0?[e.code]:[e.code,e.secondCode].sort();return[...e.modifiers,...t].join(`+`)}function l(e,t){if(e===null)return{keys:[],aria:void 0};let n=a[e.code]??e.code.replace(/^(Key|Digit)/u,``),r=t===`macos`?{control:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`}:{control:`Ctrl`,alt:`Alt`,shift:`Shift`,meta:`Meta`},i={control:`Control`,alt:`Alt`,shift:`Shift`,meta:`Meta`},o=e.code===`Space`?`Space`:e.code===`Escape`?`Escape`:e.code.startsWith(`Arrow`)?e.code:n,s=e.secondCode===void 0?[]:[a[e.secondCode]??e.secondCode.replace(/^(Key|Digit)/u,``)],c=[...e.modifiers.map(e=>r[e]),n];return{keys:[...t===`windows`?c.flatMap((e,t)=>t===0?[e]:[`+`,e]):c,...s],aria:e.secondCode===void 0?[...e.modifiers.map(e=>i[e]),o].join(`+`):void 0}}function u(e,t){if(e.secondCode!==void 0)return!1;if(t===`windows`||t===`macos`){if(e.modifiers.length>=3)return!0;let n=t===`macos`?`meta`:`control`;if(e.modifiers.length===1&&([`Comma`,`Backslash`].includes(e.code)&&e.modifiers[0]===n||e.code===`Backquote`&&e.modifiers[0]===`control`)||e.modifiers.length===2&&e.modifiers.includes(n)&&(e.modifiers.includes(`alt`)||e.modifiers.includes(`shift`)))return!0}return[{code:`Slash`,modifiers:[`primary`]},{code:`Comma`,modifiers:[`primary`,`shift`]},{code:`Period`,modifiers:[`primary`,`shift`]}].some(n=>c(e)===c(s(n,t)))}let d={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-shortcuts`,factory:e=>{var t={exports:{}};t.exports;let n=e("@deepseek-ai/cordis"),r=e("@deepseek-ai/dsh-client-store"),i=e("@deepseek-ai/dsh-client-ui-primitives"),a={Slash:`/`,Comma:`,`,Period:`.`,Backslash:`\\`,Backquote:"`",Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Semicolon:`;`,Quote:`'`,Enter:`Enter`,Escape:`Esc`,Space:`Space`,Tab:`Tab`,Backspace:`Backspace`,Delete:`Delete`,ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,NumpadAdd:`Num+`,NumpadSubtract:`Num-`,Numpad0:`Num0`},o=[`control`,`alt`,`shift`,`meta`];function s(e,t){let n=[e.code,...e.secondCode===void 0?[]:[e.secondCode]];n.sort();for(let e of n)if(!/^(Key[A-Z]|Digit[0-9]|F([1-9]|1[0-9]|2[0-4]))$/u.test(e)&&!Object.hasOwn(a,e))throw Error(`Unsupported shortcut code: ${e}`);if(n.length===2&&n[0]===n[1])throw Error(`Shortcut keys must be distinct`);let r=new Set(e.modifiers.map(e=>e===`primary`?t===`macos`?`meta`:`control`:e));return{code:n[0],...n[1]===void 0?{}:{secondCode:n[1]},modifiers:o.filter(e=>r.has(e))}}function c(e){let t=e.secondCode===void 0?[e.code]:[e.code,e.secondCode].sort();return[...e.modifiers,...t].join(`+`)}function l(e,t){if(e===null)return{keys:[],aria:void 0};let n=a[e.code]??e.code.replace(/^(Key|Digit)/u,``),r=t===`macos`?{control:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`}:{control:`Ctrl`,alt:`Alt`,shift:`Shift`,meta:`Meta`},i={control:`Control`,alt:`Alt`,shift:`Shift`,meta:`Meta`},o=e.code===`Space`?`Space`:e.code===`Escape`?`Escape`:e.code.startsWith(`Arrow`)?e.code:n,s=e.secondCode===void 0?[]:[a[e.secondCode]??e.secondCode.replace(/^(Key|Digit)/u,``)],c=[...e.modifiers.map(e=>r[e]),n];return{keys:[...t===`windows`?c.flatMap((e,t)=>t===0?[e]:[`+`,e]):c,...s],aria:e.secondCode===void 0?[...e.modifiers.map(e=>i[e]),o].join(`+`):void 0}}function u(e,t){if(e.secondCode!==void 0)return!1;if(t===`windows`||t===`macos`){if(e.modifiers.length>=3)return!0;let n=t===`macos`?`meta`:`control`;if(e.modifiers.length===1&&([`Comma`,`Backslash`].includes(e.code)&&e.modifiers[0]===n||e.code===`Backquote`&&e.modifiers[0]===`control`)||e.modifiers.length===2&&e.modifiers.includes(n)&&(e.modifiers.includes(`alt`)||e.modifiers.includes(`shift`)))return!0}return[{code:`Slash`,modifiers:[`primary`]},{code:`Comma`,modifiers:[`primary`,`shift`]},{code:`Period`,modifiers:[`primary`,`shift`]}].some(n=>c(e)===c(s(n,t)))}let d={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
2
2
  `,r:`\r`,t:` `},f=/[\\\u0000-\u001f]/u;function p(e){return e===` `||e===`
3
3
  `||e===`\r`||e===` `}function m(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}(class e{static EMPTY=e.fromObject({});static fromText(t){let n=new e;return n.append(t),n.sealed=!0,n}static fromObject(t){let n=new e;return n.object=typeof t==`object`&&t&&!Array.isArray(t)?t:{},n.sealed=!0,n}chunks=[];object;sealed=!1;#e=[];#t=0;#n=0;#r=`root`;#i=!1;#a=0;#o=!1;#s=``;#c=null;#l=[];#u=!1;#d;#f=!1;#p=/* @__PURE__ */ new Map;#m=[];#h=/* @__PURE__ */ new Map;get isSealed(){return this.sealed}get invalid(){return this.scan(),this.#r===`invalid`||this.#f}append(e){if(this.sealed)throw Error(`PartialArguments: cannot append to a sealed view`);e.length!==0&&(this.chunks.push(e),this.#t+=e.length,this.#e.push(this.#t))}settle(t){if(this.object!==void 0||t.length!==this.#t)return e.fromText(t);let n=0;for(let r of this.chunks){if(!t.startsWith(r,n))return e.fromText(t);n+=r.length}return this.chunks=t.length===0?[]:[t],this.#e=t.length===0?[]:[t.length],this.sealed=!0,this}refresh(){if(this.#h.size===0)return!1;this.scan();let e=!1,t=!1;for(let n of this.#h.values())n.completion?t=!0:e=this.refreshRead(n)||e;if(t)for(let t of this.#h.values())t.completion&&(e=this.refreshRead(t)||e);return this.sealed&&this.#h.clear(),e}refreshRead(e){let t=e.answer();return!Object.is(t,e.last)&&(e.last=t,!0)}closed(){return this.remember(`closed`,``,()=>this.closedNow())}keys(){return this.remember(`keys`,``,()=>this.keysNow(),e=>e.length)}has(e){return this.remember(`has`,e,()=>this.hasNow(e))}complete(e){return this.remember(`complete`,e,()=>this.completeNow(e))}stringLength(e,t){let n=Math.max(1,Math.floor(t?.step??1)),r=t?.offset??0;return this.remember(`length:${n}:${r}`,e,()=>this.lengthNow(e),e=>e===void 0?void 0:Math.ceil((e+r)/n))}stringExceeds(e,t){let n=Math.max(0,Math.floor(t));return this.remember(`exceeds:${n}`,e,()=>(this.lengthNow(e,n+1)??0)>n)}text(e){return this.remember(`text`,e,()=>this.textNow(e))}textPrefix(e,t){let n=Math.max(1,Math.floor(t));return this.remember(`prefix:${n}`,e,()=>this.textPrefixNow(e,n))}value(e){return this.remember(`value`,e,()=>this.valueNow(e))}remember(e,t,n,r){this.scan();let i=n();if(!this.sealed){let a=`${e}/${t}`;this.#h.has(a)||this.#h.set(a,{completion:e===`complete`,answer:r===void 0?n:()=>r(n()),last:r===void 0?i:r(i)})}return i}closedNow(){return this.sealed||this.#r===`closed`||this.#r===`invalid`}keysNow(){return this.object===void 0?this.#m:Object.keys(this.object)}hasNow(e){return this.object===void 0?this.#p.has(e):Object.hasOwn(this.object,e)}completeNow(e){if(this.object!==void 0)return Object.hasOwn(this.object,e);let t=this.#p.get(e);return t!==void 0&&t.end>=0&&(t.kind===`string`?t.invalidAt===void 0:!t.invalid)}lengthNow(e,t=1/0){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t.length:void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;if(n.text!==void 0&&n.text.at===n.end)return n.text.length;let r=n.length??={at:n.start,length:0,text:``};return this.readString(n,r,t,!1),r.length}textNow(e){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t:void 0}let t=this.#p.get(e);if(t?.kind!==`string`)return;if(t.text===void 0&&t.end>=0&&t.needsDecoding&&t.invalidAt===void 0){let e;try{e=JSON.parse(`"${this.slice(t.start,t.end)}"`)}catch{}e!==void 0&&(t.text={at:t.end,length:e.length,text:e})}let n=t.text??={at:t.start,length:0,text:``};return this.readString(t,n,1/0,!0),n.text}textPrefixNow(e,t){if(this.object!==void 0){let n=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof n==`string`?n.slice(0,t):void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;let r=n.prefixes??=/* @__PURE__ */ new Map,i=r.get(t);return i===void 0&&(i={at:n.start,length:0,text:``},r.set(t,i)),this.readString(n,i,t,!0),i.text}valueNow(e){if(this.object!==void 0){if(!Object.hasOwn(this.object,e))return;let t=this.object[e];return typeof t==`string`?void 0:t}let t=this.#p.get(e);if(!(t?.kind!==`value`||t.end<0||t.invalid)){if(t.parsed===void 0)try{t.parsed=JSON.parse(this.slice(t.start,t.end))}catch{t.invalid=!0,this.#f=!0}return t.parsed}}chunkAt(e){let t=0,n=this.#e.length;for(;t<n;){let r=t+n>>>1;this.#e[r]<=e?t=r+1:n=r}return t}slice(e,t){if(e>=t)return``;let n=this.chunkAt(e),r=this.chunkAt(t-1),i=n===0?0:this.#e[n-1];if(n===r)return this.chunks[n].slice(e-i,t-i);let a=[this.chunks[n].slice(e-i)];for(let e=n+1;e<r;e++)a.push(this.chunks[e]);return a.push(this.chunks[r].slice(0,t-this.#e[r-1])),a.join(``)}readString(e,t,n,r){let i=Math.min(e.end<0?this.#n:e.end,e.invalidAt??1/0,this.#d??1/0);if(!e.needsDecoding){let e=Math.min(i-t.at,n-t.length);if(e<=0)return;r&&(t.text+=this.slice(t.at,t.at+e)),t.at+=e,t.length+=e;return}let a=this.chunkAt(t.at);for(;t.at<i&&t.length<n;){let o=a===0?0:this.#e[a-1],s=this.chunks[a],c=s.slice(t.at-o,Math.min(s.length,i-o)),l=c.search(f),u=Math.min(l<0?c.length:l,n-t.length);if(u>0){r&&(t.text+=c.slice(0,u)),t.at+=u,t.length+=u,t.at===o+s.length&&a++;continue}let p=c.length>1?c[1]:t.at+1<i?this.chunks[a+1][0]:void 0,h,g=2;if(c[0]===`\\`&&p===void 0&&e.end<0)return;if(c[0]===`\\`&&p===`u`){let n=this.slice(t.at+2,Math.min(i,t.at+6)),r=!0;for(let e=0;e<n.length;e++)m(n[e])||(r=!1);if(r){if(n.length<4&&e.end<0)return;n.length===4&&(h=String.fromCharCode(Number.parseInt(n,16)))}g=6}else c[0]===`\\`&&p!==void 0&&(h=d[p]);if(h===void 0){e.invalidAt=t.at,this.#f=!0;return}for(r&&(t.text+=h),t.length++,t.at+=g;a<this.chunks.length&&t.at>=this.#e[a];)a++}}scan(){if(this.object===void 0&&this.#n!==this.#t)for(let e=this.chunkAt(this.#n);e<this.chunks.length&&this.#d===void 0;e++){let t=this.chunks[e],n=e===0?0:this.#e[e-1];for(let e=this.#n-n;e<t.length&&this.#r!==`invalid`;e++){if(this.#r===`string`||this.#r===`nested`&&this.#u){let n=this.stringBoundary(t,e);if(this.#n+=n-e,e=n,e===t.length)break}this.step(t[e],this.#n),this.#n++}}}stringBoundary(e,t){let n=t;for(;;){let t=e.indexOf(`"`,n),r=t<0?e.length:t;if(this.#r===`string`){let t=this.#c;!t.needsDecoding&&f.test(e.slice(n,r))&&(t.needsDecoding=!0)}let i=r;for(;i>n&&e[i-1]===`\\`;)i--;let a=(r-i)%2==1!==(i===n&&this.#i);if(this.#i=t<0&&a,t<0||!a)return r;n=t+1}}step(e,t){switch(this.#r){case`root`:if(p(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(p(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(p(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(p(e))return;if(e===`:`){this.#r=`value`;return}this.fail();return;case`value`:this.beginValue(e,t);return;case`string`:{let e=this.#c;e.end=t,this.#c=null,this.#r=`comma-or-end`;return}case`scalar`:this.stepScalar(e,t);return;case`nested`:this.stepNested(e,t);return;case`comma-or-end`:if(p(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(p(e))return;this.fail();return;
4
4
  /* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
@@ -6,4 +6,4 @@ case`invalid`:return;
6
6
  /* v8 ignore next 2 -- Every scanner mode has a handler above. */
7
7
  default:h(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){p(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||p(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function h(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}let g=e=>typeof e==`object`&&!!e&&!Array.isArray(e),_=/^[a-z][a-zA-Z0-9-]*(?:\.[a-zA-Z][a-zA-Z0-9-]*)+$/u;function v(e){if(e===null)return null;if(!g(e)||Object.keys(e).some(e=>e!==`code`&&e!==`secondCode`&&e!==`modifiers`)||typeof e.code!=`string`||!Array.isArray(e.modifiers)||Object.hasOwn(e,`secondCode`)&&typeof e.secondCode!=`string`||!e.modifiers.every(e=>typeof e==`string`&&[`primary`,`control`,`alt`,`shift`,`meta`].includes(e)))throw Error(`Invalid shortcut binding`);let t={code:e.code,modifiers:e.modifiers,...typeof e.secondCode==`string`?{secondCode:e.secondCode}:{}};return s(t,`windows`),t}function y(e){if(e===null)return{schemaVersion:1,profiles:{}};try{let t=JSON.parse(e);if(!g(t))return`invalid`;if(typeof t.schemaVersion==`number`&&t.schemaVersion>2)return`future`;if(t.schemaVersion!==1&&t.schemaVersion!==2||!g(t.profiles)||Object.keys(t).some(e=>e!==`schemaVersion`&&e!==`profiles`))return`invalid`;let n={};for(let[e,r]of Object.entries(t.profiles)){if(!/^(desktop|web):(macos|windows|linux)$/u.test(e)||!g(r))return`invalid`;let i={};for(let[e,n]of Object.entries(r)){if(!_.test(e))return`invalid`;let r=v(n);if(t.schemaVersion===1&&r?.secondCode!==void 0)return`invalid`;i[e]=r}n[e]=i}return{schemaVersion:t.schemaVersion,profiles:n}}catch{return`invalid`}}function b(e,t,n){let{code:r,modifiers:i}=e;if(t===`desktop`&&(n===`windows`||n===`macos`))return null;if(e.secondCode!==void 0)return`unsupported-key`;if(i.length===0||i.every(e=>e===`shift`))return`modifier-required`;if((n===`windows`||n===`macos`)&&i.length>=3||t===`web`&&(n===`windows`||n===`macos`)&&u(e,n))return null;let a=i.includes(n===`macos`?`meta`:`control`);return[`Escape`,`Tab`,`Space`,`Backspace`,`Delete`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(r)||r===`Enter`&&!i.includes(`alt`)||a&&[`KeyC`,`KeyV`,`KeyX`,`KeyZ`,`KeyY`,`KeyQ`,`KeyH`].includes(r)||a&&r===`KeyA`&&!i.includes(`shift`)||n!==`macos`&&(i.includes(`meta`)||i.includes(`alt`)&&[`F4`,`F2`].includes(r))||n===`macos`&&i.includes(`control`)&&i.includes(`meta`)||n===`macos`&&i.includes(`alt`)&&!a?`reserved`:t===`web`&&!u(e,n)?`unsupported-browser`:null}function x(e,t,n){return e.defaults[`${t}:${n}`]}function S(e,t,n,r){let i=t.profiles[`${n}:${r}`]??{},a=e.flatMap(e=>e.fixed?.map(t=>({id:e.id,binding:s(t,r)}))??[]),o=e.filter(e=>e.fixed===void 0).map(({id:e,defaults:t})=>{let a=Object.hasOwn(i,e),o=a?i[e]:x({id:e,defaults:t},n,r),c=o==null?null:s(o,r);return{id:e,binding:c,modified:a,issue:c===null?null:b(c,n,r)}});return o.map(e=>{let t=e.binding;return{...e,conflicts:t===null?[]:[.../* @__PURE__ */ new Set([...o.filter(n=>n.id!==e.id&&n.binding!==null&&n.issue===null&&C(n.binding,t)&&(!e.modified||n.modified)).map(e=>e.id),...a.filter(e=>C(e.binding,t)).map(e=>e.id)])]}})}function C(e,t){return e.modifiers.join(`+`)===t.modifiers.join(`+`)?e.secondCode!==void 0&&t.secondCode!==void 0?c(e)===c(t):[e.code,e.secondCode].some(e=>e!==void 0&&(e===t.code||e===t.secondCode)):!1}function ee(e,t,n,r){let i=n===`desktop`&&(r===`macos`||r===`windows`)?2:e.schemaVersion,a=`${n}:${r}`,o={...e.profiles[a]};switch(t.type){case`set`:o[t.id]=t.binding;break;case`reset`:{let{[t.id]:e,...n}=o;o=n;break}case`reset-all`:o={};break;
8
8
  /* v8 ignore next -- parseShortcutEdit validates this closed union before persistence. */
9
- default:return h(t,`shortcut edit`)}return{schemaVersion:i,profiles:{...e.profiles,[a]:o}}}function w(){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)}`}function T(){return{revision:w(),sequence:0,document:{schemaVersion:1,profiles:{}},status:`loading`,error:null,usingDefaults:!0}}var te=class{storage;runtime;platform;rereadBeforeWrite;publish;snapshot=T();raw;queue=Promise.resolve();definitions=null;active=!0;constructor(e,t,n,r,i){this.storage=e,this.runtime=t,this.platform=n,this.rereadBeforeWrite=r,this.publish=i}setDefinitions(e){this.definitions=e,this.accept({...this.snapshot})}dispose(){this.active=!1}readCurrent(){return this.serialize(()=>this.read())}edit(e,t){return this.serialize(async()=>{this.rereadBeforeWrite&&await this.read();let n=e=>({status:e,snapshot:this.snapshot});if(!this.active||this.definitions===null||this.snapshot.status===`loading`)return n(`not-ready`);if(t!==this.snapshot.revision)return n(`stale`);if(this.snapshot.status===`unreadable`)return n(`unreadable`);if((e.type===`set`||e.type===`reset`)&&!this.definitions.some(t=>t.id===e.id&&t.fixed===void 0))return n(`not-ready`);let r=ee(this.snapshot.document,e,this.runtime,this.platform),i=S(this.definitions,r,this.runtime,this.platform),a=i.find(t=>(e.type===`reset-all`||t.id===e.id)&&(t.issue!==null||t.conflicts.length>0)),o=e.type===`set`?i.find(t=>t.conflicts.includes(e.id)):void 0;if(a!==void 0||o!==void 0)return{...n(`conflict`),...a?.issue?{issue:a.issue}:{},conflicts:a?.conflicts.length?a.conflicts:o===void 0?[]:[o.id]};try{let e=`${JSON.stringify(r,null,2)}\n`;return await this.storage.write(e),this.raw=e,this.accept({...this.snapshot,document:r,status:`ready`,error:null,usingDefaults:!1}),n(`saved`)}catch{return n(`write-failed`)}})}serialize(e){let t=this.queue.then(e);return this.queue=t.catch(()=>void 0),t}accept(e){if(this.snapshot={...e,sequence:this.snapshot.sequence+1,revision:w()},this.active)try{this.publish(this.snapshot)}catch(e){console.error(`Shortcut configuration subscriber failed:`,e)}}async read(){let e;try{e=await this.storage.read()}catch{return this.snapshot.error!==`read`&&this.accept({...this.snapshot,status:`unreadable`,error:`read`}),this.snapshot}if(e===this.raw&&this.snapshot.error!==`read`)return this.snapshot;this.raw=e;let t=y(e);return typeof t==`string`?this.accept({...this.snapshot,status:`unreadable`,error:t}):this.accept({...this.snapshot,document:t,status:`ready`,error:null,usingDefaults:e===null}),this.snapshot}},ne=class{runtime;platform;commands=/* @__PURE__ */ new Map;fixedCommands=/* @__PURE__ */ new Map;conflicts=/* @__PURE__ */ new Map;bindings=/* @__PURE__ */ new Map;state;catalog;config;fixedCatalog=(0,r.createSnapshotStore)([]);constructor(e,t,n={...T(),status:`ready`}){this.runtime=e,this.platform=t,this.state=(0,r.createSnapshotStore)({catalog:[],config:n}),this.catalog={getSnapshot:()=>this.state.getSnapshot().catalog,subscribe:e=>this.state.subscribe(e)},this.config={getSnapshot:()=>this.state.getSnapshot().config,subscribe:e=>this.state.subscribe(e)}}definitions(){return[...[...this.commands.values()].map(({id:e,defaults:t})=>({id:e,defaults:t})),...[...this.fixedCommands.values()].map(({id:e,bindings:t})=>({id:e,defaults:{},fixed:t}))]}registerFixed(e){if(this.fixedCommands.has(e.id)||this.commands.has(e.id))throw Error(`Duplicate shortcut command: ${e.id}`);for(let t of e.bindings)s(t,this.platform);return this.fixedCommands.set(e.id,e),this.refreshLabels(),()=>{this.fixedCommands.get(e.id)===e&&(this.fixedCommands.delete(e.id),this.refreshLabels())}}refreshFixedLabels(){this.fixedCatalog.set([...this.fixedCommands.values()].map(e=>({id:e.id,label:e.label(),keys:e.keys,group:e.group,bindings:e.bindings.map(e=>s(e,this.platform))})))}configure(e){let t=this.config.getSnapshot();(e.revision!==t.revision||e.status!==t.status||e.error!==t.error)&&this.refreshLabels(e)}register(e){if(this.commands.has(e.id)||this.fixedCommands.has(e.id))throw Error(`Duplicate shortcut command: ${e.id}`);for(let t of[`desktop`,`web`])for(let n of[`macos`,`windows`,`linux`]){let r=x(e,t,n);if(r===void 0)continue;let i=s(r,n);if(t===`web`&&!u(i,n))throw Error(`Unsupported Web shortcut: ${e.id}`);if(b(i,t,n)!==null)throw Error(`Reserved shortcut default: ${e.id}`);for(let r of this.commands.values()){let a=x(r,t,n);if(a!==void 0&&C(i,s(a,n)))throw Error(`Conflicting shortcut defaults: ${e.id} and ${r.id} (${t}:${n})`)}}return this.commands.set(e.id,e),this.refreshLabels(),()=>{this.commands.get(e.id)===e&&(this.commands.delete(e.id),this.refreshLabels())}}refreshLabels(e=this.config.getSnapshot()){this.bindings.clear(),this.conflicts.clear();let t=S(this.definitions(),e.document,this.runtime,this.platform).map(t=>{let n=this.commands.get(t.id),r=e.status!==`loading`&&t.issue===null&&t.conflicts.length===0;return r&&t.binding!==null&&this.bindings.set(c(t.binding),n),e.status!==`loading`&&t.issue===null&&t.conflicts.length>0&&t.binding!==null&&this.conflicts.set(c(t.binding),n),{...t,label:n.label(),aliases:n.aliases,...l(t.binding,this.platform),aria:r?l(t.binding,this.platform).aria:void 0}});this.state.set({config:e,catalog:t}),this.refreshFixedLabels()}invoke(e,t){let n=this.commands.get(e);if(n===void 0||t.modal!==null&&!n.modals.includes(t.modal))return;let r=n.resolve({...t,source:`menu`});r.status===`handled`&&r.run()}dispatch(e,t,n){if(e.defaultPrevented||e.composing)return{status:`pass`};let r=[`control`,`alt`,`shift`,`meta`].filter(t=>e[t]),i=c({code:e.code,modifiers:r,...e.secondCode===void 0?{}:{secondCode:e.secondCode}}),a=this.bindings.has(i)||this.conflicts.has(i)?i:c({code:e.code,modifiers:r}),o=this.bindings.get(a)??this.conflicts.get(a),s=this.runtime===`desktop`&&(this.platform===`windows`||this.platform===`macos`);if(o===void 0||!s&&!o.regions.includes(t.region)||!s&&t.region===`terminal`&&e.control&&!e.meta&&!e.alt&&!e.shift&&(e.code===`KeyW`||e.code===`KeyR`))return{status:`pass`};if(!this.bindings.has(a))return n(),{status:`blocked`,commandId:o.id,reason:`conflict`};if(!s&&t.modal!==null&&!o.modals.includes(t.modal))return n(),{status:`blocked`,commandId:o.id,reason:`modal`};let l=o.resolve(t);return l.status===`pass`?l:(n(),l.status===`blocked`?{...l,commandId:o.id}:(e.repeat||l.run(),{status:`handled`,commandId:o.id}))}};function re(e,t){let n=e.documentElement.dataset.platform,r=e.documentElement.hasAttribute(`data-tauri-shell`),i=n??t.platform;return{runtime:n===void 0||r?`web`:`desktop`,platform:/darwin|mac|iphone|ipad/iu.test(i)?`macos`:/win/iu.test(i)?`windows`:`linux`}}function ie(e,t,n,r=!1){let a=e.document,o=(0,i.observeComposition)(a),s=!1,c,l=()=>{n?.({type:`reset`})},u=!1,d,f=()=>{u=!1,l()},p=e=>e instanceof Element&&(e.matches(i.modalSelector)||e.querySelector(i.modalSelector)!==null),m=e=>{e.length>0&&(d=void 0),e.some(e=>e.type===`attributes`?e.oldValue===`dialog`||e.oldValue===`true`||p(e.target):[...e.addedNodes,...e.removedNodes].some(p))&&l()},h=new MutationObserver(m);h.observe(a.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`role`,`aria-modal`],attributeOldValue:!0});let g=()=>{s&&l(),e.clearTimeout(c),m(h.takeRecords()),s=!0,c=e.setTimeout(()=>{s=!1,c=void 0,l()},0)},_=l=>{e.clearTimeout(c),c=void 0,s=!1;let f=l.composedPath().find(e=>e instanceof Element),p=f instanceof Element?f:a.activeElement,g=p?.closest(`.xterm`)?`terminal`:p?.closest(`input, textarea, select, [contenteditable="true"], [contenteditable=""]`)?`editable`:`page`;m(h.takeRecords()),d??=a.querySelectorAll(i.modalSelector);let _=d[d.length-1],v={region:g,modal:_===void 0?null:_.dataset.shortcutModal??`other`,target:p},y=o.guards(l)||u||l.getModifierState(`AltGraph`),b=l.key===`Dead`,x=b&&t.runtime===`web`&&t.platform===`macos`&&l.code===`KeyN`&&l.metaKey&&l.altKey&&!l.ctrlKey&&!l.shiftKey;u=b;let S={code:l.code,control:l.ctrlKey,alt:l.altKey,shift:l.shiftKey,meta:l.metaKey,repeat:l.repeat,composing:y||b,defaultPrevented:l.defaultPrevented},C=()=>{l.preventDefault(),x&&(u=!1)};n?.({type:`keydown`,gesture:S,context:v,consume:C}),!r&&t.dispatch({...S,composing:y||b&&!x,defaultPrevented:l.defaultPrevented},v,C)};return a.addEventListener(`compositionstart`,l,!0),a.addEventListener(`compositionend`,l,!0),a.addEventListener(`focusin`,l,!0),a.addEventListener(`pointerdown`,l,!0),e.addEventListener(`keydown`,g,!0),e.addEventListener(`keydown`,_),e.addEventListener(`blur`,f),()=>{s=!1,e.clearTimeout(c),h.disconnect(),d=void 0,o.dispose(),a.removeEventListener(`compositionstart`,l,!0),a.removeEventListener(`compositionend`,l,!0),a.removeEventListener(`focusin`,l,!0),a.removeEventListener(`pointerdown`,l,!0),e.removeEventListener(`keydown`,g,!0),e.removeEventListener(`keydown`,_),e.removeEventListener(`blur`,f)}}let E=`dsh.keybindings.v1`;function ae(e,t,n){let r=new te({read:()=>e.localStorage.getItem(E),write:t=>{e.localStorage.setItem(E,t)}},`web`,t,!0,n),i=e=>{(e.key===null||e.key===`dsh.keybindings.v1`)&&r.readCurrent()};return e.addEventListener(`storage`,i),{get:e=>(r.setDefinitions(e),r.readCurrent()),edit:(e,t)=>r.edit(e,t),subscribe:()=>()=>{},recording:async()=>{},dispose:()=>{e.removeEventListener(`storage`,i),r.dispose()}}}function oe(e){return e.dshDesktop?.shortcuts}function se(e,t,n,r,a){return t.subscribe(t=>{if(t.revision!==r().revision)return;a?.();let o=e.document.activeElement;for(;o?.shadowRoot?.activeElement!=null&&!o.matches(`webview[data-sidebar-browser-frame]`);)o=o.shadowRoot.activeElement;let s=[...e.document.querySelectorAll(i.modalSelector)].at(-1),c=o?.closest(`.xterm`)?`terminal`:o?.matches(`input, textarea, select, [contenteditable="true"], [contenteditable=""]`)?`editable`:`page`,l={target:o,region:c,modal:s?.dataset.shortcutModal??(s===void 0?null:`other`)};if(t.kind===`menu`)n.invoke(t.commandId,l);else if(t.kind===`keyboard`)n.dispatch({...t,composing:!1,defaultPrevented:!1},l,()=>{});else if(t.kind===`webview`){if(o?.matches(`webview[data-sidebar-browser-frame]`)!==!0||!o.isConnected||t.frameName===``||o.getAttribute(`name`)!==t.frameName)return;n.dispatch({...t,composing:!1,defaultPrevented:!1},{...l,source:`webview`},()=>{})}else o instanceof HTMLIFrameElement&&o.isConnected&&o.matches(`iframe[data-sidebar-browser-frame], iframe[data-html-preview]`)&&t.frameName!==``&&o.name===t.frameName&&n.dispatch({...t,composing:!1,defaultPrevented:!1},{...l,source:`iframe`},()=>{})})}function D(e){return e==null}function O(e){return e&&typeof e==`object`&&!Array.isArray(e)}function ce(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function k(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function le(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 A=Symbol.for(`cosmokit.volatile.write`);function j(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=>j(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,j(n,t)])))}finally{t.delete(e)}}function M(e){let t=j(e);return Object.freeze({get:()=>t,[A]:e=>{t=e}})}function N(e){return typeof e==`object`&&!!e&&A in e}function P(e,t){return arguments.length===1?t=>P(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function F(e){return P(`ArrayBuffer`,e)||P(`SharedArrayBuffer`,e)}function ue(e){return F(e)||ArrayBuffer.isView(e)}let I;(function(e){e.is=F,e.isSource=ue;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})(I||={}),I.fromBase64,I.toBase64,I.fromHex,I.toHex;function L(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(P(`Date`,e))return new Date(e.valueOf());if(P(`RegExp`,e))return new RegExp(e.source,e.flags);if(F(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(L,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(L,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function R(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(N(e)||N(t))return N(e)&&N(t);if(!n&&D(e)&&D(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(P(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(P(`URL`),(e,t)=>e.href===t.href)??a(P(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(F,(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 de;(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})(de||={});let z=Symbol.for(`schemastery`),B=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var V=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?.[B]}};Object.defineProperty(V.prototype,B,{value:!0});let H=function(e){let t=function(e,n={}){return H.resolve(e,t,n)[0]};if(e.refs){let t=k(e.refs,e=>new H(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&&k(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,H.prototype),t.meta||={},t.toString=t.toString.bind(t),t};H.prototype=Object.create(Function.prototype),H.prototype[z]=!0,Object.defineProperty(H.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:H.resolve(e,this,{})[0]}}catch(e){if(V.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),H.ValidationError=V,H.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},H.prototype.set=function(e,t){return this.dict[e]=t,this},H.prototype.push=function(e){return this.list.push(e),this};function fe(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 U(e){return e?.$value??e?.$inner}function W(e){return ce(e??{},e=>!e.startsWith(`$`))}H.prototype.i18n=function(e){let t=H(this),n=fe(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=k(t.dict,(t,n)=>t.i18n(k(e,e=>U(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(k(e,(e={})=>Array.isArray(U(e))?U(e)[n]:Array.isArray(e)?e[n]:W(e)))),t.inner&&=t.inner.i18n(k(e,e=>U(e)?U(e):W(e))),t.sKey&&=t.sKey.i18n(k(e,e=>e?.$key)),t},H.prototype.extra=function(e,t){let n=H(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(H.prototype,{[e](t=!0){let n=H(this);return n.meta={...n.meta,[e]:t},n}});H.prototype.deprecated=function(){let e=H(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},H.prototype.experimental=function(){let e=H(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},H.prototype.pattern=function(e){let t=H(this),n=le(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},H.prototype.simplify=function(e){if(N(e)&&(e=e.get()),R(e,this.meta.default,this.type===`dict`))return null;if(D(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`||!D(r))&&(t[n]=r)}return R(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 H.resolve(e,t,{}),t.simplify(e)}catch{}return e},H.prototype.toString=function(e){return Q[this.type]?.(this,e)??`Schema<${this.type}>`},H.prototype.role=function(e,t){let n=H(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(H.prototype,{[e](t){let n=H(this);return n.meta={...n.meta,[e]:t},n}});H.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let G={},K=Symbol(`checked-volatile-schema`);function q(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 V(`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))q(i,[...t,n],a,r);if(e.sKey&&q(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[z])&&q(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)q(e.list[n],[...t,String(n)],!0,r)}H.extend=function(e,t){G[e]=t},H.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[K]||(q(t,n.path),n={...n,[K]:!0}),t.meta?.volatile){let i=H(t);i.meta={...t.meta,volatile:!1};let[a,o]=H.resolve(e,i,n,r);try{return[M(a),o]}catch(e){throw new V(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(D(e)&&t.type!==`lazy`){if(t.meta.required)throw new V(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&D(i);)r=r.list[0],i=r?.meta.default;if(D(i))return[e];e=L(i)}let i=G[t.type];if(!i)throw new V(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},H.from=function(e){if(D(e))return H.any();if([`string`,`number`,`boolean`].includes(typeof e))return H.const(e).required();if(e[z])return e;if(typeof e==`function`)switch(e){case String:return H.string().required();case Number:return H.number().required();case Boolean:return H.boolean().required();case Function:return H.function().required();default:return H.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},H.lazy=function(e){let t=new H({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[z]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},H.natural=function(){return H.number().step(1).min(0)},H.percent=function(){return H.number().step(.01).min(0).max(1).role(`slider`)},H.date=function(){return H.union([H.is(Date),H.transform(H.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new V(`invalid date "${e}"`,t);return n},!0)])},H.regExp=function(e=``){return H.union([H.is(RegExp),H.transform(H.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new V(e.message,n)}},!0)])},H.arrayBuffer=function(e){return H.union([H.is(ArrayBuffer),H.is(SharedArrayBuffer),H.transform(H.any(),(e,t)=>{if(I.isSource(e))return I.fromSource(e);throw new V(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[H.transform(H.string(),(t,n)=>{try{return e===`base64`?I.fromBase64(t):I.fromHex(t)}catch(e){throw new V(e.message,n)}},!0)]:[]])},H.extend(`lazy`,(e,t,n,r)=>(t.inner[z]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},q(t.inner,n.path,!0)),H.resolve(e,t.inner,n,r))),H.extend(`any`,e=>[e]),H.extend(`never`,(e,t,n)=>{throw new V(`expected nullable but got ${e}`,n)}),H.extend(`const`,(e,{value:t},n)=>{if(R(e,t))return[t];throw new V(`expected ${t} but got ${e}`,n)});function J(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new V(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new V(`expected ${n} >= ${o} but got ${e}`,r)}H.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new V(`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 V(`expect string to match regexp ${r}`,n)}return J(e.length,t,`string length`,n),[e]});function Y(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 pe(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(Y(e,i)-Y(t,i))%Y(n,i)===0}H.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new V(`expected number but got ${e}`,n);J(e,t,`number`,n);let{step:r}=t;if(r&&!pe(e,t.min??0,r))throw new V(`expected number multiple of ${r} but got ${e}`,n);return[e]}),H.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new V(`expected boolean but got ${e}`,n)}),H.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 V(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new V(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),H.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new V(`expected function but got ${e}`,n)}),H.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new V(`expected ${t.name} but got ${e}`,n)}{if(D(e))throw new V(`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 V(`expected ${t} but got ${e}`,n)}});function X(e,t,n,r){try{let[i,a]=H.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?M(n.meta.default):n.meta.default}}H.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new V(`expected array but got ${e}`,r);return J(e.length,n,`array length`,r,!D(t.meta.default)),[e.map((n,i)=>X(e,i,t,r))]}),H.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!O(e))throw new V(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=H.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=X(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),H.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new V(`expected array but got ${e}`,n);let i=t.map((t,r)=>X(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function Z(e,t){for(let n in t)n in e||(e[n]=t[n])}H.extend(`object`,(e,{dict:t},n,r)=>{if(!O(e))throw new V(`expected object but got ${e}`,n);let i={};for(let r in t){let a=X(e,r,t[r],n);(!D(a)||r in e)&&(i[r]=a)}return r||Z(i,e),[i]}),H.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return H.resolve(e,n,r,i)}catch(e){a.push(e)}throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),H.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=H.resolve(e,i,r,!0)[0];if(!D(t)){if(D(a))a=t;else if(typeof a!=typeof t)throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)Z(a??={},t);else if(a!==t)throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&O(e)&&Z(a,e),[a]}),H.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=H.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let Q={};function $(e,t,n){Q[e]=n,Object.assign(H,{[e](...n){let r=new H({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??H.string();break;case`inner`:r.inner=H.from(n[t]);break;case`list`:r.list=n[t].map(H.from);break;case`dict`:r.dict=k(n[t],H.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}})}$(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),$(`any`,[],()=>`any`),$(`never`,[],()=>`never`),$(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),$(`string`,[],()=>`string`),$(`number`,[],()=>`number`),$(`boolean`,[],()=>`boolean`),$(`bitset`,[`bits`],()=>`bitset`),$(`function`,[],()=>`function`),$(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),$(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),$(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),$(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),$(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),$(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),$(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let me=H.object({stopSequenceMs:H.natural().min(1).max(2147483646).default(500)});return t.exports=class extends n.Service{static inject=[`locale`];runtime;platform;catalog;config;fixedCatalog;stopSequenceMs;fixedListeners=/* @__PURE__ */ new Set;adapter;keyboard;active=!0;connected=!1;registry;constructor(e){let t=re(document,navigator),n=t.runtime===`desktop`?window.dshDesktop?.keyboard:void 0;if(t.runtime===`desktop`&&n===void 0)throw Error(`Desktop keyboard bridge unavailable`);super(e,`shortcuts`),this.keyboard=n,this.runtime=t.runtime,this.platform=t.platform;let r=me(globalThis.__DSH_SHORTCUTS_CONFIG__??{});this.stopSequenceMs=r.stopSequenceMs,this.registry=new ne(this.runtime,this.platform,T()),this.catalog=this.registry.catalog,this.config=this.registry.config,this.fixedCatalog=this.registry.fixedCatalog;let i=e=>{this.active&&this.connected&&e.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(e)},a=this.runtime===`web`?ae(window,this.platform,i):void 0;this.adapter=a??oe(window),n!==void 0&&e.effect(()=>se(window,n,this.registry,()=>this.config.getSnapshot(),()=>{this.fixedInput({type:`reset`})}),`shortcuts: native keyboard`),e.effect(()=>{let e=this.adapter?.subscribe(i);return()=>{this.active=!1,e?.(),a?.dispose()}},`shortcuts: preferences`),this.syncDefinitions(),e.effect(()=>{let e=ie(window,this.registry,e=>{this.fixedInput(e)},n!==void 0&&(this.platform===`macos`||this.platform===`windows`));return()=>{e(),this.fixedListeners.clear()}},`shortcuts: keyboard`),e.effect(()=>e.locale.subscribe(()=>{this.registry.refreshLabels()}),`shortcuts: locale`)}register(e){let t=this.registry.register(e);return this.syncDefinitions(),()=>{t(),this.syncDefinitions()}}registerFixed(e){let t=this.registry.registerFixed(e);return this.syncDefinitions(),()=>{t(),this.syncDefinitions()}}observeFixedInput(e){return this.fixedListeners.add(e),()=>{this.fixedListeners.delete(e)}}fixedInput(e){let t=!1;for(let n of[...this.fixedListeners])if(this.fixedListeners.has(n))try{n(e.type===`reset`?e:{...e,gesture:{...e.gesture,defaultPrevented:e.gesture.defaultPrevented||t},consume:()=>{t=!0,e.consume()}})}catch(e){console.error(`Fixed shortcut handler failed`,e)}}describeBinding(e){let t=e===null?null:s(e,this.platform);return{binding:t,keys:l(t,this.platform).keys,issue:t===null?null:b(t,this.runtime,this.platform),conflicts:t===null?[]:[...this.catalog.getSnapshot().filter(e=>e.binding!==null&&C(e.binding,t)).map(e=>e.id),...this.fixedCatalog.getSnapshot().filter(e=>e.bindings.some(e=>C(e,t))).map(e=>e.id)]}}syncDefinitions(){this.active&&(this.adapter===void 0?this.failRead():this.adapter.get(this.registry.definitions()).then(e=>{this.connected=!0,this.active&&e.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(e)},()=>{this.failRead()}))}failRead(){this.active&&this.registry.configure({...this.config.getSnapshot(),status:`unreadable`,error:`read`})}async edit(...e){if(this.adapter===void 0)return{status:`unreadable`,snapshot:this.config.getSnapshot()};let t;try{t=await this.adapter.edit(...e)}catch(e){return this.active&&console.error(`Shortcut preference save failed`,e),{status:`write-failed`,snapshot:this.config.getSnapshot()}}return this.active&&t.snapshot.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(t.snapshot),t}async recording(e){if(this.adapter===void 0)throw Error(`Desktop shortcuts bridge unavailable`);await this.adapter.recording(e)}async closeWindow(){if(this.keyboard===void 0)throw Error(`Desktop keyboard bridge unavailable`);await this.keyboard.closeWindow(this.config.getSnapshot().revision)}},t.exports}});
9
+ default:return h(t,`shortcut edit`)}return{schemaVersion:i,profiles:{...e.profiles,[a]:o}}}function w(){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)}`}function T(){return{revision:w(),sequence:0,document:{schemaVersion:1,profiles:{}},status:`loading`,error:null,usingDefaults:!0}}var te=class{storage;runtime;platform;rereadBeforeWrite;publish;snapshot=T();raw;queue=Promise.resolve();definitions=null;active=!0;constructor(e,t,n,r,i){this.storage=e,this.runtime=t,this.platform=n,this.rereadBeforeWrite=r,this.publish=i}setDefinitions(e){this.definitions=e,this.accept({...this.snapshot})}dispose(){this.active=!1}readCurrent(){return this.serialize(()=>this.read())}edit(e,t){return this.serialize(async()=>{this.rereadBeforeWrite&&await this.read();let n=e=>({status:e,snapshot:this.snapshot});if(!this.active||this.definitions===null||this.snapshot.status===`loading`)return n(`not-ready`);if(t!==this.snapshot.revision)return n(`stale`);if(this.snapshot.status===`unreadable`)return n(`unreadable`);if((e.type===`set`||e.type===`reset`)&&!this.definitions.some(t=>t.id===e.id&&t.fixed===void 0))return n(`not-ready`);let r=ee(this.snapshot.document,e,this.runtime,this.platform),i=S(this.definitions,r,this.runtime,this.platform),a=i.find(t=>(e.type===`reset-all`||t.id===e.id)&&(t.issue!==null||t.conflicts.length>0)),o=e.type===`set`?i.find(t=>t.conflicts.includes(e.id)):void 0;if(a!==void 0||o!==void 0)return{...n(`conflict`),...a?.issue?{issue:a.issue}:{},conflicts:a?.conflicts.length?a.conflicts:o===void 0?[]:[o.id]};try{let e=`${JSON.stringify(r,null,2)}\n`;return await this.storage.write(e),this.raw=e,this.accept({...this.snapshot,document:r,status:`ready`,error:null,usingDefaults:!1}),n(`saved`)}catch{return n(`write-failed`)}})}serialize(e){let t=this.queue.then(e);return this.queue=t.catch(()=>void 0),t}accept(e){if(this.snapshot={...e,sequence:this.snapshot.sequence+1,revision:w()},this.active)try{this.publish(this.snapshot)}catch(e){console.error(`Shortcut configuration subscriber failed:`,e)}}async read(){let e;try{e=await this.storage.read()}catch{return this.snapshot.error!==`read`&&this.accept({...this.snapshot,status:`unreadable`,error:`read`}),this.snapshot}if(e===this.raw&&this.snapshot.error!==`read`)return this.snapshot;this.raw=e;let t=y(e);return typeof t==`string`?this.accept({...this.snapshot,status:`unreadable`,error:t}):this.accept({...this.snapshot,document:t,status:`ready`,error:null,usingDefaults:e===null}),this.snapshot}},ne=class{runtime;platform;commands=/* @__PURE__ */ new Map;fixedCommands=/* @__PURE__ */ new Map;conflicts=/* @__PURE__ */ new Map;bindings=/* @__PURE__ */ new Map;state;catalog;config;fixedCatalog=(0,r.createSnapshotStore)([]);constructor(e,t,n={...T(),status:`ready`}){this.runtime=e,this.platform=t,this.state=(0,r.createSnapshotStore)({catalog:[],config:n}),this.catalog={getSnapshot:()=>this.state.getSnapshot().catalog,subscribe:e=>this.state.subscribe(e)},this.config={getSnapshot:()=>this.state.getSnapshot().config,subscribe:e=>this.state.subscribe(e)}}definitions(){return[...[...this.commands.values()].map(({id:e,defaults:t})=>({id:e,defaults:t})),...[...this.fixedCommands.values()].map(({id:e,bindings:t})=>({id:e,defaults:{},fixed:t}))]}registerFixed(e){if(this.fixedCommands.has(e.id)||this.commands.has(e.id))throw Error(`Duplicate shortcut command: ${e.id}`);for(let t of e.bindings)s(t,this.platform);return this.fixedCommands.set(e.id,e),this.refreshLabels(),()=>{this.fixedCommands.get(e.id)===e&&(this.fixedCommands.delete(e.id),this.refreshLabels())}}refreshFixedLabels(){this.fixedCatalog.set([...this.fixedCommands.values()].map(e=>({id:e.id,label:e.label(),keys:e.keys,group:e.group,bindings:e.bindings.map(e=>s(e,this.platform))})))}configure(e){let t=this.config.getSnapshot();(e.revision!==t.revision||e.status!==t.status||e.error!==t.error)&&this.refreshLabels(e)}register(e){if(this.commands.has(e.id)||this.fixedCommands.has(e.id))throw Error(`Duplicate shortcut command: ${e.id}`);for(let t of[`desktop`,`web`])for(let n of[`macos`,`windows`,`linux`]){let r=x(e,t,n);if(r===void 0)continue;let i=s(r,n);if(t===`web`&&!u(i,n))throw Error(`Unsupported Web shortcut: ${e.id}`);if(b(i,t,n)!==null)throw Error(`Reserved shortcut default: ${e.id}`);for(let r of this.commands.values()){let a=x(r,t,n);if(a!==void 0&&C(i,s(a,n)))throw Error(`Conflicting shortcut defaults: ${e.id} and ${r.id} (${t}:${n})`)}}return this.commands.set(e.id,e),this.refreshLabels(),()=>{this.commands.get(e.id)===e&&(this.commands.delete(e.id),this.refreshLabels())}}refreshLabels(e=this.config.getSnapshot()){this.bindings.clear(),this.conflicts.clear();let t=S(this.definitions(),e.document,this.runtime,this.platform).map(t=>{let n=this.commands.get(t.id),r=e.status!==`loading`&&t.issue===null&&t.conflicts.length===0;return r&&t.binding!==null&&this.bindings.set(c(t.binding),n),e.status!==`loading`&&t.issue===null&&t.conflicts.length>0&&t.binding!==null&&this.conflicts.set(c(t.binding),n),{...t,label:n.label(),aliases:n.aliases,...l(t.binding,this.platform),aria:r?l(t.binding,this.platform).aria:void 0}});this.state.set({config:e,catalog:t}),this.refreshFixedLabels()}describeBinding(e){let t=e===null?null:s(e,this.platform);return{binding:t,keys:l(t,this.platform).keys,issue:t===null?null:b(t,this.runtime,this.platform),conflicts:t===null?[]:[...this.catalog.getSnapshot().filter(e=>e.binding!==null&&C(e.binding,t)).map(e=>e.id),...this.fixedCatalog.getSnapshot().filter(e=>e.bindings.some(e=>C(e,t))).map(e=>e.id)]}}invoke(e,t){let n=this.commands.get(e);if(n===void 0||t.modal!==null&&!n.modals.includes(t.modal))return;let r=n.resolve({...t,source:`menu`});r.status===`handled`&&r.run()}dispatch(e,t,n){if(e.defaultPrevented||e.composing)return{status:`pass`};let r=[`control`,`alt`,`shift`,`meta`].filter(t=>e[t]),i=c({code:e.code,modifiers:r,...e.secondCode===void 0?{}:{secondCode:e.secondCode}}),a=this.bindings.has(i)||this.conflicts.has(i)?i:c({code:e.code,modifiers:r}),o=this.bindings.get(a)??this.conflicts.get(a),s=this.runtime===`desktop`&&(this.platform===`windows`||this.platform===`macos`);if(o===void 0||!s&&!o.regions.includes(t.region)||!s&&t.region===`terminal`&&e.control&&!e.meta&&!e.alt&&!e.shift&&(e.code===`KeyW`||e.code===`KeyR`))return{status:`pass`};if(!this.bindings.has(a))return n(),{status:`blocked`,commandId:o.id,reason:`conflict`};if(!s&&t.modal!==null&&!o.modals.includes(t.modal))return n(),{status:`blocked`,commandId:o.id,reason:`modal`};let l=o.resolve(t);return l.status===`pass`?l:(n(),l.status===`blocked`?{...l,commandId:o.id}:(e.repeat||l.run(),{status:`handled`,commandId:o.id}))}};function re(e,t){let n=e.documentElement.dataset.platform,r=e.documentElement.hasAttribute(`data-tauri-shell`),i=n??t.platform;return{runtime:n===void 0||r?`web`:`desktop`,platform:/darwin|mac|iphone|ipad/iu.test(i)?`macos`:/win/iu.test(i)?`windows`:`linux`}}function ie(e,t,n,r=!1){let a=e.document,o=(0,i.observeComposition)(a),s=!1,c,l=()=>{n?.({type:`reset`})},u=!1,d,f=()=>{u=!1,l()},p=e=>e instanceof Element&&(e.matches(i.modalSelector)||e.querySelector(i.modalSelector)!==null),m=e=>{e.length>0&&(d=void 0),e.some(e=>e.type===`attributes`?e.oldValue===`dialog`||e.oldValue===`true`||p(e.target):[...e.addedNodes,...e.removedNodes].some(p))&&l()},h=new MutationObserver(m);h.observe(a.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`role`,`aria-modal`],attributeOldValue:!0});let g=()=>{s&&l(),e.clearTimeout(c),m(h.takeRecords()),s=!0,c=e.setTimeout(()=>{s=!1,c=void 0,l()},0)},_=l=>{e.clearTimeout(c),c=void 0,s=!1;let f=l.composedPath().find(e=>e instanceof Element),p=f instanceof Element?f:a.activeElement,g=p?.closest(`.xterm`)?`terminal`:p?.closest(`input, textarea, select, [contenteditable="true"], [contenteditable=""]`)?`editable`:`page`;m(h.takeRecords()),d??=a.querySelectorAll(i.modalSelector);let _=d[d.length-1],v={region:g,modal:_===void 0?null:_.dataset.shortcutModal??`other`,target:p},y=o.guards(l)||u||l.getModifierState(`AltGraph`),b=l.key===`Dead`,x=b&&t.runtime===`web`&&t.platform===`macos`&&l.code===`KeyN`&&l.metaKey&&l.altKey&&!l.ctrlKey&&!l.shiftKey;u=b;let S={code:l.code,key:l.key,control:l.ctrlKey,alt:l.altKey,shift:l.shiftKey,meta:l.metaKey,repeat:l.repeat,composing:y||b,defaultPrevented:l.defaultPrevented},C=()=>{l.preventDefault(),x&&(u=!1)};n?.({type:`keydown`,gesture:S,context:v,consume:C}),!r&&t.dispatch({...S,composing:y||b&&!x,defaultPrevented:l.defaultPrevented},v,C)};return a.addEventListener(`compositionstart`,l,!0),a.addEventListener(`compositionend`,l,!0),a.addEventListener(`focusin`,l,!0),a.addEventListener(`pointerdown`,l,!0),e.addEventListener(`keydown`,g,!0),e.addEventListener(`keydown`,_),e.addEventListener(`blur`,f),()=>{s=!1,e.clearTimeout(c),h.disconnect(),d=void 0,o.dispose(),a.removeEventListener(`compositionstart`,l,!0),a.removeEventListener(`compositionend`,l,!0),a.removeEventListener(`focusin`,l,!0),a.removeEventListener(`pointerdown`,l,!0),e.removeEventListener(`keydown`,g,!0),e.removeEventListener(`keydown`,_),e.removeEventListener(`blur`,f)}}let E=`dsh.keybindings.v1`;function ae(e,t,n){let r=new te({read:()=>e.localStorage.getItem(E),write:t=>{e.localStorage.setItem(E,t)}},`web`,t,!0,n),i=e=>{(e.key===null||e.key===`dsh.keybindings.v1`)&&r.readCurrent()};return e.addEventListener(`storage`,i),{get:e=>(r.setDefinitions(e),r.readCurrent()),edit:(e,t)=>r.edit(e,t),subscribe:()=>()=>{},recording:async()=>{},dispose:()=>{e.removeEventListener(`storage`,i),r.dispose()}}}function oe(e){return e.dshDesktop?.shortcuts}function se(e,t,n,r,a){return t.subscribe(t=>{if(t.revision!==r().revision)return;a?.();let o=e.document.activeElement;for(;o?.shadowRoot?.activeElement!=null&&!o.matches(`webview[data-sidebar-browser-frame]`);)o=o.shadowRoot.activeElement;let s=[...e.document.querySelectorAll(i.modalSelector)].at(-1),c=o?.closest(`.xterm`)?`terminal`:o?.matches(`input, textarea, select, [contenteditable="true"], [contenteditable=""]`)?`editable`:`page`,l={target:o,region:c,modal:s?.dataset.shortcutModal??(s===void 0?null:`other`)};if(t.kind===`menu`)n.invoke(t.commandId,l);else if(t.kind===`keyboard`)n.dispatch({...t,composing:!1,defaultPrevented:!1},l,()=>{});else if(t.kind===`webview`){if(o?.matches(`webview[data-sidebar-browser-frame]`)!==!0||!o.isConnected||t.frameName===``||o.getAttribute(`name`)!==t.frameName)return;n.dispatch({...t,composing:!1,defaultPrevented:!1},{...l,source:`webview`},()=>{})}else o instanceof HTMLIFrameElement&&o.isConnected&&o.matches(`iframe[data-sidebar-browser-frame], iframe[data-html-preview]`)&&t.frameName!==``&&o.name===t.frameName&&n.dispatch({...t,composing:!1,defaultPrevented:!1},{...l,source:`iframe`},()=>{})})}function D(e){return e==null}function O(e){return e&&typeof e==`object`&&!Array.isArray(e)}function ce(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function k(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function le(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 A=Symbol.for(`cosmokit.volatile.write`);function j(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=>j(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,j(n,t)])))}finally{t.delete(e)}}function M(e){let t=j(e);return Object.freeze({get:()=>t,[A]:e=>{t=e}})}function N(e){return typeof e==`object`&&!!e&&A in e}function P(e,t){return arguments.length===1?t=>P(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function F(e){return P(`ArrayBuffer`,e)||P(`SharedArrayBuffer`,e)}function ue(e){return F(e)||ArrayBuffer.isView(e)}let I;(function(e){e.is=F,e.isSource=ue;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})(I||={}),I.fromBase64,I.toBase64,I.fromHex,I.toHex;function L(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(P(`Date`,e))return new Date(e.valueOf());if(P(`RegExp`,e))return new RegExp(e.source,e.flags);if(F(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(L,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(L,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function R(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(N(e)||N(t))return N(e)&&N(t);if(!n&&D(e)&&D(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(P(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(P(`URL`),(e,t)=>e.href===t.href)??a(P(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(F,(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 de;(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})(de||={});let z=Symbol.for(`schemastery`),B=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var V=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?.[B]}};Object.defineProperty(V.prototype,B,{value:!0});let H=function(e){let t=function(e,n={}){return H.resolve(e,t,n)[0]};if(e.refs){let t=k(e.refs,e=>new H(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&&k(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,H.prototype),t.meta||={},t.toString=t.toString.bind(t),t};H.prototype=Object.create(Function.prototype),H.prototype[z]=!0,Object.defineProperty(H.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:H.resolve(e,this,{})[0]}}catch(e){if(V.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),H.ValidationError=V,H.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},H.prototype.set=function(e,t){return this.dict[e]=t,this},H.prototype.push=function(e){return this.list.push(e),this};function fe(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 U(e){return e?.$value??e?.$inner}function W(e){return ce(e??{},e=>!e.startsWith(`$`))}H.prototype.i18n=function(e){let t=H(this),n=fe(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=k(t.dict,(t,n)=>t.i18n(k(e,e=>U(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(k(e,(e={})=>Array.isArray(U(e))?U(e)[n]:Array.isArray(e)?e[n]:W(e)))),t.inner&&=t.inner.i18n(k(e,e=>U(e)?U(e):W(e))),t.sKey&&=t.sKey.i18n(k(e,e=>e?.$key)),t},H.prototype.extra=function(e,t){let n=H(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(H.prototype,{[e](t=!0){let n=H(this);return n.meta={...n.meta,[e]:t},n}});H.prototype.deprecated=function(){let e=H(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},H.prototype.experimental=function(){let e=H(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},H.prototype.pattern=function(e){let t=H(this),n=le(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},H.prototype.simplify=function(e){if(N(e)&&(e=e.get()),R(e,this.meta.default,this.type===`dict`))return null;if(D(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`||!D(r))&&(t[n]=r)}return R(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 H.resolve(e,t,{}),t.simplify(e)}catch{}return e},H.prototype.toString=function(e){return Q[this.type]?.(this,e)??`Schema<${this.type}>`},H.prototype.role=function(e,t){let n=H(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(H.prototype,{[e](t){let n=H(this);return n.meta={...n.meta,[e]:t},n}});H.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let G={},K=Symbol(`checked-volatile-schema`);function q(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 V(`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))q(i,[...t,n],a,r);if(e.sKey&&q(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[z])&&q(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)q(e.list[n],[...t,String(n)],!0,r)}H.extend=function(e,t){G[e]=t},H.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[K]||(q(t,n.path),n={...n,[K]:!0}),t.meta?.volatile){let i=H(t);i.meta={...t.meta,volatile:!1};let[a,o]=H.resolve(e,i,n,r);try{return[M(a),o]}catch(e){throw new V(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(D(e)&&t.type!==`lazy`){if(t.meta.required)throw new V(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&D(i);)r=r.list[0],i=r?.meta.default;if(D(i))return[e];e=L(i)}let i=G[t.type];if(!i)throw new V(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},H.from=function(e){if(D(e))return H.any();if([`string`,`number`,`boolean`].includes(typeof e))return H.const(e).required();if(e[z])return e;if(typeof e==`function`)switch(e){case String:return H.string().required();case Number:return H.number().required();case Boolean:return H.boolean().required();case Function:return H.function().required();default:return H.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},H.lazy=function(e){let t=new H({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[z]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},H.natural=function(){return H.number().step(1).min(0)},H.percent=function(){return H.number().step(.01).min(0).max(1).role(`slider`)},H.date=function(){return H.union([H.is(Date),H.transform(H.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new V(`invalid date "${e}"`,t);return n},!0)])},H.regExp=function(e=``){return H.union([H.is(RegExp),H.transform(H.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new V(e.message,n)}},!0)])},H.arrayBuffer=function(e){return H.union([H.is(ArrayBuffer),H.is(SharedArrayBuffer),H.transform(H.any(),(e,t)=>{if(I.isSource(e))return I.fromSource(e);throw new V(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[H.transform(H.string(),(t,n)=>{try{return e===`base64`?I.fromBase64(t):I.fromHex(t)}catch(e){throw new V(e.message,n)}},!0)]:[]])},H.extend(`lazy`,(e,t,n,r)=>(t.inner[z]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},q(t.inner,n.path,!0)),H.resolve(e,t.inner,n,r))),H.extend(`any`,e=>[e]),H.extend(`never`,(e,t,n)=>{throw new V(`expected nullable but got ${e}`,n)}),H.extend(`const`,(e,{value:t},n)=>{if(R(e,t))return[t];throw new V(`expected ${t} but got ${e}`,n)});function J(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new V(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new V(`expected ${n} >= ${o} but got ${e}`,r)}H.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new V(`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 V(`expect string to match regexp ${r}`,n)}return J(e.length,t,`string length`,n),[e]});function Y(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 pe(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(Y(e,i)-Y(t,i))%Y(n,i)===0}H.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new V(`expected number but got ${e}`,n);J(e,t,`number`,n);let{step:r}=t;if(r&&!pe(e,t.min??0,r))throw new V(`expected number multiple of ${r} but got ${e}`,n);return[e]}),H.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new V(`expected boolean but got ${e}`,n)}),H.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 V(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new V(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),H.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new V(`expected function but got ${e}`,n)}),H.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new V(`expected ${t.name} but got ${e}`,n)}{if(D(e))throw new V(`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 V(`expected ${t} but got ${e}`,n)}});function X(e,t,n,r){try{let[i,a]=H.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?M(n.meta.default):n.meta.default}}H.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new V(`expected array but got ${e}`,r);return J(e.length,n,`array length`,r,!D(t.meta.default)),[e.map((n,i)=>X(e,i,t,r))]}),H.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!O(e))throw new V(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=H.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=X(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),H.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new V(`expected array but got ${e}`,n);let i=t.map((t,r)=>X(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function Z(e,t){for(let n in t)n in e||(e[n]=t[n])}H.extend(`object`,(e,{dict:t},n,r)=>{if(!O(e))throw new V(`expected object but got ${e}`,n);let i={};for(let r in t){let a=X(e,r,t[r],n);(!D(a)||r in e)&&(i[r]=a)}return r||Z(i,e),[i]}),H.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return H.resolve(e,n,r,i)}catch(e){a.push(e)}throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),H.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=H.resolve(e,i,r,!0)[0];if(!D(t)){if(D(a))a=t;else if(typeof a!=typeof t)throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)Z(a??={},t);else if(a!==t)throw new V(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&O(e)&&Z(a,e),[a]}),H.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=H.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let Q={};function $(e,t,n){Q[e]=n,Object.assign(H,{[e](...n){let r=new H({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??H.string();break;case`inner`:r.inner=H.from(n[t]);break;case`list`:r.list=n[t].map(H.from);break;case`dict`:r.dict=k(n[t],H.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}})}$(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),$(`any`,[],()=>`any`),$(`never`,[],()=>`never`),$(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),$(`string`,[],()=>`string`),$(`number`,[],()=>`number`),$(`boolean`,[],()=>`boolean`),$(`bitset`,[`bits`],()=>`bitset`),$(`function`,[],()=>`function`),$(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),$(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),$(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),$(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),$(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),$(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),$(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let me=H.object({stopSequenceMs:H.natural().min(1).max(2147483646).default(500)});return t.exports=class extends n.Service{static inject=[`locale`];runtime;platform;catalog;config;fixedCatalog;stopSequenceMs;fixedListeners=/* @__PURE__ */ new Set;adapter;keyboard;active=!0;connected=!1;registry;constructor(e){let t=re(document,navigator),n=t.runtime===`desktop`?window.dshDesktop?.keyboard:void 0;if(t.runtime===`desktop`&&n===void 0)throw Error(`Desktop keyboard bridge unavailable`);super(e,`shortcuts`),this.keyboard=n,this.runtime=t.runtime,this.platform=t.platform;let r=me(globalThis.__DSH_SHORTCUTS_CONFIG__??{});this.stopSequenceMs=r.stopSequenceMs,this.registry=new ne(this.runtime,this.platform,T()),this.catalog=this.registry.catalog,this.config=this.registry.config,this.fixedCatalog=this.registry.fixedCatalog;let i=e=>{this.active&&this.connected&&e.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(e)},a=this.runtime===`web`?ae(window,this.platform,i):void 0;this.adapter=a??oe(window),n!==void 0&&e.effect(()=>se(window,n,this.registry,()=>this.config.getSnapshot(),()=>{this.fixedInput({type:`reset`})}),`shortcuts: native keyboard`),e.effect(()=>{let e=this.adapter?.subscribe(i);return()=>{this.active=!1,e?.(),a?.dispose()}},`shortcuts: preferences`),this.syncDefinitions(),e.effect(()=>{let e=ie(window,this.registry,e=>{this.fixedInput(e)},n!==void 0&&(this.platform===`macos`||this.platform===`windows`));return()=>{e(),this.fixedListeners.clear()}},`shortcuts: keyboard`),e.effect(()=>e.locale.subscribe(()=>{this.registry.refreshLabels()}),`shortcuts: locale`)}register(e){let t=this.registry.register(e);return this.syncDefinitions(),()=>{t(),this.syncDefinitions()}}registerFixed(e){let t=this.registry.registerFixed(e);return this.syncDefinitions(),()=>{t(),this.syncDefinitions()}}observeFixedInput(e){return this.fixedListeners.add(e),()=>{this.fixedListeners.delete(e)}}fixedInput(e){let t=!1;for(let n of[...this.fixedListeners])if(this.fixedListeners.has(n))try{n(e.type===`reset`?e:{...e,gesture:{...e.gesture,defaultPrevented:e.gesture.defaultPrevented||t},consume:()=>{t=!0,e.consume()}})}catch(e){console.error(`Fixed shortcut handler failed`,e)}}describeBinding(e){return this.registry.describeBinding(e)}syncDefinitions(){this.active&&(this.adapter===void 0?this.failRead():this.adapter.get(this.registry.definitions()).then(e=>{this.connected=!0,this.active&&e.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(e)},()=>{this.failRead()}))}failRead(){this.active&&this.registry.configure({...this.config.getSnapshot(),status:`unreadable`,error:`read`})}async edit(...e){if(this.adapter===void 0)return{status:`unreadable`,snapshot:this.config.getSnapshot()};let t;try{t=await this.adapter.edit(...e)}catch(e){return this.active&&console.error(`Shortcut preference save failed`,e),{status:`write-failed`,snapshot:this.config.getSnapshot()}}return this.active&&t.snapshot.sequence>=this.config.getSnapshot().sequence&&this.registry.configure(t.snapshot),t}async recording(e){if(this.adapter===void 0)throw Error(`Desktop shortcuts bridge unavailable`);await this.adapter.recording(e)}async closeWindow(){if(this.keyboard===void 0)throw Error(`Desktop keyboard bridge unavailable`);await this.keyboard.closeWindow(this.config.getSnapshot().revision)}},t.exports}});
@@ -1 +1,4 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-approval`,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=`@deepseek-ai/dsh-client-ui-approval/ApprovalPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(o)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-approval`,e.dataset.pluginCss=o,e.textContent=`.oJ9kxG_root{padding:8px calc(var(--dsh-composer-side-clearance) + 16px) 12px;flex-direction:column;align-items:center;display:flex}.oJ9kxG_card{width:100%;max-width:var(--dsh-chat-content-width);border:1px solid var(--dsw-alias-state-warn-secondary);border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-shadow-lv2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);flex-direction:column;display:flex;overflow:hidden}.oJ9kxG_strip{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-primary);flex-shrink:0;align-items:center;gap:8px;padding:10px 16px;font-size:13px;line-height:18px;display:flex}.oJ9kxG_body{box-sizing:border-box;min-height:0;max-height:var(--dsh-composer-text-max-height);overscroll-behavior:contain;flex-direction:column;flex:auto;gap:6px;padding:12px 16px 0;display:flex;overflow-y:auto}.oJ9kxG_headline{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:500;line-height:24px}.oJ9kxG_command{color:var(--dsw-alias-label-tertiary);font-family:var(--ds-font-family-code);word-break:break-all;font-size:13px;line-height:20px}.oJ9kxG_actionRow{flex-shrink:0;justify-content:flex-end;gap:8px;padding:14px 16px;display:flex}.oJ9kxG_reject{touch-action:manipulation;user-select:none;-webkit-tap-highlight-color:transparent}.oJ9kxG_reject:active:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);border-color:#0000}@media (hover:hover) and (pointer:fine){.oJ9kxG_reject:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);border-color:#0000}}@media (width<=720px){.oJ9kxG_root{padding:4px 8px 8px}.oJ9kxG_card{border-radius:22px;max-width:100%;max-height:min(76dvh,560px)}.oJ9kxG_strip{padding:11px 14px;font-size:13px;font-weight:500}.oJ9kxG_body{gap:10px;max-height:none;padding:12px 14px 14px}.oJ9kxG_headline{font-size:15px;font-weight:600;line-height:22px}.oJ9kxG_command{box-sizing:border-box;overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);max-height:148px;color:var(--dsw-alias-label-secondary);word-break:break-word;overflow-wrap:anywhere;padding:10px 12px;font-size:12.5px;line-height:19px;overflow-y:auto}.oJ9kxG_actionRow{padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--dsw-alias-border-l1);grid-template-columns:1fr 1fr;gap:10px;display:grid}.oJ9kxG_actionRow>button{white-space:nowrap;width:100%;min-height:44px;font-size:15px;font-weight:500}}`,document.head.appendChild(e)}var s={actionRow:`oJ9kxG_actionRow`,body:`oJ9kxG_body`,card:`oJ9kxG_card`,command:`oJ9kxG_command`,headline:`oJ9kxG_headline`,reject:`oJ9kxG_reject`,root:`oJ9kxG_root`,strip:`oJ9kxG_strip`};function c(e){let t=e.matched,n=t.callId===void 0?null:e.renderSlot(`conversation.approval.detail`,{callId:t.callId}),r=t.displayReason===void 0?t.reason:e.resolveReason(t.displayReason);return/* @__PURE__ */ (0,a.jsx)(l,{pending:t,reason:r,detail:n,t:e.t},t.key)}function l({pending:e,reason:t,detail:n,t:o}){let[c,l]=(0,r.useState)(!1),u=(0,r.useRef)(!1),d=(0,r.useRef)(!0),f=(0,r.useRef)(!1),p=(0,r.useRef)(!1);(0,r.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let m=t=>{!u.current&&e.answerable&&(u.current=!0,l(!0),e.answer(t).catch(()=>{d.current&&e.answerable&&(u.current=!1,l(!1))}))};return/* @__PURE__ */ (0,a.jsx)(`div`,{className:s.root,"data-approval-key":e.key,"aria-busy":c,onKeyDown:e=>{let t=e.target;!e.defaultPrevented&&e.currentTarget.contains(document.activeElement)&&t.closest(`input, textarea, select, [contenteditable="true"], [contenteditable=""]`)===null&&(e.key===`Enter`||e.key===`Escape`)&&(e.key!==`Enter`||t.closest(`button, a[href], [role="button"]`)===null)&&(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||(e.preventDefault(),e.stopPropagation(),!(e.repeat||f.current||p.current||e.nativeEvent.isComposing||e.keyCode===229)&&m(e.key===`Enter`?`allowed-once`:`rejected`)))},onKeyUpCapture:()=>{p.current=!1},onCompositionStartCapture:()=>{f.current=!0},onCompositionEndCapture:()=>{f.current=!1,p.current=!0},children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:s.card,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:s.strip,children:[/* @__PURE__ */ (0,a.jsx)(i.StateDot,{state:c?`ongoing`:`warning`}),o(`waiting`)]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:s.body,"data-approval-scroll":``,tabIndex:0,role:`group`,"aria-label":o(`detail.aria`),children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:s.headline,children:t??o(`escalation`,{toolName:e.toolName})}),n!==null&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:s.command,children:n})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:s.actionRow,children:[/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,className:s.reject,disabled:c,onClick:()=>{m(`rejected`)},children:o(`reject`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`primary`,disabled:c,onClick:()=>{m(`allowed-once`)},children:o(`allowOnce`)})]})]})})}function u(e,t){try{return e(),Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?e:Error(t,{cause:e}))}}let d=0;var f=class{sessionId;kind;key;toolName;callId;reason;displayReason;result;#e;#t;#n;#r;#i=Symbol(`pending approval delegated`);#a=!1;constructor(e,t){this.sessionId=e,this.kind=`approval`,d+=1,this.key=`approval:${String(d)}`,this.toolName=t.toolName,this.callId=t.callId,this.reason=t.reason,this.displayReason=t.displayReason;let n=Promise.withResolvers();if(this.result=n.promise,this.#e=n.resolve,this.#t=n.reject,this.#n=t.signal,t.signal===void 0){this.#r=void 0;return}let r=()=>{this.abort(t.signal?.reason??/* @__PURE__ */ Error(`approval request was aborted`))};this.#r=r,t.signal.addEventListener(`abort`,r,{once:!0}),t.signal.aborted&&r()}get answerable(){return!this.#a}answer(e){return u(()=>{this.finish(()=>{this.#e(e)})},`pending approval settlement failed`)}delegate(){this.#a||this.finish(()=>{this.#t(this.#i)})}isDelegation(e){return e===this.#i}abort(e){this.#a||this.finish(()=>{this.#t(e)})}finish(e){if(this.#a)throw Error(`pending approval ${this.key} is already settled`);this.#a=!0,this.#n!==void 0&&this.#r!==void 0&&this.#n.removeEventListener(`abort`,this.#r),e()}};let p={waiting:`等待审批`,"detail.aria":`审批详情`,escalation:`工具 {toolName} 请求越权执行`,reject:`拒绝`,allowOnce:`允许一次`},m={waiting:`Waiting for approval`,"detail.aria":`Approval details`,escalation:`Tool {toolName} requests privileged execution`,reject:`Reject`,allowOnce:`Allow once`},h=[`sessions`,`remote`,`uiSession`,`slots`,`locale`],g=`approval`;async function _(e,t,n,r,i){let a=e.sessions.scopeOf(t);if(a===void 0)return r();let o=new f(a,{toolName:n.toolName,...n.callId===void 0?{}:{callId:n.callId},...n.reason===void 0?{}:{reason:n.reason},...n.displayReason===void 0?{}:{displayReason:n.displayReason},...n.signal===void 0?{}:{signal:n.signal}}),s=Promise.withResolvers(),c=i(o,async()=>{o.delegate(),await s.promise});try{try{return await o.result}catch(e){if(o.isDelegation(e))return await r();throw e}}finally{c(),s.resolve()}}function v(e){e.effect(()=>e.locale.register(g,{zh:p,en:m}),`ui-approval: dictionaries`),e.inject([`shortcuts`],t=>{let n=e.locale.bind(g);t.effect(()=>t.shortcuts.registerFixed({id:`approval.allow`,label:()=>n(`allowOnce`),keys:[`Enter`],bindings:[{code:`Enter`,modifiers:[]}],group:`approval`}),`ui-approval: fixed allow reference`),t.effect(()=>t.shortcuts.registerFixed({id:`approval.reject`,label:()=>n(`reject`),keys:[`Esc`],bindings:[{code:`Escape`,modifiers:[]}],group:`approval`}),`ui-approval: fixed reject reference`)});let t=e.uiSession.registerPendingInteraction(()=>0);e.slots.inject(`conversation.composer`,()=>e.slots.register({name:`conversation.composer`,priority:1,select:({pendingInteraction:e})=>e instanceof f?e:null,locale:g,inject:()=>({resolveReason:t=>e.locale.resolveText(t)}),children:{"conversation.approval.detail":{kind:`single`,scope:`session`}}},c)),e.remote.$on(`approval/request`,function(n,r){return _(e,this,n,r,t)})}return n.apply=v,n.inject=h,t.exports}});
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-approval`,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=/^(?:工作目录|Working directory|原因|Reason)\s*[::]/i;function s(e){if(o.test(e)||/[。!?]$/.test(e))return!1;let t=e.split(/\r?\n/u).map(e=>e.trim()).filter(Boolean);return t.length!==0&&t.every(e=>!/\s{1,}[a-z]+.*\.$/.test(e)&&(/[\\/.]/.test(e)||t.length===1))}function c(e,t,n){let r=t?.trim();if(!r)return{headline:n};let i=r.split(/\n{2,}/u).map(e=>e.trim()).filter(Boolean);if(i.length<=1)return{headline:i[0]??n};let[a=n,c=``,...l]=i;if(e===`shell`&&!o.test(c)){let e=l.join(`
2
+ `).trim();return{headline:a,command:c,...e?{detail:e}:{}}}if(e===`files`&&s(c)){let e=c.split(/\r?\n/u).map(e=>e.trim()).filter(Boolean).map(e=>({path:e})),t=l.join(`
3
+ `).trim();return{headline:a,...e.length>0?{files:e}:{},...t?{detail:t}:{}}}return{headline:a,detail:i.slice(1).join(`
4
+ `)}}function l(e){let t=e.matched,n=t.callId===void 0?null:e.renderSlot(`conversation.approval.detail`,{callId:t.callId}),r=t.displayReason===void 0?t.reason:e.resolveReason(t.displayReason);return/* @__PURE__ */ (0,a.jsx)(u,{pending:t,reason:r,detail:n,t:e.t},t.key)}function u({pending:e,reason:t,detail:n,t:o}){let[s,l]=(0,r.useState)(!1),u=(0,r.useRef)(!1),d=(0,r.useRef)(!0);(0,r.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let f=t=>{!u.current&&e.answerable&&(u.current=!0,l(!0),e.answer(t).catch(()=>{d.current&&e.answerable&&(u.current=!1,l(!1))}))},p=(0,r.useMemo)(()=>c(e.toolName,t,o(`escalation`,{toolName:e.toolName})),[e.toolName,t,o]),m=(0,r.useMemo)(()=>[{id:`rejected`,label:o(`reject`),effect:`deny`},{id:`allowed-once`,label:o(`allowOnce`),effect:`allowOnce`}],[o]);return/* @__PURE__ */ (0,a.jsx)(i.ApprovalCard,{cardKey:e.key,headline:p.headline,meta:e.toolName===`shell`?`bash`:e.toolName,command:p.command,commandSlot:n,files:p.files,detail:p.detail,actions:m,busy:s,onAction:e=>{f(e.id===`allowed-once`?`allowed-once`:`rejected`)},labels:{detailAria:o(`detail.aria`),expand:o(`expand`),collapse:o(`collapse`),moreOptions:o(`moreOptions`),categoryTerminal:o(`categoryTerminal`),categoryFiles:o(`categoryFiles`),categoryPermission:o(`categoryPermission`)}})}function d(e,t){try{return e(),Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?e:Error(t,{cause:e}))}}let f=0;var p=class{sessionId;kind;key;toolName;callId;reason;displayReason;result;#e;#t;#n;#r;#i=Symbol(`pending approval delegated`);#a=!1;constructor(e,t){this.sessionId=e,this.kind=`approval`,f+=1,this.key=`approval:${String(f)}`,this.toolName=t.toolName,this.callId=t.callId,this.reason=t.reason,this.displayReason=t.displayReason;let n=Promise.withResolvers();if(this.result=n.promise,this.#e=n.resolve,this.#t=n.reject,this.#n=t.signal,t.signal===void 0){this.#r=void 0;return}let r=()=>{this.abort(t.signal?.reason??/* @__PURE__ */ Error(`approval request was aborted`))};this.#r=r,t.signal.addEventListener(`abort`,r,{once:!0}),t.signal.aborted&&r()}get answerable(){return!this.#a}answer(e){return d(()=>{this.finish(()=>{this.#e(e)})},`pending approval settlement failed`)}delegate(){this.#a||this.finish(()=>{this.#t(this.#i)})}isDelegation(e){return e===this.#i}abort(e){this.#a||this.finish(()=>{this.#t(e)})}finish(e){if(this.#a)throw Error(`pending approval ${this.key} is already settled`);this.#a=!0,this.#n!==void 0&&this.#r!==void 0&&this.#n.removeEventListener(`abort`,this.#r),e()}};let m={waiting:`等待审批`,"detail.aria":`审批详情`,escalation:`允许运行工具 {toolName}?`,reject:`拒绝`,allowOnce:`允许一次`,expand:`展开`,collapse:`收起`,moreOptions:`更多允许选项`,categoryTerminal:`终端`,categoryFiles:`编辑文件`,categoryPermission:`权限请求`},h={waiting:`Waiting for approval`,"detail.aria":`Approval details`,escalation:`Allow running {toolName}?`,reject:`Deny`,allowOnce:`Allow once`,expand:`Expand`,collapse:`Collapse`,moreOptions:`Approval options`,categoryTerminal:`Terminal`,categoryFiles:`Edit files`,categoryPermission:`Ask permission`},g=[`sessions`,`remote`,`uiSession`,`slots`,`locale`],_=`approval`;async function v(e,t,n,r,i){let a=e.sessions.scopeOf(t);if(a===void 0)return r();let o=new p(a,{toolName:n.toolName,...n.callId===void 0?{}:{callId:n.callId},...n.reason===void 0?{}:{reason:n.reason},...n.displayReason===void 0?{}:{displayReason:n.displayReason},...n.signal===void 0?{}:{signal:n.signal}}),s=Promise.withResolvers(),c=i(o,async()=>{o.delegate(),await s.promise});try{try{return await o.result}catch(e){if(o.isDelegation(e))return await r();throw e}}finally{c(),s.resolve()}}function y(e){e.effect(()=>e.locale.register(_,{zh:m,en:h}),`ui-approval: dictionaries`),e.inject([`shortcuts`],t=>{let n=e.locale.bind(_);t.effect(()=>t.shortcuts.registerFixed({id:`approval.allow`,label:()=>n(`allowOnce`),keys:[`Enter`],bindings:[{code:`Enter`,modifiers:[]}],group:`approval`}),`ui-approval: fixed allow reference`),t.effect(()=>t.shortcuts.registerFixed({id:`approval.reject`,label:()=>n(`reject`),keys:[`Esc`],bindings:[{code:`Escape`,modifiers:[]}],group:`approval`}),`ui-approval: fixed reject reference`)});let t=e.uiSession.registerPendingInteraction(()=>0);e.slots.inject(`conversation.composer`,()=>e.slots.register({name:`conversation.composer`,priority:1,select:({pendingInteraction:e})=>e instanceof p?e:null,locale:_,inject:()=>({resolveReason:t=>e.locale.resolveText(t)}),children:{"conversation.approval.detail":{kind:`single`,scope:`session`}}},l)),e.remote.$on(`approval/request`,function(n,r){return v(e,this,n,r,t)})}return n.apply=y,n.inject=g,t.exports}});
@@ -6,4 +6,4 @@ n!==null&&(t&&(n.scrollLeft=n.scrollWidth-n.clientWidth),p())},[e.length,p]),(0,
6
6
  /* v8 ignore next -- defensive: the rail div renders unconditionally, so the mount effect always finds it. */
7
7
  if(e===null)return;let t=()=>{};if(typeof ResizeObserver<`u`){let n=new ResizeObserver(p);n.observe(e),t=()=>{n.disconnect()}}let n=t=>{if(t.deltaY===0)return;let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:t.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.clientWidth:1;t.preventDefault(),e.scrollBy({left:t.deltaX===0?Math.sign(t.deltaY)*Math.min(Math.abs(t.deltaY)*n,60):t.deltaX*n,behavior:`auto`})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>{t(),e.removeEventListener(`wheel`,n)}},[p]);let m=e=>{let t=o.current;
8
8
  /* v8 ignore next -- defensive: the arrows render only while the rail is mounted, so a click cannot find a null ref. */
9
- t!==null&&t.scrollBy({left:e*Math.max(t.clientWidth-64,200),behavior:d()})};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:u.root,children:[l.left&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowLeft),"aria-label":t.scrollLeft,onClick:()=>{m(-1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:u.rail,role:`group`,"aria-label":t.group,onScroll:p,children:e.map(e=>/* @__PURE__ */ (0,a.jsx)(`div`,{className:u.item,children:n(e)},e.id))}),l.right&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowRight),"aria-label":t.scrollRight,onClick:()=>{m(1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{})})]})}let p=`@deepseek-ai/dsh-client-ui-attachment/DropOverlay.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(p)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=p,e.textContent=`.cpj-8a_mask{z-index:1000;pointer-events:none;background-color:var(--dsw-alias-bg-mask-drop);backdrop-filter:blur(10px);justify-content:center;align-items:center;animation:.16s ease-out cpj-8a_fade-in;display:flex;position:fixed;inset:0}@keyframes cpj-8a_fade-in{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.cpj-8a_mask{animation:none}}.cpj-8a_wrap{color:var(--dsw-alias-label-primary);text-align:center;flex-direction:column;align-items:center;margin-top:-3%;padding:0 40px;display:flex}.cpj-8a_illustration{width:115px;height:84px}.cpj-8a_title{font:var(--dsw-font-l-20);margin-top:16px}.cpj-8a_desc{font:var(--dsw-font-s-14);color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;margin-top:16px}`,document.head.appendChild(e)}var m={desc:`cpj-8a_desc`,"fade-in":`cpj-8a_fade-in`,illustration:`cpj-8a_illustration`,mask:`cpj-8a_mask`,title:`cpj-8a_title`,wrap:`cpj-8a_wrap`};function h({disabled:e,labels:t}){return(0,o.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.mask,role:`status`,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:m.wrap,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.illustration,"aria-hidden":`true`,children:e?/* @__PURE__ */ (0,a.jsx)(_,{}):/* @__PURE__ */ (0,a.jsx)(g,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.title,children:t.title}),!e&&t.desc!==void 0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.desc,children:t.desc})]})}),document.body)}let g=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsxs)(`g`,{clipPath:`url(#dshDropOverlayClip)`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{y:`17.0742`,width:`44.1832`,height:`43.6431`,rx:`12`,transform:`rotate(-22.7338 0 17.0742)`,fill:`#9CE5ED`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`73.4043`,y:`8.54297`,width:`43.7267`,height:`50.5284`,rx:`8`,transform:`rotate(17.403 73.4043 8.54297)`,fill:`#679EFE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4917 28.1369L40.8865 33.4564L37.2232 34.9524L29.5302 31.0159L26.7919 39.2122L23.1285 40.7082L26.8287 29.6338L16.8967 24.5516L20.5601 23.0556L27.7902 26.7549L30.3639 19.052L34.0273 17.556L30.4917 28.1369Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7966`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`31.583`,y:`38.6641`,width:`44.9157`,height:`44.3666`,rx:`12`,transform:`rotate(-0.134233 31.583 38.6641)`,fill:`#3964FE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M38.9521 73.0337C39.6129 71.7086 41.7113 66.0937 43.5113 61.1663C44.1607 59.3885 46.7484 59.3923 47.4591 61.1465C48.9728 64.8828 50.7969 68.6922 51.9988 69.1925C54.2946 70.1482 57.9854 59.3573 68.0064 70.1801`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`60.6157`,cy:`52.247`,r:`4.38794`,transform:`rotate(22.5996 60.6157 52.247)`,fill:`white`})]}),/* @__PURE__ */ (0,a.jsx)(`defs`,{children:/* @__PURE__ */ (0,a.jsx)(`clipPath`,{id:`dshDropOverlayClip`,children:/* @__PURE__ */ (0,a.jsx)(`rect`,{width:`115`,height:`84`,fill:`white`})})})]}),_=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M29.6829 4.63701L11.0677 12.4368C4.95519 14.998 2.07624 22.0294 4.6374 28.1419L12.2285 46.259C14.7896 52.3715 21.8211 55.2505 27.9336 52.6893L46.5488 44.8895C52.6613 42.3283 55.5403 35.2969 52.9791 29.1844L45.388 11.0673C42.8269 4.9548 35.7954 2.07585 29.6829 4.63701Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4915 28.1375L40.8863 33.4569L37.223 34.9529L29.53 31.0165L26.7917 39.2128L23.1283 40.7088L26.8285 29.6344L16.8965 24.5522L20.5599 23.0562L27.79 26.7555L30.3637 19.0526L34.0271 17.5566L30.4915 28.1375Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M107.496 19.2285L81.0381 10.9357C76.8221 9.61423 72.333 11.9607 71.0116 16.1768L60.6844 49.1246C59.363 53.3406 61.7095 57.8297 65.9255 59.1511L92.383 67.4439C96.599 68.7654 101.088 66.4189 102.41 62.2029L112.737 29.255C114.058 25.039 111.712 20.55 107.496 19.2285Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7967`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M66.5798 30.1418L41.481 30.2006C33.5281 30.2193 27.0962 36.6815 27.1148 44.6343L27.172 69.0742C27.1907 77.0271 33.6529 83.459 41.6057 83.4404L66.7045 83.3816C74.6574 83.363 81.0894 76.9008 81.0707 68.9479L81.0135 44.5081C80.9949 36.5552 74.5327 30.1232 66.5798 30.1418Z`,fill:`#F59E0B`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M54 70.7969C61.732 70.7969 68 64.5289 68 56.7969C68 49.0649 61.732 42.7969 54 42.7969C46.268 42.7969 40 49.0649 40 56.7969C40 64.5289 46.268 70.7969 54 70.7969Z`,stroke:`white`,strokeWidth:`3.5`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M44 46.7969L64 66.7969`,stroke:`white`,strokeWidth:`3.5`,strokeLinecap:`round`})]}),v=`@deepseek-ai/dsh-client-ui-attachment/FileCard.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(v)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=v,e.textContent=`.Mdc2uq_card{border:.5px solid var(--dsw-alias-border-l2,#0000001f);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;text-align:left;align-items:center;gap:10px;width:240px;height:64px;padding:0 12px;display:inline-flex;position:relative}.Mdc2uq_failed{border-color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_icon{flex:none;justify-content:center;align-items:center;width:28px;height:28px;display:inline-flex}.Mdc2uq_spinner{corner-shape:round;border:2px solid;border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite Mdc2uq_file-card-spin}@keyframes Mdc2uq_file-card-spin{to{transform:rotate(360deg)}}.Mdc2uq_body{flex-direction:column;flex:1;min-width:0;padding:8px 0;display:flex}.Mdc2uq_retry{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.Mdc2uq_name{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Mdc2uq_meta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}.Mdc2uq_metaFailed{color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_remove{corner-shape:round;background:var(--dsw-alias-button-contrast-fill,#000000b8);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted,#fff);opacity:0;cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:opacity .2s ease-in-out;display:inline-flex;position:absolute;top:6px;right:6px}.Mdc2uq_card:hover .Mdc2uq_remove,.Mdc2uq_remove:focus-visible{opacity:1}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.Mdc2uq_remove{transition:none}}.Mdc2uq_card:hover .Mdc2uq_name,.Mdc2uq_card:focus-within .Mdc2uq_name{padding-right:18px}.Mdc2uq_removeFailed{background:var(--dsw-alias-state-error-primary,#d54941);color:#fff;opacity:1}.Mdc2uq_progressTrack{background:var(--dsw-alias-fill-tertiary,#00000014);border-radius:1px;height:2px;position:absolute;bottom:5px;left:12px;right:12px;overflow:hidden}.Mdc2uq_progressBar{border-radius:inherit;background:var(--dsw-alias-brand-primary,#4d6bfe);width:35%;height:100%;animation:1.2s ease-in-out infinite alternate Mdc2uq_file-card-progress;display:block}.Mdc2uq_progressBar[style]{animation:none}@keyframes Mdc2uq_file-card-progress{0%{transform:translate(-70%)}to{transform:translate(220%)}}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}`,document.head.appendChild(e)}var y={body:`Mdc2uq_body`,card:`Mdc2uq_card`,failed:`Mdc2uq_failed`,"file-card-progress":`Mdc2uq_file-card-progress`,"file-card-spin":`Mdc2uq_file-card-spin`,icon:`Mdc2uq_icon`,meta:`Mdc2uq_meta`,metaFailed:`Mdc2uq_metaFailed`,name:`Mdc2uq_name`,progressBar:`Mdc2uq_progressBar`,progressTrack:`Mdc2uq_progressTrack`,remove:`Mdc2uq_remove`,removeFailed:`Mdc2uq_removeFailed`,retry:`Mdc2uq_retry`,spinner:`Mdc2uq_spinner`};function b({name:e,bytes:t,state:n,progress:r,labels:o,onRemove:s,onRetry:c}){let l=(0,i.fileExtension)(e).toUpperCase().slice(0,8),u=n===`uploading`?r===void 0?o.uploading:o.uploadingPercent(Math.round(Math.min(1,Math.max(0,r))*100)):n===`error`?o.failed:[l,(0,i.fileSizeText)(t)].filter(e=>e!==``).join(` `),d=n===`error`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${y.card}${d?` ${y.failed}`:``}`,title:e,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.icon,"aria-hidden":!0,children:n===`uploading`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.spinner}):/* @__PURE__ */ (0,a.jsx)(i.FileTypeIcon,{path:e})}),d?/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:`${y.body} ${y.retry}`,"aria-label":o.retry,onClick:c,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:`${y.meta} ${y.metaFailed}`,children:u})]}):/* @__PURE__ */ (0,a.jsxs)(`span`,{className:y.body,"aria-label":o.label,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.meta,children:u})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:d?`${y.remove} ${y.removeFailed}`:y.remove,"aria-label":o.remove,onClick:s,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})}),n===`uploading`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressTrack,"aria-hidden":!0,children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressBar,style:r===void 0?void 0:{width:`${String(Math.min(1,Math.max(0,r))*100)}%`}})})]})}function x(e){return{dialog:e(`image.preview`),close:e(`image.closePreview`)}}function S(e){return{image:e(`image.label`),open:e(`image.openOriginal`),openNamed:t=>e(`image.openOriginalLabel`,{label:t}),loading:e(`image.loading`),loadFailed:e(`image.loadFailed`),tooLarge:e(`image.previewTooLarge`),lightbox:x(e)}}function C(e,t,n){return t?{title:e(`attachment.dropTitle`),desc:n===void 0?void 0:e(`attachment.dropDesc`,n)}:{title:e(`attachment.dropBlocked`)}}function w(e,t){return{label:e(`file.pending`),remove:e(`file.remove`,{name:t}),uploading:e(`file.uploading`),uploadingPercent:t=>e(`file.uploadingPercent`,{percent:t}),failed:e(`file.uploadFailed`),retry:e(`file.retry`,{name:t})}}function T(e){return{group:e(`attachment.pending`),scrollLeft:e(`attachment.scrollLeft`),scrollRight:e(`attachment.scrollRight`)}}function E(e,t){let n=/* @__PURE__ */ new Set,r=0;for(let i of e.items){if(i.kind!==`file`)continue;let e=t[r++];typeof i.webkitGetAsEntry==`function`&&i.webkitGetAsEntry()?.isDirectory===!0&&e!==void 0&&n.add(e)}return n}function D(e,t,n,r){let i=e=>{let t=e.dataTransfer;return t===null||!t.types.includes(`Files`)?null:t},a=()=>{n.current=0,r(!1)},o=e=>{i(e)!==null&&(e.preventDefault(),n.current+=1,r(!0))},s=t=>{let n=i(t);n!==null&&(t.preventDefault(),n.dropEffect=e?`copy`:`none`)},c=e=>{if(i(e)===null)return;n.current=Math.max(0,n.current-1),n.current===0&&r(!1);let t=e.clientX<=0||e.clientY<=0||e.clientX>=window.innerWidth||e.clientY>=window.innerHeight;(e.target===document.documentElement||e.target===document.body)&&t&&a()},l=n=>{let r=i(n);if(r!==null&&(n.preventDefault(),a(),e)){let e=[...r.files];t(e,E(r,e))}};return document.addEventListener(`dragenter`,o),document.addEventListener(`dragover`,s),document.addEventListener(`dragleave`,c),document.addEventListener(`drop`,l),window.addEventListener(`dragend`,a),()=>{document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragover`,s),document.removeEventListener(`dragleave`,c),document.removeEventListener(`drop`,l),window.removeEventListener(`dragend`,a)}}let O=`@deepseek-ai/dsh-client-ui-attachment/ComposerAttachments.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(O)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=O,e.textContent=`.O5Qubq_rail{min-width:0;margin-bottom:-6px;padding:2px 10px 0}.O5Qubq_imageItem{width:64px;height:64px;position:relative}.O5Qubq_thumbnail{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;width:64px;height:64px;padding:0;overflow:hidden}.O5Qubq_thumbnail img{object-fit:cover;width:100%;height:100%;display:block}.O5Qubq_overlay{border-radius:var(--dsw-radius-xl);color:#fff;font-variant-numeric:tabular-nums;background:#00000073;border:none;place-items:center;padding:0;font-size:13px;font-weight:500;display:grid;position:absolute;inset:0}.O5Qubq_failed{cursor:pointer;background:#dc2626b3}.O5Qubq_remove{z-index:1;corner-shape:round;background:var(--dsw-alias-button-contrast-fill);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted);cursor:pointer;opacity:0;border:none;border-radius:50%;place-items:center;padding:0;transition:opacity .2s ease-in-out;display:grid;position:absolute;top:4px;right:4px}.O5Qubq_imageItem:hover .O5Qubq_remove,.O5Qubq_remove:focus-visible{opacity:1}@media (pointer:coarse){.O5Qubq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.O5Qubq_remove{transition:none}}`,document.head.appendChild(e)}var k={failed:`O5Qubq_failed`,imageItem:`O5Qubq_imageItem`,overlay:`O5Qubq_overlay`,rail:`O5Qubq_rail`,remove:`O5Qubq_remove`,thumbnail:`O5Qubq_thumbnail`};function A({attachments:e,canAcceptDrop:t,onAddFiles:n,onRemoveAttachment:o,uploads:s,onRetryFile:c,dropLimits:l,t:u}){let[d,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(!1),_=(0,r.useRef)(0),v=(0,r.useCallback)(()=>{p(null)},[]);(0,r.useEffect)(()=>{d!==null&&!e.some(e=>e.id===d.id)&&p(null)},[e,d]),(0,r.useEffect)(()=>D(t,n,_,g),[t,n]);let y=(0,r.useMemo)(()=>e.map(e=>({id:e.id,attachment:e})),[e]);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[m&&/* @__PURE__ */ (0,a.jsx)(h,{disabled:!t,labels:C(u,t,l)}),y.length>0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:k.rail,children:/* @__PURE__ */ (0,a.jsx)(f,{items:y,labels:T(u),renderItem:e=>{let t=e.attachment,n=s[t.id];if(t.kind===`image`){let e=t.file.name;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:k.imageItem,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.thumbnail,title:u(`image.openOriginal`),onClick:()=>{p(t)},children:/* @__PURE__ */ (0,a.jsx)(`img`,{src:t.previewUrl,alt:e||u(`image.pending`)})}),(n===void 0||n.status===`uploading`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:k.overlay,role:`status`,children:n?.total?`${String(Math.round(Math.min(1,n.loaded/n.total)*100))}%`:`…`}),n?.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:`${k.overlay} ${k.failed}`,"aria-label":u(`file.retry`,{name:e}),onClick:()=>{c(t.id)},children:u(`image.retry`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.remove,"aria-label":u(`image.remove`,{name:e}),onClick:()=>{o(t.id)},children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})})]})}return/* @__PURE__ */ (0,a.jsx)(b,{name:t.file.name||u(`file.label`),bytes:t.file.size,state:n===void 0||n.status===`uploading`?`uploading`:n.status===`ready`?`ready`:`error`,...n?.status===`uploading`&&n.total!==void 0&&n.total>0?{progress:n.loaded/n.total}:{},labels:w(u,t.file.name),onRemove:()=>{o(t.id)},onRetry:()=>{c(t.id)}})}})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:d.previewUrl,alt:d.file.name||u(`image.original`),labels:x(u),onClose:v})]})}let j=`@deepseek-ai/dsh-client-ui-attachment/MessageImage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(j)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=j,e.textContent=`.zeivWW_gallery{flex-wrap:wrap;gap:10px;max-width:100%;display:flex}.zeivWW_gallery[data-align=end]{justify-content:flex-end;align-self:flex-end}.zeivWW_gallery[data-align=start]{justify-content:flex-start;align-self:flex-start}.zeivWW_frame{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;flex:none;place-items:center;min-width:44px;min-height:44px;padding:0;display:grid;overflow:hidden}.zeivWW_frame[data-variant=tile]{width:64px;min-width:64px;height:64px;min-height:64px}.zeivWW_frame img{object-fit:cover;width:100%;height:100%;display:block}.zeivWW_loading,.zeivWW_error{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zeivWW_error{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);cursor:pointer;max-width:240px;padding:10px 12px}.zeivWW_error[data-variant=tile]{border-radius:var(--dsw-radius-xl);width:64px;height:64px;padding:4px;overflow:hidden}.zeivWW_frame[data-variant=thumbnail],.zeivWW_error[data-variant=thumbnail]{box-sizing:border-box;border-radius:var(--dsw-radius-lg);place-items:center;width:48px;min-width:48px;height:48px;min-height:48px;padding:2px;display:grid;overflow:hidden}.zeivWW_frame[data-variant=thumbnail] img{object-fit:contain}.zeivWW_spinner{animation:.9s linear infinite zeivWW_spinner-rotate}@keyframes zeivWW_spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.zeivWW_spinner{animation:none}}.zeivWW_frame:focus-visible,.zeivWW_error:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}`,document.head.appendChild(e)}var M={error:`zeivWW_error`,frame:`zeivWW_frame`,gallery:`zeivWW_gallery`,loading:`zeivWW_loading`,spinner:`zeivWW_spinner`,"spinner-rotate":`zeivWW_spinner-rotate`};function N(e){let t=e.width/e.height,n=Math.min(4,Math.max(.25,t)),r=n>=1?{width:240,height:240/n}:{width:240*n,height:240},i=Math.min(1,e.width/r.width,e.height/r.height);return{width:Math.max(1,Math.round(r.width*i)),height:Math.max(1,Math.round(r.height*i)),objectPosition:t<.25?`center top`:t>4?`left center`:`center`}}function P(e){return`attachment`in e?e.attachment:e.preview.width!==void 0&&e.preview.height!==void 0?{width:e.preview.width,height:e.preview.height}:void 0}function F({image:e,load:t,variant:n,labels:o}){let s=`preview`in e?e.preview:void 0,c=`attachment`in e?e.attachment:void 0,[l,u]=(0,r.useState)(()=>c===void 0?null:t.peek?.(c)??null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(),[h,g]=(0,r.useState)(!1),[_,v]=(0,r.useState)(0),y=(0,r.useCallback)(()=>{v(e=>e+1)},[]),b=(0,r.useCallback)(()=>{g(!1)},[]),x=(0,r.useMemo)(()=>P(e),[e]),S=(0,r.useMemo)(()=>{if(n!==`single`)return;let e=p??x;return e===void 0?{width:240,height:240,objectPosition:`center`}:N(e)},[x,p,n]);(0,r.useEffect)(()=>{if(c===void 0)return;let e=!0;return f(null),m(void 0),u(t.peek?.(c)??null),t(c).then(t=>{e&&u(t)}).catch(t=>{if(!e)return;let n=typeof t==`object`&&t&&`details`in t?t.details?.reason:void 0;f(n===`IMAGE_TOO_LARGE`||n===`IMAGE_TOO_MANY_PIXELS`?`too-large`:`unavailable`)}),()=>{e=!1}},[c,t,_]);let C=s?.url??l,w=(`attachment`in e?e.label:void 0)??s?.name??c?.name??o.image,T=n===`thumbnail`&&C===null;return d===`too-large`?/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.error,"data-variant":n,role:`status`,title:o.tooLarge,children:o.tooLarge}):d?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.error,"data-variant":n,title:n===`thumbnail`?o.loadFailed:void 0,"aria-label":n===`thumbnail`?o.loadFailed:void 0,onClick:y,children:n===`thumbnail`?/* @__PURE__ */ (0,a.jsx)(`span`,{"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{})}):o.loadFailed}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.frame,"data-variant":n,style:S===void 0?void 0:{width:S.width,height:S.height},title:T?o.loading:o.open,"aria-label":T?o.loading:o.openNamed(w),"aria-busy":T||void 0,onClick:()=>{C!==null&&g(!0)},children:C===null?/* @__PURE__ */ (0,a.jsx)(`span`,{className:M.loading,"aria-hidden":T||void 0,children:T?/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{className:M.spinner}):o.loading}):/* @__PURE__ */ (0,a.jsx)(`img`,{src:C,alt:w,onLoad:e=>{let{naturalWidth:t,naturalHeight:n}=e.currentTarget;t>0&&n>0&&m(e=>e?.width===t&&e.height===n?e:{width:t,height:n})},onError:()=>f(`unavailable`),style:S===void 0?void 0:{objectPosition:S.objectPosition}})}),h&&C!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:C,alt:w,labels:o.lightbox,onClose:b})]})}function I({images:e,load:t,align:n,compact:r=!1,thumbnail:i=!1,labels:o}){if(e.length===0)return null;let s=i?`thumbnail`:r||e.length>1?`tile`:`single`;return/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.gallery,"data-align":n,children:e.map((e,n)=>/* @__PURE__ */ (0,a.jsx)(F,{image:e,load:t,variant:s,labels:o},`${`attachment`in e?e.attachment.attachmentId:e.preview.url}:${n}`))})}function L({images:e,loadImage:t,align:n,compact:r=!1,thumbnail:i=!1,t:o}){return/* @__PURE__ */ (0,a.jsx)(I,{images:e,load:t,align:n,compact:r,thumbnail:i,labels:S(o)})}let R=[`slots`];function z(e){e.slots.inject(`conversation.input.attachments`,()=>e.slots.register({name:`conversation.input.attachments`,locale:`conversation`},A)),e.slots.inject(`conversation.message.images`,()=>e.slots.register({name:`conversation.message.images`,locale:`conversation`},L)),e.slots.inject(`conversation.trajectory.images`,()=>e.slots.register({name:`conversation.trajectory.images`,locale:`conversation`},L)),e.slots.inject(`tool.call.images`,()=>e.slots.register({name:`tool.call.images`,locale:`conversation`},L))}return n.apply=z,n.inject=R,t.exports}});
9
+ t!==null&&t.scrollBy({left:e*Math.max(t.clientWidth-64,200),behavior:d()})};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:u.root,children:[l.left&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowLeft),"aria-label":t.scrollLeft,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(-1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:u.rail,role:`group`,"aria-label":t.group,onScroll:p,children:e.map(e=>/* @__PURE__ */ (0,a.jsx)(`div`,{className:u.item,children:n(e)},e.id))}),l.right&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowRight),"aria-label":t.scrollRight,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{})})]})}let p=`@deepseek-ai/dsh-client-ui-attachment/DropOverlay.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(p)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=p,e.textContent=`.cpj-8a_mask{z-index:1000;pointer-events:none;background-color:var(--dsw-alias-bg-mask-drop);backdrop-filter:blur(10px);justify-content:center;align-items:center;animation:.16s ease-out cpj-8a_fade-in;display:flex;position:fixed;inset:0}@keyframes cpj-8a_fade-in{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.cpj-8a_mask{animation:none}}.cpj-8a_wrap{color:var(--dsw-alias-label-primary);text-align:center;flex-direction:column;align-items:center;margin-top:-3%;padding:0 40px;display:flex}.cpj-8a_illustration{width:115px;height:84px}.cpj-8a_title{font:var(--dsw-font-l-20);margin-top:16px}.cpj-8a_desc{font:var(--dsw-font-s-14);color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;margin-top:16px}`,document.head.appendChild(e)}var m={desc:`cpj-8a_desc`,"fade-in":`cpj-8a_fade-in`,illustration:`cpj-8a_illustration`,mask:`cpj-8a_mask`,title:`cpj-8a_title`,wrap:`cpj-8a_wrap`};function h({disabled:e,labels:t}){return(0,o.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.mask,role:`status`,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:m.wrap,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.illustration,"aria-hidden":`true`,children:e?/* @__PURE__ */ (0,a.jsx)(_,{}):/* @__PURE__ */ (0,a.jsx)(g,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.title,children:t.title}),!e&&t.desc!==void 0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.desc,children:t.desc})]})}),document.body)}let g=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsxs)(`g`,{clipPath:`url(#dshDropOverlayClip)`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{y:`17.0742`,width:`44.1832`,height:`43.6431`,rx:`12`,transform:`rotate(-22.7338 0 17.0742)`,fill:`#9CE5ED`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`73.4043`,y:`8.54297`,width:`43.7267`,height:`50.5284`,rx:`8`,transform:`rotate(17.403 73.4043 8.54297)`,fill:`#679EFE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4917 28.1369L40.8865 33.4564L37.2232 34.9524L29.5302 31.0159L26.7919 39.2122L23.1285 40.7082L26.8287 29.6338L16.8967 24.5516L20.5601 23.0556L27.7902 26.7549L30.3639 19.052L34.0273 17.556L30.4917 28.1369Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7966`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`31.583`,y:`38.6641`,width:`44.9157`,height:`44.3666`,rx:`12`,transform:`rotate(-0.134233 31.583 38.6641)`,fill:`#3964FE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M38.9521 73.0337C39.6129 71.7086 41.7113 66.0937 43.5113 61.1663C44.1607 59.3885 46.7484 59.3923 47.4591 61.1465C48.9728 64.8828 50.7969 68.6922 51.9988 69.1925C54.2946 70.1482 57.9854 59.3573 68.0064 70.1801`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`60.6157`,cy:`52.247`,r:`4.38794`,transform:`rotate(22.5996 60.6157 52.247)`,fill:`white`})]}),/* @__PURE__ */ (0,a.jsx)(`defs`,{children:/* @__PURE__ */ (0,a.jsx)(`clipPath`,{id:`dshDropOverlayClip`,children:/* @__PURE__ */ (0,a.jsx)(`rect`,{width:`115`,height:`84`,fill:`white`})})})]}),_=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M29.6829 4.63701L11.0677 12.4368C4.95519 14.998 2.07624 22.0294 4.6374 28.1419L12.2285 46.259C14.7896 52.3715 21.8211 55.2505 27.9336 52.6893L46.5488 44.8895C52.6613 42.3283 55.5403 35.2969 52.9791 29.1844L45.388 11.0673C42.8269 4.9548 35.7954 2.07585 29.6829 4.63701Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4915 28.1375L40.8863 33.4569L37.223 34.9529L29.53 31.0165L26.7917 39.2128L23.1283 40.7088L26.8285 29.6344L16.8965 24.5522L20.5599 23.0562L27.79 26.7555L30.3637 19.0526L34.0271 17.5566L30.4915 28.1375Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M107.496 19.2285L81.0381 10.9357C76.8221 9.61423 72.333 11.9607 71.0116 16.1768L60.6844 49.1246C59.363 53.3406 61.7095 57.8297 65.9255 59.1511L92.383 67.4439C96.599 68.7654 101.088 66.4189 102.41 62.2029L112.737 29.255C114.058 25.039 111.712 20.55 107.496 19.2285Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7967`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M66.5798 30.1418L41.481 30.2006C33.5281 30.2193 27.0962 36.6815 27.1148 44.6343L27.172 69.0742C27.1907 77.0271 33.6529 83.459 41.6057 83.4404L66.7045 83.3816C74.6574 83.363 81.0894 76.9008 81.0707 68.9479L81.0135 44.5081C80.9949 36.5552 74.5327 30.1232 66.5798 30.1418Z`,fill:`#F59E0B`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M54 70.7969C61.732 70.7969 68 64.5289 68 56.7969C68 49.0649 61.732 42.7969 54 42.7969C46.268 42.7969 40 49.0649 40 56.7969C40 64.5289 46.268 70.7969 54 70.7969Z`,stroke:`white`,strokeWidth:`3.5`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M44 46.7969L64 66.7969`,stroke:`white`,strokeWidth:`3.5`,strokeLinecap:`round`})]}),v=`@deepseek-ai/dsh-client-ui-attachment/FileCard.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(v)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=v,e.textContent=`.Mdc2uq_card{border:.5px solid var(--dsw-alias-border-l2,#0000001f);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;text-align:left;align-items:center;gap:10px;width:240px;height:64px;padding:0 12px;display:inline-flex;position:relative}.Mdc2uq_failed{border-color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_icon{flex:none;justify-content:center;align-items:center;width:28px;height:28px;display:inline-flex}.Mdc2uq_spinner{corner-shape:round;border:2px solid;border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite Mdc2uq_file-card-spin}@keyframes Mdc2uq_file-card-spin{to{transform:rotate(360deg)}}.Mdc2uq_body{flex-direction:column;flex:1;min-width:0;padding:8px 0;display:flex}.Mdc2uq_retry{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.Mdc2uq_name{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Mdc2uq_meta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}.Mdc2uq_metaFailed{color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_remove{corner-shape:round;background:var(--dsw-alias-button-contrast-fill,#000000b8);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted,#fff);opacity:0;cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:opacity .2s ease-in-out;display:inline-flex;position:absolute;top:6px;right:6px}.Mdc2uq_card:hover .Mdc2uq_remove,.Mdc2uq_remove:focus-visible{opacity:1}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.Mdc2uq_remove{transition:none}}.Mdc2uq_card:hover .Mdc2uq_name,.Mdc2uq_card:focus-within .Mdc2uq_name{padding-right:18px}.Mdc2uq_removeFailed{background:var(--dsw-alias-state-error-primary,#d54941);color:#fff;opacity:1}.Mdc2uq_progressTrack{background:var(--dsw-alias-fill-tertiary,#00000014);border-radius:1px;height:2px;position:absolute;bottom:5px;left:12px;right:12px;overflow:hidden}.Mdc2uq_progressBar{border-radius:inherit;background:var(--dsw-alias-brand-primary,#4d6bfe);width:35%;height:100%;animation:1.2s ease-in-out infinite alternate Mdc2uq_file-card-progress;display:block}.Mdc2uq_progressBar[style]{animation:none}@keyframes Mdc2uq_file-card-progress{0%{transform:translate(-70%)}to{transform:translate(220%)}}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}`,document.head.appendChild(e)}var y={body:`Mdc2uq_body`,card:`Mdc2uq_card`,failed:`Mdc2uq_failed`,"file-card-progress":`Mdc2uq_file-card-progress`,"file-card-spin":`Mdc2uq_file-card-spin`,icon:`Mdc2uq_icon`,meta:`Mdc2uq_meta`,metaFailed:`Mdc2uq_metaFailed`,name:`Mdc2uq_name`,progressBar:`Mdc2uq_progressBar`,progressTrack:`Mdc2uq_progressTrack`,remove:`Mdc2uq_remove`,removeFailed:`Mdc2uq_removeFailed`,retry:`Mdc2uq_retry`,spinner:`Mdc2uq_spinner`};function b({name:e,bytes:t,state:n,progress:r,labels:o,onRemove:s,onRetry:c}){let l=(0,i.fileExtension)(e).toUpperCase().slice(0,8),u=n===`uploading`?r===void 0?o.uploading:o.uploadingPercent(Math.round(Math.min(1,Math.max(0,r))*100)):n===`error`?o.failed:[l,(0,i.fileSizeText)(t)].filter(e=>e!==``).join(` `),d=n===`error`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${y.card}${d?` ${y.failed}`:``}`,title:e,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.icon,"aria-hidden":!0,children:n===`uploading`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.spinner}):/* @__PURE__ */ (0,a.jsx)(i.FileTypeIcon,{path:e})}),d?/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:`${y.body} ${y.retry}`,"aria-label":o.retry,onMouseDown:e=>{e.preventDefault()},onClick:c,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:`${y.meta} ${y.metaFailed}`,children:u})]}):/* @__PURE__ */ (0,a.jsxs)(`span`,{className:y.body,"aria-label":o.label,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.meta,children:u})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:d?`${y.remove} ${y.removeFailed}`:y.remove,"aria-label":o.remove,onMouseDown:e=>{e.preventDefault()},onClick:s,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})}),n===`uploading`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressTrack,"aria-hidden":!0,children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressBar,style:r===void 0?void 0:{width:`${String(Math.min(1,Math.max(0,r))*100)}%`}})})]})}function x(e){return{dialog:e(`image.preview`),close:e(`image.closePreview`)}}function S(e){return{image:e(`image.label`),open:e(`image.openOriginal`),openNamed:t=>e(`image.openOriginalLabel`,{label:t}),loading:e(`image.loading`),loadFailed:e(`image.loadFailed`),tooLarge:e(`image.previewTooLarge`),lightbox:x(e)}}function C(e,t,n){return t?{title:e(`attachment.dropTitle`),desc:n===void 0?void 0:e(`attachment.dropDesc`,n)}:{title:e(`attachment.dropBlocked`)}}function w(e,t){return{label:e(`file.pending`),remove:e(`file.remove`,{name:t}),uploading:e(`file.uploading`),uploadingPercent:t=>e(`file.uploadingPercent`,{percent:t}),failed:e(`file.uploadFailed`),retry:e(`file.retry`,{name:t})}}function T(e){return{group:e(`attachment.pending`),scrollLeft:e(`attachment.scrollLeft`),scrollRight:e(`attachment.scrollRight`)}}function E(e,t){let n=/* @__PURE__ */ new Set,r=0;for(let i of e.items){if(i.kind!==`file`)continue;let e=t[r++];typeof i.webkitGetAsEntry==`function`&&i.webkitGetAsEntry()?.isDirectory===!0&&e!==void 0&&n.add(e)}return n}function D(e,t,n,r){let i=e=>{let t=e.dataTransfer;return t===null||!t.types.includes(`Files`)?null:t},a=()=>{n.current=0,r(!1)},o=e=>{i(e)!==null&&(e.preventDefault(),n.current+=1,r(!0))},s=t=>{let n=i(t);n!==null&&(t.preventDefault(),n.dropEffect=e?`copy`:`none`)},c=e=>{if(i(e)===null)return;n.current=Math.max(0,n.current-1),n.current===0&&r(!1);let t=e.clientX<=0||e.clientY<=0||e.clientX>=window.innerWidth||e.clientY>=window.innerHeight;(e.target===document.documentElement||e.target===document.body)&&t&&a()},l=n=>{let r=i(n);if(r!==null&&(n.preventDefault(),a(),e)){let e=[...r.files];t(e,E(r,e))}};return document.addEventListener(`dragenter`,o),document.addEventListener(`dragover`,s),document.addEventListener(`dragleave`,c),document.addEventListener(`drop`,l),window.addEventListener(`dragend`,a),()=>{document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragover`,s),document.removeEventListener(`dragleave`,c),document.removeEventListener(`drop`,l),window.removeEventListener(`dragend`,a)}}let O=`@deepseek-ai/dsh-client-ui-attachment/ComposerAttachments.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(O)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=O,e.textContent=`.O5Qubq_rail{min-width:0;margin-bottom:-6px;padding:2px 10px 0}.O5Qubq_imageItem{width:64px;height:64px;position:relative}.O5Qubq_thumbnail{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;width:64px;height:64px;padding:0;overflow:hidden}.O5Qubq_thumbnail img{object-fit:cover;width:100%;height:100%;display:block}.O5Qubq_overlay{border-radius:var(--dsw-radius-xl);color:#fff;font-variant-numeric:tabular-nums;background:#00000073;border:none;place-items:center;padding:0;font-size:13px;font-weight:500;display:grid;position:absolute;inset:0}.O5Qubq_failed{cursor:pointer;background:#dc2626b3}.O5Qubq_remove{z-index:1;corner-shape:round;background:var(--dsw-alias-button-contrast-fill);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted);cursor:pointer;opacity:0;border:none;border-radius:50%;place-items:center;padding:0;transition:opacity .2s ease-in-out;display:grid;position:absolute;top:4px;right:4px}.O5Qubq_imageItem:hover .O5Qubq_remove,.O5Qubq_remove:focus-visible{opacity:1}@media (pointer:coarse){.O5Qubq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.O5Qubq_remove{transition:none}}`,document.head.appendChild(e)}var k={failed:`O5Qubq_failed`,imageItem:`O5Qubq_imageItem`,overlay:`O5Qubq_overlay`,rail:`O5Qubq_rail`,remove:`O5Qubq_remove`,thumbnail:`O5Qubq_thumbnail`};function A({attachments:e,canAcceptDrop:t,onAddFiles:n,onRemoveAttachment:o,uploads:s,onRetryFile:c,dropLimits:l,t:u}){let[d,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(!1),_=(0,r.useRef)(0),v=(0,r.useCallback)(()=>{p(null)},[]);(0,r.useEffect)(()=>{d!==null&&!e.some(e=>e.id===d.id)&&p(null)},[e,d]),(0,r.useEffect)(()=>D(t,n,_,g),[t,n]);let y=(0,r.useMemo)(()=>e.map(e=>({id:e.id,attachment:e})),[e]);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[m&&/* @__PURE__ */ (0,a.jsx)(h,{disabled:!t,labels:C(u,t,l)}),y.length>0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:k.rail,children:/* @__PURE__ */ (0,a.jsx)(f,{items:y,labels:T(u),renderItem:e=>{let t=e.attachment,n=s[t.id];if(t.kind===`image`){let e=t.file.name;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:k.imageItem,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.thumbnail,title:u(`image.openOriginal`),onClick:()=>{p(t)},children:/* @__PURE__ */ (0,a.jsx)(`img`,{src:t.previewUrl,alt:e||u(`image.pending`)})}),(n===void 0||n.status===`uploading`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:k.overlay,role:`status`,children:n?.total?`${String(Math.round(Math.min(1,n.loaded/n.total)*100))}%`:`…`}),n?.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:`${k.overlay} ${k.failed}`,"aria-label":u(`file.retry`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{c(t.id)},children:u(`image.retry`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.remove,"aria-label":u(`image.remove`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{o(t.id)},children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})})]})}let r=`file`in t?t.file.name:t.stored.name,l=`file`in t?t.file.size:t.stored.bytes;return/* @__PURE__ */ (0,a.jsx)(b,{name:r||u(`file.label`),bytes:l,state:n===void 0||n.status===`uploading`?`uploading`:n.status===`ready`?`ready`:`error`,...n?.status===`uploading`&&n.total!==void 0&&n.total>0?{progress:n.loaded/n.total}:{},labels:w(u,r),onRemove:()=>{o(t.id)},onRetry:()=>{c(t.id)}})}})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:d.previewUrl,alt:d.file.name||u(`image.original`),labels:x(u),onClose:v})]})}let j=`@deepseek-ai/dsh-client-ui-attachment/MessageImage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(j)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=j,e.textContent=`.zeivWW_gallery{flex-wrap:wrap;gap:10px;max-width:100%;display:flex}.zeivWW_gallery[data-align=end]{justify-content:flex-end;align-self:flex-end}.zeivWW_gallery[data-align=start]{justify-content:flex-start;align-self:flex-start}.zeivWW_frame{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;flex:none;place-items:center;min-width:44px;min-height:44px;padding:0;display:grid;overflow:hidden}.zeivWW_frame[data-variant=tile]{width:64px;min-width:64px;height:64px;min-height:64px}.zeivWW_frame img{object-fit:cover;width:100%;height:100%;display:block}.zeivWW_loading,.zeivWW_error{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zeivWW_error{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);cursor:pointer;max-width:240px;padding:10px 12px}.zeivWW_error[data-variant=tile]{border-radius:var(--dsw-radius-xl);width:64px;height:64px;padding:4px;overflow:hidden}.zeivWW_frame[data-variant=thumbnail],.zeivWW_error[data-variant=thumbnail]{box-sizing:border-box;border-radius:var(--dsw-radius-lg);place-items:center;width:48px;min-width:48px;height:48px;min-height:48px;padding:2px;display:grid;overflow:hidden}.zeivWW_frame[data-variant=thumbnail] img{object-fit:contain}.zeivWW_spinner{animation:.9s linear infinite zeivWW_spinner-rotate}@keyframes zeivWW_spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.zeivWW_spinner{animation:none}}.zeivWW_frame:focus-visible,.zeivWW_error:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}`,document.head.appendChild(e)}var M={error:`zeivWW_error`,frame:`zeivWW_frame`,gallery:`zeivWW_gallery`,loading:`zeivWW_loading`,spinner:`zeivWW_spinner`,"spinner-rotate":`zeivWW_spinner-rotate`};function N(e){let t=e.width/e.height,n=Math.min(4,Math.max(.25,t)),r=n>=1?{width:240,height:240/n}:{width:240*n,height:240},i=Math.min(1,e.width/r.width,e.height/r.height);return{width:Math.max(1,Math.round(r.width*i)),height:Math.max(1,Math.round(r.height*i)),objectPosition:t<.25?`center top`:t>4?`left center`:`center`}}function P(e){return`attachment`in e?e.attachment:e.preview.width!==void 0&&e.preview.height!==void 0?{width:e.preview.width,height:e.preview.height}:void 0}function F({image:e,load:t,variant:n,labels:o}){let s=`preview`in e?e.preview:void 0,c=`attachment`in e?e.attachment:void 0,[l,u]=(0,r.useState)(()=>c===void 0?null:t.peek?.(c)??null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(),[h,g]=(0,r.useState)(!1),[_,v]=(0,r.useState)(0),y=(0,r.useCallback)(()=>{v(e=>e+1)},[]),b=(0,r.useCallback)(()=>{g(!1)},[]),x=(0,r.useMemo)(()=>P(e),[e]),S=(0,r.useMemo)(()=>{if(n!==`single`)return;let e=p??x;return e===void 0?{width:240,height:240,objectPosition:`center`}:N(e)},[x,p,n]);(0,r.useEffect)(()=>{if(c===void 0)return;let e=!0;return f(null),m(void 0),u(t.peek?.(c)??null),t(c).then(t=>{e&&u(t)}).catch(t=>{if(!e)return;let n=typeof t==`object`&&t&&`details`in t?t.details?.reason:void 0;f(n===`IMAGE_TOO_LARGE`||n===`IMAGE_TOO_MANY_PIXELS`?`too-large`:`unavailable`)}),()=>{e=!1}},[c,t,_]);let C=s?.url??l,w=(`attachment`in e?e.label:void 0)??s?.name??c?.name??o.image,T=n===`thumbnail`&&C===null;return d===`too-large`?/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.error,"data-variant":n,role:`status`,title:o.tooLarge,children:o.tooLarge}):d?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.error,"data-variant":n,title:n===`thumbnail`?o.loadFailed:void 0,"aria-label":n===`thumbnail`?o.loadFailed:void 0,onClick:y,children:n===`thumbnail`?/* @__PURE__ */ (0,a.jsx)(`span`,{"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{})}):o.loadFailed}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.frame,"data-variant":n,style:S===void 0?void 0:{width:S.width,height:S.height},title:T?o.loading:o.open,"aria-label":T?o.loading:o.openNamed(w),"aria-busy":T||void 0,onClick:()=>{C!==null&&g(!0)},children:C===null?/* @__PURE__ */ (0,a.jsx)(`span`,{className:M.loading,"aria-hidden":T||void 0,children:T?/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{className:M.spinner}):o.loading}):/* @__PURE__ */ (0,a.jsx)(`img`,{src:C,alt:w,onLoad:e=>{let{naturalWidth:t,naturalHeight:n}=e.currentTarget;t>0&&n>0&&m(e=>e?.width===t&&e.height===n?e:{width:t,height:n})},onError:()=>f(`unavailable`),style:S===void 0?void 0:{objectPosition:S.objectPosition}})}),h&&C!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:C,alt:w,labels:o.lightbox,onClose:b})]})}function I({images:e,load:t,align:n,compact:r=!1,thumbnail:i=!1,labels:o}){if(e.length===0)return null;let s=i?`thumbnail`:r||e.length>1?`tile`:`single`;return/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.gallery,"data-align":n,children:e.map((e,n)=>/* @__PURE__ */ (0,a.jsx)(F,{image:e,load:t,variant:s,labels:o},`${`attachment`in e?e.attachment.attachmentId:e.preview.url}:${n}`))})}function L({images:e,loadImage:t,align:n,compact:r=!1,thumbnail:i=!1,t:o}){return/* @__PURE__ */ (0,a.jsx)(I,{images:e,load:t,align:n,compact:r,thumbnail:i,labels:S(o)})}let R=[`slots`];function z(e){e.slots.inject(`conversation.input.attachments`,()=>e.slots.register({name:`conversation.input.attachments`,locale:`conversation`},A)),e.slots.inject(`conversation.message.images`,()=>e.slots.register({name:`conversation.message.images`,locale:`conversation`},L)),e.slots.inject(`conversation.trajectory.images`,()=>e.slots.register({name:`conversation.trajectory.images`,locale:`conversation`},L)),e.slots.inject(`tool.call.images`,()=>e.slots.register({name:`tool.call.images`,locale:`conversation`},L))}return n.apply=z,n.inject=R,t.exports}});