syncorejs 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/_dashboard/assets/ConfirmActionDialog-Db4VzVp6.js +1 -0
  2. package/dist/_dashboard/assets/circle-x-VsB4Z8W4.js +1 -0
  3. package/dist/_dashboard/assets/data.lazy-DjdU9CzX.js +18 -0
  4. package/dist/_dashboard/assets/file-code-BrOKjG4n.js +1 -0
  5. package/dist/_dashboard/assets/functions.lazy-DvDwAGHq.js +1 -0
  6. package/dist/_dashboard/assets/funnel-BH8EMMJI.js +1 -0
  7. package/dist/_dashboard/assets/index-DT9ZEELb.css +1 -0
  8. package/dist/_dashboard/assets/index-DrSG4qZZ.js +54 -0
  9. package/dist/_dashboard/assets/loader-circle-CmJFSYga.js +1 -0
  10. package/dist/_dashboard/assets/logs.lazy-50KTk5yd.js +1 -0
  11. package/dist/_dashboard/assets/play-DS52VsLN.js +1 -0
  12. package/dist/_dashboard/assets/queries.lazy-CfysRWkz.js +1 -0
  13. package/dist/_dashboard/assets/scheduler.lazy-BB88mZk-.js +1 -0
  14. package/dist/_dashboard/assets/select-THYcR8Wt.js +1 -0
  15. package/dist/_dashboard/assets/separator-BU7xg615.js +1 -0
  16. package/dist/_dashboard/assets/shared-Bh0wwC2k.js +1 -0
  17. package/dist/_dashboard/assets/sql.lazy-CHtU9Qnt.js +13 -0
  18. package/dist/_dashboard/assets/storage.lazy-CneN7wVU.js +1 -0
  19. package/dist/_dashboard/assets/table-2-CH8JoMXf.js +1 -0
  20. package/dist/_dashboard/index.html +18 -0
  21. package/dist/_vendor/cli/app.d.mts.map +1 -1
  22. package/dist/_vendor/cli/app.mjs +16 -5
  23. package/dist/_vendor/cli/app.mjs.map +1 -1
  24. package/dist/_vendor/core/cli.d.mts.map +1 -1
  25. package/dist/_vendor/core/cli.mjs +358 -16
  26. package/dist/_vendor/core/cli.mjs.map +1 -1
  27. package/dist/_vendor/core/index.d.mts +3 -3
  28. package/dist/_vendor/core/runtime/devtools.d.mts.map +1 -1
  29. package/dist/_vendor/core/runtime/devtools.mjs +131 -0
  30. package/dist/_vendor/core/runtime/devtools.mjs.map +1 -1
  31. package/dist/_vendor/core/runtime/functions.d.mts +3 -3
  32. package/dist/_vendor/core/runtime/functions.mjs.map +1 -1
  33. package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs +1 -1
  34. package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs.map +1 -1
  35. package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs +4 -1
  36. package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs.map +1 -1
  37. package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs +6 -3
  38. package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs.map +1 -1
  39. package/dist/_vendor/core/runtime/internal/engines/shared.mjs +5 -1
  40. package/dist/_vendor/core/runtime/internal/engines/shared.mjs.map +1 -1
  41. package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs +99 -13
  42. package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs.map +1 -1
  43. package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs +38 -4
  44. package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs.map +1 -1
  45. package/dist/_vendor/core/runtime/runtime.d.mts +65 -8
  46. package/dist/_vendor/core/runtime/runtime.d.mts.map +1 -1
  47. package/dist/_vendor/core/runtime/runtime.mjs.map +1 -1
  48. package/dist/_vendor/core/transport.d.mts.map +1 -1
  49. package/dist/_vendor/core/transport.mjs +30 -5
  50. package/dist/_vendor/core/transport.mjs.map +1 -1
  51. package/dist/_vendor/devtools-protocol/index.d.ts +75 -1
  52. package/dist/_vendor/devtools-protocol/index.d.ts.map +1 -1
  53. package/dist/_vendor/devtools-protocol/index.js.map +1 -1
  54. package/dist/_vendor/next/index.js +9 -1
  55. package/dist/_vendor/next/index.js.map +1 -1
  56. package/dist/_vendor/platform-expo/index.d.ts +1 -1
  57. package/dist/_vendor/platform-expo/index.d.ts.map +1 -1
  58. package/dist/_vendor/platform-expo/index.js +6 -1
  59. package/dist/_vendor/platform-expo/index.js.map +1 -1
  60. package/dist/_vendor/platform-node/index.d.mts +2 -1
  61. package/dist/_vendor/platform-node/index.d.mts.map +1 -1
  62. package/dist/_vendor/platform-node/index.mjs +27 -2
  63. package/dist/_vendor/platform-node/index.mjs.map +1 -1
  64. package/dist/_vendor/platform-node/ipc-react.mjs +4 -0
  65. package/dist/_vendor/platform-node/ipc-react.mjs.map +1 -1
  66. package/dist/_vendor/platform-web/external-change.d.ts +2 -2
  67. package/dist/_vendor/platform-web/external-change.js +2 -2
  68. package/dist/_vendor/platform-web/external-change.js.map +1 -1
  69. package/dist/_vendor/platform-web/index.d.ts +13 -10
  70. package/dist/_vendor/platform-web/index.d.ts.map +1 -1
  71. package/dist/_vendor/platform-web/index.js +66 -10
  72. package/dist/_vendor/platform-web/index.js.map +1 -1
  73. package/dist/_vendor/platform-web/indexeddb.d.ts +3 -3
  74. package/dist/_vendor/platform-web/indexeddb.js +3 -3
  75. package/dist/_vendor/platform-web/indexeddb.js.map +1 -1
  76. package/dist/_vendor/platform-web/opfs.d.ts +3 -1
  77. package/dist/_vendor/platform-web/opfs.d.ts.map +1 -1
  78. package/dist/_vendor/platform-web/opfs.js +29 -3
  79. package/dist/_vendor/platform-web/opfs.js.map +1 -1
  80. package/dist/_vendor/platform-web/persistence.d.ts +31 -1
  81. package/dist/_vendor/platform-web/persistence.d.ts.map +1 -1
  82. package/dist/_vendor/platform-web/persistence.js.map +1 -1
  83. package/dist/_vendor/platform-web/react.d.ts.map +1 -1
  84. package/dist/_vendor/platform-web/react.js +9 -1
  85. package/dist/_vendor/platform-web/react.js.map +1 -1
  86. package/dist/_vendor/react/index.d.ts +6 -5
  87. package/dist/_vendor/react/index.d.ts.map +1 -1
  88. package/dist/_vendor/react/index.js +6 -5
  89. package/dist/_vendor/react/index.js.map +1 -1
  90. package/dist/_vendor/svelte/index.d.ts +8 -6
  91. package/dist/_vendor/svelte/index.d.ts.map +1 -1
  92. package/dist/_vendor/svelte/index.js +7 -5
  93. package/dist/_vendor/svelte/index.js.map +1 -1
  94. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ import{Ot as e}from"./index-DrSG4qZZ.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./shared-Bh0wwC2k.js";import{t}from"./funnel-BH8EMMJI.js";import{t as n}from"./play-DS52VsLN.js";import{A as r,At as i,C as a,Dt as o,Ft as s,Mt as c,Ot as l,Pt as u,_t as d,a as f,at as ee,c as p,ct as m,d as h,dt as g,f as _,i as v,j as y,jt as te,kt as b,mt as x,n as ne,o as S,ot as C,pt as w,r as T,s as E,st as D,tt as O,u as k,v as A,y as re}from"./index-DrSG4qZZ.js";var j=l(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),M=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),N=l(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),ie=l(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),P=s(u(),1),F=c(),I=b(`/logs`)({component:R}),ae=[{value:`query.executed`,label:`Queries`},{value:`mutation.committed`,label:`Mutations`},{value:`action.completed`,label:`Actions`},{value:`log`,label:`Logs`},{value:`scheduler.tick`,label:`Scheduler`},{value:`storage.updated`,label:`Storage`}];function L(e){return!!(e.type===`action.completed`&&e.error||e.type===`log`&&e.level===`error`)}function oe({event:e,isSelected:t,onClick:n,isNew:r,runtimeMap:i,causalBadges:a}){let o=S[e.type],s=E[e.type],c=_(e),l=k(e),u=L(e),d=h(e,i);return(0,F.jsxs)(`button`,{type:`button`,onClick:n,className:m(`flex items-center gap-2.5 w-full px-4 py-2 text-left transition-colors outline-none`,`hover:bg-bg-elevated/50`,t&&`bg-bg-elevated border-l-2 border-l-accent`,u&&`bg-error/3`,r&&`animate-fade-in`),children:[(0,F.jsx)(s,{size:12,className:m(o,`shrink-0`)}),(0,F.jsx)(y,{variant:f[e.type],className:`w-18 justify-center text-[10px] shrink-0`,children:p[e.type]}),(0,F.jsx)(y,{variant:`outline`,className:`hidden w-30 justify-center text-[10px] shrink-0 xl:inline-flex`,children:d}),(0,F.jsx)(`span`,{className:`text-[12px] text-text-secondary font-mono truncate flex-1`,children:c}),a.length>0&&(0,F.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 lg:flex`,children:a.slice(0,2).map(e=>(0,F.jsxs)(y,{variant:`secondary`,className:`gap-1 text-[10px]`,title:e,children:[(0,F.jsx)(N,{size:10}),e]},e))}),l&&(0,F.jsx)(`span`,{className:`text-[11px] text-text-tertiary font-mono shrink-0 tabular-nums`,children:l}),u&&(0,F.jsx)(x,{size:11,className:`text-error shrink-0`}),(0,F.jsx)(`span`,{className:`text-[10px] text-text-tertiary shrink-0 tabular-nums ml-2 font-mono`,children:g(e.timestamp)})]})}function R(){let{events:s,traceIndex:c}=A(),l=i(),u=te({from:`/logs`}),f=C(),p=ee(e=>e.includeDashboardActivity),h=(0,P.useMemo)(()=>D(s,p),[s,p]),g=(0,P.useMemo)(()=>new Map(f.map(e=>[e.runtimeId,{label:O(e),publicId:e.runtimeId.slice(0,8)}])),[f]),[b,x]=(0,P.useState)(null),[S,E]=(0,P.useState)(!1),[k,N]=(0,P.useState)(``),[I,L]=(0,P.useState)(new Set),[R,z]=(0,P.useState)(!1),U=(0,P.useRef)(null),[W,G]=(0,P.useState)([]),K=(0,P.useRef)(0),ce=K.current,q=S?W:h,J=(0,P.useMemo)(()=>q.filter(v),[q]),Y=(0,P.useMemo)(()=>ne(q),[q]);(0,P.useEffect)(()=>{S||(G(h),K.current=h.filter(v).length)},[S,h]),(0,P.useEffect)(()=>{S||G(h)},[h,S]);let X=(0,P.useMemo)(()=>{let e=J;if(I.size>0&&(e=e.filter(e=>I.has(e.type))),k.trim()){let t=k.toLowerCase();e=e.filter(e=>_(e).toLowerCase().includes(t)||e.type.toLowerCase().includes(t))}return e},[J,I,k]),le=(0,P.useCallback)(e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Z=b===null?null:X[b]??null,Q=Z?B(Z,c):null,ue=Q?.executionId?c.invalidationsByCause.get(Q.executionId)??[]:[],de=Z?.type===`query.executed`?T(Z,Y).map(e=>({invalidation:e,trace:e.causedByExecutionId?c.byExecutionId.get(e.causedByExecutionId)??null:null})):[],fe=Z?.type===`query.invalidated`&&Z.causedByExecutionId?c.byExecutionId.get(Z.causedByExecutionId)??null:null,pe=(0,P.useCallback)(()=>{U.current&&(U.current.scrollTop=0)},[]),$=(0,P.useCallback)(e=>{let t=X.findIndex(t=>V(t)===e);t>=0&&x(t)},[X]);return(0,P.useEffect)(()=>{u.executionId&&(E(!1),N(``),L(new Set))},[u.executionId]),(0,P.useEffect)(()=>{u.executionId&&$(u.executionId)},[u.executionId,$]),(0,F.jsxs)(`div`,{className:`flex h-[calc(100vh-7rem)] flex-col gap-3`,children:[(0,F.jsxs)(`div`,{className:`shrink-0 rounded-md border border-border bg-bg-surface p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!p&&(0,F.jsx)(y,{variant:`outline`,className:`text-[10px]`,children:`App only`}),(0,F.jsxs)(`div`,{className:`relative flex-1 max-w-sm min-w-48`,children:[(0,F.jsx)(d,{size:13,className:`absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary pointer-events-none`}),(0,F.jsx)(a,{type:`text`,placeholder:`Search logs...`,value:k,onChange:e=>N(e.target.value),className:`h-8 pl-8 pr-8 text-[12px]`}),k&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>N(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-text-tertiary hover:text-text-secondary`,children:(0,F.jsx)(w,{size:12})})]}),(0,F.jsxs)(r,{variant:R||I.size>0?`default`:`secondary`,size:`sm`,onClick:()=>z(!R),className:m(`text-[12px]`,(R||I.size>0)&&`bg-accent/10 border-accent/30 text-accent hover:bg-accent/15`),children:[(0,F.jsx)(t,{size:12}),`Filter`,I.size>0&&(0,F.jsx)(y,{variant:`default`,className:`ml-1 text-[10px] px-1.5 py-0`,children:I.size})]}),(0,F.jsxs)(r,{variant:S?`outline`:`secondary`,size:`sm`,onClick:()=>E(!S),className:m(`text-[12px]`,S&&`border-warning/30 text-warning hover:bg-warning/10`),children:[S?(0,F.jsx)(n,{size:12}):(0,F.jsx)(ie,{size:12}),S?`Resume`:`Pause`]}),(0,F.jsxs)(r,{variant:`secondary`,size:`sm`,onClick:pe,className:`text-[12px]`,children:[(0,F.jsx)(j,{size:12}),`Latest`]}),(0,F.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:(0,F.jsxs)(y,{variant:`secondary`,className:`tabular-nums`,children:[X.length,` events`]})})]}),R&&(0,F.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 flex-wrap`,children:[ae.map(e=>(0,F.jsx)(r,{variant:I.has(e.value)?`default`:`ghost`,size:`xs`,onClick:()=>le(e.value),className:m(`text-[11px]`,I.has(e.value)?`bg-accent/10 text-accent hover:bg-accent/15`:`text-text-tertiary hover:text-text-secondary`),children:e.label},e.value)),I.size>0&&(0,F.jsx)(r,{variant:`ghost`,size:`xs`,onClick:()=>L(new Set),className:`text-[11px] text-text-tertiary hover:text-text-secondary ml-1`,children:`Clear all`})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden rounded-md border border-border bg-bg-surface`,children:[(0,F.jsx)(re,{ref:U,className:m(`flex-1`,Z&&`md:max-w-3/5`),children:X.length===0?(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-64 text-text-tertiary`,children:[(0,F.jsx)(o,{size:20,className:`mb-2 opacity-40`}),(0,F.jsx)(`span`,{className:`text-[12px]`,children:s.length===0?`Waiting for events...`:`No events match your filters`})]}):(0,F.jsx)(`div`,{className:`divide-y divide-border/50`,children:X.map((e,t)=>{let n=H(e,c,e.type===`query.executed`?T(e,Y):[]);return(0,F.jsx)(oe,{event:e,isSelected:b===t,isNew:t>=ce,runtimeMap:g,causalBadges:n,onClick:()=>x(b===t?null:t)},`${e.type}-${e.timestamp}-${t}`)})})}),Z&&(0,F.jsxs)(`div`,{className:m(`flex flex-col overflow-hidden bg-bg-base`,`fixed inset-0 z-50`,`md:static md:inset-auto md:z-auto md:w-2/5 md:shrink-0 md:overflow-y-auto md:border-l md:border-border`),children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border bg-bg-surface px-4 py-2.5 md:py-2`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>x(null),className:`flex items-center gap-1.5 text-[12px] text-text-secondary hover:text-text-primary md:hidden`,children:[(0,F.jsx)(M,{size:14}),`Back`]}),(0,F.jsx)(`span`,{className:`flex-1 text-[11px] font-semibold text-text-primary md:flex-none`,children:`Event Detail`}),(0,F.jsx)(r,{variant:`ghost`,size:`icon-xs`,onClick:()=>x(null),className:`hidden md:flex`,children:(0,F.jsx)(w,{size:14})})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,F.jsx)(e,{event:Z,trace:Q,invalidations:ue,invalidatedBy:de,causingTrace:fe,onOpenExecution:$,onOpenFunction:e=>void l({to:`/functions`,search:se(e,Q)}),onOpenTable:()=>void l({to:`/data`})})})]})]})]})}function se(e,t){let n=z(t);return{fn:e,...n?{args:JSON.stringify(n)}:{}}}function z(e){return e?.argsPreview?.kind===`value`&&e.argsPreview.value&&typeof e.argsPreview.value==`object`&&!Array.isArray(e.argsPreview.value)?e.argsPreview.value:null}function B(e,t){let n=V(e);return n?t.byExecutionId.get(n)??null:e.type===`query.invalidated`&&e.rerunExecutionId?t.byExecutionId.get(e.rerunExecutionId)??null:null}function V(e){return`executionId`in e&&e.executionId?e.executionId:e.type===`mutation.committed`?e.mutationId:e.type===`action.completed`?e.actionId:null}function H(e,t,n){if(e.type===`query.executed`&&n.length>0)return n.map(e=>e.causedByExecutionId?`Rerun by ${e.causedByExecutionId.slice(0,8)}`:`Rerun`);let r=V(e),i=r?t.invalidationsByCause.get(r)??[]:[];if(i.length===0)return[];let a=i.filter(e=>e.rerunExecutionId);return[a.length>0?`caused ${a.length} rerun${a.length===1?``:`s`}`:`invalidated ${i.length}`]}export{I as Route};
@@ -0,0 +1 @@
1
+ import{Ot as e}from"./index-DrSG4qZZ.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,r as n}from"./shared-Bh0wwC2k.js";import{t as r}from"./file-code-BrOKjG4n.js";import{t as i}from"./loader-circle-CmJFSYga.js";import{A as a,At as o,C as s,Dt as c,Ft as l,Mt as u,Ot as d,Pt as f,St as p,_t as m,ct as h,g,j as _,kt as v,p as y,pt as b,ut as x,y as S}from"./index-DrSG4qZZ.js";var C=d(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),w=l(f(),1),T=u(),E=v(`/queries`)({component:D});function D(){let l=o(),{queryId:u}=E.useSearch(),{targetRuntimeId:d,usingProjectTarget:f,supportsOffline:p,selectedTarget:h,runtimeFilter:v}=g(),[x,D]=(0,w.useState)(``),[M,N]=(0,w.useState)(u??null),P=(0,w.useMemo)(()=>h&&v===`all`?h.runtimes.filter(e=>e.connected).map(e=>e.runtimeId):d?[d]:[],[v,h,d]),F=y(P.length>0?{kind:`runtime.activeQueries`}:null,P,{enabled:P.length>0}),I=(0,w.useMemo)(()=>Object.entries(F.dataByRuntime).flatMap(([e,t])=>t.kind===`runtime.activeQueries.result`?t.activeQueries.map(t=>({...t,runtimeId:e})):[]),[F.dataByRuntime]),L=(0,w.useMemo)(()=>{let e=x.trim().toLowerCase(),t=[...I].sort((e,t)=>t.lastRunAt-e.lastRunAt);return e?t.filter(t=>[t.functionName,t.id,JSON.stringify(t.args??{}),...t.dependencyKeys].join(` `).toLowerCase().includes(e)):t},[I,x]),R=L.find(e=>k(e)===M||e.id===M)??L[0]??null,z=new Set(I.map(e=>e.functionName)).size,B=new Set(I.flatMap(e=>e.dependencyKeys)).size,V=I.reduce((e,t)=>e+(t.consumers??1),0);return d?(0,T.jsxs)(`div`,{className:`flex h-[calc(100vh-7rem)] gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden rounded-md border border-border bg-bg-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border p-4`,children:[(0,T.jsx)(c,{size:16,className:`text-accent`}),(0,T.jsx)(`h2`,{className:`flex-1 text-[14px] font-bold text-text-primary`,children:`Active Queries`}),f&&(0,T.jsx)(_,{variant:`outline`,className:`text-[9px]`,children:`Project Target`}),F.loading&&(0,T.jsx)(i,{size:12,className:`animate-spin text-text-tertiary`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 border-b border-border p-3`,children:[(0,T.jsx)(A,{label:`Watching`,value:I.length,icon:c}),(0,T.jsx)(A,{label:`Consumers`,value:V,icon:C}),(0,T.jsx)(A,{label:`Functions`,value:z,icon:r})]}),(0,T.jsx)(`div`,{className:`border-b border-border p-3`,children:(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(m,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-text-tertiary`}),(0,T.jsx)(s,{placeholder:`Search by function, args, dependency...`,value:x,onChange:e=>D(e.target.value),className:`h-8 border-border bg-bg-base pl-8 text-[12px]`})]})}),L.length===0?(0,T.jsx)(n,{icon:c,title:`No active query subscriptions`,description:`Queries appear here while the app has live subscribers.`,className:`h-full`}):(0,T.jsx)(S,{className:`min-h-0 flex-1`,children:(0,T.jsx)(`div`,{className:`space-y-1 p-2`,children:L.map(e=>(0,T.jsx)(O,{query:e,selected:R?k(R)===k(e):!1,onSelect:()=>N(k(e))},k(e)))})})]}),R&&(0,T.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col overflow-hidden bg-bg-surface xl:static xl:inset-auto xl:z-auto xl:w-105 xl:shrink-0 xl:overflow-visible xl:rounded-md xl:border xl:border-border`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border p-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`truncate font-mono text-[12px] font-semibold text-text-primary`,children:R.functionName.replaceAll(`/`,`:`)}),(0,T.jsxs)(`div`,{className:`mt-0.5 text-[10px] text-text-tertiary`,children:[R.consumers??1,` consumer`,(R.consumers??1)===1?``:`s`,` ·`,` `,R.dependencyKeys.length,` dependencies`]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(a,{variant:`outline`,size:`xs`,className:`gap-1.5`,onClick:()=>void l({to:`/functions`,search:{fn:R.functionName,args:JSON.stringify(R.args??{})}}),children:[(0,T.jsx)(r,{size:11}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`Function`})]}),(0,T.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>N(null),className:`xl:hidden`,children:(0,T.jsx)(b,{size:14})})]})]}),(0,T.jsx)(S,{className:`flex-1`,children:(0,T.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,T.jsx)(j,{label:`Query ID`,children:(0,T.jsx)(`code`,{className:`block break-all rounded bg-bg-base px-2 py-1 text-[11px] text-text-code`,children:R.id})}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(j,{label:`Last Run`,children:R.lastRunAt>0?(0,T.jsx)(t,{timestamp:R.lastRunAt,format:`both`}):(0,T.jsx)(`span`,{className:`text-[12px] text-text-tertiary`,children:`pending`})}),(0,T.jsx)(j,{label:`Owner`,children:(0,T.jsx)(_,{variant:`secondary`,children:R.owner??`root`})})]}),R.componentPath&&(0,T.jsx)(j,{label:`Component`,children:(0,T.jsx)(`code`,{className:`text-[11px] text-text-primary`,children:R.componentPath})}),(0,T.jsx)(j,{label:`Arguments`,children:(0,T.jsx)(e,{data:R.args??{},defaultExpanded:!0,maxDepth:4})}),(0,T.jsx)(j,{label:`Dependencies`,children:(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:R.dependencyKeys.length===0?(0,T.jsx)(`span`,{className:`text-[12px] text-text-tertiary`,children:`No dependencies collected yet.`}):R.dependencyKeys.map(e=>(0,T.jsx)(_,{variant:`outline`,className:`font-mono text-[10px]`,children:e},e))})}),(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-bg-base px-3 py-2 text-[11px] text-text-tertiary`,children:[B,` unique dependencies are currently watched across all active queries.`]})]})})]})]}):(0,T.jsx)(`div`,{className:`h-[calc(100vh-7rem)]`,children:(0,T.jsx)(n,{icon:c,title:`Active queries unavailable`,description:p?`The selected Project Target runtime is not available right now.`:`Connect a runtime to inspect live query subscriptions.`,className:`h-full`})})}function O({query:e,selected:t,onSelect:n}){return(0,T.jsxs)(`button`,{type:`button`,onClick:n,className:h(`flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left transition-colors`,t?`border-accent/20 bg-accent/8`:`border-transparent hover:bg-bg-base`),children:[(0,T.jsx)(c,{size:13,className:`shrink-0 text-fn-query`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`truncate font-mono text-[12px] text-text-primary`,children:e.functionName.replaceAll(`/`,`:`)}),(e.consumers??1)>1&&(0,T.jsxs)(_,{variant:`secondary`,className:`px-1 py-0 text-[9px]`,children:[e.consumers,` consumers`]})]}),(0,T.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-text-tertiary`,children:[(0,T.jsx)(`span`,{className:`font-mono`,children:e.runtimeId.slice(0,8)}),(0,T.jsxs)(`span`,{className:`font-mono`,children:[e.dependencyKeys.length,` deps`]}),(0,T.jsx)(`span`,{children:x(e.lastRunAt)})]})]}),(0,T.jsx)(p,{size:12,className:`shrink-0 text-text-tertiary`})]})}function k(e){return`${e.runtimeId}:${e.id}`}function A({label:e,value:t,icon:n}){return(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-bg-base px-3 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-tertiary`,children:[(0,T.jsx)(n,{size:11}),e]}),(0,T.jsx)(`div`,{className:`mt-1 font-mono text-[18px] font-semibold text-text-primary`,children:t})]})}function j({label:e,children:t}){return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-text-tertiary`,children:e}),t]})}export{E as Route};
@@ -0,0 +1 @@
1
+ import{c as e,i as t,l as n,n as r,r as i,s as a,u as o}from"./shared-Bh0wwC2k.js";import{a as s,i as c,n as l,r as u,t as d}from"./select-THYcR8Wt.js";import{t as f}from"./circle-x-VsB4Z8W4.js";import{t as p}from"./loader-circle-CmJFSYga.js";import{A as m,C as h,Ct as g,Ft as _,Mt as v,Ot as y,Pt as b,St as x,ct as S,g as C,j as w,kt as T,m as E,rt as D,ut as O,wt as k,y as A}from"./index-DrSG4qZZ.js";var j=y(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),M=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),N=y(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),P=_(b(),1),F=v(),I=T(`/scheduler`)({component:R}),L=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`];function R(){let{targetRuntimeId:t,usingProjectTarget:r,supportsOffline:s}=C(),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(null),[f,m]=(0,P.useState)(!1),[h,_]=(0,P.useState)(null),v=c?.id??null,y=c?.updatedAt??null,b=E(t?{kind:`scheduler.jobs`}:null,{enabled:!!t,targetRuntimeId:t}),S=(0,P.useMemo)(()=>b.data?.kind===`scheduler.jobs.result`?b.data.jobs:[],[b.data]);(0,P.useEffect)(()=>{v&&l(S.find(e=>e.id===v)??null)},[S,c,v]),(0,P.useEffect)(()=>{if(!c||c.status!==`pending`){d(null),_(null);return}d(J(c)),_(null)},[c,v,y]);let T=(0,P.useCallback)(async e=>{if(!t)return;_(null);let n=await D({kind:`scheduler.cancel`,jobId:e},{targetRuntimeId:t});if(n.kind===`scheduler.cancel.result`&&n.error){_(n.error);return}n.kind===`scheduler.cancel.result`&&!n.cancelled&&_(`This job could not be cancelled anymore.`)},[t]),O=(0,P.useCallback)(async()=>{if(!(!t||!c||!u)){m(!0),_(null);try{let e=Z(u.argsText),n=$(u.runAtText),r=q(c)?u.schedule:void 0,i=r?te(u):void 0,a=await D({kind:`scheduler.update`,jobId:c.id,args:e,runAt:n,...r?{schedule:r}:{},...i?{misfirePolicy:i}:{}},{targetRuntimeId:t});if(a.kind!==`scheduler.update.result`)return;if(a.error){_(a.error);return}if(!a.updated){_(`This job is no longer editable.`);return}a.job&&l(a.job)}catch(e){_(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[u,c,t]),k=(0,P.useMemo)(()=>[...S].sort((e,t)=>t.runAt-e.runAt),[S]),A=(0,P.useMemo)(()=>k.filter(e=>e.status===`pending`||e.status===`running`),[k]),M=(0,P.useMemo)(()=>k.filter(e=>!!(e.recurringName&&e.schedule)),[k]),I=(0,P.useMemo)(()=>k.filter(e=>[`completed`,`failed`,`cancelled`].includes(e.status)),[k]);return t?(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 lg:h-[calc(100vh-7rem)] lg:flex-row`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col overflow-hidden rounded-md border border-border bg-bg-surface lg:flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border p-4`,children:[(0,F.jsx)(x,{size:16,className:`text-accent`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`text-[14px] font-bold text-text-primary`,children:`Scheduler`}),(0,F.jsx)(`p`,{className:`text-[11px] text-text-tertiary`,children:`Manage and edit scheduled function calls`})]}),r&&(0,F.jsx)(w,{variant:`outline`,className:`text-[9px]`,children:`Project Target`}),b.loading&&(0,F.jsx)(p,{size:12,className:`animate-spin text-text-tertiary`})]}),(0,F.jsxs)(a,{defaultValue:`pending`,className:`flex flex-col lg:min-h-0 lg:flex-1`,children:[(0,F.jsx)(`div`,{className:`border-b border-border px-4`,children:(0,F.jsxs)(n,{variant:`line`,className:`h-9`,children:[(0,F.jsxs)(o,{value:`pending`,className:`gap-1`,children:[(0,F.jsx)(N,{size:12}),`Pending`,A.length>0&&(0,F.jsx)(w,{variant:`warning`,className:`ml-1 px-1 py-0 text-[9px]`,children:A.length})]}),(0,F.jsxs)(o,{value:`recurring`,className:`gap-1`,children:[(0,F.jsx)(j,{size:12}),`Recurring`,M.length>0&&(0,F.jsx)(w,{variant:`secondary`,className:`ml-1 px-1 py-0 text-[9px]`,children:M.length})]}),(0,F.jsxs)(o,{value:`history`,className:`gap-1`,children:[(0,F.jsx)(g,{size:12}),`History`]})]})}),(0,F.jsx)(e,{value:`pending`,className:`lg:min-h-0 lg:flex-1`,children:(0,F.jsx)(z,{jobs:A,selectedJobId:c?.id??null,onSelect:l,onCancel:e=>{T(e)},emptyTitle:`No pending jobs`,emptyDescription:`Scheduled jobs will appear here when they are queued.`})}),(0,F.jsx)(e,{value:`recurring`,className:`lg:min-h-0 lg:flex-1`,children:(0,F.jsx)(z,{jobs:M,selectedJobId:c?.id??null,onSelect:l,onCancel:e=>{T(e)},emptyTitle:`No recurring jobs`,emptyDescription:`Recurring jobs will appear here once they are registered.`})}),(0,F.jsx)(e,{value:`history`,className:`lg:min-h-0 lg:flex-1`,children:(0,F.jsx)(z,{jobs:I,selectedJobId:c?.id??null,onSelect:l,emptyTitle:`No job history`,emptyDescription:`Completed, failed and cancelled jobs will appear here.`})})]})]}),c&&(0,F.jsx)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-bg-surface lg:contents`,children:(0,F.jsx)(B,{job:c,editorState:u,saving:f,error:h,usingProjectTarget:r,onClose:()=>l(null),onCancel:e=>{T(e)},onEditorChange:d,onSave:()=>{O()}})},c.id)]}):(0,F.jsx)(`div`,{className:`h-[calc(100vh-7rem)]`,children:(0,F.jsx)(i,{icon:x,title:`Scheduler unavailable`,description:s?`The selected Project Target runtime is not available right now.`:`Connect a runtime or configure a project target to manage scheduled jobs.`,className:`h-full`})})}function z({jobs:e,selectedJobId:t,onSelect:n,onCancel:r,emptyTitle:a,emptyDescription:o}){return e.length===0?(0,F.jsx)(i,{icon:x,title:a,description:o,className:`h-full`}):(0,F.jsx)(A,{className:`max-h-[60vh] lg:h-full lg:max-h-none`,children:(0,F.jsx)(`div`,{className:`space-y-1 p-2`,children:e.map(e=>(0,F.jsx)(`div`,{onClick:()=>n(e),className:S(`cursor-pointer rounded-md border px-3 py-2.5 transition-colors`,t===e.id?`border-accent/20 bg-accent/8`:`border-transparent hover:bg-bg-base`),children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(G,{status:e.status}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,F.jsx)(`span`,{className:`font-mono text-[12px] text-text-primary`,children:e.functionName.replaceAll(`/`,`:`)}),e.scheduleLabel&&(0,F.jsx)(w,{variant:`outline`,className:`px-1 py-0 text-[8px]`,children:e.scheduleLabel})]}),(0,F.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px] text-text-tertiary`,children:[(0,F.jsx)(`span`,{children:O(e.runAt)}),e.recurringName&&(0,F.jsx)(`span`,{className:`font-medium text-text-secondary`,children:e.recurringName})]})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,F.jsx)(K,{status:e.status}),r&&e.status===`pending`&&(0,F.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:t=>{t.stopPropagation(),r(e.id)},title:`Cancel job`,children:(0,F.jsx)(f,{size:12,className:`text-error`})})]})]})},e.id))})})}function B({job:i,editorState:g,saving:_,error:v,usingProjectTarget:y,onClose:b,onCancel:x,onEditorChange:S,onSave:C}){let T=i.status===`pending`&&g,E=q(i);return(0,F.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden lg:h-auto lg:flex-none lg:rounded-md lg:border lg:border-border lg:w-96 lg:shrink-0`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(G,{status:i.status}),(0,F.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] font-semibold text-text-primary`,children:i.functionName.replaceAll(`/`,`:`)})]}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(K,{status:i.status}),(0,F.jsx)(w,{variant:`outline`,className:`text-[9px]`,children:E?`Recurring`:`One-shot`}),i.recurringName&&(0,F.jsx)(`span`,{className:`truncate text-[10px] text-text-tertiary`,children:i.recurringName})]})]}),(0,F.jsx)(m,{variant:`ghost`,size:`icon-xs`,onClick:b,children:(0,F.jsx)(f,{size:12})})]}),(0,F.jsxs)(a,{defaultValue:T?`edit`:`info`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,F.jsx)(`div`,{className:`shrink-0 border-b border-border px-4`,children:(0,F.jsxs)(n,{variant:`line`,className:`h-9`,children:[(0,F.jsx)(o,{value:`info`,className:`text-[12px]`,children:`Info`}),T&&(0,F.jsx)(o,{value:`edit`,className:`text-[12px]`,children:`Edit`})]})}),(0,F.jsx)(e,{value:`info`,className:`overflow-y-auto`,children:(0,F.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(W,{label:`Scheduled At`,children:(0,F.jsx)(r,{timestamp:i.scheduledAt,format:`both`})}),(0,F.jsx)(W,{label:`Run At`,children:(0,F.jsx)(r,{timestamp:i.runAt,format:`both`})}),i.lastRunAt&&(0,F.jsx)(W,{label:`Last Run`,children:(0,F.jsx)(r,{timestamp:i.lastRunAt,format:`both`})}),i.updatedAt&&(0,F.jsx)(W,{label:`Updated At`,children:(0,F.jsx)(r,{timestamp:i.updatedAt,format:`both`})})]}),i.scheduleLabel&&(0,F.jsx)(W,{label:`Schedule`,children:(0,F.jsx)(`code`,{className:`block rounded bg-bg-base px-2 py-1 text-[11px] text-text-code`,children:i.scheduleLabel})}),(0,F.jsx)(W,{label:`Arguments`,children:(0,F.jsx)(t,{data:i.args,defaultExpanded:!0,maxDepth:4})}),(0,F.jsx)(W,{label:`Job ID`,children:(0,F.jsx)(`code`,{className:`block break-all rounded bg-bg-base px-2 py-1 text-[10px] text-text-code opacity-60`,children:i.id})}),i.status!==`pending`&&(0,F.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border bg-bg-base px-3 py-2.5 text-[11px] text-text-tertiary`,children:[(0,F.jsx)(M,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsx)(`span`,{children:i.status===`running`?`This job is currently running.`:`This job has already ${i.status}.`})]})]})}),T&&g&&(0,F.jsxs)(e,{value:`edit`,className:`flex min-h-0 flex-col`,children:[(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,F.jsxs)(`div`,{className:`space-y-5 p-4`,children:[E&&g.schedule&&(0,F.jsx)(V,{state:{...g,schedule:g.schedule},onChange:S}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`label`,{className:`block text-[11px] font-medium text-text-tertiary`,children:E?`Next Run (override)`:`Run At`}),(0,F.jsx)(`input`,{type:`datetime-local`,value:g.runAtText,onChange:e=>S({...g,runAtText:e.target.value}),className:`h-9 w-full rounded-md border border-border bg-bg-base px-3 text-[12px] text-text-primary outline-none scheme-dark focus:border-border-active`})]}),(0,F.jsx)(H,{state:g,isRecurring:E}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`label`,{className:`block text-[11px] font-medium text-text-tertiary`,children:[`Arguments`,(0,F.jsx)(`span`,{className:`ml-1.5 rounded bg-bg-elevated px-1 py-0.5 text-[9px] font-normal text-text-tertiary`,children:`JSON`})]}),(0,F.jsx)(`textarea`,{value:g.argsText,onChange:e=>S({...g,argsText:e.target.value}),className:`min-h-28 w-full rounded-md border border-border bg-bg-base px-3 py-2 font-mono text-[12px] text-text-primary outline-none transition-colors focus:border-border-active`,spellCheck:!1,placeholder:`[]`})]}),E&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`label`,{className:`block text-[11px] font-medium text-text-tertiary`,children:`Misfire Policy`}),(0,F.jsxs)(d,{value:g.misfireType,onValueChange:e=>S({...g,misfireType:e}),children:[(0,F.jsx)(c,{className:`h-9 w-full text-[12px]`,children:(0,F.jsx)(s,{})}),(0,F.jsxs)(l,{children:[(0,F.jsx)(u,{value:`catch_up`,children:`Catch up — run all missed`}),(0,F.jsx)(u,{value:`skip`,children:`Skip — ignore if missed`}),(0,F.jsx)(u,{value:`run_once_if_missed`,children:`Run once if missed`}),(0,F.jsx)(u,{value:`windowed`,children:`Windowed — within a time window`})]})]}),g.misfireType===`windowed`&&(0,F.jsx)(h,{type:`number`,min:`0`,value:g.windowMs,onChange:e=>S({...g,windowMs:e.target.value}),placeholder:`Window in milliseconds`})]}),v&&(0,F.jsx)(`div`,{className:`rounded-md border border-error/20 bg-error/5 px-3 py-2 text-[11px] text-error`,children:v})]})}),(0,F.jsxs)(`div`,{className:`shrink-0 border-t border-border bg-bg-surface p-3`,children:[(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsxs)(m,{size:`sm`,className:`flex-1 gap-1.5`,onClick:()=>void C(),disabled:_,children:[_&&(0,F.jsx)(p,{size:12,className:`animate-spin`}),`Save Changes`]}),(0,F.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>void x(i.id),disabled:_,children:`Cancel Job`})]}),y&&(0,F.jsx)(`p`,{className:`mt-1.5 text-center text-[10px] text-text-tertiary`,children:`Running via Project Target`})]})]})]})]})}function V({state:e,onChange:t}){let n=e.schedule;return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`label`,{className:`block text-[11px] font-medium text-text-tertiary`,children:`Schedule Type`}),(0,F.jsxs)(d,{value:n.type,onValueChange:n=>t({...e,schedule:Y(n)}),children:[(0,F.jsx)(c,{className:`h-9 w-full text-[12px]`,children:(0,F.jsx)(s,{})}),(0,F.jsxs)(l,{children:[(0,F.jsx)(u,{value:`interval`,children:`Interval — repeat every N hours/min/sec`}),(0,F.jsx)(u,{value:`daily`,children:`Daily — at a specific time each day`}),(0,F.jsx)(u,{value:`weekly`,children:`Weekly — on a specific day and time`})]})]})]}),n.type===`interval`&&(0,F.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,F.jsx)(U,{label:`Hours`,value:n.hours??0,onChange:r=>t({...e,schedule:{...n,hours:r}})}),(0,F.jsx)(U,{label:`Minutes`,value:n.minutes??0,onChange:r=>t({...e,schedule:{...n,minutes:r}})}),(0,F.jsx)(U,{label:`Seconds`,value:n.seconds??0,onChange:r=>t({...e,schedule:{...n,seconds:r}})})]}),n.type===`daily`&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsx)(U,{label:`Hour`,value:n.hour,onChange:r=>t({...e,schedule:{...n,hour:r}})}),(0,F.jsx)(U,{label:`Minute`,value:n.minute,onChange:r=>t({...e,schedule:{...n,minute:r}})})]}),(0,F.jsx)(h,{value:n.timezone??``,onChange:r=>t({...e,schedule:X(n,r.target.value)}),placeholder:`Timezone (optional)`})]}),n.type===`weekly`&&(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(`label`,{className:`block text-[11px] font-medium text-text-tertiary`,children:`Day of Week`}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:L.map(r=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>t({...e,schedule:{...n,dayOfWeek:r}}),className:S(`rounded px-2.5 py-1 text-[11px] font-medium transition-colors`,n.dayOfWeek===r?`bg-accent text-bg-deep`:`border border-border bg-bg-base text-text-secondary hover:text-text-primary`),children:r.slice(0,3).charAt(0).toUpperCase()+r.slice(1,3)},r))})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsx)(U,{label:`Hour`,value:n.hour,onChange:r=>t({...e,schedule:{...n,hour:r}})}),(0,F.jsx)(U,{label:`Minute`,value:n.minute,onChange:r=>t({...e,schedule:{...n,minute:r}})})]}),(0,F.jsx)(h,{value:n.timezone??``,onChange:r=>t({...e,schedule:X(n,r.target.value)}),placeholder:`Timezone (optional)`})]})]})}function H({state:e,isRecurring:t}){let n=(0,P.useMemo)(()=>{try{if(!t||!e.schedule)return[$(e.runAtText)];let n=[],r=Date.now();for(let t=0;t<3;t++)r=ee(e.schedule,r),n.push(r);return n}catch{return[]}},[e,t]);return n.length===0?null:(0,F.jsxs)(`div`,{className:`rounded-md border border-border bg-bg-base px-3 py-2.5`,children:[(0,F.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-text-tertiary`,children:[(0,F.jsx)(j,{size:11}),t?`Next runs`:`Scheduled for`]}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:n.map((e,n)=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[t&&(0,F.jsxs)(`span`,{className:`w-4 shrink-0 text-[10px] text-text-tertiary tabular-nums`,children:[`#`,n+1]}),(0,F.jsx)(r,{timestamp:e,format:`both`,className:`flex-1 text-[11px]`}),(0,F.jsx)(`span`,{className:`shrink-0 text-[10px] text-text-tertiary`,children:O(e)})]},n))})]})}function U({label:e,value:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`space-y-1`,children:[(0,F.jsx)(`span`,{className:`block text-[11px] font-medium text-text-tertiary`,children:e}),(0,F.jsx)(h,{type:`number`,min:`0`,value:String(t),onChange:e=>n(parseInt(e.target.value||`0`,10))})]})}function W({label:e,children:t}){return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-text-tertiary`,children:e}),t]})}function G({status:e}){switch(e){case`completed`:return(0,F.jsx)(g,{size:14,className:`text-success`});case`failed`:return(0,F.jsx)(k,{size:14,className:`text-error`});case`cancelled`:return(0,F.jsx)(f,{size:14,className:`text-text-tertiary`});default:return(0,F.jsx)(x,{size:14,className:`text-warning`})}}function K({status:e}){return(0,F.jsx)(w,{variant:e===`completed`?`success`:e===`failed`?`destructive`:e===`cancelled`?`secondary`:`warning`,children:e})}function q(e){return!!(e.recurringName&&e.schedule)}function J(e){return{argsText:JSON.stringify(e.args,null,2),runAtText:Q(e.runAt),misfireType:e.misfirePolicy?.type??`catch_up`,windowMs:e.misfirePolicy?.type===`windowed`?String(e.misfirePolicy.windowMs):``,...e.schedule?{schedule:e.schedule}:{}}}function Y(e){switch(e){case`interval`:return{type:e,minutes:5};case`daily`:return{type:e,hour:9,minute:0};case`weekly`:return{type:e,dayOfWeek:`monday`,hour:9,minute:0}}}function X(e,t){let n=t.trim();if(!n){let t={...e};return delete t.timezone,t}return{...e,timezone:n}}function Z(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Arguments must be a JSON object.`);return t}function Q(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return[t.getFullYear(),`-`,n(t.getMonth()+1),`-`,n(t.getDate()),`T`,n(t.getHours()),`:`,n(t.getMinutes())].join(``)}function $(e){let t=new Date(e).getTime();if(!e||Number.isNaN(t))throw Error(`Run At must be a valid local date and time.`);return t}function ee(e,t){if(e.type===`interval`){let n=((e.hours??0)*60*60+(e.minutes??0)*60+(e.seconds??0))*1e3;return t+Math.max(n,1e3)}let n=new Date(t);if(n.setSeconds(0,0),n.setHours(e.hour,e.minute,0,0),e.type===`weekly`){let t=(L.indexOf(e.dayOfWeek)-n.getDay()+7)%7;n.setDate(n.getDate()+t)}return n.getTime()<=t&&n.setDate(n.getDate()+(e.type===`weekly`?7:1)),n.getTime()}function te(e){if(e.misfireType!==`windowed`)return{type:e.misfireType};let t=Number(e.windowMs);if(!Number.isFinite(t)||t<0)throw Error(`Windowed misfire policy requires a valid window in ms.`);return{type:`windowed`,windowMs:t}}export{I as Route};
@@ -0,0 +1 @@
1
+ import{d as e,f as t}from"./shared-Bh0wwC2k.js";import{B as n,Et as r,F as i,Ft as a,H as o,I as s,J as c,K as l,L as u,M as d,Mt as f,N as p,Nt as m,Ot as h,P as g,Pt as _,Q as v,R as y,Tt as b,U as x,V as S,W as C,X as w,Y as T,Z as E,ct as D,q as O,z as k}from"./index-DrSG4qZZ.js";var A=h(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),j=a(m(),1),M=f(),N=a(_(),1);function ee(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=E(`Primitive.${t}`),r=N.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=t(R),[H,U]=T(R,[V,s]),W=s(),[te,G]=H(R),[ne,re]=H(R),ie=t=>{let{__scopeSelect:n,children:r,open:a,defaultOpen:o,onOpenChange:s,value:c,defaultValue:u,onValueChange:d,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:_}=t,v=W(n),[y,b]=N.useState(null),[x,S]=N.useState(null),[w,T]=N.useState(!1),E=e(f),[D,O]=l({prop:a,defaultProp:o??!1,onChange:s,caller:R}),[k,A]=l({prop:c,defaultProp:u,onChange:d,caller:R}),j=N.useRef(null),ee=y?_||!!y.closest(`form`):!0,[P,F]=N.useState(new Set),I=Array.from(P).map(e=>e.props.value).join(`;`);return(0,M.jsx)(i,{...v,children:(0,M.jsxs)(te,{required:g,scope:n,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:C(),value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:j,disabled:h,children:[(0,M.jsx)(z.Provider,{scope:n,children:(0,M.jsx)(ne,{scope:t.__scopeSelect,onNativeOptionAdd:N.useCallback(e=>{F(t=>new Set(t).add(e))},[]),onNativeOptionRemove:N.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:r})}),ee?(0,M.jsxs)(Ge,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:k,onChange:e=>A(e.target.value),disabled:h,form:_,children:[k===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(P)]},I):null]})})};ie.displayName=R;var ae=`SelectTrigger`,K=N.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=v(t,o.onTriggerChange),u=B(n),f=N.useRef(`touch`),[p,m,h]=qe(e=>{let t=u().filter(e=>!e.disabled),n=Je(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),g=e=>{s||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(d,{asChild:!0,...a,children:(0,M.jsx)(F.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ke(o.value)?``:void 0,...i,ref:l,onClick:c(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:c(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:c(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});K.displayName=ae;var oe=`SelectValue`,se=N.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=G(oe,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=v(t,c.onValueNodeChange);return O(()=>{l(u)},[l,u]),(0,M.jsx)(F.span,{...s,ref:d,style:{pointerEvents:`none`},children:Ke(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});se.displayName=oe;var ce=`SelectIcon`,le=N.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(F.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});le.displayName=ce;var ue=`SelectPortal`,de=e=>(0,M.jsx)(n,{asChild:!0,...e});de.displayName=ue;var q=`SelectContent`,fe=N.forwardRef((e,t)=>{let n=G(q,e.__scopeSelect),[r,i]=N.useState();if(O(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?j.createPortal((0,M.jsx)(pe,{scope:e.__scopeSelect,children:(0,M.jsx)(z.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(ge,{...e,ref:t})});fe.displayName=q;var J=10,[pe,Y]=H(q),me=`SelectContentImpl`,he=E(`SelectContent.RemoveScroll`),ge=N.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:l,sideOffset:d,align:f,alignOffset:p,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:_,hideWhenDetached:b,avoidCollisions:x,...C}=e,w=G(q,n),[T,E]=N.useState(null),[D,O]=N.useState(null),A=v(t,e=>E(e)),[j,ee]=N.useState(null),[P,F]=N.useState(null),I=B(n),[L,R]=N.useState(!1),z=N.useRef(!1);N.useEffect(()=>{if(T)return u(T)},[T]),k();let V=N.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&D&&(D.scrollTop=0),n===r&&D&&(D.scrollTop=D.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,D]),H=N.useCallback(()=>V([j,T]),[V,j,T]);N.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=w;N.useEffect(()=>{if(T){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():T.contains(n.target)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[T,U,W]),N.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=qe(e=>{let t=I().filter(e=>!e.disabled),n=Je(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=N.useCallback((e,t,n)=>{let r=!z.current&&!n;(w.value!==void 0&&w.value===t||r)&&(ee(e),r&&(z.current=!0))},[w.value]),ie=N.useCallback(()=>T?.focus(),[T]),ae=N.useCallback((e,t,n)=>{let r=!z.current&&!n;(w.value!==void 0&&w.value===t||r)&&F(e)},[w.value]),K=r===`popper`?be:ve,oe=K===be?{side:l,sideOffset:d,align:f,alignOffset:p,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:_,hideWhenDetached:b,avoidCollisions:x}:{};return(0,M.jsx)(pe,{scope:n,content:T,viewport:D,onViewportChange:O,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:L,searchRef:te,children:(0,M.jsx)(y,{as:he,allowPinchZoom:!0,children:(0,M.jsx)(S,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:c(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(o,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:(0,M.jsx)(K,{role:`listbox`,id:w.contentId,"data-state":w.open?`open`:`closed`,dir:w.dir,onContextMenu:e=>e.preventDefault(),...C,...oe,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...C.style},onKeyDown:c(C.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});ge.displayName=me;var _e=`SelectItemAlignedPosition`,ve=N.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(q,n),o=Y(q,n),[s,c]=N.useState(null),[l,u]=N.useState(null),d=v(t,e=>u(e)),f=B(n),p=N.useRef(!1),m=N.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=N.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=P(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-J,d=P(a,[J,Math.max(J,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-J*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-J,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${J}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);O(()=>b(),[b]);let[x,S]=N.useState();return O(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(xe,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:N.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,M.jsx)(F.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});ve.displayName=_e;var ye=`SelectPopperPosition`,be=N.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=W(n);return(0,M.jsx)(g,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});be.displayName=ye;var[xe,Se]=H(q,{}),Ce=`SelectViewport`,we=N.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(Ce,n),o=Se(Ce,n),s=v(t,a.onViewportChange),l=N.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(z.Slot,{scope:n,children:(0,M.jsx)(F.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:c(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-J*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});we.displayName=Ce;var Te=`SelectGroup`,[Ee,De]=H(Te),Oe=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=C();return(0,M.jsx)(Ee,{scope:n,id:i,children:(0,M.jsx)(F.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Oe.displayName=Te;var ke=`SelectLabel`,Ae=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=De(ke,n);return(0,M.jsx)(F.div,{id:i.id,...r,ref:t})});Ae.displayName=ke;var X=`SelectItem`,[je,Me]=H(X),Ne=N.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(X,n),l=Y(X,n),u=s.value===r,[d,f]=N.useState(a??``),[p,m]=N.useState(!1),h=v(t,e=>l.itemRefCallback?.(e,r,i)),g=C(),_=N.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(je,{scope:n,value:r,disabled:i,textId:g,isSelected:u,onItemTextChange:N.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,M.jsx)(F.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:c(o.onFocus,()=>m(!0)),onBlur:c(o.onBlur,()=>m(!1)),onClick:c(o.onClick,()=>{_.current!==`mouse`&&y()}),onPointerUp:c(o.onPointerUp,()=>{_.current===`mouse`&&y()}),onPointerDown:c(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:c(o.onPointerMove,e=>{_.current=e.pointerType,i?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:c(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:c(o.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Ne.displayName=X;var Z=`SelectItemText`,Pe=N.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Z,n),s=Y(Z,n),c=Me(Z,n),l=re(Z,n),[u,d]=N.useState(null),f=v(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=N.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return O(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?j.createPortal(a.children,o.valueNode):null]})});Pe.displayName=Z;var Fe=`SelectItemIndicator`,Ie=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Me(Fe,n).isSelected?(0,M.jsx)(F.span,{"aria-hidden":!0,...r,ref:t}):null});Ie.displayName=Fe;var Le=`SelectScrollUpButton`,Re=N.forwardRef((e,t)=>{let n=Y(Le,e.__scopeSelect),r=Se(Le,e.__scopeSelect),[i,a]=N.useState(!1),o=v(t,r.onScrollButtonChange);return O(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(Be,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Re.displayName=Le;var Q=`SelectScrollDownButton`,ze=N.forwardRef((e,t)=>{let n=Y(Q,e.__scopeSelect),r=Se(Q,e.__scopeSelect),[i,a]=N.useState(!1),o=v(t,r.onScrollButtonChange);return O(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(Be,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ze.displayName=Q;var Be=N.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),o=N.useRef(null),s=B(n),l=N.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),O(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(F.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:c(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:c(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:c(i.onPointerLeave,()=>{l()})})}),Ve=`SelectSeparator`,He=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(F.div,{"aria-hidden":!0,...r,ref:t})});He.displayName=Ve;var $=`SelectArrow`,Ue=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n),a=G($,n),o=Y($,n);return a.open&&o.position===`popper`?(0,M.jsx)(p,{...i,...r,ref:t}):null});Ue.displayName=$;var We=`SelectBubbleInput`,Ge=N.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=N.useRef(null),a=v(r,i),o=ee(t);return N.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(F.select,{...n,style:{...w,...n.style},ref:a,defaultValue:t})});Ge.displayName=We;function Ke(e){return e===``||e===void 0}function qe(e){let t=x(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Je(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ye(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ye(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Xe=ie,Ze=K,Qe=se,$e=le,et=de,tt=fe,nt=we,rt=Ne,it=Pe,at=Ie,ot=Re,st=ze;function ct({...e}){return(0,M.jsx)(Xe,{"data-slot":`select`,...e})}function lt({...e}){return(0,M.jsx)(Qe,{"data-slot":`select-value`,...e})}function ut({className:e,size:t=`default`,children:n,...r}){return(0,M.jsxs)(Ze,{"data-slot":`select-trigger`,"data-size":t,className:D(`flex w-fit items-center justify-between gap-2 rounded-md border border-border bg-bg-base px-3 py-2 text-[13px] text-text-primary whitespace-nowrap transition-colors outline-none`,`hover:border-border-hover hover:bg-bg-surface`,`focus-visible:ring-2 focus-visible:ring-accent/30`,`disabled:cursor-not-allowed disabled:opacity-50`,`data-[placeholder]:text-text-tertiary`,`data-[size=default]:h-9 data-[size=sm]:h-8`,`*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-text-tertiary`,e),...r,children:[n,(0,M.jsx)($e,{asChild:!0,children:(0,M.jsx)(b,{className:`size-4 opacity-50`})})]})}function dt({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,M.jsx)(et,{children:(0,M.jsxs)(tt,{"data-slot":`select-content`,className:D(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border bg-bg-surface text-text-primary shadow-lg shadow-black/20 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,M.jsx)(pt,{}),(0,M.jsx)(nt,{className:D(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,M.jsx)(mt,{})]})})}function ft({className:e,children:t,...n}){return(0,M.jsxs)(rt,{"data-slot":`select-item`,className:D(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-[13px] text-text-secondary outline-hidden select-none`,`focus:bg-bg-elevated focus:text-text-primary`,`data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-text-tertiary`,`*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,M.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,M.jsx)(at,{children:(0,M.jsx)(r,{className:`size-4 text-accent`})})}),(0,M.jsx)(it,{children:t})]})}function pt({className:e,...t}){return(0,M.jsx)(ot,{"data-slot":`select-scroll-up-button`,className:D(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(A,{className:`size-4 text-text-tertiary`})})}function mt({className:e,...t}){return(0,M.jsx)(st,{"data-slot":`select-scroll-down-button`,className:D(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(b,{className:`size-4 text-text-tertiary`})})}export{lt as a,ut as i,dt as n,ft as r,ct as t};
@@ -0,0 +1 @@
1
+ import{Ft as e,Mt as t,Nt as n,Pt as r,Z as i,ct as a}from"./index-DrSG4qZZ.js";var o=e(r(),1);n();var s=t(),c=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=o.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,s.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),l=`Separator`,u=`horizontal`,d=[`horizontal`,`vertical`],f=o.forwardRef((e,t)=>{let{decorative:n,orientation:r=u,...i}=e,a=p(r)?r:u,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,s.jsx)(c.div,{"data-orientation":a,...o,...i,ref:t})});f.displayName=l;function p(e){return d.includes(e)}var m=f;function h({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,s.jsx)(m,{"data-slot":`separator`,decorative:n,orientation:t,className:a(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}export{h as t};
@@ -0,0 +1 @@
1
+ import{$ as e,A as t,Et as n,Ft as r,G as i,J as a,K as o,Mt as s,Nt as c,Ot as l,Pt as u,Q as d,S as f,St as p,U as m,W as h,Y as g,Z as _,_t as ee,a as v,b as y,bt as b,c as x,ct as S,dt as C,ft as w,j as T,l as E,ut as te,x as D}from"./index-DrSG4qZZ.js";var O=l(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),k=l(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),A=l(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),j=r(u(),1),M=s();function ne(e){let t=e+`CollectionProvider`,[n,r]=g(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=j.useRef(null),a=j.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=_(s),l=j.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:d(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=_(u),m=j.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=j.useRef(null),s=d(t,o),c=a(u,n);return j.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return j.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}c();var re=j.createContext(void 0);function N(e){let t=j.useContext(re);return e||t||`ltr`}var ie=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),P=`rovingFocusGroup.onEntryFocus`,ae={bubbles:!1,cancelable:!0},F=`RovingFocusGroup`,[I,oe,se]=ne(F),[ce,le]=g(F,[se]),[ue,de]=ce(F),L=j.forwardRef((e,t)=>(0,M.jsx)(I.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(I.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(fe,{...e,ref:t})})}));L.displayName=F;var fe=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=j.useRef(null),_=d(t,g),ee=N(s),[v,y]=o({prop:c,defaultProp:l??null,onChange:u,caller:F}),[b,x]=j.useState(!1),S=m(f),C=oe(n),w=j.useRef(!1),[T,E]=j.useState(0);return j.useEffect(()=>{let e=g.current;if(e)return e.addEventListener(P,S),()=>e.removeEventListener(P,S)},[S]),(0,M.jsx)(ue,{scope:n,orientation:r,dir:ee,loop:i,currentTabStopId:v,onItemFocus:j.useCallback(e=>y(e),[y]),onItemShiftTab:j.useCallback(()=>x(!0),[]),onFocusableItemAdd:j.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>E(e=>e-1),[]),children:(0,M.jsx)(ie.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...h,ref:_,style:{outline:`none`,...e.style},onMouseDown:a(e.onMouseDown,()=>{w.current=!0}),onFocus:a(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(P,ae);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);B([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),p)}}w.current=!1}),onBlur:a(e.onBlur,()=>x(!1))})})}),R=`RovingFocusGroupItem`,z=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...c}=e,l=h(),u=o||l,d=de(R,n),f=d.currentTabStopId===u,p=oe(n),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:_}=d;return j.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),(0,M.jsx)(I.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,M.jsx)(ie.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:a(e.onMouseDown,e=>{r?d.onItemFocus(u):e.preventDefault()}),onFocus:a(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:a(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=he(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?ge(n,r+1):n.slice(r+1)}setTimeout(()=>B(n))}}),children:typeof s==`function`?s({isCurrentTabStop:f,hasTabStop:_!=null}):s})})});z.displayName=R;var pe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function me(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function he(e,t,n){let r=me(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return pe[r]}function B(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var _e=L,ve=z,V=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),H=`Tabs`,[ye,be]=g(H,[le]),U=le(),[xe,W]=ye(H),Se=j.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:s=`horizontal`,dir:c,activationMode:l=`automatic`,...u}=e,d=N(c),[f,p]=o({prop:r,onChange:i,defaultProp:a??``,caller:H});return(0,M.jsx)(xe,{scope:n,baseId:h(),value:f,onValueChange:p,orientation:s,dir:d,activationMode:l,children:(0,M.jsx)(V.div,{dir:d,"data-orientation":s,...u,ref:t})})});Se.displayName=H;var Ce=`TabsList`,we=j.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=W(Ce,n),o=U(n);return(0,M.jsx)(_e,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,M.jsx)(V.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});we.displayName=Ce;var Te=`TabsTrigger`,Ee=j.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=W(Te,n),c=U(n),l=ke(s.baseId,r),u=Ae(s.baseId,r),d=r===s.value;return(0,M.jsx)(ve,{asChild:!0,...c,focusable:!i,active:d,children:(0,M.jsx)(V.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":u,"data-state":d?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...o,ref:t,onMouseDown:a(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:a(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:a(e.onFocus,()=>{let e=s.activationMode!==`manual`;!d&&!i&&e&&s.onValueChange(r)})})})});Ee.displayName=Te;var De=`TabsContent`,Oe=j.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:a,children:o,...s}=e,c=W(De,n),l=ke(c.baseId,r),u=Ae(c.baseId,r),d=r===c.value,f=j.useRef(d);return j.useEffect(()=>{let e=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,M.jsx)(i,{present:a||d,children:({present:n})=>(0,M.jsx)(V.div,{"data-state":d?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?`0s`:void 0},children:n&&o})})});Oe.displayName=De;function ke(e,t){return`${e}-trigger-${t}`}function Ae(e,t){return`${e}-content-${t}`}var je=Se,Me=we,Ne=Ee,Pe=Oe;function Fe({className:e,orientation:t=`horizontal`,...n}){return(0,M.jsx)(je,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:S(`group/tabs flex gap-0 data-[orientation=horizontal]:flex-col`,e),...n})}var Ie=e(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-text-tertiary group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-bg-surface border border-border`,line:`gap-4 bg-transparent border-0 rounded-none p-0`}},defaultVariants:{variant:`default`}});function Le({className:e,variant:t=`default`,...n}){return(0,M.jsx)(Me,{"data-slot":`tabs-list`,"data-variant":t,className:S(Ie({variant:t}),e),...n})}function G({className:e,...t}){return(0,M.jsx)(Ne,{"data-slot":`tabs-trigger`,className:S(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-3 py-1 text-[13px] font-medium whitespace-nowrap text-text-tertiary transition-all`,`group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start`,`hover:text-text-secondary`,`focus-visible:ring-2 focus-visible:ring-accent/30 focus-visible:outline-none`,`disabled:pointer-events-none disabled:opacity-50`,`group-data-[variant=default]/tabs-list:data-[state=active]:bg-bg-elevated group-data-[variant=default]/tabs-list:data-[state=active]:text-text-primary group-data-[variant=default]/tabs-list:data-[state=active]:border-border group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm`,`group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:px-0 group-data-[variant=line]/tabs-list:border-b-2 group-data-[variant=line]/tabs-list:border-b-transparent group-data-[variant=line]/tabs-list:data-[state=active]:border-b-accent group-data-[variant=line]/tabs-list:data-[state=active]:text-text-primary`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function K({className:e,...t}){return(0,M.jsx)(Pe,{"data-slot":`tabs-content`,className:S(`mt-0 flex-1 outline-none`,e),...t})}var Re={query:{label:`Query`,colorClass:`text-fn-query`,bgClass:`bg-fn-query/15`,borderClass:`border-fn-query/20`,icon:ee},mutation:{label:`Mutation`,colorClass:`text-fn-mutation`,bgClass:`bg-fn-mutation/15`,borderClass:`border-fn-mutation/20`,icon:b},action:{label:`Action`,colorClass:`text-fn-action`,bgClass:`bg-fn-action/15`,borderClass:`border-fn-action/20`,icon:w},cron:{label:`Cron`,colorClass:`text-fn-cron`,bgClass:`bg-fn-cron/15`,borderClass:`border-fn-cron/20`,icon:p}};function ze({type:e,showIcon:t=!0,className:n}){let r=Re[e],i=r.icon;return(0,M.jsxs)(T,{className:S(r.bgClass,r.colorClass,r.borderClass,`border text-[10px] font-semibold uppercase tracking-wide`,n),children:[t&&(0,M.jsx)(i,{size:10}),r.label]})}function Be(e){return e.startsWith(`query.`)?`query`:e.startsWith(`mutation.`)?`mutation`:e.startsWith(`action.`)?`action`:e.startsWith(`scheduler.`)?`cron`:null}function q({data:e,className:r,defaultExpanded:i=!0,maxDepth:a=5,showCopy:o=!0}){let[s,c]=(0,j.useState)(!1),l=(0,j.useMemo)(()=>{try{return JSON.stringify(e,null,2)}catch{return String(e)}},[e]),u=(0,j.useCallback)(()=>{navigator.clipboard.writeText(l).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},[l]);return(0,M.jsxs)(`div`,{className:S(`relative group rounded-md border border-border bg-bg-base overflow-hidden`,r),children:[o&&(0,M.jsx)(t,{variant:`ghost`,size:`icon-xs`,onClick:u,className:S(`absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity`,s&&`opacity-100 text-success`),title:`Copy JSON`,children:s?(0,M.jsx)(n,{size:12}):(0,M.jsx)(k,{size:12})}),(0,M.jsx)(`div`,{className:`p-3 overflow-auto max-h-[400px] text-[12px] font-mono`,children:(0,M.jsx)(J,{data:e,depth:0,maxDepth:a,defaultExpanded:i})})]})}function J({data:e,depth:t,maxDepth:n,defaultExpanded:r,keyName:i}){let[a,o]=(0,j.useState)(r&&t<n),s=typeof e==`object`&&e&&!Array.isArray(e)?e:null;if(e===null)return(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-tertiary italic`,children:`null`})]});if(e===void 0)return(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-tertiary italic`,children:`undefined`})]});if(typeof e==`string`)return(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsxs)(`span`,{className:`text-success`,children:[`"`,e,`"`]})]});if(typeof e==`number`)return(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-info`,children:e})]});if(typeof e==`boolean`)return(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-fn-action`,children:String(e)})]});if(Array.isArray(e))return e.length===0?(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`[]`})]}):(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>o(!a),className:`inline-flex items-center gap-0.5 hover:text-text-primary transition-colors`,children:[(0,M.jsx)(O,{size:12,className:S(`text-text-tertiary transition-transform`,a&&`rotate-90`)}),i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsxs)(`span`,{className:`text-text-tertiary`,children:[`[`,a?``:`${e.length} items`]})]}),a&&(0,M.jsx)(`div`,{className:`ml-4 border-l border-border/50 pl-2`,children:e.map((i,a)=>(0,M.jsxs)(`div`,{className:`py-0.5`,children:[(0,M.jsx)(J,{data:i,depth:t+1,maxDepth:n,defaultExpanded:r,keyName:String(a)}),a<e.length-1&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`,`})]},a))}),a&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`]`}),!a&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`]`})]});if(s){let e=Object.entries(s);return e.length===0?(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`{}`})]}):(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>o(!a),className:`inline-flex items-center gap-0.5 hover:text-text-primary transition-colors`,children:[(0,M.jsx)(O,{size:12,className:S(`text-text-tertiary transition-transform`,a&&`rotate-90`)}),i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsxs)(`span`,{className:`text-text-tertiary`,children:[`{`,a?``:`${e.length} keys`]})]}),a&&(0,M.jsx)(`div`,{className:`ml-4 border-l border-border/50 pl-2`,children:e.map(([i,a],o)=>(0,M.jsxs)(`div`,{className:`py-0.5`,children:[(0,M.jsx)(J,{data:a,depth:t+1,maxDepth:n,defaultExpanded:r,keyName:i}),o<e.length-1&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`,`})]},i))}),a&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`}`}),!a&&(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`}`})]})}return typeof e==`bigint`?(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-secondary`,children:String(e)})]}):(0,M.jsxs)(`span`,{className:`inline-flex gap-1`,children:[i!==void 0&&(0,M.jsx)(Y,{name:i}),(0,M.jsx)(`span`,{className:`text-text-secondary`,children:`[unsupported]`})]})}function Y({name:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`text-accent`,children:e}),(0,M.jsx)(`span`,{className:`text-text-tertiary`,children:`: `})]})}function Ve({icon:e,title:t,description:n,action:r,className:i}){return(0,M.jsxs)(`div`,{className:S(`flex flex-col items-center justify-center py-16 px-6 text-center`,i),children:[(0,M.jsx)(`div`,{className:`flex items-center justify-center w-12 h-12 rounded-xl bg-bg-surface border border-border mb-4`,children:(0,M.jsx)(e,{size:20,className:`text-text-tertiary`})}),(0,M.jsx)(`h3`,{className:`text-[13px] font-bold text-text-primary mb-1`,children:t}),n&&(0,M.jsx)(`p`,{className:`text-[12px] text-text-tertiary max-w-xs leading-relaxed`,children:n}),r&&(0,M.jsx)(`div`,{className:`mt-4`,children:r})]})}function He({timestamp:e,format:t=`both`,className:n}){let r=C(e),i=te(e),a=new Date(e).toLocaleString();return t===`time`?(0,M.jsxs)(y,{children:[(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(`span`,{className:S(`text-[11px] tabular-nums font-mono text-text-tertiary cursor-default`,n),children:r})}),(0,M.jsx)(D,{side:`top`,className:`text-[11px]`,children:a})]}):t===`relative`?(0,M.jsxs)(y,{children:[(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(`span`,{className:S(`text-[11px] tabular-nums text-text-tertiary cursor-default`,n),children:i})}),(0,M.jsx)(D,{side:`top`,className:`text-[11px]`,children:a})]}):(0,M.jsxs)(y,{children:[(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(`span`,{className:S(`text-[11px] tabular-nums font-mono text-text-tertiary cursor-default`,n),children:r})}),(0,M.jsxs)(D,{side:`top`,className:`text-[11px]`,children:[(0,M.jsx)(`div`,{children:a}),(0,M.jsx)(`div`,{className:`text-text-tertiary`,children:i})]})]})}function Ue({event:e,trace:n,invalidations:r=[],invalidatedBy:i=[],causingTrace:a,onOpenExecution:o,onOpenFunction:s,onOpenTable:c}){let l=E(e),u=`functionName`in e?e.functionName:n?.functionName;return(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(T,{variant:v[e.type],children:x[e.type]}),n?.executionId&&(0,M.jsx)(T,{variant:`outline`,className:`font-mono text-[10px]`,children:n.executionId.slice(0,12)}),(0,M.jsx)(`span`,{className:`text-[11px] text-text-tertiary`,children:new Date(e.timestamp).toLocaleString()})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[u&&(0,M.jsxs)(t,{variant:`secondary`,size:`xs`,onClick:()=>s?.(u),children:[(0,M.jsx)(A,{size:11}),`Function`]}),e.type===`query.invalidated`&&e.causedByExecutionId&&(0,M.jsxs)(t,{variant:`secondary`,size:`xs`,onClick:()=>o?.(e.causedByExecutionId),children:[(0,M.jsx)(A,{size:11}),`Causing execution`]}),e.type===`query.invalidated`&&e.rerunExecutionId&&(0,M.jsxs)(t,{variant:`secondary`,size:`xs`,onClick:()=>o?.(e.rerunExecutionId),children:[(0,M.jsx)(A,{size:11}),`Query rerun`]})]}),(0,M.jsxs)(Fe,{defaultValue:`overview`,className:`min-w-0`,children:[(0,M.jsxs)(Le,{variant:`line`,className:`h-8`,children:[(0,M.jsx)(G,{value:`overview`,children:`Overview`}),(0,M.jsx)(G,{value:`args`,children:`Args`}),(0,M.jsx)(G,{value:`result`,children:`Result`}),(0,M.jsx)(G,{value:`writes`,children:`Reads/Writes`}),(0,M.jsx)(G,{value:`invalidations`,children:`Invalidations`})]}),(0,M.jsx)(K,{value:`overview`,className:`mt-3`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12px]`,children:[l.map(t=>(0,M.jsx)(Ge,{label:t.label,value:t.value,mono:t.mono,error:t.error},`${e.type}-${t.label}`)),n?.parentExecutionId&&(0,M.jsx)(Ke,{label:`Parent`,value:n.parentExecutionId,onClick:()=>o?.(n.parentExecutionId)}),a&&(0,M.jsx)(Ke,{label:`Caused by`,value:a.functionName??a.executionId,onClick:()=>o?.(a.executionId)})]})}),(0,M.jsx)(K,{value:`args`,className:`mt-3`,children:(0,M.jsx)(X,{preview:n?.argsPreview,empty:`No args captured.`})}),(0,M.jsx)(K,{value:`result`,className:`mt-3`,children:n?.error?(0,M.jsx)(`div`,{className:`rounded-md border border-error/20 bg-error/5 p-3 font-mono text-[12px] text-error`,children:n.error}):(0,M.jsx)(X,{preview:n?.resultPreview,empty:`No result captured.`})}),(0,M.jsxs)(K,{value:`writes`,className:`mt-3 space-y-3`,children:[(0,M.jsx)(Z,{title:`Read scopes`,scopes:n?.readScopes}),(0,M.jsx)(Z,{title:`Changed scopes`,scopes:n?.changedScopes??n?.writeScopes}),n?.changedDocumentsPreview?.length?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(Q,{children:`Document changes`}),n.changedDocumentsPreview.map(e=>(0,M.jsxs)(`div`,{className:`rounded-md border border-border bg-bg-base p-3`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2 text-[12px]`,children:[(0,M.jsx)(T,{variant:`outline`,children:e.operation}),(0,M.jsx)(`button`,{type:`button`,className:`font-mono text-accent hover:underline`,onClick:()=>c?.(e.table),children:e.table}),(0,M.jsx)(`span`,{className:`font-mono text-text-tertiary`,children:e.id})]}),(0,M.jsx)(qe,{change:e})]},`${e.table}-${e.id}-${e.operation}`))]}):null]}),(0,M.jsxs)(K,{value:`invalidations`,className:`mt-3 space-y-3`,children:[i.length>0&&(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(Q,{children:`Reran after invalidation by`}),i.map(({invalidation:e,trace:t})=>(0,M.jsx)(We,{invalidation:e,trace:t??null,onOpenExecution:o},`${e.queryId}-${e.timestamp}-${e.causedByExecutionId??`unknown`}`))]}),n?.invalidatedQueryIds?.length?(0,M.jsx)(Z,{title:`Invalidated queries`,scopes:n.invalidatedQueryIds}):null,r.length>0&&(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(Q,{children:`Invalidations caused`}),r.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between rounded-md border border-border bg-bg-base px-3 py-2 text-left text-[12px] hover:border-border-hover`,onClick:()=>e.rerunExecutionId?o?.(e.rerunExecutionId):void 0,children:[(0,M.jsx)(`span`,{className:`font-mono text-text-secondary`,children:e.queryId}),(0,M.jsxs)(T,{variant:`secondary`,className:`text-[10px]`,children:[e.matchedScopes?.length??0,` scopes`]})]},`${e.queryId}-${e.timestamp}`))]}),i.length===0&&!n?.invalidatedQueryIds?.length&&r.length===0&&(0,M.jsx)(`div`,{className:`rounded-md border border-border bg-bg-base p-3 text-[12px] text-text-tertiary`,children:`No invalidation relationships captured.`})]})]})]})}function X({preview:e,empty:t,label:n}){return e?(0,M.jsxs)(`div`,{className:`space-y-1`,children:[n&&(0,M.jsx)(Q,{children:n}),(0,M.jsx)(q,{data:e.kind===`value`?e.value:e,defaultExpanded:!1,maxDepth:4}),e.truncated&&(0,M.jsx)(`div`,{className:`text-[11px] text-warning`,children:`Preview was truncated.`})]}):(0,M.jsx)(`div`,{className:`rounded-md border border-border bg-bg-base p-3 text-[12px] text-text-tertiary`,children:t??`No preview captured.`})}function We({invalidation:e,trace:t,onOpenExecution:n}){let r=!!e.causedByExecutionId,i=t?.functionName??e.causedByExecutionId??`Unknown execution`;return(0,M.jsxs)(`button`,{type:`button`,disabled:!r,className:`flex w-full flex-col gap-2 rounded-md border border-border bg-bg-base px-3 py-2 text-left text-[12px] transition-colors enabled:hover:border-border-hover disabled:cursor-default`,onClick:()=>e.causedByExecutionId?n?.(e.causedByExecutionId):void 0,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-text-secondary`,children:i}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[t?.kind&&(0,M.jsx)(T,{variant:`secondary`,className:`text-[10px]`,children:t.kind}),r&&(0,M.jsx)(A,{size:11,className:`text-text-tertiary`})]})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px] text-text-tertiary`,children:[(0,M.jsx)(T,{variant:`outline`,className:`font-mono text-[10px]`,children:e.reason}),(0,M.jsx)(`span`,{children:new Date(e.timestamp).toLocaleTimeString()})]}),e.matchedScopes?.length?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.matchedScopes.map(e=>(0,M.jsx)(T,{variant:`outline`,className:`font-mono text-[10px]`,children:e},e))}):null]})}function Z({title:e,scopes:t}){return(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(Q,{children:e}),t?.length?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,M.jsx)(T,{variant:`outline`,className:`font-mono text-[10px]`,children:e},e))}):(0,M.jsx)(`div`,{className:`text-[12px] text-text-tertiary`,children:`None captured.`})]})}function Ge({label:e,value:t,mono:n,error:r}){return(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsx)(`span`,{className:`w-28 shrink-0 text-text-tertiary`,children:e}),(0,M.jsx)(`span`,{className:`${n?`font-mono`:``} ${r?`text-error`:`text-text-secondary`} break-all`,children:t})]})}function Ke({label:e,value:t,onClick:n}){return(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsx)(`span`,{className:`w-28 shrink-0 text-text-tertiary`,children:e}),(0,M.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 break-all font-mono text-accent hover:underline`,onClick:n,children:[t,(0,M.jsx)(k,{size:10,className:`opacity-60`})]})]})}function Q({children:e}){return(0,M.jsx)(`div`,{className:`text-[11px] font-semibold text-text-tertiary`,children:e})}function $(e){if(e===null)return`null`;if(e===void 0)return`—`;if(typeof e==`string`)return`"${e.length>40?`${e.slice(0,40)}…`:e}"`;if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=JSON.stringify(e);return t.length>60?`${t.slice(0,60)}…`:t}function qe({change:e}){let t=e.beforePreview?.kind===`value`&&typeof e.beforePreview.value==`object`&&e.beforePreview.value!==null?e.beforePreview.value:null,n=e.afterPreview?.kind===`value`&&typeof e.afterPreview.value==`object`&&e.afterPreview.value!==null?e.afterPreview.value:null;if(n&&!t)return(0,M.jsx)(`div`,{className:`rounded border border-success/20 overflow-hidden`,children:Object.entries(n).map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2 border-b border-success/10 bg-success/5 px-3 py-1.5 last:border-b-0`,children:[(0,M.jsx)(`span`,{className:`w-32 shrink-0 truncate font-mono text-[11px] text-success/80`,children:e}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-success`,children:$(t)})]},e))});if(t&&!n)return(0,M.jsx)(`div`,{className:`rounded border border-error/20 overflow-hidden`,children:Object.entries(t).map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2 border-b border-error/10 bg-error/5 px-3 py-1.5 last:border-b-0`,children:[(0,M.jsx)(`span`,{className:`w-32 shrink-0 truncate font-mono text-[11px] text-error/80`,children:e}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-error line-through`,children:$(t)})]},e))});if(t&&n){let e=Array.from(new Set([...Object.keys(t),...Object.keys(n)])).map(e=>{let r=e in t,i=e in n;return r&&i?JSON.stringify(t[e])===JSON.stringify(n[e])?{key:e,kind:`unchanged`}:{key:e,kind:`changed`,before:t[e],after:n[e]}:i?{key:e,kind:`added`,after:n[e]}:{key:e,kind:`removed`,before:t[e]}}),r=e.filter(e=>e.kind!==`unchanged`),i=e.length-r.length;return r.length===0?(0,M.jsx)(`div`,{className:`text-[11px] text-text-tertiary`,children:`No field-level changes detected.`}):(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`div`,{className:`rounded border border-border overflow-hidden`,children:r.map(e=>e.kind===`changed`?(0,M.jsxs)(`div`,{className:`flex items-baseline border-b border-warning/10 bg-warning/5 last:border-b-0`,children:[(0,M.jsx)(`span`,{className:`w-32 shrink-0 truncate px-3 py-1.5 font-mono text-[11px] text-text-secondary`,children:e.key}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-3 py-1.5`,children:[(0,M.jsx)(`span`,{className:`max-w-[35%] truncate font-mono text-[11px] text-error/80 line-through`,children:$(e.before)}),(0,M.jsx)(`span`,{className:`shrink-0 text-[10px] text-text-tertiary`,children:`→`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-success`,children:$(e.after)})]})]},e.key):e.kind===`added`?(0,M.jsxs)(`div`,{className:`flex items-baseline border-b border-success/10 bg-success/5 last:border-b-0`,children:[(0,M.jsx)(`span`,{className:`w-32 shrink-0 truncate px-3 py-1.5 font-mono text-[11px] text-success/80`,children:e.key}),(0,M.jsx)(`span`,{className:`min-w-0 truncate px-3 py-1.5 font-mono text-[11px] text-success`,children:$(e.after)})]},e.key):(0,M.jsxs)(`div`,{className:`flex items-baseline border-b border-error/10 bg-error/5 last:border-b-0`,children:[(0,M.jsx)(`span`,{className:`w-32 shrink-0 truncate px-3 py-1.5 font-mono text-[11px] text-error/80`,children:e.key}),(0,M.jsx)(`span`,{className:`min-w-0 truncate px-3 py-1.5 font-mono text-[11px] text-error line-through`,children:$(e.before)})]},e.key))}),i>0&&(0,M.jsxs)(`div`,{className:`px-1 text-[11px] text-text-tertiary`,children:[`+`,i,` unchanged `,i===1?`field`:`fields`]})]})}return(0,M.jsxs)(`div`,{className:`grid gap-2`,children:[e.beforePreview&&(0,M.jsx)(X,{label:`Before`,preview:e.beforePreview}),e.afterPreview&&(0,M.jsx)(X,{label:`After`,preview:e.afterPreview})]})}export{ze as a,K as c,N as d,ne as f,O as h,q as i,Le as l,k as m,He as n,Be as o,A as p,Ve as r,Fe as s,Ue as t,G as u};