@llmops/app 0.1.3 → 0.1.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/.vite/manifest.json +261 -167
  2. package/dist/assets/Form-B1Xes2HX.js +1 -0
  3. package/dist/assets/_environment-BHroMRce.js +1 -0
  4. package/dist/assets/_settings-B87EsM9n.css +1 -0
  5. package/dist/assets/_settings-BK4LOT_O.js +1 -0
  6. package/dist/assets/{_tabs-f2ku-dN-.js → _tabs-DWvdcnbx.js} +1 -1
  7. package/dist/assets/{_tabs-DqcWXw0k.js → _tabs-spsrS7rN.js} +1 -1
  8. package/dist/assets/{_variant-D5crm4Ds.js → _variant-i8-2ZjCg.js} +1 -1
  9. package/dist/assets/{_variants-B0pPx_AW.js → _variants-DiPU43aS.js} +1 -1
  10. package/dist/assets/area.css-d_0zeUpe.js +1 -0
  11. package/dist/assets/{button-DO9sNXVT.js → button-D46pme1q.js} +1 -1
  12. package/dist/assets/check-Cp187nGx.js +1 -0
  13. package/dist/assets/{chevron-right-C4hlJkjh.js → chevron-right-CS1Toe_9.js} +1 -1
  14. package/dist/assets/configs-BWQEZkYp.js +1 -0
  15. package/dist/assets/{copy-8RnLMadS.js → copy-BQ-62Ur4.js} +1 -1
  16. package/dist/assets/environments-CxEwSvmp.js +1 -0
  17. package/dist/assets/formatDistance-CEmiEHX5.js +1 -0
  18. package/dist/assets/index-BEbVINNT.js +1 -0
  19. package/dist/assets/{index-Cr1VB5iR.js → index-CadPnEMv.js} +1 -1
  20. package/dist/assets/index-D3G5uHLZ.js +1 -0
  21. package/dist/assets/{index-CzBp_9q8.css → index-DnQMGf2R.css} +1 -1
  22. package/dist/assets/index-KuidudiV.js +1 -0
  23. package/dist/assets/index-nHWjhrFW.js +16 -0
  24. package/dist/assets/index.esm-DJMnkOur.js +1 -0
  25. package/dist/assets/info-box-JXSyJ9E4.css +1 -0
  26. package/dist/assets/info-box.css-DyjK40Ax.js +1 -0
  27. package/dist/assets/new-config-state.css-zldOiAQS.js +1 -0
  28. package/dist/assets/{plus-BNVL12hi.js → plus-5oc_diIr.js} +1 -1
  29. package/dist/assets/route-CYSM3PkP.js +1 -0
  30. package/dist/assets/{route-DCt595Gm.js → route-CpTvuTp9.js} +1 -1
  31. package/dist/assets/{route-D_ra2qKi.js → route-TG1bSyy8.js} +1 -1
  32. package/dist/assets/{secrets-DoNAc8Mo.js → secrets-dM6OVjcE.js} +1 -1
  33. package/dist/assets/{settings-CdtZpv34.js → settings-C74FVCr5.js} +1 -1
  34. package/dist/assets/{settings-C9bl_jrl.js → settings-D4fugFLx.js} +1 -1
  35. package/dist/assets/{table-6j4oSY37.js → table-SKwX9qUc.js} +1 -1
  36. package/dist/assets/{tabs.css-BDs200M3.js → tabs.css-BvfbDFW8.js} +1 -1
  37. package/dist/assets/{targeting-BOZ8PRbu.js → targeting-rpE0HiKJ.js} +1 -1
  38. package/dist/assets/{update-or-create-name-B72U1gm0.js → update-or-create-name-Cd1zyalO.js} +2 -2
  39. package/dist/assets/{useButton-CAZmhHhe.js → useButton-DfUAk02P.js} +1 -1
  40. package/dist/assets/useConfigList-CN-eUdau.js +1 -0
  41. package/dist/assets/{useConfigVariants-DoAiT4HN.js → useConfigVariants-CIAilMey.js} +1 -1
  42. package/dist/assets/useEnvironments-D798jdLi.js +1 -0
  43. package/dist/assets/{useMutation-B5RT6zjK.js → useMutation-ppBqjQps.js} +1 -1
  44. package/dist/assets/{useRole-BBEFofTs.js → useRole-D2HhbdS4.js} +1 -1
  45. package/dist/assets/useSetTargeting-C3RG0vdV.js +1 -0
  46. package/dist/assets/useSetTargeting-CQWutQzN.css +1 -0
  47. package/dist/assets/useTargetingRules-Bi-hIPWR.js +1 -0
  48. package/dist/assets/useValueChanged-2Bqw2vWT.js +12 -0
  49. package/dist/assets/user-profile-CvRPKkVY.js +1 -0
  50. package/dist/assets/variants-CZaBWam0.js +1 -0
  51. package/dist/assets/variants.css-C4fJhzPe.js +1 -0
  52. package/dist/assets/workspace-general-ET4CEZQV.css +1 -0
  53. package/dist/assets/workspace-general-umhuExNi.js +1 -0
  54. package/dist/index.cjs +42 -15
  55. package/dist/index.mjs +42 -15
  56. package/package.json +3 -3
  57. package/dist/assets/Form-CR9iKNJV.js +0 -1
  58. package/dist/assets/_environment-DUWlgl3c.js +0 -1
  59. package/dist/assets/check-DqI6mrEe.js +0 -1
  60. package/dist/assets/configs-D7rrXGVw.js +0 -1
  61. package/dist/assets/environments-CQ_2r1iM.js +0 -1
  62. package/dist/assets/formatDistance-fxR--uRk.js +0 -1
  63. package/dist/assets/index-8q56yhPq.js +0 -16
  64. package/dist/assets/index-CAAXzvj0.js +0 -1
  65. package/dist/assets/index-Dd3OazzV.js +0 -1
  66. package/dist/assets/index.esm-Du3lv78y.js +0 -1
  67. package/dist/assets/new-config-state.css-BkrgBLVT.js +0 -1
  68. package/dist/assets/useConfigList-DVy2f9Ka.js +0 -1
  69. package/dist/assets/useEnvironments-B9zdgoPZ.js +0 -1
  70. package/dist/assets/useSetTargeting-DIyb-zyZ.css +0 -1
  71. package/dist/assets/useSetTargeting-x-2mNQAV.js +0 -1
  72. package/dist/assets/useTargetingRules-DWyIfOXq.js +0 -1
  73. package/dist/assets/useValueChanged-DLCw33hO.js +0 -12
  74. package/dist/assets/variants-CLcQicJ2.js +0 -1
  75. package/dist/assets/variants.css-CRQAZpOT.js +0 -1
  76. /package/dist/assets/{formatDistance-DoOD1Loz.css → area-DoOD1Loz.css} +0 -0
