@powerhousedao/connect 5.3.0-staging.6 → 5.3.0-staging.8

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 (48) hide show
  1. package/dist/assets/AddDriveModal-DzhYAspq.js +1 -0
  2. package/dist/assets/{ClearStorageModal-KHvp_laA.js → ClearStorageModal-DFDcDWQS.js} +1 -1
  3. package/dist/assets/CookiesPolicyModal-WMbEXRCV.js +1 -0
  4. package/dist/assets/CreateDocumentModal-BVE_T4gr.js +1 -0
  5. package/dist/assets/{DebugSettingsModal-Drau96sw.js → DebugSettingsModal-CXtyDkEO.js} +1 -1
  6. package/dist/assets/{DeleteDriveModal-Dit5RKv4.js → DeleteDriveModal-CPq7KJKl.js} +1 -1
  7. package/dist/assets/DeleteItemModal-CXbdLPD_.js +1 -0
  8. package/dist/assets/DisclaimerModal-86T-C1tB.js +1 -0
  9. package/dist/assets/DriveSettingsModal-CrRKObLy.js +1 -0
  10. package/dist/assets/{ExportDocumentWithErrorsModal-DwXRuWfq.js → ExportDocumentWithErrorsModal-DF4bBzrM.js} +1 -1
  11. package/dist/assets/{SettingsModal-iZ7RZf2l.js → SettingsModal-d784xIs3.js} +1 -1
  12. package/dist/assets/UpgradeDriveModal-DzBFN1Rl.js +1 -0
  13. package/dist/assets/{design_system-C3rLdIMt.js → design_system-DlEUixjO.js} +1 -1
  14. package/dist/assets/design_system_connect-Ctc85mD4.js +47 -0
  15. package/dist/assets/design_system_ui-r7UlXmLR.js +1 -0
  16. package/dist/assets/{document_engineering-DvjuYvlv.js → document_engineering-BYFcoq1w.js} +1 -1
  17. package/dist/assets/{document_model_editor-D4xoIBZ3.js → document_model_editor-B4T9QZq5.js} +4 -4
  18. package/dist/assets/{drive_explorer-1ZrqokUe.js → drive_explorer-Bw3X4qG9.js} +2 -2
  19. package/dist/assets/{graphql-editor-XUUp3kX7.js → graphql-editor-CUwTXlHw.js} +2 -2
  20. package/dist/assets/{hooks-sX3xk7Kt.js → hooks-CmhoG3vm.js} +1 -1
  21. package/dist/assets/index-eboADC-U.js +18 -0
  22. package/dist/assets/index-rtH_nQao.js +28 -0
  23. package/dist/assets/json-editor-C5XbRHa_.js +1 -0
  24. package/dist/assets/nodefs-CbvsanVd.js +1 -0
  25. package/dist/assets/opfs-ahp-Boxi-h7c.js +3 -0
  26. package/dist/assets/{reactor_browser-najzCy3f.js → reactor_browser-KVDPL1So.js} +4 -4
  27. package/dist/assets/state-schemas-B6irqRdw.js +2 -0
  28. package/dist/index.html +7 -7
  29. package/lib/package.copy.json +1 -1
  30. package/lib/tsconfig.tsbuildinfo +1 -1
  31. package/package.copy.json +1 -1
  32. package/package.json +10 -10
  33. package/dist/assets/AddDriveModal-BEvxiRzT.js +0 -1
  34. package/dist/assets/CookiesPolicyModal-C4rpGStZ.js +0 -1
  35. package/dist/assets/CreateDocumentModal-CuZJo5OP.js +0 -1
  36. package/dist/assets/DeleteItemModal-DZWWJ762.js +0 -1
  37. package/dist/assets/DisclaimerModal-DYhCHc13.js +0 -1
  38. package/dist/assets/DriveSettingsModal-2OYh7SO0.js +0 -1
  39. package/dist/assets/UpgradeDriveModal-B7O48fTd.js +0 -1
  40. package/dist/assets/design_system_connect-khMxY6ZK.js +0 -47
  41. package/dist/assets/design_system_ui-Uj2tSs7q.js +0 -1
  42. package/dist/assets/index-99zupCWh.js +0 -28
  43. package/dist/assets/index-Bhwnd9qc.js +0 -18
  44. package/dist/assets/json-editor-DN1vJhYY.js +0 -1
  45. package/dist/assets/nodefs-8USSZqqX.js +0 -1
  46. package/dist/assets/opfs-ahp-BIlkde4z.js +0 -3
  47. package/dist/assets/rwa-report-Bb0W5-ac.png +0 -0
  48. package/dist/assets/state-schemas-0luQ8nIl.js +0 -2
