@codexhost/cli-linux-arm64 0.22.0 → 0.24.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 (59) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +3117 -274
  4. package/app/console-web.js +15645 -4413
  5. package/app/desktop-controller.mjs +14057 -969
  6. package/app/host-runtime.mjs +11518 -8277
  7. package/app/plugins/antigravity/plugin.mjs +2030 -678
  8. package/app/plugins/claude-code/plugin.mjs +2116 -929
  9. package/app/plugins/codebuddy/plugin.mjs +1247 -353
  10. package/app/plugins/codex-usage/plugin.mjs +786 -163
  11. package/app/plugins/copilot/plugin.mjs +938 -296
  12. package/app/plugins/cursor-cli/plugin.mjs +1021 -232
  13. package/app/plugins/deepseek-harness/plugin.mjs +1552 -664
  14. package/app/plugins/devin/plugin.mjs +826 -185
  15. package/app/plugins/grok/plugin.mjs +1083 -424
  16. package/app/plugins/hermes/plugin.mjs +961 -338
  17. package/app/plugins/kimi-code/plugin.mjs +854 -237
  18. package/app/plugins/kiro-cli/plugin.mjs +821 -184
  19. package/app/plugins/omp/plugin.mjs +1316 -633
  20. package/app/plugins/opencode/plugin.mjs +1293 -606
  21. package/app/plugins/pi/plugin.mjs +1540 -867
  22. package/app/plugins/qoder/plugin.mjs +961 -332
  23. package/app/plugins/qoder-cn/plugin.mjs +961 -332
  24. package/app/plugins/qwen-code/plugin.mjs +937 -321
  25. package/app/plugins/workbuddy/plugin.mjs +1311 -370
  26. package/app/plugins/zcode/plugin.mjs +1516 -423
  27. package/app/renderer-extension.js +21297 -9060
  28. package/app/web/assets/index-CTCFIQbU.css +1 -0
  29. package/app/web/assets/index-IvFk9KT-.js +203 -0
  30. package/app/web/codexhost-settings.js +6753 -31616
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  34. package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +14 -14
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +94 -91
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-browser/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
  50. package/app/web/sw.js +8 -1
  51. package/app/web-modules/licenses/werift-NOTICES.txt +123 -0
  52. package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
  53. package/app/web-modules/server.mjs +40416 -11283
  54. package/bin/codexhost +0 -0
  55. package/libexec/codexhost-shim +0 -0
  56. package/libexec/codexhost-updater +0 -0
  57. package/package.json +1 -1
  58. package/app/web/assets/index-CN4a4sj0.js +0 -201
  59. package/app/web/assets/index-DJW4bmyx.css +0 -1
