pisper 0.6.20 → 0.6.21

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 (109) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +550 -550
  3. package/web/assets/{AppDialog-BKTqwx46.js → AppDialog-CyOinq_c.js} +1 -1
  4. package/web/assets/{AppOverlays-DEYd3Zud.js → AppOverlays-tniCecGA.js} +1 -1
  5. package/web/assets/{AssetsPage-BsIG0e5H.js → AssetsPage-DYFCPNhU.js} +1 -1
  6. package/web/assets/{BoardPage-CgbOwsbF.js → BoardPage-Dp-FZv-N.js} +3 -3
  7. package/web/assets/{ChannelsPage-C9eEdxbz.js → ChannelsPage-vBRUJEhU.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-CBnvknpv.js → ChatAppearancePage-DH4LSb0w.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-Bq-_Qawn.js → ChatHistoryPage-ChspTm6r.js} +1 -1
  10. package/web/assets/ChatPage-DvU-p808.js +553 -0
  11. package/web/assets/{ConfigPage-D44C5I7w.js → ConfigPage-CFFaLkKD.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-DGhN5dWj.js → DesktopWindowControls-Cz0mpg2c.js} +1 -1
  13. package/web/assets/{FeaturePage-B3PLRtEG.js → FeaturePage-DT_WfUIg.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-fSmyWf24.js → FileAttachmentPreview-yuCLHoKm.js} +1 -1
  15. package/web/assets/{FloatingWidgets-C1_4vp7k.js → FloatingWidgets-D-48zs1T.js} +1 -1
  16. package/web/assets/{FocusRuntimeControls-DraooZz_.js → FocusRuntimeControls-D61-BVTV.js} +1 -1
  17. package/web/assets/{GitDiffViewer-XzdYQWbX.js → GitDiffViewer-DWHHRnjQ.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-BlXjm1PQ.js → ManageProjectsDialog-B_0l-_Th.js} +1 -1
  19. package/web/assets/{MarkdownMessage-B-IixrQ3.js → MarkdownMessage-zaqhqJ44.js} +1 -1
  20. package/web/assets/{McpPage-D0Zmfgbq.js → McpPage-CuOr94Lo.js} +1 -1
  21. package/web/assets/{MemoryPage-DgZ7cL70.js → MemoryPage-CI_OOJh3.js} +1 -1
  22. package/web/assets/{MobileNavigation-BIt1CBum.js → MobileNavigation-CpOrDVyY.js} +1 -1
  23. package/web/assets/{MorePage-BZ4iZ1n_.js → MorePage-CP0ptgQR.js} +1 -1
  24. package/web/assets/{NewFolderDialog-W9wLUVXP.js → NewFolderDialog-wwAp2HUt.js} +1 -1
  25. package/web/assets/{PageHeader-DcCyaFp0.js → PageHeader-CbiN6zVm.js} +1 -1
  26. package/web/assets/{PhoneDrawer-B_eKy4tt.js → PhoneDrawer-DN3UBXYe.js} +1 -1
  27. package/web/assets/{PhoneMenuButton-CBT0H1Cn.js → PhoneMenuButton-BMgvbvez.js} +1 -1
  28. package/web/assets/{PhoneTopBar-Czpvw2ML.js → PhoneTopBar-DFtEfuO6.js} +1 -1
  29. package/web/assets/{PluginsPage-wk5WpJ7Z.js → PluginsPage-CPkH6yN9.js} +1 -1
  30. package/web/assets/{SafeModePrompt-Dtq5wVfV.js → SafeModePrompt-vZ-kg03s.js} +1 -1
  31. package/web/assets/{SchedulesPage-BtRe2Qht.js → SchedulesPage-BQBk-HJm.js} +1 -1
  32. package/web/assets/{SessionBrowserPane-D2Z-J6tl.js → SessionBrowserPane-CC0qsCP9.js} +2 -2
  33. package/web/assets/{SessionContextPanel-Cg8AW4l1.js → SessionContextPanel-CyPu1SIQ.js} +2 -2
  34. package/web/assets/{SessionHome-DIpyJQVn.js → SessionHome-C2xp5_yM.js} +1 -1
  35. package/web/assets/{SessionInspector-DdpBBhNr.js → SessionInspector-D362Va6Y.js} +1 -1
  36. package/web/assets/{SessionShell-ocBFDevg.js → SessionShell-BmsJM64n.js} +1 -1
  37. package/web/assets/{SettingsSidebar-CP5t-q0e.js → SettingsSidebar-B7qnN1dq.js} +1 -1
  38. package/web/assets/{ShortcutHelpDialog-BOcP90RU.js → ShortcutHelpDialog-BzWvhRT2.js} +1 -1
  39. package/web/assets/{ShortcutKeys-CBl2x5Yl.js → ShortcutKeys-Cg-wl3yb.js} +1 -1
  40. package/web/assets/{SidebarUpdateStatus-CqZx7khD.js → SidebarUpdateStatus-B-MIuH8f.js} +1 -1
  41. package/web/assets/{SkillsPage-BGyMMq-9.js → SkillsPage-BowfELnZ.js} +1 -1
  42. package/web/assets/{TaskProcessesPane-B43p2Dvr.js → TaskProcessesPane-DGikk1nH.js} +1 -1
  43. package/web/assets/{TaskTerminalView-BMjmp-4_.js → TaskTerminalView-BjR4vuZI.js} +1 -1
  44. package/web/assets/{TerminalPanel-CH2-Yc1F.js → TerminalPanel-ZXcyyLBu.js} +1 -1
  45. package/web/assets/{WebDesktopPet-Fy9xj1bh.js → WebDesktopPet-CrUcp9Ym.js} +1 -1
  46. package/web/assets/{WorkflowsPage-DvZsyJSV.js → WorkflowsPage-CTKpPFrC.js} +1 -1
  47. package/web/assets/{WorkspacePicker-LbBXFH77.js → WorkspacePicker-CROSQVzJ.js} +1 -1
  48. package/web/assets/{api-m-Yq8n0q.js → api-CIB7ZPX3.js} +1 -1
  49. package/web/assets/{app-update-DVn3toIR.js → app-update-B6njQMB7.js} +1 -1
  50. package/web/assets/{approval-confirm-Ch86qdyC.js → approval-confirm-D2B0tMFE.js} +1 -1
  51. package/web/assets/{board-projects-KHcPQYWz.js → board-projects-Ca61ZKPH.js} +1 -1
  52. package/web/assets/{bots-store-BMcWJ2Gm.js → bots-store-BG81qEJz.js} +1 -1
  53. package/web/assets/{chat-api-DgJdhfOP.js → chat-api-aEirz9it.js} +1 -1
  54. package/web/assets/{client-store-BkVlLM-4.js → client-store-BSqTT-c2.js} +1 -1
  55. package/web/assets/{config-search-BqYT_Xre.js → config-search-DdXAm7PX.js} +1 -1
  56. package/web/assets/{dialog-5MLAAE-f.js → dialog-D1TVm0d6.js} +1 -1
  57. package/web/assets/{events-B0F69Vd3.js → events-CrT7ie40.js} +1 -1
  58. package/web/assets/{folder-paths-CdOS1VLF.js → folder-paths-BuiyvlAk.js} +1 -1
  59. package/web/assets/{hosts-CoGHAtF9.js → hosts-CpFGDuNR.js} +1 -1
  60. package/web/assets/i18n-CXRjs9ow.js +1 -0
  61. package/web/assets/{index-DmohsuQg.js → index-DcTDwezs.js} +2 -2
  62. package/web/assets/{mount-app-Cr5Uq-cP.js → mount-app-DhHe93-u.js} +3 -3
  63. package/web/assets/{permission-rules-api-CAxfABVR.js → permission-rules-api-Ch3fRXTD.js} +1 -1
  64. package/web/assets/{pick-system-directory-ByTVOp-v.js → pick-system-directory-B8aZR2BS.js} +1 -1
  65. package/web/assets/{placements-CuVM9Xxs.js → placements-5hgUqGzE.js} +2 -2
  66. package/web/assets/{popover-DUWwlhPy.js → popover-BMTgTASl.js} +1 -1
  67. package/web/assets/{public-CWbnixwI.js → public-BTvrDX6E.js} +1 -1
  68. package/web/assets/{public-CGbDaxd0.js → public-BZlIDP6h.js} +1 -1
  69. package/web/assets/{public-B00uoqCB.js → public-DTq_JyXj.js} +2 -2
  70. package/web/assets/{public-components-DGfACSCk.js → public-components-DUa3En6P.js} +1 -1
  71. package/web/assets/public-diff-DEL93aov.js +1 -0
  72. package/web/assets/public-events-BiaqrDkZ.js +1 -0
  73. package/web/assets/{public-flags-BRenaSzJ.js → public-flags-DEs9Uj_y.js} +1 -1
  74. package/web/assets/{public-session-BeSwdD6a.js → public-session-CXzhUUNr.js} +1 -1
  75. package/web/assets/{public-sidebar-CAWnINZG.js → public-sidebar-CJVnP7HU.js} +1 -1
  76. package/web/assets/{runtime-capabilities-store-DWW9jolt.js → runtime-capabilities-store-DpEKnn1b.js} +1 -1
  77. package/web/assets/{safe-mode-instance-65Kg_IPn.js → safe-mode-instance-CVh0Lclx.js} +1 -1
  78. package/web/assets/safe-mode-sentinel-Bm4e075H.js +1 -0
  79. package/web/assets/{session-change-summary-api-CbVgbX2o.js → session-change-summary-api-sn-ejt4H.js} +1 -1
  80. package/web/assets/{session-home-LwsMdqJu.js → session-home-DBefA-JE.js} +1 -1
  81. package/web/assets/{session-organization-api-BmX-aNPa.js → session-organization-api-BFW_7Myv.js} +1 -1
  82. package/web/assets/{session-scope-Bz6CeMq0.js → session-scope-P-D-Ssd4.js} +1 -1
  83. package/web/assets/{session-tree-actions-BLL1s_Ws.js → session-tree-actions-DZ5-Z8_F.js} +1 -1
  84. package/web/assets/{session-tree-summary-BfRtAGwx.js → session-tree-summary-Dljblf8P.js} +1 -1
  85. package/web/assets/{shortcuts-Cgx6V2jI.js → shortcuts-DXHroTTi.js} +1 -1
  86. package/web/assets/{side-chat-context-Cm84nqzk.js → side-chat-context-6tf1Gx5C.js} +4 -4
  87. package/web/assets/{sidebar-C0AjfIUc.js → sidebar-PuiNlAmD.js} +1 -1
  88. package/web/assets/{sidebar-store-BhEocW8t.js → sidebar-store-CbyxBthc.js} +1 -1
  89. package/web/assets/{speech-session-BI_qH5Lw.js → speech-session-B3-i8f64.js} +1 -1
  90. package/web/assets/{startup-queries-Cevfi-_Z.js → startup-queries-CceboYee.js} +1 -1
  91. package/web/assets/{use-i18n-Cyg5th6Z.js → use-i18n-B2p84ZNR.js} +1 -1
  92. package/web/assets/{use-open-bot-HoswiH7t.js → use-open-bot-CgFlDm0x.js} +1 -1
  93. package/web/assets/{use-studio-actions-CGzcb2Fx.js → use-studio-actions-DM2CAaXR.js} +1 -1
  94. package/web/assets/{useCatalogProjects-hKlUioWa.js → useCatalogProjects-laY-U3Br.js} +1 -1
  95. package/web/assets/{useNewProjectPicker-C9X_vJdU.js → useNewProjectPicker-rhLvXi27.js} +2 -2
  96. package/web/assets/{useNow-BBVE-LCR.js → useNow-DYvbFah-.js} +1 -1
  97. package/web/assets/{usePhoneShell-CDP-O4Gc.js → usePhoneShell-BSkh5GND.js} +1 -1
  98. package/web/assets/{useSessionListQuery-BpWfS-tU.js → useSessionListQuery-CHbg2lM2.js} +1 -1
  99. package/web/assets/{useSessionRowActions-Dd5ulVpS.js → useSessionRowActions-CO4u1xCd.js} +1 -1
  100. package/web/assets/{useSidebarModel-uxFT2LRy.js → useSidebarModel-V_SZjKZH.js} +1 -1
  101. package/web/assets/{web-preview-Bo8YMR-t.js → web-preview-CR8GMArR.js} +1 -1
  102. package/web/assets/{web-preview-events-DIPJR6oR.js → web-preview-events-DUqovP-L.js} +1 -1
  103. package/web/assets/{workspace-order-store-DshLVZf8.js → workspace-order-store-CK1RETHt.js} +1 -1
  104. package/web/index.html +1 -1
  105. package/web/assets/ChatPage-Bwn6Qfok.js +0 -553
  106. package/web/assets/i18n-Du-JO3Qx.js +0 -1
  107. package/web/assets/public-diff-DIMQ2JTm.js +0 -1
  108. package/web/assets/public-events-CxK6EdoY.js +0 -1
  109. package/web/assets/safe-mode-sentinel-CIemi_6b.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{t as i}from"./runtime-capabilities-store-DWW9jolt.js";import{t as a}from"./arrow-right-DqLOhpA2.js";import{t as o}from"./download-BCfIiuaL.js";import{t as s}from"./key-round-C29uZbsf.js";import{t as c}from"./search-D0mqDaf_.js";import{t as l}from"./server-BgNvmqwJ.js";import{t as u}from"./x-07u4-129.js";import{t as d}from"./utils-C8uzG5AZ.js";import{t as f}from"./button-CCcCN8tE.js";import{t as p}from"./kbd-CAufZTkl.js";import{n as m,r as h}from"./config-search-BqYT_Xre.js";import{s as g}from"./shortcuts-Cgx6V2jI.js";import{a as _,i as v,l as y,o as b,s as x,t as S}from"./dialog-5MLAAE-f.js";import{t as C}from"./input-CPw-zkYh.js";import{t as w}from"./BrandLogo-k3CvJjd4.js";var T=e(t(),1),E=n();function D({query:e,onQueryChange:t,onSelect:n,inputRef:a,placement:o=`toolbar`}){let{t:s,language:l}=r(),[u,f]=(0,T.useState)(!1),[_,v]=(0,T.useState)(0),y=(0,T.useRef)(null),b=i(e=>e.capabilities),x=g(`focusSearch`),S=(0,T.useMemo)(()=>h(e,l,{capabilities:b,mobileApp:!!window.__PISPER_MOBILE_APP__}),[l,e,b]);(0,T.useEffect)(()=>v(0),[e]),(0,T.useEffect)(()=>{if(!u)return;let e=e=>{y.current&&!y.current.contains(e.target)&&f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]);let w=e=>{if(f(!1),t(``),e.entry.card===`interface-custom-ui`){n(e.entry.section,`widgets`);return}m(e.entry.card,e.entry.section,{targetId:e.entry.targetId,targetText:e.title,expandGroup:e.entry.expandGroup}),n(e.entry.section)},D=u&&e.trim().length>0;return(0,E.jsxs)(`div`,{ref:y,className:d(`relative`,o===`sidebar`?`w-full`:`w-[min(250px,24vw)] max-[900px]:w-[190px] max-[650px]:col-start-1 max-[650px]:row-start-1 max-[650px]:w-full max-[650px]:min-w-0`),children:[(0,E.jsx)(c,{size:15,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-content-muted`}),(0,E.jsx)(C,{ref:a,value:e,title:s(`navigation:pageHeader.search`),"aria-label":s(`navigation:pageHeader.search`),className:d(`pl-8 text-sm`,o!==`sidebar`&&`max-[650px]:h-11 max-[650px]:text-[16px]`,o===`sidebar`&&`h-8 border-key-border bg-key pr-9 text-ellipsis shadow-key`),placeholder:s(o===`sidebar`?`config:configSearch.placeholderShort`:`config:configSearch.placeholder`),onChange:e=>{t(e.target.value),f(!0)},onFocus:()=>{e.trim()&&f(!0)},onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),t(``),f(!1)):e.key===`ArrowDown`?(e.preventDefault(),v(e=>Math.min(e+1,S.length-1))):e.key===`ArrowUp`?(e.preventDefault(),v(e=>Math.max(e-1,0))):e.key===`Enter`&&S[_]&&(e.preventDefault(),w(S[_]))}}),o===`sidebar`&&x&&!e&&(0,E.jsx)(p,{className:`absolute top-1/2 right-2 -translate-y-1/2 pointer-coarse:hidden`,children:x}),D&&(0,E.jsx)(`div`,{className:`absolute top-full left-0 z-50 mt-1.5 w-full overflow-hidden rounded-md bg-solid shadow-float`,children:S.length===0?(0,E.jsx)(`p`,{role:`status`,className:`px-3 py-3 text-xs text-content-muted`,children:s(`config:configSearch.noResults`)}):(0,E.jsx)(`ul`,{className:`max-h-[280px] overflow-auto py-1`,children:S.map((e,t)=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,className:d(`flex w-full flex-col gap-0.5 px-3 py-1.5 text-left pointer-coarse:min-h-11`,t===_?`bg-surface-hover`:`hover:bg-surface-subtle`),onMouseEnter:()=>v(t),onClick:()=>w(e),children:[(0,E.jsx)(`span`,{className:`text-sm text-content`,children:e.title}),(0,E.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.sectionTitle})]})},e.entry.id))})})]})}function O({open:e,onDismiss:t,onOpenImport:n,onOpenSettings:i}){let{t:c}=r();return(0,E.jsx)(S,{open:e,onOpenChange:e=>!e&&t(),children:(0,E.jsxs)(v,{showCloseButton:!1,overlayClassName:`z-[220]`,className:`z-[220] gap-0 rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,style:{maxWidth:`min(28rem, calc(100vw - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)) - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right))))`,maxHeight:`calc(100dvh - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)) - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)))`},"aria-describedby":`model-onboarding-description`,children:[(0,E.jsxs)(`div`,{className:`relative px-5 pt-5 pb-2 max-[650px]:px-4 max-[650px]:pt-4`,children:[(0,E.jsxs)(x,{className:`gap-3 pr-9 text-left`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`w-fit rounded-[13px] shadow-raise`,children:(0,E.jsx)(w,{size:44})}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(`p`,{className:`text-xs font-medium text-content-muted`,children:c(`config:modelOnboarding.eyebrow`)}),(0,E.jsx)(y,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em]`,children:c(`config:modelOnboarding.title`)}),(0,E.jsx)(_,{id:`model-onboarding-description`,className:`leading-6`,children:c(`config:modelOnboarding.description`)})]})]}),(0,E.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3 pointer-coarse:size-11`,"aria-label":c(`common:ui.closeDialog`),title:c(`common:ui.closeDialog`),onClick:t,children:(0,E.jsx)(u,{})})]}),(0,E.jsxs)(`div`,{className:`grid gap-3 px-5 pt-2 pb-4 max-[650px]:px-4`,children:[(0,E.jsx)(`ol`,{className:`m-0 list-none divide-y divide-stroke-soft border-y border-stroke-soft p-0`,children:[{Icon:l,title:c(`config:modelOnboarding.connectionTitle`),description:c(`config:modelOnboarding.connectionDescription`)},{Icon:s,title:c(`config:modelOnboarding.modelTitle`),description:c(`config:modelOnboarding.modelDescription`)}].map(({Icon:e,title:t,description:n},r)=>(0,E.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 shrink-0 place-items-center rounded-full bg-surface-subtle text-xs font-medium text-content-secondary tabular-nums`,children:r+1}),(0,E.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,E.jsxs)(`strong`,{className:`flex items-center gap-1.5 text-sm font-medium text-content`,children:[(0,E.jsx)(e,{className:`size-3.5 text-content-muted`,"aria-hidden":`true`}),t]}),(0,E.jsx)(`p`,{className:`text-xs leading-5 text-content-muted`,children:n})]})]},t))}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`w-full max-[650px]:h-11`,onClick:n,children:[(0,E.jsx)(o,{}),c(`config:modelOnboarding.findExisting`)]})]}),(0,E.jsxs)(b,{className:`m-0 rounded-none px-5 pt-3 max-[650px]:px-4`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,E.jsx)(f,{type:`button`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:t,children:c(`config:modelOnboarding.later`)}),(0,E.jsxs)(f,{type:`button`,className:`max-[650px]:h-11`,onClick:i,children:[c(`config:modelOnboarding.openSettings`),(0,E.jsx)(a,{})]})]})]})})}export{D as ConfigSearchBox,O as ModelOnboardingDialog};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{t as i}from"./runtime-capabilities-store-DpEKnn1b.js";import{t as a}from"./arrow-right-DqLOhpA2.js";import{t as o}from"./download-BCfIiuaL.js";import{t as s}from"./key-round-C29uZbsf.js";import{t as c}from"./search-D0mqDaf_.js";import{t as l}from"./server-BgNvmqwJ.js";import{t as u}from"./x-07u4-129.js";import{t as d}from"./utils-C8uzG5AZ.js";import{t as f}from"./button-CCcCN8tE.js";import{t as p}from"./kbd-CAufZTkl.js";import{n as m,r as h}from"./config-search-DdXAm7PX.js";import{s as g}from"./shortcuts-DXHroTTi.js";import{a as _,i as v,l as y,o as b,s as x,t as S}from"./dialog-D1TVm0d6.js";import{t as C}from"./input-CPw-zkYh.js";import{t as w}from"./BrandLogo-k3CvJjd4.js";var T=e(t(),1),E=n();function D({query:e,onQueryChange:t,onSelect:n,inputRef:a,placement:o=`toolbar`}){let{t:s,language:l}=r(),[u,f]=(0,T.useState)(!1),[_,v]=(0,T.useState)(0),y=(0,T.useRef)(null),b=i(e=>e.capabilities),x=g(`focusSearch`),S=(0,T.useMemo)(()=>h(e,l,{capabilities:b,mobileApp:!!window.__PISPER_MOBILE_APP__}),[l,e,b]);(0,T.useEffect)(()=>v(0),[e]),(0,T.useEffect)(()=>{if(!u)return;let e=e=>{y.current&&!y.current.contains(e.target)&&f(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]);let w=e=>{if(f(!1),t(``),e.entry.card===`interface-custom-ui`){n(e.entry.section,`widgets`);return}m(e.entry.card,e.entry.section,{targetId:e.entry.targetId,targetText:e.title,expandGroup:e.entry.expandGroup}),n(e.entry.section)},D=u&&e.trim().length>0;return(0,E.jsxs)(`div`,{ref:y,className:d(`relative`,o===`sidebar`?`w-full`:`w-[min(250px,24vw)] max-[900px]:w-[190px] max-[650px]:col-start-1 max-[650px]:row-start-1 max-[650px]:w-full max-[650px]:min-w-0`),children:[(0,E.jsx)(c,{size:15,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-content-muted`}),(0,E.jsx)(C,{ref:a,value:e,title:s(`navigation:pageHeader.search`),"aria-label":s(`navigation:pageHeader.search`),className:d(`pl-8 text-sm`,o!==`sidebar`&&`max-[650px]:h-11 max-[650px]:text-[16px]`,o===`sidebar`&&`h-8 border-key-border bg-key pr-9 text-ellipsis shadow-key`),placeholder:s(o===`sidebar`?`config:configSearch.placeholderShort`:`config:configSearch.placeholder`),onChange:e=>{t(e.target.value),f(!0)},onFocus:()=>{e.trim()&&f(!0)},onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),t(``),f(!1)):e.key===`ArrowDown`?(e.preventDefault(),v(e=>Math.min(e+1,S.length-1))):e.key===`ArrowUp`?(e.preventDefault(),v(e=>Math.max(e-1,0))):e.key===`Enter`&&S[_]&&(e.preventDefault(),w(S[_]))}}),o===`sidebar`&&x&&!e&&(0,E.jsx)(p,{className:`absolute top-1/2 right-2 -translate-y-1/2 pointer-coarse:hidden`,children:x}),D&&(0,E.jsx)(`div`,{className:`absolute top-full left-0 z-50 mt-1.5 w-full overflow-hidden rounded-md bg-solid shadow-float`,children:S.length===0?(0,E.jsx)(`p`,{role:`status`,className:`px-3 py-3 text-xs text-content-muted`,children:s(`config:configSearch.noResults`)}):(0,E.jsx)(`ul`,{className:`max-h-[280px] overflow-auto py-1`,children:S.map((e,t)=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,className:d(`flex w-full flex-col gap-0.5 px-3 py-1.5 text-left pointer-coarse:min-h-11`,t===_?`bg-surface-hover`:`hover:bg-surface-subtle`),onMouseEnter:()=>v(t),onClick:()=>w(e),children:[(0,E.jsx)(`span`,{className:`text-sm text-content`,children:e.title}),(0,E.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.sectionTitle})]})},e.entry.id))})})]})}function O({open:e,onDismiss:t,onOpenImport:n,onOpenSettings:i}){let{t:c}=r();return(0,E.jsx)(S,{open:e,onOpenChange:e=>!e&&t(),children:(0,E.jsxs)(v,{showCloseButton:!1,overlayClassName:`z-[220]`,className:`z-[220] gap-0 rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,style:{maxWidth:`min(28rem, calc(100vw - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)) - max(1rem, env(safe-area-inset-left), env(safe-area-inset-right))))`,maxHeight:`calc(100dvh - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)) - max(1rem, env(safe-area-inset-top), env(safe-area-inset-bottom)))`},"aria-describedby":`model-onboarding-description`,children:[(0,E.jsxs)(`div`,{className:`relative px-5 pt-5 pb-2 max-[650px]:px-4 max-[650px]:pt-4`,children:[(0,E.jsxs)(x,{className:`gap-3 pr-9 text-left`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`w-fit rounded-[13px] shadow-raise`,children:(0,E.jsx)(w,{size:44})}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(`p`,{className:`text-xs font-medium text-content-muted`,children:c(`config:modelOnboarding.eyebrow`)}),(0,E.jsx)(y,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em]`,children:c(`config:modelOnboarding.title`)}),(0,E.jsx)(_,{id:`model-onboarding-description`,className:`leading-6`,children:c(`config:modelOnboarding.description`)})]})]}),(0,E.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3 pointer-coarse:size-11`,"aria-label":c(`common:ui.closeDialog`),title:c(`common:ui.closeDialog`),onClick:t,children:(0,E.jsx)(u,{})})]}),(0,E.jsxs)(`div`,{className:`grid gap-3 px-5 pt-2 pb-4 max-[650px]:px-4`,children:[(0,E.jsx)(`ol`,{className:`m-0 list-none divide-y divide-stroke-soft border-y border-stroke-soft p-0`,children:[{Icon:l,title:c(`config:modelOnboarding.connectionTitle`),description:c(`config:modelOnboarding.connectionDescription`)},{Icon:s,title:c(`config:modelOnboarding.modelTitle`),description:c(`config:modelOnboarding.modelDescription`)}].map(({Icon:e,title:t,description:n},r)=>(0,E.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 shrink-0 place-items-center rounded-full bg-surface-subtle text-xs font-medium text-content-secondary tabular-nums`,children:r+1}),(0,E.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,E.jsxs)(`strong`,{className:`flex items-center gap-1.5 text-sm font-medium text-content`,children:[(0,E.jsx)(e,{className:`size-3.5 text-content-muted`,"aria-hidden":`true`}),t]}),(0,E.jsx)(`p`,{className:`text-xs leading-5 text-content-muted`,children:n})]})]},t))}),(0,E.jsxs)(f,{type:`button`,variant:`secondary`,className:`w-full max-[650px]:h-11`,onClick:n,children:[(0,E.jsx)(o,{}),c(`config:modelOnboarding.findExisting`)]})]}),(0,E.jsxs)(b,{className:`m-0 rounded-none px-5 pt-3 max-[650px]:px-4`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,E.jsx)(f,{type:`button`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:t,children:c(`config:modelOnboarding.later`)}),(0,E.jsxs)(f,{type:`button`,className:`max-[650px]:h-11`,onClick:i,children:[c(`config:modelOnboarding.openSettings`),(0,E.jsx)(a,{})]})]})]})})}export{D as ConfigSearchBox,O as ModelOnboardingDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./GitDiffViewer-DWHHRnjQ.js";export{e as InlineGitDiff};
@@ -0,0 +1 @@
1
+ import"./events-CrT7ie40.js";
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{o as n}from"./vendor-state-GkUciC5H.js";import{a as r,l as i}from"./api-m-Yq8n0q.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DWW9jolt.js";import{u as s}from"./events-B0F69Vd3.js";import"./public-events-CxK6EdoY.js";var c=e(t(),1),l=Object.freeze([`experimental`,`preview`]),u=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,d=48;Object.freeze([{id:`bots`,stage:`experimental`,requires:[`bots`],feedbackUrl:`https://github.com/ling-kong-ran/pisper/issues`}]);function f(e){return typeof e==`string`&&e.length<=d&&u.test(e)}var p=`/api/settings/beta-features`,m=/^https:\/\/github\.com\/[^\s]{1,400}$/;function h(e){if(!e||typeof e!=`object`||Array.isArray(e))throw i();let t=e;if(!f(t.id)||!l.includes(t.stage)||typeof t.enabled!=`boolean`||typeof t.available!=`boolean`||t.unavailableReason!==null&&t.unavailableReason!==`runtime`)throw i();return{id:t.id,stage:t.stage,feedbackUrl:typeof t.feedbackUrl==`string`&&m.test(t.feedbackUrl)?t.feedbackUrl:``,enabled:t.enabled,available:t.available,unavailableReason:t.unavailableReason}}function g(e){if(!e||typeof e!=`object`||Array.isArray(e))throw i();let t=e.features;if(!Array.isArray(t))throw i();return t.map(h)}function _(e={}){return r(p,{signal:e.signal,parse:g})}function v(e,t){return r(p,{method:`PATCH`,data:{[e]:t},parse:g})}function y(e){return e instanceof Error&&e.message?e.message:String(e||``)}var b=null,x=n()((e,t)=>({features:[],status:`idle`,error:``,pending:{},rowErrors:{},load:()=>b||(e({status:t().status===`ready`?`ready`:`loading`,error:``}),b=_().then(n=>{let{pending:r}=t();e({features:n.map(e=>r[e.id]&&t().features.find(t=>t.id===e.id)||e),status:`ready`})}).catch(t=>{e({status:`error`,error:y(t)})}).finally(()=>{b=null}),b),setEnabled:async(n,r)=>{let i=t().features.find(e=>e.id===n);if(!i||t().pending[n]||!i.available)return;let{[n]:a,...o}=t().rowErrors;e({features:t().features.map(e=>e.id===n?{...e,enabled:r}:e),pending:{...t().pending,[n]:!0},rowErrors:o});try{let i=await v(n,r),{pending:a}=t();e({features:i.map(e=>e.id!==n&&a[e.id]&&t().features.find(t=>t.id===e.id)||e)}),s()}catch(a){e({features:t().features.map(e=>e.id===n?{...e,enabled:i.enabled}:e),rowErrors:{...t().rowErrors,[n]:{message:y(a),desired:r}}})}finally{let{[n]:r,...i}=t().pending;e({pending:i})}}}));function S(e){let t=o(e=>a(e.capabilities,`betaFeatures`)),n=x(e=>e.status),r=x(e=>e.load),i=x(t=>t.features.some(t=>t.id===e&&t.enabled&&t.available));return(0,c.useEffect)(()=>{t&&n===`idle`&&r()},[t,n,r]),t&&i}export{x as n,S as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{o as n}from"./vendor-state-GkUciC5H.js";import{a as r,l as i}from"./api-CIB7ZPX3.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DpEKnn1b.js";import{u as s}from"./events-CrT7ie40.js";import"./public-events-BiaqrDkZ.js";var c=e(t(),1),l=Object.freeze([`experimental`,`preview`]),u=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,d=48;Object.freeze([{id:`bots`,stage:`experimental`,requires:[`bots`],feedbackUrl:`https://github.com/ling-kong-ran/pisper/issues`}]);function f(e){return typeof e==`string`&&e.length<=d&&u.test(e)}var p=`/api/settings/beta-features`,m=/^https:\/\/github\.com\/[^\s]{1,400}$/;function h(e){if(!e||typeof e!=`object`||Array.isArray(e))throw i();let t=e;if(!f(t.id)||!l.includes(t.stage)||typeof t.enabled!=`boolean`||typeof t.available!=`boolean`||t.unavailableReason!==null&&t.unavailableReason!==`runtime`)throw i();return{id:t.id,stage:t.stage,feedbackUrl:typeof t.feedbackUrl==`string`&&m.test(t.feedbackUrl)?t.feedbackUrl:``,enabled:t.enabled,available:t.available,unavailableReason:t.unavailableReason}}function g(e){if(!e||typeof e!=`object`||Array.isArray(e))throw i();let t=e.features;if(!Array.isArray(t))throw i();return t.map(h)}function _(e={}){return r(p,{signal:e.signal,parse:g})}function v(e,t){return r(p,{method:`PATCH`,data:{[e]:t},parse:g})}function y(e){return e instanceof Error&&e.message?e.message:String(e||``)}var b=null,x=n()((e,t)=>({features:[],status:`idle`,error:``,pending:{},rowErrors:{},load:()=>b||(e({status:t().status===`ready`?`ready`:`loading`,error:``}),b=_().then(n=>{let{pending:r}=t();e({features:n.map(e=>r[e.id]&&t().features.find(t=>t.id===e.id)||e),status:`ready`})}).catch(t=>{e({status:`error`,error:y(t)})}).finally(()=>{b=null}),b),setEnabled:async(n,r)=>{let i=t().features.find(e=>e.id===n);if(!i||t().pending[n]||!i.available)return;let{[n]:a,...o}=t().rowErrors;e({features:t().features.map(e=>e.id===n?{...e,enabled:r}:e),pending:{...t().pending,[n]:!0},rowErrors:o});try{let i=await v(n,r),{pending:a}=t();e({features:i.map(e=>e.id!==n&&a[e.id]&&t().features.find(t=>t.id===e.id)||e)}),s()}catch(a){e({features:t().features.map(e=>e.id===n?{...e,enabled:i.enabled}:e),rowErrors:{...t().rowErrors,[n]:{message:y(a),desired:r}}})}finally{let{[n]:r,...i}=t().pending;e({pending:i})}}}));function S(e){let t=o(e=>a(e.capabilities,`betaFeatures`)),n=x(e=>e.status),r=x(e=>e.load),i=x(t=>t.features.some(t=>t.id===e&&t.enabled&&t.available));return(0,c.useEffect)(()=>{t&&n===`idle`&&r()},[t,n,r]),t&&i}export{x as n,S as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-Cyg5th6Z.js";import{t as a}from"./settings-2-CXJjXJS9.js";import{t as o}from"./button-CCcCN8tE.js";import{t as s}from"./BotAvatar-CNL-APwP.js";import{D as c,n as l,t as u}from"./bots-store-BMcWJ2Gm.js";import{t as d}from"./public-flags-BRenaSzJ.js";var f=e(n(),1),p=r();function m({botId:e,part:n,animate:r=!0,fallback:m=null}){let{t:h}=i(),g=d(`bots`),_=t(),v=l(t=>t.bots.find(t=>t.id===e));u(g&&n===`avatar`);let y=l(e=>e.loaded),b=l(e=>e.load);if((0,f.useEffect)(()=>{g&&!y&&n!==`avatar`&&b()},[g,b,y,n]),!g||!v)return m;if(n===`mark`)return(0,p.jsx)(s,{avatar:v.avatar,state:r?c(v):`idle`,animate:r,size:22});if(n===`name`)return v.name;if(n===`avatar`)return(0,p.jsx)(`span`,{"data-session-bot":v.id,className:`flex flex-none items-center pl-1`,children:(0,p.jsx)(s,{avatar:v.avatar,state:c(v),size:22})});let x=h(`bots:settingsPage.title`,{name:v.name});return(0,p.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none text-content-muted hover:text-content pointer-coarse:size-11`,"data-session-bot-settings":v.id,"aria-label":x,title:x,onClick:()=>_(`/bots/${encodeURIComponent(v.id)}`),children:(0,p.jsx)(a,{"aria-hidden":`true`})})}export{m as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-B2p84ZNR.js";import{t as a}from"./settings-2-CXJjXJS9.js";import{t as o}from"./button-CCcCN8tE.js";import{t as s}from"./BotAvatar-CNL-APwP.js";import{D as c,n as l,t as u}from"./bots-store-BG81qEJz.js";import{t as d}from"./public-flags-DEs9Uj_y.js";var f=e(n(),1),p=r();function m({botId:e,part:n,animate:r=!0,fallback:m=null}){let{t:h}=i(),g=d(`bots`),_=t(),v=l(t=>t.bots.find(t=>t.id===e));u(g&&n===`avatar`);let y=l(e=>e.loaded),b=l(e=>e.load);if((0,f.useEffect)(()=>{g&&!y&&n!==`avatar`&&b()},[g,b,y,n]),!g||!v)return m;if(n===`mark`)return(0,p.jsx)(s,{avatar:v.avatar,state:r?c(v):`idle`,animate:r,size:22});if(n===`name`)return v.name;if(n===`avatar`)return(0,p.jsx)(`span`,{"data-session-bot":v.id,className:`flex flex-none items-center pl-1`,children:(0,p.jsx)(s,{avatar:v.avatar,state:c(v),size:22})});let x=h(`bots:settingsPage.title`,{name:v.name});return(0,p.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none text-content-muted hover:text-content pointer-coarse:size-11`,"data-session-bot-settings":v.id,"aria-label":x,title:x,onClick:()=>_(`/bots/${encodeURIComponent(v.id)}`),children:(0,p.jsx)(a,{"aria-hidden":`true`})})}export{m as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{d as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-Cyg5th6Z.js";import{t as s}from"./plus-fQbSqB1n.js";import{n as c,t as l}from"./use-open-bot-HoswiH7t.js";import{t as u}from"./utils-C8uzG5AZ.js";import{t as d}from"./BotAvatar-CNL-APwP.js";import{D as f,E as p,k as m,n as h,t as g}from"./bots-store-BMcWJ2Gm.js";import{t as _}from"./public-flags-BRenaSzJ.js";var v=e(r(),1),y=i();function b(){let{t:e}=o(),r=_(`bots`),i=h(e=>e.bots),b=n(),x=t(),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),E=l((0,v.useCallback)((e,t)=>b(`/bots/${encodeURIComponent(t)}`),[b]));if(g(r),!r)return null;let D=a(x.pathname),O=/^\/bots\/([^/]+)/.exec(x.pathname)?.[1]??i.find(e=>D&&e.threadSessionId===D)?.id,{shown:k,hidden:A}=m(i,{expanded:w,currentId:O});return(0,y.jsxs)(`section`,{"data-sidebar-bots":!0,"aria-label":e(`bots:sidebar.title`),className:`mb-2`,children:[(0,y.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1.5 px-2.5 text-xs font-medium text-content-muted`,children:[(0,y.jsx)(`h2`,{className:`flex-1`,children:e(`bots:sidebar.title`)}),(0,y.jsx)(`button`,{type:`button`,className:`grid size-6 place-items-center rounded-md hover:bg-surface-hover hover:text-content`,"aria-label":e(`bots:sidebar.newBot`),title:e(`bots:sidebar.newBot`),onClick:()=>C(!0),children:(0,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`})})]}),(0,y.jsx)(`ul`,{role:`list`,className:`m-0 list-none p-0`,children:k.map(t=>{let n=t.activity,r=p(e,t);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"data-sidebar-bot":t.id,"aria-current":O===t.id?`page`:void 0,title:r,className:u(`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left hover:bg-surface-hover pointer-coarse:h-11`,O===t.id&&`bg-surface-active hover:bg-surface-active`),onClick:()=>void E(t),children:[(0,y.jsx)(d,{avatar:t.avatar,state:f(t),size:20}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13.5px] text-content`,children:[t.name,(0,y.jsx)(`span`,{className:`sr-only`,children:` · ${r}`})]}),n?.working?(0,y.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-bot-working":n.working,className:`flex-none text-[11.5px] text-content-muted tabular-nums`,children:n.working}):null,n?.needsYou&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 flex-none rounded-full bg-st-attn`})]})},t.id)})}),(A>0||w&&i.length>3)&&(0,y.jsx)(`button`,{type:`button`,"data-sidebar-bots-more":!0,"aria-expanded":w,className:`flex h-7 w-full items-center rounded-[var(--r-md)] px-2.5 pl-9 text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>T(!w),children:w?e(`bots:sidebar.showLess`):e(`bots:sidebar.showAll`,{count:i.length})}),(0,y.jsx)(c,{open:S,onOpenChange:C,onCreated:e=>void E(e)})]})}export{b as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{d as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-B2p84ZNR.js";import{t as s}from"./plus-fQbSqB1n.js";import{n as c,t as l}from"./use-open-bot-CgFlDm0x.js";import{t as u}from"./utils-C8uzG5AZ.js";import{t as d}from"./BotAvatar-CNL-APwP.js";import{D as f,E as p,k as m,n as h,t as g}from"./bots-store-BG81qEJz.js";import{t as _}from"./public-flags-DEs9Uj_y.js";var v=e(r(),1),y=i();function b(){let{t:e}=o(),r=_(`bots`),i=h(e=>e.bots),b=n(),x=t(),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),E=l((0,v.useCallback)((e,t)=>b(`/bots/${encodeURIComponent(t)}`),[b]));if(g(r),!r)return null;let D=a(x.pathname),O=/^\/bots\/([^/]+)/.exec(x.pathname)?.[1]??i.find(e=>D&&e.threadSessionId===D)?.id,{shown:k,hidden:A}=m(i,{expanded:w,currentId:O});return(0,y.jsxs)(`section`,{"data-sidebar-bots":!0,"aria-label":e(`bots:sidebar.title`),className:`mb-2`,children:[(0,y.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1.5 px-2.5 text-xs font-medium text-content-muted`,children:[(0,y.jsx)(`h2`,{className:`flex-1`,children:e(`bots:sidebar.title`)}),(0,y.jsx)(`button`,{type:`button`,className:`grid size-6 place-items-center rounded-md hover:bg-surface-hover hover:text-content`,"aria-label":e(`bots:sidebar.newBot`),title:e(`bots:sidebar.newBot`),onClick:()=>C(!0),children:(0,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`})})]}),(0,y.jsx)(`ul`,{role:`list`,className:`m-0 list-none p-0`,children:k.map(t=>{let n=t.activity,r=p(e,t);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"data-sidebar-bot":t.id,"aria-current":O===t.id?`page`:void 0,title:r,className:u(`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left hover:bg-surface-hover pointer-coarse:h-11`,O===t.id&&`bg-surface-active hover:bg-surface-active`),onClick:()=>void E(t),children:[(0,y.jsx)(d,{avatar:t.avatar,state:f(t),size:20}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13.5px] text-content`,children:[t.name,(0,y.jsx)(`span`,{className:`sr-only`,children:` · ${r}`})]}),n?.working?(0,y.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-bot-working":n.working,className:`flex-none text-[11.5px] text-content-muted tabular-nums`,children:n.working}):null,n?.needsYou&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 flex-none rounded-full bg-st-attn`})]})},t.id)})}),(A>0||w&&i.length>3)&&(0,y.jsx)(`button`,{type:`button`,"data-sidebar-bots-more":!0,"aria-expanded":w,className:`flex h-7 w-full items-center rounded-[var(--r-md)] px-2.5 pl-9 text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>T(!w),children:w?e(`bots:sidebar.showLess`):e(`bots:sidebar.showAll`,{count:i.length})}),(0,y.jsx)(c,{open:S,onOpenChange:C,onCreated:e=>void E(e)})]})}export{b as default};
@@ -1 +1 @@
1
- import{o as e}from"./vendor-state-GkUciC5H.js";import{t}from"./api-m-Yq8n0q.js";import{t as n}from"./runtime-capabilities-CHYOF_hE.js";function r(e){let t={...n.features};for(let n of Object.keys(t)){let r=e.features?.[n];typeof r==`boolean`&&(t[n]=r)}let r=[`desktop`,`mobile-embedded`,`mobile-store`].includes(String(e.profile))?e.profile:`desktop`;return{version:Number(e.version)||0,profile:r,engine:`node`,degraded:e.degraded===!0,modules:{childProcess:e.modules?.childProcess!==!1,workerThreads:e.modules?.workerThreads!==!1,sqlite:e.modules?.sqlite!==!1,wasm:e.modules?.wasm!==!1},features:t,tools:Array.isArray(e.tools)?e.tools.filter(e=>typeof e==`string`):[]}}var i=null,a=e()((e,a)=>({capabilities:n,loaded:!1,load:({refresh:o=!0}={})=>i||(!o&&a().loaded?Promise.resolve():(i=(async()=>{try{e({capabilities:r(await t(`/api/runtime/capabilities`)),loaded:!0})}catch{e({capabilities:n,loaded:!0})}})().finally(()=>{i=null}),i))}));export{a as t};
1
+ import{o as e}from"./vendor-state-GkUciC5H.js";import{t}from"./api-CIB7ZPX3.js";import{t as n}from"./runtime-capabilities-CHYOF_hE.js";function r(e){let t={...n.features};for(let n of Object.keys(t)){let r=e.features?.[n];typeof r==`boolean`&&(t[n]=r)}let r=[`desktop`,`mobile-embedded`,`mobile-store`].includes(String(e.profile))?e.profile:`desktop`;return{version:Number(e.version)||0,profile:r,engine:`node`,degraded:e.degraded===!0,modules:{childProcess:e.modules?.childProcess!==!1,workerThreads:e.modules?.workerThreads!==!1,sqlite:e.modules?.sqlite!==!1,wasm:e.modules?.wasm!==!1},features:t,tools:Array.isArray(e.tools)?e.tools.filter(e=>typeof e==`string`):[]}}var i=null,a=e()((e,a)=>({capabilities:n,loaded:!1,load:({refresh:o=!0}={})=>i||(!o&&a().loaded?Promise.resolve():(i=(async()=>{try{e({capabilities:r(await t(`/api/runtime/capabilities`)),loaded:!0})}catch{e({capabilities:n,loaded:!0})}})().finally(()=>{i=null}),i))}));export{a as t};
@@ -1 +1 @@
1
- import{t as e}from"./index-DmohsuQg.js";import{t}from"./safe-mode-sentinel-CIemi_6b.js";var n=`safe-mode`,r=`components`,i=3e3,a=64,o=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,95}$/;function s(e){if(!e||e.length>16384)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.loading;if(!n||typeof n!=`object`||Array.isArray(n))return null;let{at:r,instanceIds:i}=n;return typeof r!=`string`||!Number.isFinite(Date.parse(r))||!Array.isArray(i)?null:{loading:{at:r,instanceIds:i.filter(e=>typeof e==`string`&&o.test(e)).slice(0,a)}}}function c(e){try{return new URLSearchParams(e).get(n)===r}catch{return!1}}function l(e){return typeof window>`u`?()=>{}:(window.addEventListener(`beforeunload`,e),window.addEventListener(`pagehide`,e,{capture:!0}),()=>{window.removeEventListener(`beforeunload`,e),window.removeEventListener(`pagehide`,e,{capture:!0})})}function u({storage:e,search:n,now:r=()=>Date.now(),schedule:o=(e,t)=>setTimeout(e,t),cancel:u=e=>clearTimeout(e),listenUnload:d=l}){let f=new Set,p=()=>{try{return s(e.getItem(t))}catch{return null}},m=n=>{try{n?e.setItem(t,JSON.stringify(n)):e.removeItem(t)}catch{}},h=c(n)?null:p(),g=c(n)?`safe`:h?`pending`:`normal`,_=h,v=`idle`,y=new Set,b=[],x=null,S=null,C=()=>{S?.(),S=null},w=()=>{for(let e of[...f])e()};return{mode:()=>g,staleSentinel:()=>_,beginLoad(e){g===`normal`&&v!==`done`&&(x!==null&&(u(x),x=null),v=`loading`,S??=d(()=>{v===`loading`&&m(null)}),y.add(e),!b.includes(e)&&b.length<a&&b.push(e),m({loading:{at:new Date(r()).toISOString(),instanceIds:[...b]}}))},endLoad(e){v!==`loading`||!y.delete(e)||y.size||(x=o(()=>{x=null,!y.size&&(v=`done`,C(),m(null))},i))},resolve(e){g===`pending`&&(_=null,m(null),g=e===`safe`?`safe`:`normal`,w())},subscribe(e){return f.add(e),()=>{f.delete(e)}},dispose(){x!==null&&u(x),x=null,C(),f.clear()}}}var d=null;function f(){return d??=u({storage:e,search:typeof window>`u`?``:window.location.search}),d}export{f as t};
1
+ import{t as e}from"./index-DcTDwezs.js";import{t}from"./safe-mode-sentinel-Bm4e075H.js";var n=`safe-mode`,r=`components`,i=3e3,a=64,o=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,95}$/;function s(e){if(!e||e.length>16384)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.loading;if(!n||typeof n!=`object`||Array.isArray(n))return null;let{at:r,instanceIds:i}=n;return typeof r!=`string`||!Number.isFinite(Date.parse(r))||!Array.isArray(i)?null:{loading:{at:r,instanceIds:i.filter(e=>typeof e==`string`&&o.test(e)).slice(0,a)}}}function c(e){try{return new URLSearchParams(e).get(n)===r}catch{return!1}}function l(e){return typeof window>`u`?()=>{}:(window.addEventListener(`beforeunload`,e),window.addEventListener(`pagehide`,e,{capture:!0}),()=>{window.removeEventListener(`beforeunload`,e),window.removeEventListener(`pagehide`,e,{capture:!0})})}function u({storage:e,search:n,now:r=()=>Date.now(),schedule:o=(e,t)=>setTimeout(e,t),cancel:u=e=>clearTimeout(e),listenUnload:d=l}){let f=new Set,p=()=>{try{return s(e.getItem(t))}catch{return null}},m=n=>{try{n?e.setItem(t,JSON.stringify(n)):e.removeItem(t)}catch{}},h=c(n)?null:p(),g=c(n)?`safe`:h?`pending`:`normal`,_=h,v=`idle`,y=new Set,b=[],x=null,S=null,C=()=>{S?.(),S=null},w=()=>{for(let e of[...f])e()};return{mode:()=>g,staleSentinel:()=>_,beginLoad(e){g===`normal`&&v!==`done`&&(x!==null&&(u(x),x=null),v=`loading`,S??=d(()=>{v===`loading`&&m(null)}),y.add(e),!b.includes(e)&&b.length<a&&b.push(e),m({loading:{at:new Date(r()).toISOString(),instanceIds:[...b]}}))},endLoad(e){v!==`loading`||!y.delete(e)||y.size||(x=o(()=>{x=null,!y.size&&(v=`done`,C(),m(null))},i))},resolve(e){g===`pending`&&(_=null,m(null),g=e===`safe`?`safe`:`normal`,w())},subscribe(e){return f.add(e),()=>{f.delete(e)}},dispose(){x!==null&&u(x),x=null,C(),f.clear()}}}var d=null;function f(){return d??=u({storage:e,search:typeof window>`u`?``:window.location.search}),d}export{f as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./index-DcTDwezs.js";var t=`pisper-components-safe-mode`;function n(){try{return e.getItem(t)!==null}catch{return!1}}export{n,t};
@@ -1 +1 @@
1
- import{a as e}from"./startup-queries-Cevfi-_Z.js";import{t}from"./api-m-Yq8n0q.js";function n(e){if(!e||typeof e!=`object`)throw Error(`Invalid change summary`);let t=e;if(t.status!==`known`&&t.status!==`partial`&&t.status!==`unavailable`||!Number.isInteger(t.unknownFiles)||Number(t.unknownFiles)<0||typeof t.capped!=`boolean`||![`changedFiles`,`pendingFiles`,`added`,`removed`].every(e=>t.status===`known`?Number.isInteger(t[e])&&Number(t[e])>=0:t[e]===null))throw Error(`Invalid change summary`);return t}async function r(e){return n(await t(`/api/sessions/${encodeURIComponent(e)}/change-summary`))}function i(t){return e.invalidateQueries({queryKey:[`session-change-summary`,t]})}export{i as n,r as t};
1
+ import{a as e}from"./startup-queries-CceboYee.js";import{t}from"./api-CIB7ZPX3.js";function n(e){if(!e||typeof e!=`object`)throw Error(`Invalid change summary`);let t=e;if(t.status!==`known`&&t.status!==`partial`&&t.status!==`unavailable`||!Number.isInteger(t.unknownFiles)||Number(t.unknownFiles)<0||typeof t.capped!=`boolean`||![`changedFiles`,`pendingFiles`,`added`,`removed`].every(e=>t.status===`known`?Number.isInteger(t[e])&&Number(t[e])>=0:t[e]===null))throw Error(`Invalid change summary`);return t}async function r(e){return n(await t(`/api/sessions/${encodeURIComponent(e)}/change-summary`))}function i(t){return e.invalidateQueries({queryKey:[`session-change-summary`,t]})}export{i as n,r as t};
@@ -1 +1 @@
1
- import{t as e}from"./index-DmohsuQg.js";var t=`pisper-last-session`;function n(e){if(typeof e!=`string`)return``;let t=e.trim();return!t||t.length>256||t===`new`||/[\u0000-\u001f\u007f]/.test(t)?``:t}function r(){try{return n(e.getItem(t))}catch{return``}}function i(r){let i=n(r);if(i)try{e.getItem(`pisper-last-session`)!==i&&e.setItem(t,i)}catch{}}function a(n){try{e.getItem(`pisper-last-session`)===n&&e.removeItem(t)}catch{}}function o(e){if(!e||typeof e!=`object`)return null;let t=e.sessions;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let{id:t,archived:n}=e;return typeof t==`string`&&t?[{id:t,archived:n===!0}]:[]}):null}function s({lastId:e,data:t,failed:n}){if(!e)return{kind:`draft`};let r=o(t);if(!r)return n?{kind:`error`}:{kind:`loading`};let i=r.find(t=>t.id===e);return i&&!i.archived?{kind:`session`,id:i.id}:{kind:`draft`}}export{i,s as n,r,a as t};
1
+ import{t as e}from"./index-DcTDwezs.js";var t=`pisper-last-session`;function n(e){if(typeof e!=`string`)return``;let t=e.trim();return!t||t.length>256||t===`new`||/[\u0000-\u001f\u007f]/.test(t)?``:t}function r(){try{return n(e.getItem(t))}catch{return``}}function i(r){let i=n(r);if(i)try{e.getItem(`pisper-last-session`)!==i&&e.setItem(t,i)}catch{}}function a(n){try{e.getItem(`pisper-last-session`)===n&&e.removeItem(t)}catch{}}function o(e){if(!e||typeof e!=`object`)return null;let t=e.sessions;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let{id:t,archived:n}=e;return typeof t==`string`&&t?[{id:t,archived:n===!0}]:[]}):null}function s({lastId:e,data:t,failed:n}){if(!e)return{kind:`draft`};let r=o(t);if(!r)return n?{kind:`error`}:{kind:`loading`};let i=r.find(t=>t.id===e);return i&&!i.archived?{kind:`session`,id:i.id}:{kind:`draft`}}export{i,s as n,r,a as t};
@@ -1 +1 @@
1
- import{t as e}from"./api-m-Yq8n0q.js";import{u as t}from"./events-B0F69Vd3.js";var n=class extends Error{code=`invalid_session_organization_response`};function r(e){if(!e||typeof e!=`object`)throw new n;let{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}=e;if(typeof t!=`string`||!t||typeof r!=`boolean`||typeof i!=`boolean`||typeof a!=`boolean`||typeof o!=`boolean`||s!==null&&s!==`approval`&&s!==`failure`)throw new n;return{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}}async function i(i,a){if(!i||!Object.keys(a).length)throw new n;let o=r(await e(`/api/sessions/${encodeURIComponent(i)}/organization`,{method:`PATCH`,body:JSON.stringify(a)}));if(o.id!==i)throw new n;return t(o),o}export{i as n,n as t};
1
+ import{t as e}from"./api-CIB7ZPX3.js";import{u as t}from"./events-CrT7ie40.js";var n=class extends Error{code=`invalid_session_organization_response`};function r(e){if(!e||typeof e!=`object`)throw new n;let{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}=e;if(typeof t!=`string`||!t||typeof r!=`boolean`||typeof i!=`boolean`||typeof a!=`boolean`||typeof o!=`boolean`||s!==null&&s!==`approval`&&s!==`failure`)throw new n;return{id:t,pinned:r,archived:i,unread:a,needsAttention:o,attentionReason:s}}async function i(i,a){if(!i||!Object.keys(a).length)throw new n;let o=r(await e(`/api/sessions/${encodeURIComponent(i)}/organization`,{method:`PATCH`,body:JSON.stringify(a)}));if(o.id!==i)throw new n;return t(o),o}export{i as n,n as t};
@@ -1 +1 @@
1
- import{a as e,o as t,u as n}from"./api-m-Yq8n0q.js";import{o as r}from"./session-board-status-D2lpFPiI.js";var i={all:[`custom-ui`],catalog:()=>[`custom-ui`,`catalog`],instances:()=>[`custom-ui`,`instances`],describe:e=>[`custom-ui`,`describe`,e],errors:e=>[`custom-ui`,`errors`,e],versions:e=>[`custom-ui`,`versions`,e],usage:e=>[`custom-ui`,`usage`,e],trash:()=>[`custom-ui`,`trash`],staged:e=>[`custom-ui`,`staged`,e]};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var o=[`overview-card`,`session-panel`,`feature-page`,`floating`],s=[`S`,`M`],c=/^[a-z0-9][a-z0-9._-]{0,63}$/,l=/^[a-f0-9]{24}$/,u=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,79}$/,d=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/,f=/^[a-f0-9]{16}$/,p=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`];function m(e,t=4e3){return typeof e==`string`?e.slice(0,t):``}function h(e){if(typeof e!=`string`||!e||e.length>512)return!1;let t=e.split(`/`);return t.length<=3&&t.every(e=>d.test(e))}function g(e,t=200){let n={};if(!a(e))return n;for(let[r,i]of Object.entries(e).slice(0,t))typeof i==`string`&&(n[r]=i);return n}function _(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,200)){if(!a(n)||typeof n.code!=`string`||!n.code)continue;let e={path:m(n.path,512),code:m(n.code,128)};if(a(n.params)){let t={};for(let[e,r]of Object.entries(n.params))(typeof r==`string`||typeof r==`number`&&Number.isFinite(r))&&(t[e]=r);e.params=t}t.push(e)}return t}function v(e){let t={};if(!a(e))return t;for(let n of[`zh-CN`,`en-US`]){let r=e[n];a(r)&&(t[n]={...typeof r.name==`string`?{name:r.name}:{},...typeof r.description==`string`?{description:r.description}:{},strings:g(r.strings,500)})}return t}function y(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!a(n)||!o.includes(n.surface))continue;let e=n.surface;if(t.some(t=>t.surface===e))continue;let r={surface:e};if(Array.isArray(n.sizes)){let e=s.filter(e=>n.sizes.includes(e));e.length&&(r.sizes=e)}a(n.size)&&typeof n.size.w==`number`&&typeof n.size.h==`number`&&Number.isFinite(n.size.w)&&Number.isFinite(n.size.h)&&n.size.w>0&&n.size.h>0&&(r.size={w:n.size.w,h:n.size.h}),t.push(r)}return t}function b(e){let t={};if(!a(e))return t;let n=e=>m(e.reason,500);for(let r of[`notify`,`sessions.read`,`sessions.open`]){let i=e[r];a(i)&&(t[r]={reason:n(i)})}let r=e[`provider.request`];a(r)&&Array.isArray(r.paths)&&Array.isArray(r.methods)&&(t[`provider.request`]={reason:n(r),paths:r.paths.filter(e=>typeof e==`string`),methods:r.methods.filter(e=>typeof e==`string`)});let i=e.network;a(i)&&Array.isArray(i.hosts)&&(t.network={reason:n(i),hosts:i.hosts.filter(e=>typeof e==`string`).slice(0,32),...Array.isArray(i.privateOrigins)&&{privateOrigins:i.privateOrigins.filter(e=>typeof e==`string`).slice(0,32)}});let o=e.storage;return a(o)&&(t.storage={reason:n(o),quotaKb:typeof o.quotaKb==`number`&&Number.isFinite(o.quotaKb)?o.quotaKb:256}),t}function x(e,t){if(!a(t)||t.runtime!==`native`||t.id!==e||!h(t.entry))return null;let n=a(t.props)?t.props:null;if(!n||n.type!==`object`||!a(n.properties))return null;let r=Array.isArray(t.styles)?t.styles:[];return r.every(h)?{runtime:`native`,id:e,name:m(t.name,120)||e,version:m(t.version,64),description:m(t.description,500),entry:t.entry,styles:r.slice(0,8),icon:m(t.icon,48),i18n:v(t.i18n),props:{type:`object`,properties:n.properties,required:Array.isArray(n.required)?n.required.filter(e=>typeof e==`string`):[]},placements:y(t.placements),capabilities:b(t.capabilities),sdk:typeof t.sdk==`number`?t.sdk:1,minHostVersion:m(t.minHostVersion,64)}:null}function S(e){return e===`agent`||e===`template`||e===`import`?e:`local`}function C(e){return Array.isArray(e)?p.filter(t=>e.includes(t)):[]}function w(e){return!a(e)||typeof e.stageId!=`string`||!f.test(e.stageId)||typeof e.id!=`string`||!c.test(e.id)?null:{stageId:e.stageId,id:e.id,name:m(e.name,120)||e.id,version:m(e.version,64),fileName:m(e.fileName,200)||`${e.id}.zip`,bytes:typeof e.bytes==`number`&&Number.isFinite(e.bytes)?e.bytes:0,sha256:/^[a-f0-9]{64}$/.test(String(e.sha256))?String(e.sha256):``,createdAt:m(e.createdAt,64),replaces:e.replaces===`native`||e.replaces===`legacy`||e.replaces===`broken`?e.replaces:null}}function T(e){if(!a(e)||typeof e.id!=`string`||!c.test(e.id))return null;let t=e.id,n={id:t,name:m(e.name,120)||t,version:m(e.version,64),description:m(e.description,500),directory:m(e.directory,4096),updatedAt:m(e.updatedAt,64),revoked:C(e.revoked)};if(e.kind!==`native`&&e.kind!==`broken`)return{...n,kind:`legacy`,status:`unsupported`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};if(e.kind===`broken`)return{...n,kind:`broken`,status:`invalid`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};let r=_(e.errors),i={...n,kind:`native`,status:e.status===`ready`?`ready`:`invalid`,enabled:e.enabled===!0,source:S(e.source),entry:m(e.entry,512),errors:r};if(e.manifest!==void 0){let n=x(t,e.manifest);n&&(i.manifest=n)}return i.status===`ready`&&(typeof e.rev==`string`&&l.test(e.rev)&&i.manifest?i.rev=e.rev:(i.status=`invalid`,i.errors=[...r,{path:``,code:`component_response_invalid`}])),i}function E(e){if(!a(e)||typeof e.root!=`string`||!Array.isArray(e.components))throw Error(`Invalid custom UI component response`);let t=a(e.features)?e.features:null,n=[],r=new Set;for(let t of e.components){let e=T(t);!e||r.has(e.id)||(r.add(e.id),n.push(e))}let i=[];for(let t of Array.isArray(e.staged)?e.staged.slice(0,50):[]){let e=w(t);e&&!i.some(t=>t.stageId===e.stageId)&&i.push(e)}return{root:e.root,features:{import:t?.import===!0,versions:t?.versions===!0,export:t?.export===!0,trash:t?.trash===`move`?`move`:`none`,trashRestore:t?.trashRestore===!0,usage:t?.usage===!0,revoke:t?.revoke===!0},components:n,staged:i,legacyShape:!t}}function D(e){return a(e)?e.type===`all`?{type:`all`}:e.type===`project`&&typeof e.cwd==`string`&&e.cwd?{type:`project`,cwd:e.cwd}:null:null}function O(e){if(!a(e)||typeof e.instanceId!=`string`||!u.test(e.instanceId)||typeof e.componentId!=`string`||!c.test(e.componentId)||!o.includes(e.surface))return null;let t=e.surface;return{instanceId:e.instanceId,componentId:e.componentId,surface:t,size:t===`overview-card`?s.includes(e.size)?e.size:`S`:null,scope:t===`session-panel`?D(e.scope)??{type:`all`}:null,title:m(e.title,80),props:a(e.props)?e.props:{},enabled:e.enabled!==!1,order:typeof e.order==`number`&&Number.isFinite(e.order)?e.order:0,createdAt:m(e.createdAt,64),updatedAt:m(e.updatedAt,64)}}function k(e){if(!a(e)||typeof e.revision!=`number`||!Number.isSafeInteger(e.revision)||!Array.isArray(e.instances))throw Error(`Invalid custom UI instances response`);let t=[],n=new Set;for(let r of e.instances){let e=O(r);!e||n.has(e.instanceId)||(n.add(e.instanceId),t.push(e))}return t.sort((e,t)=>e.order-t.order),{revision:e.revision,instances:t}}function A(e){let t=a(e)?O(e.instance):null;if(!t||!a(e)||typeof e.revision!=`number`)throw Error(`Invalid custom UI instance response`);return{revision:e.revision,instance:t}}function j(e){if(!a(e)||!Array.isArray(e.entries))throw Error(`Invalid custom UI errors response`);let t=[];for(let n of e.entries.slice(-200))!a(n)||typeof n.message!=`string`||t.push({at:m(n.at,64),kind:m(n.kind,32),level:m(n.level,16),message:m(n.message,500),...typeof n.stack==`string`?{stack:m(n.stack,4e3)}:{},...typeof n.instanceId==`string`?{instanceId:m(n.instanceId,80)}:{},...typeof n.surface==`string`?{surface:m(n.surface,32)}:{}});let n=a(e.network)?e.network:{},r={};if(a(n.hosts))for(let[e,t]of Object.entries(n.hosts).slice(0,64))typeof t==`number`&&Number.isFinite(t)&&(r[e]=t);return{entries:t,dropped:typeof e.dropped==`number`&&Number.isFinite(e.dropped)?e.dropped:0,network:{count:typeof n.count==`number`&&Number.isFinite(n.count)?n.count:0,lastAt:typeof n.lastAt==`string`?n.lastAt:null,hosts:r}}}function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function N(e){if(!a(e)||e.status!==`ok`)return{status:`unsupported`};let t=a(e.summary)?e.summary:{},n=[`danger`,`warn`,`info`];return{status:`ok`,hosts:(Array.isArray(e.hosts)?e.hosts.slice(0,50):[]).flatMap(e=>a(e)&&typeof e.host==`string`?[{host:m(e.host,253),declared:e.declared===!0,file:m(e.file,512),line:M(e.line)}]:[]),findings:(Array.isArray(e.findings)?e.findings.slice(0,200):[]).flatMap(e=>a(e)&&typeof e.rule==`string`&&n.includes(e.severity)?[{rule:m(e.rule,32),severity:e.severity,file:m(e.file,512),line:M(e.line),excerpt:m(e.excerpt,200)}]:[]),summary:{danger:M(t.danger),warn:M(t.warn),info:M(t.info),undeclaredHosts:M(t.undeclaredHosts)},truncated:e.truncated===!0}}function P(e){return Array.isArray(e)?e.filter(e=>a(e)&&typeof e.path==`string`&&typeof e.size==`number`&&typeof e.type==`string`).slice(0,256).map(e=>({path:e.path,size:e.size,type:e.type})):[]}function F(e){let t=a(e)?T(e.component):null;if(!t||!a(e)||!Array.isArray(e.files))throw Error(`Invalid custom UI describe response`);return{component:t,files:P(e.files),errors:_(e.errors),scan:N(e.scan)}}function I(e){if(!a(e)||typeof e.status!=`number`||typeof e.body!=`string`||e.bodyEncoding!==`utf8`&&e.bodyEncoding!==`base64`)throw Error(`Invalid custom UI fetch response`);return{status:e.status,statusText:m(e.statusText,200),headers:g(e.headers,64),body:e.body,bodyEncoding:e.bodyEncoding,url:m(e.url,2048),redirected:e.redirected===!0}}function L(e){if(!(e instanceof n)||!e.data)return null;let t=e.data.code??e.data.error;return typeof t==`string`&&/^[a-z0-9_]{1,64}$/.test(t)?t:null}function R(e){return!(e instanceof n)||!e.data?[]:_(e.data.errors)}var z=e=>`/api/custom-ui/components/${encodeURIComponent(e)}`;function B(e,t,n){if(!c.test(e)||!l.test(t)||!h(n))throw Error(`Invalid component module path`);return`${z(e)}/r/${t}/${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e,n,r,i){return t(B(e,n,r),{signal:i})}function H(t){return e(`/api/custom-ui/components`,{signal:t,parse:E})}function U(t,n){return e(`${z(t)}/describe`,{signal:n,parse:F})}function ee(t){return e(`/api/custom-ui/components`,{method:`POST`,body:t,parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function W(t,n){return e(z(t),{method:`PATCH`,body:{enabled:n},parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function G(t){return e(z(t),{method:`DELETE`,parse:e=>({trashedAs:a(e)?m(e.trashedAs,256):``})})}function K(t){return e(`/api/custom-ui/instances`,{signal:t,parse:k})}function q(t){return e(`/api/custom-ui/instances`,{method:`POST`,body:t,parse:A})}function J(t,n){return e(`/api/custom-ui/instances/${encodeURIComponent(t)}`,{method:`PATCH`,body:n,parse:A})}function Y(t){return e(`/api/custom-ui/instances/${encodeURIComponent(t)}`,{method:`DELETE`,parse:e=>({revision:a(e)&&typeof e.revision==`number`?e.revision:0})})}function X(t,n){return e(`${z(t)}/errors`,{signal:n,parse:j})}function Z(t,n){return e(`${z(t)}/errors`,{method:`POST`,body:n,keepalive:!0,parse:()=>void 0})}function Q(t,n){return e(`${z(t)}/usage`,{method:`POST`,body:{entries:n},keepalive:!0,parse:()=>void 0})}function $(t,n,r){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{signal:r,parse:e=>{if(!a(e)||!Object.hasOwn(e,`value`))throw Error(`Invalid custom UI storage response`);return{value:e.value}}})}function te(t,n,r){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{method:`PUT`,body:{value:r},parse:()=>void 0})}function ne(t,n){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{method:`DELETE`,parse:()=>void 0})}async function re(t,n,r,i){return await e(`/api/custom-ui/provider-session`,{method:`PUT`,body:{sessionId:n},signal:i,timeout:15e3,parse:()=>void 0}),e(`${z(t)}/provider-request`,{method:`POST`,body:{sessionId:n,request:r},signal:i,timeout:15e3,parse:I})}function ie(t,n,r){return e(`${z(t)}/fetch`,{method:`POST`,body:n,signal:r,timeout:15e3,parse:I})}var ae=/^[A-Za-z0-9._:-]{1,128}$/,oe=/^\/skill:[a-z0-9][a-z0-9-]{0,63}$/;function se(e){if(!a(e)||typeof e.sessionId!=`string`||!ae.test(e.sessionId))throw Error(`Invalid custom UI session response`);let t=typeof e.command==`string`&&oe.test(e.command)?e.command:``,n=a(e.session)&&e.session.id===e.sessionId?e.session:null;return{sessionId:e.sessionId,created:e.created===!0,command:t,session:n}}function ce(t){return e(`${z(t)}/session`,{method:`POST`,body:{},parse:se})}function le(e=!0){return{queryKey:i.catalog(),queryFn:({signal:e})=>H(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function ue(e=!0){return{queryKey:i.instances(),queryFn:({signal:e})=>K(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function de(e,t){if(!e||e.type===`all`)return!0;let n=r(t);return n!==``&&r(e.cwd)===n}export{J as A,x as C,Q as D,Z as E,ce as O,_ as S,V as T,H as _,ie as a,T as b,re as c,te as d,ee as f,U as g,Y as h,L as i,i as j,W as k,$ as l,G as m,le as n,R as o,q as p,ue as r,B as s,de as t,ne as u,X as v,w,N as x,P as y};
1
+ import{a as e,o as t,u as n}from"./api-CIB7ZPX3.js";import{o as r}from"./session-board-status-D2lpFPiI.js";var i={all:[`custom-ui`],catalog:()=>[`custom-ui`,`catalog`],instances:()=>[`custom-ui`,`instances`],describe:e=>[`custom-ui`,`describe`,e],errors:e=>[`custom-ui`,`errors`,e],versions:e=>[`custom-ui`,`versions`,e],usage:e=>[`custom-ui`,`usage`,e],trash:()=>[`custom-ui`,`trash`],staged:e=>[`custom-ui`,`staged`,e]};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var o=[`overview-card`,`session-panel`,`feature-page`,`floating`],s=[`S`,`M`],c=/^[a-z0-9][a-z0-9._-]{0,63}$/,l=/^[a-f0-9]{24}$/,u=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,79}$/,d=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/,f=/^[a-f0-9]{16}$/,p=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`];function m(e,t=4e3){return typeof e==`string`?e.slice(0,t):``}function h(e){if(typeof e!=`string`||!e||e.length>512)return!1;let t=e.split(`/`);return t.length<=3&&t.every(e=>d.test(e))}function g(e,t=200){let n={};if(!a(e))return n;for(let[r,i]of Object.entries(e).slice(0,t))typeof i==`string`&&(n[r]=i);return n}function _(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,200)){if(!a(n)||typeof n.code!=`string`||!n.code)continue;let e={path:m(n.path,512),code:m(n.code,128)};if(a(n.params)){let t={};for(let[e,r]of Object.entries(n.params))(typeof r==`string`||typeof r==`number`&&Number.isFinite(r))&&(t[e]=r);e.params=t}t.push(e)}return t}function v(e){let t={};if(!a(e))return t;for(let n of[`zh-CN`,`en-US`]){let r=e[n];a(r)&&(t[n]={...typeof r.name==`string`?{name:r.name}:{},...typeof r.description==`string`?{description:r.description}:{},strings:g(r.strings,500)})}return t}function y(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!a(n)||!o.includes(n.surface))continue;let e=n.surface;if(t.some(t=>t.surface===e))continue;let r={surface:e};if(Array.isArray(n.sizes)){let e=s.filter(e=>n.sizes.includes(e));e.length&&(r.sizes=e)}a(n.size)&&typeof n.size.w==`number`&&typeof n.size.h==`number`&&Number.isFinite(n.size.w)&&Number.isFinite(n.size.h)&&n.size.w>0&&n.size.h>0&&(r.size={w:n.size.w,h:n.size.h}),t.push(r)}return t}function b(e){let t={};if(!a(e))return t;let n=e=>m(e.reason,500);for(let r of[`notify`,`sessions.read`,`sessions.open`]){let i=e[r];a(i)&&(t[r]={reason:n(i)})}let r=e[`provider.request`];a(r)&&Array.isArray(r.paths)&&Array.isArray(r.methods)&&(t[`provider.request`]={reason:n(r),paths:r.paths.filter(e=>typeof e==`string`),methods:r.methods.filter(e=>typeof e==`string`)});let i=e.network;a(i)&&Array.isArray(i.hosts)&&(t.network={reason:n(i),hosts:i.hosts.filter(e=>typeof e==`string`).slice(0,32),...Array.isArray(i.privateOrigins)&&{privateOrigins:i.privateOrigins.filter(e=>typeof e==`string`).slice(0,32)}});let o=e.storage;return a(o)&&(t.storage={reason:n(o),quotaKb:typeof o.quotaKb==`number`&&Number.isFinite(o.quotaKb)?o.quotaKb:256}),t}function x(e,t){if(!a(t)||t.runtime!==`native`||t.id!==e||!h(t.entry))return null;let n=a(t.props)?t.props:null;if(!n||n.type!==`object`||!a(n.properties))return null;let r=Array.isArray(t.styles)?t.styles:[];return r.every(h)?{runtime:`native`,id:e,name:m(t.name,120)||e,version:m(t.version,64),description:m(t.description,500),entry:t.entry,styles:r.slice(0,8),icon:m(t.icon,48),i18n:v(t.i18n),props:{type:`object`,properties:n.properties,required:Array.isArray(n.required)?n.required.filter(e=>typeof e==`string`):[]},placements:y(t.placements),capabilities:b(t.capabilities),sdk:typeof t.sdk==`number`?t.sdk:1,minHostVersion:m(t.minHostVersion,64)}:null}function S(e){return e===`agent`||e===`template`||e===`import`?e:`local`}function C(e){return Array.isArray(e)?p.filter(t=>e.includes(t)):[]}function w(e){return!a(e)||typeof e.stageId!=`string`||!f.test(e.stageId)||typeof e.id!=`string`||!c.test(e.id)?null:{stageId:e.stageId,id:e.id,name:m(e.name,120)||e.id,version:m(e.version,64),fileName:m(e.fileName,200)||`${e.id}.zip`,bytes:typeof e.bytes==`number`&&Number.isFinite(e.bytes)?e.bytes:0,sha256:/^[a-f0-9]{64}$/.test(String(e.sha256))?String(e.sha256):``,createdAt:m(e.createdAt,64),replaces:e.replaces===`native`||e.replaces===`legacy`||e.replaces===`broken`?e.replaces:null}}function T(e){if(!a(e)||typeof e.id!=`string`||!c.test(e.id))return null;let t=e.id,n={id:t,name:m(e.name,120)||t,version:m(e.version,64),description:m(e.description,500),directory:m(e.directory,4096),updatedAt:m(e.updatedAt,64),revoked:C(e.revoked)};if(e.kind!==`native`&&e.kind!==`broken`)return{...n,kind:`legacy`,status:`unsupported`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};if(e.kind===`broken`)return{...n,kind:`broken`,status:`invalid`,enabled:!1,source:S(e.source),entry:``,errors:_(e.errors)};let r=_(e.errors),i={...n,kind:`native`,status:e.status===`ready`?`ready`:`invalid`,enabled:e.enabled===!0,source:S(e.source),entry:m(e.entry,512),errors:r};if(e.manifest!==void 0){let n=x(t,e.manifest);n&&(i.manifest=n)}return i.status===`ready`&&(typeof e.rev==`string`&&l.test(e.rev)&&i.manifest?i.rev=e.rev:(i.status=`invalid`,i.errors=[...r,{path:``,code:`component_response_invalid`}])),i}function E(e){if(!a(e)||typeof e.root!=`string`||!Array.isArray(e.components))throw Error(`Invalid custom UI component response`);let t=a(e.features)?e.features:null,n=[],r=new Set;for(let t of e.components){let e=T(t);!e||r.has(e.id)||(r.add(e.id),n.push(e))}let i=[];for(let t of Array.isArray(e.staged)?e.staged.slice(0,50):[]){let e=w(t);e&&!i.some(t=>t.stageId===e.stageId)&&i.push(e)}return{root:e.root,features:{import:t?.import===!0,versions:t?.versions===!0,export:t?.export===!0,trash:t?.trash===`move`?`move`:`none`,trashRestore:t?.trashRestore===!0,usage:t?.usage===!0,revoke:t?.revoke===!0},components:n,staged:i,legacyShape:!t}}function D(e){return a(e)?e.type===`all`?{type:`all`}:e.type===`project`&&typeof e.cwd==`string`&&e.cwd?{type:`project`,cwd:e.cwd}:null:null}function O(e){if(!a(e)||typeof e.instanceId!=`string`||!u.test(e.instanceId)||typeof e.componentId!=`string`||!c.test(e.componentId)||!o.includes(e.surface))return null;let t=e.surface;return{instanceId:e.instanceId,componentId:e.componentId,surface:t,size:t===`overview-card`?s.includes(e.size)?e.size:`S`:null,scope:t===`session-panel`?D(e.scope)??{type:`all`}:null,title:m(e.title,80),props:a(e.props)?e.props:{},enabled:e.enabled!==!1,order:typeof e.order==`number`&&Number.isFinite(e.order)?e.order:0,createdAt:m(e.createdAt,64),updatedAt:m(e.updatedAt,64)}}function k(e){if(!a(e)||typeof e.revision!=`number`||!Number.isSafeInteger(e.revision)||!Array.isArray(e.instances))throw Error(`Invalid custom UI instances response`);let t=[],n=new Set;for(let r of e.instances){let e=O(r);!e||n.has(e.instanceId)||(n.add(e.instanceId),t.push(e))}return t.sort((e,t)=>e.order-t.order),{revision:e.revision,instances:t}}function A(e){let t=a(e)?O(e.instance):null;if(!t||!a(e)||typeof e.revision!=`number`)throw Error(`Invalid custom UI instance response`);return{revision:e.revision,instance:t}}function j(e){if(!a(e)||!Array.isArray(e.entries))throw Error(`Invalid custom UI errors response`);let t=[];for(let n of e.entries.slice(-200))!a(n)||typeof n.message!=`string`||t.push({at:m(n.at,64),kind:m(n.kind,32),level:m(n.level,16),message:m(n.message,500),...typeof n.stack==`string`?{stack:m(n.stack,4e3)}:{},...typeof n.instanceId==`string`?{instanceId:m(n.instanceId,80)}:{},...typeof n.surface==`string`?{surface:m(n.surface,32)}:{}});let n=a(e.network)?e.network:{},r={};if(a(n.hosts))for(let[e,t]of Object.entries(n.hosts).slice(0,64))typeof t==`number`&&Number.isFinite(t)&&(r[e]=t);return{entries:t,dropped:typeof e.dropped==`number`&&Number.isFinite(e.dropped)?e.dropped:0,network:{count:typeof n.count==`number`&&Number.isFinite(n.count)?n.count:0,lastAt:typeof n.lastAt==`string`?n.lastAt:null,hosts:r}}}function M(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function N(e){if(!a(e)||e.status!==`ok`)return{status:`unsupported`};let t=a(e.summary)?e.summary:{},n=[`danger`,`warn`,`info`];return{status:`ok`,hosts:(Array.isArray(e.hosts)?e.hosts.slice(0,50):[]).flatMap(e=>a(e)&&typeof e.host==`string`?[{host:m(e.host,253),declared:e.declared===!0,file:m(e.file,512),line:M(e.line)}]:[]),findings:(Array.isArray(e.findings)?e.findings.slice(0,200):[]).flatMap(e=>a(e)&&typeof e.rule==`string`&&n.includes(e.severity)?[{rule:m(e.rule,32),severity:e.severity,file:m(e.file,512),line:M(e.line),excerpt:m(e.excerpt,200)}]:[]),summary:{danger:M(t.danger),warn:M(t.warn),info:M(t.info),undeclaredHosts:M(t.undeclaredHosts)},truncated:e.truncated===!0}}function P(e){return Array.isArray(e)?e.filter(e=>a(e)&&typeof e.path==`string`&&typeof e.size==`number`&&typeof e.type==`string`).slice(0,256).map(e=>({path:e.path,size:e.size,type:e.type})):[]}function F(e){let t=a(e)?T(e.component):null;if(!t||!a(e)||!Array.isArray(e.files))throw Error(`Invalid custom UI describe response`);return{component:t,files:P(e.files),errors:_(e.errors),scan:N(e.scan)}}function I(e){if(!a(e)||typeof e.status!=`number`||typeof e.body!=`string`||e.bodyEncoding!==`utf8`&&e.bodyEncoding!==`base64`)throw Error(`Invalid custom UI fetch response`);return{status:e.status,statusText:m(e.statusText,200),headers:g(e.headers,64),body:e.body,bodyEncoding:e.bodyEncoding,url:m(e.url,2048),redirected:e.redirected===!0}}function L(e){if(!(e instanceof n)||!e.data)return null;let t=e.data.code??e.data.error;return typeof t==`string`&&/^[a-z0-9_]{1,64}$/.test(t)?t:null}function R(e){return!(e instanceof n)||!e.data?[]:_(e.data.errors)}var z=e=>`/api/custom-ui/components/${encodeURIComponent(e)}`;function B(e,t,n){if(!c.test(e)||!l.test(t)||!h(n))throw Error(`Invalid component module path`);return`${z(e)}/r/${t}/${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function V(e,n,r,i){return t(B(e,n,r),{signal:i})}function H(t){return e(`/api/custom-ui/components`,{signal:t,parse:E})}function U(t,n){return e(`${z(t)}/describe`,{signal:n,parse:F})}function ee(t){return e(`/api/custom-ui/components`,{method:`POST`,body:t,parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function W(t,n){return e(z(t),{method:`PATCH`,body:{enabled:n},parse:e=>{let t=a(e)?T(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}})}function G(t){return e(z(t),{method:`DELETE`,parse:e=>({trashedAs:a(e)?m(e.trashedAs,256):``})})}function K(t){return e(`/api/custom-ui/instances`,{signal:t,parse:k})}function q(t){return e(`/api/custom-ui/instances`,{method:`POST`,body:t,parse:A})}function J(t,n){return e(`/api/custom-ui/instances/${encodeURIComponent(t)}`,{method:`PATCH`,body:n,parse:A})}function Y(t){return e(`/api/custom-ui/instances/${encodeURIComponent(t)}`,{method:`DELETE`,parse:e=>({revision:a(e)&&typeof e.revision==`number`?e.revision:0})})}function X(t,n){return e(`${z(t)}/errors`,{signal:n,parse:j})}function Z(t,n){return e(`${z(t)}/errors`,{method:`POST`,body:n,keepalive:!0,parse:()=>void 0})}function Q(t,n){return e(`${z(t)}/usage`,{method:`POST`,body:{entries:n},keepalive:!0,parse:()=>void 0})}function $(t,n,r){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{signal:r,parse:e=>{if(!a(e)||!Object.hasOwn(e,`value`))throw Error(`Invalid custom UI storage response`);return{value:e.value}}})}function te(t,n,r){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{method:`PUT`,body:{value:r},parse:()=>void 0})}function ne(t,n){return e(`${z(t)}/storage/${encodeURIComponent(n)}`,{method:`DELETE`,parse:()=>void 0})}async function re(t,n,r,i){return await e(`/api/custom-ui/provider-session`,{method:`PUT`,body:{sessionId:n},signal:i,timeout:15e3,parse:()=>void 0}),e(`${z(t)}/provider-request`,{method:`POST`,body:{sessionId:n,request:r},signal:i,timeout:15e3,parse:I})}function ie(t,n,r){return e(`${z(t)}/fetch`,{method:`POST`,body:n,signal:r,timeout:15e3,parse:I})}var ae=/^[A-Za-z0-9._:-]{1,128}$/,oe=/^\/skill:[a-z0-9][a-z0-9-]{0,63}$/;function se(e){if(!a(e)||typeof e.sessionId!=`string`||!ae.test(e.sessionId))throw Error(`Invalid custom UI session response`);let t=typeof e.command==`string`&&oe.test(e.command)?e.command:``,n=a(e.session)&&e.session.id===e.sessionId?e.session:null;return{sessionId:e.sessionId,created:e.created===!0,command:t,session:n}}function ce(t){return e(`${z(t)}/session`,{method:`POST`,body:{},parse:se})}function le(e=!0){return{queryKey:i.catalog(),queryFn:({signal:e})=>H(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function ue(e=!0){return{queryKey:i.instances(),queryFn:({signal:e})=>K(e),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!1}}function de(e,t){if(!e||e.type===`all`)return!0;let n=r(t);return n!==``&&r(e.cwd)===n}export{J as A,x as C,Q as D,Z as E,ce as O,_ as S,V as T,H as _,ie as a,T as b,re as c,te as d,ee as f,U as g,Y as h,L as i,i as j,W as k,$ as l,G as m,le as n,R as o,q as p,ue as r,B as s,de as t,ne as u,X as v,w,N as x,P as y};
@@ -1,2 +1,2 @@
1
- import{l as e}from"./events-B0F69Vd3.js";import{t}from"./chat-api-DgJdhfOP.js";import{n,o as r,t as i}from"./session-tree-summary-BfRtAGwx.js";function a(e){if(typeof e!=`string`)return``;let t=e.trim();return t&&t.length<=200?t:``}async function o(n,a,{notify:o,t:s}){try{let r=await t.navigateSessionTree(n,a,!1);return i(n,r),e(n),o(s(`chat:sessionTree.undone`)),!0}catch(e){return o(r(e),`error`),!1}}function s(e,t,n,r){let i=a(t?.restoreEntryId);r.notify(n,`success`,i?{action:{label:r.t(`chat:sessionTree.undo`),onAction:()=>void o(e,i,r)}}:void 0)}function c(e){return{title:e(`chat:sessionTree.otherBranchTitle`),message:e(`chat:sessionTree.otherBranchMessage`),confirmLabel:e(`chat:sessionTree.switchBranch`),tone:`primary`}}async function l({sessionId:e,entryId:r,confirm:i,open:a,notify:o,t:l}){if(!await i(c(l)))return!1;let u=await t.navigateSessionTreeTarget(e,r);return!u.cancelled&&(n(e),a(e,r),s(e,u,l(`chat:sessionTree.switchedBranch`),{notify:o,t:l}),!0)}var u=8;function d(e,t){let n=e.files.filter(e=>e.action!==`unavailable`),r=e.files.filter(e=>e.action===`unavailable`),i=[];if(n.length){i.push(t(`chat:fileRewind.summary`,{count:n.length,restore:n.filter(e=>e.action===`restore`).length,remove:n.filter(e=>e.action===`delete`).length}));for(let e of n.slice(0,u))i.push(e.action===`delete`?t(`chat:fileRewind.deleteItem`,{path:e.path}):t(`chat:fileRewind.restoreItem`,{path:e.path}));n.length>u&&i.push(t(`chat:fileRewind.more`,{count:n.length-u}))}else i.push(t(`chat:fileRewind.nothing`));return r.length&&i.push(t(`chat:fileRewind.unavailable`,{count:r.length,paths:r.slice(0,u).map(e=>e.path).join(`, `)})),e.incomplete&&i.push(t(`chat:fileRewind.incomplete`)),i.push(t(`chat:fileRewind.scope`)),{title:t(`chat:fileRewind.title`),message:i.join(`
1
+ import{l as e}from"./events-CrT7ie40.js";import{t}from"./chat-api-aEirz9it.js";import{n,o as r,t as i}from"./session-tree-summary-Dljblf8P.js";function a(e){if(typeof e!=`string`)return``;let t=e.trim();return t&&t.length<=200?t:``}async function o(n,a,{notify:o,t:s}){try{let r=await t.navigateSessionTree(n,a,!1);return i(n,r),e(n),o(s(`chat:sessionTree.undone`)),!0}catch(e){return o(r(e),`error`),!1}}function s(e,t,n,r){let i=a(t?.restoreEntryId);r.notify(n,`success`,i?{action:{label:r.t(`chat:sessionTree.undo`),onAction:()=>void o(e,i,r)}}:void 0)}function c(e){return{title:e(`chat:sessionTree.otherBranchTitle`),message:e(`chat:sessionTree.otherBranchMessage`),confirmLabel:e(`chat:sessionTree.switchBranch`),tone:`primary`}}async function l({sessionId:e,entryId:r,confirm:i,open:a,notify:o,t:l}){if(!await i(c(l)))return!1;let u=await t.navigateSessionTreeTarget(e,r);return!u.cancelled&&(n(e),a(e,r),s(e,u,l(`chat:sessionTree.switchedBranch`),{notify:o,t:l}),!0)}var u=8;function d(e,t){let n=e.files.filter(e=>e.action!==`unavailable`),r=e.files.filter(e=>e.action===`unavailable`),i=[];if(n.length){i.push(t(`chat:fileRewind.summary`,{count:n.length,restore:n.filter(e=>e.action===`restore`).length,remove:n.filter(e=>e.action===`delete`).length}));for(let e of n.slice(0,u))i.push(e.action===`delete`?t(`chat:fileRewind.deleteItem`,{path:e.path}):t(`chat:fileRewind.restoreItem`,{path:e.path}));n.length>u&&i.push(t(`chat:fileRewind.more`,{count:n.length-u}))}else i.push(t(`chat:fileRewind.nothing`));return r.length&&i.push(t(`chat:fileRewind.unavailable`,{count:r.length,paths:r.slice(0,u).map(e=>e.path).join(`, `)})),e.incomplete&&i.push(t(`chat:fileRewind.incomplete`)),i.push(t(`chat:fileRewind.scope`)),{title:t(`chat:fileRewind.title`),message:i.join(`
2
2
  `),confirmLabel:n.length?t(`chat:fileRewind.confirm`):t(`chat:fileRewind.confirmChatOnly`),tone:n.length?`danger`:`primary`}}function f(e,t){let n=e.restored.length+e.deleted.length,r=n?t(`chat:fileRewind.done`,{count:n}):t(`chat:fileRewind.doneChatOnly`);return e.unavailable.length?`${r} ${t(`chat:fileRewind.doneUnavailable`,{count:e.unavailable.length})}`:r}export{d as fileRewindConfirmOptions,f as fileRewindNotice,s as notifyTreeNavigation,l as switchToTurnOnOtherBranch};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./useQuery-DdcpUQhO.js";import{a as r}from"./startup-queries-Cevfi-_Z.js";import{t as i}from"./chat-api-DgJdhfOP.js";function a(e){return e instanceof Error?e.message:String(e)}function o(e){return/(?:当前会话已经结束运行|session .*?(?:ended|finished|no longer running))/i.test(a(e))}var s=e(t(),1),c=Object.freeze({});function l(e){return[`session-tree-summary`,e]}function u(e){let t=e&&typeof e==`object`?e:{},n=Number(t.branchCount),r={};for(let e of Array.isArray(t.nodes)?t.nodes:[]){if(!e||typeof e.id!=`string`||typeof e.label!=`string`)continue;let t=e.label.trim();t&&(r[e.id]=t.slice(0,80))}return{branchCount:Number.isFinite(n)&&n>0?Math.floor(n):0,labels:Object.keys(r).length?r:c}}async function d(e){return u(await i.getSessionTree(e))}function f(e,t){if(!e)return;let n=t;n&&Array.isArray(n.nodes)?r.setQueryData(l(e),u(n)):m(e)}function p(e){return r.fetchQuery({queryKey:l(e),queryFn:()=>d(e),staleTime:1/0})}function m(e){return r.invalidateQueries({queryKey:l(e)})}function h(e,{enabled:t,streaming:i,revision:a=0}){let o=t&&!i&&!!e,c=n({queryKey:l(e),queryFn:()=>d(e),enabled:o,staleTime:1/0},r),u=(0,s.useRef)({sessionId:e,streaming:i,revision:a});return(0,s.useEffect)(()=>{let t=u.current;u.current={sessionId:e,streaming:i,revision:a},!(!o||t.sessionId!==e)&&(t.streaming!==i||t.revision!==a)&&m(e)},[o,a,e,i]),c.data??null}function g(e,t){let i=n({queryKey:l(e),queryFn:()=>d(e),enabled:!1,staleTime:1/0,select:e=>t&&e.labels[t]||``},r);return t&&i.data||``}export{g as a,h as i,m as n,a as o,p as r,o as s,f as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./useQuery-DdcpUQhO.js";import{a as r}from"./startup-queries-CceboYee.js";import{t as i}from"./chat-api-aEirz9it.js";function a(e){return e instanceof Error?e.message:String(e)}function o(e){return/(?:当前会话已经结束运行|session .*?(?:ended|finished|no longer running))/i.test(a(e))}var s=e(t(),1),c=Object.freeze({});function l(e){return[`session-tree-summary`,e]}function u(e){let t=e&&typeof e==`object`?e:{},n=Number(t.branchCount),r={};for(let e of Array.isArray(t.nodes)?t.nodes:[]){if(!e||typeof e.id!=`string`||typeof e.label!=`string`)continue;let t=e.label.trim();t&&(r[e.id]=t.slice(0,80))}return{branchCount:Number.isFinite(n)&&n>0?Math.floor(n):0,labels:Object.keys(r).length?r:c}}async function d(e){return u(await i.getSessionTree(e))}function f(e,t){if(!e)return;let n=t;n&&Array.isArray(n.nodes)?r.setQueryData(l(e),u(n)):m(e)}function p(e){return r.fetchQuery({queryKey:l(e),queryFn:()=>d(e),staleTime:1/0})}function m(e){return r.invalidateQueries({queryKey:l(e)})}function h(e,{enabled:t,streaming:i,revision:a=0}){let o=t&&!i&&!!e,c=n({queryKey:l(e),queryFn:()=>d(e),enabled:o,staleTime:1/0},r),u=(0,s.useRef)({sessionId:e,streaming:i,revision:a});return(0,s.useEffect)(()=>{let t=u.current;u.current={sessionId:e,streaming:i,revision:a},!(!o||t.sessionId!==e)&&(t.streaming!==i||t.revision!==a)&&m(e)},[o,a,e,i]),c.data??null}function g(e,t){let i=n({queryKey:l(e),queryFn:()=>d(e),enabled:!1,staleTime:1/0,select:e=>t&&e.labels[t]||``},r);return t&&i.data||``}export{g as a,h as i,m as n,a as o,p as r,o as s,f as t};
@@ -1 +1 @@
1
- import{t as e}from"./index-DmohsuQg.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-8QW6lXuT.js";var r=Object.freeze([`commandPalette`,`primaryAction`,`focusSearch`,`toggleSidebar`,`toggleTerminal`,`openSettings`,`focusComposer`,`sendMessage`,`voiceInput`,`openBoard`,`openComponents`,`openMore`,`jumpToAttention`,`agentPanel`,`toggleInspector`,`previousAgent`,`nextAgent`,`steerMessage`,`shortcutHelp`,`openSession`,`sessionTree`,`sideChat`,`cycleFocusRegion`]),i=Object.freeze({commandPalette:`Mod+KeyK`,primaryAction:`Mod+KeyN`,focusSearch:`Slash`,toggleSidebar:`Mod+KeyB`,toggleTerminal:`Mod+Backquote`,openSettings:`Mod+Comma`,focusComposer:`Mod+Shift+KeyL`,sendMessage:`Enter`,voiceInput:`F8`,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`,jumpToAttention:`Alt+KeyA`,agentPanel:`Mod+KeyJ`,toggleInspector:`Mod+KeyI`,previousAgent:`Alt+ArrowUp`,nextAgent:`Alt+ArrowDown`,steerMessage:`Alt+Enter`,shortcutHelp:`Mod+Slash`,openSession:null,sessionTree:`Mod+Shift+KeyB`,sideChat:null,cycleFocusRegion:`F6`}),a=[`Mod`,`Ctrl`,`Meta`,`Alt`,`Shift`],o=new Set([`Space`,`Backquote`,`Minus`,`Equal`,`BracketLeft`,`BracketRight`,`Backslash`,`Semicolon`,`Quote`,`Comma`,`Period`,`Slash`,`IntlBackslash`,`IntlRo`,`IntlYen`,`NumpadAdd`,`NumpadSubtract`,`NumpadMultiply`,`NumpadDivide`,`NumpadDecimal`]),s=new Set([`KeyA`,`KeyC`,`KeyF`,`KeyL`,`KeyO`,`KeyP`,`KeyQ`,`KeyR`,`KeyS`,`KeyT`,`KeyV`,`KeyW`,`KeyX`,`KeyY`,`KeyZ`]),c=new Map([[` `,`Space`],[`Spacebar`,`Space`],["`",`Backquote`],[`~`,`Backquote`],[`-`,`Minus`],[`_`,`Minus`],[`=`,`Equal`],[`+`,`Equal`],[`[`,`BracketLeft`],[`{`,`BracketLeft`],[`]`,`BracketRight`],[`}`,`BracketRight`],[`\\`,`Backslash`],[`|`,`Backslash`],[`;`,`Semicolon`],[`:`,`Semicolon`],[`'`,`Quote`],[`"`,`Quote`],[`,`,`Comma`],[`<`,`Comma`],[`.`,`Period`],[`>`,`Period`],[`/`,`Slash`],[`?`,`Slash`],...[...`)!@#$%^&*(`].map((e,t)=>[e,`Digit${t}`])]),l=class extends Error{constructor(e,t=`invalid`,n=null,r=null){super(e),this.name=`ShortcutValidationError`,this.code=t,this.action=n,this.conflictingAction=r}};function u(e){if(typeof e!=`string`||!e)return null;let t=e.split(`+`),n=t.pop();if(!/^(Key[A-Z]|Digit[0-9]|Numpad[0-9]|F([1-9]|1[0-2])|Enter|Arrow(Up|Down))$/.test(n)&&!o.has(n))return null;let r=-1;for(let e of t){let t=a.indexOf(e);if(t<=r)return null;r=t}return t.filter(e=>[`Mod`,`Ctrl`,`Meta`].includes(e)).length>1?null:{code:n,primary:t.find(e=>[`Mod`,`Ctrl`,`Meta`].includes(e))||null,alt:t.includes(`Alt`),shift:t.includes(`Shift`)}}function d(e,t=null){let{code:n,primary:r,alt:i,shift:a}=e;return n.startsWith(`Arrow`)?i&&!r&&!a:n===`Enter`&&a&&!r&&!i||i&&(n===`F4`||n===`Space`)||r&&n===`F4`||(r===`Mod`||r===`Meta`)&&n===`Space`&&!a||r&&s.has(n)&&!(n===`KeyL`&&a)?!1:/^F\d+$/.test(n)||r||i?!0:a?!1:n===`Enter`&&(!t||t===`sendMessage`)||n===`Slash`&&(!t||t===`focusSearch`)}function f(e,t){return{ctrl:e.primary===`Ctrl`||e.primary===`Mod`&&!t,meta:e.primary===`Meta`||e.primary===`Mod`&&t,alt:e.alt,shift:e.shift}}function p(e,t,n){let r=f(e,n),i=f(t,n);return e.code===t.code&&r.ctrl===i.ctrl&&r.meta===i.meta&&r.alt===i.alt&&r.shift===i.shift}function m(e,t,n){let i=u(n);if(!i)return null;for(let n of r){if(n===t)continue;let r=u(e?.[n]);if(r&&(p(i,r,!1)||p(i,r,!0)))return n}return null}function h(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==r.length||!r.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete shortcut map with only known actions`);let t={};for(let n of r){let r=e[n];if(r!==null){let e=u(r);if(!e||!d(e,n))throw new l(`Invalid or reserved shortcut for ${n}`,`invalid`,n)}t[n]=r}for(let e of r){let n=m(t,e,t[e]);if(n)throw new l(`Shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}var g=Object.freeze({openBoard:`Mod+Digit1`,openComponents:`Mod+Digit2`,openMore:`Mod+Digit3`}),_=Object.freeze({openSession:`Mod+Digit1`,openBoard:`Mod+Digit2`,openComponents:`Mod+Digit3`,openMore:`Mod+Digit4`}),v=Object.freeze([`openMore`,`openComponents`,`openBoard`,`openSession`]),y=Object.freeze({openSession:null,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`});function b(e){for(let[t,n]of Object.entries(g))if(e[t]!==n)return;for(let t of v){let n=_[t];m(e,t,n)||(e[t]=n)}}function x(e){for(let[t,n]of Object.entries(_))if(e[t]!==n)return;Object.assign(e,y)}function S(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e)))return e;let t=r.filter(t=>Object.hasOwn(e,t));if(t.length===r.length&&Reflect.ownKeys(e).length===t.length)return e;let n={};for(let r of t)n[r]=e[r];Object.hasOwn(n,`sessionTree`)||(Object.hasOwn(n,`openSession`)||b(n),x(n));for(let e of r){if(Object.hasOwn(n,e))continue;let t=i[e];n[e]=m(n,e,t)?null:t}return n}function C(e){try{let t=h(S(e));return t.voiceInput===`Mod+Shift+Space`&&!m(t,`voiceInput`,`F8`)&&(t.voiceInput=`F8`),t}catch{return{...i}}}function w(e){if(e.code)return e.code;let t=e.key;return typeof t==`string`?/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:/^(Enter|Arrow(Up|Down)|F([1-9]|1[0-2]))$/.test(t)?t:c.get(t)||null:null}function T(e){return!e||e.defaultPrevented||e.repeat||e.isComposing||e.keyCode===229||[`Dead`,`Process`,`Unidentified`,`AltGraph`].includes(e.key)||e.getModifierState?.(`AltGraph`)}function E(e,t=!1){if(T(e)||e.ctrlKey&&e.metaKey)return null;let n=w(e);if(!n)return null;let r=[];(t?e.metaKey:e.ctrlKey)?r.push(`Mod`):e.ctrlKey?r.push(`Ctrl`):e.metaKey&&r.push(`Meta`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),r.push(n);let i=r.join(`+`),a=u(i);return a&&d(a)?i:null}function D(e,t,n=!1){if(T(e))return!1;let r=u(t);if(!r||!d(r)||w(e)!==r.code)return!1;let i=f(r,n);return!!e.ctrlKey===i.ctrl&&!!e.metaKey===i.meta&&!!e.altKey===i.alt&&!!e.shiftKey===i.shift}function O(e,t=!1){let n=u(e);if(!n)return``;let r=[];n.primary&&r.push(n.primary===`Mod`?t?`Cmd`:`Ctrl`:n.primary===`Meta`?`Cmd`:`Ctrl`),n.alt&&r.push(`Alt`),n.shift&&r.push(`Shift`);let i={Backquote:"`",Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,IntlBackslash:`\\`,IntlRo:`\\`,IntlYen:`Yen`,NumpadAdd:`Num +`,NumpadSubtract:`Num -`,NumpadMultiply:`Num *`,NumpadDivide:`Num /`,NumpadDecimal:`Num .`,ArrowUp:`↑`,ArrowDown:`↓`},a=n.code;return r.push(i[a]||a.replace(/^Key|^Digit/,``).replace(/^Numpad/,`Num `)),r.join(` + `)}var k=Object.freeze([`boardNext`,`boardPrevious`,`boardApprove`,`boardDeny`,`boardRetry`,`boardTriage`,`boardToggleGrouping`]),A=Object.freeze({boardNext:`KeyJ`,boardPrevious:`KeyK`,boardApprove:`KeyA`,boardDeny:`KeyD`,boardRetry:`KeyR`,boardTriage:`KeyT`,boardToggleGrouping:`KeyG`}),j=/^Key[A-Z]$/;function M(e,t,n){return typeof n!=`string`||!j.test(n)?null:k.find(r=>r!==t&&e?.[r]===n)||null}function N(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==k.length||!k.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete board shortcut map`);let t={};for(let n of k){let r=e[n];if(r!==null&&(typeof r!=`string`||!j.test(r)))throw new l(`Invalid board shortcut for ${n}`,`invalid`,n);t[n]=r}for(let e of k){let n=M(t,e,t[e]);if(n)throw new l(`Board shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}function P(e){try{let t=e&&typeof e==`object`&&!Array.isArray(e)?e:Object.create(null),n={};for(let e of k)Object.hasOwn(t,e)&&(n[e]=t[e]);for(let e of k){if(Object.hasOwn(n,e))continue;let t=A[e];n[e]=M(n,e,t)?null:t}return N(n)}catch{return{...A}}}function F(e){return!!(e?.ctrlKey||e?.metaKey||e?.altKey||e?.shiftKey)}function I(e){if(T(e)||F(e))return null;let t=w(e);return t&&j.test(t)?t:null}function L(e,t){return typeof t!=`string`||!j.test(t)?!1:I(e)===t}function R(){try{return C(JSON.parse(e.getItem(n.shortcuts)||`null`))}catch{return{...i}}}function z(){try{return P(JSON.parse(e.getItem(n.boardShortcuts)||`null`))}catch{return{...A}}}var B=t((t,r)=>{let a=r=>{e.setItem(n.shortcuts,JSON.stringify(r)),t({bindings:r})},o=r=>{e.setItem(n.boardShortcuts,JSON.stringify(r)),t({boardBindings:r})};return{bindings:R(),boardBindings:z(),setBinding:(e,t)=>a(h({...r().bindings,[e]:t})),setBoardBinding:(e,t)=>o(N({...r().boardBindings,[e]:t})),resetBindings:()=>{a({...i}),o({...A})}}});typeof window<`u`&&window.addEventListener(`storage`,e=>{(e.key===n.shortcuts||e.key===null)&&B.setState({bindings:R()}),(e.key===n.boardShortcuts||e.key===null)&&B.setState({boardBindings:z()})});var V=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``);function H(e,t=V){return O(e,t)}function U(e,t,n=V){return D(e,t,n)}function W(e,t=V){return E(e,t)}function G(e){return H(B(t=>t.bindings[e]))}function K(e){return e instanceof HTMLElement&&!!e.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]`)}function q(e,t=V){return t&&e.altKey&&!e.ctrlKey&&!e.metaKey&&K(e.target)}function J(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.repeat||document.visibilityState===`hidden`||!!document.querySelector(`[role="dialog"], [role="alertdialog"], dialog[open]`)||e.target instanceof HTMLElement&&!!e.target.closest(`[data-shortcut-recorder], .terminal-panel, [role="menu"], [role="listbox"]`)}export{h as _,J as a,B as c,i as d,r as f,L as g,m as h,q as i,k as l,M as m,K as n,W as o,I as p,U as r,G as s,H as t,A as u};
1
+ import{t as e}from"./index-DcTDwezs.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-8QW6lXuT.js";var r=Object.freeze([`commandPalette`,`primaryAction`,`focusSearch`,`toggleSidebar`,`toggleTerminal`,`openSettings`,`focusComposer`,`sendMessage`,`voiceInput`,`openBoard`,`openComponents`,`openMore`,`jumpToAttention`,`agentPanel`,`toggleInspector`,`previousAgent`,`nextAgent`,`steerMessage`,`shortcutHelp`,`openSession`,`sessionTree`,`sideChat`,`cycleFocusRegion`]),i=Object.freeze({commandPalette:`Mod+KeyK`,primaryAction:`Mod+KeyN`,focusSearch:`Slash`,toggleSidebar:`Mod+KeyB`,toggleTerminal:`Mod+Backquote`,openSettings:`Mod+Comma`,focusComposer:`Mod+Shift+KeyL`,sendMessage:`Enter`,voiceInput:`F8`,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`,jumpToAttention:`Alt+KeyA`,agentPanel:`Mod+KeyJ`,toggleInspector:`Mod+KeyI`,previousAgent:`Alt+ArrowUp`,nextAgent:`Alt+ArrowDown`,steerMessage:`Alt+Enter`,shortcutHelp:`Mod+Slash`,openSession:null,sessionTree:`Mod+Shift+KeyB`,sideChat:null,cycleFocusRegion:`F6`}),a=[`Mod`,`Ctrl`,`Meta`,`Alt`,`Shift`],o=new Set([`Space`,`Backquote`,`Minus`,`Equal`,`BracketLeft`,`BracketRight`,`Backslash`,`Semicolon`,`Quote`,`Comma`,`Period`,`Slash`,`IntlBackslash`,`IntlRo`,`IntlYen`,`NumpadAdd`,`NumpadSubtract`,`NumpadMultiply`,`NumpadDivide`,`NumpadDecimal`]),s=new Set([`KeyA`,`KeyC`,`KeyF`,`KeyL`,`KeyO`,`KeyP`,`KeyQ`,`KeyR`,`KeyS`,`KeyT`,`KeyV`,`KeyW`,`KeyX`,`KeyY`,`KeyZ`]),c=new Map([[` `,`Space`],[`Spacebar`,`Space`],["`",`Backquote`],[`~`,`Backquote`],[`-`,`Minus`],[`_`,`Minus`],[`=`,`Equal`],[`+`,`Equal`],[`[`,`BracketLeft`],[`{`,`BracketLeft`],[`]`,`BracketRight`],[`}`,`BracketRight`],[`\\`,`Backslash`],[`|`,`Backslash`],[`;`,`Semicolon`],[`:`,`Semicolon`],[`'`,`Quote`],[`"`,`Quote`],[`,`,`Comma`],[`<`,`Comma`],[`.`,`Period`],[`>`,`Period`],[`/`,`Slash`],[`?`,`Slash`],...[...`)!@#$%^&*(`].map((e,t)=>[e,`Digit${t}`])]),l=class extends Error{constructor(e,t=`invalid`,n=null,r=null){super(e),this.name=`ShortcutValidationError`,this.code=t,this.action=n,this.conflictingAction=r}};function u(e){if(typeof e!=`string`||!e)return null;let t=e.split(`+`),n=t.pop();if(!/^(Key[A-Z]|Digit[0-9]|Numpad[0-9]|F([1-9]|1[0-2])|Enter|Arrow(Up|Down))$/.test(n)&&!o.has(n))return null;let r=-1;for(let e of t){let t=a.indexOf(e);if(t<=r)return null;r=t}return t.filter(e=>[`Mod`,`Ctrl`,`Meta`].includes(e)).length>1?null:{code:n,primary:t.find(e=>[`Mod`,`Ctrl`,`Meta`].includes(e))||null,alt:t.includes(`Alt`),shift:t.includes(`Shift`)}}function d(e,t=null){let{code:n,primary:r,alt:i,shift:a}=e;return n.startsWith(`Arrow`)?i&&!r&&!a:n===`Enter`&&a&&!r&&!i||i&&(n===`F4`||n===`Space`)||r&&n===`F4`||(r===`Mod`||r===`Meta`)&&n===`Space`&&!a||r&&s.has(n)&&!(n===`KeyL`&&a)?!1:/^F\d+$/.test(n)||r||i?!0:a?!1:n===`Enter`&&(!t||t===`sendMessage`)||n===`Slash`&&(!t||t===`focusSearch`)}function f(e,t){return{ctrl:e.primary===`Ctrl`||e.primary===`Mod`&&!t,meta:e.primary===`Meta`||e.primary===`Mod`&&t,alt:e.alt,shift:e.shift}}function p(e,t,n){let r=f(e,n),i=f(t,n);return e.code===t.code&&r.ctrl===i.ctrl&&r.meta===i.meta&&r.alt===i.alt&&r.shift===i.shift}function m(e,t,n){let i=u(n);if(!i)return null;for(let n of r){if(n===t)continue;let r=u(e?.[n]);if(r&&(p(i,r,!1)||p(i,r,!0)))return n}return null}function h(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==r.length||!r.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete shortcut map with only known actions`);let t={};for(let n of r){let r=e[n];if(r!==null){let e=u(r);if(!e||!d(e,n))throw new l(`Invalid or reserved shortcut for ${n}`,`invalid`,n)}t[n]=r}for(let e of r){let n=m(t,e,t[e]);if(n)throw new l(`Shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}var g=Object.freeze({openBoard:`Mod+Digit1`,openComponents:`Mod+Digit2`,openMore:`Mod+Digit3`}),_=Object.freeze({openSession:`Mod+Digit1`,openBoard:`Mod+Digit2`,openComponents:`Mod+Digit3`,openMore:`Mod+Digit4`}),v=Object.freeze([`openMore`,`openComponents`,`openBoard`,`openSession`]),y=Object.freeze({openSession:null,openBoard:`Mod+Digit1`,openComponents:null,openMore:`Mod+Digit2`});function b(e){for(let[t,n]of Object.entries(g))if(e[t]!==n)return;for(let t of v){let n=_[t];m(e,t,n)||(e[t]=n)}}function x(e){for(let[t,n]of Object.entries(_))if(e[t]!==n)return;Object.assign(e,y)}function S(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e)))return e;let t=r.filter(t=>Object.hasOwn(e,t));if(t.length===r.length&&Reflect.ownKeys(e).length===t.length)return e;let n={};for(let r of t)n[r]=e[r];Object.hasOwn(n,`sessionTree`)||(Object.hasOwn(n,`openSession`)||b(n),x(n));for(let e of r){if(Object.hasOwn(n,e))continue;let t=i[e];n[e]=m(n,e,t)?null:t}return n}function C(e){try{let t=h(S(e));return t.voiceInput===`Mod+Shift+Space`&&!m(t,`voiceInput`,`F8`)&&(t.voiceInput=`F8`),t}catch{return{...i}}}function w(e){if(e.code)return e.code;let t=e.key;return typeof t==`string`?/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:/^(Enter|Arrow(Up|Down)|F([1-9]|1[0-2]))$/.test(t)?t:c.get(t)||null:null}function T(e){return!e||e.defaultPrevented||e.repeat||e.isComposing||e.keyCode===229||[`Dead`,`Process`,`Unidentified`,`AltGraph`].includes(e.key)||e.getModifierState?.(`AltGraph`)}function E(e,t=!1){if(T(e)||e.ctrlKey&&e.metaKey)return null;let n=w(e);if(!n)return null;let r=[];(t?e.metaKey:e.ctrlKey)?r.push(`Mod`):e.ctrlKey?r.push(`Ctrl`):e.metaKey&&r.push(`Meta`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),r.push(n);let i=r.join(`+`),a=u(i);return a&&d(a)?i:null}function D(e,t,n=!1){if(T(e))return!1;let r=u(t);if(!r||!d(r)||w(e)!==r.code)return!1;let i=f(r,n);return!!e.ctrlKey===i.ctrl&&!!e.metaKey===i.meta&&!!e.altKey===i.alt&&!!e.shiftKey===i.shift}function O(e,t=!1){let n=u(e);if(!n)return``;let r=[];n.primary&&r.push(n.primary===`Mod`?t?`Cmd`:`Ctrl`:n.primary===`Meta`?`Cmd`:`Ctrl`),n.alt&&r.push(`Alt`),n.shift&&r.push(`Shift`);let i={Backquote:"`",Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,IntlBackslash:`\\`,IntlRo:`\\`,IntlYen:`Yen`,NumpadAdd:`Num +`,NumpadSubtract:`Num -`,NumpadMultiply:`Num *`,NumpadDivide:`Num /`,NumpadDecimal:`Num .`,ArrowUp:`↑`,ArrowDown:`↓`},a=n.code;return r.push(i[a]||a.replace(/^Key|^Digit/,``).replace(/^Numpad/,`Num `)),r.join(` + `)}var k=Object.freeze([`boardNext`,`boardPrevious`,`boardApprove`,`boardDeny`,`boardRetry`,`boardTriage`,`boardToggleGrouping`]),A=Object.freeze({boardNext:`KeyJ`,boardPrevious:`KeyK`,boardApprove:`KeyA`,boardDeny:`KeyD`,boardRetry:`KeyR`,boardTriage:`KeyT`,boardToggleGrouping:`KeyG`}),j=/^Key[A-Z]$/;function M(e,t,n){return typeof n!=`string`||!j.test(n)?null:k.find(r=>r!==t&&e?.[r]===n)||null}function N(e){if(!e||typeof e!=`object`||Array.isArray(e)||![Object.prototype,null].includes(Object.getPrototypeOf(e))||Reflect.ownKeys(e).length!==k.length||!k.every(t=>Object.hasOwn(e,t)))throw new l(`Expected a complete board shortcut map`);let t={};for(let n of k){let r=e[n];if(r!==null&&(typeof r!=`string`||!j.test(r)))throw new l(`Invalid board shortcut for ${n}`,`invalid`,n);t[n]=r}for(let e of k){let n=M(t,e,t[e]);if(n)throw new l(`Board shortcut conflict between ${e} and ${n}`,`conflict`,e,n)}return t}function P(e){try{let t=e&&typeof e==`object`&&!Array.isArray(e)?e:Object.create(null),n={};for(let e of k)Object.hasOwn(t,e)&&(n[e]=t[e]);for(let e of k){if(Object.hasOwn(n,e))continue;let t=A[e];n[e]=M(n,e,t)?null:t}return N(n)}catch{return{...A}}}function F(e){return!!(e?.ctrlKey||e?.metaKey||e?.altKey||e?.shiftKey)}function I(e){if(T(e)||F(e))return null;let t=w(e);return t&&j.test(t)?t:null}function L(e,t){return typeof t!=`string`||!j.test(t)?!1:I(e)===t}function R(){try{return C(JSON.parse(e.getItem(n.shortcuts)||`null`))}catch{return{...i}}}function z(){try{return P(JSON.parse(e.getItem(n.boardShortcuts)||`null`))}catch{return{...A}}}var B=t((t,r)=>{let a=r=>{e.setItem(n.shortcuts,JSON.stringify(r)),t({bindings:r})},o=r=>{e.setItem(n.boardShortcuts,JSON.stringify(r)),t({boardBindings:r})};return{bindings:R(),boardBindings:z(),setBinding:(e,t)=>a(h({...r().bindings,[e]:t})),setBoardBinding:(e,t)=>o(N({...r().boardBindings,[e]:t})),resetBindings:()=>{a({...i}),o({...A})}}});typeof window<`u`&&window.addEventListener(`storage`,e=>{(e.key===n.shortcuts||e.key===null)&&B.setState({bindings:R()}),(e.key===n.boardShortcuts||e.key===null)&&B.setState({boardBindings:z()})});var V=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``);function H(e,t=V){return O(e,t)}function U(e,t,n=V){return D(e,t,n)}function W(e,t=V){return E(e,t)}function G(e){return H(B(t=>t.bindings[e]))}function K(e){return e instanceof HTMLElement&&!!e.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]`)}function q(e,t=V){return t&&e.altKey&&!e.ctrlKey&&!e.metaKey&&K(e.target)}function J(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.repeat||document.visibilityState===`hidden`||!!document.querySelector(`[role="dialog"], [role="alertdialog"], dialog[open]`)||e.target instanceof HTMLElement&&!!e.target.closest(`[data-shortcut-recorder], .terminal-panel, [role="menu"], [role="listbox"]`)}export{h as _,J as a,B as c,i as d,r as f,L as g,m as h,q as i,k as l,M as m,K as n,W as o,I as p,U as r,G as s,H as t,A as u};