@@ -1 +0,0 @@
1
- import{j as a,S as $t,e as qt,u as Ce,P as ee,c as pe,f as Ze,g as Bt,C as Kt,a as Ht}from"./document_model_editor-D4xoIBZ3.js";import{r as l,a as G}from"./sentry_react-cODD7zWc.js";import{c as m,a as Je,f as Te,P as he,d as Qe,e as ae,E as Gt,I as V,u as ne,F as Ut,G as Wt,O as Xt,H as Zt,b as Ye,R as Jt,A as et,g as Qt,J as Yt,K as er,L as tr,N as rr,Q as ar,D as nr,C as sr,i as or}from"./design_system-C3rLdIMt.js";import{R as lr,T as ir,P as dr,C as cr,a as Ie,u as ur,b as fr}from"./design_system_connect-khMxY6ZK.js";import{t as gr}from"./tailwind_merge-Dr4f9Rms.js";import"./react-DQSxOgtG.js";import"./reactor_browser-najzCy3f.js";import{r as pr}from"./react-dom/client-BVPiT_FE.js";var Ta=pr();const hr=qt(m("inline-flex items-center justify-center gap-2","whitespace-nowrap rounded-md text-sm font-medium","transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","disabled:pointer-events-none","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"),{variants:{variant:{default:"",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground"}},defaultVariants:{variant:"default"}}),mr=l.forwardRef(({variant:e,className:t,asChild:r=!1,...o},n)=>{const s=r?$t:"button";return a.jsx(s,{className:m(hr({variant:e,className:t})),ref:n,...o})});function xr(e){const t=l.useRef({value:e,previous:e});return l.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var je="Checkbox",[vr]=Je(je),[br,Le]=vr(je);function yr(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:n,disabled:s,form:c,name:i,onCheckedChange:f,required:d,value:g="on",internal_do_not_use_render:h}=e,[y,v]=Qe({prop:r,defaultProp:n??!1,onChange:f,caller:je}),[N,P]=l.useState(null),[b,j]=l.useState(null),k=l.useRef(!1),$=N?!!c||!!N.closest("form"):!0,T={checked:y,disabled:s,setChecked:v,control:N,setControl:P,name:i,form:c,value:g,hasConsumerStoppedPropagationRef:k,required:d,defaultChecked:Y(n)?!1:n,isFormControl:$,bubbleInput:b,setBubbleInput:j};return a.jsx(br,{scope:t,...T,children:kr(h)?h(T):o})}var tt="CheckboxTrigger",rt=l.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...o},n)=>{const{control:s,value:c,disabled:i,checked:f,required:d,setControl:g,setChecked:h,hasConsumerStoppedPropagationRef:y,isFormControl:v,bubbleInput:N}=Le(tt,e),P=Ce(n,g),b=l.useRef(f);return l.useEffect(()=>{const j=s?.form;if(j){const k=()=>h(b.current);return j.addEventListener("reset",k),()=>j.removeEventListener("reset",k)}},[s,h]),a.jsx(he.button,{type:"button",role:"checkbox","aria-checked":Y(f)?"mixed":f,"aria-required":d,"data-state":it(f),"data-disabled":i?"":void 0,disabled:i,value:c,...o,ref:P,onKeyDown:ae(t,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:ae(r,j=>{h(k=>Y(k)?!0:!k),N&&v&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})})});rt.displayName=tt;var at=l.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:o,checked:n,defaultChecked:s,required:c,disabled:i,value:f,onCheckedChange:d,form:g,...h}=e;return a.jsx(yr,{__scopeCheckbox:r,checked:n,defaultChecked:s,disabled:i,required:c,onCheckedChange:d,name:o,form:g,value:f,internal_do_not_use_render:({isFormControl:y})=>a.jsxs(a.Fragment,{children:[a.jsx(rt,{...h,ref:t,__scopeCheckbox:r}),y&&a.jsx(lt,{__scopeCheckbox:r})]})})});at.displayName=je;var nt="CheckboxIndicator",st=l.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:o,...n}=e,s=Le(nt,r);return a.jsx(Te,{present:o||Y(s.checked)||s.checked===!0,children:a.jsx(he.span,{"data-state":it(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});st.displayName=nt;var ot="CheckboxBubbleInput",lt=l.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:o,hasConsumerStoppedPropagationRef:n,checked:s,defaultChecked:c,required:i,disabled:f,name:d,value:g,form:h,bubbleInput:y,setBubbleInput:v}=Le(ot,e),N=Ce(r,v),P=xr(s),b=Gt(o);l.useEffect(()=>{const k=y;if(!k)return;const $=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor($,"checked").set,R=!n.current;if(P!==s&&O){const A=new Event("click",{bubbles:R});k.indeterminate=Y(s),O.call(k,Y(s)?!1:s),k.dispatchEvent(A)}},[y,P,s,n]);const j=l.useRef(Y(s)?!1:s);return a.jsx(he.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??j.current,required:i,disabled:f,name:d,value:g,form:h,...t,tabIndex:-1,ref:N,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});lt.displayName=ot;function kr(e){return typeof e=="function"}function Y(e){return e==="indeterminate"}function it(e){return Y(e)?"indeterminate":e?"checked":"unchecked"}const dt=l.forwardRef(({className:e,checked:t,invalid:r,...o},n)=>a.jsx(at,{ref:n,className:m("peer size-4 shrink-0 rounded","border-input border shadow-sm shadow-black/[.04]","ring-offset-background transition-shadow","focus-visible:border-ring focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:border-gray-700 disabled:data-[invalid=false]:data-[state=checked]:bg-gray-700 disabled:data-[invalid=false]:data-[state=indeterminate]:bg-gray-700 dark:disabled:data-[invalid=false]:data-[state=checked]:bg-gray-500 dark:disabled:data-[invalid=false]:data-[state=indeterminate]:bg-gray-500","data-[state]:border-gray-700 dark:data-[state]:border-gray-500","data-[state=checked]:bg-gray-900 data-[state=indeterminate]:bg-gray-900 dark:data-[state=checked]:bg-gray-400 dark:data-[state=indeterminate]:bg-gray-400","data-[state=checked]:text-slate-50 data-[state=indeterminate]:text-slate-50 dark:data-[state=checked]:text-gray-900 dark:data-[state=indeterminate]:text-gray-900",!o.disabled&&["group-hover:border-gray-900 data-[state=checked]:group-hover:bg-gray-900 data-[state=indeterminate]:group-hover:bg-gray-900","dark:group-hover:border-slate-50 dark:data-[state=checked]:group-hover:bg-slate-50 dark:data-[state=indeterminate]:group-hover:bg-slate-50"],"data-[invalid=true]:data-[state]:!border-red-800 data-[invalid=true]:data-[state=checked]:!bg-red-800 data-[invalid=true]:data-[state=indeterminate]:!bg-red-800","dark:data-[invalid=true]:data-[state]:!border-red-800 dark:data-[invalid=true]:data-[state=checked]:!bg-red-800 dark:data-[invalid=true]:data-[state=indeterminate]:!bg-red-800","data-[invalid=true]:group-hover:!border-red-900 data-[invalid=true]:data-[state=checked]:group-hover:!bg-red-900 data-[invalid=true]:data-[state=indeterminate]:group-hover:!bg-red-900",e),checked:t,"data-invalid":r,...o,children:a.jsx(st,{className:"flex items-center justify-center text-current",children:t==="indeterminate"?a.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})}):t?a.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})}):null})}));dt.displayName="CheckboxBase";const Cr=l.forwardRef(({children:e,className:t,...r},o)=>a.jsx(cr,{ref:o,...r,className:m("z-50 overflow-hidden rounded-md text-sm","border border-gray-200 bg-white text-gray-900 dark:border-gray-900 dark:bg-slate-900 dark:text-gray-200","px-3 py-1.5 shadow-md","data-[state=open]:animate-fade-in data-[state=open]:animate-zoom-in","data-[state=closed]:animate-fade-out data-[state=closed]:animate-zoom-out","data-[side=bottom]:animate-slide-in-from-top","data-[side=left]:animate-slide-in-from-right","data-[side=right]:animate-slide-in-from-left","data-[side=top]:animate-slide-in-from-bottom",t),children:e})),Oe=({content:e,children:t,triggerAsChild:r=!1,delayDuration:o=0,...n})=>{const{open:s,defaultOpen:c,onOpenChange:i,...f}=n;return a.jsxs(lr,{defaultOpen:c,delayDuration:o,onOpenChange:i,open:s,children:[a.jsx(ir,{asChild:r,type:r?void 0:"button",children:t}),a.jsx(dr,{children:a.jsx(Cr,{sideOffset:3,...f,children:e})})]})},Me=({children:e,required:t,disabled:r,description:o,hasError:n,inline:s,className:c,...i})=>{const f=m("inline-flex items-center text-sm font-medium",s?"leading-[22px]":"leading-4",`text-gray-900 ${s?"dark:text-gray-400":"dark:text-gray-50"}`,n&&"group-hover:!text-red-900 dark:group-hover:!text-red-900",n&&s&&"text-red-800 dark:text-red-800",n&&!s&&"text-red-900 dark:text-red-900",r&&`cursor-not-allowed text-gray-700 ${s?"dark:text-gray-600":"dark:text-gray-300"}`,s?!r&&"group-hover:text-gray-900 dark:group-hover:text-slate-50":"mb-[3px]",c);if(!e)return null;const d={...i};return a.jsxs("label",{className:f,...d,children:[e,t&&a.jsx("span",{className:m("ml-1 text-gray-800 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-slate-50",n&&`${s?"!text-red-800":"!text-red-900"} group-hover:!text-red-900`),children:"*"}),o&&a.jsx(Ie,{children:a.jsx(Oe,{content:o,children:a.jsx(V,{name:"CircleInfo",size:16,className:m("ml-1 cursor-pointer text-gray-600 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-500",r&&"text-gray-500")})})})]})},jr="p",He=({children:e,type:t="info",as:r,className:o,...n})=>{const s=r||jr,i=m("mb-0 inline-flex items-center text-xs font-medium",{error:"text-red-900 dark:text-red-900",info:"text-blue-900 dark:text-blue-900",warning:"text-yellow-900 dark:text-yellow-900"}[t],o);return a.jsx(s,{"data-type":t,className:i,...n,children:e})},de=({messages:e,type:t="info",className:r,...o})=>{if(e.length===0)return null;if(e.length===1)return a.jsx(He,{type:t,...o,children:e[0]});const n={error:"before:bg-red-900 dark:before:bg-red-900",info:"before:bg-blue-900 dark:before:bg-blue-900",warning:"before:bg-orange-900 dark:before:bg-orange-900"};return a.jsx("ul",{className:m("flex flex-col gap-1",r),...o,children:e.map(s=>a.jsx(He,{as:"li",type:t,className:m("relative pl-4","before:absolute before:left-0 before:top-[0.4em] before:size-2 before:rounded-full",n[t]),children:s},s))})},wr=G.forwardRef(({id:e,name:t,label:r,value:o,defaultValue:n,disabled:s,required:c,description:i,errors:f,warnings:d,onChange:g,className:h,...y},v)=>{const N=l.useId(),P=e??N,b=!!f?.length,j=k=>k==="true"?!0:k==="false"?!1:k;return a.jsxs("div",{className:m("flex flex-col gap-2"),children:[a.jsxs("div",{className:m("group flex items-center space-x-2",h),children:[a.jsx(dt,{id:P,name:t,checked:j(o??n),disabled:s,onCheckedChange:g,required:c,invalid:b,"aria-invalid":b,ref:v,...y}),a.jsx(Me,{htmlFor:P,required:c,disabled:s,hasError:b,description:i,className:m(!s&&"group-hover:cursor-pointer"),inline:!0,children:r})]}),d&&a.jsx(de,{type:"warning",messages:d}),f&&a.jsx(de,{type:"error",messages:f})]})});wr.displayName="Checkbox";var Ge=1,Nr=.9,Rr=.8,Er=.17,Ee=.1,Se=.999,Sr=.9999,Pr=.99,Ar=/[\\\/_+.#"@\[\(\{&]/,Ir=/[\\\/_+.#"@\[\(\{&]/g,Or=/[\s-]/,ct=/[\s-]/g;function De(e,t,r,o,n,s,c){if(s===t.length)return n===e.length?Ge:Pr;var i=`${n},${s}`;if(c[i]!==void 0)return c[i];for(var f=o.charAt(s),d=r.indexOf(f,n),g=0,h,y,v,N;d>=0;)h=De(e,t,r,o,d+1,s+1,c),h>g&&(d===n?h*=Ge:Ar.test(e.charAt(d-1))?(h*=Rr,v=e.slice(n,d-1).match(Ir),v&&n>0&&(h*=Math.pow(Se,v.length))):Or.test(e.charAt(d-1))?(h*=Nr,N=e.slice(n,d-1).match(ct),N&&n>0&&(h*=Math.pow(Se,N.length))):(h*=Er,n>0&&(h*=Math.pow(Se,d-n))),e.charAt(d)!==t.charAt(s)&&(h*=Sr)),(h<Ee&&r.charAt(d-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&r.charAt(d-1)!==o.charAt(s))&&(y=De(e,t,r,o,d+1,s+2,c),y*Ee>h&&(h=y*Ee)),h>g&&(g=h),d=r.indexOf(f,d+1);return c[i]=g,g}function Ue(e){return e.toLowerCase().replace(ct," ")}function Dr(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,De(e,t,Ue(e),Ue(t),0,0,{})}var fe='[cmdk-group=""]',Pe='[cmdk-group-items=""]',Fr='[cmdk-group-heading=""]',ut='[cmdk-item=""]',We=`${ut}:not([aria-disabled="true"])`,Fe="cmdk-item-select",le="data-value",_r=(e,t,r)=>Dr(e,t,r),ft=l.createContext(void 0),me=()=>l.useContext(ft),gt=l.createContext(void 0),ze=()=>l.useContext(gt),pt=l.createContext(void 0),ht=l.forwardRef((e,t)=>{let r=ie(()=>{var u,C;return{search:"",value:(C=(u=e.value)!=null?u:e.defaultValue)!=null?C:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=ie(()=>new Set),n=ie(()=>new Map),s=ie(()=>new Map),c=ie(()=>new Set),i=mt(e),{label:f,children:d,value:g,onValueChange:h,filter:y,shouldFilter:v,loop:N,disablePointerSelection:P=!1,vimBindings:b=!0,...j}=e,k=ne(),$=ne(),T=ne(),O=l.useRef(null),R=Gr();se(()=>{if(g!==void 0){let u=g.trim();r.current.value=u,A.emit()}},[g]),se(()=>{R(6,w)},[]);let A=l.useMemo(()=>({subscribe:u=>(c.current.add(u),()=>c.current.delete(u)),snapshot:()=>r.current,setState:(u,C,x)=>{var p,E,S,F;if(!Object.is(r.current[u],C)){if(r.current[u]=C,u==="search")U(),I(),R(1,q);else if(u==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let _=document.getElementById(T);_?_.focus():(p=document.getElementById(k))==null||p.focus()}if(R(7,()=>{var _;r.current.selectedItemId=(_=D())==null?void 0:_.id,A.emit()}),x||R(5,w),((E=i.current)==null?void 0:E.value)!==void 0){let _=C??"";(F=(S=i.current).onValueChange)==null||F.call(S,_);return}}A.emit()}},emit:()=>{c.current.forEach(u=>u())}}),[]),L=l.useMemo(()=>({value:(u,C,x)=>{var p;C!==((p=s.current.get(u))==null?void 0:p.value)&&(s.current.set(u,{value:C,keywords:x}),r.current.filtered.items.set(u,M(C,x)),R(2,()=>{I(),A.emit()}))},item:(u,C)=>(o.current.add(u),C&&(n.current.has(C)?n.current.get(C).add(u):n.current.set(C,new Set([u]))),R(3,()=>{U(),I(),r.current.value||q(),A.emit()}),()=>{s.current.delete(u),o.current.delete(u),r.current.filtered.items.delete(u);let x=D();R(4,()=>{U(),x?.getAttribute("id")===u&&q(),A.emit()})}),group:u=>(n.current.has(u)||n.current.set(u,new Set),()=>{s.current.delete(u),n.current.delete(u)}),filter:()=>i.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:k,inputId:T,labelId:$,listInnerRef:O}),[]);function M(u,C){var x,p;let E=(p=(x=i.current)==null?void 0:x.filter)!=null?p:_r;return u?E(u,r.current.search,C):0}function I(){if(!r.current.search||i.current.shouldFilter===!1)return;let u=r.current.filtered.items,C=[];r.current.filtered.groups.forEach(p=>{let E=n.current.get(p),S=0;E.forEach(F=>{let _=u.get(F);S=Math.max(_,S)}),C.push([p,S])});let x=O.current;B().sort((p,E)=>{var S,F;let _=p.getAttribute("id"),X=E.getAttribute("id");return((S=u.get(X))!=null?S:0)-((F=u.get(_))!=null?F:0)}).forEach(p=>{let E=p.closest(Pe);E?E.appendChild(p.parentElement===E?p:p.closest(`${Pe} > *`)):x.appendChild(p.parentElement===x?p:p.closest(`${Pe} > *`))}),C.sort((p,E)=>E[1]-p[1]).forEach(p=>{var E;let S=(E=O.current)==null?void 0:E.querySelector(`${fe}[${le}="${encodeURIComponent(p[0])}"]`);S?.parentElement.appendChild(S)})}function q(){let u=B().find(x=>x.getAttribute("aria-disabled")!=="true"),C=u?.getAttribute(le);A.setState("value",C||void 0)}function U(){var u,C,x,p;if(!r.current.search||i.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let E=0;for(let S of o.current){let F=(C=(u=s.current.get(S))==null?void 0:u.value)!=null?C:"",_=(p=(x=s.current.get(S))==null?void 0:x.keywords)!=null?p:[],X=M(F,_);r.current.filtered.items.set(S,X),X>0&&E++}for(let[S,F]of n.current)for(let _ of F)if(r.current.filtered.items.get(_)>0){r.current.filtered.groups.add(S);break}r.current.filtered.count=E}function w(){var u,C,x;let p=D();p&&(((u=p.parentElement)==null?void 0:u.firstChild)===p&&((x=(C=p.closest(fe))==null?void 0:C.querySelector(Fr))==null||x.scrollIntoView({block:"nearest"})),p.scrollIntoView({block:"nearest"}))}function D(){var u;return(u=O.current)==null?void 0:u.querySelector(`${ut}[aria-selected="true"]`)}function B(){var u;return Array.from(((u=O.current)==null?void 0:u.querySelectorAll(We))||[])}function W(u){let C=B()[u];C&&A.setState("value",C.getAttribute(le))}function J(u){var C;let x=D(),p=B(),E=p.findIndex(F=>F===x),S=p[E+u];(C=i.current)!=null&&C.loop&&(S=E+u<0?p[p.length-1]:E+u===p.length?p[0]:p[E+u]),S&&A.setState("value",S.getAttribute(le))}function z(u){let C=D(),x=C?.closest(fe),p;for(;x&&!p;)x=u>0?Kr(x,fe):Hr(x,fe),p=x?.querySelector(We);p?A.setState("value",p.getAttribute(le)):J(u)}let K=()=>W(B().length-1),re=u=>{u.preventDefault(),u.metaKey?K():u.altKey?z(1):J(1)},oe=u=>{u.preventDefault(),u.metaKey?W(0):u.altKey?z(-1):J(-1)};return l.createElement(ee.div,{ref:t,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:u=>{var C;(C=j.onKeyDown)==null||C.call(j,u);let x=u.nativeEvent.isComposing||u.keyCode===229;if(!(u.defaultPrevented||x))switch(u.key){case"n":case"j":{b&&u.ctrlKey&&re(u);break}case"ArrowDown":{re(u);break}case"p":case"k":{b&&u.ctrlKey&&oe(u);break}case"ArrowUp":{oe(u);break}case"Home":{u.preventDefault(),W(0);break}case"End":{u.preventDefault(),K();break}case"Enter":{u.preventDefault();let p=D();if(p){let E=new Event(Fe);p.dispatchEvent(E)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:Wr},f),we(e,u=>l.createElement(gt.Provider,{value:A},l.createElement(ft.Provider,{value:L},u))))}),Tr=l.forwardRef((e,t)=>{var r,o;let n=ne(),s=l.useRef(null),c=l.useContext(pt),i=me(),f=mt(e),d=(o=(r=f.current)==null?void 0:r.forceMount)!=null?o:c?.forceMount;se(()=>{if(!d)return i.item(n,c?.id)},[d]);let g=xt(n,s,[e.value,e.children,s],e.keywords),h=ze(),y=Q(R=>R.value&&R.value===g.current),v=Q(R=>d||i.filter()===!1?!0:R.search?R.filtered.items.get(n)>0:!0);l.useEffect(()=>{let R=s.current;if(!(!R||e.disabled))return R.addEventListener(Fe,N),()=>R.removeEventListener(Fe,N)},[v,e.onSelect,e.disabled]);function N(){var R,A;P(),(A=(R=f.current).onSelect)==null||A.call(R,g.current)}function P(){h.setState("value",g.current,!0)}if(!v)return null;let{disabled:b,value:j,onSelect:k,forceMount:$,keywords:T,...O}=e;return l.createElement(ee.div,{ref:pe(s,t),...O,id:n,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!y,"data-disabled":!!b,"data-selected":!!y,onPointerMove:b||i.getDisablePointerSelection()?void 0:P,onClick:b?void 0:N},e.children)}),Lr=l.forwardRef((e,t)=>{let{heading:r,children:o,forceMount:n,...s}=e,c=ne(),i=l.useRef(null),f=l.useRef(null),d=ne(),g=me(),h=Q(v=>n||g.filter()===!1?!0:v.search?v.filtered.groups.has(c):!0);se(()=>g.group(c),[]),xt(c,i,[e.value,e.heading,f]);let y=l.useMemo(()=>({id:c,forceMount:n}),[n]);return l.createElement(ee.div,{ref:pe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&l.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),we(e,v=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},l.createElement(pt.Provider,{value:y},v))))}),Mr=l.forwardRef((e,t)=>{let{alwaysRender:r,...o}=e,n=l.useRef(null),s=Q(c=>!c.search);return!r&&!s?null:l.createElement(ee.div,{ref:pe(n,t),...o,"cmdk-separator":"",role:"separator"})}),zr=l.forwardRef((e,t)=>{let{onValueChange:r,...o}=e,n=e.value!=null,s=ze(),c=Q(d=>d.search),i=Q(d=>d.selectedItemId),f=me();return l.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),l.createElement(ee.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":i,id:f.inputId,type:"text",value:n?e.value:c,onChange:d=>{n||s.setState("search",d.target.value),r?.(d.target.value)}})}),Vr=l.forwardRef((e,t)=>{let{children:r,label:o="Suggestions",...n}=e,s=l.useRef(null),c=l.useRef(null),i=Q(d=>d.selectedItemId),f=me();return l.useEffect(()=>{if(c.current&&s.current){let d=c.current,g=s.current,h,y=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let v=d.offsetHeight;g.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return y.observe(d),()=>{cancelAnimationFrame(h),y.unobserve(d)}}},[]),l.createElement(ee.div,{ref:pe(s,t),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:f.listId},we(e,d=>l.createElement("div",{ref:pe(c,f.listInnerRef),"cmdk-list-sizer":""},d)))}),$r=l.forwardRef((e,t)=>{let{open:r,onOpenChange:o,overlayClassName:n,contentClassName:s,container:c,...i}=e;return l.createElement(Ut,{open:r,onOpenChange:o},l.createElement(Wt,{container:c},l.createElement(Xt,{"cmdk-overlay":"",className:n}),l.createElement(Zt,{"aria-label":e.label,"cmdk-dialog":"",className:s},l.createElement(ht,{ref:t,...i}))))}),qr=l.forwardRef((e,t)=>Q(r=>r.filtered.count===0)?l.createElement(ee.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Br=l.forwardRef((e,t)=>{let{progress:r,children:o,label:n="Loading...",...s}=e;return l.createElement(ee.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},we(e,c=>l.createElement("div",{"aria-hidden":!0},c)))}),H=Object.assign(ht,{List:Vr,Item:Tr,Input:zr,Group:Lr,Separator:Mr,Dialog:$r,Empty:qr,Loading:Br});function Kr(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Hr(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function mt(e){let t=l.useRef(e);return se(()=>{t.current=e}),t}var se=typeof window>"u"?l.useEffect:l.useLayoutEffect;function ie(e){let t=l.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=ze(),r=()=>e(t.snapshot());return l.useSyncExternalStore(t.subscribe,r,r)}function xt(e,t,r,o=[]){let n=l.useRef(),s=me();return se(()=>{var c;let i=(()=>{var d;for(let g of r){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(d=g.current.textContent)==null?void 0:d.trim():n.current}})(),f=o.map(d=>d.trim());s.value(e,i,f),(c=t.current)==null||c.setAttribute(le,i),n.current=i}),n}var Gr=()=>{let[e,t]=l.useState(),r=ie(()=>new Map);return se(()=>{r.current.forEach(o=>o()),r.current=new Map},[e]),(o,n)=>{r.current.set(o,n),t({})}};function Ur(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function we({asChild:e,children:t},r){return e&&l.isValidElement(t)?l.cloneElement(Ur(t),{ref:t.ref},r(t.props.children)):r(t)}var Wr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const vt=G.forwardRef(({className:e,...t},r)=>a.jsx(H,{ref:r,className:m("flex size-full flex-col rounded-md [&_[cmdk-label]]:hidden",e),...t}));vt.displayName=H.displayName;const bt=G.forwardRef(({wrapperClassName:e,className:t,...r},o)=>a.jsxs("div",{className:m("group relative flex items-center border-b","border-b-gray-300 dark:border-b-gray-900","hover:border-b-gray-300 dark:hover:border-b-gray-800","hover:bg-gray-100 dark:hover:bg-gray-900","focus-within:border-b-gray-300 dark:focus-within:border-b-gray-800","focus-within:bg-gray-100 dark:focus-within:bg-gray-900",e),"cmdk-input-wrapper":"",children:[a.jsx(V,{name:"Search",size:16,className:m("pointer-events-none absolute left-2 top-3.5 text-gray-500 dark:text-gray-700","group-hover:text-gray-700 dark:group-hover:text-gray-500","group-focus-within:!text-gray-900 dark:group-focus-within:!text-gray-50")}),a.jsx(H.Input,{ref:o,className:m("flex w-full bg-transparent pb-2 pl-8 pr-3 pt-3 text-[14px] font-normal leading-5 outline-none","placeholder:text-gray-500 dark:placeholder:text-gray-700","group-hover:placeholder:text-gray-700 dark:group-hover:placeholder:text-gray-500","group-focus-within:placeholder:!text-gray-700 dark:group-focus-within:placeholder:!text-gray-300","disabled:cursor-not-allowed",t),...r})]}));bt.displayName=H.Input.displayName;const Ve=G.forwardRef(({className:e,...t},r)=>a.jsx(H.List,{ref:r,className:m("max-h-[300px] overflow-y-auto overflow-x-hidden","focus:outline-none","scrollbar-thin scrollbar-gutter-stable","scrollbar-track-transparent","scrollbar-thumb-gray-300 hover:scrollbar-thumb-gray-300","dark:scrollbar-thumb-charcoal-700 dark:hover:scrollbar-thumb-charcoal-700","scrollbar-thumb-rounded-md",e),...t}));Ve.displayName=H.List.displayName;const Xr=G.forwardRef((e,t)=>a.jsx(H.Loading,{ref:t,...e}));Xr.displayName=H.Loading.displayName;const $e=G.forwardRef((e,t)=>a.jsx(H.Empty,{ref:t,...e}));$e.displayName=H.Empty.displayName;const ye=G.forwardRef(({className:e,...t},r)=>a.jsx(H.Group,{ref:r,className:m("overflow-hidden px-0.5 py-1","[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t}));ye.displayName=H.Group.displayName;const Ne=G.forwardRef(({className:e,...t},r)=>a.jsx(H.Item,{ref:r,className:m("relative flex select-none items-center justify-between","h-8 gap-2 rounded-md py-1.5 pl-1.5 pr-2.5","text-[14px] leading-4 outline-none","border-y-2 border-white dark:border-slate-600","data-[disabled=true]:pointer-events-none","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Ne.displayName=H.Item.displayName;function ge(e,t,r=new Map){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return r.get(e)===t?!0:(r.set(e,t),e.length===t.length&&e.every((o,n)=>ge(o,t[n],r)));if(typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){if(r.get(e)===t)return!0;r.set(e,t);const o=Object.keys(e),n=Object.keys(t);return o.length===n.length&&o.every(s=>s in t&&ge(e[s],t[s],r))}return!1}const ke={trimOnBlur:(e=!0)=>({transformer:t=>t?.trim(),options:{trigger:"blur",if:e}}),lowercaseOnChange:(e=!0)=>({transformer:t=>t?.toLowerCase(),options:{trigger:"change",if:e}}),uppercaseOnChange:(e=!0)=>({transformer:t=>t?.toUpperCase(),options:{trigger:"change",if:e}}),trimOnEnter:(e=!0)=>({transformer:t=>t?.trim(),options:{trigger:"keyDown",if:e}})},Zr=(e,t)=>l.forwardRef(({value:r,name:o,showErrorOnBlur:n,showErrorOnChange:s,validators:c,...i},f)=>{const{onChange:d,onBlur:g}=i,{control:h,formState:{errors:y,defaultValues:v},trigger:N,setValue:P,getValues:b}=Ze(),{submitCount:j}=Bt();if(!o)throw new Error(`[Field: ${e.displayName}] The name prop is required.`);const k=[...y[o]?.types?Object.values(y[o].types??[]):[]];k.length===0&&y[o]&&k.push("Invalid value"),l.useEffect(()=>{j>0&&N(o)},[i.required]),l.useEffect(()=>{i.errors&&i.errors.length>0&&N(o)},[o,i.errors,N]);const[$,T]=l.useState(!1);return l.useEffect(()=>{$&&P(o,r),T(!0)},[o,r]),r!==void 0&&!d&&console.warn(`[Field: ${o}] Value prop provided without onChange so it will be ignored. Use disabled/readOnly if you want to prevent changes.`),a.jsx(Kt,{control:h,name:o,defaultValue:r??i.defaultValue,disabled:i.disabled,render:({field:{onChange:O,onBlur:R,value:A,...L}})=>{const M=l.useCallback(w=>{n?N(o):R(),g&&g(w)},[R,n]),I=l.useCallback(w=>{if(d)Object.hasOwn(w,"target")?P(o,w.target.value):P(o,w),d(w);else{let D=w;(w instanceof Event||w.target instanceof HTMLElement)&&(D=w.target.value),P(o,D)}s===void 0&&n===void 0?j>0&&N(o):s&&N(o)},[A,s,n,j]),{ref:q}=L,U=w=>{typeof f=="function"?f(w):f&&(f.current=w),q(w)};return a.jsx(e,{...i,...L,value:A,onBlur:M,onChange:I,errors:k,ref:U})},rules:{...i.required?{required:{value:i.required,message:"This field is required"}}:{required:void 0},...i.pattern&&{pattern:{value:new RegExp(i.pattern),message:"This field does not match the required pattern"}},...i.maxLength!==void 0&&i.maxLength>=0?{maxLength:{value:i.maxLength,message:`This field must be at most ${i.maxLength} characters`}}:{maxLength:void 0},...i.minLength!==void 0&&i.minLength>=0?{minLength:{value:i.minLength,message:`This field must be at least ${i.minLength} characters`}}:{minLength:void 0},...i.minValue&&{min:{value:i.minValue,message:`This field must be greater than or equal to ${i.minValue}`}},...i.maxValue&&{max:{value:i.maxValue,message:`This field must be less than or equal to ${i.maxValue}`}},validate:{...i.errors?Object.fromEntries(Array.isArray(i.errors)?i.errors.map((O,R)=>[`_propError${R}`,()=>O]):[]):{},...c!==void 0?Object.fromEntries((Array.isArray(c)?c:[c]).map((O,R)=>[`customValidation${R}`,O])):{}}}})}),yt=({children:e,as:t,className:r})=>{const o=t??"p";return a.jsx(o,{className:m("font-sans text-sm font-normal leading-5 text-gray-600 dark:text-gray-500",r),children:e})},kt=({children:e})=>a.jsx("div",{className:"flex flex-col gap-2",children:e});var Re="Popover",[Ct]=Je(Re,[Ye]),xe=Ye(),[Jr,te]=Ct(Re),jt=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:s,modal:c=!1}=e,i=xe(t),f=l.useRef(null),[d,g]=l.useState(!1),[h,y]=Qe({prop:o,defaultProp:n??!1,onChange:s,caller:Re});return a.jsx(Jt,{...i,children:a.jsx(Jr,{scope:t,contentId:ne(),triggerRef:f,open:h,onOpenChange:y,onOpenToggle:l.useCallback(()=>y(v=>!v),[y]),hasCustomAnchor:d,onCustomAnchorAdd:l.useCallback(()=>g(!0),[]),onCustomAnchorRemove:l.useCallback(()=>g(!1),[]),modal:c,children:r})})};jt.displayName=Re;var wt="PopoverAnchor",Nt=l.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=te(wt,r),s=xe(r),{onCustomAnchorAdd:c,onCustomAnchorRemove:i}=n;return l.useEffect(()=>(c(),()=>i()),[c,i]),a.jsx(et,{...s,...o,ref:t})});Nt.displayName=wt;var Rt="PopoverTrigger",Et=l.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=te(Rt,r),s=xe(r),c=Ce(t,n.triggerRef),i=a.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Ot(n.open),...o,ref:c,onClick:ae(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?i:a.jsx(et,{asChild:!0,...s,children:i})});Et.displayName=Rt;var qe="PopoverPortal",[Qr,Yr]=Ct(qe,{forceMount:void 0}),St=e=>{const{__scopePopover:t,forceMount:r,children:o,container:n}=e,s=te(qe,t);return a.jsx(Qr,{scope:t,forceMount:r,children:a.jsx(Te,{present:r||s.open,children:a.jsx(Qt,{asChild:!0,container:n,children:o})})})};St.displayName=qe;var ce="PopoverContent",Pt=l.forwardRef((e,t)=>{const r=Yr(ce,e.__scopePopover),{forceMount:o=r.forceMount,...n}=e,s=te(ce,e.__scopePopover);return a.jsx(Te,{present:o||s.open,children:s.modal?a.jsx(ta,{...n,ref:t}):a.jsx(ra,{...n,ref:t})})});Pt.displayName=ce;var ea=tr("PopoverContent.RemoveScroll"),ta=l.forwardRef((e,t)=>{const r=te(ce,e.__scopePopover),o=l.useRef(null),n=Ce(t,o),s=l.useRef(!1);return l.useEffect(()=>{const c=o.current;if(c)return Yt(c)},[]),a.jsx(er,{as:ea,allowPinchZoom:!0,children:a.jsx(At,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ae(e.onCloseAutoFocus,c=>{c.preventDefault(),s.current||r.triggerRef.current?.focus()}),onPointerDownOutside:ae(e.onPointerDownOutside,c=>{const i=c.detail.originalEvent,f=i.button===0&&i.ctrlKey===!0,d=i.button===2||f;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ae(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),ra=l.forwardRef((e,t)=>{const r=te(ce,e.__scopePopover),o=l.useRef(!1),n=l.useRef(!1);return a.jsx(At,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||r.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;r.triggerRef.current?.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),At=l.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEscapeKeyDown:i,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:g,...h}=e,y=te(ce,r),v=xe(r);return rr(),a.jsx(ar,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:s,children:a.jsx(nr,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:g,onEscapeKeyDown:i,onPointerDownOutside:f,onFocusOutside:d,onDismiss:()=>y.onOpenChange(!1),children:a.jsx(sr,{"data-state":Ot(y.open),role:"dialog",id:y.contentId,...v,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),It="PopoverClose",aa=l.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=te(It,r);return a.jsx(he.button,{type:"button",...o,ref:t,onClick:ae(e.onClick,()=>n.onOpenChange(!1))})});aa.displayName=It;var na="PopoverArrow",sa=l.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xe(r);return a.jsx(or,{...n,...o,ref:t})});sa.displayName=na;function Ot(e){return e?"open":"closed"}var oa=jt,la=Nt,ia=Et,da=St,ca=Pt;const Dt=oa,ua=la,fa=ia,Ft=G.forwardRef(({align:e="center",sideOffset:t=4,className:r,...o},n)=>a.jsx(da,{children:a.jsx(ca,{align:e,sideOffset:t,className:m(["data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in","data-[state=closed]:animate-zoom-out data-[state=open]:animate-zoom-in","data-[side=bottom]:animate-slide-in-from-top data-[side=left]:animate-slide-in-from-right","data-[side=right]:animate-slide-in-from-left data-[side=top]:animate-slide-in-from-bottom","w-(--radix-popover-trigger-width) z-50 border p-0 outline-none","border-gray-300 bg-white dark:border-slate-500 dark:bg-slate-600","rounded-md shadow-[1px_4px_15px_0px_rgba(74,88,115,0.25)] dark:shadow-[1px_4px_15.3px_0px_#141921]"],r),ref:n,...o})})),ga=e=>typeof e=="string"?a.jsx(V,{name:e,size:16,className:m("text-gray-700 dark:text-gray-400")}):e&&a.jsx(e,{className:m("size-4","text-gray-700 dark:text-gray-400")}),Xe=({options:e=[],selectedValues:t,multiple:r,selectionIcon:o,selectionIconPosition:n,hasAnyIcon:s,toggleOption:c,tabIndex:i})=>a.jsx(a.Fragment,{children:e.map(f=>{const d=t.includes(f.value);return a.jsxs(Ne,{tabIndex:i,value:f.label,onSelect:()=>!f.disabled&&c(f.value),disabled:f.disabled,className:m("cursor-pointer","data-[selected=true]:bg-gray-100 dark:data-[selected=true]:bg-gray-900",f.disabled&&"!pointer-events-auto cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent"),role:"option","aria-selected":d,children:[o==="auto"&&(r?a.jsx("div",{className:m("flex size-4 items-center justify-center rounded-md border","border-gray-700 dark:border-gray-400",d&&"bg-gray-900 text-slate-50 dark:bg-gray-400 dark:text-black"),children:d&&a.jsx(V,{name:"Checkmark",size:16})}):a.jsx("div",{className:m("relative size-4 rounded-full border",d?"border-gray-900 dark:border-gray-400":"border-gray-800 dark:border-gray-400","bg-transparent dark:bg-transparent"),children:d&&a.jsx("div",{className:"absolute left-1/2 top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-gray-900 dark:bg-gray-400"})})),o==="checkmark"&&!(n==="right"&&s)&&a.jsx("div",{className:"size-4",children:n==="left"&&d&&a.jsx(V,{name:"Checkmark",size:16,className:"text-gray-900 dark:text-gray-50"})}),ga(f.icon),a.jsx("span",{className:m("flex-1 truncate text-[14px] font-normal leading-4","text-gray-700 dark:text-gray-500",f.disabled&&"text-gray-600 dark:text-gray-600"),children:f.label}),o==="checkmark"&&n==="right"&&a.jsx("div",{className:"size-4",children:d&&a.jsx(V,{name:"Checkmark",size:16,className:"text-gray-900 dark:text-gray-50"})})]},`favorite-${f.value}`)})}),pa=({searchable:e,commandListRef:t,multiple:r,selectedValues:o,selectionIcon:n,selectionIconPosition:s,options:c=[],toggleAll:i,toggleOption:f,favoriteOptions:d=[]})=>{const g=c.filter(v=>!v.disabled),h=c.some(v=>v.icon),y=Q(v=>v.search);return l.useEffect(()=>{t.current?.scrollTo({top:0,behavior:"instant"})},[t,y]),a.jsxs(a.Fragment,{children:[e&&a.jsx(bt,{placeholder:"Search...",onKeyDown:v=>{["ArrowUp","ArrowDown","Enter"].includes(v.key)&&g.length>0||v.stopPropagation()},wrapperClassName:"rounded-t",className:"text-gray-900 dark:text-gray-50"}),a.jsxs(Ve,{ref:t,tabIndex:e?void 0:0,children:[a.jsx($e,{className:"p-4 text-center text-[14px] font-normal leading-5 text-gray-700 dark:text-gray-400",children:"No results found."}),r&&y===""&&a.jsx(ye,{className:"pb-0",children:a.jsx(Ne,{value:"select-all",onSelect:i,disabled:!1,className:m("cursor-pointer","data-[selected=true]:bg-gray-100 dark:data-[selected=true]:bg-gray-900"),role:"option","aria-selected":o.length===g.length,children:a.jsxs("div",{className:"flex w-full items-center gap-2",children:[n==="auto"&&a.jsx("div",{className:m("flex size-4 items-center justify-center rounded-md border","border-gray-700 dark:border-gray-400",o.length===g.length&&"bg-gray-900 text-slate-50 dark:bg-gray-400 dark:text-black"),children:o.length===g.length&&a.jsx(V,{name:"Checkmark",size:16})}),n==="checkmark"&&!(s==="right"&&h)&&a.jsx("div",{className:"size-4",children:s==="left"&&o.length===g.length&&a.jsx(V,{name:"Checkmark",size:16,className:"text-gray-900 dark:text-gray-50"})}),a.jsx("span",{className:"text-[14px] font-semibold leading-4 text-gray-900 dark:text-gray-50",children:o.length===g.length?"Deselect All":"Select All"}),n==="checkmark"&&s==="right"&&a.jsx("div",{className:"ml-auto size-4",children:o.length===g.length&&a.jsx(V,{name:"Checkmark",size:16,className:"text-gray-900 dark:text-gray-50"})})]})})}),a.jsxs(ye,{className:r&&y===""?"pt-0":void 0,children:[a.jsx(Xe,{options:d,selectedValues:o,multiple:r,selectionIcon:n,selectionIconPosition:s,hasAnyIcon:h,toggleOption:f,tabIndex:e?void 0:0}),d.length>0&&a.jsx("div",{className:"my-1 border-b border-gray-300 dark:border-gray-600"}),a.jsx(Xe,{options:c,selectedValues:o,multiple:r,selectionIcon:n,selectionIconPosition:s,hasAnyIcon:h,toggleOption:f,tabIndex:e?void 0:0})]})]})]})},ha=({selectedValues:e,options:t=[],multiple:r,searchable:o,placeholder:n,handleClear:s})=>{const c=i=>typeof i=="string"?a.jsx(V,{name:i,size:16}):i&&a.jsx(i,{className:"size-4"});return e.length===0?a.jsxs("div",{className:m("mx-auto flex w-full items-center",n?"justify-between":"justify-end"),children:[n&&a.jsx("span",{className:"text-[14px] font-normal leading-5 text-gray-600 dark:text-gray-500",children:n}),o?a.jsx(V,{name:"CaretSort",size:16,className:"cursor-pointer text-gray-700 dark:text-gray-400"}):a.jsx(V,{name:"ChevronDown",size:16,className:"cursor-pointer text-gray-700 dark:text-gray-400"})]}):a.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[a.jsx("div",{className:m("max-w-full truncate text-gray-900 dark:text-gray-50",!r&&"flex items-center gap-2"),children:e.map((i,f)=>{const d=t.find(g=>g.value===i);return r?a.jsx("span",{className:m("text-[14px] font-normal leading-5",f!==e.length-1&&"mr-1"),children:f!==e.length-1?`${d?.label},`:d?.label},i):a.jsxs(G.Fragment,{children:[c(d?.icon),a.jsx("span",{className:"truncate text-[14px] font-normal leading-5",children:d?.label})]},i)})}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r&&e.length>0&&a.jsx("div",{onClick:i=>{i.preventDefault(),i.stopPropagation(),s()},className:"size-4 p-0",children:a.jsx(V,{name:"XmarkLight",size:16,className:"cursor-pointer text-gray-700 dark:text-gray-400"})}),o?a.jsx(V,{name:"CaretSort",size:16,className:"cursor-pointer text-gray-700 dark:text-gray-400"}):a.jsx(V,{name:"ChevronDown",size:16,className:"cursor-pointer text-gray-700 dark:text-gray-400"})]})]})};function ma({options:e=[],multiple:t=!1,defaultValue:r,value:o,onChange:n}){const s=l.useRef(!1),c=l.useRef(null),[i,f]=l.useState(!1),[d,g]=l.useState(()=>{const b=o??r??[];return b===""?[]:Array.isArray(b)?b:[b]});l.useEffect(()=>{if(s.current){s.current=!1;return}const b=o??r??[];g(b===""?[]:Array.isArray(b)?b:[b])},[o]);const h=l.useCallback(b=>{f(b)},[]),y=l.useCallback(b=>{s.current=!0;let j;t?j=d.includes(b)?d.filter(k=>k!==b):[...d,b]:(j=d[0]===b?[]:[b],f(!1)),g(j),n?.(t?j:j[0]??"")},[t,d,e,n]),v=l.useCallback(()=>{s.current=!0,g([]),n?.(t?[]:"")},[t,n]),N=l.useCallback(()=>{s.current=!0;const b=e.filter(k=>!k.disabled).map(k=>k.value),j=d.length===b.length?[]:b;g(j),n?.(t?j:j[0])},[e,d,t,n]),P=l.useRef(t);return l.useEffect(()=>{if(P.current!==t){if(P.current=t,!t&&d.length>1){s.current=!0,g([d[0]]),n?.(d[0]);return}d.length>0&&(s.current=!0,n?.(t?[d[0]]:d[0]))}},[t]),{selectedValues:d,isPopoverOpen:i,commandListRef:c,toggleOption:y,handleClear:v,toggleAll:N,handleOpenChange:h}}const xa=G.forwardRef(({options:e=[],favoriteOptions:t=[],defaultValue:r,value:o,onChange:n,onBlur:s,id:c,name:i,label:f,required:d,disabled:g,errors:h=[],warnings:y=[],multiple:v,selectionIcon:N="auto",selectionIconPosition:P="left",searchable:b,description:j,placeholder:k,className:$,contentClassName:T,contentAlign:O="start",...R},A)=>{const L=l.useId(),M=c??`${L}-select`,{selectedValues:I,isPopoverOpen:q,commandListRef:U,toggleOption:w,handleClear:D,toggleAll:B,handleOpenChange:W}=ma({options:e,multiple:v,defaultValue:r,value:o,onChange:n}),J=l.useCallback(z=>{q||s?.(z)},[s,q]);return a.jsxs(kt,{children:[f&&a.jsx(Me,{htmlFor:M,required:d,disabled:g,hasError:h.length>0,inline:!1,onClick:z=>{z.preventDefault(),z.target.control?.focus()},children:f}),a.jsxs(Dt,{open:q,onOpenChange:z=>{W(z),!z&&document.activeElement?.id!==M&&s?.({target:{}})},children:[a.jsx(fa,{asChild:!0,children:a.jsx(mr,{id:M,name:i,type:"button",role:"combobox",onBlur:J,disabled:g,"aria-invalid":h.length>0,"aria-label":f?void 0:v?"Multi select":"Select","aria-required":d,"aria-expanded":q,className:m("flex h-9 w-full items-center justify-between px-3 py-2","dark:border-charcoal-700 dark:bg-charcoal-900 rounded-md border border-gray-300 bg-white","hover:border-gray-300 hover:bg-gray-100","dark:hover:border-charcoal-700 dark:hover:bg-charcoal-800","dark:focus:ring-charcoal-300 focus:outline-none focus:ring-1 focus:ring-gray-900 focus:ring-offset-0","dark:focus-visible:ring-charcoal-300 focus-visible:ring-1 focus-visible:ring-gray-900 focus-visible:ring-offset-0",g&&["!pointer-events-auto cursor-not-allowed bg-gray-50","dark:hover:border-charcoal-700 dark:hover:bg-charcoal-900 hover:border-gray-300 hover:bg-gray-50"],$),...R,ref:A,children:a.jsx(ha,{selectedValues:I,options:[...t,...e],multiple:v,searchable:b,placeholder:k,handleClear:D})})}),a.jsx(Ft,{align:O,onEscapeKeyDown:z=>{z.preventDefault(),W(!1)},className:T,children:a.jsx(vt,{defaultValue:!v&&I[0]?e.find(z=>z.value===I[0])?.label:void 0,children:a.jsx(pa,{favoriteOptions:t,searchable:b,commandListRef:U,multiple:v,selectedValues:I,selectionIcon:N,selectionIconPosition:P,options:e,toggleAll:B,toggleOption:w})})})]}),j&&a.jsx(yt,{children:j}),y.length>0&&a.jsx(de,{messages:y,type:"warning"}),h.length>0&&a.jsx(de,{messages:h,type:"error"})]})}),va=Zr(xa);va.displayName="SelectField";function _t(...e){return gr(Ht(e))}const ba=_t("flex h-9 w-full rounded-md text-sm font-normal leading-5 text-gray-900 dark:text-gray-50","dark:border-charcoal-700 dark:bg-charcoal-900 border border-gray-300 bg-white","px-3 py-2","font-sans placeholder:text-gray-500 dark:placeholder:text-gray-600","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-900 focus-visible:ring-offset-0 focus-visible:ring-offset-white","dark:focus-visible:ring-charcoal-300 dark:focus-visible:ring-offset-charcoal-900 dark:focus:bg-charcoal-900 focus:bg-gray-50","disabled:cursor-not-allowed","disabled:border-gray-300 disabled:bg-gray-50 disabled:text-gray-700","disabled:dark:border-charcoal-800 disabled:dark:bg-charcoal-900 disabled:dark:text-gray-300"),Be=l.forwardRef(({className:e,type:t,...r},o)=>a.jsx("input",{type:t,className:_t(ba,e),ref:o,...r}));Be.displayName="Input";function Ae(e,t){const r=Object.getOwnPropertyDescriptor(e,"value")?.set,o=Object.getPrototypeOf(e),n=Object.getOwnPropertyDescriptor(o,"value")?.set;r&&r!==n?n?.call(e,t):r?.call(e,t)}function be(e,t,r="blur"){return e.reduce((o,n)=>typeof n=="function"?r==="blur"||r==="all"?n(o):o:(n.options?.trigger??"blur")!==r&&r!=="all"?o:n.options?.if===void 0||n.options.if?n.transformer(o):o,t)}function Tt({transformers:e,children:t}){const o=Ze()?.setValue;return l.useEffect(()=>{const n=t.props.value,s=be(e,n,"all");ge(s,n)||(typeof o=="function"?o(t.props.name,s):t.props.onChange?.({target:{value:s}}))},[e,o]),G.cloneElement(t,{...t.props,onChange:n=>{const s=be(e,n.target.value,"change");s!==n.target.value&&o&&(o(t.props.name,s),Ae(n.target,s)),t.props.onChange?.(n)},onBlur:n=>{t.props.onBlur?.(n);const s=n.target,c=be(e,s.value,"blur");if(!ge(c,s.value)){Ae(s,c);const i=new Event("change",{bubbles:!0});s.dispatchEvent(i)}},onKeyDown:n=>{if(t.props.onKeyDown?.(n),n.key==="Enter"){const s=n.target,c=be(e,s.value,"keyDown");if(!ge(c,s.value)){Ae(s,c);const i=new Event("change",{bubbles:!0});s.dispatchEvent(i)}}}})}const ya=G.forwardRef(({id:e,name:t,value:r,className:o,isLoading:n,haveFetchError:s,disabled:c,onChange:i,onBlur:f,onClick:d,selectedOption:g,optionsLength:h,handleOpenChange:y,onKeyDown:v,onMouseDown:N,placeholder:P,hasError:b,label:j,required:k,isPopoverOpen:$,maxLength:T,handlePaste:O,onPaste:R,...A},L)=>{const[M,I]=l.useState(!1),q=ur("(hover: hover) and (pointer: fine)"),U=l.useMemo(()=>[ke.trimOnBlur(),ke.trimOnEnter()],[]);return a.jsxs("div",{className:m("group relative"),children:[a.jsx(Tt,{transformers:U,children:a.jsx(H.Input,{asChild:!0,children:a.jsx(Be,{id:e,name:t,value:r,className:m("pr-9",o),disabled:c,onChange:i,onBlur:f,onClick:w=>{const D=w.target;!(n||s)&&!g&&D.value!==""&&y?.(!0),d?.(w)},onKeyDown:w=>{v?.(w);const D=["ArrowUp","ArrowDown","Enter"].includes(w.key);if(w.key==="Enter"&&$&&h===0){y?.(!1),w.preventDefault();return}D&&$&&h>0||w.stopPropagation()},onMouseDown:w=>{const D=w.target;D.contains(document.activeElement)||requestAnimationFrame(()=>{D.select()}),N?.(w)},onPaste:w=>{O?.(w),R?.(w)},placeholder:P,"aria-invalid":b,"aria-label":j?void 0:"Id Autocomplete","aria-required":k,"aria-expanded":$,maxLength:T,...A,ref:L})})}),a.jsxs("div",{className:m("absolute right-3 top-1/2 flex size-4 -translate-y-1/2 items-center",!n&&!s&&!g&&"pointer-events-none"),children:[n&&a.jsx(V,{name:"Reload",size:16,className:m("animate-spin text-gray-500 dark:text-gray-600")}),s&&a.jsx(Ie,{children:a.jsx(Oe,{content:"Network error!",children:a.jsx(V,{name:"Error",size:16,className:m("text-red-900")})})}),g&&!n&&!s&&a.jsx(Ie,{children:a.jsx(Oe,{content:"Copied!",open:M,triggerAsChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(g.value).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)}).catch(w=>{console.error("Failed to copy value: ",w)})},className:m("focus-visible:outline-none [&_svg]:pointer-events-none",q&&"opacity-0 transition-opacity duration-500 group-hover:opacity-100"),children:a.jsx(V,{name:"Copy",size:16,className:m("text-gray-500 dark:text-gray-600")})})})})]})]})}),ka=({customIcon:e,asPlaceholder:t})=>typeof e=="string"?a.jsx(V,{name:e,size:24,className:m("shrink-0",t?"text-gray-400 dark:text-gray-700":"text-gray-900 dark:text-gray-300")}):G.isValidElement(e)?a.jsx("div",{className:"size-6 shrink-0 overflow-hidden",children:e}):null,Ca=({isLoadingSelectedOption:e,handleFetchSelectedOption:t,isFetchSelectedOptionSync:r,value:o})=>a.jsx("div",{children:a.jsx("button",{type:"button",disabled:e||r,onClick:()=>{!e&&!r&&t(o)},className:m("mt-0.5 focus-visible:outline-none","disabled:pointer-events-none [&_svg]:pointer-events-none"),"aria-label":e?"Loading":r?"Success":"Reload",children:a.jsx(V,{name:r?"Checkmark":"Reload",size:16,className:m("text-gray-500 dark:text-gray-600",e&&"animate-spin",r&&"animate-in fade-in duration-500")})})}),_e=({variant:e="withValue",icon:t,title:r="Title not available",path:o="Path not available",value:n,description:s="Description not available",asPlaceholder:c,showValue:i=!0,isLoadingSelectedOption:f,handleFetchSelectedOption:d,isFetchSelectedOptionSync:g,className:h,placeholderIcon:y="PowerhouseLogoSmall",...v})=>{const N=()=>a.jsx("div",{className:m("flex w-full items-center"),children:a.jsx("span",{className:m("truncate text-xs leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-500 dark:text-gray-600"),children:n})}),P=(b=!0)=>a.jsxs("div",{className:m("flex w-full flex-col gap-1"),children:[a.jsxs("div",{className:m("flex gap-2"),children:[a.jsx(ka,{customIcon:c?y:t,asPlaceholder:c}),a.jsxs("div",{className:m("flex min-w-0 grow flex-col gap-[-2px]"),children:[a.jsx("span",{className:m("truncate text-sm font-bold leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-900 dark:text-gray-300"),children:r}),!i&&typeof o=="object"?a.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:m("truncate text-xs leading-5 text-blue-900 hover:underline focus-visible:outline-none"),children:o.text}):a.jsx("span",{className:m("truncate text-xs leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-500 dark:text-gray-600"),children:typeof o=="object"?o.text:o})]}),c===!1&&d&&a.jsx(Ca,{isLoadingSelectedOption:f,handleFetchSelectedOption:d,isFetchSelectedOptionSync:g,value:n})]}),i&&a.jsx("div",{className:m("flex max-w-full items-center"),children:a.jsx("span",{className:m("truncate text-xs leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-500 dark:text-gray-600"),children:n})}),b&&a.jsx("div",{className:m("flex flex-col"),children:a.jsx("p",{className:m("line-clamp-2 text-xs leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-900 dark:text-gray-300"),children:s})}),b&&"agentType"in v&&typeof v.agentType=="string"&&a.jsx("div",{className:m("flex max-w-full items-center justify-end"),children:a.jsx("span",{className:m("truncate text-xs leading-5",c?"text-gray-400 dark:text-gray-700":"text-gray-500 dark:text-gray-600"),children:v.agentType})})]});return a.jsxs("div",{className:m("w-full max-w-full rounded-md bg-transparent px-3 pb-2",e==="withValue"?"pt-2":"pt-3",h),children:[e==="withValue"&&N(),e==="withValueAndTitle"&&P(!1),e==="withValueTitleAndDescription"&&P()]})},ja=({variant:e,commandListRef:t,selectedValue:r,options:o=[],toggleOption:n,renderOption:s,previewPlaceholder:c})=>{const i=Q(d=>d.search),f=c||{value:"value not available",title:"Title not available",path:"Path not available",description:"Description not available"};return l.useEffect(()=>{t?.current?.scrollTo({top:0,behavior:"instant"})},[t,i]),a.jsxs(Ve,{ref:t,children:[a.jsx($e,{className:m("h-full p-1"),children:s?s(f,{asPlaceholder:!0,showValue:!0,className:m("pb-0")}):a.jsx(_e,{variant:e,icon:f.icon,title:f.title,path:f.path,value:f.value,description:f.description,asPlaceholder:!0,className:m("pb-0")})}),a.jsx(ye,{className:m("px-1"),children:o.map(d=>{const g=r===d.value;return a.jsx(Ne,{value:d.value,onSelect:()=>n?.(d.value),className:m("h-full cursor-pointer border-y-0 p-0","data-[selected=true]:bg-gray-100 dark:data-[selected=true]:bg-gray-900"),role:"option","aria-selected":g,children:s?s(d,{asPlaceholder:!1,showValue:!0}):a.jsx(_e,{variant:e,...d})},d.value)})})]})},wa=l.createContext({}),Na=()=>l.useContext(wa);function Ra({autoComplete:e,defaultValue:t,value:r,isOpenByDefault:o,initialOptions:n,onChange:s,onBlur:c,fetchOptions:i,fetchSelectedOption:f}){const d=Na(),g=l.useRef(!1),h=l.useRef(!1),y=l.useRef(null),[v,N]=l.useState(o??!1),[P,b]=l.useState(n??[]),[j,k]=l.useState(!1),[$,T]=l.useState(!1),[O,R]=l.useState(!1),[A,L]=l.useState(r??t??""),[M,I]=l.useState(void 0),[q,U]=l.useState(""),[w,D]=l.useState(!1),B=l.useCallback(()=>{R(!1),k(!1),T(!1),N(!1)},[]),W=fr(l.useCallback(x=>{if(!(!e||!i)){if(x===""){B(),b([]),L(""),I(void 0);return}R(!1),k(!0);try{const p=i(x,d);Promise.resolve(p).then(E=>{b(E);const S=E.find(F=>F.value===x);S?(I(S),N(!1)):(I(void 0),N(!0)),k(!1)}).catch(()=>{R(!0),k(!1)})}catch{R(!0),k(!1)}}},[B,e,i,d])),J=l.useCallback(x=>{if(!(!e||!f)){T(!0);try{const p=f(x),E=p instanceof Promise;Promise.resolve(p).then(S=>{S?(I(S),b(F=>{const _=F.findIndex(X=>X.value===x);if(_!==-1){const X=[...F];return X[_]=S,X}return F})):(B(),b([]),L(""),I(void 0)),T(!1),E||(D(!0),setTimeout(()=>{D(!1)},1500))}).catch(()=>{T(!1)})}catch{T(!1)}}},[B,e,f]),z=l.useCallback(x=>{x||U(P[0]?.value??""),N(x)},[P]),K=l.useCallback(x=>{g.current=!1,h.current=!0,L(x),I(P.find(p=>p.value===x)),B(),s?.(x)},[s,B,P]),re=l.useCallback(x=>{const p=x.target.value;g.current=!0,L(p),I(void 0),s?.(p)},[s]),oe=l.useCallback(x=>{U(x)},[]),u=l.useCallback(x=>{v||c?.(x)},[c,v]),C=l.useCallback(x=>{const p=x.clipboardData.getData("text"),E=p.trim();if(p!==E){x.preventDefault();const S=x.currentTarget,F=S.selectionStart||0,_=S.selectionEnd||0,X=S.value,ue=X.substring(0,F)+E+X.substring(_);s?.(ue),requestAnimationFrame(()=>{const ve=F+E.length;S.setSelectionRange(ve,ve),W(ue)})}else p===A&&W(A)},[A,W,s]);return l.useEffect(()=>{e?g.current&&W(A):(B(),b([]),L(""),I(void 0))},[e,A,W,B]),l.useEffect(()=>{h.current||(g.current=!1,L(r??t??""),I(void 0)),h.current=!1},[r]),l.useEffect(()=>{if(n?.length&&A){const x=n.find(p=>p.value===A);x&&I(x)}},[]),{selectedValue:A,selectedOption:M,isPopoverOpen:v,commandListRef:y,options:P,isLoading:j,isLoadingSelectedOption:$,haveFetchError:O,commandValue:q,isFetchSelectedOptionSync:w,toggleOption:K,handleOpenChange:z,onTriggerBlur:u,handleChange:re,handleCommandValue:oe,handleFetchSelectedOption:J,handlePaste:C}}const Ea=G.forwardRef(({id:e,name:t,className:r,label:o,description:n,value:s,defaultValue:c,disabled:i,placeholder:f,required:d,errors:g,warnings:h,onChange:y,onBlur:v,onClick:N,onKeyDown:P,onMouseDown:b,autoComplete:j=!0,variant:k="withValue",maxLength:$,fetchOptionsCallback:T,fetchSelectedOptionCallback:O,isOpenByDefault:R,initialOptions:A,renderOption:L,previewPlaceholder:M,...I},q)=>{const U=l.useId(),w=e??`${U}-id-autocomplete`,D=l.useRef(null),B=Z=>{D.current=Z,typeof q=="function"?q(Z):q&&(q.current=Z)},W=Array.isArray(h)&&h.length>0,J=Array.isArray(g)&&g.length>0,{selectedValue:z,selectedOption:K,isPopoverOpen:re,commandListRef:oe,options:u,isLoading:C,isLoadingSelectedOption:x,haveFetchError:p,commandValue:E,isFetchSelectedOptionSync:S,toggleOption:F,handleOpenChange:_,onTriggerBlur:X,handleChange:ue,handleCommandValue:ve,handleFetchSelectedOption:Ke,handlePaste:Lt}=Ra({autoComplete:j,defaultValue:c,value:s,isOpenByDefault:R,initialOptions:A,onChange:y,onBlur:v,fetchOptions:T,fetchSelectedOption:O}),Mt=Z=>{F(Z),D.current?.focus()},zt=k==="withValueAndTitle"||k==="withValueTitleAndDescription",Vt=l.useMemo(()=>[ke.trimOnBlur(),ke.trimOnEnter()],[]);return a.jsxs(kt,{children:[!!o&&a.jsx(Me,{htmlFor:w,disabled:i,hasError:J,required:d,onClick:Z=>{Z.preventDefault(),Z.target.control?.focus()},children:o}),j&&T?a.jsx(Dt,{open:re,onOpenChange:_,children:a.jsxs(H,{shouldFilter:!1,value:E,onValueChange:ve,className:m("dark:bg-charcoal-900 bg-gray-100"),children:[a.jsx(ua,{asChild:!0,children:a.jsx(ya,{id:w,name:t,value:z,className:r,isLoading:C,haveFetchError:p,disabled:i,onChange:ue,onBlur:X,onClick:N,selectedOption:K,optionsLength:u.length,handleOpenChange:_,onKeyDown:P,onMouseDown:b,placeholder:f,hasError:J,label:o,required:d,isPopoverOpen:re,maxLength:$,handlePaste:Lt,...I,ref:B})}),zt&&(L?L(K===void 0&&M?{...M}:{...K,value:K?.value??""},{asPlaceholder:K===void 0,showValue:!1,isLoadingSelectedOption:x,handleFetchSelectedOption:O?Ke:void 0,isFetchSelectedOptionSync:S,className:m("rounded-t-none pt-2")}):a.jsx(_e,{variant:k,icon:K?.icon??M?.icon,title:K?.title??M?.title,path:K?.path??M?.path,value:K?.value??M?.value??"",description:K?.description??M?.description,asPlaceholder:K===void 0,showValue:!1,isLoadingSelectedOption:x,handleFetchSelectedOption:O?Ke:void 0,isFetchSelectedOptionSync:S,className:m("rounded-t-none pt-2")})),a.jsx(Ft,{align:"start",onOpenAutoFocus:Z=>Z.preventDefault(),onInteractOutside:Z=>{Z.target instanceof Element&&Z.target.id===w&&Z.preventDefault()},children:a.jsx(ja,{variant:k,commandListRef:oe,selectedValue:z,options:u,toggleOption:Mt,renderOption:L,previewPlaceholder:M})})]})}):a.jsx(Tt,{transformers:Vt,children:a.jsx(Be,{id:w,name:t,value:z,className:r,disabled:i,onChange:ue,onBlur:v,onClick:N,onMouseDown:b,placeholder:f,"aria-invalid":J,"aria-label":o?void 0:"Id Autocomplete","aria-required":d,maxLength:$,...I,ref:B})}),!!n&&a.jsx(yt,{children:n}),W&&a.jsx(de,{messages:h,type:"warning"}),J&&a.jsx(de,{messages:g,type:"error"})]})});Ea.displayName="IdAutocomplete";export{wr as C,Be as I,Dt as P,xa as S,fa as a,Ft as b,Ea as c,Ta as d};
@@ -1,28 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/reactor_browser-najzCy3f.js","assets/document_model-Ce4lCkNT.js","assets/zod-9j67vCAu.js","assets/react-DQSxOgtG.js","assets/document_drive-BckABlJR.js","assets/graphql-AKTCpY7l.js","assets/config-CU-aFfVJ.js","assets/sentry_react-cODD7zWc.js","assets/sentry_browser-B4YoBIIG.js","assets/drive_explorer-1ZrqokUe.js","assets/document_model_editor-D4xoIBZ3.js","assets/react/jsx-runtime-DldvXD6N.js","assets/design_system-C3rLdIMt.js","assets/tailwind_merge-Dr4f9Rms.js","assets/react-dom-D6zQJsh6.js","assets/design_system_connect-khMxY6ZK.js","assets/design_system_ui-Uj2tSs7q.js","assets/react-dom/client-BVPiT_FE.js"])))=>i.map(i=>d[i]);
2
- import{j as V}from"./document_model_editor-D4xoIBZ3.js";import{b5 as W,b6 as z,b7 as E,b8 as y,b9 as j,a3 as H,aP as q}from"./reactor_browser-najzCy3f.js";import{_ as G}from"./drive_explorer-1ZrqokUe.js";import{p as N}from"./react-DQSxOgtG.js";import{r as k}from"./sentry_react-cODD7zWc.js";import{L as K}from"./design_system_connect-khMxY6ZK.js";import"./graphql-AKTCpY7l.js";import"./react/jsx-runtime-DldvXD6N.js";import"./document_model-Ce4lCkNT.js";import"./zod-9j67vCAu.js";import"./design_system-C3rLdIMt.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./document_drive-BckABlJR.js";import"./config-CU-aFfVJ.js";import"./sentry_browser-B4YoBIIG.js";import"./design_system_ui-Uj2tSs7q.js";import"./react-dom/client-BVPiT_FE.js";var O=class extends Error{constructor(t){super(`Exit with code ${t}`),this.code=t}},Q=class{appendFileSync(t,e,i={}){throw new Error("appendFileSync not implemented")}fsyncSync(t){throw new Error("fsyncSync not implemented")}linkSync(t,e){throw new Error("linkSync not implemented")}mkdirSync(t,e={}){throw new Error("mkdirSync not implemented")}readdirSync(t,e={}){throw new Error("readdirSync not implemented")}readFileSync(t,e={}){throw new Error("readFileSync not implemented")}readlinkSync(t,e={}){throw new Error("readlinkSync not implemented")}renameSync(t,e){throw new Error("renameSync not implemented")}rmdirSync(t,e={}){throw new Error("rmdirSync not implemented")}setFlagsSync(t,e){throw new Error("setFlagsSync not implemented")}statSync(t,e={}){throw new Error("statSync not implemented")}symlinkSync(t,e,i="file"){throw new Error("symlinkSync not implemented")}truncateSync(t,e=0){throw new Error("truncateSync not implemented")}unlinkSync(t){throw new Error("unlinkSync not implemented")}utimesSync(t,e,i){throw new Error("utimesSync not implemented")}writeFileSync(t,e,i={}){throw new Error("writeFileSync not implemented")}},Y=class{constructor(t={}){if(this.args=t.args||[],this.env=t.env||{},this.fs=t.fs||new Q,!this.fs)throw new Error("File system implementation required");this.fds=new Map([[0,{type:"stdio"}],[1,{type:"stdio"}],[2,{type:"stdio"}],[3,{type:"directory",preopenPath:"/"}]]),this.nextFd=this.fds.size,this.textDecoder=new TextDecoder,this.textEncoder=new TextEncoder,this.args_get=this.args_get.bind(this),this.args_sizes_get=this.args_sizes_get.bind(this),this.environ_get=this.environ_get.bind(this),this.environ_sizes_get=this.environ_sizes_get.bind(this),this.clock_res_get=this.clock_res_get.bind(this),this.clock_time_get=this.clock_time_get.bind(this),this.fd_close=this.fd_close.bind(this),this.fd_seek=this.fd_seek.bind(this),this.fd_write=this.fd_write.bind(this),this.fd_read=this.fd_read.bind(this),this.fd_fdstat_get=this.fd_fdstat_get.bind(this),this.fd_fdstat_set_flags=this.fd_fdstat_set_flags.bind(this),this.fd_prestat_get=this.fd_prestat_get.bind(this),this.fd_prestat_dir_name=this.fd_prestat_dir_name.bind(this),this.path_open=this.path_open.bind(this),this.path_filestat_get=this.path_filestat_get.bind(this),this.proc_exit=this.proc_exit.bind(this),this.fd_advise=this.fd_advise.bind(this),this.fd_allocate=this.fd_allocate.bind(this),this.fd_datasync=this.fd_datasync.bind(this),this.fd_filestat_get=this.fd_filestat_get.bind(this),this.fd_filestat_set_size=this.fd_filestat_set_size.bind(this),this.fd_filestat_set_times=this.fd_filestat_set_times.bind(this),this.fd_pread=this.fd_pread.bind(this),this.fd_pwrite=this.fd_pwrite.bind(this),this.fd_readdir=this.fd_readdir.bind(this),this.fd_renumber=this.fd_renumber.bind(this),this.fd_sync=this.fd_sync.bind(this),this.fd_tell=this.fd_tell.bind(this),this.path_create_directory=this.path_create_directory.bind(this),this.path_filestat_set_times=this.path_filestat_set_times.bind(this),this.path_link=this.path_link.bind(this),this.path_readlink=this.path_readlink.bind(this),this.path_remove_directory=this.path_remove_directory.bind(this),this.path_rename=this.path_rename.bind(this),this.path_symlink=this.path_symlink.bind(this),this.path_unlink_file=this.path_unlink_file.bind(this),this.poll_oneoff=this.poll_oneoff.bind(this),this.sock_accept=this.sock_accept.bind(this),this.sock_recv=this.sock_recv.bind(this),this.sock_send=this.sock_send.bind(this),this.sock_shutdown=this.sock_shutdown.bind(this),this.random_get=this.random_get.bind(this),this.sched_yield=this.sched_yield.bind(this)}setup(t){this.wasm=t}start(t){this.setup(t);try{return t._start&&t._start(),0}catch(e){if(e instanceof O)return e.code;throw e}}stdin(){return new Uint8Array}stdout(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.log(e)}stderr(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.error(e)}args_get(t,e){let i=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let r of this.args){i.setUint32(t,e,!0),t+=4;let n=this.textEncoder.encode(r);s.set(n,e),s[e+n.length]=0,e+=n.length+1}return 0}args_sizes_get(t,e){let i=new DataView(this.wasm.memory.buffer);i.setUint32(t,this.args.length,!0);let s=this.args.reduce((r,n)=>r+n.length+1,0);return i.setUint32(e,s,!0),0}environ_get(t,e){let i=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let[r,n]of Object.entries(this.env)){i.setUint32(t,e,!0),t+=4;let c=`${r}=${n}\0`,l=this.textEncoder.encode(c);s.set(l,e),e+=l.length}return 0}environ_sizes_get(t,e){let i=new DataView(this.wasm.memory.buffer),s=Object.keys(this.env).length;i.setUint32(t,s,!0);let r=Object.entries(this.env).reduce((n,[c,l])=>n+c.length+l.length+2,0);return i.setUint32(e,r,!0),0}clock_res_get(t,e){let i=new DataView(this.wasm.memory.buffer),s;switch(t){case 0:s=1000000n;break;case 1:s=1000n;break;default:return 28}return i.setBigUint64(e,s,!0),0}clock_time_get(t,e,i){let s=new DataView(this.wasm.memory.buffer),r;switch(t){case 0:{let n=Date.now();r=BigInt(n)*1000000n;break}case 1:{r=BigInt(Math.round(performance.now()*1e6));break}default:return 28}return s.setBigUint64(i,r,!0),0}fd_close(t){return this.fds.get(t)?(this.fds.delete(t),0):8}fd_seek(t,e,i,s){let r=this.fds.get(t);if(!r)return 8;if(r.type==="stdio")return 70;var n=null;let c=0,l=Number(e);try{n=this.fs.statSync(r.handle.path)}catch{return 29}switch(i){case 0:c=l;break;case 1:c=Number(r.handle.position)+l;break;case 2:c=Number(n.size)+l;break;default:return console.error("fd_seek invalid mode",i),28}return r.handle.position=c,new DataView(this.wasm.memory.buffer).setBigUint64(s,BigInt(c),!0),0}fd_write(t,e,i,s){let r=0,n=[],c=new DataView(this.wasm.memory.buffer),l=new Uint8Array(this.wasm.memory.buffer);for(let a=0;a<i;a++){let h=e+a*8,f=c.getUint32(h,!0),d=c.getUint32(h+4,!0);n.push(new Uint8Array(l.buffer,f,d)),r+=d}let o;if(n.length===1)o=n[0];else{o=new Uint8Array(r);let a=0;for(let h of n)o.set(h,a),a+=h.length}if(t===1)this.stdout(o);else if(t===2)this.stderr(o);else{let a=this.fds.get(t);if(!a)return 8;a.handle.position+=r;try{this.fs.writeFileSync(a.handle.path,o)}catch{return 29}}return c.setUint32(s,r,!0),0}fd_read(t,e,i,s){let r=this.fds.get(t);if(!r)return 8;let n=0,c=new DataView(this.wasm.memory.buffer),l=new Uint8Array(this.wasm.memory.buffer);try{let o;t===0?o=this.stdin():o=this.fs.readFileSync(r.handle.path);for(let a=0;a<i;a++){let h=e+a*8,f=c.getUint32(h,!0),d=c.getUint32(h+4,!0),u=r.handle.position,m=Math.min(u+d,o.length),p=m-u;if(p<=0||(l.set(new Uint8Array(o.slice(u,m)),f),n+=p,r.handle.position+=p,p<d))break}return c.setUint32(s,n,!0),0}catch{return 29}}path_open(t,e,i,s,r,n,c,l,o){var a=this.fds.get(t);if(!a)return 8;let h=new Uint8Array(this.wasm.memory.buffer).slice(i,i+s),f=this.textDecoder.decode(h),d=f;var u=0;let m=new DataView(this.wasm.memory.buffer);a.preopenPath&&(f.startsWith("/")&&(d=f.slice(1)),d=a.preopenPath+(a.preopenPath.endsWith("/")?"":"/")+d);var p=!1,_=null;let w=(r&4)==4,A=(r&8)==8;try{_=this.fs.statSync(d),p=!0}catch{}if((w||A)&&w&&p)return m.setUint32(o,u,!0),20;let $={path:d,position:0},I="file";u=this.nextFd++;let R={type:I,handle:$,fd:u};return this.fds.set(u,R),a=this.fds.get(u),a.handle.position=0,A&&(a.handle.size=0),m.setUint32(o,u,!0),0}proc_exit(t){throw new O(t)}fd_fdstat_get(t,e){let i=this.fds.get(t);if(!i)return 8;let s=new DataView(this.wasm.memory.buffer),r;switch(i.type){case"stdio":r=2;break;case"directory":r=3;break;case"file":r=4;break;default:r=0}s.setUint8(e,r);let n=0;i.append&&(n|=1),s.setUint16(e+2,n,!0);let c=0n;i.type==="file"?c=2097254:i.type==="directory"&&(c=100688384);let l=BigInt(c);return s.setBigUint64(e+8,l,!0),s.setBigUint64(e+16,l,!0),0}fd_fdstat_set_flags(t,e){let i=this.fds.get(t);if(!i)return 8;if(e&-32)return 28;if(i.type==="stdio")return 58;try{return i.append=!!(e&1),i.handle&&typeof this.fs.setFlagsSync=="function"&&this.fs.setFlagsSync(i.handle,e),0}catch{return 29}}fd_prestat_get(t,e){let i=this.fds.get(t);if(!i||i.type!=="directory"||!i.preopenPath)return 8;let s=new DataView(this.wasm.memory.buffer);s.setUint8(e,0);let r=i.preopenPath.length;return s.setUint32(e+4,r,!0),0}fd_prestat_dir_name(t,e,i){let s=this.fds.get(t);if(!s||s.type!=="directory"||!s.preopenPath)return 8;if(i<s.preopenPath.length)return 37;let r=new Uint8Array(this.wasm.memory.buffer),n=this.textEncoder.encode(s.preopenPath);return r.set(n,e),0}path_filestat_get(t,e,i,s,r){let n=this.fds.get(t);if(!n)return 8;let c=new Uint8Array(this.wasm.memory.buffer),l=new Uint8Array(c.buffer,i,s),o=this.textDecoder.decode(l);try{let a=o;n.preopenPath&&(o.startsWith("/")&&(a=o.slice(1)),a=n.preopenPath+(n.preopenPath.endsWith("/")?"":"/")+a);let h=this.fs.statSync(a,{followSymlinks:(e&void 0)!==0}),f=new DataView(this.wasm.memory.buffer);f.setBigUint64(r,BigInt(h.dev||0),!0),f.setBigUint64(r+8,BigInt(h.ino||0),!0);let d=0;return h.isFile()?d=4:h.isDirectory()?d=3:h.isSymbolicLink()?d=7:h.isCharacterDevice()?d=2:h.isBlockDevice()?d=1:h.isFIFO()&&(d=6),f.setUint8(r+16,d),f.setBigUint64(r+24,BigInt(h.nlink||1),!0),f.setBigUint64(r+32,BigInt(h.size||0),!0),f.setBigUint64(r+40,BigInt(h.atimeMs*1e6),!0),f.setBigUint64(r+48,BigInt(h.mtimeMs*1e6),!0),f.setBigUint64(r+56,BigInt(h.ctimeMs*1e6),!0),0}catch(a){return a.code==="ENOENT"?44:a.code==="EACCES"?2:29}}fd_advise(t,e,i,s){let r=this.fds.get(t);return r?r.type!=="file"?8:0:8}fd_allocate(t,e,i){let s=this.fds.get(t);if(!s||s.type!=="file")return 8;try{let r=this.fs.statSync(s.handle.path),n=Number(e)+Number(i);if(n>r.size){let c=new Uint8Array(n-r.size);this.fs.appendFileSync(s.handle.path,c)}return 0}catch{return 29}}fd_datasync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_filestat_get(t,e){let i=this.fds.get(t);if(!i||!i.handle)return 8;let s=new DataView(this.wasm.memory.buffer),r=this.fs.statSync(i.handle.path);return s.setBigUint64(e,BigInt(r.dev),!0),s.setBigUint64(e+8,BigInt(r.ino),!0),s.setUint8(e+16,r.filetype),s.setBigUint64(e+24,BigInt(r.nlink),!0),s.setBigUint64(e+32,BigInt(r.size),!0),s.setBigUint64(e+38,BigInt(r.atime),!0),s.setBigUint64(e+46,BigInt(r.mtime),!0),s.setBigUint64(e+52,BigInt(r.ctime),!0),0}fd_filestat_set_size(t,e){let i=this.fds.get(t);if(!i||i.type!=="file")return 8;try{return this.fs.truncateSync(i.handle.path,Number(e)),0}catch{return 29}}fd_filestat_set_times(t,e,i,s){let r=this.fds.get(t);if(!r||r.type!=="file")return 8;try{let n={atime:Number(e)/1e9,mtime:Number(i)/1e9};return this.fs.utimesSync(r.handle.path,n.atime,n.mtime),0}catch{return 29}}fd_pread(t,e,i,s,r){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let c=this.fs.readFileSync(n.handle.path),l=0,o=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer),h=Number(s);for(let f=0;f<i;f++){let d=e+f*8,u=o.getUint32(d,!0),m=o.getUint32(d+4,!0),p=h+l,_=Math.min(p+m,c.length),w=_-p;if(w<=0||(a.set(new Uint8Array(c.slice(p,_)),u),l+=w,w<m))break}return o.setUint32(r,l,!0),0}catch{return 29}}fd_pwrite(t,e,i,s,r){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let c=0,l=[],o=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer);for(let u=0;u<i;u++){let m=e+u*8,p=o.getUint32(m,!0),_=o.getUint32(m+4,!0);l.push(new Uint8Array(a.buffer,p,_)),c+=_}let h;if(l.length===1)h=l[0];else{h=new Uint8Array(c);let u=0;for(let m of l)h.set(m,u),u+=m.length}let f=this.fs.readFileSync(n.handle.path),d=new Uint8Array(Math.max(Number(s)+h.length,f.length));return d.set(f),d.set(h,Number(s)),this.fs.writeFileSync(n.handle.path,d),o.setUint32(r,c,!0),0}catch{return 29}}fd_readdir(t,e,i,s,r){let n=this.fds.get(t);if(!n)return 8;if(n.type!=="directory")return 54;try{let c=this.fs.readdirSync(n.handle.path,{withFileTypes:!0}),l=new DataView(this.wasm.memory.buffer),o=new Uint8Array(this.wasm.memory.buffer),a=0,h=0,f=Number(s);for(let d=f;d<c.length;d++){let u=c[d],m=u.name,p=this.textEncoder.encode(m),_=24+p.length;if(a+_>i)break;l.setBigUint64(e+a,BigInt(d+1),!0),l.setBigUint64(e+a+8,0n,!0),l.setUint32(e+a+16,p.length,!0);let w=0;u.isFile()?w=4:u.isDirectory()&&(w=3),l.setUint8(e+a+20,w),o.set(p,e+a+24),a+=_,h++}return l.setUint32(r,a,!0),0}catch{return 29}}fd_renumber(t,e){let i=this.fds.get(t);return i?(this.fds.delete(e),this.fds.set(e,i),this.fds.delete(t),0):8}fd_sync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_tell(t,e){let i=this.fds.get(t);return i?i.type!=="file"?8:(new DataView(this.wasm.memory.buffer).setBigUint64(e,BigInt(i.handle.position),!0),0):8}path_create_directory(t,e,i){let s=this.fds.get(t);if(!s)return 8;let r=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,i));try{let n=r;return s.preopenPath&&(r.startsWith("/")&&(n=r.slice(1)),n=s.preopenPath+"/"+n),this.fs.mkdirSync(n),0}catch{return 29}}path_filestat_set_times(t,e,i,s,r,n,c){let l=this.fds.get(t);if(!l)return 8;let o=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,i,s));try{let a=o;l.preopenPath&&(o.startsWith("/")&&(a=o.slice(1)),a=l.preopenPath+"/"+a);let h={atime:Number(r)/1e9,mtime:Number(n)/1e9};return this.fs.utimesSync(a,h.atime,h.mtime),0}catch{return 29}}path_link(t,e,i,s,r,n,c){let l=this.fds.get(t),o=this.fds.get(r);if(!l||!o)return 8;let a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,i,s)),h=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,n,c));try{let f=a,d=h;return l.preopenPath&&(a.startsWith("/")&&(f=a.slice(1)),f=l.preopenPath+"/"+f),o.preopenPath&&(h.startsWith("/")&&(d=h.slice(1)),d=o.preopenPath+"/"+d),this.fs.linkSync(f,d),0}catch{return 29}}path_readlink(t,e,i,s,r,n){let c=this.fds.get(t);if(!c)return 8;let l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,i));try{let o=l;c.preopenPath&&(l.startsWith("/")&&(o=l.slice(1)),o=c.preopenPath+"/"+o);let a=this.fs.readlinkSync(o),h=this.textEncoder.encode(a);return h.length>r?61:(new Uint8Array(this.wasm.memory.buffer).set(h,s),new DataView(this.wasm.memory.buffer).setUint32(n,h.length,!0),0)}catch{return 29}}path_remove_directory(t,e,i){let s=this.fds.get(t);if(!s)return 8;let r=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,i));try{let n=r;return s.preopenPath&&(r.startsWith("/")&&(n=r.slice(1)),n=s.preopenPath+"/"+n),this.fs.rmdirSync(n),0}catch{return 29}}path_rename(t,e,i,s,r,n){let c=this.fds.get(t),l=this.fds.get(s);if(!c||!l)return 8;let o=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,i)),a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,r,n));try{let h=o,f=a;return c.preopenPath&&(o.startsWith("/")&&(h=o.slice(1)),h=c.preopenPath+"/"+h),l.preopenPath&&(a.startsWith("/")&&(f=a.slice(1)),f=l.preopenPath+"/"+f),this.fs.renameSync(h,f),0}catch{return 29}}path_symlink(t,e,i,s,r){let n=this.fds.get(i);if(!n)return 8;let c=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,t,e)),l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,s,r));try{let o=l;return n.preopenPath&&(l.startsWith("/")&&(o=l.slice(1)),o=n.preopenPath+"/"+o),this.fs.symlinkSync(c,o),0}catch{return 29}}path_unlink_file(t,e,i){let s=this.fds.get(t);if(!s)return 8;let r=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,i));try{let n=r;return s.preopenPath&&(r.startsWith("/")&&(n=r.slice(1)),n=s.preopenPath+"/"+n),this.fs.unlinkSync(n),0}catch{return 29}}poll_oneoff(t,e,i,s){let r=new DataView(this.wasm.memory.buffer),n=0;for(let c=0;c<i;c++){let l=t+c*48,o=r.getBigUint64(l,!0),a=r.getUint8(l+8),h=e+n*32;r.setBigUint64(h,o,!0),r.setUint8(h+8,a),r.setUint8(h+9,1),r.setUint16(h+10,0,!0),n++}return r.setUint32(s,n,!0),0}random_get(t,e){let i=new Uint8Array(this.wasm.memory.buffer,t,e);return crypto.getRandomValues(i),0}sched_yield(){return os.sched_yield(),0}sock_accept(t,e){return 52}sock_recv(t,e,i){return 52}sock_send(t,e,i){return 52}sock_shutdown(t,e){return 52}};console.log("easywasi");var Z=typeof N=="object"&&typeof N.versions=="object"&&typeof N.versions.node=="string";function J(t,e){return{...t,...Object.fromEntries(["appendFileSync","fsyncSync","linkSync","setFlagsSync","mkdirSync","readdirSync","readFileSync","readlinkSync","renameSync","rmdirSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","writeFileSync"].map(i=>{let s=i.slice(0,i.length-4);return s in t?[i,(...r)=>(i==="writeFileSync"&&r[0]==="/tmp/out.sql"&&e.push(r[1]),t[s](...r))]:[i,()=>{throw new Error(`${s} not implemented.`)}]}).filter(i=>i!==void 0))}}async function X({pg:t,args:e}){let i=new URL("/assets/pg_dump-CW0pN9tG.wasm",import.meta.url),s=[],r=J(t.Module.FS,s),n=new Y({fs:r,args:["pg_dump",...e],env:{PWD:"/"}});n.stdout=h=>{};let c=new TextDecoder,l="";n.stderr=h=>{let f=c.decode(h);f&&(l+=f)},n.sched_yield=()=>{let h="/tmp/pglite/base/.s.PGSQL.5432.in",f="/tmp/pglite/base/.s.PGSQL.5432.out";if(r.analyzePath(h).exists){let d=r.readFileSync(h);if(r.unlinkSync(h),d[0]===0){let m=new Uint8Array([...et,...st,...rt]);return r.writeFileSync(f,m),0}let u=t.execProtocolRawSync(d);r.writeFileSync(f,u)}return 0},await r.writeFile("/pg_dump","\0",{mode:18});let o;if(Z){let h=await(await G(async()=>{const{readFile:f}=await import("./reactor_browser-najzCy3f.js").then(d=>d.bk);return{readFile:f}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).readFile(i.toString().slice(7));o=await WebAssembly.instantiate(h,{wasi_snapshot_preview1:n})}else o=await WebAssembly.instantiateStreaming(fetch(i),{wasi_snapshot_preview1:n});let a;return await t.runExclusive(async()=>{a=n.start(o.instance.exports)}),[a,s,l]}async function tt({pg:t,args:e,fileName:i="dump.sql"}){let s=(await t.query("SHOW SEARCH_PATH;")).rows[0].search_path,r="/tmp/out.sql",n=["-U","postgres","--inserts","-j","1","-f",r,"postgres"],[c,l,o]=await X({pg:t,args:[...e??[],...n]});if(t.exec(`DEALLOCATE ALL; SET SEARCH_PATH = ${s}`),c!==0)throw new Error(`pg_dump failed with exit code ${c}.
3
- Error message: ${o}`);let a=new File(l,i,{type:"text/plain"});return t.Module.FS.unlink(r),a}function B(t){return t.charCodeAt(0)}function F(t){let e=new ArrayBuffer(4);return new DataView(e).setInt32(0,t,!1),new Uint8Array(e)}function T(t){let e=new TextEncoder().encode(t);return new Uint8Array([...e,0])}var et=new Uint8Array([B("R"),...F(8),...F(0)]),rt=new Uint8Array([B("Z"),...F(5),B("I")]),C=T("server_version"),M=T("16.3 (PGlite 0.2.0)"),it=4+C.length+M.length,st=new Uint8Array([B("S"),...F(it),...C,...M]);const v=["documentType","documentId","scope","branch","index","skip"];function nt(){const t=W(),e=z(),i=k.useCallback(async()=>{if(!t)return[];const l=await y`
4
- SELECT
5
- c.table_name,
6
- c.column_name,
7
- c.data_type,
8
- c.is_nullable
9
- FROM information_schema.columns c
10
- INNER JOIN information_schema.tables t
11
- ON c.table_name = t.table_name
12
- AND c.table_schema = t.table_schema
13
- WHERE c.table_schema = ${E}
14
- AND t.table_type = 'BASE TABLE'
15
- ORDER BY c.table_name, c.ordinal_position
16
- `.execute(t),o=new Map;for(const a of l.rows)o.has(a.table_name)||o.set(a.table_name,[]),o.get(a.table_name).push({name:a.column_name,dataType:a.data_type,isNullable:a.is_nullable==="YES"});return Array.from(o).map(([a,h])=>{const f=h.map(u=>u.name),d=[...v.filter(u=>f.includes(u)).map(u=>h.find(m=>m.name===u)),...h.filter(u=>!v.includes(u.name))];return{name:a,columns:d}})},[t]),s=k.useCallback(async(l,o)=>{if(!t)return{columns:[],rows:[],total:null};const a=o.limit,h=o.offset,f=o.sort,d=o.filters,u=y.raw(`${E}."${l}"`);let m=y``;if(d?.clauses&&d.clauses.length>0){const g=[];for(let S=0;S<d.clauses.length;S++){const b=d.clauses[S];if(!b)continue;const P=y.raw(`"${b.column}"`);let D;if(b.operator==="IS NULL")D=y`${P} IS NULL`;else if(b.operator==="IS NOT NULL")D=y`${P} IS NOT NULL`;else if(b.operator==="LIKE"||b.operator==="ILIKE"){const x=b.value,U=b.operator==="LIKE"?y`LIKE`:y`ILIKE`;D=y`${P} ${U} ${x}`}else{const x=y.raw(b.operator),U=b.value;let L=U;U!==""&&!isNaN(Number(U))&&U.trim()!==""&&(L=Number(U)),D=y`${P} ${x} ${L}`}if(g.push(D),S<d.clauses.length-1){const x=d.connectors?.[S]??"AND";g.push(y.raw(x))}}g.length>0&&(m=y`WHERE ${y.join(g,y` `)}`)}let p;if(f){const g=y.raw(`"${f.column}"`),S=f.direction==="desc"?y`DESC`:y`ASC`;p=y`
17
- SELECT * FROM ${u}
18
- ${m}
19
- ORDER BY ${g} ${S}
20
- LIMIT ${a} OFFSET ${h}
21
- `}else p=y`
22
- SELECT * FROM ${u}
23
- ${m}
24
- LIMIT ${a} OFFSET ${h}
25
- `;const _=await p.execute(t),A=await y`
26
- SELECT COUNT(*) as count FROM ${u}
27
- ${m}
28
- `.execute(t),$=A.rows[0]?parseInt(A.rows[0].count,10):null,I=_.rows.length>0?Object.keys(_.rows[0]):[];return{columns:[...v.filter(g=>I.includes(g)),...I.filter(g=>!v.includes(g))],rows:_.rows,total:$}},[t]),r=k.useCallback(async()=>{if(!e)return;const o=await(await tt({pg:e})).text(),a=new Blob([o],{type:"text/sql"}),h=URL.createObjectURL(a),f=document.createElement("a");f.href=h,f.download=`database-export-${Date.now()}.sql`,f.click(),URL.revokeObjectURL(h)},[e]),n=k.useCallback(async l=>{e&&await e.transaction(async o=>{await o.exec(`DROP SCHEMA ${E} CASCADE`),await o.exec(`CREATE SCHEMA ${E}`),await o.exec(l),await o.exec(`SET search_path TO ${E}`)})},[e]),c=k.useCallback(l=>{if(l==="Operation")return{column:"timestampUtcMs",direction:"desc"}},[]);return{getTables:i,getTableRows:s,getDefaultSort:c,onExportDb:r,onImportDb:n}}function at(){const t=j();return{getRemotes:k.useCallback(()=>Promise.resolve(t?.list()??[]),[t])}}const ot=25,Dt=()=>{const e=H()?.type==="inspector",{getTables:i,getTableRows:s,getDefaultSort:r,onExportDb:n,onImportDb:c}=nt(),{getRemotes:l}=at();return V.jsx(K,{open:e,onOpenChange:o=>{o||q()},dbExplorerProps:{schema:E,getTables:i,getTableRows:s,getDefaultSort:r,pageSize:ot,onExportDb:n,onImportDb:c},remotesInspectorProps:{getRemotes:l}})};export{Dt as InspectorModal};