@@ -1,7 +1,7 @@
1
1
  window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-user-questions`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-store"),i=e("react"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime");function s(e){return e}function c(e,t){try{return e(),Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?e:Error(t,{cause:e}))}}function l(e){if(e.length!==1)return;let t=e[0],n=t.intent;if(n?.kind!==`plan-review`||t.detail===void 0||t.multiSelect===!0)return;let r=t.options??[];if(r.length>2)return;let i=r.find(e=>e.label===n.approve);if(i===void 0)return;let a=r.find(e=>e.label!==n.approve);return{id:t.id,question:t.question,plan:t.detail,...n.callId===void 0?{}:{callId:n.callId},approve:i,...a===void 0?{}:{decline:a}}}let u=Array.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),d=0,f={ASK_ABORTED:`ask_user_question was aborted before the user answered`,ASK_CANCELLED:`the user cancelled ask_user_question`,ASK_TIMED_OUT:`ask_user_question timed out before the user answered`};function p(e){let t=Error(f[e]);return t.name=`UserQuestionError`,t.code=e,t}function m(e,t,n){let r=Promise.withResolvers(),i=Symbol(`pending question delegated`),a=!1,o=e=>{a||(a=!0,t?.removeEventListener(`abort`,s),e(),n(c))},s=()=>{o(()=>{r.reject(p(`ASK_ABORTED`))})},c={deadline:e,resolve:e=>{o(()=>{r.resolve(e)})},reject:e=>{o(()=>{r.reject(p(e))})},delegate:()=>{o(()=>{r.reject(i)})}};return t!==void 0&&(t.addEventListener(`abort`,s,{once:!0}),t.aborted&&s()),{channel:c,result:r.promise,isDelegation:e=>e===i}}var h=class e{kind;key;sessionId;questions;callId;review;dismissal;#e=`open`;#t;#n;#r;#i=!1;#a;#o;#s;#c=!1;#l=!1;#u=!1;#d=!1;#f;#p=/* @__PURE__ */ new Set;#m;constructor(t,n,r,i,a){this.sessionId=t,this.questions=n,this.kind=l(n)===void 0?`question`:`plan-review`,this.callId=r,this.review=a,this.dismissal=r===void 0?`cancel`:`hide`,this.#f=i,r===void 0&&(d+=1),this.key=r===void 0?`question:${u}:${String(d)}`:e.keyOf(t,r),this.#m=this.createSnapshot()}static keyOf(e,t){return`question:${String(e)}:${t}`}liveKeys(){return this.#f?.()??[this.key]}subscribe=e=>(this.#p.add(e),()=>{this.#p.delete(e)});snapshot=()=>this.#m;getSnapshot=this.snapshot;createSnapshot(){let e=this.#t===void 0?this.#e===`continued`&&this.#n!==void 0?`rpc`:`none`:`waterfall`,t=this.#e===`continued`?`continued`:this.#u?`waiting`:this.#l?`editing`:this.#c?`focused`:`counting`;return{state:this.#e,waitState:t,countdown:this.#i?{remainingMs:this.#o===void 0?this.#s??0:Math.max(0,this.#o-Date.now()),running:this.#o!==void 0}:void 0,channel:e,closed:this.#d}}publish(){this.#m=this.createSnapshot(),this.#h();for(let e of this.#p)e()}#h(){let e=this.#o!==void 0&&!this.#d;e!==(this.#a!==void 0)&&(e?this.#a=setInterval(()=>{this.#g()},1e3):(clearInterval(this.#a),this.#a=void 0))}#g(){let e=this.#o;
2
2
  /* v8 ignore next -- #reschedule clears the interval in the same publish that drops the deadline. */
3
- e!==void 0&&(Date.now()>=e?this.timeout():this.publish())}attachWaterfall(e){this.#t=e,this.#i=e.deadline!==void 0,!this.#u&&!this.#l&&(this.#o=e.deadline,this.#c&&e.deadline!==void 0&&(this.#s=Math.max(0,e.deadline-Date.now()),this.#o=void 0)),this.publish()}detachWaterfall(e){this.#t===e&&(this.#t=void 0,this.#i=!1,this.#o=void 0,this.publish())}hasWaterfall(){return this.#t!==void 0}attachRpc(e){this.#n=e,this.publish()}attachSeat(e){this.#r=e}setState(e){this.#e!==e&&(this.#e=e,this.publish())}takeTime(){this.#u||(this.#u=!0,this.#c=!1,this.#s=void 0,this.#o=void 0,this.publish())}holdFocus(e=Date.now()){this.#u||this.#l||this.#c||(this.#s=this.#o===void 0?void 0:Math.max(0,this.#o-e),this.#o=void 0,this.#c=!0,this.publish())}releaseFocus(e=Date.now()){this.#c&&(this.#c=!1,this.#o=this.#i&&this.#s!==void 0?e+this.#s:void 0,this.#s=void 0,this.publish())}engage(e=Date.now()){this.#u||this.#l||(this.#s===void 0&&this.#o!==void 0&&(this.#s=Math.max(0,this.#o-e)),this.#l=!0,this.#c=!1,this.#o=void 0,this.publish())}timeout(){if(this.#u||this.#l||this.#c)return;let e=this.#t;e!==void 0&&(this.#t=void 0,this.#i=!1,this.#o=void 0,e.reject(`ASK_TIMED_OUT`),this.publish())}delegate(){this.#t?.delegate()}close(){this.#d||(this.#d=!0,this.publish())}answer(e){let t=this.#t;if(t!==void 0)return c(()=>{t.resolve(e)},`pending question settlement failed`);let n=this.#n;return this.#e===`continued`&&n!==void 0?n.answer(e).then(e=>{if(!e)throw Error(`this question is no longer answerable`)}):Promise.reject(/* @__PURE__ */ Error(`no channel accepts an answer yet`))}dismiss(){if(this.dismissal===`hide`)return c(()=>{this.#r?.hide()},`pending question hide failed`);let e=this.#t;return e===void 0?Promise.reject(/* @__PURE__ */ Error(`no channel accepts a cancellation yet`)):c(()=>{e.reject(`ASK_CANCELLED`)},`pending question cancellation failed`)}};function g(){return(0,r.defineStore)({init:()=>({progressByRequest:{}}),persist:`dsh.user-questions.drafts.v1`,actions:{replace:(e,t,n)=>{e.progressByRequest[t]=n},clear:(e,t)=>{e.progressByRequest=Object.fromEntries(Object.entries(e.progressByRequest).filter(([e])=>e!==t))},prune:(e,t)=>{let n=new Set(t);e.progressByRequest=Object.fromEntries(Object.entries(e.progressByRequest).filter(([e])=>n.has(e)))}}})}function _(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function v(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=_(e))&&(r&&(r+=` `),r+=t);return r}let y=`@deepseek-ai/dsh-client-ui-user-questions/PlanReviewPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(y)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=y,e.textContent=`.dPwGnq_frame{padding:6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;justify-content:center;display:flex}.dPwGnq_card{width:100%;max-width:var(--dsh-chat-content-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;display:flex;overflow:hidden}.dPwGnq_card,.dPwGnq_card *{box-sizing:border-box}.dPwGnq_strip{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-primary);flex-shrink:0;align-items:center;gap:8px;padding:12px 16px;font-size:14px;line-height:20px;display:flex}.dPwGnq_footer{flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:8px 16px 12px;display:flex}.dPwGnq_feedback{min-height:16px;color:var(--dsw-alias-state-error-primary);font-size:11px;line-height:16px}.dPwGnq_actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.dPwGnq_summary{min-width:0;padding:14px 16px 12px}.dPwGnq_title{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:500;line-height:22px;overflow:hidden}.dPwGnq_description{-webkit-line-clamp:2;color:var(--dsw-alias-label-secondary);-webkit-box-orient:vertical;margin:8px 0 0;font-size:14px;line-height:24px;display:-webkit-box;overflow:hidden}.dPwGnq_discuss{gap:6px}@media (width<=720px){.dPwGnq_card{border-radius:var(--dsw-radius-xl)}.dPwGnq_footer{align-items:flex-end;padding:8px 12px 10px}}.dPwGnq_previewActions{align-items:center;margin-left:auto;display:flex}`,document.head.appendChild(e)}var b={actions:`dPwGnq_actions`,card:`dPwGnq_card`,description:`dPwGnq_description`,discuss:`dPwGnq_discuss`,feedback:`dPwGnq_feedback`,footer:`dPwGnq_footer`,frame:`dPwGnq_frame`,previewActions:`dPwGnq_previewActions`,strip:`dPwGnq_strip`,summary:`dPwGnq_summary`,title:`dPwGnq_title`};function x(e){return e===void 0?{}:{title:e}}function S({pending:e,review:t,t:n,renderSlot:r}){let[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(null),d=(t,r=!1)=>{c(!0),u(null),t().then(()=>{r&&(c(!1),e.dismiss().catch(()=>{u(n(`status.sent`))}))}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},f=n=>{d(()=>e.answer({answers:[{id:t.id,selected:[n]}]}),e.snapshot().channel===`rpc`)},p=(0,i.useMemo)(()=>{let e=(0,a.extractMarkdownPlainText)(t.plan,{mode:`first-line`}),n=(0,a.extractMarkdownPlainText)(t.plan,{mode:`first-paragraph`});return{title:e,description:n===e?``:n}},[t.plan]);return/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.frame,"data-plan-review-key":e.key,children:/* @__PURE__ */ (0,o.jsxs)(`section`,{className:b.card,"aria-label":t.question,"aria-busy":s,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.strip,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:s?`ongoing`:`warning`}),n(`plan.header`),/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.previewActions,children:r(`conversation.plan-review.actions`,{review:t,requestKey:e.key})})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.summary,children:[/* @__PURE__ */ (0,o.jsx)(`h3`,{className:b.title,children:p.title}),p.description!==``&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:b.description,children:p.description})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.footer,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.feedback,role:`status`,children:l}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.actions,children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:b.discuss,icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{size:14}),disabled:s,onClick:()=>{d(()=>e.dismiss())},children:n(`plan.discuss`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,...x(t.approve.description),disabled:s,onClick:()=>{f(t.approve.label)},children:n(`plan.approve`)})]})]})]})})}let C=`@deepseek-ai/dsh-client-ui-user-questions/QuestionComposer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(C)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=C,e.textContent=`.Tq3z5G_frame{padding:6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;justify-content:center;display:flex}.Tq3z5G_card{width:100%;max-width:var(--dsh-chat-content-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-input-major);min-width:0;max-height:min(60vh,520px);box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-primary);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;padding:0;display:flex;overflow:hidden}.Tq3z5G_card,.Tq3z5G_card *{box-sizing:border-box}.Tq3z5G_cardMinimized{max-height:none}.Tq3z5G_cardMinimized .Tq3z5G_header{padding-bottom:16px}.Tq3z5G_headerActions{flex-shrink:0;align-items:center;gap:4px;display:flex}.Tq3z5G_waitButton{white-space:nowrap}.Tq3z5G_waitStatus{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:12px;line-height:24px}.Tq3z5G_header{flex-shrink:0;justify-content:space-between;align-items:flex-start;gap:16px;padding:16px 16px 0 20px;display:flex}.Tq3z5G_headingBlock{overflow-wrap:anywhere;min-width:0}.Tq3z5G_eyebrow{color:var(--dsw-alias-label-tertiary);margin-bottom:4px;font-size:11px;line-height:16px}.Tq3z5G_title{margin:0;font-size:16px;font-weight:500;line-height:22px}.Tq3z5G_detail{overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);min-width:0;max-height:min(24vh,160px);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;flex-shrink:0;margin:12px 20px 4px;padding:10px 12px;font-size:13px;line-height:20px;overflow-y:auto}.Tq3z5G_detail pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}.Tq3z5G_footerActions{flex-shrink:0;align-items:center;gap:8px;margin-left:auto;display:flex}.Tq3z5G_pager{flex-shrink:0;align-items:center;gap:2px;display:flex}.Tq3z5G_progress{color:var(--dsw-alias-label-secondary);white-space:nowrap;word-spacing:-2px;padding:0 4px;font-size:12px;font-weight:400;line-height:24px}.Tq3z5G_iconButton{corner-shape:round;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;place-items:center;padding:0;display:grid}.Tq3z5G_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.Tq3z5G_iconButton:focus-visible,.Tq3z5G_detail:focus-visible,.Tq3z5G_option:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.Tq3z5G_iconButton:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.Tq3z5G_body{overscroll-behavior:contain;flex-direction:column;flex:auto;min-height:0;display:flex;overflow-y:auto}.Tq3z5G_options{flex-direction:column;gap:6px;margin:12px 0;padding:2px 20px;display:flex}.Tq3z5G_option{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);width:100%;min-height:44px;color:inherit;text-align:left;cursor:pointer;background:0 0;flex-shrink:0;align-items:flex-start;gap:8px;padding:9px 12px;transition:background-color .12s,border-color .12s;display:flex}.Tq3z5G_option:hover:not(:disabled),.Tq3z5G_optionSelected{background:var(--dsw-alias-interactive-bg-hover)}.Tq3z5G_optionSelected{border-color:var(--dsw-alias-label-secondary)}.Tq3z5G_optionSelected .Tq3z5G_number{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-label-primary-foreground)}.Tq3z5G_option:disabled{cursor:default}.Tq3z5G_number{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-overlay);width:20px;height:20px;color:var(--dsw-alias-label-secondary);flex:0 0 20px;place-items:center;margin-top:2px;font-size:12px;font-weight:500;line-height:18px;display:grid}.Tq3z5G_checkbox{flex:0 0 20px;place-items:center;width:20px;height:20px;margin-top:2px;display:grid}.Tq3z5G_checkbox:before{content:"";border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-xs);grid-area:1/1;width:14px;height:14px;transition:background-color .12s,border-color .12s}.Tq3z5G_checkbox>svg{grid-area:1/1}.Tq3z5G_checkboxChecked{color:var(--dsw-alias-label-primary-foreground)}.Tq3z5G_checkboxChecked:before{border-color:var(--dsw-alias-label-primary);background:var(--dsw-alias-label-primary)}.Tq3z5G_optionCopy{overflow-wrap:anywhere;flex:1;min-width:0}.Tq3z5G_optionLine{flex-wrap:wrap;align-items:baseline;gap:2px 6px;display:flex}.Tq3z5G_optionLabel{font-size:14px;font-weight:500;line-height:24px}.Tq3z5G_badge{border-radius:var(--dsw-radius-xs);background:var(--dsw-specific-sidebar-nav-item-active-accent);color:var(--dsw-alias-button-info-fill);padding:0 4px;font-size:11px;font-weight:600;line-height:18px}.Tq3z5G_description{color:var(--dsw-alias-label-tertiary);flex-basis:100%;font-size:14px;font-weight:400;line-height:24px}.Tq3z5G_reviewNote{color:var(--dsw-alias-label-tertiary);margin:0;padding:8px 12px;font-size:14px;line-height:24px}.Tq3z5G_customRow{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);flex-shrink:0;align-items:flex-start;gap:8px;width:100%;min-height:44px;padding:9px 12px;transition:background-color .12s,border-color .12s;display:flex}.Tq3z5G_customRow:hover,.Tq3z5G_customRow:focus-within,.Tq3z5G_customRowActive{background:var(--dsw-alias-interactive-bg-hover)}.Tq3z5G_customRow:focus-within,.Tq3z5G_customRowActive{border-color:var(--dsw-alias-border-l2)}.Tq3z5G_field{--dsh-answer-field-padding:0;min-width:0;display:grid}.Tq3z5G_field>*{min-width:0;padding:var(--dsh-answer-field-padding);font:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;grid-area:1/1;font-size:14px;line-height:24px}.Tq3z5G_fieldMirror{box-sizing:content-box;visibility:hidden;max-height:144px;overflow:hidden}.Tq3z5G_fieldInput{resize:none;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);background:0 0;border:none;outline:none;overflow-y:auto}.Tq3z5G_fieldInput::placeholder{color:var(--dsw-alias-label-caption)}.Tq3z5G_customInline{flex:1}.Tq3z5G_customBlock{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);--dsh-answer-field-padding:8px 12px;flex-shrink:0;min-height:64px;margin:0}.Tq3z5G_customBlock:focus-within{border-color:var(--dsw-alias-state-business-primary)}.Tq3z5G_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px 12px;padding:10px 16px;display:flex}.Tq3z5G_feedback{min-width:0;color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;flex-basis:100%;order:-1;font-size:11px;line-height:16px}.Tq3z5G_feedback:empty{display:none}@media (width<=720px){.Tq3z5G_card{border-radius:var(--dsw-radius-xl)}.Tq3z5G_header{gap:8px;padding:14px 12px 0 16px}.Tq3z5G_options{padding:2px 16px}.Tq3z5G_title{font-size:15px;line-height:21px}.Tq3z5G_option,.Tq3z5G_customRow{padding:9px 10px}.Tq3z5G_detail{margin-left:16px;margin-right:16px}.Tq3z5G_footer{padding:10px 12px}.Tq3z5G_footerActions{flex-shrink:0}}@media (prefers-reduced-motion:reduce){.Tq3z5G_option,.Tq3z5G_customRow{transition:none}}`,document.head.appendChild(e)}var w={badge:`Tq3z5G_badge`,body:`Tq3z5G_body`,card:`Tq3z5G_card`,cardMinimized:`Tq3z5G_cardMinimized`,checkbox:`Tq3z5G_checkbox`,checkboxChecked:`Tq3z5G_checkboxChecked`,customBlock:`Tq3z5G_customBlock`,customInline:`Tq3z5G_customInline`,customRow:`Tq3z5G_customRow`,customRowActive:`Tq3z5G_customRowActive`,description:`Tq3z5G_description`,detail:`Tq3z5G_detail`,eyebrow:`Tq3z5G_eyebrow`,feedback:`Tq3z5G_feedback`,field:`Tq3z5G_field`,fieldInput:`Tq3z5G_fieldInput`,fieldMirror:`Tq3z5G_fieldMirror`,footer:`Tq3z5G_footer`,footerActions:`Tq3z5G_footerActions`,frame:`Tq3z5G_frame`,header:`Tq3z5G_header`,headerActions:`Tq3z5G_headerActions`,headingBlock:`Tq3z5G_headingBlock`,iconButton:`Tq3z5G_iconButton`,number:`Tq3z5G_number`,option:`Tq3z5G_option`,optionCopy:`Tq3z5G_optionCopy`,optionLabel:`Tq3z5G_optionLabel`,optionLine:`Tq3z5G_optionLine`,optionSelected:`Tq3z5G_optionSelected`,options:`Tq3z5G_options`,pager:`Tq3z5G_pager`,progress:`Tq3z5G_progress`,reviewNote:`Tq3z5G_reviewNote`,title:`Tq3z5G_title`,waitButton:`Tq3z5G_waitButton`,waitStatus:`Tq3z5G_waitStatus`};let T={state:`open`,waitState:`counting`,countdown:void 0,channel:`none`,closed:!0};function E(e){let t=/\s*(?:\((?:recommended|推荐)\)|((?:recommended|推荐)))\s*$/i;return t.test(e)?{label:e.replace(t,``),recommended:!0}:{label:e,recommended:!1}}function ee(e){let t=e.options?.[0]?.label;return t!==void 0&&E(t).recommended?t:void 0}function te(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let n=e;return typeof n.index!=`number`||!Number.isInteger(n.index)||n.index<0||n.index>=t||!Array.isArray(n.drafts)||n.drafts.length!==t||n.wait!==void 0&&n.wait!==`editing`&&n.wait!==`waiting`?!1:n.drafts.every(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return Array.isArray(t.selected)&&t.selected.every(e=>typeof e==`string`)&&typeof t.custom==`string`&&typeof t.skipped==`boolean`})}function ne(e){return e.nativeEvent.isComposing||Reflect.get(e.nativeEvent,`keyCode`)===229}function D(e){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:v(w.field,e.variant===`inline`?w.customInline:w.customBlock),children:[/* @__PURE__ */ (0,o.jsx)(`div`,{"aria-hidden":!0,className:w.fieldMirror,children:`${e.value}\n`}),/* @__PURE__ */ (0,o.jsx)(`textarea`,{autoFocus:e.autoFocus,className:w.fieldInput,value:e.value,disabled:e.disabled,rows:1,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e.onChange,onKeyDown:e.onKeyDown})]})}function O(e){let t=e.matched,n=(0,i.useMemo)(()=>l(t.questions),[t]);return n===void 0?/* @__PURE__ */ (0,o.jsx)(k,{pending:t,t:e.t,useStore:e.useStore,useQuestionCard:e.useQuestionCard,actions:e.actions},t.key):/* @__PURE__ */ (0,o.jsx)(S,{pending:t,review:n,t:e.t,renderSlot:e.renderSlot},t.key)}function k({pending:e,t,useStore:n,useQuestionCard:r,actions:s}){let c=e.questions,l=e.review,u=(0,i.useMemo)(()=>({code:{copyLabel:t(`copy`),copiedLabel:t(`copied`),toolbarLabels:{codeLabel:t(`codeBlock.title`),wrapLabel:t(`codeBlock.wrap`),unwrapLabel:t(`codeBlock.unwrap`)}},footnotes:t(`markdown.footnotes`)}),[t]),d=(0,i.useMemo)(()=>{let e=new Map((l??[]).map(e=>[e.id,e]));return c.map(t=>{let n=e.get(t.id),r=n?.custom??``,i=l===void 0?ee(t):void 0;return{selected:n===void 0&&i!==void 0?[i]:[...n?.selected??[]],custom:r,skipped:n!==void 0&&n.selected.length===0&&r===``}})},[c,l]),f=n(t=>t.progressByRequest[e.key]),p=te(f,c.length)?f:void 0,m=l===void 0?p:void 0,h=p?.index??0,g=m?.drafts??d,_=m?.wait??(m?.drafts.some((e,t)=>e.selected.length!==d[t]?.selected.length||e.selected.some((e,n)=>e!==d[t]?.selected[n])||e.custom!==``||e.skipped)===!0?`editing`:void 0),[y,b]=(0,i.useState)(null),[x,S]=(0,i.useState)(null),C=r(e.key,e=>e??T),O=C.channel!==`none`,k=y!==null||l!==void 0,A=(0,i.useRef)(null);(0,i.useEffect)(()=>{A.current===`waterfall`&&C.state===`continued`&&(A.current=null,b(null),S({key:`error.resubmit`}))},[C.state]),(0,i.useEffect)(()=>{C.closed&&s.clear(e.key)},[s,C.closed,e.key]),(0,i.useEffect)(()=>{s.prune(e.liveKeys())},[s,e]);let j=(0,i.useRef)(_);(0,i.useEffect)(()=>{j.current===`waiting`&&e.takeTime(),j.current===`editing`&&e.engage()},[e]);let M=C.countdown,[N,P]=(0,i.useState)(!1),F=(0,i.useRef)(/* @__PURE__ */ new Set),I=(0,i.useRef)(null),L=c[h],R=g[h],z=(L.options?.length??0)>0,B=(t,n)=>{s.replace(e.key,{index:t,drafts:n,...j.current===void 0?{}:{wait:j.current}})},V=()=>{j.current=`waiting`,e.takeTime(),B(h,g)},H=()=>{j.current===void 0&&(j.current=`editing`,e.engage())},U=t=>{t.currentTarget.contains(t.relatedTarget)||e.holdFocus()},W=t=>{t.currentTarget.contains(t.relatedTarget)||e.releaseFocus()};(0,i.useEffect)(()=>{let t=()=>{e.releaseFocus()},n=()=>{j.current===`editing`?e.engage():I.current?.contains(document.activeElement)===!0&&e.holdFocus()},r=()=>{document.hidden?t():n()};return window.addEventListener(`blur`,t),window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,r),()=>{t(),window.removeEventListener(`blur`,t),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}},[e]);let G=()=>{e.dismissal===`hide`?e.dismiss():O?(b(`cancel`),S(null),A.current=`waterfall`,e.dismiss().catch(e=>{A.current=null,b(null),S({text:e instanceof Error?e.message:String(e)})})):S({key:`error.unavailable`})},K=(e,t=h)=>{H();let n=g.map((t,n)=>n===h?e(t):t);B(t,n),S(null)},q=e=>{K(t=>{if(L.multiSelect===!0){let n=t.selected.includes(e)?t.selected.filter(t=>t!==e):[...t.selected,e];return{...t,selected:n,skipped:!1}}return{selected:[e],custom:``,skipped:!1}},L.multiSelect!==!0&&h<c.length-1?h+1:h)},J=e=>e.selected.length>0||e.custom.trim()!==``,Y=e=>J(e)||e.skipped,X=t=>{let n=t.findIndex(e=>!Y(e));if(n>=0){B(n,t),S({key:`error.incomplete`});return}if(!O){S({key:`error.unavailable`});return}let r={answers:c.map((e,n)=>{let r=t[n];if(r.skipped)return{id:e.id,selected:[]};let i=r.custom.trim();return{id:e.id,selected:i===``||e.multiSelect===!0?r.selected:[],...i===``?{}:{custom:i}}})};b(`answer`),S(null);let i=e.snapshot().channel;A.current=i===`waterfall`?`waterfall`:null,e.answer(r).then(()=>{i===`rpc`&&(A.current=null,b(null),S(null),e.dismiss().catch(()=>{S({key:`status.sent`})}))}).catch(e=>{A.current=null,b(null),S({text:e instanceof Error?e.message:String(e)})})},Z=()=>{J(R)?h<c.length-1?(B(h+1,g),S(null)):X(g):S({key:`error.unanswered`})},Q=e=>{let t=e.target.value;K(e=>({...e,selected:L.multiSelect===!0?e.selected:[],custom:t,skipped:!1}))},$=e=>{e.key!==`Enter`||e.shiftKey||ne(e)||(e.preventDefault(),Z())};return/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.frame,"data-question-key":e.key,children:/* @__PURE__ */ (0,o.jsxs)(`section`,{className:v(w.card,N&&w.cardMinimized),"aria-labelledby":`question-${e.key}-${String(h)}`,children:[/* @__PURE__ */ (0,o.jsxs)(`header`,{className:w.header,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.headingBlock,children:[L.header!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.eyebrow,children:L.header}),/* @__PURE__ */ (0,o.jsx)(`h2`,{className:w.title,id:`question-${e.key}-${String(h)}`,children:L.question})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.headerActions,children:[M!==void 0&&C.waitState!==`waiting`&&C.waitState!==`editing`&&C.waitState!==`continued`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(M.running?`wait.countdown`:`wait.paused`,{seconds:Math.ceil(M.remainingMs/1e3)})}),M!==void 0&&C.waitState!==`waiting`&&C.waitState!==`editing`&&C.waitState!==`continued`&&/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:w.waitButton,onClick:V,children:t(`wait.takeTime`)}),C.state===`continued`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`wait.continued`)}),M!==void 0&&(C.waitState===`waiting`||C.waitState===`editing`)&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`wait.held`)}),l!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`review.status`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(N?`nav.maximize`:`nav.minimize`),title:t(N?`nav.maximize`:`nav.minimize`),"aria-expanded":!N,disabled:y!==null,onClick:()=>{P(e=>!e)},children:N?/* @__PURE__ */ (0,o.jsx)(a.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(e.dismissal===`hide`?`nav.close`:`nav.cancel`),title:t(e.dismissal===`hide`?`nav.close`:`nav.cancel`),disabled:y!==null,onClick:G,children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseOutlineRegular,{})})]})]}),!N&&/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:I,className:w.body,"data-question-scroll":!0,onFocusCapture:U,onBlurCapture:W,children:[L.detail!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.detail,tabIndex:0,children:/* @__PURE__ */ (0,o.jsx)(a.MarkdownText,{text:L.detail,labels:u})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.options,role:L.multiSelect===!0?`group`:`radiogroup`,children:[(L.options??[]).map((e,n)=>{let r=R.selected.includes(e.label),i=E(e.label);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:v(w.option,r&&w.optionSelected),role:L.multiSelect===!0?`checkbox`:`radio`,"aria-checked":r,"aria-label":i.label,disabled:k,onClick:()=>{q(e.label)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),X(g))},children:[L.multiSelect===!0?/* @__PURE__ */ (0,o.jsx)(`span`,{className:v(w.checkbox,r&&w.checkboxChecked),"aria-hidden":`true`,children:r&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:12})}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.number,children:n+1}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.optionCopy,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:w.optionLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.optionLabel,children:i.label}),i.recommended&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.badge,children:t(`option.recommended`)}),e.description!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.description,children:e.description})]})})]},`${e.label}-${String(n)}`)}),l!==void 0&&R.skipped&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:w.reviewNote,children:t(`review.skipped`)}),(!z||L.allowOther!==!1)&&(l===void 0||R.custom!==``)&&(z?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:v(w.customRow,R.custom!==``&&w.customRowActive),children:[L.multiSelect===!0?/* @__PURE__ */ (0,o.jsx)(`span`,{className:v(w.checkbox,R.custom!==``&&w.checkboxChecked),"aria-hidden":`true`,children:R.custom!==``&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:12})}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.number,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{size:12})}),/* @__PURE__ */ (0,o.jsx)(D,{variant:`inline`,value:R.custom,disabled:k,placeholder:t(`custom.placeholder`),onChange:Q,onKeyDown:$})]}):/* @__PURE__ */ (0,o.jsx)(D,{autoFocus:O&&M===void 0&&!k&&!F.current.has(h),variant:`block`,value:R.custom,disabled:k,placeholder:t(`custom.placeholder`),onFocus:()=>{F.current.add(h)},onChange:Q,onKeyDown:$}))]})]}),/* @__PURE__ */ (0,o.jsxs)(`footer`,{className:w.footer,children:[c.length>1&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.pager,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(`nav.prev`),disabled:h===0||y!==null,onClick:()=>{B(h-1,g),S(null)},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:w.progress,children:[h+1,` / `,c.length]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(`nav.next`),disabled:h===c.length-1||y!==null,onClick:()=>{B(h+1,g),S(null)},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{})})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.feedback,role:`status`,children:x===null?null:`key`in x?t(x.key):x.text}),l===void 0&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.footerActions,children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`ghost`,disabled:y!==null,onClick:()=>{H();let e=g.map((e,t)=>t===h?{selected:[],custom:``,skipped:!0}:e);B(h<c.length-1?h+1:h,e),S(null),!(h<c.length-1)&&X(e)},children:t(`action.skip`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:y!==null||!J(R)||h===c.length-1&&!O,onClick:Z,children:y===`answer`?t(`submitting`):h===c.length-1?t(`submit`):t(`action.next`)})]})]})]})]})})}let A=/* @__PURE__ */ new Set([`system/message`,`developer/message`,`user/message`,`assistant/message`,`tool/result`]);function j(e){return A.has(e.type)?e.surfaceOp!==void 0:!1}function M(e){return j(e)&&e.surfaceOp===`append`}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){let t;try{t=JSON.parse(e)}catch{return{questions:[],answers:[]}}if(!N(t)||!Array.isArray(t.questions))return{questions:[],answers:[]};let n=[];for(let e of t.questions)N(e)&&typeof e.id==`string`&&typeof e.question==`string`&&n.push({id:e.id,question:e.question,...typeof e.detail==`string`?{detail:e.detail}:{},...typeof e.header==`string`?{header:e.header}:{},...Array.isArray(e.options)?{options:e.options.flatMap(e=>!N(e)||typeof e.label!=`string`?[]:[{label:e.label,...typeof e.description==`string`?{description:e.description}:{}}])}:{},...typeof e.multiSelect==`boolean`?{multiSelect:e.multiSelect}:{}});let r=[];for(let e of Array.isArray(t.answers)?t.answers:[])N(e)&&typeof e.id==`string`&&Array.isArray(e.selected)&&r.push({id:e.id,selected:e.selected.filter(e=>typeof e==`string`),...typeof e.custom==`string`?{custom:e.custom}:{}});return{questions:n,answers:r}}function F(e,t){let n=e.answers.find(e=>e.id===t),r=n?.custom?.trim()??``;return[...n?.selected??[],...r===``?[]:[r]]}function I(e,t){return e.questions.length===0?e.text:e.questions.map(n=>{let r=F(e,n.id);return`${n.header&&n.header!==n.question?`${n.header} — ${n.question}`:n.question}\n${r.length===0?t(`reply.skipped`):`${t(`reply.answerLabel`)}${r.join(`, `)}`}`}).join(`
3
+ e!==void 0&&(Date.now()>=e?this.timeout():this.publish())}attachWaterfall(e){this.#t=e,this.#i=e.deadline!==void 0,!this.#u&&!this.#l&&(this.#o=e.deadline,this.#c&&e.deadline!==void 0&&(this.#s=Math.max(0,e.deadline-Date.now()),this.#o=void 0)),this.publish()}detachWaterfall(e){this.#t===e&&(this.#t=void 0,this.#i=!1,this.#o=void 0,this.publish())}hasWaterfall(){return this.#t!==void 0}attachRpc(e){this.#n=e,this.publish()}attachSeat(e){this.#r=e}setState(e){this.#e!==e&&(this.#e=e,this.publish())}takeTime(){this.#u||(this.#u=!0,this.#c=!1,this.#s=void 0,this.#o=void 0,this.publish())}holdFocus(e=Date.now()){this.#u||this.#l||this.#c||(this.#s=this.#o===void 0?void 0:Math.max(0,this.#o-e),this.#o=void 0,this.#c=!0,this.publish())}releaseFocus(e=Date.now()){this.#c&&(this.#c=!1,this.#o=this.#i&&this.#s!==void 0?e+this.#s:void 0,this.#s=void 0,this.publish())}engage(e=Date.now()){this.#u||this.#l||(this.#s===void 0&&this.#o!==void 0&&(this.#s=Math.max(0,this.#o-e)),this.#l=!0,this.#c=!1,this.#o=void 0,this.publish())}timeout(){if(this.#u||this.#l||this.#c)return;let e=this.#t;e!==void 0&&(this.#t=void 0,this.#i=!1,this.#o=void 0,e.reject(`ASK_TIMED_OUT`),this.publish())}delegate(){this.#t?.delegate()}close(){this.#d||(this.#d=!0,this.publish())}answer(e){let t=this.#t;if(t!==void 0)return c(()=>{t.resolve(e)},`pending question settlement failed`);let n=this.#n;return this.#e===`continued`&&n!==void 0?n.answer(e).then(e=>{if(!e)throw Error(`this question is no longer answerable`)}):Promise.reject(/* @__PURE__ */ Error(`no channel accepts an answer yet`))}dismiss(){if(this.dismissal===`hide`)return c(()=>{this.#r?.hide()},`pending question hide failed`);let e=this.#t;return e===void 0?Promise.reject(/* @__PURE__ */ Error(`no channel accepts a cancellation yet`)):c(()=>{e.reject(`ASK_CANCELLED`)},`pending question cancellation failed`)}};function g(){return(0,r.defineStore)({init:()=>({progressByRequest:{}}),persist:`dsh.user-questions.drafts.v1`,actions:{replace:(e,t,n)=>{e.progressByRequest[t]=n},clear:(e,t)=>{e.progressByRequest=Object.fromEntries(Object.entries(e.progressByRequest).filter(([e])=>e!==t))},prune:(e,t)=>{let n=new Set(t);e.progressByRequest=Object.fromEntries(Object.entries(e.progressByRequest).filter(([e])=>n.has(e)))}}})}function _(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function v(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=_(e))&&(r&&(r+=` `),r+=t);return r}let y=`@deepseek-ai/dsh-client-ui-user-questions/PlanReviewPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(y)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=y,e.textContent=`.dPwGnq_frame{padding:6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;justify-content:center;display:flex}.dPwGnq_card{width:100%;max-width:var(--dsh-chat-content-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;display:flex;overflow:hidden}.dPwGnq_card,.dPwGnq_card *{box-sizing:border-box}.dPwGnq_strip{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-primary);flex-shrink:0;align-items:center;gap:8px;padding:12px 16px;font-size:14px;line-height:20px;display:flex}.dPwGnq_footer{flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:8px 16px 12px;display:flex}.dPwGnq_feedback{min-height:16px;color:var(--dsw-alias-state-error-primary);font-size:11px;line-height:16px}.dPwGnq_actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.dPwGnq_summary{min-width:0;padding:14px 16px 12px}.dPwGnq_title{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:500;line-height:22px;overflow:hidden}.dPwGnq_description{-webkit-line-clamp:2;color:var(--dsw-alias-label-secondary);-webkit-box-orient:vertical;margin:8px 0 0;font-size:14px;line-height:24px;display:-webkit-box;overflow:hidden}.dPwGnq_discuss{gap:6px}@media (width<=720px){.dPwGnq_card{border-radius:var(--dsw-radius-xl)}.dPwGnq_footer{align-items:flex-end;padding:8px 12px 10px}}.dPwGnq_previewActions{align-items:center;margin-left:auto;display:flex}`,document.head.appendChild(e)}var b={actions:`dPwGnq_actions`,card:`dPwGnq_card`,description:`dPwGnq_description`,discuss:`dPwGnq_discuss`,feedback:`dPwGnq_feedback`,footer:`dPwGnq_footer`,frame:`dPwGnq_frame`,previewActions:`dPwGnq_previewActions`,strip:`dPwGnq_strip`,summary:`dPwGnq_summary`,title:`dPwGnq_title`};function x(e){return e===void 0?{}:{title:e}}function S({pending:e,review:t,t:n,renderSlot:r}){let[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(null),d=(t,r=!1)=>{c(!0),u(null),t().then(()=>{r&&(c(!1),e.dismiss().catch(()=>{u(n(`status.sent`))}))}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},f=n=>{d(()=>e.answer({answers:[{id:t.id,selected:[n]}]}),e.snapshot().channel===`rpc`)},p=(0,i.useMemo)(()=>{let e=(0,a.extractMarkdownPlainText)(t.plan,{mode:`first-line`}),n=(0,a.extractMarkdownPlainText)(t.plan,{mode:`first-paragraph`});return{title:e,description:n===e?``:n}},[t.plan]);return/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.frame,"data-plan-review-key":e.key,children:/* @__PURE__ */ (0,o.jsxs)(`section`,{className:b.card,"aria-label":t.question,"aria-busy":s,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.strip,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:s?`ongoing`:`warning`}),n(`plan.header`),/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.previewActions,children:r(`conversation.plan-review.actions`,{review:t,requestKey:e.key})})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.summary,children:[/* @__PURE__ */ (0,o.jsx)(`h3`,{className:b.title,children:p.title}),p.description!==``&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:b.description,children:p.description})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.footer,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:b.feedback,role:`status`,children:l}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:b.actions,children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:b.discuss,icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{size:14}),disabled:s,onClick:()=>{d(()=>e.dismiss())},children:n(`plan.discuss`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,...x(t.approve.description),disabled:s,onClick:()=>{f(t.approve.label)},children:n(`plan.approve`)})]})]})]})})}let C=`@deepseek-ai/dsh-client-ui-user-questions/QuestionComposer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(C)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=C,e.textContent=`.Tq3z5G_frame{padding:6px calc(var(--dsh-composer-side-clearance) + 16px) 10px;justify-content:center;display:flex}.Tq3z5G_card{width:100%;max-width:var(--dsh-chat-content-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-input-major);min-width:0;max-height:min(60dvh,520px);box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-primary);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;padding:0;display:flex;overflow:hidden}.Tq3z5G_card,.Tq3z5G_card *{box-sizing:border-box}.Tq3z5G_topBar{flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px 12px;padding:12px 16px 4px 20px;display:flex}.Tq3z5G_cardMinimized .Tq3z5G_topBar{padding-bottom:14px}.Tq3z5G_topBarLeading{flex-direction:column;flex:1 1 0;gap:2px;min-width:0;display:flex}.Tq3z5G_eyebrow{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;line-height:16px;overflow:hidden}.Tq3z5G_minimizedTitle{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:500;line-height:21px;overflow:hidden}.Tq3z5G_statusGroup{flex-shrink:0;align-items:center;gap:8px;display:flex}.Tq3z5G_iconActions{flex-shrink:0;align-items:center;gap:4px;display:flex}.Tq3z5G_waitButton{white-space:nowrap;touch-action:manipulation;user-select:none;-webkit-tap-highlight-color:transparent}.Tq3z5G_waitStatus{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:12px;line-height:20px}.Tq3z5G_scrollArea{overscroll-behavior:contain;flex:auto;min-height:0;overflow-y:auto}.Tq3z5G_scrollArea:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.Tq3z5G_body{flex-direction:column;display:flex}.Tq3z5G_promptBlock{flex-direction:column;padding:2px 20px 0;display:flex}.Tq3z5G_promptContent{overflow-wrap:anywhere;min-width:0;position:relative}.Tq3z5G_title{margin:0;font-size:16px;font-weight:500;line-height:22px}.Tq3z5G_detail{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);min-width:0;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin-top:10px;padding:10px 12px;font-size:13px;line-height:20px}.Tq3z5G_detail pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}.Tq3z5G_promptToggle{corner-shape:round;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-state-business-primary);font:inherit;cursor:pointer;touch-action:manipulation;user-select:none;-webkit-tap-highlight-color:transparent;border:0;border-radius:999px;align-self:flex-start;align-items:center;gap:4px;margin-top:6px;padding:4px 10px;font-size:12px;font-weight:500;line-height:18px;transition:background-color .12s;display:inline-flex}.Tq3z5G_promptToggle:active{background:var(--dsw-alias-interactive-bg-active)}.Tq3z5G_promptToggle:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.Tq3z5G_footerActions{flex-shrink:0;align-items:center;gap:8px;margin-left:auto;display:flex}.Tq3z5G_pager{flex-shrink:0;align-items:center;gap:2px;display:flex}.Tq3z5G_progress{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-variant-numeric:tabular-nums;word-spacing:-2px;padding:0 4px;font-size:12px;font-weight:400;line-height:24px}.Tq3z5G_iconButton{corner-shape:round;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;touch-action:manipulation;user-select:none;-webkit-tap-highlight-color:transparent;background:0 0;border:none;border-radius:999px;place-items:center;padding:0;transition:background-color .12s,color .12s;display:grid}.Tq3z5G_iconButton:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary)}.Tq3z5G_iconButton:focus-visible,.Tq3z5G_option:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.Tq3z5G_iconButton:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.Tq3z5G_options{flex-direction:column;gap:6px;margin:12px 0;padding:2px 20px;display:flex}.Tq3z5G_option{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);width:100%;min-height:44px;color:inherit;text-align:left;cursor:pointer;touch-action:manipulation;user-select:none;-webkit-tap-highlight-color:transparent;background:0 0;flex-shrink:0;align-items:flex-start;gap:8px;padding:9px 12px;transition:background-color .12s,border-color .12s,transform .1s;display:flex}.Tq3z5G_optionSelected{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-label-secondary)}.Tq3z5G_option:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}.Tq3z5G_optionSelected .Tq3z5G_number{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-label-primary-foreground)}.Tq3z5G_option:disabled{cursor:default}.Tq3z5G_number{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-overlay);width:20px;height:20px;color:var(--dsw-alias-label-secondary);flex:0 0 20px;place-items:center;margin-top:2px;font-size:12px;font-weight:500;line-height:18px;display:grid}.Tq3z5G_checkbox{flex:0 0 20px;place-items:center;width:20px;height:20px;margin-top:2px;display:grid}.Tq3z5G_checkbox:before{content:"";border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-xs);grid-area:1/1;width:14px;height:14px;transition:background-color .12s,border-color .12s}.Tq3z5G_checkbox>svg{grid-area:1/1}.Tq3z5G_checkboxChecked{color:var(--dsw-alias-label-primary-foreground)}.Tq3z5G_checkboxChecked:before{border-color:var(--dsw-alias-label-primary);background:var(--dsw-alias-label-primary)}.Tq3z5G_optionCopy{overflow-wrap:anywhere;flex:1;min-width:0}.Tq3z5G_optionLine{flex-wrap:wrap;align-items:baseline;gap:2px 6px;display:flex}.Tq3z5G_optionLabel{font-size:14px;font-weight:500;line-height:24px}.Tq3z5G_badge{border-radius:var(--dsw-radius-xs);background:var(--dsw-specific-sidebar-nav-item-active-accent);color:var(--dsw-alias-button-info-fill);padding:0 4px;font-size:11px;font-weight:600;line-height:18px}.Tq3z5G_description{color:var(--dsw-alias-label-tertiary);flex-basis:100%;font-size:14px;font-weight:400;line-height:24px}.Tq3z5G_reviewNote{color:var(--dsw-alias-label-tertiary);margin:0;padding:8px 12px;font-size:14px;line-height:24px}.Tq3z5G_customRow{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);flex-shrink:0;align-items:flex-start;gap:8px;width:100%;min-height:44px;padding:9px 12px;transition:background-color .12s,border-color .12s;display:flex}.Tq3z5G_customRow:focus-within,.Tq3z5G_customRowActive{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l2)}.Tq3z5G_field{--dsh-answer-field-padding:0;min-width:0;display:grid}.Tq3z5G_field>*{min-width:0;padding:var(--dsh-answer-field-padding);font:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;grid-area:1/1;font-size:14px;line-height:24px}.Tq3z5G_fieldMirror{box-sizing:content-box;visibility:hidden;max-height:144px;overflow:hidden}.Tq3z5G_fieldInput{resize:none;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);background:0 0;border:none;outline:none;overflow-y:auto}.Tq3z5G_fieldInput::placeholder{color:var(--dsw-alias-label-caption)}.Tq3z5G_customInline{flex:1}.Tq3z5G_customBlock{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);--dsh-answer-field-padding:8px 12px;flex-shrink:0;min-height:64px;margin:0}.Tq3z5G_customBlock:focus-within{border-color:var(--dsw-alias-state-business-primary)}.Tq3z5G_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px 12px;padding:10px 16px;display:flex}.Tq3z5G_feedback{min-width:0;color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;flex-basis:100%;order:-1;font-size:11px;line-height:16px}.Tq3z5G_feedback:empty{display:none}@media (hover:hover) and (pointer:fine){.Tq3z5G_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.Tq3z5G_option:hover:not(:disabled),.Tq3z5G_customRow:hover,.Tq3z5G_promptToggle:hover{background:var(--dsw-alias-interactive-bg-hover)}}@media (pointer:coarse){.Tq3z5G_field>*{font-size:16px;line-height:24px}.Tq3z5G_iconButton{width:44px;height:44px}}@media (width<=720px){.Tq3z5G_frame{padding:4px 8px 8px}.Tq3z5G_card{border-radius:22px;max-width:100%;max-height:min(78dvh,640px)}.Tq3z5G_topBar{border-bottom:1px solid var(--dsw-alias-border-l1);gap:0 4px;padding:4px 4px 4px 14px}.Tq3z5G_cardMinimized .Tq3z5G_topBar{border-bottom:none;padding-bottom:4px}.Tq3z5G_eyebrow{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600;line-height:18px}.Tq3z5G_iconButton{width:44px;height:44px}.Tq3z5G_statusGroup{border-top:1px solid var(--dsw-alias-border-l1);flex-basis:100%;order:3;justify-content:space-between;margin-right:10px;padding:6px 0}.Tq3z5G_waitButton{corner-shape:round;border-radius:999px;min-height:36px;padding:0 12px;font-size:12.5px}.Tq3z5G_promptBlock{padding:12px 14px 4px}.Tq3z5G_promptCollapsed{max-height:92px;overflow:hidden}.Tq3z5G_promptFaded:after{content:"";pointer-events:none;background:linear-gradient(to bottom, transparent, var(--dsw-specific-input-major) 90%);height:32px;position:absolute;inset:auto 0 0}.Tq3z5G_promptToggle{min-height:36px;margin-top:8px;padding:4px 12px;font-size:12.5px}.Tq3z5G_title{font-size:15px;font-weight:600;line-height:22px}.Tq3z5G_detail{margin-top:10px;padding:10px 12px;font-size:13px;line-height:19px}.Tq3z5G_options{gap:8px;margin:8px 0 12px;padding:2px 14px}.Tq3z5G_option,.Tq3z5G_customRow{border-radius:14px;min-height:46px;padding:10px 12px}.Tq3z5G_optionLabel{font-size:14px;line-height:20px}.Tq3z5G_description{margin-top:2px;font-size:13px;line-height:19px}.Tq3z5G_number,.Tq3z5G_checkbox{margin-top:1px}.Tq3z5G_footer{padding:8px 12px calc(10px + env(safe-area-inset-bottom,0px));gap:6px 8px}.Tq3z5G_footerActions{flex-shrink:0;gap:6px}.Tq3z5G_footerActions>button{min-height:44px;padding:0 16px;font-size:14px;font-weight:500}.Tq3z5G_pager{gap:0}.Tq3z5G_progress{padding:0 2px;font-size:12.5px}}@media (prefers-reduced-motion:reduce){.Tq3z5G_option,.Tq3z5G_customRow,.Tq3z5G_iconButton,.Tq3z5G_promptToggle{transition:none}}`,document.head.appendChild(e)}var w={badge:`Tq3z5G_badge`,body:`Tq3z5G_body`,card:`Tq3z5G_card`,cardMinimized:`Tq3z5G_cardMinimized`,checkbox:`Tq3z5G_checkbox`,checkboxChecked:`Tq3z5G_checkboxChecked`,customBlock:`Tq3z5G_customBlock`,customInline:`Tq3z5G_customInline`,customRow:`Tq3z5G_customRow`,customRowActive:`Tq3z5G_customRowActive`,description:`Tq3z5G_description`,detail:`Tq3z5G_detail`,eyebrow:`Tq3z5G_eyebrow`,feedback:`Tq3z5G_feedback`,field:`Tq3z5G_field`,fieldInput:`Tq3z5G_fieldInput`,fieldMirror:`Tq3z5G_fieldMirror`,footer:`Tq3z5G_footer`,footerActions:`Tq3z5G_footerActions`,frame:`Tq3z5G_frame`,iconActions:`Tq3z5G_iconActions`,iconButton:`Tq3z5G_iconButton`,minimizedTitle:`Tq3z5G_minimizedTitle`,number:`Tq3z5G_number`,option:`Tq3z5G_option`,optionCopy:`Tq3z5G_optionCopy`,optionLabel:`Tq3z5G_optionLabel`,optionLine:`Tq3z5G_optionLine`,optionSelected:`Tq3z5G_optionSelected`,options:`Tq3z5G_options`,pager:`Tq3z5G_pager`,progress:`Tq3z5G_progress`,promptBlock:`Tq3z5G_promptBlock`,promptCollapsed:`Tq3z5G_promptCollapsed`,promptContent:`Tq3z5G_promptContent`,promptFaded:`Tq3z5G_promptFaded`,promptToggle:`Tq3z5G_promptToggle`,reviewNote:`Tq3z5G_reviewNote`,scrollArea:`Tq3z5G_scrollArea`,statusGroup:`Tq3z5G_statusGroup`,title:`Tq3z5G_title`,topBar:`Tq3z5G_topBar`,topBarLeading:`Tq3z5G_topBarLeading`,waitButton:`Tq3z5G_waitButton`,waitStatus:`Tq3z5G_waitStatus`};let ee={state:`open`,waitState:`counting`,countdown:void 0,channel:`none`,closed:!0};function T(e){let t=/\s*(?:\((?:recommended|推荐)\)|((?:recommended|推荐)))\s*$/i;return t.test(e)?{label:e.replace(t,``),recommended:!0}:{label:e,recommended:!1}}function te(e){let t=e.options?.[0]?.label;return t!==void 0&&T(t).recommended?t:void 0}function ne(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let n=e;return typeof n.index!=`number`||!Number.isInteger(n.index)||n.index<0||n.index>=t||!Array.isArray(n.drafts)||n.drafts.length!==t||n.wait!==void 0&&n.wait!==`editing`&&n.wait!==`waiting`?!1:n.drafts.every(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return Array.isArray(t.selected)&&t.selected.every(e=>typeof e==`string`)&&typeof t.custom==`string`&&typeof t.skipped==`boolean`})}function re(e){return e.nativeEvent.isComposing||Reflect.get(e.nativeEvent,`keyCode`)===229}function E(e){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:v(w.field,e.variant===`inline`?w.customInline:w.customBlock),children:[/* @__PURE__ */ (0,o.jsx)(`div`,{"aria-hidden":!0,className:w.fieldMirror,children:`${e.value}\n`}),/* @__PURE__ */ (0,o.jsx)(`textarea`,{autoFocus:e.autoFocus,className:w.fieldInput,value:e.value,disabled:e.disabled,rows:1,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e.onChange,onKeyDown:e.onKeyDown})]})}function D(e){let t=e.matched,n=(0,i.useMemo)(()=>l(t.questions),[t]);return n===void 0?/* @__PURE__ */ (0,o.jsx)(O,{pending:t,t:e.t,useStore:e.useStore,useQuestionCard:e.useQuestionCard,actions:e.actions},t.key):/* @__PURE__ */ (0,o.jsx)(S,{pending:t,review:n,t:e.t,renderSlot:e.renderSlot},t.key)}function O({pending:e,t,useStore:n,useQuestionCard:r,actions:s}){let c=e.questions,l=e.review,u=(0,i.useMemo)(()=>({code:{copyLabel:t(`copy`),copiedLabel:t(`copied`),toolbarLabels:{codeLabel:t(`codeBlock.title`),wrapLabel:t(`codeBlock.wrap`),unwrapLabel:t(`codeBlock.unwrap`)}},footnotes:t(`markdown.footnotes`)}),[t]),d=(0,i.useMemo)(()=>{let e=new Map((l??[]).map(e=>[e.id,e]));return c.map(t=>{let n=e.get(t.id),r=n?.custom??``,i=l===void 0?te(t):void 0;return{selected:n===void 0&&i!==void 0?[i]:[...n?.selected??[]],custom:r,skipped:n!==void 0&&n.selected.length===0&&r===``}})},[c,l]),f=n(t=>t.progressByRequest[e.key]),p=ne(f,c.length)?f:void 0,m=l===void 0?p:void 0,h=p?.index??0,g=m?.drafts??d,_=m?.wait??(m?.drafts.some((e,t)=>e.selected.length!==d[t]?.selected.length||e.selected.some((e,n)=>e!==d[t]?.selected[n])||e.custom!==``||e.skipped)===!0?`editing`:void 0),[y,b]=(0,i.useState)(null),[x,S]=(0,i.useState)(null),C=r(e.key,e=>e??ee),D=C.channel!==`none`,O=y!==null||l!==void 0,k=(0,i.useRef)(null);(0,i.useEffect)(()=>{k.current===`waterfall`&&C.state===`continued`&&(k.current=null,b(null),S({key:`error.resubmit`}))},[C.state]),(0,i.useEffect)(()=>{C.closed&&s.clear(e.key)},[s,C.closed,e.key]),(0,i.useEffect)(()=>{s.prune(e.liveKeys())},[s,e]);let A=(0,i.useRef)(_);(0,i.useEffect)(()=>{A.current===`waiting`&&e.takeTime(),A.current===`editing`&&e.engage()},[e]);let j=C.countdown,[M,N]=(0,i.useState)(!1),[P,F]=(0,i.useState)(!1),[I,L]=(0,i.useState)(!1),R=(0,i.useRef)(/* @__PURE__ */ new Set),z=(0,i.useRef)(null),B=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{z.current!==null&&(z.current.scrollTop=0),F(!1)},[h]);let V=c[h],H=g[h],U=(V.options?.length??0)>0;(0,i.useLayoutEffect)(()=>{if(M){L(!1);return}let e=B.current;if(e===null)return;let t=()=>{P||L(e.scrollHeight>e.clientHeight+2)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[M,P,h,V.question,V.detail]),(0,i.useEffect)(()=>{M&&e.releaseFocus()},[M,e]);let W=(t,n)=>{s.replace(e.key,{index:t,drafts:n,...A.current===void 0?{}:{wait:A.current}})},G=()=>{A.current=`waiting`,e.takeTime(),W(h,g)},K=()=>{A.current===void 0&&(A.current=`editing`,e.engage())},q=t=>{t.currentTarget.contains(t.relatedTarget)||e.holdFocus()},J=t=>{t.currentTarget.contains(t.relatedTarget)||e.releaseFocus()};(0,i.useEffect)(()=>{let t=()=>{e.releaseFocus()},n=()=>{A.current===`editing`?e.engage():z.current?.contains(document.activeElement)===!0&&e.holdFocus()},r=()=>{document.hidden?t():n()};return window.addEventListener(`blur`,t),window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,r),()=>{t(),window.removeEventListener(`blur`,t),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}},[e]);let Y=()=>{e.dismissal===`hide`?e.dismiss():D?(b(`cancel`),S(null),k.current=`waterfall`,e.dismiss().catch(e=>{k.current=null,b(null),S({text:e instanceof Error?e.message:String(e)})})):S({key:`error.unavailable`})},ie=(e,t=h)=>{K();let n=g.map((t,n)=>n===h?e(t):t);W(t,n),S(null)},ae=e=>{ie(t=>{if(V.multiSelect===!0){let n=t.selected.includes(e)?t.selected.filter(t=>t!==e):[...t.selected,e];return{...t,selected:n,skipped:!1}}return{selected:[e],custom:``,skipped:!1}},V.multiSelect!==!0&&h<c.length-1?h+1:h)},X=e=>e.selected.length>0||e.custom.trim()!==``,oe=e=>X(e)||e.skipped,Z=t=>{let n=t.findIndex(e=>!oe(e));if(n>=0){W(n,t),S({key:`error.incomplete`});return}if(!D){S({key:`error.unavailable`});return}let r={answers:c.map((e,n)=>{let r=t[n];if(r.skipped)return{id:e.id,selected:[]};let i=r.custom.trim();return{id:e.id,selected:i===``||e.multiSelect===!0?r.selected:[],...i===``?{}:{custom:i}}})};b(`answer`),S(null);let i=e.snapshot().channel;k.current=i===`waterfall`?`waterfall`:null,e.answer(r).then(()=>{i===`rpc`&&(k.current=null,b(null),S(null),e.dismiss().catch(()=>{S({key:`status.sent`})}))}).catch(e=>{k.current=null,b(null),S({text:e instanceof Error?e.message:String(e)})})},se=()=>{X(H)?h<c.length-1?(W(h+1,g),S(null)):Z(g):S({key:`error.unanswered`})},ce=e=>{let t=e.target.value;ie(e=>({...e,selected:V.multiSelect===!0?e.selected:[],custom:t,skipped:!1}))},le=e=>{e.key!==`Enter`||e.shiftKey||re(e)||(e.preventDefault(),se())},ue=()=>{K();let e=g.map((e,t)=>t===h?{selected:[],custom:``,skipped:!0}:e);W(h<c.length-1?h+1:h,e),S(null),!(h<c.length-1)&&Z(e)},Q=j!==void 0&&C.waitState!==`waiting`&&C.waitState!==`editing`&&C.waitState!==`continued`,de=j!==void 0&&(C.waitState===`waiting`||C.waitState===`editing`),fe=Q||C.state===`continued`||de||l!==void 0,$=`question-${e.key}-${String(h)}`;return/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.frame,"data-question-key":e.key,children:/* @__PURE__ */ (0,o.jsxs)(`section`,{className:v(w.card,M&&w.cardMinimized),"aria-labelledby":$,children:[/* @__PURE__ */ (0,o.jsxs)(`header`,{className:w.topBar,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.topBarLeading,children:[V.header!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.eyebrow,children:V.header}),M&&/* @__PURE__ */ (0,o.jsx)(`h2`,{className:w.minimizedTitle,id:$,children:V.question})]}),fe&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.statusGroup,children:[Q&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(j.running?`wait.countdown`:`wait.paused`,{seconds:Math.ceil(j.remainingMs/1e3)})}),Q&&/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,size:`sm`,className:w.waitButton,onClick:G,children:t(`wait.takeTime`)}),C.state===`continued`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`wait.continued`)}),de&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`wait.held`)}),l!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.waitStatus,children:t(`review.status`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.iconActions,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(M?`nav.maximize`:`nav.minimize`),title:t(M?`nav.maximize`:`nav.minimize`),"aria-expanded":!M,disabled:y!==null,onClick:()=>{N(e=>!e)},children:M?/* @__PURE__ */ (0,o.jsx)(a.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(e.dismissal===`hide`?`nav.close`:`nav.cancel`),title:t(e.dismissal===`hide`?`nav.close`:`nav.cancel`),disabled:y!==null,onClick:Y,children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseOutlineRegular,{})})]})]}),!M&&/* @__PURE__ */ (0,o.jsx)(`div`,{ref:z,className:w.scrollArea,"data-question-scroll":!0,tabIndex:0,onFocusCapture:q,onBlurCapture:J,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.body,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.promptBlock,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:B,className:v(w.promptContent,!P&&w.promptCollapsed,!P&&I&&w.promptFaded),children:[/* @__PURE__ */ (0,o.jsx)(`h2`,{className:w.title,id:$,children:V.question}),V.detail!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.detail,children:/* @__PURE__ */ (0,o.jsx)(a.MarkdownText,{text:V.detail,labels:u})})]}),(I||P)&&/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:w.promptToggle,"aria-expanded":P,onClick:()=>{F(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:t(P?`prompt.collapse`:`prompt.expand`)}),P?/* @__PURE__ */ (0,o.jsx)(a.IconChevronUpOutlineRegular,{size:14}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:14})]})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.options,role:V.multiSelect===!0?`group`:`radiogroup`,children:[(V.options??[]).map((e,n)=>{let r=H.selected.includes(e.label),i=T(e.label);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:v(w.option,r&&w.optionSelected),role:V.multiSelect===!0?`checkbox`:`radio`,"aria-checked":r,"aria-label":i.label,disabled:O,onClick:()=>{ae(e.label)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Z(g))},children:[V.multiSelect===!0?/* @__PURE__ */ (0,o.jsx)(`span`,{className:v(w.checkbox,r&&w.checkboxChecked),"aria-hidden":`true`,children:r&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:12})}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.number,children:n+1}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.optionCopy,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:w.optionLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.optionLabel,children:i.label}),i.recommended&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.badge,children:t(`option.recommended`)}),e.description!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.description,children:e.description})]})})]},`${e.label}-${String(n)}`)}),l!==void 0&&H.skipped&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:w.reviewNote,children:t(`review.skipped`)}),(!U||V.allowOther!==!1)&&(l===void 0||H.custom!==``)&&(U?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:v(w.customRow,H.custom!==``&&w.customRowActive),children:[V.multiSelect===!0?/* @__PURE__ */ (0,o.jsx)(`span`,{className:v(w.checkbox,H.custom!==``&&w.checkboxChecked),"aria-hidden":`true`,children:H.custom!==``&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:12})}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:w.number,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{size:12})}),/* @__PURE__ */ (0,o.jsx)(E,{variant:`inline`,value:H.custom,disabled:O,placeholder:t(`custom.placeholder`),onChange:ce,onKeyDown:le})]}):/* @__PURE__ */ (0,o.jsx)(E,{autoFocus:D&&j===void 0&&!O&&!R.current.has(h),variant:`block`,value:H.custom,disabled:O,placeholder:t(`custom.placeholder`),onFocus:()=>{R.current.add(h)},onChange:ce,onKeyDown:le}))]})]})}),!M&&/* @__PURE__ */ (0,o.jsxs)(`footer`,{className:w.footer,children:[c.length>1&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.pager,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(`nav.prev`),disabled:h===0||y!==null,onClick:()=>{W(h-1,g),S(null)},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:w.progress,children:[h+1,` / `,c.length]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:w.iconButton,"aria-label":t(`nav.next`),disabled:h===c.length-1||y!==null,onClick:()=>{W(h+1,g),S(null)},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{})})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:w.feedback,role:`status`,children:x===null?null:`key`in x?t(x.key):x.text}),l===void 0&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:w.footerActions,children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`ghost`,disabled:y!==null,onClick:ue,children:t(`action.skip`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:y!==null||!X(H)||h===c.length-1&&!D,onClick:se,children:y===`answer`?t(`submitting`):h===c.length-1?t(`submit`):t(`action.next`)})]})]})]})})}let k=/* @__PURE__ */ new Set([`system/message`,`developer/message`,`user/message`,`assistant/message`,`tool/result`]);function A(e){return k.has(e.type)?e.surfaceOp!==void 0:!1}function j(e){return A(e)&&e.surfaceOp===`append`}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){let t;try{t=JSON.parse(e)}catch{return{questions:[],answers:[]}}if(!M(t)||!Array.isArray(t.questions))return{questions:[],answers:[]};let n=[];for(let e of t.questions)M(e)&&typeof e.id==`string`&&typeof e.question==`string`&&n.push({id:e.id,question:e.question,...typeof e.detail==`string`?{detail:e.detail}:{},...typeof e.header==`string`?{header:e.header}:{},...Array.isArray(e.options)?{options:e.options.flatMap(e=>!M(e)||typeof e.label!=`string`?[]:[{label:e.label,...typeof e.description==`string`?{description:e.description}:{}}])}:{},...typeof e.multiSelect==`boolean`?{multiSelect:e.multiSelect}:{}});let r=[];for(let e of Array.isArray(t.answers)?t.answers:[])M(e)&&typeof e.id==`string`&&Array.isArray(e.selected)&&r.push({id:e.id,selected:e.selected.filter(e=>typeof e==`string`),...typeof e.custom==`string`?{custom:e.custom}:{}});return{questions:n,answers:r}}function P(e,t){let n=e.answers.find(e=>e.id===t),r=n?.custom?.trim()??``;return[...n?.selected??[],...r===``?[]:[r]]}function F(e,t){return e.questions.length===0?e.text:e.questions.map(n=>{let r=P(e,n.id);return`${n.header&&n.header!==n.question?`${n.header} — ${n.question}`:n.question}\n${r.length===0?t(`reply.skipped`):`${t(`reply.answerLabel`)}${r.join(`, `)}`}`}).join(`
4
4
 
5
- `)}function L(e){let t=e.data.source;return N(t)&&t.kind===`user-question-reply`&&typeof t.callId==`string`&&t.outcome===`answered`?{callId:t.callId,outcome:`answered`}:null}let R={kind:`user-question-reply`,target:`chat`,match:e=>e.type!==`user/message`||!M(e)||L(e)===null?null:{id:String(e.data.id),role:`start`},start:(e,t)=>{if(t.event.type!==`user/message`)throw Error(`user-question-reply start requires user/message`);let n=t.event,r=n.data.content.find(e=>e.type===`text`)?.text??``,i=L(n);if(i===null)throw Error(`user-question-reply start requires a reply source`);return{seq:n.seq,time:n.time,callId:i.callId,outcome:i.outcome,text:r,...P(r)}},update:e=>e.state,buildViewNode:e=>{if(e.state===void 0)return null;let{seq:t,...n}=e.state;return{key:e.key,kind:`question-reply`,id:e.id,target:`chat`,anchorSeq:t,location:e.start?.location??{kind:`unresolved`},visibility:`visible`,data:n}}},z=`@deepseek-ai/dsh-client-ui-user-questions/QuestionReplyView.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(z)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=z,e.textContent=`._01Ho3G_row{flex-direction:column;justify-content:flex-end;align-items:flex-end;gap:6px;padding:4px 0;display:flex}._01Ho3G_bubble{border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-bubble);max-width:72%;color:var(--dsw-alias-label-primary);cursor:pointer;font-size:var(--dsh-content-font-size,14px);line-height:calc(22px + var(--dsh-content-font-delta,0px));text-align:left;overflow-wrap:anywhere;white-space:pre-wrap;padding:10px 16px}._01Ho3G_toggle{width:100%;color:inherit;cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;padding:0}._01Ho3G_toggle:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._01Ho3G_bubble:has(._01Ho3G_toggle:focus-visible){box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}._01Ho3G_labelRow{align-items:center;gap:3px;display:flex}._01Ho3G_caret{color:var(--dsw-alias-label-secondary);display:inline-flex}._01Ho3G_caret svg{width:12px;height:12px}._01Ho3G_label{color:var(--dsw-alias-label-secondary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px));display:block}._01Ho3G_summary{color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size,14px);margin-top:3px;display:block}._01Ho3G_text{margin:8px 0 0}._01Ho3G_details{border-top:1px solid color-mix(in srgb, var(--dsw-alias-label-secondary) 24%, transparent);margin:8px 0 0;padding-top:8px}._01Ho3G_details>div+div{margin-top:12px}._01Ho3G_details dt{color:var(--dsw-alias-label-secondary);font-size:12px}._01Ho3G_question{gap:3px;display:grid}._01Ho3G_header,._01Ho3G_detail,._01Ho3G_options{color:var(--dsw-alias-label-secondary);font-size:11px}._01Ho3G_questionText{color:var(--dsw-alias-label-primary)}._01Ho3G_options{margin:0;padding-left:16px}._01Ho3G_details dd{margin:4px 0 0}._01Ho3G_answer{font-size:14px}._01Ho3G_answerLabel{color:var(--dsw-alias-label-secondary);margin-right:4px;font-size:12px}._01Ho3G_actions{height:28px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;padding-right:4px;display:flex}._01Ho3G_time{white-space:nowrap;padding-right:4px;font-size:13px;line-height:24px}._01Ho3G_action{border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:inherit;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:6px;display:inline-flex}._01Ho3G_action svg{width:15px;height:15px}._01Ho3G_action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var B={action:`_01Ho3G_action`,actions:`_01Ho3G_actions`,answer:`_01Ho3G_answer`,answerLabel:`_01Ho3G_answerLabel`,bubble:`_01Ho3G_bubble`,caret:`_01Ho3G_caret`,detail:`_01Ho3G_detail`,details:`_01Ho3G_details`,header:`_01Ho3G_header`,label:`_01Ho3G_label`,labelRow:`_01Ho3G_labelRow`,options:`_01Ho3G_options`,question:`_01Ho3G_question`,questionText:`_01Ho3G_questionText`,row:`_01Ho3G_row`,summary:`_01Ho3G_summary`,text:`_01Ho3G_text`,time:`_01Ho3G_time`,toggle:`_01Ho3G_toggle`};let V=(0,i.memo)(function({node:e,t}){return/* @__PURE__ */ (0,o.jsx)(H,{data:e.data,t})});function H({data:e,t}){let n=t(`reply.label`),[r,s]=(0,i.useState)(!1),c=t(r?`reply.close`:`reply.open`),l=e.questions.map(t=>F(e,t.id)).flat().join(`, `),u=I(e,t),[d,f]=(0,i.useState)(!1),p=(0,i.useCallback)(()=>{d||(0,a.writeClipboard)(u).then(e=>{e&&(f(!0),window.setTimeout(()=>{f(!1)},1e3))})},[d,u]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:B.row,"data-question-reply":e.callId,"data-reply-outcome":e.outcome,role:`group`,"aria-label":n,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:B.bubble,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:B.toggle,"aria-expanded":r,"aria-label":`${n} · ${c}`,onClick:()=>{s(e=>!e)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:B.labelRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.caret,"aria-hidden":`true`,children:r?/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.label,children:n})]}),!r&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.summary,children:l===``?t(`reply.skipped`):l})]}),r&&(e.questions.length===0?/* @__PURE__ */ (0,o.jsx)(`p`,{className:B.text,children:e.text}):/* @__PURE__ */ (0,o.jsx)(`dl`,{className:B.details,children:e.questions.map(n=>{let r=F(e,n.id);return/* @__PURE__ */ (0,o.jsxs)(`div`,{children:[/* @__PURE__ */ (0,o.jsxs)(`dt`,{className:B.question,children:[n.header&&n.header!==n.question&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.header,children:n.header}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.questionText,children:n.question}),n.detail&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.detail,children:n.detail}),n.options&&n.options.length>0&&/* @__PURE__ */ (0,o.jsx)(`ul`,{className:B.options,children:n.options.map(e=>/* @__PURE__ */ (0,o.jsxs)(`li`,{children:[e.label,e.description&&` — ${e.description}`]},e.label))})]}),/* @__PURE__ */ (0,o.jsxs)(`dd`,{className:B.answer,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.answerLabel,children:t(`reply.answerLabel`)}),r.length===0?t(`reply.skipped`):r.join(`, `)]})]},n.id)})}))]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:B.actions,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:B.time,children:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(e.time)}),/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:t(d?`copied`:`copy`),side:`bottom`,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:B.action,"aria-label":t(d?`copied`:`copy`),onClick:p,children:d?/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconCopyOutlineRegular,{})})})]})]})}let U={"error.incomplete":`请先完成这道问题。`,"error.unanswered":`请选择一个选项或填写自定义答案。`,"error.unavailable":`当前无法提交,请稍候再试。`,"error.resubmit":`回答未送达,工作已继续,请再提交一次。`,"status.sent":`回答已发送;面板未能关闭。`,"wait.takeTime":`慢慢回答`,"wait.countdown":`{seconds} 秒后继续工作`,"wait.paused":`已暂停 · 剩余 {seconds} 秒`,"wait.held":`会一直等你回答`,"wait.continued":`已继续工作,仍可回答`,"review.status":`已回答`,"review.skipped":`这道问题当时被跳过。`,"reply.label":`回答先前等待中的问题`,"reply.open":`展开问题详情`,"reply.close":`收起问题详情`,"reply.answerLabel":`回答:`,"reply.skipped":`已跳过`,"nav.prev":`上一题`,"nav.next":`下一题`,"nav.minimize":`收起问题卡片`,"nav.maximize":`展开问题卡片`,"nav.cancel":`放弃整组问题`,"nav.close":`收起问题面板,可从工具调用重新打开`,"option.recommended":`推荐`,"custom.placeholder":`输入你的答案`,"action.skip":`跳过`,"action.next":`下一题`,"plan.header":`计划待审`,"plan.approve":`同意执行`,"plan.decline":`拒绝`,"plan.discuss":`要求修改`},W={"error.incomplete":`Please complete this question first.`,"error.unanswered":`Please select an option or enter a custom answer.`,"error.unavailable":`Cannot submit right now; try again in a moment.`,"error.resubmit":`The answer did not arrive before work continued; submit it again.`,"status.sent":`Reply sent; the panel could not close.`,"wait.takeTime":`Take time`,"wait.countdown":`Continuing in {seconds}s`,"wait.paused":`Paused · {seconds}s remaining`,"wait.held":`Waiting until you answer`,"wait.continued":`Work continued — you can still answer`,"review.status":`Answered`,"review.skipped":`This question was skipped.`,"reply.label":`Reply to earlier pending questions`,"reply.open":`Open question details`,"reply.close":`Close question details`,"reply.answerLabel":`Answer: `,"reply.skipped":`Skipped`,"nav.prev":`Previous question`,"nav.next":`Next question`,"nav.minimize":`Collapse the question card`,"nav.maximize":`Expand the question card`,"nav.cancel":`Dismiss all questions`,"nav.close":`Close the panel — reopen it from the tool call`,"option.recommended":`Recommended`,"custom.placeholder":`Type your answer`,"action.skip":`Skip`,"action.next":`Next`,"plan.header":`Plan review`,"plan.approve":`Approve`,"plan.decline":`Refuse`,"plan.discuss":`Request changes`},G=`question`,K=[`sessions`,`remote`,`remote.userQuestions`,`uiSession`,`slots`,`locale`,`uiConversation`];var q=class{publish;#e=/* @__PURE__ */ new Map;constructor(e){this.publish=e}byCallId(e,t){return this.#e.get(h.keyOf(e,t))}source(e){return this.#e.get(e)?.pending}values(){return[...this.#e.values()]}keysFor(e){return this.values().filter(t=>t.pending.sessionId===e).map(e=>e.pending.key)}ensure(e,t,n){if(n!==void 0){let t=this.byCallId(e,n);if(t!==void 0)return t}return this.#t(new h(e,t,n,()=>this.keysFor(e)))}#t(e){let t=/* @__PURE__ */ new Set,n=async()=>{e.delegate(),await Promise.all(t)},r=this.publish(e,n),i={pending:e,hide:()=>{r?.(),r=void 0},reveal:()=>{r?.(),r=this.publish(e,n)},remove:()=>{
5
+ `)}function I(e){let t=e.data.source;return M(t)&&t.kind===`user-question-reply`&&typeof t.callId==`string`&&t.outcome===`answered`?{callId:t.callId,outcome:`answered`}:null}let L={kind:`user-question-reply`,target:`chat`,match:e=>e.type!==`user/message`||!j(e)||I(e)===null?null:{id:String(e.data.id),role:`start`},start:(e,t)=>{if(t.event.type!==`user/message`)throw Error(`user-question-reply start requires user/message`);let n=t.event,r=n.data.content.find(e=>e.type===`text`)?.text??``,i=I(n);if(i===null)throw Error(`user-question-reply start requires a reply source`);return{seq:n.seq,time:n.time,callId:i.callId,outcome:i.outcome,text:r,...N(r)}},update:e=>e.state,buildViewNode:e=>{if(e.state===void 0)return null;let{seq:t,...n}=e.state;return{key:e.key,kind:`question-reply`,id:e.id,target:`chat`,anchorSeq:t,location:e.start?.location??{kind:`unresolved`},visibility:`visible`,data:n}}},R=`@deepseek-ai/dsh-client-ui-user-questions/QuestionReplyView.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(R)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-user-questions`,e.dataset.pluginCss=R,e.textContent=`._01Ho3G_row{flex-direction:column;justify-content:flex-end;align-items:flex-end;gap:6px;padding:4px 0;display:flex}._01Ho3G_bubble{border-radius:var(--dsw-radius-xl);background:var(--dsw-specific-bubble);max-width:72%;color:var(--dsw-alias-label-primary);cursor:pointer;font-size:var(--dsh-content-font-size,14px);line-height:calc(22px + var(--dsh-content-font-delta,0px));text-align:left;overflow-wrap:anywhere;white-space:pre-wrap;padding:10px 16px}._01Ho3G_toggle{width:100%;color:inherit;cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;padding:0}._01Ho3G_toggle:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._01Ho3G_bubble:has(._01Ho3G_toggle:focus-visible){box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}._01Ho3G_labelRow{align-items:center;gap:3px;display:flex}._01Ho3G_caret{color:var(--dsw-alias-label-secondary);display:inline-flex}._01Ho3G_caret svg{width:12px;height:12px}._01Ho3G_label{color:var(--dsw-alias-label-secondary);font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(18px + var(--dsh-content-font-delta-secondary,0px));display:block}._01Ho3G_summary{color:var(--dsw-alias-label-primary);font-size:var(--dsh-content-font-size,14px);margin-top:3px;display:block}._01Ho3G_text{margin:8px 0 0}._01Ho3G_details{border-top:1px solid color-mix(in srgb, var(--dsw-alias-label-secondary) 24%, transparent);margin:8px 0 0;padding-top:8px}._01Ho3G_details>div+div{margin-top:12px}._01Ho3G_details dt{color:var(--dsw-alias-label-secondary);font-size:12px}._01Ho3G_question{gap:3px;display:grid}._01Ho3G_header,._01Ho3G_detail,._01Ho3G_options{color:var(--dsw-alias-label-secondary);font-size:11px}._01Ho3G_questionText{color:var(--dsw-alias-label-primary)}._01Ho3G_options{margin:0;padding-left:16px}._01Ho3G_details dd{margin:4px 0 0}._01Ho3G_answer{font-size:14px}._01Ho3G_answerLabel{color:var(--dsw-alias-label-secondary);margin-right:4px;font-size:12px}._01Ho3G_actions{height:28px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;padding-right:4px;display:flex}._01Ho3G_time{white-space:nowrap;padding-right:4px;font-size:13px;line-height:24px}._01Ho3G_action{border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:inherit;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:6px;display:inline-flex}._01Ho3G_action svg{width:15px;height:15px}._01Ho3G_action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var z={action:`_01Ho3G_action`,actions:`_01Ho3G_actions`,answer:`_01Ho3G_answer`,answerLabel:`_01Ho3G_answerLabel`,bubble:`_01Ho3G_bubble`,caret:`_01Ho3G_caret`,detail:`_01Ho3G_detail`,details:`_01Ho3G_details`,header:`_01Ho3G_header`,label:`_01Ho3G_label`,labelRow:`_01Ho3G_labelRow`,options:`_01Ho3G_options`,question:`_01Ho3G_question`,questionText:`_01Ho3G_questionText`,row:`_01Ho3G_row`,summary:`_01Ho3G_summary`,text:`_01Ho3G_text`,time:`_01Ho3G_time`,toggle:`_01Ho3G_toggle`};let B=(0,i.memo)(function({node:e,t}){return/* @__PURE__ */ (0,o.jsx)(V,{data:e.data,t})});function V({data:e,t}){let n=t(`reply.label`),[r,s]=(0,i.useState)(!1),c=t(r?`reply.close`:`reply.open`),l=e.questions.map(t=>P(e,t.id)).flat().join(`, `),u=F(e,t),[d,f]=(0,i.useState)(!1),p=(0,i.useCallback)(()=>{d||(0,a.writeClipboard)(u).then(e=>{e&&(f(!0),window.setTimeout(()=>{f(!1)},1e3))})},[d,u]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:z.row,"data-question-reply":e.callId,"data-reply-outcome":e.outcome,role:`group`,"aria-label":n,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:z.bubble,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:z.toggle,"aria-expanded":r,"aria-label":`${n} · ${c}`,onClick:()=>{s(e=>!e)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:z.labelRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.caret,"aria-hidden":`true`,children:r?/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.label,children:n})]}),!r&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.summary,children:l===``?t(`reply.skipped`):l})]}),r&&(e.questions.length===0?/* @__PURE__ */ (0,o.jsx)(`p`,{className:z.text,children:e.text}):/* @__PURE__ */ (0,o.jsx)(`dl`,{className:z.details,children:e.questions.map(n=>{let r=P(e,n.id);return/* @__PURE__ */ (0,o.jsxs)(`div`,{children:[/* @__PURE__ */ (0,o.jsxs)(`dt`,{className:z.question,children:[n.header&&n.header!==n.question&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.header,children:n.header}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.questionText,children:n.question}),n.detail&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.detail,children:n.detail}),n.options&&n.options.length>0&&/* @__PURE__ */ (0,o.jsx)(`ul`,{className:z.options,children:n.options.map(e=>/* @__PURE__ */ (0,o.jsxs)(`li`,{children:[e.label,e.description&&` — ${e.description}`]},e.label))})]}),/* @__PURE__ */ (0,o.jsxs)(`dd`,{className:z.answer,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.answerLabel,children:t(`reply.answerLabel`)}),r.length===0?t(`reply.skipped`):r.join(`, `)]})]},n.id)})}))]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:z.actions,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:z.time,children:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(e.time)}),/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:t(d?`copied`:`copy`),side:`bottom`,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:z.action,"aria-label":t(d?`copied`:`copy`),onClick:p,children:d?/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconCopyOutlineRegular,{})})})]})]})}let H={"error.incomplete":`请先完成这道问题。`,"error.unanswered":`请选择一个选项或填写自定义答案。`,"error.unavailable":`当前无法提交,请稍候再试。`,"error.resubmit":`回答未送达,工作已继续,请再提交一次。`,"status.sent":`回答已发送;面板未能关闭。`,"wait.takeTime":`慢慢回答`,"wait.countdown":`{seconds} 秒后继续工作`,"wait.paused":`已暂停 · 剩余 {seconds} 秒`,"wait.held":`会一直等你回答`,"wait.continued":`已继续工作,仍可回答`,"review.status":`已回答`,"review.skipped":`这道问题当时被跳过。`,"reply.label":`回答先前等待中的问题`,"reply.open":`展开问题详情`,"reply.close":`收起问题详情`,"reply.answerLabel":`回答:`,"reply.skipped":`已跳过`,"nav.prev":`上一题`,"nav.next":`下一题`,"nav.minimize":`收起问题卡片`,"nav.maximize":`展开问题卡片`,"nav.cancel":`放弃整组问题`,"nav.close":`收起问题面板,可从工具调用重新打开`,"option.recommended":`推荐`,"custom.placeholder":`输入你的答案`,"action.skip":`跳过`,"action.next":`下一题`,"prompt.expand":`展开全文`,"prompt.collapse":`收起全文`,"plan.header":`计划待审`,"plan.approve":`同意执行`,"plan.decline":`拒绝`,"plan.discuss":`要求修改`},U={"error.incomplete":`Please complete this question first.`,"error.unanswered":`Please select an option or enter a custom answer.`,"error.unavailable":`Cannot submit right now; try again in a moment.`,"error.resubmit":`The answer did not arrive before work continued; submit it again.`,"status.sent":`Reply sent; the panel could not close.`,"wait.takeTime":`Take time`,"wait.countdown":`Continuing in {seconds}s`,"wait.paused":`Paused · {seconds}s remaining`,"wait.held":`Waiting until you answer`,"wait.continued":`Work continued — you can still answer`,"review.status":`Answered`,"review.skipped":`This question was skipped.`,"reply.label":`Reply to earlier pending questions`,"reply.open":`Open question details`,"reply.close":`Close question details`,"reply.answerLabel":`Answer: `,"reply.skipped":`Skipped`,"nav.prev":`Previous question`,"nav.next":`Next question`,"nav.minimize":`Collapse the question card`,"nav.maximize":`Expand the question card`,"nav.cancel":`Dismiss all questions`,"nav.close":`Close the panel — reopen it from the tool call`,"option.recommended":`Recommended`,"custom.placeholder":`Type your answer`,"action.skip":`Skip`,"action.next":`Next`,"prompt.expand":`Show full text`,"prompt.collapse":`Show less`,"plan.header":`Plan review`,"plan.approve":`Approve`,"plan.decline":`Refuse`,"plan.discuss":`Request changes`},W=`question`,G=[`sessions`,`remote`,`remote.userQuestions`,`uiSession`,`slots`,`locale`,`uiConversation`];var K=class{publish;#e=/* @__PURE__ */ new Map;constructor(e){this.publish=e}byCallId(e,t){return this.#e.get(h.keyOf(e,t))}source(e){return this.#e.get(e)?.pending}values(){return[...this.#e.values()]}keysFor(e){return this.values().filter(t=>t.pending.sessionId===e).map(e=>e.pending.key)}ensure(e,t,n){if(n!==void 0){let t=this.byCallId(e,n);if(t!==void 0)return t}return this.#t(new h(e,t,n,()=>this.keysFor(e)))}#t(e){let t=/* @__PURE__ */ new Set,n=async()=>{e.delegate(),await Promise.all(t)},r=this.publish(e,n),i={pending:e,hide:()=>{r?.(),r=void 0},reveal:()=>{r?.(),r=this.publish(e,n)},remove:()=>{
6
6
  /* v8 ignore next -- a card leaves the registry once; no caller holds a card the registry already replaced. */
7
- this.#e.get(e.key)===i&&(this.#e.delete(e.key),e.close(),r?.(),r=void 0)},trackRequest:e=>(t.add(e),()=>{t.delete(e)}),hasRequest:()=>t.size>0};return e.attachSeat({hide:e.review===void 0?i.hide:i.remove}),this.#e.set(e.key,i),i}reveal(e,t){let n=this.byCallId(e,t);return n!==void 0&&(n.reveal(),!0)}review(e,t,n){return(this.byCallId(e,t)??this.#t(new h(e,n.questions,s(t),()=>this.keysFor(e),n.answers))).reveal(),!0}dispose(){for(let e of this.values())e.pending.delegate(),e.remove()}};async function J(e,t,n,r,i){let a=e.sessions.scopeOf(t);if(a===void 0)return r();let o=n.wait?.callId,s=i.ensure(a,n.questions,o),c=new AbortController,l=n.signal===void 0?c.signal:AbortSignal.any([c.signal,n.signal]),u,d,f,p=n.wait?.timed===!0&&o!==void 0?e.effect(()=>(u=e.remote.userQuestions.attachWait(a,o,l),async()=>{f?.(),c.abort(),u?.dispose(),d!==void 0&&await Promise.allSettled([d])}),`ui-user-questions: foreground claim`):void 0,h=Promise.withResolvers(),g=s.trackRequest(h.promise);try{let e=u?.[Symbol.asyncIterator](),t=e===void 0?void 0:await e.next();if(t?.done===!0)return await r();let n=m(t===void 0?void 0:Date.now()+t.value.remainingMs,l,e=>{s.pending.detachWaterfall(e)});if(l.aborted)return await n.result;f=()=>{n.channel.delegate()},s.pending.attachWaterfall(n.channel),e!==void 0&&(d=(async()=>{throw await e.next(),Error(`the foreground question wait ended`)})());try{return await(d===void 0?n.result:Promise.race([n.result,d]))}catch(e){if(n.isDelegation(e))return await p?.(),await r();throw e}}finally{p===void 0?c.abort():d===void 0?await p():Promise.allSettled([d]).then(()=>{p()}),o===void 0&&s.remove(),h.resolve(),g()}}function Y(e,t){let n=e.sessions,r=/* @__PURE__ */ new Map,i=e=>{if(!e.ok)throw Error(e.error.message);return e.value},a=(t,n)=>({answer:async r=>i(await e.remote.userQuestions.answer(t,n,r))}),o=()=>{let e=n.list.getSnapshot(),i=new Map(Object.values(e.byId).flatMap(e=>{let t=n.binding(e.id);return t===void 0?[]:[[e.id,t]]}));for(let[e,t]of r)i.has(e)||(t(),r.delete(e));for(let[e,t]of i){if(r.has(e))continue;let n=t.session.projections.faceOf(`userQuestions`).subscribe(o),i=t.session.projections.faceOf(`inbox`).subscribe(o);r.set(e,()=>{n(),i()})}let s=/* @__PURE__ */ new Map;for(let[e,t]of i){let n=t.session.projections.faceOf(`userQuestions`).getSnapshot(),r=t.session.projections.faceOf(`inbox`).getSnapshot(),i=/* @__PURE__ */ new Set;for(let e of[...r?.[`next-step`]??[],...r?.[`next-turn`]??[]]){if(typeof e!=`object`||!e||Array.isArray(e))continue;let t=e.source;typeof t==`object`&&t&&!Array.isArray(t)&&t.kind===`user-question-reply`&&typeof t.callId==`string`&&i.add(t.callId)}for(let t of n?.active??[])t.state===`continued`&&i.has(t.callId)||s.set(h.keyOf(e,t.callId),{sessionId:e,row:t})}for(let{sessionId:e,row:n}of s.values())if(n.state===`continued`){let r=t.ensure(e,n.questions,n.callId);r.pending.attachRpc(a(e,n.callId)),r.pending.setState(`continued`)}else t.byCallId(e,n.callId)?.pending.setState(`open`);for(let e of t.values())e.pending.callId===void 0||e.pending.review!==void 0||s.has(e.pending.key)||e.hasRequest()||e.pending.hasWaterfall()||e.remove()};o();let s=n.list.subscribe(o);return()=>{s();for(let e of r.values())e();r.clear()}}function X(e){e.effect(()=>e.locale.register(G,{zh:U,en:W}),`ui-user-questions: dictionaries`);let t=g(),n=new q(e.uiSession.registerPendingInteraction(e=>e.kind===`plan-review`?2:1));e.effect(()=>()=>{n.dispose()},`ui-user-questions: cards`);let r=e.reflect.provide(`userQuestionPanels`,{reveal:(e,t)=>n.reveal(e,t),review:(e,t,r)=>n.review(e,t,r)});e.effect(()=>r,`ui-user-questions: answer panels`),e.effect(()=>Y(e,n),`ui-user-questions: continued questions`),e.slots.inject(`conversation.composer`,()=>e.slots.register({name:`conversation.composer`,select:({pendingInteraction:e})=>e instanceof h?e:null,locale:G,store:t,inject:()=>({keyedHooks:{questionCard:e=>n.source(e)}}),children:{"conversation.plan-review.actions":{kind:`list`,scope:`session`}}},O)),e.uiConversation.events.register(R),e.slots.inject(`conversation.chat.node`,()=>e.slots.register({name:`conversation.chat.node`,key:`question-reply`,locale:G},V)),e.remote.$on(`user-questions/request`,function(t,r){return J(e,this,t,r,n)})}return n.apply=X,n.inject=K,t.exports}});
7
+ this.#e.get(e.key)===i&&(this.#e.delete(e.key),e.close(),r?.(),r=void 0)},trackRequest:e=>(t.add(e),()=>{t.delete(e)}),hasRequest:()=>t.size>0};return e.attachSeat({hide:e.review===void 0?i.hide:i.remove}),this.#e.set(e.key,i),i}reveal(e,t){let n=this.byCallId(e,t);return n!==void 0&&(n.reveal(),!0)}review(e,t,n){return(this.byCallId(e,t)??this.#t(new h(e,n.questions,s(t),()=>this.keysFor(e),n.answers))).reveal(),!0}dispose(){for(let e of this.values())e.pending.delegate(),e.remove()}};async function q(e,t,n,r,i){let a=e.sessions.scopeOf(t);if(a===void 0)return r();let o=n.wait?.callId,s=i.ensure(a,n.questions,o),c=new AbortController,l=n.signal===void 0?c.signal:AbortSignal.any([c.signal,n.signal]),u,d,f,p=n.wait?.timed===!0&&o!==void 0?e.effect(()=>(u=e.remote.userQuestions.attachWait(a,o,l),async()=>{f?.(),c.abort(),u?.dispose(),d!==void 0&&await Promise.allSettled([d])}),`ui-user-questions: foreground claim`):void 0,h=Promise.withResolvers(),g=s.trackRequest(h.promise);try{let e=u?.[Symbol.asyncIterator](),t=e===void 0?void 0:await e.next();if(t?.done===!0)return await r();let n=m(t===void 0?void 0:Date.now()+t.value.remainingMs,l,e=>{s.pending.detachWaterfall(e)});if(l.aborted)return await n.result;f=()=>{n.channel.delegate()},s.pending.attachWaterfall(n.channel),e!==void 0&&(d=(async()=>{throw await e.next(),Error(`the foreground question wait ended`)})());try{return await(d===void 0?n.result:Promise.race([n.result,d]))}catch(e){if(n.isDelegation(e))return await p?.(),await r();throw e}}finally{p===void 0?c.abort():d===void 0?await p():Promise.allSettled([d]).then(()=>{p()}),o===void 0&&s.remove(),h.resolve(),g()}}function J(e,t){let n=e.sessions,r=/* @__PURE__ */ new Map,i=e=>{if(!e.ok)throw Error(e.error.message);return e.value},a=(t,n)=>({answer:async r=>i(await e.remote.userQuestions.answer(t,n,r))}),o=()=>{let e=n.list.getSnapshot(),i=new Map(Object.values(e.byId).flatMap(e=>{let t=n.binding(e.id);return t===void 0?[]:[[e.id,t]]}));for(let[e,t]of r)i.has(e)||(t(),r.delete(e));for(let[e,t]of i){if(r.has(e))continue;let n=t.session.projections.faceOf(`userQuestions`).subscribe(o),i=t.session.projections.faceOf(`inbox`).subscribe(o);r.set(e,()=>{n(),i()})}let s=/* @__PURE__ */ new Map;for(let[e,t]of i){let n=t.session.projections.faceOf(`userQuestions`).getSnapshot(),r=t.session.projections.faceOf(`inbox`).getSnapshot(),i=/* @__PURE__ */ new Set;for(let e of[...r?.[`next-step`]??[],...r?.[`next-turn`]??[]]){if(typeof e!=`object`||!e||Array.isArray(e))continue;let t=e.source;typeof t==`object`&&t&&!Array.isArray(t)&&t.kind===`user-question-reply`&&typeof t.callId==`string`&&i.add(t.callId)}for(let t of n?.active??[])t.state===`continued`&&i.has(t.callId)||s.set(h.keyOf(e,t.callId),{sessionId:e,row:t})}for(let{sessionId:e,row:n}of s.values())if(n.state===`continued`){let r=t.ensure(e,n.questions,n.callId);r.pending.attachRpc(a(e,n.callId)),r.pending.setState(`continued`)}else t.byCallId(e,n.callId)?.pending.setState(`open`);for(let e of t.values())e.pending.callId===void 0||e.pending.review!==void 0||s.has(e.pending.key)||e.hasRequest()||e.pending.hasWaterfall()||e.remove()};o();let s=n.list.subscribe(o);return()=>{s();for(let e of r.values())e();r.clear()}}function Y(e){e.effect(()=>e.locale.register(W,{zh:H,en:U}),`ui-user-questions: dictionaries`);let t=g(),n=new K(e.uiSession.registerPendingInteraction(e=>e.kind===`plan-review`?2:1));e.effect(()=>()=>{n.dispose()},`ui-user-questions: cards`);let r=e.reflect.provide(`userQuestionPanels`,{reveal:(e,t)=>n.reveal(e,t),review:(e,t,r)=>n.review(e,t,r)});e.effect(()=>r,`ui-user-questions: answer panels`),e.effect(()=>J(e,n),`ui-user-questions: continued questions`),e.slots.inject(`conversation.composer`,()=>e.slots.register({name:`conversation.composer`,select:({pendingInteraction:e})=>e instanceof h?e:null,locale:W,store:t,inject:()=>({keyedHooks:{questionCard:e=>n.source(e)}}),children:{"conversation.plan-review.actions":{kind:`list`,scope:`session`}}},D)),e.uiConversation.events.register(L),e.slots.inject(`conversation.chat.node`,()=>e.slots.register({name:`conversation.chat.node`,key:`question-reply`,locale:W},B)),e.remote.$on(`user-questions/request`,function(t,r){return q(e,this,t,r,n)})}return n.apply=Y,n.inject=G,t.exports}});