@lunora/studio 1.0.0-alpha.45 → 1.0.0-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +12 -12
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +4 -4
- package/dist/packem_chunks/ExportImportPanel.js +4 -4
- package/dist/packem_chunks/FileBrowser.js +43 -20
- package/dist/packem_chunks/FunctionRunner.js +8 -25
- package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +5 -5
- package/dist/packem_chunks/LogsPanel.js +4 -4
- package/dist/packem_chunks/MailPanel.js +3 -3
- package/dist/packem_chunks/MetricsPanel.js +4 -4
- package/dist/packem_chunks/MigrationsPanel.js +5 -5
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +3 -3
- package/dist/packem_chunks/SecurityAdvisorPanel.js +2 -2
- package/dist/packem_chunks/SettingsPanel.js +2 -2
- package/dist/packem_chunks/SqlEditorPanel.js +7 -6
- package/dist/packem_chunks/TableEditor.js +6 -29
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +3 -2
- package/dist/packem_chunks/fanout-panel.js +3 -3
- package/dist/packem_chunks/flags-panel.js +2 -2
- package/dist/packem_chunks/kv-browser.js +2 -2
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +3 -3
- package/dist/packem_chunks/permissions-panel.js +4 -4
- package/dist/packem_chunks/queues-panel.js +3 -3
- package/dist/packem_chunks/rls-panel.js +2 -2
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/storage-rules-panel.js +2 -2
- package/dist/packem_chunks/subscriptions-panel.js +3 -3
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +2 -2
- package/dist/packem_shared/{ApiDocsPanel-CBma-lnp.js → ApiDocsPanel-B2Rc7nOF.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-CQM3pPN7.js → ApiReferencePanel-Dd8pcswz.js} +1 -1
- package/dist/packem_shared/{CommandPalette-X2tkbyHk.js → CommandPalette-BXV4eKf5.js} +1 -1
- package/dist/packem_shared/{DataBrowser-D2ywrdId.js → DataBrowser-Cc197zke.js} +8 -8
- package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
- package/dist/packem_shared/{GlobalDataBrowser-BkTPLzAY.js → GlobalDataBrowser-CxJxRRf2.js} +3 -3
- package/dist/packem_shared/{HomePanel-D1Q9LZgK.js → HomePanel-CjDlJzzs.js} +3 -3
- package/dist/packem_shared/{OpenRpcReferencePanel-Dno-hfDb.js → OpenRpcReferencePanel-CWaf0ZtX.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Ctw4jYtU.js → ScheduledJobs-dHMgnJbx.js} +2 -2
- package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
- package/dist/packem_shared/{Studio-lJhzDAze.js → Studio-sfBFghzO.js} +4 -4
- package/dist/packem_shared/{StudioApp-DiMkupvZ.js → StudioApp-Ism1gXfJ.js} +5 -11
- package/dist/packem_shared/{advisor-view-BX8OhG0w.js → advisor-view-Cx21PS_T.js} +1 -1
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
- package/dist/packem_shared/{data-grid-CdXztApG.js → data-grid-C9I16KWr.js} +1 -1
- package/dist/packem_shared/{error-alert-CXjqyGw9.js → error-alert-vIPQoN3Y.js} +1 -1
- package/dist/packem_shared/{grid-features-BF-KBDFz.js → grid-features-B_fZH4iQ.js} +3 -2
- package/dist/packem_shared/{home-panel-TFcRf9Ui.js → home-panel-BohxdqDb.js} +2 -2
- package/dist/packem_shared/{internal-CYcbqMjX.js → internal-zwBoOv24.js} +14 -1
- package/dist/packem_shared/{reference-view-DUiJcILV.js → reference-view-DUULLuOi.js} +3 -17
- package/dist/packem_shared/{browser-storage-BTrX4y3B.js → result-chart-DZradBAS.js} +2 -98
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
- package/dist/packem_shared/{studio-Dh9UlaF_.js → studio-CFC_pv0f.js} +3 -3
- package/dist/packem_shared/{table-list-sidebar-UVIXQJdU.js → table-list-sidebar-huX4VmgI.js} +19 -9
- package/dist/packem_shared/{use-admin-query-CfHYWx5n.js → use-admin-query-BGJ010yZ.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DJQiPc-_.js → use-async-submit-DGCtuDyz.js} +2 -2
- package/dist/standalone/{chunk-J75M4LTW.js → chunk-22C6COGE.js} +4 -4
- package/dist/standalone/{chunk-7XTR7BWT.js → chunk-2CQ2YNER.js} +1 -1
- package/dist/standalone/chunk-2MLA6WFH.js +1 -0
- package/dist/standalone/{chunk-2BBENYBY.js → chunk-37HPVOYP.js} +1 -1
- package/dist/standalone/{chunk-B4TTGYIX.js → chunk-3HS3ZXFB.js} +1 -1
- package/dist/standalone/{chunk-T4XWXBKR.js → chunk-3OZDR3RM.js} +1 -1
- package/dist/standalone/chunk-4KSX53SI.js +4 -0
- package/dist/standalone/chunk-4PC7IXNY.js +1 -0
- package/dist/standalone/{chunk-7KR346F4.js → chunk-5UKRVDFD.js} +1 -1
- package/dist/standalone/{chunk-4WGGEF73.js → chunk-ADP5UEHQ.js} +1 -1
- package/dist/standalone/{chunk-WKWKAU22.js → chunk-AITOCPML.js} +1 -1
- package/dist/standalone/{chunk-ZSNXQT4N.js → chunk-AYANIT5P.js} +1 -1
- package/dist/standalone/chunk-BIBCC7EE.js +6 -0
- package/dist/standalone/{chunk-XFPHUG7M.js → chunk-CGGZAYGG.js} +1 -1
- package/dist/standalone/chunk-CJTT4TBP.js +1 -0
- package/dist/standalone/{chunk-73BV73BI.js → chunk-CLMGPTAI.js} +1 -1
- package/dist/standalone/{chunk-MP5MTWY5.js → chunk-CTPCJNOP.js} +1 -1
- package/dist/standalone/chunk-DDE62TRL.js +1 -0
- package/dist/standalone/{chunk-ATG3655M.js → chunk-DH4K2OLM.js} +1 -1
- package/dist/standalone/{chunk-KMNEQEHM.js → chunk-EEWKIQUE.js} +1 -1
- package/dist/standalone/{chunk-3JO76DWI.js → chunk-EYSL7KEQ.js} +1 -1
- package/dist/standalone/{chunk-I4RSHYDW.js → chunk-F4HDP4XW.js} +1 -1
- package/dist/standalone/chunk-F5I22A4W.js +1 -0
- package/dist/standalone/chunk-FKVCHCYV.js +4 -0
- package/dist/standalone/{chunk-6HW2RKAX.js → chunk-FNQQ3B5G.js} +1 -1
- package/dist/standalone/{chunk-PXR5E7AX.js → chunk-GSCV2N3F.js} +5 -5
- package/dist/standalone/{chunk-ICIQ2GWQ.js → chunk-H27CRIP3.js} +1 -1
- package/dist/standalone/{chunk-YSF43KIJ.js → chunk-HROXYAZT.js} +1 -1
- package/dist/standalone/{chunk-EOSXQTSQ.js → chunk-HVRDZZHL.js} +1 -1
- package/dist/standalone/{chunk-245TEXSO.js → chunk-IRSIK3HT.js} +2 -2
- package/dist/standalone/{chunk-2GMEK2W3.js → chunk-ITQKVEP7.js} +9 -9
- package/dist/standalone/{chunk-34B5ECBI.js → chunk-IZN4TYMN.js} +1 -1
- package/dist/standalone/{chunk-7JOVXGO4.js → chunk-JM7XBQVK.js} +1 -1
- package/dist/standalone/{chunk-S6JKSFSO.js → chunk-JPILGFXT.js} +1 -1
- package/dist/standalone/{chunk-QQH2YTBW.js → chunk-JQ4WOPMF.js} +1 -1
- package/dist/standalone/chunk-K2CB2CHL.js +1 -0
- package/dist/standalone/{chunk-3IJLM4GF.js → chunk-KCMKEMUL.js} +1 -1
- package/dist/standalone/{chunk-WKUGR7ER.js → chunk-KKD46QVN.js} +1 -1
- package/dist/standalone/chunk-L7WR3C4Z.js +1 -0
- package/dist/standalone/chunk-LRYLU6EY.js +1 -0
- package/dist/standalone/{chunk-I34RPZ7P.js → chunk-MDTNVR3G.js} +1 -1
- package/dist/standalone/chunk-PL2KY6IG.js +1 -0
- package/dist/standalone/{chunk-KFNNMXUZ.js → chunk-S3Q6R7BA.js} +1 -1
- package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
- package/dist/standalone/chunk-SEQ43UW2.js +1 -0
- package/dist/standalone/{chunk-5KUKYIU6.js → chunk-SHK6RAFG.js} +1 -1
- package/dist/standalone/chunk-TXTJPS5F.js +1 -0
- package/dist/standalone/chunk-V4ECZI2R.js +1 -0
- package/dist/standalone/{chunk-6CRKDJNL.js → chunk-WD2LBHJZ.js} +1 -1
- package/dist/standalone/{chunk-PBXQ5QS4.js → chunk-WMWDJLRO.js} +4 -4
- package/dist/standalone/{chunk-ZTOATVB7.js → chunk-WOXVMXSQ.js} +1 -1
- package/dist/standalone/{chunk-JEVKZIHN.js → chunk-WUFVFVHJ.js} +1 -1
- package/dist/standalone/{chunk-ERUIC6WI.js → chunk-X4QFAAZ5.js} +1 -1
- package/dist/standalone/{chunk-P7AMKXU2.js → chunk-XVR74IFC.js} +1 -1
- package/dist/standalone/chunk-Y2GJJVS5.js +1 -0
- package/dist/standalone/chunk-YFA7NUCL.js +1 -0
- package/dist/standalone/chunk-YSPZSTDI.js +1 -0
- package/dist/standalone/studio.js +43 -43
- package/package.json +6 -6
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/standalone/chunk-3SKIYIBN.js +0 -1
- package/dist/standalone/chunk-AFCBRDRQ.js +0 -1
- package/dist/standalone/chunk-AX7GYUQC.js +0 -1
- package/dist/standalone/chunk-BGHGKAOM.js +0 -1
- package/dist/standalone/chunk-BL45HXOJ.js +0 -1
- package/dist/standalone/chunk-ERXJPMCU.js +0 -1
- package/dist/standalone/chunk-GNMTLLGB.js +0 -1
- package/dist/standalone/chunk-M5OMEMQ3.js +0 -1
- package/dist/standalone/chunk-O4YNKFCZ.js +0 -1
- package/dist/standalone/chunk-OLUEBOHS.js +0 -1
- package/dist/standalone/chunk-OOETIPAO.js +0 -1
- package/dist/standalone/chunk-OQPT2BEZ.js +0 -6
- package/dist/standalone/chunk-PKIPNNRD.js +0 -4
- package/dist/standalone/chunk-QB3QUTSJ.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TU5ZNEZ4.js +0 -1
- package/dist/standalone/chunk-WATFBATD.js +0 -1
- package/dist/standalone/chunk-WSMZLZWM.js +0 -4
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`),"buildTableSnippet"),ot=p((t,e)=>{switch(t){case"cli":return tt(e);case"client":return Ee(e);default:return et(e)}},"snippetForTab"),_e=p(t=>{let e=(0,ee.c)(19),{code:o,label:s,testId:n}=t,r=M(),l;e[0]!==o?(l=p(()=>{re(o)},"t1"),e[0]=o,e[1]=l):l=e[1];let i=l,d;e[2]!==s?(d=(0,B.jsxDEV)("span",{className:"text-xs font-medium text-muted-foreground",children:s},void 0,!1),e[2]=s,e[3]=d):d=e[3];let c=`${n}-copy`,m;e[4]!==r?(m=r("Copy"),e[4]=r,e[5]=m):m=e[5];let a;e[6]!==i||e[7]!==c||e[8]!==m?(a=(0,B.jsxDEV)(H,{"data-testid":c,onClick:i,size:"xs",type:"button",variant:"ghost",children:m},void 0,!1),e[6]=i,e[7]=c,e[8]=m,e[9]=a):a=e[9];let u;e[10]!==d||e[11]!==a?(u=(0,B.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[d,a]},void 0,!0),e[10]=d,e[11]=a,e[12]=u):u=e[12];let v;e[13]!==o||e[14]!==n?(v=(0,B.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:o},void 0,!1),e[13]=o,e[14]=n,e[15]=v):v=e[15];let k;return e[16]!==u||e[17]!==v?(k=(0,B.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[u,v]},void 0,!0),e[16]=u,e[17]=v,e[18]=k):k=e[18],k},"SnippetBlock"),nt=p(t=>{let e=(0,ee.c)(50),{file:o,fn:s,kind:n}=t,r=M(),[l,i]=(0,Z.useState)("react"),d,c,m;if(e[0]!==o||e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==l){let T={file:o,fn:s,kind:n},I;e[8]!==r?(I=r("CLI"),e[8]=r,e[9]=I):I=e[9];let P;e[10]!==r?(P=r("Client"),e[10]=r,e[11]=P):P=e[11];let E;e[12]!==r?(E=r("React"),e[12]=r,e[13]=E):E=e[13];let j;e[14]!==I||e[15]!==P||e[16]!==E?(j={cli:I,client:P,react:E},e[14]=I,e[15]=P,e[16]=E,e[17]=j):j=e[17],m=j;let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=p(L=>{i(L.currentTarget.dataset.tab)},"t62"),e[18]=R):R=e[18],d=R,c=ot(l,T),e[0]=o,e[1]=s,e[2]=n,e[3]=r,e[4]=l,e[5]=d,e[6]=c,e[7]=m}else d=e[5],c=e[6],m=e[7];let a=c,u=n==="action"&&l==="react"&&!Xe,v=`api.${o}.${s}`,k;e[19]!==v?(k=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:v},void 0,!1),e[19]=v,e[20]=k):k=e[20];let O;e[21]!==n||e[22]!==r?(O=r("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=r,e[23]=O):O=e[23];let h;e[24]!==O?(h=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:O},void 0,!1),e[24]=O,e[25]=h):h=e[25];let g;e[26]!==k||e[27]!==h?(g=(0,B.jsxDEV)("div",{children:[k,h]},void 0,!0),e[26]=k,e[27]=h,e[28]=g):g=e[28];let x;e[29]!==r?(x=r("Snippet flavour"),e[29]=r,e[30]=x):x=e[30];let b;e[31]!==d||e[32]!==l||e[33]!==m?(b=Qe.map(T=>(0,B.jsxDEV)(H,{"aria-selected":l===T,"data-tab":T,"data-testid":`api-tab-${T}`,onClick:d,role:"tab",size:"xs",type:"button",variant:l===T?"default":"outline",children:m[T]},T,!1)),e[31]=d,e[32]=l,e[33]=m,e[34]=b):b=e[34];let S;e[35]!==x||e[36]!==b?(S=(0,B.jsxDEV)("div",{"aria-label":x,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:b},void 0,!1),e[35]=x,e[36]=b,e[37]=S):S=e[37];let y=m[l],$=`api-snippet-${l}`,N;e[38]!==a||e[39]!==y||e[40]!==$?(N=(0,B.jsxDEV)(_e,{code:a,label:y,testId:$},void 0,!1),e[38]=a,e[39]=y,e[40]=$,e[41]=N):N=e[41];let w;e[42]!==u||e[43]!==r?(w=u&&(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:r("Actions have no React hook \u2014 call them through the client.")},void 0,!1),e[42]=u,e[43]=r,e[44]=w):w=e[44];let C;return e[45]!==N||e[46]!==w||e[47]!==g||e[48]!==S?(C=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[g,S,N,w]},void 0,!0),e[45]=N,e[46]=w,e[47]=g,e[48]=S,e[49]=C):C=e[49],C},"FunctionDoc"),rt=p(t=>{let e=(0,ee.c)(19),{name:o}=t,s=M(),n;e[0]!==o?(n=st(o),e[0]=o,e[1]=n):n=e[1];let r=n,l;e[2]!==o?(l=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:o},void 0,!1),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==s?(i=s("Read and write this table through the typed data model."),e[4]=s,e[5]=i):i=e[5];let d;e[6]!==i?(d=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i},void 0,!1),e[6]=i,e[7]=d):d=e[7];let c;e[8]!==l||e[9]!==d?(c=(0,B.jsxDEV)("div",{children:[l,d]},void 0,!0),e[8]=l,e[9]=d,e[10]=c):c=e[10];let m;e[11]!==s?(m=s("Data model"),e[11]=s,e[12]=m):m=e[12];let a;e[13]!==r||e[14]!==m?(a=(0,B.jsxDEV)(_e,{code:r,label:m,testId:"api-snippet-table"},void 0,!1),e[13]=r,e[14]=m,e[15]=a):a=e[15];let u;return e[16]!==c||e[17]!==a?(u=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,a]},void 0,!0),e[16]=c,e[17]=a,e[18]=u):u=e[18],u},"TableDoc"),Re=p(t=>{let e=(0,ee.c)(8),{active:o,label:s,onSelect:n,testId:r,value:l}=t,i;e[0]!==n||e[1]!==l?(i=p(()=>{n(l)},"t1"),e[0]=n,e[1]=l,e[2]=i):i=e[2];let d=i,c=o?"page":void 0,m;return e[3]!==s||e[4]!==d||e[5]!==c||e[6]!==r?(m=(0,B.jsxDEV)("button",{"aria-current":c,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":r,onClick:d,type:"button",children:s},void 0,!1),e[3]=s,e[4]=d,e[5]=c,e[6]=r,e[7]=m):m=e[7],m},"RailButton"),je=p(t=>{let e=(0,ee.c)(67),{functions:o,initialShardKey:s}=t,n=M(),r=G(),[l,i]=(0,Z.useState)(null),[d,c]=(0,Z.useState)(null),m,a;e[0]!==r||e[1]!==s?(m=p(()=>{let _=!1;return r.query(Ye,{},de(s??"")).then(D=>(_||i(D),D)).catch(()=>{_||i([])}),()=>{_=!0}},"t1"),a=[r,s],e[0]=r,e[1]=s,e[2]=m,e[3]=a):(m=e[2],a=e[3]),(0,Z.useEffect)(m,a);let u;e[4]!==o?(u=o??[],e[4]=o,e[5]=u):u=e[5];let v=u,k;if(e[6]!==v){let _=new Map;for(let D of v){let{file:V,fn:U}=Pe(D.path),ie=_.get(V)??[];ie.push({fn:U,kind:D.kind,path:D.path}),_.set(V,ie)}k=[..._.entries()].map(at).toSorted(lt),e[6]=v,e[7]=k}else k=e[7];let O=k,h,g,x,b,S,y,$,N,w,C;if(e[8]!==v||e[9]!==O||e[10]!==d||e[11]!==n||e[12]!==l){let _=(l??[]).map(dt).toSorted(ct),D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=p(F=>{c({kind:"fn",path:F})},"t122"),e[23]=D):D=e[23];let V=D,U;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=p(F=>{c({kind:"table",name:F})},"t132"),e[24]=U):U=e[24];let ie=U;if(g=d?.kind==="fn"?v.find(F=>F.path===d.path):void 0,h=v.length>0||_.length>0,x=g===void 0?void 0:Pe(g.path),b="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",S="lunora-api-docs",e[25]!==n?(y=n("API resources"),e[25]=n,e[26]=y):y=e[26],$="flex flex-col gap-4 overflow-y-auto",N="api-rail",e[27]!==O||e[28]!==d||e[29]!==n){let F;e[31]!==d||e[32]!==n?(F=p(ve=>(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:ve.file||n("(root)")},void 0,!1),ve.items.map(se=>(0,B.jsxDEV)(Re,{active:d?.kind==="fn"&&d.path===se.path,label:se.fn,onSelect:V,testId:`api-rail-fn-${se.path}`,value:se.path},se.path,!1))]},ve.file,!0),"t142"),e[31]=d,e[32]=n,e[33]=F):F=e[33],w=O.map(F),e[27]=O,e[28]=d,e[29]=n,e[30]=w}else w=e[30];C=_.length>0&&(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")},void 0,!1),_.map(F=>(0,B.jsxDEV)(Re,{active:d?.kind==="table"&&d.name===F,label:F,onSelect:ie,testId:`api-rail-table-${F}`,value:F},F,!1))]},void 0,!0),e[8]=v,e[9]=O,e[10]=d,e[11]=n,e[12]=l,e[13]=h,e[14]=g,e[15]=x,e[16]=b,e[17]=S,e[18]=y,e[19]=$,e[20]=N,e[21]=w,e[22]=C}else h=e[13],g=e[14],x=e[15],b=e[16],S=e[17],y=e[18],$=e[19],N=e[20],w=e[21],C=e[22];let T;e[34]!==h||e[35]!==n?(T=!h&&(0,B.jsxDEV)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")},void 0,!1),e[34]=h,e[35]=n,e[36]=T):T=e[36];let I;e[37]!==T||e[38]!==y||e[39]!==$||e[40]!==N||e[41]!==w||e[42]!==C?(I=(0,B.jsxDEV)("nav",{"aria-label":y,className:$,"data-testid":N,children:[w,C,T]},void 0,!0),e[37]=T,e[38]=y,e[39]=$,e[40]=N,e[41]=w,e[42]=C,e[43]=I):I=e[43];let P;e[44]!==d||e[45]!==n?(P=d===null&&(0,B.jsxDEV)(W,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[44]=d,e[45]=n,e[46]=P):P=e[46];let E;e[47]!==d?.kind||e[48]!==g||e[49]!==x?(E=d?.kind==="fn"&&g!==void 0&&x!==void 0&&(0,B.jsxDEV)(nt,{file:x.file,fn:x.fn,kind:g.kind},g.path,!1),e[47]=d?.kind,e[48]=g,e[49]=x,e[50]=E):E=e[50];let j;e[51]!==d?.kind||e[52]!==g||e[53]!==n?(j=d?.kind==="fn"&&g===void 0&&(0,B.jsxDEV)(W,{testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[51]=d?.kind,e[52]=g,e[53]=n,e[54]=j):j=e[54];let R;e[55]!==d?(R=d?.kind==="table"&&(0,B.jsxDEV)(rt,{name:d.name},void 0,!1),e[55]=d,e[56]=R):R=e[56];let L;e[57]!==P||e[58]!==E||e[59]!==j||e[60]!==R?(L=(0,B.jsxDEV)("div",{className:"min-w-0",children:[P,E,j,R]},void 0,!0),e[57]=P,e[58]=E,e[59]=j,e[60]=R,e[61]=L):L=e[61];let A;return e[62]!==b||e[63]!==S||e[64]!==I||e[65]!==L?(A=(0,B.jsxDEV)("div",{className:b,"data-testid":S,children:[I,L]},void 0,!0),e[62]=b,e[63]=S,e[64]=I,e[65]=L,e[66]=A):A=e[66],A},"ApiDocsPanel");function it(t,e){return t.fn.localeCompare(e.fn)}p(it,"_temp");function at(t){let[e,o]=t;return{file:e,items:o.toSorted(it)}}p(at,"_temp2");function lt(t,e){return t.file.localeCompare(e.file)}p(lt,"_temp3");function dt(t){return t.name}p(dt,"_temp4");function ct(t,e){return t.localeCompare(e)}p(ct,"_temp5");var Ve=q(oe(),1);var J=q(oe(),1),K=q(he(),1);var f=q(ne(),1);var ue=p(function(t,e,o){let s=(0,J.c)(10),n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];let[r,l]=(0,K.useState)(n),i,d;s[1]!==o||s[2]!==e||s[3]!==t?(i=p(()=>{if(t!==void 0)return;let m=!1;return e().then(a=>(m||l(o(a)),a)).catch(a=>{m||l({kind:"error",message:ce(a)})}),()=>{m=!0}},"t1"),d=[o,e,t],s[1]=o,s[2]=e,s[3]=t,s[4]=i,s[5]=d):(i=s[4],d=s[5]),(0,K.useEffect)(i,d);let c;return s[6]!==o||s[7]!==r||s[8]!==t?(c=t===void 0?r:o(t),s[6]=o,s[7]=r,s[8]=t,s[9]=c):c=s[9],c},"useAdminSpec"),ft=p(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","scalarOf"),De=p(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"enumValues"),pe=p(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>pe(e)).join(" | "):t.type==="array"?`array<${pe(t.items)}>`:t.type??"any","typeLabel"),pt=p(t=>{let e=De(t);return e!==void 0?t.type??ft(e[0]):pe(t)},"fieldTypeLabel"),ut=p(t=>{let e=De(t);return e===void 0?void 0:e.map(o=>JSON.stringify(o)).join(" | ")},"valueInText"),mt=p(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let o=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let s=e.length>(o?2:1);return o||s?e.join(" "):void 0},"rangeText"),vt=p(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"childObject"),te=p(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return te(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[o,s]of Object.entries(t.properties??{}))e[o]=te(s);return e}case"string":return"";default:return null}},"exampleForSchema"),fe=p(t=>{let e=(0,J.c)(7),{label:o,value:s}=t,n;e[0]!==o?(n=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=n):n=e[1];let r;e[2]!==s?(r=(0,f.jsxDEV)("span",{className:"text-foreground",children:s},void 0,!1),e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==n||e[5]!==r?(l=(0,f.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,r]},void 0,!0),e[4]=n,e[5]=r,e[6]=l):l=e[6],l},"Badge"),ht=p(t=>{let e=(0,J.c)(40),{name:o,required:s,schema:n}=t,r=M(),l;e[0]!==n?(l=mt(n),e[0]=n,e[1]=l):l=e[1];let i=l,d;e[2]!==n?(d=ut(n),e[2]=n,e[3]=d):d=e[3];let c=d,m=n["x-lunora-table"],a=n.format!==void 0||i!==void 0||c!==void 0||m!==void 0,u;e[4]!==n?(u=vt(n),e[4]=n,e[5]=u):u=e[5];let v=u,k=s?"*":"?",O;e[6]!==k?(O=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:k},void 0,!1),e[6]=k,e[7]=O):O=e[7];let h;e[8]!==o||e[9]!==O?(h=(0,f.jsxDEV)("span",{className:"font-mono text-foreground",children:[o,O]},void 0,!0),e[8]=o,e[9]=O,e[10]=h):h=e[10];let g;e[11]!==n?(g=pt(n),e[11]=n,e[12]=g):g=e[12];let x;e[13]!==g?(x=(0,f.jsxDEV)("span",{className:"font-mono text-muted-foreground",children:g},void 0,!1),e[13]=g,e[14]=x):x=e[14];let b;e[15]!==h||e[16]!==x?(b=(0,f.jsxDEV)("div",{className:"flex items-baseline gap-2",children:[h,x]},void 0,!0),e[15]=h,e[16]=x,e[17]=b):b=e[17];let S;e[18]!==n.description?(S=n.description!==void 0&&(0,f.jsxDEV)("p",{className:"max-w-prose text-muted-foreground",children:n.description},void 0,!1),e[18]=n.description,e[19]=S):S=e[19];let y;e[20]!==a||e[21]!==i||e[22]!==m||e[23]!==n.format||e[24]!==r||e[25]!==c?(y=a&&(0,f.jsxDEV)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,f.jsxDEV)(fe,{label:r("Format"),value:n.format},void 0,!1),i!==void 0&&(0,f.jsxDEV)(fe,{label:r("Range"),value:i},void 0,!1),c!==void 0&&(0,f.jsxDEV)(fe,{label:r("Value in"),value:c},void 0,!1),m!==void 0&&(0,f.jsxDEV)(fe,{label:r("relation"),value:m},void 0,!1)]},void 0,!0),e[20]=a,e[21]=i,e[22]=m,e[23]=n.format,e[24]=r,e[25]=c,e[26]=y):y=e[26];let $;e[27]!==S||e[28]!==y||e[29]!==b?($=(0,f.jsxDEV)("div",{className:"flex flex-col gap-1 py-2",children:[b,S,y]},void 0,!0),e[27]=S,e[28]=y,e[29]=b,e[30]=$):$=e[30];let N=$;if(v===void 0){let I;return e[31]!==N?(I=(0,f.jsxDEV)("div",{className:"border-b border-border/50 last:border-b-0",children:N},void 0,!1),e[31]=N,e[32]=I):I=e[32],I}let w;e[33]!==N?(w=(0,f.jsxDEV)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:N},void 0,!1),e[33]=N,e[34]=w):w=e[34];let C;e[35]!==v?(C=(0,f.jsxDEV)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,f.jsxDEV)(Me,{schema:v},void 0,!1)},void 0,!1),e[35]=v,e[36]=C):C=e[36];let T;return e[37]!==w||e[38]!==C?(T=(0,f.jsxDEV)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,C]},void 0,!0),e[37]=w,e[38]=C,e[39]=T):T=e[39],T},"FieldRow"),Me=p(t=>{let e=(0,J.c)(7),{schema:o}=t,s;e[0]!==o.required?(s=new Set(o.required),e[0]=o.required,e[1]=s):s=e[1];let n=s,r;e[2]!==o.properties?(r=Object.entries(o.properties??{}),e[2]=o.properties,e[3]=r):r=e[3];let l=r,i;return e[4]!==n||e[5]!==l?(i=(0,f.jsxDEV)("div",{className:"flex flex-col",children:l.map(d=>{let[c,m]=d;return(0,f.jsxDEV)(ht,{name:c,required:n.has(c),schema:m},c,!1)})},void 0,!1),e[4]=n,e[5]=l,e[6]=i):i=e[6],i},"SchemaFields"),Le=p(t=>{let e=(0,J.c)(10),{schema:o,testId:s}=t;if(o?.type!=="object"||Object.keys(o.properties??{}).length===0){let l;e[0]!==o?(l=pe(o),e[0]=o,e[1]=l):l=e[1];let i;return e[2]!==l||e[3]!==s?(i=(0,f.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l},void 0,!1),e[2]=l,e[3]=s,e[4]=i):i=e[4],i}let n;e[5]!==o?(n=(0,f.jsxDEV)(Me,{schema:o},void 0,!1),e[5]=o,e[6]=n):n=e[6];let r;return e[7]!==n||e[8]!==s?(r=(0,f.jsxDEV)("div",{className:"text-xs","data-testid":s,children:n},void 0,!1),e[7]=n,e[8]=s,e[9]=r):r=e[9],r},"SchemaTable"),gt=["curl","javascript","lunora"],xt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},bt=p(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"apiReferenceOf"),yt=p(t=>{let e=te(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"requestBody"),Nt=p((t,e,o)=>{let s=`${o}${e.httpPath}`,n=JSON.stringify(yt(e),void 0,2),r=JSON.stringify(te(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let l=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
|
|
1
|
+
import{a as Pe}from"./chunk-VLXV72QE.js";import{a as xe}from"./chunk-JSEXCW5Q.js";import{a as X}from"./chunk-KZ6INM5M.js";import{d as we,f as Oe,g as $e,k as ae}from"./chunk-4QHKBC77.js";import{a as Ae}from"./chunk-DH4K2OLM.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as ke}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Ce}from"./chunk-BOXSWNXZ.js";import{a as W}from"./chunk-TAD43CG5.js";import{b as Se}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as G}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as M,e as Ie,f as le,g as de,h as ce,l as Te,n as re}from"./chunk-ITQKVEP7.js";import{b as Ne}from"./chunk-22C6COGE.js";import{a as p,e as q,f as he,g as oe,h as ne,j as ge}from"./chunk-RRCPZMC2.js";var Ye=q(oe(),1),ye=q(he(),1);var ee=q(oe(),1);var Z=q(he(),1);var B=q(ne(),1);var Qe=le(Ce.listTables),Xe=["react","client","cli"],Ze=!1,et={action:"action",mutation:"mutation",query:"query"},Re=p(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"splitPath"),_e=p(({file:t,fn:e,kind:o})=>`await client.${et[o]}(api.${t}.${e}, { /* args */ });`,"buildClientSnippet"),tt=p(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return _e(t);case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"buildReactSnippet"),st=p(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"buildCliSnippet"),ot=p(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
|
|
2
|
+
`),"buildTableSnippet"),nt=p((t,e)=>{switch(t){case"cli":return st(e);case"client":return _e(e);default:return tt(e)}},"snippetForTab"),je=p(t=>{let e=(0,ee.c)(19),{code:o,label:s,testId:n}=t,r=M(),l;e[0]!==o?(l=p(()=>{re(o)},"t1"),e[0]=o,e[1]=l):l=e[1];let i=l,d;e[2]!==s?(d=(0,B.jsxDEV)("span",{className:"text-xs font-medium text-muted-foreground",children:s},void 0,!1),e[2]=s,e[3]=d):d=e[3];let c=`${n}-copy`,m;e[4]!==r?(m=r("Copy"),e[4]=r,e[5]=m):m=e[5];let a;e[6]!==i||e[7]!==c||e[8]!==m?(a=(0,B.jsxDEV)(H,{"data-testid":c,onClick:i,size:"xs",type:"button",variant:"ghost",children:m},void 0,!1),e[6]=i,e[7]=c,e[8]=m,e[9]=a):a=e[9];let u;e[10]!==d||e[11]!==a?(u=(0,B.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[d,a]},void 0,!0),e[10]=d,e[11]=a,e[12]=u):u=e[12];let v;e[13]!==o||e[14]!==n?(v=(0,B.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:o},void 0,!1),e[13]=o,e[14]=n,e[15]=v):v=e[15];let S;return e[16]!==u||e[17]!==v?(S=(0,B.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[u,v]},void 0,!0),e[16]=u,e[17]=v,e[18]=S):S=e[18],S},"SnippetBlock"),rt=p(t=>{let e=(0,ee.c)(50),{file:o,fn:s,kind:n}=t,r=M(),[l,i]=(0,Z.useState)("react"),d,c,m;if(e[0]!==o||e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==l){let I={file:o,fn:s,kind:n},$;e[8]!==r?($=r("CLI"),e[8]=r,e[9]=$):$=e[9];let P;e[10]!==r?(P=r("Client"),e[10]=r,e[11]=P):P=e[11];let E;e[12]!==r?(E=r("React"),e[12]=r,e[13]=E):E=e[13];let j;e[14]!==$||e[15]!==P||e[16]!==E?(j={cli:$,client:P,react:E},e[14]=$,e[15]=P,e[16]=E,e[17]=j):j=e[17],m=j;let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=p(L=>{i(L.currentTarget.dataset.tab)},"t62"),e[18]=R):R=e[18],d=R,c=nt(l,I),e[0]=o,e[1]=s,e[2]=n,e[3]=r,e[4]=l,e[5]=d,e[6]=c,e[7]=m}else d=e[5],c=e[6],m=e[7];let a=c,u=n==="action"&&l==="react"&&!Ze,v=`api.${o}.${s}`,S;e[19]!==v?(S=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:v},void 0,!1),e[19]=v,e[20]=S):S=e[20];let O;e[21]!==n||e[22]!==r?(O=r("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=r,e[23]=O):O=e[23];let h;e[24]!==O?(h=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:O},void 0,!1),e[24]=O,e[25]=h):h=e[25];let g;e[26]!==S||e[27]!==h?(g=(0,B.jsxDEV)("div",{children:[S,h]},void 0,!0),e[26]=S,e[27]=h,e[28]=g):g=e[28];let x;e[29]!==r?(x=r("Snippet flavour"),e[29]=r,e[30]=x):x=e[30];let b;e[31]!==d||e[32]!==l||e[33]!==m?(b=Xe.map(I=>(0,B.jsxDEV)(H,{"aria-selected":l===I,"data-tab":I,"data-testid":`api-tab-${I}`,onClick:d,role:"tab",size:"xs",type:"button",variant:l===I?"default":"outline",children:m[I]},I,!1)),e[31]=d,e[32]=l,e[33]=m,e[34]=b):b=e[34];let y;e[35]!==x||e[36]!==b?(y=(0,B.jsxDEV)("div",{"aria-label":x,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:b},void 0,!1),e[35]=x,e[36]=b,e[37]=y):y=e[37];let N=m[l],T=`api-snippet-${l}`,k;e[38]!==a||e[39]!==N||e[40]!==T?(k=(0,B.jsxDEV)(je,{code:a,label:N,testId:T},void 0,!1),e[38]=a,e[39]=N,e[40]=T,e[41]=k):k=e[41];let w;e[42]!==u||e[43]!==r?(w=u&&(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:r("Actions have no React hook \u2014 call them through the client.")},void 0,!1),e[42]=u,e[43]=r,e[44]=w):w=e[44];let C;return e[45]!==k||e[46]!==w||e[47]!==g||e[48]!==y?(C=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[g,y,k,w]},void 0,!0),e[45]=k,e[46]=w,e[47]=g,e[48]=y,e[49]=C):C=e[49],C},"FunctionDoc"),it=p(t=>{let e=(0,ee.c)(19),{name:o}=t,s=M(),n;e[0]!==o?(n=ot(o),e[0]=o,e[1]=n):n=e[1];let r=n,l;e[2]!==o?(l=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:o},void 0,!1),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==s?(i=s("Read and write this table through the typed data model."),e[4]=s,e[5]=i):i=e[5];let d;e[6]!==i?(d=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i},void 0,!1),e[6]=i,e[7]=d):d=e[7];let c;e[8]!==l||e[9]!==d?(c=(0,B.jsxDEV)("div",{children:[l,d]},void 0,!0),e[8]=l,e[9]=d,e[10]=c):c=e[10];let m;e[11]!==s?(m=s("Data model"),e[11]=s,e[12]=m):m=e[12];let a;e[13]!==r||e[14]!==m?(a=(0,B.jsxDEV)(je,{code:r,label:m,testId:"api-snippet-table"},void 0,!1),e[13]=r,e[14]=m,e[15]=a):a=e[15];let u;return e[16]!==c||e[17]!==a?(u=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,a]},void 0,!0),e[16]=c,e[17]=a,e[18]=u):u=e[18],u},"TableDoc"),Ee=p(t=>{let e=(0,ee.c)(8),{active:o,label:s,onSelect:n,testId:r,value:l}=t,i;e[0]!==n||e[1]!==l?(i=p(()=>{n(l)},"t1"),e[0]=n,e[1]=l,e[2]=i):i=e[2];let d=i,c=o?"page":void 0,m;return e[3]!==s||e[4]!==d||e[5]!==c||e[6]!==r?(m=(0,B.jsxDEV)("button",{"aria-current":c,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":r,onClick:d,type:"button",children:s},void 0,!1),e[3]=s,e[4]=d,e[5]=c,e[6]=r,e[7]=m):m=e[7],m},"RailButton"),Le=p(t=>{let e=(0,ee.c)(67),{functions:o,initialShardKey:s}=t,n=M(),r=G(),[l,i]=(0,Z.useState)(null),[d,c]=(0,Z.useState)(null),m,a;e[0]!==r||e[1]!==s?(m=p(()=>{let _=!1;return r.query(Qe,{},de(s??"")).then(D=>(_||i(D),D)).catch(()=>{_||i([])}),()=>{_=!0}},"t1"),a=[r,s],e[0]=r,e[1]=s,e[2]=m,e[3]=a):(m=e[2],a=e[3]),(0,Z.useEffect)(m,a);let u;e[4]!==o?(u=o??[],e[4]=o,e[5]=u):u=e[5];let v=u,S;if(e[6]!==v){let _=new Map;for(let D of v){let{file:V,fn:U}=Re(D.path),ie=_.get(V)??[];ie.push({fn:U,kind:D.kind,path:D.path}),_.set(V,ie)}S=[..._.entries()].map(lt).toSorted(dt),e[6]=v,e[7]=S}else S=e[7];let O=S,h,g,x,b,y,N,T,k,w,C;if(e[8]!==v||e[9]!==O||e[10]!==d||e[11]!==n||e[12]!==l){let _=(l??[]).map(ct).toSorted(ft),D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=p(F=>{c({kind:"fn",path:F})},"t122"),e[23]=D):D=e[23];let V=D,U;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=p(F=>{c({kind:"table",name:F})},"t132"),e[24]=U):U=e[24];let ie=U;if(g=d?.kind==="fn"?v.find(F=>F.path===d.path):void 0,h=v.length>0||_.length>0,x=g===void 0?void 0:Re(g.path),b="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",y="lunora-api-docs",e[25]!==n?(N=n("API resources"),e[25]=n,e[26]=N):N=e[26],T="flex flex-col gap-4 overflow-y-auto",k="api-rail",e[27]!==O||e[28]!==d||e[29]!==n){let F;e[31]!==d||e[32]!==n?(F=p(ve=>(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:ve.file||n("(root)")},void 0,!1),ve.items.map(se=>(0,B.jsxDEV)(Ee,{active:d?.kind==="fn"&&d.path===se.path,label:se.fn,onSelect:V,testId:`api-rail-fn-${se.path}`,value:se.path},se.path,!1))]},ve.file,!0),"t142"),e[31]=d,e[32]=n,e[33]=F):F=e[33],w=O.map(F),e[27]=O,e[28]=d,e[29]=n,e[30]=w}else w=e[30];C=_.length>0&&(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")},void 0,!1),_.map(F=>(0,B.jsxDEV)(Ee,{active:d?.kind==="table"&&d.name===F,label:F,onSelect:ie,testId:`api-rail-table-${F}`,value:F},F,!1))]},void 0,!0),e[8]=v,e[9]=O,e[10]=d,e[11]=n,e[12]=l,e[13]=h,e[14]=g,e[15]=x,e[16]=b,e[17]=y,e[18]=N,e[19]=T,e[20]=k,e[21]=w,e[22]=C}else h=e[13],g=e[14],x=e[15],b=e[16],y=e[17],N=e[18],T=e[19],k=e[20],w=e[21],C=e[22];let I;e[34]!==h||e[35]!==n?(I=!h&&(0,B.jsxDEV)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")},void 0,!1),e[34]=h,e[35]=n,e[36]=I):I=e[36];let $;e[37]!==I||e[38]!==N||e[39]!==T||e[40]!==k||e[41]!==w||e[42]!==C?($=(0,B.jsxDEV)("nav",{"aria-label":N,className:T,"data-testid":k,children:[w,C,I]},void 0,!0),e[37]=I,e[38]=N,e[39]=T,e[40]=k,e[41]=w,e[42]=C,e[43]=$):$=e[43];let P;e[44]!==d||e[45]!==n?(P=d===null&&(0,B.jsxDEV)(W,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[44]=d,e[45]=n,e[46]=P):P=e[46];let E;e[47]!==d?.kind||e[48]!==g||e[49]!==x?(E=d?.kind==="fn"&&g!==void 0&&x!==void 0&&(0,B.jsxDEV)(rt,{file:x.file,fn:x.fn,kind:g.kind},g.path,!1),e[47]=d?.kind,e[48]=g,e[49]=x,e[50]=E):E=e[50];let j;e[51]!==d?.kind||e[52]!==g||e[53]!==n?(j=d?.kind==="fn"&&g===void 0&&(0,B.jsxDEV)(W,{testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[51]=d?.kind,e[52]=g,e[53]=n,e[54]=j):j=e[54];let R;e[55]!==d?(R=d?.kind==="table"&&(0,B.jsxDEV)(it,{name:d.name},void 0,!1),e[55]=d,e[56]=R):R=e[56];let L;e[57]!==P||e[58]!==E||e[59]!==j||e[60]!==R?(L=(0,B.jsxDEV)("div",{className:"min-w-0",children:[P,E,j,R]},void 0,!0),e[57]=P,e[58]=E,e[59]=j,e[60]=R,e[61]=L):L=e[61];let A;return e[62]!==b||e[63]!==y||e[64]!==$||e[65]!==L?(A=(0,B.jsxDEV)("div",{className:b,"data-testid":y,children:[$,L]},void 0,!0),e[62]=b,e[63]=y,e[64]=$,e[65]=L,e[66]=A):A=e[66],A},"ApiDocsPanel");function at(t,e){return t.fn.localeCompare(e.fn)}p(at,"_temp");function lt(t){let[e,o]=t;return{file:e,items:o.toSorted(at)}}p(lt,"_temp2");function dt(t,e){return t.file.localeCompare(e.file)}p(dt,"_temp3");function ct(t){return t.name}p(ct,"_temp4");function ft(t,e){return t.localeCompare(e)}p(ft,"_temp5");var ze=q(oe(),1);var J=q(oe(),1),K=q(he(),1);var f=q(ne(),1);var ue=p(function(t,e,o){let s=(0,J.c)(10),n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];let[r,l]=(0,K.useState)(n),i,d;s[1]!==o||s[2]!==e||s[3]!==t?(i=p(()=>{if(t!==void 0)return;let m=!1;return e().then(a=>(m||l(o(a)),a)).catch(a=>{m||l({kind:"error",message:ce(a)})}),()=>{m=!0}},"t1"),d=[o,e,t],s[1]=o,s[2]=e,s[3]=t,s[4]=i,s[5]=d):(i=s[4],d=s[5]),(0,K.useEffect)(i,d);let c;return s[6]!==o||s[7]!==r||s[8]!==t?(c=t===void 0?r:o(t),s[6]=o,s[7]=r,s[8]=t,s[9]=c):c=s[9],c},"useAdminSpec"),pt=p(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","scalarOf"),Me=p(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"enumValues"),pe=p(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>pe(e)).join(" | "):t.type==="array"?`array<${pe(t.items)}>`:t.type??"any","typeLabel"),ut=p(t=>{let e=Me(t);return e!==void 0?t.type??pt(e[0]):pe(t)},"fieldTypeLabel"),mt=p(t=>{let e=Me(t);return e===void 0?void 0:e.map(o=>JSON.stringify(o)).join(" | ")},"valueInText"),vt=p(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let o=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let s=e.length>(o?2:1);return o||s?e.join(" "):void 0},"rangeText"),ht=p(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"childObject"),te=p(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return te(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[o,s]of Object.entries(t.properties??{}))e[o]=te(s);return e}case"string":return"";default:return null}},"exampleForSchema"),fe=p(t=>{let e=(0,J.c)(7),{label:o,value:s}=t,n;e[0]!==o?(n=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=n):n=e[1];let r;e[2]!==s?(r=(0,f.jsxDEV)("span",{className:"text-foreground",children:s},void 0,!1),e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==n||e[5]!==r?(l=(0,f.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,r]},void 0,!0),e[4]=n,e[5]=r,e[6]=l):l=e[6],l},"Badge"),gt=p(t=>{let e=(0,J.c)(40),{name:o,required:s,schema:n}=t,r=M(),l;e[0]!==n?(l=vt(n),e[0]=n,e[1]=l):l=e[1];let i=l,d;e[2]!==n?(d=mt(n),e[2]=n,e[3]=d):d=e[3];let c=d,m=n["x-lunora-table"],a=n.format!==void 0||i!==void 0||c!==void 0||m!==void 0,u;e[4]!==n?(u=ht(n),e[4]=n,e[5]=u):u=e[5];let v=u,S=s?"*":"?",O;e[6]!==S?(O=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:S},void 0,!1),e[6]=S,e[7]=O):O=e[7];let h;e[8]!==o||e[9]!==O?(h=(0,f.jsxDEV)("span",{className:"font-mono text-foreground",children:[o,O]},void 0,!0),e[8]=o,e[9]=O,e[10]=h):h=e[10];let g;e[11]!==n?(g=ut(n),e[11]=n,e[12]=g):g=e[12];let x;e[13]!==g?(x=(0,f.jsxDEV)("span",{className:"font-mono text-muted-foreground",children:g},void 0,!1),e[13]=g,e[14]=x):x=e[14];let b;e[15]!==h||e[16]!==x?(b=(0,f.jsxDEV)("div",{className:"flex items-baseline gap-2",children:[h,x]},void 0,!0),e[15]=h,e[16]=x,e[17]=b):b=e[17];let y;e[18]!==n.description?(y=n.description!==void 0&&(0,f.jsxDEV)("p",{className:"max-w-prose text-muted-foreground",children:n.description},void 0,!1),e[18]=n.description,e[19]=y):y=e[19];let N;e[20]!==a||e[21]!==i||e[22]!==m||e[23]!==n.format||e[24]!==r||e[25]!==c?(N=a&&(0,f.jsxDEV)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,f.jsxDEV)(fe,{label:r("Format"),value:n.format},void 0,!1),i!==void 0&&(0,f.jsxDEV)(fe,{label:r("Range"),value:i},void 0,!1),c!==void 0&&(0,f.jsxDEV)(fe,{label:r("Value in"),value:c},void 0,!1),m!==void 0&&(0,f.jsxDEV)(fe,{label:r("relation"),value:m},void 0,!1)]},void 0,!0),e[20]=a,e[21]=i,e[22]=m,e[23]=n.format,e[24]=r,e[25]=c,e[26]=N):N=e[26];let T;e[27]!==y||e[28]!==N||e[29]!==b?(T=(0,f.jsxDEV)("div",{className:"flex flex-col gap-1 py-2",children:[b,y,N]},void 0,!0),e[27]=y,e[28]=N,e[29]=b,e[30]=T):T=e[30];let k=T;if(v===void 0){let $;return e[31]!==k?($=(0,f.jsxDEV)("div",{className:"border-b border-border/50 last:border-b-0",children:k},void 0,!1),e[31]=k,e[32]=$):$=e[32],$}let w;e[33]!==k?(w=(0,f.jsxDEV)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k},void 0,!1),e[33]=k,e[34]=w):w=e[34];let C;e[35]!==v?(C=(0,f.jsxDEV)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,f.jsxDEV)(Ke,{schema:v},void 0,!1)},void 0,!1),e[35]=v,e[36]=C):C=e[36];let I;return e[37]!==w||e[38]!==C?(I=(0,f.jsxDEV)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,C]},void 0,!0),e[37]=w,e[38]=C,e[39]=I):I=e[39],I},"FieldRow"),Ke=p(t=>{let e=(0,J.c)(7),{schema:o}=t,s;e[0]!==o.required?(s=new Set(o.required),e[0]=o.required,e[1]=s):s=e[1];let n=s,r;e[2]!==o.properties?(r=Object.entries(o.properties??{}),e[2]=o.properties,e[3]=r):r=e[3];let l=r,i;return e[4]!==n||e[5]!==l?(i=(0,f.jsxDEV)("div",{className:"flex flex-col",children:l.map(d=>{let[c,m]=d;return(0,f.jsxDEV)(gt,{name:c,required:n.has(c),schema:m},c,!1)})},void 0,!1),e[4]=n,e[5]=l,e[6]=i):i=e[6],i},"SchemaFields"),Be=p(t=>{let e=(0,J.c)(10),{schema:o,testId:s}=t;if(o?.type!=="object"||Object.keys(o.properties??{}).length===0){let l;e[0]!==o?(l=pe(o),e[0]=o,e[1]=l):l=e[1];let i;return e[2]!==l||e[3]!==s?(i=(0,f.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l},void 0,!1),e[2]=l,e[3]=s,e[4]=i):i=e[4],i}let n;e[5]!==o?(n=(0,f.jsxDEV)(Ke,{schema:o},void 0,!1),e[5]=o,e[6]=n):n=e[6];let r;return e[7]!==n||e[8]!==s?(r=(0,f.jsxDEV)("div",{className:"text-xs","data-testid":s,children:n},void 0,!1),e[7]=n,e[8]=s,e[9]=r):r=e[9],r},"SchemaTable"),xt=["curl","javascript","lunora"],bt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},yt=p(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"apiReferenceOf"),Nt=p(t=>{let e=te(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"requestBody"),St=p((t,e,o)=>{let s=`${o}${e.httpPath}`,n=JSON.stringify(Nt(e),void 0,2),r=JSON.stringify(te(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let l=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
|
|
3
3
|
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
4
4
|
import { api } from "./_generated/api";
|
|
5
5
|
|
|
6
6
|
const client = useLunora();
|
|
7
|
-
await client.${e.kind??"query"}(${
|
|
7
|
+
await client.${e.kind??"query"}(${yt(e.functionPath)}, ${r});`;default:{let i=e.method!=="GET"&&e.method!=="HEAD"?`{
|
|
8
8
|
method: ${JSON.stringify(e.method)},
|
|
9
9
|
headers: { "Content-Type": "application/json" },
|
|
10
10
|
body: JSON.stringify(${n}),
|
|
11
11
|
}`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(s)}, ${i});
|
|
12
|
-
const data = await response.json();`}}},"sampleSource"),
|
|
13
|
-
`),t[27]=o,t[28]=w):w=t[28];let C=Math.min(12,Math.max(3,w.length)),T;t[29]!==o||t[30]!==m||t[31]!==u||t[32]!==C?(T=(0,f.jsxDEV)(Ae,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:m,onKeyDown:u,rows:C,spellCheck:!1,value:o},void 0,!1),t[29]=o,t[30]=m,t[31]=u,t[32]=C,t[33]=T):T=t[33];let I;t[34]!==N||t[35]!==T?(I=(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[N,T]},void 0,!0),t[34]=N,t[35]=T,t[36]=I):I=t[36];let P;t[37]!==s.functionPath||t[38]!==l||t[39]!==i||t[40]!==e?(P=s.functionPath!==void 0&&(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,f.jsxDEV)(xe,{htmlFor:"shard-input",children:e("Shard key (optional)")},void 0,!1),(0,f.jsxDEV)(Ce,{id:"shard-input",onChange:l,testId:"shard-input",value:i},void 0,!1)]},void 0,!0),t[37]=s.functionPath,t[38]=l,t[39]=i,t[40]=e,t[41]=P):P=t[41];let E;t[42]!==I||t[43]!==P?(E=(0,f.jsxDEV)("div",{className:"flex flex-col gap-3 p-3",children:[I,P]},void 0,!0),t[42]=I,t[43]=P,t[44]=E):E=t[44];let j;return t[45]!==E||t[46]!==y?(j=(0,f.jsxDEV)("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[y,E]},void 0,!0),t[45]=E,t[46]=y,t[47]=j):j=t[47],j},"TryIt"),Ct=p(t=>{let e=(0,J.c)(51),{operation:o}=t,s=M(),n=`api-operation-${o.operationId}`,r=o.key,l;e[0]!==o.kind||e[1]!==o.method?(l=(0,f.jsxDEV)(be,{kind:o.kind,method:o.method,testId:"api-operation-method"},void 0,!1),e[0]=o.kind,e[1]=o.method,e[2]=l):l=e[2];let i=o.functionPath??o.httpPath,d;e[3]!==i?(d=(0,f.jsxDEV)("code",{className:"truncate font-mono text-xs text-muted-foreground",children:i},void 0,!1),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==l||e[6]!==d?(c=(0,f.jsxDEV)("div",{className:"flex items-center gap-2",children:[l,d]},void 0,!0),e[5]=l,e[6]=d,e[7]=c):c=e[7];let m;e[8]!==o.title?(m=(0,f.jsxDEV)("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:o.title},void 0,!1),e[8]=o.title,e[9]=m):m=e[9];let a;e[10]!==o.description?(a=o.description!==void 0&&(0,f.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[10]=o.description,e[11]=a):a=e[11];let u;e[12]!==c||e[13]!==m||e[14]!==a?(u=(0,f.jsxDEV)("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[c,m,a]},void 0,!0),e[12]=c,e[13]=m,e[14]=a,e[15]=u):u=e[15];let v;e[16]!==s?(v=s("Try it"),e[16]=s,e[17]=v):v=e[17];let k;e[18]!==v?(k=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v},void 0,!1),e[18]=v,e[19]=k):k=e[19];let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=(0,f.jsxDEV)(Tt,{},void 0,!1),e[20]=O):O=e[20];let h;e[21]!==k?(h=(0,f.jsxDEV)("section",{className:"flex flex-col gap-2",children:[k,O]},void 0,!0),e[21]=k,e[22]=h):h=e[22];let g;e[23]!==s?(g=s("Request arguments"),e[23]=s,e[24]=g):g=e[24];let x;e[25]!==g?(x=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g},void 0,!1),e[25]=g,e[26]=x):x=e[26];let b;e[27]!==o.argsSchema?(b=(0,f.jsxDEV)(Le,{schema:o.argsSchema,testId:"api-operation-args"},void 0,!1),e[27]=o.argsSchema,e[28]=b):b=e[28];let S;e[29]!==x||e[30]!==b?(S=(0,f.jsxDEV)("section",{className:"flex flex-col gap-2",children:[x,b]},void 0,!0),e[29]=x,e[30]=b,e[31]=S):S=e[31];let y;e[32]!==s?(y=s("Response body"),e[32]=s,e[33]=y):y=e[33];let $;e[34]!==y?($=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y},void 0,!1),e[34]=y,e[35]=$):$=e[35];let N;if(e[36]!==o.responses||e[37]!==s){let T;e[39]!==s?(T=p(I=>(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[(0,f.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,f.jsxDEV)("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${Ke(I.status)}`,children:[(0,f.jsxDEV)("span",{className:`size-1.5 rounded-full ${Fe(I.status)}`},void 0,!1),I.status]},void 0,!0),I.schema!==void 0&&(0,f.jsxDEV)("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")},void 0,!1)]},void 0,!0),I.description!==void 0&&(0,f.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:I.description},void 0,!1),I.schema!==void 0&&(0,f.jsxDEV)(Le,{schema:I.schema,testId:`api-response-${I.status}`},void 0,!1)]},I.status,!0),"t212"),e[39]=s,e[40]=T):T=e[40],N=o.responses.map(T),e[36]=o.responses,e[37]=s,e[38]=N}else N=e[38];let w;e[41]!==$||e[42]!==N?(w=(0,f.jsxDEV)("section",{className:"flex flex-col gap-3",children:[$,N]},void 0,!0),e[41]=$,e[42]=N,e[43]=w):w=e[43];let C;return e[44]!==o.key||e[45]!==n||e[46]!==h||e[47]!==S||e[48]!==w||e[49]!==u?(C=(0,f.jsxDEV)("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[u,h,S,w]},r,!0),e[44]=o.key,e[45]=n,e[46]=h,e[47]=S,e[48]=w,e[49]=u,e[50]=C):C=e[50],C},"OperationView"),At={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Pt=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Rt=/^\s*:/,Et=p((t,e,o)=>o.startsWith('"')?Rt.test(t.slice(e))?"key":"string":o==="true"||o==="false"||o==="null"?"boolean":"number","classify"),_t=p(t=>{let e=[],o=0;for(let s of t.matchAll(Pt)){let{index:n}=s,r=s[0],l=n+r.length;n>o&&e.push({kind:"plain",start:o,text:t.slice(o,n)}),e.push({kind:Et(t,l,r),start:n,text:r}),o=l}return o<t.length&&e.push({kind:"plain",start:o,text:t.slice(o)}),e},"tokenize"),jt=p(t=>{let e=(0,J.c)(4),{code:o}=t,s;e[0]!==o?(s=_t(o).map(Lt),e[0]=o,e[1]=s):s=e[1];let n;return e[2]!==s?(n=(0,f.jsxDEV)(f.Fragment,{children:s},void 0,!1),e[2]=s,e[3]=n):n=e[3],n},"JsonHighlight");function Lt(t){return(0,f.jsxDEV)("span",{className:At[t.kind],children:t.text},t.start,!1)}p(Lt,"_temp$1");var Be="__live__",Bt=p(t=>t.schema===void 0?"":JSON.stringify(te(t.schema),void 0,2),"exampleBody"),Dt=p((t,e,o)=>o?t??"":e===void 0?"":JSON.stringify(e,void 0,2),"liveBody"),Mt=p(t=>{let e=(0,J.c)(18),{active:o,running:s,showError:n}=t,r=M();if(s){let a;e[0]!==r?(a=r("Sending\u2026"),e[0]=r,e[1]=a):a=e[1];let u;return e[2]!==a?(u=(0,f.jsxDEV)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:a},void 0,!1),e[2]=a,e[3]=u):u=e[3],u}if(o===void 0||o.body===""){let a;e[4]!==o?.live||e[5]!==r?(a=o?.live===!0?r("Send a request to see the response."):r("No example for this response."),e[4]=o?.live,e[5]=r,e[6]=a):a=e[6];let u;return e[7]!==a?(u=(0,f.jsxDEV)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:a},void 0,!1),e[7]=a,e[8]=u):u=e[8],u}let l=n&&"text-destructive",i;e[9]!==l?(i=ge("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=i):i=e[10];let d=n?"api-response-error":"api-response-body",c;e[11]!==o.body||e[12]!==n?(c=n?o.body:(0,f.jsxDEV)(jt,{code:o.body},void 0,!1),e[11]=o.body,e[12]=n,e[13]=c):c=e[13];let m;return e[14]!==i||e[15]!==d||e[16]!==c?(m=(0,f.jsxDEV)("pre",{className:i,"data-testid":d,children:c},void 0,!1),e[14]=i,e[15]=d,e[16]=c,e[17]=m):m=e[17],m},"ResponseBody"),Kt=p(()=>{let t=(0,J.c)(67),e=M(),{durationMs:o,error:s,operation:n,response:r,status:l}=qe(),i=l==="running",d=l==="error",c=l==="success"||d,m;if(t[0]!==o||t[1]!==s||t[2]!==d||t[3]!==n.responses||t[4]!==c||t[5]!==r||t[6]!==e){e:{let L=n.responses.map(Ft);if(!c){m=L;break e}let A;t[8]!==s||t[9]!==d||t[10]!==r?(A=Dt(s,r,d),t[8]=s,t[9]=d,t[10]=r,t[11]=A):A=t[11];let _;t[12]!==e?(_=e("Live"),t[12]=e,t[13]=_):_=t[13];let D=d?"error":"200",V;t[14]!==o||t[15]!==A||t[16]!==_||t[17]!==D?(V={body:A,durationMs:o,id:Be,label:_,live:!0,status:D},t[14]=o,t[15]=A,t[16]=_,t[17]=D,t[18]=V):V=t[18],m=[V,...L]}t[0]=o,t[1]=s,t[2]=d,t[3]=n.responses,t[4]=c,t[5]=r,t[6]=e,t[7]=m}else m=t[7];let a=m,u;t[19]!==c||t[20]!==a?(u=c?Be:a.find(Jt)?.id??a[0]?.id??"",t[19]=c,t[20]=a,t[21]=u):u=t[21];let v=u,[k,O]=(0,K.useState)(null),h,g,x,b,S,y,$,N,w,C;if(t[22]!==v||t[23]!==k||t[24]!==e||t[25]!==a){h=a.find(D=>D.id===(k??v))??a[0];let L;t[36]===Symbol.for("react.memo_cache_sentinel")?(L=p(D=>{let{id:V}=D.currentTarget.dataset;V!==void 0&&O(V)},"t82"),t[36]=L):L=t[36],x=L,g=p(()=>{h!==void 0&&re(h.body)},"onCopy");let A=h?.live===!0?h.durationMs:null;b=h?.live===!0&&h.status==="error",w="flex min-h-0 flex-col rounded-xl border border-border bg-card",C="api-response-panel",$="flex items-center justify-between gap-2 border-b border-border px-3 py-2";let _;t[37]!==e?(_=e("Response"),t[37]=e,t[38]=_):_=t[38],t[39]!==_?(N=(0,f.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_},void 0,!1),t[39]=_,t[40]=N):N=t[40],S="flex items-center gap-2",y=A!==null&&(0,f.jsxDEV)("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:A})},void 0,!1),t[22]=v,t[23]=k,t[24]=e,t[25]=a,t[26]=h,t[27]=g,t[28]=x,t[29]=b,t[30]=S,t[31]=y,t[32]=$,t[33]=N,t[34]=w,t[35]=C}else h=t[26],g=t[27],x=t[28],b=t[29],S=t[30],y=t[31],$=t[32],N=t[33],w=t[34],C=t[35];let T;t[41]!==h||t[42]!==g||t[43]!==e?(T=h!==void 0&&h.body!==""&&(0,f.jsxDEV)(H,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:g,size:"icon-xs",type:"button",variant:"ghost",children:(0,f.jsxDEV)(ae,{icon:we,strokeWidth:2},void 0,!1)},void 0,!1),t[41]=h,t[42]=g,t[43]=e,t[44]=T):T=t[44];let I;t[45]!==S||t[46]!==y||t[47]!==T?(I=(0,f.jsxDEV)("div",{className:S,children:[y,T]},void 0,!0),t[45]=S,t[46]=y,t[47]=T,t[48]=I):I=t[48];let P;t[49]!==$||t[50]!==N||t[51]!==I?(P=(0,f.jsxDEV)("div",{className:$,children:[N,I]},void 0,!0),t[49]=$,t[50]=N,t[51]=I,t[52]=P):P=t[52];let E;t[53]!==h?.id||t[54]!==x||t[55]!==a?(E=a.length>0&&(0,f.jsxDEV)("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:a.map(L=>{let A=L.id===h?.id;return(0,f.jsxDEV)("button",{"aria-selected":A,className:ge("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",A?Ke(L.status):"text-muted-foreground"),"data-id":L.id,"data-testid":L.live?"api-response-tab-live":`api-response-tab-${L.status}`,onClick:x,role:"tab",type:"button",children:[(0,f.jsxDEV)("span",{className:`size-1.5 rounded-full ${Fe(L.status)}`},void 0,!1),L.label]},L.id,!0)})},void 0,!1),t[53]=h?.id,t[54]=x,t[55]=a,t[56]=E):E=t[56];let j;t[57]!==h||t[58]!==i||t[59]!==b?(j=(0,f.jsxDEV)(Mt,{active:h,running:i,showError:b},void 0,!1),t[57]=h,t[58]=i,t[59]=b,t[60]=j):j=t[60];let R;return t[61]!==P||t[62]!==E||t[63]!==j||t[64]!==w||t[65]!==C?(R=(0,f.jsxDEV)("div",{className:w,"data-testid":C,children:[P,E,j]},void 0,!0),t[61]=P,t[62]=E,t[63]=j,t[64]=w,t[65]=C,t[66]=R):R=t[66],R},"ResponsePanel");function Ft(t){return{body:Bt(t),durationMs:null,id:t.status,label:t.status,live:!1,status:t.status}}p(Ft,"_temp");function Jt(t){return t.status.startsWith("2")}p(Jt,"_temp2");var qt=p((t,e)=>{let o=e.trim().toLowerCase();return o===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(o))})).filter(s=>s.operations.length>0)},"filterGroups"),me=p(t=>{let e=(0,J.c)(53),{model:o}=t,s=M(),n=o.groups[0]?.operations[0]?.key??"",[r,l]=(0,K.useState)(n),[i,d]=(0,K.useState)(""),c;e[0]!==n||e[1]!==o.operationByKey||e[2]!==r?(c=o.operationByKey.get(r)??o.operationByKey.get(n),e[0]=n,e[1]=o.operationByKey,e[2]=r,e[3]=c):c=e[3];let m=c,a,u,v,k,O,h,g,x,b,S;if(e[4]!==i||e[5]!==o.groups||e[6]!==o.server||e[7]!==m?.key||e[8]!==s){a=qt(o.groups,i);let T;e[19]===Symbol.for("react.memo_cache_sentinel")?(T=p(A=>{let{key:_}=A.currentTarget.dataset;_!==void 0&&l(_)},"t102"),e[19]=T):T=e[19];let I=T,P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=p(A=>{d(A.target.value)},"t112"),e[20]=P):P=e[20];let E=P;u=o.server??"",b="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",S="api-reference",e[21]!==s?(O=s("API operations"),e[21]=s,e[22]=O):O=e[22],h="flex min-h-0 flex-col overflow-y-auto border-r border-border",g="api-reference-nav";let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=(0,f.jsxDEV)(ae,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:Oe,strokeWidth:2},void 0,!1),e[23]=j):j=e[23];let R;e[24]!==s?(R=s("Filter operations"),e[24]=s,e[25]=R):R=e[25],e[26]!==i||e[27]!==R?(x=(0,f.jsxDEV)("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:(0,f.jsxDEV)("div",{className:"relative",children:[j,(0,f.jsxDEV)(ke,{className:"h-7 pl-7","data-testid":"api-filter",onChange:E,placeholder:R,value:i},void 0,!1)]},void 0,!0)},void 0,!1),e[26]=i,e[27]=R,e[28]=x):x=e[28],v="flex flex-col gap-4 p-2";let L;e[29]!==m?.key||e[30]!==s?(L=p(A=>(0,f.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,f.jsxDEV)("div",{className:"flex items-center justify-between px-2",children:[(0,f.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A.name||s("(root)")},void 0,!1),(0,f.jsxDEV)("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:A.operations.length},void 0,!1)]},void 0,!0),A.operations.map(_=>{let D=_.key===m?.key;return(0,f.jsxDEV)("button",{"aria-current":D?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:I,type:"button",children:[(0,f.jsxDEV)("span",{className:"truncate",children:_.summary},void 0,!1),(0,f.jsxDEV)(be,{kind:_.kind,method:_.method},void 0,!1)]},_.key,!0)})]},A.name,!0),"t142"),e[29]=m?.key,e[30]=s,e[31]=L):L=e[31],k=a.map(L),e[4]=i,e[5]=o.groups,e[6]=o.server,e[7]=m?.key,e[8]=s,e[9]=a,e[10]=u,e[11]=v,e[12]=k,e[13]=O,e[14]=h,e[15]=g,e[16]=x,e[17]=b,e[18]=S}else a=e[9],u=e[10],v=e[11],k=e[12],O=e[13],h=e[14],g=e[15],x=e[16],b=e[17],S=e[18];let y;e[32]!==a.length||e[33]!==s?(y=a.length===0&&(0,f.jsxDEV)("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")},void 0,!1),e[32]=a.length,e[33]=s,e[34]=y):y=e[34];let $;e[35]!==y||e[36]!==v||e[37]!==k?($=(0,f.jsxDEV)("div",{className:v,children:[k,y]},void 0,!0),e[35]=y,e[36]=v,e[37]=k,e[38]=$):$=e[38];let N;e[39]!==$||e[40]!==O||e[41]!==h||e[42]!==g||e[43]!==x?(N=(0,f.jsxDEV)("nav",{"aria-label":O,className:h,"data-testid":g,children:[x,$]},void 0,!0),e[39]=$,e[40]=O,e[41]=h,e[42]=g,e[43]=x,e[44]=N):N=e[44];let w;e[45]!==m||e[46]!==u?(w=m===void 0?(0,f.jsxDEV)("div",{className:"lg:col-span-2"},void 0,!1):(0,f.jsxDEV)(It,{operation:m,children:[(0,f.jsxDEV)("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:(0,f.jsxDEV)(Ct,{operation:m},void 0,!1)},void 0,!1),(0,f.jsxDEV)("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[(0,f.jsxDEV)(St,{operation:m,server:u},void 0,!1),(0,f.jsxDEV)(Kt,{},void 0,!1)]},void 0,!0)]},m.key,!0),e[45]=m,e[46]=u,e[47]=w):w=e[47];let C;return e[48]!==N||e[49]!==w||e[50]!==b||e[51]!==S?(C=(0,f.jsxDEV)("div",{className:b,"data-testid":S,children:[N,w]},void 0,!0),e[48]=N,e[49]=w,e[50]=b,e[51]=S,e[52]=C):C=e[52],C},"ReferenceView");var Y=q(ne(),1);var Vt=["get","post","put","patch","delete","head","options","trace"],ze=p(t=>t?.content?.["application/json"]?.schema,"jsonSchemaOf"),zt=p((t,e)=>Object.entries(t.responses??{}).map(([o,s])=>{let n=s.$ref?.replace("#/components/responses/",""),r=n===void 0?s:e.components?.responses?.[n]??s;return{description:r.description,schema:ze(r),status:o}}),"buildResponses"),Ht=p((t,e,o,s,n)=>{let r=ze(s.requestBody),l=r?.properties?.functionPath?.const,i=typeof l=="string"?l:void 0,d=i===void 0?r:r?.properties?.args,c=s.operationId??`${o} ${e}`;return{argsSchema:d,description:s.description,functionPath:i,httpPath:e,key:t,kind:s["x-lunora-function-kind"],method:o.toUpperCase(),operationId:c,requestSchema:r,responses:zt(s,n),summary:s.summary??c,tags:s.tags??[],title:s.summary??c}},"flattenOperation"),Wt=p(t=>{let e=[];for(let[o,s]of Object.entries(t.paths??{})){let n=o.includes("#")?o.slice(0,o.indexOf("#")):o;for(let r of Vt){let l=s[r];l!==void 0&&e.push(Ht(o,n,r,l,t))}}return e},"collectOperations"),Gt=p(t=>{let e=t??{},o=Wt(e),s=new Map((e.tags??[]).map(i=>[i.name,i.description])),n=new Set,r=[],l=p(i=>{if(n.has(i))return;n.add(i);let d=o.filter(c=>(c.tags[0]??"")===i);d.length>0&&r.push({description:s.get(i),name:i,operations:d})},"pushGroup");for(let i of e.tags??[])l(i.name);for(let i of o)l(i.tags[0]??"");return{groups:r,operationByKey:new Map(o.map(i=>[i.key,i])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},"parseOpenApi"),Ut=p(t=>{let{paths:e}=t;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},"isEmptySpec"),Yt=p(t=>{let e=t;return Ut(e)?{kind:"empty"}:{kind:"ready",spec:e}},"classifySpec"),He=p(t=>{let e=(0,Ve.c)(23),{spec:o}=t,s=M(),n=G(),r;e[0]!==n?(r=p(()=>n.fetchOpenApi(),"t1"),e[0]=n,e[1]=r):r=e[1];let i=ue(o,r,Yt),d;e[2]!==i.kind||e[3]!==i.spec?(d=i.kind==="ready"?Gt(i.spec):void 0,e[2]=i.kind,e[3]=i.spec,e[4]=d):d=e[4];let c=d;if(i.kind==="loading"){let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,Y.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[(0,Y.jsxDEV)(X,{className:"h-8 w-48"},void 0,!1),(0,Y.jsxDEV)(X,{className:"h-64 w-full"},void 0,!1)]},void 0,!0),e[5]=a):a=e[5],a}if(i.kind==="error"){let a;e[6]!==i.message||e[7]!==s?(a=s("Couldn't load the OpenAPI spec: {message}",{message:i.message}),e[6]=i.message,e[7]=s,e[8]=a):a=e[8];let u;e[9]!==s?(u=s("API reference unavailable"),e[9]=s,e[10]=u):u=e[10];let v;return e[11]!==a||e[12]!==u?(v=(0,Y.jsxDEV)(W,{description:a,testId:"api-reference-error",title:u},void 0,!1),e[11]=a,e[12]=u,e[13]=v):v=e[13],v}if(i.kind==="empty"||c===void 0){let a;e[14]!==s?(a=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=a):a=e[15];let u;e[16]!==s?(u=s("No OpenAPI spec configured"),e[16]=s,e[17]=u):u=e[17];let v;return e[18]!==a||e[19]!==u?(v=(0,Y.jsxDEV)(W,{description:a,testId:"api-reference-empty",title:u},void 0,!1),e[18]=a,e[19]=u,e[20]=v):v=e[20],v}let m;return e[21]!==c?(m=(0,Y.jsxDEV)(me,{model:c},void 0,!1),e[21]=c,e[22]=m):m=e[22],m},"ApiReferencePanel");var We=q(oe(),1);var Q=q(ne(),1);var Qt=p(t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],"argsParameterOf"),Xt=p(t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),"namespaceOf"),Zt=p(t=>{let e=Qt(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[Xt(t)],title:t.summary??t.name}},"toOperation"),es=p(t=>{let e=t??{},o=(e.methods??[]).map(r=>Zt(r)),s=new Map;for(let r of o){let l=r.tags[0]??"",i=s.get(l)??[];i.push(r),s.set(l,i)}return{groups:[...s.entries()].map(([r,l])=>({name:r,operations:l.toSorted((i,d)=>i.operationId.localeCompare(d.operationId))})).toSorted((r,l)=>r.name.localeCompare(l.name)),operationByKey:new Map(o.map(r=>[r.key,r])),title:e.info?.title??"API reference",version:e.info?.version}},"parseOpenRpc"),ts=p(t=>t.methods===void 0||t.methods.length===0,"isEmptyDocument"),ss=p(t=>{let e=t;return ts(e)?{kind:"empty"}:{kind:"ready",spec:e}},"classifyDocument"),Ge=p(t=>{let e=(0,We.c)(23),{spec:o}=t,s=M(),n=G(),r;e[0]!==n?(r=p(()=>n.fetchOpenRpc(),"t1"),e[0]=n,e[1]=r):r=e[1];let i=ue(o,r,ss),d;e[2]!==i.kind||e[3]!==i.spec?(d=i.kind==="ready"?es(i.spec):void 0,e[2]=i.kind,e[3]=i.spec,e[4]=d):d=e[4];let c=d;if(i.kind==="loading"){let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,Q.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[(0,Q.jsxDEV)(X,{className:"h-8 w-48"},void 0,!1),(0,Q.jsxDEV)(X,{className:"h-64 w-full"},void 0,!1)]},void 0,!0),e[5]=a):a=e[5],a}if(i.kind==="error"){let a;e[6]!==i.message||e[7]!==s?(a=s("Couldn't load the OpenRPC spec: {message}",{message:i.message}),e[6]=i.message,e[7]=s,e[8]=a):a=e[8];let u;e[9]!==s?(u=s("API reference unavailable"),e[9]=s,e[10]=u):u=e[10];let v;return e[11]!==a||e[12]!==u?(v=(0,Q.jsxDEV)(W,{description:a,testId:"openrpc-reference-error",title:u},void 0,!1),e[11]=a,e[12]=u,e[13]=v):v=e[13],v}if(i.kind==="empty"||c===void 0){let a;e[14]!==s?(a=s("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=s,e[15]=a):a=e[15];let u;e[16]!==s?(u=s("No OpenRPC spec configured"),e[16]=s,e[17]=u):u=e[17];let v;return e[18]!==a||e[19]!==u?(v=(0,Q.jsxDEV)(W,{description:a,testId:"openrpc-reference-empty",title:u},void 0,!1),e[18]=a,e[19]=u,e[20]=v):v=e[20],v}let m;return e[21]!==c?(m=(0,Q.jsxDEV)(me,{model:c},void 0,!1),e[21]=c,e[22]=m):m=e[22],m},"OpenRpcReferencePanel");var z=q(ne(),1);var os=["reference","snippets"],ns=["openapi","openrpc"],Ws=p(t=>{let e=(0,Ue.c)(51),{functions:o,initialShardKey:s,openApiSpec:n,openRpcSpec:r}=t,l=M(),[i,d]=(0,ye.useState)("reference"),[c,m]=(0,ye.useState)("openapi"),a;e[0]!==l?(a=l("Reference"),e[0]=l,e[1]=a):a=e[1];let u;e[2]!==l?(u=l("Snippets"),e[2]=l,e[3]=u):u=e[3];let v;e[4]!==a||e[5]!==u?(v={reference:a,snippets:u},e[4]=a,e[5]=u,e[6]=v):v=e[6];let k=v,O;e[7]!==l?(O=l("OpenAPI"),e[7]=l,e[8]=O):O=e[8];let h;e[9]!==l?(h=l("OpenRPC"),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==O||e[12]!==h?(g={openapi:O,openrpc:h},e[11]=O,e[12]=h,e[13]=g):g=e[13];let x=g,b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=p(A=>{d(A.currentTarget.dataset.view)},"t7"),e[14]=b):b=e[14];let S=b,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=p(A=>{m(A.currentTarget.dataset.format)},"t8"),e[15]=y):y=e[15];let $=y,N;e[16]!==l?(N=l("API view"),e[16]=l,e[17]=N):N=e[17];let w;e[18]!==i||e[19]!==k?(w=os.map(A=>(0,z.jsxDEV)(H,{"aria-selected":i===A,"data-testid":`api-view-${A}`,"data-view":A,onClick:S,role:"tab",size:"sm",type:"button",variant:i===A?"default":"outline",children:k[A]},A,!1)),e[18]=i,e[19]=k,e[20]=w):w=e[20];let C;e[21]!==w||e[22]!==N?(C=(0,z.jsxDEV)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=w,e[22]=N,e[23]=C):C=e[23];let T;e[24]!==c||e[25]!==x||e[26]!==l||e[27]!==i?(T=i==="reference"&&(0,z.jsxDEV)("div",{"aria-label":l("API spec format"),className:"flex gap-1.5","data-testid":"api-format-toggle",role:"tablist",children:ns.map(A=>(0,z.jsxDEV)(H,{"aria-selected":c===A,"data-format":A,"data-testid":`api-format-${A}`,onClick:$,role:"tab",size:"sm",type:"button",variant:c===A?"default":"outline",children:x[A]},A,!1))},void 0,!1),e[24]=c,e[25]=x,e[26]=l,e[27]=i,e[28]=T):T=e[28];let I;e[29]!==C||e[30]!==T?(I=(0,z.jsxDEV)("div",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-6 py-3",children:[C,T]},void 0,!0),e[29]=C,e[30]=T,e[31]=I):I=e[31];let P;e[32]!==o||e[33]!==s||e[34]!==i?(P=i==="snippets"&&(0,z.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:(0,z.jsxDEV)(je,{functions:o,initialShardKey:s},void 0,!1)},void 0,!1),e[32]=o,e[33]=s,e[34]=i,e[35]=P):P=e[35];let E;e[36]!==c||e[37]!==n||e[38]!==i?(E=i==="reference"&&c==="openapi"&&(0,z.jsxDEV)(He,{spec:n},void 0,!1),e[36]=c,e[37]=n,e[38]=i,e[39]=E):E=e[39];let j;e[40]!==c||e[41]!==r||e[42]!==i?(j=i==="reference"&&c==="openrpc"&&(0,z.jsxDEV)(Ge,{spec:r},void 0,!1),e[40]=c,e[41]=r,e[42]=i,e[43]=j):j=e[43];let R;e[44]!==P||e[45]!==E||e[46]!==j?(R=(0,z.jsxDEV)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[P,E,j]},void 0,!0),e[44]=P,e[45]=E,e[46]=j,e[47]=R):R=e[47];let L;return e[48]!==I||e[49]!==R?(L=(0,z.jsxDEV)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"lunora-api-tab",children:[I,R]},void 0,!0),e[48]=I,e[49]=R,e[50]=L):L=e[50],L},"ApiTab");export{Ws as default};
|
|
12
|
+
const data = await response.json();`}}},"sampleSource"),kt=p(t=>{let e=(0,J.c)(24),{operation:o,server:s}=t,n=M(),[r,l]=(0,K.useState)("curl"),i;e[0]!==o||e[1]!==r||e[2]!==s?(i=St(r,o,s),e[0]=o,e[1]=r,e[2]=s,e[3]=i):i=e[3];let d=i,c;e[4]!==d?(c=p(()=>{re(d)},"t2"),e[4]=d,e[5]=c):c=e[5];let m=c,a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=p(y=>{l(y.currentTarget.dataset.sample)},"t3"),e[6]=a):a=e[6];let u=a,v;e[7]!==r?(v=xt.map(y=>(0,f.jsxDEV)("button",{"aria-selected":r===y,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":y,"data-testid":`api-sample-${y}`,onClick:u,role:"tab",type:"button",children:bt[y]},y,!1)),e[7]=r,e[8]=v):v=e[8];let S;e[9]!==v?(S=(0,f.jsxDEV)("div",{className:"flex gap-1",role:"tablist",children:v},void 0,!1),e[9]=v,e[10]=S):S=e[10];let O;e[11]!==n?(O=n("Copy"),e[11]=n,e[12]=O):O=e[12];let h;e[13]!==m||e[14]!==O?(h=(0,f.jsxDEV)(H,{"data-testid":"api-sample-copy",onClick:m,size:"xs",type:"button",variant:"ghost",children:O},void 0,!1),e[13]=m,e[14]=O,e[15]=h):h=e[15];let g;e[16]!==S||e[17]!==h?(g=(0,f.jsxDEV)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[S,h]},void 0,!0),e[16]=S,e[17]=h,e[18]=g):g=e[18];let x;e[19]!==d?(x=(0,f.jsxDEV)("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:d},void 0,!1),e[19]=d,e[20]=x):x=e[20];let b;return e[21]!==g||e[22]!==x?(b=(0,f.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[g,x]},void 0,!0),e[21]=g,e[22]=x,e[23]=b):b=e[23],b},"CodeSamples"),wt={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},Ot=p(t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},"methodTone"),$t=p(t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},"kindTone"),be=p(t=>{let e=(0,J.c)(7),{kind:o,method:s,testId:n}=t,r;e[0]!==o||e[1]!==s?(r=o??s.toUpperCase(),e[0]=o,e[1]=s,e[2]=r):r=e[2];let l=r,i=o===void 0?Ot(s):$t(o),d=`${wt[i]} font-mono text-[10px] tracking-wide uppercase`,c;return e[3]!==l||e[4]!==d||e[5]!==n?(c=(0,f.jsxDEV)(Se,{className:d,"data-testid":n,variant:"ghost",children:l},void 0,!1),e[3]=l,e[4]=d,e[5]=n,e[6]=c):c=e[6],c},"MethodBadge"),Fe=p(t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground","statusToneClass"),Je=p(t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground","statusDotClass"),It=p(t=>JSON.stringify(te(t.argsSchema)??{},void 0,2),"seedArgs"),qe=(0,K.createContext)(null),Ve=p(()=>{let t=(0,K.use)(qe);if(t===null)throw new Ne("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},"useOperationRun"),Tt=p(({children:t,operation:e})=>{let o=M(),s=G(),[n,r]=(0,K.useState)(()=>It(e)),[l,i]=(0,K.useState)(""),[d,c]=(0,K.useState)("idle"),[m,a]=(0,K.useState)(void 0),[u,v]=(0,K.useState)(null),[S,O]=(0,K.useState)(null),h=p(async()=>{let b;try{b=n.trim()===""?{}:JSON.parse(n)}catch(N){c("error"),a(void 0),O(null),v(o("Invalid JSON args: {message}",{message:ce(N)}));return}c("running"),v(null);let y=performance.now();try{let N;if(e.functionPath===void 0){let T=e.method!=="GET"&&e.method!=="HEAD",w=await(await fetch(e.httpPath,{body:T?JSON.stringify(b):void 0,headers:T?{"content-type":"application/json"}:void 0,method:e.method})).text();try{N=JSON.parse(w)}catch{N=w}}else N=await Ie(s,e.kind,le(e.functionPath),b,de(l));a(N),O(Math.round(performance.now()-y)),c("success")}catch(N){a(void 0),O(Math.round(performance.now()-y)),v(ce(N)),c("error")}},"send");return(0,f.jsxDEV)(qe,{value:{argsText:n,durationMs:S,error:u,operation:e,response:m,send:p(()=>{Te(h())},"onSend"),setArgsText:r,setShardKey:i,shardKey:l,status:d},children:t},void 0,!1)},"OperationRunProvider"),Ct=p(()=>{let t=(0,J.c)(48),e=M(),{argsText:o,operation:s,send:n,setArgsText:r,setShardKey:l,shardKey:i,status:d}=Ve(),c;t[0]!==r?(c=p(R=>{r(R.target.value)},"t0"),t[0]=r,t[1]=c):c=t[1];let m=c,a;t[2]!==n?(a=p(R=>{R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),n())},"t1"),t[2]=n,t[3]=a):a=t[3];let u=a,v=d==="running",S;t[4]!==s.kind||t[5]!==s.method?(S=(0,f.jsxDEV)(be,{kind:s.kind,method:s.method,testId:"api-try-method"},void 0,!1),t[4]=s.kind,t[5]=s.method,t[6]=S):S=t[6];let O=s.functionPath??s.httpPath,h;t[7]!==O?(h=(0,f.jsxDEV)("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:O},void 0,!1),t[7]=O,t[8]=h):h=t[8];let g=v?"animate-pulse":void 0,x;t[9]!==g?(x=(0,f.jsxDEV)(ae,{className:g,icon:$e,strokeWidth:2},void 0,!1),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==v||t[12]!==e?(b=e(v?"Sending\u2026":"Send"),t[11]=v,t[12]=e,t[13]=b):b=t[13];let y;t[14]!==v||t[15]!==n||t[16]!==x||t[17]!==b?(y=(0,f.jsxDEV)(H,{"data-testid":"api-try-send",disabled:v,onClick:n,size:"sm",type:"button",children:[x,b]},void 0,!0),t[14]=v,t[15]=n,t[16]=x,t[17]=b,t[18]=y):y=t[18];let N;t[19]!==S||t[20]!==h||t[21]!==y?(N=(0,f.jsxDEV)("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[S,h,y]},void 0,!0),t[19]=S,t[20]=h,t[21]=y,t[22]=N):N=t[22];let T;t[23]!==e?(T=e("Arguments (JSON)"),t[23]=e,t[24]=T):T=t[24];let k;t[25]!==T?(k=(0,f.jsxDEV)(xe,{htmlFor:"api-try-args",children:T},void 0,!1),t[25]=T,t[26]=k):k=t[26];let w;t[27]!==o?(w=o.split(`
|
|
13
|
+
`),t[27]=o,t[28]=w):w=t[28];let C=Math.min(12,Math.max(3,w.length)),I;t[29]!==o||t[30]!==m||t[31]!==u||t[32]!==C?(I=(0,f.jsxDEV)(Pe,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:m,onKeyDown:u,rows:C,spellCheck:!1,value:o},void 0,!1),t[29]=o,t[30]=m,t[31]=u,t[32]=C,t[33]=I):I=t[33];let $;t[34]!==k||t[35]!==I?($=(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[k,I]},void 0,!0),t[34]=k,t[35]=I,t[36]=$):$=t[36];let P;t[37]!==s.functionPath||t[38]!==l||t[39]!==i||t[40]!==e?(P=s.functionPath!==void 0&&(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,f.jsxDEV)(xe,{htmlFor:"shard-input",children:e("Shard key (optional)")},void 0,!1),(0,f.jsxDEV)(Ae,{id:"shard-input",onChange:l,testId:"shard-input",value:i},void 0,!1)]},void 0,!0),t[37]=s.functionPath,t[38]=l,t[39]=i,t[40]=e,t[41]=P):P=t[41];let E;t[42]!==$||t[43]!==P?(E=(0,f.jsxDEV)("div",{className:"flex flex-col gap-3 p-3",children:[$,P]},void 0,!0),t[42]=$,t[43]=P,t[44]=E):E=t[44];let j;return t[45]!==E||t[46]!==N?(j=(0,f.jsxDEV)("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[N,E]},void 0,!0),t[45]=E,t[46]=N,t[47]=j):j=t[47],j},"TryIt"),At=p(t=>{let e=(0,J.c)(51),{operation:o}=t,s=M(),n=`api-operation-${o.operationId}`,r=o.key,l;e[0]!==o.kind||e[1]!==o.method?(l=(0,f.jsxDEV)(be,{kind:o.kind,method:o.method,testId:"api-operation-method"},void 0,!1),e[0]=o.kind,e[1]=o.method,e[2]=l):l=e[2];let i=o.functionPath??o.httpPath,d;e[3]!==i?(d=(0,f.jsxDEV)("code",{className:"truncate font-mono text-xs text-muted-foreground",children:i},void 0,!1),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==l||e[6]!==d?(c=(0,f.jsxDEV)("div",{className:"flex items-center gap-2",children:[l,d]},void 0,!0),e[5]=l,e[6]=d,e[7]=c):c=e[7];let m;e[8]!==o.title?(m=(0,f.jsxDEV)("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:o.title},void 0,!1),e[8]=o.title,e[9]=m):m=e[9];let a;e[10]!==o.description?(a=o.description!==void 0&&(0,f.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[10]=o.description,e[11]=a):a=e[11];let u;e[12]!==c||e[13]!==m||e[14]!==a?(u=(0,f.jsxDEV)("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[c,m,a]},void 0,!0),e[12]=c,e[13]=m,e[14]=a,e[15]=u):u=e[15];let v;e[16]!==s?(v=s("Try it"),e[16]=s,e[17]=v):v=e[17];let S;e[18]!==v?(S=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v},void 0,!1),e[18]=v,e[19]=S):S=e[19];let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=(0,f.jsxDEV)(Ct,{},void 0,!1),e[20]=O):O=e[20];let h;e[21]!==S?(h=(0,f.jsxDEV)("section",{className:"flex flex-col gap-2",children:[S,O]},void 0,!0),e[21]=S,e[22]=h):h=e[22];let g;e[23]!==s?(g=s("Request arguments"),e[23]=s,e[24]=g):g=e[24];let x;e[25]!==g?(x=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g},void 0,!1),e[25]=g,e[26]=x):x=e[26];let b;e[27]!==o.argsSchema?(b=(0,f.jsxDEV)(Be,{schema:o.argsSchema,testId:"api-operation-args"},void 0,!1),e[27]=o.argsSchema,e[28]=b):b=e[28];let y;e[29]!==x||e[30]!==b?(y=(0,f.jsxDEV)("section",{className:"flex flex-col gap-2",children:[x,b]},void 0,!0),e[29]=x,e[30]=b,e[31]=y):y=e[31];let N;e[32]!==s?(N=s("Response body"),e[32]=s,e[33]=N):N=e[33];let T;e[34]!==N?(T=(0,f.jsxDEV)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N},void 0,!1),e[34]=N,e[35]=T):T=e[35];let k;if(e[36]!==o.responses||e[37]!==s){let I;e[39]!==s?(I=p($=>(0,f.jsxDEV)("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[(0,f.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,f.jsxDEV)("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${Fe($.status)}`,children:[(0,f.jsxDEV)("span",{className:`size-1.5 rounded-full ${Je($.status)}`},void 0,!1),$.status]},void 0,!0),$.schema!==void 0&&(0,f.jsxDEV)("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")},void 0,!1)]},void 0,!0),$.description!==void 0&&(0,f.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:$.description},void 0,!1),$.schema!==void 0&&(0,f.jsxDEV)(Be,{schema:$.schema,testId:`api-response-${$.status}`},void 0,!1)]},$.status,!0),"t212"),e[39]=s,e[40]=I):I=e[40],k=o.responses.map(I),e[36]=o.responses,e[37]=s,e[38]=k}else k=e[38];let w;e[41]!==T||e[42]!==k?(w=(0,f.jsxDEV)("section",{className:"flex flex-col gap-3",children:[T,k]},void 0,!0),e[41]=T,e[42]=k,e[43]=w):w=e[43];let C;return e[44]!==o.key||e[45]!==n||e[46]!==h||e[47]!==y||e[48]!==w||e[49]!==u?(C=(0,f.jsxDEV)("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[u,h,y,w]},r,!0),e[44]=o.key,e[45]=n,e[46]=h,e[47]=y,e[48]=w,e[49]=u,e[50]=C):C=e[50],C},"OperationView"),Pt={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Rt=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Et=/^\s*:/,_t=p((t,e,o)=>o.startsWith('"')?Et.test(t.slice(e))?"key":"string":o==="true"||o==="false"||o==="null"?"boolean":"number","classify"),jt=p(t=>{let e=[],o=0;for(let s of t.matchAll(Rt)){let{index:n}=s,r=s[0],l=n+r.length;n>o&&e.push({kind:"plain",start:o,text:t.slice(o,n)}),e.push({kind:_t(t,l,r),start:n,text:r}),o=l}return o<t.length&&e.push({kind:"plain",start:o,text:t.slice(o)}),e},"tokenize"),Lt=p(t=>{let e=(0,J.c)(4),{code:o}=t,s;e[0]!==o?(s=jt(o).map(Bt),e[0]=o,e[1]=s):s=e[1];let n;return e[2]!==s?(n=(0,f.jsxDEV)(f.Fragment,{children:s},void 0,!1),e[2]=s,e[3]=n):n=e[3],n},"JsonHighlight");function Bt(t){return(0,f.jsxDEV)("span",{className:Pt[t.kind],children:t.text},t.start,!1)}p(Bt,"_temp$1");var De="__live__",Dt=p(t=>t.schema===void 0?"":JSON.stringify(te(t.schema),void 0,2),"exampleBody"),Mt=p((t,e,o)=>o?t??"":e===void 0?"":JSON.stringify(e,void 0,2),"liveBody"),Kt=p(t=>{let e=(0,J.c)(18),{active:o,running:s,showError:n}=t,r=M();if(s){let a;e[0]!==r?(a=r("Sending\u2026"),e[0]=r,e[1]=a):a=e[1];let u;return e[2]!==a?(u=(0,f.jsxDEV)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:a},void 0,!1),e[2]=a,e[3]=u):u=e[3],u}if(o===void 0||o.body===""){let a;e[4]!==o?.live||e[5]!==r?(a=o?.live===!0?r("Send a request to see the response."):r("No example for this response."),e[4]=o?.live,e[5]=r,e[6]=a):a=e[6];let u;return e[7]!==a?(u=(0,f.jsxDEV)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:a},void 0,!1),e[7]=a,e[8]=u):u=e[8],u}let l=n&&"text-destructive",i;e[9]!==l?(i=ge("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=i):i=e[10];let d=n?"api-response-error":"api-response-body",c;e[11]!==o.body||e[12]!==n?(c=n?o.body:(0,f.jsxDEV)(Lt,{code:o.body},void 0,!1),e[11]=o.body,e[12]=n,e[13]=c):c=e[13];let m;return e[14]!==i||e[15]!==d||e[16]!==c?(m=(0,f.jsxDEV)("pre",{className:i,"data-testid":d,children:c},void 0,!1),e[14]=i,e[15]=d,e[16]=c,e[17]=m):m=e[17],m},"ResponseBody"),Ft=p(()=>{let t=(0,J.c)(67),e=M(),{durationMs:o,error:s,operation:n,response:r,status:l}=Ve(),i=l==="running",d=l==="error",c=l==="success"||d,m;if(t[0]!==o||t[1]!==s||t[2]!==d||t[3]!==n.responses||t[4]!==c||t[5]!==r||t[6]!==e){e:{let L=n.responses.map(Jt);if(!c){m=L;break e}let A;t[8]!==s||t[9]!==d||t[10]!==r?(A=Mt(s,r,d),t[8]=s,t[9]=d,t[10]=r,t[11]=A):A=t[11];let _;t[12]!==e?(_=e("Live"),t[12]=e,t[13]=_):_=t[13];let D=d?"error":"200",V;t[14]!==o||t[15]!==A||t[16]!==_||t[17]!==D?(V={body:A,durationMs:o,id:De,label:_,live:!0,status:D},t[14]=o,t[15]=A,t[16]=_,t[17]=D,t[18]=V):V=t[18],m=[V,...L]}t[0]=o,t[1]=s,t[2]=d,t[3]=n.responses,t[4]=c,t[5]=r,t[6]=e,t[7]=m}else m=t[7];let a=m,u;t[19]!==c||t[20]!==a?(u=c?De:a.find(qt)?.id??a[0]?.id??"",t[19]=c,t[20]=a,t[21]=u):u=t[21];let v=u,[S,O]=(0,K.useState)(null),h,g,x,b,y,N,T,k,w,C;if(t[22]!==v||t[23]!==S||t[24]!==e||t[25]!==a){h=a.find(D=>D.id===(S??v))??a[0];let L;t[36]===Symbol.for("react.memo_cache_sentinel")?(L=p(D=>{let{id:V}=D.currentTarget.dataset;V!==void 0&&O(V)},"t82"),t[36]=L):L=t[36],x=L,g=p(()=>{h!==void 0&&re(h.body)},"onCopy");let A=h?.live===!0?h.durationMs:null;b=h?.live===!0&&h.status==="error",w="flex min-h-0 flex-col rounded-xl border border-border bg-card",C="api-response-panel",T="flex items-center justify-between gap-2 border-b border-border px-3 py-2";let _;t[37]!==e?(_=e("Response"),t[37]=e,t[38]=_):_=t[38],t[39]!==_?(k=(0,f.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_},void 0,!1),t[39]=_,t[40]=k):k=t[40],y="flex items-center gap-2",N=A!==null&&(0,f.jsxDEV)("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:A})},void 0,!1),t[22]=v,t[23]=S,t[24]=e,t[25]=a,t[26]=h,t[27]=g,t[28]=x,t[29]=b,t[30]=y,t[31]=N,t[32]=T,t[33]=k,t[34]=w,t[35]=C}else h=t[26],g=t[27],x=t[28],b=t[29],y=t[30],N=t[31],T=t[32],k=t[33],w=t[34],C=t[35];let I;t[41]!==h||t[42]!==g||t[43]!==e?(I=h!==void 0&&h.body!==""&&(0,f.jsxDEV)(H,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:g,size:"icon-xs",type:"button",variant:"ghost",children:(0,f.jsxDEV)(ae,{icon:we,strokeWidth:2},void 0,!1)},void 0,!1),t[41]=h,t[42]=g,t[43]=e,t[44]=I):I=t[44];let $;t[45]!==y||t[46]!==N||t[47]!==I?($=(0,f.jsxDEV)("div",{className:y,children:[N,I]},void 0,!0),t[45]=y,t[46]=N,t[47]=I,t[48]=$):$=t[48];let P;t[49]!==T||t[50]!==k||t[51]!==$?(P=(0,f.jsxDEV)("div",{className:T,children:[k,$]},void 0,!0),t[49]=T,t[50]=k,t[51]=$,t[52]=P):P=t[52];let E;t[53]!==h?.id||t[54]!==x||t[55]!==a?(E=a.length>0&&(0,f.jsxDEV)("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:a.map(L=>{let A=L.id===h?.id;return(0,f.jsxDEV)("button",{"aria-selected":A,className:ge("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",A?Fe(L.status):"text-muted-foreground"),"data-id":L.id,"data-testid":L.live?"api-response-tab-live":`api-response-tab-${L.status}`,onClick:x,role:"tab",type:"button",children:[(0,f.jsxDEV)("span",{className:`size-1.5 rounded-full ${Je(L.status)}`},void 0,!1),L.label]},L.id,!0)})},void 0,!1),t[53]=h?.id,t[54]=x,t[55]=a,t[56]=E):E=t[56];let j;t[57]!==h||t[58]!==i||t[59]!==b?(j=(0,f.jsxDEV)(Kt,{active:h,running:i,showError:b},void 0,!1),t[57]=h,t[58]=i,t[59]=b,t[60]=j):j=t[60];let R;return t[61]!==P||t[62]!==E||t[63]!==j||t[64]!==w||t[65]!==C?(R=(0,f.jsxDEV)("div",{className:w,"data-testid":C,children:[P,E,j]},void 0,!0),t[61]=P,t[62]=E,t[63]=j,t[64]=w,t[65]=C,t[66]=R):R=t[66],R},"ResponsePanel");function Jt(t){return{body:Dt(t),durationMs:null,id:t.status,label:t.status,live:!1,status:t.status}}p(Jt,"_temp");function qt(t){return t.status.startsWith("2")}p(qt,"_temp2");var Vt=p((t,e)=>{let o=e.trim().toLowerCase();return o===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(o))})).filter(s=>s.operations.length>0)},"filterGroups"),me=p(t=>{let e=(0,J.c)(53),{model:o}=t,s=M(),n=o.groups[0]?.operations[0]?.key??"",[r,l]=(0,K.useState)(n),[i,d]=(0,K.useState)(""),c;e[0]!==n||e[1]!==o.operationByKey||e[2]!==r?(c=o.operationByKey.get(r)??o.operationByKey.get(n),e[0]=n,e[1]=o.operationByKey,e[2]=r,e[3]=c):c=e[3];let m=c,a,u,v,S,O,h,g,x,b,y;if(e[4]!==i||e[5]!==o.groups||e[6]!==o.server||e[7]!==m?.key||e[8]!==s){a=Vt(o.groups,i);let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=p(A=>{let{key:_}=A.currentTarget.dataset;_!==void 0&&l(_)},"t102"),e[19]=I):I=e[19];let $=I,P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=p(A=>{d(A.target.value)},"t112"),e[20]=P):P=e[20];let E=P;u=o.server??"",b="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",y="api-reference",e[21]!==s?(O=s("API operations"),e[21]=s,e[22]=O):O=e[22],h="flex min-h-0 flex-col overflow-y-auto border-r border-border",g="api-reference-nav";let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=(0,f.jsxDEV)(ae,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:Oe,strokeWidth:2},void 0,!1),e[23]=j):j=e[23];let R;e[24]!==s?(R=s("Filter operations"),e[24]=s,e[25]=R):R=e[25],e[26]!==i||e[27]!==R?(x=(0,f.jsxDEV)("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:(0,f.jsxDEV)("div",{className:"relative",children:[j,(0,f.jsxDEV)(ke,{className:"h-7 pl-7","data-testid":"api-filter",onChange:E,placeholder:R,value:i},void 0,!1)]},void 0,!0)},void 0,!1),e[26]=i,e[27]=R,e[28]=x):x=e[28],v="flex flex-col gap-4 p-2";let L;e[29]!==m?.key||e[30]!==s?(L=p(A=>(0,f.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,f.jsxDEV)("div",{className:"flex items-center justify-between px-2",children:[(0,f.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A.name||s("(root)")},void 0,!1),(0,f.jsxDEV)("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:A.operations.length},void 0,!1)]},void 0,!0),A.operations.map(_=>{let D=_.key===m?.key;return(0,f.jsxDEV)("button",{"aria-current":D?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:$,type:"button",children:[(0,f.jsxDEV)("span",{className:"truncate",children:_.summary},void 0,!1),(0,f.jsxDEV)(be,{kind:_.kind,method:_.method},void 0,!1)]},_.key,!0)})]},A.name,!0),"t142"),e[29]=m?.key,e[30]=s,e[31]=L):L=e[31],S=a.map(L),e[4]=i,e[5]=o.groups,e[6]=o.server,e[7]=m?.key,e[8]=s,e[9]=a,e[10]=u,e[11]=v,e[12]=S,e[13]=O,e[14]=h,e[15]=g,e[16]=x,e[17]=b,e[18]=y}else a=e[9],u=e[10],v=e[11],S=e[12],O=e[13],h=e[14],g=e[15],x=e[16],b=e[17],y=e[18];let N;e[32]!==a.length||e[33]!==s?(N=a.length===0&&(0,f.jsxDEV)("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")},void 0,!1),e[32]=a.length,e[33]=s,e[34]=N):N=e[34];let T;e[35]!==N||e[36]!==v||e[37]!==S?(T=(0,f.jsxDEV)("div",{className:v,children:[S,N]},void 0,!0),e[35]=N,e[36]=v,e[37]=S,e[38]=T):T=e[38];let k;e[39]!==T||e[40]!==O||e[41]!==h||e[42]!==g||e[43]!==x?(k=(0,f.jsxDEV)("nav",{"aria-label":O,className:h,"data-testid":g,children:[x,T]},void 0,!0),e[39]=T,e[40]=O,e[41]=h,e[42]=g,e[43]=x,e[44]=k):k=e[44];let w;e[45]!==m||e[46]!==u?(w=m===void 0?(0,f.jsxDEV)("div",{className:"lg:col-span-2"},void 0,!1):(0,f.jsxDEV)(Tt,{operation:m,children:[(0,f.jsxDEV)("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:(0,f.jsxDEV)(At,{operation:m},void 0,!1)},void 0,!1),(0,f.jsxDEV)("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[(0,f.jsxDEV)(kt,{operation:m,server:u},void 0,!1),(0,f.jsxDEV)(Ft,{},void 0,!1)]},void 0,!0)]},m.key,!0),e[45]=m,e[46]=u,e[47]=w):w=e[47];let C;return e[48]!==k||e[49]!==w||e[50]!==b||e[51]!==y?(C=(0,f.jsxDEV)("div",{className:b,"data-testid":y,children:[k,w]},void 0,!0),e[48]=k,e[49]=w,e[50]=b,e[51]=y,e[52]=C):C=e[52],C},"ReferenceView");var Y=q(ne(),1);var zt=["get","post","put","patch","delete","head","options","trace"],He=p(t=>t?.content?.["application/json"]?.schema,"jsonSchemaOf"),Ht=p((t,e)=>Object.entries(t.responses??{}).map(([o,s])=>{let n=s.$ref?.replace("#/components/responses/",""),r=n===void 0?s:e.components?.responses?.[n]??s;return{description:r.description,schema:He(r),status:o}}),"buildResponses"),Wt=p((t,e,o,s,n)=>{let r=He(s.requestBody),l=r?.properties?.functionPath?.const,i=typeof l=="string"?l:void 0,d=i===void 0?r:r?.properties?.args,c=s.operationId??`${o} ${e}`;return{argsSchema:d,description:s.description,functionPath:i,httpPath:e,key:t,kind:s["x-lunora-function-kind"],method:o.toUpperCase(),operationId:c,requestSchema:r,responses:Ht(s,n),summary:s.summary??c,tags:s.tags??[],title:s.summary??c}},"flattenOperation"),Gt=p(t=>{let e=[];for(let[o,s]of Object.entries(t.paths??{})){let n=o.includes("#")?o.slice(0,o.indexOf("#")):o;for(let r of zt){let l=s[r];l!==void 0&&e.push(Wt(o,n,r,l,t))}}return e},"collectOperations"),Ut=p(t=>{let e=t??{},o=Gt(e),s=new Map((e.tags??[]).map(i=>[i.name,i.description])),n=new Set,r=[],l=p(i=>{if(n.has(i))return;n.add(i);let d=o.filter(c=>(c.tags[0]??"")===i);d.length>0&&r.push({description:s.get(i),name:i,operations:d})},"pushGroup");for(let i of e.tags??[])l(i.name);for(let i of o)l(i.tags[0]??"");return{groups:r,operationByKey:new Map(o.map(i=>[i.key,i])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},"parseOpenApi"),Yt=p(t=>{let{paths:e}=t;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},"isEmptySpec"),Qt=p(t=>{let e=t;return Yt(e)?{kind:"empty"}:{kind:"ready",spec:e}},"classifySpec"),We=p(t=>{let e=(0,ze.c)(23),{spec:o}=t,s=M(),n=G(),r;e[0]!==n?(r=p(()=>n.fetchOpenApi(),"t1"),e[0]=n,e[1]=r):r=e[1];let i=ue(o,r,Qt),d;e[2]!==i.kind||e[3]!==i.spec?(d=i.kind==="ready"?Ut(i.spec):void 0,e[2]=i.kind,e[3]=i.spec,e[4]=d):d=e[4];let c=d;if(i.kind==="loading"){let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,Y.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[(0,Y.jsxDEV)(X,{className:"h-8 w-48"},void 0,!1),(0,Y.jsxDEV)(X,{className:"h-64 w-full"},void 0,!1)]},void 0,!0),e[5]=a):a=e[5],a}if(i.kind==="error"){let a;e[6]!==i.message||e[7]!==s?(a=s("Couldn't load the OpenAPI spec: {message}",{message:i.message}),e[6]=i.message,e[7]=s,e[8]=a):a=e[8];let u;e[9]!==s?(u=s("API reference unavailable"),e[9]=s,e[10]=u):u=e[10];let v;return e[11]!==a||e[12]!==u?(v=(0,Y.jsxDEV)(W,{description:a,testId:"api-reference-error",title:u},void 0,!1),e[11]=a,e[12]=u,e[13]=v):v=e[13],v}if(i.kind==="empty"||c===void 0){let a;e[14]!==s?(a=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=a):a=e[15];let u;e[16]!==s?(u=s("No OpenAPI spec configured"),e[16]=s,e[17]=u):u=e[17];let v;return e[18]!==a||e[19]!==u?(v=(0,Y.jsxDEV)(W,{description:a,testId:"api-reference-empty",title:u},void 0,!1),e[18]=a,e[19]=u,e[20]=v):v=e[20],v}let m;return e[21]!==c?(m=(0,Y.jsxDEV)(me,{model:c},void 0,!1),e[21]=c,e[22]=m):m=e[22],m},"ApiReferencePanel");var Ge=q(oe(),1);var Q=q(ne(),1);var Xt=p(t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],"argsParameterOf"),Zt=p(t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),"namespaceOf"),es=p(t=>{let e=Xt(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[Zt(t)],title:t.summary??t.name}},"toOperation"),ts=p(t=>{let e=t??{},o=(e.methods??[]).map(r=>es(r)),s=new Map;for(let r of o){let l=r.tags[0]??"",i=s.get(l)??[];i.push(r),s.set(l,i)}return{groups:[...s.entries()].map(([r,l])=>({name:r,operations:l.toSorted((i,d)=>i.operationId.localeCompare(d.operationId))})).toSorted((r,l)=>r.name.localeCompare(l.name)),operationByKey:new Map(o.map(r=>[r.key,r])),title:e.info?.title??"API reference",version:e.info?.version}},"parseOpenRpc"),ss=p(t=>t.methods===void 0||t.methods.length===0,"isEmptyDocument"),os=p(t=>{let e=t;return ss(e)?{kind:"empty"}:{kind:"ready",spec:e}},"classifyDocument"),Ue=p(t=>{let e=(0,Ge.c)(23),{spec:o}=t,s=M(),n=G(),r;e[0]!==n?(r=p(()=>n.fetchOpenRpc(),"t1"),e[0]=n,e[1]=r):r=e[1];let i=ue(o,r,os),d;e[2]!==i.kind||e[3]!==i.spec?(d=i.kind==="ready"?ts(i.spec):void 0,e[2]=i.kind,e[3]=i.spec,e[4]=d):d=e[4];let c=d;if(i.kind==="loading"){let a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,Q.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[(0,Q.jsxDEV)(X,{className:"h-8 w-48"},void 0,!1),(0,Q.jsxDEV)(X,{className:"h-64 w-full"},void 0,!1)]},void 0,!0),e[5]=a):a=e[5],a}if(i.kind==="error"){let a;e[6]!==i.message||e[7]!==s?(a=s("Couldn't load the OpenRPC spec: {message}",{message:i.message}),e[6]=i.message,e[7]=s,e[8]=a):a=e[8];let u;e[9]!==s?(u=s("API reference unavailable"),e[9]=s,e[10]=u):u=e[10];let v;return e[11]!==a||e[12]!==u?(v=(0,Q.jsxDEV)(W,{description:a,testId:"openrpc-reference-error",title:u},void 0,!1),e[11]=a,e[12]=u,e[13]=v):v=e[13],v}if(i.kind==="empty"||c===void 0){let a;e[14]!==s?(a=s("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=s,e[15]=a):a=e[15];let u;e[16]!==s?(u=s("No OpenRPC spec configured"),e[16]=s,e[17]=u):u=e[17];let v;return e[18]!==a||e[19]!==u?(v=(0,Q.jsxDEV)(W,{description:a,testId:"openrpc-reference-empty",title:u},void 0,!1),e[18]=a,e[19]=u,e[20]=v):v=e[20],v}let m;return e[21]!==c?(m=(0,Q.jsxDEV)(me,{model:c},void 0,!1),e[21]=c,e[22]=m):m=e[22],m},"OpenRpcReferencePanel");var z=q(ne(),1);var ns=["reference","snippets"],rs=["openapi","openrpc"],Gs=p(t=>{let e=(0,Ye.c)(51),{functions:o,initialShardKey:s,openApiSpec:n,openRpcSpec:r}=t,l=M(),[i,d]=(0,ye.useState)("reference"),[c,m]=(0,ye.useState)("openapi"),a;e[0]!==l?(a=l("Reference"),e[0]=l,e[1]=a):a=e[1];let u;e[2]!==l?(u=l("Snippets"),e[2]=l,e[3]=u):u=e[3];let v;e[4]!==a||e[5]!==u?(v={reference:a,snippets:u},e[4]=a,e[5]=u,e[6]=v):v=e[6];let S=v,O;e[7]!==l?(O=l("OpenAPI"),e[7]=l,e[8]=O):O=e[8];let h;e[9]!==l?(h=l("OpenRPC"),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==O||e[12]!==h?(g={openapi:O,openrpc:h},e[11]=O,e[12]=h,e[13]=g):g=e[13];let x=g,b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=p(A=>{d(A.currentTarget.dataset.view)},"t7"),e[14]=b):b=e[14];let y=b,N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=p(A=>{m(A.currentTarget.dataset.format)},"t8"),e[15]=N):N=e[15];let T=N,k;e[16]!==l?(k=l("API view"),e[16]=l,e[17]=k):k=e[17];let w;e[18]!==i||e[19]!==S?(w=ns.map(A=>(0,z.jsxDEV)(H,{"aria-selected":i===A,"data-testid":`api-view-${A}`,"data-view":A,onClick:y,role:"tab",size:"sm",type:"button",variant:i===A?"default":"outline",children:S[A]},A,!1)),e[18]=i,e[19]=S,e[20]=w):w=e[20];let C;e[21]!==w||e[22]!==k?(C=(0,z.jsxDEV)("div",{"aria-label":k,className:"flex gap-1.5","data-testid":"api-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=w,e[22]=k,e[23]=C):C=e[23];let I;e[24]!==c||e[25]!==x||e[26]!==l||e[27]!==i?(I=i==="reference"&&(0,z.jsxDEV)("div",{"aria-label":l("API spec format"),className:"flex gap-1.5","data-testid":"api-format-toggle",role:"tablist",children:rs.map(A=>(0,z.jsxDEV)(H,{"aria-selected":c===A,"data-format":A,"data-testid":`api-format-${A}`,onClick:T,role:"tab",size:"sm",type:"button",variant:c===A?"default":"outline",children:x[A]},A,!1))},void 0,!1),e[24]=c,e[25]=x,e[26]=l,e[27]=i,e[28]=I):I=e[28];let $;e[29]!==C||e[30]!==I?($=(0,z.jsxDEV)("div",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-6 py-3",children:[C,I]},void 0,!0),e[29]=C,e[30]=I,e[31]=$):$=e[31];let P;e[32]!==o||e[33]!==s||e[34]!==i?(P=i==="snippets"&&(0,z.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:(0,z.jsxDEV)(Le,{functions:o,initialShardKey:s},void 0,!1)},void 0,!1),e[32]=o,e[33]=s,e[34]=i,e[35]=P):P=e[35];let E;e[36]!==c||e[37]!==n||e[38]!==i?(E=i==="reference"&&c==="openapi"&&(0,z.jsxDEV)(We,{spec:n},void 0,!1),e[36]=c,e[37]=n,e[38]=i,e[39]=E):E=e[39];let j;e[40]!==c||e[41]!==r||e[42]!==i?(j=i==="reference"&&c==="openrpc"&&(0,z.jsxDEV)(Ue,{spec:r},void 0,!1),e[40]=c,e[41]=r,e[42]=i,e[43]=j):j=e[43];let R;e[44]!==P||e[45]!==E||e[46]!==j?(R=(0,z.jsxDEV)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[P,E,j]},void 0,!0),e[44]=P,e[45]=E,e[46]=j,e[47]=R):R=e[47];let L;return e[48]!==$||e[49]!==R?(L=(0,z.jsxDEV)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"lunora-api-tab",children:[$,R]},void 0,!0),e[48]=$,e[49]=R,e[50]=L):L=e[50],L},"ApiTab");export{Gs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-3CJW6NWG.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-EOSXQTSQ.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-M5OMEMQ3.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as V,e as X,f as Y,g as E,k as W}from"./chunk-2GMEK2W3.js";import"./chunk-J75M4LTW.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
1
|
+
import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-3CJW6NWG.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-HVRDZZHL.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"./chunk-
|
|
1
|
+
import{a as y}from"./chunk-HVRDZZHL.js";import{f as m}from"./chunk-LRYLU6EY.js";import{h as d,l as g}from"./chunk-ITQKVEP7.js";import{a as o,e as f,f as A,g as b}from"./chunk-RRCPZMC2.js";var p=f(b(),1);var c=f(A(),1);var h={capabilities:{accounts:!0,admin:!0,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},L=o(()=>{let e=(0,p.c)(6),t=m(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],e[0]=a):a=e[0];let s;e[1]!==t?(s=o(()=>t.getAuthConfig(),"t1"),e[1]=t,e[2]=s):s=e[2];let{data:u,isLoading:i}=y(a,s),r=u??h,l=!i,n;return e[3]!==r||e[4]!==l?(n={config:r,ready:l},e[3]=r,e[4]=l,e[5]=n):n=e[5],n},"useAuthConfig"),w=o(()=>{let[e,t]=(0,c.useState)(!1),[a,s]=(0,c.useState)(null);return{busy:e,error:a,run:o(i=>{g((async()=>{t(!0),s(null);try{await i()}catch(r){s(d(r))}finally{t(!1)}})())},"run")}},"useAsyncSubmit");export{L as a,w as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,c as v,d as g,f as D}from"./chunk-
|
|
1
|
+
import{b,c as v,d as g,f as D}from"./chunk-LRYLU6EY.js";import{f as y,g as p,h as P,l as O}from"./chunk-ITQKVEP7.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
|