@vellumai/web 0.11.2-staging.2 → 0.11.2
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.
- package/dist/assets/{Combination-CWTYp834.js → Combination-TPH8qx8I.js} +1 -1
- package/dist/assets/{access-CVnesk0m.js → access-PKx6h0AJ.js} +1 -1
- package/dist/assets/{account-page-mMG1nL1O.js → account-page-DucijMvM.js} +1 -1
- package/dist/assets/{account-shell-BmH96-Ie.js → account-shell-BBDh-DzD.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-SN6NIuW5.js → acp-run-detail-panel-DJ6moBbf.js} +1 -1
- package/dist/assets/{activity-steps-panel-bduSS8_d.js → activity-steps-panel-C95hN_fd.js} +1 -1
- package/dist/assets/{add-credential-modal-4zzd0MPK.js → add-credential-modal-BbvTHJmF.js} +1 -1
- package/dist/assets/{add-credits-modal-DNYP2NMD.js → add-credits-modal-C5d63VSi.js} +1 -1
- package/dist/assets/{ai-page-BMqECtJX.js → ai-page-CbNTYziv.js} +1 -1
- package/dist/assets/{api-key-screen-tqtaQUVf.js → api-key-screen-B5zgGiwa.js} +1 -1
- package/dist/assets/{app-card-BJigGog3.js → app-card-CxO44OqN.js} +1 -1
- package/dist/assets/{assistant-feature-flag-store-BvLDPeej.js → assistant-feature-flag-store-BojuHxUH.js} +1 -1
- package/dist/assets/{assistant-status-panel-DyjhJvK6.js → assistant-status-panel-ZdWgKADH.js} +1 -1
- package/dist/assets/{background-task-detail-panel-DCtBOnvF.js → background-task-detail-panel-BvgkgKs6.js} +1 -1
- package/dist/assets/{billing-page-TF_LgX6K.js → billing-page-CSxWbmCW.js} +2 -2
- package/dist/assets/{bookmarks-page-Brvj5Jf6.js → bookmarks-page-hFDlAWts.js} +1 -1
- package/dist/assets/{button-Dy5001j6.js → button-BwFudwM5.js} +1 -1
- package/dist/assets/{channels-page-route-8vJJE2LN.js → channels-page-route-Cxn_zS-J.js} +1 -1
- package/dist/assets/{chat-markdown-message-B7qvlO44.js → chat-markdown-message-BZZsrGyj.js} +1 -1
- package/dist/assets/{checkbox-PU47Djxg.js → checkbox-fzrjTRTI.js} +1 -1
- package/dist/assets/{checkout-page-MpIPAAgf.js → checkout-page-lDrK4V11.js} +1 -1
- package/dist/assets/{command-palette-Bd1GTwZQ.js → command-palette-Bzsl-t3p.js} +1 -1
- package/dist/assets/{command-palette-window-page-CoweYsZl.js → command-palette-window-page-DjfAe-7N.js} +1 -1
- package/dist/assets/{community-page-BWMwSeEZ.js → community-page-CktLEQl7.js} +1 -1
- package/dist/assets/{confirm-dialog-j9o2h3xs.js → confirm-dialog-B7WBNDbT.js} +1 -1
- package/dist/assets/{connect-page-BxSNhZ8N.js → connect-page-hrIJuX_v.js} +1 -1
- package/dist/assets/{consent-controls-Bs63UL5k.js → consent-controls-HYcVhQZ2.js} +1 -1
- package/dist/assets/{contacts-page-route-BOpVOsYK.js → contacts-page-route-CX57wU3L.js} +1 -1
- package/dist/assets/{conversation-navigation-Bf3cDRKh.js → conversation-navigation-CIHBMx2t.js} +1 -1
- package/dist/assets/{copy-to-clipboard-DgY-nZpm.js → copy-to-clipboard-Y0mxY68V.js} +1 -1
- package/dist/assets/{credential-entry-page-CreYYbwf.js → credential-entry-page-DQOv-Jyx.js} +1 -1
- package/dist/assets/credentials-page-C0eeGia5.js +1 -0
- package/dist/assets/{csv-preview-cEf_PW-P.js → csv-preview-C4T5JLx3.js} +1 -1
- package/dist/assets/{debug-page-DfPZPo6D.js → debug-page-DzXHo3zM.js} +2 -2
- package/dist/assets/{deploy-dialogs-CuaO05wL.js → deploy-dialogs-DQGwptOi.js} +1 -1
- package/dist/assets/{deploy-store-BDIOP-i9.js → deploy-store-BJh0AR_u.js} +1 -1
- package/dist/assets/{detail-card-BElAV1cp.js → detail-card-Br_T-73R.js} +1 -1
- package/dist/assets/{detail-drawer-Cd_EQJkJ.js → detail-drawer-Cbj_q7o7.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-Bhew_kym.js → detail-panel-stop-button-DN2NrxEh.js} +1 -1
- package/dist/assets/{detail-shell-BjqibXNX.js → detail-shell-BuJMM-9z.js} +1 -1
- package/dist/assets/{developer-page-DwBmhm09.js → developer-page-Cj9JWAsX.js} +1 -1
- package/dist/assets/{dist-EanpjdWC.js → dist-B5IUaBWa.js} +1 -1
- package/dist/assets/{dist-C68qFSny.js → dist-BrrL0-_M.js} +1 -1
- package/dist/assets/dist-DWcXIgDR.js +1 -0
- package/dist/assets/{document-viewer-container-iB63ww7P.js → document-viewer-container-CPc9KTln.js} +2 -2
- package/dist/assets/{document-viewer-page-CA1ParJ6.js → document-viewer-page-BqJvQQmH.js} +1 -1
- package/dist/assets/{dropdown-B3FHWc_n.js → dropdown-CJVkL1Yp.js} +1 -1
- package/dist/assets/{emails-page-Bo0Bwem2.js → emails-page-DwQ-FnOD.js} +1 -1
- package/dist/assets/{file-editor-BfJR0ScX.js → file-editor-BigdI9HF.js} +1 -1
- package/dist/assets/{file-markdown-DnVLY_b_.js → file-markdown-eU8RUJQZ.js} +1 -1
- package/dist/assets/{first-run-scope-CPJpXaWU.js → first-run-scope-DqdWmMO-.js} +1 -1
- package/dist/assets/{general-page-BXeIQDGi.js → general-page-uFG7UTqR.js} +1 -1
- package/dist/assets/hatching-screen-CWZvcZVI.js +1 -0
- package/dist/assets/{home-page-route-BPht0PNp.js → home-page-route-zQaUf7gb.js} +1 -1
- package/dist/assets/{hosting-screen-DxtyBx0I.js → hosting-screen-lGuLVQVG.js} +1 -1
- package/dist/assets/{identity-page-route-DgmrXhhV.js → identity-page-route-C64OsL5_.js} +1 -1
- package/dist/assets/index-Cn_k9u0x.css +2 -0
- package/dist/assets/{index-CPeIfypI.js → index-D-1mlWsA.js} +1 -1
- package/dist/assets/{input-tXUFa7Eo.js → input-CgGeKtja.js} +1 -1
- package/dist/assets/{inspect-page-C8aLJOd6.js → inspect-page-DdXP831Q.js} +1 -1
- package/dist/assets/integrations-page-DmQCd8GV.js +1 -0
- package/dist/assets/{intelligence-layout-BRC0qkZ7.js → intelligence-layout-IptAIgHy.js} +1 -1
- package/dist/assets/{library-detail-page-gC4yIWnV.js → library-detail-page-Ddel5wXb.js} +1 -1
- package/dist/assets/{library-page-B10gnbXU.js → library-page-B4k0PNa8.js} +1 -1
- package/dist/assets/{login-page-CbWRbJDE.js → login-page-CRIed3qa.js} +1 -1
- package/dist/assets/{logout-page-DCyzi0V6.js → logout-page-Ne05SAbm.js} +1 -1
- package/dist/assets/{logs-layout-CYkqau4S.js → logs-layout-BN5HA58-.js} +1 -1
- package/dist/assets/{memory-page-route-j_3602nh.js → memory-page-route-Mz8GlpcX.js} +1 -1
- package/dist/assets/{memory-router-playground-page-x5X662qi.js → memory-router-playground-page-CeIkpuOW.js} +1 -1
- package/dist/assets/{menu-wESJw6y3.js → menu-Cfi4A3sw.js} +1 -1
- package/dist/assets/{message-files-panel-C8JokH6e.js → message-files-panel-C8sWLQ58.js} +1 -1
- package/dist/assets/{messages-Dyp1xUqz.js → messages-BTSYvzWZ.js} +1 -1
- package/dist/assets/{metric-card-DpZFp8-q.js → metric-card-CczTqF_s.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-BwCIAm23.js → mobile-sidebar-drawer-CSAugzxJ.js} +1 -1
- package/dist/assets/{modal-xr_vw1ZO.js → modal-DagTZ8xj.js} +1 -1
- package/dist/assets/mutation-error-Cp0Jaqnt.js +1 -0
- package/dist/assets/{not-found-Bh7ZsdAo.js → not-found-C1zvwDkh.js} +1 -1
- package/dist/assets/{notifications-page-BA2BW5y6.js → notifications-page-BzoWNM1e.js} +1 -1
- package/dist/assets/{onboarding-layout-iPzXbZk1.js → onboarding-layout-CNKJRWfe.js} +1 -1
- package/dist/assets/{open-workspace-file-CivxJWcw.js → open-workspace-file-DAlt8chN.js} +2 -2
- package/dist/assets/{page-shell-ZNQR4ZTn.js → page-shell-Dx-efyAO.js} +1 -1
- package/dist/assets/pairing-page-BqjYohpZ.js +1 -0
- package/dist/assets/{panel-item-CJh95P_q.js → panel-item-5YQ3jbso.js} +1 -1
- package/dist/assets/{personality-page-Bz_rNBSs.js → personality-page-CB98MeIQ.js} +1 -1
- package/dist/assets/{plans-page-BfyCgy38.js → plans-page-BcR_kjJL.js} +1 -1
- package/dist/assets/{platform-login-notice-DFmjUE9q.js → platform-login-notice-DvWjpI2S.js} +1 -1
- package/dist/assets/popover-CBYgK7Wt.js +1 -0
- package/dist/assets/{preview-error-BrLE2D3A.js → preview-error-DzUxX6Jy.js} +1 -1
- package/dist/assets/{privacy-page-BhEGh78C.js → privacy-page-B9zfD9a-.js} +1 -1
- package/dist/assets/{privacy-screen-CWVCI_KU.js → privacy-screen-Btqk8OjG.js} +1 -1
- package/dist/assets/{provider-callback-page-DP5cKqPE.js → provider-callback-page-Jul4gNdZ.js} +1 -1
- package/dist/assets/provider-key-BZOwvE14.js +1 -0
- package/dist/assets/{provider-signup-page-BjiiJWS_.js → provider-signup-page-C47ij2Um.js} +1 -1
- package/dist/assets/{research-mock-page-CGkqkXHp.js → research-mock-page-DthnGXhi.js} +1 -1
- package/dist/assets/{research-onboarding-route-DZF-B2Rk.js → research-onboarding-route-Cql_2-1F.js} +1 -1
- package/dist/assets/{research-results-view-BFZFPpev.js → research-results-view-BYpW36E0.js} +1 -1
- package/dist/assets/{retire-confirm-dialog-8xlq4bkx.js → retire-confirm-dialog-PvFzzHrQ.js} +1 -1
- package/dist/assets/{review-terms-screen-C5BAI3Rx.js → review-terms-screen-BpE_z8HY.js} +1 -1
- package/dist/assets/routes-DRAnvlxS.js +23 -0
- package/dist/assets/{runtime-upgrade-banner-DjFuJawk.js → runtime-upgrade-banner-Blp8EyfL.js} +1 -1
- package/dist/assets/{schedules-page-3ZE1nR6I.js → schedules-page-D6KPJIUP.js} +1 -1
- package/dist/assets/{select-assistant-screen-D4WHHv61.js → select-assistant-screen-DH6QRKdk.js} +1 -1
- package/dist/assets/{settings-divider-BkLQFMlW.js → settings-divider-COV4-sHz.js} +1 -1
- package/dist/assets/{settings-layout-BmOglXDq.js → settings-layout-CyMD8Ey7.js} +1 -1
- package/dist/assets/{share-feedback-modal-Rwuho_1S.js → share-feedback-modal-NfuDPoEg.js} +1 -1
- package/dist/assets/{sidebar-tree-Dxx5qLMQ.js → sidebar-tree-DTcPYrOG.js} +1 -1
- package/dist/assets/{site-favicon-CDH0mg6Q.js → site-favicon-DkjZF9mC.js} +1 -1
- package/dist/assets/{skill-detail-page-DswXTTyb.js → skill-detail-page-CzCcXCkp.js} +1 -1
- package/dist/assets/{skill-detail-panel-DhQFBAFF.js → skill-detail-panel-B1Kxa3zf.js} +1 -1
- package/dist/assets/{skills-CbF2uKXV.js → skills-CrZ3GlyK.js} +1 -1
- package/dist/assets/{slack-setup-wizard-DPzdheN0.js → slack-setup-wizard-CeBY_rKV.js} +1 -1
- package/dist/assets/src-CwGlaCIx.js +293 -0
- package/dist/assets/{start-screen-CSxaBn88.js → start-screen-wyemTUjV.js} +1 -1
- package/dist/assets/{subagent-detail-panel-CidisBCf.js → subagent-detail-panel-C3II8umu.js} +1 -1
- package/dist/assets/{superpowers-page-BouZK3P4.js → superpowers-page-DmIZ_ed4.js} +1 -1
- package/dist/assets/{system-events-page-BrvTNeiN.js → system-events-page-DAbap4FJ.js} +1 -1
- package/dist/assets/{tag-gOOX7fbA.js → tag-G0ELn_cq.js} +1 -1
- package/dist/assets/{text-preview-DwgKh8PW.js → text-preview-DLiOtb-y.js} +1 -1
- package/dist/assets/{theme-stage-page-LIhQbqRQ.js → theme-stage-page-Dt0ShS5G.js} +1 -1
- package/dist/assets/{tiptap-document-editor-BvGaiGeN.js → tiptap-document-editor-LwU6S_hn.js} +2 -2
- package/dist/assets/{toast-BtFgiPe3.js → toast-BHjG1kP8.js} +1 -1
- package/dist/assets/{tool-detail-panel-B2CIRZkB.js → tool-detail-panel-tFQRRPbP.js} +1 -1
- package/dist/assets/{transcript-message-body-shared-BfKwS5qD.js → transcript-message-body-shared-DdXeU1D-.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DjeqfvTa.js → upgrade-cancel-page-isK2Rvv6.js} +1 -1
- package/dist/assets/{upgrade-success-page-B4TCn340.js → upgrade-success-page-B7ZaoDsy.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-D-7oN9gr.js → use-assistant-identity-details-BLHiMTpS.js} +1 -1
- package/dist/assets/{use-attachment-preview-CQjpDfsc.js → use-attachment-preview-TAzqhvwh.js} +1 -1
- package/dist/assets/{use-attachment-squares-8Hx-p8ls.js → use-attachment-squares-Cnn6a6er.js} +1 -1
- package/dist/assets/{use-bookmarks-DO9wmU-2.js → use-bookmarks-BKYsQrf9.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-CV_H4uEB.js → use-checkout-dismiss-refresh-ChquCG4n.js} +1 -1
- package/dist/assets/{use-edit-app-Bd1eXXFq.js → use-edit-app-LCywIVb9.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-TNGI1l4g.js → use-invite-link-dialog-CnOeFYBH.js} +1 -1
- package/dist/assets/{use-ios-app-nudge-CadXZRJC.js → use-ios-app-nudge-9Qqz96FD.js} +1 -1
- package/dist/assets/{use-skill-actions-B_tz3CI7.js → use-skill-actions-Ik0rj4or.js} +1 -1
- package/dist/assets/{use-sticky-profiles-D5TVHOgw.js → use-sticky-profiles-BwaZUy6p.js} +1 -1
- package/dist/assets/{use-subagent-card-data-bjGydvhR.js → use-subagent-card-data-1nEhEj8_.js} +1 -1
- package/dist/assets/{use-transcript-message-by-id-BgyP3Ki5.js → use-transcript-message-by-id-RhDDYgbY.js} +1 -1
- package/dist/assets/{use-transcript-messages-C2uwkjKL.js → use-transcript-messages-C5t358ZW.js} +1 -1
- package/dist/assets/{utils-3IBGVjNS.js → utils-B6xfBCpN.js} +1 -1
- package/dist/assets/{viewer-store-DbIS4l8d.js → viewer-store-DxLOGAkL.js} +1 -1
- package/dist/assets/{voice-list-D26Lzbpv.js → voice-list-DP4_zhJe.js} +1 -1
- package/dist/assets/{voice-page-CQ2Vp8p4.js → voice-page-Bn0QH4eT.js} +1 -1
- package/dist/assets/{voice-providers-note-Ck7hNTfp.js → voice-providers-note-F4pLO3zK.js} +1 -1
- package/dist/assets/{welcome-screen-CdsjDVfi.js → welcome-screen-B6BjQt9n.js} +1 -1
- package/dist/assets/{workflow-detail-panel-CsRhUrbM.js → workflow-detail-panel-H3N7Md_X.js} +1 -1
- package/dist/assets/{workspace-page-CFuSxp5s.js → workspace-page-B4sn6pzo.js} +1 -1
- package/dist/index.html +55 -55
- package/package.json +1 -1
- package/dist/assets/credentials-page-DBLT8nUI.js +0 -1
- package/dist/assets/dist-BDdp8zqz.js +0 -1
- package/dist/assets/hatching-screen-BUpSlvBy.js +0 -1
- package/dist/assets/index-C7_04HXM.css +0 -2
- package/dist/assets/integrations-page-Bp2Q81Qt.js +0 -1
- package/dist/assets/mutation-error-YLfUU5XL.js +0 -1
- package/dist/assets/pairing-page-P5ghxF0M.js +0 -1
- package/dist/assets/popover-B-3isZCV.js +0 -1
- package/dist/assets/provider-key-CgC-RLmR.js +0 -1
- package/dist/assets/routes-uGHUgv4F.js +0 -23
- package/dist/assets/src-Da9g8qsW.js +0 -293
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{u as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as i}from"./QueryClientProvider-CMu7CkQU.js";import{t as a}from"./useQuery-Bz-fbQ-m.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{t as s}from"./arrow-up-CWzHzcyU.js";import{t as c}from"./menu-wESJw6y3.js";import"./src-Da9g8qsW.js";import{t as l}from"./download-Cnb8zZrK.js";import{t as u}from"./ellipsis-C5fQnusC.js";import{t as d}from"./file-text-CwGsMgaa.js";import{t as f}from"./globe-CdLn4IX7.js";import{t as p}from"./layout-grid-Ct4RT2Ea.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b}from"./app-card-BJigGog3.js";import{t as x}from"./search-DL-2uX3K.js";import{t as S}from"./trash-2-DfVRfykB.js";import{t as C}from"./input-tXUFa7Eo.js";import{n as w,t as T}from"./panel-item-CJh95P_q.js";import{n as E}from"./toast-BtFgiPe3.js";import{s as D}from"./sdk.gen-CjtCuSlS.js";import{d as O}from"./routes-DrfnNoYS.js";import{E as k,n as A,t as j}from"./react-query.gen-C7om930f.js";import{o as M}from"./viewer-store-DbIS4l8d.js";import{n as N}from"./conversation-navigation-Bf3cDRKh.js";import{n as P}from"./use-is-mobile-MmHo-OM6.js";import{t as F}from"./pointer-CQ4DXHXb.js";import{t as I}from"./misc-BBsGq1IU.js";import{n as L,t as R}from"./deploy-store-BDIOP-i9.js";import{t as z}from"./use-active-assistant-id-JLsAfn3e.js";import{t as B}from"./format-date-CQUMvfqf.js";import{t as V}from"./deploy-dialogs-CuaO05wL.js";import{t as H}from"./app-types-BGJfNjSJ.js";var U=e(t(),1),W=o();function G(e){return e===1?`1 word`:`${e} words`}function K({document:e,onOpen:t}){return(0,W.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:I(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,W.jsx)(d,{size:34,className:`text-[var(--content-tertiary)]`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:G(e.wordCount)})]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,W.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.updatedAt))})]})]})}function q({accept:e,fileInputRef:t,isImporting:r,onImportBundle:i,onNewConversation:a}){return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,W.jsx)(`input`,{ref:t,type:`file`,accept:e,className:`hidden`,onChange:i}),(0,W.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,W.jsx)(p,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,W.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,W.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[a?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,onClick:a,children:`New Conversation`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,W.jsxs)(n,{variant:`outlined`,size:`regular`,onClick:()=>t.current?.click(),disabled:r,children:[r?(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,W.jsx)(l,{size:14}),(0,W.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function J({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,U.useState)(!1),d=H(e.origin),f=d?void 0:a,p=d?void 0:o,m=(0,U.useCallback)(()=>M(t,e.id),[t,e.id]),g=(0,U.useCallback)(async()=>{if(!l){u(!0);try{await L(t,e.id,e.name),E.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){E.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[y,x]=(0,U.useState)(!1),C=P();return(0,W.jsx)(v,{trailingActions:F()?[{id:`pin`,label:n?`Unpin`:`Pin`,icon:n?h:b,onSelect:()=>i(e)},...f?[{id:`delete`,label:`Delete`,icon:S,variant:`destructive`,onSelect:()=>f(e)}]:[]]:[],className:`rounded-xl`,children:(0,W.jsxs)(`div`,{className:I(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:I(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,W.jsx)(_,{name:e.name,icon:e.icon,loadHtml:m})}),(0,W.jsx)(`div`,{className:I(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,y?`opacity-100`:`md:opacity-0`),children:(0,W.jsx)(Y,{appName:e.name,isPinned:n,open:y,onOpenChange:x,onPin:()=>i(e),onDelete:f?()=>f(e):void 0,onShare:d?void 0:g,onDeploy:p,isMobile:C})}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,W.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.createdAt))})]})]})})}function Y({appName:e,isPinned:t,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:l,onDeploy:d,isMobile:p}){return p?(0,W.jsxs)(w.Root,{open:r,onOpenChange:i,children:[(0,W.jsx)(w.Trigger,{asChild:!0,children:(0,W.jsx)(n,{variant:`primary`,size:`compact`,iconOnly:(0,W.jsx)(u,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,W.jsxs)(w.Content,{children:[(0,W.jsx)(w.Header,{className:`sr-only`,children:(0,W.jsx)(w.Title,{children:e})}),(0,W.jsxs)(w.Body,{className:`pt-0`,children:[(0,W.jsx)(T,{icon:t?h:b,label:t?`Unpin`:`Pin`,onSelect:()=>{i(!1),a()}}),l?(0,W.jsx)(T,{icon:s,label:(0,W.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,W.jsx)(`span`,{children:`Share`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{i(!1),l()}}):null,d?(0,W.jsx)(T,{icon:f,label:(0,W.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,W.jsx)(`span`,{children:`Deploy to Vercel`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{i(!1),d()}}):null,o?(0,W.jsx)(T,{icon:S,label:`Delete`,onSelect:()=>{i(!1),o()}}):null]})]})]}):(0,W.jsxs)(c.Root,{open:r,onOpenChange:i,children:[(0,W.jsx)(c.Trigger,{asChild:!0,children:(0,W.jsx)(n,{variant:`primary`,size:`compact`,iconOnly:(0,W.jsx)(u,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,W.jsxs)(c.Content,{align:`end`,sideOffset:4,children:[(0,W.jsx)(c.Item,{leftIcon:t?(0,W.jsx)(h,{size:14}):(0,W.jsx)(b,{size:14}),onSelect:()=>a(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),l?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(s,{size:14}),onSelect:()=>l(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(f,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,o?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(S,{size:14,className:`text-red-600`}),onSelect:()=>o(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function X({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,W.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,W.jsx)(J,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var Z=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function Q(e){let t=m.use.pinnedAppIds(),{data:n=[],isLoading:r,error:i}=a({...j({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=a({...k({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=i&&c?i instanceof Error?i.message:`Failed to load library`:null,[d,f]=(0,U.useState)(``),p=(0,U.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,U.useMemo)(()=>p.filter(e=>t.has(e.id)).sort(Z),[p,t]),recentApps:(0,U.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort(Z),[p,t]),filteredDocuments:(0,U.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function $(e,t){let{data:n,error:r,response:i}=await D({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function ee({assistantId:e,assistantName:t,onNewConversation:r,onOpenDocument:a,onOpenApp:o}){let s=i(),c=m.use.togglePin(),u=m.use.pinnedAppIds(),d=R.use.isDeploying(),{apps:f,documents:p,filteredApps:h,pinnedApps:_,recentApps:v,filteredDocuments:b,searchText:S,setSearchText:w,loading:T,error:D}=Q(e),{pendingDelete:O,isDeleting:k,requestDelete:j,confirmDelete:N,cancelDelete:P}=y(e),[I]=(0,U.useState)(()=>F()?void 0:`.vellum`),L=(0,U.useRef)(null),[z,B]=(0,U.useState)(!1),H=(0,U.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||z)){B(!0);try{let t=await $(e,n);await s.invalidateQueries({queryKey:A({path:{assistant_id:e}})}),E.success(t.name+` imported`),o(t.appId)}catch(e){E.error(e instanceof Error?e.message:`Failed to import app`)}finally{B(!1),L.current&&(L.current.value=``)}}},[e,z,s,o]),G=(0,U.useCallback)(async t=>{if(d)return;let n=f.find(e=>e.id===t)?.name??`this app`;try{let r=await M(e,t);R.getState().deployApp(e,t,n,r)}catch{R.getState().deployApp(e,t,n,``)}},[e,d,f]),J=(0,U.useCallback)(e=>c(e),[c]);return T?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,W.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):D?(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,W.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:D}),(0,W.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):f.length===0&&p.length===0?(0,W.jsx)(q,{accept:I,fileInputRef:L,isImporting:z,onImportBundle:H,onNewConversation:r?()=>r():void 0}):(0,W.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`mb-4 flex shrink-0 items-center justify-end gap-4`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{ref:L,type:`file`,accept:I,className:`hidden`,onChange:H}),(0,W.jsxs)(n,{variant:`outlined`,size:`regular`,onClick:()=>L.current?.click(),disabled:z,children:[z?(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,W.jsx)(l,{size:14}),(0,W.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})}),(0,W.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,W.jsx)(C,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:S,onChange:e=>w(e.target.value),leftIcon:(0,W.jsx)(x,{size:16})})}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:h.length===0&&b.length===0?(0,W.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,W.jsx)(x,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,W.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,S,`”`]})]}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,W.jsx)(X,{title:`Pinned`,apps:_,assistantId:e,pinnedAppIds:u,onOpen:o,onPin:J,onDelete:j,onDeploy:G}),(0,W.jsx)(X,{title:`Recents`,apps:v,assistantId:e,pinnedAppIds:u,onOpen:o,onPin:J,onDelete:j,onDeploy:G}),b.length>0?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,W.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:b.map(e=>(0,W.jsx)(K,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,W.jsx)(V,{assistantId:e,assistantName:t,onStartConversation:r}),(0,W.jsx)(g,{app:O,isDeleting:k,onConfirm:N,onCancel:P})]})}function te(){let e=z(),t=r();return(0,W.jsx)(ee,{assistantId:e,onNewConversation:(0,U.useCallback)(e=>{N(t,{prompt:e})},[t]),onOpenDocument:(0,U.useCallback)(e=>{t(O.document(e))},[t]),onOpenApp:(0,U.useCallback)(e=>{t(O.library.app(e))},[t])})}export{te as LibraryPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BwFudwM5.js";import{u as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as i}from"./QueryClientProvider-CMu7CkQU.js";import{t as a}from"./useQuery-Bz-fbQ-m.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{t as s}from"./arrow-up-CWzHzcyU.js";import{t as c}from"./menu-Cfi4A3sw.js";import"./src-CwGlaCIx.js";import{t as l}from"./download-Cnb8zZrK.js";import{t as u}from"./ellipsis-C5fQnusC.js";import{t as d}from"./file-text-CwGsMgaa.js";import{t as f}from"./globe-CdLn4IX7.js";import{t as p}from"./layout-grid-Ct4RT2Ea.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b}from"./app-card-CxO44OqN.js";import{t as x}from"./search-DL-2uX3K.js";import{t as S}from"./trash-2-DfVRfykB.js";import{t as C}from"./input-CgGeKtja.js";import{n as w,t as T}from"./panel-item-5YQ3jbso.js";import{n as E}from"./toast-BHjG1kP8.js";import{s as D}from"./sdk.gen-CjtCuSlS.js";import{d as O}from"./routes-DrfnNoYS.js";import{E as k,n as A,t as j}from"./react-query.gen-C7om930f.js";import{o as M}from"./viewer-store-DxLOGAkL.js";import{n as N}from"./conversation-navigation-CIHBMx2t.js";import{n as P}from"./use-is-mobile-MmHo-OM6.js";import{t as F}from"./pointer-CQ4DXHXb.js";import{t as I}from"./misc-BBsGq1IU.js";import{n as L,t as R}from"./deploy-store-BJh0AR_u.js";import{t as z}from"./use-active-assistant-id-JLsAfn3e.js";import{t as B}from"./format-date-CQUMvfqf.js";import{t as V}from"./deploy-dialogs-DQGwptOi.js";import{t as H}from"./app-types-BGJfNjSJ.js";var U=e(t(),1),W=o();function G(e){return e===1?`1 word`:`${e} words`}function K({document:e,onOpen:t}){return(0,W.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:I(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,W.jsx)(d,{size:34,className:`text-[var(--content-tertiary)]`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:G(e.wordCount)})]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,W.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.updatedAt))})]})]})}function q({accept:e,fileInputRef:t,isImporting:r,onImportBundle:i,onNewConversation:a}){return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,W.jsx)(`input`,{ref:t,type:`file`,accept:e,className:`hidden`,onChange:i}),(0,W.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,W.jsx)(p,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,W.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,W.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[a?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,onClick:a,children:`New Conversation`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,W.jsxs)(n,{variant:`outlined`,size:`regular`,onClick:()=>t.current?.click(),disabled:r,children:[r?(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,W.jsx)(l,{size:14}),(0,W.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function J({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,U.useState)(!1),d=H(e.origin),f=d?void 0:a,p=d?void 0:o,m=(0,U.useCallback)(()=>M(t,e.id),[t,e.id]),g=(0,U.useCallback)(async()=>{if(!l){u(!0);try{await L(t,e.id,e.name),E.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){E.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[y,x]=(0,U.useState)(!1),C=P();return(0,W.jsx)(v,{trailingActions:F()?[{id:`pin`,label:n?`Unpin`:`Pin`,icon:n?h:b,onSelect:()=>i(e)},...f?[{id:`delete`,label:`Delete`,icon:S,variant:`destructive`,onSelect:()=>f(e)}]:[]]:[],className:`rounded-xl`,children:(0,W.jsxs)(`div`,{className:I(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:I(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,W.jsx)(_,{name:e.name,icon:e.icon,loadHtml:m})}),(0,W.jsx)(`div`,{className:I(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,y?`opacity-100`:`md:opacity-0`),children:(0,W.jsx)(Y,{appName:e.name,isPinned:n,open:y,onOpenChange:x,onPin:()=>i(e),onDelete:f?()=>f(e):void 0,onShare:d?void 0:g,onDeploy:p,isMobile:C})}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,W.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.createdAt))})]})]})})}function Y({appName:e,isPinned:t,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:l,onDeploy:d,isMobile:p}){return p?(0,W.jsxs)(w.Root,{open:r,onOpenChange:i,children:[(0,W.jsx)(w.Trigger,{asChild:!0,children:(0,W.jsx)(n,{variant:`primary`,size:`compact`,iconOnly:(0,W.jsx)(u,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,W.jsxs)(w.Content,{children:[(0,W.jsx)(w.Header,{className:`sr-only`,children:(0,W.jsx)(w.Title,{children:e})}),(0,W.jsxs)(w.Body,{className:`pt-0`,children:[(0,W.jsx)(T,{icon:t?h:b,label:t?`Unpin`:`Pin`,onSelect:()=>{i(!1),a()}}),l?(0,W.jsx)(T,{icon:s,label:(0,W.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,W.jsx)(`span`,{children:`Share`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{i(!1),l()}}):null,d?(0,W.jsx)(T,{icon:f,label:(0,W.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,W.jsx)(`span`,{children:`Deploy to Vercel`}),(0,W.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{i(!1),d()}}):null,o?(0,W.jsx)(T,{icon:S,label:`Delete`,onSelect:()=>{i(!1),o()}}):null]})]})]}):(0,W.jsxs)(c.Root,{open:r,onOpenChange:i,children:[(0,W.jsx)(c.Trigger,{asChild:!0,children:(0,W.jsx)(n,{variant:`primary`,size:`compact`,iconOnly:(0,W.jsx)(u,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,W.jsxs)(c.Content,{align:`end`,sideOffset:4,children:[(0,W.jsx)(c.Item,{leftIcon:t?(0,W.jsx)(h,{size:14}):(0,W.jsx)(b,{size:14}),onSelect:()=>a(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),l?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(s,{size:14}),onSelect:()=>l(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(f,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,o?(0,W.jsx)(c.Item,{leftIcon:(0,W.jsx)(S,{size:14,className:`text-red-600`}),onSelect:()=>o(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function X({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,W.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,W.jsx)(J,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var Z=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function Q(e){let t=m.use.pinnedAppIds(),{data:n=[],isLoading:r,error:i}=a({...j({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=a({...k({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=i&&c?i instanceof Error?i.message:`Failed to load library`:null,[d,f]=(0,U.useState)(``),p=(0,U.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,U.useMemo)(()=>p.filter(e=>t.has(e.id)).sort(Z),[p,t]),recentApps:(0,U.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort(Z),[p,t]),filteredDocuments:(0,U.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function $(e,t){let{data:n,error:r,response:i}=await D({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function ee({assistantId:e,assistantName:t,onNewConversation:r,onOpenDocument:a,onOpenApp:o}){let s=i(),c=m.use.togglePin(),u=m.use.pinnedAppIds(),d=R.use.isDeploying(),{apps:f,documents:p,filteredApps:h,pinnedApps:_,recentApps:v,filteredDocuments:b,searchText:S,setSearchText:w,loading:T,error:D}=Q(e),{pendingDelete:O,isDeleting:k,requestDelete:j,confirmDelete:N,cancelDelete:P}=y(e),[I]=(0,U.useState)(()=>F()?void 0:`.vellum`),L=(0,U.useRef)(null),[z,B]=(0,U.useState)(!1),H=(0,U.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||z)){B(!0);try{let t=await $(e,n);await s.invalidateQueries({queryKey:A({path:{assistant_id:e}})}),E.success(t.name+` imported`),o(t.appId)}catch(e){E.error(e instanceof Error?e.message:`Failed to import app`)}finally{B(!1),L.current&&(L.current.value=``)}}},[e,z,s,o]),G=(0,U.useCallback)(async t=>{if(d)return;let n=f.find(e=>e.id===t)?.name??`this app`;try{let r=await M(e,t);R.getState().deployApp(e,t,n,r)}catch{R.getState().deployApp(e,t,n,``)}},[e,d,f]),J=(0,U.useCallback)(e=>c(e),[c]);return T?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,W.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):D?(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,W.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:D}),(0,W.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):f.length===0&&p.length===0?(0,W.jsx)(q,{accept:I,fileInputRef:L,isImporting:z,onImportBundle:H,onNewConversation:r?()=>r():void 0}):(0,W.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`mb-4 flex shrink-0 items-center justify-end gap-4`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{ref:L,type:`file`,accept:I,className:`hidden`,onChange:H}),(0,W.jsxs)(n,{variant:`outlined`,size:`regular`,onClick:()=>L.current?.click(),disabled:z,children:[z?(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,W.jsx)(l,{size:14}),(0,W.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})}),(0,W.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,W.jsx)(C,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:S,onChange:e=>w(e.target.value),leftIcon:(0,W.jsx)(x,{size:16})})}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:h.length===0&&b.length===0?(0,W.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,W.jsx)(x,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,W.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,S,`”`]})]}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,W.jsx)(X,{title:`Pinned`,apps:_,assistantId:e,pinnedAppIds:u,onOpen:o,onPin:J,onDelete:j,onDeploy:G}),(0,W.jsx)(X,{title:`Recents`,apps:v,assistantId:e,pinnedAppIds:u,onOpen:o,onPin:J,onDelete:j,onDeploy:G}),b.length>0?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,W.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:b.map(e=>(0,W.jsx)(K,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,W.jsx)(V,{assistantId:e,assistantName:t,onStartConversation:r}),(0,W.jsx)(g,{app:O,isDeleting:k,onConfirm:N,onCancel:P})]})}function te(){let e=z(),t=r();return(0,W.jsx)(ee,{assistantId:e,onNewConversation:(0,U.useCallback)(e=>{N(t,{prompt:e})},[t]),onOpenDocument:(0,U.useCallback)(e=>{t(O.document(e))},[t]),onOpenApp:(0,U.useCallback)(e=>{t(O.library.app(e))},[t])})}export{te as LibraryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BwFudwM5.js";import{l as r,t as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./cn-CJf7MmLX.js";import"./src-CwGlaCIx.js";import{E as s,f as c,m as l,p as u}from"./native-biometric-DetUqtjl.js";import{d}from"./routes-DrfnNoYS.js";import{n as f,r as p}from"./login-flow-CQhvCbQQ.js";import{t as m}from"./public-asset-OTnPMErp.js";import{n as h,t as g}from"./use-return-to-short-circuit-g88hMnN8.js";var _=e(t(),1),v=a();function y({children:e}){return(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(`img`,{src:m(`/vellum-logo.svg`),alt:`Vellum`,width:220,height:66,className:`block dark:hidden`}),(0,v.jsx)(`img`,{src:m(`/vellum-logo-white.svg`),alt:`Vellum`,width:220,height:66,className:`hidden dark:block`}),e,(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 w-full max-w-[900px] -translate-x-1/2`,style:{bottom:0},children:(0,v.jsx)(`img`,{src:m(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}function b(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`pointer-events-none absolute top-[120px] left-1/2 z-0 -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:m(`/vellum-logo-white.svg`),alt:`Vellum`,width:92,height:28})}),(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-0 bottom-0 left-1/2 z-0 w-full max-w-[1100px] -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:m(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}var x=`flex w-full max-w-[448px] flex-col gap-6 rounded-lg border border-[var(--border-disabled)] bg-[var(--surface-lift)] p-6`;function S({children:e}){return(0,v.jsx)(`div`,{className:x,children:e})}function C({children:e}){return(0,v.jsx)(`h1`,{className:`text-title-large text-center text-[var(--content-emphasised)]`,children:e})}function w({children:e,className:t}){return(0,v.jsx)(`p`,{className:o(`text-body-small-default text-center text-[var(--system-negative-strong)]`,t),children:e})}function T({children:e}){return(0,v.jsx)(`div`,{className:`dark`,children:(0,v.jsxs)(`div`,{className:`relative min-h-screen overflow-x-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(b,{}),(0,v.jsx)(`div`,{className:`relative z-10 flex min-h-screen flex-col items-center justify-center px-4`,children:e})]})})}var E={signup_closed:`Sign-ups are currently closed. Visit vellum.ai/community to request access.`};function D({returnTo:e}){let[t,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),o=async()=>{r(null),a(!0);try{await u({returnTo:e??null})}catch(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;if(t===`USER_CANCELLED`){a(!1);return}if(t===`AUTH_ERROR`){let t=e&&typeof e==`object`&&`data`in e&&e.data&&typeof e.data==`object`&&`authError`in e.data&&typeof e.data.authError==`string`?e.data.authError:void 0;r((t&&E[t])??`Something went wrong. Please try again.`)}else console.error(`[native-auth] auth flow failed:`,e),r(`Something went wrong. Please try again.`);a(!1)}};return(0,v.jsx)(y,{children:(0,v.jsxs)(`div`,{className:`z-10 mt-8 flex w-full max-w-[320px] flex-col items-center gap-3`,children:[t&&(0,v.jsx)(w,{className:`max-w-[280px]`,children:t}),(0,v.jsx)(n,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>{o()},disabled:i,className:`max-w-[300px]`,children:`Sign in`})]})})}function O({returnTo:e}){let[t,a]=(0,_.useState)(null),[o,l]=(0,_.useState)(!1),u=p(e),{search:m}=r(),h=s(e?`${d.account.signup}?returnTo=${encodeURIComponent(e)}`:d.account.signup,m),g=async()=>{a(null),l(!0);try{await c(f,u,{returnTo:e})}catch(e){console.error(`[web-login] auth flow failed:`,e),a(`Something went wrong. Please try again.`),l(!1)}};return(0,v.jsx)(T,{children:(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{children:`Sign in to Vellum`}),t&&(0,v.jsx)(w,{children:t}),(0,v.jsx)(`div`,{className:`flex flex-col items-center gap-3`,children:(0,v.jsx)(n,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>void g(),disabled:o,className:`max-w-[300px]`,children:`Continue`})}),(0,v.jsxs)(`p`,{className:`text-body-small-default flex justify-center gap-1`,children:[(0,v.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Don't have an account?`}),(0,v.jsx)(i,{to:h,className:`font-medium text-[var(--content-emphasised)] hover:underline`,children:`Sign up`})]})]})})}function k(){let e=l(),t=g();return t.kind===`wait`?e?(0,v.jsx)(y,{}):(0,v.jsx)(T,{children:(0,v.jsx)(h,{})}):t.kind===`redirect`?t.node:e?(0,v.jsx)(D,{returnTo:t.returnTo}):(0,v.jsx)(O,{returnTo:t.returnTo})}export{k as LoginPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{m as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{n as i}from"./auth-store-C9aYqB9U.js";import{w as a}from"./native-biometric-DetUqtjl.js";import{d as o}from"./routes-DrfnNoYS.js";import{t as s}from"./hard-navigate-BYoBFmE4.js";import{r as c,t as l}from"./account-shell-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{m as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{n as i}from"./auth-store-C9aYqB9U.js";import{w as a}from"./native-biometric-DetUqtjl.js";import{d as o}from"./routes-DrfnNoYS.js";import{t as s}from"./hard-navigate-BYoBFmE4.js";import{r as c,t as l}from"./account-shell-BBDh-DzD.js";var u=e(t(),1),d=r();function f(){let[e]=n(),t=i.use.logout(),r=(0,u.useRef)(!1);return(0,u.useEffect)(()=>{if(r.current)return;r.current=!0;let n=a(e.get(`returnTo`),o.account.login),i=n.startsWith(`http`)||n===o.account.login?n:`${o.account.login}?returnTo=${encodeURIComponent(n)}`,c=!1;return t().then(()=>{c||s(i)},()=>{c||s(i)}),()=>{c=!0}},[t,e]),(0,d.jsx)(l,{children:(0,d.jsx)(c,{title:`Signing out...`})})}export{f as LogoutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{l as n,r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./createLucideIcon-CAM1RhH8.js";import{t as o}from"./mail-DyUf40pu.js";import{d as s}from"./routes-DrfnNoYS.js";import{i as c}from"./use-platform-gate-C5bNA5Pn.js";import{n as l,t as u}from"./sidebar-tree-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{l as n,r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./createLucideIcon-CAM1RhH8.js";import{t as o}from"./mail-DyUf40pu.js";import{d as s}from"./routes-DrfnNoYS.js";import{i as c}from"./use-platform-gate-C5bNA5Pn.js";import{n as l,t as u}from"./sidebar-tree-DTcPYrOG.js";var d=a(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),f=e(t(),1),p=[{id:`emails`,label:`Emails`,href:s.logs.emails,icon:o},{id:`system-events`,label:`System Events`,href:s.logs.systemEvents,icon:d}],m=i();function h(){let e=c({platformHostedOnly:!0}),t=c(),{pathname:i}=n(),a=(0,f.useMemo)(()=>p.filter(n=>!(n.id===`system-events`&&e===`gated`||n.id===`emails`&&t===`gated`)),[e,t]),o=(0,f.useMemo)(()=>{let e=p.find(e=>i===e.href||i.startsWith(e.href+`/`));return e?e.label:i===s.logs.root?p[0]?.label??`Logs & Usage`:`Logs & Usage`},[i]);return(0,m.jsx)(l,{backHref:s.assistant,sidebar:(0,m.jsx)(u,{items:a,indexPath:s.logs.root}),title:o,menuRoute:s.logs.root,children:(0,m.jsx)(r,{})})}export{h as LogsLayout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BwFudwM5.js";import{u as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as i}from"./QueryClientProvider-CMu7CkQU.js";import{t as a}from"./useQuery-Bz-fbQ-m.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{t as s}from"./queryOptions-CMSBCFOf.js";import{t as c}from"./typography-DEI9Ra9z.js";import{t as l}from"./chevron-down-BNidRDh1.js";import{t as u}from"./chevron-left-CrxnPze-.js";import{t as d}from"./chevron-up-DofScvyy.js";import{F as f}from"./src-CwGlaCIx.js";import{t as p}from"./loader-circle-DWWXcfTQ.js";import{n as m,t as h}from"./minimize-2-Dj9FY4aF.js";import{t as g}from"./message-circle-ByXBaIaq.js";import{t as _}from"./plus-EJu6s6xR.js";import{t as v}from"./refresh-cw-EZQqnaxp.js";import{t as y}from"./rotate-ccw-CL6IkaAI.js";import{t as b}from"./search-DL-2uX3K.js";import{t as ee}from"./settings-6_RIT4kT.js";import{t as x}from"./sparkles-DfEFn3Bh.js";import{t as S}from"./x-D4O9yIS7.js";import{i as te,n as C,r as ne,t as re}from"./invalidate-memory-queries-DonPN3eH.js";import{n as w}from"./input-CgGeKtja.js";import{t as T}from"./modal-DagTZ8xj.js";import{n as ie}from"./toast-BHjG1kP8.js";import{t as E}from"./file-markdown-eU8RUJQZ.js";import{n as D,r as ae,t as oe}from"./api-errors-BRGPPSWw.js";import{bn as se,un as O}from"./sdk.gen-CjtCuSlS.js";import{d as k}from"./routes-DrfnNoYS.js";import{t as A}from"./consent-logPJwKV.js";import{n as j}from"./conversation-navigation-CIHBMx2t.js";import{n as M}from"./get-memory-stats-BnRGtUPT.js";import{t as N}from"./assistant-feature-flag-store-BojuHxUH.js";import{t as P}from"./ingest-BzFSv_f8.js";import{t as F}from"./use-assistant-capability-CnI3VItU.js";import{t as ce}from"./use-active-assistant-id-JLsAfn3e.js";var I=e(t(),1),L={x:600,y:450},R=`memory_tab_v1`,z=crypto.randomUUID();function B(e){typeof window>`u`||A()&&P([{type:`onboarding`,daemon_event_id:crypto.randomUUID(),recorded_at:Date.now(),screen:`memory`,session_id:z,step_name:e,funnel_version:R}])}var V=Math.PI*(3-Math.sqrt(5)),H=7,U=2.4,W=34,le=10;function ue(e){return Math.min(W,H+U*Math.sqrt(e))}function de(e){return e===`concept`||e===`skill`||e===`capability`||e===`pending`?e:`other`}function G(e){return e===`link`||e===`learned`?e:`other`}function fe(e,t={}){let n=t.center??L,r=e.nodes,i=r.length;if(i===0)return{nodes:[],edges:[]};let a=new Map;r.forEach((e,t)=>a.set(e.id,t));let o=e.edges.filter(e=>e.source!==e.target&&a.has(e.source)&&a.has(e.target)),s=Array(i).fill(0),c=[];for(let e of o){let t=a.get(e.source),n=a.get(e.target);s[t]++,s[n]++,c.push([t,n])}let l=r.map((e,t)=>ue(s[t])),u=70+26*Math.sqrt(i),d=r.map((e,t)=>{let r=(t+.5)/i,a=Math.acos(1-2*r),o=t*V,s=u*Math.cbrt(r),c=Math.sin(a);return{x:n.x+s*c*Math.cos(o),y:n.y+s*c*Math.sin(o),z:s*Math.cos(a),vx:0,vy:0,vz:0}}),f=t.iterations??Math.max(90,Math.min(340,Math.round(46e3/i))),p=.011,m=.82,h=.5,g=1,_=1-.001**(1/f);for(let e=0;e<f;e++){for(let e=0;e<i;e++){let t=d[e];for(let n=e+1;n<i;n++){let r=d[n],i=t.x-r.x,a=t.y-r.y,o=t.z-r.z,s=i*i+a*a+o*o;s<.01&&(i=(e-n)*.1+.1,a=.1,o=.05,s=i*i+a*a+o*o);let c=Math.sqrt(s),l=6400/s,u=i/c*l,f=a/c*l,p=o/c*l;t.vx+=u,t.vy+=f,t.vz+=p,r.vx-=u,r.vy-=f,r.vz-=p}}for(let[e,t]of c){let n=d[e],r=d[t],i=r.x-n.x,a=r.y-n.y,o=r.z-n.z,s=Math.sqrt(i*i+a*a+o*o)||.01,c=.05*(s-140),l=i/s*c,u=a/s*c,f=o/s*c;n.vx+=l,n.vy+=u,n.vz+=f,r.vx-=l,r.vy-=u,r.vz-=f}for(let e=0;e<i;e++){let t=d[e];t.vx+=(n.x-t.x)*p,t.vy+=(n.y-t.y)*p,t.vz+=(0-t.z)*p,t.x+=t.vx*g*h,t.y+=t.vy*g*h,t.z+=t.vz*g*h,t.vx*=m,t.vy*=m,t.vz*=m}g*=1-_}for(let e=0;e<10;e++){let e=!1;for(let t=0;t<i;t++){let n=d[t];for(let r=t+1;r<i;r++){let i=d[r],a=i.x-n.x,o=i.y-n.y,s=i.z-n.z,c=Math.sqrt(a*a+o*o+s*s),u=l[t]+l[r]+le;if(c>=u)continue;c<.01&&(a=(r-t)*.1+.1,o=.1,s=.05,c=Math.sqrt(a*a+o*o+s*s));let f=(u-c)/2,p=a/c*f,m=o/c*f,h=s/c*f;n.x-=p,n.y-=m,n.z-=h,i.x+=p,i.y+=m,i.z+=h,e=!0}}if(!e)break}return{nodes:r.map((e,t)=>{let n={id:e.id,x:d[t].x,y:d[t].y,z:d[t].z,radius:l[t],label:e.label,kind:de(e.kind),degree:s[t]};return e.summary&&(n.summary=e.summary),e.updatedAtMs!==void 0&&(n.updatedAtMs=e.updatedAtMs),n}),edges:o.map((e,t)=>{let n={id:`${e.source}__${e.target}__${t}`,fromId:e.source,toId:e.target,kind:G(e.kind),directed:e.directed??!1};return e.description&&(n.description=e.description),n})}}var K=o();function pe({title:e,detail:t,action:n}){return(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e}),t?(0,K.jsx)(`p`,{className:`max-w-sm text-body-small-default`,style:{color:`var(--content-tertiary)`},children:t}):null,n?(0,K.jsx)(`div`,{className:`mt-2`,children:n}):null]})}var me=`Failed to load this concept.`;function he(e,t){return s({queryKey:[`memory-graph-node`,e,t],enabled:!!(e&&t),queryFn:async()=>{let{data:n,error:r,response:i}=await se({path:{assistant_id:e},query:{id:t??``},throwOnError:!1});if(D(i,r,me),!i.ok)throw new oe(i.status,ae(r,i,me));return n??{found:!1}}})}var ge={concept:`#467CC8`,skill:`#DB4B77`,capability:`#0E9B8B`,pending:`#F1B21E`,other:`#8D99A5`},_e=[`#467CC8`,`#E86B40`,`#7A5AF5`,`#22B8CF`,`#3DB85E`,`#E9C91A`,`#E83F5B`,`#6ECF87`,`#F39B74`,`#F5C94E`],q={concept:`Concept`,skill:`Skill`,capability:`Capability`,pending:`Pending`,other:`Other`},ve=`#F1B21E`;function ye(e){if(e.length<=4)return e.map((e,t)=>({node:e,index:t}));let t=e.slice(-3).map((t,n)=>({node:t,index:e.length-3+n}));return[{node:e[0],index:0},`ellipsis`,...t]}function be(e){return e?new Date(e).toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`}):null}var J=600;function Y(e){let t=e.slice(0,J),n=t.lastIndexOf(`
|
|
2
2
|
`);return n>J/2?e.slice(0,n):t}function xe({content:e}){let[t,r]=(0,I.useState)(!1);return e.length<=J?(0,K.jsx)(E,{content:e}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(E,{content:t?e:Y(e)}),(0,K.jsx)(n,{variant:`ghost`,size:`compact`,className:`-ml-2 mt-1`,onClick:()=>r(e=>!e),rightIcon:t?(0,K.jsx)(d,{size:16,"aria-hidden":!0}):(0,K.jsx)(l,{size:16,"aria-hidden":!0}),children:t?`Show less`:`Read full note`})]})}function Se({assistantId:e,node:t,trail:r,neighbors:i,onTravel:o,onCrumb:s,onClose:c,onOpenThread:l}){let d=a(he(e,t.id)),f=d.data,p=be(t.updatedAtMs),m=f?.title??t.label,h=ye(r);return(0,I.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),c())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),(0,K.jsxs)(`div`,{"data-graph-panel":!0,className:`absolute inset-0 z-20 flex justify-end`,onPointerDown:e=>e.stopPropagation(),onPointerMove:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:`absolute inset-0`,style:{backgroundColor:`color-mix(in srgb, var(--surface-base) 16%, transparent)`},onClick:c}),(0,K.jsxs)(`aside`,{className:`relative flex h-full min-h-0 w-full max-w-md flex-col overflow-hidden`,style:{backgroundColor:`var(--surface-lift)`,borderLeft:`1px solid var(--border-base)`},children:[r.length>1?(0,K.jsxs)(`nav`,{"aria-label":`Concept trail`,className:`flex shrink-0 items-center gap-1 overflow-hidden border-b px-5 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,color:`var(--content-tertiary)`},children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(r.length-2),"aria-label":`Back`,className:`-ml-1 mr-0.5 flex shrink-0 items-center rounded p-0.5 hover:bg-[color-mix(in_srgb,var(--content-tertiary)_14%,transparent)]`,style:{color:`var(--content-tertiary)`},children:(0,K.jsx)(u,{size:16,"aria-hidden":!0})}),h.map((e,t)=>(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[t>0?(0,K.jsx)(`span`,{"aria-hidden":!0,children:`›`}):null,e===`ellipsis`?(0,K.jsx)(`span`,{"aria-hidden":!0,children:`…`}):e.index===r.length-1?(0,K.jsx)(`span`,{"aria-current":`page`,className:`max-w-[9rem] truncate`,style:{color:`var(--content-default)`},children:e.node.label}):(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e.index),className:`max-w-[8rem] truncate rounded hover:underline`,style:{color:`var(--content-tertiary)`},children:e.node.label})]},e===`ellipsis`?`ellipsis`:e.index))]}):null,(0,K.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b px-5 py-4`,style:{borderColor:`var(--border-base)`},children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`truncate text-title-small`,style:{color:`var(--content-default)`},title:f?.title??t.label,children:f?.title??t.label}),p?(0,K.jsxs)(`p`,{className:`mt-0.5 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`Updated `,p]}):null]}),(0,K.jsx)(n,{variant:`ghost`,iconOnly:(0,K.jsx)(S,{"aria-hidden":!0}),onClick:c,"aria-label":`Close`,tintColor:`var(--content-tertiary)`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,style:{touchAction:`pan-y`},children:[d.isLoading?(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(`div`,{className:`h-5 w-5 animate-spin rounded-full border-2`,style:{borderColor:`var(--border-base)`,borderTopColor:`var(--content-tertiary)`}})}):d.isError?(0,K.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Couldn't load this concept. Try again in a moment.`}):f?.found&&f.content?.trim()?(0,K.jsx)(xe,{content:f.content},t.id):(0,K.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This concept doesn't have written content yet — it exists as a link in the graph, but its page is empty.`}),i.length>0?(0,K.jsxs)(`section`,{className:`mt-6 border-t pt-4`,style:{borderColor:`var(--border-base)`},children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:`Wired to`}),(0,K.jsxs)(`span`,{className:`text-body-small-default tabular-nums`,style:{color:`var(--content-tertiary)`},children:[i.length,` connection`,i.length===1?``:`s`]})]}),(0,K.jsx)(`ul`,{className:`flex list-none flex-col gap-0.5`,children:i.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o({id:e.id,label:e.label}),className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-body-medium-default hover:bg-[color-mix(in_srgb,var(--content-tertiary)_12%,transparent)]`,style:{color:`var(--content-default)`},children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full`,style:{backgroundColor:e.kind===`learned`?ve:`var(--content-tertiary)`}}),(0,K.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.id))})]}):null]}),l?(0,K.jsxs)(`footer`,{className:`flex shrink-0 gap-2 border-t px-5 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,K.jsx)(n,{variant:`outlined`,size:`regular`,className:`flex-1`,leftIcon:(0,K.jsx)(g,{size:16,"aria-hidden":!0}),onClick:()=>l(`Tell me what you remember about "${m}" and how it connects to the rest of what you know.`),children:`Ask about this`}),(0,K.jsx)(n,{variant:`primary`,size:`regular`,className:`flex-1`,leftIcon:(0,K.jsx)(x,{size:16,"aria-hidden":!0}),onClick:()=>l(`I want to refine what you remember about "${m}". Ask me what's off and we'll correct it together.`),children:`Refine`})]}):null]})]})}function Ce({onDismiss:e}){return(0,K.jsxs)(`div`,{"data-graph-control":!0,className:`pointer-events-auto absolute left-1/2 top-4 z-10 flex w-[min(30rem,calc(100%-6rem))] -translate-x-1/2 items-start gap-3 rounded-xl px-4 py-3`,style:{backgroundColor:`var(--surface-lift)`,border:`1px solid var(--border-base)`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.25)`},children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,style:{color:`var(--primary-base)`},"aria-hidden":!0,children:(0,K.jsx)(x,{size:18})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`text-body-medium-emphasised`,style:{color:`var(--content-default)`},children:`This is your assistant's mind`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:`Every idea it learns — and the links it draws between them — shows up here. The map grows and rearranges itself as you talk, so the more you share, the richer it gets.`})]}),(0,K.jsx)(n,{variant:`ghost`,iconOnly:(0,K.jsx)(S,{"aria-hidden":!0}),onClick:e,"aria-label":`Dismiss`,tintColor:`var(--content-tertiary)`})]})}var we=8;function Te({nodeKinds:e,coloredByTheme:t,themes:n,hasLinks:r,hasLearned:i,onToggleLink:a,onToggleLearned:o,linkActive:s,learnedActive:c}){return(0,K.jsxs)(`div`,{"data-graph-control":!0,className:`pointer-events-none absolute bottom-4 left-4 flex flex-col gap-1.5 rounded-lg px-3 py-2`,style:{backgroundColor:`color-mix(in srgb, var(--surface-base) 78%, transparent)`,border:`1px solid var(--border-base)`},children:[e.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full`,style:{backgroundColor:ge[e]}}),(0,K.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--content-tertiary)`},children:q[e]})]},e)),t&&(n&&n.length>0?(0,K.jsxs)(K.Fragment,{children:[n.slice(0,we).map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,K.jsx)(`span`,{className:`max-w-[9rem] truncate text-[11px]`,style:{color:`var(--content-tertiary)`},title:e.concepts?.join(` · `)??e.name,children:e.name})]},t)),n.length>we&&(0,K.jsxs)(`span`,{className:`text-[11px]`,style:{color:`var(--content-tertiary)`},children:[`+`,n.length-we,` more`]})]}):(0,K.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--content-tertiary)`},children:`Colored by theme`})),(e.length>0||t)&&(r||i)&&(0,K.jsx)(`div`,{className:`mt-0.5 border-t pt-1.5`,style:{borderColor:`var(--border-base)`}}),r&&(0,K.jsx)(Ee,{swatchStyle:{borderTop:`2px solid var(--content-tertiary)`},label:`Link`,onToggle:a,active:s}),i&&(0,K.jsx)(Ee,{swatchStyle:{borderTop:`2px dashed #F1B21E`},label:`Learned`,onToggle:o,active:c})]})}function Ee({swatchStyle:e,label:t,onToggle:n,active:r}){let i=(0,K.jsx)(`span`,{className:`inline-block h-0 w-4`,style:e}),a=(0,K.jsx)(`span`,{className:`text-[11px]`,style:{color:`var(--content-tertiary)`},children:t});return n?(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":r,className:`pointer-events-auto flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 transition-opacity`,style:{opacity:r===!1?.4:1},children:[i,a]}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]})}var De=8;function Oe(e,t){let n=e.length;if(n===0)return new Map;let r=new Map;e.forEach((e,t)=>r.set(e.id,t));let i=e.map(()=>[]);for(let e of t){let t=r.get(e.fromId),n=r.get(e.toId);t===void 0||n===void 0||t===n||(i[t].push(n),i[n].push(t))}let a=e.map((e,t)=>t);for(let e=0;e<De;e++)for(let e=0;e<n;e++){let t=i[e];if(t.length===0)continue;let n=new Map;for(let e of t)n.set(a[e],(n.get(a[e])??0)+1);let r=a[e],o=-1;for(let[e,t]of n)(t>o||t===o&&e<r)&&(r=e,o=t);a[e]=r}let o=new Map,s=new Map;return e.forEach((e,t)=>{let n=a[t],r=o.get(n);r===void 0&&(r=o.size,o.set(n,r)),s.set(e.id,r)}),s}var X=`Migrate my memory from v2 to v3. That's most likely your "Memory v3 Migration" skill, but work out what my corpus actually needs and follow whichever skill you use exactly.
|
|
3
3
|
|
|
4
4
|
Run it in the background and tell me when it's done, or if something blocks.`,Z=`Migrate my memory from v1 to v3. That's most likely two hops, your "Memory v2 Migration" skill and then your "Memory v3 Migration" skill, but work out what my assistant actually needs and follow whichever skills you use exactly.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./useQuery-Bz-fbQ-m.js";import{t as r}from"./useMutation-CXGTrp4W.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./card-DRIctGVs.js";import"./src-Da9g8qsW.js";import{s as o}from"./auth-store-C9aYqB9U.js";import{hn as s}from"./sdk.gen-CjtCuSlS.js";import{t as c}from"./client-feature-flag-store-Cw39NfCq.js";import{X as l,Y as u,h as d}from"./react-query.gen-C7om930f.js";import{t as f}from"./access-CVnesk0m.js";import{t as p}from"./use-active-assistant-id-JLsAfn3e.js";var m=e(t(),1),h=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function g(e,t,n){let{data:r,response:i}=await s({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new h(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new h(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:_(a)}}function _(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function v(e){return r({mutationFn:async t=>{if(!e)throw new h(0,`Missing assistantId`);return g(e,t)}})}function y(e){return n({...d({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function b(e){return n({...l({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function x(e){return n({...u({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var S=i();function C(){let e=f(),t=o(),n=c.use.memoryRouterPlayground();return t?(0,S.jsx)($,{children:`Loading…`}):!e||!n?(0,S.jsx)($,{children:`Memory router playground is not available.`}):(0,S.jsx)(T,{})}var w={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function T(){let e=p(),t=v(e),n=v(e),r=y(e),i=b(e),a=x(e),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,m.useState)(!1);(0,m.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,h]=(0,m.useState)(w),[g,_]=(0,m.useState)(w),[C,T]=(0,m.useState)(null),[D,k]=(0,m.useState)(null),j=c[c.length-1].userMessage,M=e=>{let r=e===`A`?f:g,i=e===`A`?T:k,a=e===`A`?t:n;i(null);let s;try{s=E(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},N=()=>{M(`A`),M(`B`)},P=j.trim().length>0,I=P&&!t.isPending,L=P&&!n.isPending;return(0,S.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,S.jsx)(ee,{}),(0,S.jsx)(O,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,S.jsx)(A,{paneId:`A`,overrides:f,onChange:h,onRun:()=>M(`A`),canRun:I,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,S.jsx)(A,{paneId:`B`,overrides:g,onChange:_,onRun:()=>M(`B`),canRun:L,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(te,{onClick:N,disabled:!P||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,S.jsx)(ne,{visible:t.data!==void 0&&n.data!==void 0}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,S.jsx)(F,{paneId:`A`,userMessage:j,mutation:t,otherResult:n.data?.response,validation:C}),(0,S.jsx)(F,{paneId:`B`,userMessage:j,mutation:n,otherResult:t.data?.response,validation:D})]})]})})}function E(e){let t={...D(`tier1_size`,e.tier1),...D(`tier2_size`,e.tier2),...D(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function D(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function ee(){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,S.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,S.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,S.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,S.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function O({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,S.jsx)(k,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,S.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,S.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,S.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,S.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,S.jsx)(k,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,S.jsx)(k,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function k({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,S.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function A({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:q(e)},children:[`Config `,e]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,S.jsx)(N,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,S.jsx)(N,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,S.jsx)(N,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,S.jsx)(M,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,S.jsx)(j,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function j({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,m.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,S.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,S.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./useQuery-Bz-fbQ-m.js";import{t as r}from"./useMutation-CXGTrp4W.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./card-DRIctGVs.js";import"./src-CwGlaCIx.js";import{s as o}from"./auth-store-C9aYqB9U.js";import{hn as s}from"./sdk.gen-CjtCuSlS.js";import{t as c}from"./client-feature-flag-store-Cw39NfCq.js";import{X as l,Y as u,h as d}from"./react-query.gen-C7om930f.js";import{t as f}from"./access-PKx6h0AJ.js";import{t as p}from"./use-active-assistant-id-JLsAfn3e.js";var m=e(t(),1),h=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function g(e,t,n){let{data:r,response:i}=await s({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new h(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new h(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:_(a)}}function _(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function v(e){return r({mutationFn:async t=>{if(!e)throw new h(0,`Missing assistantId`);return g(e,t)}})}function y(e){return n({...d({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function b(e){return n({...l({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function x(e){return n({...u({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var S=i();function C(){let e=f(),t=o(),n=c.use.memoryRouterPlayground();return t?(0,S.jsx)($,{children:`Loading…`}):!e||!n?(0,S.jsx)($,{children:`Memory router playground is not available.`}):(0,S.jsx)(T,{})}var w={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function T(){let e=p(),t=v(e),n=v(e),r=y(e),i=b(e),a=x(e),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,m.useState)(!1);(0,m.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,h]=(0,m.useState)(w),[g,_]=(0,m.useState)(w),[C,T]=(0,m.useState)(null),[D,k]=(0,m.useState)(null),j=c[c.length-1].userMessage,M=e=>{let r=e===`A`?f:g,i=e===`A`?T:k,a=e===`A`?t:n;i(null);let s;try{s=E(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},N=()=>{M(`A`),M(`B`)},P=j.trim().length>0,I=P&&!t.isPending,L=P&&!n.isPending;return(0,S.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,S.jsx)(ee,{}),(0,S.jsx)(O,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,S.jsx)(A,{paneId:`A`,overrides:f,onChange:h,onRun:()=>M(`A`),canRun:I,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,S.jsx)(A,{paneId:`B`,overrides:g,onChange:_,onRun:()=>M(`B`),canRun:L,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(te,{onClick:N,disabled:!P||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,S.jsx)(ne,{visible:t.data!==void 0&&n.data!==void 0}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,S.jsx)(F,{paneId:`A`,userMessage:j,mutation:t,otherResult:n.data?.response,validation:C}),(0,S.jsx)(F,{paneId:`B`,userMessage:j,mutation:n,otherResult:t.data?.response,validation:D})]})]})})}function E(e){let t={...D(`tier1_size`,e.tier1),...D(`tier2_size`,e.tier2),...D(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function D(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function ee(){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,S.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,S.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,S.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,S.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function O({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,S.jsx)(k,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,S.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,S.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,S.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,S.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,S.jsx)(k,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,S.jsx)(k,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function k({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,S.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function A({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:q(e)},children:[`Config `,e]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,S.jsx)(N,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,S.jsx)(N,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,S.jsx)(N,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,S.jsx)(M,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,S.jsx)(j,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function j({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,m.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,S.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,S.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
|
|
2
2
|
{{ASSISTANT_NAME}}, {{USER_NAME}}, {{PAGE_INDEX}}
|
|
3
3
|
Leave blank to use the bundled template. "Load default" seeds the textarea with the bundled body for editing.`,className:`rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,resize:`vertical`,minHeight:`120px`}})]})}function M({paneId:e,value:t,onChange:n,profiles:r,activeProfile:i}){let a=`memory-router-playground-${e}-profile`,o=i!==null&&i.length>0?`inherit active (${i})`:`inherit active`;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{htmlFor:a,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`llm.profiles override`}),(0,S.jsxs)(`select`,{id:a,value:t,onChange:e=>n(e.target.value),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`},children:[(0,S.jsx)(`option`,{value:``,children:o}),r.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))]})]})}function N({paneId:e,label:t,value:n,onChange:r}){let i=`memory-router-playground-${e}-${t}`;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{htmlFor:i,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:t}),(0,S.jsx)(`input`,{id:i,value:n,onChange:e=>r(e.target.value),placeholder:`inherit`,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`}})]})}function te({onClick:e,disabled:t,isRunning:n}){return(0,S.jsx)(`button`,{type:`button`,onClick:e,disabled:t,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:t?`var(--surface-overlay)`:`var(--primary-base)`,color:t?`var(--content-disabled)`:`var(--content-on-primary)`,border:`none`,cursor:t?`not-allowed`:`pointer`},children:n?`Running…`:`Run both`})}function ne({visible:e}){return e?(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-md px-4 py-2 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`},children:[(0,S.jsx)(P,{marker:`●`,markerColor:`var(--content-default)`,label:`in both`}),(0,S.jsx)(P,{marker:`◆`,markerColor:q(`A`),label:`A only`}),(0,S.jsx)(P,{marker:`◇`,markerColor:q(`B`),label:`B only`})]}):null}function P({marker:e,markerColor:t,label:n}){return(0,S.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(`span`,{style:{color:t},children:e}),(0,S.jsx)(`span`,{children:n})]})}function F({paneId:e,userMessage:t,mutation:n,otherResult:r,validation:i}){let a=n.data;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsx)(R,{paneId:e}),i!==null&&(0,S.jsx)(Q,{message:i}),n.isError&&(0,S.jsx)(Q,{message:n.error instanceof Error?n.error.message:`Failed to run simulation`}),a!==void 0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(z,{paneId:e,userMessage:t,result:a.response,otherResult:r}),(0,S.jsx)(I,{paneId:e,rawRequest:a.rawRequest,rawResponse:a.rawResponse})]})]})}function I({paneId:e,rawRequest:t,rawResponse:n}){let[r,i]=(0,m.useState)(!1);return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[r?`▾`:`▸`,` Raw API exchange`]}),r&&(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsx)(L,{label:`Request (Pane ${e})`,body:t}),(0,S.jsx)(L,{label:`Response (Pane ${e})`,body:n})]})]})})}function L({label:e,body:t}){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,S.jsx)(`pre`,{className:`overflow-auto rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,maxHeight:`320px`,whiteSpace:`pre`},children:t.length===0?`(empty)`:t})]})}function R({paneId:e}){return(0,S.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:q(e)},children:[`Pane `,e]})}function z({paneId:e,userMessage:t,result:n,otherResult:r}){let i=(0,m.useMemo)(()=>B(n,r),[n,r]),a=(0,m.useMemo)(()=>W(n),[n]);return(0,S.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,S.jsx)(H,{result:n,userMessage:t,otherResult:r,counts:(0,m.useMemo)(()=>V(i),[i])}),(0,S.jsx)(U,{result:n}),n.failureReason!==null&&(0,S.jsx)(Q,{message:`Router failure: ${n.failureReason}`}),a.length===0?(0,S.jsx)(X,{}):a.map(t=>(0,S.jsx)(Y,{paneId:e,source:t.source,slugs:t.slugs,scores:n.scores,diff:i},t.source))]})}function B(e,t){let n=new Map;if(t===void 0){for(let t of e.selectedSlugs)n.set(t,`both`);return n}let r=new Set(t.selectedSlugs);for(let t of e.selectedSlugs)n.set(t,r.has(t)?`both`:`only-here`);return n}function V(e){let t=0,n=0;for(let r of e.values())r===`both`?t++:n++;return{total:e.size,shared:t,unique:n}}function H({result:e,userMessage:t,otherResult:n,counts:r}){let i=[{label:`User message`,value:t},{label:`Total candidate pages`,value:e.totalCandidatePages.toLocaleString()},{label:`Selected`,value:`${e.selectedSlugs.length} (live max_page_ids: ${e.effectiveConfig.max_page_ids})`}];return n!==void 0&&i.push({label:`Diff`,value:`${r.shared} shared · ${r.unique} unique to this pane`}),(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Summary`}),(0,S.jsx)(Z,{rows:i})]})})}function U({result:e}){let t=[`tier1_size`,`tier2_size`,`batch_size`,`max_page_ids`].map(t=>{let n=e.effectiveConfig[t],r=e.overrides[t];return{label:t,value:`${n===null?`null`:String(n)}${r===void 0?``:` (override)`}`}});return t.push({label:`llm.profiles override`,value:e.profileOverride===null?`inherit active`:`${e.profileOverride} (override)`}),t.push({label:`system prompt`,value:e.routerPromptOverridden?`custom`:`bundled`}),(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Effective config`}),(0,S.jsx)(Z,{rows:t})]})})}function W(e){let t=new Map;for(let n of e.selectedSlugs){let r=e.sourceBySlug[n];if(r===void 0)continue;let i=t.get(r)??[];i.push(n),t.set(r,i)}return[...t.keys()].sort((e,t)=>G(e)-G(t)).map(e=>({source:e,slugs:t.get(e)}))}function G(e){return e===`tier1`?0:e===`tier2`?1:e.startsWith(`tier3:`)?2+Number(e.slice(6)):2**53-1}function K(e){return e===`tier1`?`tier 1`:e===`tier2`?`tier 2`:e.startsWith(`tier3:`)?`tier 3 · b${e.slice(6)}`:e}function q(e){return e===`A`?`var(--system-mid-strong)`:`var(--primary-base)`}function J(e,t){return t===`both`?{color:`var(--content-default)`,marker:`●`}:{color:q(e),marker:e===`A`?`◆`:`◇`}}function Y({paneId:e,source:t,slugs:n,scores:r,diff:i}){return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:K(t)}),(0,S.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[n.length,` `,n.length===1?`page`:`pages`]})]}),(0,S.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let{color:a,marker:o}=J(e,i.get(n)??`only-here`);return(0,S.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,S.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{style:{color:a},children:o}),(0,S.jsx)(`code`,{className:`text-body-medium-default`,style:{color:a},children:n})]}),t===`tier2`&&(0,S.jsxs)(`span`,{className:`tabular-nums text-label-default`,style:{color:`var(--content-secondary)`},children:[`EMA `,(r[n]??0).toFixed(3)]})]},n)})})]})})}function X(){return(0,S.jsx)(a,{children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,S.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`No pages selected`}),(0,S.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`The router returned an empty selection. Try a more specific query, or relax the override values.`})]})})}function Z({rows:e}){return(0,S.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(({label:e,value:t})=>(0,S.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,S.jsx)(`span`,{className:`shrink-0 text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,S.jsx)(`span`,{className:`text-right text-body-medium-lighter`,style:{color:`var(--content-default)`},children:t})]},e))})}function Q({message:e}){return(0,S.jsx)(`div`,{className:`rounded-md px-4 py-3 text-body-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--system-negative-strong)`},children:e})}function $({children:e}){return(0,S.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-8 text-label-default`,style:{color:`var(--content-tertiary)`},children:e})}export{C as MemoryRouterPlaygroundPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{A as n,D as r,M as i,N as a,O as o,T as s,a as c,c as l,d as u,f as d,j as f,k as p,l as m,o as h,p as g,s as _,u as v,w as y}from"./button-Dy5001j6.js";import{t as b}from"./jsx-runtime-D3ZM-ToX.js";import{t as x}from"./cn-CJf7MmLX.js";import{t as S}from"./createLucideIcon-CAM1RhH8.js";import{t as C}from"./check-Dt2rQhdg.js";import{t as w}from"./chevron-right-CANAtgGn.js";import{i as ee,n as T,r as te,t as ne}from"./Combination-CWTYp834.js";import{n as E,t as D}from"./dist-EanpjdWC.js";var re=S(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),O=e(t(),1),k=b(),A=`rovingFocusGroup.onEntryFocus`,j={bubbles:!1,cancelable:!0},M=`RovingFocusGroup`,[N,P,F]=E(M),[ie,I]=f(M,[F]),[ae,L]=ie(M),oe=O.forwardRef((e,t)=>(0,k.jsx)(N.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(N.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(se,{...e,ref:t})})}));oe.displayName=M;var se=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:s,loop:c=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:m=!1,...g}=e,_=O.useRef(null),v=i(t,_),y=D(l),[b,x]=h({prop:u,defaultProp:d??null,onChange:f,caller:M}),[S,C]=O.useState(!1),w=r(p),ee=P(n),T=O.useRef(!1),[te,ne]=O.useState(0);return O.useEffect(()=>{let e=_.current;if(e)return e.addEventListener(A,w),()=>e.removeEventListener(A,w)},[w]),(0,k.jsx)(ae,{scope:n,orientation:s,dir:y,loop:c,currentTabStopId:b,onItemFocus:O.useCallback(e=>x(e),[x]),onItemShiftTab:O.useCallback(()=>C(!0),[]),onFocusableItemAdd:O.useCallback(()=>ne(e=>e+1),[]),onFocusableItemRemove:O.useCallback(()=>ne(e=>e-1),[]),children:(0,k.jsx)(o.div,{tabIndex:S||te===0?-1:0,"data-orientation":s,...g,ref:v,style:{outline:`none`,...e.style},onMouseDown:a(e.onMouseDown,()=>{T.current=!0}),onFocus:a(e.onFocus,e=>{let t=!T.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(A,j);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=ee().filter(e=>e.focusable);pe([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),m)}}T.current=!1}),onBlur:a(e.onBlur,()=>C(!1))})})}),ce=`RovingFocusGroupItem`,le=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:c,...l}=e,u=y(),d=s||u,f=L(ce,n),p=f.currentTabStopId===d,m=P(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:_}=f;return O.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),(0,k.jsx)(N.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:(0,k.jsx)(o.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:a(e.onMouseDown,e=>{r?f.onItemFocus(d):e.preventDefault()}),onFocus:a(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:a(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=fe(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?me(n,r+1):n.slice(r+1)}setTimeout(()=>pe(n))}}),children:typeof c==`function`?c({isCurrentTabStop:p,hasTabStop:_!=null}):c})})});le.displayName=ce;var ue={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function de(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function fe(e,t,n){let r=de(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ue[r]}function pe(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function me(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var he=oe,ge=le,_e=[`Enter`,` `],ve=[`ArrowDown`,`PageUp`,`Home`],ye=[`ArrowUp`,`PageDown`,`End`],be=[...ve,...ye],xe={ltr:[..._e,`ArrowRight`],rtl:[..._e,`ArrowLeft`]},Se={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},R=`Menu`,[z,Ce,we]=E(R),[B,Te]=f(R,[we,g,I]),V=g(),Ee=I(),[De,H]=B(R),[Oe,U]=B(R),ke=e=>{let{__scopeMenu:t,open:n=!1,children:i,dir:a,onOpenChange:o,modal:s=!0}=e,c=V(t),[l,u]=O.useState(null),f=O.useRef(!1),p=r(o),m=D(a);return O.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),O.useEffect(()=>{if(!n)return;let e=()=>p(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,p]),(0,k.jsx)(d,{...c,children:(0,k.jsx)(De,{scope:t,open:n,onOpenChange:p,content:l,onContentChange:u,children:(0,k.jsx)(Oe,{scope:t,onClose:O.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:s,children:i})})})};ke.displayName=R;var Ae=`MenuAnchor`,je=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=V(n);return(0,k.jsx)(m,{...i,...r,ref:t})});je.displayName=Ae;var Me=`MenuPortal`,[Ne,Pe]=B(Me,{forceMount:void 0}),Fe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=H(Me,t);return(0,k.jsx)(Ne,{scope:t,forceMount:n,children:(0,k.jsx)(_,{present:n||a.open,children:(0,k.jsx)(l,{asChild:!0,container:i,children:r})})})};Fe.displayName=Me;var W=`MenuContent`,[Ie,Le]=B(W),Re=O.forwardRef((e,t)=>{let n=Pe(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=H(W,e.__scopeMenu),o=U(W,e.__scopeMenu);return(0,k.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(_,{present:r||a.open,children:(0,k.jsx)(z.Slot,{scope:e.__scopeMenu,children:o.modal?(0,k.jsx)(ze,{...i,ref:t}):(0,k.jsx)(Be,{...i,ref:t})})})})}),ze=O.forwardRef((e,t)=>{let n=H(W,e.__scopeMenu),r=O.useRef(null),o=i(t,r);return O.useEffect(()=>{let e=r.current;if(e)return T(e)},[]),(0,k.jsx)(He,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Be=O.forwardRef((e,t)=>{let n=H(W,e.__scopeMenu);return(0,k.jsx)(He,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ve=n(`MenuContent.ScrollLock`),He=O.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:l,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,disableOutsideScroll:v,...y}=e,b=H(W,n),x=U(W,n),S=V(n),C=Ee(n),w=Ce(n),[T,E]=O.useState(null),D=O.useRef(null),re=i(t,D,b.onContentChange),A=O.useRef(0),j=O.useRef(``),M=O.useRef(0),N=O.useRef(null),P=O.useRef(`right`),F=O.useRef(0),ie=v?ne:O.Fragment,I=v?{as:Ve,allowPinchZoom:!0}:void 0,ae=e=>{let t=j.current+e,n=w().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=xt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){j.current=t,window.clearTimeout(A.current),t!==``&&(A.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};O.useEffect(()=>()=>window.clearTimeout(A.current),[]),ee();let L=O.useCallback(e=>P.current===N.current?.side&&Ct(e,N.current?.area),[]);return(0,k.jsx)(Ie,{scope:n,searchRef:j,onItemEnter:O.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:O.useCallback(e=>{L(e)||(D.current?.focus(),E(null))},[L]),onTriggerLeave:O.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:M,onPointerGraceIntentChange:O.useCallback(e=>{N.current=e},[]),children:(0,k.jsx)(ie,{...I,children:(0,k.jsx)(te,{asChild:!0,trapped:o,onMountAutoFocus:a(c,e=>{e.preventDefault(),D.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:(0,k.jsx)(s,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,children:(0,k.jsx)(he,{asChild:!0,...C,dir:x.dir,orientation:`vertical`,loop:r,currentTabStopId:T,onCurrentTabStopIdChange:E,onEntryFocus:a(f,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,k.jsx)(u,{role:`menu`,"aria-orientation":`vertical`,"data-state":_t(b.open),"data-radix-menu-content":``,dir:x.dir,...S,...y,ref:re,style:{outline:`none`,...y.style},onKeyDown:a(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ae(e.key));let i=D.current;if(e.target!==i||!be.includes(e.key))return;e.preventDefault();let a=w().filter(e=>!e.disabled).map(e=>e.ref.current);ye.includes(e.key)&&a.reverse(),yt(a)}),onBlur:a(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:a(e.onPointerMove,X(e=>{let t=e.target,n=F.current!==e.clientX;e.currentTarget.contains(t)&&n&&(P.current=e.clientX>F.current?`right`:`left`,F.current=e.clientX)}))})})})})})})});Re.displayName=W;var Ue=`MenuGroup`,We=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(o.div,{role:`group`,...r,ref:t})});We.displayName=Ue;var Ge=`MenuLabel`,Ke=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(o.div,{...r,ref:t})});Ke.displayName=Ge;var G=`MenuItem`,qe=`menu.itemSelect`,K=O.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...o}=e,s=O.useRef(null),c=U(G,e.__scopeMenu),l=Le(G,e.__scopeMenu),u=i(t,s),d=O.useRef(!1),f=()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(qe,{bubbles:!0,cancelable:!0});e.addEventListener(qe,e=>r?.(e),{once:!0}),p(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,k.jsx)(Je,{...o,ref:u,disabled:n,onClick:a(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:a(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:a(e.onKeyDown,e=>{let t=l.searchRef.current!==``;n||t&&e.key===` `||_e.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});K.displayName=G;var Je=O.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:s,...c}=e,l=Le(G,n),u=Ee(n),d=O.useRef(null),f=i(t,d),[p,m]=O.useState(!1),[h,g]=O.useState(``);return O.useEffect(()=>{let e=d.current;e&&g((e.textContent??``).trim())},[c.children]),(0,k.jsx)(z.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:(0,k.jsx)(ge,{asChild:!0,...u,focusable:!r,children:(0,k.jsx)(o.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...c,ref:f,onPointerMove:a(e.onPointerMove,X(e=>{r?l.onItemLeave(e):(l.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:a(e.onPointerLeave,X(e=>l.onItemLeave(e))),onFocus:a(e.onFocus,()=>m(!0)),onBlur:a(e.onBlur,()=>m(!1))})})})}),Ye=`MenuCheckboxItem`,Xe=O.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,k.jsx)(rt,{scope:e.__scopeMenu,checked:n,children:(0,k.jsx)(K,{role:`menuitemcheckbox`,"aria-checked":Y(n)?`mixed`:n,...i,ref:t,"data-state":vt(n),onSelect:a(i.onSelect,()=>r?.(Y(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xe.displayName=Ye;var Ze=`MenuRadioGroup`,[Qe,$e]=B(Ze,{value:void 0,onValueChange:()=>{}}),et=O.forwardRef((e,t)=>{let{value:n,onValueChange:i,...a}=e,o=r(i);return(0,k.jsx)(Qe,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,k.jsx)(We,{...a,ref:t})})});et.displayName=Ze;var tt=`MenuRadioItem`,nt=O.forwardRef((e,t)=>{let{value:n,...r}=e,i=$e(tt,e.__scopeMenu),o=n===i.value;return(0,k.jsx)(rt,{scope:e.__scopeMenu,checked:o,children:(0,k.jsx)(K,{role:`menuitemradio`,"aria-checked":o,...r,ref:t,"data-state":vt(o),onSelect:a(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});nt.displayName=tt;var q=`MenuItemIndicator`,[rt,it]=B(q,{checked:!1}),at=O.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=it(q,n);return(0,k.jsx)(_,{present:r||Y(a.checked)||a.checked===!0,children:(0,k.jsx)(o.span,{...i,ref:t,"data-state":vt(a.checked)})})});at.displayName=q;var ot=`MenuSeparator`,st=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(o.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});st.displayName=ot;var ct=`MenuArrow`,lt=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=V(n);return(0,k.jsx)(v,{...i,...r,ref:t})});lt.displayName=ct;var ut=`MenuSub`,[dt,ft]=B(ut),pt=e=>{let{__scopeMenu:t,children:n,open:i=!1,onOpenChange:a}=e,o=H(ut,t),s=V(t),[c,l]=O.useState(null),[u,f]=O.useState(null),p=r(a);return O.useEffect(()=>(o.open===!1&&p(!1),()=>p(!1)),[o.open,p]),(0,k.jsx)(d,{...s,children:(0,k.jsx)(De,{scope:t,open:i,onOpenChange:p,content:u,onContentChange:f,children:(0,k.jsx)(dt,{scope:t,contentId:y(),triggerId:y(),trigger:c,onTriggerChange:l,children:n})})})};pt.displayName=ut;var J=`MenuSubTrigger`,mt=O.forwardRef((e,t)=>{let n=H(J,e.__scopeMenu),r=U(J,e.__scopeMenu),o=ft(J,e.__scopeMenu),s=Le(J,e.__scopeMenu),c=O.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},f=O.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);O.useEffect(()=>f,[f]),O.useEffect(()=>{let e=l.current;return()=>{window.clearTimeout(e),u(null)}},[l,u]);let p=i(t,o.onTriggerChange);return(0,k.jsx)(je,{asChild:!0,...d,children:(0,k.jsx)(Je,{id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?o.contentId:void 0,"data-state":_t(n.open),...e,ref:p,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:a(e.onPointerMove,X(t=>{s.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!c.current&&(s.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:a(e.onPointerLeave,X(e=>{f();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,o=t[i?`left`:`right`],c=t[i?`right`:`left`];s.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:o,y:t.top},{x:c,y:t.top},{x:c,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:a(e.onKeyDown,t=>{let i=s.searchRef.current!==``;e.disabled||i&&t.key===` `||xe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});mt.displayName=J;var ht=`MenuSubContent`,gt=O.forwardRef((e,t)=>{let n=Pe(W,e.__scopeMenu),{forceMount:r=n.forceMount,align:o=`start`,...s}=e,c=H(W,e.__scopeMenu),l=U(W,e.__scopeMenu),u=ft(ht,e.__scopeMenu),d=O.useRef(null),f=i(t,d);return(0,k.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(_,{present:r||c.open,children:(0,k.jsx)(z.Slot,{scope:e.__scopeMenu,children:(0,k.jsx)(He,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:f,align:o,side:l.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{l.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:a(e.onFocusOutside,e=>{e.target!==u.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:a(e.onEscapeKeyDown,e=>{l.onClose(),e.preventDefault()}),onKeyDown:a(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Se[l.dir].includes(e.key);t&&n&&(c.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())})})})})})});gt.displayName=ht;function _t(e){return e?`open`:`closed`}function Y(e){return e===`indeterminate`}function vt(e){return Y(e)?`indeterminate`:e?`checked`:`unchecked`}function yt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function bt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=bt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function St(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ct(e,t){return t?St({x:e.clientX,y:e.clientY},t):!1}function X(e){return t=>t.pointerType===`mouse`?e(t):void 0}var wt=ke,Tt=je,Et=Fe,Dt=Re,Ot=We,kt=Ke,At=K,jt=Xe,Mt=et,Nt=nt,Pt=at,Ft=st,It=lt,Lt=pt,Rt=mt,zt=gt,Z=`DropdownMenu`,[Bt,Vt]=f(Z,[Te]),Q=Te(),[Ht,Ut]=Bt(Z),Wt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Q(t),l=O.useRef(null),[u,d]=h({prop:i,defaultProp:a??!1,onChange:o,caller:Z});return(0,k.jsx)(Ht,{scope:t,triggerId:y(),triggerRef:l,contentId:y(),open:u,onOpenChange:d,onOpenToggle:O.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,k.jsx)(wt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Wt.displayName=Z;var Gt=`DropdownMenuTrigger`,Kt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,c=Ut(Gt,n),l=Q(n),u=i(t,c.triggerRef);return(0,k.jsx)(Tt,{asChild:!0,...l,children:(0,k.jsx)(o.button,{type:`button`,id:c.triggerId,"aria-haspopup":`menu`,"aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...s,ref:u,onPointerDown:a(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(c.onOpenToggle(),c.open||e.preventDefault())}),onKeyDown:a(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&c.onOpenToggle(),e.key===`ArrowDown`&&c.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Kt.displayName=Gt;var qt=`DropdownMenuPortal`,Jt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Q(t);return(0,k.jsx)(Et,{...r,...n})};Jt.displayName=qt;var Yt=`DropdownMenuContent`,Xt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ut(Yt,n),o=Q(n),s=O.useRef(!1);return(0,k.jsx)(Dt,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{s.current||i.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:a(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Xt.displayName=Yt;var Zt=`DropdownMenuGroup`,Qt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Ot,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuLabel`,en=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(kt,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuItem`,nn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(At,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuCheckboxItem`,an=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(jt,{...i,...r,ref:t})});an.displayName=rn;var on=`DropdownMenuRadioGroup`,sn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Mt,{...i,...r,ref:t})});sn.displayName=on;var cn=`DropdownMenuRadioItem`,ln=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Nt,{...i,...r,ref:t})});ln.displayName=cn;var un=`DropdownMenuItemIndicator`,dn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Pt,{...i,...r,ref:t})});dn.displayName=un;var fn=`DropdownMenuSeparator`,pn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Ft,{...i,...r,ref:t})});pn.displayName=fn;var mn=`DropdownMenuArrow`,hn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(It,{...i,...r,ref:t})});hn.displayName=mn;var gn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Q(t),[s,c]=h({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,k.jsx)(Lt,{...o,open:s,onOpenChange:c,children:n})},_n=`DropdownMenuSubTrigger`,vn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Rt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`DropdownMenuSubContent`,bn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(zt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});bn.displayName=yn;var xn=Wt,Sn=Kt,Cn=Jt,wn=Xt,Tn=en,En=nn,Dn=an,On=sn,kn=ln,An=dn,jn=pn,Mn=gn,Nn=vn,Pn=bn,$=[`relative flex cursor-pointer select-none items-center gap-2`,`rounded-md px-2 py-1.5 text-body-medium-default outline-none`,`text-[var(--content-secondary)]`,`data-[highlighted]:bg-[var(--surface-hover)]`,`data-[highlighted]:text-[var(--content-emphasised)]`,`data-[disabled]:cursor-not-allowed data-[disabled]:text-[var(--content-disabled)]`,`data-[disabled]:data-[highlighted]:bg-transparent`,`transition-colors`].join(` `),Fn=[`z-50 min-w-[10rem] overflow-hidden rounded-lg bg-[var(--surface-lift)] p-2 shadow-[var(--shadow-popover)]`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`].join(` `),In=xn;function Ln({asChild:e=!0,...t}){return(0,k.jsx)(Sn,{"data-slot":`menu-trigger`,asChild:e,...t})}function Rn({className:e,sideOffset:t=6,collisionPadding:n=8,onPointerDownOutside:r,onCloseAutoFocus:i,ref:a,...o}){let s=c(),l=(0,O.useRef)(!1);return(0,k.jsx)(Cn,{container:s??void 0,children:(0,k.jsx)(wn,{ref:a,"data-slot":`menu-content`,sideOffset:t,collisionPadding:n,onPointerDownOutside:e=>{l.current=!0,r?.(e)},onCloseAutoFocus:e=>{l.current&&=(e.preventDefault(),!1),i?.(e)},className:x(Fn,e),...o})})}function zn({className:e,children:t,leftIcon:n,shortcut:r,ref:i,...a}){return(0,k.jsxs)(En,{ref:i,"data-slot":`menu-item`,className:x($,e),...a,children:[n?(0,k.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-[var(--content-tertiary)]`,"aria-hidden":!0,children:n}):null,(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:r}):null]})}function Bn({className:e,children:t,checked:n,shortcut:r,ref:i,...a}){return(0,k.jsxs)(Dn,{ref:i,checked:n,"data-slot":`menu-checkbox-item`,className:x($,`pl-7`,e),...a,children:[(0,k.jsx)(`span`,{className:`absolute left-1.5 flex h-4 w-4 items-center justify-center`,children:(0,k.jsx)(An,{children:(0,k.jsx)(C,{className:`h-3.5 w-3.5 text-[var(--content-default)]`,"aria-hidden":!0})})}),(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:r}):null]})}function Vn({ref:e,...t}){return(0,k.jsx)(On,{ref:e,"data-slot":`menu-radio-group`,...t})}function Hn({className:e,children:t,shortcut:n,ref:r,...i}){return(0,k.jsxs)(kn,{ref:r,"data-slot":`menu-radio-item`,className:x($,`pl-7`,e),...i,children:[(0,k.jsx)(`span`,{className:`absolute left-1.5 flex h-4 w-4 items-center justify-center`,children:(0,k.jsx)(An,{children:(0,k.jsx)(re,{className:`h-2 w-2 fill-current text-[var(--content-default)]`,"aria-hidden":!0})})}),(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),n?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:n}):null]})}function Un({className:e,ref:t,...n}){return(0,k.jsx)(jn,{ref:t,"data-slot":`menu-separator`,className:x(`my-1 h-px bg-[var(--border-base)]`,e),...n})}function Wn({className:e,ref:t,...n}){return(0,k.jsx)(Tn,{ref:t,"data-slot":`menu-label`,className:x(`px-2 py-1.5 text-body-small-default uppercase tracking-wide`,`text-[var(--content-tertiary)]`,e),...n})}var Gn=Mn;function Kn({className:e,children:t,leftIcon:n,ref:r,...i}){return(0,k.jsxs)(Nn,{ref:r,"data-slot":`menu-sub-trigger`,className:x($,`data-[state=open]:bg-[var(--surface-hover)]`,`data-[state=open]:text-[var(--content-emphasised)]`,e),...i,children:[n?(0,k.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-[var(--content-tertiary)]`,"aria-hidden":!0,children:n}):null,(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),(0,k.jsx)(w,{className:`ml-auto h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":!0})]})}function qn({className:e,ref:t,...n}){let r=c();return(0,k.jsx)(Cn,{container:r??void 0,children:(0,k.jsx)(Pn,{ref:t,"data-slot":`menu-sub-content`,className:x(Fn,e),...n})})}var Jn={Root:In,Trigger:Ln,Content:Rn,Item:zn,CheckboxItem:Bn,RadioGroup:Vn,RadioItem:Hn,Separator:Un,Label:Wn,Sub:Gn,SubTrigger:Kn,SubContent:qn};export{I as C,he as S,Lt as _,It as a,Te as b,Ot as c,kt as d,Et as f,Ft as g,wt as h,Tt as i,At as l,Nt as m,Fn as n,jt as o,Mt as p,$ as r,Dt as s,Jn as t,Pt as u,zt as v,re as w,ge as x,Rt as y};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{B as n,H as r,I as i,L as a,N as o,P as s,R as c,V as l,a as u,c as d,d as f,f as p,l as m,o as h,p as g,s as _,u as v,z as y}from"./button-BwFudwM5.js";import{t as b}from"./jsx-runtime-D3ZM-ToX.js";import{t as x}from"./cn-CJf7MmLX.js";import{t as S}from"./createLucideIcon-CAM1RhH8.js";import{t as C}from"./check-Dt2rQhdg.js";import{t as w}from"./chevron-right-CANAtgGn.js";import{i as ee,n as T,r as te,t as ne}from"./Combination-TPH8qx8I.js";import{n as E,t as D}from"./dist-B5IUaBWa.js";var re=S(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),O=e(t(),1),k=b(),A=`rovingFocusGroup.onEntryFocus`,j={bubbles:!1,cancelable:!0},M=`RovingFocusGroup`,[N,P,F]=E(M),[ie,I]=n(M,[F]),[ae,L]=ie(M),oe=O.forwardRef((e,t)=>(0,k.jsx)(N.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(N.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(se,{...e,ref:t})})}));oe.displayName=M;var se=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:m=!1,...g}=e,_=O.useRef(null),v=l(t,_),y=D(c),[b,x]=h({prop:u,defaultProp:d??null,onChange:f,caller:M}),[S,C]=O.useState(!1),w=i(p),ee=P(n),T=O.useRef(!1),[te,ne]=O.useState(0);return O.useEffect(()=>{let e=_.current;if(e)return e.addEventListener(A,w),()=>e.removeEventListener(A,w)},[w]),(0,k.jsx)(ae,{scope:n,orientation:o,dir:y,loop:s,currentTabStopId:b,onItemFocus:O.useCallback(e=>x(e),[x]),onItemShiftTab:O.useCallback(()=>C(!0),[]),onFocusableItemAdd:O.useCallback(()=>ne(e=>e+1),[]),onFocusableItemRemove:O.useCallback(()=>ne(e=>e-1),[]),children:(0,k.jsx)(a.div,{tabIndex:S||te===0?-1:0,"data-orientation":o,...g,ref:v,style:{outline:`none`,...e.style},onMouseDown:r(e.onMouseDown,()=>{T.current=!0}),onFocus:r(e.onFocus,e=>{let t=!T.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(A,j);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=ee().filter(e=>e.focusable);pe([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),m)}}T.current=!1}),onBlur:r(e.onBlur,()=>C(!1))})})}),ce=`RovingFocusGroupItem`,le=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:i=!0,active:s=!1,tabStopId:c,children:l,...u}=e,d=o(),f=c||d,p=L(ce,n),m=p.currentTabStopId===f,h=P(n),{onFocusableItemAdd:g,onFocusableItemRemove:_,currentTabStopId:v}=p;return O.useEffect(()=>{if(i)return g(),()=>_()},[i,g,_]),(0,k.jsx)(N.ItemSlot,{scope:n,id:f,focusable:i,active:s,children:(0,k.jsx)(a.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...u,ref:t,onMouseDown:r(e.onMouseDown,e=>{i?p.onItemFocus(f):e.preventDefault()}),onFocus:r(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:r(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=fe(e,p.orientation,p.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=p.loop?me(n,r+1):n.slice(r+1)}setTimeout(()=>pe(n))}}),children:typeof l==`function`?l({isCurrentTabStop:m,hasTabStop:v!=null}):l})})});le.displayName=ce;var ue={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function de(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function fe(e,t,n){let r=de(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ue[r]}function pe(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function me(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var he=oe,ge=le,_e=[`Enter`,` `],ve=[`ArrowDown`,`PageUp`,`Home`],ye=[`ArrowUp`,`PageDown`,`End`],be=[...ve,...ye],xe={ltr:[..._e,`ArrowRight`],rtl:[..._e,`ArrowLeft`]},Se={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},R=`Menu`,[z,Ce,we]=E(R),[B,Te]=n(R,[we,g,I]),V=g(),Ee=I(),[De,H]=B(R),[Oe,U]=B(R),ke=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,c=V(t),[l,u]=O.useState(null),d=O.useRef(!1),f=i(o),m=D(a);return O.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),O.useEffect(()=>{if(!n)return;let e=()=>f(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,k.jsx)(p,{...c,children:(0,k.jsx)(De,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,k.jsx)(Oe,{scope:t,onClose:O.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:s,children:r})})})};ke.displayName=R;var Ae=`MenuAnchor`,je=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=V(n);return(0,k.jsx)(m,{...i,...r,ref:t})});je.displayName=Ae;var Me=`MenuPortal`,[Ne,Pe]=B(Me,{forceMount:void 0}),Fe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=H(Me,t);return(0,k.jsx)(Ne,{scope:t,forceMount:n,children:(0,k.jsx)(_,{present:n||a.open,children:(0,k.jsx)(d,{asChild:!0,container:i,children:r})})})};Fe.displayName=Me;var W=`MenuContent`,[Ie,Le]=B(W),Re=O.forwardRef((e,t)=>{let n=Pe(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=H(W,e.__scopeMenu),o=U(W,e.__scopeMenu);return(0,k.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(_,{present:r||a.open,children:(0,k.jsx)(z.Slot,{scope:e.__scopeMenu,children:o.modal?(0,k.jsx)(ze,{...i,ref:t}):(0,k.jsx)(Be,{...i,ref:t})})})})}),ze=O.forwardRef((e,t)=>{let n=H(W,e.__scopeMenu),i=O.useRef(null),a=l(t,i);return O.useEffect(()=>{let e=i.current;if(e)return T(e)},[]),(0,k.jsx)(He,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:r(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Be=O.forwardRef((e,t)=>{let n=H(W,e.__scopeMenu);return(0,k.jsx)(He,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ve=y(`MenuContent.ScrollLock`),He=O.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,disableOutsideScroll:v,...y}=e,b=H(W,n),x=U(W,n),S=V(n),C=Ee(n),w=Ce(n),[T,E]=O.useState(null),D=O.useRef(null),re=l(t,D,b.onContentChange),A=O.useRef(0),j=O.useRef(``),M=O.useRef(0),N=O.useRef(null),P=O.useRef(`right`),F=O.useRef(0),ie=v?ne:O.Fragment,I=v?{as:Ve,allowPinchZoom:!0}:void 0,ae=e=>{let t=j.current+e,n=w().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=xt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){j.current=t,window.clearTimeout(A.current),t!==``&&(A.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};O.useEffect(()=>()=>window.clearTimeout(A.current),[]),ee();let L=O.useCallback(e=>P.current===N.current?.side&&Ct(e,N.current?.area),[]);return(0,k.jsx)(Ie,{scope:n,searchRef:j,onItemEnter:O.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:O.useCallback(e=>{L(e)||(D.current?.focus(),E(null))},[L]),onTriggerLeave:O.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:M,onPointerGraceIntentChange:O.useCallback(e=>{N.current=e},[]),children:(0,k.jsx)(ie,{...I,children:(0,k.jsx)(te,{asChild:!0,trapped:a,onMountAutoFocus:r(o,e=>{e.preventDefault(),D.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:(0,k.jsx)(s,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,children:(0,k.jsx)(he,{asChild:!0,...C,dir:x.dir,orientation:`vertical`,loop:i,currentTabStopId:T,onCurrentTabStopIdChange:E,onEntryFocus:r(d,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,k.jsx)(f,{role:`menu`,"aria-orientation":`vertical`,"data-state":_t(b.open),"data-radix-menu-content":``,dir:x.dir,...S,...y,ref:re,style:{outline:`none`,...y.style},onKeyDown:r(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ae(e.key));let i=D.current;if(e.target!==i||!be.includes(e.key))return;e.preventDefault();let a=w().filter(e=>!e.disabled).map(e=>e.ref.current);ye.includes(e.key)&&a.reverse(),yt(a)}),onBlur:r(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:r(e.onPointerMove,X(e=>{let t=e.target,n=F.current!==e.clientX;e.currentTarget.contains(t)&&n&&(P.current=e.clientX>F.current?`right`:`left`,F.current=e.clientX)}))})})})})})})});Re.displayName=W;var Ue=`MenuGroup`,We=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(a.div,{role:`group`,...r,ref:t})});We.displayName=Ue;var Ge=`MenuLabel`,Ke=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(a.div,{...r,ref:t})});Ke.displayName=Ge;var G=`MenuItem`,qe=`menu.itemSelect`,K=O.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=O.useRef(null),s=U(G,e.__scopeMenu),u=Le(G,e.__scopeMenu),d=l(t,o),f=O.useRef(!1),p=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(qe,{bubbles:!0,cancelable:!0});e.addEventListener(qe,e=>i?.(e),{once:!0}),c(e,t),t.defaultPrevented?f.current=!1:s.onClose()}};return(0,k.jsx)(Je,{...a,ref:d,disabled:n,onClick:r(e.onClick,p),onPointerDown:t=>{e.onPointerDown?.(t),f.current=!0},onPointerUp:r(e.onPointerUp,e=>{f.current||e.currentTarget?.click()}),onKeyDown:r(e.onKeyDown,e=>{let t=u.searchRef.current!==``;n||t&&e.key===` `||_e.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});K.displayName=G;var Je=O.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:o,...s}=e,c=Le(G,n),u=Ee(n),d=O.useRef(null),f=l(t,d),[p,m]=O.useState(!1),[h,g]=O.useState(``);return O.useEffect(()=>{let e=d.current;e&&g((e.textContent??``).trim())},[s.children]),(0,k.jsx)(z.ItemSlot,{scope:n,disabled:i,textValue:o??h,children:(0,k.jsx)(ge,{asChild:!0,...u,focusable:!i,children:(0,k.jsx)(a.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...s,ref:f,onPointerMove:r(e.onPointerMove,X(e=>{i?c.onItemLeave(e):(c.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:r(e.onPointerLeave,X(e=>c.onItemLeave(e))),onFocus:r(e.onFocus,()=>m(!0)),onBlur:r(e.onBlur,()=>m(!1))})})})}),Ye=`MenuCheckboxItem`,Xe=O.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:i,...a}=e;return(0,k.jsx)(rt,{scope:e.__scopeMenu,checked:n,children:(0,k.jsx)(K,{role:`menuitemcheckbox`,"aria-checked":Y(n)?`mixed`:n,...a,ref:t,"data-state":vt(n),onSelect:r(a.onSelect,()=>i?.(Y(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Xe.displayName=Ye;var Ze=`MenuRadioGroup`,[Qe,$e]=B(Ze,{value:void 0,onValueChange:()=>{}}),et=O.forwardRef((e,t)=>{let{value:n,onValueChange:r,...a}=e,o=i(r);return(0,k.jsx)(Qe,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,k.jsx)(We,{...a,ref:t})})});et.displayName=Ze;var tt=`MenuRadioItem`,nt=O.forwardRef((e,t)=>{let{value:n,...i}=e,a=$e(tt,e.__scopeMenu),o=n===a.value;return(0,k.jsx)(rt,{scope:e.__scopeMenu,checked:o,children:(0,k.jsx)(K,{role:`menuitemradio`,"aria-checked":o,...i,ref:t,"data-state":vt(o),onSelect:r(i.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});nt.displayName=tt;var q=`MenuItemIndicator`,[rt,it]=B(q,{checked:!1}),at=O.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=it(q,n);return(0,k.jsx)(_,{present:r||Y(o.checked)||o.checked===!0,children:(0,k.jsx)(a.span,{...i,ref:t,"data-state":vt(o.checked)})})});at.displayName=q;var ot=`MenuSeparator`,st=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(a.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});st.displayName=ot;var ct=`MenuArrow`,lt=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=V(n);return(0,k.jsx)(v,{...i,...r,ref:t})});lt.displayName=ct;var ut=`MenuSub`,[dt,ft]=B(ut),pt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,s=H(ut,t),c=V(t),[l,u]=O.useState(null),[d,f]=O.useState(null),m=i(a);return O.useEffect(()=>(s.open===!1&&m(!1),()=>m(!1)),[s.open,m]),(0,k.jsx)(p,{...c,children:(0,k.jsx)(De,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:f,children:(0,k.jsx)(dt,{scope:t,contentId:o(),triggerId:o(),trigger:l,onTriggerChange:u,children:n})})})};pt.displayName=ut;var J=`MenuSubTrigger`,mt=O.forwardRef((e,t)=>{let n=H(J,e.__scopeMenu),i=U(J,e.__scopeMenu),a=ft(J,e.__scopeMenu),o=Le(J,e.__scopeMenu),s=O.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=o,d={__scopeMenu:e.__scopeMenu},f=O.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);O.useEffect(()=>f,[f]),O.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),u(null)}},[c,u]);let p=l(t,a.onTriggerChange);return(0,k.jsx)(je,{asChild:!0,...d,children:(0,k.jsx)(Je,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":_t(n.open),...e,ref:p,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:r(e.onPointerMove,X(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:r(e.onPointerLeave,X(e=>{f();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:r(e.onKeyDown,t=>{let r=o.searchRef.current!==``;e.disabled||r&&t.key===` `||xe[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});mt.displayName=J;var ht=`MenuSubContent`,gt=O.forwardRef((e,t)=>{let n=Pe(W,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=H(W,e.__scopeMenu),c=U(W,e.__scopeMenu),u=ft(ht,e.__scopeMenu),d=O.useRef(null),f=l(t,d);return(0,k.jsx)(z.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(_,{present:i||s.open,children:(0,k.jsx)(z.Slot,{scope:e.__scopeMenu,children:(0,k.jsx)(He,{id:u.contentId,"aria-labelledby":u.triggerId,...o,ref:f,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:r(e.onFocusOutside,e=>{e.target!==u.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:r(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:r(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Se[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())})})})})})});gt.displayName=ht;function _t(e){return e?`open`:`closed`}function Y(e){return e===`indeterminate`}function vt(e){return Y(e)?`indeterminate`:e?`checked`:`unchecked`}function yt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function bt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=bt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function St(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ct(e,t){return t?St({x:e.clientX,y:e.clientY},t):!1}function X(e){return t=>t.pointerType===`mouse`?e(t):void 0}var wt=ke,Tt=je,Et=Fe,Dt=Re,Ot=We,kt=Ke,At=K,jt=Xe,Mt=et,Nt=nt,Pt=at,Ft=st,It=lt,Lt=pt,Rt=mt,zt=gt,Z=`DropdownMenu`,[Bt,Vt]=n(Z,[Te]),Q=Te(),[Ht,Ut]=Bt(Z),Wt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=Q(t),u=O.useRef(null),[d,f]=h({prop:i,defaultProp:a??!1,onChange:s,caller:Z});return(0,k.jsx)(Ht,{scope:t,triggerId:o(),triggerRef:u,contentId:o(),open:d,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,k.jsx)(wt,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};Wt.displayName=Z;var Gt=`DropdownMenuTrigger`,Kt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...o}=e,s=Ut(Gt,n),c=Q(n),u=l(t,s.triggerRef);return(0,k.jsx)(Tt,{asChild:!0,...c,children:(0,k.jsx)(a.button,{type:`button`,id:s.triggerId,"aria-haspopup":`menu`,"aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...o,ref:u,onPointerDown:r(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:r(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&s.onOpenToggle(),e.key===`ArrowDown`&&s.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Kt.displayName=Gt;var qt=`DropdownMenuPortal`,Jt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Q(t);return(0,k.jsx)(Et,{...r,...n})};Jt.displayName=qt;var Yt=`DropdownMenuContent`,Xt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Ut(Yt,n),o=Q(n),s=O.useRef(!1);return(0,k.jsx)(Dt,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...i,ref:t,onCloseAutoFocus:r(e.onCloseAutoFocus,e=>{s.current||a.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:r(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!a.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Xt.displayName=Yt;var Zt=`DropdownMenuGroup`,Qt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Ot,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuLabel`,en=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(kt,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuItem`,nn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(At,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuCheckboxItem`,an=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(jt,{...i,...r,ref:t})});an.displayName=rn;var on=`DropdownMenuRadioGroup`,sn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Mt,{...i,...r,ref:t})});sn.displayName=on;var cn=`DropdownMenuRadioItem`,ln=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Nt,{...i,...r,ref:t})});ln.displayName=cn;var un=`DropdownMenuItemIndicator`,dn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Pt,{...i,...r,ref:t})});dn.displayName=un;var fn=`DropdownMenuSeparator`,pn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Ft,{...i,...r,ref:t})});pn.displayName=fn;var mn=`DropdownMenuArrow`,hn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(It,{...i,...r,ref:t})});hn.displayName=mn;var gn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Q(t),[s,c]=h({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,k.jsx)(Lt,{...o,open:s,onOpenChange:c,children:n})},_n=`DropdownMenuSubTrigger`,vn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(Rt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`DropdownMenuSubContent`,bn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,k.jsx)(zt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});bn.displayName=yn;var xn=Wt,Sn=Kt,Cn=Jt,wn=Xt,Tn=en,En=nn,Dn=an,On=sn,kn=ln,An=dn,jn=pn,Mn=gn,Nn=vn,Pn=bn,$=[`relative flex cursor-pointer select-none items-center gap-2`,`rounded-md px-2 py-1.5 text-body-medium-default outline-none`,`text-[var(--content-secondary)]`,`data-[highlighted]:bg-[var(--surface-hover)]`,`data-[highlighted]:text-[var(--content-emphasised)]`,`data-[disabled]:cursor-not-allowed data-[disabled]:text-[var(--content-disabled)]`,`data-[disabled]:data-[highlighted]:bg-transparent`,`transition-colors`].join(` `),Fn=[`z-50 min-w-[10rem] overflow-hidden rounded-lg bg-[var(--surface-lift)] p-2 shadow-[var(--shadow-popover)]`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`].join(` `),In=xn;function Ln({asChild:e=!0,...t}){return(0,k.jsx)(Sn,{"data-slot":`menu-trigger`,asChild:e,...t})}function Rn({className:e,sideOffset:t=6,collisionPadding:n=8,onPointerDownOutside:r,onCloseAutoFocus:i,ref:a,...o}){let s=u(),c=(0,O.useRef)(!1);return(0,k.jsx)(Cn,{container:s??void 0,children:(0,k.jsx)(wn,{ref:a,"data-slot":`menu-content`,sideOffset:t,collisionPadding:n,onPointerDownOutside:e=>{c.current=!0,r?.(e)},onCloseAutoFocus:e=>{c.current&&=(e.preventDefault(),!1),i?.(e)},className:x(Fn,e),...o})})}function zn({className:e,children:t,leftIcon:n,shortcut:r,ref:i,...a}){return(0,k.jsxs)(En,{ref:i,"data-slot":`menu-item`,className:x($,e),...a,children:[n?(0,k.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-[var(--content-tertiary)]`,"aria-hidden":!0,children:n}):null,(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:r}):null]})}function Bn({className:e,children:t,checked:n,shortcut:r,ref:i,...a}){return(0,k.jsxs)(Dn,{ref:i,checked:n,"data-slot":`menu-checkbox-item`,className:x($,`pl-7`,e),...a,children:[(0,k.jsx)(`span`,{className:`absolute left-1.5 flex h-4 w-4 items-center justify-center`,children:(0,k.jsx)(An,{children:(0,k.jsx)(C,{className:`h-3.5 w-3.5 text-[var(--content-default)]`,"aria-hidden":!0})})}),(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:r}):null]})}function Vn({ref:e,...t}){return(0,k.jsx)(On,{ref:e,"data-slot":`menu-radio-group`,...t})}function Hn({className:e,children:t,shortcut:n,ref:r,...i}){return(0,k.jsxs)(kn,{ref:r,"data-slot":`menu-radio-item`,className:x($,`pl-7`,e),...i,children:[(0,k.jsx)(`span`,{className:`absolute left-1.5 flex h-4 w-4 items-center justify-center`,children:(0,k.jsx)(An,{children:(0,k.jsx)(re,{className:`h-2 w-2 fill-current text-[var(--content-default)]`,"aria-hidden":!0})})}),(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),n?(0,k.jsx)(`span`,{className:`ml-auto pl-4 text-body-small-default tracking-wide text-[var(--content-tertiary)]`,children:n}):null]})}function Un({className:e,ref:t,...n}){return(0,k.jsx)(jn,{ref:t,"data-slot":`menu-separator`,className:x(`my-1 h-px bg-[var(--border-base)]`,e),...n})}function Wn({className:e,ref:t,...n}){return(0,k.jsx)(Tn,{ref:t,"data-slot":`menu-label`,className:x(`px-2 py-1.5 text-body-small-default uppercase tracking-wide`,`text-[var(--content-tertiary)]`,e),...n})}var Gn=Mn;function Kn({className:e,children:t,leftIcon:n,ref:r,...i}){return(0,k.jsxs)(Nn,{ref:r,"data-slot":`menu-sub-trigger`,className:x($,`data-[state=open]:bg-[var(--surface-hover)]`,`data-[state=open]:text-[var(--content-emphasised)]`,e),...i,children:[n?(0,k.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-[var(--content-tertiary)]`,"aria-hidden":!0,children:n}):null,(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:t}),(0,k.jsx)(w,{className:`ml-auto h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":!0})]})}function qn({className:e,ref:t,...n}){let r=u();return(0,k.jsx)(Cn,{container:r??void 0,children:(0,k.jsx)(Pn,{ref:t,"data-slot":`menu-sub-content`,className:x(Fn,e),...n})})}var Jn={Root:In,Trigger:Ln,Content:Rn,Item:zn,CheckboxItem:Bn,RadioGroup:Vn,RadioItem:Hn,Separator:Un,Label:Wn,Sub:Gn,SubTrigger:Kn,SubContent:qn};export{I as C,he as S,Lt as _,It as a,Te as b,Ot as c,kt as d,Et as f,Ft as g,wt as h,Tt as i,At as l,Nt as m,Fn as n,jt as o,Mt as p,$ as r,Dt as s,Jn as t,Pt as u,zt as v,re as w,ge as x,Rt as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import{t}from"./typography-DEI9Ra9z.js";import"./src-
|
|
1
|
+
import{t as e}from"./jsx-runtime-D3ZM-ToX.js";import{t}from"./typography-DEI9Ra9z.js";import"./src-CwGlaCIx.js";import{t as n}from"./paperclip--f908Kg3.js";import{t as r}from"./use-attachment-squares-Cnn6a6er.js";import{t as i}from"./detail-shell-BuJMM-9z.js";import{t as a}from"./use-transcript-message-by-id-RhDDYgbY.js";var o=[];function s(e){let t=a(e);return t?t.attachments??o:null}var c=e();function l({payload:e,onClose:a}){let{displayAttachments:o,renderSquare:l,previewModal:u}=r({attachments:s(e.messageId)??e.attachments,assistantId:e.assistantId});return(0,c.jsxs)(i,{Glyph:n,titleNode:(0,c.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,c.jsx)(t,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:`Files`}),(0,c.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,c.jsx)(t,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:o.length})]}),closeLabel:`Close files`,onClose:a,children:[o.length===0?(0,c.jsx)(t,{variant:`body-small-default`,className:`py-4 text-center text-[var(--content-tertiary)]`,children:`No files on this message`}):(0,c.jsx)(`div`,{className:`flex flex-wrap items-start gap-3`,children:o.map((e,t)=>l(e,t))}),u]})}export{l as MessageFilesPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./capture-error-CqtAGHQu.js";import{t}from"./assistant-identity-store-B51BX78j.js";import{r as n,t as r}from"./semver-Bfq1LtyW.js";import{n as i}from"./api-errors-BRGPPSWw.js";import{Cn as a,Kr as o,Sn as s,Tn as c,Vr as l,u,wn as d}from"./sdk.gen-CjtCuSlS.js";import{n as f}from"./platform-detection-AHYibqOx.js";import{i as p}from"./viewer-store-
|
|
1
|
+
import{t as e}from"./capture-error-CqtAGHQu.js";import{t}from"./assistant-identity-store-B51BX78j.js";import{r as n,t as r}from"./semver-Bfq1LtyW.js";import{n as i}from"./api-errors-BRGPPSWw.js";import{Cn as a,Kr as o,Sn as s,Tn as c,Vr as l,u,wn as d}from"./sdk.gen-CjtCuSlS.js";import{n as f}from"./platform-detection-AHYibqOx.js";import{i as p}from"./viewer-store-DxLOGAkL.js";import{a as m,r as h}from"./prechat-C4MZwKWX.js";import{t as g}from"./effective-timezone-BX46fWmk.js";var _=/^\[File attachment\] (.+?), type=([^,\n]+?)(?:, size=([^\n]+))?$/,v=/^([\d.]+)\s*(B|KB|MB|GB)$/;function y(e){let t=v.exec(e.trim());if(!t)return 0;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return 0;switch(t[2]){case`B`:return Math.round(n);case`KB`:return Math.round(n*1024);case`MB`:return Math.round(n*1024*1024);case`GB`:return Math.round(n*1024*1024*1024);default:return 0}}function b(e){let t=e.indexOf(`[File attachment] `);if(t<0||!(t===0||e[t-1]===`
|
|
2
2
|
`))return{cleanedContent:e,attachments:void 0};let n=t>0&&e[t-1]===`
|
|
3
3
|
`?e.slice(0,t-1):e.slice(0,t),r=[];for(let n of e.slice(t).split(`
|
|
4
4
|
`)){let e=_.exec(n);if(!e)continue;let[,t,i,a]=e;r.push({id:`rehydrated:${r.length}`,filename:t,mimeType:i,sizeBytes:a?y(a):0,previewUrl:null,thumbnailUrl:null})}return{cleanedContent:n,attachments:r.length>0?r:void 0}}var x=[`users/guardian.md`,`users/default.md`],S=`## Onboarding Context`;function C(e){let t=[S,``];return e.preferredName&&t.push(`- **Preferred name:** ${e.preferredName}`),e.occupation&&t.push(`- **Role:** ${e.occupation}`),e.commonWork.length>0&&t.push(`- **Common work:** ${e.commonWork.join(`; `)}`),e.dailyTools.length>0&&t.push(`- **Daily tools:** ${e.dailyTools.join(`, `)}`),t.push(``),t.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{t as r}from"./typography-DEI9Ra9z.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import"./src-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{t as r}from"./typography-DEI9Ra9z.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import"./src-CwGlaCIx.js";import{t as a}from"./use-reduced-motion-fR0m_opJ.js";var o=i(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),s=e(t(),1),c=n();function l(e){if(e>=1e6){let t=e/1e6;return`${t%1==0?t.toFixed(0):t.toFixed(1)}M`}if(e>=1e3){let t=e/1e3;return`${t%1==0?t.toFixed(0):t.toFixed(1)}K`}return e.toLocaleString()}function u(e){let t=a(),[n,r]=(0,s.useState)(e),i=(0,s.useRef)(e),o=(0,s.useRef)(e),c=(0,s.useRef)(0);return(0,s.useEffect)(()=>{if(o.current=e,t){cancelAnimationFrame(c.current),c.current=0,i.current=e,r(e);return}if(i.current===e||c.current)return;let n=performance.now(),a=i.current,s=e=>{let t=o.current,l=Math.min((e-n)/300,1),u=1-(1-l)**3;i.current=l>=1?t:a+(t-a)*u,r(i.current),l<1?c.current=requestAnimationFrame(s):c.current=0};c.current=requestAnimationFrame(s)},[e,t]),(0,s.useEffect)(()=>()=>cancelAnimationFrame(c.current),[]),n}function d({icon:e,value:t,label:n}){return(0,c.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] px-3 py-3`,children:[(0,c.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:e}),(0,c.jsxs)(`div`,{className:`min-w-0`,children:[(0,c.jsx)(r,{variant:`title-small`,className:`block text-[var(--content-default)]`,children:t}),(0,c.jsx)(r,{variant:`body-small-default`,className:`block text-[var(--content-secondary)]`,children:n})]})]})}function f({icon:e,label:t,target:n,format:r}){return(0,c.jsx)(d,{icon:e,label:t,value:r(u(n))})}export{l as n,o as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-BwFudwM5.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import"./src-CwGlaCIx.js";import{n as i,t as a}from"./use-swipe-engine-Bkqjs1Zk.js";import{t as o}from"./x-D4O9yIS7.js";import{t as s}from"./haptics-C4p_Rjba.js";var c=e(t(),1),l=80;function u({enabled:e,onSwipeLeft:t,onSwipeRight:n,commitThresholdPx:r=l}){return a({enabled:e,axis:`horizontal`,commitThresholdPx:r,touchOnly:!0,onCommit:(0,c.useCallback)(e=>{e<=-r?(s.light(),t?.()):e>=r&&(s.light(),n?.())},[r,t,n])})}var d=r(),f=`(min-width: 640px)`,p=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function m({open:e,onClose:t,children:r,title:i}){let a=(0,c.useRef)(null),s=(0,c.useRef)(null),l=(0,c.useRef)(t);(0,c.useEffect)(()=>{l.current=t});let{dragOffset:m,isDragging:h,onTouchStart:g,onTouchMove:_,onTouchEnd:v,onTouchCancel:y}=u({enabled:e,onSwipeLeft:t});return(0,c.useEffect)(()=>{if(!e)return;s.current?.focus();let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.matchMedia(f),r=e=>{e.matches&&l.current()};n.addEventListener(`change`,r);let i=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),l.current();return}if(e.key!==`Tab`||!a.current)return;let t=a.current.querySelectorAll(p),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,o=a.current.contains(i);e.shiftKey?(!o||i===n)&&(e.preventDefault(),r.focus()):(!o||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n.removeEventListener(`change`,r),document.body.style.overflow=t}},[e]),e?(0,d.jsxs)(`div`,{ref:a,className:`fixed inset-0 sm:hidden`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":i,children:[(0,d.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,d.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`,transform:`translateX(${m}px)`,transition:h?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:g,onTouchMove:_,onTouchEnd:v,onTouchCancel:y,children:[(0,d.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,d.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:i}),(0,d.jsx)(n,{ref:s,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,d.jsx)(o,{"aria-hidden":!0}),onClick:t,"aria-label":`Close`,tintColor:`var(--content-tertiary)`})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})]}):null}function h({onClick:e}){return(0,d.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:(0,d.jsx)(i,{"aria-hidden":!0}),onClick:e,"aria-label":`Open sidebar`,tintColor:`var(--content-secondary)`,className:`sm:hidden`})}export{h as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{a as n}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{a as n}from"./button-BwFudwM5.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./cn-CJf7MmLX.js";import{t as a}from"./x-D4O9yIS7.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-DWcXIgDR.js";var m=e(t(),1),h=r(),g=(0,m.createContext)({}),_={sm:`max-w-[400px]`,md:`max-w-[560px]`,lg:`max-w-[800px]`,xl:`max-w-[1100px]`};function v({onOpenChange:e,...t}){return(0,h.jsx)(g,{value:{onOpenChange:e},children:(0,h.jsx)(p,{onOpenChange:e,...t})})}function y(e){return(0,h.jsx)(s,{"data-slot":`modal-trigger`,...e})}function b({size:e=`md`,hideCloseButton:t=!1,overlayClassName:r,dismissOnOverlayClick:s=!0,className:c,children:f,ref:p,...v}){let y=n(),{onOpenChange:b}=(0,m.useContext)(g);return(0,h.jsx)(u,{container:y??void 0,children:(0,h.jsx)(o,{"data-slot":`modal-overlay`,className:i(`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,r),onClick:e=>{s&&e.target===e.currentTarget&&b?.(!1)},children:(0,h.jsxs)(d,{ref:p,"data-slot":`modal-content`,className:i(`relative flex max-h-[calc(100vh-2rem)] w-full flex-col rounded-xl border shadow-xl`,_[e],`bg-[var(--surface-lift)] border-[var(--border-base)]`,`focus:outline-none`,c),...v,children:[f,t?null:(0,h.jsx)(l,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,"aria-label":`Close`,className:`absolute top-3 right-3 flex h-6 w-6 cursor-pointer items-center justify-center rounded bg-transparent text-[var(--content-secondary)] transition-colors hover:text-[var(--content-default)]`,children:(0,h.jsx)(a,{className:`h-4 w-4`})})})]})})})}function x({icon:e,className:t,children:n,ref:r,...a}){return(0,h.jsxs)(f,{ref:r,"data-slot":`modal-title`,className:i(`flex items-center gap-3 text-title-medium text-[var(--content-default)]`,t),...a,children:[e?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--primary-base) 16%, transparent)`},children:(0,h.jsx)(e,{className:`h-5 w-5 text-[var(--primary-base)]`})}):null,(0,h.jsx)(`span`,{className:`min-w-0 truncate leading-snug`,children:n})]})}function S({className:e,children:t,ref:n,...r}){return(0,h.jsx)(c,{ref:n,"data-slot":`modal-description`,className:i(`mt-1 whitespace-pre-line text-body-medium-lighter text-[var(--content-secondary)]`,e),...r,children:t})}function C(e){return(0,h.jsx)(l,{"data-slot":`modal-close`,...e})}function w({className:e,children:t,...n}){return(0,h.jsx)(`div`,{"data-slot":`modal-header`,className:i(`flex flex-col gap-1 p-4 pr-10`,e),...n,children:t})}function T({className:e,children:t,...n}){return(0,h.jsx)(`div`,{"data-slot":`modal-body`,className:i(`flex-1 overflow-y-auto px-4 pb-4 text-[var(--content-default)]`,e),...n,children:t})}function E({className:e,children:t,...n}){return(0,h.jsx)(`div`,{"data-slot":`modal-footer`,className:i(`flex justify-end gap-2 px-4 py-4`,e),...n,children:t})}var D={Root:v,Trigger:y,Content:b,Title:x,Description:S,Close:C,Header:w,Body:T,Footer:E};export{D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./toast-BHjG1kP8.js";function t(t){return n=>{e.error(n instanceof Error?n.message:t)}}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./button-
|
|
1
|
+
import{t as e}from"./button-BwFudwM5.js";import{u as t}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as n}from"./jsx-runtime-D3ZM-ToX.js";import{t as r}from"./arrow-left-W84B6oJL.js";import{t as i}from"./sparkles-DfEFn3Bh.js";import{d as a}from"./routes-DrfnNoYS.js";import{t as o}from"./proxy-DrtKRLtr.js";import{t as s}from"./use-reduced-motion-fR0m_opJ.js";var c=n(),l={hidden:{},show:{transition:{staggerChildren:.07,delayChildren:.05}}},u={hidden:{opacity:0,y:12},show:{opacity:1,y:0,transition:{duration:.45,ease:[.22,1,.36,1]}}};function d(){let n=t(),d=s();return(0,c.jsxs)(`div`,{"data-slot":`not-found`,className:`relative flex min-h-svh flex-col items-center justify-center overflow-hidden p-6 text-center`,children:[(0,c.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0`,children:[(0,c.jsx)(`div`,{className:`absolute left-1/2 top-1/2 size-[min(120vmin,900px)] -translate-x-1/2 -translate-y-1/2 rounded-full opacity-45 blur-3xl dark:opacity-30`,style:{background:`radial-gradient(circle at center, var(--content-tertiary), transparent 60%)`}}),(0,c.jsx)(`div`,{className:`absolute inset-0 opacity-[0.4]`,style:{backgroundImage:`radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0)`,backgroundSize:`28px 28px`,maskImage:`radial-gradient(ellipse 70% 60% at center, black, transparent 80%)`,WebkitMaskImage:`radial-gradient(ellipse 70% 60% at center, black, transparent 80%)`}}),(0,c.jsx)(o.p,{initial:d?!1:{opacity:0,scale:.96},animate:{opacity:.05,scale:1},transition:{duration:.8,ease:[.22,1,.36,1]},className:`absolute left-1/2 top-[42%] -translate-x-1/2 -translate-y-1/2 select-none text-[38vmin] font-bold leading-none tracking-tighter text-[var(--content-default)]`,children:`404`})]}),(0,c.jsxs)(o.div,{variants:d?void 0:l,initial:d?!1:`hidden`,animate:`show`,className:`relative flex max-w-md flex-col items-center gap-5`,children:[(0,c.jsx)(o.span,{variants:u,className:`rounded-full border border-[var(--border-subtle)] bg-[var(--surface-base)] px-3 py-1 text-label-medium-default uppercase tracking-[0.18em] text-[var(--content-tertiary)]`,children:`Error 404`}),(0,c.jsx)(o.h1,{variants:u,className:`text-3xl font-semibold tracking-tight text-[var(--content-strong)]`,children:`Page not found`}),(0,c.jsx)(o.p,{variants:u,className:`text-body-medium-default text-[var(--content-secondary)]`,children:`The page you're looking for doesn't exist or may have moved.`}),(0,c.jsxs)(o.div,{variants:u,className:`mt-5 flex flex-col items-center gap-2.5`,children:[(0,c.jsx)(e,{variant:`primary`,leftIcon:(0,c.jsx)(i,{}),onClick:()=>n(a.assistant),children:`Back to your assistant`}),(0,c.jsx)(e,{variant:`ghost`,leftIcon:(0,c.jsx)(r,{}),onClick:()=>n(-1),children:`Go back`})]})]})]})}export{d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-CqtAGHQu.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-Dy5001j6.js";import{n as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as a}from"./QueryClientProvider-CMu7CkQU.js";import{t as o}from"./useQuery-Bz-fbQ-m.js";import{t as s}from"./useMutation-CXGTrp4W.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./card-DRIctGVs.js";import{t as u}from"./createLucideIcon-CAM1RhH8.js";import{t as d}from"./bell-2SnK9BVD.js";import{t as f}from"./check-Dt2rQhdg.js";import{t as p}from"./menu-wESJw6y3.js";import{t as m}from"./loader-circle-DWWXcfTQ.js";import{t as h}from"./moon-CHW45huN.js";import{t as g}from"./triangle-alert-D6bAGtMw.js";import{t as _}from"./notice-Dslxs3H6.js";import{t as v}from"./popover-B-3isZCV.js";import{t as y}from"./input-tXUFa7Eo.js";import{n as b,t as x}from"./panel-item-CJh95P_q.js";import{n as S}from"./toast-BtFgiPe3.js";import{i as C,t as w}from"./dist-an0Z446E.js";import{d as T}from"./routes-DrfnNoYS.js";import{d as E,o as D}from"./platform-detection-AHYibqOx.js";import{i as O,r as k,t as A}from"./use-platform-gate-C5bNA5Pn.js";import{t as j}from"./use-bus-subscription-DiCq1_ki.js";import{n as M}from"./use-is-mobile-MmHo-OM6.js";import{a as N,n as P}from"./notifications-BTG4cTbF.js";import{Ct as F,St as I,_t as L,bt as R,vt as z,xt as B,yt as V}from"./react-query.gen-BtYBixpk.js";import{t as H}from"./platform-login-notice-DFmjUE9q.js";import{r as U}from"./format-date-CQUMvfqf.js";import{t as W}from"./mutation-error-YLfUU5XL.js";var G=u(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),K=u(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),q=e(n(),1),J=C(`AndroidNotificationSettings`);function Y(){return D()&&w.isPluginAvailable(`AndroidNotificationSettings`)}async function ee(){if(Y())try{await J.open()}catch(e){t(e,{context:`android_notification_settings_open`,level:`warning`})}}var X=c();function te(){let e=E(),t=Y(),[n,i]=(0,q.useState)(null);return(0,q.useEffect)(()=>{e&&P().then(i)},[e]),j(`app.resume`,()=>{e&&N().then(i)}),e?(0,X.jsxs)(l,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Native alerts`}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:n===`granted`?`Enabled for this device.`:`Receive alerts when the app is closed.`})]}),t&&(0,X.jsx)(r,{variant:`outlined`,size:`regular`,onClick:()=>void ee(),disabled:n===null,children:`System settings`})]}):null}function Z(e){e.invalidateQueries({queryKey:V()}),e.invalidateQueries({queryKey:F()})}function ne(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var Q=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}];function re({notificationId:e,currentlySnoozed:t,children:n}){let r=a(),i=s(I()),o=M(),[c,l]=(0,q.useState)(!1),u=()=>Z(r),d=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();i.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:u,onError:W(`Failed to snooze notification`)})},f=()=>{i.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:u,onError:W(`Failed to clear snooze`)})};return o?(0,X.jsxs)(b.Root,{open:c,onOpenChange:l,children:[(0,X.jsx)(b.Trigger,{asChild:!0,children:n}),(0,X.jsxs)(b.Content,{children:[(0,X.jsx)(b.Header,{children:(0,X.jsx)(b.Title,{children:`Snooze until…`})}),(0,X.jsxs)(b.Body,{children:[Q.map(({label:e,hours:t})=>(0,X.jsx)(x,{label:e,onSelect:()=>{i.isPending||(l(!1),d(t))}},e)),t&&(0,X.jsx)(x,{label:`Clear snooze`,onSelect:()=>{i.isPending||(l(!1),f())}})]})]})]}):(0,X.jsxs)(p.Root,{open:c,onOpenChange:l,children:[(0,X.jsx)(p.Trigger,{children:n}),(0,X.jsxs)(p.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,X.jsx)(p.Label,{children:`Snooze until…`}),Q.map(({label:e,hours:t})=>(0,X.jsx)(p.Item,{disabled:i.isPending,onSelect:()=>d(t),children:e},e)),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p.Separator,{}),(0,X.jsx)(p.Item,{disabled:i.isPending,onSelect:()=>f(),children:`Clear snooze`})]})]})]})}function $({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:r,hideTitle:i=!1}){let o=a(),c=s(R()),l=s(B()),[u,d]=(0,q.useState)(``),f=()=>Z(o),p=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),f(),t()},onError:W(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{r(e),f(),t()},onError:W(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,X.jsxs)(`div`,{children:[!i&&(0,X.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,X.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,U(e.expires_at)]})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,X.jsx)(y,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,X.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function ie({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=ne(e),a=!e.is_read;return(0,X.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,X.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,X.jsx)(g,{className:`h-3 w-3`}),`Alert`]}),i&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,X.jsx)(h,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,X.jsx)(f,{className:`h-3 w-3`}),`Resolved`]})]}),(0,X.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,X.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,X.jsxs)(`span`,{children:[`Last seen `,U(e.last_seen_at)]}),e.occurrence_count>1&&(0,X.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,X.jsx)(f,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,X.jsx)(re,{notificationId:e.id,currentlySnoozed:i,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,X.jsx)(h,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function ae(){let e=O({platformHostedOnly:!0}),t=A(),n=k(),r=a(),c=M(),[l,u]=(0,q.useState)(`open`),[f,p]=(0,q.useState)(!1),[h,g]=(0,q.useState)([]),{data:y,isLoading:x,isError:C,refetch:w}=o({...z({query:{status:l}}),enabled:e===`full`&&t}),E=e===`full`&&n||(t?x:!1);(0,q.useEffect)(()=>{!t&&f&&p(!1)},[t,f]);let D=t?C:!1,j=t?y?.results??[]:[],N=j.filter(e=>!e.is_read&&!e.is_resolved),P=s(L()),[F,I]=(0,q.useState)(new Set),[R,B]=(0,q.useState)(!1),V=(0,q.useCallback)(()=>Z(r),[r]),U=async(e,t)=>{I(t=>new Set(t).add(e));try{await P.mutateAsync({path:{id:e},body:{acknowledged:t}}),V()}catch(e){S.error(e instanceof Error?e.message:`Failed to update notification`)}finally{I(t=>{let n=new Set(t);return n.delete(e),n})}},W=async()=>{if(!(N.length===0||R)){B(!0);try{await Promise.allSettled(N.map(e=>P.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{V(),B(!1)}}},J=(0,X.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,X.jsx)(G,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Y=(0,X.jsx)($,{existingRules:h,onClose:()=>p(!1),onPauseCreated:e=>g(t=>[...t,e]),onPauseDeleted:e=>g(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,X.jsx)(i,{replace:!0,to:T.settings.general}):e===`disabled`?(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,X.jsx)(H,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(c?(0,X.jsxs)(b.Root,{open:f,onOpenChange:p,children:[(0,X.jsx)(b.Trigger,{asChild:!0,children:J}),(0,X.jsxs)(b.Content,{children:[(0,X.jsx)(b.Header,{children:(0,X.jsx)(b.Title,{children:`Pause alerts`})}),(0,X.jsx)(b.Body,{children:(0,X.jsx)($,{existingRules:h,onClose:()=>p(!1),onPauseCreated:e=>g(t=>[...t,e]),onPauseDeleted:e=>g(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,X.jsxs)(v.Root,{open:f,onOpenChange:p,children:[(0,X.jsx)(v.Trigger,{asChild:!0,children:J}),(0,X.jsx)(v.Content,{align:`end`,className:`w-72`,children:Y})]}))]}),(0,X.jsx)(te,{}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=l===e;return(0,X.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),l===`open`&&N.length>1&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void W(),disabled:R,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[R?(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,X.jsx)(K,{className:`h-3 w-3`}),`Mark all as read (`,N.length,`)`]})]}),E?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,X.jsx)(m,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):D?(0,X.jsxs)(_,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,X.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):j.length===0?(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,X.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,X.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,l,` notifications`]}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,X.jsx)(`div`,{className:`space-y-3`,children:j.map(e=>(0,X.jsx)(ie,{notification:e,onAck:(e,t)=>void U(e,t),isAcking:F.has(e.id)},e.id))})]})}export{ae as NotificationsPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-CqtAGHQu.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-BwFudwM5.js";import{n as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as a}from"./QueryClientProvider-CMu7CkQU.js";import{t as o}from"./useQuery-Bz-fbQ-m.js";import{t as s}from"./useMutation-CXGTrp4W.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./card-DRIctGVs.js";import{t as u}from"./createLucideIcon-CAM1RhH8.js";import{t as d}from"./bell-2SnK9BVD.js";import{t as f}from"./check-Dt2rQhdg.js";import{t as p}from"./menu-Cfi4A3sw.js";import{t as m}from"./loader-circle-DWWXcfTQ.js";import{t as h}from"./moon-CHW45huN.js";import{t as g}from"./triangle-alert-D6bAGtMw.js";import{t as _}from"./notice-Dslxs3H6.js";import{t as v}from"./popover-CBYgK7Wt.js";import{t as y}from"./input-CgGeKtja.js";import{n as b,t as x}from"./panel-item-5YQ3jbso.js";import{n as S}from"./toast-BHjG1kP8.js";import{i as C,t as w}from"./dist-an0Z446E.js";import{d as T}from"./routes-DrfnNoYS.js";import{d as E,o as D}from"./platform-detection-AHYibqOx.js";import{i as O,r as k,t as A}from"./use-platform-gate-C5bNA5Pn.js";import{t as j}from"./use-bus-subscription-DiCq1_ki.js";import{n as M}from"./use-is-mobile-MmHo-OM6.js";import{a as N,n as P}from"./notifications-BTG4cTbF.js";import{Ct as F,St as I,_t as L,bt as R,vt as z,xt as B,yt as V}from"./react-query.gen-BtYBixpk.js";import{t as H}from"./platform-login-notice-DvWjpI2S.js";import{r as U}from"./format-date-CQUMvfqf.js";import{t as W}from"./mutation-error-Cp0Jaqnt.js";var G=u(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),K=u(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),q=e(n(),1),J=C(`AndroidNotificationSettings`);function Y(){return D()&&w.isPluginAvailable(`AndroidNotificationSettings`)}async function ee(){if(Y())try{await J.open()}catch(e){t(e,{context:`android_notification_settings_open`,level:`warning`})}}var X=c();function te(){let e=E(),t=Y(),[n,i]=(0,q.useState)(null);return(0,q.useEffect)(()=>{e&&P().then(i)},[e]),j(`app.resume`,()=>{e&&N().then(i)}),e?(0,X.jsxs)(l,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Native alerts`}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:n===`granted`?`Enabled for this device.`:`Receive alerts when the app is closed.`})]}),t&&(0,X.jsx)(r,{variant:`outlined`,size:`regular`,onClick:()=>void ee(),disabled:n===null,children:`System settings`})]}):null}function Z(e){e.invalidateQueries({queryKey:V()}),e.invalidateQueries({queryKey:F()})}function ne(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var Q=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}];function re({notificationId:e,currentlySnoozed:t,children:n}){let r=a(),i=s(I()),o=M(),[c,l]=(0,q.useState)(!1),u=()=>Z(r),d=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();i.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:u,onError:W(`Failed to snooze notification`)})},f=()=>{i.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:u,onError:W(`Failed to clear snooze`)})};return o?(0,X.jsxs)(b.Root,{open:c,onOpenChange:l,children:[(0,X.jsx)(b.Trigger,{asChild:!0,children:n}),(0,X.jsxs)(b.Content,{children:[(0,X.jsx)(b.Header,{children:(0,X.jsx)(b.Title,{children:`Snooze until…`})}),(0,X.jsxs)(b.Body,{children:[Q.map(({label:e,hours:t})=>(0,X.jsx)(x,{label:e,onSelect:()=>{i.isPending||(l(!1),d(t))}},e)),t&&(0,X.jsx)(x,{label:`Clear snooze`,onSelect:()=>{i.isPending||(l(!1),f())}})]})]})]}):(0,X.jsxs)(p.Root,{open:c,onOpenChange:l,children:[(0,X.jsx)(p.Trigger,{children:n}),(0,X.jsxs)(p.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,X.jsx)(p.Label,{children:`Snooze until…`}),Q.map(({label:e,hours:t})=>(0,X.jsx)(p.Item,{disabled:i.isPending,onSelect:()=>d(t),children:e},e)),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p.Separator,{}),(0,X.jsx)(p.Item,{disabled:i.isPending,onSelect:()=>f(),children:`Clear snooze`})]})]})]})}function $({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:r,hideTitle:i=!1}){let o=a(),c=s(R()),l=s(B()),[u,d]=(0,q.useState)(``),f=()=>Z(o),p=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),f(),t()},onError:W(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{r(e),f(),t()},onError:W(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,X.jsxs)(`div`,{children:[!i&&(0,X.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,X.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,U(e.expires_at)]})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,X.jsx)(y,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,X.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function ie({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=ne(e),a=!e.is_read;return(0,X.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,X.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,X.jsx)(g,{className:`h-3 w-3`}),`Alert`]}),i&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,X.jsx)(h,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,X.jsx)(f,{className:`h-3 w-3`}),`Resolved`]})]}),(0,X.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,X.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,X.jsxs)(`span`,{children:[`Last seen `,U(e.last_seen_at)]}),e.occurrence_count>1&&(0,X.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,X.jsx)(f,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,X.jsx)(re,{notificationId:e.id,currentlySnoozed:i,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,X.jsx)(h,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function ae(){let e=O({platformHostedOnly:!0}),t=A(),n=k(),r=a(),c=M(),[l,u]=(0,q.useState)(`open`),[f,p]=(0,q.useState)(!1),[h,g]=(0,q.useState)([]),{data:y,isLoading:x,isError:C,refetch:w}=o({...z({query:{status:l}}),enabled:e===`full`&&t}),E=e===`full`&&n||(t?x:!1);(0,q.useEffect)(()=>{!t&&f&&p(!1)},[t,f]);let D=t?C:!1,j=t?y?.results??[]:[],N=j.filter(e=>!e.is_read&&!e.is_resolved),P=s(L()),[F,I]=(0,q.useState)(new Set),[R,B]=(0,q.useState)(!1),V=(0,q.useCallback)(()=>Z(r),[r]),U=async(e,t)=>{I(t=>new Set(t).add(e));try{await P.mutateAsync({path:{id:e},body:{acknowledged:t}}),V()}catch(e){S.error(e instanceof Error?e.message:`Failed to update notification`)}finally{I(t=>{let n=new Set(t);return n.delete(e),n})}},W=async()=>{if(!(N.length===0||R)){B(!0);try{await Promise.allSettled(N.map(e=>P.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{V(),B(!1)}}},J=(0,X.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,X.jsx)(G,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Y=(0,X.jsx)($,{existingRules:h,onClose:()=>p(!1),onPauseCreated:e=>g(t=>[...t,e]),onPauseDeleted:e=>g(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,X.jsx)(i,{replace:!0,to:T.settings.general}):e===`disabled`?(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,X.jsx)(H,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,X.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(c?(0,X.jsxs)(b.Root,{open:f,onOpenChange:p,children:[(0,X.jsx)(b.Trigger,{asChild:!0,children:J}),(0,X.jsxs)(b.Content,{children:[(0,X.jsx)(b.Header,{children:(0,X.jsx)(b.Title,{children:`Pause alerts`})}),(0,X.jsx)(b.Body,{children:(0,X.jsx)($,{existingRules:h,onClose:()=>p(!1),onPauseCreated:e=>g(t=>[...t,e]),onPauseDeleted:e=>g(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,X.jsxs)(v.Root,{open:f,onOpenChange:p,children:[(0,X.jsx)(v.Trigger,{asChild:!0,children:J}),(0,X.jsx)(v.Content,{align:`end`,className:`w-72`,children:Y})]}))]}),(0,X.jsx)(te,{}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=l===e;return(0,X.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),l===`open`&&N.length>1&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void W(),disabled:R,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[R?(0,X.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,X.jsx)(K,{className:`h-3 w-3`}),`Mark all as read (`,N.length,`)`]})]}),E?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,X.jsx)(m,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):D?(0,X.jsxs)(_,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,X.jsx)(`button`,{type:`button`,onClick:()=>void w(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):j.length===0?(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,X.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,X.jsx)(d,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,X.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,l,` notifications`]}),(0,X.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,X.jsx)(`div`,{className:`space-y-3`,children:j.map(e=>(0,X.jsx)(ie,{notification:e,onAck:(e,t)=>void U(e,t),isAcking:F.has(e.id)},e.id))})]})}export{ae as NotificationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{i as n}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{i as n}from"./button-BwFudwM5.js";import{t as r}from"./jsx-runtime-D3ZM-ToX.js";import{t as i}from"./public-asset-OTnPMErp.js";var a=e(t(),1),o=r();function s({className:e=``}){return(0,o.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed bottom-0 left-0 right-0 flex justify-center overflow-hidden ${e}`,children:(0,o.jsx)(`img`,{src:i(`/login-background-characters.svg`),alt:``,width:1200,height:180,className:`w-full max-w-[900px] object-cover object-bottom`})})}function c({children:e,showCreatureFooter:t=!0}){let[r,i]=(0,a.useState)(null);return(0,o.jsxs)(`div`,{className:`relative flex h-full flex-col bg-[var(--surface-base)]`,children:[(0,o.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,o.jsx)(n,{container:r,children:e})}),t&&(0,o.jsx)(s,{}),(0,o.jsx)(`div`,{ref:i})]})}export{c as t};
|