@lunora/studio 1.0.0-alpha.54 → 1.0.0-alpha.56
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 +16 -6
- package/dist/index.js +7 -7
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +2 -2
- package/dist/packem_chunks/ExportImportPanel.js +2 -2
- package/dist/packem_chunks/FileBrowser.js +2 -2
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +2 -2
- package/dist/packem_chunks/HealthPanel.js +2 -2
- package/dist/packem_chunks/InsightsPanel.js +2 -2
- package/dist/packem_chunks/LogsPanel.js +7 -18
- package/dist/packem_chunks/MailPanel.js +1 -1
- package/dist/packem_chunks/MetricsPanel.js +391 -6
- package/dist/packem_chunks/MigrationsPanel.js +2 -2
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +2 -2
- package/dist/packem_chunks/SecurityAdvisorPanel.js +2 -2
- package/dist/packem_chunks/SettingsPanel.js +2 -2
- package/dist/packem_chunks/SqlEditorPanel.js +1 -1
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +2 -2
- 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 +1 -1
- package/dist/packem_chunks/containers-panel.js +2 -2
- package/dist/packem_chunks/dashboards-panel.js +2 -2
- package/dist/packem_chunks/fanout-panel.js +2 -2
- package/dist/packem_chunks/flags-panel.js +2 -2
- package/dist/packem_chunks/issues-panel.js +321 -82
- package/dist/packem_chunks/kv-browser.js +3 -3
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +1 -1
- package/dist/packem_chunks/payments-panel.js +2 -2
- package/dist/packem_chunks/permissions-panel.js +2 -2
- package/dist/packem_chunks/queues-panel.js +2 -2
- package/dist/packem_chunks/rls-panel.js +2 -2
- package/dist/packem_chunks/schedule-panel.js +2 -2
- package/dist/packem_chunks/storage-rules-panel.js +2 -2
- package/dist/packem_chunks/subscriptions-panel.js +2 -2
- package/dist/packem_chunks/traces-panel.js +734 -0
- package/dist/packem_chunks/users-panel.js +1 -1
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +2 -2
- package/dist/packem_shared/{ADMIN_FUNCTIONS-DNeyYtUN.js → ADMIN_FUNCTIONS-C1LXrovV.js} +6 -0
- package/dist/packem_shared/{ApiDocsPanel-_aEZxAMX.js → ApiDocsPanel-cYkYKjK3.js} +1 -1
- package/dist/packem_shared/{DataBrowser-C8hejnub.js → DataBrowser-CowupumK.js} +1 -1
- package/dist/packem_shared/{HomePanel-Ye8PaqQL.js → HomePanel-B12QgvIn.js} +3 -3
- package/dist/packem_shared/{ScheduledJobs-dHMgnJbx.js → ScheduledJobs-Cz5Tr-M6.js} +1 -1
- package/dist/packem_shared/{Studio-BNGjxLVo.js → Studio-DV1PhCIl.js} +2 -2
- package/dist/packem_shared/{StudioApp-K9dn1Q9d.js → StudioApp-BF2rK77z.js} +1 -1
- package/dist/packem_shared/{advisor-view-Cx21PS_T.js → advisor-view-1RaDWED7.js} +1 -1
- package/dist/packem_shared/{app.d-__J6S7he.d.ts → app.d-C-kxb-1T.d.ts} +1 -1
- package/dist/packem_shared/{card-DURq3ElK.js → card-F2vH_aj2.js} +1 -1
- package/dist/packem_shared/{home-panel-D62G8108.js → home-panel-DDo_fi19.js} +2 -2
- package/dist/packem_shared/log-fields-jEH83H2G.js +18 -0
- package/dist/packem_shared/{select-UkNYCT3s.js → select-D9OwHEch.js} +1 -1
- package/dist/packem_shared/{studio-Cd21fp4v.js → studio-CuNuEnSJ.js} +551 -524
- package/dist/standalone/{chunk-2MYDFHDZ.js → chunk-25CDYYNE.js} +1 -1
- package/dist/standalone/{chunk-6CNL7BUU.js → chunk-2DCA6LV7.js} +1 -1
- package/dist/standalone/{chunk-EOE5NDMK.js → chunk-2TJVFKD2.js} +1 -1
- package/dist/standalone/{chunk-3HKJ6FSC.js → chunk-2U3KE6IP.js} +1 -1
- package/dist/standalone/{chunk-JFT5OIL2.js → chunk-2XJ3WRKW.js} +1 -1
- package/dist/standalone/{chunk-6PXHT2QI.js → chunk-3BYY75EO.js} +1 -1
- package/dist/standalone/chunk-3HGNPZBN.js +1 -0
- package/dist/standalone/{chunk-PQKG5GKG.js → chunk-4A7VE2UO.js} +1 -1
- package/dist/standalone/{chunk-ASLE5VQE.js → chunk-5SXQWGTH.js} +1 -1
- package/dist/standalone/{chunk-JZ4X6QMK.js → chunk-6LQ3FXP2.js} +1 -1
- package/dist/standalone/{chunk-ZSUTV374.js → chunk-6RW37KKD.js} +1 -1
- package/dist/standalone/{chunk-SCH473C7.js → chunk-6ZGXWDSY.js} +1 -1
- package/dist/standalone/{chunk-NBLGUSJW.js → chunk-AL5UKM6M.js} +1 -1
- package/dist/standalone/{chunk-NP7AR65U.js → chunk-BZ5BHTVF.js} +1 -1
- package/dist/standalone/{chunk-TYMKCYYT.js → chunk-D54HL2MW.js} +1 -1
- package/dist/standalone/chunk-DBCP55V6.js +1 -0
- package/dist/standalone/chunk-DGWFJ3GW.js +1 -0
- package/dist/standalone/{chunk-LVDKJBWU.js → chunk-DOLG4V3A.js} +1 -1
- package/dist/standalone/{chunk-NWVHLLPB.js → chunk-E5Z2TAAR.js} +1 -1
- package/dist/standalone/{chunk-5AXARNJ2.js → chunk-EGANQQLW.js} +1 -1
- package/dist/standalone/{chunk-WM2MP5ZK.js → chunk-G4GGGHEV.js} +1 -1
- package/dist/standalone/{chunk-GRBWXZE4.js → chunk-HNIDN3RX.js} +1 -1
- package/dist/standalone/chunk-ILGPO3PK.js +3 -0
- package/dist/standalone/{chunk-K53QX72G.js → chunk-JWCCDDLY.js} +1 -1
- package/dist/standalone/{chunk-S5NTGHCG.js → chunk-JZLGLG4T.js} +1 -1
- package/dist/standalone/{chunk-H5X5TIWZ.js → chunk-LJ3KEIPO.js} +1 -1
- package/dist/standalone/{chunk-HFSJCS2N.js → chunk-LJE6PGHD.js} +1 -1
- package/dist/standalone/{chunk-IDAIBUKJ.js → chunk-LYAWJGSH.js} +1 -1
- package/dist/standalone/chunk-MHGJUKCZ.js +1 -0
- package/dist/standalone/chunk-N3V74RBP.js +1 -0
- package/dist/standalone/chunk-N7SVJOHN.js +1 -0
- package/dist/standalone/{chunk-NYK3PFSC.js → chunk-OBFYFJYZ.js} +1 -1
- package/dist/standalone/{chunk-4YHXOOK7.js → chunk-OEIBZ5AI.js} +1 -1
- package/dist/standalone/{chunk-ONCMJKJS.js → chunk-OOLK6C5I.js} +1 -1
- package/dist/standalone/{chunk-777XYTDZ.js → chunk-RCSULEDU.js} +1 -1
- package/dist/standalone/{chunk-RHYLU4OZ.js → chunk-RVVADT2N.js} +1 -1
- package/dist/standalone/{chunk-IDK76JPE.js → chunk-S7BCXJWD.js} +1 -1
- package/dist/standalone/{chunk-HI373BLB.js → chunk-SPACAIAR.js} +1 -1
- package/dist/standalone/{chunk-V7RQA6NY.js → chunk-ULOBAURC.js} +1 -1
- package/dist/standalone/{chunk-EXE42KMM.js → chunk-VC2VDAUO.js} +1 -1
- package/dist/standalone/{chunk-B6DIQBOK.js → chunk-VDOUWYIZ.js} +1 -1
- package/dist/standalone/chunk-VJABWVPW.js +1 -0
- package/dist/standalone/{chunk-SXATIQAK.js → chunk-WCLFE2ZB.js} +1 -1
- package/dist/standalone/{chunk-WCB3KG7C.js → chunk-WQC5IIF7.js} +1 -1
- package/dist/standalone/{chunk-WAVZATY2.js → chunk-XFINDIAB.js} +1 -1
- package/dist/standalone/{chunk-MN4QBJWN.js → chunk-XTOCLVRS.js} +1 -1
- package/dist/standalone/{chunk-BR7WLG6X.js → chunk-XZWFP2GI.js} +1 -1
- package/dist/standalone/{chunk-R2SUQVIO.js → chunk-YS7NUMAN.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-G7ZBM54M.js +0 -1
- package/dist/standalone/chunk-JGCZJNMT.js +0 -1
- package/dist/standalone/chunk-NEQV5EQC.js +0 -3
- package/dist/standalone/chunk-REQTQOBK.js +0 -1
- package/dist/standalone/chunk-W3XY7KL4.js +0 -1
- /package/dist/standalone/{chunk-SEU5V7I6.js → chunk-Y572GMZE.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Nt,b as Pr,c as At,d as Pe,e as mt,f as dt}from"./chunk-DWDILV2E.js";import{a as wr,b as Cr,c as Nr,d as Ar,e as Mr}from"./chunk-APSSZB6Z.js";import{a as Tr}from"./chunk-QAFAJBAW.js";import{A as Qo,B as er,C as tr,D as M,G as a,H as or,L as rr,Z as nr,a as Ho,ca as sr,d as jo,da as lr,ha as ir,ia as ar,ja as pt,k as Ht,la as ur,ma as fr,n as Xo,oa as mr,pa as dr,q as Ko,qa as gr,ra as Sr,ta as hr,ua as xr,va as Rr,wa as br,x as Jo,y as Zo}from"./chunk-SHERR7ZP.js";import{a as Yo,b as pr}from"./chunk-5OIBXYZM.js";import{a as qo,b as $o,c as cr}from"./chunk-L7SK4ZZD.js";import{a as yr,b as vr,i as Ir,j as Er,k as Ct}from"./chunk-4QHKBC77.js";import{C as ut,F as Wo,I as Le,K as $e,L as ft,M as io,N as Go,O as ge,P as xe,a as Ut,b as ct,c as Lo,e as Uo,f as ko,g as Ft,h as wt,i as Fo,p as Bt,y as Bo,z as zo}from"./chunk-VL23Y44O.js";import{b as jt}from"./chunk-UK64ZSUW.js";import{a as ee,c as de,e as kt}from"./chunk-O3NAGRTR.js";import{a as Et,c as Oo,d as _o,h as lo,i as Do,j as O}from"./chunk-CKSHCYGC.js";import{a as De}from"./chunk-3OA7PECS.js";import{a as r,d as mn,e as v,f as L,g as dn,h as gn,j as tt}from"./chunk-RRCPZMC2.js";var Ot=v(dn(),1),bc=v(L(),1);var me={};mn(me,{Arrow:()=>Co,Backdrop:()=>Ro,Group:()=>To,GroupLabel:()=>Mo,Icon:()=>mo,Item:()=>Io,ItemIndicator:()=>Eo,ItemText:()=>wo,Label:()=>uo,List:()=>vo,Popup:()=>yo,Portal:()=>xo,Positioner:()=>bo,Root:()=>Hr,ScrollDownArrow:()=>No,ScrollUpArrow:()=>Ao,Separator:()=>Tr,Trigger:()=>fo,Value:()=>po});var j=v(L(),1);var gt=v(L(),1);var zt=gt.createContext(null);zt.displayName="SelectRootContext";var Wt=gt.createContext(null);Wt.displayName="SelectFloatingContext";function U(){let e=gt.useContext(zt);if(e===null)throw new Error("Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.");return e}r(U,"useSelectRootContext");function Gt(){let e=gt.useContext(Wt);if(e===null)throw new Error("Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.");return e}r(Gt,"useSelectFloatingContext");var Vr=r((e,t)=>Object.is(e,t),"defaultItemEquality");function Ue(e,t,o){return e==null||t==null?Object.is(e,t):o(e,t)}r(Ue,"compareItemEquality");function Or(e,t,o){return!e||e.length===0?!1:e.some(n=>n===void 0?!1:Ue(t,n,o))}r(Or,"selectedValueIncludes");function ot(e,t,o){return!e||e.length===0?-1:e.findIndex(n=>n===void 0?!1:Ue(n,t,o))}r(ot,"findItemIndex");function _r(e,t,o){return e.filter(n=>!Ue(t,n,o))}r(_r,"removeItem");var Dr=v(L(),1);function Yt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}r(Yt,"serializeValue");var Lr=v(De(),1);function Ur(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}r(Ur,"isGroupedItems");function kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;let t=e;if(Ur(t)){for(let o of t)for(let n of o.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(let o of t)if(o&&o.value==null&&o.label!=null)return!0;return!1}r(kr,"hasNullItemLabel");function ao(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Yt(e)}r(ao,"stringifyAsLabel");function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Yt(e.value):Yt(e)}r(je,"stringifyAsValue");function co(e,t,o){function n(){return ao(e,o)}if(r(n,"fallback"),o&&e!=null)return o(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??n();if(Array.isArray(t)){let l=t,c=Ur(l)?l.flatMap(s=>s.items):l;if(e==null||typeof e!="object"){let s=c.find(m=>m.value===e);return s&&s.label!=null?s.label:n()}if("value"in e){let s=c.find(m=>m&&m.value===e.value);if(s&&s.label!=null)return s.label}}return n()}r(co,"resolveSelectedLabel");function Fr(e,t,o){return e.reduce((n,l,c)=>(c>0&&n.push(", "),n.push((0,Lr.jsx)(Dr.Fragment,{children:co(l,t,o)},c)),n),[])}r(Fr,"resolveMultipleLabels");var i={id:M(e=>e.id),labelId:M(e=>e.labelId),modal:M(e=>e.modal),multiple:M(e=>e.multiple),items:M(e=>e.items),itemToStringLabel:M(e=>e.itemToStringLabel),itemToStringValue:M(e=>e.itemToStringValue),isItemEqualToValue:M(e=>e.isItemEqualToValue),value:M(e=>e.value),hasSelectedValue:M(e=>{let{value:t,multiple:o,itemToStringValue:n}=e;return t==null?!1:o&&Array.isArray(t)?t.length>0:je(t,n)!==""}),hasNullItemLabel:M((e,t)=>t?kr(e.items):!1),open:M(e=>e.open),mounted:M(e=>e.mounted),forceMount:M(e=>e.forceMount),transitionStatus:M(e=>e.transitionStatus),openMethod:M(e=>e.openMethod),activeIndex:M(e=>e.activeIndex),selectedIndex:M(e=>e.selectedIndex),isActive:M((e,t)=>e.activeIndex===t),isSelected:M((e,t)=>{let o=e.isItemEqualToValue,n=e.value;return e.multiple?Array.isArray(n)&&n.some(l=>Ue(t,l,o)):Ue(t,n,o)}),isSelectedByFocus:M((e,t)=>e.selectedIndex===t),popupProps:M(e=>e.popupProps),triggerProps:M(e=>e.triggerProps),triggerElement:M(e=>e.triggerElement),positionerElement:M(e=>e.positionerElement),listElement:M(e=>e.listElement),popupSide:M(e=>e.popupSide),scrollUpArrowVisible:M(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:M(e=>e.scrollDownArrowVisible),hasScrollArrows:M(e=>e.hasScrollArrows)};function Br(e,t,o=(n,l)=>n===l){return e.length===t.length&&e.every((n,l)=>o(n,t[l]))}r(Br,"areArraysEqual");var St=v(De(),1);function Hr(e){let{id:t,value:o,defaultValue:n=null,onValueChange:l,open:c,defaultOpen:s=!1,onOpenChange:m,name:f,form:p,autoComplete:g,disabled:h=!1,readOnly:R=!1,required:I=!1,modal:C=!0,actionsRef:k,inputRef:x,onOpenChangeComplete:J,items:B,multiple:N=!1,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P=Vr,highlightItemOnHover:ae=!0,children:te}=e,{clearErrors:q}=Lo(),{setDirty:se,setTouched:Se,setFocused:Re,validityData:z,setFilled:$,name:_,disabled:ce,validation:A,validationMode:Z}=ct(),H=Ft({id:t}),V=ce||h,u=_??f,[S,le]=io({controlled:o,default:N?n??lo:n,name:"Select",state:"value"}),[F,be]=io({controlled:c,default:s,name:"Select",state:"open"}),he=j.useRef([]),d=j.useRef([]),w=j.useRef(null),ue=j.useRef(null),Ne=j.useRef(0),T=j.useRef(null),X=j.useRef([]),W=j.useRef(!1),ve=j.useRef(null),ie=j.useRef(null),fe=j.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=j.useRef(!1),{mounted:oe,setMounted:Ae,transitionStatus:Q}=ft(F),{openMethod:G,triggerProps:re}=ur(F),y=Oo(()=>new or({id:H,labelId:void 0,modal:C,multiple:N,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P,value:S,open:F,mounted:oe,transitionStatus:Q,items:B,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ze=a(y,i.activeIndex),Te=a(y,i.selectedIndex),Ve=a(y,i.triggerElement),ke=a(y,i.positionerElement),We=br(G),Ke=G??We??null,yt=j.useMemo(()=>N?"":je(S,D),[N,S,D]),Fe=j.useMemo(()=>N&&Array.isArray(S)?S.map(E=>je(E,D)):je(S,D),[N,S,D]),Je=Ht(y.state.triggerElement),ne=de(()=>Fe);Go(Je,H,S,ne,!V,f);let Be=j.useRef(S),He=N?Array.isArray(S)&&S.length>0:S!=null&&je(S,D)!=="";ee(()=>{S!==Be.current&&y.set("forceMount",!0)},[y,S]),ee(()=>{$(He)},[He,$]),ee(r(function(){let Y=X.current,Ie;if(N){let ye=Array.isArray(S)?S:[];if(ye.length===0)Ie=null;else{let qe=ye[ye.length-1],et=ot(Y,qe,P);Ie=et===-1?null:et}}else{let ye=ot(Y,S,P);Ie=ye===-1?null:ye}Ie===null&&(ie.current=null),!F&&y.set("selectedIndex",Ie)},"syncSelectedIndex"),[He,N,F,S,X,P,y,ie]);function Oe(E){let Y=z.initialValue;return Array.isArray(E)&&Array.isArray(Y)?!Br(E,Y,(Ie,ye)=>Ue(Ie,ye,P)):E!==Y}r(Oe,"isSelectedValueDirty"),cr(S,()=>{q(u),se(Oe(S)),A.change(S)});let nt=de((E,Y)=>{m?.(E,Y),!Y.isCanceled&&(be(E),!E&&(Y.reason===ge.focusOut||Y.reason===ge.outsidePress)&&(Se(!0),Re(!1),Z==="onBlur"&&A.commit(S)))}),st=de(()=>{Ae(!1),y.update({activeIndex:null,openMethod:null}),J?.(!1)});$e({enabled:!k,open:F,ref:w,onComplete(){F||st()}}),j.useImperativeHandle(k,()=>({unmount:st}),[st]);let Ge=de((E,Y)=>{l?.(E,Y),!Y.isCanceled&&le(E)}),_e=de(()=>{let E=y.state.listElement||w.current;if(!E)return;let Y=mt(E.scrollHeight,E.clientHeight),Ie=dt(E.scrollTop,Y),ye=Ie>0,qe=Ie<Y;y.state.scrollUpArrowVisible!==ye&&y.set("scrollUpArrowVisible",ye),y.state.scrollDownArrowVisible!==qe&&y.set("scrollDownArrowVisible",qe)}),Ze=nr({open:F,onOpenChange:nt,elements:{reference:Ve,floating:ke}}),lt=Zo(Ze,{enabled:!R&&!V,event:"mousedown"}),it=Qo(Ze),Ye=sr(Ze,{enabled:!R&&!V,listRef:he,activeIndex:ze,selectedIndex:Te,disabledIndices:lo,onNavigate(E){E===null&&!F||y.set("activeIndex",E)},focusItemOnHover:ae}),Qe=lr(Ze,{enabled:!R&&!V&&(F||!N),listRef:d,activeIndex:ze,selectedIndex:Te,disabledIndices:r(E=>Mr(he.current[E]),"disabledIndices"),onMatch(E){F?y.set("activeIndex",E):Ge(X.current[E],xe("none"))},onTyping(E){W.current=E}}),vt=j.useMemo(()=>{let E=Et(Qe.reference,Ye.reference,it.reference,lt.reference,re);return H&&(E.id=H),E},[lt.reference,Qe.reference,Ye.reference,it.reference,re,H]),It=j.useMemo(()=>Et(rr,Qe.floating,Ye.floating,it.floating),[Qe.floating,Ye.floating,it.floating]),_t=Ye.item??Do;tr(()=>{y.update({popupProps:It,triggerProps:vt})}),ee(()=>{y.update({id:H,modal:C,multiple:N,value:S,open:F,mounted:oe,transitionStatus:Q,popupProps:It,triggerProps:vt,items:B,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P,openMethod:Ke})},[y,H,C,N,S,F,oe,Q,It,vt,B,b,D,P,Ke]);let Me=j.useMemo(()=>({store:y,name:u,required:I,disabled:V,readOnly:R,multiple:N,highlightItemOnHover:ae,setValue:Ge,setOpen:nt,listRef:he,popupRef:w,scrollHandlerRef:ue,handleScrollArrowVisibility:_e,scrollArrowsMountedCountRef:Ne,itemProps:_t,valueRef:T,valuesRef:X,labelsRef:d,typingRef:W,selectionRef:fe,firstItemTextRef:ve,selectedItemTextRef:ie,validation:A,onOpenChangeComplete:J,alignItemWithTriggerActiveRef:pe,initialValueRef:Be}),[y,u,I,V,R,N,ae,Ge,nt,_t,A,J,_e]),at=_o(x,A.inputRef),Dt=N&&Array.isArray(S)&&S.length>0,Lt=N?void 0:u,no=j.useMemo(()=>!N||!Array.isArray(S)||!u?null:S.map(E=>{let Y=je(E,D);return(0,St.jsx)("input",{type:"hidden",form:p,name:u,value:Y,disabled:V},Y)}),[N,S,p,u,D,V]);return(0,St.jsx)(zt.Provider,{value:Me,children:(0,St.jsxs)(Wt.Provider,{value:Ze,children:[te,(0,St.jsx)("input",{...A.getValidationProps(V,{onFocus(){y.state.triggerElement?.focus({focusVisible:!0})},onChange(E){if(E.nativeEvent.defaultPrevented||V||R)return;let Y=E.currentTarget.value,Ie=xe(ge.none,E.nativeEvent);function ye(){if(N)return;let qe=Y.toLowerCase(),et=X.current.findIndex(so=>je(so,D).toLowerCase()===qe||ao(so,b).toLowerCase()===qe);et===-1&&(et=X.current.findIndex((so,pn)=>{let Vo=d.current[pn];return Vo!=null&&Vo.toLowerCase()===qe}));let Po=et===-1?void 0:X.current[et];Po!=null&&Ge(Po,Ie)}r(ye,"handleChange"),y.set("forceMount",!0),queueMicrotask(ye)}}),id:H&&Lt==null?`${H}-hidden-input`:void 0,form:p,name:Lt,autoComplete:g,value:yt,disabled:V,required:I&&!Dt,readOnly:R,ref:at,style:u?$o:qo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),no]})})}r(Hr,"SelectRoot");var Wr=v(L(),1);function jr(e){return e==null?void 0:`${e}-label`}r(jr,"getDefaultLabelId");function zr(e,t){return e??t}r(zr,"resolveAriaLabelledBy");var uo=Wr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,m=s;delete m.id;let f=ct(),{store:p}=U(),g=a(p,i.triggerElement),h=a(p,i.id),R=jr(h),I=zo({id:R,fallbackControlId:g?.id??h,setLabelId(C){p.set("labelId",C)}});return O("div",t,{ref:o,state:f.state,props:[I,s],stateAttributesMapping:Ut})},"SelectLabel"));uo.displayName="SelectLabel";var ht=v(L(),1);var qt=2,Sn=400,hn={...ar,...Ut,popupSide:r(e=>e?{"data-popup-side":e}:null,"popupSide"),value:r(()=>null,"value")},fo=ht.forwardRef(r(function(t,o){let{render:n,className:l,id:c,disabled:s=!1,nativeButton:m=!0,style:f,...p}=t,{setTouched:g,setFocused:h,validationMode:R,state:I,disabled:C}=ct(),{labelId:k}=ko(),{store:x,setOpen:J,selectionRef:B,validation:N,readOnly:b,required:D,alignItemWithTriggerActiveRef:P,disabled:ae}=U(),te=C||ae||s,q=a(x,i.open),se=a(x,i.mounted),Se=a(x,i.value),Re=a(x,i.triggerProps),z=a(x,i.positionerElement),$=a(x,i.listElement),_=a(x,i.popupSide),ce=a(x,i.id),A=a(x,i.labelId),Z=a(x,i.hasSelectedValue),H=se&&z?_:null,V=c??ce,u=zr(k,A);Ft({id:V});let S=Ht(z),le=ht.useRef(null),{getButtonProps:F,buttonRef:be}=jt({disabled:te,native:m}),he=de(W=>{x.set("triggerElement",W)}),d=ut(),w=ut(),ue=ut();ht.useEffect(()=>{if(q)return ue.start(Sn,()=>{B.current.allowUnselectedMouseUp=!0,B.current.allowSelectedMouseUp=!0}),()=>{ue.clear()};B.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},w.clear()},[q,B,w,ue]);let Ne=Et(Re,{id:V,role:"combobox","aria-expanded":q?"true":"false","aria-haspopup":"listbox","aria-controls":q?$?.id??Bo(z)?.id:void 0,"aria-labelledby":u,"aria-readonly":b||void 0,"aria-required":D||void 0,tabIndex:te?-1:0,onFocus(W){h(!0),q&&P.current&&J(!1,xe(ge.none,W.nativeEvent)),d.start(0,()=>{x.set("forceMount",!0)})},onBlur(W){Bt(z,W.relatedTarget)||(g(!0),h(!1),R==="onBlur"&&N.commit(Se))},onMouseDown(W){if(q)return;let ve=wt(W.currentTarget);function ie(fe){if(!le.current)return;let pe=fe.target;if(Bt(le.current,pe)||Bt(S.current,pe))return;let oe=Ar(le.current);fe.clientX>=oe.left-qt&&fe.clientX<=oe.right+qt&&fe.clientY>=oe.top-qt&&fe.clientY<=oe.bottom+qt||J(!1,xe(ge.cancelOpen,fe))}r(ie,"handleMouseUp"),w.start(0,()=>{ve.addEventListener("mouseup",ie,{once:!0})})}},p,F),T=N.getValidationProps(te,Ne);T.role="combobox";let X={...I,open:q,disabled:te,value:Se,readOnly:b,popupSide:H,placeholder:!Z};return O("button",t,{ref:[o,le,be,he],state:X,stateAttributesMapping:hn,props:T})},"SelectTrigger"));fo.displayName="SelectTrigger";var Gr=v(L(),1);var xn={value:r(()=>null,"value")},po=Gr.forwardRef(r(function(t,o){let{className:n,render:l,children:c,placeholder:s,style:m,...f}=t,{store:p,valueRef:g}=U(),h=a(p,i.value),R=a(p,i.items),I=a(p,i.itemToStringLabel),C=a(p,i.hasSelectedValue),k=!C&&s!=null&&c==null,x=a(p,i.hasNullItemLabel,k),J={value:h,placeholder:!C},B=null;return typeof c=="function"?B=c(h):c!=null?B=c:!C&&s!=null&&!x?B=s:Array.isArray(h)?B=Fr(h,R,I):B=co(h,R,I),O("span",t,{state:J,ref:[o,g],props:[{children:B},f],stateAttributesMapping:xn})},"SelectValue"));po.displayName="SelectValue";var Yr=v(L(),1);var mo=Yr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),p={open:a(m,i.open)};return O("span",t,{state:p,ref:o,props:[{"aria-hidden":!0,children:"\u25BC"},s],stateAttributesMapping:ir})},"SelectIcon"));mo.displayName="SelectIcon";var qr=v(L(),1);var go=v(L(),1);var So=go.createContext(void 0);So.displayName="SelectPortalContext";var ho=v(De(),1);var xo=qr.forwardRef(r(function(t,o){let{store:n}=U(),l=a(n,i.mounted),c=a(n,i.forceMount);return l||c?(0,ho.jsx)(So.Provider,{value:!0,children:(0,ho.jsx)(Ko,{ref:o,...t})}):null},"SelectPortal"));xo.displayName="SelectPortal";var $r=v(L(),1);var Rn={...pt,...Le},Ro=$r.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),f=a(m,i.open),p=a(m,i.mounted),g=a(m,i.transitionStatus);return O("div",t,{state:{open:f,transitionStatus:g},ref:o,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},s],stateAttributesMapping:Rn})},"SelectBackdrop"));Ro.displayName="SelectBackdrop";var Ee=v(L(),1);var $t=v(L(),1);var Xt=$t.createContext(void 0);Xt.displayName="SelectPositionerContext";function Xe(){let e=$t.useContext(Xt);if(!e)throw new Error("Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.");return e}r(Xe,"useSelectPositionerContext");function xt(e,t){e&&Object.assign(e.style,t)}r(xt,"clearStyles");var Kt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};var Tt=v(De(),1);var bn={position:"fixed"},bo=Ee.forwardRef(r(function(t,o){let{anchor:n,positionMethod:l="absolute",className:c,render:s,side:m="bottom",align:f="center",sideOffset:p=0,alignOffset:g=0,collisionBoundary:h="clipping-ancestors",collisionPadding:R,arrowPadding:I=5,sticky:C=!1,disableAnchorTracking:k,alignItemWithTrigger:x=!0,collisionAvoidance:J=Xo,style:B,...N}=t,{store:b,listRef:D,labelsRef:P,alignItemWithTriggerActiveRef:ae,selectedItemTextRef:te,valuesRef:q,initialValueRef:se,popupRef:Se,setValue:Re}=U(),z=Gt(),$=a(b,i.open),_=a(b,i.mounted),ce=a(b,i.modal),A=a(b,i.value),Z=a(b,i.openMethod),H=a(b,i.positionerElement),V=a(b,i.triggerElement),u=a(b,i.isItemEqualToValue),S=a(b,i.transitionStatus),le=Ee.useRef(null),F=Ee.useRef(null),[be,he]=Ee.useState(x),d=_&&be&&Z!=="touch";!_&&be!==x&&he(x),ee(()=>{_||(i.scrollUpArrowVisible(b.state)&&b.set("scrollUpArrowVisible",!1),i.scrollDownArrowVisible(b.state)&&b.set("scrollDownArrowVisible",!1))},[b,_]),Ee.useImperativeHandle(ae,()=>d),hr((d||ce)&&$,Z==="touch",H,V);let w=mr({anchor:n,floatingRootContext:z,positionMethod:l,mounted:_,side:m,sideOffset:p,align:f,alignOffset:g,arrowPadding:I,collisionBoundary:h,collisionPadding:R,sticky:C,disableAnchorTracking:k??d,collisionAvoidance:J,keepMounted:!0}),ue=d?"none":w.side,Ne=d?bn:w.positionerStyles,T={open:$,side:ue,align:w.align,anchorHidden:w.anchorHidden};ee(()=>{b.set("popupSide",w.side)},[b,w.side]);let X=de(pe=>{b.set("positionerElement",pe)}),W=Sr(t,T,{styles:Ne,transitionStatus:S,props:N,refs:[o,X],hidden:!_,inert:!$}),ve=Ee.useRef(0),ie=de(pe=>{if(pe.size===0&&ve.current===0||q.current.length===0)return;let oe=ve.current;if(ve.current=pe.size,pe.size===oe)return;let Ae=xe(ge.none);if(oe!==0&&!b.state.multiple&&A!==null&&ot(q.current,A,u)===-1){let G=se.current,y=G!=null&&ot(q.current,G,u)!==-1?G:null;Re(y,Ae),y===null&&(b.set("selectedIndex",null),te.current=null)}if(oe!==0&&b.state.multiple&&Array.isArray(A)){let Q=r(re=>ot(q.current,re,u)!==-1,"hasVisibleItem"),G=A.filter(re=>Q(re));(G.length!==A.length||G.some(re=>!Or(A,re,u)))&&(Re(G,Ae),G.length===0&&(b.set("selectedIndex",null),te.current=null))}if($&&d){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let Q={height:""};xt(H,Q),xt(Se.current,Q)}}),fe=Ee.useMemo(()=>({...w,side:ue,alignItemWithTriggerActive:d,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:le,scrollDownArrowRef:F}),[w,ue,d,he]);return(0,Tt.jsx)(Nr,{elementsRef:D,labelsRef:P,onMapChange:ie,children:(0,Tt.jsxs)(Xt.Provider,{value:fe,children:[_&&ce&&(0,Tt.jsx)(dr,{inert:fr(!$),cutout:V}),W]})})},"SelectPositioner"));bo.displayName="SelectPositioner";var we=v(L(),1);var Qt=v(De(),1);var yn={...pt,...Le},yo=we.forwardRef(r(function(t,o){let{render:n,className:l,style:c,finalFocus:s,...m}=t,{store:f,popupRef:p,onOpenChangeComplete:g,setOpen:h,valueRef:R,firstItemTextRef:I,selectedItemTextRef:C,multiple:k,handleScrollArrowVisibility:x,scrollHandlerRef:J,listRef:B,highlightItemOnHover:N}=U(),{side:b,align:D,alignItemWithTriggerActive:P,isPositioned:ae,setControlledAlignItemWithTrigger:te}=Xe(),q=Rr(!0)!=null,se=Gt(),Se=pr(),{nonce:Re,disableStyleElements:z}=Pr(),$=a(f,i.id),_=a(f,i.open),ce=a(f,i.openMethod),A=a(f,i.mounted),Z=a(f,i.popupProps),H=a(f,i.transitionStatus),V=a(f,i.triggerElement),u=a(f,i.positionerElement),S=a(f,i.listElement),le=we.useRef(!1),F=we.useRef(!1),be=we.useRef({}),he=Wo(),d=de(T=>{if(!u||!p.current||!F.current)return;if(le.current||!P){x();return}let X=u.style.top==="0px",W=u.style.bottom==="0px";if(!X&&!W){x();return}let ve=Kr(u),ie=Mt(u.getBoundingClientRect().height,"y",ve),fe=wt(u),pe=kt(u),oe=pe.getComputedStyle(u),Ae=parseFloat(oe.marginTop),Q=parseFloat(oe.marginBottom),G=Xr(pe.getComputedStyle(p.current)),re=Math.min(fe.documentElement.clientHeight-Ae-Q,G),y=T.scrollTop,ze=Jt(T),Te=0,Ve=null,ke=!1,We=!1,Ke=r(ne=>{u.style.height=`${ne}px`},"setHeight"),yt=r((ne,Be)=>{let He=At(ne,0,re-ie);He>0&&Ke(ie+He),T.scrollTop=Be,re-(ie+He)<=Pe&&(le.current=!0),x()},"handleSmallDiff"),Fe=X?ze-y:y,Je=Math.min(ie+Fe,re);if(Te=Je,Fe<=Pe){yt(Fe,X?ze:0);return}if(re-Je>Pe)X?We=!0:Ve=0;else if(ke=!0,W&&y<ze){let ne=ie+Fe-re;Ve=y-(Fe-ne)}if(Te=Math.ceil(Te),Te!==0&&Ke(Te),We||Ve!=null){let ne=Jt(T),Be=We?ne:At(Ve,0,ne);Math.abs(T.scrollTop-Be)>Pe&&(T.scrollTop=Be)}(ke||Te>=re-Pe)&&(le.current=!0),x()});we.useImperativeHandle(J,()=>d,[d]),$e({open:_,ref:p,onComplete(){_&&g?.(!0)}});let w={open:_,transitionStatus:H,side:b,align:D};ee(()=>{!u||!p.current||Object.keys(be.current).length||(be.current={top:u.style.top||"0",left:u.style.left||"0",right:u.style.right,height:u.style.height,bottom:u.style.bottom,minHeight:u.style.minHeight,maxHeight:u.style.maxHeight,marginTop:u.style.marginTop,marginBottom:u.style.marginBottom})},[p,u]),ee(()=>{_||P||(F.current=!1,le.current=!1,xt(u,be.current))},[_,P,u,p]),ee(()=>{let T=p.current;if(!_||!V||!u||!T||P&&!ae||f.state.transitionStatus==="ending")return;if(!P){F.current=!0,he.request(x),T.style.removeProperty("--transform-origin");return}let X=vn(T);T.style.removeProperty("--transform-origin");try{let W=C.current;W?.isConnected||(W=!i.hasSelectedValue(f.state)&&I.current?.isConnected?I.current:null);let ve=R.current,ie=kt(u),fe=ie.getComputedStyle(u),pe=ie.getComputedStyle(T),oe=wt(V),Ae=Kr(V),Q=Zt(V.getBoundingClientRect(),Ae),G=Zt(u.getBoundingClientRect(),Ae),re=Q.height,y=S||T,ze=y.scrollHeight,Te=parseFloat(pe.borderBottomWidth),Ve=parseFloat(fe.marginTop)||10,ke=parseFloat(fe.marginBottom)||10,We=parseFloat(fe.minHeight)||100,Ke=Xr(pe),yt=5,Fe=5,Je=20,ne=oe.documentElement.clientHeight-Ve-ke,Be=oe.documentElement.clientWidth,He=ne-Q.bottom+re,Oe,nt=Se==="rtl"?Q.right-G.width:Q.left,st=0;if(W&&ve){let Me=Zt(ve.getBoundingClientRect(),Ae);Oe=Zt(W.getBoundingClientRect(),Ae),nt=G.left+(Se==="rtl"?Me.right-Oe.right:Me.left-Oe.left);let at=Me.top-Q.top+Me.height/2;st=Oe.top-G.top+Oe.height/2-at}let Ge=He+st+ke+Te,_e=Math.min(ne,Ge),Ze=ne-Ve-ke,lt=Ge-_e,it=Be-Fe;u.style.left=`${At(nt,yt,it-G.width)}px`,u.style.height=`${_e}px`,u.style.maxHeight="none",u.style.marginTop=`${Ve}px`,u.style.marginBottom=`${ke}px`,T.style.height="100%";let Ye=Jt(y),Qe=lt>=Ye-Pe;Qe&&(_e=Math.min(ne,G.height)-(lt-Ye));let vt=Q.top<Je||Q.bottom>ne-Je||Math.ceil(_e)+Pe<Math.min(ze,We),It=(ie.visualViewport?.scale??1)!==1&&Fo.engine.webkit;if(vt||It){F.current=!0,xt(u,be.current),te(!1);return}let _t=Math.max(We,_e);if(Qe){let Me=Math.max(0,ne-Ge);u.style.top=G.height>=Ze?"0":`${Me}px`,u.style.height=`${_e}px`,y.scrollTop=Jt(y)}else u.style.bottom="0",y.scrollTop=lt;if(Oe){let Me=G.top,at=G.height,Dt=Oe.top+Oe.height/2,Lt=at>0?(Dt-Me)/at*100:50,no=At(Lt,0,100);T.style.setProperty("--transform-origin",`50% ${no}%`)}(_t===ne||_e>=Ke)&&(le.current=!0),x(),N&&f.state.selectedIndex===null&&f.state.activeIndex===null&&B.current[0]!=null&&f.set("activeIndex",0),F.current=!0}finally{X()}},[f,_,u,V,R,I,C,p,x,P,te,he,S,B,N,Se,ae]),we.useEffect(()=>{if(!P||!u||!_)return;let T=kt(u);function X(W){h(!1,xe(ge.windowResize,W))}return r(X,"handleResize"),Yo(T,"resize",X)},[h,P,u,_]);let ue={...S?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":k||void 0,id:`${$}-list`},onKeyDown(T){q&&xr.has(T.key)&&T.stopPropagation()},onScroll(T){S||d(T.currentTarget)},...P&&{style:S?{height:"100%"}:Kt}},Ne=O("div",t,{ref:[o,p],state:w,stateAttributesMapping:yn,props:[Z,ue,gr(H),{className:!S&&P?Nt.className:void 0},m]});return(0,Qt.jsxs)(we.Fragment,{children:[!z&&Nt.getElement(Re),(0,Qt.jsx)(Jo,{context:se,modal:!1,disabled:!A,openInteractionType:ce,returnFocus:s,restoreFocus:!0,children:Ne})]})},"SelectPopup"));yo.displayName="SelectPopup";function Xr(e){let t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}r(Xr,"getMaxPopupHeight");function Jt(e){return mt(e.scrollHeight,e.clientHeight)}r(Jt,"getMaxScrollTop");function Kr(e){return er.getScale(e)}r(Kr,"getScale");function Mt(e,t,o){return e/o[t]}r(Mt,"normalizeSize");function Zt(e,t){return jo({x:Mt(e.x,"x",t),y:Mt(e.y,"y",t),width:Mt(e.width,"x",t),height:Mt(e.height,"y",t)})}r(Zt,"normalizeRect");var Jr=[["transform","none"],["scale","1"],["translate","0 0"]];function vn(e){let{style:t}=e,o={};for(let[n,l]of Jr)o[n]=t.getPropertyValue(n),t.setProperty(n,l,"important");return()=>{for(let[n]of Jr){let l=o[n];l?t.setProperty(n,l):t.removeProperty(n)}}}r(vn,"unsetTransformStyles");var Zr=v(L(),1);var vo=Zr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m,scrollHandlerRef:f}=U(),{alignItemWithTriggerActive:p}=Xe(),g=a(m,i.hasScrollArrows),h=a(m,i.openMethod),R=a(m,i.multiple),C={id:`${a(m,i.id)}-list`,role:"listbox","aria-multiselectable":R||void 0,onScroll(x){f.current?.(x.currentTarget)},...p&&{style:Kt},className:g&&h!=="touch"?Nt.className:void 0},k=de(x=>{m.set("listElement",x)});return O("div",t,{ref:[o,k],props:[C,s]})},"SelectList"));vo.displayName="SelectList";var Ce=v(L(),1);var eo=v(L(),1);var to=eo.createContext(void 0);to.displayName="SelectItemContext";function Pt(){let e=eo.useContext(to);if(!e)throw new Error("Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.");return e}r(Pt,"useSelectItemContext");var Qr=v(De(),1);var Io=Ce.memo(Ce.forwardRef(r(function(t,o){let{render:n,className:l,style:c,value:s=null,label:m,disabled:f=!1,nativeButton:p=!1,...g}=t,h=Ce.useRef(null),R=Cr({label:m,textRef:h,indexGuessBehavior:wr.GuessFromOrder}),{store:I,itemProps:C,setOpen:k,setValue:x,selectionRef:J,typingRef:B,valuesRef:N,multiple:b,selectedItemTextRef:D,disabled:P,readOnly:ae}=U(),te=a(I,i.isActive,R.index),q=a(I,i.open),se=a(I,i.isSelected,s),Se=a(I,i.isSelectedByFocus,R.index),Re=a(I,i.isItemEqualToValue),z=R.index,$=z!==-1,_=Ce.useRef(null);ee(()=>{if(!$)return;let d=N.current;return d[z]=s,()=>{delete d[z]}},[$,z,s,N]),ee(()=>{if(!$)return;let d=I.state.value,w=d;b&&Array.isArray(d)&&(w=d.length>0?d[d.length-1]:void 0),w!==void 0&&Ue(s,w,Re)&&(I.set("selectedIndex",z),h.current&&(D.current=h.current))},[$,z,b,Re,I,s,D]);let ce=Ce.useRef(null),A=Ce.useRef("mouse"),Z=Ce.useRef(!1),{getButtonProps:H,buttonRef:V}=jt({disabled:f,focusableWhenDisabled:!0,native:p,composite:!0}),u={disabled:f,selected:se,highlighted:te};function S(d){if(P||ae)return;let w=I.state.value;if(b){let ue=Array.isArray(w)?w:[],Ne=se?_r(ue,s,Re):[...ue,s];x(Ne,xe(ge.itemPress,d))}else x(s,xe(ge.itemPress,d)),k(!1,xe(ge.itemPress,d))}r(S,"commitSelection");function le(){J.current.dragY=0}r(le,"resetDragMovement");let F={role:"option","aria-selected":se,tabIndex:q&&te?0:-1,onKeyDown(d){ce.current=d.key,I.set("activeIndex",z),d.key===" "&&B.current&&d.preventDefault()},onClick(d){let w=d.type==="click"&&A.current!=="touch",ue=d.nativeEvent.pointerType,Ne=w&&Ho(d.nativeEvent)&&(ue!==void 0||te),T=w&&!Ne&&!Z.current;Z.current=!1,!(d.type==="keydown"&&ce.current===null)&&(f||d.type==="keydown"&&ce.current===" "&&B.current||T||(ce.current=null,S(d.nativeEvent)))},onPointerEnter(d){A.current=d.pointerType},onPointerMove(d){if(d.pointerType==="mouse"&&d.buttons===1){let w=J.current;w.dragY+=d.movementY,w.dragY**2>=64&&(w.allowUnselectedMouseUp=!0)}},onPointerDown(d){A.current=d.pointerType,Z.current=!0,le()},onMouseUp(){if(le(),f||A.current==="touch"||Z.current)return;let d=!J.current.allowSelectedMouseUp&&se,w=!J.current.allowUnselectedMouseUp&&!se;d||w||(Z.current=!0,_.current?.click(),Z.current=!1)}},be=O("div",t,{ref:[V,o,R.ref,_],state:u,props:[C,F,g,H]}),he=Ce.useMemo(()=>({selected:se,index:z,textRef:h,selectedByFocus:Se,hasRegistered:$}),[se,z,h,Se,$]);return(0,Qr.jsx)(to.Provider,{value:he,children:be})},"SelectItem")));Io.displayName="SelectItem";var rt=v(L(),1);var en=v(De(),1);var Eo=rt.forwardRef(r(function(t,o){let n=t.keepMounted??!1,{selected:l}=Pt();return n||l?(0,en.jsx)(tn,{...t,ref:o}):null},"SelectItemIndicator"));Eo.displayName="SelectItemIndicator";var tn=rt.memo(rt.forwardRef((e,t)=>{let{render:o,className:n,style:l,keepMounted:c,...s}=e,{selected:m}=Pt(),f=rt.useRef(null),{transitionStatus:p,setMounted:g}=ft(m),R=O("span",e,{ref:[t,f],state:{selected:m,transitionStatus:p},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},s],stateAttributesMapping:Le});return $e({open:m,ref:f,onComplete(){m||g(!1)}}),R}));tn.displayName="Inner";var Rt=v(L(),1);var wo=Rt.memo(Rt.forwardRef(r(function(t,o){let{index:n,textRef:l,selectedByFocus:c,hasRegistered:s}=Pt(),{firstItemTextRef:m,selectedItemTextRef:f}=U(),{render:p,className:g,style:h,...R}=t,I=Rt.useCallback(k=>{k&&(s&&n===0&&(m.current=k),s&&c&&(f.current=k))},[m,f,n,c,s]);return O("div",t,{ref:[I,o,l],props:R})},"SelectItemText")));wo.displayName="SelectItemText";var on=v(L(),1);var In={...pt,...Le},Co=on.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),{side:f,align:p,arrowRef:g,arrowStyles:h,arrowUncentered:R,alignItemWithTriggerActive:I}=Xe(),k={open:a(m,i.open),side:f,align:p,uncentered:R},x=O("div",t,{state:k,ref:[g,o],props:[{style:h,"aria-hidden":!0},s],stateAttributesMapping:In});return I?null:x},"SelectArrow"));Co.displayName="SelectArrow";var nn=v(L(),1);var rn=v(L(),1);var Vt=rn.forwardRef(r(function(t,o){let{render:n,className:l,style:c,direction:s,keepMounted:m=!1,...f}=t,p=s==="up",{store:g,popupRef:h,listRef:R,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=U(),{side:k,scrollDownArrowRef:x,scrollUpArrowRef:J}=Xe(),B=p?i.scrollUpArrowVisible:i.scrollDownArrowVisible,N=a(g,B),b=a(g,i.openMethod),D=N&&b!=="touch",P=ut(),ae=p?J:x,{mounted:te,transitionStatus:q,setMounted:se}=ft(D);ee(()=>(C.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,C]),$e({open:D,ref:ae,onComplete(){D||se(!1)}});let z=O("div",t,{ref:[o,ae],state:{direction:s,visible:D,side:k,transitionStatus:q},props:[{"aria-hidden":!0,children:p?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(_){if(_.movementX===0&&_.movementY===0||P.isStarted())return;g.set("activeIndex",null);function ce(){let A=g.state.listElement??h.current;if(!A)return;g.set("activeIndex",null),I();let Z=mt(A.scrollHeight,A.clientHeight),H=dt(A.scrollTop,Z),V=H===(p?0:Z),u=R.current;if(H!==A.scrollTop&&(A.scrollTop=H),u.length===0&&g.set(p?"scrollUpArrowVisible":"scrollDownArrowVisible",!V),V){P.clear();return}if(u.length>0){let S=ae.current?.offsetHeight||0;A.scrollTop=En(u,p,H,A.clientHeight,S,Z)}P.start(40,ce)}r(ce,"scrollNextItem"),P.start(40,ce)},onMouseLeave(){P.clear()}},f],stateAttributesMapping:Le});return te||m?z:null},"SelectScrollArrow"));Vt.displayName="SelectScrollArrow";function En(e,t,o,n,l,c){if(t){let g=0,h=o+l-Pe;for(let C=0;C<e.length;C+=1){let k=e[C];if(k&&k.offsetTop>=h){g=C;break}}let R=Math.max(0,g-1),I=e[R];return R<g&&I?dt(I.offsetTop-l,c):0}let s=e.length-1,m=o+n-l+Pe;for(let g=0;g<e.length;g+=1){let h=e[g];if(h&&h.offsetTop+h.offsetHeight>m){s=Math.max(0,g-1);break}}let f=Math.min(e.length-1,s+1),p=e[f];return f>s&&p?dt(p.offsetTop+p.offsetHeight-n+l,c):c}r(En,"getTargetScrollTop");var sn=v(De(),1);var No=nn.forwardRef(r(function(t,o){return(0,sn.jsx)(Vt,{...t,ref:o,direction:"down"})},"SelectScrollDownArrow"));No.displayName="SelectScrollDownArrow";var ln=v(L(),1);var an=v(De(),1);var Ao=ln.forwardRef(r(function(t,o){return(0,an.jsx)(Vt,{...t,ref:o,direction:"up"})},"SelectScrollUpArrow"));Ao.displayName="SelectScrollUpArrow";var bt=v(L(),1);var oo=v(L(),1);var ro=oo.createContext(void 0);ro.displayName="SelectGroupContext";function cn(){let e=oo.useContext(ro);if(e===void 0)throw new Error("Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");return e}r(cn,"useSelectGroupContext");var un=v(De(),1);var To=bt.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,[m,f]=bt.useState(),p=bt.useMemo(()=>({labelId:m,setLabelId:f}),[m,f]),g=O("div",t,{ref:o,props:[{role:"group","aria-labelledby":m},s]});return(0,un.jsx)(ro.Provider,{value:p,children:g})},"SelectGroup"));To.displayName="SelectGroup";var fn=v(L(),1);var Mo=fn.forwardRef(r(function(t,o){let{render:n,className:l,style:c,id:s,...m}=t,{setLabelId:f}=cn(),p=Uo(s);return ee(()=>{f(p)},[p,f]),O("div",t,{ref:o,props:[{id:p},m]})},"SelectGroupLabel"));Mo.displayName="SelectGroupLabel";var K=v(gn(),1);var wc=me.Root;function Cc(e){let t=(0,Ot.c)(8),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("flex flex-1 text-start",o),t[3]=o,t[4]=l):l=t[4];let c;return t[5]!==n||t[6]!==l?(c=(0,K.jsxDEV)(me.Value,{"data-slot":"select-value",className:l,...n},void 0,!1),t[5]=n,t[6]=l,t[7]=c):c=t[7],c}r(Cc,"SelectValue");function Nc({className:e,size:t="default",children:o,...n}){return(0,K.jsxDEV)(me.Trigger,{"data-slot":"select-trigger","data-size":t,className:tt("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pe-2 ps-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-md *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[o,(0,K.jsxDEV)(me.Icon,{render:(0,K.jsxDEV)(Ct,{icon:Er,strokeWidth:2,className:"pointer-events-none size-4 text-muted-foreground"},void 0,!1)},void 0,!1)]},void 0,!0)}r(Nc,"SelectTrigger");function Ac({className:e,children:t,side:o="bottom",sideOffset:n=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:s=!0,...m}){return(0,K.jsxDEV)(me.Portal,{children:(0,K.jsxDEV)(me.Positioner,{side:o,sideOffset:n,align:l,alignOffset:c,alignItemWithTrigger:s,className:"isolate z-50",children:(0,K.jsxDEV)(me.Popup,{"data-slot":"select-content","data-align-trigger":s,className:tt("isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",e),...m,children:[(0,K.jsxDEV)(wn,{},void 0,!1),(0,K.jsxDEV)(me.List,{children:t},void 0,!1),(0,K.jsxDEV)(Cn,{},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)}r(Ac,"SelectContent");function Tc(e){let t=(0,Ot.c)(13),o,n,l;t[0]!==e?({className:n,children:o,...l}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=l):(o=t[1],n=t[2],l=t[3]);let c;t[4]!==n?(c=tt("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",n),t[4]=n,t[5]=c):c=t[5];let s;t[6]!==o?(s=(0,K.jsxDEV)(me.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:o},void 0,!1),t[6]=o,t[7]=s):s=t[7];let m;t[8]===Symbol.for("react.memo_cache_sentinel")?(m=(0,K.jsxDEV)(me.ItemIndicator,{render:(0,K.jsxDEV)("span",{className:"pointer-events-none absolute end-2 flex size-4 items-center justify-center"},void 0,!1),children:(0,K.jsxDEV)(Ct,{icon:Ir,strokeWidth:2,className:"pointer-events-none"},void 0,!1)},void 0,!1),t[8]=m):m=t[8];let f;return t[9]!==l||t[10]!==c||t[11]!==s?(f=(0,K.jsxDEV)(me.Item,{"data-slot":"select-item",className:c,...l,children:[s,m]},void 0,!0),t[9]=l,t[10]=c,t[11]=s,t[12]=f):f=t[12],f}r(Tc,"SelectItem");function wn(e){let t=(0,Ot.c)(9),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",o),t[3]=o,t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=(0,K.jsxDEV)(Ct,{icon:vr,strokeWidth:2},void 0,!1),t[5]=c):c=t[5];let s;return t[6]!==n||t[7]!==l?(s=(0,K.jsxDEV)(me.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:l,...n,children:c},void 0,!1),t[6]=n,t[7]=l,t[8]=s):s=t[8],s}r(wn,"SelectScrollUpButton");function Cn(e){let t=(0,Ot.c)(9),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",o),t[3]=o,t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=(0,K.jsxDEV)(Ct,{icon:yr,strokeWidth:2},void 0,!1),t[5]=c):c=t[5];let s;return t[6]!==n||t[7]!==l?(s=(0,K.jsxDEV)(me.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:l,...n,children:c},void 0,!1),t[6]=n,t[7]=l,t[8]=s):s=t[8],s}r(Cn,"SelectScrollDownButton");export{wc as a,Cc as b,Nc as c,Ac as d,Tc as e};
|
|
1
|
+
import{a as Nt,b as Pe,c as mt,d as dt,e as At,f as Pr}from"./chunk-3HGNPZBN.js";import{a as wr,b as Cr,c as Nr,d as Ar,e as Mr}from"./chunk-APSSZB6Z.js";import{a as Tr}from"./chunk-QAFAJBAW.js";import{A as Qo,B as er,C as tr,D as M,G as a,H as or,L as rr,Z as nr,a as Ho,ca as sr,d as jo,da as lr,ha as ir,ia as ar,ja as pt,k as Ht,la as ur,ma as fr,n as Xo,oa as mr,pa as dr,q as Ko,qa as gr,ra as Sr,ta as hr,ua as xr,va as Rr,wa as br,x as Jo,y as Zo}from"./chunk-SHERR7ZP.js";import{a as Yo,b as pr}from"./chunk-5OIBXYZM.js";import{a as qo,b as $o,c as cr}from"./chunk-L7SK4ZZD.js";import{a as yr,b as vr,i as Ir,j as Er,k as Ct}from"./chunk-4QHKBC77.js";import{C as ut,F as Wo,I as Le,K as $e,L as ft,M as io,N as Go,O as ge,P as xe,a as Ut,b as ct,c as Lo,e as Uo,f as ko,g as Ft,h as wt,i as Fo,p as Bt,y as Bo,z as zo}from"./chunk-VL23Y44O.js";import{b as jt}from"./chunk-UK64ZSUW.js";import{a as ee,c as de,e as kt}from"./chunk-O3NAGRTR.js";import{a as Et,c as Oo,d as _o,h as lo,i as Do,j as O}from"./chunk-CKSHCYGC.js";import{a as De}from"./chunk-3OA7PECS.js";import{a as r,d as mn,e as v,f as L,g as dn,h as gn,j as tt}from"./chunk-RRCPZMC2.js";var Ot=v(dn(),1),bc=v(L(),1);var me={};mn(me,{Arrow:()=>Co,Backdrop:()=>Ro,Group:()=>To,GroupLabel:()=>Mo,Icon:()=>mo,Item:()=>Io,ItemIndicator:()=>Eo,ItemText:()=>wo,Label:()=>uo,List:()=>vo,Popup:()=>yo,Portal:()=>xo,Positioner:()=>bo,Root:()=>Hr,ScrollDownArrow:()=>No,ScrollUpArrow:()=>Ao,Separator:()=>Tr,Trigger:()=>fo,Value:()=>po});var j=v(L(),1);var gt=v(L(),1);var zt=gt.createContext(null);zt.displayName="SelectRootContext";var Wt=gt.createContext(null);Wt.displayName="SelectFloatingContext";function U(){let e=gt.useContext(zt);if(e===null)throw new Error("Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.");return e}r(U,"useSelectRootContext");function Gt(){let e=gt.useContext(Wt);if(e===null)throw new Error("Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.");return e}r(Gt,"useSelectFloatingContext");var Vr=r((e,t)=>Object.is(e,t),"defaultItemEquality");function Ue(e,t,o){return e==null||t==null?Object.is(e,t):o(e,t)}r(Ue,"compareItemEquality");function Or(e,t,o){return!e||e.length===0?!1:e.some(n=>n===void 0?!1:Ue(t,n,o))}r(Or,"selectedValueIncludes");function ot(e,t,o){return!e||e.length===0?-1:e.findIndex(n=>n===void 0?!1:Ue(n,t,o))}r(ot,"findItemIndex");function _r(e,t,o){return e.filter(n=>!Ue(t,n,o))}r(_r,"removeItem");var Dr=v(L(),1);function Yt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}r(Yt,"serializeValue");var Lr=v(De(),1);function Ur(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}r(Ur,"isGroupedItems");function kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;let t=e;if(Ur(t)){for(let o of t)for(let n of o.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(let o of t)if(o&&o.value==null&&o.label!=null)return!0;return!1}r(kr,"hasNullItemLabel");function ao(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Yt(e)}r(ao,"stringifyAsLabel");function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Yt(e.value):Yt(e)}r(je,"stringifyAsValue");function co(e,t,o){function n(){return ao(e,o)}if(r(n,"fallback"),o&&e!=null)return o(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??n();if(Array.isArray(t)){let l=t,c=Ur(l)?l.flatMap(s=>s.items):l;if(e==null||typeof e!="object"){let s=c.find(m=>m.value===e);return s&&s.label!=null?s.label:n()}if("value"in e){let s=c.find(m=>m&&m.value===e.value);if(s&&s.label!=null)return s.label}}return n()}r(co,"resolveSelectedLabel");function Fr(e,t,o){return e.reduce((n,l,c)=>(c>0&&n.push(", "),n.push((0,Lr.jsx)(Dr.Fragment,{children:co(l,t,o)},c)),n),[])}r(Fr,"resolveMultipleLabels");var i={id:M(e=>e.id),labelId:M(e=>e.labelId),modal:M(e=>e.modal),multiple:M(e=>e.multiple),items:M(e=>e.items),itemToStringLabel:M(e=>e.itemToStringLabel),itemToStringValue:M(e=>e.itemToStringValue),isItemEqualToValue:M(e=>e.isItemEqualToValue),value:M(e=>e.value),hasSelectedValue:M(e=>{let{value:t,multiple:o,itemToStringValue:n}=e;return t==null?!1:o&&Array.isArray(t)?t.length>0:je(t,n)!==""}),hasNullItemLabel:M((e,t)=>t?kr(e.items):!1),open:M(e=>e.open),mounted:M(e=>e.mounted),forceMount:M(e=>e.forceMount),transitionStatus:M(e=>e.transitionStatus),openMethod:M(e=>e.openMethod),activeIndex:M(e=>e.activeIndex),selectedIndex:M(e=>e.selectedIndex),isActive:M((e,t)=>e.activeIndex===t),isSelected:M((e,t)=>{let o=e.isItemEqualToValue,n=e.value;return e.multiple?Array.isArray(n)&&n.some(l=>Ue(t,l,o)):Ue(t,n,o)}),isSelectedByFocus:M((e,t)=>e.selectedIndex===t),popupProps:M(e=>e.popupProps),triggerProps:M(e=>e.triggerProps),triggerElement:M(e=>e.triggerElement),positionerElement:M(e=>e.positionerElement),listElement:M(e=>e.listElement),popupSide:M(e=>e.popupSide),scrollUpArrowVisible:M(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:M(e=>e.scrollDownArrowVisible),hasScrollArrows:M(e=>e.hasScrollArrows)};function Br(e,t,o=(n,l)=>n===l){return e.length===t.length&&e.every((n,l)=>o(n,t[l]))}r(Br,"areArraysEqual");var St=v(De(),1);function Hr(e){let{id:t,value:o,defaultValue:n=null,onValueChange:l,open:c,defaultOpen:s=!1,onOpenChange:m,name:f,form:p,autoComplete:g,disabled:h=!1,readOnly:R=!1,required:I=!1,modal:C=!0,actionsRef:k,inputRef:x,onOpenChangeComplete:J,items:B,multiple:N=!1,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P=Vr,highlightItemOnHover:ae=!0,children:te}=e,{clearErrors:q}=Lo(),{setDirty:se,setTouched:Se,setFocused:Re,validityData:z,setFilled:$,name:_,disabled:ce,validation:A,validationMode:Z}=ct(),H=Ft({id:t}),V=ce||h,u=_??f,[S,le]=io({controlled:o,default:N?n??lo:n,name:"Select",state:"value"}),[F,be]=io({controlled:c,default:s,name:"Select",state:"open"}),he=j.useRef([]),d=j.useRef([]),w=j.useRef(null),ue=j.useRef(null),Ne=j.useRef(0),T=j.useRef(null),X=j.useRef([]),W=j.useRef(!1),ve=j.useRef(null),ie=j.useRef(null),fe=j.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=j.useRef(!1),{mounted:oe,setMounted:Ae,transitionStatus:Q}=ft(F),{openMethod:G,triggerProps:re}=ur(F),y=Oo(()=>new or({id:H,labelId:void 0,modal:C,multiple:N,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P,value:S,open:F,mounted:oe,transitionStatus:Q,items:B,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ze=a(y,i.activeIndex),Te=a(y,i.selectedIndex),Ve=a(y,i.triggerElement),ke=a(y,i.positionerElement),We=br(G),Ke=G??We??null,yt=j.useMemo(()=>N?"":je(S,D),[N,S,D]),Fe=j.useMemo(()=>N&&Array.isArray(S)?S.map(E=>je(E,D)):je(S,D),[N,S,D]),Je=Ht(y.state.triggerElement),ne=de(()=>Fe);Go(Je,H,S,ne,!V,f);let Be=j.useRef(S),He=N?Array.isArray(S)&&S.length>0:S!=null&&je(S,D)!=="";ee(()=>{S!==Be.current&&y.set("forceMount",!0)},[y,S]),ee(()=>{$(He)},[He,$]),ee(r(function(){let Y=X.current,Ie;if(N){let ye=Array.isArray(S)?S:[];if(ye.length===0)Ie=null;else{let qe=ye[ye.length-1],et=ot(Y,qe,P);Ie=et===-1?null:et}}else{let ye=ot(Y,S,P);Ie=ye===-1?null:ye}Ie===null&&(ie.current=null),!F&&y.set("selectedIndex",Ie)},"syncSelectedIndex"),[He,N,F,S,X,P,y,ie]);function Oe(E){let Y=z.initialValue;return Array.isArray(E)&&Array.isArray(Y)?!Br(E,Y,(Ie,ye)=>Ue(Ie,ye,P)):E!==Y}r(Oe,"isSelectedValueDirty"),cr(S,()=>{q(u),se(Oe(S)),A.change(S)});let nt=de((E,Y)=>{m?.(E,Y),!Y.isCanceled&&(be(E),!E&&(Y.reason===ge.focusOut||Y.reason===ge.outsidePress)&&(Se(!0),Re(!1),Z==="onBlur"&&A.commit(S)))}),st=de(()=>{Ae(!1),y.update({activeIndex:null,openMethod:null}),J?.(!1)});$e({enabled:!k,open:F,ref:w,onComplete(){F||st()}}),j.useImperativeHandle(k,()=>({unmount:st}),[st]);let Ge=de((E,Y)=>{l?.(E,Y),!Y.isCanceled&&le(E)}),_e=de(()=>{let E=y.state.listElement||w.current;if(!E)return;let Y=mt(E.scrollHeight,E.clientHeight),Ie=dt(E.scrollTop,Y),ye=Ie>0,qe=Ie<Y;y.state.scrollUpArrowVisible!==ye&&y.set("scrollUpArrowVisible",ye),y.state.scrollDownArrowVisible!==qe&&y.set("scrollDownArrowVisible",qe)}),Ze=nr({open:F,onOpenChange:nt,elements:{reference:Ve,floating:ke}}),lt=Zo(Ze,{enabled:!R&&!V,event:"mousedown"}),it=Qo(Ze),Ye=sr(Ze,{enabled:!R&&!V,listRef:he,activeIndex:ze,selectedIndex:Te,disabledIndices:lo,onNavigate(E){E===null&&!F||y.set("activeIndex",E)},focusItemOnHover:ae}),Qe=lr(Ze,{enabled:!R&&!V&&(F||!N),listRef:d,activeIndex:ze,selectedIndex:Te,disabledIndices:r(E=>Mr(he.current[E]),"disabledIndices"),onMatch(E){F?y.set("activeIndex",E):Ge(X.current[E],xe("none"))},onTyping(E){W.current=E}}),vt=j.useMemo(()=>{let E=Et(Qe.reference,Ye.reference,it.reference,lt.reference,re);return H&&(E.id=H),E},[lt.reference,Qe.reference,Ye.reference,it.reference,re,H]),It=j.useMemo(()=>Et(rr,Qe.floating,Ye.floating,it.floating),[Qe.floating,Ye.floating,it.floating]),_t=Ye.item??Do;tr(()=>{y.update({popupProps:It,triggerProps:vt})}),ee(()=>{y.update({id:H,modal:C,multiple:N,value:S,open:F,mounted:oe,transitionStatus:Q,popupProps:It,triggerProps:vt,items:B,itemToStringLabel:b,itemToStringValue:D,isItemEqualToValue:P,openMethod:Ke})},[y,H,C,N,S,F,oe,Q,It,vt,B,b,D,P,Ke]);let Me=j.useMemo(()=>({store:y,name:u,required:I,disabled:V,readOnly:R,multiple:N,highlightItemOnHover:ae,setValue:Ge,setOpen:nt,listRef:he,popupRef:w,scrollHandlerRef:ue,handleScrollArrowVisibility:_e,scrollArrowsMountedCountRef:Ne,itemProps:_t,valueRef:T,valuesRef:X,labelsRef:d,typingRef:W,selectionRef:fe,firstItemTextRef:ve,selectedItemTextRef:ie,validation:A,onOpenChangeComplete:J,alignItemWithTriggerActiveRef:pe,initialValueRef:Be}),[y,u,I,V,R,N,ae,Ge,nt,_t,A,J,_e]),at=_o(x,A.inputRef),Dt=N&&Array.isArray(S)&&S.length>0,Lt=N?void 0:u,no=j.useMemo(()=>!N||!Array.isArray(S)||!u?null:S.map(E=>{let Y=je(E,D);return(0,St.jsx)("input",{type:"hidden",form:p,name:u,value:Y,disabled:V},Y)}),[N,S,p,u,D,V]);return(0,St.jsx)(zt.Provider,{value:Me,children:(0,St.jsxs)(Wt.Provider,{value:Ze,children:[te,(0,St.jsx)("input",{...A.getValidationProps(V,{onFocus(){y.state.triggerElement?.focus({focusVisible:!0})},onChange(E){if(E.nativeEvent.defaultPrevented||V||R)return;let Y=E.currentTarget.value,Ie=xe(ge.none,E.nativeEvent);function ye(){if(N)return;let qe=Y.toLowerCase(),et=X.current.findIndex(so=>je(so,D).toLowerCase()===qe||ao(so,b).toLowerCase()===qe);et===-1&&(et=X.current.findIndex((so,pn)=>{let Vo=d.current[pn];return Vo!=null&&Vo.toLowerCase()===qe}));let Po=et===-1?void 0:X.current[et];Po!=null&&Ge(Po,Ie)}r(ye,"handleChange"),y.set("forceMount",!0),queueMicrotask(ye)}}),id:H&&Lt==null?`${H}-hidden-input`:void 0,form:p,name:Lt,autoComplete:g,value:yt,disabled:V,required:I&&!Dt,readOnly:R,ref:at,style:u?$o:qo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),no]})})}r(Hr,"SelectRoot");var Wr=v(L(),1);function jr(e){return e==null?void 0:`${e}-label`}r(jr,"getDefaultLabelId");function zr(e,t){return e??t}r(zr,"resolveAriaLabelledBy");var uo=Wr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,m=s;delete m.id;let f=ct(),{store:p}=U(),g=a(p,i.triggerElement),h=a(p,i.id),R=jr(h),I=zo({id:R,fallbackControlId:g?.id??h,setLabelId(C){p.set("labelId",C)}});return O("div",t,{ref:o,state:f.state,props:[I,s],stateAttributesMapping:Ut})},"SelectLabel"));uo.displayName="SelectLabel";var ht=v(L(),1);var qt=2,Sn=400,hn={...ar,...Ut,popupSide:r(e=>e?{"data-popup-side":e}:null,"popupSide"),value:r(()=>null,"value")},fo=ht.forwardRef(r(function(t,o){let{render:n,className:l,id:c,disabled:s=!1,nativeButton:m=!0,style:f,...p}=t,{setTouched:g,setFocused:h,validationMode:R,state:I,disabled:C}=ct(),{labelId:k}=ko(),{store:x,setOpen:J,selectionRef:B,validation:N,readOnly:b,required:D,alignItemWithTriggerActiveRef:P,disabled:ae}=U(),te=C||ae||s,q=a(x,i.open),se=a(x,i.mounted),Se=a(x,i.value),Re=a(x,i.triggerProps),z=a(x,i.positionerElement),$=a(x,i.listElement),_=a(x,i.popupSide),ce=a(x,i.id),A=a(x,i.labelId),Z=a(x,i.hasSelectedValue),H=se&&z?_:null,V=c??ce,u=zr(k,A);Ft({id:V});let S=Ht(z),le=ht.useRef(null),{getButtonProps:F,buttonRef:be}=jt({disabled:te,native:m}),he=de(W=>{x.set("triggerElement",W)}),d=ut(),w=ut(),ue=ut();ht.useEffect(()=>{if(q)return ue.start(Sn,()=>{B.current.allowUnselectedMouseUp=!0,B.current.allowSelectedMouseUp=!0}),()=>{ue.clear()};B.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},w.clear()},[q,B,w,ue]);let Ne=Et(Re,{id:V,role:"combobox","aria-expanded":q?"true":"false","aria-haspopup":"listbox","aria-controls":q?$?.id??Bo(z)?.id:void 0,"aria-labelledby":u,"aria-readonly":b||void 0,"aria-required":D||void 0,tabIndex:te?-1:0,onFocus(W){h(!0),q&&P.current&&J(!1,xe(ge.none,W.nativeEvent)),d.start(0,()=>{x.set("forceMount",!0)})},onBlur(W){Bt(z,W.relatedTarget)||(g(!0),h(!1),R==="onBlur"&&N.commit(Se))},onMouseDown(W){if(q)return;let ve=wt(W.currentTarget);function ie(fe){if(!le.current)return;let pe=fe.target;if(Bt(le.current,pe)||Bt(S.current,pe))return;let oe=Ar(le.current);fe.clientX>=oe.left-qt&&fe.clientX<=oe.right+qt&&fe.clientY>=oe.top-qt&&fe.clientY<=oe.bottom+qt||J(!1,xe(ge.cancelOpen,fe))}r(ie,"handleMouseUp"),w.start(0,()=>{ve.addEventListener("mouseup",ie,{once:!0})})}},p,F),T=N.getValidationProps(te,Ne);T.role="combobox";let X={...I,open:q,disabled:te,value:Se,readOnly:b,popupSide:H,placeholder:!Z};return O("button",t,{ref:[o,le,be,he],state:X,stateAttributesMapping:hn,props:T})},"SelectTrigger"));fo.displayName="SelectTrigger";var Gr=v(L(),1);var xn={value:r(()=>null,"value")},po=Gr.forwardRef(r(function(t,o){let{className:n,render:l,children:c,placeholder:s,style:m,...f}=t,{store:p,valueRef:g}=U(),h=a(p,i.value),R=a(p,i.items),I=a(p,i.itemToStringLabel),C=a(p,i.hasSelectedValue),k=!C&&s!=null&&c==null,x=a(p,i.hasNullItemLabel,k),J={value:h,placeholder:!C},B=null;return typeof c=="function"?B=c(h):c!=null?B=c:!C&&s!=null&&!x?B=s:Array.isArray(h)?B=Fr(h,R,I):B=co(h,R,I),O("span",t,{state:J,ref:[o,g],props:[{children:B},f],stateAttributesMapping:xn})},"SelectValue"));po.displayName="SelectValue";var Yr=v(L(),1);var mo=Yr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),p={open:a(m,i.open)};return O("span",t,{state:p,ref:o,props:[{"aria-hidden":!0,children:"\u25BC"},s],stateAttributesMapping:ir})},"SelectIcon"));mo.displayName="SelectIcon";var qr=v(L(),1);var go=v(L(),1);var So=go.createContext(void 0);So.displayName="SelectPortalContext";var ho=v(De(),1);var xo=qr.forwardRef(r(function(t,o){let{store:n}=U(),l=a(n,i.mounted),c=a(n,i.forceMount);return l||c?(0,ho.jsx)(So.Provider,{value:!0,children:(0,ho.jsx)(Ko,{ref:o,...t})}):null},"SelectPortal"));xo.displayName="SelectPortal";var $r=v(L(),1);var Rn={...pt,...Le},Ro=$r.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),f=a(m,i.open),p=a(m,i.mounted),g=a(m,i.transitionStatus);return O("div",t,{state:{open:f,transitionStatus:g},ref:o,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},s],stateAttributesMapping:Rn})},"SelectBackdrop"));Ro.displayName="SelectBackdrop";var Ee=v(L(),1);var $t=v(L(),1);var Xt=$t.createContext(void 0);Xt.displayName="SelectPositionerContext";function Xe(){let e=$t.useContext(Xt);if(!e)throw new Error("Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.");return e}r(Xe,"useSelectPositionerContext");function xt(e,t){e&&Object.assign(e.style,t)}r(xt,"clearStyles");var Kt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};var Tt=v(De(),1);var bn={position:"fixed"},bo=Ee.forwardRef(r(function(t,o){let{anchor:n,positionMethod:l="absolute",className:c,render:s,side:m="bottom",align:f="center",sideOffset:p=0,alignOffset:g=0,collisionBoundary:h="clipping-ancestors",collisionPadding:R,arrowPadding:I=5,sticky:C=!1,disableAnchorTracking:k,alignItemWithTrigger:x=!0,collisionAvoidance:J=Xo,style:B,...N}=t,{store:b,listRef:D,labelsRef:P,alignItemWithTriggerActiveRef:ae,selectedItemTextRef:te,valuesRef:q,initialValueRef:se,popupRef:Se,setValue:Re}=U(),z=Gt(),$=a(b,i.open),_=a(b,i.mounted),ce=a(b,i.modal),A=a(b,i.value),Z=a(b,i.openMethod),H=a(b,i.positionerElement),V=a(b,i.triggerElement),u=a(b,i.isItemEqualToValue),S=a(b,i.transitionStatus),le=Ee.useRef(null),F=Ee.useRef(null),[be,he]=Ee.useState(x),d=_&&be&&Z!=="touch";!_&&be!==x&&he(x),ee(()=>{_||(i.scrollUpArrowVisible(b.state)&&b.set("scrollUpArrowVisible",!1),i.scrollDownArrowVisible(b.state)&&b.set("scrollDownArrowVisible",!1))},[b,_]),Ee.useImperativeHandle(ae,()=>d),hr((d||ce)&&$,Z==="touch",H,V);let w=mr({anchor:n,floatingRootContext:z,positionMethod:l,mounted:_,side:m,sideOffset:p,align:f,alignOffset:g,arrowPadding:I,collisionBoundary:h,collisionPadding:R,sticky:C,disableAnchorTracking:k??d,collisionAvoidance:J,keepMounted:!0}),ue=d?"none":w.side,Ne=d?bn:w.positionerStyles,T={open:$,side:ue,align:w.align,anchorHidden:w.anchorHidden};ee(()=>{b.set("popupSide",w.side)},[b,w.side]);let X=de(pe=>{b.set("positionerElement",pe)}),W=Sr(t,T,{styles:Ne,transitionStatus:S,props:N,refs:[o,X],hidden:!_,inert:!$}),ve=Ee.useRef(0),ie=de(pe=>{if(pe.size===0&&ve.current===0||q.current.length===0)return;let oe=ve.current;if(ve.current=pe.size,pe.size===oe)return;let Ae=xe(ge.none);if(oe!==0&&!b.state.multiple&&A!==null&&ot(q.current,A,u)===-1){let G=se.current,y=G!=null&&ot(q.current,G,u)!==-1?G:null;Re(y,Ae),y===null&&(b.set("selectedIndex",null),te.current=null)}if(oe!==0&&b.state.multiple&&Array.isArray(A)){let Q=r(re=>ot(q.current,re,u)!==-1,"hasVisibleItem"),G=A.filter(re=>Q(re));(G.length!==A.length||G.some(re=>!Or(A,re,u)))&&(Re(G,Ae),G.length===0&&(b.set("selectedIndex",null),te.current=null))}if($&&d){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let Q={height:""};xt(H,Q),xt(Se.current,Q)}}),fe=Ee.useMemo(()=>({...w,side:ue,alignItemWithTriggerActive:d,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:le,scrollDownArrowRef:F}),[w,ue,d,he]);return(0,Tt.jsx)(Nr,{elementsRef:D,labelsRef:P,onMapChange:ie,children:(0,Tt.jsxs)(Xt.Provider,{value:fe,children:[_&&ce&&(0,Tt.jsx)(dr,{inert:fr(!$),cutout:V}),W]})})},"SelectPositioner"));bo.displayName="SelectPositioner";var we=v(L(),1);var Qt=v(De(),1);var yn={...pt,...Le},yo=we.forwardRef(r(function(t,o){let{render:n,className:l,style:c,finalFocus:s,...m}=t,{store:f,popupRef:p,onOpenChangeComplete:g,setOpen:h,valueRef:R,firstItemTextRef:I,selectedItemTextRef:C,multiple:k,handleScrollArrowVisibility:x,scrollHandlerRef:J,listRef:B,highlightItemOnHover:N}=U(),{side:b,align:D,alignItemWithTriggerActive:P,isPositioned:ae,setControlledAlignItemWithTrigger:te}=Xe(),q=Rr(!0)!=null,se=Gt(),Se=pr(),{nonce:Re,disableStyleElements:z}=Pr(),$=a(f,i.id),_=a(f,i.open),ce=a(f,i.openMethod),A=a(f,i.mounted),Z=a(f,i.popupProps),H=a(f,i.transitionStatus),V=a(f,i.triggerElement),u=a(f,i.positionerElement),S=a(f,i.listElement),le=we.useRef(!1),F=we.useRef(!1),be=we.useRef({}),he=Wo(),d=de(T=>{if(!u||!p.current||!F.current)return;if(le.current||!P){x();return}let X=u.style.top==="0px",W=u.style.bottom==="0px";if(!X&&!W){x();return}let ve=Kr(u),ie=Mt(u.getBoundingClientRect().height,"y",ve),fe=wt(u),pe=kt(u),oe=pe.getComputedStyle(u),Ae=parseFloat(oe.marginTop),Q=parseFloat(oe.marginBottom),G=Xr(pe.getComputedStyle(p.current)),re=Math.min(fe.documentElement.clientHeight-Ae-Q,G),y=T.scrollTop,ze=Jt(T),Te=0,Ve=null,ke=!1,We=!1,Ke=r(ne=>{u.style.height=`${ne}px`},"setHeight"),yt=r((ne,Be)=>{let He=Nt(ne,0,re-ie);He>0&&Ke(ie+He),T.scrollTop=Be,re-(ie+He)<=Pe&&(le.current=!0),x()},"handleSmallDiff"),Fe=X?ze-y:y,Je=Math.min(ie+Fe,re);if(Te=Je,Fe<=Pe){yt(Fe,X?ze:0);return}if(re-Je>Pe)X?We=!0:Ve=0;else if(ke=!0,W&&y<ze){let ne=ie+Fe-re;Ve=y-(Fe-ne)}if(Te=Math.ceil(Te),Te!==0&&Ke(Te),We||Ve!=null){let ne=Jt(T),Be=We?ne:Nt(Ve,0,ne);Math.abs(T.scrollTop-Be)>Pe&&(T.scrollTop=Be)}(ke||Te>=re-Pe)&&(le.current=!0),x()});we.useImperativeHandle(J,()=>d,[d]),$e({open:_,ref:p,onComplete(){_&&g?.(!0)}});let w={open:_,transitionStatus:H,side:b,align:D};ee(()=>{!u||!p.current||Object.keys(be.current).length||(be.current={top:u.style.top||"0",left:u.style.left||"0",right:u.style.right,height:u.style.height,bottom:u.style.bottom,minHeight:u.style.minHeight,maxHeight:u.style.maxHeight,marginTop:u.style.marginTop,marginBottom:u.style.marginBottom})},[p,u]),ee(()=>{_||P||(F.current=!1,le.current=!1,xt(u,be.current))},[_,P,u,p]),ee(()=>{let T=p.current;if(!_||!V||!u||!T||P&&!ae||f.state.transitionStatus==="ending")return;if(!P){F.current=!0,he.request(x),T.style.removeProperty("--transform-origin");return}let X=vn(T);T.style.removeProperty("--transform-origin");try{let W=C.current;W?.isConnected||(W=!i.hasSelectedValue(f.state)&&I.current?.isConnected?I.current:null);let ve=R.current,ie=kt(u),fe=ie.getComputedStyle(u),pe=ie.getComputedStyle(T),oe=wt(V),Ae=Kr(V),Q=Zt(V.getBoundingClientRect(),Ae),G=Zt(u.getBoundingClientRect(),Ae),re=Q.height,y=S||T,ze=y.scrollHeight,Te=parseFloat(pe.borderBottomWidth),Ve=parseFloat(fe.marginTop)||10,ke=parseFloat(fe.marginBottom)||10,We=parseFloat(fe.minHeight)||100,Ke=Xr(pe),yt=5,Fe=5,Je=20,ne=oe.documentElement.clientHeight-Ve-ke,Be=oe.documentElement.clientWidth,He=ne-Q.bottom+re,Oe,nt=Se==="rtl"?Q.right-G.width:Q.left,st=0;if(W&&ve){let Me=Zt(ve.getBoundingClientRect(),Ae);Oe=Zt(W.getBoundingClientRect(),Ae),nt=G.left+(Se==="rtl"?Me.right-Oe.right:Me.left-Oe.left);let at=Me.top-Q.top+Me.height/2;st=Oe.top-G.top+Oe.height/2-at}let Ge=He+st+ke+Te,_e=Math.min(ne,Ge),Ze=ne-Ve-ke,lt=Ge-_e,it=Be-Fe;u.style.left=`${Nt(nt,yt,it-G.width)}px`,u.style.height=`${_e}px`,u.style.maxHeight="none",u.style.marginTop=`${Ve}px`,u.style.marginBottom=`${ke}px`,T.style.height="100%";let Ye=Jt(y),Qe=lt>=Ye-Pe;Qe&&(_e=Math.min(ne,G.height)-(lt-Ye));let vt=Q.top<Je||Q.bottom>ne-Je||Math.ceil(_e)+Pe<Math.min(ze,We),It=(ie.visualViewport?.scale??1)!==1&&Fo.engine.webkit;if(vt||It){F.current=!0,xt(u,be.current),te(!1);return}let _t=Math.max(We,_e);if(Qe){let Me=Math.max(0,ne-Ge);u.style.top=G.height>=Ze?"0":`${Me}px`,u.style.height=`${_e}px`,y.scrollTop=Jt(y)}else u.style.bottom="0",y.scrollTop=lt;if(Oe){let Me=G.top,at=G.height,Dt=Oe.top+Oe.height/2,Lt=at>0?(Dt-Me)/at*100:50,no=Nt(Lt,0,100);T.style.setProperty("--transform-origin",`50% ${no}%`)}(_t===ne||_e>=Ke)&&(le.current=!0),x(),N&&f.state.selectedIndex===null&&f.state.activeIndex===null&&B.current[0]!=null&&f.set("activeIndex",0),F.current=!0}finally{X()}},[f,_,u,V,R,I,C,p,x,P,te,he,S,B,N,Se,ae]),we.useEffect(()=>{if(!P||!u||!_)return;let T=kt(u);function X(W){h(!1,xe(ge.windowResize,W))}return r(X,"handleResize"),Yo(T,"resize",X)},[h,P,u,_]);let ue={...S?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":k||void 0,id:`${$}-list`},onKeyDown(T){q&&xr.has(T.key)&&T.stopPropagation()},onScroll(T){S||d(T.currentTarget)},...P&&{style:S?{height:"100%"}:Kt}},Ne=O("div",t,{ref:[o,p],state:w,stateAttributesMapping:yn,props:[Z,ue,gr(H),{className:!S&&P?At.className:void 0},m]});return(0,Qt.jsxs)(we.Fragment,{children:[!z&&At.getElement(Re),(0,Qt.jsx)(Jo,{context:se,modal:!1,disabled:!A,openInteractionType:ce,returnFocus:s,restoreFocus:!0,children:Ne})]})},"SelectPopup"));yo.displayName="SelectPopup";function Xr(e){let t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}r(Xr,"getMaxPopupHeight");function Jt(e){return mt(e.scrollHeight,e.clientHeight)}r(Jt,"getMaxScrollTop");function Kr(e){return er.getScale(e)}r(Kr,"getScale");function Mt(e,t,o){return e/o[t]}r(Mt,"normalizeSize");function Zt(e,t){return jo({x:Mt(e.x,"x",t),y:Mt(e.y,"y",t),width:Mt(e.width,"x",t),height:Mt(e.height,"y",t)})}r(Zt,"normalizeRect");var Jr=[["transform","none"],["scale","1"],["translate","0 0"]];function vn(e){let{style:t}=e,o={};for(let[n,l]of Jr)o[n]=t.getPropertyValue(n),t.setProperty(n,l,"important");return()=>{for(let[n]of Jr){let l=o[n];l?t.setProperty(n,l):t.removeProperty(n)}}}r(vn,"unsetTransformStyles");var Zr=v(L(),1);var vo=Zr.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m,scrollHandlerRef:f}=U(),{alignItemWithTriggerActive:p}=Xe(),g=a(m,i.hasScrollArrows),h=a(m,i.openMethod),R=a(m,i.multiple),C={id:`${a(m,i.id)}-list`,role:"listbox","aria-multiselectable":R||void 0,onScroll(x){f.current?.(x.currentTarget)},...p&&{style:Kt},className:g&&h!=="touch"?At.className:void 0},k=de(x=>{m.set("listElement",x)});return O("div",t,{ref:[o,k],props:[C,s]})},"SelectList"));vo.displayName="SelectList";var Ce=v(L(),1);var eo=v(L(),1);var to=eo.createContext(void 0);to.displayName="SelectItemContext";function Pt(){let e=eo.useContext(to);if(!e)throw new Error("Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.");return e}r(Pt,"useSelectItemContext");var Qr=v(De(),1);var Io=Ce.memo(Ce.forwardRef(r(function(t,o){let{render:n,className:l,style:c,value:s=null,label:m,disabled:f=!1,nativeButton:p=!1,...g}=t,h=Ce.useRef(null),R=Cr({label:m,textRef:h,indexGuessBehavior:wr.GuessFromOrder}),{store:I,itemProps:C,setOpen:k,setValue:x,selectionRef:J,typingRef:B,valuesRef:N,multiple:b,selectedItemTextRef:D,disabled:P,readOnly:ae}=U(),te=a(I,i.isActive,R.index),q=a(I,i.open),se=a(I,i.isSelected,s),Se=a(I,i.isSelectedByFocus,R.index),Re=a(I,i.isItemEqualToValue),z=R.index,$=z!==-1,_=Ce.useRef(null);ee(()=>{if(!$)return;let d=N.current;return d[z]=s,()=>{delete d[z]}},[$,z,s,N]),ee(()=>{if(!$)return;let d=I.state.value,w=d;b&&Array.isArray(d)&&(w=d.length>0?d[d.length-1]:void 0),w!==void 0&&Ue(s,w,Re)&&(I.set("selectedIndex",z),h.current&&(D.current=h.current))},[$,z,b,Re,I,s,D]);let ce=Ce.useRef(null),A=Ce.useRef("mouse"),Z=Ce.useRef(!1),{getButtonProps:H,buttonRef:V}=jt({disabled:f,focusableWhenDisabled:!0,native:p,composite:!0}),u={disabled:f,selected:se,highlighted:te};function S(d){if(P||ae)return;let w=I.state.value;if(b){let ue=Array.isArray(w)?w:[],Ne=se?_r(ue,s,Re):[...ue,s];x(Ne,xe(ge.itemPress,d))}else x(s,xe(ge.itemPress,d)),k(!1,xe(ge.itemPress,d))}r(S,"commitSelection");function le(){J.current.dragY=0}r(le,"resetDragMovement");let F={role:"option","aria-selected":se,tabIndex:q&&te?0:-1,onKeyDown(d){ce.current=d.key,I.set("activeIndex",z),d.key===" "&&B.current&&d.preventDefault()},onClick(d){let w=d.type==="click"&&A.current!=="touch",ue=d.nativeEvent.pointerType,Ne=w&&Ho(d.nativeEvent)&&(ue!==void 0||te),T=w&&!Ne&&!Z.current;Z.current=!1,!(d.type==="keydown"&&ce.current===null)&&(f||d.type==="keydown"&&ce.current===" "&&B.current||T||(ce.current=null,S(d.nativeEvent)))},onPointerEnter(d){A.current=d.pointerType},onPointerMove(d){if(d.pointerType==="mouse"&&d.buttons===1){let w=J.current;w.dragY+=d.movementY,w.dragY**2>=64&&(w.allowUnselectedMouseUp=!0)}},onPointerDown(d){A.current=d.pointerType,Z.current=!0,le()},onMouseUp(){if(le(),f||A.current==="touch"||Z.current)return;let d=!J.current.allowSelectedMouseUp&&se,w=!J.current.allowUnselectedMouseUp&&!se;d||w||(Z.current=!0,_.current?.click(),Z.current=!1)}},be=O("div",t,{ref:[V,o,R.ref,_],state:u,props:[C,F,g,H]}),he=Ce.useMemo(()=>({selected:se,index:z,textRef:h,selectedByFocus:Se,hasRegistered:$}),[se,z,h,Se,$]);return(0,Qr.jsx)(to.Provider,{value:he,children:be})},"SelectItem")));Io.displayName="SelectItem";var rt=v(L(),1);var en=v(De(),1);var Eo=rt.forwardRef(r(function(t,o){let n=t.keepMounted??!1,{selected:l}=Pt();return n||l?(0,en.jsx)(tn,{...t,ref:o}):null},"SelectItemIndicator"));Eo.displayName="SelectItemIndicator";var tn=rt.memo(rt.forwardRef((e,t)=>{let{render:o,className:n,style:l,keepMounted:c,...s}=e,{selected:m}=Pt(),f=rt.useRef(null),{transitionStatus:p,setMounted:g}=ft(m),R=O("span",e,{ref:[t,f],state:{selected:m,transitionStatus:p},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},s],stateAttributesMapping:Le});return $e({open:m,ref:f,onComplete(){m||g(!1)}}),R}));tn.displayName="Inner";var Rt=v(L(),1);var wo=Rt.memo(Rt.forwardRef(r(function(t,o){let{index:n,textRef:l,selectedByFocus:c,hasRegistered:s}=Pt(),{firstItemTextRef:m,selectedItemTextRef:f}=U(),{render:p,className:g,style:h,...R}=t,I=Rt.useCallback(k=>{k&&(s&&n===0&&(m.current=k),s&&c&&(f.current=k))},[m,f,n,c,s]);return O("div",t,{ref:[I,o,l],props:R})},"SelectItemText")));wo.displayName="SelectItemText";var on=v(L(),1);var In={...pt,...Le},Co=on.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,{store:m}=U(),{side:f,align:p,arrowRef:g,arrowStyles:h,arrowUncentered:R,alignItemWithTriggerActive:I}=Xe(),k={open:a(m,i.open),side:f,align:p,uncentered:R},x=O("div",t,{state:k,ref:[g,o],props:[{style:h,"aria-hidden":!0},s],stateAttributesMapping:In});return I?null:x},"SelectArrow"));Co.displayName="SelectArrow";var nn=v(L(),1);var rn=v(L(),1);var Vt=rn.forwardRef(r(function(t,o){let{render:n,className:l,style:c,direction:s,keepMounted:m=!1,...f}=t,p=s==="up",{store:g,popupRef:h,listRef:R,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=U(),{side:k,scrollDownArrowRef:x,scrollUpArrowRef:J}=Xe(),B=p?i.scrollUpArrowVisible:i.scrollDownArrowVisible,N=a(g,B),b=a(g,i.openMethod),D=N&&b!=="touch",P=ut(),ae=p?J:x,{mounted:te,transitionStatus:q,setMounted:se}=ft(D);ee(()=>(C.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,C]),$e({open:D,ref:ae,onComplete(){D||se(!1)}});let z=O("div",t,{ref:[o,ae],state:{direction:s,visible:D,side:k,transitionStatus:q},props:[{"aria-hidden":!0,children:p?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(_){if(_.movementX===0&&_.movementY===0||P.isStarted())return;g.set("activeIndex",null);function ce(){let A=g.state.listElement??h.current;if(!A)return;g.set("activeIndex",null),I();let Z=mt(A.scrollHeight,A.clientHeight),H=dt(A.scrollTop,Z),V=H===(p?0:Z),u=R.current;if(H!==A.scrollTop&&(A.scrollTop=H),u.length===0&&g.set(p?"scrollUpArrowVisible":"scrollDownArrowVisible",!V),V){P.clear();return}if(u.length>0){let S=ae.current?.offsetHeight||0;A.scrollTop=En(u,p,H,A.clientHeight,S,Z)}P.start(40,ce)}r(ce,"scrollNextItem"),P.start(40,ce)},onMouseLeave(){P.clear()}},f],stateAttributesMapping:Le});return te||m?z:null},"SelectScrollArrow"));Vt.displayName="SelectScrollArrow";function En(e,t,o,n,l,c){if(t){let g=0,h=o+l-Pe;for(let C=0;C<e.length;C+=1){let k=e[C];if(k&&k.offsetTop>=h){g=C;break}}let R=Math.max(0,g-1),I=e[R];return R<g&&I?dt(I.offsetTop-l,c):0}let s=e.length-1,m=o+n-l+Pe;for(let g=0;g<e.length;g+=1){let h=e[g];if(h&&h.offsetTop+h.offsetHeight>m){s=Math.max(0,g-1);break}}let f=Math.min(e.length-1,s+1),p=e[f];return f>s&&p?dt(p.offsetTop+p.offsetHeight-n+l,c):c}r(En,"getTargetScrollTop");var sn=v(De(),1);var No=nn.forwardRef(r(function(t,o){return(0,sn.jsx)(Vt,{...t,ref:o,direction:"down"})},"SelectScrollDownArrow"));No.displayName="SelectScrollDownArrow";var ln=v(L(),1);var an=v(De(),1);var Ao=ln.forwardRef(r(function(t,o){return(0,an.jsx)(Vt,{...t,ref:o,direction:"up"})},"SelectScrollUpArrow"));Ao.displayName="SelectScrollUpArrow";var bt=v(L(),1);var oo=v(L(),1);var ro=oo.createContext(void 0);ro.displayName="SelectGroupContext";function cn(){let e=oo.useContext(ro);if(e===void 0)throw new Error("Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");return e}r(cn,"useSelectGroupContext");var un=v(De(),1);var To=bt.forwardRef(r(function(t,o){let{render:n,className:l,style:c,...s}=t,[m,f]=bt.useState(),p=bt.useMemo(()=>({labelId:m,setLabelId:f}),[m,f]),g=O("div",t,{ref:o,props:[{role:"group","aria-labelledby":m},s]});return(0,un.jsx)(ro.Provider,{value:p,children:g})},"SelectGroup"));To.displayName="SelectGroup";var fn=v(L(),1);var Mo=fn.forwardRef(r(function(t,o){let{render:n,className:l,style:c,id:s,...m}=t,{setLabelId:f}=cn(),p=Uo(s);return ee(()=>{f(p)},[p,f]),O("div",t,{ref:o,props:[{id:p},m]})},"SelectGroupLabel"));Mo.displayName="SelectGroupLabel";var K=v(gn(),1);var wc=me.Root;function Cc(e){let t=(0,Ot.c)(8),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("flex flex-1 text-start",o),t[3]=o,t[4]=l):l=t[4];let c;return t[5]!==n||t[6]!==l?(c=(0,K.jsxDEV)(me.Value,{"data-slot":"select-value",className:l,...n},void 0,!1),t[5]=n,t[6]=l,t[7]=c):c=t[7],c}r(Cc,"SelectValue");function Nc({className:e,size:t="default",children:o,...n}){return(0,K.jsxDEV)(me.Trigger,{"data-slot":"select-trigger","data-size":t,className:tt("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pe-2 ps-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-md *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[o,(0,K.jsxDEV)(me.Icon,{render:(0,K.jsxDEV)(Ct,{icon:Er,strokeWidth:2,className:"pointer-events-none size-4 text-muted-foreground"},void 0,!1)},void 0,!1)]},void 0,!0)}r(Nc,"SelectTrigger");function Ac({className:e,children:t,side:o="bottom",sideOffset:n=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:s=!0,...m}){return(0,K.jsxDEV)(me.Portal,{children:(0,K.jsxDEV)(me.Positioner,{side:o,sideOffset:n,align:l,alignOffset:c,alignItemWithTrigger:s,className:"isolate z-50",children:(0,K.jsxDEV)(me.Popup,{"data-slot":"select-content","data-align-trigger":s,className:tt("isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",e),...m,children:[(0,K.jsxDEV)(wn,{},void 0,!1),(0,K.jsxDEV)(me.List,{children:t},void 0,!1),(0,K.jsxDEV)(Cn,{},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)}r(Ac,"SelectContent");function Tc(e){let t=(0,Ot.c)(13),o,n,l;t[0]!==e?({className:n,children:o,...l}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=l):(o=t[1],n=t[2],l=t[3]);let c;t[4]!==n?(c=tt("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",n),t[4]=n,t[5]=c):c=t[5];let s;t[6]!==o?(s=(0,K.jsxDEV)(me.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:o},void 0,!1),t[6]=o,t[7]=s):s=t[7];let m;t[8]===Symbol.for("react.memo_cache_sentinel")?(m=(0,K.jsxDEV)(me.ItemIndicator,{render:(0,K.jsxDEV)("span",{className:"pointer-events-none absolute end-2 flex size-4 items-center justify-center"},void 0,!1),children:(0,K.jsxDEV)(Ct,{icon:Ir,strokeWidth:2,className:"pointer-events-none"},void 0,!1)},void 0,!1),t[8]=m):m=t[8];let f;return t[9]!==l||t[10]!==c||t[11]!==s?(f=(0,K.jsxDEV)(me.Item,{"data-slot":"select-item",className:c,...l,children:[s,m]},void 0,!0),t[9]=l,t[10]=c,t[11]=s,t[12]=f):f=t[12],f}r(Tc,"SelectItem");function wn(e){let t=(0,Ot.c)(9),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",o),t[3]=o,t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=(0,K.jsxDEV)(Ct,{icon:vr,strokeWidth:2},void 0,!1),t[5]=c):c=t[5];let s;return t[6]!==n||t[7]!==l?(s=(0,K.jsxDEV)(me.ScrollUpArrow,{"data-slot":"select-scroll-up-button",className:l,...n,children:c},void 0,!1),t[6]=n,t[7]=l,t[8]=s):s=t[8],s}r(wn,"SelectScrollUpButton");function Cn(e){let t=(0,Ot.c)(9),o,n;t[0]!==e?({className:o,...n}=e,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]);let l;t[3]!==o?(l=tt("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",o),t[3]=o,t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=(0,K.jsxDEV)(Ct,{icon:yr,strokeWidth:2},void 0,!1),t[5]=c):c=t[5];let s;return t[6]!==n||t[7]!==l?(s=(0,K.jsxDEV)(me.ScrollDownArrow,{"data-slot":"select-scroll-down-button",className:l,...n,children:c},void 0,!1),t[6]=n,t[7]=l,t[8]=s):s=t[8],s}r(Cn,"SelectScrollDownButton");export{wc as a,Cc as b,Nc as c,Ac as d,Tc as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ae}from"./chunk-4F72YCTU.js";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 R,e as _}from"./chunk-SEU5V7I6.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-G7ZBM54M.js";import{f as Q}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.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{b as ae}from"./chunk-4F72YCTU.js";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 R,e as _}from"./chunk-Y572GMZE.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-MHGJUKCZ.js";import{f as Q}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.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 Oe,b as Je}from"./chunk-GVFODXW2.js";import{a as Ke}from"./chunk-3GXGLNKW.js";import{a as qe}from"./chunk-AHILM3ZP.js";import{a as We}from"./chunk-J6J54MBP.js";import"./chunk-L7SK4ZZD.js";import{a as Ge}from"./chunk-2K47A3P6.js";import{a as Ze}from"./chunk-4F72YCTU.js";import{a as De,b as Re,c as Pe,d as j,e as D,f as R}from"./chunk-GTM65MVX.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{a as V}from"./chunk-JSEXCW5Q.js";import"./chunk-4QHKBC77.js";import{R as B}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as U}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as $}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as H}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as Qe}from"./chunk-TAD43CG5.js";import{d as Y,h as ze,k as Ae,l as Ue,p as Fe}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as i,e as je,f as _e,g as et,h as tt}from"./chunk-RRCPZMC2.js";var k=je(_e(),1);var Q=je(et(),1);var t=je(tt(),1);var st=i(()=>{let u=(0,Q.c)(3),{config:e,ready:a}=Oe(),l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},"useAuthCapabilities"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=i((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"isFieldFilled"),it=i((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){let l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},"coerceFieldValue"),ot=i(u=>{let e=(0,Q.c)(105),{onClose:a,onCreated:l}=u,c=H(),s=Y(),{config:r}=Oe(),{busy:o,error:n,run:f}=Je(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,F]=(0,k.useState)(""),[v,g]=(0,k.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[h,d]=(0,k.useState)(p),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{S(m.target.value)},"t2"),e[1]=A):A=e[1];let b=A,I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=i(m=>{C(m.target.value)},"t3"),e[2]=I):I=e[2];let M=I,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=i(m=>{F(m.target.value)},"t4"),e[3]=E):E=e[3];let Be=E,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=i(m=>{g(m.target.value)},"t5"),e[4]=Z):Z=e[4];let $e=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=i((m,P)=>{d(q=>({...q,[m]:P}))},"t6"),e[5]=G):G=e[5];let Ee=G,W;e[6]!==h?(W=i(m=>h[m.name]??(m.type==="boolean"?!1:""),"t7"),e[6]=h,e[7]=W):W=e[7];let T=W,J;if(e[8]!==r.userFields||e[9]!==T){let m;e[11]!==T?(m=i(P=>!P.required||at(P,T(P)),"t92"),e[11]=T,e[12]=m):m=e[12],J=r.userFields.every(m),e[8]=r.userFields,e[9]=T,e[10]=J}else J=e[10];let Ie=J,K;e[13]!==o||e[14]!==w||e[15]!==x||e[16]!==Ie?(K=!o&&w.trim()!==""&&x.trim()!==""&&Ie,e[13]=o,e[14]=w,e[15]=x,e[16]=Ie,e[17]=K):K=e[17];let Ve=K,X;e[18]!==r.userFields||e[19]!==T?(X=i(()=>{let m={};for(let P of r.userFields){let q=it(P,T(P));q!==void 0&&(m[P.name]=q.value)}return Object.keys(m).length===0?void 0:m},"t10"),e[18]=r.userFields,e[19]=T,e[20]=X):X=e[20];let Se=X,_;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==v||e[29]!==f?(_=i(()=>{f(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:v.trim()===""?void 0:v.trim()}),l(),a()})},"t11"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=v,e[29]=f,e[30]=_):_=e[30];let N=_,z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:L},void 0,!1),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==s?(ee=s("email"),e[37]=s,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsxDEV)(V,{htmlFor:"uc-email",children:ee},void 0,!1),e[39]=ee,e[40]=te):te=e[40];let se;e[41]!==w?(se=(0,t.jsxDEV)(B,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:w},void 0,!1),e[41]=w,e[42]=se):se=e[42];let le;e[43]!==te||e[44]!==se?(le=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[te,se]},void 0,!0),e[43]=te,e[44]=se,e[45]=le):le=e[45];let ae;e[46]!==s?(ae=s("name"),e[46]=s,e[47]=ae):ae=e[47];let ie;e[48]!==ae?(ie=(0,t.jsxDEV)(V,{htmlFor:"uc-name",children:ae},void 0,!1),e[48]=ae,e[49]=ie):ie=e[49];let oe;e[50]!==x?(oe=(0,t.jsxDEV)(B,{"data-testid":"uc-name",id:"uc-name",onChange:M,value:x},void 0,!1),e[50]=x,e[51]=oe):oe=e[51];let ne;e[52]!==ie||e[53]!==oe?(ne=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ie,oe]},void 0,!0),e[52]=ie,e[53]=oe,e[54]=ne):ne=e[54];let de;e[55]!==s?(de=s("Password (optional)"),e[55]=s,e[56]=de):de=e[56];let re;e[57]!==de?(re=(0,t.jsxDEV)(V,{htmlFor:"uc-password",children:de},void 0,!1),e[57]=de,e[58]=re):re=e[58];let ce;e[59]!==y?(ce=(0,t.jsxDEV)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y},void 0,!1),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==re||e[62]!==ce?(ue=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[re,ce]},void 0,!0),e[61]=re,e[62]=ce,e[63]=ue):ue=e[63];let fe;e[64]!==s?(fe=s("Role (optional)"),e[64]=s,e[65]=fe):fe=e[65];let ve;e[66]!==fe?(ve=(0,t.jsxDEV)(V,{htmlFor:"uc-role",children:fe},void 0,!1),e[66]=fe,e[67]=ve):ve=e[67];let me;e[68]!==v?(me=(0,t.jsxDEV)(B,{"data-testid":"uc-role",id:"uc-role",onChange:$e,value:v},void 0,!1),e[68]=v,e[69]=me):me=e[69];let he;e[70]!==ve||e[71]!==me?(he=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ve,me]},void 0,!0),e[70]=ve,e[71]=me,e[72]=he):he=e[72];let pe;e[73]!==r.userFields||e[74]!==T||e[75]!==s?(pe=r.userFields.length>0&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")},void 0,!1),r.userFields.map(m=>{let P=`uc-field-${m.name}`,q=m.required?"":` (${s("optional")})`;if(m.type==="boolean"){let Le=T(m)===!0;return(0,t.jsxDEV)("label",{className:"flex items-center gap-2",htmlFor:P,children:[(0,t.jsxDEV)(Ke,{checked:Le,"data-testid":P,id:P,onCheckedChange:i(Xe=>{Ee(m.name,Xe)},"onCheckedChange")},void 0,!1),(0,t.jsxDEV)("span",{className:"text-sm",children:[m.name,q]},void 0,!0)]},m.name,!0)}let Ye=T(m);return(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:P,children:[m.name,q]},void 0,!0),(0,t.jsxDEV)(B,{"data-testid":P,id:P,onChange:i(Le=>{Ee(m.name,Le.target.value)},"onChange"),type:lt[m.type],value:typeof Ye=="string"?Ye:""},void 0,!1)]},m.name,!0)})]},void 0,!0),e[73]=r.userFields,e[74]=T,e[75]=s,e[76]=pe):pe=e[76];let be;e[77]!==n?(be=n!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n},void 0,!1),e[77]=n,e[78]=be):be=e[78];let xe;e[79]!==s?(xe=s("Cancel"),e[79]=s,e[80]=xe):xe=e[80];let ye;e[81]!==a||e[82]!==xe?(ye=(0,t.jsxDEV)(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:xe},void 0,!1),e[81]=a,e[82]=xe,e[83]=ye):ye=e[83];let Me=!Ve,ge;e[84]!==o||e[85]!==s?(ge=s(o?"Creating\u2026":"Create"),e[84]=o,e[85]=s,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Me||e[89]!==ge?(Ne=(0,t.jsxDEV)(U,{"data-testid":"uc-submit",disabled:Me,onClick:N,size:"sm",type:"button",children:ge},void 0,!1),e[87]=N,e[88]=Me,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]},void 0,!0),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Te;return e[94]!==a||e[95]!==z||e[96]!==O||e[97]!==le||e[98]!==ne||e[99]!==ue||e[100]!==he||e[101]!==pe||e[102]!==be||e[103]!==ke?(Te=(0,t.jsxDEV)(qe,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,le,ne,ue,he,pe,be,ke]},void 0,!0),e[94]=a,e[95]=z,e[96]=O,e[97]=le,e[98]=ne,e[99]=ue,e[100]=he,e[101]=pe,e[102]=be,e[103]=ke,e[104]=Te):Te=e[104],Te},"UserCreateDialog"),He=i(u=>{let e=(0,Q.c)(2),{children:a}=u,l;return e[0]!==a?(l=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a},void 0,!1),e[0]=a,e[1]=l):l=e[1],l},"SectionHeading"),nt=i(u=>{let e=(0,Q.c)(29),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{let b=await r.listAuthSessions({limit:50,userId:c});f(b.rows)}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l?(y=i(b=>{l(()=>r.revokeAuthSession({sessionId:b}))},"t3"),e[7]=r,e[8]=l,e[9]=y):y=e[9];let F=y,v;e[10]!==o?(v=o("Sessions"),e[10]=o,e[11]=v):v=e[11];let g;e[12]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[12]=v,e[13]=g):g=e[13];let p;e[14]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w},void 0,!1),e[14]=w,e[15]=p):p=e[15];let h;e[16]!==n||e[17]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:o("No active sessions.")},void 0,!1),e[16]=n,e[17]=o,e[18]=h):h=e[18];let d;e[19]!==a||e[20]!==F||e[21]!==n||e[22]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("expires")},void 0,!1),(0,t.jsxDEV)(D,{children:o("ip")},void 0,!1),(0,t.jsxDEV)(D,{children:o("user agent")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>(0,t.jsxDEV)(j,{"data-testid":`ud-session-${b.id}`,children:[(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.expiresAt)},void 0,!1),(0,t.jsxDEV)(R,{children:b.ipAddress??""},void 0,!1),(0,t.jsxDEV)(R,{className:"max-w-40 truncate",children:b.userAgent??""},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-revoke-${b.id}`,disabled:a,onClick:i(()=>{F(b.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},b.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=a,e[20]=F,e[21]=n,e[22]=o,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==p||e[26]!==h||e[27]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,p,h,d]},void 0,!0),e[24]=g,e[25]=p,e[26]=h,e[27]=d,e[28]=A):A=e[28],A},"UserSessionsPanel"),dt=i(u=>{let e=(0,Q.c)(30),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{f(await r.listAuthAccounts({userId:c}))}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l||e[9]!==c?(y=i(b=>{l(()=>r.unlinkAuthAccount({accountId:b,userId:c}))},"t3"),e[7]=r,e[8]=l,e[9]=c,e[10]=y):y=e[10];let F=y,v;e[11]!==o?(v=o("Linked accounts"),e[11]=o,e[12]=v):v=e[12];let g;e[13]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[13]=v,e[14]=g):g=e[14];let p;e[15]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:w},void 0,!1),e[15]=w,e[16]=p):p=e[16];let h;e[17]!==n||e[18]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No linked accounts.")},void 0,!1),e[17]=n,e[18]=o,e[19]=h):h=e[19];let d;e[20]!==n||e[21]!==a||e[22]!==F||e[23]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("provider")},void 0,!1),(0,t.jsxDEV)(D,{children:o("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>{let I=Ae(b.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-account-${I}`,children:[(0,t.jsxDEV)(R,{children:Ae(b.providerId)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:i(()=>{F(I)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Unlink")},void 0,!1)},void 0,!1)]},I,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=n,e[21]=a,e[22]=F,e[23]=o,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==p||e[27]!==h||e[28]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,p,h,d]},void 0,!0),e[25]=g,e[26]=p,e[27]=h,e[28]=d,e[29]=A):A=e[29],A},"UserAccountsPanel"),rt=i(u=>{let e=(0,Q.c)(40),{busy:a,capabilities:l,runAction:c,userId:s,version:r}=u,o=H(),n=Y(),[f,w]=(0,k.useState)(null),S;e[0]!==l.passkey||e[1]!==o||e[2]!==s?(S=i(()=>{l.passkey&&Ue((async()=>{try{w(await o.listAuthPasskeys({userId:s}))}catch{w(null)}})())},"t1"),e[0]=l.passkey,e[1]=o,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==o||e[6]!==s||e[7]!==r?(x=[l.passkey,o,s,r],e[4]=l.passkey,e[5]=o,e[6]=s,e[7]=r,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==o||e[10]!==c||e[11]!==s?(C=i(()=>{c(()=>o.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=o,e[10]=c,e[11]=s,e[12]=C):C=e[12];let y=C,F;e[13]!==o||e[14]!==c?(F=i(I=>{c(()=>o.deleteAuthPasskey({passkeyId:I}))},"t4"),e[13]=o,e[14]=c,e[15]=F):F=e[15];let v=F,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let p;e[18]!==g?(p=(0,t.jsxDEV)(He,{children:g},void 0,!1),e[18]=g,e[19]=p):p=e[19];let h;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==n?(h=l.twoFactor&&(0,t.jsxDEV)(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")},void 0,!1),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=n,e[24]=h):h=e[24];let d;e[25]!==l.passkey||e[26]!==f||e[27]!==n?(d=l.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")},void 0,!1),e[25]=l.passkey,e[26]=f,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==a||e[30]!==l.passkey||e[31]!==v||e[32]!==f||e[33]!==n?(A=l.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:n("name")},void 0,!1),(0,t.jsxDEV)(D,{children:n("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":n("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:f.map(I=>{let M=Ae(I.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-passkey-${M}`,children:[(0,t.jsxDEV)(R,{children:Ae(I.name)||M},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-delete-passkey-${M}`,disabled:a,onClick:i(()=>{v(M)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")},void 0,!1)},void 0,!1)]},M,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=a,e[30]=l.passkey,e[31]=v,e[32]=f,e[33]=n,e[34]=A):A=e[34];let b;return e[35]!==p||e[36]!==h||e[37]!==d||e[38]!==A?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,h,d,A]},void 0,!0),e[35]=p,e[36]=h,e[37]=d,e[38]=A,e[39]=b):b=e[39],b},"UserSecurityPanel"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=i((u,e)=>typeof e=="number"&&ct.test(u)?Fe(e):Ae(e),"formatField"),vt=i(({capabilities:u,onChanged:e,onClose:a,user:l})=>{let c=H(),s=Y(),r=l.banned===!0,[o,n]=(0,k.useState)(null),[f,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof l.role=="string"?l.role:""),[F,v]=(0,k.useState)(""),[g,p]=(0,k.useState)(""),[h,d]=(0,k.useState)(""),[A,b]=(0,k.useState)(null),[I,M]=(0,k.useState)(!1),E=i((N,z)=>{Ue((async()=>{w(!0),n(null);try{let L=await N();z?.refresh!==!1&&(x(O=>O+1),e()),z?.onResult?.(L)}catch(L){n(ze(L))}finally{w(!1)}})())},"runAction"),Be=i(N=>{y(N.target.value)},"onRoleInputChange"),Z=i(N=>{v(N.target.value)},"onBanReasonChange"),$e=i(N=>{p(N.target.value)},"onBanDaysChange"),G=i(N=>{d(N.target.value)},"onNewPasswordChange"),Ee=i(()=>{let N=C.trim();N!==""&&E(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},"onSetRole"),W=i(()=>{let N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;E(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:F.trim()===""?void 0:F.trim(),userId:l.id})})},"onBan"),T=i(()=>{E(async()=>{await c.unbanAuthUser({userId:l.id})})},"onUnban"),J=i(()=>{E(async()=>{await c.setAuthUserPassword({newPassword:h,userId:l.id}),d("")})},"onSetPassword"),Ie=i(()=>{E(()=>c.impersonateAuthUser({userId:l.id}),{onResult:i(N=>{b(N.token)},"onResult"),refresh:!1})},"onImpersonate"),K=i(()=>{E(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},"onRevokeAll"),Ve=i(()=>{E(async()=>{await c.removeAuthUser({userId:l.id}),a()})},"onDelete"),X=i(()=>{M(!0)},"onConfirmDelete"),Se=i(()=>{M(!1)},"onCancelDelete"),_=Object.entries(l).filter(([N])=>!ut.has(N));return(0,t.jsxDEV)(qe,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsxDEV)($,{variant:"secondary",children:l.role},void 0,!1),r?(0,t.jsxDEV)($,{variant:"destructive",children:s("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("Active")},void 0,!1),l.emailVerified===!0?(0,t.jsxDEV)($,{variant:"secondary",children:s("verified")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),o!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:o},void 0,!1),u.admin&&(0,t.jsxDEV)(we,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-role",disabled:f||C.trim()==="",onClick:Ee,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),r?(0,t.jsxDEV)(U,{"data-testid":"ud-unban",disabled:f,onClick:T,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:F},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:$e,type:"number",value:g},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-ban",disabled:f,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:h},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-password",disabled:f||h==="",onClick:J,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(U,{"data-testid":"ud-impersonate",disabled:f,onClick:Ie,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-revoke-all",disabled:f,onClick:K,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),I?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(U,{"data-testid":"ud-delete-confirm",disabled:f,onClick:Ve,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(U,{"data-testid":"ud-delete",disabled:f,onClick:X,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(nt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),u.accounts&&(0,t.jsxDEV)(dt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),(u.twoFactor||u.passkey)&&(0,t.jsxDEV)(rt,{busy:f,capabilities:u,runAction:E,userId:l.id,version:S},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:_.map(([N,z])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(N,z)},void 0,!1)]},N,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),mt=50,Rt=i(({pageSize:u=mt}={})=>{let e=H(),a=Y(),[l,c]=(0,k.useState)(""),[s,r]=(0,k.useState)(""),o=Ge(l),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=o.trim(),y=s.trim(),F=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),v=F.data?.rows??null,g=F.error,p=i(()=>{F.refetch()},"reloadUsers");We(()=>{F.refetch()},!0);let h=n===null?null:v?.find(d=>d.id===n)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:i(d=>{c(d.target.value)},"onChange"),placeholder:a("Search by email or name\u2026"),value:l},void 0,!1),(0,t.jsxDEV)(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i(d=>{r(d.target.value)},"onChange"),placeholder:a("Filter by role"),value:s},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"us-new",onClick:i(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:a("New user")},void 0,!1)]},void 0,!0),g!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g},void 0,!1),v!==null&&v.length===0&&(0,t.jsxDEV)(Qe,{description:a("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:a("No users.")},void 0,!1),v!==null&&v.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"us-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:a("id")},void 0,!1),(0,t.jsxDEV)(D,{children:a("email")},void 0,!1),(0,t.jsxDEV)(D,{children:a("name")},void 0,!1),(0,t.jsxDEV)(D,{children:a("role")},void 0,!1),(0,t.jsxDEV)(D,{children:a("status")},void 0,!1),(0,t.jsxDEV)(D,{children:a("verified")},void 0,!1),(0,t.jsxDEV)(D,{children:a("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":a("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:v.map(d=>(0,t.jsxDEV)(j,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsxDEV)(R,{className:"font-mono text-xs",children:d.id},void 0,!1),(0,t.jsxDEV)(R,{children:d.email??""},void 0,!1),(0,t.jsxDEV)(R,{children:d.name??""},void 0,!1),(0,t.jsxDEV)(R,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsxDEV)($,{variant:"secondary",children:d.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(R,{children:d.banned===!0?(0,t.jsxDEV)($,{variant:"destructive",children:a("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"success",children:a("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{children:d.emailVerified===!0?(0,t.jsxDEV)($,{variant:"success",children:a("yes")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:a("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(d.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`us-manage-${d.id}`,onClick:i(()=>{f(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Manage")},void 0,!1)},void 0,!1)]},d.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),h!==null&&(0,t.jsxDEV)(vt,{capabilities:x,onChanged:p,onClose:i(()=>{f(null)},"onClose"),user:h},void 0,!1),w&&(0,t.jsxDEV)(ot,{onClose:i(()=>{S(!1)},"onClose"),onCreated:p},void 0,!1)]},void 0,!0)},"UsersPanel");export{Rt as UsersPanel};
|
|
1
|
+
import{a as Oe,b as Je}from"./chunk-GVFODXW2.js";import{a as Ke}from"./chunk-3GXGLNKW.js";import{a as qe}from"./chunk-AHILM3ZP.js";import{a as We}from"./chunk-J6J54MBP.js";import"./chunk-L7SK4ZZD.js";import{a as Ge}from"./chunk-2K47A3P6.js";import{a as Ze}from"./chunk-4F72YCTU.js";import{a as De,b as Re,c as Pe,d as j,e as D,f as R}from"./chunk-GTM65MVX.js";import{a as we,e as Ce}from"./chunk-Y572GMZE.js";import{a as V}from"./chunk-JSEXCW5Q.js";import"./chunk-4QHKBC77.js";import{R as B}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as U}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as $}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as H}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as Qe}from"./chunk-TAD43CG5.js";import{d as Y,h as ze,k as Ae,l as Ue,p as Fe}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as i,e as je,f as _e,g as et,h as tt}from"./chunk-RRCPZMC2.js";var k=je(_e(),1);var Q=je(et(),1);var t=je(tt(),1);var st=i(()=>{let u=(0,Q.c)(3),{config:e,ready:a}=Oe(),l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},"useAuthCapabilities"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=i((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"isFieldFilled"),it=i((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){let l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},"coerceFieldValue"),ot=i(u=>{let e=(0,Q.c)(105),{onClose:a,onCreated:l}=u,c=H(),s=Y(),{config:r}=Oe(),{busy:o,error:n,run:f}=Je(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,F]=(0,k.useState)(""),[v,g]=(0,k.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[h,d]=(0,k.useState)(p),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{S(m.target.value)},"t2"),e[1]=A):A=e[1];let b=A,I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=i(m=>{C(m.target.value)},"t3"),e[2]=I):I=e[2];let M=I,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=i(m=>{F(m.target.value)},"t4"),e[3]=E):E=e[3];let Be=E,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=i(m=>{g(m.target.value)},"t5"),e[4]=Z):Z=e[4];let $e=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=i((m,P)=>{d(q=>({...q,[m]:P}))},"t6"),e[5]=G):G=e[5];let Ee=G,W;e[6]!==h?(W=i(m=>h[m.name]??(m.type==="boolean"?!1:""),"t7"),e[6]=h,e[7]=W):W=e[7];let T=W,J;if(e[8]!==r.userFields||e[9]!==T){let m;e[11]!==T?(m=i(P=>!P.required||at(P,T(P)),"t92"),e[11]=T,e[12]=m):m=e[12],J=r.userFields.every(m),e[8]=r.userFields,e[9]=T,e[10]=J}else J=e[10];let Ie=J,K;e[13]!==o||e[14]!==w||e[15]!==x||e[16]!==Ie?(K=!o&&w.trim()!==""&&x.trim()!==""&&Ie,e[13]=o,e[14]=w,e[15]=x,e[16]=Ie,e[17]=K):K=e[17];let Ve=K,X;e[18]!==r.userFields||e[19]!==T?(X=i(()=>{let m={};for(let P of r.userFields){let q=it(P,T(P));q!==void 0&&(m[P.name]=q.value)}return Object.keys(m).length===0?void 0:m},"t10"),e[18]=r.userFields,e[19]=T,e[20]=X):X=e[20];let Se=X,_;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==v||e[29]!==f?(_=i(()=>{f(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:v.trim()===""?void 0:v.trim()}),l(),a()})},"t11"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=v,e[29]=f,e[30]=_):_=e[30];let N=_,z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:L},void 0,!1),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==s?(ee=s("email"),e[37]=s,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsxDEV)(V,{htmlFor:"uc-email",children:ee},void 0,!1),e[39]=ee,e[40]=te):te=e[40];let se;e[41]!==w?(se=(0,t.jsxDEV)(B,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:w},void 0,!1),e[41]=w,e[42]=se):se=e[42];let le;e[43]!==te||e[44]!==se?(le=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[te,se]},void 0,!0),e[43]=te,e[44]=se,e[45]=le):le=e[45];let ae;e[46]!==s?(ae=s("name"),e[46]=s,e[47]=ae):ae=e[47];let ie;e[48]!==ae?(ie=(0,t.jsxDEV)(V,{htmlFor:"uc-name",children:ae},void 0,!1),e[48]=ae,e[49]=ie):ie=e[49];let oe;e[50]!==x?(oe=(0,t.jsxDEV)(B,{"data-testid":"uc-name",id:"uc-name",onChange:M,value:x},void 0,!1),e[50]=x,e[51]=oe):oe=e[51];let ne;e[52]!==ie||e[53]!==oe?(ne=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ie,oe]},void 0,!0),e[52]=ie,e[53]=oe,e[54]=ne):ne=e[54];let de;e[55]!==s?(de=s("Password (optional)"),e[55]=s,e[56]=de):de=e[56];let re;e[57]!==de?(re=(0,t.jsxDEV)(V,{htmlFor:"uc-password",children:de},void 0,!1),e[57]=de,e[58]=re):re=e[58];let ce;e[59]!==y?(ce=(0,t.jsxDEV)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y},void 0,!1),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==re||e[62]!==ce?(ue=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[re,ce]},void 0,!0),e[61]=re,e[62]=ce,e[63]=ue):ue=e[63];let fe;e[64]!==s?(fe=s("Role (optional)"),e[64]=s,e[65]=fe):fe=e[65];let ve;e[66]!==fe?(ve=(0,t.jsxDEV)(V,{htmlFor:"uc-role",children:fe},void 0,!1),e[66]=fe,e[67]=ve):ve=e[67];let me;e[68]!==v?(me=(0,t.jsxDEV)(B,{"data-testid":"uc-role",id:"uc-role",onChange:$e,value:v},void 0,!1),e[68]=v,e[69]=me):me=e[69];let he;e[70]!==ve||e[71]!==me?(he=(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[ve,me]},void 0,!0),e[70]=ve,e[71]=me,e[72]=he):he=e[72];let pe;e[73]!==r.userFields||e[74]!==T||e[75]!==s?(pe=r.userFields.length>0&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")},void 0,!1),r.userFields.map(m=>{let P=`uc-field-${m.name}`,q=m.required?"":` (${s("optional")})`;if(m.type==="boolean"){let Le=T(m)===!0;return(0,t.jsxDEV)("label",{className:"flex items-center gap-2",htmlFor:P,children:[(0,t.jsxDEV)(Ke,{checked:Le,"data-testid":P,id:P,onCheckedChange:i(Xe=>{Ee(m.name,Xe)},"onCheckedChange")},void 0,!1),(0,t.jsxDEV)("span",{className:"text-sm",children:[m.name,q]},void 0,!0)]},m.name,!0)}let Ye=T(m);return(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:P,children:[m.name,q]},void 0,!0),(0,t.jsxDEV)(B,{"data-testid":P,id:P,onChange:i(Le=>{Ee(m.name,Le.target.value)},"onChange"),type:lt[m.type],value:typeof Ye=="string"?Ye:""},void 0,!1)]},m.name,!0)})]},void 0,!0),e[73]=r.userFields,e[74]=T,e[75]=s,e[76]=pe):pe=e[76];let be;e[77]!==n?(be=n!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n},void 0,!1),e[77]=n,e[78]=be):be=e[78];let xe;e[79]!==s?(xe=s("Cancel"),e[79]=s,e[80]=xe):xe=e[80];let ye;e[81]!==a||e[82]!==xe?(ye=(0,t.jsxDEV)(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:xe},void 0,!1),e[81]=a,e[82]=xe,e[83]=ye):ye=e[83];let Me=!Ve,ge;e[84]!==o||e[85]!==s?(ge=s(o?"Creating\u2026":"Create"),e[84]=o,e[85]=s,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Me||e[89]!==ge?(Ne=(0,t.jsxDEV)(U,{"data-testid":"uc-submit",disabled:Me,onClick:N,size:"sm",type:"button",children:ge},void 0,!1),e[87]=N,e[88]=Me,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]},void 0,!0),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Te;return e[94]!==a||e[95]!==z||e[96]!==O||e[97]!==le||e[98]!==ne||e[99]!==ue||e[100]!==he||e[101]!==pe||e[102]!==be||e[103]!==ke?(Te=(0,t.jsxDEV)(qe,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,le,ne,ue,he,pe,be,ke]},void 0,!0),e[94]=a,e[95]=z,e[96]=O,e[97]=le,e[98]=ne,e[99]=ue,e[100]=he,e[101]=pe,e[102]=be,e[103]=ke,e[104]=Te):Te=e[104],Te},"UserCreateDialog"),He=i(u=>{let e=(0,Q.c)(2),{children:a}=u,l;return e[0]!==a?(l=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a},void 0,!1),e[0]=a,e[1]=l):l=e[1],l},"SectionHeading"),nt=i(u=>{let e=(0,Q.c)(29),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{let b=await r.listAuthSessions({limit:50,userId:c});f(b.rows)}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l?(y=i(b=>{l(()=>r.revokeAuthSession({sessionId:b}))},"t3"),e[7]=r,e[8]=l,e[9]=y):y=e[9];let F=y,v;e[10]!==o?(v=o("Sessions"),e[10]=o,e[11]=v):v=e[11];let g;e[12]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[12]=v,e[13]=g):g=e[13];let p;e[14]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w},void 0,!1),e[14]=w,e[15]=p):p=e[15];let h;e[16]!==n||e[17]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:o("No active sessions.")},void 0,!1),e[16]=n,e[17]=o,e[18]=h):h=e[18];let d;e[19]!==a||e[20]!==F||e[21]!==n||e[22]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("expires")},void 0,!1),(0,t.jsxDEV)(D,{children:o("ip")},void 0,!1),(0,t.jsxDEV)(D,{children:o("user agent")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>(0,t.jsxDEV)(j,{"data-testid":`ud-session-${b.id}`,children:[(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.expiresAt)},void 0,!1),(0,t.jsxDEV)(R,{children:b.ipAddress??""},void 0,!1),(0,t.jsxDEV)(R,{className:"max-w-40 truncate",children:b.userAgent??""},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-revoke-${b.id}`,disabled:a,onClick:i(()=>{F(b.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},b.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=a,e[20]=F,e[21]=n,e[22]=o,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==p||e[26]!==h||e[27]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,p,h,d]},void 0,!0),e[24]=g,e[25]=p,e[26]=h,e[27]=d,e[28]=A):A=e[28],A},"UserSessionsPanel"),dt=i(u=>{let e=(0,Q.c)(30),{busy:a,runAction:l,userId:c,version:s}=u,r=H(),o=Y(),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==r||e[1]!==c?(x=i(()=>{Ue((async()=>{S(null);try{f(await r.listAuthAccounts({userId:c}))}catch(b){let I=b;f(null),S(ze(I))}})())},"t1"),e[0]=r,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==r||e[4]!==c||e[5]!==s?(C=[r,c,s],e[3]=r,e[4]=c,e[5]=s,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==r||e[8]!==l||e[9]!==c?(y=i(b=>{l(()=>r.unlinkAuthAccount({accountId:b,userId:c}))},"t3"),e[7]=r,e[8]=l,e[9]=c,e[10]=y):y=e[10];let F=y,v;e[11]!==o?(v=o("Linked accounts"),e[11]=o,e[12]=v):v=e[12];let g;e[13]!==v?(g=(0,t.jsxDEV)(He,{children:v},void 0,!1),e[13]=v,e[14]=g):g=e[14];let p;e[15]!==w?(p=w!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:w},void 0,!1),e[15]=w,e[16]=p):p=e[16];let h;e[17]!==n||e[18]!==o?(h=n!==null&&n.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No linked accounts.")},void 0,!1),e[17]=n,e[18]=o,e[19]=h):h=e[19];let d;e[20]!==n||e[21]!==a||e[22]!==F||e[23]!==o?(d=n!==null&&n.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:o("provider")},void 0,!1),(0,t.jsxDEV)(D,{children:o("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:n.map(b=>{let I=Ae(b.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-account-${I}`,children:[(0,t.jsxDEV)(R,{children:Ae(b.providerId)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(b.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:i(()=>{F(I)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Unlink")},void 0,!1)},void 0,!1)]},I,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=n,e[21]=a,e[22]=F,e[23]=o,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==p||e[27]!==h||e[28]!==d?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,p,h,d]},void 0,!0),e[25]=g,e[26]=p,e[27]=h,e[28]=d,e[29]=A):A=e[29],A},"UserAccountsPanel"),rt=i(u=>{let e=(0,Q.c)(40),{busy:a,capabilities:l,runAction:c,userId:s,version:r}=u,o=H(),n=Y(),[f,w]=(0,k.useState)(null),S;e[0]!==l.passkey||e[1]!==o||e[2]!==s?(S=i(()=>{l.passkey&&Ue((async()=>{try{w(await o.listAuthPasskeys({userId:s}))}catch{w(null)}})())},"t1"),e[0]=l.passkey,e[1]=o,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==o||e[6]!==s||e[7]!==r?(x=[l.passkey,o,s,r],e[4]=l.passkey,e[5]=o,e[6]=s,e[7]=r,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==o||e[10]!==c||e[11]!==s?(C=i(()=>{c(()=>o.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=o,e[10]=c,e[11]=s,e[12]=C):C=e[12];let y=C,F;e[13]!==o||e[14]!==c?(F=i(I=>{c(()=>o.deleteAuthPasskey({passkeyId:I}))},"t4"),e[13]=o,e[14]=c,e[15]=F):F=e[15];let v=F,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let p;e[18]!==g?(p=(0,t.jsxDEV)(He,{children:g},void 0,!1),e[18]=g,e[19]=p):p=e[19];let h;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==n?(h=l.twoFactor&&(0,t.jsxDEV)(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")},void 0,!1),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=n,e[24]=h):h=e[24];let d;e[25]!==l.passkey||e[26]!==f||e[27]!==n?(d=l.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")},void 0,!1),e[25]=l.passkey,e[26]=f,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==a||e[30]!==l.passkey||e[31]!==v||e[32]!==f||e[33]!==n?(A=l.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:n("name")},void 0,!1),(0,t.jsxDEV)(D,{children:n("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":n("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:f.map(I=>{let M=Ae(I.id);return(0,t.jsxDEV)(j,{"data-testid":`ud-passkey-${M}`,children:[(0,t.jsxDEV)(R,{children:Ae(I.name)||M},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`ud-delete-passkey-${M}`,disabled:a,onClick:i(()=>{v(M)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")},void 0,!1)},void 0,!1)]},M,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=a,e[30]=l.passkey,e[31]=v,e[32]=f,e[33]=n,e[34]=A):A=e[34];let b;return e[35]!==p||e[36]!==h||e[37]!==d||e[38]!==A?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,h,d,A]},void 0,!0),e[35]=p,e[36]=h,e[37]=d,e[38]=A,e[39]=b):b=e[39],b},"UserSecurityPanel"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=i((u,e)=>typeof e=="number"&&ct.test(u)?Fe(e):Ae(e),"formatField"),vt=i(({capabilities:u,onChanged:e,onClose:a,user:l})=>{let c=H(),s=Y(),r=l.banned===!0,[o,n]=(0,k.useState)(null),[f,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof l.role=="string"?l.role:""),[F,v]=(0,k.useState)(""),[g,p]=(0,k.useState)(""),[h,d]=(0,k.useState)(""),[A,b]=(0,k.useState)(null),[I,M]=(0,k.useState)(!1),E=i((N,z)=>{Ue((async()=>{w(!0),n(null);try{let L=await N();z?.refresh!==!1&&(x(O=>O+1),e()),z?.onResult?.(L)}catch(L){n(ze(L))}finally{w(!1)}})())},"runAction"),Be=i(N=>{y(N.target.value)},"onRoleInputChange"),Z=i(N=>{v(N.target.value)},"onBanReasonChange"),$e=i(N=>{p(N.target.value)},"onBanDaysChange"),G=i(N=>{d(N.target.value)},"onNewPasswordChange"),Ee=i(()=>{let N=C.trim();N!==""&&E(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},"onSetRole"),W=i(()=>{let N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;E(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:F.trim()===""?void 0:F.trim(),userId:l.id})})},"onBan"),T=i(()=>{E(async()=>{await c.unbanAuthUser({userId:l.id})})},"onUnban"),J=i(()=>{E(async()=>{await c.setAuthUserPassword({newPassword:h,userId:l.id}),d("")})},"onSetPassword"),Ie=i(()=>{E(()=>c.impersonateAuthUser({userId:l.id}),{onResult:i(N=>{b(N.token)},"onResult"),refresh:!1})},"onImpersonate"),K=i(()=>{E(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},"onRevokeAll"),Ve=i(()=>{E(async()=>{await c.removeAuthUser({userId:l.id}),a()})},"onDelete"),X=i(()=>{M(!0)},"onConfirmDelete"),Se=i(()=>{M(!1)},"onCancelDelete"),_=Object.entries(l).filter(([N])=>!ut.has(N));return(0,t.jsxDEV)(qe,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsxDEV)($,{variant:"secondary",children:l.role},void 0,!1),r?(0,t.jsxDEV)($,{variant:"destructive",children:s("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("Active")},void 0,!1),l.emailVerified===!0?(0,t.jsxDEV)($,{variant:"secondary",children:s("verified")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),o!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:o},void 0,!1),u.admin&&(0,t.jsxDEV)(we,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-role",disabled:f||C.trim()==="",onClick:Ee,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),r?(0,t.jsxDEV)(U,{"data-testid":"ud-unban",disabled:f,onClick:T,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:F},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:$e,type:"number",value:g},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-ban",disabled:f,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:h},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(U,{"data-testid":"ud-set-password",disabled:f||h==="",onClick:J,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(U,{"data-testid":"ud-impersonate",disabled:f,onClick:Ie,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-revoke-all",disabled:f,onClick:K,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),I?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(U,{"data-testid":"ud-delete-confirm",disabled:f,onClick:Ve,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(U,{"data-testid":"ud-delete",disabled:f,onClick:X,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(V,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,t.jsxDEV)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(nt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),u.accounts&&(0,t.jsxDEV)(dt,{busy:f,runAction:E,userId:l.id,version:S},void 0,!1),(u.twoFactor||u.passkey)&&(0,t.jsxDEV)(rt,{busy:f,capabilities:u,runAction:E,userId:l.id,version:S},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:_.map(([N,z])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(N,z)},void 0,!1)]},N,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),mt=50,Rt=i(({pageSize:u=mt}={})=>{let e=H(),a=Y(),[l,c]=(0,k.useState)(""),[s,r]=(0,k.useState)(""),o=Ge(l),[n,f]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=o.trim(),y=s.trim(),F=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),v=F.data?.rows??null,g=F.error,p=i(()=>{F.refetch()},"reloadUsers");We(()=>{F.refetch()},!0);let h=n===null?null:v?.find(d=>d.id===n)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:i(d=>{c(d.target.value)},"onChange"),placeholder:a("Search by email or name\u2026"),value:l},void 0,!1),(0,t.jsxDEV)(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i(d=>{r(d.target.value)},"onChange"),placeholder:a("Filter by role"),value:s},void 0,!1),(0,t.jsxDEV)(U,{"data-testid":"us-new",onClick:i(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:a("New user")},void 0,!1)]},void 0,!0),g!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g},void 0,!1),v!==null&&v.length===0&&(0,t.jsxDEV)(Qe,{description:a("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:a("No users.")},void 0,!1),v!==null&&v.length>0&&(0,t.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Ce,{className:"px-0",children:(0,t.jsxDEV)(De,{"data-testid":"us-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(D,{children:a("id")},void 0,!1),(0,t.jsxDEV)(D,{children:a("email")},void 0,!1),(0,t.jsxDEV)(D,{children:a("name")},void 0,!1),(0,t.jsxDEV)(D,{children:a("role")},void 0,!1),(0,t.jsxDEV)(D,{children:a("status")},void 0,!1),(0,t.jsxDEV)(D,{children:a("verified")},void 0,!1),(0,t.jsxDEV)(D,{children:a("created")},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":a("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Pe,{children:v.map(d=>(0,t.jsxDEV)(j,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsxDEV)(R,{className:"font-mono text-xs",children:d.id},void 0,!1),(0,t.jsxDEV)(R,{children:d.email??""},void 0,!1),(0,t.jsxDEV)(R,{children:d.name??""},void 0,!1),(0,t.jsxDEV)(R,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsxDEV)($,{variant:"secondary",children:d.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(R,{children:d.banned===!0?(0,t.jsxDEV)($,{variant:"destructive",children:a("Banned")},void 0,!1):(0,t.jsxDEV)($,{variant:"success",children:a("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{children:d.emailVerified===!0?(0,t.jsxDEV)($,{variant:"success",children:a("yes")},void 0,!1):(0,t.jsxDEV)($,{variant:"outline",children:a("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(R,{className:"text-muted-foreground tabular-nums",children:Fe(d.createdAt)},void 0,!1),(0,t.jsxDEV)(R,{children:(0,t.jsxDEV)(U,{"data-testid":`us-manage-${d.id}`,onClick:i(()=>{f(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Manage")},void 0,!1)},void 0,!1)]},d.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),h!==null&&(0,t.jsxDEV)(vt,{capabilities:x,onChanged:p,onClose:i(()=>{f(null)},"onClose"),user:h},void 0,!1),w&&(0,t.jsxDEV)(ot,{onClose:i(()=>{S(!1)},"onClose"),onCreated:p},void 0,!1)]},void 0,!0)},"UsersPanel");export{Rt as UsersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-FQUNSQLG.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-D73WYMRU.js";import"./chunk-XNJNSCLM.js";import{b as G}from"./chunk-4F72YCTU.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as z,e as Q}from"./chunk-
|
|
1
|
+
import{a as le}from"./chunk-FQUNSQLG.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-D73WYMRU.js";import"./chunk-XNJNSCLM.js";import{b as G}from"./chunk-4F72YCTU.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as z,e as Q}from"./chunk-Y572GMZE.js";import{a as X}from"./chunk-FDWXYXOM.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-MHGJUKCZ.js";import"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as U}from"./chunk-TAD43CG5.js";import{d as H,p as W}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _={assignIssue:"__lunora_admin__:assignIssue",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAuditLog:"__lunora_admin__:getAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",listFlags:"__lunora_admin__:listFlags",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{_ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Y}from"./chunk-N7SVJOHN.js";import{a as ne}from"./chunk-QVIPA6UJ.js";import{b as le}from"./chunk-VXM5H542.js";import{a as ie}from"./chunk-IYHPYY4A.js";import{a as ae}from"./chunk-FQUNSQLG.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as oe}from"./chunk-D73WYMRU.js";import"./chunk-XNJNSCLM.js";import{b as K}from"./chunk-4F72YCTU.js";import{a as re}from"./chunk-FDWXYXOM.js";import{b as te}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as D}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as U}from"./chunk-MHGJUKCZ.js";import"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ee}from"./chunk-TAD43CG5.js";import{d as Z}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as i,e as z,f as qe,g as Pe,h as Oe,j as I}from"./chunk-RRCPZMC2.js";var T=z(Pe(),1);var u=z(qe(),1);var r=z(Oe(),1);var Me=["trace","debug","log","info","warn","error","fatal"],G=400,Fe=36,Ae={height:G,overflow:"auto"},me={left:0,position:"absolute",top:0,width:"100%"},_e={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},Ve={error:"destructive",ok:"secondary"},$e=i(a=>{let e=(0,T.c)(26),{entry:t,index:l,measureRef:n,start:o}=a,d=`translateY(${String(o)}px)`,g;e[0]!==d?(g={...me,transform:d},e[0]=d,e[1]=g):g=e[1];let m=g,f;e[2]!==t.fields?(f=Y(t.fields),e[2]=t.fields,e[3]=f):f=e[3];let c=f,w;e[4]!==t.timestamp?(w=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=w):w=e[5];let h;e[6]!==w?(h=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:w},void 0,!1),e[6]=w,e[7]=h):h=e[7];let N=_e[t.level],v;e[8]!==t.level||e[9]!==N?(v=(0,r.jsxDEV)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(D,{variant:N,children:t.level},void 0,!1)},void 0,!1),e[8]=t.level,e[9]=N,e[10]=v):v=e[10];let b=t.functionPath??"\u2014",y;e[11]!==b?(y=(0,r.jsxDEV)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b},void 0,!1),e[11]=b,e[12]=y):y=e[12];let p;e[13]!==c?(p=c===""?null:(0,r.jsxDEV)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c},void 0,!1),e[13]=c,e[14]=p):p=e[14];let x;e[15]!==t.message||e[16]!==p?(x=(0,r.jsxDEV)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,p]},void 0,!0),e[15]=t.message,e[16]=p,e[17]=x):x=e[17];let L;return e[18]!==l||e[19]!==n||e[20]!==m||e[21]!==x||e[22]!==h||e[23]!==v||e[24]!==y?(L=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-row",ref:n,role:"row",style:m,children:[h,v,y,x]},void 0,!0),e[18]=l,e[19]=n,e[20]=m,e[21]=x,e[22]=h,e[23]=v,e[24]=y,e[25]=L):L=e[25],L},"LogRow"),de=i(a=>a.length===0?"\u2014":a.join(", "),"tablesLabel"),Be=i(a=>{let e=(0,T.c)(37),{entry:t,index:l,measureRef:n,start:o}=a,d=`translateY(${String(o)}px)`,g;e[0]!==d?(g={...me,transform:d},e[0]=d,e[1]=g):g=e[1];let m=g,f;e[2]!==t.ts?(f=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=f):f=e[3];let c;e[4]!==f?(c=(0,r.jsxDEV)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:f},void 0,!1),e[4]=f,e[5]=c):c=e[5];let w=Ve[t.outcome],h;e[6]!==t.outcome||e[7]!==w?(h=(0,r.jsxDEV)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(D,{variant:w,children:t.outcome},void 0,!1)},void 0,!1),e[6]=t.outcome,e[7]=w,e[8]=h):h=e[8];let N;e[9]!==t.functionPath?(N=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=N):N=e[10];let v=t.shardKey??"\u2014",b;e[11]!==v?(b=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:v},void 0,!1),e[11]=v,e[12]=b):b=e[12];let y=t.userId??"\u2014",p;e[13]!==y?(p=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:y},void 0,!1),e[13]=y,e[14]=p):p=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let L=`${String(x)}ms`,S;e[17]!==L?(S=(0,r.jsxDEV)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:L},void 0,!1),e[17]=L,e[18]=S):S=e[18];let C;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(C=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${de(t.tablesRead)} \xB7 w:${de(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=C):C=e[23];let k;e[24]!==C?(k=(0,r.jsxDEV)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:C},void 0,!1),e[24]=C,e[25]=k):k=e[25];let E;return e[26]!==l||e[27]!==n||e[28]!==m||e[29]!==p||e[30]!==S||e[31]!==k||e[32]!==c||e[33]!==h||e[34]!==N||e[35]!==b?(E=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-req-row",ref:n,role:"row",style:m,children:[c,h,N,b,p,S,k]},void 0,!0),e[26]=l,e[27]=n,e[28]=m,e[29]=p,e[30]=S,e[31]=k,e[32]=c,e[33]=h,e[34]=N,e[35]=b,e[36]=E):E=e[36],E},"RequestRow"),ce=i(a=>{let{entries:e}=a??{};return Array.isArray(e)?e:[]},"entriesOf"),ze=i(a=>{let e={};return a.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=a.functionPathPrefix.trim()),a.userId.trim()!==""&&(e.userId=a.userId.trim()),a.tableTouched.trim()!==""&&(e.tableTouched=a.tableTouched.trim()),(a.outcome==="ok"||a.outcome==="error")&&(e.outcome=a.outcome),e},"buildRequestQuery"),fe=Me,De={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},Ke=i((a,e)=>{let t=e.search.trim().toLowerCase(),l=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-De[e.range];return a.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<n||l!==""&&!(o.functionPath??"").toLowerCase().includes(l)?!1:t===""||o.message.toLowerCase().includes(t)||Y(o.fields).toLowerCase().includes(t))},"filterLogs"),Ue="\u2014",Ye=i(a=>{let e=new Map,t=new Map;for(let o of a){e.set(o.level,(e.get(o.level)??0)+1);let d=o.functionPath??Ue;t.set(d,(t.get(d)??0)+1)}let l=fe.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),n=[...t.entries()].map(([o,d])=>({count:d,key:o})).toSorted((o,d)=>d.count===o.count?o.key.localeCompare(d.key):d.count-o.count);return{byLevel:l,byPath:n,total:a.length}},"summarizeLogs"),Ge=i(a=>{let e=(0,T.c)(11),{level:t,onToggle:l,selected:n}=a,o;e[0]!==t||e[1]!==l?(o=i(()=>{l(t)},"t1"),e[0]=t,e[1]=l,e[2]=o):o=e[2];let d=o,g=n?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==g?(m=I("rounded-md border px-2 py-1 text-xs",g),e[3]=g,e[4]=m):m=e[4];let f=`logs-level-${t}`,c;return e[5]!==t||e[6]!==d||e[7]!==n||e[8]!==m||e[9]!==f?(c=(0,r.jsxDEV)("button",{"aria-pressed":n,className:m,"data-testid":f,onClick:d,type:"button",children:t},void 0,!1),e[5]=t,e[6]=d,e[7]=n,e[8]=m,e[9]=f,e[10]=c):c=e[10],c},"LevelToggle"),ue=i(a=>{let e=(0,T.c)(7),{bucket:t}=a,l;e[0]!==t.key?(l=(0,r.jsxDEV)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key},void 0,!1),e[0]=t.key,e[1]=l):l=e[1];let n;e[2]!==t.count?(n=(0,r.jsxDEV)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count},void 0,!1),e[2]=t.count,e[3]=n):n=e[3];let o;return e[4]!==l||e[5]!==n?(o=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[l,n]},void 0,!0),e[4]=l,e[5]=n,e[6]=o):o=e[6],o},"SummaryBucketRow"),ct=i(({initialShardKey:a})=>{let e=Z(),[t,l]=(0,u.useState)("requests"),[n,o]=(0,u.useState)(a??""),[d,g]=(0,u.useState)(""),[m,f]=(0,u.useState)(()=>new Set),[c,w]=(0,u.useState)(""),[h,N]=(0,u.useState)("all"),[v,b]=(0,u.useState)(!1),[y,p]=(0,u.useState)(""),[x,L]=(0,u.useState)(""),[S,C]=(0,u.useState)(""),[k,E]=(0,u.useState)("all"),q=se(n.trim(),400),he=ze({functionPathPrefix:y,outcome:k,tableTouched:S,userId:x}),Q=K(U.getRequestLog,he,{enabled:t==="requests",live:!0,shardKey:q}),W=K(U.getLogs,{},{enabled:t==="errors",live:!0,shardKey:q}),F=t==="requests"?Q:W,{error:H,errorSource:ge,isLoading:j,liveError:ve}=F,pe=ce(W.data),J=ce(Q.data);(0,u.useEffect)(()=>{F.data!==void 0&&te(q)},[F.data,q]);let A=Ke(pe,{levels:m,now:Date.now(),path:c,range:h,search:d}),_=Ye(A),V=t==="requests"?J.length:A.length,$=t==="errors"&&v,P=(0,u.useMemo)(()=>H!==null?"error":V===0?j?$?"summary":"list":"empty":$?"summary":"list",[V,j,H,$]),X=(0,u.useRef)(null),O=le({count:V,estimateSize:i(()=>Fe,"estimateSize"),getScrollElement:i(()=>X.current,"getScrollElement"),initialRect:{height:G,width:800},observeElementRect:i((s,B)=>ne(s,B,G),"observeElementRect"),overscan:8}),be=O.getVirtualItems(),xe={height:O.getTotalSize(),position:"relative",width:"100%"},ye=i(s=>{g(s.target.value)},"onSearchChange"),we=i(s=>{f(B=>{let M=new Set(B);return M.has(s)?M.delete(s):M.add(s),M})},"toggleLevel"),Ne=i(s=>{w(s.target.value)},"onLogPathChange"),Le=i(s=>{N(s.target.value)},"onTimeRangeChange"),Se=i(()=>{b(s=>!s)},"toggleSummary"),ke=i(s=>{p(s.target.value)},"onPathChange"),Ce=i(s=>{L(s.target.value)},"onUserChange"),Ee=i(s=>{C(s.target.value)},"onTableChange"),Re=i(s=>{E(s.target.value)},"onOutcomeChange"),Ie=i(()=>{l("requests"),b(!1)},"showRequests"),Te=i(()=>{l("errors"),b(!1)},"showErrors");return(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,r.jsxDEV)("button",{"aria-selected":t==="requests",className:I("px-3 py-1 text-sm",t==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:Ie,role:"tab",type:"button",children:e("Requests")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="errors",className:I("px-3 py-1 text-sm",t==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:Te,role:"tab",type:"button",children:e("Errors")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(re,{onChange:o,testId:"lg-shard-input",value:n},void 0,!1),(0,r.jsxDEV)(ae,{message:ve,prefix:"lg"},void 0,!1),(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:ie,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")},void 0,!1)]},void 0,!0),t==="errors"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(R,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:ye,placeholder:e("search message"),value:d},void 0,!1),(0,r.jsxDEV)(R,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Ne,placeholder:e("filter path"),value:c},void 0,!1),(0,r.jsxDEV)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:fe.map(s=>(0,r.jsxDEV)(Ge,{level:s,onToggle:we,selected:m.has(s)},s,!1))},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Time range"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:Le,value:h,children:[(0,r.jsxDEV)("option",{value:"all",children:e("All time")},void 0,!1),(0,r.jsxDEV)("option",{value:"5m",children:e("Last 5m")},void 0,!1),(0,r.jsxDEV)("option",{value:"15m",children:e("Last 15m")},void 0,!1),(0,r.jsxDEV)("option",{value:"1h",children:e("Last hour")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("button",{"aria-pressed":v,className:I("h-8 rounded-md border px-3 text-sm",v?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:Se,type:"button",children:e(v?"List":"Summary")},void 0,!1)]},void 0,!0),t==="requests"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(R,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:ke,placeholder:e("file:function"),value:y},void 0,!1),(0,r.jsxDEV)(R,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:Ce,placeholder:e("userId"),value:x},void 0,!1),(0,r.jsxDEV)(R,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:Ee,placeholder:e("table"),value:S},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Outcome filter"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:Re,value:k,children:[(0,r.jsxDEV)("option",{value:"all",children:e("all")},void 0,!1),(0,r.jsxDEV)("option",{value:"ok",children:e("ok")},void 0,!1),(0,r.jsxDEV)("option",{value:"error",children:e("error")},void 0,!1)]},void 0,!0)]},void 0,!0),P==="error"&&(0,r.jsxDEV)(oe,{error:ge,testId:"lg-error"},void 0,!1),P==="empty"&&(0,r.jsxDEV)(ee,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M4 5h16M4 12h16M4 19h10"},void 0,!1)},void 0,!1),testId:"lg-empty",title:e("No logs.")},void 0,!1),P==="summary"&&(0,r.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,r.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:_.total})},void 0,!1),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:_.byLevel.map(s=>(0,r.jsxDEV)(ue,{bucket:s},s.key,!1))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:_.byPath.map(s=>(0,r.jsxDEV)(ue,{bucket:s},s.key,!1))},void 0,!1)]},void 0,!0)]},void 0,!0),P==="list"&&(0,r.jsxDEV)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:X,style:Ae,children:(0,r.jsxDEV)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:xe,children:be.map(s=>t==="requests"?(0,r.jsxDEV)(Be,{entry:J[s.index],index:s.index,measureRef:O.measureElement,start:s.start},s.key,!1):(0,r.jsxDEV)($e,{entry:A[s.index],index:s.index,measureRef:O.measureElement,start:s.start},s.key,!1))},void 0,!1)},void 0,!1)]},void 0,!0)},"LogsPanel");export{ct as LogsPanel,Ke as filterLogs,Ye as summarizeLogs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-RRCPZMC2.js";var o=t(r=>{if(typeof r=="string")return r;try{return JSON.stringify(r)??String(r)}catch{return String(r)}},"stringifyFieldValue"),e=t(r=>typeof r!="object"||r===null||Array.isArray(r)?"":Object.entries(r).map(([n,i])=>`${n}=${o(i)}`).join(" "),"formatLogFields");export{e as a};
|