@lunora/studio 1.0.0-alpha.146 → 1.0.0-alpha.147
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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +3 -3
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +7 -8
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/analytics-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/auth-config-panel.mjs +1 -1
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/log-drains-panel.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/organizations-panel.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/sync-client-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/users-panel.mjs +1 -1
- package/dist/packem_chunks/vector-browser.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/{ApiDocsPanel-CHCIjzZu.mjs → ApiDocsPanel-BImfQhyJ.mjs} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-Cqy9Z7mO.mjs → ApiReferencePanel-B4i-KeOf.mjs} +1 -1
- package/dist/packem_shared/{CommandPalette-DtLEYVhX.mjs → CommandPalette-CSdz9zax.mjs} +1 -1
- package/dist/packem_shared/DataBrowser-Bpj-0P1G.mjs +4 -0
- package/dist/packem_shared/{GlobalDataBrowser-CDpzXZxj.mjs → GlobalDataBrowser-BTbqR6Wc.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-4gpRjcch.mjs → HomePanel-_BwLI4TQ.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-Cz0x3Pv6.mjs → MigrationsPanel-BPWzFdxC.mjs} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-DZicbIOf.mjs → OpenRpcReferencePanel-BKJEX7we.mjs} +1 -1
- package/dist/packem_shared/{ScheduledJobs-BWziDVZO.mjs → ScheduledJobs-B4DPADwk.mjs} +1 -1
- package/dist/packem_shared/{Studio-C_yEjXcG.mjs → Studio-CcWQdYrV.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-BQAxVB3v.mjs → StudioApp-B5jLGbeH.mjs} +1 -1
- package/dist/packem_shared/{advisor-view-DyXQCN4y.mjs → advisor-view-CPgOok_h.mjs} +1 -1
- package/dist/packem_shared/{data-grid-B8WGnT-5.mjs → data-grid-DTBAKZlm.mjs} +1 -1
- package/dist/packem_shared/{error-alert-ClpDVYvo.mjs → error-alert-tf5zvSLV.mjs} +1 -1
- package/dist/packem_shared/{grid-features-CGs2pKcr.mjs → grid-features-Dl7bCGRN.mjs} +4 -4
- package/dist/packem_shared/{home-panel-CHtt8k50.mjs → home-panel-DCUKd8Uk.mjs} +1 -1
- package/dist/packem_shared/internal-B6haJbiP.mjs +2 -0
- package/dist/packem_shared/{log-line-DpRfHaVQ.mjs → log-line-BoObzuue.mjs} +1 -1
- package/dist/packem_shared/{recording-client-CMvFFEC0.mjs → recording-client-BXUIyBL4.mjs} +1 -1
- package/dist/packem_shared/{reference-view-DS7FFPpP.mjs → reference-view-AC9FgXSz.mjs} +1 -1
- package/dist/packem_shared/{schema-diagram-C27ETi10.mjs → schema-diagram-CDj_69jF.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-BLIMecXM.mjs → sql-result-table-C5y0jwaK.mjs} +1 -1
- package/dist/packem_shared/{studio-DF0GqQBP.mjs → studio-OqNyRY1N.mjs} +1 -1
- package/dist/packem_shared/table-list-sidebar-DHG1UJC4.mjs +1 -0
- package/dist/packem_shared/{use-admin-query-BvZH4unR.mjs → use-admin-query-BKXiqLci.mjs} +1 -1
- package/dist/packem_shared/{use-async-submit-C1A11ka9.mjs → use-async-submit-BTr3w2-K.mjs} +1 -1
- package/dist/packem_shared/{use-auth-config-DocoJ5uQ.mjs → use-auth-config-BQKGdSFh.mjs} +1 -1
- package/dist/packem_shared/{use-open-trace-CTQIPjo9.mjs → use-open-trace-BCW0c9qq.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-BGoWYcGL.mjs → use-sql-assistant-BhIMDQHV.mjs} +1 -1
- package/dist/packem_shared/{wire-codec-BE-vgg1L.mjs → wire-codec-C0jSa3ZC.mjs} +1 -1
- package/dist/standalone/{chunk-6T3STPM7.js → chunk-2ES4GR4C.js} +1 -1
- package/dist/standalone/{chunk-HLE46T7J.js → chunk-2GPQJLCR.js} +1 -1
- package/dist/standalone/chunk-2GZVY7CX.js +1 -0
- package/dist/standalone/chunk-2LN3T5HY.js +15 -0
- package/dist/standalone/{chunk-5L3SHBMK.js → chunk-2LOBQ4CX.js} +1 -1
- package/dist/standalone/{chunk-E6LDY3TC.js → chunk-2Z5PSAHC.js} +1 -1
- package/dist/standalone/{chunk-3BFUVYWS.js → chunk-3CGQYQDZ.js} +1 -1
- package/dist/standalone/{chunk-UZ5QI3PB.js → chunk-3KDC7UYQ.js} +1 -1
- package/dist/standalone/{chunk-HQPQTWW4.js → chunk-4R6AMNIM.js} +1 -1
- package/dist/standalone/{chunk-XABVLLMA.js → chunk-4XIC6MLF.js} +1 -1
- package/dist/standalone/{chunk-RFTFYKFL.js → chunk-5EWLJXES.js} +1 -1
- package/dist/standalone/{chunk-PWHV7BUN.js → chunk-5K2UDZLN.js} +1 -1
- package/dist/standalone/{chunk-MHLBCDVW.js → chunk-5OFSVXDU.js} +1 -1
- package/dist/standalone/chunk-6DQKYWZI.js +1 -0
- package/dist/standalone/{chunk-6NO6WOSN.js → chunk-6UG4S7I7.js} +1 -1
- package/dist/standalone/chunk-7BRTPMJO.js +1 -0
- package/dist/standalone/{chunk-EDYGNYP2.js → chunk-7IY5BR52.js} +1 -1
- package/dist/standalone/{chunk-KLQEN4KA.js → chunk-A4UOWQOI.js} +1 -1
- package/dist/standalone/{chunk-5JEYBOS6.js → chunk-BOTGXX4H.js} +1 -1
- package/dist/standalone/{chunk-2KAH7DVZ.js → chunk-BVRZVNKL.js} +1 -1
- package/dist/standalone/{chunk-PEEGF7YA.js → chunk-CZY6LNTK.js} +2 -2
- package/dist/standalone/{chunk-CZU3LZ2O.js → chunk-DLT5B4TL.js} +1 -1
- package/dist/standalone/{chunk-L3JA4OKZ.js → chunk-DX6FAHR2.js} +1 -1
- package/dist/standalone/{chunk-IAWCSJRR.js → chunk-EERTS7JH.js} +1 -1
- package/dist/standalone/{chunk-SMVAE2AQ.js → chunk-EHSU2WDS.js} +1 -1
- package/dist/standalone/chunk-FIACUWE5.js +1 -0
- package/dist/standalone/{chunk-NXKPFGOP.js → chunk-FODLDLE2.js} +8 -8
- package/dist/standalone/{chunk-DDI4VSJH.js → chunk-GDB2JX2H.js} +1 -1
- package/dist/standalone/{chunk-MDVH5C5A.js → chunk-GIOZAYBS.js} +1 -1
- package/dist/standalone/{chunk-DMPVOWA7.js → chunk-GWW7SJR6.js} +1 -1
- package/dist/standalone/{chunk-IYYZMNOB.js → chunk-HR42URDR.js} +1 -1
- package/dist/standalone/{chunk-H3UCYGKY.js → chunk-HRYPE4NU.js} +1 -1
- package/dist/standalone/{chunk-E723DEAW.js → chunk-IABM4BFJ.js} +1 -1
- package/dist/standalone/{chunk-ZZENQM5W.js → chunk-INWAISDG.js} +4 -4
- package/dist/standalone/{chunk-VSHZE77Y.js → chunk-JAKYTDUH.js} +1 -1
- package/dist/standalone/chunk-JOYK6ITY.js +1 -0
- package/dist/standalone/{chunk-CIQRB2ET.js → chunk-JWPJS6AI.js} +1 -1
- package/dist/standalone/{chunk-JOQUDV7F.js → chunk-JY4ANRPG.js} +1 -1
- package/dist/standalone/{chunk-YL7OENDU.js → chunk-KCEVLJ65.js} +1 -1
- package/dist/standalone/{chunk-H5PZ7JXM.js → chunk-KJ4YYMID.js} +1 -1
- package/dist/standalone/{chunk-BQ4P3PLU.js → chunk-KQFH6FFC.js} +1 -1
- package/dist/standalone/{chunk-7B3OQXWL.js → chunk-LFDP6ANM.js} +1 -1
- package/dist/standalone/{chunk-MJG6GTPL.js → chunk-LJYUUOBB.js} +1 -1
- package/dist/standalone/{chunk-BN5TOI5O.js → chunk-LK4TLRSU.js} +1 -1
- package/dist/standalone/{chunk-AJQKSUVQ.js → chunk-MNGNHBOS.js} +1 -1
- package/dist/standalone/chunk-N74RUMRA.js +7 -0
- package/dist/standalone/{chunk-447V2Q3F.js → chunk-NZ57KZSG.js} +1 -1
- package/dist/standalone/{chunk-VXWAQW3F.js → chunk-OEVYSTUL.js} +1 -1
- package/dist/standalone/{chunk-JRN7SEJN.js → chunk-OSLV4PT6.js} +1 -1
- package/dist/standalone/chunk-PIGJKRDD.js +3 -0
- package/dist/standalone/{chunk-OUD7BAWE.js → chunk-PL664H45.js} +1 -1
- package/dist/standalone/{chunk-YWYJLVEP.js → chunk-QNSRFASE.js} +1 -1
- package/dist/standalone/{chunk-2IUHQB2Q.js → chunk-QYEQOTRN.js} +7 -8
- package/dist/standalone/{chunk-B5WPIRI3.js → chunk-R5QR5EZZ.js} +1 -1
- package/dist/standalone/{chunk-HDWOQTDN.js → chunk-RDYIEOYN.js} +1 -1
- package/dist/standalone/{chunk-GMEE5NFG.js → chunk-SLFPZM2C.js} +1 -1
- package/dist/standalone/{chunk-TWXJF4C2.js → chunk-SU737V7V.js} +1 -1
- package/dist/standalone/{chunk-EX33M5EE.js → chunk-T3VYCKM7.js} +1 -1
- package/dist/standalone/{chunk-3JV5F5SY.js → chunk-TIUMFAN2.js} +1 -1
- package/dist/standalone/{chunk-7MJY23GU.js → chunk-VGJ6HFCF.js} +1 -1
- package/dist/standalone/{chunk-JSXJND3V.js → chunk-VLCHF5SE.js} +1 -1
- package/dist/standalone/{chunk-CKKZCUAV.js → chunk-VWFNJLMK.js} +1 -1
- package/dist/standalone/{chunk-V5M356X3.js → chunk-VWXU7LIX.js} +1 -1
- package/dist/standalone/{chunk-2IRZXHAZ.js → chunk-WWXSQVPE.js} +1 -1
- package/dist/standalone/{chunk-RNZ7XXND.js → chunk-WXRI2LBR.js} +1 -1
- package/dist/standalone/{chunk-XGPF7VOP.js → chunk-XHM5CP2I.js} +1 -1
- package/dist/standalone/{chunk-IDB7SMQU.js → chunk-XVX3KH35.js} +1 -1
- package/dist/standalone/chunk-XZCNX7YU.js +11 -0
- package/dist/standalone/{chunk-VHMOFAJT.js → chunk-YCEVUCMI.js} +1 -1
- package/dist/standalone/{chunk-3DL3MLWV.js → chunk-ZLPC3XZF.js} +1 -1
- package/dist/standalone/chunk-ZTDD3M5D.js +1 -0
- package/dist/standalone/{chunk-46XX646F.js → chunk-ZYCM7BV2.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/DataBrowser-Bf32rBcr.mjs +0 -4
- package/dist/packem_shared/internal-D4gBuklE.mjs +0 -2
- package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +0 -1
- package/dist/packem_shared/table-list-sidebar-DKpSAP6p.mjs +0 -1
- package/dist/standalone/chunk-2L64LHIR.js +0 -1
- package/dist/standalone/chunk-3HEXTCWR.js +0 -1
- package/dist/standalone/chunk-5AUOM7FK.js +0 -1
- package/dist/standalone/chunk-FZKQX74O.js +0 -1
- package/dist/standalone/chunk-IB3MWLG4.js +0 -1
- package/dist/standalone/chunk-JMNCMGSE.js +0 -1
- package/dist/standalone/chunk-L2OWXMYF.js +0 -1
- package/dist/standalone/chunk-QPVND4TE.js +0 -3
- package/dist/standalone/chunk-RIO2HPN7.js +0 -15
- package/dist/standalone/chunk-UKQTCLDK.js +0 -7
- package/dist/standalone/chunk-W3Q32C24.js +0 -11
- /package/dist/standalone/{chunk-7AU5QSY7.js → chunk-LSWAITBZ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as q}from"react/compiler-runtime";import{useLunora as I}from"@lunora/react";import{B as _}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as R,a as H}from"../packem_shared/card--2hKx4L2.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as j,a as B,b as w,c as l,d as K,e as r}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Q}from"../packem_shared/use-admin-query-
|
|
1
|
+
import{c as q}from"react/compiler-runtime";import{useLunora as I}from"@lunora/react";import{B as _}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as R,a as H}from"../packem_shared/card--2hKx4L2.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as j,a as B,b as w,c as l,d as K,e as r}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Q}from"../packem_shared/use-admin-query-BKXiqLci.mjs";import{useAutoRefresh as V}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsx as n,jsxs as s}from"react/jsx-runtime";const $=2e3,z=new Set(["open"]),ie=W=>{const e=q(41),{read:S}=W,t=Y(),L=I();let T;e[0]!==L||e[1]!==S?(T=()=>Promise.resolve(S?S():L.debug()),e[0]=L,e[1]=S,e[2]=T):T=e[2];const M=T,A=S?"injected":"live";let x;e[3]!==A?(x=["lunora-studio","sync-client-debug",A],e[3]=A,e[4]=x):x=e[4];const{data:c,refetch:O}=Q(x,M);if(V(O,!0,$),!c){let i;e[5]!==t?(i=t("Reading the sync client's state…"),e[5]=t,e[6]=i):i=e[6];let g;e[7]!==t?(g=t("Sync client"),e[7]=t,e[8]=g):g=e[8];let k;return e[9]!==i||e[10]!==g?(k=n(R,{children:n(H,{children:n(P,{description:i,title:g})})}),e[9]=i,e[10]=g,e[11]=k):k=e[11],k}const{pendingWrites:v,shards:C,subscriptions:b}=c;let a;e[12]!==t?(a=t("This Studio session's sync client"),e[12]=t,e[13]=a):a=e[13];let o;e[14]!==a?(o=n("span",{className:"text-sm font-medium",children:a}),e[14]=a,e[15]=o):o=e[15];const E=c.connectionStatus==="connected"?"default":"secondary";let d;e[16]!==c.connectionStatus||e[17]!==E?(d=n(_,{variant:E,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=E,e[18]=d):d=e[18];let h;e[19]!==v||e[20]!==t?(h=v>0?n(_,{variant:"secondary",children:t("{count} pending writes",{count:v})}):null,e[19]=v,e[20]=t,e[21]=h):h=e[21];let f;e[22]!==o||e[23]!==d||e[24]!==h?(f=s("div",{className:"flex flex-wrap items-center gap-2",children:[o,d,h]}),e[22]=o,e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==t?(m=t("Reads client.debug() for the client running in this page — not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=m):m=e[27];let u;e[28]!==m?(u=n("p",{className:"text-muted-foreground text-xs",children:m}),e[28]=m,e[29]=u):u=e[29];let p;e[30]!==C||e[31]!==t?(p=C.length===0?n(P,{description:t("No shard connection has been opened yet."),title:t("No shards")}):s(j,{children:[n(B,{children:s(w,{children:[n(l,{children:t("Shard")}),n(l,{children:t("Socket")}),n(l,{children:t("Confirmed watermark")})]})}),n(K,{children:C.map(i=>s(w,{children:[n(r,{children:i.shardKey??t("(default)")}),n(r,{children:n(_,{variant:z.has(i.wsState)?"default":"secondary",children:i.wsState})}),n(r,{children:i.confirmedMutationWatermark})]},i.shardKey??"__default__"))})]}),e[30]=C,e[31]=t,e[32]=p):p=e[32];let y;e[33]!==b||e[34]!==t?(y=b.length===0?n(P,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):s(j,{children:[n(B,{children:s(w,{children:[n(l,{children:t("Subscription")}),n(l,{children:t("Kind")}),n(l,{children:t("Acked")}),n(l,{children:t("Cursor")}),n(l,{children:t("Pending overlays")})]})}),n(K,{children:b.map(i=>s(w,{children:[n(r,{className:"font-mono text-xs",children:i.functionPath}),n(r,{children:i.kind}),n(r,{children:n(_,{variant:i.acked?"default":"secondary",children:i.acked?t("yes"):t("no")})}),n(r,{children:i.serverCursor??"—"}),n(r,{children:i.pendingOptimisticLayers})]},i.id))})]}),e[33]=b,e[34]=t,e[35]=y):y=e[35];let N;return e[36]!==u||e[37]!==p||e[38]!==y||e[39]!==f?(N=n(R,{children:s(H,{className:"flex flex-col gap-4",children:[f,u,p,y]})}),e[36]=u,e[37]=p,e[38]=y,e[39]=f,e[40]=N):N=e[40],N};export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as U}from"react/compiler-runtime";import{useState as ee,useEffect as le}from"react";import{E as ge}from"../packem_shared/error-alert-ClpDVYvo.mjs";import{L as be}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as xe}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as ye}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{E as Ne}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ve}from"../packem_shared/input-CXhxesPC.mjs";import{u as oe}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{u as Se}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as me}from"../packem_shared/internal-D4gBuklE.mjs";import{r as we}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{p as _e,c as Ie}from"../packem_shared/trace-handoff-BV3EWqy_.mjs";import{L as ke}from"../packem_shared/log-line-DpRfHaVQ.mjs";import{f as Me}from"../packem_shared/log-fields-SBxKyBug.mjs";import{c as ne}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as n,jsxs as k,Fragment as $e}from"react/jsx-runtime";const Te=.5,de=4,ce=a=>Math.min(100,Math.max(0,a)),Le=(a,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};const t=ce(a.offsetMs/e*100),s=a.durationMs/e*100,l=Math.max(Te,Math.min(ce(s),100-t));return{leftPercent:t,widthPercent:l}},Ce=(a,e,t=!1)=>{const s=e.trim().toLowerCase(),l=t?a.filter(r=>!r.ok):a;return s===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(s)||r.functionPath.toLowerCase().includes(s)||r.traceId.toLowerCase().includes(s)||r.spans.some(o=>o.name.toLowerCase().includes(s)||o.spanId.toLowerCase().includes(s)))},q=a=>Number.isFinite(a)?a>0&&a<1?`${a.toFixed(2)}ms`:`${String(Math.round(a))}ms`:"—",Ee=a=>!Number.isFinite(a)||a<=0?[]:Array.from({length:de},(e,t)=>{const s=(t+1)/de;return{label:q(a*s),percent:s*100}}),ue=a=>{if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}},Y=a=>{const e=U(7),{label:t,value:s}=a;let l;e[0]!==t?(l=n("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==s?(r=n("dd",{className:"min-w-0 break-all",children:s}),e[2]=s,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=k("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},Pe=a=>{const e=U(68),{span:t}=a,s=Z();let l,r,o,i,d,f;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==s){const $=Object.entries(t.attributes??{});let M;e[15]!==t.events?(M=t.events??[],e[15]=t.events,e[16]=M):M=e[16],l=M,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let N;e[17]!==s?(N=s("Span ID"),e[17]=s,e[18]=N):N=e[18];let v;e[19]!==t.spanId||e[20]!==N?(v=n(Y,{label:N,value:t.spanId}),e[19]=t.spanId,e[20]=N,e[21]=v):v=e[21];let S;e[22]!==s?(S=s("Parent span ID"),e[22]=s,e[23]=S):S=e[23];let m;e[24]!==t.parentSpanId||e[25]!==s?(m=t.parentSpanId===""?s("— (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=s,e[26]=m):m=e[26];let u;e[27]!==m||e[28]!==S?(u=n(Y,{label:S,value:m}),e[27]=m,e[28]=S,e[29]=u):u=e[29];let h;e[30]!==s?(h=s("Kind"),e[30]=s,e[31]=h):h=e[31];const T=t.kind??"internal";let _;e[32]!==h||e[33]!==T?(_=n(Y,{label:h,value:T}),e[32]=h,e[33]=T,e[34]=_):_=e[34];let w;e[35]!==s?(w=s("Started at"),e[35]=s,e[36]=w):w=e[36];let g;e[37]!==t.offsetMs||e[38]!==s?(g=s("+{offset}",{offset:q(t.offsetMs)}),e[37]=t.offsetMs,e[38]=s,e[39]=g):g=e[39];let b;e[40]!==w||e[41]!==g?(b=n(Y,{label:w,value:g}),e[40]=w,e[41]=g,e[42]=b):b=e[42];let I;e[43]!==s?(I=s("Duration"),e[43]=s,e[44]=I):I=e[44];let p;e[45]!==t.durationMs?(p=q(t.durationMs),e[45]=t.durationMs,e[46]=p):p=e[46];let x;e[47]!==I||e[48]!==p?(x=n(Y,{label:I,value:p}),e[47]=I,e[48]=p,e[49]=x):x=e[49],e[50]!==u||e[51]!==_||e[52]!==b||e[53]!==x||e[54]!==v?(i=k("dl",{className:"flex flex-col gap-1",children:[v,u,_,b,x]}),e[50]=u,e[51]=_,e[52]=b,e[53]=x,e[54]=v,e[55]=i):i=e[55],e[56]!==t.error?(d=t.error!==void 0&&k("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[n("span",{className:"font-semibold text-destructive",children:t.error.type}),n("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=d):d=e[57],f=$.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Attributes")}),n("dl",{className:"flex flex-col gap-1",children:$.map(Fe)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=s,e[9]=l,e[10]=r,e[11]=o,e[12]=i,e[13]=d,e[14]=f}else l=e[9],r=e[10],o=e[11],i=e[12],d=e[13],f=e[14];let c;e[58]!==l||e[59]!==s?(c=l.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-events",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Events")}),n("ul",{className:"flex flex-col gap-1",children:l.map(Ae)})]}),e[58]=l,e[59]=s,e[60]=c):c=e[60];let y;return e[61]!==r||e[62]!==o||e[63]!==i||e[64]!==d||e[65]!==f||e[66]!==c?(y=k("div",{className:r,"data-testid":o,children:[i,d,f,c]}),e[61]=r,e[62]=o,e[63]=i,e[64]=d,e[65]=f,e[66]=c,e[67]=y):y=e[67],y};function Fe(a){const[e,t]=a;return n(Y,{label:e,value:ue(t)},e)}function Ke(a){const[e,t]=a;return`${e}=${ue(t)}`}function Ae(a){return k("li",{className:"flex gap-2",children:[n("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:me(a.ts)}),n(fe,{variant:"secondary",children:a.name}),n("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(a.attributes??{}).map(Ke).join(" ")})]},`${a.name}:${String(a.ts)}`)}const De=14,pe="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=a=>{const e=U(17),{traceDurationMs:t}=a;let s,l,r,o,i,d;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const y=Ee(t);if(y.length===0){d=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=ne(pe,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n("span",{}),e[8]=i):i=e[8],s="relative h-3",l=y.map(je)}e[0]=t,e[1]=s,e[2]=l,e[3]=r,e[4]=o,e[5]=i,e[6]=d}else s=e[1],l=e[2],r=e[3],o=e[4],i=e[5],d=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[9]!==s||e[10]!==l?(f=n("span",{className:s,children:l}),e[9]=s,e[10]=l,e[11]=f):f=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==i||e[15]!==f?(c=k("div",{className:r,"data-testid":o,children:[i,f]}),e[12]=r,e[13]=o,e[14]=i,e[15]=f,e[16]=c):c=e[16],c},Be=a=>{const e=U(60),{span:t,traceDurationMs:s}=a,l=Z(),[r,o]=ee(!1);let i;e[0]!==t||e[1]!==s?(i=Le(t,s),e[0]=t,e[1]=s,e[2]=i):i=e[2];const{leftPercent:d,widthPercent:f}=i;let c;e[3]!==t.attributes?(c=Me(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];const y=c,$=t.depth*De;let M;e[5]!==$?(M={paddingLeft:$},e[5]=$,e[6]=M):M=e[6];const N=M,v=`${String(d)}%`,S=`${String(f)}%`;let m;e[7]!==v||e[8]!==S?(m={left:v,width:S},e[7]=v,e[8]=S,e[9]=m):m=e[9];const u=m;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(We)},e[10]=h):h=e[10];const T=h,_=t.depth,w=`tr-span-detail-${t.spanId}`;let g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:q(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:q(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=ne(pe,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=b):b=e[17];const I=`tr-span-toggle-${t.spanId}`;let p;e[18]!==t.ok?(p=t.ok?null:n("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"●"}),e[18]=t.ok,e[19]=p):p=e[19];let x;e[20]!==N||e[21]!==t.name||e[22]!==p?(x=k("span",{className:"truncate",style:N,title:t.name,children:[p,t.name]}),e[20]=N,e[21]=t.name,e[22]=p,e[23]=x):x=e[23];const R=t.ok?"bg-primary/70":"bg-destructive";let L;e[24]!==R?(L=ne("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let D;e[26]!==u||e[27]!==d||e[28]!==L||e[29]!==f?(D=n("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:n("span",{className:L,"data-left":d,"data-testid":"tr-span-bar","data-width":f,style:u})}),e[26]=u,e[27]=d,e[28]=L,e[29]=f,e[30]=D):D=e[30];let B;e[31]!==t.durationMs?(B=q(t.durationMs),e[31]=t.durationMs,e[32]=B):B=e[32];let F;e[33]!==B?(F=n("span",{className:"text-right tabular-nums text-muted-foreground",children:B}),e[33]=B,e[34]=F):F=e[34];let O;e[35]!==t.error?(O=t.error===void 0?null:n("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=O):O=e[36];let C;e[37]!==O?(C=n("span",{className:"truncate text-muted-foreground",children:O}),e[37]=O,e[38]=C):C=e[38];let j;e[39]!==y?(j=y===""?null:n("span",{"data-testid":"tr-span-attributes",title:y,children:y}),e[39]=y,e[40]=j):j=e[40];let E;e[41]!==j?(E=n("span",{className:"truncate text-muted-foreground",children:j}),e[41]=j,e[42]=E):E=e[42];let W;e[43]!==r||e[44]!==w||e[45]!==g||e[46]!==I||e[47]!==x||e[48]!==D||e[49]!==F||e[50]!==C||e[51]!==E?(W=k("button",{"aria-controls":w,"aria-expanded":r,"aria-label":g,className:b,"data-testid":I,onClick:T,type:"button",children:[x,D,F,C,E]}),e[43]=r,e[44]=w,e[45]=g,e[46]=I,e[47]=x,e[48]=D,e[49]=F,e[50]=C,e[51]=E,e[52]=W):W=e[52];let K;e[53]!==r||e[54]!==t?(K=r&&n("div",{id:`tr-span-detail-${t.spanId}`,children:n(Pe,{span:t})}),e[53]=r,e[54]=t,e[55]=K):K=e[55];let P;return e[56]!==t.depth||e[57]!==W||e[58]!==K?(P=k("li",{"data-depth":_,"data-testid":"tr-span-row",children:[W,K]}),e[56]=t.depth,e[57]=W,e[58]=K,e[59]=P):P=e[59],P},Oe=a=>{const e=U(15),{durationMs:t,spans:s}=a,l=Z();let r;e[0]!==t?(r=n(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let i;if(e[4]!==t||e[5]!==s){let c;e[7]!==t?(c=y=>n(Be,{span:y,traceDurationMs:t},y.spanId),e[7]=t,e[8]=c):c=e[8],i=s.map(c),e[4]=t,e[5]=s,e[6]=i}else i=e[6];let d;e[9]!==o||e[10]!==i?(d=n("ul",{"aria-label":o,children:i}),e[9]=o,e[10]=i,e[11]=d):d=e[11];let f;return e[12]!==r||e[13]!==d?(f=k($e,{children:[r,d]}),e[12]=r,e[13]=d,e[14]=f):f=e[14],f};function je(a){return n("span",{className:ne("absolute inset-y-0 border-l border-border/70",a.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(a.percent)}%`},children:a.label},a.percent)}function We(a){return!a}const Ue=a=>Array.isArray(a?.traces)?a.traces:[],qe=a=>{const e=U(12),{entries:t}=a,s=Z();let l;e[0]!==t.length||e[1]!==s?(l=s("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=n("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ge),e[5]=t,e[6]=o):o=e[6];let i;e[7]!==o?(i=n("div",{role:"grid",children:o}),e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==r||e[10]!==i?(d=k("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11],d},ze=a=>{const e=U(50),{expanded:t,logs:s,onToggle:l,trace:r}=a,o=Z();let i;e[0]!==l||e[1]!==r.traceId?(i=()=>{l(r.traceId)},e[0]=l,e[1]=r.traceId,e[2]=i):i=e[2];const d=i,f=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,y=`tr-toggle-${r.traceId}`,$=t?"▾":"▸";let M;e[3]!==$?(M=n("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=M):M=e[4];let N;e[5]!==r.rootName?(N=n("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=N):N=e[6];let v;e[7]!==r.functionPath?(v=n("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=v):v=e[8];let S;e[9]!==r.durationMs?(S=q(r.durationMs),e[9]=r.durationMs,e[10]=S):S=e[10];let m;e[11]!==S?(m=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:S}),e[11]=S,e[12]=m):m=e[12];let u;e[13]!==o||e[14]!==r.spans.length?(u=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=u):u=e[15];let h;e[16]!==u?(h=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:u}),e[16]=u,e[17]=h):h=e[17];const T=r.ok?"secondary":"destructive";let _;e[18]!==o||e[19]!==r.ok?(_=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=_):_=e[20];let w;e[21]!==T||e[22]!==_?(w=n("span",{className:"shrink-0",children:n(fe,{variant:T,children:_})}),e[21]=T,e[22]=_,e[23]=w):w=e[23];let g;e[24]!==r.startTs?(g=me(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let b;e[26]!==g?(b=n("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=b):b=e[27];let I;e[28]!==t||e[29]!==d||e[30]!==m||e[31]!==h||e[32]!==w||e[33]!==b||e[34]!==c||e[35]!==y||e[36]!==M||e[37]!==N||e[38]!==v?(I=k("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":y,onClick:d,type:"button",children:[M,N,v,m,h,w,b]}),e[28]=t,e[29]=d,e[30]=m,e[31]=h,e[32]=w,e[33]=b,e[34]=c,e[35]=y,e[36]=M,e[37]=N,e[38]=v,e[39]=I):I=e[39];let p;e[40]!==t||e[41]!==s||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(p=t&&k("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[n(Oe,{durationMs:r.durationMs,spans:r.spans}),s.length>0&&n(qe,{entries:s})]}),e[40]=t,e[41]=s,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=p):p=e[45];let x;return e[46]!==I||e[47]!==p||e[48]!==f?(x=k("div",{className:"border-b border-border last:border-b-0","data-testid":f,children:[I,p]}),e[46]=I,e[47]=p,e[48]=f,e[49]=x):x=e[49],x},gt=a=>{const e=U(58),{initialShardKey:t}=a,s=Z(),[l]=ee(_e),{queryShardKey:r,setShardKey:o,shardKey:i}=Se(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[d,f]=ee(l?.traceId??""),[c,y]=ee(!1),[$,M]=ee(He);let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],le(Je,N);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v={},e[1]=v):v=e[1];let S;e[2]!==r?(S={live:!0,shardKey:r},e[2]=r,e[3]=S):S=e[3];const{data:m,error:u,errorSource:h,isLoading:T,liveError:_}=oe(ie.getTraces,v,S);let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={},e[4]=w):w=e[4];const g=$.size>0;let b;e[5]!==r||e[6]!==g?(b={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=b):b=e[7];const{data:I}=oe(ie.getLogs,w,b);let p,x;e[8]!==m||e[9]!==r?(p=()=>{m!==void 0&&we(r)},x=[m,r],e[8]=m,e[9]=r,e[10]=p,e[11]=x):(p=e[10],x=e[11]),le(p,x);let R;if(e[12]!==m||e[13]!==u||e[14]!==h||e[15]!==$||e[16]!==T||e[17]!==_||e[18]!==I?.entries||e[19]!==c||e[20]!==d||e[21]!==o||e[22]!==i||e[23]!==s){const L=Ue(m),D=m?.total??L.length,B=D>L.length,F=Ce(L,d,c),O=Map.groupBy((I?.entries??[]).toReversed(),Qe);let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=A=>{f(A.target.value)},e[25]=C):C=e[25];const j=C;let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=A=>{M(he=>{const ae=new Set(he);return ae.has(A)?ae.delete(A):ae.add(A),ae})},e[26]=E):E=e[26];const W=E,K=u===null&&F.length===0&&!T;let P;e[27]!==o||e[28]!==i?(P=n(xe,{onChange:o,testId:"tr-shard-input",value:i}),e[27]=o,e[28]=i,e[29]=P):P=e[29];let z;e[30]!==s?(z=s("Search traces"),e[30]=s,e[31]=z):z=e[31];let G;e[32]!==s?(G=s("search trace, span, or function"),e[32]=s,e[33]=G):G=e[33];let H;e[34]!==d||e[35]!==z||e[36]!==G?(H=n(ve,{"aria-label":z,className:"h-8 w-56","data-testid":"tr-search",onChange:j,placeholder:G,value:d}),e[34]=d,e[35]=z,e[36]=G,e[37]=H):H=e[37];let J;e[38]!==c?(J=n(ye,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:y}),e[38]=c,e[39]=J):J=e[39];let Q;e[40]!==s?(Q=s("Errors only"),e[40]=s,e[41]=Q):Q=e[41];let V;e[42]!==J||e[43]!==Q?(V=k("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[J,Q]}),e[42]=J,e[43]=Q,e[44]=V):V=e[44];let X;e[45]!==_?(X=n(be,{message:_,prefix:"tr"}),e[45]=_,e[46]=X):X=e[46];let te;e[47]!==P||e[48]!==H||e[49]!==V||e[50]!==X?(te=k("div",{className:"flex flex-wrap items-center gap-2",children:[P,H,V,X]}),e[47]=P,e[48]=H,e[49]=V,e[50]=X,e[51]=te):te=e[51];let re;e[52]!==u||e[53]!==h?(re=u!==null&&n(ge,{error:h,testId:"tr-error"}),e[52]=u,e[53]=h,e[54]=re):re=e[54];let se;e[55]!==K||e[56]!==s?(se=K&&n(Ne,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:n("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[55]=K,e[56]=s,e[57]=se):se=e[57],R=k("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[te,re,se,u===null&&B&&n("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:D})}),u===null&&F.length>0&&n("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:F.map(A=>n(ze,{expanded:$.has(A.traceId),logs:O.get(A.traceId)??[],onToggle:W,trace:A},A.traceId))})]}),e[12]=m,e[13]=u,e[14]=h,e[15]=$,e[16]=T,e[17]=_,e[18]=I?.entries,e[19]=c,e[20]=d,e[21]=o,e[22]=i,e[23]=s,e[24]=R}else R=e[24];return R};function Ge(a,e){return n("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:n(ke,{entry:a})},`${String(e)}:${String(a.timestamp)}`)}function He(){return new Set}function Je(){Ie()}function Qe(a){return a.traceId}export{gt as default};
|
|
1
|
+
import{c as U}from"react/compiler-runtime";import{useState as ee,useEffect as le}from"react";import{E as ge}from"../packem_shared/error-alert-tf5zvSLV.mjs";import{L as be}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as xe}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as ye}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{E as Ne}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ve}from"../packem_shared/input-CXhxesPC.mjs";import{u as oe}from"../packem_shared/use-admin-query-BKXiqLci.mjs";import{u as Se}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as me}from"../packem_shared/internal-B6haJbiP.mjs";import{r as we}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{p as _e,c as Ie}from"../packem_shared/trace-handoff-BV3EWqy_.mjs";import{L as ke}from"../packem_shared/log-line-BoObzuue.mjs";import{f as Me}from"../packem_shared/log-fields-SBxKyBug.mjs";import{c as ne}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as n,jsxs as k,Fragment as $e}from"react/jsx-runtime";const Te=.5,de=4,ce=a=>Math.min(100,Math.max(0,a)),Le=(a,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};const t=ce(a.offsetMs/e*100),s=a.durationMs/e*100,l=Math.max(Te,Math.min(ce(s),100-t));return{leftPercent:t,widthPercent:l}},Ce=(a,e,t=!1)=>{const s=e.trim().toLowerCase(),l=t?a.filter(r=>!r.ok):a;return s===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(s)||r.functionPath.toLowerCase().includes(s)||r.traceId.toLowerCase().includes(s)||r.spans.some(o=>o.name.toLowerCase().includes(s)||o.spanId.toLowerCase().includes(s)))},q=a=>Number.isFinite(a)?a>0&&a<1?`${a.toFixed(2)}ms`:`${String(Math.round(a))}ms`:"—",Ee=a=>!Number.isFinite(a)||a<=0?[]:Array.from({length:de},(e,t)=>{const s=(t+1)/de;return{label:q(a*s),percent:s*100}}),ue=a=>{if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}},Y=a=>{const e=U(7),{label:t,value:s}=a;let l;e[0]!==t?(l=n("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==s?(r=n("dd",{className:"min-w-0 break-all",children:s}),e[2]=s,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=k("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},Pe=a=>{const e=U(68),{span:t}=a,s=Z();let l,r,o,i,d,f;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==s){const $=Object.entries(t.attributes??{});let M;e[15]!==t.events?(M=t.events??[],e[15]=t.events,e[16]=M):M=e[16],l=M,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let N;e[17]!==s?(N=s("Span ID"),e[17]=s,e[18]=N):N=e[18];let v;e[19]!==t.spanId||e[20]!==N?(v=n(Y,{label:N,value:t.spanId}),e[19]=t.spanId,e[20]=N,e[21]=v):v=e[21];let S;e[22]!==s?(S=s("Parent span ID"),e[22]=s,e[23]=S):S=e[23];let m;e[24]!==t.parentSpanId||e[25]!==s?(m=t.parentSpanId===""?s("— (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=s,e[26]=m):m=e[26];let u;e[27]!==m||e[28]!==S?(u=n(Y,{label:S,value:m}),e[27]=m,e[28]=S,e[29]=u):u=e[29];let h;e[30]!==s?(h=s("Kind"),e[30]=s,e[31]=h):h=e[31];const T=t.kind??"internal";let _;e[32]!==h||e[33]!==T?(_=n(Y,{label:h,value:T}),e[32]=h,e[33]=T,e[34]=_):_=e[34];let w;e[35]!==s?(w=s("Started at"),e[35]=s,e[36]=w):w=e[36];let g;e[37]!==t.offsetMs||e[38]!==s?(g=s("+{offset}",{offset:q(t.offsetMs)}),e[37]=t.offsetMs,e[38]=s,e[39]=g):g=e[39];let b;e[40]!==w||e[41]!==g?(b=n(Y,{label:w,value:g}),e[40]=w,e[41]=g,e[42]=b):b=e[42];let I;e[43]!==s?(I=s("Duration"),e[43]=s,e[44]=I):I=e[44];let p;e[45]!==t.durationMs?(p=q(t.durationMs),e[45]=t.durationMs,e[46]=p):p=e[46];let x;e[47]!==I||e[48]!==p?(x=n(Y,{label:I,value:p}),e[47]=I,e[48]=p,e[49]=x):x=e[49],e[50]!==u||e[51]!==_||e[52]!==b||e[53]!==x||e[54]!==v?(i=k("dl",{className:"flex flex-col gap-1",children:[v,u,_,b,x]}),e[50]=u,e[51]=_,e[52]=b,e[53]=x,e[54]=v,e[55]=i):i=e[55],e[56]!==t.error?(d=t.error!==void 0&&k("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[n("span",{className:"font-semibold text-destructive",children:t.error.type}),n("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=d):d=e[57],f=$.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Attributes")}),n("dl",{className:"flex flex-col gap-1",children:$.map(Fe)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=s,e[9]=l,e[10]=r,e[11]=o,e[12]=i,e[13]=d,e[14]=f}else l=e[9],r=e[10],o=e[11],i=e[12],d=e[13],f=e[14];let c;e[58]!==l||e[59]!==s?(c=l.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-events",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Events")}),n("ul",{className:"flex flex-col gap-1",children:l.map(Ae)})]}),e[58]=l,e[59]=s,e[60]=c):c=e[60];let y;return e[61]!==r||e[62]!==o||e[63]!==i||e[64]!==d||e[65]!==f||e[66]!==c?(y=k("div",{className:r,"data-testid":o,children:[i,d,f,c]}),e[61]=r,e[62]=o,e[63]=i,e[64]=d,e[65]=f,e[66]=c,e[67]=y):y=e[67],y};function Fe(a){const[e,t]=a;return n(Y,{label:e,value:ue(t)},e)}function Ke(a){const[e,t]=a;return`${e}=${ue(t)}`}function Ae(a){return k("li",{className:"flex gap-2",children:[n("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:me(a.ts)}),n(fe,{variant:"secondary",children:a.name}),n("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(a.attributes??{}).map(Ke).join(" ")})]},`${a.name}:${String(a.ts)}`)}const De=14,pe="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=a=>{const e=U(17),{traceDurationMs:t}=a;let s,l,r,o,i,d;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const y=Ee(t);if(y.length===0){d=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=ne(pe,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n("span",{}),e[8]=i):i=e[8],s="relative h-3",l=y.map(je)}e[0]=t,e[1]=s,e[2]=l,e[3]=r,e[4]=o,e[5]=i,e[6]=d}else s=e[1],l=e[2],r=e[3],o=e[4],i=e[5],d=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[9]!==s||e[10]!==l?(f=n("span",{className:s,children:l}),e[9]=s,e[10]=l,e[11]=f):f=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==i||e[15]!==f?(c=k("div",{className:r,"data-testid":o,children:[i,f]}),e[12]=r,e[13]=o,e[14]=i,e[15]=f,e[16]=c):c=e[16],c},Be=a=>{const e=U(60),{span:t,traceDurationMs:s}=a,l=Z(),[r,o]=ee(!1);let i;e[0]!==t||e[1]!==s?(i=Le(t,s),e[0]=t,e[1]=s,e[2]=i):i=e[2];const{leftPercent:d,widthPercent:f}=i;let c;e[3]!==t.attributes?(c=Me(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];const y=c,$=t.depth*De;let M;e[5]!==$?(M={paddingLeft:$},e[5]=$,e[6]=M):M=e[6];const N=M,v=`${String(d)}%`,S=`${String(f)}%`;let m;e[7]!==v||e[8]!==S?(m={left:v,width:S},e[7]=v,e[8]=S,e[9]=m):m=e[9];const u=m;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(We)},e[10]=h):h=e[10];const T=h,_=t.depth,w=`tr-span-detail-${t.spanId}`;let g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:q(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:q(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=ne(pe,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=b):b=e[17];const I=`tr-span-toggle-${t.spanId}`;let p;e[18]!==t.ok?(p=t.ok?null:n("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"●"}),e[18]=t.ok,e[19]=p):p=e[19];let x;e[20]!==N||e[21]!==t.name||e[22]!==p?(x=k("span",{className:"truncate",style:N,title:t.name,children:[p,t.name]}),e[20]=N,e[21]=t.name,e[22]=p,e[23]=x):x=e[23];const R=t.ok?"bg-primary/70":"bg-destructive";let L;e[24]!==R?(L=ne("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let D;e[26]!==u||e[27]!==d||e[28]!==L||e[29]!==f?(D=n("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:n("span",{className:L,"data-left":d,"data-testid":"tr-span-bar","data-width":f,style:u})}),e[26]=u,e[27]=d,e[28]=L,e[29]=f,e[30]=D):D=e[30];let B;e[31]!==t.durationMs?(B=q(t.durationMs),e[31]=t.durationMs,e[32]=B):B=e[32];let F;e[33]!==B?(F=n("span",{className:"text-right tabular-nums text-muted-foreground",children:B}),e[33]=B,e[34]=F):F=e[34];let O;e[35]!==t.error?(O=t.error===void 0?null:n("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=O):O=e[36];let C;e[37]!==O?(C=n("span",{className:"truncate text-muted-foreground",children:O}),e[37]=O,e[38]=C):C=e[38];let j;e[39]!==y?(j=y===""?null:n("span",{"data-testid":"tr-span-attributes",title:y,children:y}),e[39]=y,e[40]=j):j=e[40];let E;e[41]!==j?(E=n("span",{className:"truncate text-muted-foreground",children:j}),e[41]=j,e[42]=E):E=e[42];let W;e[43]!==r||e[44]!==w||e[45]!==g||e[46]!==I||e[47]!==x||e[48]!==D||e[49]!==F||e[50]!==C||e[51]!==E?(W=k("button",{"aria-controls":w,"aria-expanded":r,"aria-label":g,className:b,"data-testid":I,onClick:T,type:"button",children:[x,D,F,C,E]}),e[43]=r,e[44]=w,e[45]=g,e[46]=I,e[47]=x,e[48]=D,e[49]=F,e[50]=C,e[51]=E,e[52]=W):W=e[52];let K;e[53]!==r||e[54]!==t?(K=r&&n("div",{id:`tr-span-detail-${t.spanId}`,children:n(Pe,{span:t})}),e[53]=r,e[54]=t,e[55]=K):K=e[55];let P;return e[56]!==t.depth||e[57]!==W||e[58]!==K?(P=k("li",{"data-depth":_,"data-testid":"tr-span-row",children:[W,K]}),e[56]=t.depth,e[57]=W,e[58]=K,e[59]=P):P=e[59],P},Oe=a=>{const e=U(15),{durationMs:t,spans:s}=a,l=Z();let r;e[0]!==t?(r=n(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let i;if(e[4]!==t||e[5]!==s){let c;e[7]!==t?(c=y=>n(Be,{span:y,traceDurationMs:t},y.spanId),e[7]=t,e[8]=c):c=e[8],i=s.map(c),e[4]=t,e[5]=s,e[6]=i}else i=e[6];let d;e[9]!==o||e[10]!==i?(d=n("ul",{"aria-label":o,children:i}),e[9]=o,e[10]=i,e[11]=d):d=e[11];let f;return e[12]!==r||e[13]!==d?(f=k($e,{children:[r,d]}),e[12]=r,e[13]=d,e[14]=f):f=e[14],f};function je(a){return n("span",{className:ne("absolute inset-y-0 border-l border-border/70",a.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(a.percent)}%`},children:a.label},a.percent)}function We(a){return!a}const Ue=a=>Array.isArray(a?.traces)?a.traces:[],qe=a=>{const e=U(12),{entries:t}=a,s=Z();let l;e[0]!==t.length||e[1]!==s?(l=s("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=n("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ge),e[5]=t,e[6]=o):o=e[6];let i;e[7]!==o?(i=n("div",{role:"grid",children:o}),e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==r||e[10]!==i?(d=k("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11],d},ze=a=>{const e=U(50),{expanded:t,logs:s,onToggle:l,trace:r}=a,o=Z();let i;e[0]!==l||e[1]!==r.traceId?(i=()=>{l(r.traceId)},e[0]=l,e[1]=r.traceId,e[2]=i):i=e[2];const d=i,f=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,y=`tr-toggle-${r.traceId}`,$=t?"▾":"▸";let M;e[3]!==$?(M=n("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=M):M=e[4];let N;e[5]!==r.rootName?(N=n("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=N):N=e[6];let v;e[7]!==r.functionPath?(v=n("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=v):v=e[8];let S;e[9]!==r.durationMs?(S=q(r.durationMs),e[9]=r.durationMs,e[10]=S):S=e[10];let m;e[11]!==S?(m=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:S}),e[11]=S,e[12]=m):m=e[12];let u;e[13]!==o||e[14]!==r.spans.length?(u=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=u):u=e[15];let h;e[16]!==u?(h=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:u}),e[16]=u,e[17]=h):h=e[17];const T=r.ok?"secondary":"destructive";let _;e[18]!==o||e[19]!==r.ok?(_=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=_):_=e[20];let w;e[21]!==T||e[22]!==_?(w=n("span",{className:"shrink-0",children:n(fe,{variant:T,children:_})}),e[21]=T,e[22]=_,e[23]=w):w=e[23];let g;e[24]!==r.startTs?(g=me(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let b;e[26]!==g?(b=n("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=b):b=e[27];let I;e[28]!==t||e[29]!==d||e[30]!==m||e[31]!==h||e[32]!==w||e[33]!==b||e[34]!==c||e[35]!==y||e[36]!==M||e[37]!==N||e[38]!==v?(I=k("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":y,onClick:d,type:"button",children:[M,N,v,m,h,w,b]}),e[28]=t,e[29]=d,e[30]=m,e[31]=h,e[32]=w,e[33]=b,e[34]=c,e[35]=y,e[36]=M,e[37]=N,e[38]=v,e[39]=I):I=e[39];let p;e[40]!==t||e[41]!==s||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(p=t&&k("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[n(Oe,{durationMs:r.durationMs,spans:r.spans}),s.length>0&&n(qe,{entries:s})]}),e[40]=t,e[41]=s,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=p):p=e[45];let x;return e[46]!==I||e[47]!==p||e[48]!==f?(x=k("div",{className:"border-b border-border last:border-b-0","data-testid":f,children:[I,p]}),e[46]=I,e[47]=p,e[48]=f,e[49]=x):x=e[49],x},gt=a=>{const e=U(58),{initialShardKey:t}=a,s=Z(),[l]=ee(_e),{queryShardKey:r,setShardKey:o,shardKey:i}=Se(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[d,f]=ee(l?.traceId??""),[c,y]=ee(!1),[$,M]=ee(He);let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],le(Je,N);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v={},e[1]=v):v=e[1];let S;e[2]!==r?(S={live:!0,shardKey:r},e[2]=r,e[3]=S):S=e[3];const{data:m,error:u,errorSource:h,isLoading:T,liveError:_}=oe(ie.getTraces,v,S);let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={},e[4]=w):w=e[4];const g=$.size>0;let b;e[5]!==r||e[6]!==g?(b={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=b):b=e[7];const{data:I}=oe(ie.getLogs,w,b);let p,x;e[8]!==m||e[9]!==r?(p=()=>{m!==void 0&&we(r)},x=[m,r],e[8]=m,e[9]=r,e[10]=p,e[11]=x):(p=e[10],x=e[11]),le(p,x);let R;if(e[12]!==m||e[13]!==u||e[14]!==h||e[15]!==$||e[16]!==T||e[17]!==_||e[18]!==I?.entries||e[19]!==c||e[20]!==d||e[21]!==o||e[22]!==i||e[23]!==s){const L=Ue(m),D=m?.total??L.length,B=D>L.length,F=Ce(L,d,c),O=Map.groupBy((I?.entries??[]).toReversed(),Qe);let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=A=>{f(A.target.value)},e[25]=C):C=e[25];const j=C;let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=A=>{M(he=>{const ae=new Set(he);return ae.has(A)?ae.delete(A):ae.add(A),ae})},e[26]=E):E=e[26];const W=E,K=u===null&&F.length===0&&!T;let P;e[27]!==o||e[28]!==i?(P=n(xe,{onChange:o,testId:"tr-shard-input",value:i}),e[27]=o,e[28]=i,e[29]=P):P=e[29];let z;e[30]!==s?(z=s("Search traces"),e[30]=s,e[31]=z):z=e[31];let G;e[32]!==s?(G=s("search trace, span, or function"),e[32]=s,e[33]=G):G=e[33];let H;e[34]!==d||e[35]!==z||e[36]!==G?(H=n(ve,{"aria-label":z,className:"h-8 w-56","data-testid":"tr-search",onChange:j,placeholder:G,value:d}),e[34]=d,e[35]=z,e[36]=G,e[37]=H):H=e[37];let J;e[38]!==c?(J=n(ye,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:y}),e[38]=c,e[39]=J):J=e[39];let Q;e[40]!==s?(Q=s("Errors only"),e[40]=s,e[41]=Q):Q=e[41];let V;e[42]!==J||e[43]!==Q?(V=k("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[J,Q]}),e[42]=J,e[43]=Q,e[44]=V):V=e[44];let X;e[45]!==_?(X=n(be,{message:_,prefix:"tr"}),e[45]=_,e[46]=X):X=e[46];let te;e[47]!==P||e[48]!==H||e[49]!==V||e[50]!==X?(te=k("div",{className:"flex flex-wrap items-center gap-2",children:[P,H,V,X]}),e[47]=P,e[48]=H,e[49]=V,e[50]=X,e[51]=te):te=e[51];let re;e[52]!==u||e[53]!==h?(re=u!==null&&n(ge,{error:h,testId:"tr-error"}),e[52]=u,e[53]=h,e[54]=re):re=e[54];let se;e[55]!==K||e[56]!==s?(se=K&&n(Ne,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:n("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[55]=K,e[56]=s,e[57]=se):se=e[57],R=k("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[te,re,se,u===null&&B&&n("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:D})}),u===null&&F.length>0&&n("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:F.map(A=>n(ze,{expanded:$.has(A.traceId),logs:O.get(A.traceId)??[],onToggle:W,trace:A},A.traceId))})]}),e[12]=m,e[13]=u,e[14]=h,e[15]=$,e[16]=T,e[17]=_,e[18]=I?.entries,e[19]=c,e[20]=d,e[21]=o,e[22]=i,e[23]=s,e[24]=R}else R=e[24];return R};function Ge(a,e){return n("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:n(ke,{entry:a})},`${String(e)}:${String(a.timestamp)}`)}function He(){return new Set}function Je(){Ie()}function Qe(a){return a.traceId}export{gt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as ge}from"@lunora/react";import{useState as F,useEffect as Ve}from"react";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as U}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Fe,a as Ie}from"../packem_shared/card--2hKx4L2.mjs";import{E as Qe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as B}from"../packem_shared/input-CXhxesPC.mjs";import{T as Re,a as Pe,b as O,c as D,d as Te,e as R}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Ze}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{c as Ne}from"react/compiler-runtime";import{u as qe,D as We}from"../packem_shared/use-auth-config-DocoJ5uQ.mjs";import{useAutoRefresh as Je}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import Ke from"../packem_shared/useDebounced-DVeQ5-oW.mjs";import{useT as ke}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as Se,h as Ae,f as Ee,b as je}from"../packem_shared/internal-D4gBuklE.mjs";import{C as Xe}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{L as V}from"../packem_shared/label-DKFzyHq6.mjs";import{M as Ye}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{u as _e}from"../packem_shared/use-async-submit-C1A11ka9.mjs";import{jsxs as i,jsx as t,Fragment as et}from"react/jsx-runtime";We.capabilities;const tt=()=>{const u=Ne(3),{config:e,ready:a}=qe();let l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=(u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),at=(u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;const a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){const l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},nt=u=>{const e=Ne(105),{onClose:a,onCreated:l}=u,c=ge(),s=ke(),{config:d}=qe(),{busy:n,error:r,run:m}=_e(),[k,S]=F(""),[x,w]=F(""),[y,A]=F(""),[h,g]=F("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[p,o]=F(b);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{S(f.target.value)},e[1]=C):C=e[1];const v=C;let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=f=>{w(f.target.value)},e[2]=I):I=e[2];const $=I;let T;e[3]===Symbol.for("react.memo_cache_sentinel")?(T=f=>{A(f.target.value)},e[3]=T):T=e[3];const ze=T;let q;e[4]===Symbol.for("react.memo_cache_sentinel")?(q=f=>{g(f.target.value)},e[4]=q):q=e[4];const Be=q;let Y;e[5]===Symbol.for("react.memo_cache_sentinel")?(Y=(f,P)=>{o(H=>({...H,[f]:P}))},e[5]=Y):Y=e[5];const Ue=Y;let G;e[6]!==p?(G=f=>p[f.name]??(f.type==="boolean"?!1:""),e[6]=p,e[7]=G):G=e[7];const E=G;let Q;if(e[8]!==d.userFields||e[9]!==E){let f;e[11]!==E?(f=P=>!P.required||lt(P,E(P)),e[11]=E,e[12]=f):f=e[12],Q=d.userFields.every(f),e[8]=d.userFields,e[9]=E,e[10]=Q}else Q=e[10];const we=Q;let Z;e[13]!==n||e[14]!==k||e[15]!==x||e[16]!==we?(Z=!n&&k.trim()!==""&&x.trim()!==""&&we,e[13]=n,e[14]=k,e[15]=x,e[16]=we,e[17]=Z):Z=e[17];const $e=Z;let W;e[18]!==d.userFields||e[19]!==E?(W=()=>{const f={};for(const P of d.userFields){const H=at(P,E(P));H!==void 0&&(f[P.name]=H.value)}return Object.keys(f).length===0?void 0:f},e[18]=d.userFields,e[19]=E,e[20]=W):W=e[20];const Ce=W;let J;e[21]!==Ce||e[22]!==c||e[23]!==k||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==h||e[29]!==m?(J=()=>{m(async()=>{await c.createAuthUser({data:Ce(),email:k.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),l(),a()})},e[21]=Ce,e[22]=c,e[23]=k,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=h,e[29]=m,e[30]=J):J=e[30];const N=J;let z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let j;e[35]!==L?(j=t("h2",{className:"text-sm font-semibold text-foreground",children:L}),e[35]=L,e[36]=j):j=e[36];let K;e[37]!==s?(K=s("email"),e[37]=s,e[38]=K):K=e[38];let X;e[39]!==K?(X=t(V,{htmlFor:"uc-email",children:K}),e[39]=K,e[40]=X):X=e[40];let _;e[41]!==k?(_=t(B,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:k}),e[41]=k,e[42]=_):_=e[42];let ee;e[43]!==X||e[44]!==_?(ee=i("div",{className:"flex flex-col gap-1",children:[X,_]}),e[43]=X,e[44]=_,e[45]=ee):ee=e[45];let te;e[46]!==s?(te=s("name"),e[46]=s,e[47]=te):te=e[47];let se;e[48]!==te?(se=t(V,{htmlFor:"uc-name",children:te}),e[48]=te,e[49]=se):se=e[49];let le;e[50]!==x?(le=t(B,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:x}),e[50]=x,e[51]=le):le=e[51];let ae;e[52]!==se||e[53]!==le?(ae=i("div",{className:"flex flex-col gap-1",children:[se,le]}),e[52]=se,e[53]=le,e[54]=ae):ae=e[54];let ne;e[55]!==s?(ne=s("Password (optional)"),e[55]=s,e[56]=ne):ne=e[56];let re;e[57]!==ne?(re=t(V,{htmlFor:"uc-password",children:ne}),e[57]=ne,e[58]=re):re=e[58];let ie;e[59]!==y?(ie=t(B,{"data-testid":"uc-password",id:"uc-password",onChange:ze,type:"password",value:y}),e[59]=y,e[60]=ie):ie=e[60];let oe;e[61]!==re||e[62]!==ie?(oe=i("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[61]=re,e[62]=ie,e[63]=oe):oe=e[63];let de;e[64]!==s?(de=s("Role (optional)"),e[64]=s,e[65]=de):de=e[65];let ce;e[66]!==de?(ce=t(V,{htmlFor:"uc-role",children:de}),e[66]=de,e[67]=ce):ce=e[67];let ue;e[68]!==h?(ue=t(B,{"data-testid":"uc-role",id:"uc-role",onChange:Be,value:h}),e[68]=h,e[69]=ue):ue=e[69];let me;e[70]!==ce||e[71]!==ue?(me=i("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[70]=ce,e[71]=ue,e[72]=me):me=e[72];let he;e[73]!==d.userFields||e[74]!==E||e[75]!==s?(he=d.userFields.length>0&&i("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")}),d.userFields.map(f=>{const P=`uc-field-${f.name}`,H=f.required?"":` (${s("optional")})`;if(f.type==="boolean"){const Me=E(f)===!0;return i("label",{className:"flex items-center gap-2",htmlFor:P,children:[t(Xe,{checked:Me,"data-testid":P,id:P,onCheckedChange:Ge=>{Ue(f.name,Ge)}}),i("span",{className:"text-sm",children:[f.name,H]})]},f.name)}const He=E(f);return i("div",{className:"flex flex-col gap-1",children:[i(V,{htmlFor:P,children:[f.name,H]}),t(B,{"data-testid":P,id:P,onChange:Me=>{Ue(f.name,Me.target.value)},type:st[f.type],value:typeof He=="string"?He:""})]},f.name)})]}),e[73]=d.userFields,e[74]=E,e[75]=s,e[76]=he):he=e[76];let fe;e[77]!==r?(fe=r!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:r}),e[77]=r,e[78]=fe):fe=e[78];let pe;e[79]!==s?(pe=s("Cancel"),e[79]=s,e[80]=pe):pe=e[80];let be;e[81]!==a||e[82]!==pe?(be=t(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:pe}),e[81]=a,e[82]=pe,e[83]=be):be=e[83];const Le=!$e;let ve;e[84]!==n||e[85]!==s?(ve=s(n?"Creating…":"Create"),e[84]=n,e[85]=s,e[86]=ve):ve=e[86];let xe;e[87]!==N||e[88]!==Le||e[89]!==ve?(xe=t(U,{"data-testid":"uc-submit",disabled:Le,onClick:N,size:"sm",type:"button",children:ve}),e[87]=N,e[88]=Le,e[89]=ve,e[90]=xe):xe=e[90];let ye;e[91]!==be||e[92]!==xe?(ye=i("div",{className:"flex justify-end gap-2 pt-1",children:[be,xe]}),e[91]=be,e[92]=xe,e[93]=ye):ye=e[93];let De;return e[94]!==a||e[95]!==z||e[96]!==j||e[97]!==ee||e[98]!==ae||e[99]!==oe||e[100]!==me||e[101]!==he||e[102]!==fe||e[103]!==ye?(De=i(Ye,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[j,ee,ae,oe,me,he,fe,ye]}),e[94]=a,e[95]=z,e[96]=j,e[97]=ee,e[98]=ae,e[99]=oe,e[100]=me,e[101]=he,e[102]=fe,e[103]=ye,e[104]=De):De=e[104],De},Oe=u=>{const e=Ne(2),{children:a}=u;let l;return e[0]!==a?(l=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=l):l=e[1],l},rt=u=>{const e=Ne(29),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{const v=await d.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l?(y=v=>{l(()=>d.revokeAuthSession({sessionId:v}))},e[7]=d,e[8]=l,e[9]=y):y=e[9];const A=y;let h;e[10]!==n?(h=n("Sessions"),e[10]=n,e[11]=h):h=e[11];let g;e[12]!==h?(g=t(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k}),e[14]=k,e[15]=b):b=e[15];let p;e[16]!==r||e[17]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:n("No active sessions.")}),e[16]=r,e[17]=n,e[18]=p):p=e[18];let o;e[19]!==a||e[20]!==A||e[21]!==r||e[22]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-sessions-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("expires")}),t(D,{children:n("ip")}),t(D,{children:n("user agent")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>i(O,{"data-testid":`ud-session-${v.id}`,children:[t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.expiresAt)}),t(R,{children:v.ipAddress??""}),t(R,{className:"max-w-40 truncate",children:v.userAgent??""}),t(R,{children:t(U,{"data-testid":`ud-revoke-${v.id}`,disabled:a,onClick:()=>{A(v.id)},size:"xs",type:"button",variant:"ghost",children:n("Revoke")})})]},v.id))})]})})}),e[19]=a,e[20]=A,e[21]=r,e[22]=n,e[23]=o):o=e[23];let C;return e[24]!==g||e[25]!==b||e[26]!==p||e[27]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,p,o]}),e[24]=g,e[25]=b,e[26]=p,e[27]=o,e[28]=C):C=e[28],C},it=u=>{const e=Ne(30),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{m(await d.listAuthAccounts({userId:c}))}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l||e[9]!==c?(y=v=>{l(()=>d.unlinkAuthAccount({accountId:v,userId:c}))},e[7]=d,e[8]=l,e[9]=c,e[10]=y):y=e[10];const A=y;let h;e[11]!==n?(h=n("Linked accounts"),e[11]=n,e[12]=h):h=e[12];let g;e[13]!==h?(g=t(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:k}),e[15]=k,e[16]=b):b=e[16];let p;e[17]!==r||e[18]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground",children:n("No linked accounts.")}),e[17]=r,e[18]=n,e[19]=p):p=e[19];let o;e[20]!==r||e[21]!==a||e[22]!==A||e[23]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-accounts-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("provider")}),t(D,{children:n("created")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>{const I=Ae(v.id);return i(O,{"data-testid":`ud-account-${I}`,children:[t(R,{children:Ae(v.providerId)}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:()=>{A(I)},size:"xs",type:"button",variant:"ghost",children:n("Unlink")})})]},I)})})]})})}),e[20]=r,e[21]=a,e[22]=A,e[23]=n,e[24]=o):o=e[24];let C;return e[25]!==g||e[26]!==b||e[27]!==p||e[28]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,p,o]}),e[25]=g,e[26]=b,e[27]=p,e[28]=o,e[29]=C):C=e[29],C},ot=u=>{const e=Ne(40),{busy:a,capabilities:l,runAction:c,userId:s,version:d}=u,n=ge(),r=ke(),[m,k]=F(null);let S;e[0]!==l.passkey||e[1]!==n||e[2]!==s?(S=()=>{l.passkey&&Ee((async()=>{try{k(await n.listAuthPasskeys({userId:s}))}catch{k(null)}})())},e[0]=l.passkey,e[1]=n,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==n||e[6]!==s||e[7]!==d?(x=[l.passkey,n,s,d],e[4]=l.passkey,e[5]=n,e[6]=s,e[7]=d,e[8]=x):x=e[8],Ve(S,x);let w;e[9]!==n||e[10]!==c||e[11]!==s?(w=()=>{c(()=>n.disableAuthTwoFactor({userId:s}))},e[9]=n,e[10]=c,e[11]=s,e[12]=w):w=e[12];const y=w;let A;e[13]!==n||e[14]!==c?(A=I=>{c(()=>n.deleteAuthPasskey({passkeyId:I}))},e[13]=n,e[14]=c,e[15]=A):A=e[15];const h=A;let g;e[16]!==r?(g=r("Security"),e[16]=r,e[17]=g):g=e[17];let b;e[18]!==g?(b=t(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let p;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==r?(p=l.twoFactor&&t(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:r("Disable two-factor")}),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=r,e[24]=p):p=e[24];let o;e[25]!==l.passkey||e[26]!==m||e[27]!==r?(o=l.passkey&&m!==null&&m.length===0&&t("p",{className:"text-sm text-muted-foreground",children:r("No passkeys.")}),e[25]=l.passkey,e[26]=m,e[27]=r,e[28]=o):o=e[28];let C;e[29]!==a||e[30]!==l.passkey||e[31]!==h||e[32]!==m||e[33]!==r?(C=l.passkey&&m!==null&&m.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-passkeys-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:r("name")}),t(D,{children:r("created")}),t(D,{"aria-label":r("Actions")})]})}),t(Te,{children:m.map(I=>{const $=Ae(I.id);return i(O,{"data-testid":`ud-passkey-${$}`,children:[t(R,{children:Ae(I.name)||$}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(I.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-delete-passkey-${$}`,disabled:a,onClick:()=>{h($)},size:"xs",type:"button",variant:"ghost",children:r("Delete")})})]},$)})})]})})}),e[29]=a,e[30]=l.passkey,e[31]=h,e[32]=m,e[33]=r,e[34]=C):C=e[34];let v;return e[35]!==b||e[36]!==p||e[37]!==o||e[38]!==C?(v=i("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,p,o,C]}),e[35]=b,e[36]=p,e[37]=o,e[38]=C,e[39]=v):v=e[39],v},dt=/(?:at|expires)$/iu,ct=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ut=(u,e)=>typeof e=="number"&&dt.test(u)?Se(e):Ae(e),mt=({capabilities:u,onChanged:e,onClose:a,user:l})=>{const c=ge(),s=ke(),d=l.banned===!0,[n,r]=F(null),[m,k]=F(!1),[S,x]=F(0),[w,y]=F(typeof l.role=="string"?l.role:""),[A,h]=F(""),[g,b]=F(""),[p,o]=F(""),[C,v]=F(null),[I,$]=F(!1),T=(N,z)=>{Ee((async()=>{k(!0),r(null);try{const L=await N();z?.refresh!==!1&&(x(j=>j+1),e()),z?.onResult?.(L)}catch(L){r(je(L))}k(!1)})())},ze=N=>{y(N.target.value)},q=N=>{h(N.target.value)},Be=N=>{b(N.target.value)},Y=N=>{o(N.target.value)},Ue=()=>{const N=w.trim();N!==""&&T(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},G=()=>{const N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;T(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:A.trim()===""?void 0:A.trim(),userId:l.id})})},E=()=>{T(async()=>{await c.unbanAuthUser({userId:l.id})})},Q=()=>{T(async()=>{await c.setAuthUserPassword({newPassword:p,userId:l.id}),o("")})},we=()=>{T(()=>c.impersonateAuthUser({userId:l.id}),{onResult:N=>{v(N.token)},refresh:!1})},Z=()=>{T(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},$e=()=>{T(async()=>{await c.removeAuthUser({userId:l.id}),a()})},W=()=>{$(!0)},Ce=()=>{$(!1)},J=Object.entries(l).filter(([N])=>!ct.has(N));return i(Ye,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[i("div",{className:"flex items-start justify-between gap-2",children:[i("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),i("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&t(M,{variant:"secondary",children:l.role}),d?t(M,{variant:"destructive",children:s("Banned")}):t(M,{variant:"outline",children:s("Active")}),l.emailVerified===!0?t(M,{variant:"secondary",children:s("verified")}):t(M,{variant:"outline",children:s("unverified")})]})]}),t(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")})]}),n!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:n}),u.admin&&i(Fe,{className:"gap-0 py-0",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")})}),i(Ie,{className:"flex flex-col gap-3 p-3",children:[i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-role",children:s("Role")}),t(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:ze,value:w})]}),t(U,{"data-testid":"ud-set-role",disabled:m||w.trim()==="",onClick:Ue,size:"sm",type:"button",variant:"outline",children:s("Set role")})]}),d?t(U,{"data-testid":"ud-unban",disabled:m,onClick:E,size:"sm",type:"button",variant:"outline",children:s("Unban")}):i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")}),t(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:q,value:A})]}),i("div",{className:"flex w-24 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-days",children:s("Days")}),t(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Be,type:"number",value:g})]}),t(U,{"data-testid":"ud-ban",disabled:m,onClick:G,size:"sm",type:"button",variant:"destructive",children:s("Ban user")})]}),i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-password",children:s("New password")}),t(B,{"data-testid":"ud-password",id:"ud-password",onChange:Y,type:"password",value:p})]}),t(U,{"data-testid":"ud-set-password",disabled:m||p==="",onClick:Q,size:"sm",type:"button",variant:"outline",children:s("Set password")})]}),i("div",{className:"flex flex-wrap gap-2",children:[t(U,{"data-testid":"ud-impersonate",disabled:m,onClick:we,size:"sm",type:"button",variant:"outline",children:s("Impersonate")}),t(U,{"data-testid":"ud-revoke-all",disabled:m,onClick:Z,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")}),I?i(et,{children:[t(U,{"data-testid":"ud-delete-confirm",disabled:m,onClick:$e,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")}),t(U,{"data-testid":"ud-delete-cancel",onClick:Ce,size:"sm",type:"button",variant:"ghost",children:s("Cancel")})]}):t(U,{"data-testid":"ud-delete",disabled:m,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Delete user")})]}),C!==null&&i("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(V,{htmlFor:"ud-token",children:s("Impersonation token")}),t(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:C})]})]})]}),t(rt,{busy:m,runAction:T,userId:l.id,version:S}),u.accounts&&t(it,{busy:m,runAction:T,userId:l.id,version:S}),(u.twoFactor||u.passkey)&&t(ot,{busy:m,capabilities:u,runAction:T,userId:l.id,version:S}),i("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")}),t("dl",{className:"flex flex-col",children:J.map(([N,z])=>i("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),t("dd",{className:"m-0 font-mono text-xs break-words",children:ut(N,z)})]},N))})]})]})},ht=50,Et=({pageSize:u=ht}={})=>{const e=ge(),a=ke(),[l,c]=F(""),[s,d]=F(""),n=Ke(l),[r,m]=F(null),[k,S]=F(!1),{capabilities:x}=tt(),w=n.trim(),y=s.trim(),A=Ze(["lunora-auth-users",w,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:w===""?void 0:w}),{keepPreviousData:!0}),h=A.data?.rows??null,g=A.error,b=()=>{A.refetch()};Je(()=>{A.refetch()},!0);const p=r===null?null:h?.find(o=>o.id===r)??null;return i("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[i("div",{className:"flex flex-wrap items-center gap-2",children:[t(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:o=>{c(o.target.value)},placeholder:a("Search by email or name…"),value:l}),t(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:o=>{d(o.target.value)},placeholder:a("Filter by role"),value:s}),t(U,{"data-testid":"us-new",onClick:()=>{S(!0)},size:"sm",type:"button",children:a("New user")})]}),g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&t(Qe,{description:a("Users who sign up to your app will appear here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:a("No users.")}),h!==null&&h.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"us-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:a("id")}),t(D,{children:a("email")}),t(D,{children:a("name")}),t(D,{children:a("role")}),t(D,{children:a("status")}),t(D,{children:a("verified")}),t(D,{children:a("created")}),t(D,{"aria-label":a("Actions")})]})}),t(Te,{children:h.map(o=>i(O,{"data-testid":`us-row-${o.id}`,children:[t(R,{className:"font-mono text-xs",children:o.id}),t(R,{children:o.email??""}),t(R,{children:o.name??""}),t(R,{children:typeof o.role=="string"&&o.role!==""?t(M,{variant:"secondary",children:o.role}):""}),t(R,{children:o.banned===!0?t(M,{variant:"destructive",children:a("Banned")}):t(M,{variant:"success",children:a("Active")})}),t(R,{children:o.emailVerified===!0?t(M,{variant:"success",children:a("yes")}):t(M,{variant:"outline",children:a("no")})}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(o.createdAt)}),t(R,{children:t(U,{"data-testid":`us-manage-${o.id}`,onClick:()=>{m(o.id)},size:"xs",type:"button",variant:"ghost",children:a("Manage")})})]},o.id))})]})})}),p!==null&&t(mt,{capabilities:x,onChanged:b,onClose:()=>{m(null)},user:p}),k&&t(nt,{onClose:()=>{S(!1)},onCreated:b})]})};export{Et as UsersPanel};
|
|
1
|
+
import{useLunora as ge}from"@lunora/react";import{useState as F,useEffect as Ve}from"react";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as U}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Fe,a as Ie}from"../packem_shared/card--2hKx4L2.mjs";import{E as Qe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as B}from"../packem_shared/input-CXhxesPC.mjs";import{T as Re,a as Pe,b as O,c as D,d as Te,e as R}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Ze}from"../packem_shared/use-admin-query-BKXiqLci.mjs";import{c as Ne}from"react/compiler-runtime";import{u as qe,D as We}from"../packem_shared/use-auth-config-BQKGdSFh.mjs";import{useAutoRefresh as Je}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import Ke from"../packem_shared/useDebounced-DVeQ5-oW.mjs";import{useT as ke}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as Se,i as Ae,f as Ee,b as je}from"../packem_shared/internal-B6haJbiP.mjs";import{C as Xe}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{L as V}from"../packem_shared/label-DKFzyHq6.mjs";import{M as Ye}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{u as _e}from"../packem_shared/use-async-submit-BTr3w2-K.mjs";import{jsxs as i,jsx as t,Fragment as et}from"react/jsx-runtime";We.capabilities;const tt=()=>{const u=Ne(3),{config:e,ready:a}=qe();let l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=(u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),at=(u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;const a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){const l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},nt=u=>{const e=Ne(105),{onClose:a,onCreated:l}=u,c=ge(),s=ke(),{config:d}=qe(),{busy:n,error:r,run:m}=_e(),[k,S]=F(""),[x,w]=F(""),[y,A]=F(""),[h,g]=F("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[p,o]=F(b);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{S(f.target.value)},e[1]=C):C=e[1];const v=C;let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=f=>{w(f.target.value)},e[2]=I):I=e[2];const $=I;let T;e[3]===Symbol.for("react.memo_cache_sentinel")?(T=f=>{A(f.target.value)},e[3]=T):T=e[3];const ze=T;let q;e[4]===Symbol.for("react.memo_cache_sentinel")?(q=f=>{g(f.target.value)},e[4]=q):q=e[4];const Be=q;let Y;e[5]===Symbol.for("react.memo_cache_sentinel")?(Y=(f,P)=>{o(H=>({...H,[f]:P}))},e[5]=Y):Y=e[5];const Ue=Y;let G;e[6]!==p?(G=f=>p[f.name]??(f.type==="boolean"?!1:""),e[6]=p,e[7]=G):G=e[7];const E=G;let Q;if(e[8]!==d.userFields||e[9]!==E){let f;e[11]!==E?(f=P=>!P.required||lt(P,E(P)),e[11]=E,e[12]=f):f=e[12],Q=d.userFields.every(f),e[8]=d.userFields,e[9]=E,e[10]=Q}else Q=e[10];const we=Q;let Z;e[13]!==n||e[14]!==k||e[15]!==x||e[16]!==we?(Z=!n&&k.trim()!==""&&x.trim()!==""&&we,e[13]=n,e[14]=k,e[15]=x,e[16]=we,e[17]=Z):Z=e[17];const $e=Z;let W;e[18]!==d.userFields||e[19]!==E?(W=()=>{const f={};for(const P of d.userFields){const H=at(P,E(P));H!==void 0&&(f[P.name]=H.value)}return Object.keys(f).length===0?void 0:f},e[18]=d.userFields,e[19]=E,e[20]=W):W=e[20];const Ce=W;let J;e[21]!==Ce||e[22]!==c||e[23]!==k||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==h||e[29]!==m?(J=()=>{m(async()=>{await c.createAuthUser({data:Ce(),email:k.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),l(),a()})},e[21]=Ce,e[22]=c,e[23]=k,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=h,e[29]=m,e[30]=J):J=e[30];const N=J;let z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let j;e[35]!==L?(j=t("h2",{className:"text-sm font-semibold text-foreground",children:L}),e[35]=L,e[36]=j):j=e[36];let K;e[37]!==s?(K=s("email"),e[37]=s,e[38]=K):K=e[38];let X;e[39]!==K?(X=t(V,{htmlFor:"uc-email",children:K}),e[39]=K,e[40]=X):X=e[40];let _;e[41]!==k?(_=t(B,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:k}),e[41]=k,e[42]=_):_=e[42];let ee;e[43]!==X||e[44]!==_?(ee=i("div",{className:"flex flex-col gap-1",children:[X,_]}),e[43]=X,e[44]=_,e[45]=ee):ee=e[45];let te;e[46]!==s?(te=s("name"),e[46]=s,e[47]=te):te=e[47];let se;e[48]!==te?(se=t(V,{htmlFor:"uc-name",children:te}),e[48]=te,e[49]=se):se=e[49];let le;e[50]!==x?(le=t(B,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:x}),e[50]=x,e[51]=le):le=e[51];let ae;e[52]!==se||e[53]!==le?(ae=i("div",{className:"flex flex-col gap-1",children:[se,le]}),e[52]=se,e[53]=le,e[54]=ae):ae=e[54];let ne;e[55]!==s?(ne=s("Password (optional)"),e[55]=s,e[56]=ne):ne=e[56];let re;e[57]!==ne?(re=t(V,{htmlFor:"uc-password",children:ne}),e[57]=ne,e[58]=re):re=e[58];let ie;e[59]!==y?(ie=t(B,{"data-testid":"uc-password",id:"uc-password",onChange:ze,type:"password",value:y}),e[59]=y,e[60]=ie):ie=e[60];let oe;e[61]!==re||e[62]!==ie?(oe=i("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[61]=re,e[62]=ie,e[63]=oe):oe=e[63];let de;e[64]!==s?(de=s("Role (optional)"),e[64]=s,e[65]=de):de=e[65];let ce;e[66]!==de?(ce=t(V,{htmlFor:"uc-role",children:de}),e[66]=de,e[67]=ce):ce=e[67];let ue;e[68]!==h?(ue=t(B,{"data-testid":"uc-role",id:"uc-role",onChange:Be,value:h}),e[68]=h,e[69]=ue):ue=e[69];let me;e[70]!==ce||e[71]!==ue?(me=i("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[70]=ce,e[71]=ue,e[72]=me):me=e[72];let he;e[73]!==d.userFields||e[74]!==E||e[75]!==s?(he=d.userFields.length>0&&i("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")}),d.userFields.map(f=>{const P=`uc-field-${f.name}`,H=f.required?"":` (${s("optional")})`;if(f.type==="boolean"){const Me=E(f)===!0;return i("label",{className:"flex items-center gap-2",htmlFor:P,children:[t(Xe,{checked:Me,"data-testid":P,id:P,onCheckedChange:Ge=>{Ue(f.name,Ge)}}),i("span",{className:"text-sm",children:[f.name,H]})]},f.name)}const He=E(f);return i("div",{className:"flex flex-col gap-1",children:[i(V,{htmlFor:P,children:[f.name,H]}),t(B,{"data-testid":P,id:P,onChange:Me=>{Ue(f.name,Me.target.value)},type:st[f.type],value:typeof He=="string"?He:""})]},f.name)})]}),e[73]=d.userFields,e[74]=E,e[75]=s,e[76]=he):he=e[76];let fe;e[77]!==r?(fe=r!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:r}),e[77]=r,e[78]=fe):fe=e[78];let pe;e[79]!==s?(pe=s("Cancel"),e[79]=s,e[80]=pe):pe=e[80];let be;e[81]!==a||e[82]!==pe?(be=t(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:pe}),e[81]=a,e[82]=pe,e[83]=be):be=e[83];const Le=!$e;let ve;e[84]!==n||e[85]!==s?(ve=s(n?"Creating…":"Create"),e[84]=n,e[85]=s,e[86]=ve):ve=e[86];let xe;e[87]!==N||e[88]!==Le||e[89]!==ve?(xe=t(U,{"data-testid":"uc-submit",disabled:Le,onClick:N,size:"sm",type:"button",children:ve}),e[87]=N,e[88]=Le,e[89]=ve,e[90]=xe):xe=e[90];let ye;e[91]!==be||e[92]!==xe?(ye=i("div",{className:"flex justify-end gap-2 pt-1",children:[be,xe]}),e[91]=be,e[92]=xe,e[93]=ye):ye=e[93];let De;return e[94]!==a||e[95]!==z||e[96]!==j||e[97]!==ee||e[98]!==ae||e[99]!==oe||e[100]!==me||e[101]!==he||e[102]!==fe||e[103]!==ye?(De=i(Ye,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[j,ee,ae,oe,me,he,fe,ye]}),e[94]=a,e[95]=z,e[96]=j,e[97]=ee,e[98]=ae,e[99]=oe,e[100]=me,e[101]=he,e[102]=fe,e[103]=ye,e[104]=De):De=e[104],De},Oe=u=>{const e=Ne(2),{children:a}=u;let l;return e[0]!==a?(l=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=l):l=e[1],l},rt=u=>{const e=Ne(29),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{const v=await d.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l?(y=v=>{l(()=>d.revokeAuthSession({sessionId:v}))},e[7]=d,e[8]=l,e[9]=y):y=e[9];const A=y;let h;e[10]!==n?(h=n("Sessions"),e[10]=n,e[11]=h):h=e[11];let g;e[12]!==h?(g=t(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k}),e[14]=k,e[15]=b):b=e[15];let p;e[16]!==r||e[17]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:n("No active sessions.")}),e[16]=r,e[17]=n,e[18]=p):p=e[18];let o;e[19]!==a||e[20]!==A||e[21]!==r||e[22]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-sessions-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("expires")}),t(D,{children:n("ip")}),t(D,{children:n("user agent")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>i(O,{"data-testid":`ud-session-${v.id}`,children:[t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.expiresAt)}),t(R,{children:v.ipAddress??""}),t(R,{className:"max-w-40 truncate",children:v.userAgent??""}),t(R,{children:t(U,{"data-testid":`ud-revoke-${v.id}`,disabled:a,onClick:()=>{A(v.id)},size:"xs",type:"button",variant:"ghost",children:n("Revoke")})})]},v.id))})]})})}),e[19]=a,e[20]=A,e[21]=r,e[22]=n,e[23]=o):o=e[23];let C;return e[24]!==g||e[25]!==b||e[26]!==p||e[27]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,p,o]}),e[24]=g,e[25]=b,e[26]=p,e[27]=o,e[28]=C):C=e[28],C},it=u=>{const e=Ne(30),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{m(await d.listAuthAccounts({userId:c}))}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l||e[9]!==c?(y=v=>{l(()=>d.unlinkAuthAccount({accountId:v,userId:c}))},e[7]=d,e[8]=l,e[9]=c,e[10]=y):y=e[10];const A=y;let h;e[11]!==n?(h=n("Linked accounts"),e[11]=n,e[12]=h):h=e[12];let g;e[13]!==h?(g=t(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:k}),e[15]=k,e[16]=b):b=e[16];let p;e[17]!==r||e[18]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground",children:n("No linked accounts.")}),e[17]=r,e[18]=n,e[19]=p):p=e[19];let o;e[20]!==r||e[21]!==a||e[22]!==A||e[23]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-accounts-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("provider")}),t(D,{children:n("created")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>{const I=Ae(v.id);return i(O,{"data-testid":`ud-account-${I}`,children:[t(R,{children:Ae(v.providerId)}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:()=>{A(I)},size:"xs",type:"button",variant:"ghost",children:n("Unlink")})})]},I)})})]})})}),e[20]=r,e[21]=a,e[22]=A,e[23]=n,e[24]=o):o=e[24];let C;return e[25]!==g||e[26]!==b||e[27]!==p||e[28]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,p,o]}),e[25]=g,e[26]=b,e[27]=p,e[28]=o,e[29]=C):C=e[29],C},ot=u=>{const e=Ne(40),{busy:a,capabilities:l,runAction:c,userId:s,version:d}=u,n=ge(),r=ke(),[m,k]=F(null);let S;e[0]!==l.passkey||e[1]!==n||e[2]!==s?(S=()=>{l.passkey&&Ee((async()=>{try{k(await n.listAuthPasskeys({userId:s}))}catch{k(null)}})())},e[0]=l.passkey,e[1]=n,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==n||e[6]!==s||e[7]!==d?(x=[l.passkey,n,s,d],e[4]=l.passkey,e[5]=n,e[6]=s,e[7]=d,e[8]=x):x=e[8],Ve(S,x);let w;e[9]!==n||e[10]!==c||e[11]!==s?(w=()=>{c(()=>n.disableAuthTwoFactor({userId:s}))},e[9]=n,e[10]=c,e[11]=s,e[12]=w):w=e[12];const y=w;let A;e[13]!==n||e[14]!==c?(A=I=>{c(()=>n.deleteAuthPasskey({passkeyId:I}))},e[13]=n,e[14]=c,e[15]=A):A=e[15];const h=A;let g;e[16]!==r?(g=r("Security"),e[16]=r,e[17]=g):g=e[17];let b;e[18]!==g?(b=t(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let p;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==r?(p=l.twoFactor&&t(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:r("Disable two-factor")}),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=r,e[24]=p):p=e[24];let o;e[25]!==l.passkey||e[26]!==m||e[27]!==r?(o=l.passkey&&m!==null&&m.length===0&&t("p",{className:"text-sm text-muted-foreground",children:r("No passkeys.")}),e[25]=l.passkey,e[26]=m,e[27]=r,e[28]=o):o=e[28];let C;e[29]!==a||e[30]!==l.passkey||e[31]!==h||e[32]!==m||e[33]!==r?(C=l.passkey&&m!==null&&m.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-passkeys-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:r("name")}),t(D,{children:r("created")}),t(D,{"aria-label":r("Actions")})]})}),t(Te,{children:m.map(I=>{const $=Ae(I.id);return i(O,{"data-testid":`ud-passkey-${$}`,children:[t(R,{children:Ae(I.name)||$}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(I.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-delete-passkey-${$}`,disabled:a,onClick:()=>{h($)},size:"xs",type:"button",variant:"ghost",children:r("Delete")})})]},$)})})]})})}),e[29]=a,e[30]=l.passkey,e[31]=h,e[32]=m,e[33]=r,e[34]=C):C=e[34];let v;return e[35]!==b||e[36]!==p||e[37]!==o||e[38]!==C?(v=i("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,p,o,C]}),e[35]=b,e[36]=p,e[37]=o,e[38]=C,e[39]=v):v=e[39],v},dt=/(?:at|expires)$/iu,ct=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ut=(u,e)=>typeof e=="number"&&dt.test(u)?Se(e):Ae(e),mt=({capabilities:u,onChanged:e,onClose:a,user:l})=>{const c=ge(),s=ke(),d=l.banned===!0,[n,r]=F(null),[m,k]=F(!1),[S,x]=F(0),[w,y]=F(typeof l.role=="string"?l.role:""),[A,h]=F(""),[g,b]=F(""),[p,o]=F(""),[C,v]=F(null),[I,$]=F(!1),T=(N,z)=>{Ee((async()=>{k(!0),r(null);try{const L=await N();z?.refresh!==!1&&(x(j=>j+1),e()),z?.onResult?.(L)}catch(L){r(je(L))}k(!1)})())},ze=N=>{y(N.target.value)},q=N=>{h(N.target.value)},Be=N=>{b(N.target.value)},Y=N=>{o(N.target.value)},Ue=()=>{const N=w.trim();N!==""&&T(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},G=()=>{const N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;T(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:A.trim()===""?void 0:A.trim(),userId:l.id})})},E=()=>{T(async()=>{await c.unbanAuthUser({userId:l.id})})},Q=()=>{T(async()=>{await c.setAuthUserPassword({newPassword:p,userId:l.id}),o("")})},we=()=>{T(()=>c.impersonateAuthUser({userId:l.id}),{onResult:N=>{v(N.token)},refresh:!1})},Z=()=>{T(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},$e=()=>{T(async()=>{await c.removeAuthUser({userId:l.id}),a()})},W=()=>{$(!0)},Ce=()=>{$(!1)},J=Object.entries(l).filter(([N])=>!ct.has(N));return i(Ye,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[i("div",{className:"flex items-start justify-between gap-2",children:[i("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),i("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&t(M,{variant:"secondary",children:l.role}),d?t(M,{variant:"destructive",children:s("Banned")}):t(M,{variant:"outline",children:s("Active")}),l.emailVerified===!0?t(M,{variant:"secondary",children:s("verified")}):t(M,{variant:"outline",children:s("unverified")})]})]}),t(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")})]}),n!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:n}),u.admin&&i(Fe,{className:"gap-0 py-0",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")})}),i(Ie,{className:"flex flex-col gap-3 p-3",children:[i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-role",children:s("Role")}),t(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:ze,value:w})]}),t(U,{"data-testid":"ud-set-role",disabled:m||w.trim()==="",onClick:Ue,size:"sm",type:"button",variant:"outline",children:s("Set role")})]}),d?t(U,{"data-testid":"ud-unban",disabled:m,onClick:E,size:"sm",type:"button",variant:"outline",children:s("Unban")}):i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")}),t(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:q,value:A})]}),i("div",{className:"flex w-24 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-days",children:s("Days")}),t(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Be,type:"number",value:g})]}),t(U,{"data-testid":"ud-ban",disabled:m,onClick:G,size:"sm",type:"button",variant:"destructive",children:s("Ban user")})]}),i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-password",children:s("New password")}),t(B,{"data-testid":"ud-password",id:"ud-password",onChange:Y,type:"password",value:p})]}),t(U,{"data-testid":"ud-set-password",disabled:m||p==="",onClick:Q,size:"sm",type:"button",variant:"outline",children:s("Set password")})]}),i("div",{className:"flex flex-wrap gap-2",children:[t(U,{"data-testid":"ud-impersonate",disabled:m,onClick:we,size:"sm",type:"button",variant:"outline",children:s("Impersonate")}),t(U,{"data-testid":"ud-revoke-all",disabled:m,onClick:Z,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")}),I?i(et,{children:[t(U,{"data-testid":"ud-delete-confirm",disabled:m,onClick:$e,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")}),t(U,{"data-testid":"ud-delete-cancel",onClick:Ce,size:"sm",type:"button",variant:"ghost",children:s("Cancel")})]}):t(U,{"data-testid":"ud-delete",disabled:m,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Delete user")})]}),C!==null&&i("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(V,{htmlFor:"ud-token",children:s("Impersonation token")}),t(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:C})]})]})]}),t(rt,{busy:m,runAction:T,userId:l.id,version:S}),u.accounts&&t(it,{busy:m,runAction:T,userId:l.id,version:S}),(u.twoFactor||u.passkey)&&t(ot,{busy:m,capabilities:u,runAction:T,userId:l.id,version:S}),i("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")}),t("dl",{className:"flex flex-col",children:J.map(([N,z])=>i("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),t("dd",{className:"m-0 font-mono text-xs break-words",children:ut(N,z)})]},N))})]})]})},ht=50,Et=({pageSize:u=ht}={})=>{const e=ge(),a=ke(),[l,c]=F(""),[s,d]=F(""),n=Ke(l),[r,m]=F(null),[k,S]=F(!1),{capabilities:x}=tt(),w=n.trim(),y=s.trim(),A=Ze(["lunora-auth-users",w,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:w===""?void 0:w}),{keepPreviousData:!0}),h=A.data?.rows??null,g=A.error,b=()=>{A.refetch()};Je(()=>{A.refetch()},!0);const p=r===null?null:h?.find(o=>o.id===r)??null;return i("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[i("div",{className:"flex flex-wrap items-center gap-2",children:[t(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:o=>{c(o.target.value)},placeholder:a("Search by email or name…"),value:l}),t(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:o=>{d(o.target.value)},placeholder:a("Filter by role"),value:s}),t(U,{"data-testid":"us-new",onClick:()=>{S(!0)},size:"sm",type:"button",children:a("New user")})]}),g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&t(Qe,{description:a("Users who sign up to your app will appear here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:a("No users.")}),h!==null&&h.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"us-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:a("id")}),t(D,{children:a("email")}),t(D,{children:a("name")}),t(D,{children:a("role")}),t(D,{children:a("status")}),t(D,{children:a("verified")}),t(D,{children:a("created")}),t(D,{"aria-label":a("Actions")})]})}),t(Te,{children:h.map(o=>i(O,{"data-testid":`us-row-${o.id}`,children:[t(R,{className:"font-mono text-xs",children:o.id}),t(R,{children:o.email??""}),t(R,{children:o.name??""}),t(R,{children:typeof o.role=="string"&&o.role!==""?t(M,{variant:"secondary",children:o.role}):""}),t(R,{children:o.banned===!0?t(M,{variant:"destructive",children:a("Banned")}):t(M,{variant:"success",children:a("Active")})}),t(R,{children:o.emailVerified===!0?t(M,{variant:"success",children:a("yes")}):t(M,{variant:"outline",children:a("no")})}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(o.createdAt)}),t(R,{children:t(U,{"data-testid":`us-manage-${o.id}`,onClick:()=>{m(o.id)},size:"xs",type:"button",variant:"ghost",children:a("Manage")})})]},o.id))})]})})}),p!==null&&t(mt,{capabilities:x,onChanged:b,onClose:()=>{m(null)},user:p}),k&&t(nt,{onClose:()=>{S(!1)},onCreated:b})]})};export{Et as UsersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as H}from"react/compiler-runtime";import{useLunora as K}from"@lunora/react";import{useState as h,useEffect as z}from"react";import{B as O}from"../packem_shared/button-q0UYSmrn.mjs";import{C as E,a as q}from"../packem_shared/card--2hKx4L2.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as R}from"../packem_shared/input-CXhxesPC.mjs";import{T as B,a as j,b,c as d,d as L,e as i}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as M,b as V,
|
|
1
|
+
import{c as H}from"react/compiler-runtime";import{useLunora as K}from"@lunora/react";import{useState as h,useEffect as z}from"react";import{B as O}from"../packem_shared/button-q0UYSmrn.mjs";import{C as E,a as q}from"../packem_shared/card--2hKx4L2.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as R}from"../packem_shared/input-CXhxesPC.mjs";import{T as B,a as j,b,c as d,d as L,e as i}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as M,b as V,i as W}from"../packem_shared/internal-B6haJbiP.mjs";import{jsxs as n,jsx as e}from"react/jsx-runtime";const Z=10,g=x=>{const a=H(7),{label:m,value:r}=x;let l;a[0]!==m?(l=e("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),a[0]=m,a[1]=l):l=a[1];const f=r??"—";let s;a[2]!==f?(s=e("span",{className:"font-mono text-sm",children:f}),a[2]=f,a[3]=s):s=a[3];let u;return a[4]!==l||a[5]!==s?(u=n("div",{className:"flex flex-col gap-0.5",children:[l,s]}),a[4]=l,a[5]=s,a[6]=u):u=a[6],u},se=({loadIndexes:x,runQuery:a}={})=>{const m=K(),r=U(),[l,f]=h(null),[s,u]=h(null),[v,C]=h(null),[N,F]=h(""),[p,y]=h(null),[S,w]=h(null),[k,I]=h(!1);z(()=>{const t={cancelled:!1};return M((async()=>{try{const o=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(f(o),u(null),C(T=>T??o[0]?.name??null))}catch(o){t.cancelled||(f(null),u(V(o)))}})()),()=>{t.cancelled=!0}},[m,x]);const c=l?.find(t=>t.name===v)??null,Q=t=>{C(t.currentTarget.dataset.index??null),y(null),w(null)},$=t=>{F(t.target.value)},A=async()=>{const t=N.trim();if(!(v===null||t==="")){I(!0),w(null);try{const o=await(a??(T=>m.queryVectorIndex(T)))({name:v,text:t,topK:Z});y(o)}catch(o){y(null),w(V(o))}I(!1)}},D=()=>{M(A())};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&e("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),l!==null&&l.length===0&&e(P,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:r("No vector indexes.")}),l!==null&&l.length>0&&e(E,{className:"overflow-hidden py-0",children:e(q,{className:"px-0",children:n(B,{"data-testid":"vector-table",children:[e(j,{children:n(b,{children:[e(d,{children:r("name")}),e(d,{children:r("table")}),e(d,{children:r("dimensions")}),e(d,{children:r("metric")}),e(d,{children:r("vectors")})]})}),e(L,{children:l.map(t=>n(b,{className:t.name===v?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:Q,children:[e(i,{className:"font-mono text-xs",children:t.name}),e(i,{className:"font-mono text-xs",children:t.table}),e(i,{className:"tabular-nums",children:t.dimensions??"—"}),e(i,{children:t.metric??"—"}),e(i,{className:"tabular-nums",children:t.vectorsCount??"—"})]},t.name))})]})})}),c!==null&&n("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[n("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e(g,{label:r("field"),value:c.field}),e(g,{label:r("dimensions"),value:c.dimensions}),e(g,{label:r("metric"),value:c.metric}),e(g,{label:r("vectors"),value:c.vectorsCount})]}),c.metadata!==void 0&&c.metadata.length>0&&n("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",e("span",{className:"font-mono",children:c.metadata.join(", ")})]}),n("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e(R,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:$,placeholder:r("Search by similarity…"),value:N}),e(O,{"data-testid":"vector-search",disabled:k||N.trim()==="",onClick:D,children:r(k?"Searching…":"Search")})]}),S!==null&&e("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:S}),p!==null&&p.length===0&&e("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")}),p!==null&&p.length>0&&e(E,{className:"mt-3 overflow-hidden py-0",children:e(q,{className:"px-0",children:n(B,{"data-testid":"vector-matches",children:[e(j,{children:n(b,{children:[e(d,{children:r("id")}),e(d,{children:r("score")}),e(d,{children:r("metadata")})]})}),e(L,{children:p.map(t=>n(b,{"data-testid":`vector-match-${t.id}`,children:[e(i,{className:"font-mono text-xs",children:t.id}),e(i,{className:"tabular-nums",children:t.score.toFixed(4)}),e(i,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"—":W(t.metadata)})]},t.id))})]})})})]})]})};export{se as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as X}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{B as E}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as U}from"../packem_shared/card--2hKx4L2.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as re}from"../packem_shared/input-CXhxesPC.mjs";import{T as j,a as z,b as x,c as i,d as J,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as se}from"../packem_shared/textarea--40GKAyz.mjs";import{u as ae}from"../packem_shared/use-admin-query-BvZH4unR.mjs";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as M}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as W,b as A,d as V,c as Z}from"../packem_shared/internal-D4gBuklE.mjs";import{jsxs as n,jsx as e}from"react/jsx-runtime";const ne=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const s=o.error??o.output;if(s===void 0)return"—";try{return JSON.stringify(s)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:s,readOnly:N,runAction:R,workflowName:w})=>{const O=X(),a=Y(),[h,g]=m(null),[k,I]=m(null),[v,_]=m(""),[b,f]=m(null),[$,S]=m(!1),[F,D]=m(null),p=o??(r=>O.getWorkflowInstance(r)),C=N?void 0:R??(s===void 0?r=>O.setWorkflowInstanceStatus(r):void 0),L=async()=>{f(null),S(!1);const r=v===""?void 0:v;try{if(s===void 0){const l=await O.listWorkflowInstances({name:w,status:r});if(l.configured===!1){g(null),S(!0);return}g(l.instances);return}g(await s({name:w,status:r}))}catch(l){g(null),ie(l)?S(!0):f(A(l))}};te(()=>{I(null),W(L())},[w,v]);const K=async r=>{f(null);try{I(await p({id:r,name:w}))}catch(l){f(A(l))}},q=async(r,l)=>{if(C!==void 0){D(r),f(null);try{await C({action:l,id:r,name:w}),await L()}catch(G){f(A(G))}D(null)}};return n("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[n("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:a("Instance history")}),n("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r=>{_(r.target.value)},value:v,children:[e("option",{value:"",children:a("All statuses")}),ne.map(r=>e("option",{value:r,children:r},r))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),$&&e(H,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!$&&h!==null&&h.length===0&&e(H,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),h!==null&&h.length>0&&e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflow-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:a("Instance id")}),e(i,{children:a("Status")}),e(i,{children:a("Created")}),e(i,{children:a("Ended")}),e(i,{"aria-label":a("Actions")})]})}),e(J,{children:h.map(r=>n(x,{"data-testid":`workflow-instance-${r.id}`,children:[e(d,{className:"font-mono text-xs",children:r.id}),e(d,{className:"font-mono text-xs",children:r.status}),e(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"—"}),e(d,{className:"text-right",children:n("div",{className:"flex justify-end gap-1.5",children:[e(E,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:()=>{W(K(r.id))},size:"sm",type:"button",variant:"outline",children:a("Steps")}),C!==void 0&&oe.map(l=>e(E,{"data-testid":`workflow-instance-${l}-${r.id}`,disabled:F===r.id,onClick:()=>{W(q(r.id,l))},size:"sm",type:"button",variant:"ghost",children:a(l)},l))]})})]},r.id))})]})})}),k!==null&&e(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:n(U,{className:"flex flex-col gap-2 px-4 py-3",children:[n("div",{className:"flex items-center justify-between",children:[n("span",{className:"font-mono text-xs",children:[a("Steps")," · ",k.id]}),e(E,{"data-testid":"workflow-instance-detail-close",onClick:()=>{I(null)},size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),k.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):n(j,{"data-testid":"workflow-instance-steps",children:[e(z,{children:n(x,{children:[e(i,{children:a("Step")}),e(i,{children:a("Type")}),e(i,{children:a("Attempts")}),e(i,{children:a("Started")}),e(i,{children:a("Output")})]})}),e(J,{children:k.steps.map((r,l)=>n(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:r.name}),e(d,{className:"text-xs text-muted-foreground",children:r.type??"—"}),e(d,{className:"tabular-nums",children:r.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(r)})]},`${r.name}:${String(l)}`))})]})]})})]})},me=Z(M.createWorkflowInstance),ue=Z(M.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,s)=>o.some(N=>N.exportName===s)?s:o[0]?.exportName??"",Te=()=>{const o=X(),s=Y(),{data:N,error:R}=ae(M.listWorkflows,{}),[w,O]=m(""),[a,h]=m(""),[g,k]=m(""),[I,v]=m(!1),[_,b]=m(null),[f,$]=m([]),[S,F]=m(null),D=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],T=he(p,w),B=p.find(t=>t.exportName===T),C=t=>{$(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},L=async()=>{const t=T;if(t==="")return;let u;const c=g.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(s("Params must be valid JSON"));return}v(!0),b(null);try{const y=a.trim(),Q=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},V(""));C({exportName:t,id:Q.id,status:Q.status}),h("")}catch(y){b(A(y))}v(!1)},K=()=>{W(L())},q=async(t,u)=>{F(u);try{const c=await o.query(ue,{exportName:t,id:u},V(""));C({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(A(c))}F(null)},r=t=>{O(t.target.value)},l=t=>{h(t.target.value)},G=t=>{k(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&W(q(u,c))};return n("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[R!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:R}),e("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),D&&p.length===0?e(H,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")}):e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Export")}),e(i,{children:s("Name")}),e(i,{children:s("Class")}),e(i,{children:s("Binding")})]})}),e(J,{children:p.map(t=>n(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:s("Start instance")}),_!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:_}),n("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:r,value:T,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(re,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:l,placeholder:s("Instance id (optional)"),value:a}),e(E,{"data-testid":"workflows-start-button",disabled:I||T==="",onClick:K,children:s(I?"Starting…":"Start instance")})]}),e(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:G,placeholder:s("Params (JSON, optional)"),value:g})]}),f.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:s("Instances")}),e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Workflow")}),e(i,{children:s("Instance id")}),e(i,{children:s("Status")}),e(i,{children:s("Output")}),e(i,{})]})}),e(J,{children:f.map(t=>n(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(E,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:ee,size:"xs",variant:"outline",children:S===t.id?s("Refreshing…"):s("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),B!==void 0&&e(ce,{workflowName:B.name})]})};export{Te as default};
|
|
1
|
+
import{useLunora as X}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{B as E}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as U}from"../packem_shared/card--2hKx4L2.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as re}from"../packem_shared/input-CXhxesPC.mjs";import{T as j,a as z,b as x,c as i,d as J,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as se}from"../packem_shared/textarea--40GKAyz.mjs";import{u as ae}from"../packem_shared/use-admin-query-BKXiqLci.mjs";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as M}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as W,b as A,d as V,c as Z}from"../packem_shared/internal-B6haJbiP.mjs";import{jsxs as n,jsx as e}from"react/jsx-runtime";const ne=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const s=o.error??o.output;if(s===void 0)return"—";try{return JSON.stringify(s)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:s,readOnly:N,runAction:R,workflowName:w})=>{const O=X(),a=Y(),[h,g]=m(null),[k,I]=m(null),[v,_]=m(""),[b,f]=m(null),[$,S]=m(!1),[F,D]=m(null),p=o??(r=>O.getWorkflowInstance(r)),C=N?void 0:R??(s===void 0?r=>O.setWorkflowInstanceStatus(r):void 0),L=async()=>{f(null),S(!1);const r=v===""?void 0:v;try{if(s===void 0){const l=await O.listWorkflowInstances({name:w,status:r});if(l.configured===!1){g(null),S(!0);return}g(l.instances);return}g(await s({name:w,status:r}))}catch(l){g(null),ie(l)?S(!0):f(A(l))}};te(()=>{I(null),W(L())},[w,v]);const K=async r=>{f(null);try{I(await p({id:r,name:w}))}catch(l){f(A(l))}},q=async(r,l)=>{if(C!==void 0){D(r),f(null);try{await C({action:l,id:r,name:w}),await L()}catch(G){f(A(G))}D(null)}};return n("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[n("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:a("Instance history")}),n("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r=>{_(r.target.value)},value:v,children:[e("option",{value:"",children:a("All statuses")}),ne.map(r=>e("option",{value:r,children:r},r))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),$&&e(H,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!$&&h!==null&&h.length===0&&e(H,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),h!==null&&h.length>0&&e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflow-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:a("Instance id")}),e(i,{children:a("Status")}),e(i,{children:a("Created")}),e(i,{children:a("Ended")}),e(i,{"aria-label":a("Actions")})]})}),e(J,{children:h.map(r=>n(x,{"data-testid":`workflow-instance-${r.id}`,children:[e(d,{className:"font-mono text-xs",children:r.id}),e(d,{className:"font-mono text-xs",children:r.status}),e(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"—"}),e(d,{className:"text-right",children:n("div",{className:"flex justify-end gap-1.5",children:[e(E,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:()=>{W(K(r.id))},size:"sm",type:"button",variant:"outline",children:a("Steps")}),C!==void 0&&oe.map(l=>e(E,{"data-testid":`workflow-instance-${l}-${r.id}`,disabled:F===r.id,onClick:()=>{W(q(r.id,l))},size:"sm",type:"button",variant:"ghost",children:a(l)},l))]})})]},r.id))})]})})}),k!==null&&e(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:n(U,{className:"flex flex-col gap-2 px-4 py-3",children:[n("div",{className:"flex items-center justify-between",children:[n("span",{className:"font-mono text-xs",children:[a("Steps")," · ",k.id]}),e(E,{"data-testid":"workflow-instance-detail-close",onClick:()=>{I(null)},size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),k.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):n(j,{"data-testid":"workflow-instance-steps",children:[e(z,{children:n(x,{children:[e(i,{children:a("Step")}),e(i,{children:a("Type")}),e(i,{children:a("Attempts")}),e(i,{children:a("Started")}),e(i,{children:a("Output")})]})}),e(J,{children:k.steps.map((r,l)=>n(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:r.name}),e(d,{className:"text-xs text-muted-foreground",children:r.type??"—"}),e(d,{className:"tabular-nums",children:r.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(r)})]},`${r.name}:${String(l)}`))})]})]})})]})},me=Z(M.createWorkflowInstance),ue=Z(M.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,s)=>o.some(N=>N.exportName===s)?s:o[0]?.exportName??"",Te=()=>{const o=X(),s=Y(),{data:N,error:R}=ae(M.listWorkflows,{}),[w,O]=m(""),[a,h]=m(""),[g,k]=m(""),[I,v]=m(!1),[_,b]=m(null),[f,$]=m([]),[S,F]=m(null),D=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],T=he(p,w),B=p.find(t=>t.exportName===T),C=t=>{$(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},L=async()=>{const t=T;if(t==="")return;let u;const c=g.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(s("Params must be valid JSON"));return}v(!0),b(null);try{const y=a.trim(),Q=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},V(""));C({exportName:t,id:Q.id,status:Q.status}),h("")}catch(y){b(A(y))}v(!1)},K=()=>{W(L())},q=async(t,u)=>{F(u);try{const c=await o.query(ue,{exportName:t,id:u},V(""));C({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(A(c))}F(null)},r=t=>{O(t.target.value)},l=t=>{h(t.target.value)},G=t=>{k(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&W(q(u,c))};return n("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[R!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:R}),e("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),D&&p.length===0?e(H,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")}):e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Export")}),e(i,{children:s("Name")}),e(i,{children:s("Class")}),e(i,{children:s("Binding")})]})}),e(J,{children:p.map(t=>n(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:s("Start instance")}),_!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:_}),n("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:r,value:T,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(re,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:l,placeholder:s("Instance id (optional)"),value:a}),e(E,{"data-testid":"workflows-start-button",disabled:I||T==="",onClick:K,children:s(I?"Starting…":"Start instance")})]}),e(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:G,placeholder:s("Params (JSON, optional)"),value:g})]}),f.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:s("Instances")}),e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Workflow")}),e(i,{children:s("Instance id")}),e(i,{children:s("Status")}),e(i,{children:s("Output")}),e(i,{})]})}),e(J,{children:f.map(t=>n(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(E,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:ee,size:"xs",variant:"outline",children:S===t.id?s("Refreshing…"):s("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),B!==void 0&&e(ce,{workflowName:B.name})]})};export{Te as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as Z,d as ee,g as te}from"./internal-
|
|
1
|
+
import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as Z,d as ee,g as te}from"./internal-B6haJbiP.mjs";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ne=["react","client","cli"],ae={action:"action",mutation:"mutation",query:"query"},Q=a=>{const e=a.indexOf(":");return e===-1?{file:"",fn:a}:{file:a.slice(0,e),fn:a.slice(e+1)}},ie=({file:a,fn:e,kind:i})=>`await client.${ae[i]}(api.${a}.${e}, { /* args */ });`,se=a=>{const e=`api.${a.file}.${a.fn}`;switch(a.kind){case"action":return`const { call: ${a.fn} } = useAction(${e});`;case"mutation":return`const ${a.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:a,fn:e})=>`lunora run ${a}:${e} --args '{ }'`,ce=a=>["// Read rows",`const rows = await ctx.db.query("${a}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${a}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${a}">;`,`type RowId = Id<"${a}">;`].join(`
|
|
2
2
|
`),re=(a,e)=>{switch(a){case"cli":return oe(e);case"client":return ie(e);default:return se(e)}},U=a=>{const e=F(19),{code:i,label:s,testId:l}=a,n=M();let c;e[0]!==i?(c=()=>{te(i)},e[0]=i,e[1]=c):c=e[1];const m=c;let t;e[2]!==s?(t=u("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[2]=s,e[3]=t):t=e[3];const d=`${l}-copy`;let o;e[4]!==n?(o=n("Copy"),e[4]=n,e[5]=o):o=e[5];let f;e[6]!==m||e[7]!==d||e[8]!==o?(f=u(H,{"data-testid":d,onClick:m,size:"xs",type:"button",variant:"ghost",children:o}),e[6]=m,e[7]=d,e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==f?(p=R("div",{className:"flex items-center justify-between gap-2",children:[t,f]}),e[10]=t,e[11]=f,e[12]=p):p=e[12];let r;e[13]!==i||e[14]!==l?(r=u("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":l,children:i}),e[13]=i,e[14]=l,e[15]=r):r=e[15];let b;return e[16]!==p||e[17]!==r?(b=R("div",{className:"flex flex-col gap-1.5",children:[p,r]}),e[16]=p,e[17]=r,e[18]=b):b=e[18],b},de=a=>{const e=F(46),{file:i,fn:s,kind:l}=a,n=M(),[c,m]=z("react");let t,d,o;if(e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==c){const x={file:i,fn:s,kind:l};let k;e[8]!==n?(k=n("CLI"),e[8]=n,e[9]=k):k=e[9];let w;e[10]!==n?(w=n("Client"),e[10]=n,e[11]=w):w=e[11];let I;e[12]!==n?(I=n("React"),e[12]=n,e[13]=I):I=e[13];let C;e[14]!==k||e[15]!==w||e[16]!==I?(C={cli:k,client:w,react:I},e[14]=k,e[15]=w,e[16]=I,e[17]=C):C=e[17],o=C;let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=D=>{m(D.currentTarget.dataset.tab)},e[18]=B):B=e[18],t=B,d=re(c,x),e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=c,e[5]=t,e[6]=d,e[7]=o}else t=e[5],d=e[6],o=e[7];const f=d,p=`api.${i}.${s}`;let r;e[19]!==p?(r=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:p}),e[19]=p,e[20]=r):r=e[20];let b;e[21]!==l||e[22]!==n?(b=n("Call this {kind} from your app.",{kind:l}),e[21]=l,e[22]=n,e[23]=b):b=e[23];let h;e[24]!==b?(h=u("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=h):h=e[25];let v;e[26]!==r||e[27]!==h?(v=R("div",{children:[r,h]}),e[26]=r,e[27]=h,e[28]=v):v=e[28];let $;e[29]!==n?($=n("Snippet flavour"),e[29]=n,e[30]=$):$=e[30];let y;e[31]!==t||e[32]!==c||e[33]!==o?(y=ne.map(x=>u(H,{"aria-selected":c===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:c===x?"default":"outline",children:o[x]},x)),e[31]=t,e[32]=c,e[33]=o,e[34]=y):y=e[34];let N;e[35]!==$||e[36]!==y?(N=u("div",{"aria-label":$,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=$,e[36]=y,e[37]=N):N=e[37];const _=o[c],A=`api-snippet-${c}`;let S;e[38]!==f||e[39]!==_||e[40]!==A?(S=u(U,{code:f,label:_,testId:A}),e[38]=f,e[39]=_,e[40]=A,e[41]=S):S=e[41];let T;return e[42]!==S||e[43]!==v||e[44]!==N?(T=R("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,N,S]}),e[42]=S,e[43]=v,e[44]=N,e[45]=T):T=e[45],T},fe=a=>{const e=F(19),{name:i}=a,s=M();let l;e[0]!==i?(l=ce(i),e[0]=i,e[1]=l):l=e[1];const n=l;let c;e[2]!==i?(c=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:i}),e[2]=i,e[3]=c):c=e[3];let m;e[4]!==s?(m=s("Read and write this table through the typed data model."),e[4]=s,e[5]=m):m=e[5];let t;e[6]!==m?(t=u("p",{className:"text-xs text-muted-foreground",children:m}),e[6]=m,e[7]=t):t=e[7];let d;e[8]!==c||e[9]!==t?(d=R("div",{children:[c,t]}),e[8]=c,e[9]=t,e[10]=d):d=e[10];let o;e[11]!==s?(o=s("Data model"),e[11]=s,e[12]=o):o=e[12];let f;e[13]!==n||e[14]!==o?(f=u(U,{code:n,label:o,testId:"api-snippet-table"}),e[13]=n,e[14]=o,e[15]=f):f=e[15];let p;return e[16]!==d||e[17]!==f?(p=R("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[d,f]}),e[16]=d,e[17]=f,e[18]=p):p=e[18],p},G=a=>{const e=F(8),{active:i,label:s,onSelect:l,testId:n,value:c}=a;let m;e[0]!==l||e[1]!==c?(m=()=>{l(c)},e[0]=l,e[1]=c,e[2]=m):m=e[2];const t=m,d=i?"page":void 0;let o;return e[3]!==s||e[4]!==t||e[5]!==d||e[6]!==n?(o=u("button",{"aria-current":d,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":n,onClick:t,type:"button",children:s}),e[3]=s,e[4]=t,e[5]=d,e[6]=n,e[7]=o):o=e[7],o},pe=a=>{const e=new Map;for(const i of a){const{file:s,fn:l}=Q(i.path),n=e.get(s)??[];n.push({fn:l,kind:i.kind,path:i.path}),e.set(s,n)}return[...e.entries()].map(([i,s])=>({file:i,items:s.toSorted((l,n)=>l.fn.localeCompare(n.fn))})).toSorted((i,s)=>i.file.localeCompare(s.file))},ke=a=>{const e=F(58),{functions:i,initialShardKey:s}=a,l=M(),n=V(),[c,m]=z(null),[t,d]=z(null);let o,f;e[0]!==n||e[1]!==s?(o=()=>{let D=!1;return n.query(le,{},ee(s??"")).then(L=>(D||m(L),L)).catch(()=>{D||m([])}),()=>{D=!0}},f=[n,s],e[0]=n,e[1]=s,e[2]=o,e[3]=f):(o=e[2],f=e[3]),W(o,f);let p,r,b,h,v,$,y,N,_,A;if(e[4]!==i||e[5]!==t||e[6]!==l||e[7]!==c){const D=i??[],L=pe(D),O=(c??[]).map(ue).toSorted(me);let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=g=>{d({kind:"fn",path:g})},e[18]=P):P=e[18];const Y=P;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=g=>{d({kind:"table",name:g})},e[19]=j):j=e[19];const J=j;r=t?.kind==="fn"?D.find(g=>g.path===t.path):void 0,p=D.length>0||O.length>0,b=r===void 0?void 0:Q(r.path),_="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",A="lunora-api-docs",e[20]!==l?(h=l("API resources"),e[20]=l,e[21]=h):h=e[21],v="flex flex-col gap-4 overflow-y-auto",$="api-rail";let q;e[22]!==t||e[23]!==l?(q=g=>R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||l("(root)")}),g.items.map(E=>u(G,{active:t?.kind==="fn"&&t.path===E.path,label:E.fn,onSelect:Y,testId:`api-rail-fn-${E.path}`,value:E.path},E.path))]},g.file),e[22]=t,e[23]=l,e[24]=q):q=e[24],y=L.map(q),N=O.length>0&&R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l("Tables")}),O.map(g=>u(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:J,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=i,e[5]=t,e[6]=l,e[7]=c,e[8]=p,e[9]=r,e[10]=b,e[11]=h,e[12]=v,e[13]=$,e[14]=y,e[15]=N,e[16]=_,e[17]=A}else p=e[8],r=e[9],b=e[10],h=e[11],v=e[12],$=e[13],y=e[14],N=e[15],_=e[16],A=e[17];let S;e[25]!==p||e[26]!==l?(S=!p&&u("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:l("No functions or tables to document yet.")}),e[25]=p,e[26]=l,e[27]=S):S=e[27];let T;e[28]!==S||e[29]!==h||e[30]!==v||e[31]!==$||e[32]!==y||e[33]!==N?(T=R("nav",{"aria-label":h,className:v,"data-testid":$,children:[y,N,S]}),e[28]=S,e[29]=h,e[30]=v,e[31]=$,e[32]=y,e[33]=N,e[34]=T):T=e[34];let x;e[35]!==t||e[36]!==l?(x=t===null&&u(K,{description:l("Select a function or table to see how to call it from your app."),testId:"api-empty",title:l("API usage snippets")}),e[35]=t,e[36]=l,e[37]=x):x=e[37];let k;e[38]!==t?.kind||e[39]!==r||e[40]!==b?(k=t?.kind==="fn"&&r!==void 0&&b!==void 0&&u(de,{file:b.file,fn:b.fn,kind:r.kind},r.path),e[38]=t?.kind,e[39]=r,e[40]=b,e[41]=k):k=e[41];let w;e[42]!==t?.kind||e[43]!==r||e[44]!==l?(w=t?.kind==="fn"&&r===void 0&&u(K,{testId:"api-empty",title:l("API usage snippets")}),e[42]=t?.kind,e[43]=r,e[44]=l,e[45]=w):w=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&u(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==x||e[49]!==k||e[50]!==w||e[51]!==I?(C=R("div",{className:"min-w-0",children:[x,k,w,I]}),e[48]=x,e[49]=k,e[50]=w,e[51]=I,e[52]=C):C=e[52];let B;return e[53]!==T||e[54]!==C||e[55]!==_||e[56]!==A?(B=R("div",{className:_,"data-testid":A,children:[T,C]}),e[53]=T,e[54]=C,e[55]=_,e[56]=A,e[57]=B):B=e[57],B};function ue(a){return a.name}function me(a,e){return a.localeCompare(e)}export{oe as buildCliSnippet,ie as buildClientSnippet,se as buildReactSnippet,ce as buildTableSnippet,ke as default,Q as splitPath};
|
package/dist/packem_shared/{ApiReferencePanel-Cqy9Z7mO.mjs → ApiReferencePanel-B4i-KeOf.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as O,R as S}from"./reference-view-
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as O,R as S}from"./reference-view-AC9FgXSz.mjs";import{useT as A}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},B=r=>{const e=k(23),{spec:i}=r,s=A(),c=v();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=O(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(S,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as X}from"./internal-
|
|
1
|
+
import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as X}from"./internal-B6haJbiP.mjs";import{u as G}from"./shortcuts-B9gDaXmw.mjs";import{c as J}from"./utils-bhneXptQ.mjs";import{jsx as r,jsxs as A}from"react/jsx-runtime";const F="lunora:command-palette",ce=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(F))},Y=v=>{const e=U(18),{active:f,index:o,item:n,onActivate:h,onSelect:b}=v;let g;e[0]!==n||e[1]!==b?(g=()=>{b(n)},e[0]=n,e[1]=b,e[2]=g):g=e[2];const c=g;let x;e[3]!==o||e[4]!==h?(x=()=>{h(o)},e[3]=o,e[4]=h,e[5]=x):x=e[5];const d=x,m=f?"bg-accent text-accent-foreground":"text-foreground";let u;e[6]!==m?(u=J("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=u):u=e[7];let s;e[8]!==n.label?(s=r("span",{children:n.label}),e[8]=n.label,e[9]=s):s=e[9];let i;e[10]!==n.group?(i=r("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=i):i=e[11];let p;return e[12]!==c||e[13]!==d||e[14]!==u||e[15]!==s||e[16]!==i?(p=r("li",{children:A("button",{className:u,onClick:c,onMouseEnter:d,type:"button",children:[s,i]})}),e[12]=c,e[13]=d,e[14]=u,e[15]=s,e[16]=i,e[17]=p):p=e[17],p},Z=(v,e)=>{const f=e.trim().toLowerCase();return f===""?v:v.filter(o=>o.label.toLowerCase().includes(f)||o.group.toLowerCase().includes(f))},de=v=>{const e=U(40),{items:f}=v,o=W(),n=H(),{palette:h}=G(),[b,g]=B(!1),[c,x]=B(""),[d,m]=B(0),u=Q(null);let s,i;e[0]!==h?(s=()=>{const t=S=>{if(!(S.metaKey||S.ctrlKey)||S.key.toLowerCase()!==h)return;const{target:_}=S;_ instanceof HTMLElement&&(_.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(_.tagName))||(S.preventDefault(),g(!0))},l=()=>{g(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(F,l),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(F,l)}},i=[h],e[0]=h,e[1]=s,e[2]=i):(s=e[1],i=e[2]),V(s,i);let p;e[3]!==f||e[4]!==c?(p=Z(f,c),e[3]=f,e[4]=c,e[5]=p):p=e[5];const a=p;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{g(t),t||(x(""),m(0))},e[6]=I):I=e[6];const M=I;let K;e[7]!==n?(K=t=>{if(M(!1),t.run!==void 0){t.run();return}t.to!==void 0&&X(n({to:t.to}))},e[7]=n,e[8]=K):K=e[8];const w=K;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t=>{x(t.target.value),m(0)},e[9]=P):P=e[9];const q=P;let z;e[10]!==d||e[11]!==a||e[12]!==w?(z=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),m(l=>a.length===0?0:(l+1)%a.length);break e}case"ArrowUp":{t.preventDefault(),m(l=>a.length===0?0:(l-1+a.length)%a.length);break e}case"Enter":{t.preventDefault();const l=a[d];l!==void 0&&w(l);break e}}},e[10]=d,e[11]=a,e[12]=w,e[13]=z):z=e[13];const j=z;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=r(D.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[14]=R):R=e[14];let y;e[15]!==o?(y=o("Command palette"),e[15]=o,e[16]=y):y=e[16];let E;e[17]!==y?(E=r(D.Title,{className:"sr-only",children:y}),e[17]=y,e[18]=E):E=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=A("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[19]=O):O=e[19];let N;e[20]!==o?(N=o("Search…"),e[20]=o,e[21]=N):N=e[21];let C;e[22]!==j||e[23]!==c||e[24]!==N?(C=A("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[O,r("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:q,onKeyDown:j,placeholder:N,ref:u,type:"text",value:c})]}),e[22]=j,e[23]=c,e[24]=N,e[25]=C):C=e[25];let T;e[26]!==d||e[27]!==a||e[28]!==w||e[29]!==o?(T=a.length===0?r("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("No results.")}):a.map((t,l)=>r(Y,{active:l===d,index:l,item:t,onActivate:m,onSelect:w},t.to??`${t.group}:${t.label}`)),e[26]=d,e[27]=a,e[28]=w,e[29]=o,e[30]=T):T=e[30];let k;e[31]!==T?(k=r("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:T}),e[31]=T,e[32]=k):k=e[32];let L;e[33]!==E||e[34]!==C||e[35]!==k?(L=A(D.Portal,{children:[R,A(D.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:u,children:[E,C,k]})]}),e[33]=E,e[34]=C,e[35]=k,e[36]=L):L=e[36];let $;return e[37]!==b||e[38]!==L?($=r(D.Root,{onOpenChange:M,open:b,children:L}),e[37]=b,e[38]=L,e[39]=$):$=e[39],$};export{de as CommandPalette,ce as openCommandPalette};
|