@@ -0,0 +1 @@
1
+ import{r as s,X as ce,a9 as Dt,aE as ne,j,bq as sn,br as be,bs as It,bt as $e,bu as Qe,bv as In,bo as hr,bc as tt,aD as br,aW as xr,bw as Ir,bd as yn,bx as yr,a2 as qe,Y as te,aL as Nt,aS as Cn,a1 as xt,aK as Cr,by as vr,bz as Rr,aG as Sn,aQ as it,a3 as rt,a6 as D,bA as Ie,al as nn,aJ as Vn,ae as On,bg as Er,bB as Pr,bC as y,bD as an,am as mt,bE as We,bf as nt,aq as wr,an as je,ag as Ft,bF as Mr,$ as Sr,a0 as Vr,ar as Or,bj as kr,aa as Be,b3 as kn,aV as Ar,aN as Tr,bG as vn,aM as Lr,bH as Nr,ak as Dr,ac as ln,bI as Rn,ah as Fr,av as jr,ax as _r,ab as An,au as Hr,l as qr,a as lt,e as Vt,bJ as Br,bK as Kr,bL as zr,bM as Ur,bN as Gr,bO as Wr,bP as $r,bQ as Qr,bR as Yr,bS as Jr,bT as Xr,bU as Zr,bV as eo,bW as En,bX as to,bY as no,bZ as ro,b_ as oo,b$ as so,c0 as io,c1 as ao,c2 as lo,c3 as uo,c4 as co,t as fo,y as po,i as Tn,g as mo}from"./index-nHWjhrFW.js";import{u as un}from"./useButton-DfUAk02P.js";import{f as go,e as Ln,u as ho,c as Ot,b as Nn,a as bo,I as xo,i as Io,F as yo}from"./useValueChanged-2Bqw2vWT.js";import{u as Co}from"./useMutation-ppBqjQps.js";import{g as vo}from"./useTargetingRules-Bi-hIPWR.js";function Zt({controlled:e,default:t,name:n,state:r="value"}){const{current:f}=s.useRef(e!==void 0),[a,p]=s.useState(t),l=f?e:a,i=s.useCallback(c=>{f||p(c)},[]);return[l,i]}const Dn=s.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ro(){return s.useContext(Dn)}function Eo(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:f}=e,a=ce(f),p=s.useRef(0),l=Dt(wo).current,i=Dt(Po).current,[c,g]=s.useState(0),u=s.useRef(c),P=ce((d,o)=>{i.set(d,o??null),u.current+=1,g(u.current)}),h=ce(d=>{i.delete(d),u.current+=1,g(u.current)}),O=s.useMemo(()=>{const d=new Map;return Array.from(i.keys()).filter(M=>M.isConnected).sort(Mo).forEach((M,I)=>{const w=i.get(M)??{};d.set(M,{...w,index:I})}),d},[i,c]);ne(()=>{if(typeof MutationObserver!="function"||O.size===0)return;const d=new MutationObserver(o=>{const M=new Set,I=w=>M.has(w)?M.delete(w):M.add(w);o.forEach(w=>{w.removedNodes.forEach(I),w.addedNodes.forEach(I)}),M.size===0&&(u.current+=1,g(u.current))});return O.forEach((o,M)=>{M.parentElement&&d.observe(M.parentElement,{childList:!0})}),()=>{d.disconnect()}},[O]),ne(()=>{u.current===c&&(n.current.length!==O.size&&(n.current.length=O.size),r&&r.current.length!==O.size&&(r.current.length=O.size),p.current=O.size),a(O)},[a,O,n,r,c]),ne(()=>()=>{n.current=[]},[n]),ne(()=>()=>{r&&(r.current=[])},[r]);const m=ce(d=>(l.add(d),()=>{l.delete(d)}));ne(()=>{l.forEach(d=>d(O))},[l,O]);const x=s.useMemo(()=>({register:P,unregister:h,subscribeMapChange:m,elementsRef:n,labelsRef:r,nextIndexRef:p}),[P,h,m,n,r,p]);return j.jsx(Dn.Provider,{value:x,children:t})}function Po(){return new Map}function wo(){return new Set}function Mo(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}let Fn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function So(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:f,index:a}=e,{register:p,unregister:l,subscribeMapChange:i,elementsRef:c,labelsRef:g,nextIndexRef:u}=Ro(),P=s.useRef(-1),[h,O]=s.useState(a??(f===Fn.GuessFromOrder?()=>{if(P.current===-1){const d=u.current;u.current+=1,P.current=d}return P.current}:-1)),m=s.useRef(null),x=s.useCallback(d=>{if(m.current=d,h!==-1&&d!==null&&(c.current[h]=d,g)){const o=t!==void 0;g.current[h]=o?t:r?.current?.textContent??d.textContent}},[h,c,g,t,r]);return ne(()=>{if(a!=null)return;const d=m.current;if(d)return p(d,n),()=>{l(d)}},[a,p,l,n]),ne(()=>{if(a==null)return i(d=>{const o=m.current?d.get(m.current)?.index:null;o!=null&&O(o)})},[a,i,O]),s.useMemo(()=>({ref:x,index:h}),[h,x])}function kt(e,t,n){return Math.floor(e/t)!==n}function ht(e,t){return t<0||t>=e.current.length}function en(e,t){return Pe(e,{disabledIndices:t})}function Pn(e,t){return Pe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Pe(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:f=1}={}){let a=t;do a+=n?-f:f;while(a>=0&&a<=e.current.length-1&&bt(e,a,r));return a}function Vo(e,{event:t,orientation:n,loopFocus:r,rtl:f,cols:a,disabledIndices:p,minIndex:l,maxIndex:i,prevIndex:c,stopEvent:g=!1}){let u=c;const P=[],h={};let O=!1;{let d=null,o=-1;e.current.forEach((M,I)=>{if(M==null)return;const w=M.closest('[role="row"]');w&&(O=!0),(w!==d||o===-1)&&(d=w,o+=1,P[o]=[]),P[o].push(I),h[I]=o})}const m=O&&P.length>0&&P.some(d=>d.length!==a);function x(d){if(!m||c===-1)return;const o=h[c];if(o==null)return;const M=P[o].indexOf(c);let I=d==="up"?o-1:o+1;r&&(I<0?I=P.length-1:I>=P.length&&(I=0));const w=new Set;for(;I>=0&&I<P.length&&!w.has(I);){w.add(I);const v=P[I];if(v.length===0){I=d==="up"?I-1:I+1;continue}const R=Math.min(M,v.length-1);for(let T=R;T>=0;T-=1){const z=v[T];if(!bt(e,z,p))return z}I=d==="up"?I-1:I+1,r&&(I<0?I=P.length-1:I>=P.length&&(I=0))}}if(t.key===sn){const d=x("up");if(d!==void 0)g&&be(t),u=d;else{if(g&&be(t),c===-1)u=i;else if(u=Pe(e,{startingIndex:u,amount:a,decrement:!0,disabledIndices:p}),r&&(c-a<l||u<0)){const o=c%a,M=i%a,I=i-(M-o);M===o?u=i:u=M>o?I:I-a}ht(e,u)&&(u=c)}}if(t.key===It){const d=x("down");d!==void 0?(g&&be(t),u=d):(g&&be(t),c===-1?u=l:(u=Pe(e,{startingIndex:c,amount:a,disabledIndices:p}),r&&c+a>i&&(u=Pe(e,{startingIndex:c%a-a,amount:a,disabledIndices:p}))),ht(e,u)&&(u=c))}if(n==="both"){const d=In(c/a);t.key===(f?$e:Qe)&&(g&&be(t),c%a!==a-1?(u=Pe(e,{startingIndex:c,disabledIndices:p}),r&&kt(u,a,d)&&(u=Pe(e,{startingIndex:c-c%a-1,disabledIndices:p}))):r&&(u=Pe(e,{startingIndex:c-c%a-1,disabledIndices:p})),kt(u,a,d)&&(u=c)),t.key===(f?Qe:$e)&&(g&&be(t),c%a!==0?(u=Pe(e,{startingIndex:c,decrement:!0,disabledIndices:p}),r&&kt(u,a,d)&&(u=Pe(e,{startingIndex:c+(a-c%a),decrement:!0,disabledIndices:p}))):r&&(u=Pe(e,{startingIndex:c+(a-c%a),decrement:!0,disabledIndices:p})),kt(u,a,d)&&(u=c));const o=In(i/a)===d;ht(e,u)&&(r&&o?u=t.key===(f?Qe:$e)?i:Pe(e,{startingIndex:c-c%a-1,disabledIndices:p}):u=c)}return u}function Oo(e,t,n){const r=[];let f=0;return e.forEach(({width:a,height:p},l)=>{let i=!1;for(n&&(f=0);!i;){const c=[];for(let g=0;g<a;g+=1)for(let u=0;u<p;u+=1)c.push(f+g+u*t);f%t+a<=t&&c.every(g=>r[g]==null)?(c.forEach(g=>{r[g]=l}),i=!0):f+=1}}),[...r]}function ko(e,t,n,r,f){if(e===-1)return-1;const a=n.indexOf(e),p=t[e];switch(f){case"tl":return a;case"tr":return p?a+p.width-1:a;case"bl":return p?a+(p.height-1)*r:a;case"br":return n.lastIndexOf(e);default:return-1}}function Ao(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function bt(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}const To="Escape";function jt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function At(e,t){return jt(t,e===sn||e===It,e===$e||e===Qe)}function tn(e,t,n){return jt(t,e===It,n?e===$e:e===Qe)||e==="Enter"||e===" "||e===""}function Lo(e,t,n){return jt(t,n?e===$e:e===Qe,e===It)}function No(e,t,n,r){const f=n?e===Qe:e===$e,a=e===sn;return t==="both"||t==="horizontal"&&r&&r>1?e===To:jt(t,f,a)}function Do(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),f=n.useState("floatingElement"),a=n.useState("domReferenceElement"),p=n.context.dataRef,{listRef:l,activeIndex:i,onNavigate:c=()=>{},enabled:g=!0,selectedIndex:u=null,allowEscape:P=!1,loopFocus:h=!1,nested:O=!1,rtl:m=!1,virtual:x=!1,focusItemOnOpen:d="auto",focusItemOnHover:o=!0,openOnArrowKeyDown:M=!0,disabledIndices:I=void 0,orientation:w="vertical",parentOrientation:v,cols:R=1,scrollItemIntoView:T=!0,itemSizes:z,dense:re=!1,id:q,resetOnPointerLeave:ie=!0,externalTree:X}=t,K=hr(f),S=tt(K),U=br(),ae=xr(X);ne(()=>{p.current.orientation=w},[p,w]);const ye=Ir(a),Z=s.useRef(d),k=s.useRef(u??-1),G=s.useRef(null),pe=s.useRef(!0),J=ce(V=>{c(k.current===-1?null:k.current,V)}),Q=s.useRef(J),A=s.useRef(!!f),de=s.useRef(r),le=s.useRef(!1),ue=s.useRef(!1),me=tt(I),E=tt(r),_=tt(T),W=tt(u),Ce=tt(ie),ve=ce(()=>{function V(se){x?ae?.events.emit("virtualfocus",se):go(se,{sync:le.current,preventScroll:!0})}const $=l.current[k.current],L=ue.current;$&&V($),(le.current?se=>se():requestAnimationFrame)(()=>{const se=l.current[k.current]||$;if(!se)return;$||V(se);const ee=_.current;ee&&we&&(L||!pe.current)&&se.scrollIntoView?.(typeof ee=="boolean"?{block:"nearest",inline:"nearest"}:ee)})});ne(()=>{g&&(r&&f?(k.current=u??-1,Z.current&&u!=null&&(ue.current=!0,J())):A.current&&(k.current=-1,Q.current()))},[g,r,f,u,J]),ne(()=>{if(g){if(!r){le.current=!1;return}if(f)if(i==null){if(le.current=!1,W.current!=null)return;if(A.current&&(k.current=-1,ve()),(!de.current||!A.current)&&Z.current&&(G.current!=null||Z.current===!0&&G.current==null)){let V=0;const $=()=>{l.current[0]==null?(V<2&&(V?requestAnimationFrame:queueMicrotask)($),V+=1):(k.current=G.current==null||tn(G.current,w,m)||O?en(l):Pn(l),G.current=null,J())};$()}}else ht(l,i)||(k.current=i,ve(),ue.current=!1)}},[g,r,f,i,W,O,l,w,m,J,ve,me]),ne(()=>{if(!g||f||!ae||x||!A.current)return;const V=ae.nodesRef.current,$=V.find(se=>se.id===U)?.context?.elements.floating,L=yn(yr(f)),oe=V.some(se=>se.context&&qe(se.context.elements.floating,L));$&&!oe&&pe.current&&$.focus({preventScroll:!0})},[g,f,ae,U,x]),ne(()=>{Q.current=J,de.current=r,A.current=!!f}),ne(()=>{r||(G.current=null,Z.current=d)},[r,d]);const Y=i!=null,we=s.useMemo(()=>{function V(L){if(!E.current)return;const oe=l.current.indexOf(L.currentTarget);oe!==-1&&k.current!==oe&&(k.current=oe,J(L))}return{onFocus(L){le.current=!0,V(L)},onClick:({currentTarget:L})=>L.focus({preventScroll:!0}),onMouseMove(L){le.current=!0,ue.current=!1,o&&V(L)},onPointerLeave(L){if(!E.current||!pe.current||L.pointerType==="touch")return;le.current=!0;const oe=L.relatedTarget;!o||l.current.includes(oe)||Ce.current&&(k.current=-1,J(L),x||S.current?.focus({preventScroll:!0}))}}},[E,S,o,l,J,Ce,x]),Oe=s.useCallback(()=>v??ae?.nodesRef.current.find(V=>V.id===U)?.context?.dataRef?.current.orientation,[U,ae,v]),ze=ce(V=>{if(pe.current=!1,le.current=!0,V.which===229||!E.current&&V.currentTarget===S.current)return;if(O&&No(V.key,w,m,R)){At(V.key,Oe())||be(V),n.setOpen(!1,te(Nt,V.nativeEvent)),Cn(a)&&(x?ae?.events.emit("virtualfocus",a):a.focus());return}const $=k.current,L=en(l,I),oe=Pn(l,I);if(ye||(V.key==="Home"&&(be(V),k.current=L,J(V)),V.key==="End"&&(be(V),k.current=oe,J(V))),R>1){const se=z||Array.from({length:l.current.length},()=>({width:1,height:1})),ee=Oo(se,R,re),Re=ee.findIndex(ke=>ke!=null&&!bt(l,ke,I)),Fe=ee.reduce((ke,ge,F)=>ge!=null&&!bt(l,ge,I)?F:ke,-1),Ne=ee[Vo({current:ee.map(ke=>ke!=null?l.current[ke]:null)},{event:V,orientation:w,loopFocus:h,rtl:m,cols:R,disabledIndices:Ao([...(typeof I!="function"?I:null)||l.current.map((ke,ge)=>bt(l,ge,I)?ge:void 0),void 0],ee),minIndex:Re,maxIndex:Fe,prevIndex:ko(k.current>oe?L:k.current,se,ee,R,V.key===It?"bl":V.key===(m?$e:Qe)?"tr":"tl"),stopEvent:!0})];if(Ne!=null&&(k.current=Ne,J(V)),w==="both")return}if(At(V.key,w)){if(be(V),r&&!x&&yn(V.currentTarget.ownerDocument)===V.currentTarget){k.current=tn(V.key,w,m)?L:oe,J(V);return}tn(V.key,w,m)?h?$>=oe?P&&$!==l.current.length?k.current=-1:(le.current=!1,k.current=L):k.current=Pe(l,{startingIndex:$,disabledIndices:I}):k.current=Math.min(oe,Pe(l,{startingIndex:$,disabledIndices:I})):h?$<=L?P&&$!==-1?k.current=l.current.length:(le.current=!1,k.current=oe):k.current=Pe(l,{startingIndex:$,decrement:!0,disabledIndices:I}):k.current=Math.max(L,Pe(l,{startingIndex:$,decrement:!0,disabledIndices:I})),ht(l,k.current)&&(k.current=-1),J(V)}}),Ye=s.useMemo(()=>x&&r&&Y&&{"aria-activedescendant":`${q}-${i}`},[x,r,Y,q,i]),ut=s.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...ye?{}:Ye,onKeyDown(V){if(V.key==="Tab"&&V.shiftKey&&r&&!x){const $=xt(V.nativeEvent);if($&&!qe(S.current,$))return;be(V),n.setOpen(!1,te(Cr,V.nativeEvent)),Cn(a)&&a.focus();return}ze(V)},onPointerMove(){pe.current=!0}}),[Ye,ze,S,w,ye,n,r,x,a]),Ue=s.useMemo(()=>{function V(L){d==="auto"&&vr(L.nativeEvent)&&(Z.current=!x)}function $(L){Z.current=d,d==="auto"&&Rr(L.nativeEvent)&&(Z.current=!0)}return{onKeyDown(L){const oe=n.select("open");pe.current=!1;const se=L.key.startsWith("Arrow"),ee=Lo(L.key,Oe(),m),Re=At(L.key,w),Fe=(O?ee:Re)||L.key==="Enter"||L.key.trim()==="";if(x&&oe)return ze(L);if(!(!oe&&!M&&se)){if(Fe){const Ne=At(L.key,Oe());G.current=O&&Ne?null:L.key}if(O){ee&&(be(L),oe?(k.current=en(l,me.current),J(L)):n.setOpen(!0,te(Nt,L.nativeEvent,L.currentTarget)));return}Re&&(W.current!=null&&(k.current=W.current),be(L),!oe&&M?n.setOpen(!0,te(Nt,L.nativeEvent,L.currentTarget)):ze(L),oe&&J(L))}},onFocus(L){n.select("open")&&!x&&(k.current=-1,J(L))},onPointerDown:$,onPointerEnter:$,onMouseDown:V,onClick:V}},[ze,me,d,l,O,J,n,M,w,Oe,m,W,x]),Ve=s.useMemo(()=>({...Ye,...Ue}),[Ye,Ue]);return s.useMemo(()=>g?{reference:Ve,floating:ut,item:we,trigger:Ue}:{},[g,Ve,ut,Ue,we])}function Fo(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),f=n.context.dataRef,{listRef:a,activeIndex:p,onMatch:l,onTypingChange:i,enabled:c=!0,findMatch:g=null,resetMs:u=750,ignoreKeys:P=it,selectedIndex:h=null}=t,O=Sn(),m=s.useRef(""),x=s.useRef(h??p??-1),d=s.useRef(null);ne(()=>{r&&(O.clear(),d.current=null,m.current="")},[r,O]),ne(()=>{r&&m.current===""&&(x.current=h??p??-1)},[r,h,p]);const o=ce(v=>{v?f.current.typing||(f.current.typing=v,i?.(v)):f.current.typing&&(f.current.typing=v,i?.(v))}),M=ce(v=>{function R(ie,X,K){const S=g?g(X,K):X.find(U=>U?.toLocaleLowerCase().indexOf(K.toLocaleLowerCase())===0);return S?ie.indexOf(S):-1}const T=a.current;if(m.current.length>0&&m.current[0]!==" "&&(R(T,T,m.current)===-1?o(!1):v.key===" "&&be(v)),T==null||P.includes(v.key)||v.key.length!==1||v.ctrlKey||v.metaKey||v.altKey)return;r&&v.key!==" "&&(be(v),o(!0)),T.every(ie=>ie?ie[0]?.toLocaleLowerCase()!==ie[1]?.toLocaleLowerCase():!0)&&m.current===v.key&&(m.current="",x.current=d.current),m.current+=v.key,O.start(u,()=>{m.current="",x.current=d.current,o(!1)});const re=x.current,q=R(T,[...T.slice((re||0)+1),...T.slice(0,(re||0)+1)],m.current);q!==-1?(l?.(q),d.current=q):v.key!==" "&&(m.current="",o(!1))}),I=s.useMemo(()=>({onKeyDown:M}),[M]),w=s.useMemo(()=>({onKeyDown:M,onKeyUp(v){v.key===" "&&o(!1)}}),[M,o]);return s.useMemo(()=>c?{reference:I,floating:w}:{},[c,I,w])}function jo(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const jn=s.createContext(void 0),_n=s.createContext(void 0),Hn=s.createContext(void 0),qn=s.createContext("");function Ke(){const e=s.useContext(jn);if(!e)throw new Error(rt(22));return e}function _t(){const e=s.useContext(_n);if(!e)throw new Error(rt(23));return e}function ot(){const e=s.useContext(Hn);if(!e)throw new Error(rt(24));return e}function cn(){return s.useContext(qn)}const _o=(e,t)=>Object.is(e,t);function at(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Tt(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:at(r,t,n))}function rn(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:at(r,t,n))}function Ho(e,t,n){return e.filter(r=>!at(r,t,n))}const C={id:D(e=>e.id),query:D(e=>e.query),items:D(e=>e.items),selectedValue:D(e=>e.selectedValue),open:D(e=>e.open),mounted:D(e=>e.mounted),forceMounted:D(e=>e.forceMounted),inline:D(e=>e.inline),activeIndex:D(e=>e.activeIndex),selectedIndex:D(e=>e.selectedIndex),isActive:D((e,t)=>e.activeIndex===t),isSelected:D((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(f=>at(f,t,n)):at(r,t,n)}),transitionStatus:D(e=>e.transitionStatus),popupProps:D(e=>e.popupProps),inputProps:D(e=>e.inputProps),triggerProps:D(e=>e.triggerProps),getItemProps:D(e=>e.getItemProps),positionerElement:D(e=>e.positionerElement),listElement:D(e=>e.listElement),triggerElement:D(e=>e.triggerElement),inputElement:D(e=>e.inputElement),popupSide:D(e=>e.popupSide),openMethod:D(e=>e.openMethod),inputInsidePopup:D(e=>e.inputInsidePopup),selectionMode:D(e=>e.selectionMode),listRef:D(e=>e.listRef),labelsRef:D(e=>e.labelsRef),popupRef:D(e=>e.popupRef),emptyRef:D(e=>e.emptyRef),inputRef:D(e=>e.inputRef),keyboardActiveRef:D(e=>e.keyboardActiveRef),chipsContainerRef:D(e=>e.chipsContainerRef),clearRef:D(e=>e.clearRef),valuesRef:D(e=>e.valuesRef),allValuesRef:D(e=>e.allValuesRef),name:D(e=>e.name),disabled:D(e=>e.disabled),readOnly:D(e=>e.readOnly),required:D(e=>e.required),grid:D(e=>e.grid),isGrouped:D(e=>e.isGrouped),virtualized:D(e=>e.virtualized),onOpenChangeComplete:D(e=>e.onOpenChangeComplete),openOnInputClick:D(e=>e.openOnInputClick),itemToStringLabel:D(e=>e.itemToStringLabel),isItemEqualToValue:D(e=>e.isItemEqualToValue),modal:D(e=>e.modal),autoHighlight:D(e=>e.autoHighlight),submitOnItemClick:D(e=>e.submitOnItemClick)};let wn=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const qo={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Bn={valid(e){return e===null?null:e?{[wn.valid]:""}:{[wn.invalid]:""}}},Bo=s.createContext({invalid:void 0,name:void 0,validityData:{state:qo,errors:[],error:"",value:"",initialValue:null},setValidityData:Ie,disabled:void 0,touched:!1,setTouched:Ie,dirty:!1,setDirty:Ie,filled:!1,setFilled:Ie,focused:!1,setFocused:Ie,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=nn)=>e,getInputValidationProps:(e=nn)=>e,inputRef:{current:null},commit:async()=>{}}});function yt(e=!0){const t=s.useContext(Bo);if(t.setValidityData===Ie&&!e)throw new Error(rt(28));return t}function Ko(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function zo(e){const{enabled:t=!0,value:n,id:r,name:f,controlRef:a,commit:p}=e,{formRef:l}=Ln(),{invalid:i,markedDirtyRef:c,validityData:g,setValidityData:u}=yt(),P=ce(e.getValue);ne(()=>{if(!t)return;let h=n;h===void 0&&(h=P()),g.initialValue===null&&h!==null&&u(O=>({...O,initialValue:h}))},[t,u,n,g.initialValue,P]),ne(()=>{!t||!r||l.current.fields.set(r,{getValue:P,name:f,controlRef:a,validityData:Ko(g,i),validate(){let h=n;h===void 0&&(h=P()),c.current=!0,Vn.flushSync(()=>p(h))}})},[p,a,t,l,P,r,i,c,f,g,n]),ne(()=>{const h=l.current.fields;return()=>{r&&h.delete(r)}},[l,r])}const Uo=s.createContext({controlId:void 0,setControlId:Ie,labelId:void 0,setLabelId:Ie,messageIds:[],setMessageIds:Ie,getDescriptionProps:e=>e});function dn(){return s.useContext(Uo)}function Go(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:f,setControlId:a}=dn(),p=On(t);return ne(()=>{if(!(!n&&!t||a===Ie)){if(n){const l=r?.current;Er(l)&&l.closest("label")!=null?a(t??null):a(f??p)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,f,a,n,p]),f??p}function on(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Wo(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Se(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 on(e)}function gt(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?on(e.value):on(e)}function $o(e,t){return(n,r)=>{if(n==null)return!1;const f=Se(n,t);return e.contains(f,r)}}function Qo(e,t,n){return(r,f)=>{if(r==null)return!1;if(!f)return!0;const a=Se(r,t),p=n!=null?Se(n,t):"";return p&&e.contains(p,f)&&p.length===f.length?!0:e.contains(a,f)}}const Mn=new Map;function Kn(e){return Array.isArray(e)?e.map(t=>Kn(t)).join(","):e==null?"":String(e)}function Yo(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${Kn(e.locale)}|${JSON.stringify(t)}`,r=Mn.get(n);if(r)return r;const f=new Intl.Collator(e.locale,t),a={contains(p,l,i){if(!l)return!0;const c=Se(p,i);for(let g=0;g<=c.length-l.length;g+=1)if(f.compare(c.slice(g,g+l.length),l)===0)return!0;return!1},startsWith(p,l,i){if(!l)return!0;const c=Se(p,i);return f.compare(c.slice(0,l.length),l)===0},endsWith(p,l,i){if(!l)return!0;const c=Se(p,i),g=l.length;return c.length>=g&&f.compare(c.slice(c.length-g),l)===0}};return Mn.set(n,a),a}const Jo=Yo,zn=Symbol("none"),et={value:zn,index:-1};function Xo(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:f,onSelectedValueChange:a,defaultInputValue:p,inputValue:l,selectionMode:i="none",onItemHighlighted:c,name:g,disabled:u=!1,readOnly:P=!1,required:h=!1,inputRef:O,grid:m=!1,items:x,filteredItems:d,filter:o,openOnInputClick:M=!0,autoHighlight:I=!1,keepHighlight:w=!1,highlightItemOnHover:v=!0,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:z=_o,virtualized:re=!1,inline:q=!1,fillInputOnItemPress:ie=!0,modal:X=!1,limit:K=-1,autoComplete:S="list",locale:U,submitOnItemClick:ae=!1}=e,{clearErrors:ye}=Ln(),{setDirty:Z,validityData:k,shouldValidateOnChange:G,setFilled:pe,name:J,disabled:Q,validation:A}=yt(),de=Go({id:t}),le=Jo({locale:U}),[ue,me]=s.useState(!1),[E,_]=s.useState(null),W=s.useRef([]),Ce=s.useRef([]),ve=s.useRef(null),Y=s.useRef(null),we=s.useRef(null),Oe=s.useRef(!0),ze=s.useRef(!1),Ye=s.useRef(null),ut=s.useRef(null),Ue=s.useRef(null),Ve=s.useRef(et),V=s.useRef(null),$=s.useRef([]),L=s.useRef([]),oe=Q||u,se=J??g,ee=i==="multiple",Re=i==="single",Fe=l!==void 0||p!==void 0,Ne=x!==void 0,ke=d!==void 0;let ge;I==="always"?ge="always":ge=I?"input-change":!1;const[F,Ct]=Zt({controlled:f,default:ee?r??it:r,name:"Combobox",state:"selectedValue"}),vt=s.useMemo(()=>o===null?()=>!0:o!==void 0?o:Re&&!ue?Qo(le,R,F):$o(le,R),[o,Re,F,ue,le,R]),pn=Dt(()=>Fe?p??"":Re?Se(F,R):"").current,[Ae,Qn]=Zt({controlled:l,default:pn,name:"Combobox",state:"inputValue"}),[xe,Yn]=Zt({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),_e=Wo(x),Me=E??(Ae===""?"":String(Ae).trim()),Ht=Re?Se(F,R):"",mn=Re&&!ue&&Me!==""&&Ht!==""&&Ht.length===Me.length&&le.contains(Ht,Me),ct=mn?"":Me,gn=Ne&&ke&&mn,Ge=s.useMemo(()=>x?_e?x.flatMap(b=>b.items):x:it,[x,_e]),dt=s.useMemo(()=>{if(d&&!gn)return d;if(!x)return it;if(_e){const N=x,H=[];let fe=0;for(const he of N){if(K>-1&&fe>=K)break;const Ee=ct===""?he.items:he.items.filter(St=>vt(St,ct,R));if(Ee.length===0)continue;const Xe=K>-1?K-fe:1/0,Ze=Ee.slice(0,Xe);if(Ze.length>0){const St={...he,items:Ze};H.push(St),fe+=Ze.length}}return H}if(ct==="")return K>-1?Ge.slice(0,K):Ge;const b=[];for(const N of Ge){if(K>-1&&b.length>=K)break;vt(N,ct,R)&&b.push(N)}return b},[d,gn,x,_e,ct,K,vt,R,Ge]),De=s.useMemo(()=>_e?dt.flatMap(N=>N.items):dt,[dt,_e]),B=Dt(()=>new Pr({id:de,selectedValue:F,open:xe,filter:vt,query:Me,items:x,selectionMode:i,listRef:W,labelsRef:Ce,popupRef:ve,emptyRef:we,inputRef:Y,keyboardActiveRef:Oe,chipsContainerRef:Ye,clearRef:ut,valuesRef:$,allValuesRef:L,selectionEventRef:Ue,name:se,disabled:oe,readOnly:P,required:h,grid:m,isGrouped:_e,virtualized:re,openOnInputClick:M,itemToStringLabel:R,isItemEqualToValue:z,modal:X,autoHighlight:ge,submitOnItemClick:ae,hasInputValue:Fe,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:q,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||Ie,setOpen:Ie,setInputValue:Ie,setSelectedValue:Ie,setIndices:Ie,onItemHighlighted:Ie,handleSelection:Ie,getItemProps:()=>nn,forceMount:Ie,requestSubmit:Ie})).current,st=i==="none"?Ae:F,Jn=s.useMemo(()=>i==="none"?st:Array.isArray(F)?F.map(b=>gt(b,T)):gt(F,T),[st,T,i,F]),qt=ce(c),Bt=ce(n),Rt=y(B,C.activeIndex),Xn=y(B,C.selectedIndex),Et=y(B,C.positionerElement),hn=y(B,C.listElement),ft=y(B,C.triggerElement),Kt=y(B,C.inputElement),He=y(B,C.inline),Je=y(B,C.inputInsidePopup),Zn=tt(ft),{mounted:bn,setMounted:er,transitionStatus:zt}=an(xe),{openMethod:xn,triggerProps:Ut,reset:tr}=ho(xe);zo({id:de,name:se,commit:A.commit,value:st,controlRef:Je?Zn:Y,getValue:()=>Jn});const Pt=ce(()=>{x?Ce.current=De.map(b=>Se(b,R)):B.set("forceMounted",!0)}),nr=s.useRef(F);ne(()=>{F!==nr.current&&Pt()},[Pt,F]);const Te=ce(b=>{B.update(b);const N=b.type||"none";if(b.activeIndex!==void 0)if(b.activeIndex===null)Ve.current!==et&&(Ve.current=et,qt(void 0,mt(N,void 0,{index:-1})));else{const H=$.current[b.activeIndex];Ve.current={value:H,index:b.activeIndex},qt(H,mt(N,void 0,{index:b.activeIndex}))}}),Le=ce((b,N)=>{if(ze.current=N.reason===We,e.onInputValueChange?.(b,N),!N.isCanceled){if(N.reason===nt){const H=b.trim()!=="";H&&me(!0),V.current={hasQuery:H},H&&ge&&B.state.activeIndex==null&&B.set("activeIndex",0)}Qn(b)}}),pt=ce((b,N)=>{xe!==b&&(N.reason==="escape-key"&&Ne&&De.length===0&&!B.state.emptyRef.current&&N.allowPropagation(),e.onOpenChange?.(b,N),!N.isCanceled&&(!b&&ue&&(Re?(_(Me),Me===""&&me(!1)):ee&&(He||Je?Te({activeIndex:null}):_(Me),Le("",te(We,N.event)))),Yn(b)))}),wt=ce((b,N)=>{if(a?.(b,N),N.isCanceled)return;Ct(b),(i==="none"&&ve.current&&ie||Re&&!B.state.inputInsidePopup)&&Le(Se(b,R),te(N.reason,N.event)),Re&&b!=null&&N.reason!==nt&&ue&&_(Me)}),rr=ce((b,N)=>{let H=N;if(H===void 0){if(Rt===null)return;H=$.current[Rt]}const fe=xt(b),he=Ue.current??b;Ue.current=null;const Ee=te(wr,he),Xe=fe?.closest("a")?.getAttribute("href");if(Xe){Xe.startsWith("#")&&pt(!1,Ee);return}if(ee){const Ze=Array.isArray(F)?F:[],gr=Tt(Ze,H,B.state.isItemEqualToValue)?Ho(Ze,H,B.state.isItemEqualToValue):[...Ze,H];if(wt(gr,Ee),!(Y.current?Y.current.value.trim()!=="":!1))return;B.state.inputInsidePopup?Le("",te(We,Ee.event)):pt(!1,Ee)}else wt(H,Ee),pt(!1,Ee)}),Gt=ce(()=>{if(!B.state.submitOnItemClick)return;const b=B.state.inputElement?.form;b&&typeof b.requestSubmit=="function"&&b.requestSubmit()}),Wt=ce(()=>{if(er(!1),Bt?.(!1),me(!1),tr(),_(null),Te(i==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),ee&&Y.current&&Y.current.value!==""&&!ze.current&&Le("",te(We)),Re)if(B.state.inputInsidePopup)Y.current&&Y.current.value!==""&&Le("",te(We));else{const b=Se(F,R);Y.current&&Y.current.value!==b&&Le(b,te(b===""?We:je))}}),or=s.useMemo(()=>He&&Et?{current:Et.closest('[role="dialog"]')}:ve,[He,Et]);Ft({enabled:!e.actionsRef,open:xe,ref:or,onComplete(){xe||Wt()}}),s.useImperativeHandle(e.actionsRef,()=>({unmount:Wt}),[Wt]),ne(function(){if(xe||i==="none")return;const N=x?Ge:L.current;if(ee){const H=Array.isArray(F)?F:[],fe=H[H.length-1],he=rn(N,fe,z);Te({selectedIndex:he===-1?null:he})}else{const H=rn(N,F,z);Te({selectedIndex:H===-1?null:H})}},[xe,F,x,i,Ge,ee,z,Te]),ne(()=>{x&&($.current=De,W.current.length=De.length)},[x,De]),ne(()=>{const b=V.current;if(b&&(b.hasQuery?ge&&B.set("activeIndex",0):ge==="always"&&B.set("activeIndex",0),V.current=null),!xe&&!He)return;const H=Ne||ke?De:$.current,fe=B.state.activeIndex;if(fe==null){if(ge==="always"&&H.length>0){B.set("activeIndex",0);return}Ve.current!==et&&(Ve.current=et,B.state.onItemHighlighted(void 0,mt(je,void 0,{index:-1})));return}if(fe>=H.length){Ve.current!==et&&(Ve.current=et,B.state.onItemHighlighted(void 0,mt(je,void 0,{index:-1}))),B.set("activeIndex",null);return}const he=H[fe],Ee=Ve.current.value,Xe=Ee!==zn&&B.state.isItemEqualToValue(he,Ee);(Ve.current.index!==fe||!Xe)&&(Ve.current={value:he,index:fe},B.state.onItemHighlighted(he,mt(je,void 0,{index:fe})))},[Rt,ge,ke,Ne,De,He,xe,B]),ne(()=>{if(!x||i==="none")return;const b=Ge;if(ee){const fe=Array.isArray(F)?F:it,he=fe.filter(Ee=>Tt(b,Ee,B.state.isItemEqualToValue));he.length!==fe.length&&Ct(he);return}if(F==null?!0:Tt(b,F,B.state.isItemEqualToValue))return;let H=null;if(r!=null&&Tt(b,r,B.state.isItemEqualToValue)&&(H=r),Ct(H),!B.state.inputInsidePopup){const fe=Se(H,R);Y.current&&Y.current.value!==fe&&Le(fe,te(je))}},[x,Ge,ee,i,F,r,Ct,R,B,Le]),ne(()=>{if(i==="none"){pe(String(Ae)!=="");return}pe(ee?Array.isArray(F)&&F.length>0:F!=null)},[pe,i,Ae,F,ee]),s.useEffect(()=>{Ne&&ge&&De.length===0&&Te({activeIndex:null})},[Ne,ge,De.length,Te]),Ot(Me,()=>{!xe||Me===""||Me===String(pn)||me(!0)}),Ot(F,()=>{if(i!=="none"&&(ye(se),Z(F!==k.initialValue),G()?A.commit(F):A.commit(F,!0),ee&&B.state.selectedIndex!==null&&(!Array.isArray(F)||F.length===0)&&Te({activeIndex:null,selectedIndex:null}),Re&&!Fe&&!Je)){const b=Se(F,R);Ae!==b&&Le(b,te(je))}}),Ot(Ae,()=>{i==="none"&&(ye(se),Z(Ae!==k.initialValue),G()?A.commit(Ae):A.commit(Ae,!0))}),Ot(x,()=>{if(!Re||Fe||Je||ue)return;const b=Se(F,R);Ae!==b&&Le(b,te(je))});const Mt=Mr({open:He?!0:xe,onOpenChange:pt,elements:{reference:Je?ft:Kt,floating:Et}});let $t,Qt;He||($t=m?"grid":"listbox",Qt=xe?"true":"false");const sr=s.useMemo(()=>{const b=Kt?.tagName==="INPUT",N=b||xe,H=b?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return N&&(H.role="combobox",H["aria-expanded"]=Qt,H["aria-haspopup"]=$t,H["aria-controls"]=xe?hn?.id:void 0,H["aria-autocomplete"]=S),{reference:H,floating:{role:"presentation"}}},[Kt,xe,Qt,$t,hn?.id,S]),ir=Nn(Mt,{enabled:!P&&!oe&&M,event:"mousedown-only",toggle:!1,touchOpenDelay:Je?0:50}),ar=Sr(Mt,{enabled:!P&&!oe&&!He,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:He?!0:void 0,outsidePress(b){const N=xt(b);return!qe(ft,N)&&!qe(ut.current,N)&&!qe(Ye.current,N)}}),lr=Do(Mt,{enabled:!P&&!oe,id:de,listRef:W,activeIndex:Rt,selectedIndex:Xn,virtual:!0,loopFocus:!0,allowEscape:!ge,focusItemOnOpen:ue||i==="none"&&!ge?!1:"auto",focusItemOnHover:v,resetOnPointerLeave:!w,cols:m?2:1,orientation:m?"horizontal":void 0,disabledIndices:it,onNavigate(b,N){!N&&!xe||zt==="ending"||Te(N?{activeIndex:b,type:Oe.current?"keyboard":"pointer"}:{activeIndex:b})}}),{getReferenceProps:Yt,getFloatingProps:Jt,getItemProps:Xt}=Vr([sr,ir,ar,lr]);jo(()=>{B.update({inline:q,popupProps:Jt(),inputProps:Yt(),triggerProps:Ut,getItemProps:Xt,setOpen:pt,setInputValue:Le,setSelectedValue:wt,setIndices:Te,onItemHighlighted:qt,handleSelection:rr,forceMount:Pt,requestSubmit:Gt})}),ne(()=>{B.update({id:de,selectedValue:F,open:xe,mounted:bn,transitionStatus:zt,items:x,inline:q,popupProps:Jt(),inputProps:Yt(),triggerProps:Ut,openMethod:xn,getItemProps:Xt,selectionMode:i,name:se,disabled:oe,readOnly:P,required:h,grid:m,isGrouped:_e,virtualized:re,onOpenChangeComplete:Bt,openOnInputClick:M,itemToStringLabel:R,modal:X,autoHighlight:ge,isItemEqualToValue:z,submitOnItemClick:ae,hasInputValue:Fe,requestSubmit:Gt})},[B,de,F,xe,bn,zt,x,Jt,Yt,Xt,xn,Ut,i,se,oe,P,h,A,m,_e,re,Bt,M,R,X,z,ae,Fe,q,Gt,ge]);const ur=Or(O,A.inputRef),cr=s.useMemo(()=>({query:Me,filteredItems:dt,flatFilteredItems:De}),[Me,dt,De]),dr=s.useMemo(()=>Array.isArray(st)?"":gt(st,T),[st,T]),fr=ee&&Array.isArray(F)&&F.length>0,pr=s.useMemo(()=>!ee||!Array.isArray(F)||!se?null:F.map(b=>{const N=gt(b,T);return j.jsx("input",{type:"hidden",name:se,value:N},N)}),[ee,F,se,T]),mr=j.jsxs(s.Fragment,{children:[e.children,j.jsx("input",{...A.getInputValidationProps({onFocus(){if(Je){ft?.focus();return}(Y.current||ft)?.focus()},onChange(b){if(b.nativeEvent.defaultPrevented)return;const N=b.target.value,H=te(nt,b.nativeEvent);function fe(){if(ee)return;if(i==="none"){Z(N!==k.initialValue),Le(N,H),G()&&A.commit(N);return}const he=$.current.find(Ee=>gt(Ee,T).toLowerCase()===N.toLowerCase());he!=null&&(Z(he!==k.initialValue),wt?.(he,H),G()&&A.commit(he))}x?fe():(Pt(),queueMicrotask(fe))}}),id:de,name:ee||i==="none"?void 0:se,disabled:oe,required:h&&!fr,readOnly:P,value:dr,ref:ur,style:kr,tabIndex:-1,"aria-hidden":!0}),pr]});return j.jsx(jn.Provider,{value:B,children:j.jsx(_n.Provider,{value:Mt,children:j.jsx(Hn.Provider,{value:cr,children:j.jsx(qn.Provider,{value:Ae,children:mr})})})})}function Zo(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const a=parseFloat(n.width)||0,p=parseFloat(n.height)||0,l=parseFloat(r.width)||0,i=parseFloat(r.height)||0,c=Math.max(t.width,a,l),g=Math.max(t.height,p,i),u=c-t.width,P=g-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-P/2,bottom:t.bottom+P/2}}const Lt=2,es={...kn,...Bn},ts=s.forwardRef(function(t,n){const{render:r,className:f,nativeButton:a=!0,disabled:p=!1,...l}=t,{state:i,disabled:c,setTouched:g,setFocused:u,validationMode:P,validation:h}=yt(),{labelId:O}=dn(),m=Ke(),x=y(m,C.selectionMode),d=y(m,C.disabled),o=y(m,C.readOnly),M=y(m,C.listElement),I=y(m,C.triggerProps),w=y(m,C.triggerElement),v=y(m,C.inputInsidePopup),R=y(m,C.open),T=y(m,C.selectedValue),z=y(m,C.activeIndex),re=y(m,C.selectedIndex),q=_t(),ie=cn(),X=Sn(),K=c||d||p,S=s.useRef("");function U(A){S.current=A.pointerType}const ae=q.select("domReferenceElement");s.useEffect(()=>{v&&w&&w!==ae&&q.set("domReferenceElement",w)},[w,ae,q,v]);const{reference:ye}=Fo(q,{enabled:!R&&!o&&!d&&x==="single",listRef:m.state.labelsRef,activeIndex:z,selectedIndex:re,onMatch(A){const de=m.state.valuesRef.current[A];de!==void 0&&m.state.setSelectedValue(de,te("none"))}}),{reference:Z}=Nn(q,{enabled:!o&&!d,event:"mousedown"}),{buttonRef:k,getButtonProps:G}=un({native:a,disabled:K}),pe=s.useMemo(()=>({...i,open:R,disabled:K}),[i,R,K]),J=ce(A=>{m.set("triggerElement",A)});return Be("button",t,{ref:[n,k,J],state:pe,props:[I,Z,ye,{tabIndex:v?0:-1,disabled:K,role:v?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":v?"dialog":"listbox","aria-controls":R?M?.id:void 0,"aria-readonly":o||void 0,"aria-labelledby":O,onPointerDown:U,onPointerEnter:U,onFocus(){u(!0),!(K||o)&&X.start(0,m.state.forceMount)},onBlur(){if(g(!0),u(!1),P==="onBlur"){const A=x==="none"?ie:T;h.commit(A)}},onMouseDown(A){if(K||o||(v||q.set("domReferenceElement",A.currentTarget),m.state.forceMount(),S.current!=="touch"&&(m.state.inputRef.current?.focus(),v||A.preventDefault()),R))return;const de=Ar(A.currentTarget);function le(ue){if(!w)return;const me=xt(ue),E=m.state.positionerElement,_=m.state.listElement;if(qe(w,me)||qe(E,me)||qe(_,me)||me===w)return;const W=Zo(w),Ce=ue.clientX>=W.left-Lt&&ue.clientX<=W.right+Lt,ve=ue.clientY>=W.top-Lt&&ue.clientY<=W.bottom+Lt;Ce&&ve||m.state.setOpen(!1,te("cancel-open",ue))}v&&de.addEventListener("mouseup",le,{once:!0})},onKeyDown(A){K||o||(A.key==="ArrowDown"||A.key==="ArrowUp")&&(be(A),m.state.setOpen(!0,te(Nt,A.nativeEvent)),m.state.inputRef.current?.focus())}},h?h.getValidationProps(l):l,G],stateAttributesMapping:es})}),ns=s.createContext(void 0);function rs(){return s.useContext(ns)}const Un=s.createContext(void 0);function fn(e){const t=s.useContext(Un);if(t===void 0&&!e)throw new Error(rt(21));return t}const os={...kn,...Bn,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},ss=s.forwardRef(function(t,n){const{render:r,className:f,disabled:a=!1,id:p,...l}=t,{state:i,disabled:c,setTouched:g,setFocused:u,validationMode:P,validation:h}=yt(),{labelId:O}=dn(),m=rs(),d=!!fn(!0),o=Ke(),{filteredItems:M}=ot(),I=cn(),w=On(p),v=Tr(),R=y(o,C.disabled),T=y(o,C.readOnly),z=y(o,C.name),re=y(o,C.selectionMode),q=y(o,C.autoHighlight),ie=y(o,C.inputProps),X=y(o,C.triggerProps),K=y(o,C.open),S=y(o,C.mounted),U=y(o,C.selectedValue),ae=y(o,C.popupSide),ye=y(o,C.positionerElement),Z=!!q,k=S&&ye?ae:null,G=c||R||a,pe=M.length===0,[J,Q]=s.useState(null),A=s.useRef(!1),de=ce(E=>{const _=d||o.state.inline;_&&!o.state.hasInputValue&&o.state.setInputValue("",te(je)),o.update({inputElement:E,inputInsidePopup:_})}),le=s.useMemo(()=>({...i,open:K,disabled:G,readOnly:T,popupSide:k,listEmpty:pe}),[i,K,G,T,k,pe]);function ue(E){if(!m)return;let _;const{highlightedChipIndex:W}=m;if(W!==void 0){if(E.key==="ArrowLeft")E.preventDefault(),W>0?_=W-1:_=void 0;else if(E.key==="ArrowRight")E.preventDefault(),W<U.length-1?_=W+1:_=void 0;else if(E.key==="Backspace"||E.key==="Delete"){E.preventDefault();const Ce=W>=U.length-1?U.length-2:W;_=Ce>=0?Ce:void 0,o.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return _}return E.key==="ArrowLeft"&&(E.currentTarget.selectionStart??0)===0&&U.length>0?(E.preventDefault(),_=Math.max(U.length-1,0)):E.key==="Backspace"&&E.currentTarget.value===""&&U.length>0&&(o.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),E.preventDefault()),_}return Be("input",t,{state:le,ref:[n,o.state.inputRef,de],props:[ie,X,{type:"text",value:t.value??J??I,"aria-readonly":T||void 0,"aria-labelledby":O,disabled:G,readOnly:T,...re==="none"&&z&&{name:z},id:w,onFocus(){u(!0)},onBlur(){if(g(!0),u(!1),P==="onBlur"){const E=re==="none"?I:U;h.commit(E)}},onCompositionStart(E){Nr||(A.current=!0,Q(E.currentTarget.value))},onCompositionEnd(E){A.current=!1;const _=E.currentTarget.value;Q(null),o.state.setInputValue(_,te(nt,E.nativeEvent))},onChange(E){if(A.current){const ve=E.currentTarget.value;Q(ve),ve===""&&!o.state.openOnInputClick&&!o.state.inputInsidePopup&&o.state.setOpen(!1,te(We,E.nativeEvent));const Y=ve.trim(),we=Z&&Y!=="";!T&&!G&&Y!==""&&(o.state.setOpen(!0,te(nt,E.nativeEvent)),Z||o.state.setIndices({activeIndex:null,selectedIndex:null,type:o.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&o.state.activeIndex!==null&&!we&&o.state.setIndices({activeIndex:null,selectedIndex:null,type:o.state.keyboardActiveRef.current?"keyboard":"pointer"});return}o.state.setInputValue(E.currentTarget.value,te(nt,E.nativeEvent));const _=E.currentTarget.value==="",W=te(We,E.nativeEvent);_&&!o.state.inputInsidePopup&&(re==="single"&&o.state.setSelectedValue(null,W),o.state.openOnInputClick||o.state.setOpen(!1,W));const Ce=E.currentTarget.value.trim();!T&&!G&&Ce!==""&&(o.state.setOpen(!0,te(nt,E.nativeEvent)),Z||o.state.setIndices({activeIndex:null,selectedIndex:null,type:o.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&o.state.activeIndex!==null&&!Z&&o.state.setIndices({activeIndex:null,selectedIndex:null,type:o.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(E){if(G||T||E.ctrlKey||E.shiftKey||E.altKey||E.metaKey)return;o.state.keyboardActiveRef.current=!0;const _=E.currentTarget,W=_.scrollWidth-_.clientWidth,Ce=v==="rtl";if(E.key==="Home"){be(E);const Y=vn&&Ce?_.value.length:0;_.setSelectionRange(Y,Y),_.scrollLeft=0;return}if(E.key==="End"){be(E);const Y=vn&&Ce?0:_.value.length;_.setSelectionRange(Y,Y),_.scrollLeft=Ce?-W:W;return}if(!S&&E.key==="Escape"){const Y=re==="multiple"&&Array.isArray(U)?U.length===0:U===null,we=te(Lr,E.nativeEvent),Oe=re==="multiple"?[]:null;o.state.setInputValue("",we),o.state.setSelectedValue(Oe,we),!Y&&!o.state.inline&&!we.isPropagationAllowed&&E.stopPropagation();return}if(m&&E.key==="Backspace"&&_.value===""&&m.highlightedChipIndex===void 0&&Array.isArray(U)&&U.length>0){const Y=U.slice(0,-1);o.state.setIndices({activeIndex:null,selectedIndex:null,type:o.state.keyboardActiveRef.current?"keyboard":"pointer"}),o.state.setSelectedValue(Y,te(je,E.nativeEvent));return}const ve=ue(E);if(m?.setHighlightedChipIndex(ve),ve!==void 0?m?.chipsRef.current[ve]?.focus():o.state.inputRef.current?.focus(),E.which!==229&&E.key==="Enter"&&K){const Y=o.state.activeIndex,we=E.nativeEvent;if(Y===null){o.state.setOpen(!1,te(je,we));return}be(E);const Oe=o.state.listRef.current[Y];Oe&&(o.state.selectionEventRef.current=we,Oe.click(),o.state.selectionEventRef.current=null)}},onPointerMove(){o.state.keyboardActiveRef.current=!1},onPointerDown(){o.state.keyboardActiveRef.current=!1}},h?h.getValidationProps(l):l],stateAttributesMapping:os})}),is={...ln,...Dr},as=s.forwardRef(function(t,n){const{render:r,className:f,disabled:a=!1,nativeButton:p=!0,keepMounted:l=!1,...i}=t,{disabled:c}=yt(),g=Ke(),u=y(g,C.selectionMode),P=y(g,C.disabled),h=y(g,C.readOnly),O=y(g,C.open),m=y(g,C.selectedValue),x=cn();let d=!1;u==="none"?d=x!=="":u==="single"?d=m!=null:d=Array.isArray(m)&&m.length>0;const o=c||P||a,{buttonRef:M,getButtonProps:I}=un({native:p,disabled:o}),{mounted:w,transitionStatus:v,setMounted:R}=an(d),T=s.useMemo(()=>({disabled:o,open:O,transitionStatus:v}),[o,O,v]);Ft({open:d,ref:g.state.clearRef,onComplete(){d||R(!1)}});const z=Be("button",t,{state:T,ref:[n,M,g.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:o,"aria-readonly":h||void 0,onMouseDown(q){q.preventDefault()},onClick(q){if(o||h)return;const ie=g.state.keyboardActiveRef;g.state.setInputValue("",te(Rn,q.nativeEvent)),u!=="none"?(g.state.setSelectedValue(Array.isArray(m)?[]:null,te(Rn,q.nativeEvent)),g.state.setIndices({activeIndex:null,selectedIndex:null,type:ie.current?"keyboard":"pointer"})):g.state.setIndices({activeIndex:null,type:ie.current?"keyboard":"pointer"}),g.state.inputRef.current?.focus()}},i,I],stateAttributesMapping:is});return l||w?z:null}),ls=s.createContext(null);function us(){return s.useContext(ls)}function cs(e){const{children:t}=e,{filteredItems:n}=ot(),r=us(),f=r?r.items:n;return f?j.jsx(s.Fragment,{children:f.map(t)}):null}const ds=s.forwardRef(function(t,n){var r;const{render:f,className:a,children:p,...l}=t,i=Ke(),c=_t(),g=!!fn(!0),{filteredItems:u}=ot(),P=y(i,C.items),h=y(i,C.labelsRef),O=y(i,C.listRef),m=y(i,C.selectionMode),x=y(i,C.grid),d=y(i,C.popupProps),o=y(i,C.disabled),M=y(i,C.readOnly),I=y(i,C.virtualized),w=m==="multiple",v=u.length===0,R=ce(X=>{i.set("positionerElement",X)}),T=ce(X=>{i.set("listElement",X)}),z=s.useMemo(()=>typeof p=="function"?r||(r=j.jsx(cs,{children:p})):p,[p]),re=s.useMemo(()=>({empty:v}),[v]),q=c.useState("floatingId"),ie=Be("div",t,{state:re,ref:[n,T,g?null:R],props:[d,{children:z,tabIndex:-1,id:q,role:x?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(X){if(!(o||M)&&X.key==="Enter"){const K=i.state.activeIndex;if(K==null)return;be(X);const S=X.nativeEvent,U=i.state.listRef.current[K];U&&(i.state.selectionEventRef.current=S,U.click(),i.state.selectionEventRef.current=null)}},onKeyDownCapture(){i.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){i.state.keyboardActiveRef.current=!1}},l]});return I?ie:j.jsx(Eo,{elementsRef:O,labelsRef:P?void 0:h,children:ie})}),Gn=s.createContext(void 0);function fs(){const e=s.useContext(Gn);if(e===void 0)throw new Error(rt(20));return e}const ps=s.forwardRef(function(t,n){const{keepMounted:r=!1,...f}=t,a=Ke(),p=y(a,C.mounted),l=y(a,C.forceMounted);return p||r||l?j.jsx(Gn.Provider,{value:r,children:j.jsx(Fr,{ref:n,...f})}):null}),ms=s.forwardRef(function(t,n){const{render:r,className:f,anchor:a,positionMethod:p="absolute",side:l="bottom",align:i="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:P=5,arrowPadding:h=5,sticky:O=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=jr,...d}=t,o=Ke(),{filteredItems:M}=ot(),I=_t(),w=fs(),v=y(o,C.modal),R=y(o,C.open),T=y(o,C.mounted),z=y(o,C.openMethod),re=y(o,C.triggerElement),q=y(o,C.inputElement),ie=y(o,C.inputInsidePopup),X=M.length===0,S=_r({anchor:a??(ie?re:q),floatingRootContext:I,positionMethod:p,mounted:T,side:l,sideOffset:c,align:i,alignOffset:g,arrowPadding:h,collisionBoundary:u,collisionPadding:P,sticky:O,disableAnchorTracking:m,keepMounted:w,collisionAvoidance:x,lazyFlip:!0});bo(R&&v&&z!=="touch",re);const U=s.useMemo(()=>{const G={...S.positionerStyles};return R||(G.pointerEvents="none"),{role:"presentation",hidden:!T,style:G}},[R,T,S.positionerStyles]),ae=s.useMemo(()=>({open:R,side:S.side,align:S.align,anchorHidden:S.anchorHidden,empty:X}),[R,S.side,S.align,S.anchorHidden,X]);ne(()=>{o.set("popupSide",S.side)},[o,S.side]);const ye=s.useMemo(()=>({side:S.side,align:S.align,arrowRef:S.arrowRef,arrowUncentered:S.arrowUncentered,arrowStyles:S.arrowStyles,anchorHidden:S.anchorHidden,isPositioned:S.isPositioned}),[S.side,S.align,S.arrowRef,S.arrowUncentered,S.arrowStyles,S.anchorHidden,S.isPositioned]),Z=ce(G=>{o.set("positionerElement",G)}),k=Be("div",t,{state:ae,ref:[n,Z],props:[U,d],stateAttributesMapping:An});return j.jsxs(Un.Provider,{value:ye,children:[T&&v&&j.jsx(xo,{inert:Io(!R),cutout:q??re}),k]})}),gs={...An,...ln},hs=s.forwardRef(function(t,n){const{render:r,className:f,initialFocus:a,finalFocus:p,...l}=t,i=Ke(),c=fn(),g=_t(),{filteredItems:u}=ot(),P=y(i,C.mounted),h=y(i,C.open),O=y(i,C.openMethod),m=y(i,C.transitionStatus),x=y(i,C.inputInsidePopup),d=y(i,C.inputElement),o=u.length===0;Ft({open:h,ref:i.state.popupRef,onComplete(){h&&i.state.onOpenChangeComplete(!0)}});const M=s.useMemo(()=>({open:h,side:c.side,align:c.align,anchorHidden:c.anchorHidden,transitionStatus:m,empty:o}),[h,c.side,c.align,c.anchorHidden,m,o]),I=Be("div",t,{state:M,ref:[n,i.state.popupRef],props:[{role:x?"dialog":"presentation",tabIndex:-1,onFocus(T){const z=xt(T.nativeEvent);O!=="touch"&&(qe(i.state.listElement,z)||z===T.currentTarget)&&i.state.inputRef.current?.focus()}},Hr(m),l],stateAttributesMapping:gs}),v=a===void 0?x?T=>T==="touch"?i.state.popupRef.current:d:!1:a;let R;return p!=null?R=p:R=x?void 0:!1,j.jsx(yo,{context:g,disabled:!P,modal:!x,openInteractionType:O,initialFocus:v,returnFocus:R,children:I})}),Wn=s.createContext(void 0);function $n(){const e=s.useContext(Wn);if(!e)throw new Error(rt(19));return e}const bs=s.createContext(!1);function xs(){return s.useContext(bs)}const Is=s.memo(s.forwardRef(function(t,n){const{render:r,className:f,value:a=null,index:p,disabled:l=!1,nativeButton:i=!1,...c}=t,g=s.useRef(!1),u=s.useRef(null),P=So({index:p,textRef:u,indexGuessBehavior:Fn.GuessFromOrder}),h=Ke(),O=xs(),{flatFilteredItems:m}=ot(),x=y(h,C.open),d=y(h,C.selectionMode),o=y(h,C.readOnly),M=y(h,C.virtualized),I=y(h,C.isItemEqualToValue),w=d!=="none",v=p??(M?rn(m,a,I):P.index),R=P.index!==-1,T=y(h,C.id),z=y(h,C.isActive,v),re=y(h,C.isSelected,a),q=y(h,C.items),ie=y(h,C.getItemProps),X=s.useRef(null),K=T!=null&&R?`${T}-${v}`:void 0,S=re&&w;ne(()=>{if(!(R&&(M||p!=null)))return;const A=h.state.listRef.current;return A[v]=X.current,()=>{delete A[v]}},[R,M,v,p,h]),ne(()=>{if(!R||q)return;const Q=h.state.valuesRef.current;return Q[v]=a,d!=="none"&&h.state.allValuesRef.current.push(a),()=>{delete Q[v]}},[R,q,v,a,h,d]),ne(()=>{if(!x){g.current=!1;return}if(!R||q)return;const Q=h.state.selectedValue,A=Array.isArray(Q)?Q[Q.length-1]:Q;at(A,a,I)&&h.set("selectedIndex",v)},[R,q,x,h,v,a,I]);const U=s.useMemo(()=>({disabled:l,selected:S,highlighted:z}),[l,S,z]),ae=ie({active:z,selected:S});ae.id=void 0,ae.onFocus=void 0;const{getButtonProps:ye,buttonRef:Z}=un({disabled:l,focusableWhenDisabled:!0,native:i});function k(Q){function A(){h.state.handleSelection(Q,a)}h.state.submitOnItemClick?(Vn.flushSync(A),h.state.requestSubmit()):A()}const G={id:K,role:O?"gridcell":"option","aria-disabled":l||void 0,"aria-selected":w?S:void 0,tabIndex:void 0,onPointerDownCapture(Q){g.current=!0,Q.preventDefault()},onClick(Q){l||o||k(Q.nativeEvent)},onMouseUp(Q){const A=g.current;g.current=!1,!(l||o||Q.button!==0||A||!z)&&k(Q.nativeEvent)}},pe=Be("div",t,{ref:[Z,n,P.ref,X],state:U,props:[ae,G,c,ye]}),J=s.useMemo(()=>({selected:S,textRef:u}),[S,u]);return j.jsx(Wn.Provider,{value:J,children:pe})})),ys=s.forwardRef(function(t,n){const{render:r,className:f,children:a,...p}=t,{filteredItems:l}=ot(),i=Ke(),c=l.length===0?a:null;return Be("div",t,{ref:[n,i.state.emptyRef],props:[{children:c,role:"status","aria-live":"polite","aria-atomic":!0},p]})});function Cs(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:f,...a}=e;return j.jsx(Xo,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:f})}const vs=s.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:f}=$n();return r||f?j.jsx(Rs,{...t,ref:n}):null}),Rs=s.memo(s.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:f,...a}=e,{selected:p}=$n(),l=s.useRef(null),{transitionStatus:i,setMounted:c}=an(p),g=s.useMemo(()=>({selected:p,transitionStatus:i}),[p,i]),u=Be("span",e,{ref:[t,l],state:g,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:ln});return Ft({open:p,ref:l,onComplete(){p||c(!1)}}),u}));const Es=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Fs=qr("save",Es);function Ps(e){const t=lt.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=j.jsx("path",{d:"M9.1603 1.12218C9.50684 1.34873 9.60427 1.81354 9.37792 2.16038L5.13603 8.66012C5.01614 8.8438 4.82192 8.96576 4.60451 8.99384C4.3871 9.02194 4.1683 8.95335 4.00574 8.80615L1.24664 6.30769C0.939709 6.02975 0.916013 5.55541 1.19372 5.24822C1.47142 4.94102 1.94536 4.91731 2.2523 5.19524L4.36085 7.10461L8.12299 1.33999C8.34934 0.993152 8.81376 0.895638 9.1603 1.12218Z"}),t[0]=n):n=t[0];let r;return t[1]!==e?(r=j.jsx("svg",{fill:"currentcolor",width:"10",height:"10",viewBox:"0 0 10 10",...e,children:n}),t[1]=e,t[2]=r):r=t[2],r}function ws(e){const t=lt.c(4);let n,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=j.jsx("path",{d:"M18 6L6 18"}),r=j.jsx("path",{d:"M6 6l12 12"}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let f;return t[2]!==e?(f=j.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[n,r]}),t[2]=e,t[3]=f):f=t[3],f}function Ms(e){const t=lt.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=j.jsx("path",{d:"M6 9l6 6 6-6"}),t[0]=n):n=t[0];let r;return t[1]!==e?(r=j.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:n}),t[1]=e,t[2]=r):r=t[2],r}function js(e){const t=lt.c(44),{items:n,label:r,placeholder:f,id:a,value:p,defaultValue:l,onValueChange:i,disabled:c,className:g,itemToString:u,itemToIcon:P,variant:h}=e,O=f===void 0?"Search...":f,m=c===void 0?!1:c,x=h===void 0?"default":h,d=s.useId(),o=a||d,M=x==="inline",I=M?Yr:Jr,w=M?Br:Kr,v=m&&(M?zr:Ur);let R;t[0]!==w||t[1]!==v?(R=Vt(w,v),t[0]=w,t[1]=v,t[2]=R):R=t[2];const T=R,z=M?Gr:Wr,re=m&&(M?$r:Qr);let q;t[3]!==z||t[4]!==re?(q=Vt(z,re),t[3]=z,t[4]=re,t[5]=q):q=t[5];const ie=q,X=M?Zr:eo;let K;t[6]!==i?(K=(_,W)=>{i?.(_)},t[6]=i,t[7]=K):K=t[7];const S=K,U=p!==void 0,ae=U?p??void 0:void 0,ye=U?void 0:l??void 0;let Z;t[8]!==g||t[9]!==I?(Z=Vt(I,g),t[8]=g,t[9]=I,t[10]=Z):Z=t[10];let k;t[11]!==o||t[12]!==r?(k=r&&j.jsx("label",{htmlFor:o,children:r}),t[11]=o,t[12]=r,t[13]=k):k=t[13];let G;t[14]!==o||t[15]!==ie||t[16]!==O?(G=j.jsx(ss,{placeholder:O,id:o,className:ie}),t[14]=o,t[15]=ie,t[16]=O,t[17]=G):G=t[17];let pe;t[18]===Symbol.for("react.memo_cache_sentinel")?(pe=Vt(Xr,"combobox-clear"),t[18]=pe):pe=t[18];let J;t[19]===Symbol.for("react.memo_cache_sentinel")?(J=j.jsx(as,{className:pe,"aria-label":"Clear selection",children:j.jsx(ws,{className:En})}),t[19]=J):J=t[19];let Q;t[20]===Symbol.for("react.memo_cache_sentinel")?(Q=j.jsx(ts,{className:to,"aria-label":"Open popup",children:j.jsx(Ms,{className:En})}),t[20]=Q):Q=t[20];let A;t[21]!==X?(A=j.jsxs("div",{className:X,children:[J,Q]}),t[21]=X,t[22]=A):A=t[22];let de;t[23]!==G||t[24]!==A||t[25]!==T?(de=j.jsxs("div",{className:T,children:[G,A]}),t[23]=G,t[24]=A,t[25]=T,t[26]=de):de=t[26];let le;t[27]!==Z||t[28]!==k||t[29]!==de?(le=j.jsxs("div",{className:Z,children:[k,de]}),t[27]=Z,t[28]=k,t[29]=de,t[30]=le):le=t[30];let ue;t[31]===Symbol.for("react.memo_cache_sentinel")?(ue=j.jsx(ys,{className:no,children:"No items found."}),t[31]=ue):ue=t[31];let me;t[32]!==P||t[33]!==u?(me=j.jsx(ps,{children:j.jsx(ms,{className:ro,sideOffset:4,children:j.jsxs(hs,{className:oo,children:[ue,j.jsx(ds,{className:so,children:_=>{const W=!!P;return j.jsxs(Is,{value:_,className:io({withIcon:W}),children:[j.jsx(vs,{className:ao({withIcon:W}),children:j.jsx(Ps,{className:lo})}),P&&j.jsx("div",{className:uo({withIcon:W}),children:P(_)}),j.jsx("div",{className:co({withIcon:W}),children:u?u(_):String(_)})]},u?u(_):String(_))}})]})})}),t[32]=P,t[33]=u,t[34]=me):me=t[34];let E;return t[35]!==m||t[36]!==S||t[37]!==u||t[38]!==n||t[39]!==ae||t[40]!==ye||t[41]!==le||t[42]!==me?(E=j.jsxs(Cs,{items:n,value:ae,defaultValue:ye,onValueChange:S,disabled:m,itemToStringLabel:u,children:[le,me]}),t[35]=m,t[36]=S,t[37]=u,t[38]=n,t[39]=ae,t[40]=ye,t[41]=le,t[42]=me,t[43]=E):E=t[43],E}var _s="_1oq6p8e0",Hs="_1oq6p8e1",qs="_1oq6p8e3",Bs="_1oq6p8e4",Ks="_1oq6p8e5",zs="_1oq6p8e6",Us="_1oq6p8e7",Gs="_1oq6p8e8",Ws="_1oq6p8e9";const Ss=e=>["variant-versions",e],Vs=e=>po({queryKey:Ss(e),queryFn:async()=>{const n=await(await Tn.v1.variants[":id"].versions.$get({param:{id:e}})).json();return"data"in n?n.data:[]},enabled:!!e,staleTime:1e3*60*5}),$s=e=>{const t=lt.c(2);let n;return t[0]!==e?(n=Vs(e),t[0]=e,t[1]=n):n=t[1],fo(n)},Qs=()=>{const e=lt.c(2),t=mo();let n;return e[0]!==t?(n={mutationFn:Os,onSuccess:(r,f)=>{t.invalidateQueries({queryKey:vo(f.configId)})}},e[0]=t,e[1]=n):n=e[1],Co(n)};async function Os(e){const t=await Tn.v1.targeting.set.$post({json:{environmentId:e.environmentId,configId:e.configId,configVariantId:e.configVariantId,variantVersionId:e.variantVersionId}}),n=await t.json();if(!t.ok||!("data"in n))throw new Error("message"in n?n.message:"Failed to set targeting");return n.data}export{Eo as C,Fs as S,Do as a,Fo as b,yt as c,dn as d,Zt as e,zo as f,Zo as g,Go as h,js as i,Ks as j,Ws as k,zs as l,Gs as m,Bs as n,Ss as o,Qs as p,$s as q,_s as r,Hs as s,qs as t,So as u,Us as v};
@@ -0,0 +1 @@
1
+ ._1oq6p8e0{display:flex;justify-content:space-between;align-items:center;gap:.5rem;width:100%;padding-left:.5rem;padding-right:.5rem;position:sticky;top:3rem;padding:.5rem .25rem;height:3rem;border-bottom:1px solid var(--tyy9ow1n);left:0;background-color:var(--tyy9ow2c)}._1oq6p8e1{display:flex;align-items:center;gap:.5rem}._1oq6p8e2{font-size:.75rem;font-weight:500;color:var(--tyy9ow1u)}._1oq6p8e3{min-height:calc(100vh - 9rem);padding:.5rem .75rem}._1oq6p8e4{margin:0 auto}._1oq6p8e5{display:flex;align-items:center;min-height:1.75rem;padding-top:.25rem;padding-bottom:.25rem;gap:1rem}._1oq6p8e6{display:flex;flex-direction:column;align-items:stretch;padding-top:.25rem;padding-bottom:.25rem;gap:1rem;margin-top:1rem}._1oq6p8e7{font-size:.875rem;color:var(--tyy9ow1s);font-weight:400;display:flex;align-items:center;justify-content:space-between;gap:.5rem}._1oq6p8e8{display:flex;align-items:center;gap:.5rem;color:var(--tyy9ow1r);font-size:.75rem;line-height:.875rem}._1oq6p8e9{flex:1;display:flex;align-items:center}._1oq6p8eb{border:none;background-color:transparent;height:1.75rem;outline:none;min-width:8rem}._1oq6p8eb:-moz-placeholder{color:var(--tyy9ow1s)}._1oq6p8eb::-webkit-input-placeholder{color:var(--tyy9ow1s)}._1oq6p8eb::placeholder{color:var(--tyy9ow1s)}._1oq6p8eb:hover{background-color:var(--tyy9ow1l)}._1oq6p8eb:focus{background-color:var(--tyy9ow1m)}._1oq6p8ec{margin-top:1.5rem;padding:1rem}
@@ -0,0 +1 @@
1
+ import{a as l,t as o,i}from"./index-nHWjhrFW.js";const p=t=>["targeting-rules",t],g=t=>{const e=l.c(8);let s;e[0]!==t?(s=p(t),e[0]=t,e[1]=s):s=e[1];let a;e[2]!==t?(a=async()=>{const u=await(await i.v1.targeting.config[":configId"].$get({param:{configId:t}})).json();return"data"in u?u.data:[]},e[2]=t,e[3]=a):a=e[3];const n=!!t;let r;return e[4]!==s||e[5]!==a||e[6]!==n?(r={queryKey:s,queryFn:a,enabled:n},e[4]=s,e[5]=a,e[6]=n,e[7]=r):r=e[7],o(r)};export{p as g,g as u};
@@ -0,0 +1,12 @@
1
+ import{aE as $,b7 as Me,aV as ue,c6 as ae,bA as Ue,c7 as ut,c8 as Je,c9 as at,ca as lt,bx as G,cb as Qe,X as K,bw as Pe,bc as ne,aW as ft,cc as dt,r as d,aG as ve,aO as Ze,bo as De,cd as et,ce as ye,aS as J,ar as Ve,cf as Ne,cg as We,ch as X,bd as Q,a2 as L,bj as pt,ci as Be,ay as bt,at as mt,by as ht,bz as gt,j as ce,b4 as Ge,b0 as Ye,b2 as vt,cj as yt,br as Et,a1 as re,Y as ie,aK as kt,ck as tt,aj as Tt,cl as wt,cm as Rt,cn as je,co as xt,aI as be,cp as Ct,al as St,cq as Ot}from"./index-nHWjhrFW.js";let qe={},$e={},He="";function Ft(e){if(typeof document>"u")return!1;const r=ue(e);return ae(r).innerWidth-r.documentElement.clientWidth>0}function Lt(e){const r=ue(e),t=r.documentElement,n=r.body,o=Je(t)?t:n,i=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=i}}function It(e){const r=ue(e),t=r.documentElement,n=r.body,o=ae(t);let i=0,p=0;const x=lt.create(),E=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(at&&(o.visualViewport?.scale??1)!==1)return()=>{};function R(){const S=o.getComputedStyle(t),u=o.getComputedStyle(n),g=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=t.scrollTop,p=t.scrollLeft,qe={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},He=t.style.scrollBehavior,$e={position:n.style.position,height:n.style.height,width:n.style.width,boxSizing:n.style.boxSizing,overflowY:n.style.overflowY,overflowX:n.style.overflowX,scrollBehavior:n.style.scrollBehavior};const y=t.scrollHeight>t.clientHeight,f=t.scrollWidth>t.clientWidth,a=S.overflowY==="scroll"||u.overflowY==="scroll",V=S.overflowX==="scroll"||u.overflowX==="scroll",O=Math.max(0,o.innerWidth-t.clientWidth),A=Math.max(0,o.innerHeight-t.clientHeight),M=parseFloat(u.marginTop)+parseFloat(u.marginBottom),_=parseFloat(u.marginLeft)+parseFloat(u.marginRight),I=Je(t)?t:n;if(E){t.style.scrollbarGutter=g,I.style.overflowY="hidden",I.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:g,overflowY:"hidden",overflowX:"hidden"}),(y||a)&&(t.style.overflowY="scroll"),(f||V)&&(t.style.overflowX="scroll"),Object.assign(n.style,{position:"relative",height:M||A?`calc(100dvh - ${M+A}px)`:"100dvh",width:_||O?`calc(100vw - ${_+O}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),n.scrollTop=i,n.scrollLeft=p,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function C(){Object.assign(t.style,qe),Object.assign(n.style,$e),E||(t.scrollTop=i,t.scrollLeft=p,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=He)}function D(){C(),x.request(R)}return R(),o.addEventListener("resize",D),()=>{x.cancel(),C(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",D)}}class At{lockCount=0;restore=null;timeoutLock=Me.create();timeoutUnlock=Me.create();acquire(r){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(r)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(r){if(this.lockCount===0||this.restore!==null)return;const n=ue(r).documentElement,o=ae(n).getComputedStyle(n).overflowY;if(o==="hidden"||o==="clip"){this.restore=Ue;return}const i=ut||!Ft(r);this.restore=i?Lt(r):It(r)}}const Mt=new At;function $t(e=!0,r=null){$(()=>{if(e)return Mt.acquire(r)},[e,r])}let Xe=0;function me(e,r={}){const{preventScroll:t=!1,cancelPrevious:n=!0,sync:o=!1}=r;n&&cancelAnimationFrame(Xe);const i=()=>e?.focus({preventScroll:t});o?i():Xe=requestAnimationFrame(i)}const z={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Ke(e){return e==="inert"?z.inert:e==="aria-hidden"?z["aria-hidden"]:z.none}let oe=new WeakSet,se={},he=0;const nt=e=>e&&(e.host||nt(e.parentNode)),Pt=(e,r)=>r.map(t=>{if(e.contains(t))return t;const n=nt(t);return e.contains(n)?n:null}).filter(t=>t!=null);function Dt(e,r,t,n){const o="data-base-ui-inert",i=n?"inert":t?"aria-hidden":null,p=Pt(r,e),x=new Set,E=new Set(p),R=[];se[o]||(se[o]=new WeakMap);const C=se[o];p.forEach(D),S(r),x.clear();function D(u){!u||x.has(u)||(x.add(u),u.parentNode&&D(u.parentNode))}function S(u){!u||E.has(u)||[].forEach.call(u.children,b=>{if(Qe(b)!=="script")if(x.has(b))S(b);else{const F=i?b.getAttribute(i):null,g=F!==null&&F!=="false",y=Ke(i),f=(y.get(b)||0)+1,a=(C.get(b)||0)+1;y.set(b,f),C.set(b,a),R.push(b),f===1&&g&&oe.add(b),a===1&&b.setAttribute(o,""),!g&&i&&b.setAttribute(i,i==="inert"?"":"true")}})}return he+=1,()=>{R.forEach(u=>{const b=Ke(i),g=(b.get(u)||0)-1,y=(C.get(u)||0)-1;b.set(u,g),C.set(u,y),g||(!oe.has(u)&&i&&u.removeAttribute(i),oe.delete(u)),y||u.removeAttribute(o)}),he-=1,he||(z.inert=new WeakMap,z["aria-hidden"]=new WeakMap,z.none=new WeakMap,oe=new WeakSet,se={})}}function Vt(e,r=!1,t=!1){const n=G(e[0]).body;return Dt(e.concat(Array.from(n.querySelectorAll("[aria-live]"))),n,r,t)}function Nt(e,r){const t=ae(e.target);return e instanceof t.KeyboardEvent?"keyboard":e instanceof t.FocusEvent?r||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof t.MouseEvent?r||(e.detail===0?"keyboard":"mouse"):""}const ze=20;let Y=[];function Ee(){Y=Y.filter(e=>e.isConnected)}function Wt(e){Ee(),e&&Qe(e)!=="body"&&(Y.push(e),Y.length>ze&&(Y=Y.slice(-ze)))}function ge(){return Ee(),Y[Y.length-1]}function Bt(e){if(!e)return null;const r=ye();return tt(e,r)?e:et(e,r)[0]||e}function Gt(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Rt(e).display!=="none"}function _e(e,r){if(!r.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const t=ye(),o=wt(e,t).filter(p=>{const x=p.getAttribute("data-tabindex")||"";return tt(p,t)||p.hasAttribute("data-tabindex")&&!x.startsWith("-")}),i=e.getAttribute("tabindex");r.current.includes("floating")||o.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Ht(e){const{context:r,children:t,disabled:n=!1,order:o=["content"],initialFocus:i=!0,returnFocus:p=!0,restoreFocus:x=!1,modal:E=!0,closeOnFocusOut:R=!0,openInteractionType:C="",getInsideElements:D=()=>[],nextFocusableElement:S,previousFocusableElement:u,beforeContentFocusGuardRef:b,externalTree:F}=e,g="rootStore"in r?r.rootStore:r,y=g.useState("open"),f=g.useState("domReferenceElement"),a=g.useState("floatingElement"),{events:V,dataRef:O}=g.context,A=K(()=>O.current.floatingContext?.nodeId),M=K(D),_=i===!1,I=Pe(f)&&_,j=ne(o),ke=ne(i),Z=ne(p),Te=ne(C),N=ft(F),k=dt(),rt=d.useRef(null),ot=d.useRef(null),W=d.useRef(!1),ee=d.useRef(!1),le=d.useRef(!1),we=d.useRef(-1),Re=d.useRef(""),fe=d.useRef(""),xe=ve(),Ce=ve(),Se=Ze(),de=k!=null,l=De(a),q=K((c=l)=>c?et(c,ye()):[]),U=K(c=>{const m=q(c);return j.current.map(()=>m).filter(Boolean).flat()});d.useEffect(()=>{if(n||!E)return;function c(T){T.key==="Tab"&&L(l,Q(G(l)))&&q().length===0&&!I&&Et(T)}const m=G(l);return m.addEventListener("keydown",c),()=>{m.removeEventListener("keydown",c)}},[n,f,l,E,j,I,q,U]),d.useEffect(()=>{if(n||!a)return;function c(m){const T=re(m),w=q().indexOf(T);w!==-1&&(we.current=w)}return a.addEventListener("focusin",c),()=>{a.removeEventListener("focusin",c)}},[n,a,q]),d.useEffect(()=>{if(n||!y)return;const c=G(l);function m(){le.current=!1}function T(w){const s=re(w),h=L(a,s)||L(f,s)||L(k?.portalNode,s);le.current=!h,fe.current=w.pointerType||"keyboard"}function v(){fe.current="keyboard"}return c.addEventListener("pointerdown",T,!0),c.addEventListener("pointerup",m,!0),c.addEventListener("pointercancel",m,!0),c.addEventListener("keydown",v,!0),()=>{c.removeEventListener("pointerdown",T,!0),c.removeEventListener("pointerup",m,!0),c.removeEventListener("pointercancel",m,!0),c.removeEventListener("keydown",v,!0)}},[n,a,f,l,y,k]),d.useEffect(()=>{if(n||!R)return;function c(){ee.current=!0,Ce.start(0,()=>{ee.current=!1})}function m(s){const h=s.relatedTarget,H=s.currentTarget,P=re(s);queueMicrotask(()=>{const te=A(),Ie=g.context.triggerElements,it=!(L(f,h)||L(a,h)||L(h,a)||L(k?.portalNode,h)||h!=null&&Ie.hasElement(h)||Ie.hasMatchingElement(B=>L(B,h))||h?.hasAttribute(Ne("focus-guard"))||N&&(Be(N.nodesRef.current,te).find(B=>L(B.context?.elements.floating,h)||L(B.context?.elements.domReference,h))||We(N.nodesRef.current,te).find(B=>[B.context?.elements.floating,De(B.context?.elements.floating)].includes(h)||B.context?.elements.domReference===h)));if(H===f&&l&&_e(l,j),x&&H!==f&&!Gt(P)&&Q(G(l))===G(l).body){if(J(l)&&(l.focus(),x==="popup")){Se.request(()=>{l.focus()});return}const B=we.current,pe=q(),Ae=pe[B]||pe[pe.length-1]||l;J(Ae)&&Ae.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(I||!E)&&h&&it&&!ee.current&&(I||h!==ge())&&(W.current=!0,g.setOpen(!1,ie(kt,s)))})}function T(){le.current||(O.current.insideReactTree=!0,xe.start(0,()=>{O.current.insideReactTree=!1}))}const v=J(f)?f:null,w=[];if(!(!a&&!v))return v&&(v.addEventListener("focusout",m),v.addEventListener("pointerdown",c),w.push(()=>{v.removeEventListener("focusout",m),v.removeEventListener("pointerdown",c)})),a&&(a.addEventListener("focusout",m),k&&(a.addEventListener("focusout",T,!0),w.push(()=>{a.removeEventListener("focusout",T,!0)})),w.push(()=>{a.removeEventListener("focusout",m)})),()=>{w.forEach(s=>{s()})}},[n,f,a,l,E,N,k,g,R,x,q,I,A,j,O,xe,Ce,Se]);const Oe=d.useRef(null),Fe=d.useRef(null),st=Ve(Oe,b,k?.beforeInsideRef),ct=Ve(Fe,k?.afterInsideRef);d.useEffect(()=>{if(n||!a||!y)return;const c=Array.from(k?.portalNode?.querySelectorAll(`[${Ne("portal")}]`)||[]),T=(N?We(N.nodesRef.current,A()):[]).find(s=>Pe(s.context?.elements.domReference||null))?.context?.elements.domReference,v=[a,T,...c,...M(),rt.current,ot.current,Oe.current,Fe.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,X(u),X(S),I?f:null].filter(s=>s!=null),w=Vt(v,E||I);return()=>{w()}},[y,n,f,a,E,j,k,I,N,A,M,S,u]),$(()=>{if(!y||n||!J(l))return;const c=G(l),m=Q(c);queueMicrotask(()=>{const T=U(l),v=ke.current,w=typeof v=="function"?v(Te.current||""):v;if(w===void 0||w===!1)return;let s;w===!0||w===null?s=T[0]||l:s=X(w),s=s||T[0]||l,!L(l,m)&&me(s,{preventScroll:s===l})})},[n,y,l,_,U,ke,Te]),$(()=>{if(n||!l)return;const c=G(l),m=Q(c);Wt(m);function T(s){if(s.open||(Re.current=Nt(s.nativeEvent,fe.current)),s.reason===bt&&s.nativeEvent.type==="mouseleave"&&(W.current=!0),s.reason===mt)if(s.nested)W.current=!1;else if(ht(s.nativeEvent)||gt(s.nativeEvent))W.current=!1;else{let h=!1;document.createElement("div").focus({get preventScroll(){return h=!0,!1}}),h?W.current=!1:W.current=!0}}V.on("openchange",T);const v=c.createElement("span");v.setAttribute("tabindex","-1"),v.setAttribute("aria-hidden","true"),Object.assign(v.style,pt),de&&f&&f.insertAdjacentElement("afterend",v);function w(){const s=Z.current;let h=typeof s=="function"?s(Re.current):s;if(h===void 0||h===!1)return null;if(h===null&&(h=!0),typeof h=="boolean"){const P=f||ge();return P&&P.isConnected?P:v}const H=f||ge()||v;return X(h)||H}return()=>{V.off("openchange",T);const s=Q(c),h=L(a,s)||N&&Be(N.nodesRef.current,A(),!1).some(P=>L(P.context?.elements.floating,s)),H=w();queueMicrotask(()=>{const P=Bt(H),te=typeof Z.current!="boolean";Z.current&&!W.current&&J(P)&&(!(!te&&P!==s&&s!==c.body)||h)&&P.focus({preventScroll:!0}),v.remove()})}},[n,a,l,Z,O,V,N,de,f,A]),d.useEffect(()=>{queueMicrotask(()=>{W.current=!1})},[n]),d.useEffect(()=>{if(n||!y)return;function c(T){re(T)?.closest(`[${Tt}]`)&&(ee.current=!0)}const m=G(l);return m.addEventListener("pointerdown",c,!0),()=>{m.removeEventListener("pointerdown",c,!0)}},[n,y,l]),$(()=>{if(!n&&k)return k.setFocusManagerState({modal:E,closeOnFocusOut:R,open:y,onOpenChange:g.setOpen,domReference:f}),()=>{k.setFocusManagerState(null)}},[n,k,E,y,g,R,f]),$(()=>{if(!(n||!l))return _e(l,j),()=>{queueMicrotask(Ee)}},[n,l,j]);const Le=!n&&(E?!I:!0)&&(de||E);return ce.jsxs(d.Fragment,{children:[Le&&ce.jsx(Ge,{"data-type":"inside",ref:st,onFocus:c=>{if(E){const m=U();me(m[m.length-1])}else k?.portalNode&&(W.current=!1,Ye(c,k.portalNode)?vt(f)?.focus():X(u??k.beforeOutsideRef)?.focus())}}),t,Le&&ce.jsx(Ge,{"data-type":"inside",ref:ct,onFocus:c=>{E?me(U()[0]):k?.portalNode&&(R&&(W.current=!0),Ye(c,k.portalNode)?yt(f)?.focus():X(S??k.afterOutsideRef)?.focus())}})]})}function Xt(e,r={}){const t="rootStore"in e?e.rootStore:e,n=t.context.dataRef,{enabled:o=!0,event:i="click",toggle:p=!0,ignoreMouse:x=!1,stickIfOpen:E=!0,touchOpenDelay:R=0}=r,C=d.useRef(void 0),D=Ze(),S=ve(),u=d.useMemo(()=>({onPointerDown(b){C.current=b.pointerType},onMouseDown(b){const F=C.current,g=b.nativeEvent,y=t.select("open");if(b.button!==0||i==="click"||je(F,!0)&&x)return;const f=n.current.openEvent,a=f?.type,V=t.select("domReferenceElement")!==b.currentTarget,O=y&&V||!(y&&p&&(!(f&&E)||a==="click"||a==="mousedown"));if(Ct(g.target)){const M=ie(be,g,g.target);O&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,M)}):t.setOpen(O,M);return}const A=b.currentTarget;D.request(()=>{const M=ie(be,g,A);O&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,M)}):t.setOpen(O,M)})},onClick(b){if(i==="mousedown-only")return;const F=C.current;if(i==="mousedown"&&F){C.current=void 0;return}if(je(F,!0)&&x)return;const g=t.select("open"),y=n.current.openEvent,f=t.select("domReferenceElement")!==b.currentTarget,a=g&&f||!(g&&p&&(!(y&&E)||xt(y))),V=ie(be,b.nativeEvent,b.currentTarget);a&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,V)}):t.setOpen(a,V)},onKeyDown(){C.current=void 0}}),[n,i,x,t,E,p,D,S,R]);return d.useMemo(()=>o?{reference:u}:St,[o,u])}function Yt(e){const r=d.useRef(""),t=d.useCallback(o=>{o.defaultPrevented||(r.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:d.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,r.current),r.current=""},[e]),onPointerDown:t}}function Kt(e){const[r,t]=d.useState(null),n=K((x,E)=>{e||t(E)}),o=d.useCallback(()=>{t(null)},[]),{onClick:i,onPointerDown:p}=Yt(n);return d.useMemo(()=>({openMethod:r,reset:o,triggerProps:{onClick:i,onPointerDown:p}}),[r,o,i,p])}function zt(e){return Ot(19)?e:e?"true":void 0}const _t=d.forwardRef(function(r,t){const{cutout:n,...o}=r;let i;if(n){const p=n?.getBoundingClientRect();i=`polygon(
2
+ 0% 0%,
3
+ 100% 0%,
4
+ 100% 100%,
5
+ 0% 100%,
6
+ 0% 0%,
7
+ ${p.left}px ${p.top}px,
8
+ ${p.left}px ${p.bottom}px,
9
+ ${p.right}px ${p.bottom}px,
10
+ ${p.right}px ${p.top}px,
11
+ ${p.left}px ${p.top}px
12
+ )`}return ce.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:i}})}),jt=d.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ue,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ut(){return d.useContext(jt)}function Jt(e,r){const t=d.useRef(e),n=K(r);$(()=>{t.current!==e&&n(t.current)},[e,n]),$(()=>{t.current=e},[e])}export{Ht as F,_t as I,$t as a,Xt as b,Jt as c,jt as d,Ut as e,me as f,zt as i,Kt as u};
@@ -0,0 +1 @@
1
+ import{l as n,a as s,j as t}from"./index-nHWjhrFW.js";import{i as c}from"./info-box.css-DyjK40Ax.js";/* empty css */const a=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],r=n("info",a);function p(){const e=s.c(2);if((window.bootstrapData?.authType||"basic")==="basic"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsxs("div",{className:c,children:[t.jsx(r,{size:16}),t.jsx("span",{children:"You are using basic authentication. Profile settings cannot be changed in this mode."})]})}),e[0]=i):i=e[0],i}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{children:t.jsx("h2",{children:"Profile"})}),e[1]=o):o=e[1],o}export{p as component};
@@ -0,0 +1 @@
1
+ import{a as v,A as g,g as C,d as y,j as s,C as b,I as V}from"./index-nHWjhrFW.js";import{B as I}from"./button-D46pme1q.js";import{b as p,e as c,a as T,c as x,T as N,d as _}from"./table-SKwX9qUc.js";import{u as $}from"./useConfigVariants-CIAilMey.js";import{v as k,a as R}from"./variants.css-C4fJhzPe.js";import{P as w}from"./plus-5oc_diIr.js";/* empty css */import"./useButton-DfUAk02P.js";function L(){const e=v.c(18),{id:a}=g.useParams(),j=C(),{data:d,isLoading:u}=$(a),i=y();if(u){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{children:"Loading variants..."}),e[0]=n):n=e[0],n}let t;e[1]!==a||e[2]!==i?(t=()=>{i({to:"/configs/$id/variants/$variant",params:{id:a,variant:"new"}})},e[1]=a,e[2]=i,e[3]=t):t=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(V,{icon:w}),e[4]=m):m=e[4];let r;e[5]!==t?(r=s.jsx("div",{className:k,children:s.jsxs(I,{variant:"ghost",onClick:t,children:[m,"Add Variant"]})}),e[5]=t,e[6]=r):r=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(T,{children:s.jsxs(p,{children:[s.jsx(x,{children:"Name"}),s.jsx(x,{children:"Provider"}),s.jsx(x,{children:"Model"}),s.jsx(x,{children:"Current Version"})]})}),e[7]=f):f=e[7];let o;e[8]!==a||e[9]!==d||e[10]!==i||e[11]!==j?(o=d&&d.length>0?d.map(n=>s.jsxs(p,{interactive:!0,onMouseEnter:()=>{j.prefetchQuery(b(n.variantId))},onClick:()=>i({to:"/configs/$id/variants/$variant",params:{id:a,variant:n.variantId}}),children:[s.jsx(c,{children:n.name||"Unnamed Variant"}),s.jsx(c,{children:n.provider||"Unknown"}),s.jsx(c,{children:n.modelName||"Unknown"}),s.jsx(c,{children:n.latestVersion?.version?`v${n.latestVersion.version}`:"-"})]},n.variantId)):s.jsx(p,{children:s.jsx(c,{colSpan:4,style:{textAlign:"center",padding:"2rem"},children:'No variants added yet. Click "Add Variant" to get started.'})}),e[8]=a,e[9]=d,e[10]=i,e[11]=j,e[12]=o):o=e[12];let l;e[13]!==o?(l=s.jsxs(N,{children:[f,s.jsx(_,{children:o})]}),e[13]=o,e[14]=l):l=e[14];let h;return e[15]!==r||e[16]!==l?(h=s.jsxs("div",{className:R,children:[r,l]}),e[15]=r,e[16]=l,e[17]=h):h=e[17],h}export{L as component};
@@ -0,0 +1 @@
1
+ import"./index-nHWjhrFW.js";var r="tye0o0",t="tye0o1";export{r as a,t as v};
@@ -0,0 +1 @@
1
+ ._1ervu4v0{max-width:600px}._1ervu4v1{display:flex;flex-direction:column;gap:2rem}._1ervu4v2{display:flex;flex-direction:column;gap:1rem}._1ervu4v3{font-size:.875rem;font-weight:600;color:var(--tyy9ow1v);margin:0}._1ervu4v4{font-size:.75rem;color:var(--tyy9ow1s);margin:0}._1ervu4v5{display:block;font-size:.75rem;color:var(--tyy9ow1s);margin-bottom:.5rem}._1ervu4v7{height:2rem;border:1px solid var(--tyy9ow1n);outline:none;width:100%;max-width:200px}._1ervu4v7:-moz-placeholder{color:var(--tyy9ow1q)}._1ervu4v7::-webkit-input-placeholder{color:var(--tyy9ow1q)}._1ervu4v7::placeholder{color:var(--tyy9ow1q)}._1ervu4v7:focus{border-color:var(--tyy9ow8)}
@@ -0,0 +1 @@
1
+ import{a as g,t as w,i as h,g as x,r as _,j as a}from"./index-nHWjhrFW.js";import{u as S}from"./useMutation-ppBqjQps.js";/* empty css */const k=()=>["workspace-settings"],N=()=>{const e=g.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t={queryKey:k(),queryFn:$},e[0]=t):t=e[0],w(t)};async function $(){const t=await(await h.v1["workspace-settings"].$get()).json();return"data"in t?t.data:null}const E=()=>{const e=g.c(2),t=x();let s;return e[0]!==t?(s={mutationFn:C,onSuccess:()=>{t.invalidateQueries({queryKey:k()})}},e[0]=t,e[1]=s):s=e[1],S(s)};async function C(e){const t=await h.v1["workspace-settings"].$patch({json:{name:e.name}}),s=await t.json();if(!t.ok||!("data"in s))throw new Error("message"in s?s.message:"Failed to update workspace settings");return s.data}var y="_1ervu4v0",F="_1ervu4v1",K="_1ervu4v2",q="_1ervu4v5",Q="_1ervu4v7 _1ervu4v6 _1lg22bkv0 _1lg22bkuc _1lg22bk26 _1lg22bk2u _1lg22bkbc _1lg22bkj9";function B(){const e=g.c(14),{data:t,isLoading:s}=N(),p=E(),[r,f]=_.useState("");let o;e[0]!==t?(o=()=>{t?.name!==void 0&&f(t.name??"")},e[0]=t,e[1]=o):o=e[1];const d=t?.name;let i;e[2]!==d?(i=[d],e[2]=d,e[3]=i):i=e[3],_.useEffect(o,i);let c;e[4]!==r||e[5]!==t?.name||e[6]!==p?(c=()=>{const n=r.trim(),j=t?.name??"";n!==j&&p.mutate({name:n||null})},e[4]=r,e[5]=t?.name,e[6]=p,e[7]=c):c=e[7],t?.name;const v=c,b=L;if(s){let n;return e[8]===Symbol.for("react.memo_cache_sentinel")?(n=a.jsx("div",{className:y,children:"Loading..."}),e[8]=n):n=e[8],n}let l;e[9]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx("label",{className:q,children:"Name of your workspace"}),e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=n=>f(n.target.value),e[10]=u):u=e[10];let m;return e[11]!==v||e[12]!==r?(m=a.jsx("div",{className:y,children:a.jsx("div",{className:F,children:a.jsx("div",{className:K,children:a.jsxs("div",{children:[l,a.jsx("input",{type:"text",className:Q,value:r,onChange:u,onBlur:v,onKeyDown:b,placeholder:"Workspace name"})]})})})}),e[11]=v,e[12]=r,e[13]=m):m=e[13],m}function L(e){e.key==="Enter"&&e.currentTarget.blur()}export{B as component};
package/dist/index.cjs CHANGED
@@ -62,7 +62,7 @@ let node_process = require("node:process");
62
62
  let __llmops_core_db = require("@llmops/core/db");
63
63
 
64
64
  //#region src/client/index.tsx?url
65
- var client_default = "/assets/index-8q56yhPq.js";
65
+ var client_default = "/assets/index-nHWjhrFW.js";
66
66
 
67
67
  //#endregion
68
68
  //#region src/client/styles/styles.css?url
@@ -93,7 +93,7 @@ const ReactRefresh = () => {
93
93
  const { renderToString } = react_dom_server.default;
94
94
  const manifestPath = (0, node_path.join)((0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)), "./.vite/manifest.json");
95
95
  const manifest = (0, node_fs.existsSync)(manifestPath) ? JSON.parse((0, node_fs.readFileSync)(manifestPath, "utf-8")) : {};
96
- const renderer = ({ basePath = "", dev = false, llmProviders }) => {
96
+ const renderer = ({ basePath = "", dev = false, llmProviders, authType }) => {
97
97
  const stylesPath = basePath === "/" ? styles_default : basePath + styles_default;
98
98
  const clientPath = basePath === "/" ? client_default : basePath + client_default;
99
99
  const faviconPath = basePath === "/" ? "/favicon.ico" : basePath + "/assets/favicon.ico";
@@ -356,7 +356,8 @@ const renderer = ({ basePath = "", dev = false, llmProviders }) => {
356
356
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("script", { children: `
357
357
  window.bootstrapData = {
358
358
  basePath: "${basePath}",
359
- llmProviders: ${JSON.stringify(llmProviders || [])}
359
+ llmProviders: ${JSON.stringify(llmProviders || [])},
360
+ authType: "${authType || "basic"}"
360
361
  };
361
362
  ` }),
362
363
  dev && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReactRefresh, {})
@@ -12740,7 +12741,7 @@ const internalServerError = (message, code) => {
12740
12741
 
12741
12742
  //#endregion
12742
12743
  //#region src/server/handlers/configs/index.ts
12743
- const app$8 = new hono.Hono().post("/", zv("json", zod_default.object({ name: zod_default.string().min(1) })), async (c) => {
12744
+ const app$9 = new hono.Hono().post("/", zv("json", zod_default.object({ name: zod_default.string().min(1) })), async (c) => {
12744
12745
  const db = c.get("db");
12745
12746
  try {
12746
12747
  const value = await db.createNewConfig({ name: c.req.valid("json").name });
@@ -12844,7 +12845,7 @@ const app$8 = new hono.Hono().post("/", zv("json", zod_default.object({ name: zo
12844
12845
  return c.json(internalServerError("Failed to delete config", 500), 500);
12845
12846
  }
12846
12847
  });
12847
- var configs_default = app$8;
12848
+ var configs_default = app$9;
12848
12849
 
12849
12850
  //#endregion
12850
12851
  //#region src/server/handlers/environments/index.ts
@@ -12855,7 +12856,7 @@ var configs_default = app$8;
12855
12856
  const generateSecretKey$1 = (slug) => {
12856
12857
  return `sec_${slug.slice(0, 4).toLowerCase()}_${(0, __llmops_core.generateId)(24)}`;
12857
12858
  };
12858
- const app$7 = new hono.Hono().post("/", zv("json", zod_default.object({
12859
+ const app$8 = new hono.Hono().post("/", zv("json", zod_default.object({
12859
12860
  name: zod_default.string().min(1),
12860
12861
  slug: zod_default.string().min(1),
12861
12862
  isProd: zod_default.boolean().optional()
@@ -12940,7 +12941,7 @@ const app$7 = new hono.Hono().post("/", zv("json", zod_default.object({
12940
12941
  return c.json(internalServerError("Failed to fetch environment secrets", 500), 500);
12941
12942
  }
12942
12943
  });
12943
- var environments_default = app$7;
12944
+ var environments_default = app$8;
12944
12945
 
12945
12946
  //#endregion
12946
12947
  //#region src/server/handlers/providers/index.ts
@@ -12960,7 +12961,7 @@ async function fetchModelsDevData() {
12960
12961
  cacheTimestamp = now;
12961
12962
  return modelsCache;
12962
12963
  }
12963
- const app$6 = new hono.Hono().get("/", async (c) => {
12964
+ const app$7 = new hono.Hono().get("/", async (c) => {
12964
12965
  try {
12965
12966
  const data = await fetchModelsDevData();
12966
12967
  const providers = Object.values(data).map((provider) => ({
@@ -13068,11 +13069,11 @@ const app$6 = new hono.Hono().get("/", async (c) => {
13068
13069
  return c.json(internalServerError("Failed to fetch models", 500), 500);
13069
13070
  }
13070
13071
  });
13071
- var providers_default = app$6;
13072
+ var providers_default = app$7;
13072
13073
 
13073
13074
  //#endregion
13074
13075
  //#region src/server/handlers/targeting/index.ts
13075
- const app$5 = new hono.Hono().post("/", zv("json", zod_default.object({
13076
+ const app$6 = new hono.Hono().post("/", zv("json", zod_default.object({
13076
13077
  environmentId: zod_default.string().uuid(),
13077
13078
  configId: zod_default.string().uuid(),
13078
13079
  configVariantId: zod_default.string().uuid(),
@@ -13199,11 +13200,11 @@ const app$5 = new hono.Hono().post("/", zv("json", zod_default.object({
13199
13200
  return c.json(internalServerError("Failed to set targeting for environment", 500), 500);
13200
13201
  }
13201
13202
  });
13202
- var targeting_default = app$5;
13203
+ var targeting_default = app$6;
13203
13204
 
13204
13205
  //#endregion
13205
13206
  //#region src/server/handlers/variants.ts
13206
- const app$4 = new hono.Hono().get("/:id", zv("param", zod_default.object({ id: zod_default.string().uuid() })), async (c) => {
13207
+ const app$5 = new hono.Hono().get("/:id", zv("param", zod_default.object({ id: zod_default.string().uuid() })), async (c) => {
13207
13208
  const db = c.get("db");
13208
13209
  const { id } = c.req.valid("param");
13209
13210
  const versionParam = c.req.query("version");
@@ -13350,7 +13351,31 @@ const app$4 = new hono.Hono().get("/:id", zv("param", zod_default.object({ id: z
13350
13351
  return c.json(internalServerError("Failed to fetch variant version", 500), 500);
13351
13352
  }
13352
13353
  });
13353
- var variants_default = app$4;
13354
+ var variants_default = app$5;
13355
+
13356
+ //#endregion
13357
+ //#region src/server/handlers/workspace-settings/index.ts
13358
+ const app$4 = new hono.Hono().get("/", async (c) => {
13359
+ const db = c.get("db");
13360
+ try {
13361
+ const settings = await db.getWorkspaceSettings();
13362
+ return c.json(successResponse(settings, 200));
13363
+ } catch (error$45) {
13364
+ console.error("Error fetching workspace settings:", error$45);
13365
+ return c.json(internalServerError("Failed to fetch workspace settings", 500), 500);
13366
+ }
13367
+ }).patch("/", zv("json", zod_default.object({ name: zod_default.string().nullable().optional() })), async (c) => {
13368
+ const db = c.get("db");
13369
+ const body = c.req.valid("json");
13370
+ try {
13371
+ const settings = await db.updateWorkspaceSettings(body);
13372
+ return c.json(successResponse(settings, 200));
13373
+ } catch (error$45) {
13374
+ console.error("Error updating workspace settings:", error$45);
13375
+ return c.json(internalServerError("Failed to update workspace settings", 500), 500);
13376
+ }
13377
+ });
13378
+ var workspace_settings_default = app$4;
13354
13379
 
13355
13380
  //#endregion
13356
13381
  //#region src/server/handlers/v1.ts
@@ -13371,7 +13396,7 @@ const app$3 = new hono.Hono().use("*", async (c, next) => {
13371
13396
  error: "Auth middleware not configured",
13372
13397
  message: `Auth type "${config$1.auth.type}" requires @llmops/enterprise middleware. Either use basicAuth() from @llmops/sdk or install @llmops/enterprise and add the auth middleware.`
13373
13398
  }, 501);
13374
- }).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default);
13399
+ }).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default).route("/workspace-settings", workspace_settings_default);
13375
13400
  var v1_default = app$3;
13376
13401
 
13377
13402
  //#endregion
@@ -13604,10 +13629,12 @@ app.use("/assets/*", (0, hono_serve_static.serveStatic)({
13604
13629
  if (!c.req.path.startsWith("/api")) {
13605
13630
  const basePath = c.var.llmopsConfig?.basePath || "";
13606
13631
  const llmProviders = c.var.llmProviders || [];
13632
+ const authType = c.var.llmopsConfig?.auth?.type || "basic";
13607
13633
  return c.html(renderer({
13608
13634
  basePath,
13609
13635
  dev: node_process.env.LLMOPS_DEV === "true",
13610
- llmProviders
13636
+ llmProviders,
13637
+ authType
13611
13638
  }));
13612
13639
  }
13613
13640
  await next();
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ var __export = (all, symbols) => {
36
36
 
37
37
  //#endregion
38
38
  //#region src/client/index.tsx?url
39
- var client_default = "/assets/index-8q56yhPq.js";
39
+ var client_default = "/assets/index-nHWjhrFW.js";
40
40
 
41
41
  //#endregion
42
42
  //#region src/client/styles/styles.css?url
@@ -67,7 +67,7 @@ const ReactRefresh = () => {
67
67
  const { renderToString } = reactServer;
68
68
  const manifestPath = join(dirname(fileURLToPath(import.meta.url)), "./.vite/manifest.json");
69
69
  const manifest = existsSync(manifestPath) ? JSON.parse(readFileSync(manifestPath, "utf-8")) : {};
70
- const renderer = ({ basePath = "", dev = false, llmProviders }) => {
70
+ const renderer = ({ basePath = "", dev = false, llmProviders, authType }) => {
71
71
  const stylesPath = basePath === "/" ? styles_default : basePath + styles_default;
72
72
  const clientPath = basePath === "/" ? client_default : basePath + client_default;
73
73
  const faviconPath = basePath === "/" ? "/favicon.ico" : basePath + "/assets/favicon.ico";
@@ -330,7 +330,8 @@ const renderer = ({ basePath = "", dev = false, llmProviders }) => {
330
330
  /* @__PURE__ */ jsx("script", { children: `
331
331
  window.bootstrapData = {
332
332
  basePath: "${basePath}",
333
- llmProviders: ${JSON.stringify(llmProviders || [])}
333
+ llmProviders: ${JSON.stringify(llmProviders || [])},
334
+ authType: "${authType || "basic"}"
334
335
  };
335
336
  ` }),
336
337
  dev && /* @__PURE__ */ jsx(ReactRefresh, {})
@@ -12714,7 +12715,7 @@ const internalServerError = (message, code) => {
12714
12715
 
12715
12716
  //#endregion
12716
12717
  //#region src/server/handlers/configs/index.ts
12717
- const app$8 = new Hono().post("/", zv("json", zod_default.object({ name: zod_default.string().min(1) })), async (c) => {
12718
+ const app$9 = new Hono().post("/", zv("json", zod_default.object({ name: zod_default.string().min(1) })), async (c) => {
12718
12719
  const db = c.get("db");
12719
12720
  try {
12720
12721
  const value = await db.createNewConfig({ name: c.req.valid("json").name });
@@ -12818,7 +12819,7 @@ const app$8 = new Hono().post("/", zv("json", zod_default.object({ name: zod_def
12818
12819
  return c.json(internalServerError("Failed to delete config", 500), 500);
12819
12820
  }
12820
12821
  });
12821
- var configs_default = app$8;
12822
+ var configs_default = app$9;
12822
12823
 
12823
12824
  //#endregion
12824
12825
  //#region src/server/handlers/environments/index.ts
@@ -12829,7 +12830,7 @@ var configs_default = app$8;
12829
12830
  const generateSecretKey$1 = (slug) => {
12830
12831
  return `sec_${slug.slice(0, 4).toLowerCase()}_${generateId(24)}`;
12831
12832
  };
12832
- const app$7 = new Hono().post("/", zv("json", zod_default.object({
12833
+ const app$8 = new Hono().post("/", zv("json", zod_default.object({
12833
12834
  name: zod_default.string().min(1),
12834
12835
  slug: zod_default.string().min(1),
12835
12836
  isProd: zod_default.boolean().optional()
@@ -12914,7 +12915,7 @@ const app$7 = new Hono().post("/", zv("json", zod_default.object({
12914
12915
  return c.json(internalServerError("Failed to fetch environment secrets", 500), 500);
12915
12916
  }
12916
12917
  });
12917
- var environments_default = app$7;
12918
+ var environments_default = app$8;
12918
12919
 
12919
12920
  //#endregion
12920
12921
  //#region src/server/handlers/providers/index.ts
@@ -12934,7 +12935,7 @@ async function fetchModelsDevData() {
12934
12935
  cacheTimestamp = now;
12935
12936
  return modelsCache;
12936
12937
  }
12937
- const app$6 = new Hono().get("/", async (c) => {
12938
+ const app$7 = new Hono().get("/", async (c) => {
12938
12939
  try {
12939
12940
  const data = await fetchModelsDevData();
12940
12941
  const providers = Object.values(data).map((provider) => ({
@@ -13042,11 +13043,11 @@ const app$6 = new Hono().get("/", async (c) => {
13042
13043
  return c.json(internalServerError("Failed to fetch models", 500), 500);
13043
13044
  }
13044
13045
  });
13045
- var providers_default = app$6;
13046
+ var providers_default = app$7;
13046
13047
 
13047
13048
  //#endregion
13048
13049
  //#region src/server/handlers/targeting/index.ts
13049
- const app$5 = new Hono().post("/", zv("json", zod_default.object({
13050
+ const app$6 = new Hono().post("/", zv("json", zod_default.object({
13050
13051
  environmentId: zod_default.string().uuid(),
13051
13052
  configId: zod_default.string().uuid(),
13052
13053
  configVariantId: zod_default.string().uuid(),
@@ -13173,11 +13174,11 @@ const app$5 = new Hono().post("/", zv("json", zod_default.object({
13173
13174
  return c.json(internalServerError("Failed to set targeting for environment", 500), 500);
13174
13175
  }
13175
13176
  });
13176
- var targeting_default = app$5;
13177
+ var targeting_default = app$6;
13177
13178
 
13178
13179
  //#endregion
13179
13180
  //#region src/server/handlers/variants.ts
13180
- const app$4 = new Hono().get("/:id", zv("param", zod_default.object({ id: zod_default.string().uuid() })), async (c) => {
13181
+ const app$5 = new Hono().get("/:id", zv("param", zod_default.object({ id: zod_default.string().uuid() })), async (c) => {
13181
13182
  const db = c.get("db");
13182
13183
  const { id } = c.req.valid("param");
13183
13184
  const versionParam = c.req.query("version");
@@ -13324,7 +13325,31 @@ const app$4 = new Hono().get("/:id", zv("param", zod_default.object({ id: zod_de
13324
13325
  return c.json(internalServerError("Failed to fetch variant version", 500), 500);
13325
13326
  }
13326
13327
  });
13327
- var variants_default = app$4;
13328
+ var variants_default = app$5;
13329
+
13330
+ //#endregion
13331
+ //#region src/server/handlers/workspace-settings/index.ts
13332
+ const app$4 = new Hono().get("/", async (c) => {
13333
+ const db = c.get("db");
13334
+ try {
13335
+ const settings = await db.getWorkspaceSettings();
13336
+ return c.json(successResponse(settings, 200));
13337
+ } catch (error$45) {
13338
+ console.error("Error fetching workspace settings:", error$45);
13339
+ return c.json(internalServerError("Failed to fetch workspace settings", 500), 500);
13340
+ }
13341
+ }).patch("/", zv("json", zod_default.object({ name: zod_default.string().nullable().optional() })), async (c) => {
13342
+ const db = c.get("db");
13343
+ const body = c.req.valid("json");
13344
+ try {
13345
+ const settings = await db.updateWorkspaceSettings(body);
13346
+ return c.json(successResponse(settings, 200));
13347
+ } catch (error$45) {
13348
+ console.error("Error updating workspace settings:", error$45);
13349
+ return c.json(internalServerError("Failed to update workspace settings", 500), 500);
13350
+ }
13351
+ });
13352
+ var workspace_settings_default = app$4;
13328
13353
 
13329
13354
  //#endregion
13330
13355
  //#region src/server/handlers/v1.ts
@@ -13345,7 +13370,7 @@ const app$3 = new Hono().use("*", async (c, next) => {
13345
13370
  error: "Auth middleware not configured",
13346
13371
  message: `Auth type "${config$1.auth.type}" requires @llmops/enterprise middleware. Either use basicAuth() from @llmops/sdk or install @llmops/enterprise and add the auth middleware.`
13347
13372
  }, 501);
13348
- }).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default);
13373
+ }).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default).route("/workspace-settings", workspace_settings_default);
13349
13374
  var v1_default = app$3;
13350
13375
 
13351
13376
  //#endregion
@@ -13578,10 +13603,12 @@ app.use("/assets/*", serveStatic({
13578
13603
  if (!c.req.path.startsWith("/api")) {
13579
13604
  const basePath = c.var.llmopsConfig?.basePath || "";
13580
13605
  const llmProviders = c.var.llmProviders || [];
13606
+ const authType = c.var.llmopsConfig?.auth?.type || "basic";
13581
13607
  return c.html(renderer({
13582
13608
  basePath,
13583
13609
  dev: env.LLMOPS_DEV === "true",
13584
- llmProviders
13610
+ llmProviders,
13611
+ authType
13585
13612
  }));
13586
13613
  }
13587
13614
  await next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/app",
3
- "version": "0.1.3",
3
+ "version": "0.1.5-beta.1",
4
4
  "description": "LLMOps application with server and client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -64,8 +64,8 @@
64
64
  "motion": "^12.23.25",
65
65
  "react-aria-components": "^1.13.0",
66
66
  "react-hook-form": "^7.68.0",
67
- "@llmops/core": "^0.1.3",
68
- "@llmops/gateway": "^0.1.3"
67
+ "@llmops/core": "^0.1.5-beta.1",
68
+ "@llmops/gateway": "^0.1.5-beta.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": "^19.2.1",
@@ -1 +0,0 @@
1
- import{P as $,Q as H,U as B,V as A,r as s,W as J,X as Q,Y as X,Z as W,_ as Z,$ as q,a0 as V,a1 as z,a2 as ee,a3 as O,a4 as te,a5 as ne,a6 as oe,j as k,a7 as M,a8 as _,a9 as K,aa as se,ab as j,ac as F,ad as re,ae,af as ie,ag as le,ah as ue,ai as U,aj as ce,ak as de}from"./index-8q56yhPq.js";import{u as pe,a as fe,F as ge,I as me,i as Ce,b as Se,c as Re,d as he}from"./useValueChanged-DLCw33hO.js";import{u as xe,C as Ee}from"./useRole-BBEFofTs.js";import{u as G}from"./useButton-CAZmhHhe.js";function ve(t){const{store:e,parentContext:o,actionsRef:C}=t,l=e.useState("open"),r=e.useState("disablePointerDismissal"),u=e.useState("modal"),i=e.useState("popupElement"),{openMethod:n,triggerProps:g,reset:p}=pe(l);$(e);const{forceUnmount:f}=H(l,e,()=>{p()}),a=B(E=>{const b=A(E);return b.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},b}),S=s.useCallback(()=>{e.setOpen(!1,a(J))},[e,a]);s.useImperativeHandle(C,()=>({unmount:f,close:S}),[f,S]);const d=Q({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[R,v]=s.useState(0),h=R===0,y=xe(d),c=X(d,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if("button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const b=Z(E);if(h&&!r){const w=b;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===w||e.context.backdropRef.current===w||q(w,i)&&!w?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:h});fe(l&&u===!0,i);const{getReferenceProps:m,getFloatingProps:I,getTriggerProps:x}=W([y,c]);e.useContextCallback("onNestedDialogOpen",E=>{v(E+1)}),e.useContextCallback("onNestedDialogClose",()=>{v(0)}),s.useEffect(()=>(o?.onNestedDialogOpen&&l&&o.onNestedDialogOpen(R),o?.onNestedDialogClose&&!l&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&l&&o.onNestedDialogClose()}),[l,o,R]);const D=s.useMemo(()=>m(g),[m,g]),P=s.useMemo(()=>x(g),[x,g]),N=s.useMemo(()=>I(),[I]);e.useSyncedValues({openMethod:n,activeTriggerProps:D,inactiveTriggerProps:P,popupProps:N,floatingRootContext:d,nestedOpenDialogCount:R})}const Y=s.createContext(void 0);function T(t){const e=s.useContext(Y);if(t===!1&&e===void 0)throw new Error(V(27));return e}const Pe={...te,modal:O(t=>t.modal),nested:O(t=>t.nested),nestedOpenDialogCount:O(t=>t.nestedOpenDialogCount),disablePointerDismissal:O(t=>t.disablePointerDismissal),openMethod:O(t=>t.openMethod),descriptionElementId:O(t=>t.descriptionElementId),titleElementId:O(t=>t.titleElementId),viewportElement:O(t=>t.viewportElement),role:O(t=>t.role)};class Ie extends z{constructor(e){super(be(e),{popupRef:s.createRef(),backdropRef:s.createRef(),internalBackdropRef:s.createRef(),triggerElements:new ee,onOpenChange:void 0,onOpenChangeComplete:void 0},Pe)}setOpen=(e,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,o),o.isCanceled)return;const C={open:e,nativeEvent:o.event,reason:o.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",C);const l={open:e},r=o.trigger?.id??null;(r||e)&&(l.activeTriggerId=r,l.activeTriggerElement=o.trigger??null),this.update(l)}}function be(t={}){return{...ne(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function Be(t){const{children:e,open:o,defaultOpen:C=!1,onOpenChange:l,onOpenChangeComplete:r,actionsRef:u,handle:i,triggerId:n,defaultTriggerId:g=null}=t,p=T(),f=!!p,a=oe(()=>i?.store??new Ie({open:o??C,activeTriggerId:n!==void 0?n:g,modal:!0,disablePointerDismissal:!0,nested:f,role:"alertdialog"})).current;a.useControlledProp("open",o,C),a.useControlledProp("activeTriggerId",n,g),a.useSyncedValue("nested",f),a.useContextCallback("onOpenChange",l),a.useContextCallback("onOpenChangeComplete",r);const S=a.useState("payload");ve({store:a,actionsRef:u,parentContext:p?.store.context});const d=s.useMemo(()=>({store:a}),[a]);return k.jsx(Y.Provider,{value:d,children:typeof e=="function"?e({payload:S}):e})}const Oe={..._,...K},Ve=s.forwardRef(function(e,o){const{render:C,className:l,forceRender:r=!1,...u}=e,{store:i}=T(),n=i.useState("open"),g=i.useState("nested"),p=i.useState("mounted"),f=i.useState("transitionStatus"),a=s.useMemo(()=>({open:n,transitionStatus:f}),[n,f]);return M("div",e,{state:a,ref:[i.context.backdropRef,o],stateAttributesMapping:Oe,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:r||!g})}),je=s.forwardRef(function(e,o){const{render:C,className:l,disabled:r=!1,nativeButton:u=!0,...i}=e,{store:n}=T(),g=n.useState("open");function p(d){g&&n.setOpen(!1,A(se,d.nativeEvent))}const{getButtonProps:f,buttonRef:a}=G({disabled:r,native:u}),S=s.useMemo(()=>({disabled:r}),[r]);return M("button",e,{state:S,ref:[o,a],props:[{onClick:p},i,f]})}),Ue=s.forwardRef(function(e,o){const{render:C,className:l,id:r,...u}=e,{store:i}=T(),n=j(r);return i.useSyncedValueWithCleanup("descriptionElementId",n),M("p",e,{ref:o,props:[{id:n},u]})});let De=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),Te=(function(t){return t[t.open=F.open]="open",t[t.closed=F.closed]="closed",t[t.startingStyle=F.startingStyle]="startingStyle",t[t.endingStyle=F.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const L=s.createContext(void 0);function ye(){const t=s.useContext(L);if(t===void 0)throw new Error(V(26));return t}const Me={..._,...K,nestedDialogOpen(t){return t?{[Te.nestedDialogOpen]:""}:null}},Ae=s.forwardRef(function(e,o){const{className:C,finalFocus:l,initialFocus:r,render:u,...i}=e,{store:n}=T(),g=n.useState("descriptionElementId"),p=n.useState("disablePointerDismissal"),f=n.useState("floatingRootContext"),a=n.useState("popupProps"),S=n.useState("modal"),d=n.useState("mounted"),R=n.useState("nested"),v=n.useState("nestedOpenDialogCount"),h=n.useState("open"),y=n.useState("openMethod"),c=n.useState("titleElementId"),m=n.useState("transitionStatus"),I=n.useState("role");ye(),re({open:h,ref:n.context.popupRef,onComplete(){h&&n.context.onOpenChangeComplete?.(!0)}});function x(b){return b==="touch"?n.context.popupRef.current:!0}const D=r===void 0?x:r,P=v>0,N=s.useMemo(()=>({open:h,nested:R,transitionStatus:m,nestedDialogOpen:P}),[h,R,m,P]),E=M("div",e,{state:N,props:[a,{"aria-labelledby":c??void 0,"aria-describedby":g??void 0,role:I,tabIndex:-1,hidden:!d,onKeyDown(b){Ee.has(b.key)&&b.stopPropagation()},style:{[De.nestedDialogs]:v}},i],ref:[o,n.context.popupRef,n.useStateSetter("popupElement")],stateAttributesMapping:Me});return k.jsx(ge,{context:f,openInteractionType:y,disabled:!d,closeOnFocusOut:!p,initialFocus:D,returnFocus:l,modal:S!==!1,restoreFocus:"popup",children:E})}),We=s.forwardRef(function(e,o){const{keepMounted:C=!1,...l}=e,{store:r}=T(),u=r.useState("mounted"),i=r.useState("modal");return u||C?k.jsx(L.Provider,{value:C,children:k.jsxs(ae,{ref:o,...l,children:[u&&i===!0&&k.jsx(me,{ref:r.context.internalBackdropRef,inert:Ce(!open)}),e.children]})}):null}),_e=s.forwardRef(function(e,o){const{render:C,className:l,id:r,...u}=e,{store:i}=T(),n=j(r);return i.useSyncedValueWithCleanup("titleElementId",n),M("h2",e,{ref:o,props:[{id:n},u]})}),Ke=s.forwardRef(function(e,o){const{render:C,className:l,disabled:r=!1,nativeButton:u=!0,id:i,payload:n,handle:g,...p}=e,f=T(!0),a=g?.store??f?.store;if(!a)throw new Error(V(79));const S=j(i),d=a.useState("floatingRootContext"),R=a.useState("isOpenedByTrigger",S),v=s.useRef(null),{registerTrigger:h,isMountedByThisTrigger:y}=ie(S,v,a,{payload:n}),{getButtonProps:c,buttonRef:m}=G({disabled:r,native:u}),I=Se(d,{enabled:d!=null}),x=W([I]),D=s.useMemo(()=>({disabled:r,open:R}),[r,R]),P=a.useState("triggerProps",y);return M("button",e,{state:D,ref:[m,o,h,v],props:[x.getReferenceProps(),P,{[le]:"",id:S},p,c],stateAttributesMapping:ue})}),Ge=s.forwardRef(function(e,o){const{render:C,className:l,validationMode:r="onSubmit",errors:u,onSubmit:i,onFormSubmit:n,...g}=e,p=s.useRef({fields:new Map}),f=s.useRef(!1),a=s.useRef(!1),S=B(c=>{c&&(c.focus(),c.tagName==="INPUT"&&c.select())}),[d,R]=s.useState(u);Re(u,()=>{R(u)}),s.useEffect(()=>{if(!f.current)return;f.current=!1;const c=Array.from(p.current.fields.values()).filter(m=>m.validityData.state.valid===!1);c.length&&S(c[0].controlRef.current)},[d,S]);const v=M("form",e,{ref:o,props:[{noValidate:!0,onSubmit(c){a.current=!0;let m=Array.from(p.current.fields.values());m.forEach(x=>{x.validate()}),m=Array.from(p.current.fields.values());const I=m.filter(x=>!x.validityData.state.valid);if(I.length)c.preventDefault(),S(I[0].controlRef.current);else if(f.current=!0,i?.(c),n){c.preventDefault();const x=m.reduce((D,P)=>(P.name&&(D[P.name]=P.getValue()),D),{});n(x,ce(de,c.nativeEvent))}}},g]}),h=B(c=>{if(c&&d&&U.hasOwnProperty.call(d,c)){const m={...d};delete m[c],R(m)}}),y=s.useMemo(()=>({formRef:p,validationMode:r,errors:d??U,clearErrors:h,submitAttemptedRef:a}),[p,r,d,h]);return k.jsx(he.Provider,{value:y,children:v})});export{Be as A,Ke as D,Ge as F,We as a,Ve as b,Ae as c,_e as d,Ue as e,je as f};
@@ -1 +0,0 @@
1
- import{a as Q,bl as X,j as i,b as Y,r as D,I as Z}from"./index-8q56yhPq.js";import{B as ee}from"./button-DO9sNXVT.js";import{p as te,q as ne,w as ie,x as se,j as G,v as J,k as K,i as M,S as ae,r as re,t as oe}from"./useSetTargeting-x-2mNQAV.js";import{u as le}from"./useEnvironments-B9zdgoPZ.js";import{u as ce}from"./useConfigVariants-DoAiT4HN.js";import{u as de}from"./useTargetingRules-DWyIfOXq.js";/* empty css */import"./useButton-CAZmhHhe.js";import"./useValueChanged-DLCw33hO.js";import"./useMutation-B5RT6zjK.js";function Ne(){const t=Q.c(17),{id:e,environment:a}=X.useParams(),{data:c,isLoading:j}=le(),{data:o,isLoading:y}=ce(e),{data:L,isLoading:I}=de(e);if(j||y||I){let s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{children:"Loading..."}),t[0]=s):s=t[0],s}let n;t[1]!==a||t[2]!==c?(n=c?.find(s=>s.id===a),t[1]=a,t[2]=c,t[3]=n):n=t[3];const S=n;if(!S){let s;return t[4]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{children:"Environment not found"}),t[4]=s):s=t[4],s}let r;t[5]!==a||t[6]!==L?(r=L?.find(s=>s.environmentId===a),t[5]=a,t[6]=L,t[7]=r):r=t[7];const R=r;let l;t[8]!==o?(l=o??[],t[8]=o,t[9]=l):l=t[9];const w=R?.configVariantId??null,E=R?.variantVersionId??null;let g;return t[10]!==e||t[11]!==S||t[12]!==a||t[13]!==l||t[14]!==w||t[15]!==E?(g=i.jsx(me,{configId:e,environmentId:a,environment:S,variants:l,initialVariantId:w,initialVariantVersionId:E}),t[10]=e,t[11]=S,t[12]=a,t[13]=l,t[14]=w,t[15]=E,t[16]=g):g=t[16],g}function me(t){const e=Q.c(67),{configId:a,environmentId:c,environment:j,variants:o,initialVariantId:y,initialVariantVersionId:L}=t,I=Y(),f=te(),[n,S]=D.useState(y),[r,R]=D.useState(L??null);let l;if(e[0]!==n||e[1]!==o){let m;e[3]!==n?(m=P=>P.id===n,e[3]=n,e[4]=m):m=e[4],l=o.find(m),e[0]=n,e[1]=o,e[2]=l}else l=e[2];const E=l?.variantId??"",{data:g,isLoading:s}=ne(E);let $,H;e[5]!==y||e[6]!==n?($=()=>{n!==y&&R(null)},H=[n,y],e[5]=y,e[6]=n,e[7]=$,e[8]=H):($=e[7],H=e[8]),D.useEffect($,H);let k;e[9]!==o?(k=o.map(ge),e[9]=o,e[10]=k):k=e[10];const u=k;let h,b,p,x,V,N,d;if(e[11]!==a||e[12]!==j.name||e[13]!==c||e[14]!==s||e[15]!==I||e[16]!==n||e[17]!==r||e[18]!==f||e[19]!==u||e[20]!==o||e[21]!==g){d=g?.map(fe)??[];let m;e[29]!==a||e[30]!==c||e[31]!==I||e[32]!==n||e[33]!==r||e[34]!==f?(m=async()=>{if(!(!n||!r))try{await f.mutateAsync({environmentId:c,configId:a,configVariantId:n,variantVersionId:r}),I({to:"/configs/$id/targeting",params:{id:a}})}catch(v){console.error("Error setting targeting:",v)}},e[29]=a,e[30]=c,e[31]=I,e[32]=n,e[33]=r,e[34]=f,e[35]=m):m=e[35];const P=m;let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z={justifyContent:"flex-end"},e[36]=z):z=e[36];const W=!n||!r||f.isPending;let B;e[37]===Symbol.for("react.memo_cache_sentinel")?(B=i.jsx(Z,{icon:ae,size:"sm"}),e[37]=B):B=e[37];const A=f.isPending?"Saving...":"Save";e[38]!==P||e[39]!==W||e[40]!==A?(h=i.jsx("div",{className:re,style:z,children:i.jsxs(ee,{variant:"primary",onClick:P,disabled:W,children:[B,A]})}),e[38]=P,e[39]=W,e[40]=A,e[41]=h):h=e[41],b=oe,e[42]!==j.name?(p=i.jsxs("div",{className:ie,children:["The selected variant will be served to all requests in the"," ",i.jsx("span",{className:se,children:j.name})," ","environment"]}),e[42]=j.name,e[43]=p):p=e[43];let F;e[44]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx("div",{className:J,style:{minWidth:"120px"},children:"Variant"}),e[44]=F):F=e[44];let T;e[45]!==o?(T=v=>{if(!v)return"";const O=o.find(U=>U.id===v);return O?O.name:v},e[45]=o,e[46]=T):T=e[46],e[47]!==n||e[48]!==T||e[49]!==u?(x=i.jsxs("div",{className:G,children:[F,i.jsx("div",{className:K,children:i.jsx(M,{items:u,value:n,onValueChange:S,placeholder:"Select a variant...",itemToString:T})})]}),e[47]=n,e[48]=T,e[49]=u,e[50]=x):x=e[50],e[51]!==u.length?(V=u.length===0&&i.jsx("div",{style:{marginTop:"1rem",opacity:.6},children:"No variants available. Create a variant first to configure targeting."}),e[51]=u.length,e[52]=V):V=e[52],N=n&&i.jsxs("div",{className:G,children:[i.jsx("div",{className:J,style:{minWidth:"120px"},children:"Version"}),i.jsx("div",{className:K,children:s?i.jsx("span",{style:{opacity:.6},children:"Loading versions..."}):d.length===0?i.jsx("span",{style:{opacity:.6},children:"No versions available"}):i.jsx(M,{items:d,value:d.find(v=>v.id===r)??null,onValueChange:v=>R(v?.id??null),placeholder:"Select version...",itemToString:ve})})]}),e[11]=a,e[12]=j.name,e[13]=c,e[14]=s,e[15]=I,e[16]=n,e[17]=r,e[18]=f,e[19]=u,e[20]=o,e[21]=g,e[22]=h,e[23]=b,e[24]=p,e[25]=x,e[26]=V,e[27]=N,e[28]=d}else h=e[22],b=e[23],p=e[24],x=e[25],V=e[26],N=e[27],d=e[28];let C;e[53]!==n||e[54]!==r||e[55]!==d?(C=n&&!r&&d.length>0&&i.jsx("div",{style:{marginTop:"0.5rem",fontSize:"0.75rem",color:"var(--gray9)"},children:"Select a version to deploy to this environment."}),e[53]=n,e[54]=r,e[55]=d,e[56]=C):C=e[56];let _;e[57]!==C||e[58]!==b||e[59]!==p||e[60]!==x||e[61]!==V||e[62]!==N?(_=i.jsxs("div",{className:b,children:[p,x,V,N,C]}),e[57]=C,e[58]=b,e[59]=p,e[60]=x,e[61]=V,e[62]=N,e[63]=_):_=e[63];let q;return e[64]!==h||e[65]!==_?(q=i.jsxs("div",{children:[h,_]}),e[64]=h,e[65]=_,e[66]=q):q=e[66],q}function ve(t){return t?.label??""}function fe(t){return{id:t.id,label:`Version ${t.version}`,version:t.version}}function ge(t){return t.id}export{Ne as component};
@@ -1 +0,0 @@
1
- import{k as c}from"./index-8q56yhPq.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};