@xopcai/xopc 0.0.165 → 0.0.166

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 (134) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CKVX2TyD.js → agent-avatar-dicebear-Tr2hgn4j.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-F8749KZ_.js → agents-DZ69tC4K.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-ClToHdDF.js → app-management-settings-panel-D7Nrbhez.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-Ci2jWAkQ.js → appearance-settings-DNNbABFj.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-DCow0nte.js → apps-page-0zXIeywq.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-CKv5A1_M.js → archive-plugin-CizqFy4G.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-LgoN-Vwo.js → attachment-load-DU8KjTua.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automation-suggestion-card-BwnZqDQE.js → automation-suggestion-card-3pqyIveW.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-DWWHMqCZ.js → automations-page-DSz3xDsi.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-WwMRnBdP.js → binary-plugins-CipUnsOr.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-CThEfJSn.js → block-editor-XoEq6qiv.js} +3 -3
  14. package/dist/gateway/static/root/assets/{browser-settings-page-7x8rKLOl.js → browser-settings-page-COYvq3y5.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DCj9DG0A.js → browser-workflow-inputs-DRH995XI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflows-page-C1k2vHLV.js → browser-workflows-page-65edjhpz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DIwGIpuS.js → capabilities-settings-panel-LOQyfdsM.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-api-C_NVbV7o.js → capability-presets-api-XL4h7dCK.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DBdvIcV0.js → capability-presets-settings-panel-KPJFkt1h.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-settings-DU93p9RZ.js → channels-settings-D8nH0mve.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connector-logo-au5xzRMl.js → connector-logo-n4Hg41iD.js} +1 -1
  22. package/dist/gateway/static/root/assets/{connectors-page-B9sD56hT.js → connectors-page-jvRWZn3Y.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-CaTO9bAV.js → desktop-pet-D4OzBOwm.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-CORq2BIE.js → desktop-pet-settings-CDGezbaf.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-Daf0tqrN.js → directory-picker-path-field-DmL4AUXQ.js} +1 -1
  26. package/dist/gateway/static/root/assets/{dreaming-settings-CJqJpvgc.js → dreaming-settings-ClUcBKnd.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-0XmiUqsm.js → extension-debug-page-DsV_KUDM.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-C_9HSvyu.js → extension-page-DJv_G1jY.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-DcmUCmOu.js → extension-settings-page-DUAlJ4CU.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-config-api-CZqfsxJf.js → gateway-config-api-SVYgzqv7.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-settings-CzX8TVmO.js → gateway-settings-YL6f2C_F.js} +1 -1
  32. package/dist/gateway/static/root/assets/{goal-create-dialog-Dbj_sgV-.js → goal-create-dialog-CJJe-4Co.js} +1 -1
  33. package/dist/gateway/static/root/assets/{goal-detail-page-BdkiZwW-.js → goal-detail-page-Da9VMWRd.js} +1 -1
  34. package/dist/gateway/static/root/assets/{goals-config-api-Cvlq3jyf.js → goals-config-api-st_Itxa9.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goals-page-BD9ztXNA.js → goals-page-B6pC7PYZ.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goals-settings-CSGvHJDi.js → goals-settings-BEZePZ5m.js} +1 -1
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-BvXA7oNN.js → heartbeat-settings-DpeD9GQ9.js} +1 -1
  38. package/dist/gateway/static/root/assets/{index-CfOzvGDb.js → index-BhQMnKH1.js} +6 -6
  39. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-xb6mna1C.js → keyboard-shortcuts-settings-fhssr2-J.js} +1 -1
  40. package/dist/gateway/static/root/assets/{local-app-workbench-page-DH4nglP_.js → local-app-workbench-page-Ctia6lSG.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-apps-page-BScdXqMo.js → local-apps-page-DWF9rpWQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{logs-page-BBpAWjyF.js → logs-page-D3gL6vHX.js} +1 -1
  43. package/dist/gateway/static/root/assets/{markdown-split-8hnAS25m.js → markdown-split-BuduJ0Ev.js} +1 -1
  44. package/dist/gateway/static/root/assets/{media-plugins-DzlHseMD.js → media-plugins-CLASZjhT.js} +1 -1
  45. package/dist/gateway/static/root/assets/{notes-page-DbDHFPiI.js → notes-page-ve3XiBDF.js} +1 -1
  46. package/dist/gateway/static/root/assets/{notes-workbench-B-A9whbg.js → notes-workbench-oHU532lp.js} +2 -2
  47. package/dist/gateway/static/root/assets/{page-tabs-CXJiygUJ.js → page-tabs-DU85jn98.js} +1 -1
  48. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cq6aue5a.js → preview-open-alternatives-CtchTuRQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{product-open-page-nP8vuNlJ.js → product-open-page-DFT6Fx6y.js} +1 -1
  50. package/dist/gateway/static/root/assets/{project-detail-page-BXrscUbq.js → project-detail-page-Ceu0NoC1.js} +1 -1
  51. package/dist/gateway/static/root/assets/{projects-page-m0EKUeaY.js → projects-page-CdpqOmO8.js} +1 -1
  52. package/dist/gateway/static/root/assets/{remote-access-hub-B16uQSY5.js → remote-access-hub-D1NKLyiR.js} +1 -1
  53. package/dist/gateway/static/root/assets/{save-bar-controls-BPgnLY1p.js → save-bar-controls-CmcrHpMc.js} +1 -1
  54. package/dist/gateway/static/root/assets/{schedule-field-rHWpueWl.js → schedule-field-DmIkP6JV.js} +1 -1
  55. package/dist/gateway/static/root/assets/{schema-form-CHKIUrzk.js → schema-form-Dkk9blN0.js} +1 -1
  56. package/dist/gateway/static/root/assets/{sessions-page-C5_qtznc.js → sessions-page-CMj_JaOk.js} +1 -1
  57. package/dist/gateway/static/root/assets/settings-advanced-gate-DR9Q2ZyF.js +1 -0
  58. package/dist/gateway/static/root/assets/{settings-form-section-CR4J0N4X.js → settings-form-section-CuQzWvg5.js} +1 -1
  59. package/dist/gateway/static/root/assets/{settings-loading-skeleton-B8v-lHKT.js → settings-loading-skeleton-C5FNbyej.js} +1 -1
  60. package/dist/gateway/static/root/assets/{settings-page-BcLf8Rd5.js → settings-page-a-A2yTGE.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-layout-Co31Becn.js → settings-page-layout-MuXpamWD.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-BFLA1Fsj.js → setup-status-panel-BUdh8FKY.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-B5vMe8DY.js → share-preview-page-BfzzmTgg.js} +1 -1
  64. package/dist/gateway/static/root/assets/{shares-settings-DL2tKPq6.js → shares-settings-8a9qnLF8.js} +1 -1
  65. package/dist/gateway/static/root/assets/{skill-reload-api-C8jkuLob.js → skill-reload-api-da5gLCer.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skills-page-DAOZXlp5.js → skills-page-CmHj-CKY.js} +1 -1
  67. package/dist/gateway/static/root/assets/{system-settings-panel-CHt3FXI8.js → system-settings-panel-CyhRkWMi.js} +1 -1
  68. package/dist/gateway/static/root/assets/{time-picker-C9Rr1IUV.js → time-picker-WEPp3HrB.js} +1 -1
  69. package/dist/gateway/static/root/assets/{typed-models-lib-QMF30Yvh.js → typed-models-lib-Bi1uoxFR.js} +1 -1
  70. package/dist/gateway/static/root/assets/{user-context-page-D6EEhj-e.js → user-context-page-BObEyiim.js} +1 -1
  71. package/dist/gateway/static/root/assets/{voice-api-key-field-Gjjs3qih.js → voice-api-key-field-Gvgodhec.js} +1 -1
  72. package/dist/gateway/static/root/assets/{work-discovery-page-CDnL9daG.js → work-discovery-page-BHnjvGH1.js} +1 -1
  73. package/dist/gateway/static/root/assets/{work-item-detail-page-BCoT4p1E.js → work-item-detail-page-CQ8ybkxx.js} +1 -1
  74. package/dist/gateway/static/root/assets/{work-page-l8h2Y50w.js → work-page-D_U_En23.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DnOfronD.js → workflow-run-setup-panel-B-Sk6gFn.js} +1 -1
  76. package/dist/gateway/static/root/assets/{workflows-page-IVbQ83CW.js → workflows-page-DT0pzfkz.js} +1 -1
  77. package/dist/gateway/static/root/index.html +1 -1
  78. package/dist/package.js +1 -1
  79. package/dist/src/agent/agent-manager.js +3 -3
  80. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  81. package/dist/src/agent/embedded/model-runtime.js +1 -1
  82. package/dist/src/agent/goals/post-turn.js +1 -1
  83. package/dist/src/agent/image/tool-model-config.js +1 -1
  84. package/dist/src/agent/ipc/inbox.js +1 -1
  85. package/dist/src/agent/memory/dreaming/config.js +1 -1
  86. package/dist/src/agent/service.js +2 -2
  87. package/dist/src/agent/skills/hub-lock.js +1 -1
  88. package/dist/src/agent-runtime/index.js +1 -1
  89. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  90. package/dist/src/auth/credentials.js +2 -2
  91. package/dist/src/auth/profiles/store.js +1 -1
  92. package/dist/src/auth/sync-provider-auth.js +2 -2
  93. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  94. package/dist/src/cli/commands/connectors.js +1 -1
  95. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  96. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  97. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  98. package/dist/src/cli/commands/models.js +1 -1
  99. package/dist/src/cli/commands/update.js +1 -1
  100. package/dist/src/config/agent-profile.js +1 -1
  101. package/dist/src/config/index.js +4 -4
  102. package/dist/src/config/loader.js +1 -1
  103. package/dist/src/config/models-json.js +1 -1
  104. package/dist/src/connectors/connector-memory-sync.js +1 -1
  105. package/dist/src/connectors/health.js +1 -1
  106. package/dist/src/extensions/lockfile.js +1 -1
  107. package/dist/src/gateway/agents-admin.js +2 -2
  108. package/dist/src/gateway/file-path-classifier.js +1 -1
  109. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  110. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  111. package/dist/src/gateway/hono/routes/models.js +1 -1
  112. package/dist/src/gateway/hono/routes/update.js +2 -2
  113. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  114. package/dist/src/gateway/index.js +1 -1
  115. package/dist/src/gateway/run-loop.js +1 -1
  116. package/dist/src/gateway/service/config-coordinator.js +1 -1
  117. package/dist/src/gateway/service.js +4 -4
  118. package/dist/src/goals/goal-workflow-judge.js +1 -1
  119. package/dist/src/infra/gateway-processes.js +1 -1
  120. package/dist/src/infra/update-restart.js +1 -1
  121. package/dist/src/infra/update-runner.js +2 -2
  122. package/dist/src/infra/update-startup.js +1 -1
  123. package/dist/src/mcp/channel-bridge.js +1 -1
  124. package/dist/src/notes/service.js +1 -1
  125. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  126. package/dist/src/providers/index.js +7 -4
  127. package/dist/src/providers/model-ref.d.ts +6 -0
  128. package/dist/src/providers/model-ref.js +15 -0
  129. package/dist/src/providers/model-registry.js +6 -3
  130. package/dist/src/tui/tui-startup-resources.js +2 -2
  131. package/dist/src/tui/tui.js +1 -1
  132. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  133. package/package.json +1 -1
  134. package/dist/gateway/static/root/assets/settings-advanced-gate-DQlbm1mA.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-C96Zjb0V.js";import{n as o}from"./locale-store-C_ax27uc.js";import{Ar as s,Dr as c,Mr as l,Nr as u,Or as d,Pr as f,Xo as p,jr as m,kr as h}from"./index-CfOzvGDb.js";import{n as g,r as _}from"./settings-page-layout-Co31Becn.js";var v=n(),y=e(t(),1),b=r(),x=s(),S=x?`⌘`:`Ctrl`;function C(e){let t=(0,v.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:u,setShortcut:d,legacyRecordingEvent:p,notice:h}=e,g=o(T),_;t[0]===g?_=t[1]:(_=a(g),t[0]=g,t[1]=_);let S=_.keyboardShortcutsSettings,[C,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null),k,A;t[2]!==p||t[3]!==C?(k=()=>{let e={active:C};return window.dispatchEvent(new CustomEvent(f,{detail:e})),p&&window.dispatchEvent(new CustomEvent(p,{detail:e})),()=>{let e={active:!1};window.dispatchEvent(new CustomEvent(f,{detail:e})),p&&window.dispatchEvent(new CustomEvent(p,{detail:e}))}},A=[p,C],t[2]=p,t[3]=C,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,y.useEffect)(k,A);let j;t[6]!==S.quickCaptureShortcutConflict||t[7]!==c||t[8]!==C||t[9]!==d?(j=e=>{if(!C)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){E(!1);return}let t=l(e.nativeEvent);if(!t)return;let n=x?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(S.quickCaptureShortcutConflict);return}d(t),O(null),E(!1)},t[6]=S.quickCaptureShortcutConflict,t[7]=c,t[8]=C,t[9]=d,t[10]=j):j=t[10];let M=j,N;t[11]===n?N=t[12]:(N=(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[11]=n,t[12]=N);let P;t[13]===r?P=t[14]:(P=(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[13]=r,t[14]=P);let F;t[15]!==N||t[16]!==P?(F=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[15]=N,t[16]=P,t[17]=F):F=t[17];let I;t[18]===s?I=t[19]:(I=m(s).map(w),t[18]=s,t[19]=I);let L;t[20]===I?L=t[21]:(L=(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[20]=I,t[21]=L);let R;t[22]!==F||t[23]!==L?(R=(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[22]=F,t[23]=L,t[24]=R):R=t[24];let z,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=i(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),E(!0)},t[25]=z,t[26]=B):(z=t[25],B=t[26]);let V;t[27]===S.quickCaptureShortcutChange?V=t[28]:(V=(0,b.jsx)(`button`,{type:`button`,className:z,onClick:B,children:S.quickCaptureShortcutChange}),t[27]=S.quickCaptureShortcutChange,t[28]=V);let H;t[29]!==u||t[30]!==d?(H=()=>{d(u()),O(null)},t[29]=u,t[30]=d,t[31]=H):H=t[31];let U;t[32]!==S.quickCaptureShortcutReset||t[33]!==H?(U=(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:H,children:S.quickCaptureShortcutReset}),t[32]=S.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==S.quickCaptureShortcutRecording||t[36]!==M||t[37]!==C?(W=C?(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg border border-accent bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none`,onKeyDown:M,onClick:()=>E(!1),children:S.quickCaptureShortcutRecording}):null,t[35]=S.quickCaptureShortcutRecording,t[36]=M,t[37]=C,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===D?K=t[44]:(K=D?(0,b.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:D}):null,t[43]=D,t[44]=K);let q;t[45]===h?q=t[46]:(q=h?(0,b.jsx)(`div`,{className:`mt-3 border-t border-edge pt-3`,children:h}):null,t[45]=h,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,b.jsxs)(`section`,{className:`rounded-xl bg-surface-base px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function w(e,t){return(0,b.jsx)(L,{children:e},`${e}-${String(t)}`)}function T(e){return e.language}function E(){let e=(0,v.c)(8),t=o(A),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=u(k),s=u(O),c=d(D),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==i||e[6]!==c?(l=(0,b.jsx)(C,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:i,otherShortcut:c,defaultShortcut:h,setShortcut:s,legacyRecordingEvent:`quick-capture-shortcut-recording`}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=i,e[6]=c,e[7]=l):l=e[7],l}function D(e){return e.shortcut}function O(e){return e.setShortcut}function k(e){return e.shortcut}function A(e){return e.language}function j(){let e=(0,v.c)(9),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=d(P),s=d(N),l=u(M),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,b.jsx)(I,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==i?(p=(0,b.jsx)(C,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:i,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=i,e[8]=p):p=e[8],p}function M(e){return e.shortcut}function N(e){return e.setShortcut}function P(e){return e.shortcut}function F(e){return e.language}function I(){let e=a(o(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=p()&&window.electronAPI?.platform===`darwin`,[r,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&s(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,b.jsx)(`button`,{type:`button`,disabled:c,className:i(`rounded-lg border border-edge-strong bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{l(!0);try{s((await t.requestAccessibility()).status===`granted`)}finally{l(!1)}},children:c?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function L(e){let t=(0,v.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,b.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md border border-edge-subtle bg-surface-hover/60 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-[0_1px_0_0_var(--color-edge-subtle)]`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=(0,v.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,b.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,b.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(z),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function z(e){return(0,b.jsx)(L,{children:e},e)}function B(e){let t=(0,v.c)(11),{title:n,shortcuts:r}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=i(`rounded-xl bg-surface-base px-4 sm:px-5`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,b.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=o);let s;t[3]===r?s=t[4]:(s=r.map(V),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,b.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==o||t[8]!==c||t[9]!==n?(l=(0,b.jsxs)(`section`,{className:a,"aria-label":n,children:[o,c]}),t[7]=o,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function V(e){return(0,b.jsx)(R,{...e},e.label)}function H(){let e=(0,v.c)(134),t=o(K),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=u(G),s=d(W),c;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatVoiceInput||e[10]!==r.editorBulletList||e[11]!==r.editorHeading1||e[12]!==r.editorHeading2||e[13]!==r.editorHeading3||e[14]!==r.editorOrderedList||e[15]!==r.editorTaskList||e[16]!==r.globalNewChat||e[17]!==r.globalOpenSettings||e[18]!==r.globalToggleWindow||e[19]!==r.globalVoiceInput||e[20]!==r.globalVoiceInputMacNote||e[21]!==r.globalVoiceInputWindowsNote||e[22]!==r.navCloseDialog||e[23]!==r.navCommandPalette||e[24]!==r.navQuickCapture||e[25]!==r.navToggleFullscreen||e[26]!==r.navToggleSidebar||e[27]!==i||e[28]!==s){if(c=[],p()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(i=[S,`Shift`,`Space`],e[30]=i):i=e[30];let a;e[31]===r.globalToggleWindow?a=e[32]:(a={keys:i,label:r.globalToggleWindow},e[31]=r.globalToggleWindow,e[32]=a);let o;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[33]=o):o=e[33];let s;e[34]!==r.globalVoiceInput||e[35]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[34]=r.globalVoiceInput,e[35]=n,e[36]=s):s=e[36];let l;e[37]!==a||e[38]!==s?(l=[a,s],e[37]=a,e[38]=s,e[39]=l):l=e[39];let u;e[40]!==r.categoryGlobal||e[41]!==l?(u={title:r.categoryGlobal,shortcuts:l},e[40]=r.categoryGlobal,e[41]=l,e[42]=u):u=e[42],c.push(u)}let t=r.categoryNavigation,n;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(n=[S,`N`],e[43]=n):n=e[43];let a;e[44]===r.globalNewChat?a=e[45]:(a={keys:n,label:r.globalNewChat},e[44]=r.globalNewChat,e[45]=a);let o;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(o=[S,`K`],e[46]=o):o=e[46];let l;e[47]===r.navCommandPalette?l=e[48]:(l={keys:o,label:r.navCommandPalette},e[47]=r.navCommandPalette,e[48]=l);let u;e[49]===i?u=e[50]:(u=m(i),e[49]=i,e[50]=u);let d;e[51]!==r.navQuickCapture||e[52]!==u?(d={keys:u,label:r.navQuickCapture},e[51]=r.navQuickCapture,e[52]=u,e[53]=d):d=e[53];let f;e[54]===r.navToggleSidebar?f=e[55]:(f=p()?[{keys:[S,`B`],label:r.navToggleSidebar}]:[],e[54]=r.navToggleSidebar,e[55]=f);let h;e[56]===r.navToggleFullscreen?h=e[57]:(h=p()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[56]=r.navToggleFullscreen,e[57]=h);let g;e[58]===r.globalOpenSettings?g=e[59]:(g=p()?[{keys:[S,`,`],label:r.globalOpenSettings}]:[],e[58]=r.globalOpenSettings,e[59]=g);let _;e[60]===Symbol.for(`react.memo_cache_sentinel`)?(_=[`Esc`],e[60]=_):_=e[60];let v;e[61]===r.navCloseDialog?v=e[62]:(v={keys:_,label:r.navCloseDialog},e[61]=r.navCloseDialog,e[62]=v);let y;e[63]!==g||e[64]!==v||e[65]!==a||e[66]!==l||e[67]!==d||e[68]!==f||e[69]!==h?(y=[a,l,d,...f,...h,...g,v],e[63]=g,e[64]=v,e[65]=a,e[66]=l,e[67]=d,e[68]=f,e[69]=h,e[70]=y):y=e[70];let b;e[71]!==r.categoryNavigation||e[72]!==y?(b={title:t,shortcuts:y},e[71]=r.categoryNavigation,e[72]=y,e[73]=b):b=e[73],c.push(b);let x=r.categoryChat,C;e[74]===Symbol.for(`react.memo_cache_sentinel`)?(C=[`Enter`],e[74]=C):C=e[74];let w;e[75]===r.chatSend?w=e[76]:(w={keys:C,label:r.chatSend},e[75]=r.chatSend,e[76]=w);let T;e[77]===Symbol.for(`react.memo_cache_sentinel`)?(T=[`Shift`,`Enter`],e[77]=T):T=e[77];let E;e[78]===r.chatNewLine?E=e[79]:(E={keys:T,label:r.chatNewLine},e[78]=r.chatNewLine,e[79]=E);let D;e[80]===Symbol.for(`react.memo_cache_sentinel`)?(D=[S,`Enter`],e[80]=D):D=e[80];let O;e[81]===r.chatForceSend?O=e[82]:(O={keys:D,label:r.chatForceSend},e[81]=r.chatForceSend,e[82]=O);let k;e[83]===s?k=e[84]:(k=m(s),e[83]=s,e[84]=k);let A;e[85]!==r.chatVoiceInput||e[86]!==k?(A={keys:k,label:r.chatVoiceInput},e[85]=r.chatVoiceInput,e[86]=k,e[87]=A):A=e[87];let j;e[88]!==w||e[89]!==E||e[90]!==O||e[91]!==A?(j=[w,E,O,A],e[88]=w,e[89]=E,e[90]=O,e[91]=A,e[92]=j):j=e[92];let M;e[93]!==r.categoryChat||e[94]!==j?(M={title:x,shortcuts:j},e[93]=r.categoryChat,e[94]=j,e[95]=M):M=e[95],c.push(M);let N;e[96]===Symbol.for(`react.memo_cache_sentinel`)?(N=[S,`Shift`,`1`],e[96]=N):N=e[96];let P;e[97]===r.editorHeading1?P=e[98]:(P={keys:N,label:r.editorHeading1},e[97]=r.editorHeading1,e[98]=P);let F;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(F=[S,`Shift`,`2`],e[99]=F):F=e[99];let I;e[100]===r.editorHeading2?I=e[101]:(I={keys:F,label:r.editorHeading2},e[100]=r.editorHeading2,e[101]=I);let L;e[102]===Symbol.for(`react.memo_cache_sentinel`)?(L=[S,`Shift`,`3`],e[102]=L):L=e[102];let R;e[103]===r.editorHeading3?R=e[104]:(R={keys:L,label:r.editorHeading3},e[103]=r.editorHeading3,e[104]=R);let z;e[105]===Symbol.for(`react.memo_cache_sentinel`)?(z=[S,`Shift`,`8`],e[105]=z):z=e[105];let B;e[106]===r.editorBulletList?B=e[107]:(B={keys:z,label:r.editorBulletList},e[106]=r.editorBulletList,e[107]=B);let V;e[108]===Symbol.for(`react.memo_cache_sentinel`)?(V=[S,`Shift`,`9`],e[108]=V):V=e[108];let H;e[109]===r.editorOrderedList?H=e[110]:(H={keys:V,label:r.editorOrderedList},e[109]=r.editorOrderedList,e[110]=H);let U;e[111]===Symbol.for(`react.memo_cache_sentinel`)?(U=[S,`Shift`,`0`],e[111]=U):U=e[111];let W;e[112]===r.editorTaskList?W=e[113]:(W={keys:U,label:r.editorTaskList},e[112]=r.editorTaskList,e[113]=W);let G;e[114]!==P||e[115]!==I||e[116]!==R||e[117]!==B||e[118]!==H||e[119]!==W?(G=[P,I,R,B,H,W],e[114]=P,e[115]=I,e[116]=R,e[117]=B,e[118]=H,e[119]=W,e[120]=G):G=e[120];let K;e[121]!==r.categoryEditor||e[122]!==G?(K={title:r.categoryEditor,shortcuts:G},e[121]=r.categoryEditor,e[122]=G,e[123]=K):K=e[123],c.push(K),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatVoiceInput,e[10]=r.editorBulletList,e[11]=r.editorHeading1,e[12]=r.editorHeading2,e[13]=r.editorHeading3,e[14]=r.editorOrderedList,e[15]=r.editorTaskList,e[16]=r.globalNewChat,e[17]=r.globalOpenSettings,e[18]=r.globalToggleWindow,e[19]=r.globalVoiceInput,e[20]=r.globalVoiceInputMacNote,e[21]=r.globalVoiceInputWindowsNote,e[22]=r.navCloseDialog,e[23]=r.navCommandPalette,e[24]=r.navQuickCapture,e[25]=r.navToggleFullscreen,e[26]=r.navToggleSidebar,e[27]=i,e[28]=s,e[29]=c}else c=e[29];let l;e[124]!==r.pageTitle||e[125]!==r.subtitle?(l=(0,b.jsx)(g,{title:r.pageTitle,subtitle:r.subtitle}),e[124]=r.pageTitle,e[125]=r.subtitle,e[126]=l):l=e[126];let f,h;e[127]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,b.jsx)(E,{}),h=(0,b.jsx)(j,{}),e[127]=f,e[128]=h):(f=e[127],h=e[128]);let y;e[129]===c?y=e[130]:(y=c.map(U),e[129]=c,e[130]=y);let x;return e[131]!==l||e[132]!==y?(x=(0,b.jsxs)(_,{gap:`gap-6`,children:[l,f,h,y]}),e[131]=l,e[132]=y,e[133]=x):x=e[133],x}function U(e){return(0,b.jsx)(B,{...e},e.title)}function W(e){return e.shortcut}function G(e){return e.shortcut}function K(e){return e.language}export{H as KeyboardShortcutsSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-C96Zjb0V.js";import{n as o}from"./locale-store-C_ax27uc.js";import{Ar as s,Dr as c,Mr as l,Nr as u,Or as d,Pr as f,Xo as p,jr as m,kr as h}from"./index-BhQMnKH1.js";import{n as g,r as _}from"./settings-page-layout-MuXpamWD.js";var v=n(),y=e(t(),1),b=r(),x=s(),S=x?`⌘`:`Ctrl`;function C(e){let t=(0,v.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:u,setShortcut:d,legacyRecordingEvent:p,notice:h}=e,g=o(T),_;t[0]===g?_=t[1]:(_=a(g),t[0]=g,t[1]=_);let S=_.keyboardShortcutsSettings,[C,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null),k,A;t[2]!==p||t[3]!==C?(k=()=>{let e={active:C};return window.dispatchEvent(new CustomEvent(f,{detail:e})),p&&window.dispatchEvent(new CustomEvent(p,{detail:e})),()=>{let e={active:!1};window.dispatchEvent(new CustomEvent(f,{detail:e})),p&&window.dispatchEvent(new CustomEvent(p,{detail:e}))}},A=[p,C],t[2]=p,t[3]=C,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,y.useEffect)(k,A);let j;t[6]!==S.quickCaptureShortcutConflict||t[7]!==c||t[8]!==C||t[9]!==d?(j=e=>{if(!C)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){E(!1);return}let t=l(e.nativeEvent);if(!t)return;let n=x?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(S.quickCaptureShortcutConflict);return}d(t),O(null),E(!1)},t[6]=S.quickCaptureShortcutConflict,t[7]=c,t[8]=C,t[9]=d,t[10]=j):j=t[10];let M=j,N;t[11]===n?N=t[12]:(N=(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[11]=n,t[12]=N);let P;t[13]===r?P=t[14]:(P=(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[13]=r,t[14]=P);let F;t[15]!==N||t[16]!==P?(F=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[15]=N,t[16]=P,t[17]=F):F=t[17];let I;t[18]===s?I=t[19]:(I=m(s).map(w),t[18]=s,t[19]=I);let L;t[20]===I?L=t[21]:(L=(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[20]=I,t[21]=L);let R;t[22]!==F||t[23]!==L?(R=(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[22]=F,t[23]=L,t[24]=R):R=t[24];let z,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=i(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),E(!0)},t[25]=z,t[26]=B):(z=t[25],B=t[26]);let V;t[27]===S.quickCaptureShortcutChange?V=t[28]:(V=(0,b.jsx)(`button`,{type:`button`,className:z,onClick:B,children:S.quickCaptureShortcutChange}),t[27]=S.quickCaptureShortcutChange,t[28]=V);let H;t[29]!==u||t[30]!==d?(H=()=>{d(u()),O(null)},t[29]=u,t[30]=d,t[31]=H):H=t[31];let U;t[32]!==S.quickCaptureShortcutReset||t[33]!==H?(U=(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:H,children:S.quickCaptureShortcutReset}),t[32]=S.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==S.quickCaptureShortcutRecording||t[36]!==M||t[37]!==C?(W=C?(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg border border-accent bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none`,onKeyDown:M,onClick:()=>E(!1),children:S.quickCaptureShortcutRecording}):null,t[35]=S.quickCaptureShortcutRecording,t[36]=M,t[37]=C,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===D?K=t[44]:(K=D?(0,b.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:D}):null,t[43]=D,t[44]=K);let q;t[45]===h?q=t[46]:(q=h?(0,b.jsx)(`div`,{className:`mt-3 border-t border-edge pt-3`,children:h}):null,t[45]=h,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,b.jsxs)(`section`,{className:`rounded-xl bg-surface-base px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function w(e,t){return(0,b.jsx)(L,{children:e},`${e}-${String(t)}`)}function T(e){return e.language}function E(){let e=(0,v.c)(8),t=o(A),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=u(k),s=u(O),c=d(D),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==i||e[6]!==c?(l=(0,b.jsx)(C,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:i,otherShortcut:c,defaultShortcut:h,setShortcut:s,legacyRecordingEvent:`quick-capture-shortcut-recording`}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=i,e[6]=c,e[7]=l):l=e[7],l}function D(e){return e.shortcut}function O(e){return e.setShortcut}function k(e){return e.shortcut}function A(e){return e.language}function j(){let e=(0,v.c)(9),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=d(P),s=d(N),l=u(M),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,b.jsx)(I,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==i?(p=(0,b.jsx)(C,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:i,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=i,e[8]=p):p=e[8],p}function M(e){return e.shortcut}function N(e){return e.setShortcut}function P(e){return e.shortcut}function F(e){return e.language}function I(){let e=a(o(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=p()&&window.electronAPI?.platform===`darwin`,[r,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&s(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,b.jsx)(`button`,{type:`button`,disabled:c,className:i(`rounded-lg border border-edge-strong bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{l(!0);try{s((await t.requestAccessibility()).status===`granted`)}finally{l(!1)}},children:c?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function L(e){let t=(0,v.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,b.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md border border-edge-subtle bg-surface-hover/60 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-[0_1px_0_0_var(--color-edge-subtle)]`,children:n}),t[0]=n,t[1]=r),r}function R(e){let t=(0,v.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,b.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,b.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(z),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function z(e){return(0,b.jsx)(L,{children:e},e)}function B(e){let t=(0,v.c)(11),{title:n,shortcuts:r}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=i(`rounded-xl bg-surface-base px-4 sm:px-5`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,b.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=o);let s;t[3]===r?s=t[4]:(s=r.map(V),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,b.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==o||t[8]!==c||t[9]!==n?(l=(0,b.jsxs)(`section`,{className:a,"aria-label":n,children:[o,c]}),t[7]=o,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function V(e){return(0,b.jsx)(R,{...e},e.label)}function H(){let e=(0,v.c)(134),t=o(K),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,i=u(G),s=d(W),c;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatVoiceInput||e[10]!==r.editorBulletList||e[11]!==r.editorHeading1||e[12]!==r.editorHeading2||e[13]!==r.editorHeading3||e[14]!==r.editorOrderedList||e[15]!==r.editorTaskList||e[16]!==r.globalNewChat||e[17]!==r.globalOpenSettings||e[18]!==r.globalToggleWindow||e[19]!==r.globalVoiceInput||e[20]!==r.globalVoiceInputMacNote||e[21]!==r.globalVoiceInputWindowsNote||e[22]!==r.navCloseDialog||e[23]!==r.navCommandPalette||e[24]!==r.navQuickCapture||e[25]!==r.navToggleFullscreen||e[26]!==r.navToggleSidebar||e[27]!==i||e[28]!==s){if(c=[],p()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(i=[S,`Shift`,`Space`],e[30]=i):i=e[30];let a;e[31]===r.globalToggleWindow?a=e[32]:(a={keys:i,label:r.globalToggleWindow},e[31]=r.globalToggleWindow,e[32]=a);let o;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[33]=o):o=e[33];let s;e[34]!==r.globalVoiceInput||e[35]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[34]=r.globalVoiceInput,e[35]=n,e[36]=s):s=e[36];let l;e[37]!==a||e[38]!==s?(l=[a,s],e[37]=a,e[38]=s,e[39]=l):l=e[39];let u;e[40]!==r.categoryGlobal||e[41]!==l?(u={title:r.categoryGlobal,shortcuts:l},e[40]=r.categoryGlobal,e[41]=l,e[42]=u):u=e[42],c.push(u)}let t=r.categoryNavigation,n;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(n=[S,`N`],e[43]=n):n=e[43];let a;e[44]===r.globalNewChat?a=e[45]:(a={keys:n,label:r.globalNewChat},e[44]=r.globalNewChat,e[45]=a);let o;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(o=[S,`K`],e[46]=o):o=e[46];let l;e[47]===r.navCommandPalette?l=e[48]:(l={keys:o,label:r.navCommandPalette},e[47]=r.navCommandPalette,e[48]=l);let u;e[49]===i?u=e[50]:(u=m(i),e[49]=i,e[50]=u);let d;e[51]!==r.navQuickCapture||e[52]!==u?(d={keys:u,label:r.navQuickCapture},e[51]=r.navQuickCapture,e[52]=u,e[53]=d):d=e[53];let f;e[54]===r.navToggleSidebar?f=e[55]:(f=p()?[{keys:[S,`B`],label:r.navToggleSidebar}]:[],e[54]=r.navToggleSidebar,e[55]=f);let h;e[56]===r.navToggleFullscreen?h=e[57]:(h=p()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[56]=r.navToggleFullscreen,e[57]=h);let g;e[58]===r.globalOpenSettings?g=e[59]:(g=p()?[{keys:[S,`,`],label:r.globalOpenSettings}]:[],e[58]=r.globalOpenSettings,e[59]=g);let _;e[60]===Symbol.for(`react.memo_cache_sentinel`)?(_=[`Esc`],e[60]=_):_=e[60];let v;e[61]===r.navCloseDialog?v=e[62]:(v={keys:_,label:r.navCloseDialog},e[61]=r.navCloseDialog,e[62]=v);let y;e[63]!==g||e[64]!==v||e[65]!==a||e[66]!==l||e[67]!==d||e[68]!==f||e[69]!==h?(y=[a,l,d,...f,...h,...g,v],e[63]=g,e[64]=v,e[65]=a,e[66]=l,e[67]=d,e[68]=f,e[69]=h,e[70]=y):y=e[70];let b;e[71]!==r.categoryNavigation||e[72]!==y?(b={title:t,shortcuts:y},e[71]=r.categoryNavigation,e[72]=y,e[73]=b):b=e[73],c.push(b);let x=r.categoryChat,C;e[74]===Symbol.for(`react.memo_cache_sentinel`)?(C=[`Enter`],e[74]=C):C=e[74];let w;e[75]===r.chatSend?w=e[76]:(w={keys:C,label:r.chatSend},e[75]=r.chatSend,e[76]=w);let T;e[77]===Symbol.for(`react.memo_cache_sentinel`)?(T=[`Shift`,`Enter`],e[77]=T):T=e[77];let E;e[78]===r.chatNewLine?E=e[79]:(E={keys:T,label:r.chatNewLine},e[78]=r.chatNewLine,e[79]=E);let D;e[80]===Symbol.for(`react.memo_cache_sentinel`)?(D=[S,`Enter`],e[80]=D):D=e[80];let O;e[81]===r.chatForceSend?O=e[82]:(O={keys:D,label:r.chatForceSend},e[81]=r.chatForceSend,e[82]=O);let k;e[83]===s?k=e[84]:(k=m(s),e[83]=s,e[84]=k);let A;e[85]!==r.chatVoiceInput||e[86]!==k?(A={keys:k,label:r.chatVoiceInput},e[85]=r.chatVoiceInput,e[86]=k,e[87]=A):A=e[87];let j;e[88]!==w||e[89]!==E||e[90]!==O||e[91]!==A?(j=[w,E,O,A],e[88]=w,e[89]=E,e[90]=O,e[91]=A,e[92]=j):j=e[92];let M;e[93]!==r.categoryChat||e[94]!==j?(M={title:x,shortcuts:j},e[93]=r.categoryChat,e[94]=j,e[95]=M):M=e[95],c.push(M);let N;e[96]===Symbol.for(`react.memo_cache_sentinel`)?(N=[S,`Shift`,`1`],e[96]=N):N=e[96];let P;e[97]===r.editorHeading1?P=e[98]:(P={keys:N,label:r.editorHeading1},e[97]=r.editorHeading1,e[98]=P);let F;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(F=[S,`Shift`,`2`],e[99]=F):F=e[99];let I;e[100]===r.editorHeading2?I=e[101]:(I={keys:F,label:r.editorHeading2},e[100]=r.editorHeading2,e[101]=I);let L;e[102]===Symbol.for(`react.memo_cache_sentinel`)?(L=[S,`Shift`,`3`],e[102]=L):L=e[102];let R;e[103]===r.editorHeading3?R=e[104]:(R={keys:L,label:r.editorHeading3},e[103]=r.editorHeading3,e[104]=R);let z;e[105]===Symbol.for(`react.memo_cache_sentinel`)?(z=[S,`Shift`,`8`],e[105]=z):z=e[105];let B;e[106]===r.editorBulletList?B=e[107]:(B={keys:z,label:r.editorBulletList},e[106]=r.editorBulletList,e[107]=B);let V;e[108]===Symbol.for(`react.memo_cache_sentinel`)?(V=[S,`Shift`,`9`],e[108]=V):V=e[108];let H;e[109]===r.editorOrderedList?H=e[110]:(H={keys:V,label:r.editorOrderedList},e[109]=r.editorOrderedList,e[110]=H);let U;e[111]===Symbol.for(`react.memo_cache_sentinel`)?(U=[S,`Shift`,`0`],e[111]=U):U=e[111];let W;e[112]===r.editorTaskList?W=e[113]:(W={keys:U,label:r.editorTaskList},e[112]=r.editorTaskList,e[113]=W);let G;e[114]!==P||e[115]!==I||e[116]!==R||e[117]!==B||e[118]!==H||e[119]!==W?(G=[P,I,R,B,H,W],e[114]=P,e[115]=I,e[116]=R,e[117]=B,e[118]=H,e[119]=W,e[120]=G):G=e[120];let K;e[121]!==r.categoryEditor||e[122]!==G?(K={title:r.categoryEditor,shortcuts:G},e[121]=r.categoryEditor,e[122]=G,e[123]=K):K=e[123],c.push(K),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatVoiceInput,e[10]=r.editorBulletList,e[11]=r.editorHeading1,e[12]=r.editorHeading2,e[13]=r.editorHeading3,e[14]=r.editorOrderedList,e[15]=r.editorTaskList,e[16]=r.globalNewChat,e[17]=r.globalOpenSettings,e[18]=r.globalToggleWindow,e[19]=r.globalVoiceInput,e[20]=r.globalVoiceInputMacNote,e[21]=r.globalVoiceInputWindowsNote,e[22]=r.navCloseDialog,e[23]=r.navCommandPalette,e[24]=r.navQuickCapture,e[25]=r.navToggleFullscreen,e[26]=r.navToggleSidebar,e[27]=i,e[28]=s,e[29]=c}else c=e[29];let l;e[124]!==r.pageTitle||e[125]!==r.subtitle?(l=(0,b.jsx)(g,{title:r.pageTitle,subtitle:r.subtitle}),e[124]=r.pageTitle,e[125]=r.subtitle,e[126]=l):l=e[126];let f,h;e[127]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,b.jsx)(E,{}),h=(0,b.jsx)(j,{}),e[127]=f,e[128]=h):(f=e[127],h=e[128]);let y;e[129]===c?y=e[130]:(y=c.map(U),e[129]=c,e[130]=y);let x;return e[131]!==l||e[132]!==y?(x=(0,b.jsxs)(_,{gap:`gap-6`,children:[l,f,h,y]}),e[131]=l,e[132]=y,e[133]=x):x=e[133],x}function U(e){return(0,b.jsx)(B,{...e},e.title)}function W(e){return e.shortcut}function G(e){return e.shortcut}function K(e){return e.language}export{H as KeyboardShortcutsSettingsPanel};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as s}from"./check-DUBLcKHA.js";import{n as c,r as l}from"./locale-store-C_ax27uc.js";import{a as u,i as d}from"./vendor-swr-BIWyz7Rc.js";import{$c as f,Ba as p,Co as m,Ec as ee,Fu as h,Go as g,Hl as te,Is as _,Jo as v,Js as ne,Kl as y,Ko as b,Ll as x,Ma as re,Mc as ie,Ns as S,Tl as ae,To as oe,Uc as se,Uo as ce,Wo as C,Yo as le,Ys as ue,au as de,bt as w,hu as fe,jc as pe,lc as me,lu as he,pc as ge,qo as _e,rl as T,ro as E,wc as ve}from"./index-CfOzvGDb.js";import{a as ye,c as be,l as xe,n as Se,o as Ce,r as we,s as Te,t as Ee}from"./api-DPIXEcIq.js";var D=e(t(),1),De=`build-xopc-local-app`;function Oe(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function ke(e){return e.find(e=>Oe(e)===`coder`)??null}function Ae(e,t){let n=new URLSearchParams({skill:De}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var O=new Set([`document`,`content`,`interaction`,`criteria`]),je=new Set([`passed`,`failed`,`skipped`]);function Me(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.source!==`xopc-local-app-preview`||t.version!==1)return null;if(t.type===`ready`)return{type:`ready`,detail:{}};if(t.type===`criteria`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.scenarios)||e.scenarios.length>10)return null;let n=e.scenarios.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||!t.id.trim()||t.id.length>80||typeof t.name!=`string`||!t.name.trim()||t.name.length>120||t.status!==`passed`&&t.status!==`failed`||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,name:t.name,status:t.status,message:t.message.slice(0,500),failureKind:`scenario`}});if(n.some(e=>e===null))return null;let r=typeof e.scenarioCount==`number`&&Number.isInteger(e.scenarioCount)&&e.scenarioCount>=0&&e.scenarioCount<=10?e.scenarioCount:n.length;return{type:`criteria`,detail:{status:e.status,scenarioCount:r,scenarios:n}}}if(t.type===`acceptance`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.checks))return null;let n=e.checks.slice(0,10).map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return!O.has(t.id)||!je.has(t.status)||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,status:t.status,message:t.message.slice(0,500)}});if(!n.length||n.some(e=>e===null))return null;let r=typeof e.interactiveCount==`number`&&Number.isFinite(e.interactiveCount)&&e.interactiveCount>=0?Math.min(Math.floor(e.interactiveCount),1e4):0;return{type:`acceptance`,detail:{status:e.status,checks:n,interactiveCount:r}}}if(t.type!==`error`||!t.detail||typeof t.detail!=`object`)return null;let n=t.detail;return n.kind!==`script_error`&&n.kind!==`unhandled_rejection`||typeof n.message!=`string`||!n.message.trim()?null:{type:`error`,detail:{kind:n.kind,message:n.message.slice(0,500),filename:typeof n.filename==`string`?n.filename.slice(0,500):void 0,line:typeof n.line==`number`?n.line:void 0,column:typeof n.column==`number`?n.column:void 0}}}function Ne(e){return e?.checks.filter(e=>e.status===`failed`).map(e=>e.message)??[]}function Pe(e){let t=e.filename?` (${e.filename}${e.line?`:${e.line}${e.column?`:${e.column}`:``}`:``})`:``;return`${e.message}${t}`}var Fe=Object.freeze({source:`xopc-local-app-host`,version:1,type:`connect`});function Ie(e,t){let n=null,r=()=>{n?.close();let r=new MessageChannel;n=r.port1,n.onmessage=e=>t(e.data),n.start(),e.contentWindow?.postMessage(Fe,`*`,[r.port2])};return e.addEventListener(`load`,r),r(),()=>{e.removeEventListener(`load`,r),n?.close()}}var Le=n(),k=r();function Re(e){let t=(0,Le.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let l=a?`产品场景`:`Product scenarios`,u;t[0]===l?u=t[1]:(u=(0,k.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,p;t[2]===d?p=t[3]:(p=(0,k.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:d}),t[2]=d,t[3]=p);let m;t[4]!==u||t[5]!==p?(m=(0,k.jsxs)(`div`,{children:[u,p]}),t[4]=u,t[5]=p,t[6]=m):m=t[6];let h=i!==null,g;t[7]===i?g=t[8]:(g=i===`all`?(0,k.jsx)(T,{className:`size-3 animate-spin`}):(0,k.jsx)(ee,{className:`size-3`}),t[7]=i,t[8]=g);let te=a?`全部重跑`:`Run all`,_;t[9]!==o||t[10]!==h||t[11]!==g||t[12]!==te?(_=(0,k.jsxs)(S,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:h,children:[g,te]}),t[9]=o,t[10]=h,t[11]=g,t[12]=te,t[13]=_):_=t[13];let v;t[14]!==m||t[15]!==_?(v=(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[14]=m,t[15]=_,t[16]=v):v=t[16];let ne=a?`产品场景验收结果`:`Product scenario acceptance results`,y;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,k.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,k.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,k.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,k.jsx)(T,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,k.jsx)(fe,{className:`size-3.5 text-success`}):n===`failed`?(0,k.jsx)(he,{className:`size-3.5 text-danger`}):(0,k.jsx)(de,{className:`size-3.5 text-fg-subtle`})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,k.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,k.jsx)(S,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,k.jsx)(ee,{className:`size-3`})})]}),n===`running`?(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,k.jsxs)(`div`,{className:`mt-1.5`,children:[(0,k.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,k.jsxs)(S,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,k.jsx)(f,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],y=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=y}else y=t[23];let b;t[30]!==ne||t[31]!==y?(b=(0,k.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":ne,children:y}),t[30]=ne,t[31]=y,t[32]=b):b=t[32];let x;return t[33]!==v||t[34]!==b?(x=(0,k.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[v,b]}),t[33]=v,t[34]=b,t[35]=x):x=t[35],x}var ze=`allow-scripts allow-forms`;function Be(e,t){return w(e,t)}function Ve(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function A(){let{appId:e}=o(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),de=i(),{mutate:w}=u(),he=m(e=>e.moveToFront),De=oe(e=>e.setPageHeader),Oe=oe(e=>e.clearPageHeader),{data:O,isLoading:je,error:Fe,mutate:Le}=d(!t&&e?[`local-app`,e]:null,()=>Se(e)),{data:A,isLoading:He,mutate:Ue}=d(!t&&e?[`local-app-validation`,e]:null,()=>xe(e)),[We,Ge]=(0,D.useState)(``),[Ke,qe]=(0,D.useState)(``),[j,M]=(0,D.useState)(!1),[Je,N]=(0,D.useState)(null),[Ye,Xe]=(0,D.useState)(!1),[Ze,Qe]=(0,D.useState)(!1),[$e,et]=(0,D.useState)(0),[tt,nt]=(0,D.useState)(``),[P,rt]=(0,D.useState)(!1),[F,it]=(0,D.useState)(!1),[I,L]=(0,D.useState)(`booting`),[R,at]=(0,D.useState)(null),[z,ot]=(0,D.useState)(null),[B,st]=(0,D.useState)({}),[V,ct]=(0,D.useState)(`all`),[H,U]=(0,D.useState)(0),[lt,ut]=(0,D.useState)(0),[dt,ft]=(0,D.useState)(null),[W,pt]=(0,D.useState)(null),[mt,ht]=(0,D.useState)([]),[G,gt]=(0,D.useState)(!1),_t=(0,D.useRef)(new Set),K=(0,D.useRef)(null),vt=(0,D.useRef)(null),yt=(0,D.useRef)(null),q=(0,D.useRef)(null),J=(0,D.useRef)(``),Y=A?.acceptanceScenarios??[],X=(0,D.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>B[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,B]),Z=(0,D.useMemo)(()=>{if(!z)return null;if(!A?.acceptanceScenarioCount)return z;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...z.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:z.interactiveCount}},[z,X,A?.acceptanceScenarioCount]),bt=(0,D.useCallback)(async(e,t)=>{let n=ke(await p(e.projectId))??await re(e.projectId,`coder`);_t.current.add(n.key),de(Ae(n.key,t))},[de]),xt=(0,D.useCallback)(async(e=!0)=>{if(!O)return null;it(!0);try{let t=await xe(O.id);return await Ue(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ct(`all`),U(0),et(e=>e+1)),t}catch(e){return N(e instanceof Error?e.message:String(e)),null}finally{it(!1)}},[O,Ue]);(0,D.useEffect)(()=>{if(!O)return;let e=!1;p(O.projectId).then(t=>{e||(_t.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!_t.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,xt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[O,xt]),(0,D.useEffect)(()=>{ht(O?.acceptanceRuns??[])},[O?.acceptanceRuns]),(0,D.useEffect)(()=>{q.current=null},[O?.id]),(0,D.useEffect)(()=>{!A?.sourceHash||q.current||(q.current=A.sourceHash,ct(`all`),U(0),et(e=>e+1))},[A?.sourceHash]),(0,D.useLayoutEffect)(()=>{if(!O)return;L(`booting`),at(null),ot(null),pt(null),gt(!1),J.current=``;let e=window.setTimeout(()=>L(e=>e===`failed`?e:`timeout`),7e3),t=vt.current?Ie(vt.current,t=>{let n=Me(t);if(n){if(n.type===`ready`){L(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ot(n.detail),pt(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),at(n.detail),L(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[O,$e]),(0,D.useLayoutEffect)(()=>{if(!O||A?.status!==`healthy`||!Y.length){ft(null);return}let e=V===`all`?Y[H]:Y.find(e=>e.id===V),t=e?[e]:[];if(!t.length)return;ft(V),st(e=>{if(V===`all`&&H===0)return{};let t={...e};return delete t[V],t});let r=!1,i=e=>{st(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),ft(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=yt.current?Ie(yt.current,e=>{let t=Me(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),st(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),V===`all`&&H+1<Y.length?(U(e=>e+1),ut(e=>e+1)):ft(null)):t.type===`error`&&(window.clearTimeout(a),i(Pe(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,O,lt,V,H,$e,A?.status,n]),(0,D.useEffect)(()=>{if(!O||!Z||!W||W!==A?.sourceHash)return;let e=`${O.id}:${W}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,gt(!0),ye(O.id,W,Z).then(t=>{J.current===e&&ht(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,N(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&gt(!1)}))},[Z,W,O,A?.sourceHash]);let Q=(0,D.useCallback)(async e=>{if(O){rt(!0),N(null);try{await bt(O,e)}catch(e){N(e instanceof Error?e.message:String(e)),rt(!1)}}},[O,bt]);(0,D.useLayoutEffect)(()=>(De({startExtra:(0,k.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回本地应用`:`Back to local apps`,children:(0,k.jsx)(h,{className:`size-4`})}),main:(0,k.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:O?.name||(n?`创建本地应用`:`Create local app`)}),end:O?(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(S,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,k.jsxs)(a,{to:`/projects/${encodeURIComponent(O.projectId)}`,children:[(0,k.jsx)(x,{className:`size-4`}),`Project`]})}),(0,k.jsxs)(S,{className:`h-9`,onClick:()=>void Q(),disabled:P,children:[P?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(f,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Oe()),[O,P,Oe,Q,De,n]);async function St(e){e.preventDefault(),M(!0),N(null);try{let e=await Ee({name:We,idea:Ke});await w(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await bt(e,t)}catch{de(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}async function Ct(){if(O){M(!0),N(null);try{let e=await we(O.id);await Le(e,{revalidate:!1}),await Ue(),await Promise.all([w(`local-apps-list`),w(`gateway-extensions-list`)]),he(`ext:${e.extensionId}:app`),Xe(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function wt(e,t=!1){M(!0),N(null);try{let n=await e();return await Le(n,{revalidate:!1}),await Ue(),await Promise.all([w(`local-apps-list`),w(`gateway-extensions-list`)]),t&&he(`ext:${n.extensionId}:app`),!0}catch(e){return N(e instanceof Error?e.message:String(e)),!1}finally{M(!1)}}async function Tt(e){O&&await wt(()=>Te(O.id,e),e)}async function Et(e){O&&await wt(()=>Ce(O.id,e),!0)}async function Dt(){O&&await wt(()=>be(O.id))&&Qe(!1)}function Ot(){let e=Array.from(new Set([...A?.issues.map(e=>e.message)??[],...R?[Pe(R)]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>e.message)??[],...Object.values(B).filter(e=>e.status===`failed`).map(e=>`${e.name}: ${e.failureKind===`runner`?`[验收执行器] `:``}${e.message}`),...I===`timeout`?[n?`预览在 7 秒内未完成启动,可能存在白屏或阻塞。`:`The preview did not finish booting within 7 seconds and may be blank or blocked.`]:[]]));if(!e.length)return;let t=e.map(e=>`- ${e}`).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as s}from"./check-DUBLcKHA.js";import{n as c,r as l}from"./locale-store-C_ax27uc.js";import{a as u,i as d}from"./vendor-swr-BIWyz7Rc.js";import{$c as f,Ba as p,Co as m,Ec as ee,Fu as h,Go as g,Hl as te,Is as _,Jo as v,Js as ne,Kl as y,Ko as b,Ll as x,Ma as re,Mc as ie,Ns as S,Tl as ae,To as oe,Uc as se,Uo as ce,Wo as C,Yo as le,Ys as ue,au as de,bt as w,hu as fe,jc as pe,lc as me,lu as he,pc as ge,qo as _e,rl as T,ro as E,wc as ve}from"./index-BhQMnKH1.js";import{a as ye,c as be,l as xe,n as Se,o as Ce,r as we,s as Te,t as Ee}from"./api-DPIXEcIq.js";var D=e(t(),1),De=`build-xopc-local-app`;function Oe(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function ke(e){return e.find(e=>Oe(e)===`coder`)??null}function Ae(e,t){let n=new URLSearchParams({skill:De}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var O=new Set([`document`,`content`,`interaction`,`criteria`]),je=new Set([`passed`,`failed`,`skipped`]);function Me(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.source!==`xopc-local-app-preview`||t.version!==1)return null;if(t.type===`ready`)return{type:`ready`,detail:{}};if(t.type===`criteria`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.scenarios)||e.scenarios.length>10)return null;let n=e.scenarios.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||!t.id.trim()||t.id.length>80||typeof t.name!=`string`||!t.name.trim()||t.name.length>120||t.status!==`passed`&&t.status!==`failed`||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,name:t.name,status:t.status,message:t.message.slice(0,500),failureKind:`scenario`}});if(n.some(e=>e===null))return null;let r=typeof e.scenarioCount==`number`&&Number.isInteger(e.scenarioCount)&&e.scenarioCount>=0&&e.scenarioCount<=10?e.scenarioCount:n.length;return{type:`criteria`,detail:{status:e.status,scenarioCount:r,scenarios:n}}}if(t.type===`acceptance`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.checks))return null;let n=e.checks.slice(0,10).map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return!O.has(t.id)||!je.has(t.status)||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,status:t.status,message:t.message.slice(0,500)}});if(!n.length||n.some(e=>e===null))return null;let r=typeof e.interactiveCount==`number`&&Number.isFinite(e.interactiveCount)&&e.interactiveCount>=0?Math.min(Math.floor(e.interactiveCount),1e4):0;return{type:`acceptance`,detail:{status:e.status,checks:n,interactiveCount:r}}}if(t.type!==`error`||!t.detail||typeof t.detail!=`object`)return null;let n=t.detail;return n.kind!==`script_error`&&n.kind!==`unhandled_rejection`||typeof n.message!=`string`||!n.message.trim()?null:{type:`error`,detail:{kind:n.kind,message:n.message.slice(0,500),filename:typeof n.filename==`string`?n.filename.slice(0,500):void 0,line:typeof n.line==`number`?n.line:void 0,column:typeof n.column==`number`?n.column:void 0}}}function Ne(e){return e?.checks.filter(e=>e.status===`failed`).map(e=>e.message)??[]}function Pe(e){let t=e.filename?` (${e.filename}${e.line?`:${e.line}${e.column?`:${e.column}`:``}`:``})`:``;return`${e.message}${t}`}var Fe=Object.freeze({source:`xopc-local-app-host`,version:1,type:`connect`});function Ie(e,t){let n=null,r=()=>{n?.close();let r=new MessageChannel;n=r.port1,n.onmessage=e=>t(e.data),n.start(),e.contentWindow?.postMessage(Fe,`*`,[r.port2])};return e.addEventListener(`load`,r),r(),()=>{e.removeEventListener(`load`,r),n?.close()}}var Le=n(),k=r();function Re(e){let t=(0,Le.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let l=a?`产品场景`:`Product scenarios`,u;t[0]===l?u=t[1]:(u=(0,k.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,p;t[2]===d?p=t[3]:(p=(0,k.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:d}),t[2]=d,t[3]=p);let m;t[4]!==u||t[5]!==p?(m=(0,k.jsxs)(`div`,{children:[u,p]}),t[4]=u,t[5]=p,t[6]=m):m=t[6];let h=i!==null,g;t[7]===i?g=t[8]:(g=i===`all`?(0,k.jsx)(T,{className:`size-3 animate-spin`}):(0,k.jsx)(ee,{className:`size-3`}),t[7]=i,t[8]=g);let te=a?`全部重跑`:`Run all`,_;t[9]!==o||t[10]!==h||t[11]!==g||t[12]!==te?(_=(0,k.jsxs)(S,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:h,children:[g,te]}),t[9]=o,t[10]=h,t[11]=g,t[12]=te,t[13]=_):_=t[13];let v;t[14]!==m||t[15]!==_?(v=(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[14]=m,t[15]=_,t[16]=v):v=t[16];let ne=a?`产品场景验收结果`:`Product scenario acceptance results`,y;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,k.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,k.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,k.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,k.jsx)(T,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,k.jsx)(fe,{className:`size-3.5 text-success`}):n===`failed`?(0,k.jsx)(he,{className:`size-3.5 text-danger`}):(0,k.jsx)(de,{className:`size-3.5 text-fg-subtle`})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,k.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,k.jsx)(S,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,k.jsx)(ee,{className:`size-3`})})]}),n===`running`?(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,k.jsxs)(`div`,{className:`mt-1.5`,children:[(0,k.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,k.jsxs)(S,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,k.jsx)(f,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,k.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],y=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=y}else y=t[23];let b;t[30]!==ne||t[31]!==y?(b=(0,k.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":ne,children:y}),t[30]=ne,t[31]=y,t[32]=b):b=t[32];let x;return t[33]!==v||t[34]!==b?(x=(0,k.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[v,b]}),t[33]=v,t[34]=b,t[35]=x):x=t[35],x}var ze=`allow-scripts allow-forms`;function Be(e,t){return w(e,t)}function Ve(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function A(){let{appId:e}=o(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),de=i(),{mutate:w}=u(),he=m(e=>e.moveToFront),De=oe(e=>e.setPageHeader),Oe=oe(e=>e.clearPageHeader),{data:O,isLoading:je,error:Fe,mutate:Le}=d(!t&&e?[`local-app`,e]:null,()=>Se(e)),{data:A,isLoading:He,mutate:Ue}=d(!t&&e?[`local-app-validation`,e]:null,()=>xe(e)),[We,Ge]=(0,D.useState)(``),[Ke,qe]=(0,D.useState)(``),[j,M]=(0,D.useState)(!1),[Je,N]=(0,D.useState)(null),[Ye,Xe]=(0,D.useState)(!1),[Ze,Qe]=(0,D.useState)(!1),[$e,et]=(0,D.useState)(0),[tt,nt]=(0,D.useState)(``),[P,rt]=(0,D.useState)(!1),[F,it]=(0,D.useState)(!1),[I,L]=(0,D.useState)(`booting`),[R,at]=(0,D.useState)(null),[z,ot]=(0,D.useState)(null),[B,st]=(0,D.useState)({}),[V,ct]=(0,D.useState)(`all`),[H,U]=(0,D.useState)(0),[lt,ut]=(0,D.useState)(0),[dt,ft]=(0,D.useState)(null),[W,pt]=(0,D.useState)(null),[mt,ht]=(0,D.useState)([]),[G,gt]=(0,D.useState)(!1),_t=(0,D.useRef)(new Set),K=(0,D.useRef)(null),vt=(0,D.useRef)(null),yt=(0,D.useRef)(null),q=(0,D.useRef)(null),J=(0,D.useRef)(``),Y=A?.acceptanceScenarios??[],X=(0,D.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>B[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,B]),Z=(0,D.useMemo)(()=>{if(!z)return null;if(!A?.acceptanceScenarioCount)return z;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...z.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:z.interactiveCount}},[z,X,A?.acceptanceScenarioCount]),bt=(0,D.useCallback)(async(e,t)=>{let n=ke(await p(e.projectId))??await re(e.projectId,`coder`);_t.current.add(n.key),de(Ae(n.key,t))},[de]),xt=(0,D.useCallback)(async(e=!0)=>{if(!O)return null;it(!0);try{let t=await xe(O.id);return await Ue(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ct(`all`),U(0),et(e=>e+1)),t}catch(e){return N(e instanceof Error?e.message:String(e)),null}finally{it(!1)}},[O,Ue]);(0,D.useEffect)(()=>{if(!O)return;let e=!1;p(O.projectId).then(t=>{e||(_t.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!_t.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,xt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[O,xt]),(0,D.useEffect)(()=>{ht(O?.acceptanceRuns??[])},[O?.acceptanceRuns]),(0,D.useEffect)(()=>{q.current=null},[O?.id]),(0,D.useEffect)(()=>{!A?.sourceHash||q.current||(q.current=A.sourceHash,ct(`all`),U(0),et(e=>e+1))},[A?.sourceHash]),(0,D.useLayoutEffect)(()=>{if(!O)return;L(`booting`),at(null),ot(null),pt(null),gt(!1),J.current=``;let e=window.setTimeout(()=>L(e=>e===`failed`?e:`timeout`),7e3),t=vt.current?Ie(vt.current,t=>{let n=Me(t);if(n){if(n.type===`ready`){L(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ot(n.detail),pt(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),at(n.detail),L(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[O,$e]),(0,D.useLayoutEffect)(()=>{if(!O||A?.status!==`healthy`||!Y.length){ft(null);return}let e=V===`all`?Y[H]:Y.find(e=>e.id===V),t=e?[e]:[];if(!t.length)return;ft(V),st(e=>{if(V===`all`&&H===0)return{};let t={...e};return delete t[V],t});let r=!1,i=e=>{st(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),ft(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=yt.current?Ie(yt.current,e=>{let t=Me(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),st(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),V===`all`&&H+1<Y.length?(U(e=>e+1),ut(e=>e+1)):ft(null)):t.type===`error`&&(window.clearTimeout(a),i(Pe(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,O,lt,V,H,$e,A?.status,n]),(0,D.useEffect)(()=>{if(!O||!Z||!W||W!==A?.sourceHash)return;let e=`${O.id}:${W}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,gt(!0),ye(O.id,W,Z).then(t=>{J.current===e&&ht(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,N(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&gt(!1)}))},[Z,W,O,A?.sourceHash]);let Q=(0,D.useCallback)(async e=>{if(O){rt(!0),N(null);try{await bt(O,e)}catch(e){N(e instanceof Error?e.message:String(e)),rt(!1)}}},[O,bt]);(0,D.useLayoutEffect)(()=>(De({startExtra:(0,k.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回本地应用`:`Back to local apps`,children:(0,k.jsx)(h,{className:`size-4`})}),main:(0,k.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:O?.name||(n?`创建本地应用`:`Create local app`)}),end:O?(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(S,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,k.jsxs)(a,{to:`/projects/${encodeURIComponent(O.projectId)}`,children:[(0,k.jsx)(x,{className:`size-4`}),`Project`]})}),(0,k.jsxs)(S,{className:`h-9`,onClick:()=>void Q(),disabled:P,children:[P?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(f,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Oe()),[O,P,Oe,Q,De,n]);async function St(e){e.preventDefault(),M(!0),N(null);try{let e=await Ee({name:We,idea:Ke});await w(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await bt(e,t)}catch{de(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}async function Ct(){if(O){M(!0),N(null);try{let e=await we(O.id);await Le(e,{revalidate:!1}),await Ue(),await Promise.all([w(`local-apps-list`),w(`gateway-extensions-list`)]),he(`ext:${e.extensionId}:app`),Xe(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function wt(e,t=!1){M(!0),N(null);try{let n=await e();return await Le(n,{revalidate:!1}),await Ue(),await Promise.all([w(`local-apps-list`),w(`gateway-extensions-list`)]),t&&he(`ext:${n.extensionId}:app`),!0}catch(e){return N(e instanceof Error?e.message:String(e)),!1}finally{M(!1)}}async function Tt(e){O&&await wt(()=>Te(O.id,e),e)}async function Et(e){O&&await wt(()=>Ce(O.id,e),!0)}async function Dt(){O&&await wt(()=>be(O.id))&&Qe(!1)}function Ot(){let e=Array.from(new Set([...A?.issues.map(e=>e.message)??[],...R?[Pe(R)]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>e.message)??[],...Object.values(B).filter(e=>e.status===`failed`).map(e=>`${e.name}: ${e.failureKind===`runner`?`[验收执行器] `:``}${e.message}`),...I===`timeout`?[n?`预览在 7 秒内未完成启动,可能存在白屏或阻塞。`:`The preview did not finish booting within 7 seconds and may be blank or blocked.`]:[]]));if(!e.length)return;let t=e.map(e=>`- ${e}`).join(`
2
2
  `);Q(n?`请修复当前本地应用草稿的校验问题,保持扩展 ID 和已安装版本不变。先复现并判断问题来自应用行为还是验收执行器,不要通过弱化断言绕过问题。修复后运行完整校验。\n\n${t}`:`Fix the current local-app draft validation issues without changing the extension id or installed release. Reproduce first and determine whether each issue comes from app behavior or the acceptance runner; do not weaken assertions to bypass it. Run the full validation afterward.\n\n${t}`)}function kt(){ct(`all`),U(0),ut(e=>e+1)}function At(e){ct(e),U(0),ut(e=>e+1)}function jt(e,t){let r=t.failureKind===`runner`?n?`验收执行器`:`acceptance runner`:n?`产品场景`:`product scenario`;Q(n?`请修复本地应用的${r}问题“${e.name}”。当前失败信息:${t.message}\n\n保持扩展 ID 和场景原意不变;先复现并判断问题来自应用行为还是验收执行器,不要通过弱化断言绕过问题。修复后运行完整校验。`:`Fix the local-app ${r} issue "${e.name}". Current failure: ${t.message}\n\nPreserve the extension id and scenario intent. Reproduce first and determine whether the issue comes from app behavior or the runner; do not weaken assertions to bypass it. Run the full validation afterward.`)}let Mt=mt.findIndex(e=>Ve(e,W,Z)),$=Mt>=0?mt[Mt]:null,Nt=Mt>=0?mt[Mt+1]??null:mt[0]??null,Pt=Ne(Z),Ft=Nt?Nt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],It=A?.status===`failed`||I===`failed`||I===`timeout`||Z?.status===`failed`||Object.values(B).some(e=>e.status===`failed`),Lt=Ft.filter(e=>!Pt.includes(e)).length;async function Rt(){let e=await xt(!1);if(e?.status===`healthy`&&e.sourceHash!==W){q.current=e.sourceHash??null,U(0),et(e=>e+1);return}e?.status===`healthy`&&I===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&Xe(!0)}return t?(0,k.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,k.jsxs)(`div`,{className:`mx-auto grid w-full max-w-6xl overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,k.jsxs)(`form`,{onSubmit:St,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,k.jsx)(me,{className:`size-4`}),n?`告诉 Coder 你的想法`:`Tell Coder your idea`]}),(0,k.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,k.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会建立一个 Coder Project,并把应用上下文和开发 Skill 带入对话。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,k.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,k.jsx)(`input`,{value:We,onChange:e=>Ge(e.target.value),required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,k.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,k.jsx)(`textarea`,{value:Ke,onChange:e=>qe(e.target.value),required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Je?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Je}):null,(0,k.jsxs)(S,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:j||!We.trim()||!Ke.trim(),children:[j?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(f,{className:`size-4`}),n?`进入 Coder 对话`:`Continue with Coder`]})]}),(0,k.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,k.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,k.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,k.jsx)(se,{className:`size-7`})}),(0,k.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,k.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):je?(0,k.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,k.jsx)(E,{className:`rounded-xl`}),(0,k.jsx)(E,{className:`rounded-xl`}),(0,k.jsx)(E,{className:`rounded-xl`})]}):Fe||!O?(0,k.jsx)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:Fe instanceof Error?Fe.message:n?`找不到应用`:`App not found`}):(0,k.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,k.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,k.jsx)(me,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,k.jsx)(`div`,{className:`mt-4 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg`,children:O.idea}),(0,k.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,k.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,k.jsx)(fe,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,k.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续迭代会进入对应 Project,由 Coder 读取应用上下文和专属 skill。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,k.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(tt)},children:[(0,k.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,k.jsx)(`textarea`,{id:`local-app-change-request`,value:tt,onChange:e=>nt(e.target.value),rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,k.jsxs)(S,{type:`submit`,className:`mt-2 w-full`,disabled:P||!tt.trim(),children:[P?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(f,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,k.jsxs)(S,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:P,children:[(0,k.jsx)(x,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,k.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,k.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,k.jsx)(`span`,{className:`size-2 rounded-full ${A?.status===`failed`||I===`failed`||I===`timeout`||Z?.status===`failed`?`bg-danger`:A?.status===`healthy`&&I===`healthy`&&Z?.status===`passed`&&$?.sourceHash===A.sourceHash&&!G?`bg-success`:`bg-fg-subtle`}`}),I===`failed`||I===`timeout`?n?`预览运行异常`:`Preview runtime issue`:A?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:I===`booting`||!Z?n?`自动验收中`:`Running acceptance`:G||$?.sourceHash!==A?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,k.jsxs)(S,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void xt(!0),disabled:F,children:[F?(0,k.jsx)(T,{className:`size-3.5 animate-spin`}):(0,k.jsx)(ee,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,k.jsx)(`iframe`,{ref:vt,title:`${O.name} preview`,src:l(O.previewUrl),sandbox:ze,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{at({kind:`script_error`,message:`Preview document failed to load`}),L(`failed`)}},$e),A?.status===`healthy`&&A.acceptanceScenarioCount>0?(0,k.jsx)(`iframe`,{ref:yt,title:`${O.name} acceptance runner`,src:`${l(O.previewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(V===`all`?Y[H]?.id??``:V)}`,sandbox:ze,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${$e}-${lt}-${H}`):null]}),(0,k.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O.installationState===`not_installed`?n?`尚未安装`:`Not installed`:O.enabled?n?`版本 ${O.activeVersion} 正在使用`:`Version ${O.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,k.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${O.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,k.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,k.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,O.draftVersion]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,k.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:O.activeVersion?`v${O.activeVersion}`:`—`})]})]}),(0,k.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,k.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,k.jsx)(te,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),He||F?(0,k.jsx)(T,{className:`size-3.5 animate-spin text-fg-muted`}):A?.status===`healthy`?(0,k.jsx)(fe,{className:`size-4 text-success`}):(0,k.jsx)(ne,{className:`size-4 text-danger`})]}),A?(0,k.jsxs)(`div`,{className:`mt-2`,children:[(0,k.jsx)(`p`,{className:`text-xs leading-5 ${A.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:A.status===`healthy`?A.hasDraftChanges?n?`${A.changedFileCount} 个文件有改动,可以安装新版本。`:`${A.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:A.issues[0]?.message}),A.changedFiles.length?(0,k.jsx)(`ul`,{className:`mt-2 space-y-1`,children:A.changedFiles.slice(0,4).map(e=>(0,k.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,k.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,k.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,A.changedFileCount>4?(0,k.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${A.changedFileCount-4} 个文件`:`${A.changedFileCount-4} more files`}):null,(0,k.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,k.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,k.jsx)(`span`,{className:`size-2 rounded-full ${I===`healthy`?`bg-success`:I===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,k.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${I===`failed`||I===`timeout`?`text-danger`:`text-fg-muted`}`,children:R?Pe(R):I===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:I===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,k.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,k.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,k.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,k.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,k.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,k.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,k.jsx)(`span`,{children:e.message})]},e.id))}):(0,k.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:A?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${A.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${A.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),G?(0,k.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,k.jsx)(T,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,k.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Nt?n?`相比上次:已修复 ${Lt} 项,仍有 ${Pt.length} 项。`:`Since the previous run: ${Lt} fixed, ${Pt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,k.jsx)(Re,{scenarios:Y,results:B,runningTarget:dt,zh:n,onRunAll:kt,onRunScenario:At,onAskCoder:jt})]}),It?(0,k.jsxs)(S,{className:`mt-3 w-full`,onClick:Ot,disabled:P,children:[(0,k.jsx)(f,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,k.jsx)(E,{className:`mt-2 h-12 rounded-lg`})]}),(0,k.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,k.jsx)(ge,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,k.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(A?.permissions??O.permissions).map(e=>(0,k.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,k.jsx)(S,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Rt(),disabled:j||He||F||G||A?.status===`failed`||I!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==A?.sourceHash||O.installationState===`installed`&&A?.hasDraftChanges===!1,children:O.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),O.installationState===`installed`?(0,k.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,k.jsxs)(S,{className:`min-w-0 flex-1`,onClick:()=>void Tt(!O.enabled),disabled:j,children:[O.enabled?(0,k.jsx)(ie,{className:`size-4`}):(0,k.jsx)(pe,{className:`size-4`}),O.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,k.jsx)(S,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>Qe(!0),disabled:j,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,k.jsx)(ue,{className:`size-4`})})]}):null,(0,k.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,k.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,k.jsx)(ae,{className:`size-4`}),n?`版本历史`:`Release history`]}),O.releases.length?(0,k.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:O.releases.map(e=>(0,k.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,k.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,k.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Be(e.createdAt,r)})]}),e.isActive?null:(0,k.jsxs)(S,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void Et(e.id),disabled:j,children:[(0,k.jsx)(ve,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,k.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Je?(0,k.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Je}):null]}),(0,k.jsx)(ce,{open:Ye,onOpenChange:Xe,children:(0,k.jsxs)(v,{children:[(0,k.jsx)(_e,{className:`fixed inset-0 z-50 bg-black/45`}),(0,k.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-2xl focus:outline-none`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(le,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,k.jsx)(b,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,k.jsx)(C,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,k.jsx)(_,{className:`size-4`})})]}),(0,k.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,k.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,k.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O.name}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O.extensionId})]}),(0,k.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,k.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,k.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:A?.changedFileCount??0})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,k.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,k.jsx)(fe,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),A?.changedFiles.length?(0,k.jsx)(`ul`,{className:`mt-3 space-y-1`,children:A.changedFiles.slice(0,5).map(e=>(0,k.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,k.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,k.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,k.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,k.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(A?.permissions??O.permissions).map(e=>(0,k.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,k.jsx)(s,{className:`size-4 text-success`}),e,O.installationState===`installed`&&A?.permissionDelta.added.includes(e)?(0,k.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),O.installationState===`installed`&&A?.permissionDelta.added.length?(0,k.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,k.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,k.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,k.jsx)(C,{asChild:!0,children:(0,k.jsx)(S,{children:n?`取消`:`Cancel`})}),(0,k.jsxs)(S,{variant:`primary`,onClick:()=>void Ct(),disabled:j,children:[j?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(y,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,k.jsx)(ce,{open:Ze,onOpenChange:Qe,children:(0,k.jsxs)(v,{children:[(0,k.jsx)(_e,{className:`fixed inset-0 z-50 bg-black/45`}),(0,k.jsxs)(g,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-2xl focus:outline-none`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(le,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,k.jsx)(b,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但 Project、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,k.jsx)(C,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,k.jsx)(_,{className:`size-4`})})]}),(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,k.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:O.name}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,k.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,k.jsx)(C,{asChild:!0,children:(0,k.jsx)(S,{children:n?`取消`:`Cancel`})}),(0,k.jsxs)(S,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Dt(),disabled:j,children:[j?(0,k.jsx)(T,{className:`size-4 animate-spin`}):(0,k.jsx)(ue,{className:`size-4`}),n?`卸载但保留 Project`:`Uninstall and keep Project`]})]})]})]})})]})}export{A as LocalAppWorkbenchPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{Nc as s,Ns as c,Pu as l,To as u,Tu as d,lc as f,ro as p}from"./index-CfOzvGDb.js";import{i as m}from"./api-DPIXEcIq.js";var h=n(),g=e(t(),1),_=r();function v(){let e=(0,h.c)(24),t=a(S)===`zh`,n=u(x),r=u(b),{data:p,isLoading:v,error:C}=o(`local-apps-list`,m),w,T;e[0]!==r||e[1]!==n||e[2]!==t?(w=()=>(n({startExtra:null,main:(0,_.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Workshop`}),end:(0,_.jsx)(c,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,_.jsxs)(i,{to:`/local-apps/new`,children:[(0,_.jsx)(s,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),T=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=w,e[4]=T):(w=e[3],T=e[4]),(0,g.useLayoutEffect)(w,T);let E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,_.jsx)(f,{className:`size-4`}),e[5]=E):E=e[5];let D=t?`从想法开始`:`Start with an idea`,O;e[6]===D?O=e[7]:(O=(0,_.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[E,D]}),e[6]=D,e[7]=O);let k=t?`把自己的工具放进 XOPC`:`Put your own tools inside XOPC`,A;e[8]===k?A=e[9]:(A=(0,_.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:k}),e[8]=k,e[9]=A);let j=t?`每个应用都会自动创建一个由 Coder 负责的 Project,可预览、安装到侧栏,并持续迭代。`:`Every app gets a Coder-owned Project for previewing, installing in the sidebar, and ongoing iteration.`,M;e[10]===j?M=e[11]:(M=(0,_.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:j}),e[10]=j,e[11]=M);let N;e[12]!==O||e[13]!==A||e[14]!==M?(N=(0,_.jsxs)(`div`,{className:`mb-6 max-w-2xl`,children:[O,A,M]}),e[12]=O,e[13]=A,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==p||e[17]!==C||e[18]!==v||e[19]!==t?(P=v?(0,_.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(y)}):C?(0,_.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:C instanceof Error?C.message:String(C)}):p?.length?(0,_.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:p.map(e=>(0,_.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,_.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,_.jsx)(d,{className:`size-5`})}),(0,_.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,_.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,_.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,_.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`打开工作台`:`Open workbench`,(0,_.jsx)(l,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,_.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge bg-surface-base px-6 py-14 text-center`,children:[(0,_.jsx)(d,{className:`mx-auto size-8 text-fg-subtle`}),(0,_.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有本地应用`:`No local apps yet`}),(0,_.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用骨架和可持续开发的 Project。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,_.jsx)(c,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,_.jsxs)(i,{to:`/local-apps/new`,children:[(0,_.jsx)(s,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[16]=p,e[17]=C,e[18]=v,e[19]=t,e[20]=P):P=e[20];let F;return e[21]!==P||e[22]!==N?(F=(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 py-8 sm:px-5 xl:px-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[N,P]})}),e[21]=P,e[22]=N,e[23]=F):F=e[23],F}function y(e,t){return(0,_.jsx)(p,{className:`h-44 rounded-xl`},t)}function b(e){return e.clearPageHeader}function x(e){return e.setPageHeader}function S(e){return e.language}export{v as LocalAppsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{Nc as s,Ns as c,Pu as l,To as u,Tu as d,lc as f,ro as p}from"./index-BhQMnKH1.js";import{i as m}from"./api-DPIXEcIq.js";var h=n(),g=e(t(),1),_=r();function v(){let e=(0,h.c)(24),t=a(S)===`zh`,n=u(x),r=u(b),{data:p,isLoading:v,error:C}=o(`local-apps-list`,m),w,T;e[0]!==r||e[1]!==n||e[2]!==t?(w=()=>(n({startExtra:null,main:(0,_.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Workshop`}),end:(0,_.jsx)(c,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,_.jsxs)(i,{to:`/local-apps/new`,children:[(0,_.jsx)(s,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),T=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=w,e[4]=T):(w=e[3],T=e[4]),(0,g.useLayoutEffect)(w,T);let E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,_.jsx)(f,{className:`size-4`}),e[5]=E):E=e[5];let D=t?`从想法开始`:`Start with an idea`,O;e[6]===D?O=e[7]:(O=(0,_.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[E,D]}),e[6]=D,e[7]=O);let k=t?`把自己的工具放进 XOPC`:`Put your own tools inside XOPC`,A;e[8]===k?A=e[9]:(A=(0,_.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:k}),e[8]=k,e[9]=A);let j=t?`每个应用都会自动创建一个由 Coder 负责的 Project,可预览、安装到侧栏,并持续迭代。`:`Every app gets a Coder-owned Project for previewing, installing in the sidebar, and ongoing iteration.`,M;e[10]===j?M=e[11]:(M=(0,_.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:j}),e[10]=j,e[11]=M);let N;e[12]!==O||e[13]!==A||e[14]!==M?(N=(0,_.jsxs)(`div`,{className:`mb-6 max-w-2xl`,children:[O,A,M]}),e[12]=O,e[13]=A,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==p||e[17]!==C||e[18]!==v||e[19]!==t?(P=v?(0,_.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(y)}):C?(0,_.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:C instanceof Error?C.message:String(C)}):p?.length?(0,_.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:p.map(e=>(0,_.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,_.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,_.jsx)(d,{className:`size-5`})}),(0,_.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,_.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,_.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,_.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`打开工作台`:`Open workbench`,(0,_.jsx)(l,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,_.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge bg-surface-base px-6 py-14 text-center`,children:[(0,_.jsx)(d,{className:`mx-auto size-8 text-fg-subtle`}),(0,_.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有本地应用`:`No local apps yet`}),(0,_.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用骨架和可持续开发的 Project。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,_.jsx)(c,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,_.jsxs)(i,{to:`/local-apps/new`,children:[(0,_.jsx)(s,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[16]=p,e[17]=C,e[18]=v,e[19]=t,e[20]=P):P=e[20];let F;return e[21]!==P||e[22]!==N?(F=(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 py-8 sm:px-5 xl:px-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[N,P]})}),e[21]=P,e[22]=N,e[23]=F):F=e[23],F}function y(e,t){return(0,_.jsx)(p,{className:`h-44 rounded-xl`},t)}function b(e){return e.clearPageHeader}function x(e){return e.setPageHeader}function S(e){return e.language}export{v as LocalAppsPage};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./copy-to-clipboard-HOJ79TWv.js";import{t as s}from"./messages-C96Zjb0V.js";import{l as c,n as l,r as u,s as d}from"./locale-store-C_ax27uc.js";import{Bl as f,Ec as p,Go as m,Is as h,Jo as g,Nl as _,Ns as v,Os as y,Pl as b,Qs as x,Uo as S,Wo as C,Xl as w,Yo as T,_s as E,aa as D,cl as O,cs as k,gs as A,hs as j,js as M,ma as N,ms as P,os as F,ps as I,qo as L,ro as R,su as z,vs as B,yc as ee,ys as V,yu as H}from"./index-CfOzvGDb.js";import{r as U}from"./segmented-styles-BL8oLBEp.js";var W=e(t(),1),G=n();function K(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.sessionKey&&t.set(`sessionKey`,e.sessionKey),e.sessionId&&t.set(`sessionId`,e.sessionId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function q(e){return d(u(`/api/logs${K(e)}`))}async function J(){return(await d(u(`/api/logs/files`))).files??[]}async function te(){return(await d(u(`/api/logs/modules`))).modules??[]}async function Y(){let e=await d(u(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function ne(){return(await d(u(`/api/logs/dir`))).dir??``}async function X(){return(await d(u(`/api/logs/level`))).level??`info`}async function Z(e,t){return d(u(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function re(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await d(u(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var ie=500,ae=class{_token;_callbacks;_abort;constructor(e,t){this._token=e,this._callbacks=t}connect(e,t){this.disconnect();let n=new AbortController;this._abort=n,this._consume(n,e,t)}async _consume(e,t,n){let r=new URL(u(`/api/logs/stream`));t?.length?r.searchParams.set(`levels`,t.join(`,`)):r.searchParams.set(`levels`,`trace,debug,info,warn,error,fatal`),n&&r.searchParams.set(`module`,n);try{let t=new Headers({Accept:`text/event-stream`});this._token&&t.set(`Authorization`,`Bearer ${this._token}`);let n=await fetch(r.toString(),{headers:t,signal:e.signal});if(!n.ok||!n.body)throw Error(`Log stream failed: ${n.status}`);let i=n.body.getReader(),a=new TextDecoder,o=``;for(;!e.signal.aborted;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0});let n=o.indexOf(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./copy-to-clipboard-HOJ79TWv.js";import{t as s}from"./messages-C96Zjb0V.js";import{l as c,n as l,r as u,s as d}from"./locale-store-C_ax27uc.js";import{Bl as f,Ec as p,Go as m,Is as h,Jo as g,Nl as _,Ns as v,Os as y,Pl as b,Qs as x,Uo as S,Wo as C,Xl as w,Yo as T,_s as E,aa as D,cl as O,cs as k,gs as A,hs as j,js as M,ma as N,ms as P,os as F,ps as I,qo as L,ro as R,su as z,vs as B,yc as ee,ys as V,yu as H}from"./index-BhQMnKH1.js";import{r as U}from"./segmented-styles-BL8oLBEp.js";var W=e(t(),1),G=n();function K(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.sessionKey&&t.set(`sessionKey`,e.sessionKey),e.sessionId&&t.set(`sessionId`,e.sessionId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function q(e){return d(u(`/api/logs${K(e)}`))}async function J(){return(await d(u(`/api/logs/files`))).files??[]}async function te(){return(await d(u(`/api/logs/modules`))).modules??[]}async function Y(){let e=await d(u(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function ne(){return(await d(u(`/api/logs/dir`))).dir??``}async function X(){return(await d(u(`/api/logs/level`))).level??`info`}async function Z(e,t){return d(u(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function re(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await d(u(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var ie=500,ae=class{_token;_callbacks;_abort;constructor(e,t){this._token=e,this._callbacks=t}connect(e,t){this.disconnect();let n=new AbortController;this._abort=n,this._consume(n,e,t)}async _consume(e,t,n){let r=new URL(u(`/api/logs/stream`));t?.length?r.searchParams.set(`levels`,t.join(`,`)):r.searchParams.set(`levels`,`trace,debug,info,warn,error,fatal`),n&&r.searchParams.set(`module`,n);try{let t=new Headers({Accept:`text/event-stream`});this._token&&t.set(`Authorization`,`Bearer ${this._token}`);let n=await fetch(r.toString(),{headers:t,signal:e.signal});if(!n.ok||!n.body)throw Error(`Log stream failed: ${n.status}`);let i=n.body.getReader(),a=new TextDecoder,o=``;for(;!e.signal.aborted;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0});let n=o.indexOf(`
2
2
 
3
3
  `);for(;n>=0;)this._dispatchChunk(o.slice(0,n)),o=o.slice(n+2),n=o.indexOf(`
4
4
 
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{Wi as r}from"./index-CfOzvGDb.js";import{t as i}from"./markdown-editor-BvUebh3C.js";var a=t();e();var o=n();function s(e){let t=(0,a.c)(12),{initialContent:n,onSave:s,isDark:c,wordWrap:l,onToggleWordWrap:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p;t[0]===s?p=t[1]:(p=e=>{s?.(e)},t[0]=s,t[1]=p);let m=r(p,500),h;t[2]===m?h=t[3]:(h=e=>{m(e)},t[2]=m,t[3]=h);let g=h,_;t[4]===u?_=t[5]:(_=[{key:`Alt-z`,run:()=>(u?.(),!0)}],t[4]=u,t[5]=_);let v=_,y;return t[6]!==g||t[7]!==n||t[8]!==d||t[9]!==v||t[10]!==f?(y=(0,o.jsx)(`div`,{className:`h-full min-w-0 overflow-hidden`,children:(0,o.jsx)(i,{initialContent:n,onChange:g,isDark:d,lineWrap:f,keyBindings:v})}),t[6]=g,t[7]=n,t[8]=d,t[9]=v,t[10]=f,t[11]=y):y=t[11],y}export{s as MarkdownSplit};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{Wi as r}from"./index-BhQMnKH1.js";import{t as i}from"./markdown-editor-BvUebh3C.js";var a=t();e();var o=n();function s(e){let t=(0,a.c)(12),{initialContent:n,onSave:s,isDark:c,wordWrap:l,onToggleWordWrap:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p;t[0]===s?p=t[1]:(p=e=>{s?.(e)},t[0]=s,t[1]=p);let m=r(p,500),h;t[2]===m?h=t[3]:(h=e=>{m(e)},t[2]=m,t[3]=h);let g=h,_;t[4]===u?_=t[5]:(_=[{key:`Alt-z`,run:()=>(u?.(),!0)}],t[4]=u,t[5]=_);let v=_,y;return t[6]!==g||t[7]!==n||t[8]!==d||t[9]!==v||t[10]!==f?(y=(0,o.jsx)(`div`,{className:`h-full min-w-0 overflow-hidden`,children:(0,o.jsx)(i,{initialContent:n,onChange:g,isDark:d,lineWrap:f,keyBindings:v})}),t[6]=g,t[7]=n,t[8]=d,t[9]=v,t[10]=f,t[11]=y):y=t[11],y}export{s as MarkdownSplit};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-C96Zjb0V.js";import{Za as i}from"./index-CfOzvGDb.js";import{t as a}from"./preview-open-alternatives-Cq6aue5a.js";import{t as o}from"./use-blob-object-url-D4BFuzZB.js";var s=t();e();var c=n();function l(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`audio`}),t[0]=e,t[1]=n),n}function u(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`video`}),t[0]=e,t[1]=n),n}function d(e){let t=(0,s.c)(8),{props:n,kind:r}=e,a;bb0:{if(!n.binaryBuffer){a=null;break bb0}let e;if(t[0]!==r||t[1]!==n.binaryBuffer||t[2]!==n.descriptor.fileName||t[3]!==n.descriptor.mimeType){let a=i(n.descriptor.fileName)??n.descriptor.mimeType;e=new Blob([n.binaryBuffer],{type:a||`${r}/*`}),t[0]=r,t[1]=n.binaryBuffer,t[2]=n.descriptor.fileName,t[3]=n.descriptor.mimeType,t[4]=e}else e=t[4];a=e}let l=o(a);if(!l)return null;let u;return t[5]!==r||t[6]!==l?(u=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base p-4 dark:bg-surface-hover/20`,children:r===`audio`?(0,c.jsx)(`audio`,{src:l,controls:!0,className:`w-full max-w-2xl`}):(0,c.jsx)(`video`,{src:l,controls:!0,playsInline:!0,className:`max-h-full max-w-full rounded-md bg-black`})}),t[5]=r,t[6]=l,t[7]=u):u=t[7],u}function f(e){let t=(0,s.c)(12),n;t[0]===e.language?n=t[1]:(n=r(e.language),t[0]=e.language,t[1]=n);let i=n,o=e.descriptor.context===`workspace`,l=o?`${i.workspace.cannotPreviewType} ${i.workspace.openElsewhereHint}`:i.chat.attachmentPreviewOpenElsewhereHint,u=o?i.workspace.openSystemApp:void 0,d=o?i.workspace.chooseApp:void 0,f;return t[2]!==i.chat.attachmentPreviewDownloadFull||t[3]!==e.actions.canChooseOpenWithApp||t[4]!==e.actions.canOpenWithSystemApp||t[5]!==e.actions.onChooseOpenWithApp||t[6]!==e.actions.onDownload||t[7]!==e.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,c.jsx)(a,{message:l,downloadLabel:i.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:e.actions.onOpenWithSystemApp,canOpenWithSystemApp:e.actions.canOpenWithSystemApp,chooseAppLabel:d,onChooseOpenWithApp:e.actions.onChooseOpenWithApp,canChooseOpenWithApp:e.actions.canChooseOpenWithApp})}),t[2]=i.chat.attachmentPreviewDownloadFull,t[3]=e.actions.canChooseOpenWithApp,t[4]=e.actions.canOpenWithSystemApp,t[5]=e.actions.onChooseOpenWithApp,t[6]=e.actions.onDownload,t[7]=e.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}export{l as AudioPreviewPluginView,f as UnsupportedPreviewPluginView,u as VideoPreviewPluginView};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-C96Zjb0V.js";import{Za as i}from"./index-BhQMnKH1.js";import{t as a}from"./preview-open-alternatives-CtchTuRQ.js";import{t as o}from"./use-blob-object-url-D4BFuzZB.js";var s=t();e();var c=n();function l(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`audio`}),t[0]=e,t[1]=n),n}function u(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`video`}),t[0]=e,t[1]=n),n}function d(e){let t=(0,s.c)(8),{props:n,kind:r}=e,a;bb0:{if(!n.binaryBuffer){a=null;break bb0}let e;if(t[0]!==r||t[1]!==n.binaryBuffer||t[2]!==n.descriptor.fileName||t[3]!==n.descriptor.mimeType){let a=i(n.descriptor.fileName)??n.descriptor.mimeType;e=new Blob([n.binaryBuffer],{type:a||`${r}/*`}),t[0]=r,t[1]=n.binaryBuffer,t[2]=n.descriptor.fileName,t[3]=n.descriptor.mimeType,t[4]=e}else e=t[4];a=e}let l=o(a);if(!l)return null;let u;return t[5]!==r||t[6]!==l?(u=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base p-4 dark:bg-surface-hover/20`,children:r===`audio`?(0,c.jsx)(`audio`,{src:l,controls:!0,className:`w-full max-w-2xl`}):(0,c.jsx)(`video`,{src:l,controls:!0,playsInline:!0,className:`max-h-full max-w-full rounded-md bg-black`})}),t[5]=r,t[6]=l,t[7]=u):u=t[7],u}function f(e){let t=(0,s.c)(12),n;t[0]===e.language?n=t[1]:(n=r(e.language),t[0]=e.language,t[1]=n);let i=n,o=e.descriptor.context===`workspace`,l=o?`${i.workspace.cannotPreviewType} ${i.workspace.openElsewhereHint}`:i.chat.attachmentPreviewOpenElsewhereHint,u=o?i.workspace.openSystemApp:void 0,d=o?i.workspace.chooseApp:void 0,f;return t[2]!==i.chat.attachmentPreviewDownloadFull||t[3]!==e.actions.canChooseOpenWithApp||t[4]!==e.actions.canOpenWithSystemApp||t[5]!==e.actions.onChooseOpenWithApp||t[6]!==e.actions.onDownload||t[7]!==e.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,c.jsx)(a,{message:l,downloadLabel:i.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:e.actions.onOpenWithSystemApp,canOpenWithSystemApp:e.actions.canOpenWithSystemApp,chooseAppLabel:d,onChooseOpenWithApp:e.actions.onChooseOpenWithApp,canChooseOpenWithApp:e.actions.canChooseOpenWithApp})}),t[2]=i.chat.attachmentPreviewDownloadFull,t[3]=e.actions.canChooseOpenWithApp,t[4]=e.actions.canOpenWithSystemApp,t[5]=e.actions.onChooseOpenWithApp,t[6]=e.actions.onDownload,t[7]=e.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}export{l as AudioPreviewPluginView,f as UnsupportedPreviewPluginView,u as VideoPreviewPluginView};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{u as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./notes-workbench-B-A9whbg.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{u as n}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as r}from"./notes-workbench-oHU532lp.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CThEfJSn.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CfOzvGDb.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-uQ0fehio.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/circle-alert-BEjgurr2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-C_ax27uc.js","assets/messages-C96Zjb0V.js","assets/cn-JdwAhgNB.js","assets/schemas-DgQq6Z5S.js","assets/product-delivery-BTRT9kCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-ulwTJovP.js","assets/activity-store-DkALQFJT.js","assets/theme-store-D37XLD_C.js","assets/index-BXtJvaQl.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-C96Zjb0V.js";import{l as c,n as l}from"./locale-store-C_ax27uc.js";import{i as u}from"./theme-store-D37XLD_C.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Bl as p,Ci as m,Cr as h,Du as g,Ec as _,Fc as v,Fu as y,Gl as b,Go as x,Is as S,Jl as C,Jo as w,Ko as T,Lc as E,Lu as D,Nc as O,Nt as k,Qn as A,Rc as j,Ru as M,Si as N,Sl as P,Sr as F,Ti as ee,Tl as I,To as te,Tr as L,U as ne,Uc as re,Uo as R,Vc as ie,Vu as ae,Wo as z,Xc as oe,Xs as B,Yo as V,Ys as se,Zo as H,Zs as U,_ as W,_l as G,_r as K,ar as ce,au as le,bi as ue,br as de,cc as fe,cr as pe,cs as me,dr as he,el as ge,er as _e,fr as q,gr as J,hr as ve,ir as ye,lc as be,lr as xe,mr as Se,nu as Ce,oc as Y,or as we,os as Te,pr as Ee,qo as De,rc as Oe,rl as ke,sr as Ae,ur as je,vc as Me,vr as Ne,wi as Pe,wl as X,xi as Fe,xl as Ie,yc as Le,yr as Re,zc as ze}from"./index-CfOzvGDb.js";import{t as Be}from"./automation-suggestion-card-BwnZqDQE.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(De,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=h):h=t[4];let g=a?.alt||`Image preview`,_;t[5]===g?_=t[6]:(_=(0,$.jsx)(V,{className:`sr-only`,children:g}),t[5]=g,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(S,{className:`size-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:v})}),t[8]=i,t[9]=y);let b;t[10]===a?b=t[11]:(b=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=b);let C;t[12]!==y||t[13]!==b||t[14]!==_?(C=(0,$.jsxs)(w,{children:[m,(0,$.jsxs)(x,{className:h,"aria-describedby":void 0,children:[_,y,b]})]}),t[12]=y,t[13]=b,t[14]=_,t[15]=C):C=t[15];let T;t[16]!==C||t[17]!==f?(T=(0,$.jsx)(R,{open:f,onOpenChange:p,children:C}),t[16]=C,t[17]=f,t[18]=T):T=t[18];let E;return t[19]!==n||t[20]!==T?(E=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,T]}),t[19]=n,t[20]=T,t[21]=E):E=t[21],E}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=L(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(X,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(h,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=_e(),p=_e(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,y=m&&u>0?u:i??0,b=y>0?Math.min(_/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=h?`Pause`:`Play`,k;t[14]!==g||t[15]!==h?(k=g?(0,$.jsx)(ke,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(ie,{className:`size-3.5`}):(0,$.jsx)(v,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==y||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:y),t[25]=y,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let ee;return t[34]!==F||t[35]!==T||t[36]!==A?(ee=(0,$.jsxs)(`div`,{className:T,onClick:tt,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=ee):ee=t[37],ee}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=rt(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,h=!n.snippet?.trim(),[g]=(0,Q.useState)(ct),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==u?(_=Xe(n.createdAt,g,u),t[3]=n.createdAt,t[4]=g,t[5]=u,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),b=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,S;t[11]===x?S=t[12]:(S=o(`group relative flex cursor-pointer flex-col gap-2 rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,x),t[11]=x,t[12]=S);let w=d?`true`:void 0,T;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(T=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=T):T=t[18];let D;t[19]===n.title?D=t[20]:(D=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=D);let O=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,k;t[21]===O?k=t[22]:(k=o(`truncate text-sm leading-5`,O),t[21]=O,t[22]=k);let A;t[23]!==p||t[24]!==k?(A=(0,$.jsx)(`p`,{className:k,children:p}),t[23]=p,t[24]=k,t[25]=A):A=t[25];let P;t[26]!==D||t[27]!==A?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,A]}),t[26]=D,t[27]=A,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(ee,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(C,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let te;t[34]===n.pinned?te=t[35]:(te=n.pinned?(0,$.jsx)(E,{className:`size-4`}):(0,$.jsx)(j,{className:`size-4`}),t[34]=n.pinned,t[35]=te);let L=n.pinned?l.unpin:l.pin,ne;t[36]!==I||t[37]!==te||t[38]!==L?(ne=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[te,L]}),t[36]=I,t[37]=te,t[38]=L,t[39]=ne):ne=t[39];let re;t[40]!==n.id||t[41]!==s?(re=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=re):re=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(M,{className:`size-4`}),t[43]=R):R=t[43];let ie;t[44]!==l.archive||t[45]!==re?(ie=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:re,children:[R,l.archive]}),t[44]=l.archive,t[45]=re,t[46]=ie):ie=t[46];let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(Pe,{className:`my-1 h-px bg-edge-subtle`}),t[47]=ae):ae=t[47];let z;t[48]!==n.id||t[49]!==c?(z=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=z):z=t[50];let oe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(se,{className:`size-4`}),t[51]=oe):oe=t[51];let B;t[52]!==l.delete||t[53]!==z?(B=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[oe,l.delete]}),t[52]=l.delete,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==ne||t[56]!==ie||t[57]!==B?(V=(0,$.jsxs)(m,{children:[F,(0,$.jsx)(N,{children:(0,$.jsxs)(ue,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[ne,ie,ae,B]})})]}),t[55]=ne,t[56]=ie,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==P||t[60]!==V||t[61]!==T?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[T,P,V]}),t[59]=P,t[60]=V,t[61]=T,t[62]=H):H=t[62];let U;t[63]===n.pinned?U=t[64]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(j,{className:`size-3`})}),t[63]=n.pinned,t[64]=U);let W;t[65]===n.tags?W=t[66]:(W=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=W);let G;t[67]===v?G=t[68]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=G);let K;t[69]!==U||t[70]!==W||t[71]!==G?(K=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,W,G]}),t[69]=U,t[70]=W,t[71]=G,t[72]=K):K=t[72];let ce;return t[73]!==H||t[74]!==K||t[75]!==y||t[76]!==b||t[77]!==S||t[78]!==w?(ce=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:S,"aria-current":w,children:[H,K]}),t[73]=H,t[74]=K,t[75]=y,t[76]=b,t[77]=S,t[78]=w,t[79]=ce):ce=t[79],ce}function at(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:ze,ai_edit:be,sync:_,restore:D};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>je(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async t=>{p(!0);try{await Re(e,t),h(null),i()}catch{H({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??ze,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,_,c)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e.timestamp)},disabled:f,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})})]})}function ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:p,onOpenChat:m,onOpenNewChat:h}=e,g=s(l(yt)).notes,_=a(),v=r?.aiDeep?.catalysis,b=v?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>pe(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await Ne(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(be,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(y,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=A):A=t[8];let j;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(ge,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=j):j=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:g.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":g.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:A})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:g.catalysisSectionDescription}),w?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>K(n),{revalidate:!1}),disabled:E,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:g.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?g.processing:b?g.recatalyze:g.catalyzeAction}),b?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(pt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:g.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackHelpfulAria,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackNotHelpfulAria,children:(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:g.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[j,g.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:p,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:p?g.openingChat:g.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:p,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:g.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||g.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:g.noThreads})]})]})]})}function pt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function ht(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function gt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-CThEfJSn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([28,1,3,25,5,29])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Tt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:p},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:Ce},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:b},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:p,autoFocus:m=!1,onAutoFocusConsumed:h}){let g=l(e=>e.language),_=s(g).notes,v=s(g).automations.suggestions,b=a(),x=u(e=>e.resolved)===`dark`,{openImage:S}=He(),[C,w]=(0,Q.useState)(`wysiwyg`),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,ee]=(0,Q.useState)(360),[L,re]=(0,Q.useState)(!1),[R,ie]=(0,Q.useState)(!1),[z,oe]=(0,Q.useState)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),se=(0,Q.useRef)(null),U=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=te(e=>e.setPageHeader),_e=te(e=>e.clearPageHeader),{data:q,mutate:J}=d(e?[`note-detail`,e]:null,()=>Ae(e)),{data:ve=[],mutate:Se}=d(e?[`note-threads`,e]:null,()=>he(e),{revalidateOnFocus:!1}),Ce=D!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{B.current=!1,N(``),O(null),E(null),V.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!q||B.current||(N(q.title??``),B.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!m||!q||Ce||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),h?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[m,Ce,q,e,h]);let Y=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,we=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ae,i),children:(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Te=(0,Q.useCallback)(t=>{N(t),e&&(K.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){j(!0);try{await de(e,{title:t}),await J(),n?.()}catch{}finally{j(!1)}}},600))},[e,J,n]),De=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ae),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||Y||void 0,children:M||Y}),k?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,k,Y,M]),Oe=(0,Q.useCallback)(async(t=!1)=>{oe(!0);try{let n=await Ee(e,{forceNew:t});await J(),await Se(),b(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H({type:`error`,title:_.chatOpenFailedTitle,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{oe(!1)}},[J,Se,b,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),ke=(0,Q.useCallback)(async()=>{ie(!0);try{await ye(e),await J()}catch(e){H({type:`error`,title:_.catalysisFailed,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{ie(!1)}},[J,e]),je=(0,Q.useCallback)(()=>{E(T===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!R&&ke()},[T,R,ke,q?.aiDeep?.catalysis?.report]),Me=(0,Q.useCallback)(()=>{let t=D?.markdown??G.current??q?.markdown??``,n=D?.title??M,r=A([n,t].filter(Boolean).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-XoEq6qiv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BhQMnKH1.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-uQ0fehio.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/circle-alert-BEjgurr2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-C_ax27uc.js","assets/messages-C96Zjb0V.js","assets/cn-JdwAhgNB.js","assets/schemas-DgQq6Z5S.js","assets/product-delivery-BTRT9kCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-ulwTJovP.js","assets/activity-store-DkALQFJT.js","assets/theme-store-D37XLD_C.js","assets/index-BXtJvaQl.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-C96Zjb0V.js";import{l as c,n as l}from"./locale-store-C_ax27uc.js";import{i as u}from"./theme-store-D37XLD_C.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Bl as p,Ci as m,Cr as h,Du as g,Ec as _,Fc as v,Fu as y,Gl as b,Go as x,Is as S,Jl as C,Jo as w,Ko as T,Lc as E,Lu as D,Nc as O,Nt as k,Qn as A,Rc as j,Ru as M,Si as N,Sl as P,Sr as F,Ti as ee,Tl as I,To as te,Tr as L,U as ne,Uc as re,Uo as R,Vc as ie,Vu as ae,Wo as z,Xc as oe,Xs as B,Yo as V,Ys as se,Zo as H,Zs as U,_ as W,_l as G,_r as K,ar as ce,au as le,bi as ue,br as de,cc as fe,cr as pe,cs as me,dr as he,el as ge,er as _e,fr as q,gr as J,hr as ve,ir as ye,lc as be,lr as xe,mr as Se,nu as Ce,oc as Y,or as we,os as Te,pr as Ee,qo as De,rc as Oe,rl as ke,sr as Ae,ur as je,vc as Me,vr as Ne,wi as Pe,wl as X,xi as Fe,xl as Ie,yc as Le,yr as Re,zc as ze}from"./index-BhQMnKH1.js";import{t as Be}from"./automation-suggestion-card-3pqyIveW.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(De,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=h):h=t[4];let g=a?.alt||`Image preview`,_;t[5]===g?_=t[6]:(_=(0,$.jsx)(V,{className:`sr-only`,children:g}),t[5]=g,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(S,{className:`size-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:v})}),t[8]=i,t[9]=y);let b;t[10]===a?b=t[11]:(b=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=b);let C;t[12]!==y||t[13]!==b||t[14]!==_?(C=(0,$.jsxs)(w,{children:[m,(0,$.jsxs)(x,{className:h,"aria-describedby":void 0,children:[_,y,b]})]}),t[12]=y,t[13]=b,t[14]=_,t[15]=C):C=t[15];let T;t[16]!==C||t[17]!==f?(T=(0,$.jsx)(R,{open:f,onOpenChange:p,children:C}),t[16]=C,t[17]=f,t[18]=T):T=t[18];let E;return t[19]!==n||t[20]!==T?(E=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,T]}),t[19]=n,t[20]=T,t[21]=E):E=t[21],E}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=L(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(X,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(h,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=_e(),p=_e(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,y=m&&u>0?u:i??0,b=y>0?Math.min(_/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=h?`Pause`:`Play`,k;t[14]!==g||t[15]!==h?(k=g?(0,$.jsx)(ke,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(ie,{className:`size-3.5`}):(0,$.jsx)(v,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==y||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:y),t[25]=y,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let ee;return t[34]!==F||t[35]!==T||t[36]!==A?(ee=(0,$.jsxs)(`div`,{className:T,onClick:tt,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=ee):ee=t[37],ee}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=rt(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,h=!n.snippet?.trim(),[g]=(0,Q.useState)(ct),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==u?(_=Xe(n.createdAt,g,u),t[3]=n.createdAt,t[4]=g,t[5]=u,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),b=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,S;t[11]===x?S=t[12]:(S=o(`group relative flex cursor-pointer flex-col gap-2 rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,x),t[11]=x,t[12]=S);let w=d?`true`:void 0,T;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(T=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=T):T=t[18];let D;t[19]===n.title?D=t[20]:(D=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=D);let O=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,k;t[21]===O?k=t[22]:(k=o(`truncate text-sm leading-5`,O),t[21]=O,t[22]=k);let A;t[23]!==p||t[24]!==k?(A=(0,$.jsx)(`p`,{className:k,children:p}),t[23]=p,t[24]=k,t[25]=A):A=t[25];let P;t[26]!==D||t[27]!==A?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,A]}),t[26]=D,t[27]=A,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(ee,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(C,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let te;t[34]===n.pinned?te=t[35]:(te=n.pinned?(0,$.jsx)(E,{className:`size-4`}):(0,$.jsx)(j,{className:`size-4`}),t[34]=n.pinned,t[35]=te);let L=n.pinned?l.unpin:l.pin,ne;t[36]!==I||t[37]!==te||t[38]!==L?(ne=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[te,L]}),t[36]=I,t[37]=te,t[38]=L,t[39]=ne):ne=t[39];let re;t[40]!==n.id||t[41]!==s?(re=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=re):re=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(M,{className:`size-4`}),t[43]=R):R=t[43];let ie;t[44]!==l.archive||t[45]!==re?(ie=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:re,children:[R,l.archive]}),t[44]=l.archive,t[45]=re,t[46]=ie):ie=t[46];let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(Pe,{className:`my-1 h-px bg-edge-subtle`}),t[47]=ae):ae=t[47];let z;t[48]!==n.id||t[49]!==c?(z=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=z):z=t[50];let oe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(se,{className:`size-4`}),t[51]=oe):oe=t[51];let B;t[52]!==l.delete||t[53]!==z?(B=(0,$.jsxs)(Fe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[oe,l.delete]}),t[52]=l.delete,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==ne||t[56]!==ie||t[57]!==B?(V=(0,$.jsxs)(m,{children:[F,(0,$.jsx)(N,{children:(0,$.jsxs)(ue,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[ne,ie,ae,B]})})]}),t[55]=ne,t[56]=ie,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==P||t[60]!==V||t[61]!==T?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[T,P,V]}),t[59]=P,t[60]=V,t[61]=T,t[62]=H):H=t[62];let U;t[63]===n.pinned?U=t[64]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(j,{className:`size-3`})}),t[63]=n.pinned,t[64]=U);let W;t[65]===n.tags?W=t[66]:(W=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=W);let G;t[67]===v?G=t[68]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=G);let K;t[69]!==U||t[70]!==W||t[71]!==G?(K=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,W,G]}),t[69]=U,t[70]=W,t[71]=G,t[72]=K):K=t[72];let ce;return t[73]!==H||t[74]!==K||t[75]!==y||t[76]!==b||t[77]!==S||t[78]!==w?(ce=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:S,"aria-current":w,children:[H,K]}),t[73]=H,t[74]=K,t[75]=y,t[76]=b,t[77]=S,t[78]=w,t[79]=ce):ce=t[79],ce}function at(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:ze,ai_edit:be,sync:_,restore:D};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>je(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async t=>{p(!0);try{await Re(e,t),h(null),i()}catch{H({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??ze,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,_,c)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e.timestamp)},disabled:f,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})})]})}function ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:p,onOpenChat:m,onOpenNewChat:h}=e,g=s(l(yt)).notes,_=a(),v=r?.aiDeep?.catalysis,b=v?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>pe(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await Ne(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(be,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(y,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=A):A=t[8];let j;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(ge,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=j):j=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:g.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":g.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:A})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:g.catalysisSectionDescription}),w?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>K(n),{revalidate:!1}),disabled:E,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:g.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?g.processing:b?g.recatalyze:g.catalyzeAction}),b?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(pt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:g.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackHelpfulAria,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackNotHelpfulAria,children:(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:g.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[j,g.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:p,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:p?g.openingChat:g.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:p,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:g.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||g.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:g.noThreads})]})]})]})}function pt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function ht(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function gt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-XoEq6qiv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([28,1,3,25,5,29])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Tt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:p},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:Ce},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:b},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:p,autoFocus:m=!1,onAutoFocusConsumed:h}){let g=l(e=>e.language),_=s(g).notes,v=s(g).automations.suggestions,b=a(),x=u(e=>e.resolved)===`dark`,{openImage:S}=He(),[C,w]=(0,Q.useState)(`wysiwyg`),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,ee]=(0,Q.useState)(360),[L,re]=(0,Q.useState)(!1),[R,ie]=(0,Q.useState)(!1),[z,oe]=(0,Q.useState)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),se=(0,Q.useRef)(null),U=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=te(e=>e.setPageHeader),_e=te(e=>e.clearPageHeader),{data:q,mutate:J}=d(e?[`note-detail`,e]:null,()=>Ae(e)),{data:ve=[],mutate:Se}=d(e?[`note-threads`,e]:null,()=>he(e),{revalidateOnFocus:!1}),Ce=D!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{B.current=!1,N(``),O(null),E(null),V.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!q||B.current||(N(q.title??``),B.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!m||!q||Ce||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),h?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[m,Ce,q,e,h]);let Y=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,we=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ae,i),children:(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Te=(0,Q.useCallback)(t=>{N(t),e&&(K.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){j(!0);try{await de(e,{title:t}),await J(),n?.()}catch{}finally{j(!1)}}},600))},[e,J,n]),De=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ae),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||Y||void 0,children:M||Y}),k?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,k,Y,M]),Oe=(0,Q.useCallback)(async(t=!1)=>{oe(!0);try{let n=await Ee(e,{forceNew:t});await J(),await Se(),b(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H({type:`error`,title:_.chatOpenFailedTitle,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{oe(!1)}},[J,Se,b,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),ke=(0,Q.useCallback)(async()=>{ie(!0);try{await ye(e),await J()}catch(e){H({type:`error`,title:_.catalysisFailed,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{ie(!1)}},[J,e]),je=(0,Q.useCallback)(()=>{E(T===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!R&&ke()},[T,R,ke,q?.aiDeep?.catalysis?.report]),Me=(0,Q.useCallback)(()=>{let t=D?.markdown??G.current??q?.markdown??``,n=D?.title??M,r=A([n,t].filter(Boolean).join(`
3
3
 
4
4
  `));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:f(r,g)}},[g,_.titlePlaceholder,q?.markdown,e,D,M]),Ne=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,ae),children:[p?(0,$.jsx)(`button`,{type:`button`,onClick:p,"aria-label":_.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(ne,{input:Me,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:je,disabled:R,"aria-label":_.catalysisSectionTitle,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,T===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),R?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Oe(!1),disabled:z,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),z?_.openingChat:_.openChatButton]}),(0,$.jsx)(Tt,{mode:C,onModeChange:w,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(T===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,T===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0})})]}),[R,je,Oe,C,_.history,_.modeEdit,_.modePreview,_.modeSource,z,T,p,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,Me]);(0,Q.useLayoutEffect)(()=>(me({startExtra:we,main:q?De:null,end:q?Ne:null}),()=>{c&&_e()}),[c,_e,Ne,De,we,q,me]);let Pe=(0,Q.useCallback)(t=>{e&&(G.current=t,se.current&&clearTimeout(se.current),se.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){j(!0);try{await de(e,{markdown:t}),await J(),n?.()}catch(e){H({type:`error`,title:_.saveFailed,message:e instanceof Error?e.message:_.saveFailedHint})}finally{j(!1)}}},600))},[e,J,_.saveFailed,_.saveFailedHint,n]),X=(0,Q.useCallback)(t=>{xe(e,t.timestamp).then(e=>{e&&O(e)})},[e]),Fe=(0,Q.useCallback)(()=>{E(null),O(null)},[]),Ie=(0,Q.useCallback)(()=>{E(null),O(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{se.current&&clearTimeout(se.current),U.current&&clearTimeout(U.current);let t=G.current,n=K.current;G.current=null,K.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&de(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:_.back})]});let Re=Ce?D.title??``:M,ze=Ce?D.markdown??``:q.markdown??``,Z=new Date(q.createdAt).getTime(),Ve=Number.isFinite(Z)&&Date.now()-Z<3600*1e3?(0,$.jsx)(Be,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(W,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(W,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(`div`,{ref:ce,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:Ce?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Re&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Re}),ze?(0,$.jsx)(F,{noteId:e,content:ze,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[C===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),onCompositionStart:()=>{V.current=!0},onCompositionEnd:()=>{V.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!V.current&&!t.isComposing&&(e.preventDefault(),(ce.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(St,{initialContent:q.markdown??``,onChange:Pe,noteId:e},`wysiwyg-${e}`)})})]}),C===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(Ct,{initialContent:q.markdown??``,onChange:Pe,isDark:x},`source-${e}`)})})]}),C===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&S(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),q.markdown?(0,$.jsx)(F,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})})]}),(0,$.jsx)(`div`,{ref:le,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!L&&`transition-[width] duration-300 ease-in-out`),style:{width:T?P:0},children:(0,$.jsxs)(`div`,{ref:ue,className:`flex min-h-0 flex-1 flex-col`,style:{width:P},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),re(!0);let n=e.clientX,r=P,i=e.pointerId,a=0,o=P,s=P,c=()=>{a=0,s=o,T&&le.current?.style.setProperty(`width`,`${s}px`),ue.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}re(!1),ee(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:o(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,L&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:T===`history`?(0,$.jsx)(dt,{noteId:e,activeTimestamp:D?.timestamp??null,onSelect:X,onClose:Fe,onRestored:Ie}):T===`breakdown`?(0,$.jsx)(ft,{noteId:e,note:q??null,catalyzing:R,onCatalyze:ke,onClose:()=>E(null),noteThreads:ve,openingChat:z,onOpenChat:()=>Oe(!1),onOpenNewChat:()=>Oe(!0)}):null})]})})]})}var kt=3e4;function At(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function jt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(0),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)([]),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useCallback)(()=>{w.current&&=(clearInterval(w.current),null),T.current&&=(clearTimeout(T.current),null),x.current?.getTracks().forEach(e=>e.stop()),x.current=null,b.current=null,S.current=[],m(!1),g(0)},[]);(0,Q.useEffect)(()=>()=>E(),[E]);let D=(0,Q.useCallback)(async()=>{let e=b.current;if(!e||e.state!==`recording`)return;v(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-C.current)/1e3)),n=e.mimeType||At()||`audio/webm`,r=new Blob(S.current,{type:n});if(E(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{v(!1)}return}v(!1)},[E,i]),O=(0,Q.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=At(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);x.current=e,b.current=n,S.current=[],C.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&S.current.push(e.data)},n.start(),m(!0),g(0),w.current=setInterval(()=>{g(Math.round((Date.now()-C.current)/1e3))},250),T.current=setTimeout(()=>{D()},kt)}catch{E()}},[E,i,p,D,_]),k=(0,Q.useCallback)(()=>{if(p){D();return}O()},[p,O,D]),A=(0,Q.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),y.current?.focus()}}},[l,d,n]),j=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),A()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),A({navigate:!1}))},[A]),M=d||_;return(0,$.jsxs)(`div`,{className:o(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,p&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:M||s||p,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(P,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:k,disabled:M||c||d,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,p?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":p?`Stop recording`:`Voice`,"aria-pressed":p,children:p?(0,$.jsx)(Y,{className:`size-4 fill-current`}):(0,$.jsx)(oe,{className:`size-4`})}),p?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(h))}):(0,$.jsx)(`textarea`,{ref:y,value:l,onChange:e=>u(e.target.value),onKeyDown:j,placeholder:e,rows:1,disabled:M,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!l.trim()||M||p,onClick:e=>void A({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,l.trim()&&!M&&!p?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(Me,{className:`size-4`})})]})}var Mt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Nt=240,Pt=320,Ft=520,It=560;function Lt(e){if(globalThis.localStorage===void 0)return Pt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Pt;let n=Number(t);return Number.isFinite(n)?n:Pt}catch{return Pt}}function Rt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var zt={thought:Oe,todo:fe,voice:oe,media:P,bookmark:g,mixed:Oe,task:fe};function Bt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Vt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Ht(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Ut({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:u,captureTags:f=[],listTitle:p,listDescription:m,emptyText:h,emptyDescription:_,listWidthStorageKey:v=`xopc.notes.listWidth`}){let y=s(l(e=>e.language)).notes,b=!!c(e=>e.token),[C,E]=(0,Q.useReducer)(k,Mt),[D,A]=(0,Q.useState)(!1),[N,F]=(0,Q.useState)(``),[ee,I]=(0,Q.useState)(0),[L,ne]=(0,Q.useState)(()=>Lt(v)),[ie,B]=(0,Q.useState)(!1),[se,U]=(0,Q.useState)(!1),[W,K]=(0,Q.useState)(!1),[ue,pe]=(0,Q.useState)(null),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),[_e]=(0,Q.useState)(()=>Date.now()),ye=a(),be=(0,Q.useCallback)(e=>{let t=he.current?.clientWidth??window.innerWidth,n=Math.max(Nt,t-It);return Math.max(Nt,Math.min(Math.min(Ft,n),e))},[]),xe=(0,Q.useCallback)(e=>{let t=be(e);ne(t),Rt(v,t)},[be,v]);(0,Q.useLayoutEffect)(()=>{ne(e=>be(e))},[be]);let{data:Ce,mutate:Y,isLoading:Ee}=d((0,Q.useMemo)(()=>b?[`notes-list`,u,C.statusFilter,C.kindFilter,C.pinnedOnly]:null,[b,u,C.statusFilter,C.kindFilter,C.pinnedOnly]),()=>q({status:C.statusFilter===`all`?void 0:C.statusFilter,kind:C.kindFilter===`all`?void 0:C.kindFilter,tag:u,pinned:C.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ke=Ee&&!Ce,Ae=Ce?.items??[],je=Ce?.total??0,Me=N.trim(),{data:Ne,isLoading:Pe}=d(b&&D&&Me?[`notes-search`,u,Me]:null,()=>q({search:Me,tag:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Ne?.items??[],Fe=e?Ae.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[Me]),(0,Q.useEffect)(()=>{ee>=X.length&&I(Math.max(0,X.length-1))},[ee,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Re=te(e=>e.setPageHeader),ze=te(e=>e.clearPageHeader),Be=je>0?y.noteCount.replace(`{{count}}`,String(je)):null,Z=y.searchDialogTitle,Ve=y.searchClose,He=y.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:o(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ae),"aria-label":Z,children:[(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Z})]}),[Z]);(0,Q.useLayoutEffect)(()=>{if(n)return b?(Re({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ae),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:p??y.title}),Be?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Be}):null]}),end:Ue}),()=>ze()):(ze(),()=>ze())},[ze,b,Ue,p,n,y.title,Be,e,Re]);let We=(0,Q.useMemo)(()=>({justNow:y.justNow,minutesAgo:y.minutesAgo,today:y.today,yesterday:y.yesterday,daysAgo:y.daysAgo}),[y.justNow,y.minutesAgo,y.today,y.yesterday,y.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:y.viewRecent,description:y.viewRecentDescription,icon:le,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:y.filterInbox,description:y.viewInboxDescription,icon:Ie,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:y.pinned,description:y.viewPinnedDescription,icon:j,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:y.viewTasks,description:y.viewTasksDescription,icon:fe,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:y.kindVoice,description:y.viewVoiceDescription,icon:oe,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:y.kindMedia,description:y.viewMediaDescription,icon:P,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:y.kindBookmark,description:y.viewBookmarksDescription,icon:g,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:y.filterProcessed,description:y.viewProcessedDescription,icon:G,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:y.filterArchived,description:y.viewArchiveDescription,icon:M,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[y.filterArchived,y.filterInbox,y.filterProcessed,y.kindBookmark,y.kindMedia,y.kindVoice,y.pinned,y.viewArchiveDescription,y.viewBookmarksDescription,y.viewInboxDescription,y.viewMediaDescription,y.viewPinnedDescription,y.viewProcessedDescription,y.viewRecent,y.viewRecentDescription,y.viewTasks,y.viewTasksDescription,y.viewVoiceDescription]),Ke=Ge.find(e=>Vt(C,e))??Ge[0],qe=p??Ke.label,Je=m??Ke.description,Ye=(0,Q.useCallback)(async(e,n)=>{let r=f.length?await ce({markdown:e,kind:`thought`,tags:f,channel:`web`}):await Se(e,`web`);await Y(),n?.navigate!==!1&&ye(Ht(t,r.id))},[t,f,Y,ye]),$e=(0,Q.useCallback)(async()=>{if(!W){K(!0);try{let e=await ce({markdown:``,kind:`thought`,tags:f,channel:`web`});E({type:`patch`,patch:Mt}),await Y(),pe(e.id),ye(Ht(t,e.id))}catch(e){H({type:`error`,title:y.createBlankFailed,message:e instanceof Error?e.message:y.createBlankFailedHint})}finally{K(!1)}}},[t,f,W,Y,y.createBlankFailed,y.createBlankFailedHint,ye]),et=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{await ve(t,`web`),await Y()}catch(e){H({type:`error`,title:y.imageUploadFailed,message:e instanceof Error?e.message:y.imageUploadFailedHint})}},e.click()},[Y,y.imageUploadFailed,y.imageUploadFailedHint]),tt=(0,Q.useCallback)(async(e,t)=>{try{await J(e,t,`web`),await Y()}catch(e){H({type:`error`,title:y.voiceUploadFailed,message:e instanceof Error?e.message:y.voiceUploadFailedHint})}},[Y,y.voiceUploadFailed,y.voiceUploadFailedHint]),nt=(0,Q.useCallback)(async(e,t)=>{await de(e,{pinned:t}),await Y()},[Y]),rt=(0,Q.useCallback)(async e=>{await de(e,{status:`archived`}),await Y()},[Y]),at=(0,Q.useCallback)(async e=>{await we(e),await Y()},[Y]),ot=(0,Q.useCallback)(e=>{ye(Ht(t,e))},[t,ye]),st=(0,Q.useCallback)(e=>{ye(Ht(t,e)),A(!1)},[t,ye]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[ee]??X[0];t&&st(t.id)}}},[ee,st,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ge.current;t.setPointerCapture(e.pointerId),B(!0);let r=he.current?.clientWidth??window.innerWidth,i=Math.max(Nt,r-It),a=Math.min(Ft,i),o=e=>Math.max(Nt,Math.min(a,e)),s=e.clientX,c=o(L),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}B(!1),he.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),ne(f),Rt(v,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[v,L]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),$e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$e]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),xe(L-16)):e.key===`ArrowRight`?(e.preventDefault(),xe(L+16)):e.key===`Home`?(e.preventDefault(),xe(Nt)):e.key===`End`&&(e.preventDefault(),xe(Ft))},[xe,L]);return b?(0,$.jsxs)(`div`,{ref:he,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${L}px`},children:[(0,$.jsxs)(`section`,{ref:ge,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!ie&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,se?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":se?!0:void 0,children:[(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(Te,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&E({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":y.libraryTitle,children:Ge.map(e=>(0,$.jsx)(me,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Be??Je})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":y.collapseNotesList,title:y.collapseNotesList,children:(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:$e,disabled:W,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":y.createBlankNote,title:y.createBlankShortcut,children:(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":y.searchDialogTitle,children:(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})})]})]})}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ke?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Ae.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(Oe,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Fe?y.noteOutsideCurrentView:h??y.noNotes}),e&&!Fe?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:_??y.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Fe?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:y.noteOutsideCurrentView}):null,Ae.map((t,n)=>{let r=n>0?Qe(Ae[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[Qe(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Ze(t.createdAt,_e,We)}),(0,$.jsx)(it,{note:t,selected:t.id===e,onPress:ot,onPin:nt,onArchive:rt,onDelete:at,timeLabels:We,labels:{pin:y.pin,unpin:y.unpin,archive:y.archive,delete:y.delete,imageNote:y.imageNote,noText:y.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(jt,{placeholder:y.quickCapturePlaceholder,sendLabel:y.send,onCapture:Ye,onImagePick:i?et:void 0,onVoiceCapture:i?tt:void 0,recordingLabel:y.recording})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":y.resizeNotesList,"aria-valuemin":Nt,"aria-valuemax":Ft,"aria-valuenow":Math.round(L),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>xe(Pt),onKeyDown:ut,title:y.resizeNotesList,className:o(`group relative hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,se?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-3 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:o(`h-8 w-1 rounded-pill opacity-0 transition-[background-color,opacity,transform] duration-150`,`bg-edge-strong/55 group-hover:opacity-100 group-focus-visible:opacity-100`,`group-hover:scale-y-110 group-focus-visible:scale-y-110`,ie&&`bg-accent opacity-100 scale-y-125`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[se?(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":y.expandNotesList,title:y.expandNotesList,children:(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Et,{noteId:e,onBack:()=>ye(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>A(!0),autoFocus:e===ue,onAutoFocusConsumed:()=>pe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(Oe,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:y.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:y.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:$e,disabled:W,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),W?y.creatingBlankNote:y.createBlankNote]})]})})]}),(0,$.jsx)(R,{open:D,onOpenChange:A,children:(0,$.jsxs)(w,{children:[(0,$.jsx)(De,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(x,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(V,{className:`text-sm font-semibold text-fg`,children:Z}),(0,$.jsx)(T,{className:`sr-only`,children:y.searchPlaceholder}),(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ve,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Le,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:N,onChange:e=>F(e.target.value),onKeyDown:ct,placeholder:y.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),N?(0,$.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":He,children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Me?Pe&&!Ne?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Oe,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:y.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:y.searchResultsCount.replace(`{{count}}`,String(Ne?.total??X.length))}),X.map((e,t)=>{let n=zt[e.kind]||Oe,r=Bt(e,{imageNote:y.imageNote,noText:y.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>st(e.id),onMouseEnter:()=>I(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===ee?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Xe(e.updatedAt,_e,We)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Le,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:y.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(Oe,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y.needToken})]})}export{He as n,Ut as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{Ds as a}from"./index-CfOzvGDb.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{Ds as a}from"./index-BhQMnKH1.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Ds as r,Kl as i,Xl as a,Xo as o}from"./index-CfOzvGDb.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=o()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=o()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=n(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,r.transition,r.press,r.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,r.transition,r.press,r.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=n(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,r.transition,r.press,r.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Ds as r,Kl as i,Xl as a,Xo as o}from"./index-BhQMnKH1.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=o()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=o()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=n(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,r.transition,r.press,r.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,r.transition,r.press,r.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=n(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,r.transition,r.press,r.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-BTRT9kCS.js";import{ro as l}from"./index-CfOzvGDb.js";import{n as u}from"./api-DPIXEcIq.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{n as a}from"./locale-store-C_ax27uc.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-BTRT9kCS.js";import{ro as l}from"./index-BhQMnKH1.js";import{n as u}from"./api-DPIXEcIq.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};