better-auth-studio 1.0.79-beta.21 → 1.0.79-beta.23

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.
@@ -73,7 +73,7 @@ Error generating stack: `+n.message+`
73
73
  * LICENSE.md file in the root directory of this source tree.
74
74
  *
75
75
  * @license MIT
76
- */function fN(){return fN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fN.apply(this,arguments)}function O$(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function D$(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function I$(e,t){return e.button===0&&(!t||t==="_self")&&!D$(e)}function pN(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function M$(e,t){let n=pN(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}const L$=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],U$="6";try{window.__reactRouterVersion=U$}catch{}const P$="startTransition",wj=_p[P$];function F$(e){let{basename:t,children:n,future:r,window:s}=e,i=p.useRef();i.current==null&&(i.current=Bz({window:s,v5Compat:!0}));let o=i.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},h=p.useCallback(d=>{u&&wj?wj(()=>c(d)):c(d)},[c,u]);return p.useLayoutEffect(()=>o.listen(h),[o,h]),p.useEffect(()=>A$(r),[r]),p.createElement(R$,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const B$=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",z$=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tp=p.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:h,viewTransition:d}=t,f=O$(t,L$),{basename:m}=p.useContext(Ji),y,b=!1;if(typeof u=="string"&&z$.test(u)&&(y=u,B$))try{let g=new URL(window.location.href),N=u.startsWith("//")?new URL(g.protocol+u):new URL(u),S=nS(N.pathname,m);N.origin===g.origin&&S!=null?u=S+N.search+N.hash:b=!0}catch{}let w=p$(u,{relative:s}),x=$$(u,{replace:o,state:l,target:c,preventScrollReset:h,relative:s,viewTransition:d});function v(g){r&&r(g),g.defaultPrevented||x(g)}return p.createElement("a",fN({},f,{href:y||w,onClick:b||i?r:v,ref:n,target:c}))});var Nj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Nj||(Nj={}));var Sj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Sj||(Sj={}));function $$(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=ha(),u=eo(),h=gM(e,{relative:o});return p.useCallback(d=>{if(I$(d,n)){d.preventDefault();let f=r!==void 0?r:ep(u)===ep(h);c(e,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,h,r,s,n,e,i,o,l])}function yM(e){let t=p.useRef(pN(e)),n=p.useRef(!1),r=eo(),s=p.useMemo(()=>M$(r.search,n.current?null:t.current),[r.search]),i=ha(),o=p.useCallback((l,c)=>{const u=pN(typeof l=="function"?l(s):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}function H$(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const q$=e=>{switch(e){case"success":return Y$;case"info":return X$;case"warning":return W$;case"error":return K$;default:return null}},G$=Array(12).fill(0),V$=({visible:e,className:t})=>ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ee.createElement("div",{className:"sonner-spinner"},G$.map((n,r)=>ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Y$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),W$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),X$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),K$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Z$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Q$=()=>{const[e,t]=ee.useState(document.hidden);return ee.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let mN=1;class J${constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:mN++,o=this.toasts.find(c=>c.id===i),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:r}),{...c,...t,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,o;const l=s.then(async u=>{if(o=["resolve",u],ee.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(t8(u)&&!u.ok){i=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...y})}else if(u instanceof Error){i=!1;const d=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...y})}else if(n.success!==void 0){i=!1;const d=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:f,...y})}}).catch(async u=>{if(o=["reject",u],n.error!==void 0){i=!1;const h=typeof n.error=="function"?await n.error(u):n.error,d=typeof n.description=="function"?await n.description(u):n.description,m=typeof h=="object"&&!ee.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:d,...m})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,h)=>l.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||mN++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const oa=new J$,e8=(e,t)=>{const n=(t==null?void 0:t.id)||mN++;return oa.addToast({title:e,...t,id:n}),n},t8=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",n8=e8,a8=()=>oa.toasts,r8=()=>oa.getActiveToasts(),V=Object.assign(n8,{success:oa.success,info:oa.info,warning:oa.warning,error:oa.error,custom:oa.custom,message:oa.message,promise:oa.promise,dismiss:oa.dismiss,loading:oa.loading},{getHistory:a8,getToasts:r8});H$("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Th(e){return e.label!==void 0}const s8=3,i8="24px",o8="16px",Ej=4e3,l8=356,c8=14,d8=45,u8=200;function Rr(...e){return e.filter(Boolean).join(" ")}function h8(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const f8=e=>{var t,n,r,s,i,o,l,c,u;const{invert:h,toast:d,unstyled:f,interacting:m,setHeights:y,visibleToasts:b,heights:w,index:x,toasts:v,expanded:g,removeToast:N,defaultRichColors:S,closeButton:E,style:j,cancelButtonStyle:R,actionButtonStyle:L,className:P="",descriptionClassName:U="",duration:F,position:G,gap:_,expandByDefault:I,classNames:A,icons:C,closeButtonAriaLabel:T="Close toast"}=e,[O,q]=ee.useState(null),[k,M]=ee.useState(null),[$,W]=ee.useState(!1),[Y,te]=ee.useState(!1),[ne,X]=ee.useState(!1),[se,Ee]=ee.useState(!1),[re,xe]=ee.useState(!1),[ye,ze]=ee.useState(0),[He,Fe]=ee.useState(0),Ye=ee.useRef(d.duration||F||Ej),ft=ee.useRef(null),et=ee.useRef(null),de=x===0,Be=x+1<=b,Ue=d.type,Oe=d.dismissible!==!1,We=d.className||"",nt=d.descriptionClassName||"",lt=ee.useMemo(()=>w.findIndex(he=>he.toastId===d.id)||0,[w,d.id]),Ut=ee.useMemo(()=>{var he;return(he=d.closeButton)!=null?he:E},[d.closeButton,E]),Kt=ee.useMemo(()=>d.duration||F||Ej,[d.duration,F]),Gt=ee.useRef(0),_t=ee.useRef(0),ce=ee.useRef(0),Te=ee.useRef(null),[Ze,Q]=G.split("-"),pe=ee.useMemo(()=>w.reduce((he,Z,oe)=>oe>=lt?he:he+Z.height,0),[w,lt]),be=Q$(),_e=d.invert||h,$e=Ue==="loading";_t.current=ee.useMemo(()=>lt*_+pe,[lt,pe]),ee.useEffect(()=>{Ye.current=Kt},[Kt]),ee.useEffect(()=>{W(!0)},[]),ee.useEffect(()=>{const he=et.current;if(he){const Z=he.getBoundingClientRect().height;return Fe(Z),y(oe=>[{toastId:d.id,height:Z,position:d.position},...oe]),()=>y(oe=>oe.filter(De=>De.toastId!==d.id))}},[y,d.id]),ee.useLayoutEffect(()=>{if(!$)return;const he=et.current,Z=he.style.height;he.style.height="auto";const oe=he.getBoundingClientRect().height;he.style.height=Z,Fe(oe),y(De=>De.find(tt=>tt.toastId===d.id)?De.map(tt=>tt.toastId===d.id?{...tt,height:oe}:tt):[{toastId:d.id,height:oe,position:d.position},...De])},[$,d.title,d.description,y,d.id,d.jsx,d.action,d.cancel]);const je=ee.useCallback(()=>{te(!0),ze(_t.current),y(he=>he.filter(Z=>Z.toastId!==d.id)),setTimeout(()=>{N(d)},u8)},[d,N,y,_t]);ee.useEffect(()=>{if(d.promise&&Ue==="loading"||d.duration===1/0||d.type==="loading")return;let he;return g||m||be?(()=>{if(ce.current<Gt.current){const De=new Date().getTime()-Gt.current;Ye.current=Ye.current-De}ce.current=new Date().getTime()})():(()=>{Ye.current!==1/0&&(Gt.current=new Date().getTime(),he=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),je()},Ye.current))})(),()=>clearTimeout(he)},[g,m,d,Ue,be,je]),ee.useEffect(()=>{d.delete&&(je(),d.onDismiss==null||d.onDismiss.call(d,d))},[je,d.delete]);function K(){var he;if(C!=null&&C.loading){var Z;return ee.createElement("div",{className:Rr(A==null?void 0:A.loader,d==null||(Z=d.classNames)==null?void 0:Z.loader,"sonner-loader"),"data-visible":Ue==="loading"},C.loading)}return ee.createElement(V$,{className:Rr(A==null?void 0:A.loader,d==null||(he=d.classNames)==null?void 0:he.loader),visible:Ue==="loading"})}const ue=d.icon||(C==null?void 0:C[Ue])||q$(Ue);var Ae,Le;return ee.createElement("li",{tabIndex:0,ref:et,className:Rr(P,We,A==null?void 0:A.toast,d==null||(t=d.classNames)==null?void 0:t.toast,A==null?void 0:A.default,A==null?void 0:A[Ue],d==null||(n=d.classNames)==null?void 0:n[Ue]),"data-sonner-toast":"","data-rich-colors":(Ae=d.richColors)!=null?Ae:S,"data-styled":!(d.jsx||d.unstyled||f),"data-mounted":$,"data-promise":!!d.promise,"data-swiped":re,"data-removed":Y,"data-visible":Be,"data-y-position":Ze,"data-x-position":Q,"data-index":x,"data-front":de,"data-swiping":ne,"data-dismissible":Oe,"data-type":Ue,"data-invert":_e,"data-swipe-out":se,"data-swipe-direction":k,"data-expanded":!!(g||I&&$),"data-testid":d.testId,style:{"--index":x,"--toasts-before":x,"--z-index":v.length-x,"--offset":`${Y?ye:_t.current}px`,"--initial-height":I?"auto":`${He}px`,...j,...d.style},onDragEnd:()=>{X(!1),q(null),Te.current=null},onPointerDown:he=>{he.button!==2&&($e||!Oe||(ft.current=new Date,ze(_t.current),he.target.setPointerCapture(he.pointerId),he.target.tagName!=="BUTTON"&&(X(!0),Te.current={x:he.clientX,y:he.clientY})))},onPointerUp:()=>{var he,Z,oe;if(se||!Oe)return;Te.current=null;const De=Number(((he=et.current)==null?void 0:he.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),it=Number(((Z=et.current)==null?void 0:Z.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),tt=new Date().getTime()-((oe=ft.current)==null?void 0:oe.getTime()),at=O==="x"?De:it,It=Math.abs(at)/tt;if(Math.abs(at)>=d8||It>.11){ze(_t.current),d.onDismiss==null||d.onDismiss.call(d,d),M(O==="x"?De>0?"right":"left":it>0?"down":"up"),je(),Ee(!0);return}else{var wn,sn;(wn=et.current)==null||wn.style.setProperty("--swipe-amount-x","0px"),(sn=et.current)==null||sn.style.setProperty("--swipe-amount-y","0px")}xe(!1),X(!1),q(null)},onPointerMove:he=>{var Z,oe,De;if(!Te.current||!Oe||((Z=window.getSelection())==null?void 0:Z.toString().length)>0)return;const tt=he.clientY-Te.current.y,at=he.clientX-Te.current.x;var It;const wn=(It=e.swipeDirections)!=null?It:h8(G);!O&&(Math.abs(at)>1||Math.abs(tt)>1)&&q(Math.abs(at)>Math.abs(tt)?"x":"y");let sn={x:0,y:0};const ns=In=>1/(1.5+Math.abs(In)/20);if(O==="y"){if(wn.includes("top")||wn.includes("bottom"))if(wn.includes("top")&&tt<0||wn.includes("bottom")&&tt>0)sn.y=tt;else{const In=tt*ns(tt);sn.y=Math.abs(In)<Math.abs(tt)?In:tt}}else if(O==="x"&&(wn.includes("left")||wn.includes("right")))if(wn.includes("left")&&at<0||wn.includes("right")&&at>0)sn.x=at;else{const In=at*ns(at);sn.x=Math.abs(In)<Math.abs(at)?In:at}(Math.abs(sn.x)>0||Math.abs(sn.y)>0)&&xe(!0),(oe=et.current)==null||oe.style.setProperty("--swipe-amount-x",`${sn.x}px`),(De=et.current)==null||De.style.setProperty("--swipe-amount-y",`${sn.y}px`)}},Ut&&!d.jsx&&Ue!=="loading"?ee.createElement("button",{"aria-label":T,"data-disabled":$e,"data-close-button":!0,onClick:$e||!Oe?()=>{}:()=>{je(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Rr(A==null?void 0:A.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Le=C==null?void 0:C.close)!=null?Le:Z$):null,(Ue||d.icon||d.promise)&&d.icon!==null&&((C==null?void 0:C[Ue])!==null||d.icon)?ee.createElement("div",{"data-icon":"",className:Rr(A==null?void 0:A.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||K():null,d.type!=="loading"?ue:null):null,ee.createElement("div",{"data-content":"",className:Rr(A==null?void 0:A.content,d==null||(i=d.classNames)==null?void 0:i.content)},ee.createElement("div",{"data-title":"",className:Rr(A==null?void 0:A.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?ee.createElement("div",{"data-description":"",className:Rr(U,nt,A==null?void 0:A.description,d==null||(l=d.classNames)==null?void 0:l.description)},typeof d.description=="function"?d.description():d.description):null),ee.isValidElement(d.cancel)?d.cancel:d.cancel&&Th(d.cancel)?ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||R,onClick:he=>{Th(d.cancel)&&Oe&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,he),je())},className:Rr(A==null?void 0:A.cancelButton,d==null||(c=d.classNames)==null?void 0:c.cancelButton)},d.cancel.label):null,ee.isValidElement(d.action)?d.action:d.action&&Th(d.action)?ee.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||L,onClick:he=>{Th(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,he),!he.defaultPrevented&&je())},className:Rr(A==null?void 0:A.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function jj(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function p8(e,t){const n={};return[e,t].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",l=i?o8:i8;function c(u){["top","right","bottom","left"].forEach(h=>{n[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}const m8=ee.forwardRef(function(t,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:h,mobileOffset:d,theme:f="light",richColors:m,duration:y,style:b,visibleToasts:w=s8,toastOptions:x,dir:v=jj(),gap:g=c8,icons:N,containerAriaLabel:S="Notifications"}=t,[E,j]=ee.useState([]),R=ee.useMemo(()=>r?E.filter($=>$.toasterId===r):E.filter($=>!$.toasterId),[E,r]),L=ee.useMemo(()=>Array.from(new Set([i].concat(R.filter($=>$.position).map($=>$.position)))),[R,i]),[P,U]=ee.useState([]),[F,G]=ee.useState(!1),[_,I]=ee.useState(!1),[A,C]=ee.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=ee.useRef(null),O=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=ee.useRef(null),k=ee.useRef(!1),M=ee.useCallback($=>{j(W=>{var Y;return(Y=W.find(te=>te.id===$.id))!=null&&Y.delete||oa.dismiss($.id),W.filter(({id:te})=>te!==$.id)})},[]);return ee.useEffect(()=>oa.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{j(W=>W.map(Y=>Y.id===$.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{A4.flushSync(()=>{j(W=>{const Y=W.findIndex(te=>te.id===$.id);return Y!==-1?[...W.slice(0,Y),{...W[Y],...$},...W.slice(Y+1)]:[$,...W]})})})}),[E]),ee.useEffect(()=>{if(f!=="system"){C(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?C("dark"):C("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:W})=>{C(W?"dark":"light")})}catch{$.addListener(({matches:Y})=>{try{C(Y?"dark":"light")}catch(te){console.error(te)}})}},[f]),ee.useEffect(()=>{E.length<=1&&G(!1)},[E]),ee.useEffect(()=>{const $=W=>{var Y;if(o.every(X=>W[X]||W.code===X)){var ne;G(!0),(ne=T.current)==null||ne.focus()}W.code==="Escape"&&(document.activeElement===T.current||(Y=T.current)!=null&&Y.contains(document.activeElement))&&G(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[o]),ee.useEffect(()=>{if(T.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,k.current=!1)}},[T.current]),ee.createElement("section",{ref:n,"aria-label":`${S} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map(($,W)=>{var Y;const[te,ne]=$.split("-");return R.length?ee.createElement("ol",{key:$,dir:v==="auto"?jj():v,tabIndex:-1,ref:T,className:u,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":te,"data-x-position":ne,style:{"--front-toast-height":`${((Y=P[0])==null?void 0:Y.height)||0}px`,"--width":`${l8}px`,"--gap":`${g}px`,...b,...p8(h,d)},onBlur:X=>{k.current&&!X.currentTarget.contains(X.relatedTarget)&&(k.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||k.current||(k.current=!0,q.current=X.relatedTarget)},onMouseEnter:()=>G(!0),onMouseMove:()=>G(!0),onMouseLeave:()=>{_||G(!1)},onDragEnd:()=>G(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},R.filter(X=>!X.position&&W===0||X.position===$).map((X,se)=>{var Ee,re;return ee.createElement(f8,{key:X.id,icons:N,index:se,toast:X,defaultRichColors:m,duration:(Ee=x==null?void 0:x.duration)!=null?Ee:y,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:s,visibleToasts:w,closeButton:(re=x==null?void 0:x.closeButton)!=null?re:c,interacting:_,position:$,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,closeButtonAriaLabel:x==null?void 0:x.closeButtonAriaLabel,removeToast:M,toasts:R.filter(xe=>xe.position==X.position),heights:P.filter(xe=>xe.position==X.position),setHeights:U,expandByDefault:l,gap:g,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function yn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=yn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var g8={value:()=>{}};function Kp(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new df(n)}function df(e){this._=e}function x8(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}df.prototype=Kp.prototype={constructor:df,on:function(e,t){var n=this._,r=x8(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=b8(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=Tj(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Tj(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new df(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function b8(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function Tj(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=g8,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gN="http://www.w3.org/1999/xhtml";const Cj={svg:"http://www.w3.org/2000/svg",xhtml:gN,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zp(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Cj.hasOwnProperty(t)?{space:Cj[t],local:e}:e}function v8(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gN&&t.documentElement.namespaceURI===gN?t.createElement(e):t.createElementNS(n,e)}}function y8(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wM(e){var t=Zp(e);return(t.local?y8:v8)(t)}function w8(){}function oS(e){return e==null?w8:function(){return this.querySelector(e)}}function N8(e){typeof e!="function"&&(e=oS(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,h=0;h<o;++h)(c=i[h])&&(u=e.call(c,c.__data__,h,i))&&("__data__"in c&&(u.__data__=c.__data__),l[h]=u);return new Ua(r,this._parents)}function S8(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function E8(){return[]}function NM(e){return e==null?E8:function(){return this.querySelectorAll(e)}}function j8(e){return function(){return S8(e.apply(this,arguments))}}function T8(e){typeof e=="function"?e=j8(e):e=NM(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Ua(r,s)}function SM(e){return function(){return this.matches(e)}}function EM(e){return function(t){return t.matches(e)}}var C8=Array.prototype.find;function k8(e){return function(){return C8.call(this.children,e)}}function A8(){return this.firstElementChild}function _8(e){return this.select(e==null?A8:k8(typeof e=="function"?e:EM(e)))}var R8=Array.prototype.filter;function O8(){return Array.from(this.children)}function D8(e){return function(){return R8.call(this.children,e)}}function I8(e){return this.selectAll(e==null?O8:D8(typeof e=="function"?e:EM(e)))}function M8(e){typeof e!="function"&&(e=SM(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Ua(r,this._parents)}function jM(e){return new Array(e.length)}function L8(){return new Ua(this._enter||this._groups.map(jM),this._parents)}function np(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}np.prototype={constructor:np,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function U8(e){return function(){return e}}function P8(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new np(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function F8(e,t,n,r,s,i,o){var l,c,u=new Map,h=t.length,d=i.length,f=new Array(h),m;for(l=0;l<h;++l)(c=t[l])&&(f[l]=m=o.call(c,c.__data__,l,t)+"",u.has(m)?s[l]=c:u.set(m,c));for(l=0;l<d;++l)m=o.call(e,i[l],l,i)+"",(c=u.get(m))?(r[l]=c,c.__data__=i[l],u.delete(m)):n[l]=new np(e,i[l]);for(l=0;l<h;++l)(c=t[l])&&u.get(f[l])===c&&(s[l]=c)}function B8(e){return e.__data__}function z8(e,t){if(!arguments.length)return Array.from(this,B8);var n=t?F8:P8,r=this._parents,s=this._groups;typeof e!="function"&&(e=U8(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var h=r[u],d=s[u],f=d.length,m=$8(e.call(h,h&&h.__data__,u,r)),y=m.length,b=l[u]=new Array(y),w=o[u]=new Array(y),x=c[u]=new Array(f);n(h,d,b,w,x,m,t);for(var v=0,g=0,N,S;v<y;++v)if(N=b[v]){for(v>=g&&(g=v+1);!(S=w[g])&&++g<y;);N._next=S||null}}return o=new Ua(o,r),o._enter=l,o._exit=c,o}function $8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function H8(){return new Ua(this._exit||this._groups.map(jM),this._parents)}function q8(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function G8(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],h=r[c],d=u.length,f=l[c]=new Array(d),m,y=0;y<d;++y)(m=u[y]||h[y])&&(f[y]=m);for(;c<s;++c)l[c]=n[c];return new Ua(l,this._parents)}function V8(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function Y8(e){e||(e=W8);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,h=0;h<l;++h)(u=o[h])&&(c[h]=u);c.sort(t)}return new Ua(s,this._parents).order()}function W8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function X8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K8(){return Array.from(this)}function Z8(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function Q8(){let e=0;for(const t of this)++e;return e}function J8(){return!this.node()}function e9(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function t9(e){return function(){this.removeAttribute(e)}}function n9(e){return function(){this.removeAttributeNS(e.space,e.local)}}function a9(e,t){return function(){this.setAttribute(e,t)}}function r9(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function s9(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function i9(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function o9(e,t){var n=Zp(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?n9:t9:typeof t=="function"?n.local?i9:s9:n.local?r9:a9)(n,t))}function TM(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l9(e){return function(){this.style.removeProperty(e)}}function c9(e,t,n){return function(){this.style.setProperty(e,t,n)}}function d9(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function u9(e,t,n){return arguments.length>1?this.each((t==null?l9:typeof t=="function"?d9:c9)(e,t,n??"")):gc(this.node(),e)}function gc(e,t){return e.style.getPropertyValue(t)||TM(e).getComputedStyle(e,null).getPropertyValue(t)}function h9(e){return function(){delete this[e]}}function f9(e,t){return function(){this[e]=t}}function p9(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function m9(e,t){return arguments.length>1?this.each((t==null?h9:typeof t=="function"?p9:f9)(e,t)):this.node()[e]}function CM(e){return e.trim().split(/^|\s+/)}function lS(e){return e.classList||new kM(e)}function kM(e){this._node=e,this._names=CM(e.getAttribute("class")||"")}kM.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function AM(e,t){for(var n=lS(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function _M(e,t){for(var n=lS(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function g9(e){return function(){AM(this,e)}}function x9(e){return function(){_M(this,e)}}function b9(e,t){return function(){(t.apply(this,arguments)?AM:_M)(this,e)}}function v9(e,t){var n=CM(e+"");if(arguments.length<2){for(var r=lS(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?b9:t?g9:x9)(n,t))}function y9(){this.textContent=""}function w9(e){return function(){this.textContent=e}}function N9(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function S9(e){return arguments.length?this.each(e==null?y9:(typeof e=="function"?N9:w9)(e)):this.node().textContent}function E9(){this.innerHTML=""}function j9(e){return function(){this.innerHTML=e}}function T9(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function C9(e){return arguments.length?this.each(e==null?E9:(typeof e=="function"?T9:j9)(e)):this.node().innerHTML}function k9(){this.nextSibling&&this.parentNode.appendChild(this)}function A9(){return this.each(k9)}function _9(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R9(){return this.each(_9)}function O9(e){var t=typeof e=="function"?e:wM(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function D9(){return null}function I9(e,t){var n=typeof e=="function"?e:wM(e),r=t==null?D9:typeof t=="function"?t:oS(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function M9(){var e=this.parentNode;e&&e.removeChild(this)}function L9(){return this.each(M9)}function U9(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P9(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function F9(e){return this.select(e?P9:U9)}function B9(e){return arguments.length?this.property("__data__",e):this.node().__data__}function z9(e){return function(t){e.call(this,t,this.__data__)}}function $9(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function H9(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function q9(e,t,n){return function(){var r=this.__on,s,i=z9(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function G9(e,t,n){var r=$9(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,h;c<u;++c)for(s=0,h=l[c];s<i;++s)if((o=r[s]).type===h.type&&o.name===h.name)return h.value}return}for(l=t?q9:H9,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function RM(e,t,n){var r=TM(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function V9(e,t){return function(){return RM(this,e,t)}}function Y9(e,t){return function(){return RM(this,e,t.apply(this,arguments))}}function W9(e,t){return this.each((typeof t=="function"?Y9:V9)(e,t))}function*X9(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var OM=[null];function Ua(e,t){this._groups=e,this._parents=t}function Gu(){return new Ua([[document.documentElement]],OM)}function K9(){return this}Ua.prototype=Gu.prototype={constructor:Ua,select:N8,selectAll:T8,selectChild:_8,selectChildren:I8,filter:M8,data:z8,enter:L8,exit:H8,join:q8,merge:G8,selection:K9,order:V8,sort:Y8,call:X8,nodes:K8,node:Z8,size:Q8,empty:J8,each:e9,attr:o9,style:u9,property:m9,classed:v9,text:S9,html:C9,raise:A9,lower:R9,append:O9,insert:I9,remove:L9,clone:F9,datum:B9,on:G9,dispatch:W9,[Symbol.iterator]:X9};function _a(e){return typeof e=="string"?new Ua([[document.querySelector(e)]],[document.documentElement]):new Ua([[e]],OM)}function Z9(e){let t;for(;t=e.sourceEvent;)e=t;return e}function hr(e,t){if(e=Z9(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Q9={passive:!1},du={capture:!0,passive:!1};function Eg(e){e.stopImmediatePropagation()}function Zl(e){e.preventDefault(),e.stopImmediatePropagation()}function DM(e){var t=e.document.documentElement,n=_a(e).on("dragstart.drag",Zl,du);"onselectstart"in t?n.on("selectstart.drag",Zl,du):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function IM(e,t){var n=e.document.documentElement,r=_a(e).on("dragstart.drag",null);t&&(r.on("click.drag",Zl,du),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ch=e=>()=>e;function xN(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:h}})}xN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function J9(e){return!e.ctrlKey&&!e.button}function eH(){return this.parentNode}function tH(e,t){return t??{x:e.x,y:e.y}}function nH(){return navigator.maxTouchPoints||"ontouchstart"in this}function MM(){var e=J9,t=eH,n=tH,r=nH,s={},i=Kp("start","drag","end"),o=0,l,c,u,h,d=0;function f(N){N.on("mousedown.drag",m).filter(r).on("touchstart.drag",w).on("touchmove.drag",x,Q9).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,S){if(!(h||!e.call(this,N,S))){var E=g(this,t.call(this,N,S),N,S,"mouse");E&&(_a(N.view).on("mousemove.drag",y,du).on("mouseup.drag",b,du),DM(N.view),Eg(N),u=!1,l=N.clientX,c=N.clientY,E("start",N))}}function y(N){if(Zl(N),!u){var S=N.clientX-l,E=N.clientY-c;u=S*S+E*E>d}s.mouse("drag",N)}function b(N){_a(N.view).on("mousemove.drag mouseup.drag",null),IM(N.view,u),Zl(N),s.mouse("end",N)}function w(N,S){if(e.call(this,N,S)){var E=N.changedTouches,j=t.call(this,N,S),R=E.length,L,P;for(L=0;L<R;++L)(P=g(this,j,N,S,E[L].identifier,E[L]))&&(Eg(N),P("start",N,E[L]))}}function x(N){var S=N.changedTouches,E=S.length,j,R;for(j=0;j<E;++j)(R=s[S[j].identifier])&&(Zl(N),R("drag",N,S[j]))}function v(N){var S=N.changedTouches,E=S.length,j,R;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),j=0;j<E;++j)(R=s[S[j].identifier])&&(Eg(N),R("end",N,S[j]))}function g(N,S,E,j,R,L){var P=i.copy(),U=hr(L||E,S),F,G,_;if((_=n.call(N,new xN("beforestart",{sourceEvent:E,target:f,identifier:R,active:o,x:U[0],y:U[1],dx:0,dy:0,dispatch:P}),j))!=null)return F=_.x-U[0]||0,G=_.y-U[1]||0,function I(A,C,T){var O=U,q;switch(A){case"start":s[R]=I,q=o++;break;case"end":delete s[R],--o;case"drag":U=hr(T||C,S),q=o;break}P.call(A,N,new xN(A,{sourceEvent:C,subject:_,target:f,identifier:R,active:q,x:U[0]+F,y:U[1]+G,dx:U[0]-O[0],dy:U[1]-O[1],dispatch:P}),j)}}return f.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Ch(!!N),f):e},f.container=function(N){return arguments.length?(t=typeof N=="function"?N:Ch(N),f):t},f.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Ch(N),f):n},f.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Ch(!!N),f):r},f.on=function(){var N=i.on.apply(i,arguments);return N===i?f:N},f.clickDistance=function(N){return arguments.length?(d=(N=+N)*N,f):Math.sqrt(d)},f}function cS(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function LM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Vu(){}var uu=.7,ap=1/uu,Ql="\\s*([+-]?\\d+)\\s*",hu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aH=/^#([0-9a-f]{3,8})$/,rH=new RegExp(`^rgb\\(${Ql},${Ql},${Ql}\\)$`),sH=new RegExp(`^rgb\\(${Gr},${Gr},${Gr}\\)$`),iH=new RegExp(`^rgba\\(${Ql},${Ql},${Ql},${hu}\\)$`),oH=new RegExp(`^rgba\\(${Gr},${Gr},${Gr},${hu}\\)$`),lH=new RegExp(`^hsl\\(${hu},${Gr},${Gr}\\)$`),cH=new RegExp(`^hsla\\(${hu},${Gr},${Gr},${hu}\\)$`),kj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cS(Vu,Po,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Aj,formatHex:Aj,formatHex8:dH,formatHsl:uH,formatRgb:_j,toString:_j});function Aj(){return this.rgb().formatHex()}function dH(){return this.rgb().formatHex8()}function uH(){return UM(this).formatHsl()}function _j(){return this.rgb().formatRgb()}function Po(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=aH.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Rj(t):n===3?new ca(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rH.exec(e))?new ca(t[1],t[2],t[3],1):(t=sH.exec(e))?new ca(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iH.exec(e))?kh(t[1],t[2],t[3],t[4]):(t=oH.exec(e))?kh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lH.exec(e))?Ij(t[1],t[2]/100,t[3]/100,1):(t=cH.exec(e))?Ij(t[1],t[2]/100,t[3]/100,t[4]):kj.hasOwnProperty(e)?Rj(kj[e]):e==="transparent"?new ca(NaN,NaN,NaN,0):null}function Rj(e){return new ca(e>>16&255,e>>8&255,e&255,1)}function kh(e,t,n,r){return r<=0&&(e=t=n=NaN),new ca(e,t,n,r)}function hH(e){return e instanceof Vu||(e=Po(e)),e?(e=e.rgb(),new ca(e.r,e.g,e.b,e.opacity)):new ca}function bN(e,t,n,r){return arguments.length===1?hH(e):new ca(e,t,n,r??1)}function ca(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cS(ca,bN,LM(Vu,{brighter(e){return e=e==null?ap:Math.pow(ap,e),new ca(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?uu:Math.pow(uu,e),new ca(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ca(_o(this.r),_o(this.g),_o(this.b),rp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Oj,formatHex:Oj,formatHex8:fH,formatRgb:Dj,toString:Dj}));function Oj(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}`}function fH(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}${yo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dj(){const e=rp(this.opacity);return`${e===1?"rgb(":"rgba("}${_o(this.r)}, ${_o(this.g)}, ${_o(this.b)}${e===1?")":`, ${e})`}`}function rp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _o(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function yo(e){return e=_o(e),(e<16?"0":"")+e.toString(16)}function Ij(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fr(e,t,n,r)}function UM(e){if(e instanceof fr)return new fr(e.h,e.s,e.l,e.opacity);if(e instanceof Vu||(e=Po(e)),!e)return new fr;if(e instanceof fr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new fr(o,l,c,e.opacity)}function pH(e,t,n,r){return arguments.length===1?UM(e):new fr(e,t,n,r??1)}function fr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cS(fr,pH,LM(Vu,{brighter(e){return e=e==null?ap:Math.pow(ap,e),new fr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uu:Math.pow(uu,e),new fr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ca(jg(e>=240?e-240:e+120,s,r),jg(e,s,r),jg(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new fr(Mj(this.h),Ah(this.s),Ah(this.l),rp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=rp(this.opacity);return`${e===1?"hsl(":"hsla("}${Mj(this.h)}, ${Ah(this.s)*100}%, ${Ah(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mj(e){return e=(e||0)%360,e<0?e+360:e}function Ah(e){return Math.max(0,Math.min(1,e||0))}function jg(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const dS=e=>()=>e;function mH(e,t){return function(n){return e+n*t}}function gH(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function xH(e){return(e=+e)==1?PM:function(t,n){return n-t?gH(t,n,e):dS(isNaN(t)?n:t)}}function PM(e,t){var n=t-e;return n?mH(e,n):dS(isNaN(e)?t:e)}const sp=function e(t){var n=xH(t);function r(s,i){var o=n((s=bN(s)).r,(i=bN(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=PM(s.opacity,i.opacity);return function(h){return s.r=o(h),s.g=l(h),s.b=c(h),s.opacity=u(h),s+""}}return r.gamma=e,r}(1);function bH(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function vH(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yH(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Gd(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function wH(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Lr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function NH(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Gd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var vN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tg=new RegExp(vN.source,"g");function SH(e){return function(){return e}}function EH(e){return function(t){return e(t)+""}}function FM(e,t){var n=vN.lastIndex=Tg.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=vN.exec(e))&&(s=Tg.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Lr(r,s)})),n=Tg.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?EH(c[0].x):SH(t):(t=c.length,function(u){for(var h=0,d;h<t;++h)l[(d=c[h]).i]=d.x(u);return l.join("")})}function Gd(e,t){var n=typeof t,r;return t==null||n==="boolean"?dS(t):(n==="number"?Lr:n==="string"?(r=Po(t))?(t=r,sp):FM:t instanceof Po?sp:t instanceof Date?wH:vH(t)?bH:Array.isArray(t)?yH:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?NH:Lr)(e,t)}var Lj=180/Math.PI,yN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function BM(e,t,n,r,s,i){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Lj,skewX:Math.atan(c)*Lj,scaleX:o,scaleY:l}}var _h;function jH(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?yN:BM(t.a,t.b,t.c,t.d,t.e,t.f)}function TH(e){return e==null||(_h||(_h=document.createElementNS("http://www.w3.org/2000/svg","g")),_h.setAttribute("transform",e),!(e=_h.transform.baseVal.consolidate()))?yN:(e=e.matrix,BM(e.a,e.b,e.c,e.d,e.e,e.f))}function zM(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,h,d,f,m,y){if(u!==d||h!==f){var b=m.push("translate(",null,t,null,n);y.push({i:b-4,x:Lr(u,d)},{i:b-2,x:Lr(h,f)})}else(d||f)&&m.push("translate("+d+t+f+n)}function o(u,h,d,f){u!==h?(u-h>180?h+=360:h-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,r)-2,x:Lr(u,h)})):h&&d.push(s(d)+"rotate("+h+r)}function l(u,h,d,f){u!==h?f.push({i:d.push(s(d)+"skewX(",null,r)-2,x:Lr(u,h)}):h&&d.push(s(d)+"skewX("+h+r)}function c(u,h,d,f,m,y){if(u!==d||h!==f){var b=m.push(s(m)+"scale(",null,",",null,")");y.push({i:b-4,x:Lr(u,d)},{i:b-2,x:Lr(h,f)})}else(d!==1||f!==1)&&m.push(s(m)+"scale("+d+","+f+")")}return function(u,h){var d=[],f=[];return u=e(u),h=e(h),i(u.translateX,u.translateY,h.translateX,h.translateY,d,f),o(u.rotate,h.rotate,d,f),l(u.skewX,h.skewX,d,f),c(u.scaleX,u.scaleY,h.scaleX,h.scaleY,d,f),u=h=null,function(m){for(var y=-1,b=f.length,w;++y<b;)d[(w=f[y]).i]=w.x(m);return d.join("")}}}var CH=zM(jH,"px, ","px)","deg)"),kH=zM(TH,", ",")",")"),AH=1e-12;function Uj(e){return((e=Math.exp(e))+1/e)/2}function _H(e){return((e=Math.exp(e))-1/e)/2}function RH(e){return((e=Math.exp(2*e))-1)/(e+1)}const uf=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],h=o[0],d=o[1],f=o[2],m=h-l,y=d-c,b=m*m+y*y,w,x;if(b<AH)x=Math.log(f/u)/t,w=function(j){return[l+j*m,c+j*y,u*Math.exp(t*j*x)]};else{var v=Math.sqrt(b),g=(f*f-u*u+r*b)/(2*u*n*v),N=(f*f-u*u-r*b)/(2*f*n*v),S=Math.log(Math.sqrt(g*g+1)-g),E=Math.log(Math.sqrt(N*N+1)-N);x=(E-S)/t,w=function(j){var R=j*x,L=Uj(S),P=u/(n*v)*(L*RH(t*R+S)-_H(S));return[l+P*m,c+P*y,u*L/Uj(t*R+S)]}}return w.duration=x*1e3*t/Math.SQRT2,w}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var xc=0,Ed=0,sd=0,$M=1e3,ip,jd,op=0,Fo=0,Qp=0,fu=typeof performance=="object"&&performance.now?performance:Date,HM=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function uS(){return Fo||(HM(OH),Fo=fu.now()+Qp)}function OH(){Fo=0}function lp(){this._call=this._time=this._next=null}lp.prototype=qM.prototype={constructor:lp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?uS():+n)+(t==null?0:+t),!this._next&&jd!==this&&(jd?jd._next=this:ip=this,jd=this),this._call=e,this._time=n,wN()},stop:function(){this._call&&(this._call=null,this._time=1/0,wN())}};function qM(e,t,n){var r=new lp;return r.restart(e,t,n),r}function DH(){uS(),++xc;for(var e=ip,t;e;)(t=Fo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xc}function Pj(){Fo=(op=fu.now())+Qp,xc=Ed=0;try{DH()}finally{xc=0,MH(),Fo=0}}function IH(){var e=fu.now(),t=e-op;t>$M&&(Qp-=t,op=e)}function MH(){for(var e,t=ip,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ip=n);jd=e,wN(r)}function wN(e){if(!xc){Ed&&(Ed=clearTimeout(Ed));var t=e-Fo;t>24?(e<1/0&&(Ed=setTimeout(Pj,e-fu.now()-Qp)),sd&&(sd=clearInterval(sd))):(sd||(op=fu.now(),sd=setInterval(IH,$M)),xc=1,HM(Pj))}}function Fj(e,t,n){var r=new lp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var LH=Kp("start","end","cancel","interrupt"),UH=[],GM=0,Bj=1,NN=2,hf=3,zj=4,SN=5,ff=6;function Jp(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;PH(e,n,{name:t,index:r,group:s,on:LH,tween:UH,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:GM})}function hS(e,t){var n=wr(e,t);if(n.state>GM)throw new Error("too late; already scheduled");return n}function Zr(e,t){var n=wr(e,t);if(n.state>hf)throw new Error("too late; already running");return n}function wr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PH(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=qM(i,0,n.time);function i(u){n.state=Bj,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var h,d,f,m;if(n.state!==Bj)return c();for(h in r)if(m=r[h],m.name===n.name){if(m.state===hf)return Fj(o);m.state===zj?(m.state=ff,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[h]):+h<t&&(m.state=ff,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[h])}if(Fj(function(){n.state===hf&&(n.state=zj,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=NN,n.on.call("start",e,e.__data__,n.index,n.group),n.state===NN){for(n.state=hf,s=new Array(f=n.tween.length),h=0,d=-1;h<f;++h)(m=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++d]=m);s.length=d+1}}function l(u){for(var h=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=SN,1),d=-1,f=s.length;++d<f;)s[d].call(e,h);n.state===SN&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ff,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function pf(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>NN&&r.state<SN,r.state=ff,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function FH(e){return this.each(function(){pf(this,e)})}function BH(e,t){var n,r;return function(){var s=Zr(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function zH(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Zr(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function $H(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=wr(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?BH:zH)(n,e,t))}function fS(e,t,n){var r=e._id;return e.each(function(){var s=Zr(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return wr(s,r).value[t]}}function VM(e,t){var n;return(typeof t=="number"?Lr:t instanceof Po?sp:(n=Po(t))?(t=n,sp):FM)(e,t)}function HH(e){return function(){this.removeAttribute(e)}}function qH(e){return function(){this.removeAttributeNS(e.space,e.local)}}function GH(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function VH(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function YH(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function WH(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function XH(e,t){var n=Zp(e),r=n==="transform"?kH:VM;return this.attrTween(e,typeof t=="function"?(n.local?WH:YH)(n,r,fS(this,"attr."+e,t)):t==null?(n.local?qH:HH)(n):(n.local?VH:GH)(n,r,t))}function KH(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ZH(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function QH(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ZH(e,i)),n}return s._value=t,s}function JH(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&KH(e,i)),n}return s._value=t,s}function e7(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Zp(e);return this.tween(n,(r.local?QH:JH)(r,t))}function t7(e,t){return function(){hS(this,e).delay=+t.apply(this,arguments)}}function n7(e,t){return t=+t,function(){hS(this,e).delay=t}}function a7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?t7:n7)(t,e)):wr(this.node(),t).delay}function r7(e,t){return function(){Zr(this,e).duration=+t.apply(this,arguments)}}function s7(e,t){return t=+t,function(){Zr(this,e).duration=t}}function i7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?r7:s7)(t,e)):wr(this.node(),t).duration}function o7(e,t){if(typeof t!="function")throw new Error;return function(){Zr(this,e).ease=t}}function l7(e){var t=this._id;return arguments.length?this.each(o7(t,e)):wr(this.node(),t).ease}function c7(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Zr(this,e).ease=n}}function d7(e){if(typeof e!="function")throw new Error;return this.each(c7(this._id,e))}function u7(e){typeof e!="function"&&(e=SM(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Bs(r,this._parents,this._name,this._id)}function h7(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],h=c.length,d=o[l]=new Array(h),f,m=0;m<h;++m)(f=c[m]||u[m])&&(d[m]=f);for(;l<r;++l)o[l]=t[l];return new Bs(o,this._parents,this._name,this._id)}function f7(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function p7(e,t,n){var r,s,i=f7(t)?hS:Zr;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function m7(e,t){var n=this._id;return arguments.length<2?wr(this.node(),n).on.on(e):this.each(p7(n,e,t))}function g7(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function x7(){return this.on("end.remove",g7(this._id))}function b7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oS(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),h,d,f=0;f<c;++f)(h=l[f])&&(d=e.call(h,h.__data__,f,l))&&("__data__"in h&&(d.__data__=h.__data__),u[f]=d,Jp(u[f],t,n,f,u,wr(h,n)));return new Bs(i,this._parents,t,n)}function v7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=NM(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,h,d=0;d<u;++d)if(h=c[d]){for(var f=e.call(h,h.__data__,d,c),m,y=wr(h,n),b=0,w=f.length;b<w;++b)(m=f[b])&&Jp(m,t,n,b,f,y);i.push(f),o.push(h)}return new Bs(i,o,t,n)}var y7=Gu.prototype.constructor;function w7(){return new y7(this._groups,this._parents)}function N7(e,t){var n,r,s;return function(){var i=gc(this,e),o=(this.style.removeProperty(e),gc(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function YM(e){return function(){this.style.removeProperty(e)}}function S7(e,t,n){var r,s=n+"",i;return function(){var o=gc(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function E7(e,t,n){var r,s,i;return function(){var o=gc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),gc(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function j7(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Zr(this,e),u=c.on,h=c.value[i]==null?l||(l=YM(t)):void 0;(u!==n||s!==h)&&(r=(n=u).copy()).on(o,s=h),c.on=r}}function T7(e,t,n){var r=(e+="")=="transform"?CH:VM;return t==null?this.styleTween(e,N7(e,r)).on("end.style."+e,YM(e)):typeof t=="function"?this.styleTween(e,E7(e,r,fS(this,"style."+e,t))).each(j7(this._id,e)):this.styleTween(e,S7(e,r,t),n).on("end.style."+e,null)}function C7(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function k7(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&C7(e,o,n)),r}return i._value=t,i}function A7(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,k7(e,t,n??""))}function _7(e){return function(){this.textContent=e}}function R7(e){return function(){var t=e(this);this.textContent=t??""}}function O7(e){return this.tween("text",typeof e=="function"?R7(fS(this,"text",e)):_7(e==null?"":e+""))}function D7(e){return function(t){this.textContent=e.call(this,t)}}function I7(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&D7(s)),t}return r._value=e,r}function M7(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,I7(e))}function L7(){for(var e=this._name,t=this._id,n=WM(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var h=wr(c,t);Jp(c,e,n,u,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Bs(r,this._parents,e,n)}function U7(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Zr(this,r),h=u.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var P7=0;function Bs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function WM(){return++P7}var bs=Gu.prototype;Bs.prototype={constructor:Bs,select:b7,selectAll:v7,selectChild:bs.selectChild,selectChildren:bs.selectChildren,filter:u7,merge:h7,selection:w7,transition:L7,call:bs.call,nodes:bs.nodes,node:bs.node,size:bs.size,empty:bs.empty,each:bs.each,on:m7,attr:XH,attrTween:e7,style:T7,styleTween:A7,text:O7,textTween:M7,remove:x7,tween:$H,delay:a7,duration:i7,ease:l7,easeVarying:d7,end:U7,[Symbol.iterator]:bs[Symbol.iterator]};function F7(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var B7={time:null,delay:0,duration:250,ease:F7};function z7(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function $7(e){var t,n;e instanceof Bs?(t=e._id,e=e._name):(t=WM(),(n=B7).time=uS(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Jp(c,e,t,u,o,n||z7(c,t));return new Bs(r,this._parents,e,t)}Gu.prototype.interrupt=FH;Gu.prototype.transition=$7;const Rh=e=>()=>e;function H7(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function ks(e,t,n){this.k=e,this.x=t,this.y=n}ks.prototype={constructor:ks,scale:function(e){return e===1?this:new ks(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ks(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var em=new ks(1,0,0);XM.prototype=ks.prototype;function XM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return em;return e.__zoom}function Cg(e){e.stopImmediatePropagation()}function id(e){e.preventDefault(),e.stopImmediatePropagation()}function q7(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function G7(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function $j(){return this.__zoom||em}function V7(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Y7(){return navigator.maxTouchPoints||"ontouchstart"in this}function W7(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function KM(){var e=q7,t=G7,n=W7,r=V7,s=Y7,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=uf,u=Kp("start","zoom","end"),h,d,f,m=500,y=150,b=0,w=10;function x(_){_.property("__zoom",$j).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",U).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(_,I,A,C){var T=_.selection?_.selection():_;T.property("__zoom",$j),_!==T?S(_,I,A,C):T.interrupt().each(function(){E(this,arguments).event(C).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},x.scaleBy=function(_,I,A,C){x.scaleTo(_,function(){var T=this.__zoom.k,O=typeof I=="function"?I.apply(this,arguments):I;return T*O},A,C)},x.scaleTo=function(_,I,A,C){x.transform(_,function(){var T=t.apply(this,arguments),O=this.__zoom,q=A==null?N(T):typeof A=="function"?A.apply(this,arguments):A,k=O.invert(q),M=typeof I=="function"?I.apply(this,arguments):I;return n(g(v(O,M),q,k),T,o)},A,C)},x.translateBy=function(_,I,A,C){x.transform(_,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),o)},null,C)},x.translateTo=function(_,I,A,C,T){x.transform(_,function(){var O=t.apply(this,arguments),q=this.__zoom,k=C==null?N(O):typeof C=="function"?C.apply(this,arguments):C;return n(em.translate(k[0],k[1]).scale(q.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof A=="function"?-A.apply(this,arguments):-A),O,o)},C,T)};function v(_,I){return I=Math.max(i[0],Math.min(i[1],I)),I===_.k?_:new ks(I,_.x,_.y)}function g(_,I,A){var C=I[0]-A[0]*_.k,T=I[1]-A[1]*_.k;return C===_.x&&T===_.y?_:new ks(_.k,C,T)}function N(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function S(_,I,A,C){_.on("start.zoom",function(){E(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(C).end()}).tween("zoom",function(){var T=this,O=arguments,q=E(T,O).event(C),k=t.apply(T,O),M=A==null?N(k):typeof A=="function"?A.apply(T,O):A,$=Math.max(k[1][0]-k[0][0],k[1][1]-k[0][1]),W=T.__zoom,Y=typeof I=="function"?I.apply(T,O):I,te=c(W.invert(M).concat($/W.k),Y.invert(M).concat($/Y.k));return function(ne){if(ne===1)ne=Y;else{var X=te(ne),se=$/X[2];ne=new ks(se,M[0]-X[0]*se,M[1]-X[1]*se)}q.zoom(null,ne)}})}function E(_,I,A){return!A&&_.__zooming||new j(_,I)}function j(_,I){this.that=_,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,I),this.taps=0}j.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,I){return this.mouse&&_!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var I=_a(this.that).datum();u.call(_,this.that,new H7(_,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:u}),I)}};function R(_,...I){if(!e.apply(this,arguments))return;var A=E(this,I).event(_),C=this.__zoom,T=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),O=hr(_);if(A.wheel)(A.mouse[0][0]!==O[0]||A.mouse[0][1]!==O[1])&&(A.mouse[1]=C.invert(A.mouse[0]=O)),clearTimeout(A.wheel);else{if(C.k===T)return;A.mouse=[O,C.invert(O)],pf(this),A.start()}id(_),A.wheel=setTimeout(q,y),A.zoom("mouse",n(g(v(C,T),A.mouse[0],A.mouse[1]),A.extent,o));function q(){A.wheel=null,A.end()}}function L(_,...I){if(f||!e.apply(this,arguments))return;var A=_.currentTarget,C=E(this,I,!0).event(_),T=_a(_.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",$,!0),O=hr(_,A),q=_.clientX,k=_.clientY;DM(_.view),Cg(_),C.mouse=[O,this.__zoom.invert(O)],pf(this),C.start();function M(W){if(id(W),!C.moved){var Y=W.clientX-q,te=W.clientY-k;C.moved=Y*Y+te*te>b}C.event(W).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=hr(W,A),C.mouse[1]),C.extent,o))}function $(W){T.on("mousemove.zoom mouseup.zoom",null),IM(W.view,C.moved),id(W),C.event(W).end()}}function P(_,...I){if(e.apply(this,arguments)){var A=this.__zoom,C=hr(_.changedTouches?_.changedTouches[0]:_,this),T=A.invert(C),O=A.k*(_.shiftKey?.5:2),q=n(g(v(A,O),C,T),t.apply(this,I),o);id(_),l>0?_a(this).transition().duration(l).call(S,q,C,_):_a(this).call(x.transform,q,C,_)}}function U(_,...I){if(e.apply(this,arguments)){var A=_.touches,C=A.length,T=E(this,I,_.changedTouches.length===C).event(_),O,q,k,M;for(Cg(_),q=0;q<C;++q)k=A[q],M=hr(k,this),M=[M,this.__zoom.invert(M),k.identifier],T.touch0?!T.touch1&&T.touch0[2]!==M[2]&&(T.touch1=M,T.taps=0):(T.touch0=M,O=!0,T.taps=1+!!h);h&&(h=clearTimeout(h)),O&&(T.taps<2&&(d=M[0],h=setTimeout(function(){h=null},m)),pf(this),T.start())}}function F(_,...I){if(this.__zooming){var A=E(this,I).event(_),C=_.changedTouches,T=C.length,O,q,k,M;for(id(_),O=0;O<T;++O)q=C[O],k=hr(q,this),A.touch0&&A.touch0[2]===q.identifier?A.touch0[0]=k:A.touch1&&A.touch1[2]===q.identifier&&(A.touch1[0]=k);if(q=A.that.__zoom,A.touch1){var $=A.touch0[0],W=A.touch0[1],Y=A.touch1[0],te=A.touch1[1],ne=(ne=Y[0]-$[0])*ne+(ne=Y[1]-$[1])*ne,X=(X=te[0]-W[0])*X+(X=te[1]-W[1])*X;q=v(q,Math.sqrt(ne/X)),k=[($[0]+Y[0])/2,($[1]+Y[1])/2],M=[(W[0]+te[0])/2,(W[1]+te[1])/2]}else if(A.touch0)k=A.touch0[0],M=A.touch0[1];else return;A.zoom("touch",n(g(q,k,M),A.extent,o))}}function G(_,...I){if(this.__zooming){var A=E(this,I).event(_),C=_.changedTouches,T=C.length,O,q;for(Cg(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),O=0;O<T;++O)q=C[O],A.touch0&&A.touch0[2]===q.identifier?delete A.touch0:A.touch1&&A.touch1[2]===q.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(q=hr(q,this),Math.hypot(d[0]-q[0],d[1]-q[1])<w)){var k=_a(this).on("dblclick.zoom");k&&k.apply(this,arguments)}}}return x.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:Rh(+_),x):r},x.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Rh(!!_),x):e},x.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:Rh(!!_),x):s},x.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Rh([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),x):t},x.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],x):[i[0],i[1]]},x.translateExtent=function(_){return arguments.length?(o[0][0]=+_[0][0],o[1][0]=+_[1][0],o[0][1]=+_[0][1],o[1][1]=+_[1][1],x):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},x.constrain=function(_){return arguments.length?(n=_,x):n},x.duration=function(_){return arguments.length?(l=+_,x):l},x.interpolate=function(_){return arguments.length?(c=_,x):c},x.on=function(){var _=u.on.apply(u,arguments);return _===u?x:_},x.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,x):Math.sqrt(b)},x.tapDistance=function(_){return arguments.length?(w=+_,x):w},x}const Yr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ZM=["Enter"," ","Escape"],QM={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var bc;(function(e){e.Strict="strict",e.Loose="loose"})(bc||(bc={}));var Ro;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ro||(Ro={}));var mu;(function(e){e.Partial="partial",e.Full="full"})(mu||(mu={}));const JM={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Si;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Si||(Si={}));var cp;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cp||(cp={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));const Hj={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};function eL(e){return e===null?null:e?"valid":"invalid"}const tL=e=>"id"in e&&"source"in e&&"target"in e,X7=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),pS=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Yu=(e,t=[0,0])=>{const{width:n,height:r}=Gs(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},K7=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):pS(s)?s:t.nodeLookup.get(s.id));const l=o?dp(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nm(n)},Wu=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=tm(n,dp(s)),r=!0)}),r?nm(n):{x:0,y:0,width:0,height:0}},mS=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l={...Ku(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:h,selectable:d=!0,hidden:f=!1}=u;if(o&&!d||f)continue;const m=h.width??u.width??u.initialWidth??null,y=h.height??u.height??u.initialHeight??null,b=gu(l,yc(u)),w=(m??0)*(y??0),x=i&&b>0;(!u.internals.handleBounds||x||b>=w||u.dragging)&&c.push(u)}return c},Z7=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Q7(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function J7({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!0);const l=Q7(e,o),c=Wu(l),u=gS(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function nL({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},h=o.origin??r;let d=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",Yr.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(d=[[c,u],[c+m,u+y]])}else l&&wc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const f=wc(d)?Bo(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",Yr.error015())),{position:{x:f.x-c+(o.measured.width??0)*h[0],y:f.y-u+(o.measured.height??0)*h[1]},positionAbsolute:f}}async function eq({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const m=i.has(f.id),y=!m&&f.parentId&&o.find(b=>b.id===f.parentId);(m||y)&&o.push(f)}const l=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),h=Z7(o,c);for(const f of c)l.has(f.id)&&!h.find(y=>y.id===f.id)&&h.push(f);if(!s)return{edges:h,nodes:o};const d=await s({nodes:o,edges:h});return typeof d=="boolean"?d?{edges:h,nodes:o}:{edges:[],nodes:[]}:d}const vc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Bo=(e={x:0,y:0},t,n)=>({x:vc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:vc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function aL(e,t,n){const{width:r,height:s}=Gs(n),{x:i,y:o}=n.internals.positionAbsolute;return Bo(e,[[i,o],[i+r,o+s]],t)}const qj=(e,t,n)=>e<t?vc(Math.abs(e-t),1,t)/t:e>n?-vc(Math.abs(e-n),1,t)/t:0,rL=(e,t,n=15,r=40)=>{const s=qj(e.x,r,t.width-r)*n,i=qj(e.y,r,t.height-r)*n;return[s,i]},tm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),EN=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),yc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=pS(e)?e.internals.positionAbsolute:Yu(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},dp=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=pS(e)?e.internals.positionAbsolute:Yu(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},sL=(e,t)=>nm(tm(EN(e),EN(t))),gu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Gj=e=>pr(e.width)&&pr(e.height)&&pr(e.x)&&pr(e.y),pr=e=>!isNaN(e)&&isFinite(e),tq=(e,t)=>{},Xu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ku=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?Xu(l,o):l},up=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function dl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nq(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=dl(e,n),s=dl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=dl(e.top??e.y??0,n),s=dl(e.bottom??e.y??0,n),i=dl(e.left??e.x??0,t),o=dl(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function aq(e,t,n,r,s,i){const{x:o,y:l}=up(e,[t,n,r]),{x:c,y:u}=up({x:e.x+e.width,y:e.y+e.height},[t,n,r]),h=s-c,d=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(d)}}const gS=(e,t,n,r,s,i)=>{const o=nq(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),h=vc(u,r,s),d=e.x+e.width/2,f=e.y+e.height/2,m=t/2-d*h,y=n/2-f*h,b=aq(e,m,y,h,t,n),w={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:m-w.left+w.right,y:y-w.top+w.bottom,zoom:h}},xu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function wc(e){return e!=null&&e!=="parent"}function Gs(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function iL(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function oL(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function Vj(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rq(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function sq(e){return{...QM,...e||{}}}function Vd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=mr(e),l=Ku({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Xu(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const xS=e=>({width:e.offsetWidth,height:e.offsetHeight}),lL=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},iq=["INPUT","SELECT","TEXTAREA"];function cL(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:iq.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dL=e=>"clientX"in e,mr=(e,t)=>{var i,o;const n=dL(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Yj=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...xS(o)}})};function uL({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,h=Math.abs(c-e),d=Math.abs(u-t);return[c,u,h,d]}function Oh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wj({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Xe.Left:return[t-Oh(t-r,i),n];case Xe.Right:return[t+Oh(r-t,i),n];case Xe.Top:return[t,n-Oh(n-s,i)];case Xe.Bottom:return[t,n+Oh(s-n,i)]}}function hL({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,curvature:o=.25}){const[l,c]=Wj({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,h]=Wj({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[d,f,m,y]=uL({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:h});return[`M${e},${t} C${l},${c} ${u},${h} ${r},${s}`,d,f,m,y]}function fL({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function oq({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:s=!1}){if(r!==void 0)return r;const i=s&&n?1e3:0,o=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+o}function lq({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=tm(dp(e),dp(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return gu(o,nm(i))>0}const cq=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,dq=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),pL=(e,t)=>{if(!e.source||!e.target)return t;let n;return tL(e)?n={...e}:n={...e,id:cq(e)},dq(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function mL({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=fL({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const Xj={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}},uq=({source:e,sourcePosition:t=Xe.Bottom,target:n})=>t===Xe.Left||t===Xe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Kj=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hq({source:e,sourcePosition:t=Xe.Bottom,target:n,targetPosition:r=Xe.Top,center:s,offset:i,stepPosition:o}){const l=Xj[t],c=Xj[r],u={x:e.x+l.x*i,y:e.y+l.y*i},h={x:n.x+c.x*i,y:n.y+c.y*i},d=uq({source:u,sourcePosition:t,target:h}),f=d.x!==0?"x":"y",m=d[f];let y=[],b,w;const x={x:0,y:0},v={x:0,y:0},[,,g,N]=fL({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(b=s.x??u.x+(h.x-u.x)*o,w=s.y??(u.y+h.y)/2):(b=s.x??(u.x+h.x)/2,w=s.y??u.y+(h.y-u.y)*o);const E=[{x:b,y:u.y},{x:b,y:h.y}],j=[{x:u.x,y:w},{x:h.x,y:w}];l[f]===m?y=f==="x"?E:j:y=f==="x"?j:E}else{const E=[{x:u.x,y:h.y}],j=[{x:h.x,y:u.y}];if(f==="x"?y=l.x===m?j:E:y=l.y===m?E:j,t===r){const F=Math.abs(e[f]-n[f]);if(F<=i){const G=Math.min(i-1,i-F);l[f]===m?x[f]=(u[f]>e[f]?-1:1)*G:v[f]=(h[f]>n[f]?-1:1)*G}}if(t!==r){const F=f==="x"?"y":"x",G=l[f]===c[F],_=u[F]>h[F],I=u[F]<h[F];(l[f]===1&&(!G&&_||G&&I)||l[f]!==1&&(!G&&I||G&&_))&&(y=f==="x"?E:j)}const R={x:u.x+x.x,y:u.y+x.y},L={x:h.x+v.x,y:h.y+v.y},P=Math.max(Math.abs(R.x-y[0].x),Math.abs(L.x-y[0].x)),U=Math.max(Math.abs(R.y-y[0].y),Math.abs(L.y-y[0].y));P>=U?(b=(R.x+L.x)/2,w=y[0].y):(b=y[0].x,w=(R.y+L.y)/2)}return[[e,{x:u.x+x.x,y:u.y+x.y},...y,{x:h.x+v.x,y:h.y+v.y},n],b,w,g,N]}function fq(e,t,n,r){const s=Math.min(Kj(e,t)/2,Kj(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function jN({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:h=.5}){const[d,f,m,y,b]=hq({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:h});return[d.reduce((x,v,g)=>{let N="";return g>0&&g<d.length-1?N=fq(d[g-1],v,d[g+1],o):N=`${g===0?"M":"L"}${v.x} ${v.y}`,x+=N,x},""),f,m,y,b]}function Zj(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pq(e){var d;const{sourceNode:t,targetNode:n}=e;if(!Zj(t)||!Zj(n))return null;const r=t.internals.handleBounds||Qj(t.handles),s=n.internals.handleBounds||Qj(n.handles),i=Jj((r==null?void 0:r.source)??[],e.sourceHandle),o=Jj(e.connectionMode===bc.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(d=e.onError)==null||d.call(e,"008",Yr.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Xe.Bottom,c=(o==null?void 0:o.position)||Xe.Top,u=bu(t,i,l),h=bu(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function Qj(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function bu(e,t,n=Xe.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Gs(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Xe.Top:return{x:s+o/2,y:i};case Xe.Right:return{x:s+o,y:i+l/2};case Xe.Bottom:return{x:s+o/2,y:i+l};case Xe.Left:return{x:s,y:i+l/2}}}function Jj(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function TN(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mq(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=TN(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const gL=1e3,gq=10,bS={nodeOrigin:[0,0],nodeExtent:pu,elevateNodesOnSelect:!0,defaults:{}},xq={...bS,checkEquality:!0};function vS(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function bq(e,t,n){const r=vS(bS,n);for(const s of e.values())if(s.parentId)yS(s,e,t,r);else{const i=Yu(s,r.nodeOrigin),o=wc(s.extent)?s.extent:r.nodeExtent,l=Bo(i,o,Gs(s));s.internals.positionAbsolute=l}}function vq(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function CN(e,t,n,r){var u,h;const s=vS(xq,r);let i={i:-1},o=e.length>0;const l=new Map(t),c=s!=null&&s.elevateNodesOnSelect?gL:0;t.clear(),n.clear();for(const d of e){let f=l.get(d.id);if(s.checkEquality&&d===(f==null?void 0:f.internals.userNode))t.set(d.id,f);else{const m=Yu(d,s.nodeOrigin),y=wc(d.extent)?d.extent:s.nodeExtent,b=Bo(m,y,Gs(d));f={...s.defaults,...d,measured:{width:(u=d.measured)==null?void 0:u.width,height:(h=d.measured)==null?void 0:h.height},internals:{positionAbsolute:b,handleBounds:vq(d,f),z:xL(d,c),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(o=!1),d.parentId&&yS(f,t,n,r,i)}return o}function yq(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function yS(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l}=vS(bS,r),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yq(e,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*gq),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const h=i?gL:0,{x:d,y:f,z:m}=wq(e,u,o,l,h),{positionAbsolute:y}=e.internals,b=d!==y.x||f!==y.y;(b||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:f}:y,z:m}})}function xL(e,t){return(pr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function wq(e,t,n,r,s){const{x:i,y:o}=t.internals.positionAbsolute,l=Gs(e),c=Yu(e,n),u=wc(e.extent)?Bo(c,e.extent,l):c;let h=Bo({x:i+u.x,y:o+u.y},r,l);e.extent==="parent"&&(h=aL(h,l,t));const d=xL(e,s),f=t.internals.z??0;return{x:h.x,y:h.y,z:f>=d?f+1:d}}function wS(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??yc(c),h=sL(u,l.rect);i.set(l.parentId,{expandedRect:h,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var g;const h=c.internals.positionAbsolute,d=Gs(c),f=c.origin??r,m=l.x<h.x?Math.round(Math.abs(h.x-l.x)):0,y=l.y<h.y?Math.round(Math.abs(h.y-l.y)):0,b=Math.max(d.width,Math.round(l.width)),w=Math.max(d.height,Math.round(l.height)),x=(b-d.width)*f[0],v=(w-d.height)*f[1];(m>0||y>0||x||v)&&(s.push({id:u,type:"position",position:{x:c.position.x-m+x,y:c.position.y-y+v}}),(g=n.get(u))==null||g.forEach(N=>{e.some(S=>S.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+m,y:N.position.y+y}})})),(d.width<l.width||d.height<l.height||m||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?f[0]*m-x:0),height:w+(y?f[1]*y-v:0)}})}),s}function Nq(e,t,n,r,s,i){const o=r==null?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!o)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(o),{m22:h}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const f of e.values()){const m=t.get(f.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=xS(f.nodeElement),b=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(b||!m.internals.handleBounds||f.force))){const x=f.nodeElement.getBoundingClientRect(),v=wc(m.extent)?m.extent:i;let{positionAbsolute:g}=m.internals;m.parentId&&m.extent==="parent"?g=aL(g,y,t.get(m.parentId)):v&&(g=Bo(g,v,y));const N={...m,measured:y,internals:{...m.internals,positionAbsolute:g,handleBounds:{source:Yj("source",f.nodeElement,x,h,m.id),target:Yj("target",f.nodeElement,x,h,m.id)}}};t.set(m.id,N),m.parentId&&yS(N,t,n,{nodeOrigin:s}),l=!0,b&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&d.push({id:m.id,parentId:m.parentId,rect:yc(N,s)}))}}if(d.length>0){const f=wS(d,t,n,s);c.push(...f)}return{changes:c,updatedInternals:l}}async function Sq({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function eT(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function bL(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,h=`${i}-${l}--${s}-${o}`;eT("source",c,h,e,s,o),eT("target",c,u,e,i,l),t.set(r.id,r)}}function vL(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vL(n,t):!1}function tT(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Eq(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!vL(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function kg({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,h]of t){const d=(o=n.get(u))==null?void 0:o.internals.userNode;d&&s.push({...d,position:h.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function jq({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=Xu(i,t);return{x:o.x-i.x,y:o.y-i.y}}function Tq({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},h=null,d=!1,f=null,m=!1,y=!1,b=null;function w({noDragClassName:v,handleSelector:g,domNode:N,isSelectable:S,nodeId:E,nodeClickDistance:j=0}){f=_a(N);function R({x:F,y:G}){const{nodeLookup:_,nodeExtent:I,snapGrid:A,snapToGrid:C,nodeOrigin:T,onNodeDrag:O,onSelectionDrag:q,onError:k,updateNodePositions:M}=t();i={x:F,y:G};let $=!1;const W=l.size>1,Y=W&&I?EN(Wu(l)):null,te=W&&C?jq({dragItems:l,snapGrid:A,x:F,y:G}):null;for(const[ne,X]of l){if(!_.has(ne))continue;let se={x:F-X.distance.x,y:G-X.distance.y};C&&(se=te?{x:Math.round(se.x+te.x),y:Math.round(se.y+te.y)}:Xu(se,A));let Ee=null;if(W&&I&&!X.extent&&Y){const{positionAbsolute:ye}=X.internals,ze=ye.x-Y.x+I[0][0],He=ye.x+X.measured.width-Y.x2+I[1][0],Fe=ye.y-Y.y+I[0][1],Ye=ye.y+X.measured.height-Y.y2+I[1][1];Ee=[[ze,Fe],[He,Ye]]}const{position:re,positionAbsolute:xe}=nL({nodeId:ne,nextPosition:se,nodeLookup:_,nodeExtent:Ee||I,nodeOrigin:T,onError:k});$=$||X.position.x!==re.x||X.position.y!==re.y,X.position=re,X.internals.positionAbsolute=xe}if(y=y||$,!!$&&(M(l,!0),b&&(r||O||!E&&q))){const[ne,X]=kg({nodeId:E,dragItems:l,nodeLookup:_});r==null||r(b,l,ne,X),O==null||O(b,ne,X),E||q==null||q(b,X)}}async function L(){if(!h)return;const{transform:F,panBy:G,autoPanSpeed:_,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(o);return}const[A,C]=rL(u,h,_);(A!==0||C!==0)&&(i.x=(i.x??0)-A/F[2],i.y=(i.y??0)-C/F[2],await G({x:A,y:C})&&R(i)),o=requestAnimationFrame(L)}function P(F){var W;const{nodeLookup:G,multiSelectionActive:_,nodesDraggable:I,transform:A,snapGrid:C,snapToGrid:T,selectNodesOnDrag:O,onNodeDragStart:q,onSelectionDragStart:k,unselectNodesAndEdges:M}=t();d=!0,(!O||!S)&&!_&&E&&((W=G.get(E))!=null&&W.selected||M()),S&&O&&E&&(e==null||e(E));const $=Vd(F.sourceEvent,{transform:A,snapGrid:C,snapToGrid:T,containerBounds:h});if(i=$,l=Eq(G,I,$,E),l.size>0&&(n||q||!E&&k)){const[Y,te]=kg({nodeId:E,dragItems:l,nodeLookup:G});n==null||n(F.sourceEvent,l,Y,te),q==null||q(F.sourceEvent,Y,te),E||k==null||k(F.sourceEvent,te)}}const U=MM().clickDistance(j).on("start",F=>{const{domNode:G,nodeDragThreshold:_,transform:I,snapGrid:A,snapToGrid:C}=t();h=(G==null?void 0:G.getBoundingClientRect())||null,m=!1,y=!1,b=F.sourceEvent,_===0&&P(F),i=Vd(F.sourceEvent,{transform:I,snapGrid:A,snapToGrid:C,containerBounds:h}),u=mr(F.sourceEvent,h)}).on("drag",F=>{const{autoPanOnNodeDrag:G,transform:_,snapGrid:I,snapToGrid:A,nodeDragThreshold:C,nodeLookup:T}=t(),O=Vd(F.sourceEvent,{transform:_,snapGrid:I,snapToGrid:A,containerBounds:h});if(b=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||E&&!T.has(E))&&(m=!0),!m){if(!c&&G&&d&&(c=!0,L()),!d){const q=mr(F.sourceEvent,h),k=q.x-u.x,M=q.y-u.y;Math.sqrt(k*k+M*M)>C&&P(F)}(i.x!==O.xSnapped||i.y!==O.ySnapped)&&l&&d&&(u=mr(F.sourceEvent,h),R(O))}}).on("end",F=>{if(!(!d||m)&&(c=!1,d=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:G,updateNodePositions:_,onNodeDragStop:I,onSelectionDragStop:A}=t();if(y&&(_(l,!1),y=!1),s||I||!E&&A){const[C,T]=kg({nodeId:E,dragItems:l,nodeLookup:G,dragging:!1});s==null||s(F.sourceEvent,l,C,T),I==null||I(F.sourceEvent,C,T),E||A==null||A(F.sourceEvent,T)}}}).filter(F=>{const G=F.target;return!F.button&&(!v||!tT(G,`.${v}`,N))&&(!g||tT(G,g,N))});f.call(U)}function x(){f==null||f.on(".drag",null)}return{update:w,destroy:x}}function Cq(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())gu(s,yc(i))>0&&r.push(i);return r}const kq=250;function Aq(e,t,n,r){var l,c;let s=[],i=1/0;const o=Cq(e,n,t+kq);for(const u of o){const h=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of h){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:m}=bu(u,d,d.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(m-e.y,2));y>t||(y<i?(s=[{...d,x:f,y:m}],i=y):y===i&&s.push({...d,x:f,y:m}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(h=>h.type===u)??s[0]}return s[0]}function yL(e,t,n,r,s,i=!1){var u,h,d;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((h=o.internals.handleBounds)==null?void 0:h.source)??[],...((d=o.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...bu(o,c,c.position,!0)}:c}function wL(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function _q(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const NL=()=>!0;function Rq(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:h,flowId:d,panBy:f,cancelConnection:m,onConnectStart:y,onConnect:b,onConnectEnd:w,isValidConnection:x=NL,onReconnectEnd:v,updateConnection:g,getTransform:N,getFromHandle:S,autoPanSpeed:E,dragThreshold:j=1,handleDomNode:R}){const L=lL(e.target);let P=0,U;const{x:F,y:G}=mr(e),_=wL(i,R),I=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!I||!_)return;const C=yL(s,_,r,c,t);if(!C)return;let T=mr(e,I),O=!1,q=null,k=!1,M=null;function $(){if(!h||!I)return;const[re,xe]=rL(T,I,E);f({x:re,y:xe}),P=requestAnimationFrame($)}const W={...C,nodeId:s,type:_,position:C.position},Y=c.get(s);let ne={inProgress:!0,isValid:null,from:bu(Y,W,Xe.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:Y,to:T,toHandle:null,toPosition:Hj[W.position],toNode:null,pointer:T};function X(){A=!0,g(ne),y==null||y(e,{nodeId:s,handleId:r,handleType:_})}j===0&&X();function se(re){if(!A){const{x:He,y:Fe}=mr(re),Ye=He-F,ft=Fe-G;if(!(Ye*Ye+ft*ft>j*j))return;X()}if(!S()||!W){Ee(re);return}const xe=N();T=mr(re,I),U=Aq(Ku(T,xe,!1,[1,1]),n,c,W),O||($(),O=!0);const ye=SL(re,{handle:U,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:x,doc:L,lib:u,flowId:d,nodeLookup:c});M=ye.handleDomNode,q=ye.connection,k=_q(!!U,ye.isValid);const ze={...ne,isValid:k,to:ye.toHandle&&k?up({x:ye.toHandle.x,y:ye.toHandle.y},xe):T,toHandle:ye.toHandle,toPosition:k&&ye.toHandle?ye.toHandle.position:Hj[W.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:T};g(ze),ne=ze}function Ee(re){if(!("touches"in re&&re.touches.length>0)){if(A){(U||M)&&q&&k&&(b==null||b(q));const{inProgress:xe,...ye}=ne,ze={...ye,toPosition:ne.toHandle?ne.toPosition:null};w==null||w(re,ze),i&&(v==null||v(re,ze))}m(),cancelAnimationFrame(P),O=!1,k=!1,q=null,M=null,L.removeEventListener("mousemove",se),L.removeEventListener("mouseup",Ee),L.removeEventListener("touchmove",se),L.removeEventListener("touchend",Ee)}}L.addEventListener("mousemove",se),L.addEventListener("mouseup",Ee),L.addEventListener("touchmove",se),L.addEventListener("touchend",Ee)}function SL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=NL,nodeLookup:h}){const d=i==="target",f=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=mr(e),b=o.elementFromPoint(m,y),w=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:f,x={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const v=wL(void 0,w),g=w.getAttribute("data-nodeid"),N=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!g||!v)return x;const j={source:d?g:r,sourceHandle:d?N:s,target:d?r:g,targetHandle:d?s:N};x.connection=j;const L=S&&E&&(n===bc.Strict?d&&v==="source"||!d&&v==="target":g!==r||N!==s);x.isValid=L&&u(j),x.toHandle=yL(g,v,N,h,n,!0)}return x}const kN={onPointerDown:Rq,isValid:SL};function Oq({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=_a(e);function i({translateExtent:l,width:c,height:u,zoomStep:h=1,pannable:d=!0,zoomable:f=!0,inversePan:m=!1}){const y=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const N=n(),S=g.sourceEvent.ctrlKey&&xu()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*h,j=N[2]*Math.pow(2,E*S);t.scaleTo(j)};let b=[0,0];const w=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(b=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},x=g=>{const N=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const S=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[S[0]-b[0],S[1]-b[1]];b=S;const j=r()*Math.max(N[2],Math.log(N[2]))*(m?-1:1),R={x:N[0]-E[0]*j,y:N[1]-E[1]*j},L=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:N[2]},L,l)},v=KM().on("start",w).on("zoom",d?x:null).on("zoom.wheel",f?y:null);s.call(v,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:hr}}const am=e=>({x:e.x,y:e.y,zoom:e.k}),Ag=({x:e,y:t,zoom:n})=>em.translate(e,t).scale(n),Pl=(e,t)=>e.target.closest(`.${t}`),EL=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dq=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,_g=(e,t=0,n=Dq,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},jL=e=>{const t=e.ctrlKey&&xu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Iq({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return h=>{if(Pl(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(h.ctrlKey&&o){const w=hr(h),x=jL(h),v=d*Math.pow(2,x);r.scaleTo(n,v,w,h);return}const f=h.deltaMode===1?20:1;let m=s===Ro.Vertical?0:h.deltaX*f,y=s===Ro.Horizontal?0:h.deltaY*f;!xu()&&h.shiftKey&&s!==Ro.Vertical&&(m=h.deltaY*f,y=0),r.translateBy(n,-(m/d)*i,-(y/d)*i,{internal:!0});const b=am(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(h,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(h,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(h,b))}}function Mq({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=Pl(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function Lq({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=am(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Uq({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&EL(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,am(i.transform)))}}function Pq({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&EL(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=am(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function Fq({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:h}){return d=>{var w;const f=e||t,m=n&&d.ctrlKey,y=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Pl(d,`${u}-flow__node`)||Pl(d,`${u}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||o||h&&!y||Pl(d,l)&&y||Pl(d,c)&&(!y||s&&y&&!e)||!n&&d.ctrlKey&&y)return!1;if(!n&&d.type==="touchstart"&&((w=d.touches)==null?void 0:w.length)>1)return d.preventDefault(),!1;if(!f&&!s&&!m&&y||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||y)&&b}}function Bq({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),d=KM().scaleExtent([t,n]).translateExtent(r),f=_a(e).call(d);v({x:s.x,y:s.y,zoom:vc(s.zoom,t,n)},[[0,0],[h.width,h.height]],r);const m=f.on("wheel.zoom"),y=f.on("dblclick.zoom");d.wheelDelta(jL);function b(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).transform(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function w({noWheelClassName:U,noPanClassName:F,onPaneContextMenu:G,userSelectionActive:_,panOnScroll:I,panOnDrag:A,panOnScrollMode:C,panOnScrollSpeed:T,preventScrolling:O,zoomOnPinch:q,zoomOnScroll:k,zoomOnDoubleClick:M,zoomActivationKeyPressed:$,lib:W,onTransformChange:Y,connectionInProgress:te,paneClickDistance:ne,selectionOnDrag:X}){_&&!u.isZoomingOrPanning&&x();const se=I&&!$&&!_;d.clickDistance(X?1/0:!pr(ne)||ne<0?0:ne);const Ee=se?Iq({zoomPanValues:u,noWheelClassName:U,d3Selection:f,d3Zoom:d,panOnScrollMode:C,panOnScrollSpeed:T,zoomOnPinch:q,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):Mq({noWheelClassName:U,preventScrolling:O,d3ZoomHandler:m});if(f.on("wheel.zoom",Ee,{passive:!1}),!_){const xe=Lq({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});d.on("start",xe);const ye=Uq({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!G,onPanZoom:i,onTransformChange:Y});d.on("zoom",ye);const ze=Pq({zoomPanValues:u,panOnDrag:A,panOnScroll:I,onPaneContextMenu:G,onPanZoomEnd:l,onDraggingChange:c});d.on("end",ze)}const re=Fq({zoomActivationKeyPressed:$,panOnDrag:A,zoomOnScroll:k,panOnScroll:I,zoomOnDoubleClick:M,zoomOnPinch:q,userSelectionActive:_,noPanClassName:F,noWheelClassName:U,lib:W,connectionInProgress:te});d.filter(re),M?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function v(U,F,G){const _=Ag(U),I=d==null?void 0:d.constrain()(_,F,G);return I&&await b(I),new Promise(A=>A(I))}async function g(U,F){const G=Ag(U);return await b(G,F),new Promise(_=>_(G))}function N(U){if(f){const F=Ag(U),G=f.property("__zoom");(G.k!==U.zoom||G.x!==U.x||G.y!==U.y)&&(d==null||d.transform(f,F,null,{sync:!0}))}}function S(){const U=f?XM(f.node()):{x:0,y:0,k:1};return{x:U.x,y:U.y,zoom:U.k}}function E(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).scaleTo(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function j(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).scaleBy(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function R(U){d==null||d.scaleExtent(U)}function L(U){d==null||d.translateExtent(U)}function P(U){const F=!pr(U)||U<0?0:U;d==null||d.clickDistance(F)}return{update:w,destroy:x,setViewport:g,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:j,setScaleExtent:R,setTranslateExtent:L,syncViewport:N,setClickDistance:P}}var Nc;(function(e){e.Line="line",e.Handle="handle"})(Nc||(Nc={}));function zq({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function nT(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ii(e,t){return Math.max(0,t-e)}function oi(e,t){return Math.max(0,e-t)}function Dh(e,t,n){return Math.max(0,t-e,e-n)}function aT(e,t){return e?!t:t}function $q(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:h,isVertical:d}=t,f=h&&d,{xSnapped:m,ySnapped:y}=n,{minWidth:b,maxWidth:w,minHeight:x,maxHeight:v}=r,{x:g,y:N,width:S,height:E,aspectRatio:j}=e;let R=Math.floor(h?m-e.pointerX:0),L=Math.floor(d?y-e.pointerY:0);const P=S+(c?-R:R),U=E+(u?-L:L),F=-i[0]*S,G=-i[1]*E;let _=Dh(P,b,w),I=Dh(U,x,v);if(o){let T=0,O=0;c&&R<0?T=ii(g+R+F,o[0][0]):!c&&R>0&&(T=oi(g+P+F,o[1][0])),u&&L<0?O=ii(N+L+G,o[0][1]):!u&&L>0&&(O=oi(N+U+G,o[1][1])),_=Math.max(_,T),I=Math.max(I,O)}if(l){let T=0,O=0;c&&R>0?T=oi(g+R,l[0][0]):!c&&R<0&&(T=ii(g+P,l[1][0])),u&&L>0?O=oi(N+L,l[0][1]):!u&&L<0&&(O=ii(N+U,l[1][1])),_=Math.max(_,T),I=Math.max(I,O)}if(s){if(h){const T=Dh(P/j,x,v)*j;if(_=Math.max(_,T),o){let O=0;!c&&!u||c&&!u&&f?O=oi(N+G+P/j,o[1][1])*j:O=ii(N+G+(c?R:-R)/j,o[0][1])*j,_=Math.max(_,O)}if(l){let O=0;!c&&!u||c&&!u&&f?O=ii(N+P/j,l[1][1])*j:O=oi(N+(c?R:-R)/j,l[0][1])*j,_=Math.max(_,O)}}if(d){const T=Dh(U*j,b,w)/j;if(I=Math.max(I,T),o){let O=0;!c&&!u||u&&!c&&f?O=oi(g+U*j+F,o[1][0])/j:O=ii(g+(u?L:-L)*j+F,o[0][0])/j,I=Math.max(I,O)}if(l){let O=0;!c&&!u||u&&!c&&f?O=ii(g+U*j,l[1][0])/j:O=oi(g+(u?L:-L)*j,l[0][0])/j,I=Math.max(I,O)}}}L=L+(L<0?I:-I),R=R+(R<0?_:-_),s&&(f?P>U*j?L=(aT(c,u)?-R:R)/j:R=(aT(c,u)?-L:L)*j:h?(L=R/j,u=c):(R=L*j,c=u));const A=c?g+R:g,C=u?N+L:N;return{width:S+(c?-R:R),height:E+(u?-L:L),x:i[0]*R*(c?-1:1)+A,y:i[1]*L*(u?-1:1)+C}}const TL={width:0,height:0,x:0,y:0},Hq={...TL,pointerX:0,pointerY:0,aspectRatio:1};function qq(e){return[[0,0],[e.measured.width,e.measured.height]]}function Gq(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function Vq({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=_a(e);let o={controlDirection:nT("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:h,keepAspectRatio:d,resizeDirection:f,onResizeStart:m,onResize:y,onResizeEnd:b,shouldResize:w}){let x={...TL},v={...Hq};o={boundaries:h,resizeDirection:f,keepAspectRatio:d,controlDirection:nT(u)};let g,N=null,S=[],E,j,R,L=!1;const P=MM().on("start",U=>{const{nodeLookup:F,transform:G,snapGrid:_,snapToGrid:I,nodeOrigin:A,paneDomNode:C}=n();if(g=F.get(t),!g)return;N=(C==null?void 0:C.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:O}=Vd(U.sourceEvent,{transform:G,snapGrid:_,snapToGrid:I,containerBounds:N});x={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...x,pointerX:T,pointerY:O,aspectRatio:x.width/x.height},E=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=F.get(g.parentId),j=E&&g.extent==="parent"?qq(E):void 0),S=[],R=void 0;for(const[q,k]of F)if(k.parentId===t&&(S.push({id:q,position:{...k.position},extent:k.extent}),k.extent==="parent"||k.expandParent)){const M=Gq(k,g,k.origin??A);R?R=[[Math.min(M[0][0],R[0][0]),Math.min(M[0][1],R[0][1])],[Math.max(M[1][0],R[1][0]),Math.max(M[1][1],R[1][1])]]:R=M}m==null||m(U,{...x})}).on("drag",U=>{const{transform:F,snapGrid:G,snapToGrid:_,nodeOrigin:I}=n(),A=Vd(U.sourceEvent,{transform:F,snapGrid:G,snapToGrid:_,containerBounds:N}),C=[];if(!g)return;const{x:T,y:O,width:q,height:k}=x,M={},$=g.origin??I,{width:W,height:Y,x:te,y:ne}=$q(v,o.controlDirection,A,o.boundaries,o.keepAspectRatio,$,j,R),X=W!==q,se=Y!==k,Ee=te!==T&&X,re=ne!==O&&se;if(!Ee&&!re&&!X&&!se)return;if((Ee||re||$[0]===1||$[1]===1)&&(M.x=Ee?te:x.x,M.y=re?ne:x.y,x.x=M.x,x.y=M.y,S.length>0)){const He=te-T,Fe=ne-O;for(const Ye of S)Ye.position={x:Ye.position.x-He+$[0]*(W-q),y:Ye.position.y-Fe+$[1]*(Y-k)},C.push(Ye)}if((X||se)&&(M.width=X&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:x.width,M.height=se&&(!o.resizeDirection||o.resizeDirection==="vertical")?Y:x.height,x.width=M.width,x.height=M.height),E&&g.expandParent){const He=$[0]*(M.width??0);M.x&&M.x<He&&(x.x=He,v.x=v.x-(M.x-He));const Fe=$[1]*(M.height??0);M.y&&M.y<Fe&&(x.y=Fe,v.y=v.y-(M.y-Fe))}const xe=zq({width:x.width,prevWidth:q,height:x.height,prevHeight:k,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ye={...x,direction:xe};(w==null?void 0:w(U,ye))!==!1&&(L=!0,y==null||y(U,ye),r(M,C))}).on("end",U=>{L&&(b==null||b(U,{...x}),s==null||s({...x}),L=!1)});i.call(P)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var CL={exports:{}},kL={},AL={exports:{}},_L={};/**
76
+ */function fN(){return fN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fN.apply(this,arguments)}function O$(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function D$(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function I$(e,t){return e.button===0&&(!t||t==="_self")&&!D$(e)}function pN(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function M$(e,t){let n=pN(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}const L$=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],U$="6";try{window.__reactRouterVersion=U$}catch{}const P$="startTransition",wj=_p[P$];function F$(e){let{basename:t,children:n,future:r,window:s}=e,i=p.useRef();i.current==null&&(i.current=Bz({window:s,v5Compat:!0}));let o=i.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},h=p.useCallback(d=>{u&&wj?wj(()=>c(d)):c(d)},[c,u]);return p.useLayoutEffect(()=>o.listen(h),[o,h]),p.useEffect(()=>A$(r),[r]),p.createElement(R$,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const B$=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",z$=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tp=p.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:h,viewTransition:d}=t,f=O$(t,L$),{basename:m}=p.useContext(Ji),y,b=!1;if(typeof u=="string"&&z$.test(u)&&(y=u,B$))try{let g=new URL(window.location.href),N=u.startsWith("//")?new URL(g.protocol+u):new URL(u),S=nS(N.pathname,m);N.origin===g.origin&&S!=null?u=S+N.search+N.hash:b=!0}catch{}let w=p$(u,{relative:s}),x=$$(u,{replace:o,state:l,target:c,preventScrollReset:h,relative:s,viewTransition:d});function v(g){r&&r(g),g.defaultPrevented||x(g)}return p.createElement("a",fN({},f,{href:y||w,onClick:b||i?r:v,ref:n,target:c}))});var Nj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Nj||(Nj={}));var Sj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Sj||(Sj={}));function $$(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=ha(),u=eo(),h=gM(e,{relative:o});return p.useCallback(d=>{if(I$(d,n)){d.preventDefault();let f=r!==void 0?r:ep(u)===ep(h);c(e,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,h,r,s,n,e,i,o,l])}function yM(e){let t=p.useRef(pN(e)),n=p.useRef(!1),r=eo(),s=p.useMemo(()=>M$(r.search,n.current?null:t.current),[r.search]),i=ha(),o=p.useCallback((l,c)=>{const u=pN(typeof l=="function"?l(s):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}function H$(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const q$=e=>{switch(e){case"success":return Y$;case"info":return X$;case"warning":return W$;case"error":return K$;default:return null}},G$=Array(12).fill(0),V$=({visible:e,className:t})=>ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ee.createElement("div",{className:"sonner-spinner"},G$.map((n,r)=>ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Y$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),W$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),X$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),K$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Z$=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Q$=()=>{const[e,t]=ee.useState(document.hidden);return ee.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let mN=1;class J${constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:mN++,o=this.toasts.find(c=>c.id===i),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:r}),{...c,...t,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,o;const l=s.then(async u=>{if(o=["resolve",u],ee.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(t8(u)&&!u.ok){i=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...y})}else if(u instanceof Error){i=!1;const d=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...y})}else if(n.success!==void 0){i=!1;const d=typeof n.success=="function"?await n.success(u):n.success,f=typeof n.description=="function"?await n.description(u):n.description,y=typeof d=="object"&&!ee.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:f,...y})}}).catch(async u=>{if(o=["reject",u],n.error!==void 0){i=!1;const h=typeof n.error=="function"?await n.error(u):n.error,d=typeof n.description=="function"?await n.description(u):n.description,m=typeof h=="object"&&!ee.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:d,...m})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,h)=>l.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||mN++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const oa=new J$,e8=(e,t)=>{const n=(t==null?void 0:t.id)||mN++;return oa.addToast({title:e,...t,id:n}),n},t8=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",n8=e8,a8=()=>oa.toasts,r8=()=>oa.getActiveToasts(),V=Object.assign(n8,{success:oa.success,info:oa.info,warning:oa.warning,error:oa.error,custom:oa.custom,message:oa.message,promise:oa.promise,dismiss:oa.dismiss,loading:oa.loading},{getHistory:a8,getToasts:r8});H$("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Th(e){return e.label!==void 0}const s8=3,i8="24px",o8="16px",Ej=4e3,l8=356,c8=14,d8=45,u8=200;function Rr(...e){return e.filter(Boolean).join(" ")}function h8(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const f8=e=>{var t,n,r,s,i,o,l,c,u;const{invert:h,toast:d,unstyled:f,interacting:m,setHeights:y,visibleToasts:b,heights:w,index:x,toasts:v,expanded:g,removeToast:N,defaultRichColors:S,closeButton:E,style:j,cancelButtonStyle:R,actionButtonStyle:L,className:P="",descriptionClassName:U="",duration:F,position:G,gap:_,expandByDefault:I,classNames:A,icons:C,closeButtonAriaLabel:T="Close toast"}=e,[O,q]=ee.useState(null),[k,M]=ee.useState(null),[$,W]=ee.useState(!1),[Y,te]=ee.useState(!1),[ne,X]=ee.useState(!1),[se,Ee]=ee.useState(!1),[re,xe]=ee.useState(!1),[ye,ze]=ee.useState(0),[He,Fe]=ee.useState(0),Ye=ee.useRef(d.duration||F||Ej),ft=ee.useRef(null),et=ee.useRef(null),de=x===0,Be=x+1<=b,Ue=d.type,Oe=d.dismissible!==!1,We=d.className||"",nt=d.descriptionClassName||"",lt=ee.useMemo(()=>w.findIndex(he=>he.toastId===d.id)||0,[w,d.id]),Ut=ee.useMemo(()=>{var he;return(he=d.closeButton)!=null?he:E},[d.closeButton,E]),Kt=ee.useMemo(()=>d.duration||F||Ej,[d.duration,F]),Gt=ee.useRef(0),_t=ee.useRef(0),ce=ee.useRef(0),Te=ee.useRef(null),[Ze,K]=G.split("-"),pe=ee.useMemo(()=>w.reduce((he,Q,oe)=>oe>=lt?he:he+Q.height,0),[w,lt]),be=Q$(),_e=d.invert||h,$e=Ue==="loading";_t.current=ee.useMemo(()=>lt*_+pe,[lt,pe]),ee.useEffect(()=>{Ye.current=Kt},[Kt]),ee.useEffect(()=>{W(!0)},[]),ee.useEffect(()=>{const he=et.current;if(he){const Q=he.getBoundingClientRect().height;return Fe(Q),y(oe=>[{toastId:d.id,height:Q,position:d.position},...oe]),()=>y(oe=>oe.filter(De=>De.toastId!==d.id))}},[y,d.id]),ee.useLayoutEffect(()=>{if(!$)return;const he=et.current,Q=he.style.height;he.style.height="auto";const oe=he.getBoundingClientRect().height;he.style.height=Q,Fe(oe),y(De=>De.find(tt=>tt.toastId===d.id)?De.map(tt=>tt.toastId===d.id?{...tt,height:oe}:tt):[{toastId:d.id,height:oe,position:d.position},...De])},[$,d.title,d.description,y,d.id,d.jsx,d.action,d.cancel]);const je=ee.useCallback(()=>{te(!0),ze(_t.current),y(he=>he.filter(Q=>Q.toastId!==d.id)),setTimeout(()=>{N(d)},u8)},[d,N,y,_t]);ee.useEffect(()=>{if(d.promise&&Ue==="loading"||d.duration===1/0||d.type==="loading")return;let he;return g||m||be?(()=>{if(ce.current<Gt.current){const De=new Date().getTime()-Gt.current;Ye.current=Ye.current-De}ce.current=new Date().getTime()})():(()=>{Ye.current!==1/0&&(Gt.current=new Date().getTime(),he=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),je()},Ye.current))})(),()=>clearTimeout(he)},[g,m,d,Ue,be,je]),ee.useEffect(()=>{d.delete&&(je(),d.onDismiss==null||d.onDismiss.call(d,d))},[je,d.delete]);function Z(){var he;if(C!=null&&C.loading){var Q;return ee.createElement("div",{className:Rr(A==null?void 0:A.loader,d==null||(Q=d.classNames)==null?void 0:Q.loader,"sonner-loader"),"data-visible":Ue==="loading"},C.loading)}return ee.createElement(V$,{className:Rr(A==null?void 0:A.loader,d==null||(he=d.classNames)==null?void 0:he.loader),visible:Ue==="loading"})}const ue=d.icon||(C==null?void 0:C[Ue])||q$(Ue);var Ae,Le;return ee.createElement("li",{tabIndex:0,ref:et,className:Rr(P,We,A==null?void 0:A.toast,d==null||(t=d.classNames)==null?void 0:t.toast,A==null?void 0:A.default,A==null?void 0:A[Ue],d==null||(n=d.classNames)==null?void 0:n[Ue]),"data-sonner-toast":"","data-rich-colors":(Ae=d.richColors)!=null?Ae:S,"data-styled":!(d.jsx||d.unstyled||f),"data-mounted":$,"data-promise":!!d.promise,"data-swiped":re,"data-removed":Y,"data-visible":Be,"data-y-position":Ze,"data-x-position":K,"data-index":x,"data-front":de,"data-swiping":ne,"data-dismissible":Oe,"data-type":Ue,"data-invert":_e,"data-swipe-out":se,"data-swipe-direction":k,"data-expanded":!!(g||I&&$),"data-testid":d.testId,style:{"--index":x,"--toasts-before":x,"--z-index":v.length-x,"--offset":`${Y?ye:_t.current}px`,"--initial-height":I?"auto":`${He}px`,...j,...d.style},onDragEnd:()=>{X(!1),q(null),Te.current=null},onPointerDown:he=>{he.button!==2&&($e||!Oe||(ft.current=new Date,ze(_t.current),he.target.setPointerCapture(he.pointerId),he.target.tagName!=="BUTTON"&&(X(!0),Te.current={x:he.clientX,y:he.clientY})))},onPointerUp:()=>{var he,Q,oe;if(se||!Oe)return;Te.current=null;const De=Number(((he=et.current)==null?void 0:he.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),it=Number(((Q=et.current)==null?void 0:Q.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),tt=new Date().getTime()-((oe=ft.current)==null?void 0:oe.getTime()),at=O==="x"?De:it,It=Math.abs(at)/tt;if(Math.abs(at)>=d8||It>.11){ze(_t.current),d.onDismiss==null||d.onDismiss.call(d,d),M(O==="x"?De>0?"right":"left":it>0?"down":"up"),je(),Ee(!0);return}else{var wn,sn;(wn=et.current)==null||wn.style.setProperty("--swipe-amount-x","0px"),(sn=et.current)==null||sn.style.setProperty("--swipe-amount-y","0px")}xe(!1),X(!1),q(null)},onPointerMove:he=>{var Q,oe,De;if(!Te.current||!Oe||((Q=window.getSelection())==null?void 0:Q.toString().length)>0)return;const tt=he.clientY-Te.current.y,at=he.clientX-Te.current.x;var It;const wn=(It=e.swipeDirections)!=null?It:h8(G);!O&&(Math.abs(at)>1||Math.abs(tt)>1)&&q(Math.abs(at)>Math.abs(tt)?"x":"y");let sn={x:0,y:0};const ns=In=>1/(1.5+Math.abs(In)/20);if(O==="y"){if(wn.includes("top")||wn.includes("bottom"))if(wn.includes("top")&&tt<0||wn.includes("bottom")&&tt>0)sn.y=tt;else{const In=tt*ns(tt);sn.y=Math.abs(In)<Math.abs(tt)?In:tt}}else if(O==="x"&&(wn.includes("left")||wn.includes("right")))if(wn.includes("left")&&at<0||wn.includes("right")&&at>0)sn.x=at;else{const In=at*ns(at);sn.x=Math.abs(In)<Math.abs(at)?In:at}(Math.abs(sn.x)>0||Math.abs(sn.y)>0)&&xe(!0),(oe=et.current)==null||oe.style.setProperty("--swipe-amount-x",`${sn.x}px`),(De=et.current)==null||De.style.setProperty("--swipe-amount-y",`${sn.y}px`)}},Ut&&!d.jsx&&Ue!=="loading"?ee.createElement("button",{"aria-label":T,"data-disabled":$e,"data-close-button":!0,onClick:$e||!Oe?()=>{}:()=>{je(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Rr(A==null?void 0:A.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Le=C==null?void 0:C.close)!=null?Le:Z$):null,(Ue||d.icon||d.promise)&&d.icon!==null&&((C==null?void 0:C[Ue])!==null||d.icon)?ee.createElement("div",{"data-icon":"",className:Rr(A==null?void 0:A.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Z():null,d.type!=="loading"?ue:null):null,ee.createElement("div",{"data-content":"",className:Rr(A==null?void 0:A.content,d==null||(i=d.classNames)==null?void 0:i.content)},ee.createElement("div",{"data-title":"",className:Rr(A==null?void 0:A.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?ee.createElement("div",{"data-description":"",className:Rr(U,nt,A==null?void 0:A.description,d==null||(l=d.classNames)==null?void 0:l.description)},typeof d.description=="function"?d.description():d.description):null),ee.isValidElement(d.cancel)?d.cancel:d.cancel&&Th(d.cancel)?ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||R,onClick:he=>{Th(d.cancel)&&Oe&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,he),je())},className:Rr(A==null?void 0:A.cancelButton,d==null||(c=d.classNames)==null?void 0:c.cancelButton)},d.cancel.label):null,ee.isValidElement(d.action)?d.action:d.action&&Th(d.action)?ee.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||L,onClick:he=>{Th(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,he),!he.defaultPrevented&&je())},className:Rr(A==null?void 0:A.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function jj(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function p8(e,t){const n={};return[e,t].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",l=i?o8:i8;function c(u){["top","right","bottom","left"].forEach(h=>{n[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}const m8=ee.forwardRef(function(t,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:h,mobileOffset:d,theme:f="light",richColors:m,duration:y,style:b,visibleToasts:w=s8,toastOptions:x,dir:v=jj(),gap:g=c8,icons:N,containerAriaLabel:S="Notifications"}=t,[E,j]=ee.useState([]),R=ee.useMemo(()=>r?E.filter($=>$.toasterId===r):E.filter($=>!$.toasterId),[E,r]),L=ee.useMemo(()=>Array.from(new Set([i].concat(R.filter($=>$.position).map($=>$.position)))),[R,i]),[P,U]=ee.useState([]),[F,G]=ee.useState(!1),[_,I]=ee.useState(!1),[A,C]=ee.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=ee.useRef(null),O=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=ee.useRef(null),k=ee.useRef(!1),M=ee.useCallback($=>{j(W=>{var Y;return(Y=W.find(te=>te.id===$.id))!=null&&Y.delete||oa.dismiss($.id),W.filter(({id:te})=>te!==$.id)})},[]);return ee.useEffect(()=>oa.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{j(W=>W.map(Y=>Y.id===$.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{A4.flushSync(()=>{j(W=>{const Y=W.findIndex(te=>te.id===$.id);return Y!==-1?[...W.slice(0,Y),{...W[Y],...$},...W.slice(Y+1)]:[$,...W]})})})}),[E]),ee.useEffect(()=>{if(f!=="system"){C(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?C("dark"):C("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:W})=>{C(W?"dark":"light")})}catch{$.addListener(({matches:Y})=>{try{C(Y?"dark":"light")}catch(te){console.error(te)}})}},[f]),ee.useEffect(()=>{E.length<=1&&G(!1)},[E]),ee.useEffect(()=>{const $=W=>{var Y;if(o.every(X=>W[X]||W.code===X)){var ne;G(!0),(ne=T.current)==null||ne.focus()}W.code==="Escape"&&(document.activeElement===T.current||(Y=T.current)!=null&&Y.contains(document.activeElement))&&G(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[o]),ee.useEffect(()=>{if(T.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,k.current=!1)}},[T.current]),ee.createElement("section",{ref:n,"aria-label":`${S} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map(($,W)=>{var Y;const[te,ne]=$.split("-");return R.length?ee.createElement("ol",{key:$,dir:v==="auto"?jj():v,tabIndex:-1,ref:T,className:u,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":te,"data-x-position":ne,style:{"--front-toast-height":`${((Y=P[0])==null?void 0:Y.height)||0}px`,"--width":`${l8}px`,"--gap":`${g}px`,...b,...p8(h,d)},onBlur:X=>{k.current&&!X.currentTarget.contains(X.relatedTarget)&&(k.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||k.current||(k.current=!0,q.current=X.relatedTarget)},onMouseEnter:()=>G(!0),onMouseMove:()=>G(!0),onMouseLeave:()=>{_||G(!1)},onDragEnd:()=>G(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},R.filter(X=>!X.position&&W===0||X.position===$).map((X,se)=>{var Ee,re;return ee.createElement(f8,{key:X.id,icons:N,index:se,toast:X,defaultRichColors:m,duration:(Ee=x==null?void 0:x.duration)!=null?Ee:y,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:s,visibleToasts:w,closeButton:(re=x==null?void 0:x.closeButton)!=null?re:c,interacting:_,position:$,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,closeButtonAriaLabel:x==null?void 0:x.closeButtonAriaLabel,removeToast:M,toasts:R.filter(xe=>xe.position==X.position),heights:P.filter(xe=>xe.position==X.position),setHeights:U,expandByDefault:l,gap:g,expanded:F,swipeDirections:t.swipeDirections})})):null}))});function yn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=yn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var g8={value:()=>{}};function Kp(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new df(n)}function df(e){this._=e}function x8(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}df.prototype=Kp.prototype={constructor:df,on:function(e,t){var n=this._,r=x8(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=b8(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=Tj(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Tj(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new df(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function b8(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function Tj(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=g8,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gN="http://www.w3.org/1999/xhtml";const Cj={svg:"http://www.w3.org/2000/svg",xhtml:gN,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zp(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Cj.hasOwnProperty(t)?{space:Cj[t],local:e}:e}function v8(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gN&&t.documentElement.namespaceURI===gN?t.createElement(e):t.createElementNS(n,e)}}function y8(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wM(e){var t=Zp(e);return(t.local?y8:v8)(t)}function w8(){}function oS(e){return e==null?w8:function(){return this.querySelector(e)}}function N8(e){typeof e!="function"&&(e=oS(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=new Array(o),c,u,h=0;h<o;++h)(c=i[h])&&(u=e.call(c,c.__data__,h,i))&&("__data__"in c&&(u.__data__=c.__data__),l[h]=u);return new Ua(r,this._parents)}function S8(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function E8(){return[]}function NM(e){return e==null?E8:function(){return this.querySelectorAll(e)}}function j8(e){return function(){return S8(e.apply(this,arguments))}}function T8(e){typeof e=="function"?e=j8(e):e=NM(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Ua(r,s)}function SM(e){return function(){return this.matches(e)}}function EM(e){return function(t){return t.matches(e)}}var C8=Array.prototype.find;function k8(e){return function(){return C8.call(this.children,e)}}function A8(){return this.firstElementChild}function _8(e){return this.select(e==null?A8:k8(typeof e=="function"?e:EM(e)))}var R8=Array.prototype.filter;function O8(){return Array.from(this.children)}function D8(e){return function(){return R8.call(this.children,e)}}function I8(e){return this.selectAll(e==null?O8:D8(typeof e=="function"?e:EM(e)))}function M8(e){typeof e!="function"&&(e=SM(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Ua(r,this._parents)}function jM(e){return new Array(e.length)}function L8(){return new Ua(this._enter||this._groups.map(jM),this._parents)}function np(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}np.prototype={constructor:np,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function U8(e){return function(){return e}}function P8(e,t,n,r,s,i){for(var o=0,l,c=t.length,u=i.length;o<u;++o)(l=t[o])?(l.__data__=i[o],r[o]=l):n[o]=new np(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function F8(e,t,n,r,s,i,o){var l,c,u=new Map,h=t.length,d=i.length,f=new Array(h),m;for(l=0;l<h;++l)(c=t[l])&&(f[l]=m=o.call(c,c.__data__,l,t)+"",u.has(m)?s[l]=c:u.set(m,c));for(l=0;l<d;++l)m=o.call(e,i[l],l,i)+"",(c=u.get(m))?(r[l]=c,c.__data__=i[l],u.delete(m)):n[l]=new np(e,i[l]);for(l=0;l<h;++l)(c=t[l])&&u.get(f[l])===c&&(s[l]=c)}function B8(e){return e.__data__}function z8(e,t){if(!arguments.length)return Array.from(this,B8);var n=t?F8:P8,r=this._parents,s=this._groups;typeof e!="function"&&(e=U8(e));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var h=r[u],d=s[u],f=d.length,m=$8(e.call(h,h&&h.__data__,u,r)),y=m.length,b=l[u]=new Array(y),w=o[u]=new Array(y),x=c[u]=new Array(f);n(h,d,b,w,x,m,t);for(var v=0,g=0,N,S;v<y;++v)if(N=b[v]){for(v>=g&&(g=v+1);!(S=w[g])&&++g<y;);N._next=S||null}}return o=new Ua(o,r),o._enter=l,o._exit=c,o}function $8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function H8(){return new Ua(this._exit||this._groups.map(jM),this._parents)}function q8(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function G8(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var u=n[c],h=r[c],d=u.length,f=l[c]=new Array(d),m,y=0;y<d;++y)(m=u[y]||h[y])&&(f[y]=m);for(;c<s;++c)l[c]=n[c];return new Ua(l,this._parents)}function V8(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function Y8(e){e||(e=W8);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),u,h=0;h<l;++h)(u=o[h])&&(c[h]=u);c.sort(t)}return new Ua(s,this._parents).order()}function W8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function X8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K8(){return Array.from(this)}function Z8(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function Q8(){let e=0;for(const t of this)++e;return e}function J8(){return!this.node()}function e9(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function t9(e){return function(){this.removeAttribute(e)}}function n9(e){return function(){this.removeAttributeNS(e.space,e.local)}}function a9(e,t){return function(){this.setAttribute(e,t)}}function r9(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function s9(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function i9(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function o9(e,t){var n=Zp(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?n9:t9:typeof t=="function"?n.local?i9:s9:n.local?r9:a9)(n,t))}function TM(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l9(e){return function(){this.style.removeProperty(e)}}function c9(e,t,n){return function(){this.style.setProperty(e,t,n)}}function d9(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function u9(e,t,n){return arguments.length>1?this.each((t==null?l9:typeof t=="function"?d9:c9)(e,t,n??"")):gc(this.node(),e)}function gc(e,t){return e.style.getPropertyValue(t)||TM(e).getComputedStyle(e,null).getPropertyValue(t)}function h9(e){return function(){delete this[e]}}function f9(e,t){return function(){this[e]=t}}function p9(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function m9(e,t){return arguments.length>1?this.each((t==null?h9:typeof t=="function"?p9:f9)(e,t)):this.node()[e]}function CM(e){return e.trim().split(/^|\s+/)}function lS(e){return e.classList||new kM(e)}function kM(e){this._node=e,this._names=CM(e.getAttribute("class")||"")}kM.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function AM(e,t){for(var n=lS(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function _M(e,t){for(var n=lS(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function g9(e){return function(){AM(this,e)}}function x9(e){return function(){_M(this,e)}}function b9(e,t){return function(){(t.apply(this,arguments)?AM:_M)(this,e)}}function v9(e,t){var n=CM(e+"");if(arguments.length<2){for(var r=lS(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?b9:t?g9:x9)(n,t))}function y9(){this.textContent=""}function w9(e){return function(){this.textContent=e}}function N9(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function S9(e){return arguments.length?this.each(e==null?y9:(typeof e=="function"?N9:w9)(e)):this.node().textContent}function E9(){this.innerHTML=""}function j9(e){return function(){this.innerHTML=e}}function T9(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function C9(e){return arguments.length?this.each(e==null?E9:(typeof e=="function"?T9:j9)(e)):this.node().innerHTML}function k9(){this.nextSibling&&this.parentNode.appendChild(this)}function A9(){return this.each(k9)}function _9(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R9(){return this.each(_9)}function O9(e){var t=typeof e=="function"?e:wM(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function D9(){return null}function I9(e,t){var n=typeof e=="function"?e:wM(e),r=t==null?D9:typeof t=="function"?t:oS(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function M9(){var e=this.parentNode;e&&e.removeChild(this)}function L9(){return this.each(M9)}function U9(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P9(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function F9(e){return this.select(e?P9:U9)}function B9(e){return arguments.length?this.property("__data__",e):this.node().__data__}function z9(e){return function(t){e.call(this,t,this.__data__)}}function $9(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function H9(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function q9(e,t,n){return function(){var r=this.__on,s,i=z9(t);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function G9(e,t,n){var r=$9(e+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,h;c<u;++c)for(s=0,h=l[c];s<i;++s)if((o=r[s]).type===h.type&&o.name===h.name)return h.value}return}for(l=t?q9:H9,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function RM(e,t,n){var r=TM(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function V9(e,t){return function(){return RM(this,e,t)}}function Y9(e,t){return function(){return RM(this,e,t.apply(this,arguments))}}function W9(e,t){return this.each((typeof t=="function"?Y9:V9)(e,t))}function*X9(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var OM=[null];function Ua(e,t){this._groups=e,this._parents=t}function Gu(){return new Ua([[document.documentElement]],OM)}function K9(){return this}Ua.prototype=Gu.prototype={constructor:Ua,select:N8,selectAll:T8,selectChild:_8,selectChildren:I8,filter:M8,data:z8,enter:L8,exit:H8,join:q8,merge:G8,selection:K9,order:V8,sort:Y8,call:X8,nodes:K8,node:Z8,size:Q8,empty:J8,each:e9,attr:o9,style:u9,property:m9,classed:v9,text:S9,html:C9,raise:A9,lower:R9,append:O9,insert:I9,remove:L9,clone:F9,datum:B9,on:G9,dispatch:W9,[Symbol.iterator]:X9};function _a(e){return typeof e=="string"?new Ua([[document.querySelector(e)]],[document.documentElement]):new Ua([[e]],OM)}function Z9(e){let t;for(;t=e.sourceEvent;)e=t;return e}function hr(e,t){if(e=Z9(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Q9={passive:!1},du={capture:!0,passive:!1};function Eg(e){e.stopImmediatePropagation()}function Zl(e){e.preventDefault(),e.stopImmediatePropagation()}function DM(e){var t=e.document.documentElement,n=_a(e).on("dragstart.drag",Zl,du);"onselectstart"in t?n.on("selectstart.drag",Zl,du):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function IM(e,t){var n=e.document.documentElement,r=_a(e).on("dragstart.drag",null);t&&(r.on("click.drag",Zl,du),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ch=e=>()=>e;function xN(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:u,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:h}})}xN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function J9(e){return!e.ctrlKey&&!e.button}function eH(){return this.parentNode}function tH(e,t){return t??{x:e.x,y:e.y}}function nH(){return navigator.maxTouchPoints||"ontouchstart"in this}function MM(){var e=J9,t=eH,n=tH,r=nH,s={},i=Kp("start","drag","end"),o=0,l,c,u,h,d=0;function f(N){N.on("mousedown.drag",m).filter(r).on("touchstart.drag",w).on("touchmove.drag",x,Q9).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,S){if(!(h||!e.call(this,N,S))){var E=g(this,t.call(this,N,S),N,S,"mouse");E&&(_a(N.view).on("mousemove.drag",y,du).on("mouseup.drag",b,du),DM(N.view),Eg(N),u=!1,l=N.clientX,c=N.clientY,E("start",N))}}function y(N){if(Zl(N),!u){var S=N.clientX-l,E=N.clientY-c;u=S*S+E*E>d}s.mouse("drag",N)}function b(N){_a(N.view).on("mousemove.drag mouseup.drag",null),IM(N.view,u),Zl(N),s.mouse("end",N)}function w(N,S){if(e.call(this,N,S)){var E=N.changedTouches,j=t.call(this,N,S),R=E.length,L,P;for(L=0;L<R;++L)(P=g(this,j,N,S,E[L].identifier,E[L]))&&(Eg(N),P("start",N,E[L]))}}function x(N){var S=N.changedTouches,E=S.length,j,R;for(j=0;j<E;++j)(R=s[S[j].identifier])&&(Zl(N),R("drag",N,S[j]))}function v(N){var S=N.changedTouches,E=S.length,j,R;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),j=0;j<E;++j)(R=s[S[j].identifier])&&(Eg(N),R("end",N,S[j]))}function g(N,S,E,j,R,L){var P=i.copy(),U=hr(L||E,S),F,G,_;if((_=n.call(N,new xN("beforestart",{sourceEvent:E,target:f,identifier:R,active:o,x:U[0],y:U[1],dx:0,dy:0,dispatch:P}),j))!=null)return F=_.x-U[0]||0,G=_.y-U[1]||0,function I(A,C,T){var O=U,q;switch(A){case"start":s[R]=I,q=o++;break;case"end":delete s[R],--o;case"drag":U=hr(T||C,S),q=o;break}P.call(A,N,new xN(A,{sourceEvent:C,subject:_,target:f,identifier:R,active:q,x:U[0]+F,y:U[1]+G,dx:U[0]-O[0],dy:U[1]-O[1],dispatch:P}),j)}}return f.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Ch(!!N),f):e},f.container=function(N){return arguments.length?(t=typeof N=="function"?N:Ch(N),f):t},f.subject=function(N){return arguments.length?(n=typeof N=="function"?N:Ch(N),f):n},f.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:Ch(!!N),f):r},f.on=function(){var N=i.on.apply(i,arguments);return N===i?f:N},f.clickDistance=function(N){return arguments.length?(d=(N=+N)*N,f):Math.sqrt(d)},f}function cS(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function LM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Vu(){}var uu=.7,ap=1/uu,Ql="\\s*([+-]?\\d+)\\s*",hu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aH=/^#([0-9a-f]{3,8})$/,rH=new RegExp(`^rgb\\(${Ql},${Ql},${Ql}\\)$`),sH=new RegExp(`^rgb\\(${Gr},${Gr},${Gr}\\)$`),iH=new RegExp(`^rgba\\(${Ql},${Ql},${Ql},${hu}\\)$`),oH=new RegExp(`^rgba\\(${Gr},${Gr},${Gr},${hu}\\)$`),lH=new RegExp(`^hsl\\(${hu},${Gr},${Gr}\\)$`),cH=new RegExp(`^hsla\\(${hu},${Gr},${Gr},${hu}\\)$`),kj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cS(Vu,Po,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Aj,formatHex:Aj,formatHex8:dH,formatHsl:uH,formatRgb:_j,toString:_j});function Aj(){return this.rgb().formatHex()}function dH(){return this.rgb().formatHex8()}function uH(){return UM(this).formatHsl()}function _j(){return this.rgb().formatRgb()}function Po(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=aH.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Rj(t):n===3?new ca(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rH.exec(e))?new ca(t[1],t[2],t[3],1):(t=sH.exec(e))?new ca(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iH.exec(e))?kh(t[1],t[2],t[3],t[4]):(t=oH.exec(e))?kh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lH.exec(e))?Ij(t[1],t[2]/100,t[3]/100,1):(t=cH.exec(e))?Ij(t[1],t[2]/100,t[3]/100,t[4]):kj.hasOwnProperty(e)?Rj(kj[e]):e==="transparent"?new ca(NaN,NaN,NaN,0):null}function Rj(e){return new ca(e>>16&255,e>>8&255,e&255,1)}function kh(e,t,n,r){return r<=0&&(e=t=n=NaN),new ca(e,t,n,r)}function hH(e){return e instanceof Vu||(e=Po(e)),e?(e=e.rgb(),new ca(e.r,e.g,e.b,e.opacity)):new ca}function bN(e,t,n,r){return arguments.length===1?hH(e):new ca(e,t,n,r??1)}function ca(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cS(ca,bN,LM(Vu,{brighter(e){return e=e==null?ap:Math.pow(ap,e),new ca(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?uu:Math.pow(uu,e),new ca(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ca(_o(this.r),_o(this.g),_o(this.b),rp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Oj,formatHex:Oj,formatHex8:fH,formatRgb:Dj,toString:Dj}));function Oj(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}`}function fH(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}${yo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dj(){const e=rp(this.opacity);return`${e===1?"rgb(":"rgba("}${_o(this.r)}, ${_o(this.g)}, ${_o(this.b)}${e===1?")":`, ${e})`}`}function rp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _o(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function yo(e){return e=_o(e),(e<16?"0":"")+e.toString(16)}function Ij(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fr(e,t,n,r)}function UM(e){if(e instanceof fr)return new fr(e.h,e.s,e.l,e.opacity);if(e instanceof Vu||(e=Po(e)),!e)return new fr;if(e instanceof fr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new fr(o,l,c,e.opacity)}function pH(e,t,n,r){return arguments.length===1?UM(e):new fr(e,t,n,r??1)}function fr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cS(fr,pH,LM(Vu,{brighter(e){return e=e==null?ap:Math.pow(ap,e),new fr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uu:Math.pow(uu,e),new fr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ca(jg(e>=240?e-240:e+120,s,r),jg(e,s,r),jg(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new fr(Mj(this.h),Ah(this.s),Ah(this.l),rp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=rp(this.opacity);return`${e===1?"hsl(":"hsla("}${Mj(this.h)}, ${Ah(this.s)*100}%, ${Ah(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mj(e){return e=(e||0)%360,e<0?e+360:e}function Ah(e){return Math.max(0,Math.min(1,e||0))}function jg(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const dS=e=>()=>e;function mH(e,t){return function(n){return e+n*t}}function gH(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function xH(e){return(e=+e)==1?PM:function(t,n){return n-t?gH(t,n,e):dS(isNaN(t)?n:t)}}function PM(e,t){var n=t-e;return n?mH(e,n):dS(isNaN(e)?t:e)}const sp=function e(t){var n=xH(t);function r(s,i){var o=n((s=bN(s)).r,(i=bN(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=PM(s.opacity,i.opacity);return function(h){return s.r=o(h),s.g=l(h),s.b=c(h),s.opacity=u(h),s+""}}return r.gamma=e,r}(1);function bH(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function vH(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yH(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Gd(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function wH(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Lr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function NH(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Gd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var vN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tg=new RegExp(vN.source,"g");function SH(e){return function(){return e}}function EH(e){return function(t){return e(t)+""}}function FM(e,t){var n=vN.lastIndex=Tg.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=vN.exec(e))&&(s=Tg.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Lr(r,s)})),n=Tg.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?EH(c[0].x):SH(t):(t=c.length,function(u){for(var h=0,d;h<t;++h)l[(d=c[h]).i]=d.x(u);return l.join("")})}function Gd(e,t){var n=typeof t,r;return t==null||n==="boolean"?dS(t):(n==="number"?Lr:n==="string"?(r=Po(t))?(t=r,sp):FM:t instanceof Po?sp:t instanceof Date?wH:vH(t)?bH:Array.isArray(t)?yH:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?NH:Lr)(e,t)}var Lj=180/Math.PI,yN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function BM(e,t,n,r,s,i){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*Lj,skewX:Math.atan(c)*Lj,scaleX:o,scaleY:l}}var _h;function jH(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?yN:BM(t.a,t.b,t.c,t.d,t.e,t.f)}function TH(e){return e==null||(_h||(_h=document.createElementNS("http://www.w3.org/2000/svg","g")),_h.setAttribute("transform",e),!(e=_h.transform.baseVal.consolidate()))?yN:(e=e.matrix,BM(e.a,e.b,e.c,e.d,e.e,e.f))}function zM(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,h,d,f,m,y){if(u!==d||h!==f){var b=m.push("translate(",null,t,null,n);y.push({i:b-4,x:Lr(u,d)},{i:b-2,x:Lr(h,f)})}else(d||f)&&m.push("translate("+d+t+f+n)}function o(u,h,d,f){u!==h?(u-h>180?h+=360:h-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,r)-2,x:Lr(u,h)})):h&&d.push(s(d)+"rotate("+h+r)}function l(u,h,d,f){u!==h?f.push({i:d.push(s(d)+"skewX(",null,r)-2,x:Lr(u,h)}):h&&d.push(s(d)+"skewX("+h+r)}function c(u,h,d,f,m,y){if(u!==d||h!==f){var b=m.push(s(m)+"scale(",null,",",null,")");y.push({i:b-4,x:Lr(u,d)},{i:b-2,x:Lr(h,f)})}else(d!==1||f!==1)&&m.push(s(m)+"scale("+d+","+f+")")}return function(u,h){var d=[],f=[];return u=e(u),h=e(h),i(u.translateX,u.translateY,h.translateX,h.translateY,d,f),o(u.rotate,h.rotate,d,f),l(u.skewX,h.skewX,d,f),c(u.scaleX,u.scaleY,h.scaleX,h.scaleY,d,f),u=h=null,function(m){for(var y=-1,b=f.length,w;++y<b;)d[(w=f[y]).i]=w.x(m);return d.join("")}}}var CH=zM(jH,"px, ","px)","deg)"),kH=zM(TH,", ",")",")"),AH=1e-12;function Uj(e){return((e=Math.exp(e))+1/e)/2}function _H(e){return((e=Math.exp(e))-1/e)/2}function RH(e){return((e=Math.exp(2*e))-1)/(e+1)}const uf=function e(t,n,r){function s(i,o){var l=i[0],c=i[1],u=i[2],h=o[0],d=o[1],f=o[2],m=h-l,y=d-c,b=m*m+y*y,w,x;if(b<AH)x=Math.log(f/u)/t,w=function(j){return[l+j*m,c+j*y,u*Math.exp(t*j*x)]};else{var v=Math.sqrt(b),g=(f*f-u*u+r*b)/(2*u*n*v),N=(f*f-u*u-r*b)/(2*f*n*v),S=Math.log(Math.sqrt(g*g+1)-g),E=Math.log(Math.sqrt(N*N+1)-N);x=(E-S)/t,w=function(j){var R=j*x,L=Uj(S),P=u/(n*v)*(L*RH(t*R+S)-_H(S));return[l+P*m,c+P*y,u*L/Uj(t*R+S)]}}return w.duration=x*1e3*t/Math.SQRT2,w}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return e(o,l,c)},s}(Math.SQRT2,2,4);var xc=0,Ed=0,sd=0,$M=1e3,ip,jd,op=0,Fo=0,Qp=0,fu=typeof performance=="object"&&performance.now?performance:Date,HM=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function uS(){return Fo||(HM(OH),Fo=fu.now()+Qp)}function OH(){Fo=0}function lp(){this._call=this._time=this._next=null}lp.prototype=qM.prototype={constructor:lp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?uS():+n)+(t==null?0:+t),!this._next&&jd!==this&&(jd?jd._next=this:ip=this,jd=this),this._call=e,this._time=n,wN()},stop:function(){this._call&&(this._call=null,this._time=1/0,wN())}};function qM(e,t,n){var r=new lp;return r.restart(e,t,n),r}function DH(){uS(),++xc;for(var e=ip,t;e;)(t=Fo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xc}function Pj(){Fo=(op=fu.now())+Qp,xc=Ed=0;try{DH()}finally{xc=0,MH(),Fo=0}}function IH(){var e=fu.now(),t=e-op;t>$M&&(Qp-=t,op=e)}function MH(){for(var e,t=ip,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ip=n);jd=e,wN(r)}function wN(e){if(!xc){Ed&&(Ed=clearTimeout(Ed));var t=e-Fo;t>24?(e<1/0&&(Ed=setTimeout(Pj,e-fu.now()-Qp)),sd&&(sd=clearInterval(sd))):(sd||(op=fu.now(),sd=setInterval(IH,$M)),xc=1,HM(Pj))}}function Fj(e,t,n){var r=new lp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var LH=Kp("start","end","cancel","interrupt"),UH=[],GM=0,Bj=1,NN=2,hf=3,zj=4,SN=5,ff=6;function Jp(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;PH(e,n,{name:t,index:r,group:s,on:LH,tween:UH,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:GM})}function hS(e,t){var n=wr(e,t);if(n.state>GM)throw new Error("too late; already scheduled");return n}function Zr(e,t){var n=wr(e,t);if(n.state>hf)throw new Error("too late; already running");return n}function wr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PH(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=qM(i,0,n.time);function i(u){n.state=Bj,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var h,d,f,m;if(n.state!==Bj)return c();for(h in r)if(m=r[h],m.name===n.name){if(m.state===hf)return Fj(o);m.state===zj?(m.state=ff,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[h]):+h<t&&(m.state=ff,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[h])}if(Fj(function(){n.state===hf&&(n.state=zj,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=NN,n.on.call("start",e,e.__data__,n.index,n.group),n.state===NN){for(n.state=hf,s=new Array(f=n.tween.length),h=0,d=-1;h<f;++h)(m=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++d]=m);s.length=d+1}}function l(u){for(var h=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=SN,1),d=-1,f=s.length;++d<f;)s[d].call(e,h);n.state===SN&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ff,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function pf(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>NN&&r.state<SN,r.state=ff,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function FH(e){return this.each(function(){pf(this,e)})}function BH(e,t){var n,r;return function(){var s=Zr(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function zH(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Zr(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function $H(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=wr(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?BH:zH)(n,e,t))}function fS(e,t,n){var r=e._id;return e.each(function(){var s=Zr(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return wr(s,r).value[t]}}function VM(e,t){var n;return(typeof t=="number"?Lr:t instanceof Po?sp:(n=Po(t))?(t=n,sp):FM)(e,t)}function HH(e){return function(){this.removeAttribute(e)}}function qH(e){return function(){this.removeAttributeNS(e.space,e.local)}}function GH(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function VH(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function YH(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function WH(e,t,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l)))}}function XH(e,t){var n=Zp(e),r=n==="transform"?kH:VM;return this.attrTween(e,typeof t=="function"?(n.local?WH:YH)(n,r,fS(this,"attr."+e,t)):t==null?(n.local?qH:HH)(n):(n.local?VH:GH)(n,r,t))}function KH(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ZH(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function QH(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ZH(e,i)),n}return s._value=t,s}function JH(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&KH(e,i)),n}return s._value=t,s}function e7(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Zp(e);return this.tween(n,(r.local?QH:JH)(r,t))}function t7(e,t){return function(){hS(this,e).delay=+t.apply(this,arguments)}}function n7(e,t){return t=+t,function(){hS(this,e).delay=t}}function a7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?t7:n7)(t,e)):wr(this.node(),t).delay}function r7(e,t){return function(){Zr(this,e).duration=+t.apply(this,arguments)}}function s7(e,t){return t=+t,function(){Zr(this,e).duration=t}}function i7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?r7:s7)(t,e)):wr(this.node(),t).duration}function o7(e,t){if(typeof t!="function")throw new Error;return function(){Zr(this,e).ease=t}}function l7(e){var t=this._id;return arguments.length?this.each(o7(t,e)):wr(this.node(),t).ease}function c7(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Zr(this,e).ease=n}}function d7(e){if(typeof e!="function")throw new Error;return this.each(c7(this._id,e))}function u7(e){typeof e!="function"&&(e=SM(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,l=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Bs(r,this._parents,this._name,this._id)}function h7(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],h=c.length,d=o[l]=new Array(h),f,m=0;m<h;++m)(f=c[m]||u[m])&&(d[m]=f);for(;l<r;++l)o[l]=t[l];return new Bs(o,this._parents,this._name,this._id)}function f7(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function p7(e,t,n){var r,s,i=f7(t)?hS:Zr;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function m7(e,t){var n=this._id;return arguments.length<2?wr(this.node(),n).on.on(e):this.each(p7(n,e,t))}function g7(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function x7(){return this.on("end.remove",g7(this._id))}function b7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oS(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,u=i[o]=new Array(c),h,d,f=0;f<c;++f)(h=l[f])&&(d=e.call(h,h.__data__,f,l))&&("__data__"in h&&(d.__data__=h.__data__),u[f]=d,Jp(u[f],t,n,f,u,wr(h,n)));return new Bs(i,this._parents,t,n)}function v7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=NM(e));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],u=c.length,h,d=0;d<u;++d)if(h=c[d]){for(var f=e.call(h,h.__data__,d,c),m,y=wr(h,n),b=0,w=f.length;b<w;++b)(m=f[b])&&Jp(m,t,n,b,f,y);i.push(f),o.push(h)}return new Bs(i,o,t,n)}var y7=Gu.prototype.constructor;function w7(){return new y7(this._groups,this._parents)}function N7(e,t){var n,r,s;return function(){var i=gc(this,e),o=(this.style.removeProperty(e),gc(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function YM(e){return function(){this.style.removeProperty(e)}}function S7(e,t,n){var r,s=n+"",i;return function(){var o=gc(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function E7(e,t,n){var r,s,i;return function(){var o=gc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),gc(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function j7(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Zr(this,e),u=c.on,h=c.value[i]==null?l||(l=YM(t)):void 0;(u!==n||s!==h)&&(r=(n=u).copy()).on(o,s=h),c.on=r}}function T7(e,t,n){var r=(e+="")=="transform"?CH:VM;return t==null?this.styleTween(e,N7(e,r)).on("end.style."+e,YM(e)):typeof t=="function"?this.styleTween(e,E7(e,r,fS(this,"style."+e,t))).each(j7(this._id,e)):this.styleTween(e,S7(e,r,t),n).on("end.style."+e,null)}function C7(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function k7(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&C7(e,o,n)),r}return i._value=t,i}function A7(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,k7(e,t,n??""))}function _7(e){return function(){this.textContent=e}}function R7(e){return function(){var t=e(this);this.textContent=t??""}}function O7(e){return this.tween("text",typeof e=="function"?R7(fS(this,"text",e)):_7(e==null?"":e+""))}function D7(e){return function(t){this.textContent=e.call(this,t)}}function I7(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&D7(s)),t}return r._value=e,r}function M7(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,I7(e))}function L7(){for(var e=this._name,t=this._id,n=WM(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)if(c=o[u]){var h=wr(c,t);Jp(c,e,n,u,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Bs(r,this._parents,e,n)}function U7(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=Zr(this,r),h=u.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var P7=0;function Bs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function WM(){return++P7}var bs=Gu.prototype;Bs.prototype={constructor:Bs,select:b7,selectAll:v7,selectChild:bs.selectChild,selectChildren:bs.selectChildren,filter:u7,merge:h7,selection:w7,transition:L7,call:bs.call,nodes:bs.nodes,node:bs.node,size:bs.size,empty:bs.empty,each:bs.each,on:m7,attr:XH,attrTween:e7,style:T7,styleTween:A7,text:O7,textTween:M7,remove:x7,tween:$H,delay:a7,duration:i7,ease:l7,easeVarying:d7,end:U7,[Symbol.iterator]:bs[Symbol.iterator]};function F7(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var B7={time:null,delay:0,duration:250,ease:F7};function z7(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function $7(e){var t,n;e instanceof Bs?(t=e._id,e=e._name):(t=WM(),(n=B7).time=uS(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,u=0;u<l;++u)(c=o[u])&&Jp(c,e,t,u,o,n||z7(c,t));return new Bs(r,this._parents,e,t)}Gu.prototype.interrupt=FH;Gu.prototype.transition=$7;const Rh=e=>()=>e;function H7(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function ks(e,t,n){this.k=e,this.x=t,this.y=n}ks.prototype={constructor:ks,scale:function(e){return e===1?this:new ks(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ks(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var em=new ks(1,0,0);XM.prototype=ks.prototype;function XM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return em;return e.__zoom}function Cg(e){e.stopImmediatePropagation()}function id(e){e.preventDefault(),e.stopImmediatePropagation()}function q7(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function G7(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function $j(){return this.__zoom||em}function V7(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Y7(){return navigator.maxTouchPoints||"ontouchstart"in this}function W7(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function KM(){var e=q7,t=G7,n=W7,r=V7,s=Y7,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=uf,u=Kp("start","zoom","end"),h,d,f,m=500,y=150,b=0,w=10;function x(_){_.property("__zoom",$j).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",U).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(_,I,A,C){var T=_.selection?_.selection():_;T.property("__zoom",$j),_!==T?S(_,I,A,C):T.interrupt().each(function(){E(this,arguments).event(C).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},x.scaleBy=function(_,I,A,C){x.scaleTo(_,function(){var T=this.__zoom.k,O=typeof I=="function"?I.apply(this,arguments):I;return T*O},A,C)},x.scaleTo=function(_,I,A,C){x.transform(_,function(){var T=t.apply(this,arguments),O=this.__zoom,q=A==null?N(T):typeof A=="function"?A.apply(this,arguments):A,k=O.invert(q),M=typeof I=="function"?I.apply(this,arguments):I;return n(g(v(O,M),q,k),T,o)},A,C)},x.translateBy=function(_,I,A,C){x.transform(_,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),o)},null,C)},x.translateTo=function(_,I,A,C,T){x.transform(_,function(){var O=t.apply(this,arguments),q=this.__zoom,k=C==null?N(O):typeof C=="function"?C.apply(this,arguments):C;return n(em.translate(k[0],k[1]).scale(q.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof A=="function"?-A.apply(this,arguments):-A),O,o)},C,T)};function v(_,I){return I=Math.max(i[0],Math.min(i[1],I)),I===_.k?_:new ks(I,_.x,_.y)}function g(_,I,A){var C=I[0]-A[0]*_.k,T=I[1]-A[1]*_.k;return C===_.x&&T===_.y?_:new ks(_.k,C,T)}function N(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function S(_,I,A,C){_.on("start.zoom",function(){E(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(C).end()}).tween("zoom",function(){var T=this,O=arguments,q=E(T,O).event(C),k=t.apply(T,O),M=A==null?N(k):typeof A=="function"?A.apply(T,O):A,$=Math.max(k[1][0]-k[0][0],k[1][1]-k[0][1]),W=T.__zoom,Y=typeof I=="function"?I.apply(T,O):I,te=c(W.invert(M).concat($/W.k),Y.invert(M).concat($/Y.k));return function(ne){if(ne===1)ne=Y;else{var X=te(ne),se=$/X[2];ne=new ks(se,M[0]-X[0]*se,M[1]-X[1]*se)}q.zoom(null,ne)}})}function E(_,I,A){return!A&&_.__zooming||new j(_,I)}function j(_,I){this.that=_,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,I),this.taps=0}j.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,I){return this.mouse&&_!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var I=_a(this.that).datum();u.call(_,this.that,new H7(_,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:u}),I)}};function R(_,...I){if(!e.apply(this,arguments))return;var A=E(this,I).event(_),C=this.__zoom,T=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),O=hr(_);if(A.wheel)(A.mouse[0][0]!==O[0]||A.mouse[0][1]!==O[1])&&(A.mouse[1]=C.invert(A.mouse[0]=O)),clearTimeout(A.wheel);else{if(C.k===T)return;A.mouse=[O,C.invert(O)],pf(this),A.start()}id(_),A.wheel=setTimeout(q,y),A.zoom("mouse",n(g(v(C,T),A.mouse[0],A.mouse[1]),A.extent,o));function q(){A.wheel=null,A.end()}}function L(_,...I){if(f||!e.apply(this,arguments))return;var A=_.currentTarget,C=E(this,I,!0).event(_),T=_a(_.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",$,!0),O=hr(_,A),q=_.clientX,k=_.clientY;DM(_.view),Cg(_),C.mouse=[O,this.__zoom.invert(O)],pf(this),C.start();function M(W){if(id(W),!C.moved){var Y=W.clientX-q,te=W.clientY-k;C.moved=Y*Y+te*te>b}C.event(W).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=hr(W,A),C.mouse[1]),C.extent,o))}function $(W){T.on("mousemove.zoom mouseup.zoom",null),IM(W.view,C.moved),id(W),C.event(W).end()}}function P(_,...I){if(e.apply(this,arguments)){var A=this.__zoom,C=hr(_.changedTouches?_.changedTouches[0]:_,this),T=A.invert(C),O=A.k*(_.shiftKey?.5:2),q=n(g(v(A,O),C,T),t.apply(this,I),o);id(_),l>0?_a(this).transition().duration(l).call(S,q,C,_):_a(this).call(x.transform,q,C,_)}}function U(_,...I){if(e.apply(this,arguments)){var A=_.touches,C=A.length,T=E(this,I,_.changedTouches.length===C).event(_),O,q,k,M;for(Cg(_),q=0;q<C;++q)k=A[q],M=hr(k,this),M=[M,this.__zoom.invert(M),k.identifier],T.touch0?!T.touch1&&T.touch0[2]!==M[2]&&(T.touch1=M,T.taps=0):(T.touch0=M,O=!0,T.taps=1+!!h);h&&(h=clearTimeout(h)),O&&(T.taps<2&&(d=M[0],h=setTimeout(function(){h=null},m)),pf(this),T.start())}}function F(_,...I){if(this.__zooming){var A=E(this,I).event(_),C=_.changedTouches,T=C.length,O,q,k,M;for(id(_),O=0;O<T;++O)q=C[O],k=hr(q,this),A.touch0&&A.touch0[2]===q.identifier?A.touch0[0]=k:A.touch1&&A.touch1[2]===q.identifier&&(A.touch1[0]=k);if(q=A.that.__zoom,A.touch1){var $=A.touch0[0],W=A.touch0[1],Y=A.touch1[0],te=A.touch1[1],ne=(ne=Y[0]-$[0])*ne+(ne=Y[1]-$[1])*ne,X=(X=te[0]-W[0])*X+(X=te[1]-W[1])*X;q=v(q,Math.sqrt(ne/X)),k=[($[0]+Y[0])/2,($[1]+Y[1])/2],M=[(W[0]+te[0])/2,(W[1]+te[1])/2]}else if(A.touch0)k=A.touch0[0],M=A.touch0[1];else return;A.zoom("touch",n(g(q,k,M),A.extent,o))}}function G(_,...I){if(this.__zooming){var A=E(this,I).event(_),C=_.changedTouches,T=C.length,O,q;for(Cg(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),O=0;O<T;++O)q=C[O],A.touch0&&A.touch0[2]===q.identifier?delete A.touch0:A.touch1&&A.touch1[2]===q.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(q=hr(q,this),Math.hypot(d[0]-q[0],d[1]-q[1])<w)){var k=_a(this).on("dblclick.zoom");k&&k.apply(this,arguments)}}}return x.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:Rh(+_),x):r},x.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Rh(!!_),x):e},x.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:Rh(!!_),x):s},x.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Rh([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),x):t},x.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],x):[i[0],i[1]]},x.translateExtent=function(_){return arguments.length?(o[0][0]=+_[0][0],o[1][0]=+_[1][0],o[0][1]=+_[0][1],o[1][1]=+_[1][1],x):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},x.constrain=function(_){return arguments.length?(n=_,x):n},x.duration=function(_){return arguments.length?(l=+_,x):l},x.interpolate=function(_){return arguments.length?(c=_,x):c},x.on=function(){var _=u.on.apply(u,arguments);return _===u?x:_},x.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,x):Math.sqrt(b)},x.tapDistance=function(_){return arguments.length?(w=+_,x):w},x}const Yr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ZM=["Enter"," ","Escape"],QM={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var bc;(function(e){e.Strict="strict",e.Loose="loose"})(bc||(bc={}));var Ro;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ro||(Ro={}));var mu;(function(e){e.Partial="partial",e.Full="full"})(mu||(mu={}));const JM={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Si;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Si||(Si={}));var cp;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cp||(cp={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));const Hj={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};function eL(e){return e===null?null:e?"valid":"invalid"}const tL=e=>"id"in e&&"source"in e&&"target"in e,X7=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),pS=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Yu=(e,t=[0,0])=>{const{width:n,height:r}=Gs(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},K7=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):pS(s)?s:t.nodeLookup.get(s.id));const l=o?dp(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nm(n)},Wu=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=tm(n,dp(s)),r=!0)}),r?nm(n):{x:0,y:0,width:0,height:0}},mS=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l={...Ku(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:h,selectable:d=!0,hidden:f=!1}=u;if(o&&!d||f)continue;const m=h.width??u.width??u.initialWidth??null,y=h.height??u.height??u.initialHeight??null,b=gu(l,yc(u)),w=(m??0)*(y??0),x=i&&b>0;(!u.internals.handleBounds||x||b>=w||u.dragging)&&c.push(u)}return c},Z7=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Q7(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function J7({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!0);const l=Q7(e,o),c=Wu(l),u=gS(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function nL({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},h=o.origin??r;let d=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",Yr.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(d=[[c,u],[c+m,u+y]])}else l&&wc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const f=wc(d)?Bo(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",Yr.error015())),{position:{x:f.x-c+(o.measured.width??0)*h[0],y:f.y-u+(o.measured.height??0)*h[1]},positionAbsolute:f}}async function eq({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const m=i.has(f.id),y=!m&&f.parentId&&o.find(b=>b.id===f.parentId);(m||y)&&o.push(f)}const l=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),h=Z7(o,c);for(const f of c)l.has(f.id)&&!h.find(y=>y.id===f.id)&&h.push(f);if(!s)return{edges:h,nodes:o};const d=await s({nodes:o,edges:h});return typeof d=="boolean"?d?{edges:h,nodes:o}:{edges:[],nodes:[]}:d}const vc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Bo=(e={x:0,y:0},t,n)=>({x:vc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:vc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function aL(e,t,n){const{width:r,height:s}=Gs(n),{x:i,y:o}=n.internals.positionAbsolute;return Bo(e,[[i,o],[i+r,o+s]],t)}const qj=(e,t,n)=>e<t?vc(Math.abs(e-t),1,t)/t:e>n?-vc(Math.abs(e-n),1,t)/t:0,rL=(e,t,n=15,r=40)=>{const s=qj(e.x,r,t.width-r)*n,i=qj(e.y,r,t.height-r)*n;return[s,i]},tm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),EN=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),yc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=pS(e)?e.internals.positionAbsolute:Yu(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},dp=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=pS(e)?e.internals.positionAbsolute:Yu(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},sL=(e,t)=>nm(tm(EN(e),EN(t))),gu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Gj=e=>pr(e.width)&&pr(e.height)&&pr(e.x)&&pr(e.y),pr=e=>!isNaN(e)&&isFinite(e),tq=(e,t)=>{},Xu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ku=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?Xu(l,o):l},up=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function dl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nq(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=dl(e,n),s=dl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=dl(e.top??e.y??0,n),s=dl(e.bottom??e.y??0,n),i=dl(e.left??e.x??0,t),o=dl(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function aq(e,t,n,r,s,i){const{x:o,y:l}=up(e,[t,n,r]),{x:c,y:u}=up({x:e.x+e.width,y:e.y+e.height},[t,n,r]),h=s-c,d=i-u;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(d)}}const gS=(e,t,n,r,s,i)=>{const o=nq(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),h=vc(u,r,s),d=e.x+e.width/2,f=e.y+e.height/2,m=t/2-d*h,y=n/2-f*h,b=aq(e,m,y,h,t,n),w={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:m-w.left+w.right,y:y-w.top+w.bottom,zoom:h}},xu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function wc(e){return e!=null&&e!=="parent"}function Gs(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function iL(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function oL(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function Vj(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rq(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function sq(e){return{...QM,...e||{}}}function Vd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=mr(e),l=Ku({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Xu(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const xS=e=>({width:e.offsetWidth,height:e.offsetHeight}),lL=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},iq=["INPUT","SELECT","TEXTAREA"];function cL(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:iq.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dL=e=>"clientX"in e,mr=(e,t)=>{var i,o;const n=dL(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Yj=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...xS(o)}})};function uL({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,h=Math.abs(c-e),d=Math.abs(u-t);return[c,u,h,d]}function Oh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wj({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Xe.Left:return[t-Oh(t-r,i),n];case Xe.Right:return[t+Oh(r-t,i),n];case Xe.Top:return[t,n-Oh(n-s,i)];case Xe.Bottom:return[t,n+Oh(s-n,i)]}}function hL({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,curvature:o=.25}){const[l,c]=Wj({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,h]=Wj({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[d,f,m,y]=uL({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:h});return[`M${e},${t} C${l},${c} ${u},${h} ${r},${s}`,d,f,m,y]}function fL({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[i,l,s,o]}function oq({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:s=!1}){if(r!==void 0)return r;const i=s&&n?1e3:0,o=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return i+o}function lq({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=tm(dp(e),dp(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return gu(o,nm(i))>0}const cq=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,dq=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),pL=(e,t)=>{if(!e.source||!e.target)return t;let n;return tL(e)?n={...e}:n={...e,id:cq(e)},dq(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function mL({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=fL({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const Xj={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}},uq=({source:e,sourcePosition:t=Xe.Bottom,target:n})=>t===Xe.Left||t===Xe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Kj=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hq({source:e,sourcePosition:t=Xe.Bottom,target:n,targetPosition:r=Xe.Top,center:s,offset:i,stepPosition:o}){const l=Xj[t],c=Xj[r],u={x:e.x+l.x*i,y:e.y+l.y*i},h={x:n.x+c.x*i,y:n.y+c.y*i},d=uq({source:u,sourcePosition:t,target:h}),f=d.x!==0?"x":"y",m=d[f];let y=[],b,w;const x={x:0,y:0},v={x:0,y:0},[,,g,N]=fL({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(b=s.x??u.x+(h.x-u.x)*o,w=s.y??(u.y+h.y)/2):(b=s.x??(u.x+h.x)/2,w=s.y??u.y+(h.y-u.y)*o);const E=[{x:b,y:u.y},{x:b,y:h.y}],j=[{x:u.x,y:w},{x:h.x,y:w}];l[f]===m?y=f==="x"?E:j:y=f==="x"?j:E}else{const E=[{x:u.x,y:h.y}],j=[{x:h.x,y:u.y}];if(f==="x"?y=l.x===m?j:E:y=l.y===m?E:j,t===r){const F=Math.abs(e[f]-n[f]);if(F<=i){const G=Math.min(i-1,i-F);l[f]===m?x[f]=(u[f]>e[f]?-1:1)*G:v[f]=(h[f]>n[f]?-1:1)*G}}if(t!==r){const F=f==="x"?"y":"x",G=l[f]===c[F],_=u[F]>h[F],I=u[F]<h[F];(l[f]===1&&(!G&&_||G&&I)||l[f]!==1&&(!G&&I||G&&_))&&(y=f==="x"?E:j)}const R={x:u.x+x.x,y:u.y+x.y},L={x:h.x+v.x,y:h.y+v.y},P=Math.max(Math.abs(R.x-y[0].x),Math.abs(L.x-y[0].x)),U=Math.max(Math.abs(R.y-y[0].y),Math.abs(L.y-y[0].y));P>=U?(b=(R.x+L.x)/2,w=y[0].y):(b=y[0].x,w=(R.y+L.y)/2)}return[[e,{x:u.x+x.x,y:u.y+x.y},...y,{x:h.x+v.x,y:h.y+v.y},n],b,w,g,N]}function fq(e,t,n,r){const s=Math.min(Kj(e,t)/2,Kj(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function jN({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top,borderRadius:o=5,centerX:l,centerY:c,offset:u=20,stepPosition:h=.5}){const[d,f,m,y,b]=hq({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:h});return[d.reduce((x,v,g)=>{let N="";return g>0&&g<d.length-1?N=fq(d[g-1],v,d[g+1],o):N=`${g===0?"M":"L"}${v.x} ${v.y}`,x+=N,x},""),f,m,y,b]}function Zj(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pq(e){var d;const{sourceNode:t,targetNode:n}=e;if(!Zj(t)||!Zj(n))return null;const r=t.internals.handleBounds||Qj(t.handles),s=n.internals.handleBounds||Qj(n.handles),i=Jj((r==null?void 0:r.source)??[],e.sourceHandle),o=Jj(e.connectionMode===bc.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(d=e.onError)==null||d.call(e,"008",Yr.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Xe.Bottom,c=(o==null?void 0:o.position)||Xe.Top,u=bu(t,i,l),h=bu(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function Qj(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function bu(e,t,n=Xe.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Gs(e);if(r)return{x:s+o/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Xe.Top:return{x:s+o/2,y:i};case Xe.Right:return{x:s+o,y:i+l/2};case Xe.Bottom:return{x:s+o/2,y:i+l};case Xe.Left:return{x:s,y:i+l/2}}}function Jj(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function TN(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mq(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=TN(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const gL=1e3,gq=10,bS={nodeOrigin:[0,0],nodeExtent:pu,elevateNodesOnSelect:!0,defaults:{}},xq={...bS,checkEquality:!0};function vS(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function bq(e,t,n){const r=vS(bS,n);for(const s of e.values())if(s.parentId)yS(s,e,t,r);else{const i=Yu(s,r.nodeOrigin),o=wc(s.extent)?s.extent:r.nodeExtent,l=Bo(i,o,Gs(s));s.internals.positionAbsolute=l}}function vq(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function CN(e,t,n,r){var u,h;const s=vS(xq,r);let i={i:-1},o=e.length>0;const l=new Map(t),c=s!=null&&s.elevateNodesOnSelect?gL:0;t.clear(),n.clear();for(const d of e){let f=l.get(d.id);if(s.checkEquality&&d===(f==null?void 0:f.internals.userNode))t.set(d.id,f);else{const m=Yu(d,s.nodeOrigin),y=wc(d.extent)?d.extent:s.nodeExtent,b=Bo(m,y,Gs(d));f={...s.defaults,...d,measured:{width:(u=d.measured)==null?void 0:u.width,height:(h=d.measured)==null?void 0:h.height},internals:{positionAbsolute:b,handleBounds:vq(d,f),z:xL(d,c),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(o=!1),d.parentId&&yS(f,t,n,r,i)}return o}function yq(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function yS(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l}=vS(bS,r),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yq(e,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*gq),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const h=i?gL:0,{x:d,y:f,z:m}=wq(e,u,o,l,h),{positionAbsolute:y}=e.internals,b=d!==y.x||f!==y.y;(b||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:f}:y,z:m}})}function xL(e,t){return(pr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function wq(e,t,n,r,s){const{x:i,y:o}=t.internals.positionAbsolute,l=Gs(e),c=Yu(e,n),u=wc(e.extent)?Bo(c,e.extent,l):c;let h=Bo({x:i+u.x,y:o+u.y},r,l);e.extent==="parent"&&(h=aL(h,l,t));const d=xL(e,s),f=t.internals.z??0;return{x:h.x,y:h.y,z:f>=d?f+1:d}}function wS(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??yc(c),h=sL(u,l.rect);i.set(l.parentId,{expandedRect:h,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var g;const h=c.internals.positionAbsolute,d=Gs(c),f=c.origin??r,m=l.x<h.x?Math.round(Math.abs(h.x-l.x)):0,y=l.y<h.y?Math.round(Math.abs(h.y-l.y)):0,b=Math.max(d.width,Math.round(l.width)),w=Math.max(d.height,Math.round(l.height)),x=(b-d.width)*f[0],v=(w-d.height)*f[1];(m>0||y>0||x||v)&&(s.push({id:u,type:"position",position:{x:c.position.x-m+x,y:c.position.y-y+v}}),(g=n.get(u))==null||g.forEach(N=>{e.some(S=>S.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+m,y:N.position.y+y}})})),(d.width<l.width||d.height<l.height||m||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?f[0]*m-x:0),height:w+(y?f[1]*y-v:0)}})}),s}function Nq(e,t,n,r,s,i){const o=r==null?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!o)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(o),{m22:h}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const f of e.values()){const m=t.get(f.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=xS(f.nodeElement),b=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(b||!m.internals.handleBounds||f.force))){const x=f.nodeElement.getBoundingClientRect(),v=wc(m.extent)?m.extent:i;let{positionAbsolute:g}=m.internals;m.parentId&&m.extent==="parent"?g=aL(g,y,t.get(m.parentId)):v&&(g=Bo(g,v,y));const N={...m,measured:y,internals:{...m.internals,positionAbsolute:g,handleBounds:{source:Yj("source",f.nodeElement,x,h,m.id),target:Yj("target",f.nodeElement,x,h,m.id)}}};t.set(m.id,N),m.parentId&&yS(N,t,n,{nodeOrigin:s}),l=!0,b&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&d.push({id:m.id,parentId:m.parentId,rect:yc(N,s)}))}}if(d.length>0){const f=wS(d,t,n,s);c.push(...f)}return{changes:c,updatedInternals:l}}async function Sq({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function eT(e,t,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function bL(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},u=`${s}-${o}--${i}-${l}`,h=`${i}-${l}--${s}-${o}`;eT("source",c,h,e,s,o),eT("target",c,u,e,i,l),t.set(r.id,r)}}function vL(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vL(n,t):!1}function tT(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Eq(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!vL(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function kg({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[u,h]of t){const d=(o=n.get(u))==null?void 0:o.internals.userNode;d&&s.push({...d,position:h.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function jq({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=Xu(i,t);return{x:o.x-i.x,y:o.y-i.y}}function Tq({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,u={x:0,y:0},h=null,d=!1,f=null,m=!1,y=!1,b=null;function w({noDragClassName:v,handleSelector:g,domNode:N,isSelectable:S,nodeId:E,nodeClickDistance:j=0}){f=_a(N);function R({x:F,y:G}){const{nodeLookup:_,nodeExtent:I,snapGrid:A,snapToGrid:C,nodeOrigin:T,onNodeDrag:O,onSelectionDrag:q,onError:k,updateNodePositions:M}=t();i={x:F,y:G};let $=!1;const W=l.size>1,Y=W&&I?EN(Wu(l)):null,te=W&&C?jq({dragItems:l,snapGrid:A,x:F,y:G}):null;for(const[ne,X]of l){if(!_.has(ne))continue;let se={x:F-X.distance.x,y:G-X.distance.y};C&&(se=te?{x:Math.round(se.x+te.x),y:Math.round(se.y+te.y)}:Xu(se,A));let Ee=null;if(W&&I&&!X.extent&&Y){const{positionAbsolute:ye}=X.internals,ze=ye.x-Y.x+I[0][0],He=ye.x+X.measured.width-Y.x2+I[1][0],Fe=ye.y-Y.y+I[0][1],Ye=ye.y+X.measured.height-Y.y2+I[1][1];Ee=[[ze,Fe],[He,Ye]]}const{position:re,positionAbsolute:xe}=nL({nodeId:ne,nextPosition:se,nodeLookup:_,nodeExtent:Ee||I,nodeOrigin:T,onError:k});$=$||X.position.x!==re.x||X.position.y!==re.y,X.position=re,X.internals.positionAbsolute=xe}if(y=y||$,!!$&&(M(l,!0),b&&(r||O||!E&&q))){const[ne,X]=kg({nodeId:E,dragItems:l,nodeLookup:_});r==null||r(b,l,ne,X),O==null||O(b,ne,X),E||q==null||q(b,X)}}async function L(){if(!h)return;const{transform:F,panBy:G,autoPanSpeed:_,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(o);return}const[A,C]=rL(u,h,_);(A!==0||C!==0)&&(i.x=(i.x??0)-A/F[2],i.y=(i.y??0)-C/F[2],await G({x:A,y:C})&&R(i)),o=requestAnimationFrame(L)}function P(F){var W;const{nodeLookup:G,multiSelectionActive:_,nodesDraggable:I,transform:A,snapGrid:C,snapToGrid:T,selectNodesOnDrag:O,onNodeDragStart:q,onSelectionDragStart:k,unselectNodesAndEdges:M}=t();d=!0,(!O||!S)&&!_&&E&&((W=G.get(E))!=null&&W.selected||M()),S&&O&&E&&(e==null||e(E));const $=Vd(F.sourceEvent,{transform:A,snapGrid:C,snapToGrid:T,containerBounds:h});if(i=$,l=Eq(G,I,$,E),l.size>0&&(n||q||!E&&k)){const[Y,te]=kg({nodeId:E,dragItems:l,nodeLookup:G});n==null||n(F.sourceEvent,l,Y,te),q==null||q(F.sourceEvent,Y,te),E||k==null||k(F.sourceEvent,te)}}const U=MM().clickDistance(j).on("start",F=>{const{domNode:G,nodeDragThreshold:_,transform:I,snapGrid:A,snapToGrid:C}=t();h=(G==null?void 0:G.getBoundingClientRect())||null,m=!1,y=!1,b=F.sourceEvent,_===0&&P(F),i=Vd(F.sourceEvent,{transform:I,snapGrid:A,snapToGrid:C,containerBounds:h}),u=mr(F.sourceEvent,h)}).on("drag",F=>{const{autoPanOnNodeDrag:G,transform:_,snapGrid:I,snapToGrid:A,nodeDragThreshold:C,nodeLookup:T}=t(),O=Vd(F.sourceEvent,{transform:_,snapGrid:I,snapToGrid:A,containerBounds:h});if(b=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||E&&!T.has(E))&&(m=!0),!m){if(!c&&G&&d&&(c=!0,L()),!d){const q=mr(F.sourceEvent,h),k=q.x-u.x,M=q.y-u.y;Math.sqrt(k*k+M*M)>C&&P(F)}(i.x!==O.xSnapped||i.y!==O.ySnapped)&&l&&d&&(u=mr(F.sourceEvent,h),R(O))}}).on("end",F=>{if(!(!d||m)&&(c=!1,d=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:G,updateNodePositions:_,onNodeDragStop:I,onSelectionDragStop:A}=t();if(y&&(_(l,!1),y=!1),s||I||!E&&A){const[C,T]=kg({nodeId:E,dragItems:l,nodeLookup:G,dragging:!1});s==null||s(F.sourceEvent,l,C,T),I==null||I(F.sourceEvent,C,T),E||A==null||A(F.sourceEvent,T)}}}).filter(F=>{const G=F.target;return!F.button&&(!v||!tT(G,`.${v}`,N))&&(!g||tT(G,g,N))});f.call(U)}function x(){f==null||f.on(".drag",null)}return{update:w,destroy:x}}function Cq(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())gu(s,yc(i))>0&&r.push(i);return r}const kq=250;function Aq(e,t,n,r){var l,c;let s=[],i=1/0;const o=Cq(e,n,t+kq);for(const u of o){const h=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of h){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:m}=bu(u,d,d.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(m-e.y,2));y>t||(y<i?(s=[{...d,x:f,y:m}],i=y):y===i&&s.push({...d,x:f,y:m}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(h=>h.type===u)??s[0]}return s[0]}function yL(e,t,n,r,s,i=!1){var u,h,d;const o=r.get(e);if(!o)return null;const l=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((h=o.internals.handleBounds)==null?void 0:h.source)??[],...((d=o.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...bu(o,c,c.position,!0)}:c}function wL(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function _q(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const NL=()=>!0;function Rq(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:h,flowId:d,panBy:f,cancelConnection:m,onConnectStart:y,onConnect:b,onConnectEnd:w,isValidConnection:x=NL,onReconnectEnd:v,updateConnection:g,getTransform:N,getFromHandle:S,autoPanSpeed:E,dragThreshold:j=1,handleDomNode:R}){const L=lL(e.target);let P=0,U;const{x:F,y:G}=mr(e),_=wL(i,R),I=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!I||!_)return;const C=yL(s,_,r,c,t);if(!C)return;let T=mr(e,I),O=!1,q=null,k=!1,M=null;function $(){if(!h||!I)return;const[re,xe]=rL(T,I,E);f({x:re,y:xe}),P=requestAnimationFrame($)}const W={...C,nodeId:s,type:_,position:C.position},Y=c.get(s);let ne={inProgress:!0,isValid:null,from:bu(Y,W,Xe.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:Y,to:T,toHandle:null,toPosition:Hj[W.position],toNode:null,pointer:T};function X(){A=!0,g(ne),y==null||y(e,{nodeId:s,handleId:r,handleType:_})}j===0&&X();function se(re){if(!A){const{x:He,y:Fe}=mr(re),Ye=He-F,ft=Fe-G;if(!(Ye*Ye+ft*ft>j*j))return;X()}if(!S()||!W){Ee(re);return}const xe=N();T=mr(re,I),U=Aq(Ku(T,xe,!1,[1,1]),n,c,W),O||($(),O=!0);const ye=SL(re,{handle:U,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:x,doc:L,lib:u,flowId:d,nodeLookup:c});M=ye.handleDomNode,q=ye.connection,k=_q(!!U,ye.isValid);const ze={...ne,isValid:k,to:ye.toHandle&&k?up({x:ye.toHandle.x,y:ye.toHandle.y},xe):T,toHandle:ye.toHandle,toPosition:k&&ye.toHandle?ye.toHandle.position:Hj[W.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:T};g(ze),ne=ze}function Ee(re){if(!("touches"in re&&re.touches.length>0)){if(A){(U||M)&&q&&k&&(b==null||b(q));const{inProgress:xe,...ye}=ne,ze={...ye,toPosition:ne.toHandle?ne.toPosition:null};w==null||w(re,ze),i&&(v==null||v(re,ze))}m(),cancelAnimationFrame(P),O=!1,k=!1,q=null,M=null,L.removeEventListener("mousemove",se),L.removeEventListener("mouseup",Ee),L.removeEventListener("touchmove",se),L.removeEventListener("touchend",Ee)}}L.addEventListener("mousemove",se),L.addEventListener("mouseup",Ee),L.addEventListener("touchmove",se),L.addEventListener("touchend",Ee)}function SL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=NL,nodeLookup:h}){const d=i==="target",f=t?o.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=mr(e),b=o.elementFromPoint(m,y),w=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:f,x={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const v=wL(void 0,w),g=w.getAttribute("data-nodeid"),N=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!g||!v)return x;const j={source:d?g:r,sourceHandle:d?N:s,target:d?r:g,targetHandle:d?s:N};x.connection=j;const L=S&&E&&(n===bc.Strict?d&&v==="source"||!d&&v==="target":g!==r||N!==s);x.isValid=L&&u(j),x.toHandle=yL(g,v,N,h,n,!0)}return x}const kN={onPointerDown:Rq,isValid:SL};function Oq({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=_a(e);function i({translateExtent:l,width:c,height:u,zoomStep:h=1,pannable:d=!0,zoomable:f=!0,inversePan:m=!1}){const y=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const N=n(),S=g.sourceEvent.ctrlKey&&xu()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*h,j=N[2]*Math.pow(2,E*S);t.scaleTo(j)};let b=[0,0];const w=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(b=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},x=g=>{const N=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const S=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[S[0]-b[0],S[1]-b[1]];b=S;const j=r()*Math.max(N[2],Math.log(N[2]))*(m?-1:1),R={x:N[0]-E[0]*j,y:N[1]-E[1]*j},L=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:N[2]},L,l)},v=KM().on("start",w).on("zoom",d?x:null).on("zoom.wheel",f?y:null);s.call(v,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:hr}}const am=e=>({x:e.x,y:e.y,zoom:e.k}),Ag=({x:e,y:t,zoom:n})=>em.translate(e,t).scale(n),Pl=(e,t)=>e.target.closest(`.${t}`),EL=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dq=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,_g=(e,t=0,n=Dq,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},jL=e=>{const t=e.ctrlKey&&xu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Iq({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return h=>{if(Pl(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(h.ctrlKey&&o){const w=hr(h),x=jL(h),v=d*Math.pow(2,x);r.scaleTo(n,v,w,h);return}const f=h.deltaMode===1?20:1;let m=s===Ro.Vertical?0:h.deltaX*f,y=s===Ro.Horizontal?0:h.deltaY*f;!xu()&&h.shiftKey&&s!==Ro.Vertical&&(m=h.deltaY*f,y=0),r.translateBy(n,-(m/d)*i,-(y/d)*i,{internal:!0});const b=am(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(h,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(h,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(h,b))}}function Mq({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=Pl(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function Lq({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=am(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Uq({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&EL(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,am(i.transform)))}}function Pq({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&EL(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=am(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function Fq({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:h}){return d=>{var w;const f=e||t,m=n&&d.ctrlKey,y=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Pl(d,`${u}-flow__node`)||Pl(d,`${u}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||o||h&&!y||Pl(d,l)&&y||Pl(d,c)&&(!y||s&&y&&!e)||!n&&d.ctrlKey&&y)return!1;if(!n&&d.type==="touchstart"&&((w=d.touches)==null?void 0:w.length)>1)return d.preventDefault(),!1;if(!f&&!s&&!m&&y||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||y)&&b}}function Bq({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),d=KM().scaleExtent([t,n]).translateExtent(r),f=_a(e).call(d);v({x:s.x,y:s.y,zoom:vc(s.zoom,t,n)},[[0,0],[h.width,h.height]],r);const m=f.on("wheel.zoom"),y=f.on("dblclick.zoom");d.wheelDelta(jL);function b(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).transform(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function w({noWheelClassName:U,noPanClassName:F,onPaneContextMenu:G,userSelectionActive:_,panOnScroll:I,panOnDrag:A,panOnScrollMode:C,panOnScrollSpeed:T,preventScrolling:O,zoomOnPinch:q,zoomOnScroll:k,zoomOnDoubleClick:M,zoomActivationKeyPressed:$,lib:W,onTransformChange:Y,connectionInProgress:te,paneClickDistance:ne,selectionOnDrag:X}){_&&!u.isZoomingOrPanning&&x();const se=I&&!$&&!_;d.clickDistance(X?1/0:!pr(ne)||ne<0?0:ne);const Ee=se?Iq({zoomPanValues:u,noWheelClassName:U,d3Selection:f,d3Zoom:d,panOnScrollMode:C,panOnScrollSpeed:T,zoomOnPinch:q,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):Mq({noWheelClassName:U,preventScrolling:O,d3ZoomHandler:m});if(f.on("wheel.zoom",Ee,{passive:!1}),!_){const xe=Lq({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});d.on("start",xe);const ye=Uq({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!G,onPanZoom:i,onTransformChange:Y});d.on("zoom",ye);const ze=Pq({zoomPanValues:u,panOnDrag:A,panOnScroll:I,onPaneContextMenu:G,onPanZoomEnd:l,onDraggingChange:c});d.on("end",ze)}const re=Fq({zoomActivationKeyPressed:$,panOnDrag:A,zoomOnScroll:k,panOnScroll:I,zoomOnDoubleClick:M,zoomOnPinch:q,userSelectionActive:_,noPanClassName:F,noWheelClassName:U,lib:W,connectionInProgress:te});d.filter(re),M?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function v(U,F,G){const _=Ag(U),I=d==null?void 0:d.constrain()(_,F,G);return I&&await b(I),new Promise(A=>A(I))}async function g(U,F){const G=Ag(U);return await b(G,F),new Promise(_=>_(G))}function N(U){if(f){const F=Ag(U),G=f.property("__zoom");(G.k!==U.zoom||G.x!==U.x||G.y!==U.y)&&(d==null||d.transform(f,F,null,{sync:!0}))}}function S(){const U=f?XM(f.node()):{x:0,y:0,k:1};return{x:U.x,y:U.y,zoom:U.k}}function E(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).scaleTo(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function j(U,F){return f?new Promise(G=>{d==null||d.interpolate((F==null?void 0:F.interpolate)==="linear"?Gd:uf).scaleBy(_g(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>G(!0)),U)}):Promise.resolve(!1)}function R(U){d==null||d.scaleExtent(U)}function L(U){d==null||d.translateExtent(U)}function P(U){const F=!pr(U)||U<0?0:U;d==null||d.clickDistance(F)}return{update:w,destroy:x,setViewport:g,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:j,setScaleExtent:R,setTranslateExtent:L,syncViewport:N,setClickDistance:P}}var Nc;(function(e){e.Line="line",e.Handle="handle"})(Nc||(Nc={}));function zq({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function nT(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ii(e,t){return Math.max(0,t-e)}function oi(e,t){return Math.max(0,e-t)}function Dh(e,t,n){return Math.max(0,t-e,e-n)}function aT(e,t){return e?!t:t}function $q(e,t,n,r,s,i,o,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:h,isVertical:d}=t,f=h&&d,{xSnapped:m,ySnapped:y}=n,{minWidth:b,maxWidth:w,minHeight:x,maxHeight:v}=r,{x:g,y:N,width:S,height:E,aspectRatio:j}=e;let R=Math.floor(h?m-e.pointerX:0),L=Math.floor(d?y-e.pointerY:0);const P=S+(c?-R:R),U=E+(u?-L:L),F=-i[0]*S,G=-i[1]*E;let _=Dh(P,b,w),I=Dh(U,x,v);if(o){let T=0,O=0;c&&R<0?T=ii(g+R+F,o[0][0]):!c&&R>0&&(T=oi(g+P+F,o[1][0])),u&&L<0?O=ii(N+L+G,o[0][1]):!u&&L>0&&(O=oi(N+U+G,o[1][1])),_=Math.max(_,T),I=Math.max(I,O)}if(l){let T=0,O=0;c&&R>0?T=oi(g+R,l[0][0]):!c&&R<0&&(T=ii(g+P,l[1][0])),u&&L>0?O=oi(N+L,l[0][1]):!u&&L<0&&(O=ii(N+U,l[1][1])),_=Math.max(_,T),I=Math.max(I,O)}if(s){if(h){const T=Dh(P/j,x,v)*j;if(_=Math.max(_,T),o){let O=0;!c&&!u||c&&!u&&f?O=oi(N+G+P/j,o[1][1])*j:O=ii(N+G+(c?R:-R)/j,o[0][1])*j,_=Math.max(_,O)}if(l){let O=0;!c&&!u||c&&!u&&f?O=ii(N+P/j,l[1][1])*j:O=oi(N+(c?R:-R)/j,l[0][1])*j,_=Math.max(_,O)}}if(d){const T=Dh(U*j,b,w)/j;if(I=Math.max(I,T),o){let O=0;!c&&!u||u&&!c&&f?O=oi(g+U*j+F,o[1][0])/j:O=ii(g+(u?L:-L)*j+F,o[0][0])/j,I=Math.max(I,O)}if(l){let O=0;!c&&!u||u&&!c&&f?O=ii(g+U*j,l[1][0])/j:O=oi(g+(u?L:-L)*j,l[0][0])/j,I=Math.max(I,O)}}}L=L+(L<0?I:-I),R=R+(R<0?_:-_),s&&(f?P>U*j?L=(aT(c,u)?-R:R)/j:R=(aT(c,u)?-L:L)*j:h?(L=R/j,u=c):(R=L*j,c=u));const A=c?g+R:g,C=u?N+L:N;return{width:S+(c?-R:R),height:E+(u?-L:L),x:i[0]*R*(c?-1:1)+A,y:i[1]*L*(u?-1:1)+C}}const TL={width:0,height:0,x:0,y:0},Hq={...TL,pointerX:0,pointerY:0,aspectRatio:1};function qq(e){return[[0,0],[e.measured.width,e.measured.height]]}function Gq(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function Vq({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=_a(e);let o={controlDirection:nT("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:h,keepAspectRatio:d,resizeDirection:f,onResizeStart:m,onResize:y,onResizeEnd:b,shouldResize:w}){let x={...TL},v={...Hq};o={boundaries:h,resizeDirection:f,keepAspectRatio:d,controlDirection:nT(u)};let g,N=null,S=[],E,j,R,L=!1;const P=MM().on("start",U=>{const{nodeLookup:F,transform:G,snapGrid:_,snapToGrid:I,nodeOrigin:A,paneDomNode:C}=n();if(g=F.get(t),!g)return;N=(C==null?void 0:C.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:O}=Vd(U.sourceEvent,{transform:G,snapGrid:_,snapToGrid:I,containerBounds:N});x={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...x,pointerX:T,pointerY:O,aspectRatio:x.width/x.height},E=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=F.get(g.parentId),j=E&&g.extent==="parent"?qq(E):void 0),S=[],R=void 0;for(const[q,k]of F)if(k.parentId===t&&(S.push({id:q,position:{...k.position},extent:k.extent}),k.extent==="parent"||k.expandParent)){const M=Gq(k,g,k.origin??A);R?R=[[Math.min(M[0][0],R[0][0]),Math.min(M[0][1],R[0][1])],[Math.max(M[1][0],R[1][0]),Math.max(M[1][1],R[1][1])]]:R=M}m==null||m(U,{...x})}).on("drag",U=>{const{transform:F,snapGrid:G,snapToGrid:_,nodeOrigin:I}=n(),A=Vd(U.sourceEvent,{transform:F,snapGrid:G,snapToGrid:_,containerBounds:N}),C=[];if(!g)return;const{x:T,y:O,width:q,height:k}=x,M={},$=g.origin??I,{width:W,height:Y,x:te,y:ne}=$q(v,o.controlDirection,A,o.boundaries,o.keepAspectRatio,$,j,R),X=W!==q,se=Y!==k,Ee=te!==T&&X,re=ne!==O&&se;if(!Ee&&!re&&!X&&!se)return;if((Ee||re||$[0]===1||$[1]===1)&&(M.x=Ee?te:x.x,M.y=re?ne:x.y,x.x=M.x,x.y=M.y,S.length>0)){const He=te-T,Fe=ne-O;for(const Ye of S)Ye.position={x:Ye.position.x-He+$[0]*(W-q),y:Ye.position.y-Fe+$[1]*(Y-k)},C.push(Ye)}if((X||se)&&(M.width=X&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:x.width,M.height=se&&(!o.resizeDirection||o.resizeDirection==="vertical")?Y:x.height,x.width=M.width,x.height=M.height),E&&g.expandParent){const He=$[0]*(M.width??0);M.x&&M.x<He&&(x.x=He,v.x=v.x-(M.x-He));const Fe=$[1]*(M.height??0);M.y&&M.y<Fe&&(x.y=Fe,v.y=v.y-(M.y-Fe))}const xe=zq({width:x.width,prevWidth:q,height:x.height,prevHeight:k,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ye={...x,direction:xe};(w==null?void 0:w(U,ye))!==!1&&(L=!0,y==null||y(U,ye),r(M,C))}).on("end",U=>{L&&(b==null||b(U,{...x}),s==null||s({...x}),L=!1)});i.call(P)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var CL={exports:{}},kL={},AL={exports:{}},_L={};/**
77
77
  * @license React
78
78
  * use-sync-external-store-shim.production.js
79
79
  *
@@ -94,7 +94,7 @@ Error generating stack: `+n.message+`
94
94
 
95
95
  `,`
96
96
  +`).split(`
97
- `)),h=u.reduce((d,f)=>d.concat(...f),[]);return[u,h]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??dT,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const h=m=>{var w,x;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!u)&&cL(m))return!1;const b=hT(m.code,l);if(i.current.add(m[b]),uT(o,i.current,!1)){const v=((x=(w=m.composedPath)==null?void 0:w.call(m))==null?void 0:x[0])||m.target,g=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!g)&&m.preventDefault(),r(!0)}},d=m=>{const y=hT(m.code,l);uT(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",h),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",h),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function uT(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function hT(e,t){return t.includes(e)?"code":"key"}const UG=()=>{const e=Xt();return p.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=gS(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},h=n.snapGrid??s,d=n.snapToGrid??i;return Ku(u,r,d,h)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=up(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function LL(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)PG(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function PG(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function UL(e,t){return LL(e,t)}function PL(e,t){return LL(e,t)}function go(e,t){return{id:e,type:"select",selected:t}}function Fl(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(go(i.id,o)))}return r}function fT({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function pT(e){return{id:e.id,type:"remove"}}const mT=e=>X7(e),FG=e=>tL(e);function FL(e){return p.forwardRef(e)}const BG=typeof window<"u"?p.useLayoutEffect:p.useEffect;function gT(e){const[t,n]=p.useState(BigInt(0)),[r]=p.useState(()=>zG(()=>n(s=>s+BigInt(1))));return BG(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function zG(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const BL=p.createContext(null);function $G({children:e}){const t=Xt(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:h,onNodesChange:d,nodeLookup:f,fitViewQueued:m}=t.getState();let y=c;for(const w of l)y=typeof w=="function"?w(y):w;const b=fT({items:y,lookup:f});h&&u(y),b.length>0?d==null||d(b):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:x,setNodes:v}=t.getState();w&&v(x)})},[]),r=gT(n),s=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:h,onEdgesChange:d,edgeLookup:f}=t.getState();let m=c;for(const y of l)m=typeof y=="function"?y(m):y;h?u(m):d&&d(fT({items:m,lookup:f}))},[]),i=gT(s),o=p.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(BL.Provider,{value:o,children:e})}function HG(){const e=p.useContext(BL);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const qG=e=>!!e.panZoom;function NS(){const e=UG(),t=Xt(),n=HG(),r=gt(qG),s=p.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),o=d=>{n.nodeQueue.push(d)},l=d=>{n.edgeQueue.push(d)},c=d=>{var x,v;const{nodeLookup:f,nodeOrigin:m}=t.getState(),y=mT(d)?d:f.get(d.id),b=y.parentId?oL(y.position,y.measured,y.parentId,f,m):y.position,w={...y,position:b,width:((x=y.measured)==null?void 0:x.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return yc(w)},u=(d,f,m={replace:!1})=>{o(y=>y.map(b=>{if(b.id===d){const w=typeof f=="function"?f(b):f;return m.replace&&mT(w)?w:{...b,...w}}return b}))},h=(d,f,m={replace:!1})=>{l(y=>y.map(b=>{if(b.id===d){const w=typeof f=="function"?f(b):f;return m.replace&&FG(w)?w:{...b,...w}}return b}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var f;return(f=i(d))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:o,setEdges:l,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(m=>[...m,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:m}=t.getState(),[y,b,w]=m;return{nodes:d.map(x=>({...x})),edges:f.map(x=>({...x})),viewport:{x:y,y:b,zoom:w}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:m,edges:y,onNodesDelete:b,onEdgesDelete:w,triggerNodeChanges:x,triggerEdgeChanges:v,onDelete:g,onBeforeDelete:N}=t.getState(),{nodes:S,edges:E}=await eq({nodesToRemove:d,edgesToRemove:f,nodes:m,edges:y,onBeforeDelete:N}),j=E.length>0,R=S.length>0;if(j){const L=E.map(pT);w==null||w(E),v(L)}if(R){const L=S.map(pT);b==null||b(S),x(L)}return(R||j)&&(g==null||g({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(d,f=!0,m)=>{const y=Gj(d),b=y?d:c(d),w=m!==void 0;return b?(m||t.getState().nodes).filter(x=>{const v=t.getState().nodeLookup.get(x.id);if(v&&!y&&(x.id===d.id||!v.internals.positionAbsolute))return!1;const g=yc(w?x:v),N=gu(g,b);return f&&N>0||N>=g.width*g.height||N>=b.width*b.height}):[]},isNodeIntersecting:(d,f,m=!0)=>{const b=Gj(d)?d:c(d);if(!b)return!1;const w=gu(b,f);return m&&w>0||w>=f.width*f.height||w>=b.width*b.height},updateNode:u,updateNodeData:(d,f,m={replace:!1})=>{u(d,y=>{const b=typeof f=="function"?f(y):f;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},updateEdge:h,updateEdgeData:(d,f,m={replace:!1})=>{h(d,y=>{const b=typeof f=="function"?f(y):f;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return K7(d,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:d,id:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${d}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:d,handleId:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${d?f?`-${d}-${f}`:`-${d}`:""}`))==null?void 0:y.values())??[])},fitView:async d=>{const f=t.getState().fitViewResolver??rq();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return p.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const xT=e=>e.selected,GG=typeof window<"u"?window:void 0;function VG({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Xt(),{deleteElements:r}=NS(),s=vu(e,{actInsideInputWithModifier:!1}),i=vu(t,{target:GG});p.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(xT),edges:o.filter(xT)}),n.setState({nodesSelectionActive:!1})}},[s]),p.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function YG(e){const t=Xt();p.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=xS(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Yr.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const om={position:"absolute",width:"100%",height:"100%",top:0,left:0},WG=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function XG({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ro.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:h,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:m=!0,children:y,noWheelClassName:b,noPanClassName:w,onViewportChange:x,isControlledViewport:v,paneClickDistance:g,selectionOnDrag:N}){const S=Xt(),E=p.useRef(null),{userSelectionActive:j,lib:R,connectionInProgress:L}=gt(WG,en),P=vu(f),U=p.useRef();YG(E);const F=p.useCallback(G=>{x==null||x({x:G[0],y:G[1],zoom:G[2]}),v||S.setState({transform:G})},[x,v]);return p.useEffect(()=>{if(E.current){U.current=Bq({domNode:E.current,minZoom:h,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:A=>S.setState({paneDragging:A}),onPanZoomStart:(A,C)=>{const{onViewportChangeStart:T,onMoveStart:O}=S.getState();O==null||O(A,C),T==null||T(C)},onPanZoom:(A,C)=>{const{onViewportChange:T,onMove:O}=S.getState();O==null||O(A,C),T==null||T(C)},onPanZoomEnd:(A,C)=>{const{onViewportChangeEnd:T,onMoveEnd:O}=S.getState();O==null||O(A,C),T==null||T(C)}});const{x:G,y:_,zoom:I}=U.current.getViewport();return S.setState({panZoom:U.current,transform:[G,_,I],domNode:E.current.closest(".react-flow")}),()=>{var A;(A=U.current)==null||A.destroy()}}},[]),p.useEffect(()=>{var G;(G=U.current)==null||G.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:w,userSelectionActive:j,noWheelClassName:b,lib:R,onTransformChange:F,connectionInProgress:L,selectionOnDrag:N,paneClickDistance:g})},[e,t,n,r,s,i,o,l,P,m,w,j,b,R,F,L,N,g]),a.jsx("div",{className:"react-flow__renderer",ref:E,style:om,children:y})}const KG=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function ZG(){const{userSelectionActive:e,userSelectionRect:t}=gt(KG,en);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Og=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},QG=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function JG({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mu.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:o,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:h,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:m,children:y}){const b=Xt(),{userSelectionActive:w,elementsSelectable:x,dragging:v,connectionInProgress:g}=gt(QG,en),N=x&&(e||w),S=p.useRef(null),E=p.useRef(),j=p.useRef(new Set),R=p.useRef(new Set),L=p.useRef(!1),P=T=>{if(L.current||g){L.current=!1;return}c==null||c(T),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},U=T=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){T.preventDefault();return}u==null||u(T)},F=h?T=>h(T):void 0,G=T=>{L.current&&(T.stopPropagation(),L.current=!1)},_=T=>{var Y,te;const{domNode:O}=b.getState();if(E.current=O==null?void 0:O.getBoundingClientRect(),!E.current)return;const q=T.target===S.current;if(!q&&!!T.target.closest(".nokey")||!e||!(i&&q||t)||T.button!==0||!T.isPrimary)return;(te=(Y=T.target)==null?void 0:Y.setPointerCapture)==null||te.call(Y,T.pointerId),L.current=!1;const{x:$,y:W}=mr(T.nativeEvent,E.current);b.setState({userSelectionRect:{width:0,height:0,startX:$,startY:W,x:$,y:W}}),q||(T.stopPropagation(),T.preventDefault())},I=T=>{const{userSelectionRect:O,transform:q,nodeLookup:k,edgeLookup:M,connectionLookup:$,triggerNodeChanges:W,triggerEdgeChanges:Y,defaultEdgeOptions:te,resetSelectedElements:ne}=b.getState();if(!E.current||!O)return;const{x:X,y:se}=mr(T.nativeEvent,E.current),{startX:Ee,startY:re}=O;if(!L.current){const Fe=t?0:s;if(Math.hypot(X-Ee,se-re)<=Fe)return;ne(),o==null||o(T)}L.current=!0;const xe={startX:Ee,startY:re,x:X<Ee?X:Ee,y:se<re?se:re,width:Math.abs(X-Ee),height:Math.abs(se-re)},ye=j.current,ze=R.current;j.current=new Set(mS(k,xe,q,n===mu.Partial,!0).map(Fe=>Fe.id)),R.current=new Set;const He=(te==null?void 0:te.selectable)??!0;for(const Fe of j.current){const Ye=$.get(Fe);if(Ye)for(const{edgeId:ft}of Ye.values()){const et=M.get(ft);et&&(et.selectable??He)&&R.current.add(ft)}}if(!Vj(ye,j.current)){const Fe=Fl(k,j.current,!0);W(Fe)}if(!Vj(ze,R.current)){const Fe=Fl(M,R.current);Y(Fe)}b.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},A=T=>{var O,q;T.button===0&&((q=(O=T.target)==null?void 0:O.releasePointerCapture)==null||q.call(O,T.pointerId),!w&&T.target===S.current&&b.getState().userSelectionRect&&(P==null||P(T)),b.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(T),b.setState({nodesSelectionActive:j.current.size>0})))},C=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:yn(["react-flow__pane",{draggable:C,dragging:v,selection:e}]),onClick:N?void 0:Og(P,S),onContextMenu:Og(U,S),onWheel:Og(F,S),onPointerEnter:N?void 0:d,onPointerMove:N?I:f,onPointerUp:N?A:void 0,onPointerDownCapture:N?_:void 0,onClickCapture:N?G:void 0,onPointerLeave:m,ref:S,style:om,children:[y,a.jsx(ZG,{})]})}function AN({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Yr.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function zL({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Xt(),[c,u]=p.useState(!1),h=p.useRef();return p.useEffect(()=>{h.current=Tq({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{AN({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{var d,f;if(t)(d=h.current)==null||d.destroy();else if(e.current)return(f=h.current)==null||f.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var m;(m=h.current)==null||m.destroy()}},[n,r,t,i,e,s]),c}const eV=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function $L(){const e=Xt();return p.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:h}=e.getState(),d=new Map,f=eV(o),m=s?i[0]:5,y=s?i[1]:5,b=n.direction.x*m*n.factor,w=n.direction.y*y*n.factor;for(const[,x]of u){if(!f(x))continue;let v={x:x.internals.positionAbsolute.x+b,y:x.internals.positionAbsolute.y+w};s&&(v=Xu(v,i));const{position:g,positionAbsolute:N}=nL({nodeId:x.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:h,onError:l});x.position=g,x.internals.positionAbsolute=N,d.set(x.id,x)}c(d)},[])}const SS=p.createContext(null),tV=SS.Provider;SS.Consumer;const HL=()=>p.useContext(SS),nV=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),aV=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o,h=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:h,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===bc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:h&&u}};function rV({type:e="source",position:t=Xe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:h,onTouchStart:d,...f},m){var I,A;const y=o||null,b=e==="target",w=Xt(),x=HL(),{connectOnClick:v,noPanClassName:g,rfId:N}=gt(nV,en),{connectingFrom:S,connectingTo:E,clickConnecting:j,isPossibleEndHandle:R,connectionInProcess:L,clickConnectionInProcess:P,valid:U}=gt(aV(x,y,e),en);x||(A=(I=w.getState()).onError)==null||A.call(I,"010",Yr.error010());const F=C=>{const{defaultEdgeOptions:T,onConnect:O,hasDefaultEdges:q}=w.getState(),k={...T,...C};if(q){const{edges:M,setEdges:$}=w.getState();$(pL(k,M))}O==null||O(k),l==null||l(k)},G=C=>{if(!x)return;const T=dL(C.nativeEvent);if(s&&(T&&C.button===0||!T)){const O=w.getState();kN.onPointerDown(C.nativeEvent,{handleDomNode:C.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:b,handleId:y,nodeId:x,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:O.onConnectEnd,updateConnection:O.updateConnection,onConnect:F,isValidConnection:n||O.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}T?h==null||h(C):d==null||d(C)},_=C=>{const{onClickConnectStart:T,onClickConnectEnd:O,connectionClickStartHandle:q,connectionMode:k,isValidConnection:M,lib:$,rfId:W,nodeLookup:Y,connection:te}=w.getState();if(!x||!q&&!s)return;if(!q){T==null||T(C.nativeEvent,{nodeId:x,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:x,type:e,id:y}});return}const ne=lL(C.target),X=n||M,{connection:se,isValid:Ee}=kN.isValid(C.nativeEvent,{handle:{nodeId:x,id:y,type:e},connectionMode:k,fromNodeId:q.nodeId,fromHandleId:q.id||null,fromType:q.type,isValidConnection:X,flowId:W,doc:ne,lib:$,nodeLookup:Y});Ee&&se&&F(se);const re=structuredClone(te);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,O==null||O(C,re),w.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":y,"data-nodeid":x,"data-handlepos":t,"data-id":`${N}-${x}-${y}-${e}`,className:yn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:j,connectingfrom:S,connectingto:E,valid:U,connectionindicator:r&&(!L||R)&&(L||P?i:s)}]),onMouseDown:G,onTouchStart:G,onClick:v?_:void 0,ref:m,...f,children:c})}const Oo=p.memo(FL(rV));function sV({data:e,isConnectable:t,sourcePosition:n=Xe.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(Oo,{type:"source",position:n,isConnectable:t})]})}function iV({data:e,isConnectable:t,targetPosition:n=Xe.Top,sourcePosition:r=Xe.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(Oo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(Oo,{type:"source",position:r,isConnectable:t})]})}function oV(){return null}function lV({data:e,isConnectable:t,targetPosition:n=Xe.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(Oo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const hp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bT={input:sV,default:iV,output:lV,group:oV};function cV(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const dV=e=>{const{width:t,height:n,x:r,y:s}=Wu(e.nodeLookup,{filter:i=>!!i.selected});return{width:pr(t)?t:null,height:pr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function uV({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xt(),{width:s,height:i,transformString:o,userSelectionActive:l}=gt(dV,en),c=$L(),u=p.useRef(null);if(p.useEffect(()=>{var f;n||(f=u.current)==null||f.focus({preventScroll:!0})},[n]),zL({nodeRef:u}),l||!s||!i)return null;const h=e?f=>{const m=r.getState().nodes.filter(y=>y.selected);e(f,m)}:void 0,d=f=>{Object.prototype.hasOwnProperty.call(hp,f.key)&&(f.preventDefault(),c({direction:hp[f.key],factor:f.shiftKey?4:1}))};return a.jsx("div",{className:yn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:i}})})}const vT=typeof window<"u"?window:void 0,hV=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function qL({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:h,selectionMode:d,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:w,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:N,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:R,defaultViewport:L,translateExtent:P,minZoom:U,maxZoom:F,preventScrolling:G,onSelectionContextMenu:_,noWheelClassName:I,noPanClassName:A,disableKeyboardA11y:C,onViewportChange:T,isControlledViewport:O}){const{nodesSelectionActive:q,userSelectionActive:k}=gt(hV),M=vu(u,{target:vT}),$=vu(b,{target:vT}),W=$||R,Y=$||N,te=h&&W!==!0,ne=M||k||te;return VG({deleteKeyCode:c,multiSelectionKeyCode:y}),a.jsx(XG,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:Y,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:!M&&W,defaultViewport:L,translateExtent:P,minZoom:U,maxZoom:F,zoomActivationKeyCode:w,preventScrolling:G,noWheelClassName:I,noPanClassName:A,onViewportChange:T,isControlledViewport:O,paneClickDistance:l,selectionOnDrag:te,children:a.jsxs(JG,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:W,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:M,paneClickDistance:l,selectionOnDrag:te,children:[e,q&&a.jsx(uV,{onSelectionContextMenu:_,noPanClassName:A,disableKeyboardA11y:C})]})})}qL.displayName="FlowRenderer";const fV=p.memo(qL),pV=e=>t=>e?mS(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function mV(e){return gt(p.useCallback(pV(e),[e]),en)}const gV=e=>e.updateNodeInternals;function xV(){const e=gt(gV),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function bV({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Xt(),i=p.useRef(null),o=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),h=n&&!!e.internals.handleBounds;return p.useEffect(()=>{i.current&&!e.hidden&&(!h||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[h,e.hidden]),p.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),p.useEffect(()=>{if(i.current){const d=u.current!==t,f=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(d||f||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function vV({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:h,resizeObserver:d,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:y,rfId:b,nodeTypes:w,nodeClickDistance:x,onError:v}){const{node:g,internals:N,isParent:S}=gt(X=>{const se=X.nodeLookup.get(e),Ee=X.parentLookup.has(e);return{node:se,internals:se.internals,isParent:Ee}},en);let E=g.type||"default",j=(w==null?void 0:w[E])||bT[E];j===void 0&&(v==null||v("003",Yr.error003(E)),E="default",j=(w==null?void 0:w.default)||bT.default);const R=!!(g.draggable||l&&typeof g.draggable>"u"),L=!!(g.selectable||c&&typeof g.selectable>"u"),P=!!(g.connectable||u&&typeof g.connectable>"u"),U=!!(g.focusable||h&&typeof g.focusable>"u"),F=Xt(),G=iL(g),_=bV({node:g,nodeType:E,hasDimensions:G,resizeObserver:d}),I=zL({nodeRef:_,disabled:g.hidden||!R,noDragClassName:f,handleSelector:g.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:x}),A=$L();if(g.hidden)return null;const C=Gs(g),T=cV(g),O=L||R||t||n||r||s,q=n?X=>n(X,{...N.userNode}):void 0,k=r?X=>r(X,{...N.userNode}):void 0,M=s?X=>s(X,{...N.userNode}):void 0,$=i?X=>i(X,{...N.userNode}):void 0,W=o?X=>o(X,{...N.userNode}):void 0,Y=X=>{const{selectNodesOnDrag:se,nodeDragThreshold:Ee}=F.getState();L&&(!se||!R||Ee>0)&&AN({id:e,store:F,nodeRef:_}),t&&t(X,{...N.userNode})},te=X=>{if(!(cL(X.nativeEvent)||y)){if(ZM.includes(X.key)&&L){const se=X.key==="Escape";AN({id:e,store:F,unselect:se,nodeRef:_})}else if(R&&g.selected&&Object.prototype.hasOwnProperty.call(hp,X.key)){X.preventDefault();const{ariaLabelConfig:se}=F.getState();F.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),A({direction:hp[X.key],factor:X.shiftKey?4:1})}}},ne=()=>{var ze;if(y||!((ze=_.current)!=null&&ze.matches(":focus-visible")))return;const{transform:X,width:se,height:Ee,autoPanOnNodeFocus:re,setCenter:xe}=F.getState();if(!re)return;mS(new Map([[e,g]]),{x:0,y:0,width:se,height:Ee},X,!0).length>0||xe(g.position.x+C.width/2,g.position.y+C.height/2,{zoom:X[2]})};return a.jsx("div",{className:yn(["react-flow__node",`react-flow__node-${E}`,{[m]:R},g.className,{selected:g.selected,selectable:L,parent:S,draggable:R,dragging:I}]),ref:_,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:G?"visible":"hidden",...g.style,...T},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:q,onMouseMove:k,onMouseLeave:M,onContextMenu:$,onClick:Y,onDoubleClick:W,onKeyDown:U?te:void 0,tabIndex:U?0:void 0,onFocus:U?ne:void 0,role:g.ariaRole??(U?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${DL}-${b}`,"aria-label":g.ariaLabel,...g.domAttributes,children:a.jsx(tV,{value:e,children:a.jsx(j,{id:e,data:g.data,type:E,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:g.selected??!1,selectable:L,draggable:R,deletable:g.deletable??!0,isConnectable:P,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:I,dragHandle:g.dragHandle,zIndex:N.z,parentId:g.parentId,...C})})})}var yV=p.memo(vV);const wV=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function GL(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=gt(wV,en),o=mV(e.onlyRenderVisibleElements),l=xV();return a.jsx("div",{className:"react-flow__nodes",style:om,children:o.map(c=>a.jsx(yV,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}GL.displayName="NodeRenderer";const NV=p.memo(GL);function SV(e){return gt(p.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&lq({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),en)}const EV=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},jV=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},yT={[cp.Arrow]:EV,[cp.ArrowClosed]:jV};function TV(e){const t=Xt();return p.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(yT,e)?yT[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Yr.error009(e)),null)},[e])}const CV=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=TV(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},VL=({defaultColor:e,rfId:t})=>{const n=gt(i=>i.edges),r=gt(i=>i.defaultEdgeOptions),s=p.useMemo(()=>mq(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(CV,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};VL.displayName="MarkerDefinitions";var kV=p.memo(VL);function YL({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...h}){const[d,f]=p.useState({x:1,y:0,width:0,height:0}),m=yn(["react-flow__edge-textwrapper",u]),y=p.useRef(null);return p.useEffect(()=>{if(y.current){const b=y.current.getBBox();f({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:m,visibility:d.width?"visible":"hidden",...h,children:[s&&a.jsx("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}YL.displayName="EdgeText";const AV=p.memo(YL);function lm({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...h}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...h,d:e,fill:"none",className:yn(["react-flow__edge-path",h.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&pr(t)&&pr(n)?a.jsx(AV,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function wT({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Xe.Left||e===Xe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function WL({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top}){const[o,l]=wT({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=wT({pos:i,x1:r,y1:s,x2:e,y2:t}),[h,d,f,m]=uL({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,h,d,f,m]}function XL(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:x})=>{const[v,g,N]=WL({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),S=e.isInternal?void 0:t;return a.jsx(lm,{id:S,path:v,labelX:g,labelY:N,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:x})})}const _V=XL({isInternal:!1}),KL=XL({isInternal:!0});_V.displayName="SimpleBezierEdge";KL.displayName="SimpleBezierEdgeInternal";function ZL(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,sourcePosition:m=Xe.Bottom,targetPosition:y=Xe.Top,markerEnd:b,markerStart:w,pathOptions:x,interactionWidth:v})=>{const[g,N,S]=jN({sourceX:n,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:y,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),E=e.isInternal?void 0:t;return a.jsx(lm,{id:E,path:g,labelX:N,labelY:S,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:b,markerStart:w,interactionWidth:v})})}const QL=ZL({isInternal:!1}),JL=ZL({isInternal:!0});QL.displayName="SmoothStepEdge";JL.displayName="SmoothStepEdgeInternal";function e3(e){return p.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(QL,{...n,id:r,pathOptions:p.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const RV=e3({isInternal:!1}),t3=e3({isInternal:!0});RV.displayName="StepEdge";t3.displayName="StepEdgeInternal";function n3(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:y,interactionWidth:b})=>{const[w,x,v]=mL({sourceX:n,sourceY:r,targetX:s,targetY:i}),g=e.isInternal?void 0:t;return a.jsx(lm,{id:g,path:w,labelX:x,labelY:v,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:y,interactionWidth:b})})}const OV=n3({isInternal:!1}),a3=n3({isInternal:!0});OV.displayName="StraightEdge";a3.displayName="StraightEdgeInternal";function r3(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=Xe.Bottom,targetPosition:l=Xe.Top,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,pathOptions:x,interactionWidth:v})=>{const[g,N,S]=hL({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:x==null?void 0:x.curvature}),E=e.isInternal?void 0:t;return a.jsx(lm,{id:E,path:g,labelX:N,labelY:S,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:v})})}const DV=r3({isInternal:!1}),s3=r3({isInternal:!0});DV.displayName="BezierEdge";s3.displayName="BezierEdgeInternal";const NT={default:s3,straight:a3,step:t3,smoothstep:JL,simplebezier:KL},ST={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},IV=(e,t,n)=>n===Xe.Left?e-t:n===Xe.Right?e+t:e,MV=(e,t,n)=>n===Xe.Top?e-t:n===Xe.Bottom?e+t:e,ET="react-flow__edgeupdater";function jT({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:yn([ET,`${ET}-${l}`]),cx:IV(t,r,e),cy:MV(n,r,e),r,stroke:"transparent",fill:"transparent"})}function LV({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:h,onReconnectEnd:d,setReconnecting:f,setUpdateHover:m}){const y=Xt(),b=(N,S)=>{if(N.button!==0)return;const{autoPanOnConnect:E,domNode:j,isValidConnection:R,connectionMode:L,connectionRadius:P,lib:U,onConnectStart:F,onConnectEnd:G,cancelConnection:_,nodeLookup:I,rfId:A,panBy:C,updateConnection:T}=y.getState(),O=S.type==="target",q=($,W)=>{f(!1),d==null||d($,n,S.type,W)},k=$=>u==null?void 0:u(n,$),M=($,W)=>{f(!0),h==null||h(N,n,S.type),F==null||F($,W)};kN.onPointerDown(N.nativeEvent,{autoPanOnConnect:E,connectionMode:L,connectionRadius:P,domNode:j,handleId:S.id,nodeId:S.nodeId,nodeLookup:I,isTarget:O,edgeUpdaterType:S.type,lib:U,flowId:A,cancelConnection:_,panBy:C,isValidConnection:R,onConnect:k,onConnectStart:M,onConnectEnd:G,onReconnectEnd:q,updateConnection:T,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},w=N=>b(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=N=>b(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),g=()=>m(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(jT,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&a.jsx(jT,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:x,onMouseEnter:v,onMouseOut:g,type:"target"})]})}function UV({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:m,rfId:y,edgeTypes:b,noPanClassName:w,onError:x,disableKeyboardA11y:v}){let g=gt(xe=>xe.edgeLookup.get(e));const N=gt(xe=>xe.defaultEdgeOptions);g=N?{...N,...g}:g;let S=g.type||"default",E=(b==null?void 0:b[S])||NT[S];E===void 0&&(x==null||x("011",Yr.error011(S)),S="default",E=(b==null?void 0:b.default)||NT.default);const j=!!(g.focusable||t&&typeof g.focusable>"u"),R=typeof d<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),L=!!(g.selectable||r&&typeof g.selectable>"u"),P=p.useRef(null),[U,F]=p.useState(!1),[G,_]=p.useState(!1),I=Xt(),{zIndex:A,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M}=gt(p.useCallback(xe=>{const ye=xe.nodeLookup.get(g.source),ze=xe.nodeLookup.get(g.target);if(!ye||!ze)return{zIndex:g.zIndex,...ST};const He=pq({id:e,sourceNode:ye,targetNode:ze,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:xe.connectionMode,onError:x});return{zIndex:oq({selected:g.selected,zIndex:g.zIndex,sourceNode:ye,targetNode:ze,elevateOnSelect:xe.elevateEdgesOnSelect}),...He||ST}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),en),$=p.useMemo(()=>g.markerStart?`url('#${TN(g.markerStart,y)}')`:void 0,[g.markerStart,y]),W=p.useMemo(()=>g.markerEnd?`url('#${TN(g.markerEnd,y)}')`:void 0,[g.markerEnd,y]);if(g.hidden||C===null||T===null||O===null||q===null)return null;const Y=xe=>{var Fe;const{addSelectedEdges:ye,unselectNodesAndEdges:ze,multiSelectionActive:He}=I.getState();L&&(I.setState({nodesSelectionActive:!1}),g.selected&&He?(ze({nodes:[],edges:[g]}),(Fe=P.current)==null||Fe.blur()):ye([e])),s&&s(xe,g)},te=i?xe=>{i(xe,{...g})}:void 0,ne=o?xe=>{o(xe,{...g})}:void 0,X=l?xe=>{l(xe,{...g})}:void 0,se=c?xe=>{c(xe,{...g})}:void 0,Ee=u?xe=>{u(xe,{...g})}:void 0,re=xe=>{var ye;if(!v&&ZM.includes(xe.key)&&L){const{unselectNodesAndEdges:ze,addSelectedEdges:He}=I.getState();xe.key==="Escape"?((ye=P.current)==null||ye.blur(),ze({edges:[g]})):He([e])}};return a.jsx("svg",{style:{zIndex:A},children:a.jsxs("g",{className:yn(["react-flow__edge",`react-flow__edge-${S}`,g.className,w,{selected:g.selected,animated:g.animated,inactive:!L&&!s,updating:U,selectable:L}]),onClick:Y,onDoubleClick:te,onContextMenu:ne,onMouseEnter:X,onMouseMove:se,onMouseLeave:Ee,onKeyDown:j?re:void 0,tabIndex:j?0:void 0,role:g.ariaRole??(j?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":j?`${IL}-${y}`:void 0,ref:P,...g.domAttributes,children:[!G&&a.jsx(E,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:L,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:$,markerEnd:W,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),R&&a.jsx(LV,{edge:g,isReconnectable:R,reconnectRadius:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:m,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M,setUpdateHover:F,setReconnecting:_})]})})}var PV=p.memo(UV);const FV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function i3({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:h,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:w,edgesReconnectable:x,elementsSelectable:v,onError:g}=gt(FV,en),N=SV(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(kV,{defaultColor:e,rfId:n}),N.map(S=>a.jsx(PV,{id:S,edgesFocusable:w,edgesReconnectable:x,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:h,reconnectRadius:d,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:g,edgeTypes:r,disableKeyboardA11y:b},S))]})}i3.displayName="EdgeRenderer";const BV=p.memo(i3),zV=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $V({children:e}){const t=gt(zV);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function HV(e){const t=NS(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qV=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function GV(e){const t=gt(qV),n=Xt();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function VV(e){return e.connection.inProgress?{...e.connection,to:Ku(e.connection.to,e.transform)}:{...e.connection}}function YV(e){return VV}function WV(e){const t=YV();return gt(t,en)}const XV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function KV({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=gt(XV,en);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:yn(["react-flow__connection",eL(l)]),children:a.jsx(o3,{style:t,type:n,CustomComponent:r,isValid:l})})})}const o3=({style:e,type:t=Si.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:h,toHandle:d,toPosition:f,pointer:m}=WV();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:eL(r),toNode:h,toHandle:d,pointer:m});let y="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case Si.Bezier:[y]=hL(b);break;case Si.SimpleBezier:[y]=WL(b);break;case Si.Step:[y]=jN({...b,borderRadius:0});break;case Si.SmoothStep:[y]=jN(b);break;default:[y]=mL(b)}return a.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};o3.displayName="ConnectionLine";const ZV={};function TT(e=ZV){p.useRef(e),Xt(),p.useEffect(()=>{},[e])}function QV(){Xt(),p.useRef(!1),p.useEffect(()=>{},[])}function l3({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:h,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:v,selectionOnDrag:g,selectionMode:N,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:j,deleteKeyCode:R,onlyRenderVisibleElements:L,elementsSelectable:P,defaultViewport:U,translateExtent:F,minZoom:G,maxZoom:_,preventScrolling:I,defaultMarkerColor:A,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:$,onPaneClick:W,onPaneMouseEnter:Y,onPaneMouseMove:te,onPaneMouseLeave:ne,onPaneScroll:X,onPaneContextMenu:se,paneClickDistance:Ee,nodeClickDistance:re,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:ze,onEdgeMouseLeave:He,reconnectRadius:Fe,onReconnect:Ye,onReconnectStart:ft,onReconnectEnd:et,noDragClassName:de,noWheelClassName:Be,noPanClassName:Ue,disableKeyboardA11y:Oe,nodeExtent:We,rfId:nt,viewport:lt,onViewportChange:Ut}){return TT(e),TT(t),QV(),HV(n),GV(lt),a.jsx(fV,{onPaneClick:W,onPaneMouseEnter:Y,onPaneMouseMove:te,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:X,paneClickDistance:Ee,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:g,selectionMode:N,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:j,elementsSelectable:P,zoomOnScroll:C,zoomOnPinch:T,zoomOnDoubleClick:M,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:k,panOnDrag:$,defaultViewport:U,translateExtent:F,minZoom:G,maxZoom:_,onSelectionContextMenu:d,preventScrolling:I,noDragClassName:de,noWheelClassName:Be,noPanClassName:Ue,disableKeyboardA11y:Oe,onViewportChange:Ut,isControlledViewport:!!lt,children:a.jsxs($V,{children:[a.jsx(BV,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ye,onReconnectStart:ft,onReconnectEnd:et,onlyRenderVisibleElements:L,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:ze,onEdgeMouseLeave:He,reconnectRadius:Fe,defaultMarkerColor:A,noPanClassName:Ue,disableKeyboardA11y:Oe,rfId:nt}),a.jsx(KV,{style:b,type:y,component:w,containerStyle:x}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(NV,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:h,nodeClickDistance:re,onlyRenderVisibleElements:L,noPanClassName:Ue,noDragClassName:de,disableKeyboardA11y:Oe,nodeExtent:We,rfId:nt}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}l3.displayName="GraphView";const JV=p.memo(l3),CT=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:h,nodeExtent:d}={})=>{const f=new Map,m=new Map,y=new Map,b=new Map,w=r??t??[],x=n??e??[],v=h??[0,0],g=d??pu;bL(y,b,w);const N=CN(x,f,m,{nodeOrigin:v,nodeExtent:g,elevateNodesOnSelect:!1});let S=[0,0,1];if(o&&s&&i){const E=Wu(f,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:j,y:R,zoom:L}=gS(E,s,i,c,u,(l==null?void 0:l.padding)??.1);S=[j,R,L]}return{rfId:"1",width:s??0,height:i??0,transform:S,nodes:x,nodesInitialized:N,nodeLookup:f,parentLookup:m,edges:w,edgeLookup:b,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:pu,nodeExtent:g,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...JM},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tq,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:QM}},eY=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:h,nodeExtent:d})=>bG((f,m)=>{async function y(){const{nodeLookup:b,panZoom:w,fitViewOptions:x,fitViewResolver:v,width:g,height:N,minZoom:S,maxZoom:E}=m();w&&(await J7({nodes:b,width:g,height:N,panZoom:w,minZoom:S,maxZoom:E},x),v==null||v.resolve(!0),f({fitViewResolver:null}))}return{...CT({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:h,nodeExtent:d,defaultNodes:n,defaultEdges:r}),setNodes:b=>{const{nodeLookup:w,parentLookup:x,nodeOrigin:v,elevateNodesOnSelect:g,fitViewQueued:N}=m(),S=CN(b,w,x,{nodeOrigin:v,nodeExtent:d,elevateNodesOnSelect:g,checkEquality:!0});N&&S?(y(),f({nodes:b,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:b,nodesInitialized:S})},setEdges:b=>{const{connectionLookup:w,edgeLookup:x}=m();bL(w,x,b),f({edges:b})},setDefaultNodesAndEdges:(b,w)=>{if(b){const{setNodes:x}=m();x(b),f({hasDefaultNodes:!0})}if(w){const{setEdges:x}=m();x(w),f({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:w,nodeLookup:x,parentLookup:v,domNode:g,nodeOrigin:N,nodeExtent:S,debug:E,fitViewQueued:j}=m(),{changes:R,updatedInternals:L}=Nq(b,x,v,g,N,S);L&&(bq(x,v,{nodeOrigin:N,nodeExtent:S}),j?(y(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),(R==null?void 0:R.length)>0&&(E&&console.log("React Flow: trigger node changes",R),w==null||w(R)))},updateNodePositions:(b,w=!1)=>{const x=[],v=[],{nodeLookup:g,triggerNodeChanges:N}=m();for(const[S,E]of b){const j=g.get(S),R=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(E!=null&&E.position)),L={id:S,type:"position",position:R?{x:Math.max(0,E.position.x),y:Math.max(0,E.position.y)}:E.position,dragging:w};R&&j.parentId&&x.push({id:S,parentId:j.parentId,rect:{...E.internals.positionAbsolute,width:E.measured.width??0,height:E.measured.height??0}}),v.push(L)}if(x.length>0){const{parentLookup:S,nodeOrigin:E}=m(),j=wS(x,g,S,E);v.push(...j)}N(v)},triggerNodeChanges:b=>{const{onNodesChange:w,setNodes:x,nodes:v,hasDefaultNodes:g,debug:N}=m();if(b!=null&&b.length){if(g){const S=UL(b,v);x(S)}N&&console.log("React Flow: trigger node changes",b),w==null||w(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:w,setEdges:x,edges:v,hasDefaultEdges:g,debug:N}=m();if(b!=null&&b.length){if(g){const S=PL(b,v);x(S)}N&&console.log("React Flow: trigger edge changes",b),w==null||w(b)}},addSelectedNodes:b=>{const{multiSelectionActive:w,edgeLookup:x,nodeLookup:v,triggerNodeChanges:g,triggerEdgeChanges:N}=m();if(w){const S=b.map(E=>go(E,!0));g(S);return}g(Fl(v,new Set([...b]),!0)),N(Fl(x))},addSelectedEdges:b=>{const{multiSelectionActive:w,edgeLookup:x,nodeLookup:v,triggerNodeChanges:g,triggerEdgeChanges:N}=m();if(w){const S=b.map(E=>go(E,!0));N(S);return}N(Fl(x,new Set([...b]))),g(Fl(v,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:w}={})=>{const{edges:x,nodes:v,nodeLookup:g,triggerNodeChanges:N,triggerEdgeChanges:S}=m(),E=b||v,j=w||x,R=E.map(P=>{const U=g.get(P.id);return U&&(U.selected=!1),go(P.id,!1)}),L=j.map(P=>go(P.id,!1));N(R),S(L)},setMinZoom:b=>{const{panZoom:w,maxZoom:x}=m();w==null||w.setScaleExtent([b,x]),f({minZoom:b})},setMaxZoom:b=>{const{panZoom:w,minZoom:x}=m();w==null||w.setScaleExtent([x,b]),f({maxZoom:b})},setTranslateExtent:b=>{var w;(w=m().panZoom)==null||w.setTranslateExtent(b),f({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:w,triggerNodeChanges:x,triggerEdgeChanges:v,elementsSelectable:g}=m();if(!g)return;const N=w.reduce((E,j)=>j.selected?[...E,go(j.id,!1)]:E,[]),S=b.reduce((E,j)=>j.selected?[...E,go(j.id,!1)]:E,[]);x(N),v(S)},setNodeExtent:b=>{const{nodes:w,nodeLookup:x,parentLookup:v,nodeOrigin:g,elevateNodesOnSelect:N,nodeExtent:S}=m();b[0][0]===S[0][0]&&b[0][1]===S[0][1]&&b[1][0]===S[1][0]&&b[1][1]===S[1][1]||(CN(w,x,v,{nodeOrigin:g,nodeExtent:b,elevateNodesOnSelect:N,checkEquality:!1}),f({nodeExtent:b}))},panBy:b=>{const{transform:w,width:x,height:v,panZoom:g,translateExtent:N}=m();return Sq({delta:b,panZoom:g,transform:w,translateExtent:N,width:x,height:v})},setCenter:async(b,w,x)=>{const{width:v,height:g,maxZoom:N,panZoom:S}=m();if(!S)return Promise.resolve(!1);const E=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:N;return await S.setViewport({x:v/2-b*E,y:g/2-w*E,zoom:E},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...JM}})},updateConnection:b=>{f({connection:b})},reset:()=>f({...CT()})}},Object.is);function tY({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:h,nodeExtent:d,children:f}){const[m]=p.useState(()=>eY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:h,nodeExtent:d}));return a.jsx(vG,{value:m,children:a.jsx($G,{children:f})})}function nY({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:h,nodeOrigin:d,nodeExtent:f}){return p.useContext(sm)?a.jsx(a.Fragment,{children:e}):a.jsx(tY,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:h,nodeOrigin:d,nodeExtent:f,children:e})}const aY={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function rY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:h,onMoveStart:d,onMoveEnd:f,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:x,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:j,onNodeDrag:R,onNodeDragStop:L,onNodesDelete:P,onEdgesDelete:U,onDelete:F,onSelectionChange:G,onSelectionDragStart:_,onSelectionDrag:I,onSelectionDragStop:A,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:O,onBeforeDelete:q,connectionMode:k,connectionLineType:M=Si.Bezier,connectionLineStyle:$,connectionLineComponent:W,connectionLineContainerStyle:Y,deleteKeyCode:te="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:X=!1,selectionMode:se=mu.Full,panActivationKeyCode:Ee="Space",multiSelectionKeyCode:re=xu()?"Meta":"Control",zoomActivationKeyCode:xe=xu()?"Meta":"Control",snapToGrid:ye,snapGrid:ze,onlyRenderVisibleElements:He=!1,selectNodesOnDrag:Fe,nodesDraggable:Ye,autoPanOnNodeFocus:ft,nodesConnectable:et,nodesFocusable:de,nodeOrigin:Be=ML,edgesFocusable:Ue,edgesReconnectable:Oe,elementsSelectable:We=!0,defaultViewport:nt=OG,minZoom:lt=.5,maxZoom:Ut=2,translateExtent:Kt=pu,preventScrolling:Gt=!0,nodeExtent:_t,defaultMarkerColor:ce="#b1b1b7",zoomOnScroll:Te=!0,zoomOnPinch:Ze=!0,panOnScroll:Q=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:be=Ro.Free,zoomOnDoubleClick:_e=!0,panOnDrag:$e=!0,onPaneClick:je,onPaneMouseEnter:K,onPaneMouseMove:ue,onPaneMouseLeave:Ae,onPaneScroll:Le,onPaneContextMenu:he,paneClickDistance:Z=1,nodeClickDistance:oe=0,children:De,onReconnect:it,onReconnectStart:tt,onReconnectEnd:at,onEdgeContextMenu:It,onEdgeDoubleClick:wn,onEdgeMouseEnter:sn,onEdgeMouseMove:ns,onEdgeMouseLeave:In,reconnectRadius:qn=10,onNodesChange:sr,onEdgesChange:as,noDragClassName:nl="nodrag",noWheelClassName:Ws="nowheel",noPanClassName:Fn="nopan",fitView:Mt,fitViewOptions:rs,connectOnClick:ss,attributionPosition:is,proOptions:Sr,defaultEdgeOptions:os,elevateNodesOnSelect:Er,elevateEdgesOnSelect:Xs,disableKeyboardA11y:pa=!1,autoPanOnConnect:Qn,autoPanOnNodeDrag:Fa,autoPanSpeed:Ks,connectionRadius:ma,isValidConnection:Jn,onError:ir,style:Zs,id:Qs,nodeDragThreshold:al,connectionDragThreshold:Js,viewport:ro,onViewportChange:xt,width:jr,height:Tr,colorMode:ei="light",debug:ls,onScroll:or,ariaLabelConfig:cs,...Ba},so){const ds=Qs||"1",rl=LG(ei),we=p.useCallback(Ne=>{Ne.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),or==null||or(Ne)},[or]);return a.jsx("div",{"data-testid":"rf__wrapper",...Ba,onScroll:we,style:{...Zs,...aY},ref:so,className:yn(["react-flow",s,rl]),id:Qs,role:"application",children:a.jsxs(nY,{nodes:e,edges:t,width:jr,height:Tr,fitView:Mt,fitViewOptions:rs,minZoom:lt,maxZoom:Ut,nodeOrigin:Be,nodeExtent:_t,children:[a.jsx(JV,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:o,connectionLineType:M,connectionLineStyle:$,connectionLineComponent:W,connectionLineContainerStyle:Y,selectionKeyCode:ne,selectionOnDrag:X,selectionMode:se,deleteKeyCode:te,multiSelectionKeyCode:re,panActivationKeyCode:Ee,zoomActivationKeyCode:xe,onlyRenderVisibleElements:He,defaultViewport:nt,translateExtent:Kt,minZoom:lt,maxZoom:Ut,preventScrolling:Gt,zoomOnScroll:Te,zoomOnPinch:Ze,zoomOnDoubleClick:_e,panOnScroll:Q,panOnScrollSpeed:pe,panOnScrollMode:be,panOnDrag:$e,onPaneClick:je,onPaneMouseEnter:K,onPaneMouseMove:ue,onPaneMouseLeave:Ae,onPaneScroll:Le,onPaneContextMenu:he,paneClickDistance:Z,nodeClickDistance:oe,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:O,onReconnect:it,onReconnectStart:tt,onReconnectEnd:at,onEdgeContextMenu:It,onEdgeDoubleClick:wn,onEdgeMouseEnter:sn,onEdgeMouseMove:ns,onEdgeMouseLeave:In,reconnectRadius:qn,defaultMarkerColor:ce,noDragClassName:nl,noWheelClassName:Ws,noPanClassName:Fn,rfId:ds,disableKeyboardA11y:pa,nodeExtent:_t,viewport:ro,onViewportChange:xt}),a.jsx(MG,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:x,nodesDraggable:Ye,autoPanOnNodeFocus:ft,nodesConnectable:et,nodesFocusable:de,edgesFocusable:Ue,edgesReconnectable:Oe,elementsSelectable:We,elevateNodesOnSelect:Er,elevateEdgesOnSelect:Xs,minZoom:lt,maxZoom:Ut,nodeExtent:_t,onNodesChange:sr,onEdgesChange:as,snapToGrid:ye,snapGrid:ze,connectionMode:k,translateExtent:Kt,connectOnClick:ss,defaultEdgeOptions:os,fitView:Mt,fitViewOptions:rs,onNodesDelete:P,onEdgesDelete:U,onDelete:F,onNodeDragStart:j,onNodeDrag:R,onNodeDragStop:L,onSelectionDrag:I,onSelectionDragStart:_,onSelectionDragStop:A,onMove:h,onMoveStart:d,onMoveEnd:f,noPanClassName:Fn,nodeOrigin:Be,rfId:ds,autoPanOnConnect:Qn,autoPanOnNodeDrag:Fa,autoPanSpeed:Ks,onError:ir,connectionRadius:ma,isValidConnection:Jn,selectNodesOnDrag:Fe,nodeDragThreshold:al,connectionDragThreshold:Js,onBeforeDelete:q,debug:ls,ariaLabelConfig:cs}),a.jsx(RG,{onSelectionChange:G}),De,a.jsx(TG,{proOptions:Sr,position:is}),a.jsx(jG,{rfId:ds,disableKeyboardA11y:pa})]})})}var sY=FL(rY);function iY(e){const[t,n]=p.useState(e),r=p.useCallback(s=>n(i=>UL(s,i)),[]);return[t,n,r]}function oY(e){const[t,n]=p.useState(e),r=p.useCallback(s=>n(i=>PL(s,i)),[]);return[t,n,r]}function lY({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:yn(["react-flow__background-pattern",n,r])})}function cY({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:yn(["react-flow__background-pattern","dots",t])})}var Is;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Is||(Is={}));const dY={[Is.Dots]:1,[Is.Lines]:1,[Is.Cross]:6},uY=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function c3({id:e,variant:t=Is.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:h}){const d=p.useRef(null),{transform:f,patternId:m}=gt(uY,en),y=r||dY[t],b=t===Is.Dots,w=t===Is.Cross,x=Array.isArray(n)?n:[n,n],v=[x[0]*f[2]||1,x[1]*f[2]||1],g=y*f[2],N=Array.isArray(i)?i:[i,i],S=w?[g,g]:v,E=[N[0]*f[2]||1+S[0]/2,N[1]*f[2]||1+S[1]/2],j=`${m}${e||""}`;return a.jsxs("svg",{className:yn(["react-flow__background",u]),style:{...c,...om,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:d,"data-testid":"rf__background",children:[a.jsx("pattern",{id:j,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:b?a.jsx(cY,{radius:g/2,className:h}):a.jsx(lY,{dimensions:S,lineWidth:s,variant:t,className:h})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j})`})]})}c3.displayName="Background";const hY=p.memo(c3);function fY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function pY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function mY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function gY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function xY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Mh({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:yn(["react-flow__controls-button",t]),...n,children:e})}const bY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function d3({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:h,position:d="bottom-left",orientation:f="vertical","aria-label":m}){const y=Xt(),{isInteractive:b,minZoomReached:w,maxZoomReached:x,ariaLabelConfig:v}=gt(bY,en),{zoomIn:g,zoomOut:N,fitView:S}=NS(),E=()=>{g(),i==null||i()},j=()=>{N(),o==null||o()},R=()=>{S(s),l==null||l()},L=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},P=f==="horizontal"?"horizontal":"vertical";return a.jsxs(im,{className:yn(["react-flow__controls",P,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Mh,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:x,children:a.jsx(fY,{})}),a.jsx(Mh,{onClick:j,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:w,children:a.jsx(pY,{})})]}),n&&a.jsx(Mh,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:a.jsx(mY,{})}),r&&a.jsx(Mh,{className:"react-flow__controls-interactive",onClick:L,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?a.jsx(xY,{}):a.jsx(gY,{})}),h]})}d3.displayName="Controls";const vY=p.memo(d3);function yY({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:h,shapeRendering:d,selected:f,onClick:m}){const{background:y,backgroundColor:b}=i||{},w=o||y||b;return a.jsx("rect",{className:yn(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:h,ry:h,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:d,onClick:m?x=>m(x,e):void 0})}const wY=p.memo(yY),NY=e=>e.nodes.map(t=>t.id),Dg=e=>e instanceof Function?e:()=>e;function SY({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=wY,onClick:o}){const l=gt(NY,en),c=Dg(t),u=Dg(e),h=Dg(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(f=>a.jsx(jY,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:h,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:d},f))})}function EY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:h,y:d,width:f,height:m}=gt(y=>{const{internals:b}=y.nodeLookup.get(e),w=b.userNode,{x,y:v}=b.positionAbsolute,{width:g,height:N}=Gs(w);return{node:w,x,y:v,width:g,height:N}},en);return!u||u.hidden||!iL(u)?null:a.jsx(l,{x:h,y:d,width:f,height:m,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const jY=p.memo(EY);var TY=p.memo(SY);const CY=200,kY=150,AY=e=>!e.hidden,_Y=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?sL(Wu(e.nodeLookup,{filter:AY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},RY="react-flow__minimap-desc";function u3({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:h,maskStrokeWidth:d,position:f="bottom-right",onClick:m,onNodeClick:y,pannable:b=!1,zoomable:w=!1,ariaLabel:x,inversePan:v,zoomStep:g=1,offsetScale:N=5}){const S=Xt(),E=p.useRef(null),{boundingRect:j,viewBB:R,rfId:L,panZoom:P,translateExtent:U,flowWidth:F,flowHeight:G,ariaLabelConfig:_}=gt(_Y,en),I=(e==null?void 0:e.width)??CY,A=(e==null?void 0:e.height)??kY,C=j.width/I,T=j.height/A,O=Math.max(C,T),q=O*I,k=O*A,M=N*O,$=j.x-(q-j.width)/2-M,W=j.y-(k-j.height)/2-M,Y=q+M*2,te=k+M*2,ne=`${RY}-${L}`,X=p.useRef(0),se=p.useRef();X.current=O,p.useEffect(()=>{if(E.current&&P)return se.current=Oq({domNode:E.current,panZoom:P,getTransform:()=>S.getState().transform,getViewScale:()=>X.current}),()=>{var ye;(ye=se.current)==null||ye.destroy()}},[P]),p.useEffect(()=>{var ye;(ye=se.current)==null||ye.update({translateExtent:U,width:F,height:G,inversePan:v,pannable:b,zoomStep:g,zoomable:w})},[b,w,v,g,U,F,G]);const Ee=m?ye=>{var Fe;const[ze,He]=((Fe=se.current)==null?void 0:Fe.pointer(ye))||[0,0];m(ye,{x:ze,y:He})}:void 0,re=y?p.useCallback((ye,ze)=>{const He=S.getState().nodeLookup.get(ze).internals.userNode;y(ye,He)},[]):void 0,xe=x??_["minimap.ariaLabel"];return a.jsx(im,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:yn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:I,height:A,viewBox:`${$} ${W} ${Y} ${te}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:E,onClick:Ee,children:[xe&&a.jsx("title",{id:ne,children:xe}),a.jsx(TY,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-M},${W-M}h${Y+M*2}v${te+M*2}h${-Y-M*2}z
97
+ `)),h=u.reduce((d,f)=>d.concat(...f),[]);return[u,h]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??dT,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const h=m=>{var w,x;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!u)&&cL(m))return!1;const b=hT(m.code,l);if(i.current.add(m[b]),uT(o,i.current,!1)){const v=((x=(w=m.composedPath)==null?void 0:w.call(m))==null?void 0:x[0])||m.target,g=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!g)&&m.preventDefault(),r(!0)}},d=m=>{const y=hT(m.code,l);uT(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",h),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",h),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function uT(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function hT(e,t){return t.includes(e)?"code":"key"}const UG=()=>{const e=Xt();return p.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=e.getState(),c=gS(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},h=n.snapGrid??s,d=n.snapToGrid??i;return Ku(u,r,d,h)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=up(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function LL(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)PG(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function PG(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function UL(e,t){return LL(e,t)}function PL(e,t){return LL(e,t)}function go(e,t){return{id:e,type:"select",selected:t}}function Fl(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(go(i.id,o)))}return r}function fT({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const l=t.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function pT(e){return{id:e.id,type:"remove"}}const mT=e=>X7(e),FG=e=>tL(e);function FL(e){return p.forwardRef(e)}const BG=typeof window<"u"?p.useLayoutEffect:p.useEffect;function gT(e){const[t,n]=p.useState(BigInt(0)),[r]=p.useState(()=>zG(()=>n(s=>s+BigInt(1))));return BG(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function zG(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const BL=p.createContext(null);function $G({children:e}){const t=Xt(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:h,onNodesChange:d,nodeLookup:f,fitViewQueued:m}=t.getState();let y=c;for(const w of l)y=typeof w=="function"?w(y):w;const b=fT({items:y,lookup:f});h&&u(y),b.length>0?d==null||d(b):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:x,setNodes:v}=t.getState();w&&v(x)})},[]),r=gT(n),s=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:h,onEdgesChange:d,edgeLookup:f}=t.getState();let m=c;for(const y of l)m=typeof y=="function"?y(m):y;h?u(m):d&&d(fT({items:m,lookup:f}))},[]),i=gT(s),o=p.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(BL.Provider,{value:o,children:e})}function HG(){const e=p.useContext(BL);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const qG=e=>!!e.panZoom;function NS(){const e=UG(),t=Xt(),n=HG(),r=gt(qG),s=p.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),o=d=>{n.nodeQueue.push(d)},l=d=>{n.edgeQueue.push(d)},c=d=>{var x,v;const{nodeLookup:f,nodeOrigin:m}=t.getState(),y=mT(d)?d:f.get(d.id),b=y.parentId?oL(y.position,y.measured,y.parentId,f,m):y.position,w={...y,position:b,width:((x=y.measured)==null?void 0:x.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return yc(w)},u=(d,f,m={replace:!1})=>{o(y=>y.map(b=>{if(b.id===d){const w=typeof f=="function"?f(b):f;return m.replace&&mT(w)?w:{...b,...w}}return b}))},h=(d,f,m={replace:!1})=>{l(y=>y.map(b=>{if(b.id===d){const w=typeof f=="function"?f(b):f;return m.replace&&FG(w)?w:{...b,...w}}return b}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var f;return(f=i(d))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:o,setEdges:l,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(m=>[...m,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:m}=t.getState(),[y,b,w]=m;return{nodes:d.map(x=>({...x})),edges:f.map(x=>({...x})),viewport:{x:y,y:b,zoom:w}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:m,edges:y,onNodesDelete:b,onEdgesDelete:w,triggerNodeChanges:x,triggerEdgeChanges:v,onDelete:g,onBeforeDelete:N}=t.getState(),{nodes:S,edges:E}=await eq({nodesToRemove:d,edgesToRemove:f,nodes:m,edges:y,onBeforeDelete:N}),j=E.length>0,R=S.length>0;if(j){const L=E.map(pT);w==null||w(E),v(L)}if(R){const L=S.map(pT);b==null||b(S),x(L)}return(R||j)&&(g==null||g({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(d,f=!0,m)=>{const y=Gj(d),b=y?d:c(d),w=m!==void 0;return b?(m||t.getState().nodes).filter(x=>{const v=t.getState().nodeLookup.get(x.id);if(v&&!y&&(x.id===d.id||!v.internals.positionAbsolute))return!1;const g=yc(w?x:v),N=gu(g,b);return f&&N>0||N>=g.width*g.height||N>=b.width*b.height}):[]},isNodeIntersecting:(d,f,m=!0)=>{const b=Gj(d)?d:c(d);if(!b)return!1;const w=gu(b,f);return m&&w>0||w>=f.width*f.height||w>=b.width*b.height},updateNode:u,updateNodeData:(d,f,m={replace:!1})=>{u(d,y=>{const b=typeof f=="function"?f(y):f;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},updateEdge:h,updateEdgeData:(d,f,m={replace:!1})=>{h(d,y=>{const b=typeof f=="function"?f(y):f;return m.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},m)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return K7(d,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:d,id:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${d}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:d,handleId:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${d?f?`-${d}-${f}`:`-${d}`:""}`))==null?void 0:y.values())??[])},fitView:async d=>{const f=t.getState().fitViewResolver??rq();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return p.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const xT=e=>e.selected,GG=typeof window<"u"?window:void 0;function VG({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Xt(),{deleteElements:r}=NS(),s=vu(e,{actInsideInputWithModifier:!1}),i=vu(t,{target:GG});p.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(xT),edges:o.filter(xT)}),n.setState({nodesSelectionActive:!1})}},[s]),p.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function YG(e){const t=Xt();p.useEffect(()=>{const n=()=>{var s,i,o,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=xS(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",Yr.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const om={position:"absolute",width:"100%",height:"100%",top:0,left:0},WG=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function XG({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ro.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:h,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:m=!0,children:y,noWheelClassName:b,noPanClassName:w,onViewportChange:x,isControlledViewport:v,paneClickDistance:g,selectionOnDrag:N}){const S=Xt(),E=p.useRef(null),{userSelectionActive:j,lib:R,connectionInProgress:L}=gt(WG,en),P=vu(f),U=p.useRef();YG(E);const F=p.useCallback(G=>{x==null||x({x:G[0],y:G[1],zoom:G[2]}),v||S.setState({transform:G})},[x,v]);return p.useEffect(()=>{if(E.current){U.current=Bq({domNode:E.current,minZoom:h,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:A=>S.setState({paneDragging:A}),onPanZoomStart:(A,C)=>{const{onViewportChangeStart:T,onMoveStart:O}=S.getState();O==null||O(A,C),T==null||T(C)},onPanZoom:(A,C)=>{const{onViewportChange:T,onMove:O}=S.getState();O==null||O(A,C),T==null||T(C)},onPanZoomEnd:(A,C)=>{const{onViewportChangeEnd:T,onMoveEnd:O}=S.getState();O==null||O(A,C),T==null||T(C)}});const{x:G,y:_,zoom:I}=U.current.getViewport();return S.setState({panZoom:U.current,transform:[G,_,I],domNode:E.current.closest(".react-flow")}),()=>{var A;(A=U.current)==null||A.destroy()}}},[]),p.useEffect(()=>{var G;(G=U.current)==null||G.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:w,userSelectionActive:j,noWheelClassName:b,lib:R,onTransformChange:F,connectionInProgress:L,selectionOnDrag:N,paneClickDistance:g})},[e,t,n,r,s,i,o,l,P,m,w,j,b,R,F,L,N,g]),a.jsx("div",{className:"react-flow__renderer",ref:E,style:om,children:y})}const KG=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function ZG(){const{userSelectionActive:e,userSelectionRect:t}=gt(KG,en);return e&&t?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Og=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},QG=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function JG({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mu.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:o,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:h,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:m,children:y}){const b=Xt(),{userSelectionActive:w,elementsSelectable:x,dragging:v,connectionInProgress:g}=gt(QG,en),N=x&&(e||w),S=p.useRef(null),E=p.useRef(),j=p.useRef(new Set),R=p.useRef(new Set),L=p.useRef(!1),P=T=>{if(L.current||g){L.current=!1;return}c==null||c(T),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},U=T=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){T.preventDefault();return}u==null||u(T)},F=h?T=>h(T):void 0,G=T=>{L.current&&(T.stopPropagation(),L.current=!1)},_=T=>{var Y,te;const{domNode:O}=b.getState();if(E.current=O==null?void 0:O.getBoundingClientRect(),!E.current)return;const q=T.target===S.current;if(!q&&!!T.target.closest(".nokey")||!e||!(i&&q||t)||T.button!==0||!T.isPrimary)return;(te=(Y=T.target)==null?void 0:Y.setPointerCapture)==null||te.call(Y,T.pointerId),L.current=!1;const{x:$,y:W}=mr(T.nativeEvent,E.current);b.setState({userSelectionRect:{width:0,height:0,startX:$,startY:W,x:$,y:W}}),q||(T.stopPropagation(),T.preventDefault())},I=T=>{const{userSelectionRect:O,transform:q,nodeLookup:k,edgeLookup:M,connectionLookup:$,triggerNodeChanges:W,triggerEdgeChanges:Y,defaultEdgeOptions:te,resetSelectedElements:ne}=b.getState();if(!E.current||!O)return;const{x:X,y:se}=mr(T.nativeEvent,E.current),{startX:Ee,startY:re}=O;if(!L.current){const Fe=t?0:s;if(Math.hypot(X-Ee,se-re)<=Fe)return;ne(),o==null||o(T)}L.current=!0;const xe={startX:Ee,startY:re,x:X<Ee?X:Ee,y:se<re?se:re,width:Math.abs(X-Ee),height:Math.abs(se-re)},ye=j.current,ze=R.current;j.current=new Set(mS(k,xe,q,n===mu.Partial,!0).map(Fe=>Fe.id)),R.current=new Set;const He=(te==null?void 0:te.selectable)??!0;for(const Fe of j.current){const Ye=$.get(Fe);if(Ye)for(const{edgeId:ft}of Ye.values()){const et=M.get(ft);et&&(et.selectable??He)&&R.current.add(ft)}}if(!Vj(ye,j.current)){const Fe=Fl(k,j.current,!0);W(Fe)}if(!Vj(ze,R.current)){const Fe=Fl(M,R.current);Y(Fe)}b.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},A=T=>{var O,q;T.button===0&&((q=(O=T.target)==null?void 0:O.releasePointerCapture)==null||q.call(O,T.pointerId),!w&&T.target===S.current&&b.getState().userSelectionRect&&(P==null||P(T)),b.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(T),b.setState({nodesSelectionActive:j.current.size>0})))},C=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:yn(["react-flow__pane",{draggable:C,dragging:v,selection:e}]),onClick:N?void 0:Og(P,S),onContextMenu:Og(U,S),onWheel:Og(F,S),onPointerEnter:N?void 0:d,onPointerMove:N?I:f,onPointerUp:N?A:void 0,onPointerDownCapture:N?_:void 0,onClickCapture:N?G:void 0,onPointerLeave:m,ref:S,style:om,children:[y,a.jsx(ZG,{})]})}function AN({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Yr.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function zL({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Xt(),[c,u]=p.useState(!1),h=p.useRef();return p.useEffect(()=>{h.current=Tq({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{AN({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{var d,f;if(t)(d=h.current)==null||d.destroy();else if(e.current)return(f=h.current)==null||f.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var m;(m=h.current)==null||m.destroy()}},[n,r,t,i,e,s]),c}const eV=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function $L(){const e=Xt();return p.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:h}=e.getState(),d=new Map,f=eV(o),m=s?i[0]:5,y=s?i[1]:5,b=n.direction.x*m*n.factor,w=n.direction.y*y*n.factor;for(const[,x]of u){if(!f(x))continue;let v={x:x.internals.positionAbsolute.x+b,y:x.internals.positionAbsolute.y+w};s&&(v=Xu(v,i));const{position:g,positionAbsolute:N}=nL({nodeId:x.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:h,onError:l});x.position=g,x.internals.positionAbsolute=N,d.set(x.id,x)}c(d)},[])}const SS=p.createContext(null),tV=SS.Provider;SS.Consumer;const HL=()=>p.useContext(SS),nV=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),aV=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o,h=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:h,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===bc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:h&&u}};function rV({type:e="source",position:t=Xe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:u,onMouseDown:h,onTouchStart:d,...f},m){var I,A;const y=o||null,b=e==="target",w=Xt(),x=HL(),{connectOnClick:v,noPanClassName:g,rfId:N}=gt(nV,en),{connectingFrom:S,connectingTo:E,clickConnecting:j,isPossibleEndHandle:R,connectionInProcess:L,clickConnectionInProcess:P,valid:U}=gt(aV(x,y,e),en);x||(A=(I=w.getState()).onError)==null||A.call(I,"010",Yr.error010());const F=C=>{const{defaultEdgeOptions:T,onConnect:O,hasDefaultEdges:q}=w.getState(),k={...T,...C};if(q){const{edges:M,setEdges:$}=w.getState();$(pL(k,M))}O==null||O(k),l==null||l(k)},G=C=>{if(!x)return;const T=dL(C.nativeEvent);if(s&&(T&&C.button===0||!T)){const O=w.getState();kN.onPointerDown(C.nativeEvent,{handleDomNode:C.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:b,handleId:y,nodeId:x,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:O.onConnectEnd,updateConnection:O.updateConnection,onConnect:F,isValidConnection:n||O.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}T?h==null||h(C):d==null||d(C)},_=C=>{const{onClickConnectStart:T,onClickConnectEnd:O,connectionClickStartHandle:q,connectionMode:k,isValidConnection:M,lib:$,rfId:W,nodeLookup:Y,connection:te}=w.getState();if(!x||!q&&!s)return;if(!q){T==null||T(C.nativeEvent,{nodeId:x,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:x,type:e,id:y}});return}const ne=lL(C.target),X=n||M,{connection:se,isValid:Ee}=kN.isValid(C.nativeEvent,{handle:{nodeId:x,id:y,type:e},connectionMode:k,fromNodeId:q.nodeId,fromHandleId:q.id||null,fromType:q.type,isValidConnection:X,flowId:W,doc:ne,lib:$,nodeLookup:Y});Ee&&se&&F(se);const re=structuredClone(te);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,O==null||O(C,re),w.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":y,"data-nodeid":x,"data-handlepos":t,"data-id":`${N}-${x}-${y}-${e}`,className:yn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:j,connectingfrom:S,connectingto:E,valid:U,connectionindicator:r&&(!L||R)&&(L||P?i:s)}]),onMouseDown:G,onTouchStart:G,onClick:v?_:void 0,ref:m,...f,children:c})}const Oo=p.memo(FL(rV));function sV({data:e,isConnectable:t,sourcePosition:n=Xe.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(Oo,{type:"source",position:n,isConnectable:t})]})}function iV({data:e,isConnectable:t,targetPosition:n=Xe.Top,sourcePosition:r=Xe.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(Oo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(Oo,{type:"source",position:r,isConnectable:t})]})}function oV(){return null}function lV({data:e,isConnectable:t,targetPosition:n=Xe.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(Oo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const hp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bT={input:sV,default:iV,output:lV,group:oV};function cV(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const dV=e=>{const{width:t,height:n,x:r,y:s}=Wu(e.nodeLookup,{filter:i=>!!i.selected});return{width:pr(t)?t:null,height:pr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function uV({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xt(),{width:s,height:i,transformString:o,userSelectionActive:l}=gt(dV,en),c=$L(),u=p.useRef(null);if(p.useEffect(()=>{var f;n||(f=u.current)==null||f.focus({preventScroll:!0})},[n]),zL({nodeRef:u}),l||!s||!i)return null;const h=e?f=>{const m=r.getState().nodes.filter(y=>y.selected);e(f,m)}:void 0,d=f=>{Object.prototype.hasOwnProperty.call(hp,f.key)&&(f.preventDefault(),c({direction:hp[f.key],factor:f.shiftKey?4:1}))};return a.jsx("div",{className:yn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:i}})})}const vT=typeof window<"u"?window:void 0,hV=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function qL({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:h,selectionMode:d,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:w,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:N,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:R,defaultViewport:L,translateExtent:P,minZoom:U,maxZoom:F,preventScrolling:G,onSelectionContextMenu:_,noWheelClassName:I,noPanClassName:A,disableKeyboardA11y:C,onViewportChange:T,isControlledViewport:O}){const{nodesSelectionActive:q,userSelectionActive:k}=gt(hV),M=vu(u,{target:vT}),$=vu(b,{target:vT}),W=$||R,Y=$||N,te=h&&W!==!0,ne=M||k||te;return VG({deleteKeyCode:c,multiSelectionKeyCode:y}),a.jsx(XG,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:Y,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:!M&&W,defaultViewport:L,translateExtent:P,minZoom:U,maxZoom:F,zoomActivationKeyCode:w,preventScrolling:G,noWheelClassName:I,noPanClassName:A,onViewportChange:T,isControlledViewport:O,paneClickDistance:l,selectionOnDrag:te,children:a.jsxs(JG,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:W,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:M,paneClickDistance:l,selectionOnDrag:te,children:[e,q&&a.jsx(uV,{onSelectionContextMenu:_,noPanClassName:A,disableKeyboardA11y:C})]})})}qL.displayName="FlowRenderer";const fV=p.memo(qL),pV=e=>t=>e?mS(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function mV(e){return gt(p.useCallback(pV(e),[e]),en)}const gV=e=>e.updateNodeInternals;function xV(){const e=gt(gV),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function bV({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Xt(),i=p.useRef(null),o=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),h=n&&!!e.internals.handleBounds;return p.useEffect(()=>{i.current&&!e.hidden&&(!h||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[h,e.hidden]),p.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),p.useEffect(()=>{if(i.current){const d=u.current!==t,f=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(d||f||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function vV({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:h,resizeObserver:d,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:y,rfId:b,nodeTypes:w,nodeClickDistance:x,onError:v}){const{node:g,internals:N,isParent:S}=gt(X=>{const se=X.nodeLookup.get(e),Ee=X.parentLookup.has(e);return{node:se,internals:se.internals,isParent:Ee}},en);let E=g.type||"default",j=(w==null?void 0:w[E])||bT[E];j===void 0&&(v==null||v("003",Yr.error003(E)),E="default",j=(w==null?void 0:w.default)||bT.default);const R=!!(g.draggable||l&&typeof g.draggable>"u"),L=!!(g.selectable||c&&typeof g.selectable>"u"),P=!!(g.connectable||u&&typeof g.connectable>"u"),U=!!(g.focusable||h&&typeof g.focusable>"u"),F=Xt(),G=iL(g),_=bV({node:g,nodeType:E,hasDimensions:G,resizeObserver:d}),I=zL({nodeRef:_,disabled:g.hidden||!R,noDragClassName:f,handleSelector:g.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:x}),A=$L();if(g.hidden)return null;const C=Gs(g),T=cV(g),O=L||R||t||n||r||s,q=n?X=>n(X,{...N.userNode}):void 0,k=r?X=>r(X,{...N.userNode}):void 0,M=s?X=>s(X,{...N.userNode}):void 0,$=i?X=>i(X,{...N.userNode}):void 0,W=o?X=>o(X,{...N.userNode}):void 0,Y=X=>{const{selectNodesOnDrag:se,nodeDragThreshold:Ee}=F.getState();L&&(!se||!R||Ee>0)&&AN({id:e,store:F,nodeRef:_}),t&&t(X,{...N.userNode})},te=X=>{if(!(cL(X.nativeEvent)||y)){if(ZM.includes(X.key)&&L){const se=X.key==="Escape";AN({id:e,store:F,unselect:se,nodeRef:_})}else if(R&&g.selected&&Object.prototype.hasOwnProperty.call(hp,X.key)){X.preventDefault();const{ariaLabelConfig:se}=F.getState();F.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),A({direction:hp[X.key],factor:X.shiftKey?4:1})}}},ne=()=>{var ze;if(y||!((ze=_.current)!=null&&ze.matches(":focus-visible")))return;const{transform:X,width:se,height:Ee,autoPanOnNodeFocus:re,setCenter:xe}=F.getState();if(!re)return;mS(new Map([[e,g]]),{x:0,y:0,width:se,height:Ee},X,!0).length>0||xe(g.position.x+C.width/2,g.position.y+C.height/2,{zoom:X[2]})};return a.jsx("div",{className:yn(["react-flow__node",`react-flow__node-${E}`,{[m]:R},g.className,{selected:g.selected,selectable:L,parent:S,draggable:R,dragging:I}]),ref:_,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:G?"visible":"hidden",...g.style,...T},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:q,onMouseMove:k,onMouseLeave:M,onContextMenu:$,onClick:Y,onDoubleClick:W,onKeyDown:U?te:void 0,tabIndex:U?0:void 0,onFocus:U?ne:void 0,role:g.ariaRole??(U?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${DL}-${b}`,"aria-label":g.ariaLabel,...g.domAttributes,children:a.jsx(tV,{value:e,children:a.jsx(j,{id:e,data:g.data,type:E,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:g.selected??!1,selectable:L,draggable:R,deletable:g.deletable??!0,isConnectable:P,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:I,dragHandle:g.dragHandle,zIndex:N.z,parentId:g.parentId,...C})})})}var yV=p.memo(vV);const wV=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function GL(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=gt(wV,en),o=mV(e.onlyRenderVisibleElements),l=xV();return a.jsx("div",{className:"react-flow__nodes",style:om,children:o.map(c=>a.jsx(yV,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}GL.displayName="NodeRenderer";const NV=p.memo(GL);function SV(e){return gt(p.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&lq({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),en)}const EV=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},jV=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},yT={[cp.Arrow]:EV,[cp.ArrowClosed]:jV};function TV(e){const t=Xt();return p.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(yT,e)?yT[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Yr.error009(e)),null)},[e])}const CV=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=TV(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},VL=({defaultColor:e,rfId:t})=>{const n=gt(i=>i.edges),r=gt(i=>i.defaultEdgeOptions),s=p.useMemo(()=>mq(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(CV,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};VL.displayName="MarkerDefinitions";var kV=p.memo(VL);function YL({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...h}){const[d,f]=p.useState({x:1,y:0,width:0,height:0}),m=yn(["react-flow__edge-textwrapper",u]),y=p.useRef(null);return p.useEffect(()=>{if(y.current){const b=y.current.getBBox();f({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:m,visibility:d.width?"visible":"hidden",...h,children:[s&&a.jsx("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}YL.displayName="EdgeText";const AV=p.memo(YL);function lm({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...h}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...h,d:e,fill:"none",className:yn(["react-flow__edge-path",h.className])}),u?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&pr(t)&&pr(n)?a.jsx(AV,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function wT({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Xe.Left||e===Xe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function WL({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:r,targetY:s,targetPosition:i=Xe.Top}){const[o,l]=wT({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=wT({pos:i,x1:r,y1:s,x2:e,y2:t}),[h,d,f,m]=uL({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${l} ${c},${u} ${r},${s}`,h,d,f,m]}function XL(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:x})=>{const[v,g,N]=WL({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),S=e.isInternal?void 0:t;return a.jsx(lm,{id:S,path:v,labelX:g,labelY:N,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:x})})}const _V=XL({isInternal:!1}),KL=XL({isInternal:!0});_V.displayName="SimpleBezierEdge";KL.displayName="SimpleBezierEdgeInternal";function ZL(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,sourcePosition:m=Xe.Bottom,targetPosition:y=Xe.Top,markerEnd:b,markerStart:w,pathOptions:x,interactionWidth:v})=>{const[g,N,S]=jN({sourceX:n,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:y,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),E=e.isInternal?void 0:t;return a.jsx(lm,{id:E,path:g,labelX:N,labelY:S,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:b,markerStart:w,interactionWidth:v})})}const QL=ZL({isInternal:!1}),JL=ZL({isInternal:!0});QL.displayName="SmoothStepEdge";JL.displayName="SmoothStepEdgeInternal";function e3(e){return p.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(QL,{...n,id:r,pathOptions:p.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const RV=e3({isInternal:!1}),t3=e3({isInternal:!0});RV.displayName="StepEdge";t3.displayName="StepEdgeInternal";function n3(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:y,interactionWidth:b})=>{const[w,x,v]=mL({sourceX:n,sourceY:r,targetX:s,targetY:i}),g=e.isInternal?void 0:t;return a.jsx(lm,{id:g,path:w,labelX:x,labelY:v,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:y,interactionWidth:b})})}const OV=n3({isInternal:!1}),a3=n3({isInternal:!0});OV.displayName="StraightEdge";a3.displayName="StraightEdgeInternal";function r3(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=Xe.Bottom,targetPosition:l=Xe.Top,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,pathOptions:x,interactionWidth:v})=>{const[g,N,S]=hL({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:x==null?void 0:x.curvature}),E=e.isInternal?void 0:t;return a.jsx(lm,{id:E,path:g,labelX:N,labelY:S,label:c,labelStyle:u,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:w,interactionWidth:v})})}const DV=r3({isInternal:!1}),s3=r3({isInternal:!0});DV.displayName="BezierEdge";s3.displayName="BezierEdgeInternal";const NT={default:s3,straight:a3,step:t3,smoothstep:JL,simplebezier:KL},ST={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},IV=(e,t,n)=>n===Xe.Left?e-t:n===Xe.Right?e+t:e,MV=(e,t,n)=>n===Xe.Top?e-t:n===Xe.Bottom?e+t:e,ET="react-flow__edgeupdater";function jT({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:yn([ET,`${ET}-${l}`]),cx:IV(t,r,e),cy:MV(n,r,e),r,stroke:"transparent",fill:"transparent"})}function LV({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:h,onReconnectEnd:d,setReconnecting:f,setUpdateHover:m}){const y=Xt(),b=(N,S)=>{if(N.button!==0)return;const{autoPanOnConnect:E,domNode:j,isValidConnection:R,connectionMode:L,connectionRadius:P,lib:U,onConnectStart:F,onConnectEnd:G,cancelConnection:_,nodeLookup:I,rfId:A,panBy:C,updateConnection:T}=y.getState(),O=S.type==="target",q=($,W)=>{f(!1),d==null||d($,n,S.type,W)},k=$=>u==null?void 0:u(n,$),M=($,W)=>{f(!0),h==null||h(N,n,S.type),F==null||F($,W)};kN.onPointerDown(N.nativeEvent,{autoPanOnConnect:E,connectionMode:L,connectionRadius:P,domNode:j,handleId:S.id,nodeId:S.nodeId,nodeLookup:I,isTarget:O,edgeUpdaterType:S.type,lib:U,flowId:A,cancelConnection:_,panBy:C,isValidConnection:R,onConnect:k,onConnectStart:M,onConnectEnd:G,onReconnectEnd:q,updateConnection:T,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},w=N=>b(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=N=>b(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),g=()=>m(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(jT,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&a.jsx(jT,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:x,onMouseEnter:v,onMouseOut:g,type:"target"})]})}function UV({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:m,rfId:y,edgeTypes:b,noPanClassName:w,onError:x,disableKeyboardA11y:v}){let g=gt(xe=>xe.edgeLookup.get(e));const N=gt(xe=>xe.defaultEdgeOptions);g=N?{...N,...g}:g;let S=g.type||"default",E=(b==null?void 0:b[S])||NT[S];E===void 0&&(x==null||x("011",Yr.error011(S)),S="default",E=(b==null?void 0:b.default)||NT.default);const j=!!(g.focusable||t&&typeof g.focusable>"u"),R=typeof d<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),L=!!(g.selectable||r&&typeof g.selectable>"u"),P=p.useRef(null),[U,F]=p.useState(!1),[G,_]=p.useState(!1),I=Xt(),{zIndex:A,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M}=gt(p.useCallback(xe=>{const ye=xe.nodeLookup.get(g.source),ze=xe.nodeLookup.get(g.target);if(!ye||!ze)return{zIndex:g.zIndex,...ST};const He=pq({id:e,sourceNode:ye,targetNode:ze,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:xe.connectionMode,onError:x});return{zIndex:oq({selected:g.selected,zIndex:g.zIndex,sourceNode:ye,targetNode:ze,elevateOnSelect:xe.elevateEdgesOnSelect}),...He||ST}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),en),$=p.useMemo(()=>g.markerStart?`url('#${TN(g.markerStart,y)}')`:void 0,[g.markerStart,y]),W=p.useMemo(()=>g.markerEnd?`url('#${TN(g.markerEnd,y)}')`:void 0,[g.markerEnd,y]);if(g.hidden||C===null||T===null||O===null||q===null)return null;const Y=xe=>{var Fe;const{addSelectedEdges:ye,unselectNodesAndEdges:ze,multiSelectionActive:He}=I.getState();L&&(I.setState({nodesSelectionActive:!1}),g.selected&&He?(ze({nodes:[],edges:[g]}),(Fe=P.current)==null||Fe.blur()):ye([e])),s&&s(xe,g)},te=i?xe=>{i(xe,{...g})}:void 0,ne=o?xe=>{o(xe,{...g})}:void 0,X=l?xe=>{l(xe,{...g})}:void 0,se=c?xe=>{c(xe,{...g})}:void 0,Ee=u?xe=>{u(xe,{...g})}:void 0,re=xe=>{var ye;if(!v&&ZM.includes(xe.key)&&L){const{unselectNodesAndEdges:ze,addSelectedEdges:He}=I.getState();xe.key==="Escape"?((ye=P.current)==null||ye.blur(),ze({edges:[g]})):He([e])}};return a.jsx("svg",{style:{zIndex:A},children:a.jsxs("g",{className:yn(["react-flow__edge",`react-flow__edge-${S}`,g.className,w,{selected:g.selected,animated:g.animated,inactive:!L&&!s,updating:U,selectable:L}]),onClick:Y,onDoubleClick:te,onContextMenu:ne,onMouseEnter:X,onMouseMove:se,onMouseLeave:Ee,onKeyDown:j?re:void 0,tabIndex:j?0:void 0,role:g.ariaRole??(j?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":j?`${IL}-${y}`:void 0,ref:P,...g.domAttributes,children:[!G&&a.jsx(E,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:L,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:$,markerEnd:W,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),R&&a.jsx(LV,{edge:g,isReconnectable:R,reconnectRadius:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:m,sourceX:C,sourceY:T,targetX:O,targetY:q,sourcePosition:k,targetPosition:M,setUpdateHover:F,setReconnecting:_})]})})}var PV=p.memo(UV);const FV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function i3({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:h,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:w,edgesReconnectable:x,elementsSelectable:v,onError:g}=gt(FV,en),N=SV(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(kV,{defaultColor:e,rfId:n}),N.map(S=>a.jsx(PV,{id:S,edgesFocusable:w,edgesReconnectable:x,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:h,reconnectRadius:d,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:g,edgeTypes:r,disableKeyboardA11y:b},S))]})}i3.displayName="EdgeRenderer";const BV=p.memo(i3),zV=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $V({children:e}){const t=gt(zV);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function HV(e){const t=NS(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qV=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function GV(e){const t=gt(qV),n=Xt();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function VV(e){return e.connection.inProgress?{...e.connection,to:Ku(e.connection.to,e.transform)}:{...e.connection}}function YV(e){return VV}function WV(e){const t=YV();return gt(t,en)}const XV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function KV({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=gt(XV,en);return!(i&&s&&c)?null:a.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:yn(["react-flow__connection",eL(l)]),children:a.jsx(o3,{style:t,type:n,CustomComponent:r,isValid:l})})})}const o3=({style:e,type:t=Si.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:u,toNode:h,toHandle:d,toPosition:f,pointer:m}=WV();if(!s)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:eL(r),toNode:h,toHandle:d,pointer:m});let y="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case Si.Bezier:[y]=hL(b);break;case Si.SimpleBezier:[y]=WL(b);break;case Si.Step:[y]=jN({...b,borderRadius:0});break;case Si.SmoothStep:[y]=jN(b);break;default:[y]=mL(b)}return a.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};o3.displayName="ConnectionLine";const ZV={};function TT(e=ZV){p.useRef(e),Xt(),p.useEffect(()=>{},[e])}function QV(){Xt(),p.useRef(!1),p.useEffect(()=>{},[])}function l3({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:h,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:v,selectionOnDrag:g,selectionMode:N,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:j,deleteKeyCode:R,onlyRenderVisibleElements:L,elementsSelectable:P,defaultViewport:U,translateExtent:F,minZoom:G,maxZoom:_,preventScrolling:I,defaultMarkerColor:A,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:$,onPaneClick:W,onPaneMouseEnter:Y,onPaneMouseMove:te,onPaneMouseLeave:ne,onPaneScroll:X,onPaneContextMenu:se,paneClickDistance:Ee,nodeClickDistance:re,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:ze,onEdgeMouseLeave:He,reconnectRadius:Fe,onReconnect:Ye,onReconnectStart:ft,onReconnectEnd:et,noDragClassName:de,noWheelClassName:Be,noPanClassName:Ue,disableKeyboardA11y:Oe,nodeExtent:We,rfId:nt,viewport:lt,onViewportChange:Ut}){return TT(e),TT(t),QV(),HV(n),GV(lt),a.jsx(fV,{onPaneClick:W,onPaneMouseEnter:Y,onPaneMouseMove:te,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:X,paneClickDistance:Ee,deleteKeyCode:R,selectionKeyCode:v,selectionOnDrag:g,selectionMode:N,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:j,elementsSelectable:P,zoomOnScroll:C,zoomOnPinch:T,zoomOnDoubleClick:M,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:k,panOnDrag:$,defaultViewport:U,translateExtent:F,minZoom:G,maxZoom:_,onSelectionContextMenu:d,preventScrolling:I,noDragClassName:de,noWheelClassName:Be,noPanClassName:Ue,disableKeyboardA11y:Oe,onViewportChange:Ut,isControlledViewport:!!lt,children:a.jsxs($V,{children:[a.jsx(BV,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ye,onReconnectStart:ft,onReconnectEnd:et,onlyRenderVisibleElements:L,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:ze,onEdgeMouseLeave:He,reconnectRadius:Fe,defaultMarkerColor:A,noPanClassName:Ue,disableKeyboardA11y:Oe,rfId:nt}),a.jsx(KV,{style:b,type:y,component:w,containerStyle:x}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(NV,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:h,nodeClickDistance:re,onlyRenderVisibleElements:L,noPanClassName:Ue,noDragClassName:de,disableKeyboardA11y:Oe,nodeExtent:We,rfId:nt}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}l3.displayName="GraphView";const JV=p.memo(l3),CT=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:h,nodeExtent:d}={})=>{const f=new Map,m=new Map,y=new Map,b=new Map,w=r??t??[],x=n??e??[],v=h??[0,0],g=d??pu;bL(y,b,w);const N=CN(x,f,m,{nodeOrigin:v,nodeExtent:g,elevateNodesOnSelect:!1});let S=[0,0,1];if(o&&s&&i){const E=Wu(f,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:j,y:R,zoom:L}=gS(E,s,i,c,u,(l==null?void 0:l.padding)??.1);S=[j,R,L]}return{rfId:"1",width:s??0,height:i??0,transform:S,nodes:x,nodesInitialized:N,nodeLookup:f,parentLookup:m,edges:w,edgeLookup:b,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:pu,nodeExtent:g,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...JM},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tq,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:QM}},eY=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:h,nodeExtent:d})=>bG((f,m)=>{async function y(){const{nodeLookup:b,panZoom:w,fitViewOptions:x,fitViewResolver:v,width:g,height:N,minZoom:S,maxZoom:E}=m();w&&(await J7({nodes:b,width:g,height:N,panZoom:w,minZoom:S,maxZoom:E},x),v==null||v.resolve(!0),f({fitViewResolver:null}))}return{...CT({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:h,nodeExtent:d,defaultNodes:n,defaultEdges:r}),setNodes:b=>{const{nodeLookup:w,parentLookup:x,nodeOrigin:v,elevateNodesOnSelect:g,fitViewQueued:N}=m(),S=CN(b,w,x,{nodeOrigin:v,nodeExtent:d,elevateNodesOnSelect:g,checkEquality:!0});N&&S?(y(),f({nodes:b,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:b,nodesInitialized:S})},setEdges:b=>{const{connectionLookup:w,edgeLookup:x}=m();bL(w,x,b),f({edges:b})},setDefaultNodesAndEdges:(b,w)=>{if(b){const{setNodes:x}=m();x(b),f({hasDefaultNodes:!0})}if(w){const{setEdges:x}=m();x(w),f({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:w,nodeLookup:x,parentLookup:v,domNode:g,nodeOrigin:N,nodeExtent:S,debug:E,fitViewQueued:j}=m(),{changes:R,updatedInternals:L}=Nq(b,x,v,g,N,S);L&&(bq(x,v,{nodeOrigin:N,nodeExtent:S}),j?(y(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),(R==null?void 0:R.length)>0&&(E&&console.log("React Flow: trigger node changes",R),w==null||w(R)))},updateNodePositions:(b,w=!1)=>{const x=[],v=[],{nodeLookup:g,triggerNodeChanges:N}=m();for(const[S,E]of b){const j=g.get(S),R=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(E!=null&&E.position)),L={id:S,type:"position",position:R?{x:Math.max(0,E.position.x),y:Math.max(0,E.position.y)}:E.position,dragging:w};R&&j.parentId&&x.push({id:S,parentId:j.parentId,rect:{...E.internals.positionAbsolute,width:E.measured.width??0,height:E.measured.height??0}}),v.push(L)}if(x.length>0){const{parentLookup:S,nodeOrigin:E}=m(),j=wS(x,g,S,E);v.push(...j)}N(v)},triggerNodeChanges:b=>{const{onNodesChange:w,setNodes:x,nodes:v,hasDefaultNodes:g,debug:N}=m();if(b!=null&&b.length){if(g){const S=UL(b,v);x(S)}N&&console.log("React Flow: trigger node changes",b),w==null||w(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:w,setEdges:x,edges:v,hasDefaultEdges:g,debug:N}=m();if(b!=null&&b.length){if(g){const S=PL(b,v);x(S)}N&&console.log("React Flow: trigger edge changes",b),w==null||w(b)}},addSelectedNodes:b=>{const{multiSelectionActive:w,edgeLookup:x,nodeLookup:v,triggerNodeChanges:g,triggerEdgeChanges:N}=m();if(w){const S=b.map(E=>go(E,!0));g(S);return}g(Fl(v,new Set([...b]),!0)),N(Fl(x))},addSelectedEdges:b=>{const{multiSelectionActive:w,edgeLookup:x,nodeLookup:v,triggerNodeChanges:g,triggerEdgeChanges:N}=m();if(w){const S=b.map(E=>go(E,!0));N(S);return}N(Fl(x,new Set([...b]))),g(Fl(v,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:w}={})=>{const{edges:x,nodes:v,nodeLookup:g,triggerNodeChanges:N,triggerEdgeChanges:S}=m(),E=b||v,j=w||x,R=E.map(P=>{const U=g.get(P.id);return U&&(U.selected=!1),go(P.id,!1)}),L=j.map(P=>go(P.id,!1));N(R),S(L)},setMinZoom:b=>{const{panZoom:w,maxZoom:x}=m();w==null||w.setScaleExtent([b,x]),f({minZoom:b})},setMaxZoom:b=>{const{panZoom:w,minZoom:x}=m();w==null||w.setScaleExtent([x,b]),f({maxZoom:b})},setTranslateExtent:b=>{var w;(w=m().panZoom)==null||w.setTranslateExtent(b),f({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:w,triggerNodeChanges:x,triggerEdgeChanges:v,elementsSelectable:g}=m();if(!g)return;const N=w.reduce((E,j)=>j.selected?[...E,go(j.id,!1)]:E,[]),S=b.reduce((E,j)=>j.selected?[...E,go(j.id,!1)]:E,[]);x(N),v(S)},setNodeExtent:b=>{const{nodes:w,nodeLookup:x,parentLookup:v,nodeOrigin:g,elevateNodesOnSelect:N,nodeExtent:S}=m();b[0][0]===S[0][0]&&b[0][1]===S[0][1]&&b[1][0]===S[1][0]&&b[1][1]===S[1][1]||(CN(w,x,v,{nodeOrigin:g,nodeExtent:b,elevateNodesOnSelect:N,checkEquality:!1}),f({nodeExtent:b}))},panBy:b=>{const{transform:w,width:x,height:v,panZoom:g,translateExtent:N}=m();return Sq({delta:b,panZoom:g,transform:w,translateExtent:N,width:x,height:v})},setCenter:async(b,w,x)=>{const{width:v,height:g,maxZoom:N,panZoom:S}=m();if(!S)return Promise.resolve(!1);const E=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:N;return await S.setViewport({x:v/2-b*E,y:g/2-w*E,zoom:E},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...JM}})},updateConnection:b=>{f({connection:b})},reset:()=>f({...CT()})}},Object.is);function tY({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:h,nodeExtent:d,children:f}){const[m]=p.useState(()=>eY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:h,nodeExtent:d}));return a.jsx(vG,{value:m,children:a.jsx($G,{children:f})})}function nY({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:h,nodeOrigin:d,nodeExtent:f}){return p.useContext(sm)?a.jsx(a.Fragment,{children:e}):a.jsx(tY,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:h,nodeOrigin:d,nodeExtent:f,children:e})}const aY={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function rY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:h,onMoveStart:d,onMoveEnd:f,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:x,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:j,onNodeDrag:R,onNodeDragStop:L,onNodesDelete:P,onEdgesDelete:U,onDelete:F,onSelectionChange:G,onSelectionDragStart:_,onSelectionDrag:I,onSelectionDragStop:A,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:O,onBeforeDelete:q,connectionMode:k,connectionLineType:M=Si.Bezier,connectionLineStyle:$,connectionLineComponent:W,connectionLineContainerStyle:Y,deleteKeyCode:te="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:X=!1,selectionMode:se=mu.Full,panActivationKeyCode:Ee="Space",multiSelectionKeyCode:re=xu()?"Meta":"Control",zoomActivationKeyCode:xe=xu()?"Meta":"Control",snapToGrid:ye,snapGrid:ze,onlyRenderVisibleElements:He=!1,selectNodesOnDrag:Fe,nodesDraggable:Ye,autoPanOnNodeFocus:ft,nodesConnectable:et,nodesFocusable:de,nodeOrigin:Be=ML,edgesFocusable:Ue,edgesReconnectable:Oe,elementsSelectable:We=!0,defaultViewport:nt=OG,minZoom:lt=.5,maxZoom:Ut=2,translateExtent:Kt=pu,preventScrolling:Gt=!0,nodeExtent:_t,defaultMarkerColor:ce="#b1b1b7",zoomOnScroll:Te=!0,zoomOnPinch:Ze=!0,panOnScroll:K=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:be=Ro.Free,zoomOnDoubleClick:_e=!0,panOnDrag:$e=!0,onPaneClick:je,onPaneMouseEnter:Z,onPaneMouseMove:ue,onPaneMouseLeave:Ae,onPaneScroll:Le,onPaneContextMenu:he,paneClickDistance:Q=1,nodeClickDistance:oe=0,children:De,onReconnect:it,onReconnectStart:tt,onReconnectEnd:at,onEdgeContextMenu:It,onEdgeDoubleClick:wn,onEdgeMouseEnter:sn,onEdgeMouseMove:ns,onEdgeMouseLeave:In,reconnectRadius:qn=10,onNodesChange:sr,onEdgesChange:as,noDragClassName:nl="nodrag",noWheelClassName:Ws="nowheel",noPanClassName:Fn="nopan",fitView:Mt,fitViewOptions:rs,connectOnClick:ss,attributionPosition:is,proOptions:Sr,defaultEdgeOptions:os,elevateNodesOnSelect:Er,elevateEdgesOnSelect:Xs,disableKeyboardA11y:pa=!1,autoPanOnConnect:Qn,autoPanOnNodeDrag:Fa,autoPanSpeed:Ks,connectionRadius:ma,isValidConnection:Jn,onError:ir,style:Zs,id:Qs,nodeDragThreshold:al,connectionDragThreshold:Js,viewport:ro,onViewportChange:xt,width:jr,height:Tr,colorMode:ei="light",debug:ls,onScroll:or,ariaLabelConfig:cs,...Ba},so){const ds=Qs||"1",rl=LG(ei),we=p.useCallback(Ne=>{Ne.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),or==null||or(Ne)},[or]);return a.jsx("div",{"data-testid":"rf__wrapper",...Ba,onScroll:we,style:{...Zs,...aY},ref:so,className:yn(["react-flow",s,rl]),id:Qs,role:"application",children:a.jsxs(nY,{nodes:e,edges:t,width:jr,height:Tr,fitView:Mt,fitViewOptions:rs,minZoom:lt,maxZoom:Ut,nodeOrigin:Be,nodeExtent:_t,children:[a.jsx(JV,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:N,onNodeContextMenu:S,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:o,connectionLineType:M,connectionLineStyle:$,connectionLineComponent:W,connectionLineContainerStyle:Y,selectionKeyCode:ne,selectionOnDrag:X,selectionMode:se,deleteKeyCode:te,multiSelectionKeyCode:re,panActivationKeyCode:Ee,zoomActivationKeyCode:xe,onlyRenderVisibleElements:He,defaultViewport:nt,translateExtent:Kt,minZoom:lt,maxZoom:Ut,preventScrolling:Gt,zoomOnScroll:Te,zoomOnPinch:Ze,zoomOnDoubleClick:_e,panOnScroll:K,panOnScrollSpeed:pe,panOnScrollMode:be,panOnDrag:$e,onPaneClick:je,onPaneMouseEnter:Z,onPaneMouseMove:ue,onPaneMouseLeave:Ae,onPaneScroll:Le,onPaneContextMenu:he,paneClickDistance:Q,nodeClickDistance:oe,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:O,onReconnect:it,onReconnectStart:tt,onReconnectEnd:at,onEdgeContextMenu:It,onEdgeDoubleClick:wn,onEdgeMouseEnter:sn,onEdgeMouseMove:ns,onEdgeMouseLeave:In,reconnectRadius:qn,defaultMarkerColor:ce,noDragClassName:nl,noWheelClassName:Ws,noPanClassName:Fn,rfId:ds,disableKeyboardA11y:pa,nodeExtent:_t,viewport:ro,onViewportChange:xt}),a.jsx(MG,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:x,nodesDraggable:Ye,autoPanOnNodeFocus:ft,nodesConnectable:et,nodesFocusable:de,edgesFocusable:Ue,edgesReconnectable:Oe,elementsSelectable:We,elevateNodesOnSelect:Er,elevateEdgesOnSelect:Xs,minZoom:lt,maxZoom:Ut,nodeExtent:_t,onNodesChange:sr,onEdgesChange:as,snapToGrid:ye,snapGrid:ze,connectionMode:k,translateExtent:Kt,connectOnClick:ss,defaultEdgeOptions:os,fitView:Mt,fitViewOptions:rs,onNodesDelete:P,onEdgesDelete:U,onDelete:F,onNodeDragStart:j,onNodeDrag:R,onNodeDragStop:L,onSelectionDrag:I,onSelectionDragStart:_,onSelectionDragStop:A,onMove:h,onMoveStart:d,onMoveEnd:f,noPanClassName:Fn,nodeOrigin:Be,rfId:ds,autoPanOnConnect:Qn,autoPanOnNodeDrag:Fa,autoPanSpeed:Ks,onError:ir,connectionRadius:ma,isValidConnection:Jn,selectNodesOnDrag:Fe,nodeDragThreshold:al,connectionDragThreshold:Js,onBeforeDelete:q,debug:ls,ariaLabelConfig:cs}),a.jsx(RG,{onSelectionChange:G}),De,a.jsx(TG,{proOptions:Sr,position:is}),a.jsx(jG,{rfId:ds,disableKeyboardA11y:pa})]})})}var sY=FL(rY);function iY(e){const[t,n]=p.useState(e),r=p.useCallback(s=>n(i=>UL(s,i)),[]);return[t,n,r]}function oY(e){const[t,n]=p.useState(e),r=p.useCallback(s=>n(i=>PL(s,i)),[]);return[t,n,r]}function lY({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:yn(["react-flow__background-pattern",n,r])})}function cY({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:yn(["react-flow__background-pattern","dots",t])})}var Is;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Is||(Is={}));const dY={[Is.Dots]:1,[Is.Lines]:1,[Is.Cross]:6},uY=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function c3({id:e,variant:t=Is.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:h}){const d=p.useRef(null),{transform:f,patternId:m}=gt(uY,en),y=r||dY[t],b=t===Is.Dots,w=t===Is.Cross,x=Array.isArray(n)?n:[n,n],v=[x[0]*f[2]||1,x[1]*f[2]||1],g=y*f[2],N=Array.isArray(i)?i:[i,i],S=w?[g,g]:v,E=[N[0]*f[2]||1+S[0]/2,N[1]*f[2]||1+S[1]/2],j=`${m}${e||""}`;return a.jsxs("svg",{className:yn(["react-flow__background",u]),style:{...c,...om,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:d,"data-testid":"rf__background",children:[a.jsx("pattern",{id:j,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:b?a.jsx(cY,{radius:g/2,className:h}):a.jsx(lY,{dimensions:S,lineWidth:s,variant:t,className:h})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j})`})]})}c3.displayName="Background";const hY=p.memo(c3);function fY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function pY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function mY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function gY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function xY(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Mh({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:yn(["react-flow__controls-button",t]),...n,children:e})}const bY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function d3({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:u,children:h,position:d="bottom-left",orientation:f="vertical","aria-label":m}){const y=Xt(),{isInteractive:b,minZoomReached:w,maxZoomReached:x,ariaLabelConfig:v}=gt(bY,en),{zoomIn:g,zoomOut:N,fitView:S}=NS(),E=()=>{g(),i==null||i()},j=()=>{N(),o==null||o()},R=()=>{S(s),l==null||l()},L=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},P=f==="horizontal"?"horizontal":"vertical";return a.jsxs(im,{className:yn(["react-flow__controls",P,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Mh,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:x,children:a.jsx(fY,{})}),a.jsx(Mh,{onClick:j,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:w,children:a.jsx(pY,{})})]}),n&&a.jsx(Mh,{className:"react-flow__controls-fitview",onClick:R,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:a.jsx(mY,{})}),r&&a.jsx(Mh,{className:"react-flow__controls-interactive",onClick:L,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?a.jsx(xY,{}):a.jsx(gY,{})}),h]})}d3.displayName="Controls";const vY=p.memo(d3);function yY({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:u,borderRadius:h,shapeRendering:d,selected:f,onClick:m}){const{background:y,backgroundColor:b}=i||{},w=o||y||b;return a.jsx("rect",{className:yn(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:h,ry:h,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:d,onClick:m?x=>m(x,e):void 0})}const wY=p.memo(yY),NY=e=>e.nodes.map(t=>t.id),Dg=e=>e instanceof Function?e:()=>e;function SY({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=wY,onClick:o}){const l=gt(NY,en),c=Dg(t),u=Dg(e),h=Dg(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(f=>a.jsx(jY,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:h,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:d},f))})}function EY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:u,x:h,y:d,width:f,height:m}=gt(y=>{const{internals:b}=y.nodeLookup.get(e),w=b.userNode,{x,y:v}=b.positionAbsolute,{width:g,height:N}=Gs(w);return{node:w,x,y:v,width:g,height:N}},en);return!u||u.hidden||!iL(u)?null:a.jsx(l,{x:h,y:d,width:f,height:m,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const jY=p.memo(EY);var TY=p.memo(SY);const CY=200,kY=150,AY=e=>!e.hidden,_Y=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?sL(Wu(e.nodeLookup,{filter:AY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},RY="react-flow__minimap-desc";function u3({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:h,maskStrokeWidth:d,position:f="bottom-right",onClick:m,onNodeClick:y,pannable:b=!1,zoomable:w=!1,ariaLabel:x,inversePan:v,zoomStep:g=1,offsetScale:N=5}){const S=Xt(),E=p.useRef(null),{boundingRect:j,viewBB:R,rfId:L,panZoom:P,translateExtent:U,flowWidth:F,flowHeight:G,ariaLabelConfig:_}=gt(_Y,en),I=(e==null?void 0:e.width)??CY,A=(e==null?void 0:e.height)??kY,C=j.width/I,T=j.height/A,O=Math.max(C,T),q=O*I,k=O*A,M=N*O,$=j.x-(q-j.width)/2-M,W=j.y-(k-j.height)/2-M,Y=q+M*2,te=k+M*2,ne=`${RY}-${L}`,X=p.useRef(0),se=p.useRef();X.current=O,p.useEffect(()=>{if(E.current&&P)return se.current=Oq({domNode:E.current,panZoom:P,getTransform:()=>S.getState().transform,getViewScale:()=>X.current}),()=>{var ye;(ye=se.current)==null||ye.destroy()}},[P]),p.useEffect(()=>{var ye;(ye=se.current)==null||ye.update({translateExtent:U,width:F,height:G,inversePan:v,pannable:b,zoomStep:g,zoomable:w})},[b,w,v,g,U,F,G]);const Ee=m?ye=>{var Fe;const[ze,He]=((Fe=se.current)==null?void 0:Fe.pointer(ye))||[0,0];m(ye,{x:ze,y:He})}:void 0,re=y?p.useCallback((ye,ze)=>{const He=S.getState().nodeLookup.get(ze).internals.userNode;y(ye,He)},[]):void 0,xe=x??_["minimap.ariaLabel"];return a.jsx(im,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:yn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:I,height:A,viewBox:`${$} ${W} ${Y} ${te}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:E,onClick:Ee,children:[xe&&a.jsx("title",{id:ne,children:xe}),a.jsx(TY,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-M},${W-M}h${Y+M*2}v${te+M*2}h${-Y-M*2}z
98
98
  M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}u3.displayName="MiniMap";const OY=p.memo(u3),DY=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,IY={[Nc.Line]:"right",[Nc.Handle]:"bottom-right"};function MY({nodeId:e,position:t,variant:n=Nc.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:m=!0,shouldResize:y,onResizeStart:b,onResize:w,onResizeEnd:x}){const v=HL(),g=typeof e=="string"?e:v,N=Xt(),S=p.useRef(null),E=n===Nc.Handle,j=gt(p.useCallback(DY(E&&m),[E,m]),en),R=p.useRef(null),L=t??IY[n];p.useEffect(()=>{if(!(!S.current||!g))return R.current||(R.current=Vq({domNode:S.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:U,transform:F,snapGrid:G,snapToGrid:_,nodeOrigin:I,domNode:A}=N.getState();return{nodeLookup:U,transform:F,snapGrid:G,snapToGrid:_,nodeOrigin:I,paneDomNode:A}},onChange:(U,F)=>{const{triggerNodeChanges:G,nodeLookup:_,parentLookup:I,nodeOrigin:A}=N.getState(),C=[],T={x:U.x,y:U.y},O=_.get(g);if(O&&O.expandParent&&O.parentId){const q=O.origin??A,k=U.width??O.measured.width??0,M=U.height??O.measured.height??0,$={id:O.id,parentId:O.parentId,rect:{width:k,height:M,...oL({x:U.x??O.position.x,y:U.y??O.position.y},{width:k,height:M},O.parentId,_,q)}},W=wS([$],_,I,A);C.push(...W),T.x=U.x?Math.max(q[0]*k,U.x):void 0,T.y=U.y?Math.max(q[1]*M,U.y):void 0}if(T.x!==void 0&&T.y!==void 0){const q={id:g,type:"position",position:{...T}};C.push(q)}if(U.width!==void 0&&U.height!==void 0){const k={id:g,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:U.width,height:U.height}};C.push(k)}for(const q of F){const k={...q,type:"position"};C.push(k)}G(C)},onEnd:({width:U,height:F})=>{const G={id:g,type:"dimensions",resizing:!1,dimensions:{width:U,height:F}};N.getState().triggerNodeChanges([G])}})),R.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:h},keepAspectRatio:d,resizeDirection:f,onResizeStart:b,onResize:w,onResizeEnd:x,shouldResize:y}),()=>{var U;(U=R.current)==null||U.destroy()}},[L,l,c,u,h,d,b,w,x,y]);const P=L.split("-");return a.jsx("div",{className:yn(["react-flow__resize-control","nodrag",...P,n,r]),ref:S,style:{...s,scale:j,...o&&{[E?"backgroundColor":"borderColor"]:o}},children:i})}p.memo(MY);/**
99
99
  * @license lucide-react v0.294.0 - ISC
100
100
  *
@@ -509,7 +509,7 @@ Error generating stack: `+n.message+`
509
509
 
510
510
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
511
511
 
512
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mQ="DialogDescriptionWarning",gQ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_5(mQ).contentName}}.`;return p.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},xQ=y5,bQ=S5,vQ=E5,yQ=j5,wQ=Symbol.for("react.lazy"),wp=_p[" use ".trim().toString()];function NQ(e){return typeof e=="object"&&e!==null&&"then"in e}function R5(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===wQ&&"_payload"in e&&NQ(e._payload)}function O5(e){const t=EQ(e),n=p.forwardRef((r,s)=>{let{children:i,...o}=r;R5(i)&&typeof wp=="function"&&(i=wp(i._payload));const l=p.Children.toArray(i),c=l.find(TQ);if(c){const u=c.props.children,h=l.map(d=>d===c?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:p.isValidElement(u)?p.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var SQ=O5("Slot");function EQ(e){const t=p.forwardRef((n,r)=>{let{children:s,...i}=n;if(R5(s)&&typeof wp=="function"&&(s=wp(s._payload)),p.isValidElement(s)){const o=kQ(s),l=CQ(i,s.props);return s.type!==p.Fragment&&(l.ref=r?Gi(r,o):o),p.cloneElement(s,l)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jQ=Symbol("radix.slottable");function TQ(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jQ}function CQ(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function kQ(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var AQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],to=AQ.reduce((e,t)=>{const n=O5(`Primitive.${t}`),r=p.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),cd='[cmdk-group=""]',Kg='[cmdk-group-items=""]',_Q='[cmdk-group-heading=""]',D5='[cmdk-item=""]',cC=`${D5}:not([aria-disabled="true"])`,HN="cmdk-item-select",Nl="data-value",RQ=(e,t,n)=>uZ(e,t,n),I5=p.createContext(void 0),eh=()=>p.useContext(I5),M5=p.createContext(void 0),qS=()=>p.useContext(M5),L5=p.createContext(void 0),U5=p.forwardRef((e,t)=>{let n=Sl(()=>{var M,$;return{search:"",value:($=(M=e.value)!=null?M:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Sl(()=>new Set),s=Sl(()=>new Map),i=Sl(()=>new Map),o=Sl(()=>new Set),l=P5(e),{label:c,children:u,value:h,onValueChange:d,filter:f,shouldFilter:m,loop:y,disablePointerSelection:b=!1,vimBindings:w=!0,...x}=e,v=tr(),g=tr(),N=tr(),S=p.useRef(null),E=$Q();Yo(()=>{if(h!==void 0){let M=h.trim();n.current.value=M,j.emit()}},[h]),Yo(()=>{E(6,G)},[]);let j=p.useMemo(()=>({subscribe:M=>(o.current.add(M),()=>o.current.delete(M)),snapshot:()=>n.current,setState:(M,$,W)=>{var Y,te,ne,X;if(!Object.is(n.current[M],$)){if(n.current[M]=$,M==="search")F(),P(),E(1,U);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(N);se?se.focus():(Y=document.getElementById(v))==null||Y.focus()}if(E(7,()=>{var se;n.current.selectedItemId=(se=_())==null?void 0:se.id,j.emit()}),W||E(5,G),((te=l.current)==null?void 0:te.value)!==void 0){let se=$??"";(X=(ne=l.current).onValueChange)==null||X.call(ne,se);return}}j.emit()}},emit:()=>{o.current.forEach(M=>M())}}),[]),R=p.useMemo(()=>({value:(M,$,W)=>{var Y;$!==((Y=i.current.get(M))==null?void 0:Y.value)&&(i.current.set(M,{value:$,keywords:W}),n.current.filtered.items.set(M,L($,W)),E(2,()=>{P(),j.emit()}))},item:(M,$)=>(r.current.add(M),$&&(s.current.has($)?s.current.get($).add(M):s.current.set($,new Set([M]))),E(3,()=>{F(),P(),n.current.value||U(),j.emit()}),()=>{i.current.delete(M),r.current.delete(M),n.current.filtered.items.delete(M);let W=_();E(4,()=>{F(),(W==null?void 0:W.getAttribute("id"))===M&&U(),j.emit()})}),group:M=>(s.current.has(M)||s.current.set(M,new Set),()=>{i.current.delete(M),s.current.delete(M)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:N,labelId:g,listInnerRef:S}),[]);function L(M,$){var W,Y;let te=(Y=(W=l.current)==null?void 0:W.filter)!=null?Y:RQ;return M?te(M,n.current.search,$):0}function P(){if(!n.current.search||l.current.shouldFilter===!1)return;let M=n.current.filtered.items,$=[];n.current.filtered.groups.forEach(Y=>{let te=s.current.get(Y),ne=0;te.forEach(X=>{let se=M.get(X);ne=Math.max(se,ne)}),$.push([Y,ne])});let W=S.current;I().sort((Y,te)=>{var ne,X;let se=Y.getAttribute("id"),Ee=te.getAttribute("id");return((ne=M.get(Ee))!=null?ne:0)-((X=M.get(se))!=null?X:0)}).forEach(Y=>{let te=Y.closest(Kg);te?te.appendChild(Y.parentElement===te?Y:Y.closest(`${Kg} > *`)):W.appendChild(Y.parentElement===W?Y:Y.closest(`${Kg} > *`))}),$.sort((Y,te)=>te[1]-Y[1]).forEach(Y=>{var te;let ne=(te=S.current)==null?void 0:te.querySelector(`${cd}[${Nl}="${encodeURIComponent(Y[0])}"]`);ne==null||ne.parentElement.appendChild(ne)})}function U(){let M=I().find(W=>W.getAttribute("aria-disabled")!=="true"),$=M==null?void 0:M.getAttribute(Nl);j.setState("value",$||void 0)}function F(){var M,$,W,Y;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let te=0;for(let ne of r.current){let X=($=(M=i.current.get(ne))==null?void 0:M.value)!=null?$:"",se=(Y=(W=i.current.get(ne))==null?void 0:W.keywords)!=null?Y:[],Ee=L(X,se);n.current.filtered.items.set(ne,Ee),Ee>0&&te++}for(let[ne,X]of s.current)for(let se of X)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(ne);break}n.current.filtered.count=te}function G(){var M,$,W;let Y=_();Y&&(((M=Y.parentElement)==null?void 0:M.firstChild)===Y&&((W=($=Y.closest(cd))==null?void 0:$.querySelector(_Q))==null||W.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function _(){var M;return(M=S.current)==null?void 0:M.querySelector(`${D5}[aria-selected="true"]`)}function I(){var M;return Array.from(((M=S.current)==null?void 0:M.querySelectorAll(cC))||[])}function A(M){let $=I()[M];$&&j.setState("value",$.getAttribute(Nl))}function C(M){var $;let W=_(),Y=I(),te=Y.findIndex(X=>X===W),ne=Y[te+M];($=l.current)!=null&&$.loop&&(ne=te+M<0?Y[Y.length-1]:te+M===Y.length?Y[0]:Y[te+M]),ne&&j.setState("value",ne.getAttribute(Nl))}function T(M){let $=_(),W=$==null?void 0:$.closest(cd),Y;for(;W&&!Y;)W=M>0?BQ(W,cd):zQ(W,cd),Y=W==null?void 0:W.querySelector(cC);Y?j.setState("value",Y.getAttribute(Nl)):C(M)}let O=()=>A(I().length-1),q=M=>{M.preventDefault(),M.metaKey?O():M.altKey?T(1):C(1)},k=M=>{M.preventDefault(),M.metaKey?A(0):M.altKey?T(-1):C(-1)};return p.createElement(to.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:M=>{var $;($=x.onKeyDown)==null||$.call(x,M);let W=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||W))switch(M.key){case"n":case"j":{w&&M.ctrlKey&&q(M);break}case"ArrowDown":{q(M);break}case"p":case"k":{w&&M.ctrlKey&&k(M);break}case"ArrowUp":{k(M);break}case"Home":{M.preventDefault(),A(0);break}case"End":{M.preventDefault(),O();break}case"Enter":{M.preventDefault();let Y=_();if(Y){let te=new Event(HN);Y.dispatchEvent(te)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:R.inputId,id:R.labelId,style:qQ},c),wm(e,M=>p.createElement(M5.Provider,{value:j},p.createElement(I5.Provider,{value:R},M))))}),OQ=p.forwardRef((e,t)=>{var n,r;let s=tr(),i=p.useRef(null),o=p.useContext(L5),l=eh(),c=P5(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Yo(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let h=F5(s,i,[e.value,e.children,i],e.keywords),d=qS(),f=Xi(E=>E.value&&E.value===h.current),m=Xi(E=>u||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);p.useEffect(()=>{let E=i.current;if(!(!E||e.disabled))return E.addEventListener(HN,y),()=>E.removeEventListener(HN,y)},[m,e.onSelect,e.disabled]);function y(){var E,j;b(),(j=(E=c.current).onSelect)==null||j.call(E,h.current)}function b(){d.setState("value",h.current,!0)}if(!m)return null;let{disabled:w,value:x,onSelect:v,forceMount:g,keywords:N,...S}=e;return p.createElement(to.div,{ref:Gi(i,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!f,"data-disabled":!!w,"data-selected":!!f,onPointerMove:w||l.getDisablePointerSelection()?void 0:b,onClick:w?void 0:y},e.children)}),DQ=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=tr(),l=p.useRef(null),c=p.useRef(null),u=tr(),h=eh(),d=Xi(m=>s||h.filter()===!1?!0:m.search?m.filtered.groups.has(o):!0);Yo(()=>h.group(o),[]),F5(o,l,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:s}),[s]);return p.createElement(to.div,{ref:Gi(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&p.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),wm(e,m=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},p.createElement(L5.Provider,{value:f},m))))}),IQ=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=p.useRef(null),i=Xi(o=>!o.search);return!n&&!i?null:p.createElement(to.div,{ref:Gi(s,t),...r,"cmdk-separator":"",role:"separator"})}),MQ=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=qS(),o=Xi(u=>u.search),l=Xi(u=>u.selectedItemId),c=eh();return p.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),p.createElement(to.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),LQ=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=p.useRef(null),o=p.useRef(null),l=Xi(u=>u.selectedItemId),c=eh();return p.useEffect(()=>{if(o.current&&i.current){let u=o.current,h=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let m=u.offsetHeight;h.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(d),f.unobserve(u)}}},[]),p.createElement(to.div,{ref:Gi(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},wm(e,u=>p.createElement("div",{ref:Gi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),UQ=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return p.createElement(xQ,{open:n,onOpenChange:r},p.createElement(bQ,{container:o},p.createElement(vQ,{"cmdk-overlay":"",className:s}),p.createElement(yQ,{"aria-label":e.label,"cmdk-dialog":"",className:i},p.createElement(U5,{ref:t,...l}))))}),PQ=p.forwardRef((e,t)=>Xi(n=>n.filtered.count===0)?p.createElement(to.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),FQ=p.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return p.createElement(to.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},wm(e,o=>p.createElement("div",{"aria-hidden":!0},o)))}),dd=Object.assign(U5,{List:LQ,Item:OQ,Input:MQ,Group:DQ,Separator:IQ,Dialog:UQ,Empty:PQ,Loading:FQ});function BQ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function zQ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function P5(e){let t=p.useRef(e);return Yo(()=>{t.current=e}),t}var Yo=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Sl(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function Xi(e){let t=qS(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function F5(e,t,n,r=[]){let s=p.useRef(),i=eh();return Yo(()=>{var o;let l=(()=>{var u;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Nl,l),s.current=l}),s}var $Q=()=>{let[e,t]=p.useState(),n=Sl(()=>new Map);return Yo(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function HQ(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function wm({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(HQ(t),{ref:t.ref},n(t.props.children)):n(t)}var qQ={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function GQ({isOpen:e,onClose:t}){const n=ha(),[r,s]=p.useState(""),[i,o]=p.useState(null);p.useEffect(()=>{(async()=>{try{const m=await(await fetch("/api/plugins")).json();o(m)}catch{}})()},[]);const l=d=>i!=null&&i.plugins?i.plugins.some(f=>f.id===d):!1,h=[{id:"users",title:"Users",description:"Manage users and their accounts",icon:Ho,action:()=>n("/users"),category:"Navigation",keywords:["user","account","profile"]},{id:"organizations",title:"Organizations",description:"Manage organizations and teams",icon:Mr,action:()=>n("/organizations"),category:"Navigation",keywords:["org","company","team"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"},{id:"sessions",title:"Sessions",description:"View active user sessions",icon:RT,action:()=>n("/sessions"),category:"Navigation",keywords:["session","login","active"]},{id:"tools",title:"Tools",description:"View tools and utilities",icon:g3,action:()=>n("/tools"),category:"Navigation",keywords:["utilities","tools"]},{id:"database",title:"Database",description:"View database and schema",icon:nn,disabled:!0,action:()=>n("/database"),category:"Navigation",keywords:["database","schema"]},{id:"settings",title:"Settings",description:"Configure Better Auth Studio",icon:Do,action:()=>n("/settings"),category:"Navigation",keywords:["config","setup","preferences"]},{id:"dashboard",title:"Dashboard",description:"View overview and statistics",icon:RT,action:()=>n("/"),category:"Navigation",keywords:["overview","stats","home"]},{id:"create-user",title:"Create User",description:"Add a new user to the system",icon:ON,action:()=>n("/users"),category:"Actions",keywords:["add","new","register"]},{id:"create-organization",title:"Create Organization",description:"Create a new organization",icon:Fi,action:()=>n("/organizations"),category:"Actions",keywords:["add","new","org"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"},{id:"invite-user",title:"Invite User",description:"Send invitation to join organization",icon:jc,action:()=>n("/organizations"),category:"Actions",keywords:["invite","email","send"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"}].filter(d=>{var m;const f=r.toLowerCase();return d.title.toLowerCase().includes(f)||d.description.toLowerCase().includes(f)||((m=d.keywords)==null?void 0:m.some(y=>y.toLowerCase().includes(f)))}).reduce((d,f)=>(d[f.category]||(d[f.category]=[]),d[f.category].push(f),d),{});return p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key==="k"&&f.preventDefault()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),p.useEffect(()=>{const d=f=>{f.key==="Escape"&&t()};if(e)return document.body.style.overflow="hidden",document.addEventListener("keydown",d),()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",d)}},[e,t]),e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-start justify-center pt-[20vh] z-50 overflow-hidden",onClick:t,children:a.jsx("div",{className:"bg-black/90 overflow-hidden border border-white/10 rounded-none w-full max-w-2xl mx-4",onClick:d=>d.stopPropagation(),children:a.jsxs(dd,{className:"p-2",children:[a.jsxs("div",{className:"flex items-center border-b border-dashed border-white/10 px-3 pb-3",children:[a.jsx($o,{className:"w-4 h-4 text-gray-400 mr-3"}),a.jsx(dd.Input,{value:r,onValueChange:s,placeholder:"Search for actions, pages, or commands...",className:"flex-1 placeholder:text-xs bg-transparent text-white placeholder-gray-400 outline-none",autoFocus:!0}),a.jsx("kbd",{className:"hidden sm:inline-flex items-center px-2 py-1 text-xs text-gray-400 border border-dashed border-white/20 rounded-sm",children:"ESC"})]}),a.jsx(dd.List,{className:"max-h-96 overflow-y-auto p-2",children:Object.keys(h).length===0?a.jsxs("div",{className:"text-center py-8 text-gray-400",children:[a.jsx($o,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),a.jsx("p",{children:"No results found"}),a.jsx("p",{className:"text-sm",children:"Try a different search term"})]}):Object.entries(h).map(([d,f])=>a.jsx(dd.Group,{heading:d,className:"text-xs text-gray-400 font-medium mb-4 px-2",children:f.map(m=>{const y=m.icon,b=m.disabled;return a.jsxs(dd.Item,{value:m.id,disabled:b,onSelect:()=>{b||(m.action(),t())},className:`flex items-center space-x-3 px-0 py-2 rounded-none transition-colors relative ${b?"opacity-40 cursor-not-allowed blur-[0.5px]":"hover:bg-white/5 cursor-pointer"}`,children:[a.jsx(y,{className:"w-4 h-4 text-white"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"text-white text-[13px] font-light flex items-center gap-2",children:[m.title,b&&a.jsx(Jl,{className:"w-3 h-3 text-yellow-500"})]}),a.jsx("div",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:b?m.disabledMessage:m.description})]}),!b&&a.jsx(PY,{className:"w-4 h-4 text-gray-400"})]},m.id)})},d))}),a.jsx("div",{className:"border-t border-dashed border-white/10 px-3 py-2 text-xs text-gray-400",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{children:["Press"," ",a.jsx("kbd",{className:"px-1 py-0.5 border border-dashed border-white/20 rounded-sm",children:"↑↓"})," ","to navigate"]}),a.jsxs("span",{children:["Press"," ",a.jsx("kbd",{className:"px-1 py-0.5 border border-dashed border-white/20 rounded-sm",children:"Enter"})," ","to select"]})]})})]})})}):null}function qN(){return window.__STUDIO_CONFIG__||{}}function VQ(){return!!qN().basePath}const YQ={connecting:{label:"Connecting",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"},watching:{label:"Watching",textClass:"text-emerald-200 border-emerald-400/40",dotClass:"bg-emerald-300"},refreshing:{label:"Refreshing",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"},up_to_date:{label:"Up-to-date",textClass:"text-emerald-200 border-emerald-400/40",dotClass:"bg-emerald-300"},error:{label:"Reload Failed",textClass:"text-red-200 border-red-500/50",dotClass:"bg-red-400",animate:"animate-pulse"},unavailable:{label:"Watch Off",textClass:"text-gray-300 border-gray-500/40",dotClass:"bg-gray-400"},reconnecting:{label:"Reconnecting",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"}};function WQ(e){switch(e){case"refreshing":return"refreshing";case"error":return"error";case"up_to_date":case"watching":return"up_to_date";default:return"watching"}}const XQ=6,KQ=14;function ZQ({children:e}){const t=eo(),{counts:n,loading:r}=bm(),s=ha(),[i,o]=p.useState(!1),[l,c]=p.useState("v1.0.0"),[u,h]=p.useState({status:"connecting"}),[d,f]=p.useState(null),m=p.useRef(!1),y=p.useRef(null),b=p.useRef(!1),[w,x]=p.useState(null),[v,g]=p.useState(!1),[N,S]=p.useState(!1),E=p.useRef(null);p.useEffect(()=>{S(VQ())},[]);const j=()=>{y.current&&(clearTimeout(y.current),y.current=null)},R=()=>{j(),y.current=setTimeout(()=>{m.current=!1,h(I=>({...I,status:"up_to_date",updatedAt:Date.now()}))},4e3)};p.useEffect(()=>{const I=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),o(!0))};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]),p.useEffect(()=>{if(!N)return;(async()=>{try{const A=qN().basePath||"",T=await(await fetch(`${A}/auth/session`,{credentials:"include"})).json();T.authenticated&&T.user&&x(T.user)}catch{x(null)}})()},[N]),p.useEffect(()=>{const I=A=>{E.current&&!E.current.contains(A.target)&&g(!1)};return v&&document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[v]);const L=async()=>{try{const I=qN().basePath||"";await fetch(`${I}/auth/logout`,{method:"GET",credentials:"include"}),s("/login")}catch{s("/login")}},P=(I,A)=>I?I.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2):A?A[0].toUpperCase():"?";p.useEffect(()=>{const I=async()=>{var C;try{const O=await(await fetch("/api/config")).json();(C=O.studio)!=null&&C.version&&c(`v${O.studio.version}`)}catch{}},A=async()=>{try{const T=await(await fetch("/api/database/schema")).json();T.success&&T.schema&&T.schema.tables&&f(T.schema.tables.length)}catch{f(null)}};return I(),A(),()=>{j()}},[]);const U=()=>{m.current=!1,b.current=!1,j(),h(I=>({...I,status:"refreshing",updatedAt:Date.now()})),window.location.reload()};i5(I=>{if(I.type==="studio_status"){const A=WQ(I.status);A==="up_to_date"&&(m.current=!1,j()),h(C=>({status:A,fileName:I.fileName||C.fileName,updatedAt:I.updatedAt||Date.now()}));return}if(I.type==="config_change_detected"){m.current=!0,R(),h(A=>({...A,status:"refreshing",fileName:I.fileName||A.fileName,updatedAt:Date.now()})),b.current||(b.current=!0,setTimeout(()=>{U()},200));return}if(I.type==="config_changed"){m.current=!1,j(),h(A=>({...A,status:"up_to_date",fileName:I.fileName||A.fileName,updatedAt:I.changedAt||Date.now()}));return}I.type==="connected"&&(m.current=!1,j(),h(A=>({...A,status:"up_to_date",updatedAt:Date.now()})))},{onStatusChange:I=>{h(A=>{if(A.status==="refreshing"&&I!=="unavailable"&&I!=="open")return A;switch(I){case"connecting":return{...A,status:"connecting"};case"open":return j(),m.current?A:{...A,status:"watching",updatedAt:Date.now()};case"reconnecting":case"closed":return{...A,status:"reconnecting"};case"error":return{...A,status:"error"};case"unavailable":return m.current=!1,j(),{...A,status:"unavailable"};default:return A}})}});const F=YQ[u.status],G=I=>I>=1e3?`${(I/1e3).toFixed(1).replace(/\.0$/,"")}k`:I.toString(),_=[{name:"Dashboard",href:"/",icon:YY},{name:"Users",href:"/users",icon:Ho,badge:r?"...":G(n.users)},{name:"Organizations",href:"/organizations",icon:Mr,badge:r?"...":G(n.organizations)},{name:"Database",href:"/database",icon:nn,badge:d!==null?G(d):void 0},{name:"Emails",href:"/emails",icon:jc,badge:G(XQ)},{name:"Tools",href:"/tools",icon:g3,badge:G(KQ)},{name:"Settings",href:"/settings",icon:Do}];return a.jsxs("div",{className:"min-h-screen bg-black",children:[a.jsx("div",{className:"bg-black/70 border-b border-white/15",children:a.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx("img",{src:UW("/logo.png"),alt:"Logo",className:"w-10 h-10 object-contain"}),a.jsx("div",{className:"mb-0 cursor-pointer",onClick:()=>s("/"),children:a.jsxs("h1",{className:"text-md inline-flex mb-0 items-start font-light font-mono uppercase text-white gap-2",children:["Better-Auth Studio",a.jsxs("sup",{className:"text-xs text-gray-400 ml-1 mt-0 flex items-center space-x-2",children:[a.jsxs("span",{className:"inline-flex items-center",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 lowercase font-mono text-xs",children:l}),a.jsx("span",{className:"ml-1",children:"]"})]}),a.jsxs("span",{className:"inline-flex items-center",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:"PUBLIC BETA"}),a.jsx("span",{className:"ml-1",children:"]"})]}),a.jsxs("span",{className:`inline-flex items-center rounded border px-1.5 py-0.5 font-normal uppercase tracking-wide text-[9px] ${F.textClass} ${F.animate??""}`,children:[a.jsx("span",{className:`mr-1 h-1.5 w-1.5 rounded-full ${F.dotClass}`}),F.label]}),a.jsx("button",{type:"button",onClick:U,"aria-label":"Hard refresh studio",className:"ml-1 inline-flex items-center rounded border border-dashed border-white/20 p-0.5 text-white/70 transition hover:text-white hover:border-white/50",children:a.jsx(RN,{className:"h-3.5 w-3.5"})})]})]})})]})}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("a",{href:"https://better-auth-studio.vercel.app/docs",target:"_blank",rel:"noopener",className:"group flex items-center",children:[a.jsx("span",{className:"text-white/70 text-xs mr-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-sm uppercase",children:"Docs"}),a.jsx("span",{className:"text-white/70 text-xs ml-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"]"})]}),a.jsxs("a",{href:"https://better-auth.com/docs",target:"_blank",rel:"noopener",className:"group flex items-center",children:[a.jsx("span",{className:"text-white/70 text-xs mr-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-sm uppercase",children:"Support"}),a.jsx("span",{className:"text-white/70 text-xs ml-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"]"})]}),a.jsxs("div",{className:"relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx("input",{type:"text",placeholder:"Search...",onClick:()=>o(!0),className:"pl-10 pr-4 py-2 bg-black border rounded-none border-gray-600 text-white border-dashed border-white/20 focus:ring-2 focus:ring-white focus:border-transparent transition-colors placeholder-gray-400 cursor-pointer",readOnly:!0}),a.jsx("kbd",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-xs text-gray-400 border border-dashed border-white/10 rounded-sm px-1.5 py-0.5",children:"⌘ K"})]}),N&&w&&a.jsxs("div",{className:"relative h-full",ref:E,children:[a.jsx("button",{type:"button",onClick:()=>g(!v),className:"w-10 h-10 border border-dashed border-white/30 bg-black flex items-center justify-center hover:border-white/50 transition-colors overflow-hidden",children:w.image?a.jsx("img",{src:w.image,alt:w.name||w.email,className:"w-full h-full object-cover"}):a.jsx("span",{className:"text-white text-xs font-mono uppercase",children:P(w.name,w.email)})}),v&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-64 border border-dashed border-white/20 bg-black z-50",children:[a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 border border-dashed border-white/30 bg-black flex items-center justify-center flex-shrink-0 overflow-hidden",children:w.image?a.jsx("img",{src:w.image,alt:w.name||w.email,className:"w-full h-full object-cover"}):a.jsx(pp,{className:"w-5 h-5 text-white/50"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-white text-[11px] font-mono uppercase truncate",children:[w.name||"User",w.role&&a.jsx("span",{className:"inline-flex ml-2 mt-1 text-[9px] tracking-wider font-mono uppercase text-white/60 border border-dashed border-white/20 px-1.5 py-0.5",children:w.role})]}),a.jsx("p",{className:"text-white/40 text-xs font-mono truncate",children:w.email})]})]})}),a.jsxs("div",{className:"flex flex-col items-center justify-center",children:[a.jsx("hr",{className:"w-full border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-5 w-full bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[5%]"}),a.jsx("hr",{className:"w-full border-white/10 h-px"})]}),a.jsxs("div",{className:"",children:[a.jsxs(tp,{to:"/settings",onClick:()=>g(!1),className:"flex items-center gap-3 px-3 py-3 text-white/70 hover:text-white hover:bg-white/5 transition-colors",children:[a.jsx(Do,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-mono uppercase",children:"Settings"})]}),a.jsxs("button",{type:"button",onClick:L,className:"w-full flex items-center gap-3 px-3 py-3 text-red-400/70 hover:text-red-400 hover:bg-red-500/5 transition-colors",children:[a.jsx(XY,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-mono uppercase",children:"Logout"})]})]})]})]})]})]})}),a.jsx("div",{className:"bg-black/50 border-b border-white/15",children:a.jsx("div",{className:"px-6",children:a.jsx("nav",{className:"flex overflow-y-hidden overflow-x-auto",children:_.map((I,A)=>{const C=t.pathname===I.href;return a.jsxs("div",{className:"flex items-center",children:[A===0&&a.jsx("div",{className:"h-[50px] -my-5 w-px bg-transparent border-dashed border-r border-white/20"}),a.jsxs(tp,{to:I.href,className:`flex items-center space-x-2 border-x-0 px-8 py-4 text-sm font-medium border-b-2 transition-all duration-200 relative ${C?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-500/50"}`,children:[a.jsx(I.icon,{className:"w-4 h-4"}),a.jsxs("span",{className:"inline-flex font-mono uppercase border-x-0 font-light text-xs items-start",children:[I.name,I.badge&&a.jsxs("sup",{className:"text-xs text-gray-500 ml-1",children:[a.jsx("span",{className:"mr-0.5",children:"["}),a.jsx("span",{className:"text-white/80 lowercase font-mono text-xs",children:I.badge}),a.jsx("span",{className:"ml-0.5",children:"]"})]})]})]}),A<=_.length-1&&a.jsx("div",{className:"h-[50px] -my-5 w-px bg-transparent border-dashed border-r border-white/20"})]},I.name)})})})}),a.jsx("div",{className:"flex-1 p-0",children:e}),a.jsx(GQ,{isOpen:i,onClose:()=>o(!1)})]})}function QQ(){const e=ha(),t=async()=>{var n;try{const r=((n=window.__STUDIO_CONFIG__)==null?void 0:n.basePath)||"",s=r?`${r}/auth`:"/api/auth";await fetch(`${s}/logout`,{credentials:"include"}),e("/login")}catch{e("/login")}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-[3%]",children:a.jsx("div",{className:"absolute inset-0 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_8px)]"})}),a.jsx("div",{className:"w-full max-w-md relative z-10",children:a.jsxs("div",{className:"border border-dashed border-white/20 bg-black p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-6 h-6 border border-dashed border-red-500/40 flex items-center justify-center",children:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",className:"text-red-400",children:a.jsx("path",{d:"M4 4h2v2H4V4zm14 0h2v2h-2V4zM6 6h2v2H6V6zm10 0h2v2h-2V6zM8 8h2v2H8V8zm6 0h2v2h-2V8zm-4 4h4v2h-4v-2zm-2 4h2v2H8v-2zm6 0h2v2h-2v-2zm-4 2h4v2h-4v-2z",fill:"currentColor"})})}),a.jsx("span",{className:"text-white/60 text-xs font-mono uppercase tracking-wider",children:"access denied"})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-white text-lg font-mono uppercase tracking-wide mb-2",children:"Permission Denied"}),a.jsx("p",{className:"text-white/40 text-xs font-mono leading-relaxed",children:"Your account does not have the required role to access Better Auth Studio."})]}),a.jsx("div",{className:"p-3 border border-dashed border-white/10 bg-white/[2%] mb-6",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-white/40 flex-shrink-0 mt-0.5",children:a.jsx("path",{d:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z",fill:"currentColor"})}),a.jsxs("p",{className:"text-white/40 text-[11px] font-mono",children:["Required role: ",a.jsx("span",{className:"text-white/60",children:"admin"})]})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("button",{onClick:t,className:"w-full h-10 bg-white text-black text-xs font-mono uppercase tracking-wider hover:bg-white/90 transition-colors flex items-center justify-center gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-black",children:a.jsx("path",{d:"M5 3h14v2H5V3zm0 16h14v2H5v-2zm0-8h8v2H5v-2zm10 0h2v2h-2v-2zm2 2h2v2h-2v-2zm0-4h2v2h-2V9zm-2 6h2v2h-2v-2z",fill:"currentColor"})}),"Sign Out"]}),a.jsxs("button",{onClick:()=>window.history.back(),className:"w-full h-10 border border-dashed border-white/20 text-white text-xs font-mono uppercase tracking-wider hover:bg-white/5 hover:border-white/30 transition-colors flex items-center justify-center gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-white",children:a.jsx("path",{d:"M12 4h2v2h-2V4zm-2 2h2v2h-2V6zm-2 2h2v2H8V8zm-2 2h2v4H6v-4zm14 0h2v4h-2v-4zm-2 4h2v2h-2v-2zm-2 2h2v2h-2v-2zm-2 2h2v2h-2v-2z",fill:"currentColor"})}),"Go Back"]})]}),a.jsx("div",{className:"mt-6 pt-4 border-t border-dashed border-white/10",children:a.jsx("p",{className:"text-white/20 text-[10px] font-mono text-center",children:"Contact your administrator for access"})})]})})]})}function Wo(e){"@babel/helpers - typeof";return Wo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wo(e)}function Xo(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Zn(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Jr(e){Zn(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Wo(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function JQ(e,t){Zn(2,arguments);var n=Jr(e).getTime(),r=Xo(t);return new Date(n+r)}var eJ={};function Nm(){return eJ}function tJ(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function nJ(e){return Zn(1,arguments),e instanceof Date||Wo(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function aJ(e){if(Zn(1,arguments),!nJ(e)&&typeof e!="number")return!1;var t=Jr(e);return!isNaN(Number(t))}function rJ(e,t){Zn(2,arguments);var n=Xo(t);return JQ(e,-n)}var sJ=864e5;function iJ(e){Zn(1,arguments);var t=Jr(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),s=n-r;return Math.floor(s/sJ)+1}function Np(e){Zn(1,arguments);var t=1,n=Jr(e),r=n.getUTCDay(),s=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-s),n.setUTCHours(0,0,0,0),n}function B5(e){Zn(1,arguments);var t=Jr(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var s=Np(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var o=Np(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function oJ(e){Zn(1,arguments);var t=B5(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Np(n);return r}var lJ=6048e5;function cJ(e){Zn(1,arguments);var t=Jr(e),n=Np(t).getTime()-oJ(t).getTime();return Math.round(n/lJ)+1}function Sp(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Nm(),d=Xo((n=(r=(s=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&s!==void 0?s:h.weekStartsOn)!==null&&r!==void 0?r:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Jr(e),m=f.getUTCDay(),y=(m<d?7:0)+m-d;return f.setUTCDate(f.getUTCDate()-y),f.setUTCHours(0,0,0,0),f}function z5(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Jr(e),d=h.getUTCFullYear(),f=Nm(),m=Xo((n=(r=(s=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&s!==void 0?s:f.firstWeekContainsDate)!==null&&r!==void 0?r:(c=f.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(d+1,0,m),y.setUTCHours(0,0,0,0);var b=Sp(y,t),w=new Date(0);w.setUTCFullYear(d,0,m),w.setUTCHours(0,0,0,0);var x=Sp(w,t);return h.getTime()>=b.getTime()?d+1:h.getTime()>=x.getTime()?d:d-1}function dJ(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Nm(),d=Xo((n=(r=(s=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&s!==void 0?s:h.firstWeekContainsDate)!==null&&r!==void 0?r:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=z5(e,t),m=new Date(0);m.setUTCFullYear(f,0,d),m.setUTCHours(0,0,0,0);var y=Sp(m,t);return y}var uJ=6048e5;function hJ(e,t){Zn(1,arguments);var n=Jr(e),r=Sp(n,t).getTime()-dJ(n,t).getTime();return Math.round(r/uJ)+1}function St(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var di={y:function(t,n){var r=t.getUTCFullYear(),s=r>0?r:1-r;return St(n==="yy"?s%100:s,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):St(r+1,2)},d:function(t,n){return St(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return St(t.getUTCHours()%12||12,n.length)},H:function(t,n){return St(t.getUTCHours(),n.length)},m:function(t,n){return St(t.getUTCMinutes(),n.length)},s:function(t,n){return St(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,s=t.getUTCMilliseconds(),i=Math.floor(s*Math.pow(10,r-3));return St(i,n.length)}},pl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},fJ={G:function(t,n,r){var s=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var s=t.getUTCFullYear(),i=s>0?s:1-s;return r.ordinalNumber(i,{unit:"year"})}return di.y(t,n)},Y:function(t,n,r,s){var i=z5(t,s),o=i>0?i:1-i;if(n==="YY"){var l=o%100;return St(l,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):St(o,n.length)},R:function(t,n){var r=B5(t);return St(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return St(r,n.length)},Q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(s);case"QQ":return St(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(s);case"qq":return St(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,n,r){var s=t.getUTCMonth();switch(n){case"M":case"MM":return di.M(t,n);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(t,n,r){var s=t.getUTCMonth();switch(n){case"L":return String(s+1);case"LL":return St(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(t,n,r,s){var i=hJ(t,s);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):St(i,n.length)},I:function(t,n,r){var s=cJ(t);return n==="Io"?r.ordinalNumber(s,{unit:"week"}):St(s,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):di.d(t,n)},D:function(t,n,r){var s=iJ(t);return n==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):St(s,n.length)},E:function(t,n,r){var s=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return St(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return St(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var s=t.getUTCDay(),i=s===0?7:s;switch(n){case"i":return String(i);case"ii":return St(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(t,n,r){var s=t.getUTCHours(),i=s/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var s=t.getUTCHours(),i;switch(s===12?i=pl.noon:s===0?i=pl.midnight:i=s/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var s=t.getUTCHours(),i;switch(s>=17?i=pl.evening:s>=12?i=pl.afternoon:s>=4?i=pl.morning:i=pl.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var s=t.getUTCHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return di.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):di.H(t,n)},K:function(t,n,r){var s=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(s,{unit:"hour"}):St(s,n.length)},k:function(t,n,r){var s=t.getUTCHours();return s===0&&(s=24),n==="ko"?r.ordinalNumber(s,{unit:"hour"}):St(s,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):di.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):di.s(t,n)},S:function(t,n){return di.S(t,n)},X:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();if(o===0)return"Z";switch(n){case"X":return uC(o);case"XXXX":case"XX":return xo(o);case"XXXXX":case"XXX":default:return xo(o,":")}},x:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"x":return uC(o);case"xxxx":case"xx":return xo(o);case"xxxxx":case"xxx":default:return xo(o,":")}},O:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+dC(o,":");case"OOOO":default:return"GMT"+xo(o,":")}},z:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+dC(o,":");case"zzzz":default:return"GMT"+xo(o,":")}},t:function(t,n,r,s){var i=s._originalDate||t,o=Math.floor(i.getTime()/1e3);return St(o,n.length)},T:function(t,n,r,s){var i=s._originalDate||t,o=i.getTime();return St(o,n.length)}};function dC(e,t){var n=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),i=r%60;if(i===0)return n+String(s);var o=t;return n+String(s)+o+St(i,2)}function uC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+St(Math.abs(e)/60,2)}return xo(e,t)}function xo(e,t){var n=t||"",r=e>0?"-":"+",s=Math.abs(e),i=St(Math.floor(s/60),2),o=St(s%60,2);return r+i+n+o}var hC=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},$5=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},pJ=function(t,n){var r=t.match(/(P+)(p+)?/)||[],s=r[1],i=r[2];if(!i)return hC(t,n);var o;switch(s){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",hC(s,n)).replace("{{time}}",$5(i,n))},mJ={p:$5,P:pJ},gJ=["D","DD"],xJ=["YY","YYYY"];function bJ(e){return gJ.indexOf(e)!==-1}function vJ(e){return xJ.indexOf(e)!==-1}function fC(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var yJ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},wJ=function(t,n,r){var s,i=yJ[t];return typeof i=="string"?s=i:n===1?s=i.one:s=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Zg(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var NJ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},SJ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},EJ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jJ={date:Zg({formats:NJ,defaultWidth:"full"}),time:Zg({formats:SJ,defaultWidth:"full"}),dateTime:Zg({formats:EJ,defaultWidth:"full"})},TJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},CJ=function(t,n,r,s){return TJ[t]};function ud(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",s;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):i;s=e.formattingValues[o]||e.formattingValues[i]}else{var l=e.defaultWidth,c=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[c]||e.values[l]}var u=e.argumentCallback?e.argumentCallback(t):t;return s[u]}}var kJ={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},AJ={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_J={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},RJ={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},OJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},DJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},IJ=function(t,n){var r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},MJ={ordinalNumber:IJ,era:ud({values:kJ,defaultWidth:"wide"}),quarter:ud({values:AJ,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:ud({values:_J,defaultWidth:"wide"}),day:ud({values:RJ,defaultWidth:"wide"}),dayPeriod:ud({values:OJ,defaultWidth:"wide",formattingValues:DJ,defaultFormattingWidth:"wide"})};function hd(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;var o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?UJ(l,function(d){return d.test(o)}):LJ(l,function(d){return d.test(o)}),u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;var h=t.slice(o.length);return{value:u,rest:h}}}function LJ(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function UJ(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function PJ(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var s=r[0],i=t.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;var l=t.slice(s.length);return{value:o,rest:l}}}var FJ=/^(\d+)(th|st|nd|rd)?/i,BJ=/\d+/i,zJ={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$J={any:[/^b/i,/^(a|c)/i]},HJ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},qJ={any:[/1/i,/2/i,/3/i,/4/i]},GJ={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},VJ={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},YJ={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},WJ={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},XJ={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},KJ={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZJ={ordinalNumber:PJ({matchPattern:FJ,parsePattern:BJ,valueCallback:function(t){return parseInt(t,10)}}),era:hd({matchPatterns:zJ,defaultMatchWidth:"wide",parsePatterns:$J,defaultParseWidth:"any"}),quarter:hd({matchPatterns:HJ,defaultMatchWidth:"wide",parsePatterns:qJ,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:hd({matchPatterns:GJ,defaultMatchWidth:"wide",parsePatterns:VJ,defaultParseWidth:"any"}),day:hd({matchPatterns:YJ,defaultMatchWidth:"wide",parsePatterns:WJ,defaultParseWidth:"any"}),dayPeriod:hd({matchPatterns:XJ,defaultMatchWidth:"any",parsePatterns:KJ,defaultParseWidth:"any"})},QJ={code:"en-US",formatDistance:wJ,formatLong:jJ,formatRelative:CJ,localize:MJ,match:ZJ,options:{weekStartsOn:0,firstWeekContainsDate:1}},JJ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,eee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tee=/^'([^]*?)'?$/,nee=/''/g,aee=/[a-zA-Z]/;function Yn(e,t,n){var r,s,i,o,l,c,u,h,d,f,m,y,b,w;Zn(2,arguments);var x=String(t),v=Nm(),g=(r=(s=void 0)!==null&&s!==void 0?s:v.locale)!==null&&r!==void 0?r:QJ,N=Xo((i=(o=(l=(c=void 0)!==null&&c!==void 0?c:void 0)!==null&&l!==void 0?l:v.firstWeekContainsDate)!==null&&o!==void 0?o:(u=v.locale)===null||u===void 0||(h=u.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(N>=1&&N<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var S=Xo((d=(f=(m=(y=void 0)!==null&&y!==void 0?y:void 0)!==null&&m!==void 0?m:v.weekStartsOn)!==null&&f!==void 0?f:(b=v.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&d!==void 0?d:0);if(!(S>=0&&S<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!g.localize)throw new RangeError("locale must contain localize property");if(!g.formatLong)throw new RangeError("locale must contain formatLong property");var E=Jr(e);if(!aJ(E))throw new RangeError("Invalid time value");var j=tJ(E),R=rJ(E,j),L={firstWeekContainsDate:N,weekStartsOn:S,locale:g,_originalDate:E},P=x.match(eee).map(function(U){var F=U[0];if(F==="p"||F==="P"){var G=mJ[F];return G(U,g.formatLong)}return U}).join("").match(JJ).map(function(U){if(U==="''")return"'";var F=U[0];if(F==="'")return ree(U);var G=fJ[F];if(G)return vJ(U)&&fC(U,t,String(e)),bJ(U)&&fC(U,t,String(e)),G(R,U,g.localize,L);if(F.match(aee))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");return U}).join("");return P}function ree(e){var t=e.match(tee);return t?t[1].replace(nee,"'"):e}function GN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function see(e,t){if(e){if(typeof e=="string")return GN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GN(e,t):void 0}}function iee(e,t){if(Wo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oee(e){var t=iee(e,"string");return Wo(t)=="symbol"?t:t+""}function H5(e,t,n){return(t=oee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mC=mp,q5=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return mC(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const h=n==null?void 0:n[u],d=i==null?void 0:i[u];if(h===null)return null;const f=pC(h)||pC(d);return s[u][f]}),l=n&&Object.entries(n).reduce((u,h)=>{let[d,f]=h;return f===void 0||(u[d]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,h)=>{let{class:d,className:f,...m}=h;return Object.entries(m).every(y=>{let[b,w]=y;return Array.isArray(w)?w.includes({...i,...l}[b]):{...i,...l}[b]===w})?[...u,d,f]:u},[]);return mC(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},VN=q5("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-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),z=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?SQ:"button";return a.jsx(o,{className:Ve(VN({variant:t,size:n,className:e})),ref:i,...s})});z.displayName="Button";function lee(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const Qg={},Td={};function No(e,t){try{const r=(Qg[e]||(Qg[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return r in Td?Td[r]:gC(r,r.split(":"))}catch{if(e in Td)return Td[e];const n=e==null?void 0:e.match(cee);return n?gC(e,n.slice(1)):NaN}}const cee=/([+-]\d\d):?(\d\d)?/;function gC(e,t){const n=+(t[0]||0),r=+(t[1]||0),s=+(t[2]||0)/60;return Td[e]=n*60+r>0?n*60+r+s:n*60-r-s}class zr extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(No(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),G5(this),YN(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new zr(...n,t):new zr(Date.now(),t)}withTimeZone(t){return new zr(+this,t)}getTimezoneOffset(){const t=-No(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),YN(this),+this}[Symbol.for("constructDateFrom")](t){return new zr(+new Date(t),this.timeZone)}}const xC=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!xC.test(e))return;const t=e.replace(xC,"$1UTC");zr.prototype[t]&&(e.startsWith("get")?zr.prototype[e]=function(){return this.internal[t]()}:(zr.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),dee(this),+this},zr.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),YN(this),+this}))});function YN(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-No(e.timeZone,e)*60))}function dee(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),G5(e)}function G5(e){const t=No(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const u=new Date(+e);u.setUTCSeconds(0);const h=s>0?u.getSeconds():(u.getSeconds()-60)%60,d=Math.round(-(No(e.timeZone,e)*60))%60;(d||h)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+d),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+d+h));const f=No(e.timeZone,e),m=f>0?Math.floor(f):Math.ceil(f),b=-new Date(+e).getTimezoneOffset()-m,w=m!==n,x=b-c;if(w&&x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+x);const v=No(e.timeZone,e),g=v>0?Math.floor(v):Math.ceil(v),N=m-g;N&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+N),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+N))}}class Bn extends zr{static tz(t,...n){return n.length?new Bn(...n,t):new Bn(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),s=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${t} GMT${n}${r}${s} (${lee(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[n,r,s]}withTimeZone(t){return new Bn(+this,t)}[Symbol.for("constructDateFrom")](t){return new Bn(+new Date(t),this.timeZone)}}const V5=6048e5,uee=864e5,bC=Symbol.for("constructDateFrom");function vn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&bC in e?e[bC](t):e instanceof Date?new e.constructor(t):new Date(t)}function At(e,t){return vn(t||e,e)}function Y5(e,t,n){const r=At(e,n==null?void 0:n.in);return isNaN(t)?vn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function W5(e,t,n){const r=At(e,n==null?void 0:n.in);if(isNaN(t))return vn(e,NaN);if(!t)return r;const s=r.getDate(),i=vn(e,r.getTime());i.setMonth(r.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let hee={};function th(){return hee}function kc(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.weekStartsOn)??0,s=At(e,t==null?void 0:t.in),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Tu(e,t){return kc(e,{...t,weekStartsOn:1})}function X5(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=vn(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=Tu(s),o=vn(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const l=Tu(o);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function vC(e){const t=At(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Hc(e,...t){const n=vn.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function Cu(e,t){const n=At(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function K5(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t),i=Cu(r),o=Cu(s),l=+i-vC(i),c=+o-vC(o);return Math.round((l-c)/uee)}function fee(e,t){const n=X5(e,t),r=vn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Tu(r)}function pee(e,t,n){return Y5(e,t*7,n)}function mee(e,t,n){return W5(e,t*12,n)}function gee(e,t){let n,r=t==null?void 0:t.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=vn.bind(null,s));const i=At(s,r);(!n||n<i||isNaN(+i))&&(n=i)}),vn(r,n||NaN)}function xee(e,t){let n,r=t==null?void 0:t.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=vn.bind(null,s));const i=At(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vn(r,n||NaN)}function bee(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return+Cu(r)==+Cu(s)}function Z5(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function vee(e){return!(!Z5(e)&&typeof e!="number"||isNaN(+At(e)))}function yee(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t),i=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return i*12+o}function wee(e,t){const n=At(e,t==null?void 0:t.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Q5(e,t){const[n,r]=Hc(e,t.start,t.end);return{start:n,end:r}}function Nee(e,t){const{start:n,end:r}=Q5(t==null?void 0:t.in,e);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setDate(1);let l=1;const c=[];for(;+o<=i;)c.push(vn(n,o)),o.setMonth(o.getMonth()+l);return s?c.reverse():c}function See(e,t){const n=At(e,t==null?void 0:t.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Eee(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function J5(e,t){const n=At(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jee(e,t){const{start:n,end:r}=Q5(t==null?void 0:t.in,e);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const c=[];for(;+o<=i;)c.push(vn(n,o)),o.setFullYear(o.getFullYear()+l);return s?c.reverse():c}function eU(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.weekStartsOn)??0,s=At(e,t==null?void 0:t.in),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Tee(e,t){return eU(e,{...t,weekStartsOn:1})}const Cee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},kee=(e,t,n)=>{let r;const s=Cee[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Jg(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Aee={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_ee={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ree={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Oee={date:Jg({formats:Aee,defaultWidth:"full"}),time:Jg({formats:_ee,defaultWidth:"full"}),dateTime:Jg({formats:Ree,defaultWidth:"full"})},Dee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Iee=(e,t,n,r)=>Dee[e];function fd(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const Mee={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Lee={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Uee={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pee={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Fee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zee=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},$ee={ordinalNumber:zee,era:fd({values:Mee,defaultWidth:"wide"}),quarter:fd({values:Lee,defaultWidth:"wide",argumentCallback:e=>e-1}),month:fd({values:Uee,defaultWidth:"wide"}),day:fd({values:Pee,defaultWidth:"wide"}),dayPeriod:fd({values:Fee,defaultWidth:"wide",formattingValues:Bee,defaultFormattingWidth:"wide"})};function pd(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?qee(l,d=>d.test(o)):Hee(l,d=>d.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const h=t.slice(o.length);return{value:u,rest:h}}}function Hee(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function qee(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Gee(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const Vee=/^(\d+)(th|st|nd|rd)?/i,Yee=/\d+/i,Wee={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Xee={any:[/^b/i,/^(a|c)/i]},Kee={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zee={any:[/1/i,/2/i,/3/i,/4/i]},Qee={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Jee={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ete={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},tte={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},nte={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ate={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},rte={ordinalNumber:Gee({matchPattern:Vee,parsePattern:Yee,valueCallback:e=>parseInt(e,10)}),era:pd({matchPatterns:Wee,defaultMatchWidth:"wide",parsePatterns:Xee,defaultParseWidth:"any"}),quarter:pd({matchPatterns:Kee,defaultMatchWidth:"wide",parsePatterns:Zee,defaultParseWidth:"any",valueCallback:e=>e+1}),month:pd({matchPatterns:Qee,defaultMatchWidth:"wide",parsePatterns:Jee,defaultParseWidth:"any"}),day:pd({matchPatterns:ete,defaultMatchWidth:"wide",parsePatterns:tte,defaultParseWidth:"any"}),dayPeriod:pd({matchPatterns:nte,defaultMatchWidth:"any",parsePatterns:ate,defaultParseWidth:"any"})},GS={code:"en-US",formatDistance:kee,formatLong:Oee,formatRelative:Iee,localize:$ee,match:rte,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ste(e,t){const n=At(e,t==null?void 0:t.in);return K5(n,J5(n))+1}function tU(e,t){const n=At(e,t==null?void 0:t.in),r=+Tu(n)-+fee(n);return Math.round(r/V5)+1}function nU(e,t){var h,d,f,m;const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=th(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=vn((t==null?void 0:t.in)||e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=kc(o,t),c=vn((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=kc(c,t);return+n>=+l?r+1:+n>=+u?r:r-1}function ite(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,s=nU(e,t),i=vn((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),kc(i,t)}function aU(e,t){const n=At(e,t==null?void 0:t.in),r=+kc(n,t)-+ite(n,t);return Math.round(r/V5)+1}function Et(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const ui={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Et(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Et(n+1,2)},d(e,t){return Et(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Et(e.getHours()%12||12,t.length)},H(e,t){return Et(e.getHours(),t.length)},m(e,t){return Et(e.getMinutes(),t.length)},s(e,t){return Et(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Et(s,t.length)}},ml={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},yC={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return ui.y(e,t)},Y:function(e,t,n,r){const s=nU(e,r),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return Et(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Et(i,t.length)},R:function(e,t){const n=X5(e);return Et(n,t.length)},u:function(e,t){const n=e.getFullYear();return Et(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Et(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Et(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return ui.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Et(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=aU(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):Et(s,t.length)},I:function(e,t,n){const r=tU(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Et(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):ui.d(e,t)},D:function(e,t,n){const r=ste(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Et(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Et(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Et(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return Et(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=ml.noon:r===0?s=ml.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=ml.evening:r>=12?s=ml.afternoon:r>=4?s=ml.morning:s=ml.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ui.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):ui.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):ui.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):ui.s(e,t)},S:function(e,t){return ui.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return NC(r);case"XXXX":case"XX":return bo(r);case"XXXXX":case"XXX":default:return bo(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return NC(r);case"xxxx":case"xx":return bo(r);case"xxxxx":case"xxx":default:return bo(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+wC(r,":");case"OOOO":default:return"GMT"+bo(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+wC(r,":");case"zzzz":default:return"GMT"+bo(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return Et(r,t.length)},T:function(e,t,n){return Et(+e,t.length)}};function wC(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+Et(i,2)}function NC(e,t){return e%60===0?(e>0?"-":"+")+Et(Math.abs(e)/60,2):bo(e,t)}function bo(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Et(Math.trunc(r/60),2),i=Et(r%60,2);return n+s+t+i}const SC=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},rU=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ote=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return SC(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",SC(r,t)).replace("{{time}}",rU(s,t))},lte={p:rU,P:ote},cte=/^D+$/,dte=/^Y+$/,ute=["D","DD","YY","YYYY"];function hte(e){return cte.test(e)}function fte(e){return dte.test(e)}function pte(e,t,n){const r=mte(e,t,n);if(console.warn(r),ute.includes(e))throw new RangeError(r)}function mte(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const gte=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xte=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bte=/^'([^]*?)'?$/,vte=/''/g,yte=/[a-zA-Z]/;function wte(e,t,n){var h,d,f,m,y,b,w,x;const r=th(),s=(n==null?void 0:n.locale)??r.locale??GS,i=(n==null?void 0:n.firstWeekContainsDate)??((d=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((b=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:b.weekStartsOn)??r.weekStartsOn??((x=(w=r.locale)==null?void 0:w.options)==null?void 0:x.weekStartsOn)??0,l=At(e,n==null?void 0:n.in);if(!vee(l))throw new RangeError("Invalid time value");let c=t.match(xte).map(v=>{const g=v[0];if(g==="p"||g==="P"){const N=lte[g];return N(v,s.formatLong)}return v}).join("").match(gte).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const g=v[0];if(g==="'")return{isToken:!1,value:Nte(v)};if(yC[g])return{isToken:!0,value:v};if(g.match(yte))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(v=>{if(!v.isToken)return v.value;const g=v.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&fte(g)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&hte(g))&&pte(g,t,String(e));const N=yC[g[0]];return N(l,g,s.localize,u)}).join("")}function Nte(e){const t=e.match(bte);return t?t[1].replace(vte,"'"):e}function Ste(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=n.getMonth(),i=vn(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Ete(e,t){return At(e,t==null?void 0:t.in).getMonth()}function jte(e,t){return At(e,t==null?void 0:t.in).getFullYear()}function Tte(e,t){return+At(e)>+At(t)}function Cte(e,t){return+At(e)<+At(t)}function kte(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function Ate(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return r.getFullYear()===s.getFullYear()}function _te(e,t,n){const r=At(e,n==null?void 0:n.in),s=r.getFullYear(),i=r.getDate(),o=vn(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=Ste(o);return r.setMonth(t,Math.min(i,l)),r}function Rte(e,t,n){const r=At(e,n==null?void 0:n.in);return isNaN(+r)?vn(e,NaN):(r.setFullYear(t),r)}const EC=5,Ote=4;function Dte(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,s=t.addDays(e,-r+1),i=t.addDays(s,EC*7-1);return t.getMonth(e)===t.getMonth(i)?EC:Ote}function sU(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-1*6):t.addDays(n,-1*(r-1))}function Ite(e,t){const n=sU(e,t),r=Dte(e,t);return t.addDays(n,r*7-1)}class Pa{constructor(t,n){this.Date=Date,this.today=()=>{var r;return(r=this.overrides)!=null&&r.today?this.overrides.today():this.options.timeZone?Bn.tz(this.options.timeZone):new this.Date},this.newDate=(r,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Bn(r,s,i,this.options.timeZone):new Date(r,s,i)},this.addDays=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(r,s):Y5(r,s)},this.addMonths=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(r,s):W5(r,s)},this.addWeeks=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(r,s):pee(r,s)},this.addYears=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(r,s):mee(r,s)},this.differenceInCalendarDays=(r,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):K5(r,s)},this.differenceInCalendarMonths=(r,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):yee(r,s)},this.eachMonthOfInterval=r=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Nee(r)},this.eachYearOfInterval=r=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):jee(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=r=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):Ite(r,this)},this.endOfISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(r):Tee(r)},this.endOfMonth=r=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(r):wee(r)},this.endOfWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(r,s):eU(r,this.options)},this.endOfYear=r=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(r):Eee(r)},this.format=(r,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(r,s,this.options):wte(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(r):tU(r)},this.getMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(r,this.options):Ete(r,this.options)},this.getYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(r,this.options):jte(r,this.options)},this.getWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(r,this.options):aU(r,this.options)},this.isAfter=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(r,s):Tte(r,s)},this.isBefore=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(r,s):Cte(r,s)},this.isDate=r=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(r):Z5(r)},this.isSameDay=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(r,s):bee(r,s)},this.isSameMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(r,s):kte(r,s)},this.isSameYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(r,s):Ate(r,s)},this.max=r=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(r):gee(r)},this.min=r=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(r):xee(r)},this.setMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(r,s):_te(r,s)},this.setYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(r,s):Rte(r,s)},this.startOfBroadcastWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):sU(r,this)},this.startOfDay=r=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(r):Cu(r)},this.startOfISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(r):Tu(r)},this.startOfMonth=r=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(r):See(r)},this.startOfWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(r,this.options):kc(r,this.options)},this.startOfYear=r=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(r):J5(r)},this.options={locale:GS,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var n;const t=(n=this.options.locale)==null?void 0:n.code;return t&&Pa.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:s}=this.options,i=n==null?void 0:n.code;if(i&&Pa.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}Pa.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const es=new Pa;class iU{constructor(t,n,r=es){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class Mte{constructor(t,n){this.date=t,this.weeks=n}}class Lte{constructor(t,n){this.days=n,this.weekNumber=t}}function Ute(e){return ee.createElement("button",{...e})}function Pte(e){return ee.createElement("span",{...e})}function Fte(e){const{size:t=24,orientation:n="left",className:r}=e;return ee.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&ee.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ee.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ee.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ee.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Bte(e){const{day:t,modifiers:n,...r}=e;return ee.createElement("td",{...r})}function zte(e){const{day:t,modifiers:n,...r}=e,s=ee.useRef(null);return ee.useEffect(()=>{var i;n.focused&&((i=s.current)==null||i.focus())},[n.focused]),ee.createElement("button",{ref:s,...r})}var qe;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(qe||(qe={}));var Qt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Qt||(Qt={}));var gr;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(gr||(gr={}));var ja;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(ja||(ja={}));function $te(e){const{options:t,className:n,components:r,classNames:s,...i}=e,o=[s[qe.Dropdown],n].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return ee.createElement("span",{"data-disabled":i.disabled,className:s[qe.DropdownRoot]},ee.createElement(r.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:u,disabled:h})=>ee.createElement(r.Option,{key:c,value:c,disabled:h},u))),ee.createElement("span",{className:s[qe.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,ee.createElement(r.Chevron,{orientation:"down",size:18,className:s[qe.Chevron]})))}function Hte(e){return ee.createElement("div",{...e})}function qte(e){return ee.createElement("div",{...e})}function Gte(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r},e.children)}function Vte(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r})}function Yte(e){return ee.createElement("table",{...e})}function Wte(e){return ee.createElement("div",{...e})}const oU=p.createContext(void 0);function nh(){const e=p.useContext(oU);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Xte(e){const{components:t}=nh();return ee.createElement(t.Dropdown,{...e})}function Kte(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:u}}=nh(),h=p.useCallback(f=>{s&&(n==null||n(f))},[s,n]),d=p.useCallback(f=>{r&&(t==null||t(f))},[r,t]);return ee.createElement("nav",{...i},ee.createElement(o.PreviousMonthButton,{type:"button",className:l[qe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},ee.createElement(o.Chevron,{disabled:r?void 0:!0,className:l[qe.Chevron],orientation:"left"})),ee.createElement(o.NextMonthButton,{type:"button",className:l[qe.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":u(s),onClick:h},ee.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[qe.Chevron]})))}function Zte(e){const{components:t}=nh();return ee.createElement(t.Button,{...e})}function Qte(e){return ee.createElement("option",{...e})}function Jte(e){const{components:t}=nh();return ee.createElement(t.Button,{...e})}function ene(e){const{rootRef:t,...n}=e;return ee.createElement("div",{...n,ref:t})}function tne(e){return ee.createElement("select",{...e})}function nne(e){const{week:t,...n}=e;return ee.createElement("tr",{...n})}function ane(e){return ee.createElement("th",{...e})}function rne(e){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...e}))}function sne(e){const{week:t,...n}=e;return ee.createElement("th",{...n})}function ine(e){return ee.createElement("th",{...e})}function one(e){return ee.createElement("tbody",{...e})}function lne(e){const{components:t}=nh();return ee.createElement(t.Dropdown,{...e})}const cne=Object.freeze(Object.defineProperty({__proto__:null,Button:Ute,CaptionLabel:Pte,Chevron:Fte,Day:Bte,DayButton:zte,Dropdown:$te,DropdownNav:Hte,Footer:qte,Month:Gte,MonthCaption:Vte,MonthGrid:Yte,Months:Wte,MonthsDropdown:Xte,Nav:Kte,NextMonthButton:Zte,Option:Qte,PreviousMonthButton:Jte,Root:ene,Select:tne,Week:nne,WeekNumber:sne,WeekNumberHeader:ine,Weekday:ane,Weekdays:rne,Weeks:one,YearsDropdown:lne},Symbol.toStringTag,{value:"Module"}));function As(e,t,n=!1,r=es){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=r;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(n?1:0)&&o(i,t)>=(n?1:0)):!n&&i?l(i,t):!n&&s?l(s,t):!1}function lU(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function VS(e){return!!(e&&typeof e=="object"&&"from"in e)}function cU(e){return!!(e&&typeof e=="object"&&"after"in e)}function dU(e){return!!(e&&typeof e=="object"&&"before"in e)}function uU(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function hU(e,t){return Array.isArray(e)&&e.every(t.isDate)}function _s(e,t,n=es){const r=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(e,l);if(hU(l,n))return l.includes(e);if(VS(l))return As(l,e,!1,n);if(uU(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(lU(l)){const c=i(l.before,e),u=i(l.after,e),h=c>0,d=u<0;return o(l.before,l.after)?d&&h:h||d}return cU(l)?i(e,l.after)>0:dU(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function dne(e,t,n,r,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:u,today:h}=t,{isSameDay:d,isSameMonth:f,startOfMonth:m,isBefore:y,endOfMonth:b,isAfter:w}=s,x=n&&m(n),v=r&&b(r),g={[Qt.focused]:[],[Qt.outside]:[],[Qt.disabled]:[],[Qt.hidden]:[],[Qt.today]:[]},N={};for(const S of e){const{date:E,displayMonth:j}=S,R=!!(j&&!f(E,j)),L=!!(x&&y(E,x)),P=!!(v&&w(E,v)),U=!!(i&&_s(E,i,s)),F=!!(o&&_s(E,o,s))||L||P||!u&&!c&&R||u&&c===!1&&R,G=d(E,h??s.today());R&&g.outside.push(S),U&&g.disabled.push(S),F&&g.hidden.push(S),G&&g.today.push(S),l&&Object.keys(l).forEach(_=>{const I=l==null?void 0:l[_];I&&_s(E,I,s)&&(N[_]?N[_].push(S):N[_]=[S])})}return S=>{const E={[Qt.focused]:!1,[Qt.disabled]:!1,[Qt.hidden]:!1,[Qt.outside]:!1,[Qt.today]:!1},j={};for(const R in g){const L=g[R];E[R]=L.some(P=>P===S)}for(const R in N)j[R]=N[R].some(L=>L===S);return{...E,...j}}}function une(e,t,n={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):t[Qt[i]]?s.push(t[Qt[i]]):t[gr[i]]&&s.push(t[gr[i]]),s),[t[qe.Day]])}function hne(e){return{...cne,...e}}function fne(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function YS(){const e={};for(const t in qe)e[qe[t]]=`rdp-${qe[t]}`;for(const t in Qt)e[Qt[t]]=`rdp-${Qt[t]}`;for(const t in gr)e[gr[t]]=`rdp-${gr[t]}`;for(const t in ja)e[ja[t]]=`rdp-${ja[t]}`;return e}function fU(e,t,n){return(n??new Pa(t)).formatMonthYear(e)}const pne=fU;function mne(e,t,n){return(n??new Pa(t)).format(e,"d")}function gne(e,t=es){return t.format(e,"LLLL")}function xne(e,t,n){return(n??new Pa(t)).format(e,"cccccc")}function bne(e,t=es){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function vne(){return""}function pU(e,t=es){return t.format(e,"yyyy")}const yne=pU,wne=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:fU,formatDay:mne,formatMonthCaption:pne,formatMonthDropdown:gne,formatWeekNumber:bne,formatWeekNumberHeader:vne,formatWeekdayName:xne,formatYearCaption:yne,formatYearDropdown:pU},Symbol.toStringTag,{value:"Module"}));function Nne(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...wne,...e}}function Sne(e,t,n,r,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:u}=s;return c({start:o(e),end:l(e)}).map(f=>{const m=r.formatMonthDropdown(f,s),y=u(f),b=t&&f<i(t)||n&&f>i(n)||!1;return{value:y,label:m,disabled:b}})}function Ene(e,t={},n={}){let r={...t==null?void 0:t[qe.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n==null?void 0:n[s]}}),r}function jne(e,t,n){const r=e.today(),s=t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let o=0;o<7;o++){const l=e.addDays(s,o);i.push(l)}return i}function Tne(e,t,n,r,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=r,u=i(e),h=o(t),d=l({start:u,end:h});return s&&d.reverse(),d.map(f=>{const m=n.formatYearDropdown(f,r);return{value:c(f),label:m,disabled:!1}})}function mU(e,t,n,r){let s=(r??new Pa(n)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const Cne=mU;function gU(e,t,n){return(n??new Pa(t)).formatMonthYear(e)}const kne=gU;function Ane(e,t,n,r){let s=(r??new Pa(n)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function _ne(e){return"Choose the Month"}function Rne(){return""}function One(e){return"Go to the Next Month"}function Dne(e){return"Go to the Previous Month"}function Ine(e,t,n){return(n??new Pa(t)).format(e,"cccc")}function Mne(e,t){return`Week ${e}`}function Lne(e){return"Week Number"}function Une(e){return"Choose the Year"}const Pne=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:kne,labelDay:Cne,labelDayButton:mU,labelGrid:gU,labelGridcell:Ane,labelMonthDropdown:_ne,labelNav:Rne,labelNext:One,labelPrevious:Dne,labelWeekNumber:Mne,labelWeekNumberHeader:Lne,labelWeekday:Ine,labelYearDropdown:Une},Symbol.toStringTag,{value:"Module"})),ah=e=>e instanceof HTMLElement?e:null,ex=e=>[...e.querySelectorAll("[data-animated-month]")??[]],Fne=e=>ah(e.querySelector("[data-animated-month]")),tx=e=>ah(e.querySelector("[data-animated-caption]")),nx=e=>ah(e.querySelector("[data-animated-weeks]")),Bne=e=>ah(e.querySelector("[data-animated-nav]")),zne=e=>ah(e.querySelector("[data-animated-weekdays]"));function $ne(e,t,{classNames:n,months:r,focused:s,dateLib:i}){const o=p.useRef(null),l=p.useRef(r),c=p.useRef(!1);p.useLayoutEffect(()=>{const u=l.current;if(l.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const h=i.isSameMonth(r[0].date,u[0].date),d=i.isAfter(r[0].date,u[0].date),f=d?n[ja.caption_after_enter]:n[ja.caption_before_enter],m=d?n[ja.weeks_after_enter]:n[ja.weeks_before_enter],y=o.current,b=e.current.cloneNode(!0);if(b instanceof HTMLElement?(ex(b).forEach(g=>{if(!(g instanceof HTMLElement))return;const N=Fne(g);N&&g.contains(N)&&g.removeChild(N);const S=tx(g);S&&S.classList.remove(f);const E=nx(g);E&&E.classList.remove(m)}),o.current=b):o.current=null,c.current||h||s)return;const w=y instanceof HTMLElement?ex(y):[],x=ex(e.current);if(x!=null&&x.every(v=>v instanceof HTMLElement)&&w&&w.every(v=>v instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const v=Bne(e.current);v&&(v.style.zIndex="1"),x.forEach((g,N)=>{const S=w[N];if(!S)return;g.style.position="relative",g.style.overflow="hidden";const E=tx(g);E&&E.classList.add(f);const j=nx(g);j&&j.classList.add(m);const R=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),v&&(v.style.zIndex=""),E&&E.classList.remove(f),j&&j.classList.remove(m),g.style.position="",g.style.overflow="",g.contains(S)&&g.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const L=zne(S);L&&(L.style.opacity="0");const P=tx(S);P&&(P.classList.add(d?n[ja.caption_before_exit]:n[ja.caption_after_exit]),P.addEventListener("animationend",R));const U=nx(S);U&&U.classList.add(d?n[ja.weeks_before_exit]:n[ja.weeks_after_exit]),g.insertBefore(S,g.firstChild)})}})}function Hne(e,t,n,r){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:u,differenceInCalendarDays:h,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:m,endOfMonth:y,endOfWeek:b,isAfter:w,startOfBroadcastWeek:x,startOfISOWeek:v,startOfWeek:g}=r,N=c?x(s,r):o?v(s):g(s),S=c?f(i):o?m(y(i)):b(y(i)),E=h(S,N),j=d(i,s)+1,R=[];for(let U=0;U<=E;U++){const F=u(N,U);if(t&&w(F,t))break;R.push(F)}const P=(c?35:42)*j;if(l&&R.length<P){const U=P-R.length;for(let F=0;F<U;F++){const G=u(R[R.length-1],1);R.push(G)}}return R}function qne(e){const t=[];return e.reduce((n,r)=>{const s=r.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return n.concat(s.slice())},t.slice())}function Gne(e,t,n,r){const{numberOfMonths:s=1}=n,i=[];for(let o=0;o<s;o++){const l=r.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function jC(e,t,n,r){const{month:s,defaultMonth:i,today:o=r.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:u,addMonths:h,startOfMonth:d}=r;if(n&&u(n,c)<l-1){const f=-1*(l-1);c=h(n,f)}return t&&u(c,t)<0&&(c=t),d(c)}function Vne(e,t,n,r){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:u,getWeek:h,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:m}=r,y=e.reduce((b,w)=>{const x=n.broadcastCalendar?d(w,r):n.ISOWeek?f(w):m(w),v=n.broadcastCalendar?i(w):n.ISOWeek?o(l(w)):c(l(w)),g=t.filter(j=>j>=x&&j<=v),N=n.broadcastCalendar?35:42;if(n.fixedWeeks&&g.length<N){const j=t.filter(R=>{const L=N-g.length;return R>v&&R<=s(v,L)});g.push(...j)}const S=g.reduce((j,R)=>{const L=n.ISOWeek?u(R):h(R),P=j.find(F=>F.weekNumber===L),U=new iU(R,w,r);return P?P.days.push(U):j.push(new Lte(L,[U])),j},[]),E=new Mte(w,S);return b.push(E),b},[]);return n.reverseMonths?y.reverse():y}function Yne(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:u,newDate:h,today:d}=t,{fromYear:f,toYear:m,fromMonth:y,toMonth:b}=e;!n&&y&&(n=y),!n&&f&&(n=t.newDate(f,0,1)),!r&&b&&(r=b),!r&&m&&(r=h(m,11,31));const w=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=o(n):f?n=h(f,0,1):!n&&w&&(n=s(c(e.today??d(),-100))),r?r=l(r):m?r=h(m,11,31):!r&&w&&(r=u(e.today??d())),[n&&i(n),r&&i(r)]}function Wne(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=r,u=s?i:1,h=o(e);if(!t)return l(h,u);if(!(c(t,e)<i))return l(h,u)}function Xne(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=r,u=s?i??1:1,h=o(e);if(!t)return l(h,-u);if(!(c(h,t)<=0))return l(h,-u)}function Kne(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function Sm(e,t){const[n,r]=p.useState(e);return[t===void 0?n:t,r]}function Zne(e,t){const[n,r]=Yne(e,t),{startOfMonth:s,endOfMonth:i}=t,o=jC(e,n,r,t),[l,c]=Sm(o,e.month?o:void 0);p.useEffect(()=>{const E=jC(e,n,r,t);c(E)},[e.timeZone]);const u=Gne(l,r,e,t),h=Hne(u,e.endMonth?i(e.endMonth):void 0,e,t),d=Vne(u,h,e,t),f=Kne(d),m=qne(d),y=Xne(l,n,e,t),b=Wne(l,r,e,t),{disableNavigation:w,onMonthChange:x}=e,v=E=>f.some(j=>j.days.some(R=>R.isEqualTo(E))),g=E=>{if(w)return;let j=s(E);n&&j<s(n)&&(j=s(n)),r&&j>s(r)&&(j=s(r)),c(j),x==null||x(j)};return{months:d,weeks:f,days:m,navStart:n,navEnd:r,previousMonth:y,nextMonth:b,goToMonth:g,goToDay:E=>{v(E)||g(E.date)}}}var Ir;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ir||(Ir={}));function TC(e){return!e[Qt.disabled]&&!e[Qt.hidden]&&!e[Qt.outside]}function Qne(e,t,n,r){let s,i=-1;for(const o of e){const l=t(o);TC(l)&&(l[Qt.focused]&&i<Ir.FocusedModifier?(s=o,i=Ir.FocusedModifier):r!=null&&r.isEqualTo(o)&&i<Ir.LastFocused?(s=o,i=Ir.LastFocused):n(o.date)&&i<Ir.Selected?(s=o,i=Ir.Selected):l[Qt.today]&&i<Ir.Today&&(s=o,i=Ir.Today))}return s||(s=e.find(o=>TC(t(o)))),s}function Jne(e,t,n,r,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:u,addMonths:h,addWeeks:d,addYears:f,endOfBroadcastWeek:m,endOfISOWeek:y,endOfWeek:b,max:w,min:x,startOfBroadcastWeek:v,startOfISOWeek:g,startOfWeek:N}=o;let E={day:u,week:d,month:h,year:f,startOfWeek:j=>c?v(j,o):l?g(j):N(j),endOfWeek:j=>c?m(j):l?y(j):b(j)}[e](n,t==="after"?1:-1);return t==="before"&&r?E=w([r,E]):t==="after"&&s&&(E=x([s,E])),E}function xU(e,t,n,r,s,i,o,l=0){if(l>365)return;const c=Jne(e,t,n.date,r,s,i,o),u=!!(i.disabled&&_s(c,i.disabled,o)),h=!!(i.hidden&&_s(c,i.hidden,o)),d=c,f=new iU(c,d,o);return!u&&!h?f:xU(e,t,f,r,s,i,o,l+1)}function eae(e,t,n,r,s){const{autoFocus:i}=e,[o,l]=p.useState(),c=Qne(t.days,n,r||(()=>!1),o),[u,h]=p.useState(i?c:void 0);return{isFocusTarget:b=>!!(c!=null&&c.isEqualTo(b)),setFocused:h,focused:u,blur:()=>{l(u),h(void 0)},moveFocus:(b,w)=>{if(!u)return;const x=xU(b,w,u,t.navStart,t.navEnd,e,s);x&&(e.disableNavigation&&!t.days.some(g=>g.isEqualTo(x))||(t.goToDay(x),h(x)))}}}function tae(e,t){const{selected:n,required:r,onSelect:s}=e,[i,o]=Sm(n,s?n:void 0),l=s?n:i,{isSameDay:c}=t,u=m=>(l==null?void 0:l.some(y=>c(y,m)))??!1,{min:h,max:d}=e;return{selected:l,select:(m,y,b)=>{let w=[...l??[]];if(u(m)){if((l==null?void 0:l.length)===h||r&&(l==null?void 0:l.length)===1)return;w=l==null?void 0:l.filter(x=>!c(x,m))}else(l==null?void 0:l.length)===d?w=[m]:w=[...w,m];return s||o(w),s==null||s(w,m,y,b),w},isSelected:u}}function nae(e,t,n=0,r=0,s=!1,i=es){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:u,isBefore:h}=i;let d;if(!o&&!l)d={from:e,to:n>0?void 0:e};else if(o&&!l)c(o,e)?n===0?d={from:o,to:e}:s?d={from:o,to:void 0}:d=void 0:h(e,o)?d={from:e,to:o}:d={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?d={from:o,to:l}:d=void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(l,e))d={from:e,to:n>0?void 0:e};else if(h(e,o))d={from:e,to:l};else if(u(e,o))d={from:o,to:e};else if(u(e,l))d={from:o,to:e};else throw new Error("Invalid range");if(d!=null&&d.from&&(d!=null&&d.to)){const f=i.differenceInCalendarDays(d.to,d.from);r>0&&f>r?d={from:e,to:void 0}:n>1&&f<n&&(d={from:e,to:void 0})}return d}function aae(e,t,n=es){const r=Array.isArray(t)?t:[t];let s=e.from;const i=n.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function CC(e,t,n=es){return As(e,t.from,!1,n)||As(e,t.to,!1,n)||As(t,e.from,!1,n)||As(t,e.to,!1,n)}function rae(e,t,n=es){const r=Array.isArray(t)?t:[t];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?As(e,l,!1,n):hU(l,n)?l.some(c=>As(e,c,!1,n)):VS(l)?l.from&&l.to?CC(e,{from:l.from,to:l.to},n):!1:uU(l)?aae(e,l.dayOfWeek,n):lU(l)?n.isAfter(l.before,l.after)?CC(e,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):_s(e.from,l,n)||_s(e.to,l,n):cU(l)||dU(l)?_s(e.from,l,n)||_s(e.to,l,n):!1))return!0;const o=r.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=n.differenceInCalendarDays(e.to,e.from);for(let u=0;u<=c;u++){if(o.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function sae(e,t){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:o}=e,[l,c]=Sm(s,o?s:void 0),u=o?s:l;return{selected:u,select:(f,m,y)=>{const{min:b,max:w}=e,x=f?nae(f,u,b,w,i,t):void 0;return r&&n&&(x!=null&&x.from)&&x.to&&rae({from:x.from,to:x.to},n,t)&&(x.from=f,x.to=void 0),o||c(x),o==null||o(x,f,m,y),x},isSelected:f=>u&&As(u,f,!1,t)}}function iae(e,t){const{selected:n,required:r,onSelect:s}=e,[i,o]=Sm(n,s?n:void 0),l=s?n:i,{isSameDay:c}=t;return{selected:l,select:(d,f,m)=>{let y=d;return!r&&l&&l&&c(d,l)&&(y=void 0),s||o(y),s==null||s(y,d,f,m),y},isSelected:d=>l?c(l,d):!1}}function oae(e,t){const n=iae(e,t),r=tae(e,t),s=sae(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function lae(e){var $e;let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new Bn(t.today,t.timeZone)),t.month&&(t.month=new Bn(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new Bn(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new Bn(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new Bn(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new Bn(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=($e=t.selected)==null?void 0:$e.map(je=>new Bn(je,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new Bn(t.selected.from,t.timeZone):void 0,to:t.selected.to?new Bn(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:o,classNames:l}=p.useMemo(()=>{const je={...GS,...t.locale};return{dateLib:new Pa({locale:je,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:hne(t.components),formatters:Nne(t.formatters),labels:{...Pne,...t.labels},locale:je,classNames:{...YS(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:c,mode:u,navLayout:h,numberOfMonths:d=1,onDayBlur:f,onDayClick:m,onDayFocus:y,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:x,onNextClick:v,onPrevClick:g,showWeekNumber:N,styles:S}=t,{formatCaption:E,formatDay:j,formatMonthDropdown:R,formatWeekNumber:L,formatWeekNumberHeader:P,formatWeekdayName:U,formatYearDropdown:F}=r,G=Zne(t,i),{days:_,months:I,navStart:A,navEnd:C,previousMonth:T,nextMonth:O,goToMonth:q}=G,k=dne(_,t,A,C,i),{isSelected:M,select:$,selected:W}=oae(t,i)??{},{blur:Y,focused:te,isFocusTarget:ne,moveFocus:X,setFocused:se}=eae(t,G,k,M??(()=>!1),i),{labelDayButton:Ee,labelGridcell:re,labelGrid:xe,labelMonthDropdown:ye,labelNav:ze,labelPrevious:He,labelNext:Fe,labelWeekday:Ye,labelWeekNumber:ft,labelWeekNumberHeader:et,labelYearDropdown:de}=s,Be=p.useMemo(()=>jne(i,t.ISOWeek),[i,t.ISOWeek]),Ue=u!==void 0||m!==void 0,Oe=p.useCallback(()=>{T&&(q(T),g==null||g(T))},[T,q,g]),We=p.useCallback(()=>{O&&(q(O),v==null||v(O))},[q,O,v]),nt=p.useCallback((je,K)=>ue=>{ue.preventDefault(),ue.stopPropagation(),se(je),$==null||$(je.date,K,ue),m==null||m(je.date,K,ue)},[$,m,se]),lt=p.useCallback((je,K)=>ue=>{se(je),y==null||y(je.date,K,ue)},[y,se]),Ut=p.useCallback((je,K)=>ue=>{Y(),f==null||f(je.date,K,ue)},[Y,f]),Kt=p.useCallback((je,K)=>ue=>{const Ae={ArrowLeft:[ue.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[ue.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[ue.shiftKey?"year":"week","after"],ArrowUp:[ue.shiftKey?"year":"week","before"],PageUp:[ue.shiftKey?"year":"month","before"],PageDown:[ue.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ue.key]){ue.preventDefault(),ue.stopPropagation();const[Le,he]=Ae[ue.key];X(Le,he)}b==null||b(je.date,K,ue)},[X,b,t.dir]),Gt=p.useCallback((je,K)=>ue=>{w==null||w(je.date,K,ue)},[w]),_t=p.useCallback((je,K)=>ue=>{x==null||x(je.date,K,ue)},[x]),ce=p.useCallback(je=>K=>{const ue=Number(K.target.value),Ae=i.setMonth(i.startOfMonth(je),ue);q(Ae)},[i,q]),Te=p.useCallback(je=>K=>{const ue=Number(K.target.value),Ae=i.setYear(i.startOfMonth(je),ue);q(Ae)},[i,q]),{className:Ze,style:Q}=p.useMemo(()=>({className:[l[qe.Root],t.className].filter(Boolean).join(" "),style:{...S==null?void 0:S[qe.Root],...t.style}}),[l,t.className,t.style,S]),pe=fne(t),be=p.useRef(null);$ne(be,!!t.animate,{classNames:l,months:I,focused:te,dateLib:i});const _e={dayPickerProps:t,selected:W,select:$,isSelected:M,months:I,nextMonth:O,previousMonth:T,goToMonth:q,getModifiers:k,components:n,classNames:l,styles:S,labels:s,formatters:r};return ee.createElement(oU.Provider,{value:_e},ee.createElement(n.Root,{rootRef:t.animate?be:void 0,className:Ze,style:Q,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...pe},ee.createElement(n.Months,{className:l[qe.Months],style:S==null?void 0:S[qe.Months]},!t.hideNavigation&&!h&&ee.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[qe.Nav],style:S==null?void 0:S[qe.Nav],"aria-label":ze(),onPreviousClick:Oe,onNextClick:We,previousMonth:T,nextMonth:O}),I.map((je,K)=>ee.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:l[qe.Month],style:S==null?void 0:S[qe.Month],key:K,displayIndex:K,calendarMonth:je},h==="around"&&!t.hideNavigation&&K===0&&ee.createElement(n.PreviousMonthButton,{type:"button",className:l[qe.PreviousMonthButton],tabIndex:T?void 0:-1,"aria-disabled":T?void 0:!0,"aria-label":He(T),onClick:Oe,"data-animated-button":t.animate?"true":void 0},ee.createElement(n.Chevron,{disabled:T?void 0:!0,className:l[qe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),ee.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[qe.MonthCaption],style:S==null?void 0:S[qe.MonthCaption],calendarMonth:je,displayIndex:K},c!=null&&c.startsWith("dropdown")?ee.createElement(n.DropdownNav,{className:l[qe.Dropdowns],style:S==null?void 0:S[qe.Dropdowns]},(()=>{const ue=c==="dropdown"||c==="dropdown-months"?ee.createElement(n.MonthsDropdown,{key:"month",className:l[qe.MonthsDropdown],"aria-label":ye(),classNames:l,components:n,disabled:!!t.disableNavigation,onChange:ce(je.date),options:Sne(je.date,A,C,r,i),style:S==null?void 0:S[qe.Dropdown],value:i.getMonth(je.date)}):ee.createElement("span",{key:"month"},R(je.date,i)),Ae=c==="dropdown"||c==="dropdown-years"?ee.createElement(n.YearsDropdown,{key:"year",className:l[qe.YearsDropdown],"aria-label":de(i.options),classNames:l,components:n,disabled:!!t.disableNavigation,onChange:Te(je.date),options:Tne(A,C,r,i,!!t.reverseYears),style:S==null?void 0:S[qe.Dropdown],value:i.getYear(je.date)}):ee.createElement("span",{key:"year"},F(je.date,i));return i.getMonthYearOrder()==="year-first"?[Ae,ue]:[ue,Ae]})(),ee.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(je.date,i.options,i))):ee.createElement(n.CaptionLabel,{className:l[qe.CaptionLabel],role:"status","aria-live":"polite"},E(je.date,i.options,i))),h==="around"&&!t.hideNavigation&&K===d-1&&ee.createElement(n.NextMonthButton,{type:"button",className:l[qe.NextMonthButton],tabIndex:O?void 0:-1,"aria-disabled":O?void 0:!0,"aria-label":Fe(O),onClick:We,"data-animated-button":t.animate?"true":void 0},ee.createElement(n.Chevron,{disabled:O?void 0:!0,className:l[qe.Chevron],orientation:t.dir==="rtl"?"left":"right"})),K===d-1&&h==="after"&&!t.hideNavigation&&ee.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[qe.Nav],style:S==null?void 0:S[qe.Nav],"aria-label":ze(),onPreviousClick:Oe,onNextClick:We,previousMonth:T,nextMonth:O}),ee.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":xe(je.date,i.options,i)||void 0,className:l[qe.MonthGrid],style:S==null?void 0:S[qe.MonthGrid]},!t.hideWeekdays&&ee.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[qe.Weekdays],style:S==null?void 0:S[qe.Weekdays]},N&&ee.createElement(n.WeekNumberHeader,{"aria-label":et(i.options),className:l[qe.WeekNumberHeader],style:S==null?void 0:S[qe.WeekNumberHeader],scope:"col"},P()),Be.map(ue=>ee.createElement(n.Weekday,{"aria-label":Ye(ue,i.options,i),className:l[qe.Weekday],key:String(ue),style:S==null?void 0:S[qe.Weekday],scope:"col"},U(ue,i.options,i)))),ee.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[qe.Weeks],style:S==null?void 0:S[qe.Weeks]},je.weeks.map(ue=>ee.createElement(n.Week,{className:l[qe.Week],key:ue.weekNumber,style:S==null?void 0:S[qe.Week],week:ue},N&&ee.createElement(n.WeekNumber,{week:ue,style:S==null?void 0:S[qe.WeekNumber],"aria-label":ft(ue.weekNumber,{locale:o}),className:l[qe.WeekNumber],scope:"row",role:"rowheader"},L(ue.weekNumber,i)),ue.days.map(Ae=>{const{date:Le}=Ae,he=k(Ae);if(he[Qt.focused]=!he.hidden&&!!(te!=null&&te.isEqualTo(Ae)),he[gr.selected]=(M==null?void 0:M(Le))||he.selected,VS(W)){const{from:it,to:tt}=W;he[gr.range_start]=!!(it&&tt&&i.isSameDay(Le,it)),he[gr.range_end]=!!(it&&tt&&i.isSameDay(Le,tt)),he[gr.range_middle]=As(W,Le,!0,i)}const Z=Ene(he,S,t.modifiersStyles),oe=une(he,l,t.modifiersClassNames),De=!Ue&&!he.hidden?re(Le,he,i.options,i):void 0;return ee.createElement(n.Day,{key:`${i.format(Le,"yyyy-MM-dd")}_${i.format(Ae.displayMonth,"yyyy-MM")}`,day:Ae,modifiers:he,className:oe.join(" "),style:Z,role:"gridcell","aria-selected":he.selected||void 0,"aria-label":De,"data-day":i.format(Le,"yyyy-MM-dd"),"data-month":Ae.outside?i.format(Le,"yyyy-MM"):void 0,"data-selected":he.selected||void 0,"data-disabled":he.disabled||void 0,"data-hidden":he.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":he.focused||void 0,"data-today":he.today||void 0},!he.hidden&&Ue?ee.createElement(n.DayButton,{className:l[qe.DayButton],style:S==null?void 0:S[qe.DayButton],type:"button",day:Ae,modifiers:he,disabled:he.disabled||void 0,tabIndex:ne(Ae)?0:-1,"aria-label":Ee(Le,he,i.options,i),onClick:nt(Ae,he),onBlur:Ut(Ae,he),onFocus:lt(Ae,he),onKeyDown:Kt(Ae,he),onMouseEnter:Gt(Ae,he),onMouseLeave:_t(Ae,he)},j(Le,i.options,i)):!he.hidden&&j(Ae.date,i.options,i))})))))))),t.footer&&ee.createElement(n.Footer,{className:l[qe.Footer],style:S==null?void 0:S[qe.Footer],role:"status","aria-live":"polite"},t.footer)))}function Ga({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:o,...l}){const c=YS();return a.jsx(lae,{showOutsideDays:n,className:Ve("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:u=>u.toLocaleString("default",{month:"short"}),...i},classNames:{root:Ve("w-fit",c.root),months:Ve("relative flex flex-col gap-4 md:flex-row",c.months),month:Ve("flex w-full flex-col gap-4",c.month),nav:Ve("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:Ve(VN({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:Ve(VN({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:Ve("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:Ve("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:Ve("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:Ve("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:Ve("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:Ve("flex",c.weekdays),weekday:Ve("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:Ve("mt-2 flex w-full",c.week),week_number_header:Ve("w-[--cell-size] select-none",c.week_number_header),week_number:Ve("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:Ve("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:Ve("bg-accent rounded-l-md",c.range_start),range_middle:Ve("rounded-none",c.range_middle),range_end:Ve("bg-accent rounded-r-md",c.range_end),today:Ve("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:Ve("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:Ve("text-muted-foreground opacity-50",c.disabled),hidden:Ve("invisible",c.hidden),...t},components:{Root:({className:u,rootRef:h,...d})=>a.jsx("div",{"data-slot":"calendar",ref:h,className:Ve(u),...d}),Chevron:({className:u,orientation:h,...d})=>h==="left"?a.jsx(h3,{className:Ve("size-4",u),...d}):h==="right"?a.jsx(ES,{className:Ve("size-4",u),...d}):a.jsx(Zu,{className:Ve("size-4",u),...d}),DayButton:cae,WeekNumber:({children:u,...h})=>a.jsx("td",{...h,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:u})}),...o},...l})}function cae({className:e,day:t,modifiers:n,...r}){const s=YS(),i=p.useRef(null);return p.useEffect(()=>{var o;n.focused&&((o=i.current)==null||o.focus())},[n.focused]),a.jsx(z,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:Ve("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,e),...r})}var Em="Popover",[bU]=Vs(Em,[pm]),rh=pm(),[dae,no]=bU(Em),vU=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=rh(t),c=p.useRef(null),[u,h]=p.useState(!1),[d,f]=$c({prop:r,defaultProp:s??!1,onChange:i,caller:Em});return a.jsx(Y3,{...l,children:a.jsx(dae,{scope:t,contentId:tr(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>h(!0),[]),onCustomAnchorRemove:p.useCallback(()=>h(!1),[]),modal:o,children:n})})};vU.displayName=Em;var yU="PopoverAnchor",uae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(yU,n),i=rh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return p.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(LS,{...i,...r,ref:t})});uae.displayName=yU;var wU="PopoverTrigger",NU=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(wU,n),i=rh(n),o=dn(t,s.triggerRef),l=a.jsx(qt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":CU(s.open),...r,ref:o,onClick:Nt(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(LS,{asChild:!0,...i,children:l})});NU.displayName=wU;var WS="PopoverPortal",[hae,fae]=bU(WS,{forceMount:void 0}),SU=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=no(WS,t);return a.jsx(hae,{scope:t,forceMount:n,children:a.jsx(Ys,{present:n||i.open,children:a.jsx(US,{asChild:!0,container:s,children:r})})})};SU.displayName=WS;var Ac="PopoverContent",EU=p.forwardRef((e,t)=>{const n=fae(Ac,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=no(Ac,e.__scopePopover);return a.jsx(Ys,{present:r||i.open,children:i.modal?a.jsx(mae,{...s,ref:t}):a.jsx(gae,{...s,ref:t})})});EU.displayName=Ac;var pae=Nu("PopoverContent.RemoveScroll"),mae=p.forwardRef((e,t)=>{const n=no(Ac,e.__scopePopover),r=p.useRef(null),s=dn(t,r),i=p.useRef(!1);return p.useEffect(()=>{const o=r.current;if(o)return b5(o)},[]),a.jsx(BS,{as:pae,allowPinchZoom:!0,children:a.jsx(jU,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Nt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Nt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),gae=p.forwardRef((e,t)=>{const n=no(Ac,e.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return a.jsx(jU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),jU=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:h,...d}=e,f=no(Ac,n),m=rh(n);return c5(),a.jsx(FS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(cm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(W3,{"data-state":CU(f.open),role:"dialog",id:f.contentId,...m,...d,ref:t,style:{...d.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)"}})})})}),TU="PopoverClose",xae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(TU,n);return a.jsx(qt.button,{type:"button",...r,ref:t,onClick:Nt(e.onClick,()=>s.onOpenChange(!1))})});xae.displayName=TU;var bae="PopoverArrow",vae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rh(n);return a.jsx(X3,{...s,...r,ref:t})});vae.displayName=bae;function CU(e){return e?"open":"closed"}var yae=vU,wae=NU,Nae=SU,kU=EU;const Va=yae,Ya=wae,Ta=p.forwardRef(({className:e,align:t="start",sideOffset:n=4,...r},s)=>a.jsx(Nae,{children:a.jsx(kU,{ref:s,align:t,sideOffset:n,className:Ve("z-50 w-auto p-0 rounded-lg border border-white/20 bg-black text-white shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Ta.displayName=kU.displayName;const kC=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M20 3H2v14h8v2H8v2h8v-2h-2v-2h8V3h-2zm-6 12H4V5h16v10h-6z",fill:"currentColor"})}),qh=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M7 8H5v2h2v2h2v2h2v2h2v-2h2v-2h2v-2h2V8h-2v2h-2v2h-2v2h-2v-2H9v-2H7V8z",fill:"currentColor"})}),md=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})}),Cd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M18 6h2v2h-2V6zm-2 4V8h2v2h-2zm-2 2v-2h2v2h-2zm-2 2h2v-2h-2v2zm-2 2h2v-2h-2v2zm-2 0v2h2v-2H8zm-2-2h2v2H6v-2zm0 0H4v-2h2v2z",fill:"currentColor"})}),dr=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2h2v2h4v18H3V4h4V2h2v2h6V2zM9 6H5v2h14V6H9zm-4 4v10h14V10H5zm2 2h8v2H7v-2zm4 6v-2H7v2h4z",fill:"currentColor"})}),Sae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M2 2h14v4h6v16H2V2zm18 6h-4v2h2v2h-2v2h2v2h-2v2h2v2h2V8zm-6-4H4v16h2v-2h6v2h2V4zM6 6h2v2H6V6zm6 0h-2v2h2V6zm-6 4h2v2H6v-2zm6 0h-2v2h2v-2zm-6 4h2v2H6v-2zm6 0h-2v2h2v-2z",fill:"currentColor"})}),Eae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M20 11v2H8v2H6v-2H4v-2h2V9h2v2h12zM10 7H8v2h2V7zm0 0h2V5h-2v2zm0 10H8v-2h2v2zm0 0h2v2h-2v-2z",fill:"currentColor"})}),bi=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M4 11v2h12v2h2v-2h2v-2h-2V9h-2v2H4zm10-4h2v2h-2V7zm0 0h-2V5h2v2zm0 10h2v-2h-2v2zm0 0h-2v2h2v-2z",fill:"currentColor"})}),AU=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M3 3h18v18H3V3zm16 2H5v14h14V5zM7 12h2v5H7v-5zm10-5h-2v10h2V7zm-6 3h2v2h-2v-2zm2 4h-2v3h2v-3z",fill:"currentColor"})}),ys=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M22 4H2v16h20V4zM4 18V6h16v12H4zM8 8H6v2h2v2h2v2h4v-2h2v-2h2V8h-2v2h-2v2h-4v-2H8V8z",fill:"currentColor"})}),_U=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M6 2h8v2H6V2zM4 6V4h2v2H4zm0 8H2V6h2v8zm2 2H4v-2h2v2zm8 0v2H6v-2h8zm2-2h-2v2h2v2h2v2h2v2h2v-2h-2v-2h-2v-2h-2v-2zm0-8h2v8h-2V6zm0 0V4h-2v2h2z",fill:"currentColor"})}),gd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h12v2H6v4h12v-4h2v6H4v-6z",fill:"currentColor"})}),Ot=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M11 0H5v2H3v6h2v2h6V8H5V2h6V0zm0 2h2v6h-2V2zM0 14h2v4h12v2H0v-6zm2 0h12v-2H2v2zm14 0h-2v6h2v-6zM15 0h4v2h-4V0zm4 8h-4v2h4V8zm0-6h2v6h-2V2zm5 12h-2v4h-4v2h6v-6zm-6-2h4v2h-4v-2z",fill:"currentColor"})}),dt=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M5 5h2v2H5V5zm4 4H7V7h2v2zm2 2H9V9h2v2zm2 0h-2v2H9v2H7v2H5v2h2v-2h2v-2h2v-2h2v2h2v2h2v2h2v-2h-2v-2h-2v-2h-2v-2zm2-2v2h-2V9h2zm2-2v2h-2V7h2zm0 0V5h2v2h-2z",fill:"currentColor"})}),RU=({className:e="",size:t=24})=>a.jsx(_N,{size:t,className:Ve(e,"w-4 h-4")}),Rs=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M2 4h20v4H2V4zm18 2v2H4V6h16zm0 6H2v4h18v-4zm-2 2v2H4v-2h14zM2 16h20v4H2v-4zm18 2v2H4v-2h16z",fill:"currentColor"})}),jae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 4c2.21 0 4 1.79 4 4s-1.79 4-4 4-4-1.79-4-4 1.79-4 4-4zm0 6c1.38 0 2.5-1.12 2.5-2.5S13.38 11.5 12 11.5 9.5 12.62 9.5 14 10.62 16.5 12 16.5z",fill:"currentColor"})}),ax=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h8v2H6v4h8v-4h2v6H4v-6zm10-4h-2v2h2v-2z",fill:"currentColor"})}),Yd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h8v2H6v4h8v-4h2v6H4v-6zm12-6h-2v2h2v2h2v-2h-2v-2z",fill:"currentColor"})}),rx=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-1.57.46-3.03 1.24-4.26L16.26 18.76C15.03 19.54 13.57 20 12 20zm6.76-3.74L7.74 5.24C8.97 4.46 10.43 4 12 4c4.41 0 8 3.59 8 8 0 1.57-.46 3.03-1.24 4.26z",fill:"currentColor"})}),hn=e=>a.jsx(er,{...e,className:"w-4 h-4 animate-spin"}),Tae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M6 2h12v2H6V2zm0 2v16h12V4H6zm8 2H10v2h4V6zm-4 4h4v8h-4v-8z",fill:"currentColor"})}),Cae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M8 4h2v4h4V4h2v4h4v2h-4v4h4v2h-4v4h-2v-4H8v4H6v-4H2v-2h4V8H2V6h4V4zm2 6v4h4v-4h-4z",fill:"currentColor"})}),ka=({className:e="",size:t=24})=>a.jsx(Sae,{className:e,size:t}),AC=({className:e="",size:t=24})=>a.jsx(AU,{className:e,size:t}),va=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M4 2h12v2H4v12H2V2h2zm4 4h12v16H8V6zm2 2v12h8V8h-8z",fill:"currentColor"})}),OU=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2h2v2h-2V2zm-2 4H8v2H6v2h2v2h2v-2h2V8h-2V6zm6 0h-2v2h2V6zm2 0h2v2h-2V6zm-6 8h-2v-2h2v2zm-4 0H6v-2h2v2zm-4 0H2v-2h2v2zm8 4h-2v-2h2v2zm4 0h2v-2h-2v2zm-6 2h2v2h-2v-2zm4 0h2v2h-2v-2z",fill:"currentColor"})}),kae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2h2v2h-2V2zm-2 4h6v2h-2v6h-2V8H8V6zm-4 8h12v2H4v-2zm0 4h12v2H4v-2z",fill:"currentColor"})}),yf=({className:e="",size:t=24})=>a.jsx(nW,{className:Ve(e,"w-4 h-4"),size:t}),_C=({className:e="",size:t=24})=>a.jsx(m3,{className:Ve(e,"w-4 h-4"),size:t}),Ep=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-5l6-6-1.41-1.41L11 12.17l-2.59-2.58L7 10.59l4 4z",fill:"currentColor"})}),RC=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 1h2v8h8v4h-2v-2h-8V5h-2V1zM8 7V5h2v2H8zM6 9V7h2v2H6zm-2 2V9h2v2H4zm10 8v2h-2v2h-2v-8H2v-4h2v2h8v6h2zm2-2v2h-2v-2h2zm2-2v2h-2v-2h2zm0 0h2v-2h-2v2z",fill:"currentColor"})}),Bi=(e,t,n)=>{const r=document.createElement(e),[s,i]=Array.isArray(t)?[void 0,t]:[t,n];return s&&Object.assign(r,s),i==null||i.forEach(o=>r.appendChild(o)),r},Aae=(e,t)=>{var n;return t==="left"?e.offsetLeft:(((n=e.offsetParent instanceof HTMLElement?e.offsetParent:null)==null?void 0:n.offsetWidth)??0)-e.offsetWidth-e.offsetLeft},_ae=e=>e.offsetWidth>0&&e.offsetHeight>0,Rae=(e,t)=>{!customElements.get(e)&&customElements.define(e,t)};function Oae(e,t,{reverse:n=!1}={}){const r=e.length;for(let s=n?r-1:0;n?s>=0:s<r;n?s--:s++)t(e[s],s)}function Dae(e,t,n,r){const s=t.formatToParts(e);n&&s.unshift({type:"prefix",value:n}),r&&s.push({type:"suffix",value:r});const i=[],o=[],l=[],c=[],u={},h=b=>`${b}:${u[b]=(u[b]??-1)+1}`;let d="",f=!1,m=!1;for(const b of s){d+=b.value;const w=b.type==="minusSign"||b.type==="plusSign"?"sign":b.type;w==="integer"?(f=!0,o.push(...b.value.split("").map(x=>({type:w,value:parseInt(x)})))):w==="group"?o.push({type:w,value:b.value}):w==="decimal"?(m=!0,l.push({type:w,value:b.value,key:h(w)})):w==="fraction"?l.push(...b.value.split("").map(x=>({type:w,value:parseInt(x),key:h(w),pos:-1-u[w]}))):(f||m?c:i).push({type:w,value:b.value,key:h(w)})}const y=[];for(let b=o.length-1;b>=0;b--){const w=o[b];y.unshift(w.type==="integer"?{...w,key:h(w.type),pos:u[w.type]}:{...w,key:h(w.type)})}return{pre:i,integer:y,fraction:l,post:c,valueAsString:d,value:typeof e=="string"?parseFloat(e):e}}const Iae=String.raw,Mae=(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})(),Lae=typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)"),OC=typeof matchMedia<"u"?matchMedia("(prefers-reduced-motion: reduce)"):null,jp="--_number-flow-d-opacity",XS="--_number-flow-d-width",Tp="--_number-flow-dx",KS="--_number-flow-d",Uae=(()=>{try{return CSS.registerProperty({name:jp,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:Tp,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:XS,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:KS,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),Pae="var(--number-flow-char-height, 1em)",mi="var(--number-flow-mask-height, 0.25em)",DC=`calc(${mi} / 2)`,WN="var(--number-flow-mask-width, 0.5em)",uo=`calc(${WN} / var(--scale-x))`,Gh="#000 0, transparent 71%",IC=Iae`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:${Pae} !important}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${XS}) / var(--width));transform:translateX(var(${Tp})) scaleX(var(--scale-x));margin:0 calc(-1 * ${WN});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${uo},#000 calc(100% - ${uo}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${mi},#000 calc(100% - ${mi}),transparent 100% ),radial-gradient(at bottom right,${Gh}),radial-gradient(at bottom left,${Gh}),radial-gradient(at top left,${Gh}),radial-gradient(at top right,${Gh});-webkit-mask-size:100% calc(100% - ${mi} * 2),calc(100% - ${uo} * 2) 100%,${uo} ${mi},${uo} ${mi},${uo} ${mi},${uo} ${mi};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${DC} ${WN};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${Tp})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${KS})}.digit__num,.number .section::after{padding:${DC} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${jp}))}`,Fae=HTMLElement,Bae=Lae&&Mae&&Uae;let Vh;class DU extends Fae{constructor(){super(),this.created=!1,this.batched=!1;const{animated:t,...n}=this.constructor.defaultProps;this._animated=this.computedAnimated=t,Object.assign(this,n)}get animated(){return this._animated}set animated(t){var n;this.animated!==t&&(this._animated=t,(n=this.shadowRoot)==null||n.getAnimations().forEach(r=>r.finish()))}set data(t){var n;if(t==null)return;const{pre:r,integer:s,fraction:i,post:o,value:l}=t;if(this.created){const c=this._data;this._data=t,this.computedTrend=typeof this.trend=="function"?this.trend(c.value,l):this.trend,this.computedAnimated=Bae&&this._animated&&(!this.respectMotionPreference||!(OC!=null&&OC.matches))&&_ae(this),(n=this.plugins)==null||n.forEach(u=>{var h;return(h=u.onUpdate)==null?void 0:h.call(u,t,c,this)}),this.batched||this.willUpdate(),this._pre.update(r),this._num.update({integer:s,fraction:i}),this._post.update(o),this.batched||this.didUpdate()}else{this._data=t,this.attachShadow({mode:"open"});try{this._internals??(this._internals=this.attachInternals()),this._internals.role="img"}catch{}if(typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)Vh||(Vh=new CSSStyleSheet,Vh.replaceSync(IC)),this.shadowRoot.adoptedStyleSheets=[Vh];else{const c=document.createElement("style");c.textContent=IC,this.shadowRoot.appendChild(c)}this._pre=new LC(this,r,{justify:"right",part:"left"}),this.shadowRoot.appendChild(this._pre.el),this._num=new zae(this,s,i),this.shadowRoot.appendChild(this._num.el),this._post=new LC(this,o,{justify:"left",part:"right"}),this.shadowRoot.appendChild(this._post.el),this.created=!0}try{this._internals.ariaLabel=t.valueAsString}catch{}}willUpdate(){this._pre.willUpdate(),this._num.willUpdate(),this._post.willUpdate()}didUpdate(){if(!this.computedAnimated)return;this._abortAnimationsFinish?this._abortAnimationsFinish.abort():this.dispatchEvent(new Event("animationsstart")),this._pre.didUpdate(),this._num.didUpdate(),this._post.didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(n=>n.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),this._abortAnimationsFinish=void 0)}),this._abortAnimationsFinish=t}}DU.defaultProps={transformTiming:{duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"},spinTiming:void 0,opacityTiming:{duration:450,easing:"ease-out"},animated:!0,trend:(e,t)=>Math.sign(t-e),respectMotionPreference:!0,plugins:void 0,digits:void 0};class zae{constructor(t,n,r,{className:s,...i}={}){this.flow=t,this._integer=new MC(t,n,{justify:"right",part:"integer"}),this._fraction=new MC(t,r,{justify:"left",part:"fraction"}),this._inner=Bi("span",{className:"number__inner"},[this._integer.el,this._fraction.el]),this.el=Bi("span",{...i,part:"number",className:`number ${s??""}`},[this._inner])}willUpdate(){this._prevWidth=this.el.offsetWidth,this._prevLeft=this.el.getBoundingClientRect().left,this._integer.willUpdate(),this._fraction.willUpdate()}update({integer:t,fraction:n}){this._integer.update(t),this._fraction.update(n)}didUpdate(){const t=this.el.getBoundingClientRect();this._integer.didUpdate(),this._fraction.didUpdate();const n=this._prevLeft-t.left,r=this.el.offsetWidth,s=this._prevWidth-r;this.el.style.setProperty("--width",String(r)),this.el.animate({[Tp]:[`${n}px`,"0px"],[XS]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}class IU{constructor(t,n,{justify:r,className:s,...i},o){this.flow=t,this.children=new Map,this.onCharRemove=c=>()=>{this.children.delete(c)},this.justify=r;const l=n.map(c=>this.addChar(c).el);this.el=Bi("span",{...i,className:`section section--justify-${r} ${s??""}`},o?o(l):l)}addChar(t,{startDigitsAtZero:n=!1,...r}={}){const s=t.type==="integer"||t.type==="fraction"?new LU(this,t.type,n?0:t.value,t.pos,{...r,onRemove:this.onCharRemove(t.key)}):new $ae(this,t.type,t.value,{...r,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.removeAttribute("inert"),t.el.style.top="",t.el.style[this.justify]=""}pop(t){t.forEach(n=>{n.el.style.top=`${n.el.offsetTop}px`,n.el.style[this.justify]=`${Aae(n.el,this.justify)}px`}),t.forEach(n=>{n.el.setAttribute("inert",""),n.present=!1})}addNewAndUpdateExisting(t){const n=new Map,r=new Map,s=this.justify==="left",i=s?"prepend":"append";if(Oae(t,o=>{let l;this.children.has(o.key)?(l=this.children.get(o.key),r.set(o,l),this.unpop(l),l.present=!0):(l=this.addChar(o,{startDigitsAtZero:!0,animateIn:!0}),n.set(o,l)),this.el[i](l.el)},{reverse:s}),this.flow.computedAnimated){const o=this.el.getBoundingClientRect();n.forEach(l=>{l.willUpdate(o)})}n.forEach((o,l)=>{o.update(l.value)}),r.forEach((o,l)=>{o.update(l.value)})}willUpdate(){const t=this.el.getBoundingClientRect();this._prevOffset=t[this.justify],this.children.forEach(n=>n.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const n=t[this.justify],r=this._prevOffset-n;r&&this.children.size&&this.el.animate({transform:[`translateX(${r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}class MC extends IU{update(t){const n=new Map;this.children.forEach((r,s)=>{t.find(i=>i.key===s)||n.set(s,r),this.unpop(r)}),this.addNewAndUpdateExisting(t),n.forEach(r=>{r instanceof LU&&r.update(0)}),this.pop(n)}}class LC extends IU{update(t){const n=new Map;this.children.forEach((r,s)=>{t.find(i=>i.key===s)||n.set(s,r)}),this.pop(n),this.addNewAndUpdateExisting(t)}}class XN{constructor(t,n,{onRemove:r,animateIn:s=!1}={}){this.flow=t,this.el=n,this._present=!0,this._remove=()=>{var i;this.el.remove(),(i=this._onRemove)==null||i.call(this)},this.el.classList.add("animate-presence"),this.flow.computedAnimated&&s&&this.el.animate({[jp]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),this._onRemove=r}get present(){return this._present}set present(t){if(this._present!==t){if(this._present=t,t?this.el.removeAttribute("inert"):this.el.setAttribute("inert",""),!this.flow.computedAnimated){t||this._remove();return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[jp]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",this._remove):this.flow.addEventListener("animationsfinish",this._remove,{once:!0})}}}class MU extends XN{constructor(t,n,r,s){super(t.flow,r,s),this.section=t,this.value=n,this.el=r}}class LU extends MU{constructor(t,n,r,s,i){var o,l;const c=(((l=(o=t.flow.digits)==null?void 0:o[s])==null?void 0:l.max)??9)+1,u=Array.from({length:c}).map((d,f)=>{const m=Bi("span",{className:"digit__num"},[document.createTextNode(String(f))]);return f!==r&&m.setAttribute("inert",""),m.style.setProperty("--n",String(f)),m}),h=Bi("span",{part:`digit ${n}-digit`,className:"digit"},u);h.style.setProperty("--current",String(r)),h.style.setProperty("--length",String(c)),super(t,r,h,i),this.pos=s,this._onAnimationsFinish=()=>{this.el.classList.remove("is-spinning")},this._numbers=u,this.length=c}willUpdate(t){const n=this.el.getBoundingClientRect();this._prevValue=this.value;const r=n[this.section.justify]-t[this.section.justify],s=n.width/2;this._prevCenter=this.section.justify==="left"?r+s:r-s}update(t){this.el.style.setProperty("--current",String(t)),this._numbers.forEach((n,r)=>r===t?n.removeAttribute("inert"):n.setAttribute("inert","")),this.value=t}didUpdate(t){const n=this.el.getBoundingClientRect(),r=n[this.section.justify]-t[this.section.justify],s=n.width/2,i=this.section.justify==="left"?r+s:r-s,o=this._prevCenter-i;o&&this.el.animate({transform:[`translateX(${o}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const l=this.getDelta();l&&(this.el.classList.add("is-spinning"),this.el.animate({[KS]:[-l,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",this._onAnimationsFinish,{once:!0}))}getDelta(){var t;if(this.flow.plugins)for(const s of this.flow.plugins){const i=(t=s.getDelta)==null?void 0:t.call(s,this.value,this._prevValue,this);if(i!=null)return i}const n=this.value-this._prevValue,r=this.flow.computedTrend||Math.sign(n);return r<0&&this.value>this._prevValue?this.value-this.length-this._prevValue:r>0&&this.value<this._prevValue?this.length-this._prevValue+this.value:n}}class $ae extends MU{constructor(t,n,r,s){const i=Bi("span",{className:"symbol__value",textContent:r});super(t,r,Bi("span",{part:`symbol ${n}`,className:"symbol"},[i]),s),this.type=n,this._children=new Map,this._onChildRemove=o=>()=>{this._children.delete(o)},this._children.set(r,new XN(this.flow,i,{onRemove:this._onChildRemove(r)}))}willUpdate(t){if(this.type==="decimal")return;const n=this.el.getBoundingClientRect();this._prevOffset=n[this.section.justify]-t[this.section.justify]}update(t){if(this.value!==t){const n=this._children.get(this.value);n&&(n.present=!1);const r=this._children.get(t);if(r)r.present=!0;else{const s=Bi("span",{className:"symbol__value",textContent:t});this.el.appendChild(s),this._children.set(t,new XN(this.flow,s,{animateIn:!0,onRemove:this._onChildRemove(t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const n=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify],r=this._prevOffset-n;r&&this.el.animate({transform:[`translateX(${r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}var f4;const Hae=parseInt((f4=p.version.match(/^(\d+)\./))==null?void 0:f4[1]),ZS=Hae>=19,qae=["data","digits"];class QS extends DU{attributeChangedCallback(t,n,r){this[t]=JSON.parse(r)}}QS.observedAttributes=ZS?[]:qae;Rae("number-flow-react",QS);const sx={},UC=ZS?e=>e:JSON.stringify;function PC(e){const{transformTiming:t,spinTiming:n,opacityTiming:r,animated:s,respectMotionPreference:i,trend:o,plugins:l,...c}=e;return[{transformTiming:t,spinTiming:n,opacityTiming:r,animated:s,respectMotionPreference:i,trend:o,plugins:l},c]}class Gae extends p.Component{updateProperties(t){if(!this.el)return;this.el.batched=!this.props.isolate;const[n]=PC(this.props);Object.entries(n).forEach(([r,s])=>{this.el[r]=s??QS.defaultProps[r]}),t!=null&&t.onAnimationsStart&&this.el.removeEventListener("animationsstart",t.onAnimationsStart),this.props.onAnimationsStart&&this.el.addEventListener("animationsstart",this.props.onAnimationsStart),t!=null&&t.onAnimationsFinish&&this.el.removeEventListener("animationsfinish",t.onAnimationsFinish),this.props.onAnimationsFinish&&this.el.addEventListener("animationsfinish",this.props.onAnimationsFinish)}componentDidMount(){this.updateProperties(),ZS&&this.el&&(this.el.digits=this.props.digits,this.el.data=this.props.data)}getSnapshotBeforeUpdate(t){var n;if(this.updateProperties(t),t.data!==this.props.data){if(this.props.group)return this.props.group.willUpdate(),()=>{var r;return(r=this.props.group)==null?void 0:r.didUpdate()};if(!this.props.isolate)return(n=this.el)==null||n.willUpdate(),()=>{var r;return(r=this.el)==null?void 0:r.didUpdate()}}return null}componentDidUpdate(t,n,r){r==null||r()}handleRef(t){this.props.innerRef&&(this.props.innerRef.current=t),this.el=t}render(){const[t,{innerRef:n,className:r,data:s,willChange:i,isolate:o,group:l,digits:c,onAnimationsStart:u,onAnimationsFinish:h,...d}]=PC(this.props);return p.createElement("number-flow-react",{ref:this.handleRef,"data-will-change":i?"":void 0,class:r,...d,dangerouslySetInnerHTML:{__html:""},suppressHydrationWarning:!0,digits:UC(c),data:UC(s)})}constructor(t){super(t),this.handleRef=this.handleRef.bind(this)}}const Vae=p.forwardRef(function({value:t,locales:n,format:r,prefix:s,suffix:i,...o},l){p.useImperativeHandle(l,()=>c.current,[]);const c=p.useRef(),u=p.useContext(Yae);u==null||u.useRegister(c);const h=p.useMemo(()=>n?JSON.stringify(n):"",[n]),d=p.useMemo(()=>r?JSON.stringify(r):"",[r]),f=p.useMemo(()=>{var y;const m=sx[y=`${h}:${d}`]??(sx[y]=new Intl.NumberFormat(n,r));return Dae(t,m,s,i)},[t,h,d,s,i]);return p.createElement(Gae,{...o,group:u,data:f,innerRef:c})}),Yae=p.createContext(void 0),Wae={notation:"compact",maximumFractionDigits:1};function _n({value:e,loading:t=!1,className:n,prefix:r,suffix:s,format:i,trend:o,fallback:l="…"}){const c=p.useMemo(()=>{if(e==null)return 0;const d=Number(e);return Number.isFinite(d)?d:0},[e]);if(t)return a.jsxs("span",{className:mp("inline-flex items-baseline",n),children:[r,l,s]});const u=Vae,h=typeof o=="boolean"?o?1:0:o;return a.jsxs("span",{className:mp("inline-flex",n),children:[r,a.jsx(u,{value:c,format:i??Wae,trend:h,className:"inline-flex"}),s]})}function Jt({id:e,label:t="ID",className:n="",variant:r="inline",nonSliced:s=!1}){const[i,o]=p.useState(!1),l=async()=>{try{await navigator.clipboard.writeText(e),o(!0),V.success("Copied to clipboard"),setTimeout(()=>o(!1),2e3)}catch{V.error("Failed to copy to clipboard")}};return r==="detail"?a.jsxs("div",{className:`flex justify-between items-center ${n}`,children:[a.jsxs("span",{className:"text-gray-400",children:[t,":"]}),a.jsxs("button",{onClick:l,className:"flex items-center gap-2 text-white text-sm hover:text-white/80 transition-colors group",title:"Click to copy",children:[a.jsx("span",{className:"font-mono",children:e}),i?a.jsx(wu,{className:"w-3 h-3 text-green-500"}):a.jsx(Ec,{className:"w-3 h-3 text-gray-400 group-hover:text-white transition-colors"})]})]}):r==="subscript"?a.jsxs("sup",{onClick:l,className:`text-xs text-gray-500 ml-2 cursor-pointer hover:text-white transition-colors inline-flex items-center gap-1 ${n}`,title:"Click to copy User ID",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:s?e:e.slice(0,8)}),a.jsx("span",{className:"ml-1",children:"]"})]}):a.jsxs("button",{onClick:l,className:`flex items-center gap-1.5 text-sm text-gray-400 hover:text-white transition-colors group ${n}`,title:"Click to copy",children:[a.jsxs("span",{children:[t,":"]}),a.jsx("span",{className:"font-mono",children:e}),i?a.jsx(wu,{className:"w-3 h-3 text-green-500"}):a.jsx(Ec,{className:"w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ki({title:e="Seeding Terminal",lines:t,isRunning:n=!1,className:r="",defaultCollapsed:s=!1}){const[i,o]=p.useState(s),l=p.useRef(null);p.useEffect(()=>{const d=l.current;!d||i||d.scrollTo({top:d.scrollHeight,behavior:"smooth"})},[i]);const c=d=>{switch(d.type){case"success":return a.jsx(Sn,{className:"w-3 h-3 text-green-400"});case"error":return a.jsx(Ns,{className:"w-3 h-3 text-red-400"});case"progress":return d.status==="running"?a.jsx(er,{className:"w-3 h-3 text-blue-400 animate-spin"}):d.status==="completed"?a.jsx(Sn,{className:"w-3 h-3 text-green-400"}):d.status==="failed"?a.jsx(Ns,{className:"w-3 h-3 text-red-400"}):a.jsx("div",{className:"w-3 h-3 border border-gray-500 rounded-full"});default:return a.jsx("div",{className:"w-3 h-3 border border-gray-500 rounded-full"})}},u=d=>{switch(d.type){case"success":return"text-green-400";case"error":return"text-red-400";case"progress":return d.status==="running"?"text-blue-400":d.status==="completed"?"text-green-400":d.status==="failed"?"text-red-400":"text-gray-400";default:return"text-gray-300"}},h=d=>d.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+d.getMilliseconds().toString().padStart(3,"0");return a.jsxs("div",{className:`bg-black/90 border border-dashed border-white/20 rounded-none font-mono text-xs ${r}`,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-dashed border-white/10",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(tW,{className:"w-3 h-3 text-green-400"}),a.jsx("span",{className:"text-green-400 font-medium text-xs",children:e})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[n&&a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full animate-pulse"}),a.jsx("span",{className:"text-green-400 text-xs",children:"RUNNING"})]}),a.jsxs("div",{className:"text-gray-400 text-xs",children:[t.length," / ",t.length]}),a.jsx("button",{onClick:()=>o(!i),className:"text-gray-400 hover:text-white transition-colors",children:i?a.jsx(Zu,{className:"w-3 h-3"}):a.jsx(f3,{className:"w-3 h-3"})})]})]}),!i&&a.jsxs("div",{ref:l,className:"p-3 space-y-0.5 h-56 overflow-y-auto",children:[t.length===0?a.jsxs("div",{className:"text-gray-500 italic text-xs",children:[a.jsx("span",{className:"text-green-400",children:"$"})," Waiting for operations..."]}):t.map(d=>a.jsxs("div",{className:`flex items-start space-x-3 py-1 ${u(d)} text-xs`,children:[a.jsx("span",{className:"text-gray-500 text-xs w-20 flex-shrink-0",children:h(d.timestamp)}),a.jsx("span",{className:"text-green-400 flex-shrink-0",children:"$"}),a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:c(d)}),a.jsx("span",{className:"flex-1 min-w-0 break-words",children:d.message})]},d.id)),n&&a.jsxs("div",{className:"flex items-start space-x-3 py-1 text-green-400 text-xs",children:[a.jsx("span",{className:"text-gray-500 text-xs w-20 flex-shrink-0",children:h(new Date)}),a.jsx("span",{className:"text-green-400 flex-shrink-0",children:"$"}),a.jsx("div",{className:"w-3 h-3 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"flex-1 flex items-center",children:a.jsx("span",{className:"animate-pulse",children:"█"})})]})]}),!i&&a.jsx("div",{className:"px-3 py-1.5 border-t border-dashed border-white/10 bg-black/50",children:a.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("span",{children:["Status: ",n?"Active":"Idle"]}),a.jsxs("span",{children:["Lines: ",t.length]})]}),a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full"}),a.jsx("span",{children:"Better Auth Studio"})]})]})})]})}const UU=document.createElement("style");UU.textContent=`
512
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mQ="DialogDescriptionWarning",gQ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_5(mQ).contentName}}.`;return p.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},xQ=y5,bQ=S5,vQ=E5,yQ=j5,wQ=Symbol.for("react.lazy"),wp=_p[" use ".trim().toString()];function NQ(e){return typeof e=="object"&&e!==null&&"then"in e}function R5(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===wQ&&"_payload"in e&&NQ(e._payload)}function O5(e){const t=EQ(e),n=p.forwardRef((r,s)=>{let{children:i,...o}=r;R5(i)&&typeof wp=="function"&&(i=wp(i._payload));const l=p.Children.toArray(i),c=l.find(TQ);if(c){const u=c.props.children,h=l.map(d=>d===c?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:p.isValidElement(u)?p.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var SQ=O5("Slot");function EQ(e){const t=p.forwardRef((n,r)=>{let{children:s,...i}=n;if(R5(s)&&typeof wp=="function"&&(s=wp(s._payload)),p.isValidElement(s)){const o=kQ(s),l=CQ(i,s.props);return s.type!==p.Fragment&&(l.ref=r?Gi(r,o):o),p.cloneElement(s,l)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jQ=Symbol("radix.slottable");function TQ(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jQ}function CQ(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function kQ(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var AQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],to=AQ.reduce((e,t)=>{const n=O5(`Primitive.${t}`),r=p.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),cd='[cmdk-group=""]',Kg='[cmdk-group-items=""]',_Q='[cmdk-group-heading=""]',D5='[cmdk-item=""]',cC=`${D5}:not([aria-disabled="true"])`,HN="cmdk-item-select",Nl="data-value",RQ=(e,t,n)=>uZ(e,t,n),I5=p.createContext(void 0),eh=()=>p.useContext(I5),M5=p.createContext(void 0),qS=()=>p.useContext(M5),L5=p.createContext(void 0),U5=p.forwardRef((e,t)=>{let n=Sl(()=>{var M,$;return{search:"",value:($=(M=e.value)!=null?M:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Sl(()=>new Set),s=Sl(()=>new Map),i=Sl(()=>new Map),o=Sl(()=>new Set),l=P5(e),{label:c,children:u,value:h,onValueChange:d,filter:f,shouldFilter:m,loop:y,disablePointerSelection:b=!1,vimBindings:w=!0,...x}=e,v=tr(),g=tr(),N=tr(),S=p.useRef(null),E=$Q();Yo(()=>{if(h!==void 0){let M=h.trim();n.current.value=M,j.emit()}},[h]),Yo(()=>{E(6,G)},[]);let j=p.useMemo(()=>({subscribe:M=>(o.current.add(M),()=>o.current.delete(M)),snapshot:()=>n.current,setState:(M,$,W)=>{var Y,te,ne,X;if(!Object.is(n.current[M],$)){if(n.current[M]=$,M==="search")F(),P(),E(1,U);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(N);se?se.focus():(Y=document.getElementById(v))==null||Y.focus()}if(E(7,()=>{var se;n.current.selectedItemId=(se=_())==null?void 0:se.id,j.emit()}),W||E(5,G),((te=l.current)==null?void 0:te.value)!==void 0){let se=$??"";(X=(ne=l.current).onValueChange)==null||X.call(ne,se);return}}j.emit()}},emit:()=>{o.current.forEach(M=>M())}}),[]),R=p.useMemo(()=>({value:(M,$,W)=>{var Y;$!==((Y=i.current.get(M))==null?void 0:Y.value)&&(i.current.set(M,{value:$,keywords:W}),n.current.filtered.items.set(M,L($,W)),E(2,()=>{P(),j.emit()}))},item:(M,$)=>(r.current.add(M),$&&(s.current.has($)?s.current.get($).add(M):s.current.set($,new Set([M]))),E(3,()=>{F(),P(),n.current.value||U(),j.emit()}),()=>{i.current.delete(M),r.current.delete(M),n.current.filtered.items.delete(M);let W=_();E(4,()=>{F(),(W==null?void 0:W.getAttribute("id"))===M&&U(),j.emit()})}),group:M=>(s.current.has(M)||s.current.set(M,new Set),()=>{i.current.delete(M),s.current.delete(M)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:N,labelId:g,listInnerRef:S}),[]);function L(M,$){var W,Y;let te=(Y=(W=l.current)==null?void 0:W.filter)!=null?Y:RQ;return M?te(M,n.current.search,$):0}function P(){if(!n.current.search||l.current.shouldFilter===!1)return;let M=n.current.filtered.items,$=[];n.current.filtered.groups.forEach(Y=>{let te=s.current.get(Y),ne=0;te.forEach(X=>{let se=M.get(X);ne=Math.max(se,ne)}),$.push([Y,ne])});let W=S.current;I().sort((Y,te)=>{var ne,X;let se=Y.getAttribute("id"),Ee=te.getAttribute("id");return((ne=M.get(Ee))!=null?ne:0)-((X=M.get(se))!=null?X:0)}).forEach(Y=>{let te=Y.closest(Kg);te?te.appendChild(Y.parentElement===te?Y:Y.closest(`${Kg} > *`)):W.appendChild(Y.parentElement===W?Y:Y.closest(`${Kg} > *`))}),$.sort((Y,te)=>te[1]-Y[1]).forEach(Y=>{var te;let ne=(te=S.current)==null?void 0:te.querySelector(`${cd}[${Nl}="${encodeURIComponent(Y[0])}"]`);ne==null||ne.parentElement.appendChild(ne)})}function U(){let M=I().find(W=>W.getAttribute("aria-disabled")!=="true"),$=M==null?void 0:M.getAttribute(Nl);j.setState("value",$||void 0)}function F(){var M,$,W,Y;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let te=0;for(let ne of r.current){let X=($=(M=i.current.get(ne))==null?void 0:M.value)!=null?$:"",se=(Y=(W=i.current.get(ne))==null?void 0:W.keywords)!=null?Y:[],Ee=L(X,se);n.current.filtered.items.set(ne,Ee),Ee>0&&te++}for(let[ne,X]of s.current)for(let se of X)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(ne);break}n.current.filtered.count=te}function G(){var M,$,W;let Y=_();Y&&(((M=Y.parentElement)==null?void 0:M.firstChild)===Y&&((W=($=Y.closest(cd))==null?void 0:$.querySelector(_Q))==null||W.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function _(){var M;return(M=S.current)==null?void 0:M.querySelector(`${D5}[aria-selected="true"]`)}function I(){var M;return Array.from(((M=S.current)==null?void 0:M.querySelectorAll(cC))||[])}function A(M){let $=I()[M];$&&j.setState("value",$.getAttribute(Nl))}function C(M){var $;let W=_(),Y=I(),te=Y.findIndex(X=>X===W),ne=Y[te+M];($=l.current)!=null&&$.loop&&(ne=te+M<0?Y[Y.length-1]:te+M===Y.length?Y[0]:Y[te+M]),ne&&j.setState("value",ne.getAttribute(Nl))}function T(M){let $=_(),W=$==null?void 0:$.closest(cd),Y;for(;W&&!Y;)W=M>0?BQ(W,cd):zQ(W,cd),Y=W==null?void 0:W.querySelector(cC);Y?j.setState("value",Y.getAttribute(Nl)):C(M)}let O=()=>A(I().length-1),q=M=>{M.preventDefault(),M.metaKey?O():M.altKey?T(1):C(1)},k=M=>{M.preventDefault(),M.metaKey?A(0):M.altKey?T(-1):C(-1)};return p.createElement(to.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:M=>{var $;($=x.onKeyDown)==null||$.call(x,M);let W=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||W))switch(M.key){case"n":case"j":{w&&M.ctrlKey&&q(M);break}case"ArrowDown":{q(M);break}case"p":case"k":{w&&M.ctrlKey&&k(M);break}case"ArrowUp":{k(M);break}case"Home":{M.preventDefault(),A(0);break}case"End":{M.preventDefault(),O();break}case"Enter":{M.preventDefault();let Y=_();if(Y){let te=new Event(HN);Y.dispatchEvent(te)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:R.inputId,id:R.labelId,style:qQ},c),wm(e,M=>p.createElement(M5.Provider,{value:j},p.createElement(I5.Provider,{value:R},M))))}),OQ=p.forwardRef((e,t)=>{var n,r;let s=tr(),i=p.useRef(null),o=p.useContext(L5),l=eh(),c=P5(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Yo(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let h=F5(s,i,[e.value,e.children,i],e.keywords),d=qS(),f=Xi(E=>E.value&&E.value===h.current),m=Xi(E=>u||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);p.useEffect(()=>{let E=i.current;if(!(!E||e.disabled))return E.addEventListener(HN,y),()=>E.removeEventListener(HN,y)},[m,e.onSelect,e.disabled]);function y(){var E,j;b(),(j=(E=c.current).onSelect)==null||j.call(E,h.current)}function b(){d.setState("value",h.current,!0)}if(!m)return null;let{disabled:w,value:x,onSelect:v,forceMount:g,keywords:N,...S}=e;return p.createElement(to.div,{ref:Gi(i,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!f,"data-disabled":!!w,"data-selected":!!f,onPointerMove:w||l.getDisablePointerSelection()?void 0:b,onClick:w?void 0:y},e.children)}),DQ=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...i}=e,o=tr(),l=p.useRef(null),c=p.useRef(null),u=tr(),h=eh(),d=Xi(m=>s||h.filter()===!1?!0:m.search?m.filtered.groups.has(o):!0);Yo(()=>h.group(o),[]),F5(o,l,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:s}),[s]);return p.createElement(to.div,{ref:Gi(l,t),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&p.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),wm(e,m=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},p.createElement(L5.Provider,{value:f},m))))}),IQ=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=p.useRef(null),i=Xi(o=>!o.search);return!n&&!i?null:p.createElement(to.div,{ref:Gi(s,t),...r,"cmdk-separator":"",role:"separator"})}),MQ=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,i=qS(),o=Xi(u=>u.search),l=Xi(u=>u.selectedItemId),c=eh();return p.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),p.createElement(to.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),LQ=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,i=p.useRef(null),o=p.useRef(null),l=Xi(u=>u.selectedItemId),c=eh();return p.useEffect(()=>{if(o.current&&i.current){let u=o.current,h=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let m=u.offsetHeight;h.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(d),f.unobserve(u)}}},[]),p.createElement(to.div,{ref:Gi(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},wm(e,u=>p.createElement("div",{ref:Gi(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),UQ=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=e;return p.createElement(xQ,{open:n,onOpenChange:r},p.createElement(bQ,{container:o},p.createElement(vQ,{"cmdk-overlay":"",className:s}),p.createElement(yQ,{"aria-label":e.label,"cmdk-dialog":"",className:i},p.createElement(U5,{ref:t,...l}))))}),PQ=p.forwardRef((e,t)=>Xi(n=>n.filtered.count===0)?p.createElement(to.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),FQ=p.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...i}=e;return p.createElement(to.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},wm(e,o=>p.createElement("div",{"aria-hidden":!0},o)))}),dd=Object.assign(U5,{List:LQ,Item:OQ,Input:MQ,Group:DQ,Separator:IQ,Dialog:UQ,Empty:PQ,Loading:FQ});function BQ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function zQ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function P5(e){let t=p.useRef(e);return Yo(()=>{t.current=e}),t}var Yo=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Sl(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function Xi(e){let t=qS(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function F5(e,t,n,r=[]){let s=p.useRef(),i=eh();return Yo(()=>{var o;let l=(()=>{var u;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():s.current}})(),c=r.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Nl,l),s.current=l}),s}var $Q=()=>{let[e,t]=p.useState(),n=Sl(()=>new Map);return Yo(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function HQ(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function wm({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(HQ(t),{ref:t.ref},n(t.props.children)):n(t)}var qQ={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function GQ({isOpen:e,onClose:t}){const n=ha(),[r,s]=p.useState(""),[i,o]=p.useState(null);p.useEffect(()=>{(async()=>{try{const m=await(await fetch("/api/plugins")).json();o(m)}catch{}})()},[]);const l=d=>i!=null&&i.plugins?i.plugins.some(f=>f.id===d):!1,h=[{id:"users",title:"Users",description:"Manage users and their accounts",icon:Ho,action:()=>n("/users"),category:"Navigation",keywords:["user","account","profile"]},{id:"organizations",title:"Organizations",description:"Manage organizations and teams",icon:Mr,action:()=>n("/organizations"),category:"Navigation",keywords:["org","company","team"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"},{id:"sessions",title:"Sessions",description:"View active user sessions",icon:RT,action:()=>n("/sessions"),category:"Navigation",keywords:["session","login","active"]},{id:"tools",title:"Tools",description:"View tools and utilities",icon:g3,action:()=>n("/tools"),category:"Navigation",keywords:["utilities","tools"]},{id:"database",title:"Database",description:"View database and schema",icon:nn,disabled:!0,action:()=>n("/database"),category:"Navigation",keywords:["database","schema"]},{id:"settings",title:"Settings",description:"Configure Better Auth Studio",icon:Do,action:()=>n("/settings"),category:"Navigation",keywords:["config","setup","preferences"]},{id:"dashboard",title:"Dashboard",description:"View overview and statistics",icon:RT,action:()=>n("/"),category:"Navigation",keywords:["overview","stats","home"]},{id:"create-user",title:"Create User",description:"Add a new user to the system",icon:ON,action:()=>n("/users"),category:"Actions",keywords:["add","new","register"]},{id:"create-organization",title:"Create Organization",description:"Create a new organization",icon:Fi,action:()=>n("/organizations"),category:"Actions",keywords:["add","new","org"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"},{id:"invite-user",title:"Invite User",description:"Send invitation to join organization",icon:jc,action:()=>n("/organizations"),category:"Actions",keywords:["invite","email","send"],requiresPlugin:"organization",disabled:!l("organization"),disabledMessage:"Enable organization plugin in settings"}].filter(d=>{var m;const f=r.toLowerCase();return d.title.toLowerCase().includes(f)||d.description.toLowerCase().includes(f)||((m=d.keywords)==null?void 0:m.some(y=>y.toLowerCase().includes(f)))}).reduce((d,f)=>(d[f.category]||(d[f.category]=[]),d[f.category].push(f),d),{});return p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key==="k"&&f.preventDefault()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),p.useEffect(()=>{const d=f=>{f.key==="Escape"&&t()};if(e)return document.body.style.overflow="hidden",document.addEventListener("keydown",d),()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",d)}},[e,t]),e?a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-start justify-center pt-[20vh] z-50 overflow-hidden",onClick:t,children:a.jsx("div",{className:"bg-black/90 overflow-hidden border border-white/10 rounded-none w-full max-w-2xl mx-4",onClick:d=>d.stopPropagation(),children:a.jsxs(dd,{className:"p-2",children:[a.jsxs("div",{className:"flex items-center border-b border-dashed border-white/10 px-3 pb-3",children:[a.jsx($o,{className:"w-4 h-4 text-gray-400 mr-3"}),a.jsx(dd.Input,{value:r,onValueChange:s,placeholder:"Search for actions, pages, or commands...",className:"flex-1 placeholder:text-xs bg-transparent text-white placeholder-gray-400 outline-none",autoFocus:!0}),a.jsx("kbd",{className:"hidden sm:inline-flex items-center px-2 py-1 text-xs text-gray-400 border border-dashed border-white/20 rounded-sm",children:"ESC"})]}),a.jsx(dd.List,{className:"max-h-96 overflow-y-auto p-2",children:Object.keys(h).length===0?a.jsxs("div",{className:"text-center py-8 text-gray-400",children:[a.jsx($o,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),a.jsx("p",{children:"No results found"}),a.jsx("p",{className:"text-sm",children:"Try a different search term"})]}):Object.entries(h).map(([d,f])=>a.jsx(dd.Group,{heading:d,className:"text-xs text-gray-400 font-medium mb-4 px-2",children:f.map(m=>{const y=m.icon,b=m.disabled;return a.jsxs(dd.Item,{value:m.id,disabled:b,onSelect:()=>{b||(m.action(),t())},className:`flex items-center space-x-3 px-0 py-2 rounded-none transition-colors relative ${b?"opacity-40 cursor-not-allowed blur-[0.5px]":"hover:bg-white/5 cursor-pointer"}`,children:[a.jsx(y,{className:"w-4 h-4 text-white"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"text-white text-[13px] font-light flex items-center gap-2",children:[m.title,b&&a.jsx(Jl,{className:"w-3 h-3 text-yellow-500"})]}),a.jsx("div",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:b?m.disabledMessage:m.description})]}),!b&&a.jsx(PY,{className:"w-4 h-4 text-gray-400"})]},m.id)})},d))}),a.jsx("div",{className:"border-t border-dashed border-white/10 px-3 py-2 text-xs text-gray-400",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{children:["Press"," ",a.jsx("kbd",{className:"px-1 py-0.5 border border-dashed border-white/20 rounded-sm",children:"↑↓"})," ","to navigate"]}),a.jsxs("span",{children:["Press"," ",a.jsx("kbd",{className:"px-1 py-0.5 border border-dashed border-white/20 rounded-sm",children:"Enter"})," ","to select"]})]})})]})})}):null}function qN(){return window.__STUDIO_CONFIG__||{}}function VQ(){return!!qN().basePath}const YQ={connecting:{label:"Connecting",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"},watching:{label:"Watching",textClass:"text-emerald-200 border-emerald-400/40",dotClass:"bg-emerald-300"},refreshing:{label:"Refreshing",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"},up_to_date:{label:"Up-to-date",textClass:"text-emerald-200 border-emerald-400/40",dotClass:"bg-emerald-300"},error:{label:"Reload Failed",textClass:"text-red-200 border-red-500/50",dotClass:"bg-red-400",animate:"animate-pulse"},unavailable:{label:"Watch Off",textClass:"text-gray-300 border-gray-500/40",dotClass:"bg-gray-400"},reconnecting:{label:"Reconnecting",textClass:"text-amber-200 border-amber-400/40",dotClass:"bg-amber-300",animate:"animate-pulse"}};function WQ(e){switch(e){case"refreshing":return"refreshing";case"error":return"error";case"up_to_date":case"watching":return"up_to_date";default:return"watching"}}const XQ=6,KQ=14;function ZQ({children:e}){const t=eo(),{counts:n,loading:r}=bm(),s=ha(),[i,o]=p.useState(!1),[l,c]=p.useState("v1.0.0"),[u,h]=p.useState({status:"connecting"}),[d,f]=p.useState(null),m=p.useRef(!1),y=p.useRef(null),b=p.useRef(!1),[w,x]=p.useState(null),[v,g]=p.useState(!1),[N,S]=p.useState(!1),E=p.useRef(null);p.useEffect(()=>{S(VQ())},[]);const j=()=>{y.current&&(clearTimeout(y.current),y.current=null)},R=()=>{j(),y.current=setTimeout(()=>{m.current=!1,h(I=>({...I,status:"up_to_date",updatedAt:Date.now()}))},4e3)};p.useEffect(()=>{const I=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),o(!0))};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[]),p.useEffect(()=>{if(!N)return;(async()=>{try{const A=qN().basePath||"",T=await(await fetch(`${A}/auth/session`,{credentials:"include"})).json();T.authenticated&&T.user&&x(T.user)}catch{x(null)}})()},[N]),p.useEffect(()=>{const I=A=>{E.current&&!E.current.contains(A.target)&&g(!1)};return v&&document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[v]);const L=async()=>{try{const I=qN().basePath||"";await fetch(`${I}/auth/logout`,{method:"GET",credentials:"include"}),s("/login")}catch{s("/login")}},P=(I,A)=>I?I.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2):A?A[0].toUpperCase():"?";p.useEffect(()=>{const I=async()=>{var C;try{const O=await(await fetch("/api/config")).json();(C=O.studio)!=null&&C.version&&c(`v${O.studio.version}`)}catch{}},A=async()=>{try{const T=await(await fetch("/api/database/schema")).json();T.success&&T.schema&&T.schema.tables&&f(T.schema.tables.length)}catch{f(null)}};return I(),A(),()=>{j()}},[]);const U=()=>{m.current=!1,b.current=!1,j(),h(I=>({...I,status:"refreshing",updatedAt:Date.now()})),window.location.reload()};i5(I=>{if(I.type==="studio_status"){const A=WQ(I.status);A==="up_to_date"&&(m.current=!1,j()),h(C=>({status:A,fileName:I.fileName||C.fileName,updatedAt:I.updatedAt||Date.now()}));return}if(I.type==="config_change_detected"){m.current=!0,R(),h(A=>({...A,status:"refreshing",fileName:I.fileName||A.fileName,updatedAt:Date.now()})),b.current||(b.current=!0,setTimeout(()=>{U()},200));return}if(I.type==="config_changed"){m.current=!1,j(),h(A=>({...A,status:"up_to_date",fileName:I.fileName||A.fileName,updatedAt:I.changedAt||Date.now()}));return}I.type==="connected"&&(m.current=!1,j(),h(A=>({...A,status:"up_to_date",updatedAt:Date.now()})))},{onStatusChange:I=>{h(A=>{if(A.status==="refreshing"&&I!=="unavailable"&&I!=="open")return A;switch(I){case"connecting":return{...A,status:"connecting"};case"open":return j(),m.current?A:{...A,status:"watching",updatedAt:Date.now()};case"reconnecting":case"closed":return{...A,status:"reconnecting"};case"error":return{...A,status:"error"};case"unavailable":return m.current=!1,j(),{...A,status:"unavailable"};default:return A}})}});const F=YQ[u.status],G=I=>I>=1e3?`${(I/1e3).toFixed(1).replace(/\.0$/,"")}k`:I.toString(),_=[{name:"Dashboard",href:"/",icon:YY},{name:"Users",href:"/users",icon:Ho,badge:r?"...":G(n.users)},{name:"Organizations",href:"/organizations",icon:Mr,badge:r?"...":G(n.organizations)},{name:"Database",href:"/database",icon:nn,badge:d!==null?G(d):void 0},{name:"Emails",href:"/emails",icon:jc,badge:G(XQ)},{name:"Tools",href:"/tools",icon:g3,badge:G(KQ)},{name:"Settings",href:"/settings",icon:Do}];return a.jsxs("div",{className:"min-h-screen bg-black",children:[a.jsx("div",{className:"bg-black/70 border-b border-white/15",children:a.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx("img",{src:UW("/logo.png"),alt:"Logo",className:"w-10 h-10 object-contain"}),a.jsx("div",{className:"mb-0 cursor-pointer",onClick:()=>s("/"),children:a.jsxs("h1",{className:"text-md inline-flex mb-0 items-start font-light font-mono uppercase text-white gap-2",children:["Better-Auth Studio",a.jsxs("sup",{className:"text-xs text-gray-400 ml-1 mt-0 flex items-center space-x-2",children:[a.jsxs("span",{className:"inline-flex items-center",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 lowercase font-mono text-xs",children:l}),a.jsx("span",{className:"ml-1",children:"]"})]}),a.jsxs("span",{className:"inline-flex items-center",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:"PUBLIC BETA"}),a.jsx("span",{className:"ml-1",children:"]"})]}),a.jsxs("span",{className:`inline-flex items-center rounded border px-1.5 py-0.5 font-normal uppercase tracking-wide text-[9px] ${F.textClass} ${F.animate??""}`,children:[a.jsx("span",{className:`mr-1 h-1.5 w-1.5 rounded-full ${F.dotClass}`}),F.label]}),a.jsx("button",{type:"button",onClick:U,"aria-label":"Hard refresh studio",className:"ml-1 inline-flex items-center rounded border border-dashed border-white/20 p-0.5 text-white/70 transition hover:text-white hover:border-white/50",children:a.jsx(RN,{className:"h-3.5 w-3.5"})})]})]})})]})}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("a",{href:"https://better-auth-studio.vercel.app/docs",target:"_blank",rel:"noopener",className:"group flex items-center",children:[a.jsx("span",{className:"text-white/70 text-xs mr-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-sm uppercase",children:"Docs"}),a.jsx("span",{className:"text-white/70 text-xs ml-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"]"})]}),a.jsxs("a",{href:"https://better-auth.com/docs",target:"_blank",rel:"noopener",className:"group flex items-center",children:[a.jsx("span",{className:"text-white/70 text-xs mr-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-sm uppercase",children:"Support"}),a.jsx("span",{className:"text-white/70 text-xs ml-2 transition-colors duration-150 group-hover:text-white group-hover:bg-gray-500/20 rounded px-0.5",children:"]"})]}),a.jsxs("div",{className:"relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx("input",{type:"text",placeholder:"Search...",onClick:()=>o(!0),className:"pl-10 pr-4 py-2 bg-black border rounded-none border-gray-600 text-white border-dashed border-white/20 focus:ring-2 focus:ring-white focus:border-transparent transition-colors placeholder-gray-400 cursor-pointer",readOnly:!0}),a.jsx("kbd",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-xs text-gray-400 border border-dashed border-white/10 rounded-sm px-1.5 py-0.5",children:"⌘ K"})]}),N&&w&&a.jsxs("div",{className:"relative h-full",ref:E,children:[a.jsx("button",{type:"button",onClick:()=>g(!v),className:"w-10 h-10 border border-dashed border-white/30 bg-black flex items-center justify-center hover:border-white/50 transition-colors overflow-hidden",children:w.image?a.jsx("img",{src:w.image,alt:w.name||w.email,className:"w-full h-full object-cover"}):a.jsx("span",{className:"text-white text-xs font-mono uppercase",children:P(w.name,w.email)})}),v&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-64 border border-dashed border-white/20 bg-black z-50",children:[a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 border border-dashed border-white/30 bg-black flex items-center justify-center flex-shrink-0 overflow-hidden",children:w.image?a.jsx("img",{src:w.image,alt:w.name||w.email,className:"w-full h-full object-cover"}):a.jsx(pp,{className:"w-5 h-5 text-white/50"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-white text-[11px] font-mono uppercase truncate",children:[w.name||"User",w.role&&a.jsx("span",{className:"inline-flex ml-2 mt-1 text-[9px] tracking-wider font-mono uppercase text-white/60 border border-dashed border-white/20 px-1.5 py-0.5",children:w.role})]}),a.jsx("p",{className:"text-white/40 text-xs font-mono truncate",children:w.email})]})]})}),a.jsxs("div",{className:"flex flex-col items-center justify-center",children:[a.jsx("hr",{className:"w-full border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-5 w-full bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[5%]"}),a.jsx("hr",{className:"w-full border-white/10 h-px"})]}),a.jsxs("div",{className:"",children:[a.jsxs(tp,{to:"/settings",onClick:()=>g(!1),className:"flex items-center gap-3 px-3 py-3 text-white/70 hover:text-white hover:bg-white/5 transition-colors",children:[a.jsx(Do,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-mono uppercase",children:"Settings"})]}),a.jsxs("button",{type:"button",onClick:L,className:"w-full flex items-center gap-3 px-3 py-3 text-red-400/70 hover:text-red-400 hover:bg-red-500/5 transition-colors",children:[a.jsx(XY,{className:"w-4 h-4"}),a.jsx("span",{className:"text-xs font-mono uppercase",children:"Logout"})]})]})]})]})]})]})}),a.jsx("div",{className:"bg-black/50 border-b border-white/15",children:a.jsx("div",{className:"px-6",children:a.jsx("nav",{className:"flex overflow-y-hidden overflow-x-auto",children:_.map((I,A)=>{const C=t.pathname===I.href;return a.jsxs("div",{className:"flex items-center",children:[A===0&&a.jsx("div",{className:"h-[50px] -my-5 w-px bg-transparent border-dashed border-r border-white/20"}),a.jsxs(tp,{to:I.href,className:`flex items-center space-x-2 border-x-0 px-8 py-4 text-sm font-medium border-b-2 transition-all duration-200 relative ${C?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-gray-500/50"}`,children:[a.jsx(I.icon,{className:"w-4 h-4"}),a.jsxs("span",{className:"inline-flex font-mono uppercase border-x-0 font-light text-xs items-start",children:[I.name,I.badge&&a.jsxs("sup",{className:"text-xs text-gray-500 ml-1",children:[a.jsx("span",{className:"mr-0.5",children:"["}),a.jsx("span",{className:"text-white/80 lowercase font-mono text-xs",children:I.badge}),a.jsx("span",{className:"ml-0.5",children:"]"})]})]})]}),A<=_.length-1&&a.jsx("div",{className:"h-[50px] -my-5 w-px bg-transparent border-dashed border-r border-white/20"})]},I.name)})})})}),a.jsx("div",{className:"flex-1 p-0",children:e}),a.jsx(GQ,{isOpen:i,onClose:()=>o(!1)})]})}function QQ(){const e=ha(),t=async()=>{var n;try{const r=((n=window.__STUDIO_CONFIG__)==null?void 0:n.basePath)||"",s=r?`${r}/auth`:"/api/auth";await fetch(`${s}/logout`,{credentials:"include"}),e("/login")}catch{e("/login")}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-[3%]",children:a.jsx("div",{className:"absolute inset-0 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_8px)]"})}),a.jsx("div",{className:"w-full max-w-md relative z-10",children:a.jsxs("div",{className:"border border-dashed border-white/20 bg-black p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-6 h-6 border border-dashed border-red-500/40 flex items-center justify-center",children:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",className:"text-red-400",children:a.jsx("path",{d:"M4 4h2v2H4V4zm14 0h2v2h-2V4zM6 6h2v2H6V6zm10 0h2v2h-2V6zM8 8h2v2H8V8zm6 0h2v2h-2V8zm-4 4h4v2h-4v-2zm-2 4h2v2H8v-2zm6 0h2v2h-2v-2zm-4 2h4v2h-4v-2z",fill:"currentColor"})})}),a.jsx("span",{className:"text-white/60 text-xs font-mono uppercase tracking-wider",children:"access denied"})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-white text-lg font-mono uppercase tracking-wide mb-2",children:"Permission Denied"}),a.jsx("p",{className:"text-white/40 text-xs font-mono leading-relaxed",children:"Your account does not have the required role to access Better Auth Studio."})]}),a.jsx("div",{className:"p-3 border border-dashed border-white/10 bg-white/[2%] mb-6",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-white/40 flex-shrink-0 mt-0.5",children:a.jsx("path",{d:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z",fill:"currentColor"})}),a.jsxs("p",{className:"text-white/40 text-[11px] font-mono",children:["Required role: ",a.jsx("span",{className:"text-white/60",children:"admin"})]})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("button",{onClick:t,className:"w-full h-10 bg-white text-black text-xs font-mono uppercase tracking-wider hover:bg-white/90 transition-colors flex items-center justify-center gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-black",children:a.jsx("path",{d:"M5 3h14v2H5V3zm0 16h14v2H5v-2zm0-8h8v2H5v-2zm10 0h2v2h-2v-2zm2 2h2v2h-2v-2zm0-4h2v2h-2V9zm-2 6h2v2h-2v-2z",fill:"currentColor"})}),"Sign Out"]}),a.jsxs("button",{onClick:()=>window.history.back(),className:"w-full h-10 border border-dashed border-white/20 text-white text-xs font-mono uppercase tracking-wider hover:bg-white/5 hover:border-white/30 transition-colors flex items-center justify-center gap-2",children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-white",children:a.jsx("path",{d:"M12 4h2v2h-2V4zm-2 2h2v2h-2V6zm-2 2h2v2H8V8zm-2 2h2v4H6v-4zm14 0h2v4h-2v-4zm-2 4h2v2h-2v-2zm-2 2h2v2h-2v-2zm-2 2h2v2h-2v-2z",fill:"currentColor"})}),"Go Back"]})]}),a.jsx("div",{className:"mt-6 pt-4 border-t border-dashed border-white/10",children:a.jsx("p",{className:"text-white/20 text-[10px] font-mono text-center",children:"Contact your administrator for access"})})]})})]})}function Wo(e){"@babel/helpers - typeof";return Wo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wo(e)}function Xo(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Zn(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Jr(e){Zn(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Wo(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function JQ(e,t){Zn(2,arguments);var n=Jr(e).getTime(),r=Xo(t);return new Date(n+r)}var eJ={};function Nm(){return eJ}function tJ(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function nJ(e){return Zn(1,arguments),e instanceof Date||Wo(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function aJ(e){if(Zn(1,arguments),!nJ(e)&&typeof e!="number")return!1;var t=Jr(e);return!isNaN(Number(t))}function rJ(e,t){Zn(2,arguments);var n=Xo(t);return JQ(e,-n)}var sJ=864e5;function iJ(e){Zn(1,arguments);var t=Jr(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),s=n-r;return Math.floor(s/sJ)+1}function Np(e){Zn(1,arguments);var t=1,n=Jr(e),r=n.getUTCDay(),s=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-s),n.setUTCHours(0,0,0,0),n}function B5(e){Zn(1,arguments);var t=Jr(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var s=Np(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var o=Np(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function oJ(e){Zn(1,arguments);var t=B5(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Np(n);return r}var lJ=6048e5;function cJ(e){Zn(1,arguments);var t=Jr(e),n=Np(t).getTime()-oJ(t).getTime();return Math.round(n/lJ)+1}function Sp(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Nm(),d=Xo((n=(r=(s=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&s!==void 0?s:h.weekStartsOn)!==null&&r!==void 0?r:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Jr(e),m=f.getUTCDay(),y=(m<d?7:0)+m-d;return f.setUTCDate(f.getUTCDate()-y),f.setUTCHours(0,0,0,0),f}function z5(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Jr(e),d=h.getUTCFullYear(),f=Nm(),m=Xo((n=(r=(s=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&s!==void 0?s:f.firstWeekContainsDate)!==null&&r!==void 0?r:(c=f.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(d+1,0,m),y.setUTCHours(0,0,0,0);var b=Sp(y,t),w=new Date(0);w.setUTCFullYear(d,0,m),w.setUTCHours(0,0,0,0);var x=Sp(w,t);return h.getTime()>=b.getTime()?d+1:h.getTime()>=x.getTime()?d:d-1}function dJ(e,t){var n,r,s,i,o,l,c,u;Zn(1,arguments);var h=Nm(),d=Xo((n=(r=(s=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&s!==void 0?s:h.firstWeekContainsDate)!==null&&r!==void 0?r:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=z5(e,t),m=new Date(0);m.setUTCFullYear(f,0,d),m.setUTCHours(0,0,0,0);var y=Sp(m,t);return y}var uJ=6048e5;function hJ(e,t){Zn(1,arguments);var n=Jr(e),r=Sp(n,t).getTime()-dJ(n,t).getTime();return Math.round(r/uJ)+1}function St(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var di={y:function(t,n){var r=t.getUTCFullYear(),s=r>0?r:1-r;return St(n==="yy"?s%100:s,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):St(r+1,2)},d:function(t,n){return St(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return St(t.getUTCHours()%12||12,n.length)},H:function(t,n){return St(t.getUTCHours(),n.length)},m:function(t,n){return St(t.getUTCMinutes(),n.length)},s:function(t,n){return St(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,s=t.getUTCMilliseconds(),i=Math.floor(s*Math.pow(10,r-3));return St(i,n.length)}},pl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},fJ={G:function(t,n,r){var s=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var s=t.getUTCFullYear(),i=s>0?s:1-s;return r.ordinalNumber(i,{unit:"year"})}return di.y(t,n)},Y:function(t,n,r,s){var i=z5(t,s),o=i>0?i:1-i;if(n==="YY"){var l=o%100;return St(l,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):St(o,n.length)},R:function(t,n){var r=B5(t);return St(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return St(r,n.length)},Q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(s);case"QQ":return St(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(s);case"qq":return St(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,n,r){var s=t.getUTCMonth();switch(n){case"M":case"MM":return di.M(t,n);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(t,n,r){var s=t.getUTCMonth();switch(n){case"L":return String(s+1);case"LL":return St(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(t,n,r,s){var i=hJ(t,s);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):St(i,n.length)},I:function(t,n,r){var s=cJ(t);return n==="Io"?r.ordinalNumber(s,{unit:"week"}):St(s,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):di.d(t,n)},D:function(t,n,r){var s=iJ(t);return n==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):St(s,n.length)},E:function(t,n,r){var s=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return St(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return St(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var s=t.getUTCDay(),i=s===0?7:s;switch(n){case"i":return String(i);case"ii":return St(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(t,n,r){var s=t.getUTCHours(),i=s/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var s=t.getUTCHours(),i;switch(s===12?i=pl.noon:s===0?i=pl.midnight:i=s/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var s=t.getUTCHours(),i;switch(s>=17?i=pl.evening:s>=12?i=pl.afternoon:s>=4?i=pl.morning:i=pl.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var s=t.getUTCHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return di.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):di.H(t,n)},K:function(t,n,r){var s=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(s,{unit:"hour"}):St(s,n.length)},k:function(t,n,r){var s=t.getUTCHours();return s===0&&(s=24),n==="ko"?r.ordinalNumber(s,{unit:"hour"}):St(s,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):di.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):di.s(t,n)},S:function(t,n){return di.S(t,n)},X:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();if(o===0)return"Z";switch(n){case"X":return uC(o);case"XXXX":case"XX":return xo(o);case"XXXXX":case"XXX":default:return xo(o,":")}},x:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"x":return uC(o);case"xxxx":case"xx":return xo(o);case"xxxxx":case"xxx":default:return xo(o,":")}},O:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+dC(o,":");case"OOOO":default:return"GMT"+xo(o,":")}},z:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+dC(o,":");case"zzzz":default:return"GMT"+xo(o,":")}},t:function(t,n,r,s){var i=s._originalDate||t,o=Math.floor(i.getTime()/1e3);return St(o,n.length)},T:function(t,n,r,s){var i=s._originalDate||t,o=i.getTime();return St(o,n.length)}};function dC(e,t){var n=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),i=r%60;if(i===0)return n+String(s);var o=t;return n+String(s)+o+St(i,2)}function uC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+St(Math.abs(e)/60,2)}return xo(e,t)}function xo(e,t){var n=t||"",r=e>0?"-":"+",s=Math.abs(e),i=St(Math.floor(s/60),2),o=St(s%60,2);return r+i+n+o}var hC=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},$5=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},pJ=function(t,n){var r=t.match(/(P+)(p+)?/)||[],s=r[1],i=r[2];if(!i)return hC(t,n);var o;switch(s){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",hC(s,n)).replace("{{time}}",$5(i,n))},mJ={p:$5,P:pJ},gJ=["D","DD"],xJ=["YY","YYYY"];function bJ(e){return gJ.indexOf(e)!==-1}function vJ(e){return xJ.indexOf(e)!==-1}function fC(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var yJ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},wJ=function(t,n,r){var s,i=yJ[t];return typeof i=="string"?s=i:n===1?s=i.one:s=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Zg(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var NJ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},SJ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},EJ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jJ={date:Zg({formats:NJ,defaultWidth:"full"}),time:Zg({formats:SJ,defaultWidth:"full"}),dateTime:Zg({formats:EJ,defaultWidth:"full"})},TJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},CJ=function(t,n,r,s){return TJ[t]};function ud(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",s;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):i;s=e.formattingValues[o]||e.formattingValues[i]}else{var l=e.defaultWidth,c=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[c]||e.values[l]}var u=e.argumentCallback?e.argumentCallback(t):t;return s[u]}}var kJ={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},AJ={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_J={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},RJ={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},OJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},DJ={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},IJ=function(t,n){var r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},MJ={ordinalNumber:IJ,era:ud({values:kJ,defaultWidth:"wide"}),quarter:ud({values:AJ,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:ud({values:_J,defaultWidth:"wide"}),day:ud({values:RJ,defaultWidth:"wide"}),dayPeriod:ud({values:OJ,defaultWidth:"wide",formattingValues:DJ,defaultFormattingWidth:"wide"})};function hd(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;var o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?UJ(l,function(d){return d.test(o)}):LJ(l,function(d){return d.test(o)}),u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;var h=t.slice(o.length);return{value:u,rest:h}}}function LJ(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function UJ(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function PJ(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var s=r[0],i=t.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;var l=t.slice(s.length);return{value:o,rest:l}}}var FJ=/^(\d+)(th|st|nd|rd)?/i,BJ=/\d+/i,zJ={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$J={any:[/^b/i,/^(a|c)/i]},HJ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},qJ={any:[/1/i,/2/i,/3/i,/4/i]},GJ={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},VJ={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},YJ={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},WJ={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},XJ={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},KJ={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZJ={ordinalNumber:PJ({matchPattern:FJ,parsePattern:BJ,valueCallback:function(t){return parseInt(t,10)}}),era:hd({matchPatterns:zJ,defaultMatchWidth:"wide",parsePatterns:$J,defaultParseWidth:"any"}),quarter:hd({matchPatterns:HJ,defaultMatchWidth:"wide",parsePatterns:qJ,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:hd({matchPatterns:GJ,defaultMatchWidth:"wide",parsePatterns:VJ,defaultParseWidth:"any"}),day:hd({matchPatterns:YJ,defaultMatchWidth:"wide",parsePatterns:WJ,defaultParseWidth:"any"}),dayPeriod:hd({matchPatterns:XJ,defaultMatchWidth:"any",parsePatterns:KJ,defaultParseWidth:"any"})},QJ={code:"en-US",formatDistance:wJ,formatLong:jJ,formatRelative:CJ,localize:MJ,match:ZJ,options:{weekStartsOn:0,firstWeekContainsDate:1}},JJ=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,eee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tee=/^'([^]*?)'?$/,nee=/''/g,aee=/[a-zA-Z]/;function Yn(e,t,n){var r,s,i,o,l,c,u,h,d,f,m,y,b,w;Zn(2,arguments);var x=String(t),v=Nm(),g=(r=(s=void 0)!==null&&s!==void 0?s:v.locale)!==null&&r!==void 0?r:QJ,N=Xo((i=(o=(l=(c=void 0)!==null&&c!==void 0?c:void 0)!==null&&l!==void 0?l:v.firstWeekContainsDate)!==null&&o!==void 0?o:(u=v.locale)===null||u===void 0||(h=u.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(N>=1&&N<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var S=Xo((d=(f=(m=(y=void 0)!==null&&y!==void 0?y:void 0)!==null&&m!==void 0?m:v.weekStartsOn)!==null&&f!==void 0?f:(b=v.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&d!==void 0?d:0);if(!(S>=0&&S<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!g.localize)throw new RangeError("locale must contain localize property");if(!g.formatLong)throw new RangeError("locale must contain formatLong property");var E=Jr(e);if(!aJ(E))throw new RangeError("Invalid time value");var j=tJ(E),R=rJ(E,j),L={firstWeekContainsDate:N,weekStartsOn:S,locale:g,_originalDate:E},P=x.match(eee).map(function(U){var F=U[0];if(F==="p"||F==="P"){var G=mJ[F];return G(U,g.formatLong)}return U}).join("").match(JJ).map(function(U){if(U==="''")return"'";var F=U[0];if(F==="'")return ree(U);var G=fJ[F];if(G)return vJ(U)&&fC(U,t,String(e)),bJ(U)&&fC(U,t,String(e)),G(R,U,g.localize,L);if(F.match(aee))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");return U}).join("");return P}function ree(e){var t=e.match(tee);return t?t[1].replace(nee,"'"):e}function GN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function see(e,t){if(e){if(typeof e=="string")return GN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GN(e,t):void 0}}function iee(e,t){if(Wo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oee(e){var t=iee(e,"string");return Wo(t)=="symbol"?t:t+""}function H5(e,t,n){return(t=oee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mC=mp,q5=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return mC(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const h=n==null?void 0:n[u],d=i==null?void 0:i[u];if(h===null)return null;const f=pC(h)||pC(d);return s[u][f]}),l=n&&Object.entries(n).reduce((u,h)=>{let[d,f]=h;return f===void 0||(u[d]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,h)=>{let{class:d,className:f,...m}=h;return Object.entries(m).every(y=>{let[b,w]=y;return Array.isArray(w)?w.includes({...i,...l}[b]):{...i,...l}[b]===w})?[...u,d,f]:u},[]);return mC(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},VN=q5("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-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),z=p.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?SQ:"button";return a.jsx(o,{className:Ve(VN({variant:t,size:n,className:e})),ref:i,...s})});z.displayName="Button";function lee(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const Qg={},Td={};function No(e,t){try{const r=(Qg[e]||(Qg[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return r in Td?Td[r]:gC(r,r.split(":"))}catch{if(e in Td)return Td[e];const n=e==null?void 0:e.match(cee);return n?gC(e,n.slice(1)):NaN}}const cee=/([+-]\d\d):?(\d\d)?/;function gC(e,t){const n=+(t[0]||0),r=+(t[1]||0),s=+(t[2]||0)/60;return Td[e]=n*60+r>0?n*60+r+s:n*60-r-s}class zr extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(No(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),G5(this),YN(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new zr(...n,t):new zr(Date.now(),t)}withTimeZone(t){return new zr(+this,t)}getTimezoneOffset(){const t=-No(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),YN(this),+this}[Symbol.for("constructDateFrom")](t){return new zr(+new Date(t),this.timeZone)}}const xC=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!xC.test(e))return;const t=e.replace(xC,"$1UTC");zr.prototype[t]&&(e.startsWith("get")?zr.prototype[e]=function(){return this.internal[t]()}:(zr.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),dee(this),+this},zr.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),YN(this),+this}))});function YN(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-No(e.timeZone,e)*60))}function dee(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),G5(e)}function G5(e){const t=No(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const u=new Date(+e);u.setUTCSeconds(0);const h=s>0?u.getSeconds():(u.getSeconds()-60)%60,d=Math.round(-(No(e.timeZone,e)*60))%60;(d||h)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+d),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+d+h));const f=No(e.timeZone,e),m=f>0?Math.floor(f):Math.ceil(f),b=-new Date(+e).getTimezoneOffset()-m,w=m!==n,x=b-c;if(w&&x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+x);const v=No(e.timeZone,e),g=v>0?Math.floor(v):Math.ceil(v),N=m-g;N&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+N),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+N))}}class Bn extends zr{static tz(t,...n){return n.length?new Bn(...n,t):new Bn(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),s=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${t} GMT${n}${r}${s} (${lee(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[n,r,s]}withTimeZone(t){return new Bn(+this,t)}[Symbol.for("constructDateFrom")](t){return new Bn(+new Date(t),this.timeZone)}}const V5=6048e5,uee=864e5,bC=Symbol.for("constructDateFrom");function vn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&bC in e?e[bC](t):e instanceof Date?new e.constructor(t):new Date(t)}function At(e,t){return vn(t||e,e)}function Y5(e,t,n){const r=At(e,n==null?void 0:n.in);return isNaN(t)?vn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function W5(e,t,n){const r=At(e,n==null?void 0:n.in);if(isNaN(t))return vn(e,NaN);if(!t)return r;const s=r.getDate(),i=vn(e,r.getTime());i.setMonth(r.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let hee={};function th(){return hee}function kc(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.weekStartsOn)??0,s=At(e,t==null?void 0:t.in),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Tu(e,t){return kc(e,{...t,weekStartsOn:1})}function X5(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=vn(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=Tu(s),o=vn(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const l=Tu(o);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function vC(e){const t=At(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Hc(e,...t){const n=vn.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function Cu(e,t){const n=At(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function K5(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t),i=Cu(r),o=Cu(s),l=+i-vC(i),c=+o-vC(o);return Math.round((l-c)/uee)}function fee(e,t){const n=X5(e,t),r=vn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Tu(r)}function pee(e,t,n){return Y5(e,t*7,n)}function mee(e,t,n){return W5(e,t*12,n)}function gee(e,t){let n,r=t==null?void 0:t.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=vn.bind(null,s));const i=At(s,r);(!n||n<i||isNaN(+i))&&(n=i)}),vn(r,n||NaN)}function xee(e,t){let n,r=t==null?void 0:t.in;return e.forEach(s=>{!r&&typeof s=="object"&&(r=vn.bind(null,s));const i=At(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vn(r,n||NaN)}function bee(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return+Cu(r)==+Cu(s)}function Z5(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function vee(e){return!(!Z5(e)&&typeof e!="number"||isNaN(+At(e)))}function yee(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t),i=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return i*12+o}function wee(e,t){const n=At(e,t==null?void 0:t.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Q5(e,t){const[n,r]=Hc(e,t.start,t.end);return{start:n,end:r}}function Nee(e,t){const{start:n,end:r}=Q5(t==null?void 0:t.in,e);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setDate(1);let l=1;const c=[];for(;+o<=i;)c.push(vn(n,o)),o.setMonth(o.getMonth()+l);return s?c.reverse():c}function See(e,t){const n=At(e,t==null?void 0:t.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Eee(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function J5(e,t){const n=At(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jee(e,t){const{start:n,end:r}=Q5(t==null?void 0:t.in,e);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const c=[];for(;+o<=i;)c.push(vn(n,o)),o.setFullYear(o.getFullYear()+l);return s?c.reverse():c}function eU(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.weekStartsOn)??0,s=At(e,t==null?void 0:t.in),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Tee(e,t){return eU(e,{...t,weekStartsOn:1})}const Cee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},kee=(e,t,n)=>{let r;const s=Cee[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Jg(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Aee={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_ee={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ree={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Oee={date:Jg({formats:Aee,defaultWidth:"full"}),time:Jg({formats:_ee,defaultWidth:"full"}),dateTime:Jg({formats:Ree,defaultWidth:"full"})},Dee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Iee=(e,t,n,r)=>Dee[e];function fd(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const Mee={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Lee={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Uee={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pee={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Fee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zee=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},$ee={ordinalNumber:zee,era:fd({values:Mee,defaultWidth:"wide"}),quarter:fd({values:Lee,defaultWidth:"wide",argumentCallback:e=>e-1}),month:fd({values:Uee,defaultWidth:"wide"}),day:fd({values:Pee,defaultWidth:"wide"}),dayPeriod:fd({values:Fee,defaultWidth:"wide",formattingValues:Bee,defaultFormattingWidth:"wide"})};function pd(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?qee(l,d=>d.test(o)):Hee(l,d=>d.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const h=t.slice(o.length);return{value:u,rest:h}}}function Hee(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function qee(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Gee(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const Vee=/^(\d+)(th|st|nd|rd)?/i,Yee=/\d+/i,Wee={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Xee={any:[/^b/i,/^(a|c)/i]},Kee={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zee={any:[/1/i,/2/i,/3/i,/4/i]},Qee={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Jee={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ete={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},tte={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},nte={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ate={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},rte={ordinalNumber:Gee({matchPattern:Vee,parsePattern:Yee,valueCallback:e=>parseInt(e,10)}),era:pd({matchPatterns:Wee,defaultMatchWidth:"wide",parsePatterns:Xee,defaultParseWidth:"any"}),quarter:pd({matchPatterns:Kee,defaultMatchWidth:"wide",parsePatterns:Zee,defaultParseWidth:"any",valueCallback:e=>e+1}),month:pd({matchPatterns:Qee,defaultMatchWidth:"wide",parsePatterns:Jee,defaultParseWidth:"any"}),day:pd({matchPatterns:ete,defaultMatchWidth:"wide",parsePatterns:tte,defaultParseWidth:"any"}),dayPeriod:pd({matchPatterns:nte,defaultMatchWidth:"any",parsePatterns:ate,defaultParseWidth:"any"})},GS={code:"en-US",formatDistance:kee,formatLong:Oee,formatRelative:Iee,localize:$ee,match:rte,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ste(e,t){const n=At(e,t==null?void 0:t.in);return K5(n,J5(n))+1}function tU(e,t){const n=At(e,t==null?void 0:t.in),r=+Tu(n)-+fee(n);return Math.round(r/V5)+1}function nU(e,t){var h,d,f,m;const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=th(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=vn((t==null?void 0:t.in)||e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=kc(o,t),c=vn((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=kc(c,t);return+n>=+l?r+1:+n>=+u?r:r-1}function ite(e,t){var l,c,u,h;const n=th(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(u=n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,s=nU(e,t),i=vn((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),kc(i,t)}function aU(e,t){const n=At(e,t==null?void 0:t.in),r=+kc(n,t)-+ite(n,t);return Math.round(r/V5)+1}function Et(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const ui={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Et(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Et(n+1,2)},d(e,t){return Et(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Et(e.getHours()%12||12,t.length)},H(e,t){return Et(e.getHours(),t.length)},m(e,t){return Et(e.getMinutes(),t.length)},s(e,t){return Et(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Et(s,t.length)}},ml={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},yC={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return ui.y(e,t)},Y:function(e,t,n,r){const s=nU(e,r),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return Et(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Et(i,t.length)},R:function(e,t){const n=X5(e);return Et(n,t.length)},u:function(e,t){const n=e.getFullYear();return Et(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Et(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Et(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return ui.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Et(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=aU(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):Et(s,t.length)},I:function(e,t,n){const r=tU(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Et(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):ui.d(e,t)},D:function(e,t,n){const r=ste(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Et(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Et(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Et(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return Et(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=ml.noon:r===0?s=ml.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=ml.evening:r>=12?s=ml.afternoon:r>=4?s=ml.morning:s=ml.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ui.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):ui.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Et(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):ui.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):ui.s(e,t)},S:function(e,t){return ui.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return NC(r);case"XXXX":case"XX":return bo(r);case"XXXXX":case"XXX":default:return bo(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return NC(r);case"xxxx":case"xx":return bo(r);case"xxxxx":case"xxx":default:return bo(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+wC(r,":");case"OOOO":default:return"GMT"+bo(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+wC(r,":");case"zzzz":default:return"GMT"+bo(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return Et(r,t.length)},T:function(e,t,n){return Et(+e,t.length)}};function wC(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+Et(i,2)}function NC(e,t){return e%60===0?(e>0?"-":"+")+Et(Math.abs(e)/60,2):bo(e,t)}function bo(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Et(Math.trunc(r/60),2),i=Et(r%60,2);return n+s+t+i}const SC=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},rU=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ote=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return SC(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",SC(r,t)).replace("{{time}}",rU(s,t))},lte={p:rU,P:ote},cte=/^D+$/,dte=/^Y+$/,ute=["D","DD","YY","YYYY"];function hte(e){return cte.test(e)}function fte(e){return dte.test(e)}function pte(e,t,n){const r=mte(e,t,n);if(console.warn(r),ute.includes(e))throw new RangeError(r)}function mte(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const gte=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xte=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bte=/^'([^]*?)'?$/,vte=/''/g,yte=/[a-zA-Z]/;function wte(e,t,n){var h,d,f,m,y,b,w,x;const r=th(),s=(n==null?void 0:n.locale)??r.locale??GS,i=(n==null?void 0:n.firstWeekContainsDate)??((d=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((b=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:b.weekStartsOn)??r.weekStartsOn??((x=(w=r.locale)==null?void 0:w.options)==null?void 0:x.weekStartsOn)??0,l=At(e,n==null?void 0:n.in);if(!vee(l))throw new RangeError("Invalid time value");let c=t.match(xte).map(v=>{const g=v[0];if(g==="p"||g==="P"){const N=lte[g];return N(v,s.formatLong)}return v}).join("").match(gte).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const g=v[0];if(g==="'")return{isToken:!1,value:Nte(v)};if(yC[g])return{isToken:!0,value:v};if(g.match(yte))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(v=>{if(!v.isToken)return v.value;const g=v.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&fte(g)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&hte(g))&&pte(g,t,String(e));const N=yC[g[0]];return N(l,g,s.localize,u)}).join("")}function Nte(e){const t=e.match(bte);return t?t[1].replace(vte,"'"):e}function Ste(e,t){const n=At(e,t==null?void 0:t.in),r=n.getFullYear(),s=n.getMonth(),i=vn(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Ete(e,t){return At(e,t==null?void 0:t.in).getMonth()}function jte(e,t){return At(e,t==null?void 0:t.in).getFullYear()}function Tte(e,t){return+At(e)>+At(t)}function Cte(e,t){return+At(e)<+At(t)}function kte(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function Ate(e,t,n){const[r,s]=Hc(n==null?void 0:n.in,e,t);return r.getFullYear()===s.getFullYear()}function _te(e,t,n){const r=At(e,n==null?void 0:n.in),s=r.getFullYear(),i=r.getDate(),o=vn(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=Ste(o);return r.setMonth(t,Math.min(i,l)),r}function Rte(e,t,n){const r=At(e,n==null?void 0:n.in);return isNaN(+r)?vn(e,NaN):(r.setFullYear(t),r)}const EC=5,Ote=4;function Dte(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,s=t.addDays(e,-r+1),i=t.addDays(s,EC*7-1);return t.getMonth(e)===t.getMonth(i)?EC:Ote}function sU(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-1*6):t.addDays(n,-1*(r-1))}function Ite(e,t){const n=sU(e,t),r=Dte(e,t);return t.addDays(n,r*7-1)}class Pa{constructor(t,n){this.Date=Date,this.today=()=>{var r;return(r=this.overrides)!=null&&r.today?this.overrides.today():this.options.timeZone?Bn.tz(this.options.timeZone):new this.Date},this.newDate=(r,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Bn(r,s,i,this.options.timeZone):new Date(r,s,i)},this.addDays=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(r,s):Y5(r,s)},this.addMonths=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(r,s):W5(r,s)},this.addWeeks=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(r,s):pee(r,s)},this.addYears=(r,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(r,s):mee(r,s)},this.differenceInCalendarDays=(r,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):K5(r,s)},this.differenceInCalendarMonths=(r,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):yee(r,s)},this.eachMonthOfInterval=r=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Nee(r)},this.eachYearOfInterval=r=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):jee(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=r=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):Ite(r,this)},this.endOfISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(r):Tee(r)},this.endOfMonth=r=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(r):wee(r)},this.endOfWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(r,s):eU(r,this.options)},this.endOfYear=r=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(r):Eee(r)},this.format=(r,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(r,s,this.options):wte(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(r):tU(r)},this.getMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(r,this.options):Ete(r,this.options)},this.getYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(r,this.options):jte(r,this.options)},this.getWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(r,this.options):aU(r,this.options)},this.isAfter=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(r,s):Tte(r,s)},this.isBefore=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(r,s):Cte(r,s)},this.isDate=r=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(r):Z5(r)},this.isSameDay=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(r,s):bee(r,s)},this.isSameMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(r,s):kte(r,s)},this.isSameYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(r,s):Ate(r,s)},this.max=r=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(r):gee(r)},this.min=r=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(r):xee(r)},this.setMonth=(r,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(r,s):_te(r,s)},this.setYear=(r,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(r,s):Rte(r,s)},this.startOfBroadcastWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):sU(r,this)},this.startOfDay=r=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(r):Cu(r)},this.startOfISOWeek=r=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(r):Tu(r)},this.startOfMonth=r=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(r):See(r)},this.startOfWeek=(r,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(r,this.options):kc(r,this.options)},this.startOfYear=r=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(r):J5(r)},this.options={locale:GS,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var n;const t=(n=this.options.locale)==null?void 0:n.code;return t&&Pa.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:s}=this.options,i=n==null?void 0:n.code;if(i&&Pa.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}Pa.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const es=new Pa;class iU{constructor(t,n,r=es){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class Mte{constructor(t,n){this.date=t,this.weeks=n}}class Lte{constructor(t,n){this.days=n,this.weekNumber=t}}function Ute(e){return ee.createElement("button",{...e})}function Pte(e){return ee.createElement("span",{...e})}function Fte(e){const{size:t=24,orientation:n="left",className:r}=e;return ee.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&ee.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ee.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ee.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ee.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Bte(e){const{day:t,modifiers:n,...r}=e;return ee.createElement("td",{...r})}function zte(e){const{day:t,modifiers:n,...r}=e,s=ee.useRef(null);return ee.useEffect(()=>{var i;n.focused&&((i=s.current)==null||i.focus())},[n.focused]),ee.createElement("button",{ref:s,...r})}var qe;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(qe||(qe={}));var Qt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Qt||(Qt={}));var gr;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(gr||(gr={}));var ja;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(ja||(ja={}));function $te(e){const{options:t,className:n,components:r,classNames:s,...i}=e,o=[s[qe.Dropdown],n].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return ee.createElement("span",{"data-disabled":i.disabled,className:s[qe.DropdownRoot]},ee.createElement(r.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:u,disabled:h})=>ee.createElement(r.Option,{key:c,value:c,disabled:h},u))),ee.createElement("span",{className:s[qe.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,ee.createElement(r.Chevron,{orientation:"down",size:18,className:s[qe.Chevron]})))}function Hte(e){return ee.createElement("div",{...e})}function qte(e){return ee.createElement("div",{...e})}function Gte(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r},e.children)}function Vte(e){const{calendarMonth:t,displayIndex:n,...r}=e;return ee.createElement("div",{...r})}function Yte(e){return ee.createElement("table",{...e})}function Wte(e){return ee.createElement("div",{...e})}const oU=p.createContext(void 0);function nh(){const e=p.useContext(oU);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Xte(e){const{components:t}=nh();return ee.createElement(t.Dropdown,{...e})}function Kte(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:u}}=nh(),h=p.useCallback(f=>{s&&(n==null||n(f))},[s,n]),d=p.useCallback(f=>{r&&(t==null||t(f))},[r,t]);return ee.createElement("nav",{...i},ee.createElement(o.PreviousMonthButton,{type:"button",className:l[qe.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},ee.createElement(o.Chevron,{disabled:r?void 0:!0,className:l[qe.Chevron],orientation:"left"})),ee.createElement(o.NextMonthButton,{type:"button",className:l[qe.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":u(s),onClick:h},ee.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[qe.Chevron]})))}function Zte(e){const{components:t}=nh();return ee.createElement(t.Button,{...e})}function Qte(e){return ee.createElement("option",{...e})}function Jte(e){const{components:t}=nh();return ee.createElement(t.Button,{...e})}function ene(e){const{rootRef:t,...n}=e;return ee.createElement("div",{...n,ref:t})}function tne(e){return ee.createElement("select",{...e})}function nne(e){const{week:t,...n}=e;return ee.createElement("tr",{...n})}function ane(e){return ee.createElement("th",{...e})}function rne(e){return ee.createElement("thead",{"aria-hidden":!0},ee.createElement("tr",{...e}))}function sne(e){const{week:t,...n}=e;return ee.createElement("th",{...n})}function ine(e){return ee.createElement("th",{...e})}function one(e){return ee.createElement("tbody",{...e})}function lne(e){const{components:t}=nh();return ee.createElement(t.Dropdown,{...e})}const cne=Object.freeze(Object.defineProperty({__proto__:null,Button:Ute,CaptionLabel:Pte,Chevron:Fte,Day:Bte,DayButton:zte,Dropdown:$te,DropdownNav:Hte,Footer:qte,Month:Gte,MonthCaption:Vte,MonthGrid:Yte,Months:Wte,MonthsDropdown:Xte,Nav:Kte,NextMonthButton:Zte,Option:Qte,PreviousMonthButton:Jte,Root:ene,Select:tne,Week:nne,WeekNumber:sne,WeekNumberHeader:ine,Weekday:ane,Weekdays:rne,Weeks:one,YearsDropdown:lne},Symbol.toStringTag,{value:"Module"}));function As(e,t,n=!1,r=es){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=r;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(n?1:0)&&o(i,t)>=(n?1:0)):!n&&i?l(i,t):!n&&s?l(s,t):!1}function lU(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function VS(e){return!!(e&&typeof e=="object"&&"from"in e)}function cU(e){return!!(e&&typeof e=="object"&&"after"in e)}function dU(e){return!!(e&&typeof e=="object"&&"before"in e)}function uU(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function hU(e,t){return Array.isArray(e)&&e.every(t.isDate)}function _s(e,t,n=es){const r=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(e,l);if(hU(l,n))return l.includes(e);if(VS(l))return As(l,e,!1,n);if(uU(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(lU(l)){const c=i(l.before,e),u=i(l.after,e),h=c>0,d=u<0;return o(l.before,l.after)?d&&h:h||d}return cU(l)?i(e,l.after)>0:dU(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function dne(e,t,n,r,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:u,today:h}=t,{isSameDay:d,isSameMonth:f,startOfMonth:m,isBefore:y,endOfMonth:b,isAfter:w}=s,x=n&&m(n),v=r&&b(r),g={[Qt.focused]:[],[Qt.outside]:[],[Qt.disabled]:[],[Qt.hidden]:[],[Qt.today]:[]},N={};for(const S of e){const{date:E,displayMonth:j}=S,R=!!(j&&!f(E,j)),L=!!(x&&y(E,x)),P=!!(v&&w(E,v)),U=!!(i&&_s(E,i,s)),F=!!(o&&_s(E,o,s))||L||P||!u&&!c&&R||u&&c===!1&&R,G=d(E,h??s.today());R&&g.outside.push(S),U&&g.disabled.push(S),F&&g.hidden.push(S),G&&g.today.push(S),l&&Object.keys(l).forEach(_=>{const I=l==null?void 0:l[_];I&&_s(E,I,s)&&(N[_]?N[_].push(S):N[_]=[S])})}return S=>{const E={[Qt.focused]:!1,[Qt.disabled]:!1,[Qt.hidden]:!1,[Qt.outside]:!1,[Qt.today]:!1},j={};for(const R in g){const L=g[R];E[R]=L.some(P=>P===S)}for(const R in N)j[R]=N[R].some(L=>L===S);return{...E,...j}}}function une(e,t,n={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):t[Qt[i]]?s.push(t[Qt[i]]):t[gr[i]]&&s.push(t[gr[i]]),s),[t[qe.Day]])}function hne(e){return{...cne,...e}}function fne(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function YS(){const e={};for(const t in qe)e[qe[t]]=`rdp-${qe[t]}`;for(const t in Qt)e[Qt[t]]=`rdp-${Qt[t]}`;for(const t in gr)e[gr[t]]=`rdp-${gr[t]}`;for(const t in ja)e[ja[t]]=`rdp-${ja[t]}`;return e}function fU(e,t,n){return(n??new Pa(t)).formatMonthYear(e)}const pne=fU;function mne(e,t,n){return(n??new Pa(t)).format(e,"d")}function gne(e,t=es){return t.format(e,"LLLL")}function xne(e,t,n){return(n??new Pa(t)).format(e,"cccccc")}function bne(e,t=es){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function vne(){return""}function pU(e,t=es){return t.format(e,"yyyy")}const yne=pU,wne=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:fU,formatDay:mne,formatMonthCaption:pne,formatMonthDropdown:gne,formatWeekNumber:bne,formatWeekNumberHeader:vne,formatWeekdayName:xne,formatYearCaption:yne,formatYearDropdown:pU},Symbol.toStringTag,{value:"Module"}));function Nne(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...wne,...e}}function Sne(e,t,n,r,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:u}=s;return c({start:o(e),end:l(e)}).map(f=>{const m=r.formatMonthDropdown(f,s),y=u(f),b=t&&f<i(t)||n&&f>i(n)||!1;return{value:y,label:m,disabled:b}})}function Ene(e,t={},n={}){let r={...t==null?void 0:t[qe.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n==null?void 0:n[s]}}),r}function jne(e,t,n){const r=e.today(),s=t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let o=0;o<7;o++){const l=e.addDays(s,o);i.push(l)}return i}function Tne(e,t,n,r,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=r,u=i(e),h=o(t),d=l({start:u,end:h});return s&&d.reverse(),d.map(f=>{const m=n.formatYearDropdown(f,r);return{value:c(f),label:m,disabled:!1}})}function mU(e,t,n,r){let s=(r??new Pa(n)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const Cne=mU;function gU(e,t,n){return(n??new Pa(t)).formatMonthYear(e)}const kne=gU;function Ane(e,t,n,r){let s=(r??new Pa(n)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function _ne(e){return"Choose the Month"}function Rne(){return""}function One(e){return"Go to the Next Month"}function Dne(e){return"Go to the Previous Month"}function Ine(e,t,n){return(n??new Pa(t)).format(e,"cccc")}function Mne(e,t){return`Week ${e}`}function Lne(e){return"Week Number"}function Une(e){return"Choose the Year"}const Pne=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:kne,labelDay:Cne,labelDayButton:mU,labelGrid:gU,labelGridcell:Ane,labelMonthDropdown:_ne,labelNav:Rne,labelNext:One,labelPrevious:Dne,labelWeekNumber:Mne,labelWeekNumberHeader:Lne,labelWeekday:Ine,labelYearDropdown:Une},Symbol.toStringTag,{value:"Module"})),ah=e=>e instanceof HTMLElement?e:null,ex=e=>[...e.querySelectorAll("[data-animated-month]")??[]],Fne=e=>ah(e.querySelector("[data-animated-month]")),tx=e=>ah(e.querySelector("[data-animated-caption]")),nx=e=>ah(e.querySelector("[data-animated-weeks]")),Bne=e=>ah(e.querySelector("[data-animated-nav]")),zne=e=>ah(e.querySelector("[data-animated-weekdays]"));function $ne(e,t,{classNames:n,months:r,focused:s,dateLib:i}){const o=p.useRef(null),l=p.useRef(r),c=p.useRef(!1);p.useLayoutEffect(()=>{const u=l.current;if(l.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const h=i.isSameMonth(r[0].date,u[0].date),d=i.isAfter(r[0].date,u[0].date),f=d?n[ja.caption_after_enter]:n[ja.caption_before_enter],m=d?n[ja.weeks_after_enter]:n[ja.weeks_before_enter],y=o.current,b=e.current.cloneNode(!0);if(b instanceof HTMLElement?(ex(b).forEach(g=>{if(!(g instanceof HTMLElement))return;const N=Fne(g);N&&g.contains(N)&&g.removeChild(N);const S=tx(g);S&&S.classList.remove(f);const E=nx(g);E&&E.classList.remove(m)}),o.current=b):o.current=null,c.current||h||s)return;const w=y instanceof HTMLElement?ex(y):[],x=ex(e.current);if(x!=null&&x.every(v=>v instanceof HTMLElement)&&w&&w.every(v=>v instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const v=Bne(e.current);v&&(v.style.zIndex="1"),x.forEach((g,N)=>{const S=w[N];if(!S)return;g.style.position="relative",g.style.overflow="hidden";const E=tx(g);E&&E.classList.add(f);const j=nx(g);j&&j.classList.add(m);const R=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),v&&(v.style.zIndex=""),E&&E.classList.remove(f),j&&j.classList.remove(m),g.style.position="",g.style.overflow="",g.contains(S)&&g.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const L=zne(S);L&&(L.style.opacity="0");const P=tx(S);P&&(P.classList.add(d?n[ja.caption_before_exit]:n[ja.caption_after_exit]),P.addEventListener("animationend",R));const U=nx(S);U&&U.classList.add(d?n[ja.weeks_before_exit]:n[ja.weeks_after_exit]),g.insertBefore(S,g.firstChild)})}})}function Hne(e,t,n,r){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:u,differenceInCalendarDays:h,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:m,endOfMonth:y,endOfWeek:b,isAfter:w,startOfBroadcastWeek:x,startOfISOWeek:v,startOfWeek:g}=r,N=c?x(s,r):o?v(s):g(s),S=c?f(i):o?m(y(i)):b(y(i)),E=h(S,N),j=d(i,s)+1,R=[];for(let U=0;U<=E;U++){const F=u(N,U);if(t&&w(F,t))break;R.push(F)}const P=(c?35:42)*j;if(l&&R.length<P){const U=P-R.length;for(let F=0;F<U;F++){const G=u(R[R.length-1],1);R.push(G)}}return R}function qne(e){const t=[];return e.reduce((n,r)=>{const s=r.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return n.concat(s.slice())},t.slice())}function Gne(e,t,n,r){const{numberOfMonths:s=1}=n,i=[];for(let o=0;o<s;o++){const l=r.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function jC(e,t,n,r){const{month:s,defaultMonth:i,today:o=r.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:u,addMonths:h,startOfMonth:d}=r;if(n&&u(n,c)<l-1){const f=-1*(l-1);c=h(n,f)}return t&&u(c,t)<0&&(c=t),d(c)}function Vne(e,t,n,r){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:u,getWeek:h,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:m}=r,y=e.reduce((b,w)=>{const x=n.broadcastCalendar?d(w,r):n.ISOWeek?f(w):m(w),v=n.broadcastCalendar?i(w):n.ISOWeek?o(l(w)):c(l(w)),g=t.filter(j=>j>=x&&j<=v),N=n.broadcastCalendar?35:42;if(n.fixedWeeks&&g.length<N){const j=t.filter(R=>{const L=N-g.length;return R>v&&R<=s(v,L)});g.push(...j)}const S=g.reduce((j,R)=>{const L=n.ISOWeek?u(R):h(R),P=j.find(F=>F.weekNumber===L),U=new iU(R,w,r);return P?P.days.push(U):j.push(new Lte(L,[U])),j},[]),E=new Mte(w,S);return b.push(E),b},[]);return n.reverseMonths?y.reverse():y}function Yne(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:u,newDate:h,today:d}=t,{fromYear:f,toYear:m,fromMonth:y,toMonth:b}=e;!n&&y&&(n=y),!n&&f&&(n=t.newDate(f,0,1)),!r&&b&&(r=b),!r&&m&&(r=h(m,11,31));const w=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=o(n):f?n=h(f,0,1):!n&&w&&(n=s(c(e.today??d(),-100))),r?r=l(r):m?r=h(m,11,31):!r&&w&&(r=u(e.today??d())),[n&&i(n),r&&i(r)]}function Wne(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=r,u=s?i:1,h=o(e);if(!t)return l(h,u);if(!(c(t,e)<i))return l(h,u)}function Xne(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=r,u=s?i??1:1,h=o(e);if(!t)return l(h,-u);if(!(c(h,t)<=0))return l(h,-u)}function Kne(e){const t=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),t.slice())}function Sm(e,t){const[n,r]=p.useState(e);return[t===void 0?n:t,r]}function Zne(e,t){const[n,r]=Yne(e,t),{startOfMonth:s,endOfMonth:i}=t,o=jC(e,n,r,t),[l,c]=Sm(o,e.month?o:void 0);p.useEffect(()=>{const E=jC(e,n,r,t);c(E)},[e.timeZone]);const u=Gne(l,r,e,t),h=Hne(u,e.endMonth?i(e.endMonth):void 0,e,t),d=Vne(u,h,e,t),f=Kne(d),m=qne(d),y=Xne(l,n,e,t),b=Wne(l,r,e,t),{disableNavigation:w,onMonthChange:x}=e,v=E=>f.some(j=>j.days.some(R=>R.isEqualTo(E))),g=E=>{if(w)return;let j=s(E);n&&j<s(n)&&(j=s(n)),r&&j>s(r)&&(j=s(r)),c(j),x==null||x(j)};return{months:d,weeks:f,days:m,navStart:n,navEnd:r,previousMonth:y,nextMonth:b,goToMonth:g,goToDay:E=>{v(E)||g(E.date)}}}var Ir;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ir||(Ir={}));function TC(e){return!e[Qt.disabled]&&!e[Qt.hidden]&&!e[Qt.outside]}function Qne(e,t,n,r){let s,i=-1;for(const o of e){const l=t(o);TC(l)&&(l[Qt.focused]&&i<Ir.FocusedModifier?(s=o,i=Ir.FocusedModifier):r!=null&&r.isEqualTo(o)&&i<Ir.LastFocused?(s=o,i=Ir.LastFocused):n(o.date)&&i<Ir.Selected?(s=o,i=Ir.Selected):l[Qt.today]&&i<Ir.Today&&(s=o,i=Ir.Today))}return s||(s=e.find(o=>TC(t(o)))),s}function Jne(e,t,n,r,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:u,addMonths:h,addWeeks:d,addYears:f,endOfBroadcastWeek:m,endOfISOWeek:y,endOfWeek:b,max:w,min:x,startOfBroadcastWeek:v,startOfISOWeek:g,startOfWeek:N}=o;let E={day:u,week:d,month:h,year:f,startOfWeek:j=>c?v(j,o):l?g(j):N(j),endOfWeek:j=>c?m(j):l?y(j):b(j)}[e](n,t==="after"?1:-1);return t==="before"&&r?E=w([r,E]):t==="after"&&s&&(E=x([s,E])),E}function xU(e,t,n,r,s,i,o,l=0){if(l>365)return;const c=Jne(e,t,n.date,r,s,i,o),u=!!(i.disabled&&_s(c,i.disabled,o)),h=!!(i.hidden&&_s(c,i.hidden,o)),d=c,f=new iU(c,d,o);return!u&&!h?f:xU(e,t,f,r,s,i,o,l+1)}function eae(e,t,n,r,s){const{autoFocus:i}=e,[o,l]=p.useState(),c=Qne(t.days,n,r||(()=>!1),o),[u,h]=p.useState(i?c:void 0);return{isFocusTarget:b=>!!(c!=null&&c.isEqualTo(b)),setFocused:h,focused:u,blur:()=>{l(u),h(void 0)},moveFocus:(b,w)=>{if(!u)return;const x=xU(b,w,u,t.navStart,t.navEnd,e,s);x&&(e.disableNavigation&&!t.days.some(g=>g.isEqualTo(x))||(t.goToDay(x),h(x)))}}}function tae(e,t){const{selected:n,required:r,onSelect:s}=e,[i,o]=Sm(n,s?n:void 0),l=s?n:i,{isSameDay:c}=t,u=m=>(l==null?void 0:l.some(y=>c(y,m)))??!1,{min:h,max:d}=e;return{selected:l,select:(m,y,b)=>{let w=[...l??[]];if(u(m)){if((l==null?void 0:l.length)===h||r&&(l==null?void 0:l.length)===1)return;w=l==null?void 0:l.filter(x=>!c(x,m))}else(l==null?void 0:l.length)===d?w=[m]:w=[...w,m];return s||o(w),s==null||s(w,m,y,b),w},isSelected:u}}function nae(e,t,n=0,r=0,s=!1,i=es){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:u,isBefore:h}=i;let d;if(!o&&!l)d={from:e,to:n>0?void 0:e};else if(o&&!l)c(o,e)?n===0?d={from:o,to:e}:s?d={from:o,to:void 0}:d=void 0:h(e,o)?d={from:e,to:o}:d={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?d={from:o,to:l}:d=void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(l,e))d={from:e,to:n>0?void 0:e};else if(h(e,o))d={from:e,to:l};else if(u(e,o))d={from:o,to:e};else if(u(e,l))d={from:o,to:e};else throw new Error("Invalid range");if(d!=null&&d.from&&(d!=null&&d.to)){const f=i.differenceInCalendarDays(d.to,d.from);r>0&&f>r?d={from:e,to:void 0}:n>1&&f<n&&(d={from:e,to:void 0})}return d}function aae(e,t,n=es){const r=Array.isArray(t)?t:[t];let s=e.from;const i=n.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function CC(e,t,n=es){return As(e,t.from,!1,n)||As(e,t.to,!1,n)||As(t,e.from,!1,n)||As(t,e.to,!1,n)}function rae(e,t,n=es){const r=Array.isArray(t)?t:[t];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?As(e,l,!1,n):hU(l,n)?l.some(c=>As(e,c,!1,n)):VS(l)?l.from&&l.to?CC(e,{from:l.from,to:l.to},n):!1:uU(l)?aae(e,l.dayOfWeek,n):lU(l)?n.isAfter(l.before,l.after)?CC(e,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):_s(e.from,l,n)||_s(e.to,l,n):cU(l)||dU(l)?_s(e.from,l,n)||_s(e.to,l,n):!1))return!0;const o=r.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=n.differenceInCalendarDays(e.to,e.from);for(let u=0;u<=c;u++){if(o.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function sae(e,t){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:o}=e,[l,c]=Sm(s,o?s:void 0),u=o?s:l;return{selected:u,select:(f,m,y)=>{const{min:b,max:w}=e,x=f?nae(f,u,b,w,i,t):void 0;return r&&n&&(x!=null&&x.from)&&x.to&&rae({from:x.from,to:x.to},n,t)&&(x.from=f,x.to=void 0),o||c(x),o==null||o(x,f,m,y),x},isSelected:f=>u&&As(u,f,!1,t)}}function iae(e,t){const{selected:n,required:r,onSelect:s}=e,[i,o]=Sm(n,s?n:void 0),l=s?n:i,{isSameDay:c}=t;return{selected:l,select:(d,f,m)=>{let y=d;return!r&&l&&l&&c(d,l)&&(y=void 0),s||o(y),s==null||s(y,d,f,m),y},isSelected:d=>l?c(l,d):!1}}function oae(e,t){const n=iae(e,t),r=tae(e,t),s=sae(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function lae(e){var $e;let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new Bn(t.today,t.timeZone)),t.month&&(t.month=new Bn(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new Bn(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new Bn(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new Bn(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new Bn(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=($e=t.selected)==null?void 0:$e.map(je=>new Bn(je,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new Bn(t.selected.from,t.timeZone):void 0,to:t.selected.to?new Bn(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:o,classNames:l}=p.useMemo(()=>{const je={...GS,...t.locale};return{dateLib:new Pa({locale:je,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:hne(t.components),formatters:Nne(t.formatters),labels:{...Pne,...t.labels},locale:je,classNames:{...YS(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:c,mode:u,navLayout:h,numberOfMonths:d=1,onDayBlur:f,onDayClick:m,onDayFocus:y,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:x,onNextClick:v,onPrevClick:g,showWeekNumber:N,styles:S}=t,{formatCaption:E,formatDay:j,formatMonthDropdown:R,formatWeekNumber:L,formatWeekNumberHeader:P,formatWeekdayName:U,formatYearDropdown:F}=r,G=Zne(t,i),{days:_,months:I,navStart:A,navEnd:C,previousMonth:T,nextMonth:O,goToMonth:q}=G,k=dne(_,t,A,C,i),{isSelected:M,select:$,selected:W}=oae(t,i)??{},{blur:Y,focused:te,isFocusTarget:ne,moveFocus:X,setFocused:se}=eae(t,G,k,M??(()=>!1),i),{labelDayButton:Ee,labelGridcell:re,labelGrid:xe,labelMonthDropdown:ye,labelNav:ze,labelPrevious:He,labelNext:Fe,labelWeekday:Ye,labelWeekNumber:ft,labelWeekNumberHeader:et,labelYearDropdown:de}=s,Be=p.useMemo(()=>jne(i,t.ISOWeek),[i,t.ISOWeek]),Ue=u!==void 0||m!==void 0,Oe=p.useCallback(()=>{T&&(q(T),g==null||g(T))},[T,q,g]),We=p.useCallback(()=>{O&&(q(O),v==null||v(O))},[q,O,v]),nt=p.useCallback((je,Z)=>ue=>{ue.preventDefault(),ue.stopPropagation(),se(je),$==null||$(je.date,Z,ue),m==null||m(je.date,Z,ue)},[$,m,se]),lt=p.useCallback((je,Z)=>ue=>{se(je),y==null||y(je.date,Z,ue)},[y,se]),Ut=p.useCallback((je,Z)=>ue=>{Y(),f==null||f(je.date,Z,ue)},[Y,f]),Kt=p.useCallback((je,Z)=>ue=>{const Ae={ArrowLeft:[ue.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[ue.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[ue.shiftKey?"year":"week","after"],ArrowUp:[ue.shiftKey?"year":"week","before"],PageUp:[ue.shiftKey?"year":"month","before"],PageDown:[ue.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ue.key]){ue.preventDefault(),ue.stopPropagation();const[Le,he]=Ae[ue.key];X(Le,he)}b==null||b(je.date,Z,ue)},[X,b,t.dir]),Gt=p.useCallback((je,Z)=>ue=>{w==null||w(je.date,Z,ue)},[w]),_t=p.useCallback((je,Z)=>ue=>{x==null||x(je.date,Z,ue)},[x]),ce=p.useCallback(je=>Z=>{const ue=Number(Z.target.value),Ae=i.setMonth(i.startOfMonth(je),ue);q(Ae)},[i,q]),Te=p.useCallback(je=>Z=>{const ue=Number(Z.target.value),Ae=i.setYear(i.startOfMonth(je),ue);q(Ae)},[i,q]),{className:Ze,style:K}=p.useMemo(()=>({className:[l[qe.Root],t.className].filter(Boolean).join(" "),style:{...S==null?void 0:S[qe.Root],...t.style}}),[l,t.className,t.style,S]),pe=fne(t),be=p.useRef(null);$ne(be,!!t.animate,{classNames:l,months:I,focused:te,dateLib:i});const _e={dayPickerProps:t,selected:W,select:$,isSelected:M,months:I,nextMonth:O,previousMonth:T,goToMonth:q,getModifiers:k,components:n,classNames:l,styles:S,labels:s,formatters:r};return ee.createElement(oU.Provider,{value:_e},ee.createElement(n.Root,{rootRef:t.animate?be:void 0,className:Ze,style:K,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...pe},ee.createElement(n.Months,{className:l[qe.Months],style:S==null?void 0:S[qe.Months]},!t.hideNavigation&&!h&&ee.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[qe.Nav],style:S==null?void 0:S[qe.Nav],"aria-label":ze(),onPreviousClick:Oe,onNextClick:We,previousMonth:T,nextMonth:O}),I.map((je,Z)=>ee.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:l[qe.Month],style:S==null?void 0:S[qe.Month],key:Z,displayIndex:Z,calendarMonth:je},h==="around"&&!t.hideNavigation&&Z===0&&ee.createElement(n.PreviousMonthButton,{type:"button",className:l[qe.PreviousMonthButton],tabIndex:T?void 0:-1,"aria-disabled":T?void 0:!0,"aria-label":He(T),onClick:Oe,"data-animated-button":t.animate?"true":void 0},ee.createElement(n.Chevron,{disabled:T?void 0:!0,className:l[qe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),ee.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[qe.MonthCaption],style:S==null?void 0:S[qe.MonthCaption],calendarMonth:je,displayIndex:Z},c!=null&&c.startsWith("dropdown")?ee.createElement(n.DropdownNav,{className:l[qe.Dropdowns],style:S==null?void 0:S[qe.Dropdowns]},(()=>{const ue=c==="dropdown"||c==="dropdown-months"?ee.createElement(n.MonthsDropdown,{key:"month",className:l[qe.MonthsDropdown],"aria-label":ye(),classNames:l,components:n,disabled:!!t.disableNavigation,onChange:ce(je.date),options:Sne(je.date,A,C,r,i),style:S==null?void 0:S[qe.Dropdown],value:i.getMonth(je.date)}):ee.createElement("span",{key:"month"},R(je.date,i)),Ae=c==="dropdown"||c==="dropdown-years"?ee.createElement(n.YearsDropdown,{key:"year",className:l[qe.YearsDropdown],"aria-label":de(i.options),classNames:l,components:n,disabled:!!t.disableNavigation,onChange:Te(je.date),options:Tne(A,C,r,i,!!t.reverseYears),style:S==null?void 0:S[qe.Dropdown],value:i.getYear(je.date)}):ee.createElement("span",{key:"year"},F(je.date,i));return i.getMonthYearOrder()==="year-first"?[Ae,ue]:[ue,Ae]})(),ee.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(je.date,i.options,i))):ee.createElement(n.CaptionLabel,{className:l[qe.CaptionLabel],role:"status","aria-live":"polite"},E(je.date,i.options,i))),h==="around"&&!t.hideNavigation&&Z===d-1&&ee.createElement(n.NextMonthButton,{type:"button",className:l[qe.NextMonthButton],tabIndex:O?void 0:-1,"aria-disabled":O?void 0:!0,"aria-label":Fe(O),onClick:We,"data-animated-button":t.animate?"true":void 0},ee.createElement(n.Chevron,{disabled:O?void 0:!0,className:l[qe.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Z===d-1&&h==="after"&&!t.hideNavigation&&ee.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[qe.Nav],style:S==null?void 0:S[qe.Nav],"aria-label":ze(),onPreviousClick:Oe,onNextClick:We,previousMonth:T,nextMonth:O}),ee.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":xe(je.date,i.options,i)||void 0,className:l[qe.MonthGrid],style:S==null?void 0:S[qe.MonthGrid]},!t.hideWeekdays&&ee.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[qe.Weekdays],style:S==null?void 0:S[qe.Weekdays]},N&&ee.createElement(n.WeekNumberHeader,{"aria-label":et(i.options),className:l[qe.WeekNumberHeader],style:S==null?void 0:S[qe.WeekNumberHeader],scope:"col"},P()),Be.map(ue=>ee.createElement(n.Weekday,{"aria-label":Ye(ue,i.options,i),className:l[qe.Weekday],key:String(ue),style:S==null?void 0:S[qe.Weekday],scope:"col"},U(ue,i.options,i)))),ee.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[qe.Weeks],style:S==null?void 0:S[qe.Weeks]},je.weeks.map(ue=>ee.createElement(n.Week,{className:l[qe.Week],key:ue.weekNumber,style:S==null?void 0:S[qe.Week],week:ue},N&&ee.createElement(n.WeekNumber,{week:ue,style:S==null?void 0:S[qe.WeekNumber],"aria-label":ft(ue.weekNumber,{locale:o}),className:l[qe.WeekNumber],scope:"row",role:"rowheader"},L(ue.weekNumber,i)),ue.days.map(Ae=>{const{date:Le}=Ae,he=k(Ae);if(he[Qt.focused]=!he.hidden&&!!(te!=null&&te.isEqualTo(Ae)),he[gr.selected]=(M==null?void 0:M(Le))||he.selected,VS(W)){const{from:it,to:tt}=W;he[gr.range_start]=!!(it&&tt&&i.isSameDay(Le,it)),he[gr.range_end]=!!(it&&tt&&i.isSameDay(Le,tt)),he[gr.range_middle]=As(W,Le,!0,i)}const Q=Ene(he,S,t.modifiersStyles),oe=une(he,l,t.modifiersClassNames),De=!Ue&&!he.hidden?re(Le,he,i.options,i):void 0;return ee.createElement(n.Day,{key:`${i.format(Le,"yyyy-MM-dd")}_${i.format(Ae.displayMonth,"yyyy-MM")}`,day:Ae,modifiers:he,className:oe.join(" "),style:Q,role:"gridcell","aria-selected":he.selected||void 0,"aria-label":De,"data-day":i.format(Le,"yyyy-MM-dd"),"data-month":Ae.outside?i.format(Le,"yyyy-MM"):void 0,"data-selected":he.selected||void 0,"data-disabled":he.disabled||void 0,"data-hidden":he.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":he.focused||void 0,"data-today":he.today||void 0},!he.hidden&&Ue?ee.createElement(n.DayButton,{className:l[qe.DayButton],style:S==null?void 0:S[qe.DayButton],type:"button",day:Ae,modifiers:he,disabled:he.disabled||void 0,tabIndex:ne(Ae)?0:-1,"aria-label":Ee(Le,he,i.options,i),onClick:nt(Ae,he),onBlur:Ut(Ae,he),onFocus:lt(Ae,he),onKeyDown:Kt(Ae,he),onMouseEnter:Gt(Ae,he),onMouseLeave:_t(Ae,he)},j(Le,i.options,i)):!he.hidden&&j(Ae.date,i.options,i))})))))))),t.footer&&ee.createElement(n.Footer,{className:l[qe.Footer],style:S==null?void 0:S[qe.Footer],role:"status","aria-live":"polite"},t.footer)))}function Ga({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:o,...l}){const c=YS();return a.jsx(lae,{showOutsideDays:n,className:Ve("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:u=>u.toLocaleString("default",{month:"short"}),...i},classNames:{root:Ve("w-fit",c.root),months:Ve("relative flex flex-col gap-4 md:flex-row",c.months),month:Ve("flex w-full flex-col gap-4",c.month),nav:Ve("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:Ve(VN({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:Ve(VN({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:Ve("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:Ve("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:Ve("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:Ve("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:Ve("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:Ve("flex",c.weekdays),weekday:Ve("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:Ve("mt-2 flex w-full",c.week),week_number_header:Ve("w-[--cell-size] select-none",c.week_number_header),week_number:Ve("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:Ve("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:Ve("bg-accent rounded-l-md",c.range_start),range_middle:Ve("rounded-none",c.range_middle),range_end:Ve("bg-accent rounded-r-md",c.range_end),today:Ve("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:Ve("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:Ve("text-muted-foreground opacity-50",c.disabled),hidden:Ve("invisible",c.hidden),...t},components:{Root:({className:u,rootRef:h,...d})=>a.jsx("div",{"data-slot":"calendar",ref:h,className:Ve(u),...d}),Chevron:({className:u,orientation:h,...d})=>h==="left"?a.jsx(h3,{className:Ve("size-4",u),...d}):h==="right"?a.jsx(ES,{className:Ve("size-4",u),...d}):a.jsx(Zu,{className:Ve("size-4",u),...d}),DayButton:cae,WeekNumber:({children:u,...h})=>a.jsx("td",{...h,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:u})}),...o},...l})}function cae({className:e,day:t,modifiers:n,...r}){const s=YS(),i=p.useRef(null);return p.useEffect(()=>{var o;n.focused&&((o=i.current)==null||o.focus())},[n.focused]),a.jsx(z,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:Ve("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,e),...r})}var Em="Popover",[bU]=Vs(Em,[pm]),rh=pm(),[dae,no]=bU(Em),vU=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=rh(t),c=p.useRef(null),[u,h]=p.useState(!1),[d,f]=$c({prop:r,defaultProp:s??!1,onChange:i,caller:Em});return a.jsx(Y3,{...l,children:a.jsx(dae,{scope:t,contentId:tr(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>h(!0),[]),onCustomAnchorRemove:p.useCallback(()=>h(!1),[]),modal:o,children:n})})};vU.displayName=Em;var yU="PopoverAnchor",uae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(yU,n),i=rh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return p.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(LS,{...i,...r,ref:t})});uae.displayName=yU;var wU="PopoverTrigger",NU=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(wU,n),i=rh(n),o=dn(t,s.triggerRef),l=a.jsx(qt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":CU(s.open),...r,ref:o,onClick:Nt(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(LS,{asChild:!0,...i,children:l})});NU.displayName=wU;var WS="PopoverPortal",[hae,fae]=bU(WS,{forceMount:void 0}),SU=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=no(WS,t);return a.jsx(hae,{scope:t,forceMount:n,children:a.jsx(Ys,{present:n||i.open,children:a.jsx(US,{asChild:!0,container:s,children:r})})})};SU.displayName=WS;var Ac="PopoverContent",EU=p.forwardRef((e,t)=>{const n=fae(Ac,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=no(Ac,e.__scopePopover);return a.jsx(Ys,{present:r||i.open,children:i.modal?a.jsx(mae,{...s,ref:t}):a.jsx(gae,{...s,ref:t})})});EU.displayName=Ac;var pae=Nu("PopoverContent.RemoveScroll"),mae=p.forwardRef((e,t)=>{const n=no(Ac,e.__scopePopover),r=p.useRef(null),s=dn(t,r),i=p.useRef(!1);return p.useEffect(()=>{const o=r.current;if(o)return b5(o)},[]),a.jsx(BS,{as:pae,allowPinchZoom:!0,children:a.jsx(jU,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Nt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Nt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),gae=p.forwardRef((e,t)=>{const n=no(Ac,e.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return a.jsx(jU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),jU=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:h,...d}=e,f=no(Ac,n),m=rh(n);return c5(),a.jsx(FS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(cm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(W3,{"data-state":CU(f.open),role:"dialog",id:f.contentId,...m,...d,ref:t,style:{...d.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)"}})})})}),TU="PopoverClose",xae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=no(TU,n);return a.jsx(qt.button,{type:"button",...r,ref:t,onClick:Nt(e.onClick,()=>s.onOpenChange(!1))})});xae.displayName=TU;var bae="PopoverArrow",vae=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=rh(n);return a.jsx(X3,{...s,...r,ref:t})});vae.displayName=bae;function CU(e){return e?"open":"closed"}var yae=vU,wae=NU,Nae=SU,kU=EU;const Va=yae,Ya=wae,Ta=p.forwardRef(({className:e,align:t="start",sideOffset:n=4,...r},s)=>a.jsx(Nae,{children:a.jsx(kU,{ref:s,align:t,sideOffset:n,className:Ve("z-50 w-auto p-0 rounded-lg border border-white/20 bg-black text-white shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Ta.displayName=kU.displayName;const kC=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M20 3H2v14h8v2H8v2h8v-2h-2v-2h8V3h-2zm-6 12H4V5h16v10h-6z",fill:"currentColor"})}),qh=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M7 8H5v2h2v2h2v2h2v2h2v-2h2v-2h2v-2h2V8h-2v2h-2v2h-2v2h-2v-2H9v-2H7V8z",fill:"currentColor"})}),md=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})}),Cd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M18 6h2v2h-2V6zm-2 4V8h2v2h-2zm-2 2v-2h2v2h-2zm-2 2h2v-2h-2v2zm-2 2h2v-2h-2v2zm-2 0v2h2v-2H8zm-2-2h2v2H6v-2zm0 0H4v-2h2v2z",fill:"currentColor"})}),dr=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2h2v2h4v18H3V4h4V2h2v2h6V2zM9 6H5v2h14V6H9zm-4 4v10h14V10H5zm2 2h8v2H7v-2zm4 6v-2H7v2h4z",fill:"currentColor"})}),Sae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M2 2h14v4h6v16H2V2zm18 6h-4v2h2v2h-2v2h2v2h-2v2h2v2h2V8zm-6-4H4v16h2v-2h6v2h2V4zM6 6h2v2H6V6zm6 0h-2v2h2V6zm-6 4h2v2H6v-2zm6 0h-2v2h2v-2zm-6 4h2v2H6v-2zm6 0h-2v2h2v-2z",fill:"currentColor"})}),Eae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M20 11v2H8v2H6v-2H4v-2h2V9h2v2h12zM10 7H8v2h2V7zm0 0h2V5h-2v2zm0 10H8v-2h2v2zm0 0h2v2h-2v-2z",fill:"currentColor"})}),bi=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M4 11v2h12v2h2v-2h2v-2h-2V9h-2v2H4zm10-4h2v2h-2V7zm0 0h-2V5h2v2zm0 10h2v-2h-2v2zm0 0h-2v2h2v-2z",fill:"currentColor"})}),AU=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M3 3h18v18H3V3zm16 2H5v14h14V5zM7 12h2v5H7v-5zm10-5h-2v10h2V7zm-6 3h2v2h-2v-2zm2 4h-2v3h2v-3z",fill:"currentColor"})}),ys=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M22 4H2v16h20V4zM4 18V6h16v12H4zM8 8H6v2h2v2h2v2h4v-2h2v-2h2V8h-2v2h-2v2h-4v-2H8V8z",fill:"currentColor"})}),_U=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M6 2h8v2H6V2zM4 6V4h2v2H4zm0 8H2V6h2v8zm2 2H4v-2h2v2zm8 0v2H6v-2h8zm2-2h-2v2h2v2h2v2h2v2h2v-2h-2v-2h-2v-2h-2v-2zm0-8h2v8h-2V6zm0 0V4h-2v2h2z",fill:"currentColor"})}),gd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h12v2H6v4h12v-4h2v6H4v-6z",fill:"currentColor"})}),Ot=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M11 0H5v2H3v6h2v2h6V8H5V2h6V0zm0 2h2v6h-2V2zM0 14h2v4h12v2H0v-6zm2 0h12v-2H2v2zm14 0h-2v6h2v-6zM15 0h4v2h-4V0zm4 8h-4v2h4V8zm0-6h2v6h-2V2zm5 12h-2v4h-4v2h6v-6zm-6-2h4v2h-4v-2z",fill:"currentColor"})}),dt=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M5 5h2v2H5V5zm4 4H7V7h2v2zm2 2H9V9h2v2zm2 0h-2v2H9v2H7v2H5v2h2v-2h2v-2h2v-2h2v2h2v2h2v2h2v-2h-2v-2h-2v-2h-2v-2zm2-2v2h-2V9h2zm2-2v2h-2V7h2zm0 0V5h2v2h-2z",fill:"currentColor"})}),RU=({className:e="",size:t=24})=>a.jsx(_N,{size:t,className:Ve(e,"w-4 h-4")}),Rs=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M2 4h20v4H2V4zm18 2v2H4V6h16zm0 6H2v4h18v-4zm-2 2v2H4v-2h14zM2 16h20v4H2v-4zm18 2v2H4v-2h16z",fill:"currentColor"})}),jae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 4c2.21 0 4 1.79 4 4s-1.79 4-4 4-4-1.79-4-4 1.79-4 4-4zm0 6c1.38 0 2.5-1.12 2.5-2.5S13.38 11.5 12 11.5 9.5 12.62 9.5 14 10.62 16.5 12 16.5z",fill:"currentColor"})}),ax=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h8v2H6v4h8v-4h2v6H4v-6zm10-4h-2v2h2v-2z",fill:"currentColor"})}),Yd=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M15 2H9v2H7v6h2V4h6V2zm0 8H9v2h6v-2zm0-6h2v6h-2V4zM4 16h2v-2h8v2H6v4h8v-4h2v6H4v-6zm12-6h-2v2h2v2h2v-2h-2v-2z",fill:"currentColor"})}),rx=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-1.57.46-3.03 1.24-4.26L16.26 18.76C15.03 19.54 13.57 20 12 20zm6.76-3.74L7.74 5.24C8.97 4.46 10.43 4 12 4c4.41 0 8 3.59 8 8 0 1.57-.46 3.03-1.24 4.26z",fill:"currentColor"})}),hn=e=>a.jsx(er,{...e,className:"w-4 h-4 animate-spin"}),Tae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M6 2h12v2H6V2zm0 2v16h12V4H6zm8 2H10v2h4V6zm-4 4h4v8h-4v-8z",fill:"currentColor"})}),Cae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M8 4h2v4h4V4h2v4h4v2h-4v4h4v2h-4v4h-2v-4H8v4H6v-4H2v-2h4V8H2V6h4V4zm2 6v4h4v-4h-4z",fill:"currentColor"})}),ka=({className:e="",size:t=24})=>a.jsx(Sae,{className:e,size:t}),AC=({className:e="",size:t=24})=>a.jsx(AU,{className:e,size:t}),va=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M4 2h12v2H4v12H2V2h2zm4 4h12v16H8V6zm2 2v12h8V8h-8z",fill:"currentColor"})}),OU=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2h2v2h-2V2zm-2 4H8v2H6v2h2v2h2v-2h2V8h-2V6zm6 0h-2v2h2V6zm2 0h2v2h-2V6zm-6 8h-2v-2h2v2zm-4 0H6v-2h2v2zm-4 0H2v-2h2v2zm8 4h-2v-2h2v2zm4 0h2v-2h-2v2zm-6 2h2v2h-2v-2zm4 0h2v2h-2v-2z",fill:"currentColor"})}),kae=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2h2v2h-2V2zm-2 4h6v2h-2v6h-2V8H8V6zm-4 8h12v2H4v-2zm0 4h12v2H4v-2z",fill:"currentColor"})}),yf=({className:e="",size:t=24})=>a.jsx(nW,{className:Ve(e,"w-4 h-4"),size:t}),_C=({className:e="",size:t=24})=>a.jsx(m3,{className:Ve(e,"w-4 h-4"),size:t}),Ep=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-5l6-6-1.41-1.41L11 12.17l-2.59-2.58L7 10.59l4 4z",fill:"currentColor"})}),RC=({className:e="",size:t=24})=>a.jsx("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,width:t,height:t,children:a.jsx("path",{d:"M12 1h2v8h8v4h-2v-2h-8V5h-2V1zM8 7V5h2v2H8zM6 9V7h2v2H6zm-2 2V9h2v2H4zm10 8v2h-2v2h-2v-8H2v-4h2v2h8v6h2zm2-2v2h-2v-2h2zm2-2v2h-2v-2h2zm0 0h2v-2h-2v2z",fill:"currentColor"})}),Bi=(e,t,n)=>{const r=document.createElement(e),[s,i]=Array.isArray(t)?[void 0,t]:[t,n];return s&&Object.assign(r,s),i==null||i.forEach(o=>r.appendChild(o)),r},Aae=(e,t)=>{var n;return t==="left"?e.offsetLeft:(((n=e.offsetParent instanceof HTMLElement?e.offsetParent:null)==null?void 0:n.offsetWidth)??0)-e.offsetWidth-e.offsetLeft},_ae=e=>e.offsetWidth>0&&e.offsetHeight>0,Rae=(e,t)=>{!customElements.get(e)&&customElements.define(e,t)};function Oae(e,t,{reverse:n=!1}={}){const r=e.length;for(let s=n?r-1:0;n?s>=0:s<r;n?s--:s++)t(e[s],s)}function Dae(e,t,n,r){const s=t.formatToParts(e);n&&s.unshift({type:"prefix",value:n}),r&&s.push({type:"suffix",value:r});const i=[],o=[],l=[],c=[],u={},h=b=>`${b}:${u[b]=(u[b]??-1)+1}`;let d="",f=!1,m=!1;for(const b of s){d+=b.value;const w=b.type==="minusSign"||b.type==="plusSign"?"sign":b.type;w==="integer"?(f=!0,o.push(...b.value.split("").map(x=>({type:w,value:parseInt(x)})))):w==="group"?o.push({type:w,value:b.value}):w==="decimal"?(m=!0,l.push({type:w,value:b.value,key:h(w)})):w==="fraction"?l.push(...b.value.split("").map(x=>({type:w,value:parseInt(x),key:h(w),pos:-1-u[w]}))):(f||m?c:i).push({type:w,value:b.value,key:h(w)})}const y=[];for(let b=o.length-1;b>=0;b--){const w=o[b];y.unshift(w.type==="integer"?{...w,key:h(w.type),pos:u[w.type]}:{...w,key:h(w.type)})}return{pre:i,integer:y,fraction:l,post:c,valueAsString:d,value:typeof e=="string"?parseFloat(e):e}}const Iae=String.raw,Mae=(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})(),Lae=typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)"),OC=typeof matchMedia<"u"?matchMedia("(prefers-reduced-motion: reduce)"):null,jp="--_number-flow-d-opacity",XS="--_number-flow-d-width",Tp="--_number-flow-dx",KS="--_number-flow-d",Uae=(()=>{try{return CSS.registerProperty({name:jp,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:Tp,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:XS,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:KS,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),Pae="var(--number-flow-char-height, 1em)",mi="var(--number-flow-mask-height, 0.25em)",DC=`calc(${mi} / 2)`,WN="var(--number-flow-mask-width, 0.5em)",uo=`calc(${WN} / var(--scale-x))`,Gh="#000 0, transparent 71%",IC=Iae`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:${Pae} !important}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${XS}) / var(--width));transform:translateX(var(${Tp})) scaleX(var(--scale-x));margin:0 calc(-1 * ${WN});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${uo},#000 calc(100% - ${uo}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${mi},#000 calc(100% - ${mi}),transparent 100% ),radial-gradient(at bottom right,${Gh}),radial-gradient(at bottom left,${Gh}),radial-gradient(at top left,${Gh}),radial-gradient(at top right,${Gh});-webkit-mask-size:100% calc(100% - ${mi} * 2),calc(100% - ${uo} * 2) 100%,${uo} ${mi},${uo} ${mi},${uo} ${mi},${uo} ${mi};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${DC} ${WN};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${Tp})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${KS})}.digit__num,.number .section::after{padding:${DC} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${jp}))}`,Fae=HTMLElement,Bae=Lae&&Mae&&Uae;let Vh;class DU extends Fae{constructor(){super(),this.created=!1,this.batched=!1;const{animated:t,...n}=this.constructor.defaultProps;this._animated=this.computedAnimated=t,Object.assign(this,n)}get animated(){return this._animated}set animated(t){var n;this.animated!==t&&(this._animated=t,(n=this.shadowRoot)==null||n.getAnimations().forEach(r=>r.finish()))}set data(t){var n;if(t==null)return;const{pre:r,integer:s,fraction:i,post:o,value:l}=t;if(this.created){const c=this._data;this._data=t,this.computedTrend=typeof this.trend=="function"?this.trend(c.value,l):this.trend,this.computedAnimated=Bae&&this._animated&&(!this.respectMotionPreference||!(OC!=null&&OC.matches))&&_ae(this),(n=this.plugins)==null||n.forEach(u=>{var h;return(h=u.onUpdate)==null?void 0:h.call(u,t,c,this)}),this.batched||this.willUpdate(),this._pre.update(r),this._num.update({integer:s,fraction:i}),this._post.update(o),this.batched||this.didUpdate()}else{this._data=t,this.attachShadow({mode:"open"});try{this._internals??(this._internals=this.attachInternals()),this._internals.role="img"}catch{}if(typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)Vh||(Vh=new CSSStyleSheet,Vh.replaceSync(IC)),this.shadowRoot.adoptedStyleSheets=[Vh];else{const c=document.createElement("style");c.textContent=IC,this.shadowRoot.appendChild(c)}this._pre=new LC(this,r,{justify:"right",part:"left"}),this.shadowRoot.appendChild(this._pre.el),this._num=new zae(this,s,i),this.shadowRoot.appendChild(this._num.el),this._post=new LC(this,o,{justify:"left",part:"right"}),this.shadowRoot.appendChild(this._post.el),this.created=!0}try{this._internals.ariaLabel=t.valueAsString}catch{}}willUpdate(){this._pre.willUpdate(),this._num.willUpdate(),this._post.willUpdate()}didUpdate(){if(!this.computedAnimated)return;this._abortAnimationsFinish?this._abortAnimationsFinish.abort():this.dispatchEvent(new Event("animationsstart")),this._pre.didUpdate(),this._num.didUpdate(),this._post.didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(n=>n.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),this._abortAnimationsFinish=void 0)}),this._abortAnimationsFinish=t}}DU.defaultProps={transformTiming:{duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"},spinTiming:void 0,opacityTiming:{duration:450,easing:"ease-out"},animated:!0,trend:(e,t)=>Math.sign(t-e),respectMotionPreference:!0,plugins:void 0,digits:void 0};class zae{constructor(t,n,r,{className:s,...i}={}){this.flow=t,this._integer=new MC(t,n,{justify:"right",part:"integer"}),this._fraction=new MC(t,r,{justify:"left",part:"fraction"}),this._inner=Bi("span",{className:"number__inner"},[this._integer.el,this._fraction.el]),this.el=Bi("span",{...i,part:"number",className:`number ${s??""}`},[this._inner])}willUpdate(){this._prevWidth=this.el.offsetWidth,this._prevLeft=this.el.getBoundingClientRect().left,this._integer.willUpdate(),this._fraction.willUpdate()}update({integer:t,fraction:n}){this._integer.update(t),this._fraction.update(n)}didUpdate(){const t=this.el.getBoundingClientRect();this._integer.didUpdate(),this._fraction.didUpdate();const n=this._prevLeft-t.left,r=this.el.offsetWidth,s=this._prevWidth-r;this.el.style.setProperty("--width",String(r)),this.el.animate({[Tp]:[`${n}px`,"0px"],[XS]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}class IU{constructor(t,n,{justify:r,className:s,...i},o){this.flow=t,this.children=new Map,this.onCharRemove=c=>()=>{this.children.delete(c)},this.justify=r;const l=n.map(c=>this.addChar(c).el);this.el=Bi("span",{...i,className:`section section--justify-${r} ${s??""}`},o?o(l):l)}addChar(t,{startDigitsAtZero:n=!1,...r}={}){const s=t.type==="integer"||t.type==="fraction"?new LU(this,t.type,n?0:t.value,t.pos,{...r,onRemove:this.onCharRemove(t.key)}):new $ae(this,t.type,t.value,{...r,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.removeAttribute("inert"),t.el.style.top="",t.el.style[this.justify]=""}pop(t){t.forEach(n=>{n.el.style.top=`${n.el.offsetTop}px`,n.el.style[this.justify]=`${Aae(n.el,this.justify)}px`}),t.forEach(n=>{n.el.setAttribute("inert",""),n.present=!1})}addNewAndUpdateExisting(t){const n=new Map,r=new Map,s=this.justify==="left",i=s?"prepend":"append";if(Oae(t,o=>{let l;this.children.has(o.key)?(l=this.children.get(o.key),r.set(o,l),this.unpop(l),l.present=!0):(l=this.addChar(o,{startDigitsAtZero:!0,animateIn:!0}),n.set(o,l)),this.el[i](l.el)},{reverse:s}),this.flow.computedAnimated){const o=this.el.getBoundingClientRect();n.forEach(l=>{l.willUpdate(o)})}n.forEach((o,l)=>{o.update(l.value)}),r.forEach((o,l)=>{o.update(l.value)})}willUpdate(){const t=this.el.getBoundingClientRect();this._prevOffset=t[this.justify],this.children.forEach(n=>n.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const n=t[this.justify],r=this._prevOffset-n;r&&this.children.size&&this.el.animate({transform:[`translateX(${r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}class MC extends IU{update(t){const n=new Map;this.children.forEach((r,s)=>{t.find(i=>i.key===s)||n.set(s,r),this.unpop(r)}),this.addNewAndUpdateExisting(t),n.forEach(r=>{r instanceof LU&&r.update(0)}),this.pop(n)}}class LC extends IU{update(t){const n=new Map;this.children.forEach((r,s)=>{t.find(i=>i.key===s)||n.set(s,r)}),this.pop(n),this.addNewAndUpdateExisting(t)}}class XN{constructor(t,n,{onRemove:r,animateIn:s=!1}={}){this.flow=t,this.el=n,this._present=!0,this._remove=()=>{var i;this.el.remove(),(i=this._onRemove)==null||i.call(this)},this.el.classList.add("animate-presence"),this.flow.computedAnimated&&s&&this.el.animate({[jp]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),this._onRemove=r}get present(){return this._present}set present(t){if(this._present!==t){if(this._present=t,t?this.el.removeAttribute("inert"):this.el.setAttribute("inert",""),!this.flow.computedAnimated){t||this._remove();return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[jp]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",this._remove):this.flow.addEventListener("animationsfinish",this._remove,{once:!0})}}}class MU extends XN{constructor(t,n,r,s){super(t.flow,r,s),this.section=t,this.value=n,this.el=r}}class LU extends MU{constructor(t,n,r,s,i){var o,l;const c=(((l=(o=t.flow.digits)==null?void 0:o[s])==null?void 0:l.max)??9)+1,u=Array.from({length:c}).map((d,f)=>{const m=Bi("span",{className:"digit__num"},[document.createTextNode(String(f))]);return f!==r&&m.setAttribute("inert",""),m.style.setProperty("--n",String(f)),m}),h=Bi("span",{part:`digit ${n}-digit`,className:"digit"},u);h.style.setProperty("--current",String(r)),h.style.setProperty("--length",String(c)),super(t,r,h,i),this.pos=s,this._onAnimationsFinish=()=>{this.el.classList.remove("is-spinning")},this._numbers=u,this.length=c}willUpdate(t){const n=this.el.getBoundingClientRect();this._prevValue=this.value;const r=n[this.section.justify]-t[this.section.justify],s=n.width/2;this._prevCenter=this.section.justify==="left"?r+s:r-s}update(t){this.el.style.setProperty("--current",String(t)),this._numbers.forEach((n,r)=>r===t?n.removeAttribute("inert"):n.setAttribute("inert","")),this.value=t}didUpdate(t){const n=this.el.getBoundingClientRect(),r=n[this.section.justify]-t[this.section.justify],s=n.width/2,i=this.section.justify==="left"?r+s:r-s,o=this._prevCenter-i;o&&this.el.animate({transform:[`translateX(${o}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const l=this.getDelta();l&&(this.el.classList.add("is-spinning"),this.el.animate({[KS]:[-l,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",this._onAnimationsFinish,{once:!0}))}getDelta(){var t;if(this.flow.plugins)for(const s of this.flow.plugins){const i=(t=s.getDelta)==null?void 0:t.call(s,this.value,this._prevValue,this);if(i!=null)return i}const n=this.value-this._prevValue,r=this.flow.computedTrend||Math.sign(n);return r<0&&this.value>this._prevValue?this.value-this.length-this._prevValue:r>0&&this.value<this._prevValue?this.length-this._prevValue+this.value:n}}class $ae extends MU{constructor(t,n,r,s){const i=Bi("span",{className:"symbol__value",textContent:r});super(t,r,Bi("span",{part:`symbol ${n}`,className:"symbol"},[i]),s),this.type=n,this._children=new Map,this._onChildRemove=o=>()=>{this._children.delete(o)},this._children.set(r,new XN(this.flow,i,{onRemove:this._onChildRemove(r)}))}willUpdate(t){if(this.type==="decimal")return;const n=this.el.getBoundingClientRect();this._prevOffset=n[this.section.justify]-t[this.section.justify]}update(t){if(this.value!==t){const n=this._children.get(this.value);n&&(n.present=!1);const r=this._children.get(t);if(r)r.present=!0;else{const s=Bi("span",{className:"symbol__value",textContent:t});this.el.appendChild(s),this._children.set(t,new XN(this.flow,s,{animateIn:!0,onRemove:this._onChildRemove(t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const n=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify],r=this._prevOffset-n;r&&this.el.animate({transform:[`translateX(${r}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}var f4;const Hae=parseInt((f4=p.version.match(/^(\d+)\./))==null?void 0:f4[1]),ZS=Hae>=19,qae=["data","digits"];class QS extends DU{attributeChangedCallback(t,n,r){this[t]=JSON.parse(r)}}QS.observedAttributes=ZS?[]:qae;Rae("number-flow-react",QS);const sx={},UC=ZS?e=>e:JSON.stringify;function PC(e){const{transformTiming:t,spinTiming:n,opacityTiming:r,animated:s,respectMotionPreference:i,trend:o,plugins:l,...c}=e;return[{transformTiming:t,spinTiming:n,opacityTiming:r,animated:s,respectMotionPreference:i,trend:o,plugins:l},c]}class Gae extends p.Component{updateProperties(t){if(!this.el)return;this.el.batched=!this.props.isolate;const[n]=PC(this.props);Object.entries(n).forEach(([r,s])=>{this.el[r]=s??QS.defaultProps[r]}),t!=null&&t.onAnimationsStart&&this.el.removeEventListener("animationsstart",t.onAnimationsStart),this.props.onAnimationsStart&&this.el.addEventListener("animationsstart",this.props.onAnimationsStart),t!=null&&t.onAnimationsFinish&&this.el.removeEventListener("animationsfinish",t.onAnimationsFinish),this.props.onAnimationsFinish&&this.el.addEventListener("animationsfinish",this.props.onAnimationsFinish)}componentDidMount(){this.updateProperties(),ZS&&this.el&&(this.el.digits=this.props.digits,this.el.data=this.props.data)}getSnapshotBeforeUpdate(t){var n;if(this.updateProperties(t),t.data!==this.props.data){if(this.props.group)return this.props.group.willUpdate(),()=>{var r;return(r=this.props.group)==null?void 0:r.didUpdate()};if(!this.props.isolate)return(n=this.el)==null||n.willUpdate(),()=>{var r;return(r=this.el)==null?void 0:r.didUpdate()}}return null}componentDidUpdate(t,n,r){r==null||r()}handleRef(t){this.props.innerRef&&(this.props.innerRef.current=t),this.el=t}render(){const[t,{innerRef:n,className:r,data:s,willChange:i,isolate:o,group:l,digits:c,onAnimationsStart:u,onAnimationsFinish:h,...d}]=PC(this.props);return p.createElement("number-flow-react",{ref:this.handleRef,"data-will-change":i?"":void 0,class:r,...d,dangerouslySetInnerHTML:{__html:""},suppressHydrationWarning:!0,digits:UC(c),data:UC(s)})}constructor(t){super(t),this.handleRef=this.handleRef.bind(this)}}const Vae=p.forwardRef(function({value:t,locales:n,format:r,prefix:s,suffix:i,...o},l){p.useImperativeHandle(l,()=>c.current,[]);const c=p.useRef(),u=p.useContext(Yae);u==null||u.useRegister(c);const h=p.useMemo(()=>n?JSON.stringify(n):"",[n]),d=p.useMemo(()=>r?JSON.stringify(r):"",[r]),f=p.useMemo(()=>{var y;const m=sx[y=`${h}:${d}`]??(sx[y]=new Intl.NumberFormat(n,r));return Dae(t,m,s,i)},[t,h,d,s,i]);return p.createElement(Gae,{...o,group:u,data:f,innerRef:c})}),Yae=p.createContext(void 0),Wae={notation:"compact",maximumFractionDigits:1};function _n({value:e,loading:t=!1,className:n,prefix:r,suffix:s,format:i,trend:o,fallback:l="…"}){const c=p.useMemo(()=>{if(e==null)return 0;const d=Number(e);return Number.isFinite(d)?d:0},[e]);if(t)return a.jsxs("span",{className:mp("inline-flex items-baseline",n),children:[r,l,s]});const u=Vae,h=typeof o=="boolean"?o?1:0:o;return a.jsxs("span",{className:mp("inline-flex",n),children:[r,a.jsx(u,{value:c,format:i??Wae,trend:h,className:"inline-flex"}),s]})}function Jt({id:e,label:t="ID",className:n="",variant:r="inline",nonSliced:s=!1}){const[i,o]=p.useState(!1),l=async()=>{try{await navigator.clipboard.writeText(e),o(!0),V.success("Copied to clipboard"),setTimeout(()=>o(!1),2e3)}catch{V.error("Failed to copy to clipboard")}};return r==="detail"?a.jsxs("div",{className:`flex justify-between items-center ${n}`,children:[a.jsxs("span",{className:"text-gray-400",children:[t,":"]}),a.jsxs("button",{onClick:l,className:"flex items-center gap-2 text-white text-sm hover:text-white/80 transition-colors group",title:"Click to copy",children:[a.jsx("span",{className:"font-mono",children:e}),i?a.jsx(wu,{className:"w-3 h-3 text-green-500"}):a.jsx(Ec,{className:"w-3 h-3 text-gray-400 group-hover:text-white transition-colors"})]})]}):r==="subscript"?a.jsxs("sup",{onClick:l,className:`text-xs text-gray-500 ml-2 cursor-pointer hover:text-white transition-colors inline-flex items-center gap-1 ${n}`,title:"Click to copy User ID",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:s?e:e.slice(0,8)}),a.jsx("span",{className:"ml-1",children:"]"})]}):a.jsxs("button",{onClick:l,className:`flex items-center gap-1.5 text-sm text-gray-400 hover:text-white transition-colors group ${n}`,title:"Click to copy",children:[a.jsxs("span",{children:[t,":"]}),a.jsx("span",{className:"font-mono",children:e}),i?a.jsx(wu,{className:"w-3 h-3 text-green-500"}):a.jsx(Ec,{className:"w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ki({title:e="Seeding Terminal",lines:t,isRunning:n=!1,className:r="",defaultCollapsed:s=!1}){const[i,o]=p.useState(s),l=p.useRef(null);p.useEffect(()=>{const d=l.current;!d||i||d.scrollTo({top:d.scrollHeight,behavior:"smooth"})},[i]);const c=d=>{switch(d.type){case"success":return a.jsx(Sn,{className:"w-3 h-3 text-green-400"});case"error":return a.jsx(Ns,{className:"w-3 h-3 text-red-400"});case"progress":return d.status==="running"?a.jsx(er,{className:"w-3 h-3 text-blue-400 animate-spin"}):d.status==="completed"?a.jsx(Sn,{className:"w-3 h-3 text-green-400"}):d.status==="failed"?a.jsx(Ns,{className:"w-3 h-3 text-red-400"}):a.jsx("div",{className:"w-3 h-3 border border-gray-500 rounded-full"});default:return a.jsx("div",{className:"w-3 h-3 border border-gray-500 rounded-full"})}},u=d=>{switch(d.type){case"success":return"text-green-400";case"error":return"text-red-400";case"progress":return d.status==="running"?"text-blue-400":d.status==="completed"?"text-green-400":d.status==="failed"?"text-red-400":"text-gray-400";default:return"text-gray-300"}},h=d=>d.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+d.getMilliseconds().toString().padStart(3,"0");return a.jsxs("div",{className:`bg-black/90 border border-dashed border-white/20 rounded-none font-mono text-xs ${r}`,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-dashed border-white/10",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(tW,{className:"w-3 h-3 text-green-400"}),a.jsx("span",{className:"text-green-400 font-medium text-xs",children:e})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[n&&a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full animate-pulse"}),a.jsx("span",{className:"text-green-400 text-xs",children:"RUNNING"})]}),a.jsxs("div",{className:"text-gray-400 text-xs",children:[t.length," / ",t.length]}),a.jsx("button",{onClick:()=>o(!i),className:"text-gray-400 hover:text-white transition-colors",children:i?a.jsx(Zu,{className:"w-3 h-3"}):a.jsx(f3,{className:"w-3 h-3"})})]})]}),!i&&a.jsxs("div",{ref:l,className:"p-3 space-y-0.5 h-56 overflow-y-auto",children:[t.length===0?a.jsxs("div",{className:"text-gray-500 italic text-xs",children:[a.jsx("span",{className:"text-green-400",children:"$"})," Waiting for operations..."]}):t.map(d=>a.jsxs("div",{className:`flex items-start space-x-3 py-1 ${u(d)} text-xs`,children:[a.jsx("span",{className:"text-gray-500 text-xs w-20 flex-shrink-0",children:h(d.timestamp)}),a.jsx("span",{className:"text-green-400 flex-shrink-0",children:"$"}),a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:c(d)}),a.jsx("span",{className:"flex-1 min-w-0 break-words",children:d.message})]},d.id)),n&&a.jsxs("div",{className:"flex items-start space-x-3 py-1 text-green-400 text-xs",children:[a.jsx("span",{className:"text-gray-500 text-xs w-20 flex-shrink-0",children:h(new Date)}),a.jsx("span",{className:"text-green-400 flex-shrink-0",children:"$"}),a.jsx("div",{className:"w-3 h-3 flex-shrink-0 mt-0.5"}),a.jsx("span",{className:"flex-1 flex items-center",children:a.jsx("span",{className:"animate-pulse",children:"█"})})]})]}),!i&&a.jsx("div",{className:"px-3 py-1.5 border-t border-dashed border-white/10 bg-black/50",children:a.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("span",{children:["Status: ",n?"Active":"Idle"]}),a.jsxs("span",{children:["Lines: ",t.length]})]}),a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full"}),a.jsx("span",{children:"Better Auth Studio"})]})]})})]})}const UU=document.createElement("style");UU.textContent=`
513
513
  @keyframes fadeIn {
514
514
  from {
515
515
  opacity: 0;
@@ -524,9 +524,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
524
524
  .animate-fadeIn {
525
525
  animation: fadeIn 0.3s ease-out forwards;
526
526
  }
527
- `;document.head.appendChild(UU);const ve=p.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:`flex h-10 w-full border border-dashed border-white/20 bg-black/30 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,ref:r,...n}));ve.displayName="Input";const ie=p.forwardRef(({className:e,...t},n)=>a.jsx("label",{className:`text-sm font-light text-white ${e}`,ref:n,...t}));ie.displayName="Label";function PU({currentPage:e,totalPages:t,onPageChange:n,totalItems:r,startIndex:s,endIndex:i}){const o=()=>{const u=[],h=[];for(let d=Math.max(2,e-2);d<=Math.min(t-1,e+2);d++)u.push(d);return e-2>2?h.push(1,"..."):h.push(1),h.push(...u),e+2<t-1?h.push("...",t):t>1&&h.push(t),h};if(t<=1)return null;const l=o();return a.jsxs("div",{className:"flex items-center justify-between mt-6",children:[a.jsxs("div",{className:"text-sm text-gray-400",children:["Showing ",s+1," to ",Math.min(i,r)," of ",r," items"]}),a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:e===1,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(h3,{className:"w-4 h-4"}),"Previous"]}),l.map((c,u)=>{if(c==="...")return a.jsx(z,{variant:"outline",size:"sm",disabled:!0,className:"border border-dashed border-white/20 text-white rounded-none",children:a.jsx(ZY,{className:"w-4 h-4"})},`dots-${u}`);const h=c,d=e===h;return a.jsx(z,{variant:d?"default":"outline",size:"sm",onClick:()=>n(h),className:d?"bg-white text-black rounded-none":"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:h},h)}),a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:["Next",a.jsx(ES,{className:"w-4 h-4"})]})]})]})}const sh=p.createContext({isOpen:!1,setIsOpen:()=>{}}),pn=p.forwardRef(({className:e,value:t,onValueChange:n,children:r,...s},i)=>{const[o,l]=p.useState(!1);return a.jsx(sh.Provider,{value:{value:t,onValueChange:n,isOpen:o,setIsOpen:l},children:a.jsx("div",{ref:i,className:`relative ${e}`,...s,children:r})})});pn.displayName="Select";const mn=p.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:s,setIsOpen:i}=p.useContext(sh);return a.jsxs("button",{ref:r,type:"button",className:`flex h-10 w-full items-center justify-between border bg-black/30 px-3 py-2 text-sm text-white focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,onClick:()=>i(!s),...n,children:[t,a.jsx(Zu,{className:`h-4 w-4 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})});mn.displayName="SelectTrigger";const zn=p.forwardRef(({className:e,placeholder:t,...n},r)=>{const{value:s}=p.useContext(sh);return a.jsx("span",{ref:r,className:`text-sm text-white ${e}`,...n,children:s||t})});zn.displayName="SelectValue";const gn=p.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:s}=p.useContext(sh);return s?a.jsx("div",{ref:r,className:`absolute top-full left-0 right-0 z-[100] mt-1 border border-dashed border-white/20 bg-black rounded-none shadow-lg max-h-60 overflow-y-auto ${e}`,...n,children:t}):null});gn.displayName="SelectContent";const Pe=p.forwardRef(({className:e,children:t,value:n,...r},s)=>{const{onValueChange:i,setIsOpen:o}=p.useContext(sh);return a.jsx("div",{ref:s,className:`px-3 py-2 text-sm text-white hover:bg-white/10 cursor-pointer ${e}`,onClick:()=>{i==null||i(n),o(!1)},...r,children:t})});Pe.displayName="SelectItem";const FC=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function FU(){const e=ha(),{counts:t,refetchCounts:n}=bm(),[r,s]=p.useState([]),[i,o]=p.useState(!0),[l,c]=p.useState(null),[u,h]=p.useState(""),[d,f]=p.useState("all"),[m,y]=p.useState([]),[b,w]=p.useState(1),[x]=p.useState(20),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(null),[A,C]=p.useState([]),[T,O]=p.useState(!1),[q,k]=p.useState(!1),[M,$]=p.useState({name:"",slug:""}),[W,Y]=p.useState({name:"",slug:""});p.useEffect(()=>{re();const ce=setInterval(()=>{l!=null&&l.enabled||re()},2e3);return()=>clearInterval(ce)},[l==null?void 0:l.enabled]);const te=ce=>ce.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),ne=ce=>{const Te=te(ce);$({name:ce,slug:Te})},X=ce=>{$(Te=>({...Te,slug:te(ce)}))},se=ce=>{const Te=te(ce);Y({name:ce,slug:Te})},Ee=ce=>{Y(Te=>({...Te,slug:te(ce)}))},re=async()=>{try{const Te=await(await fetch("/api/plugins")).json(),Ze=(Te==null?void 0:Te.plugins).find(Q=>Q.id==="organization");c({enabled:!!Ze,availablePlugins:(Te==null?void 0:Te.plugins).map(Q=>Q.id),configPath:Te.configPath,organizationPlugin:(Te==null?void 0:Te.plugins).find(Q=>Q.id==="organization")}),Ze?await xe():o(!1)}catch(ce){console.error("Failed to check plugin status:",ce),c({enabled:!1,error:"Failed to check plugin status"}),o(!1)}},xe=async()=>{try{const Te=await(await fetch("/api/organizations?limit=10000")).json();console.log({lenght:Te.organizations.length}),s(Te.organizations||[])}catch(ce){console.error("Failed to fetch organizations:",ce),V.error("Failed to fetch organizations")}finally{o(!1)}},ye=async ce=>{C([]),O(!0),C([{id:"start",type:"info",message:`Starting organization seeding process for ${ce} organizations...`,timestamp:new Date}]);try{const Ze=await(await fetch("/api/seed/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:ce})})).json();if(Ze.success){const Q=Ze.results.map((be,_e)=>be.success?{id:`org-${_e}`,type:"progress",message:`Creating organization: ${be.organization.name} (${be.organization.slug})`,timestamp:new Date,status:"completed"}:{id:`org-${_e}`,type:"error",message:`Failed to create organization ${_e+1}: ${be.error}`,timestamp:new Date});C(be=>[...be,...Q]);const pe=Ze.results.filter(be=>be.success).length;C(be=>[...be,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${pe}/${ce} organizations successfully`,timestamp:new Date}]),await xe(),await n()}else C(Q=>[...Q,{id:"error",type:"error",message:`❌ Seeding failed: ${Ze.error||"Unknown error"}`,timestamp:new Date}])}catch(Te){C(Ze=>[...Ze,{id:"error",type:"error",message:`❌ Network error: ${Te}`,timestamp:new Date}])}finally{O(!1)}},ze=ce=>{I(ce),U(!0)},He=ce=>{I(ce),Y({name:ce.name,slug:ce.slug}),j(!0)},Fe=ce=>{I(ce),L(!0)},Ye=async()=>{if(!M.name){V.error("Please fill in the organization name");return}const ce=V.loading("Creating organization...");try{const Ze=await(await fetch("/api/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:M.name,slug:M.slug})})).json();Ze.success?(await xe(),g(!1),$({name:"",slug:""}),V.success("Organization created successfully!",{id:ce})):V.error(`Error creating organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error creating organization:",Te),V.error("Error creating organization",{id:ce})}},ft=async()=>{if(!_){V.error("No organization selected");return}if(!W.name){V.error("Please fill in the organization name");return}k(!0);const ce=V.loading("Updating organization...");try{const Ze=await(await fetch(`/api/organizations/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name,slug:W.slug})})).json();Ze.success?(await xe(),j(!1),I(null),Y({name:"",slug:""}),V.success("Organization updated successfully!",{id:ce})):V.error(`Error updating organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error updating organization:",Te),V.error("Error updating organization",{id:ce})}finally{k(!1)}},et=async()=>{if(!_){V.error("No organization selected");return}const ce=V.loading("Deleting organization...");try{const Ze=await(await fetch(`/api/organizations/${_.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ze.success?(await xe(),await n(),L(!1),I(null),V.success("Organization deleted successfully!",{id:ce})):V.error(`Error deleting organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error deleting organization:",Te),V.error("Error deleting organization",{id:ce})}},de=()=>{if(r.length===0){V.error("No organizations to export");return}const ce=["ID","Name","Slug","Created At","Updated At"],Te=r.map(_e=>[_e.id,_e.name||"",_e.slug||"",new Date(_e.createdAt).toLocaleString(),new Date(_e.updatedAt).toLocaleString()]),Ze=[ce.join(","),...Te.map(_e=>_e.map($e=>`"${$e}"`).join(","))].join(`
528
- `),Q=new Blob([Ze],{type:"text/csv;charset=utf-8;"}),pe=document.createElement("a"),be=URL.createObjectURL(Q);pe.setAttribute("href",be),pe.setAttribute("download",`organizations-export-${new Date().toISOString().split("T")[0]}.csv`),pe.style.visibility="hidden",document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),V.success(`Exported ${r.length} organizations to CSV`)},Be=ce=>{m.some(Te=>Te.type===ce)||y([...m,{type:ce}])},Ue=ce=>{y(m.filter(Te=>Te.type!==ce))},Oe=()=>{y([])},We=(ce,Te)=>{y(Ze=>Ze.map(Q=>Q.type===ce?{...Q,dateRange:Te}:Q))},nt=r.filter(ce=>{const Te=ce.name.toLowerCase().includes(u.toLowerCase())||ce.slug.toLowerCase().includes(u.toLowerCase());if(m.length===0)return Te;const Ze=m.every(Q=>{var pe,be,_e,$e;switch(Q.type){case"createdAt":{if(!((pe=Q.dateRange)!=null&&pe.from)&&!((be=Q.dateRange)!=null&&be.to))return!0;const je=new Date(ce.createdAt);return!((_e=Q.dateRange)!=null&&_e.from&&Q.dateRange.from>je||($e=Q.dateRange)!=null&&$e.to&&Q.dateRange.to<je)}default:return!0}});return Te&&Ze}),lt=Math.ceil(nt.length/x),Ut=(b-1)*x,Kt=Ut+x,Gt=nt.slice(Ut,Kt),_t=ce=>{w(ce)};return i?a.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading organizations..."})]})}):l&&!l.enabled?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl text-white font-light",children:"Organizations"}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application organizations"})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Mr,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl text-white font-light font-mono uppercase mb-2",children:"Organization Plugin Required"}),a.jsx("p",{className:"text-gray-300 mb-6 text-sm",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsxs("li",{children:["Import the plugin in your auth configuration file",l.configPath&&a.jsxs("span",{className:"text-gray-400",children:[" (",l.configPath,")"]}),":"]})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),l.availablePlugins&&l.availablePlugins.length>0&&a.jsx("div",{className:"mb-4",children:a.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",l.availablePlugins.join(", ")]})}),a.jsx(z,{onClick:re,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Organizations",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:t.organizations??0,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your organizations and teams"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:de,children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>G(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>g(!0),children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Add Organization"]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search organizations...",value:u,onChange:ce=>h(ce.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs(pn,{value:"",onValueChange:Be,children:[a.jsx(mn,{className:"w-[180px]",children:a.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[a.jsx(Fi,{className:"w-4 h-4"}),a.jsx("span",{children:"Add Filter"})]})}),a.jsx(gn,{children:!m.some(ce=>ce.type==="createdAt")&&a.jsx(Pe,{value:"createdAt",children:"Created Date"})})]})}),m.length>0&&a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(z,{onClick:Oe,children:"Clear all"})})]}),m.length>0&&a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex flex-wrap gap-3",children:m.map(ce=>{var Te,Ze,Q,pe;return a.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[a.jsx(jS,{className:"w-3 h-3 text-white"}),ce.type==="createdAt"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Created:"}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(Te=ce.dateRange)!=null&&Te.from?Yn(ce.dateRange.from,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(Ze=ce.dateRange)==null?void 0:Ze.from,onSelect:be=>{var _e;return We("createdAt",{from:be,to:(_e=ce.dateRange)==null?void 0:_e.to})},initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(Q=ce.dateRange)!=null&&Q.to?Yn(ce.dateRange.to,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(pe=ce.dateRange)==null?void 0:pe.to,onSelect:be=>{var _e;return We("createdAt",{from:(_e=ce.dateRange)==null?void 0:_e.from,to:be})},initialFocus:!0,disabled:be=>{var _e;return(_e=ce.dateRange)!=null&&_e.from?be<ce.dateRange.from:!1},className:"rounded-none"})})]})]}),a.jsx("button",{onClick:()=>Ue(ce.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:a.jsx(an,{className:"w-3 h-3 text-white"})})]},ce.type)})})})]}),a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Organization"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Slug"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:nt.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-8 h-8 text-white/50"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium text-lg",children:"No organizations found"}),a.jsx("p",{className:"text-gray-400 text-sm mt-1",children:u||d!=="all"?"Try adjusting your search or filter criteria":"Get started by creating your first organization"})]}),!u&&d==="all"&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>g(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Organization"]}),a.jsxs(z,{onClick:()=>G(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):Gt.map(ce=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>e(`/organizations/${ce.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:ce.name}),a.jsx(Jt,{id:ce.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:ce.slug}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:a.jsxs("div",{className:"flex flex-col",children:[new Date(ce.createdAt).toLocaleDateString(),a.jsx("p",{className:"text-xs",children:new Date(ce.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Te=>{Te.stopPropagation(),ze(ce)},children:a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Te=>{Te.stopPropagation(),He(ce)},children:a.jsx(zo,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:Te=>{Te.stopPropagation(),Fe(ce)},children:a.jsx(Qu,{className:"w-4 h-4"})})]})})]},ce.id))})]})}),a.jsx(PU,{currentPage:b,totalPages:lt,onPageChange:_t,totalItems:nt.length,startIndex:Ut,endIndex:Kt})]}),F&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(Mr,{className:"inline mr-2 w-3.5 h-3.5 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Organizations"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"organization-count",className:"text-sm text-gray-400 font-light",children:"Number of organizations"}),a.jsx(ve,{id:"organization-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var Te;const ce=parseInt(((Te=document.getElementById("organization-count"))==null?void 0:Te.value)||"5",10);ye(ce)},disabled:T,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:T?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Organizations"]})})]})}),A.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Organization Seeding Terminal",lines:A,isRunning:T,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"create-name",value:M.name,onChange:ce=>ne(ce.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"create-slug",value:M.slug,onChange:ce=>X(ce.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),$({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ye,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),E&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:ce=>{ce.target===ce.currentTarget&&(j(!1),I(null),Y({name:"",slug:""}))},children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",onClick:ce=>ce.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{j(!1),I(null),Y({name:"",slug:""})},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",value:W.name,onChange:ce=>se(ce.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"edit-slug",value:W.slug,onChange:ce=>Ee(ce.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{j(!1),Y({name:"",slug:""})},disabled:q,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:ft,disabled:q,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:q?"Updating...":"Update"})]})]})}),R&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[_.name,a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this organization? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:et,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),P&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none w-full max-w-xl p-6 shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Organization Details"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>U(!1),className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-6 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsx("div",{className:"space-y-2 text-sm",children:[{label:"Created",value:FC(_.createdAt)},{label:"Updated",value:FC(_.updatedAt)}].map(ce=>a.jsxs("div",{className:"flex items-center justify-between border border-dashed border-white/15 bg-black/90 px-3 py-2 rounded-none",children:[a.jsx("div",{className:"text-[11px] font-mono font-light uppercase tracking-wide text-gray-400",children:ce.label}),a.jsx("div",{className:"text-[10px] font-mono uppercase text-white text-right break-words max-w-[60%]",children:ce.value})]},ce.label))})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-8",children:[a.jsx(z,{onClick:()=>U(!1),className:"border border-white/20 bg-white/5 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:()=>{U(!1),e(`/organizations/${_.id}`)},className:"border border-white/20 bg-white text-black hover:bg-white/90 rounded-none",children:"View Details"})]})]})})]})}const ix=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function BU(){const e=ha(),{counts:t,refetchCounts:n}=bm(),[r,s]=p.useState([]),[i,o]=p.useState(!0),[l,c]=p.useState(""),[u,h]=p.useState([]),[d,f]=p.useState(1),[m]=p.useState(20),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(null),[A,C]=p.useState(null),[T,O]=p.useState(""),[q,k]=p.useState(),[M,$]=p.useState(!1),[W,Y]=p.useState(""),[te,ne]=p.useState(""),[X,se]=p.useState(""),[Ee,re]=p.useState([]),[xe,ye]=p.useState(!1),[ze,He]=p.useState(!1),Fe=p.useCallback(async()=>{try{const ue=await(await fetch("/api/users?limit=10000")).json();s(ue.users||[])}catch{}finally{o(!1)}},[]),Ye=p.useCallback(async()=>{try{const ue=await(await fetch("/api/admin/status")).json();$(ue.enabled)}catch{$(!1)}},[]);p.useEffect(()=>{Fe(),Ye();const K=()=>{A&&C(null)};return document.addEventListener("click",K),()=>document.removeEventListener("click",K)},[A,Ye,Fe]),p.useEffect(()=>(N?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N,_]);const ft=async(K,ue)=>{re([]),ye(!0),re([{id:"start",type:"info",message:`Starting user seeding process for ${K} users...`,timestamp:new Date}]);try{const Le=await(await fetch("/api/seed/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:K,role:ue||void 0})})).json();if(Le.success){const he=Le.results.map((oe,De)=>oe.success?{id:`user-${De}`,type:"progress",message:`Creating user: ${oe.user.name} (${oe.user.email})`,timestamp:new Date,status:"completed"}:{id:`user-${De}`,type:"error",message:`Failed to create user ${De+1}: ${oe.error}`,timestamp:new Date});re(oe=>[...oe,...he]);const Z=Le.results.filter(oe=>oe.success).length;re(oe=>[...oe,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${Z}/${K} users successfully`,timestamp:new Date}]),await Fe(),await n()}else re(he=>[...he,{id:"error",type:"error",message:`❌ Seeding failed: ${Le.error||"Unknown error"}`,timestamp:new Date}])}catch(Ae){re(Le=>[...Le,{id:"error",type:"error",message:`❌ Network error: ${Ae}`,timestamp:new Date}])}finally{ye(!1)}},et=K=>{I(K),S(!0)},de=K=>{I(K),Y(K.role||""),x(!0)},Be=K=>{I(K),g(!0)},Ue=async()=>{var he,Z,oe;const K=(he=document.getElementById("create-name"))==null?void 0:he.value,ue=(Z=document.getElementById("create-email"))==null?void 0:Z.value,Ae=(oe=document.getElementById("create-password"))==null?void 0:oe.value;if(!K||!ue||!Ae){V.error("Please fill in all fields");return}const Le=V.loading("Creating user...");try{const it=await(await fetch("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:K,email:ue,password:Ae,role:X||null})})).json();it.success?(await Fe(),b(!1),se(""),document.getElementById("create-name").value="",document.getElementById("create-email").value="",document.getElementById("create-password").value="",V.success("User created successfully!",{id:Le})):V.error(`Error creating user: ${it.error||"Unknown error"}`,{id:Le})}catch{V.error("Error creating user",{id:Le})}},Oe=async()=>{var Le,he;if(!_){V.error("No user selected");return}const K=(Le=document.getElementById("edit-name"))==null?void 0:Le.value,ue=(he=document.getElementById("edit-email"))==null?void 0:he.value;if(!K||!ue){V.error("Please fill in all fields");return}He(!0);const Ae=V.loading("Updating user...");try{const oe=await(await fetch(`/api/users/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:K,email:ue,role:W||null})})).json();oe.success?(await Fe(),x(!1),I(null),Y(""),V.success("User updated successfully!",{id:Ae})):V.error(`Error updating user: ${oe.error||"Unknown error"}`,{id:Ae})}catch{V.error("Error updating user",{id:Ae})}finally{He(!1)}},We=async()=>{if(!_){V.error("No user selected");return}const K=V.loading("Deleting user...");try{const Ae=await(await fetch(`/api/users/${_.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ae.success?(await Fe(),await n(),g(!1),I(null),V.success("User deleted successfully!",{id:K})):V.error(`Error deleting user: ${Ae.error||"Unknown error"}`,{id:K})}catch{V.error("Error deleting user",{id:K})}},nt=async()=>{if(!_)return;if(!M){V.error("Admin plugin is not enabled");return}const K=V.loading("Banning user...");try{const ue=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:_.id,banReason:T||"No reason provided",banExpiresIn:q})}),Ae=await ue.json();ue.ok?(V.success("User banned successfully!",{id:K}),L(!1),O(""),k(void 0),I(null),C(null),Fe()):V.error(`Error banning user: ${Ae.error||Ae.message||"Unknown error"}`,{id:K})}catch{V.error("Error banning user",{id:K})}},lt=async()=>{if(!_)return;if(!M){V.error("Admin plugin is not enabled");return}const K=V.loading("Unbanning user...");try{const ue=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:_.id})}),Ae=await ue.json();ue.ok?(V.success("User unbanned successfully!",{id:K}),U(!1),I(null),C(null),Fe()):V.error(`Error unbanning user: ${Ae.error||Ae.message||"Unknown error"}`,{id:K})}catch{V.error("Error unbanning user",{id:K})}},Ut=async()=>{var Ae;if(!_){V.error("No user selected");return}const K=(Ae=document.getElementById("update-password"))==null?void 0:Ae.value;if(!K){V.error("Please enter a new password");return}const ue=V.loading("Updating password...");try{const Le=await fetch(`/api/users/${_.id}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:K})}),he=await Le.json();Le.ok&&he.success?(V.success("Password updated successfully!",{id:ue}),G(!1),I(null),document.getElementById("update-password").value=""):V.error(`Error updating password: ${he.error||"Unknown error"}`,{id:ue})}catch{V.error("Error updating password",{id:ue})}},Kt=()=>{if(r.length===0){V.error("No users to export");return}const K=["ID","Name","Email","Email Verified","Created At","Updated At"],ue=r.map(oe=>[oe.id,oe.name||"",oe.email||"",!!oe.emailVerified,new Date(oe.createdAt).toLocaleString(),new Date(oe.updatedAt).toLocaleString()]),Ae=[K.join(","),...ue.map(oe=>oe.map(De=>`"${De}"`).join(","))].join(`
529
- `),Le=new Blob([Ae],{type:"text/csv;charset=utf-8;"}),he=document.createElement("a"),Z=URL.createObjectURL(Le);he.setAttribute("href",Z),he.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),he.style.visibility="hidden",document.body.appendChild(he),he.click(),document.body.removeChild(he),V.success(`Exported ${r.length} users to CSV`)},Gt=K=>{u.some(Ae=>Ae.type===K)||(h(Ae=>[...Ae,{type:K}]),f(1))},_t=K=>{h(ue=>ue.filter(Ae=>Ae.type!==K)),f(1)},ce=(K,ue)=>{h(Ae=>Ae.map(Le=>Le.type===K?{...Le,value:ue}:Le))},Te=(K,ue)=>{h(Ae=>Ae.map(Le=>Le.type===K?{...Le,dateRange:ue}:Le))},Ze=r.filter(K=>{const ue=K.name.toLowerCase().includes(l.toLowerCase())||K.email.toLowerCase().includes(l.toLowerCase());if(u.length===0)return ue;const Ae=u.every(Le=>{var he,Z,oe,De,it;switch(Le.type){case"emailVerified":return Le.value===void 0?!0:K.emailVerified===(Le.value==="true");case"banned":return Le.value===void 0?!0:K.banned===(Le.value==="true");case"active":return K.banned!==!0;case"createdAt":{if(!((he=Le.dateRange)!=null&&he.from)&&!((Z=Le.dateRange)!=null&&Z.to))return!0;const tt=new Date(K.createdAt);return!((oe=Le.dateRange)!=null&&oe.from&&Le.dateRange.from>tt||(De=Le.dateRange)!=null&&De.to&&Le.dateRange.to<tt)}case"role":return Le.value?(it=K.role)==null?void 0:it.toLowerCase().includes(Le.value.toLowerCase()):!0;default:return!0}});return ue&&Ae}),Q=r.filter(K=>K.banned).length,pe=Math.ceil(Ze.length/m),be=(d-1)*m,_e=be+m,$e=Ze.slice(be,_e),je=K=>{f(K)};return i?a.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:t.users??0,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),a.jsx("div",{className:"flex items-center space-x-4 mt-2",children:Q>0&&a.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[a.jsx(Lh,{className:"w-3 h-3"}),a.jsxs("span",{children:[Q," Banned"]})]})})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:Kt,children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>j(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>b(!0),children:[a.jsx(ON,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search users...",value:l,onChange:K=>c(K.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs(pn,{value:"",onValueChange:Gt,children:[a.jsx(mn,{className:"w-[180px]",children:a.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[a.jsx(Fi,{className:"w-4 h-4"}),a.jsx("span",{children:"Add Filter"})]})}),a.jsxs(gn,{children:[!u.some(K=>K.type==="emailVerified")&&a.jsx(Pe,{value:"emailVerified",children:"Email Verified"}),!u.some(K=>K.type==="banned")&&a.jsx(Pe,{value:"banned",children:"Banned Status"}),!u.some(K=>K.type==="createdAt")&&a.jsx(Pe,{value:"createdAt",children:"Created Date"}),!u.some(K=>K.type==="role")&&a.jsx(Pe,{value:"role",children:"Role"})]})]})}),u.length>0&&a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(z,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),u.length>0&&a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex flex-wrap gap-3",children:u.map(K=>{var ue,Ae,Le,he;return a.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[a.jsx(jS,{className:"w-3 h-3 text-white"}),K.type==="emailVerified"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),a.jsxs(pn,{value:K.value||"",onValueChange:Z=>ce("emailVerified",Z),children:[a.jsx(mn,{className:"h-7 w-24 text-xs",children:a.jsx("span",{children:K.value==="true"?"True":K.value==="false"?"False":"Select"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"true",children:"True"}),a.jsx(Pe,{value:"false",children:"False"})]})]})]}),K.type==="banned"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Banned:"}),a.jsxs(pn,{value:K.value||"",onValueChange:Z=>ce("banned",Z),children:[a.jsx(mn,{className:"h-7 w-24 text-xs",children:a.jsx("span",{children:K.value==="true"?"Yes":K.value==="false"?"No":"Select"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"true",children:"Yes"}),a.jsx(Pe,{value:"false",children:"No"})]})]})]}),K.type==="createdAt"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Created:"}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(ue=K.dateRange)!=null&&ue.from?Yn(K.dateRange.from,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(Ae=K.dateRange)==null?void 0:Ae.from,onSelect:Z=>{var oe;return Te("createdAt",{from:Z,to:(oe=K.dateRange)==null?void 0:oe.to})},initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(Le=K.dateRange)!=null&&Le.to?Yn(K.dateRange.to,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(he=K.dateRange)==null?void 0:he.to,onSelect:Z=>{var oe;return Te("createdAt",{from:(oe=K.dateRange)==null?void 0:oe.from,to:Z})},initialFocus:!0,disabled:Z=>{var oe;return(oe=K.dateRange)!=null&&oe.from?Z<K.dateRange.from:!1},className:"rounded-none"})})]})]}),K.type==="role"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Role:"}),a.jsx(ve,{type:"text",value:K.value||"",onChange:Z=>ce("role",Z.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),a.jsx("button",{onClick:()=>_t(K.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:a.jsx(an,{className:"w-3 h-3 text-white"})})]},K.type)})})})]}),a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"overflow-x-auto overflow-y-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:$e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 px-4 text-center",children:a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Ho,{className:"w-8 h-8 text-white/50"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),a.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||u.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&u.length===0&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>b(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[a.jsx(ON,{className:"w-4 h-4 mr-2"}),"Create User"]}),a.jsxs(z,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):$e.map(K=>a.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${K.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${K.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:K.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${K.id}`,alt:K.name,className:`w-10 h-10 rounded-none border border-dashed ${K.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),K.banned&&a.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:a.jsx(Lh,{className:"w-3 h-3 text-white"})})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"text-white font-light",children:K.name}),K.banned&&a.jsxs("span",{className:"relative group inline-block",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide cursor-help",children:"Banned"}),K.banReason&&a.jsxs("span",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 px-2 py-1 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[K.banReason,a.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),a.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:K.email})]})]})}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[K.emailVerified?a.jsx(wu,{className:"w-4 h-4 text-green-400"}):a.jsx(jc,{className:"w-4 h-4 text-yellow-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:K.emailVerified?"Verified":"Not Verified"})]})}),a.jsx("td",{className:"py-4 px-4",children:K.role?a.jsx("span",{className:"px-2 py-1 text-xs font-mono uppercase bg-white/5 border border-dashed border-white/15 text-white/80 rounded-sm tracking-wide",children:K.role}):a.jsx("span",{className:"text-sm text-gray-500",children:"—"})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:a.jsxs("div",{className:"flex flex-col",children:[new Date(K.createdAt).toLocaleDateString(),a.jsx("p",{className:"text-xs",children:new Date(K.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"relative flex items-center justify-end",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:ue=>{ue.stopPropagation(),C(A===K.id?null:K.id)},children:a.jsx(p3,{className:"w-4 h-4"})}),A===K.id&&a.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:ue=>ue.stopPropagation(),children:[a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),et(K)},children:[a.jsx(Ms,{className:"w-4 h-4"}),a.jsx("span",{children:"View"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),de(K)},children:[a.jsx(zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Edit User"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),I(K),G(!0)},children:[a.jsx(Ln,{className:"w-4 h-4"}),a.jsx("span",{children:"Update Password"})]}),M&&(K.banned?a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),I(K),U(!0),C(null)},children:[a.jsx(Lh,{className:"w-4 h-4"}),a.jsx("span",{children:"Unban User"})]}):a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),I(K),L(!0),C(null)},children:[a.jsx(Lh,{className:"w-4 h-4"}),a.jsx("span",{children:"Ban User"})]})),a.jsx("div",{className:"border-t border-white/10 my-1"}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),Be(K)},children:[a.jsx(Qu,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete User"})]})]})]})})]},K.id))})]})}),a.jsx(PU,{currentPage:d,totalPages:pe,onPageChange:je,totalItems:Ze.length,startIndex:be,endIndex:_e})]}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(Ho,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{j(!1),ne("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center space-x-2"}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center space-x-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),a.jsx(ve,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"seed-role",className:"text-sm text-gray-400 font-light",children:"Role (optional)"}),a.jsxs(pn,{className:"bg-black text-white",value:te,onValueChange:ne,children:[a.jsx(mn,{id:"seed-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role (optional)"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"}),a.jsx(Pe,{value:"mix",children:"Mix (Random)"})]})]})]}),a.jsx(z,{onClick:()=>{var ue;const K=parseInt(((ue=document.getElementById("user-count"))==null?void 0:ue.value)||"5",10);ft(K,te||void 0)},disabled:xe,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:xe?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),Ee.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"User Seeding Terminal",lines:Ee,isRunning:xe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>{j(!1),ne("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),y&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{b(!1),se("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),a.jsx(ve,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{className:"bg-black text-white",value:X,onValueChange:se,children:[a.jsx(mn,{id:"create-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{b(!1),se("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ue,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),w&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{x(!1),Y("")},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center overflow-hidden",children:_.image?a.jsx("img",{src:_.image,alt:_.name,className:"w-14 h-14 object-cover"}):a.jsx(pp,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",defaultValue:_.name,placeholder:"e.g. John Doe",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"edit-email",type:"email",defaultValue:_.email,placeholder:"e.g. john@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{value:W,onValueChange:Y,children:[a.jsx(mn,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{x(!1),Y("")},disabled:ze,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Oe,disabled:ze,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:ze?"Updating...":"Update"})]})]})}),v&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:_.name}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:We,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),N&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none w-full max-w-lg p-6 shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"User Details"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-6 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-14 h-14 rounded-none border border-dashed border-white/15"}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsx("div",{className:"space-y-2 text-sm",children:[{label:"Email Verified",value:_.emailVerified?"Yes":"No"},{label:"Role",value:_.role||"—"},{label:"Banned",value:_.banned?"Yes":"No"},{label:"Ban Reason",value:_.banReason||"—"},{label:"Ban Expires",value:ix(_.banExpires)},{label:"Created",value:ix(_.createdAt)},{label:"Updated",value:ix(_.updatedAt)}].map(K=>a.jsxs("div",{className:"flex items-center justify-between border border-dashed border-white/15 bg-black/90 px-3 py-2 rounded-none",children:[a.jsx("div",{className:"text-[11px] font-mono font-light uppercase tracking-wide text-gray-400",children:K.label}),a.jsx("div",{className:"text-[10px] font-mono uppercase text-white text-right break-words max-w-[60%]",children:K.value})]},K.label))})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-8",children:[a.jsx(z,{onClick:()=>S(!1),className:"border border-white/20 bg-white/5 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:()=>{S(!1),e(`/users/${_.id}`)},className:"border border-white/20 bg-white text-black hover:bg-white/90 rounded-none",children:"View Details"})]})]})}),R&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),a.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",a.jsx("strong",{children:_.name})," from accessing the system."]}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),a.jsx(ve,{id:"banReason",value:T,onChange:K=>O(K.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),a.jsx(ve,{id:"banExpires",type:"number",value:q||"",onChange:K=>k(K.target.value?Number(K.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{L(!1),O(""),k(void 0),I(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:nt,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),P&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),a.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",a.jsx("strong",{children:_.name}),"? This will restore their access to the system."]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{U(!1),I(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:lt,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),F&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{G(!1),I(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:_.name}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),a.jsx(ve,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{G(!1),I(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ut,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const xd=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function Xae(){const[e]=p.useState("overview"),[t,n]=p.useState(!1),[r,s]=p.useState(0),[i,o]=p.useState(0),[l,c]=p.useState("1D"),[u,h]=p.useState("1D"),[d,f]=p.useState(null),[m,y]=p.useState(!1),[b,w]=p.useState("Daily"),[x,v]=p.useState("Daily"),[g,N]=p.useState("Daily"),[S,E]=p.useState("Daily"),[j,R]=p.useState(!1),[L,P]=p.useState(!1),[U,F]=p.useState(!1),[G,_]=p.useState(!1),[I,A]=p.useState(null),[C,T]=p.useState(null),[O,q]=p.useState(null),[k,M]=p.useState(null),[$,W]=p.useState(null),[Y,te]=p.useState(void 0),[ne,X]=p.useState(void 0),[se,Ee]=p.useState(void 0),[re,xe]=p.useState(void 0),[ye,ze]=p.useState(void 0),[He,Fe]=p.useState(void 0),[Ye,ft]=p.useState(void 0),[et,de]=p.useState(void 0),[Be,Ue]=p.useState([]),[Oe,We]=p.useState([]),[nt,lt]=p.useState(0),[Ut,Kt]=p.useState([]),[Gt,_t]=p.useState([]),[ce,Te]=p.useState(0),[Ze,Q]=p.useState(0),[pe,be]=p.useState(0),[_e,$e]=p.useState(0),[je,K]=p.useState(0),[ue,Ae]=p.useState(!1),[Le,he]=p.useState(!1),[Z,oe]=p.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[De,it]=p.useState([]),[tt,at]=p.useState(!1),[It,wn]=p.useState(0),[sn,ns]=p.useState(0),[In,qn]=p.useState(0),[sr,as]=p.useState(0),[nl,Ws]=p.useState(0),[Fn,Mt]=p.useState([]),[rs,ss]=p.useState(0),[is,Sr]=p.useState(0),[os,Er]=p.useState(0),{counts:Xs,loading:pa}=bm(),Qn=ha(),Fa=["Daily","Weekly","Monthly","Yearly","Custom"],Ks={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},ma=p.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),Jn=we=>we==null?"...":ma.format(Number(we)),ir=we=>we==null?"...":Number(we).toLocaleString(),Zs=p.useMemo(()=>xd.reduce((we,Ne)=>(we[Ne.id]=(Z[Ne.id]||[]).reduce((Re,me)=>Re+me,0),we),{}),[Z]),Qs=p.useMemo(()=>Object.values(Zs).reduce((we,Ne)=>we+Ne,0),[Zs]),al=(we,Ne)=>{const Re=we.currentTarget.getBoundingClientRect();M(Ne),W({x:Re.left+Re.width/2,y:Re.top})},ro=(()=>{const we=[];return I!=null&&I.isOutdated?we.push({id:"version-check",title:`Update Better-Auth to v${I.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `pnpm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):I&&we.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),we.push(),we.push({id:"3",title:"Rate Limiting Configuration",severity:"medium",date:new Date().toISOString().split("T")[0],description:"Configure rate limiting for authentication endpoints to prevent brute force attacks. Better-auth provides built-in rate limiting middleware.",affectedComponents:["Auth Endpoints"],status:"pending"}),we.filter(Ne=>Ne.status!=="applied")})(),xt=p.useCallback(async(we,Ne,Re,me)=>{try{const Ce=new URLSearchParams({type:we,period:Ne});return Re&&Ce.append("from",Re.toISOString()),me&&Ce.append("to",me.toISOString()),await(await fetch(`/api/analytics?${Ce.toString()}`)).json()}catch{return null}},[]);p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/users/all")).json();Re!=null&&Re.success&&Re.users&&Mt(Re.users)}catch{Mt([])}})()},[]),p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/stats")).json();Re&&s(Re.activeUsers||0)}catch{s(0)}})()},[]),p.useEffect(()=>{(async()=>{const Ne=await xt("users",l,Y,ne);Ne&&(Ue(Ne.data||[]),We(Ne.labels||[]),lt(Ne.percentageChange||0))})()},[l,Y,ne,xt]),p.useEffect(()=>{if(Fn.length===0){ss(0),Sr(0);return}const we=new Date;let Ne,Re=we,me,Ce;if(x==="Custom"){if(!se||!re){ss(0),Sr(0);return}Ne=new Date(se),Re=new Date(re),Re.setHours(23,59,59,999);const Ft=Re.getTime()-Ne.getTime();Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-Ft)}else switch(x){case"Daily":Ne=new Date(we),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-24*60*60*1e3);break;case"Weekly":Ne=new Date(we),Ne.setDate(we.getDate()-we.getDay()),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-7*24*60*60*1e3);break;case"Monthly":Ne=new Date(we.getFullYear(),we.getMonth(),1),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(we.getFullYear(),we.getMonth()-1,1),me.setHours(0,0,0,0);break;case"Yearly":Ne=new Date(we.getFullYear(),0,1),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(we.getFullYear()-1,0,1),me.setHours(0,0,0,0);break;default:ss(0),Sr(0);return}const Ie=Fn.filter(Ft=>{if(!Ft.createdAt)return!1;const ea=new Date(Ft.createdAt);return ea>=Ne&&ea<=Re}),ke=Fn.filter(Ft=>{if(!Ft.createdAt)return!1;const ea=new Date(Ft.createdAt);return ea>=me&&ea<=Ce}),Se=Ie.length,Ge=ke.length;let Pt=0;Ge>0?Pt=(Se-Ge)/Ge*100:Se>0&&(Pt=100),ss(Se),Sr(Pt)},[Fn,x,se,re]),p.useEffect(()=>{(async()=>{if(!(u==="Custom"&&(!se||!re))){at(!0);try{const[Ne,Re,me,Ce,Ie]=await Promise.all([xt("newUsers",u,se,re),xt("activeUsers",u,se,re),xt("organizations",u,se,re),xt("teams",u,se,re),xt("sessions",u,se,re)]);Ne&&(Kt(Ne.data||[]),_t(Ne.labels||[])),oe({signups:(Ne==null?void 0:Ne.data)||[],logins:(Re==null?void 0:Re.data)||[],organizations:(me==null?void 0:me.data)||[],teams:(Ce==null?void 0:Ce.data)||[],sessions:(Ie==null?void 0:Ie.data)||[]}),it((Ne==null?void 0:Ne.labels)||(Re==null?void 0:Re.labels)||(me==null?void 0:me.labels)||(Ce==null?void 0:Ce.labels)||(Ie==null?void 0:Ie.labels)||[])}finally{at(!1)}}})()},[u,se,re,xt]),p.useEffect(()=>{(async()=>{const Ne=await xt("activeUsers","1D");Ne&&Te(Ne.percentageChange||0)})()},[xt]),p.useEffect(()=>{(async()=>{const Ne=Ks[g]||"1D",Re=Ne==="Custom";if(!(Re&&(!ye||!He))){Ae(!0);try{const me=await xt("organizations",Ne,Re?ye:void 0,Re?He:void 0);me&&($e(me.total||0),Q(me.percentageChange||0))}catch{$e(0),Q(0)}finally{Ae(!1)}}})()},[g,ye,He,xt]),p.useEffect(()=>{(async()=>{const Ne=Ks[S]||"1D",Re=Ne==="Custom";if(!(Re&&(!Ye||!et))){he(!0);try{const me=await xt("teams",Ne,Re?Ye:void 0,Re?et:void 0);me&&(K(me.total||0),be(me.percentageChange||0))}catch{K(0),be(0)}finally{he(!1)}}})()},[S,Ye,et,xt]),p.useEffect(()=>{(async()=>{const Ne=await xt("users","1D");Ne&&wn(Ne.percentageChange||0);const Re=await xt("organizations","1D");Re&&ns(Re.percentageChange||0);const me=await xt("activeUsers","1D");me&&qn(me.percentageChange||0);const[Ce,Ie,ke,Se,Ge]=await Promise.all([xt("newUsers","1D"),xt("activeUsers","1D"),xt("organizations","1D"),xt("teams","1D"),xt("sessions","1D")]);Ce?(o(Ce.total||0),Er(Ce.percentageChange||0)):(o(0),Er(0));const Ft=[(Ce==null?void 0:Ce.total)||0,(Ie==null?void 0:Ie.total)||0,(ke==null?void 0:ke.total)||0,(Se==null?void 0:Se.total)||0,(Ge==null?void 0:Ge.total)||0].reduce((Cr,kr)=>Cr+kr,0);Ws(Ft);const ga=[(Ce==null?void 0:Ce.previousTotal)||0,(Ie==null?void 0:Ie.previousTotal)||0,(ke==null?void 0:ke.previousTotal)||0,(Se==null?void 0:Se.previousTotal)||0,(Ge==null?void 0:Ge.previousTotal)||0].reduce((Cr,kr)=>Cr+kr,0);if(ga>0){const Cr=(Ft-ga)/ga*100;as(Cr)}else Ft>0?as(100):as(0)})()},[xt]),p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/version-check")).json();Re&&A({current:Re.current||"1.0.0",latest:Re.latest||"1.0.0",isOutdated:Re.isOutdated||!1})}catch{try{const Ce=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Ie="1.5.0";A({current:Ce,latest:Ie,isOutdated:Ce!==Ie})}catch{A({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const jr=we=>{switch(we){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Tr=we=>{switch(we){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},ei=we=>{f(we),y(!0)},ls=()=>{y(!1),setTimeout(()=>f(null),300)},or=()=>{if(!Fn||Fn.length===0)return 0;const we=Fn.reduce((me,Ce)=>{const Ie=Ce!=null&&Ce.createdAt?new Date(Ce.createdAt):null;return!Ie||Number.isNaN(Ie.getTime())?me:me?Ie<me?Ie:me:Ie},null);if(!we)return 0;const Ne=new Date,Re=(Ne.getFullYear()-we.getFullYear())*12+(Ne.getMonth()-we.getMonth())+1;return Math.max(Re,0)},cs=()=>{const we=or();if(we<=0)return{labels:Array.from({length:12},(Ie,ke)=>`Week ${ke+1}`),expectedLength:12};if(we<3)return{labels:Array.from({length:12},(Ie,ke)=>`Week ${ke+1}`),expectedLength:12};if(we<=12){const ke=Fn.reduce((Ge,Pt)=>{const Ft=Pt!=null&&Pt.createdAt?new Date(Pt.createdAt):null;return!Ft||Number.isNaN(Ft.getTime())?Ge:Ge?Ft<Ge?Ft:Ge:Ft},null)||new Date,Se=Array.from({length:12},(Ge,Pt)=>new Date(ke.getFullYear(),ke.getMonth()+Pt,1).toLocaleDateString("en-US",{month:"short"}));return{labels:Se,expectedLength:Se.length}}const Ne=Math.max(1,Math.ceil(we/12)),me=(Fn.reduce((Ie,ke)=>{const Se=ke!=null&&ke.createdAt?new Date(ke.createdAt):null;return!Se||Number.isNaN(Se.getTime())?Ie:Ie?Se<Ie?Se:Ie:Se},null)||new Date).getFullYear(),Ce=Array.from({length:Ne},(Ie,ke)=>`${me+ke}`);return{labels:Ce,expectedLength:Ce.length}},Ba=(we,Ne="users")=>{const Re=Ne==="users"?Oe:Ne==="newUsers"?Gt:De,me={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7};if(we==="ALL"){if(Ne==="users"||Ne==="activity"){const{labels:ke}=cs();return ke}return[]}const Ce=me[we]||7;if(Re&&Re.length>0&&Re.length===Ce)return we==="1D"?Re.filter((ke,Se)=>Se%4===0).map(ke=>{const Se=parseInt(ke.replace("h",""),10);return Se===0?"12am":Se<12?`${Se}am`:Se===12?"12pm":`${Se-12}pm`}):we==="1W"?Re.map(ke=>ke.length>3?ke.substring(0,3):ke):we==="1M"?Re.map(ke=>{const Se=ke.split(" ");return Se.length>=2?Se[1]:ke}):we==="1Y"||we==="3M"||we==="6M"?Re.map(ke=>ke.length>3?ke.substring(0,3):ke):Re.map(ke=>ke.length>3?ke.substring(0,3):ke);const Ie=new Date;switch(we){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(ke,Se)=>new Date(Ie.getTime()-(6-Se)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(ke,Se)=>new Date(Ie.getTime()-(29-Se)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(2-Se),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(5-Se),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(11-Se),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(6-Se),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},so=(we,Ne="users")=>{const Re=Ne==="users"?Oe:Gt;let Ce={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[we]||7;if(we==="ALL"&&Ne==="users"){const{labels:ke,expectedLength:Se}=cs();return Ce=Se||Ce,Re&&Re.length===ke.length,ke}if(we==="ALL"&&Ne!=="users")return[];if(Re&&Re.length>0&&Re.length===Ce)return we==="1D"?Re.map(ke=>{const Se=parseInt(ke.replace("h",""),10);return Se===0?"12am":Se<12?`${Se}am`:Se===12?"12pm":`${Se-12}pm`}):we==="1Y"||we==="3M"||we==="6M"?Re.map(ke=>{const Se=["January","February","March","April","May","June","July","August","September","October","November","December"],Pt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(ke);return Pt!==-1?Se[Pt]:ke}):Re;const Ie=new Date;switch(we){case"1D":return Array.from({length:24},(ke,Se)=>{const Ge=new Date;return Ge.setHours(Se,0,0,0),Ge.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(ke,Se)=>new Date(Ie.getTime()-(6-Se)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(ke,Se)=>{const Ge=new Date(Ie.getTime()-(29-Se)*24*60*60*1e3),Pt=Ge.toLocaleDateString("en-US",{month:"short"}),Ft=Ge.getDate();return`${Pt} ${Ft}`});case"3M":return Array.from({length:3},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(2-Se),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(5-Se),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(11-Se),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(6-Se),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},ds=(we,Ne="users")=>{const Re=Ne==="users"?Be:Ut;let Ce={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[we]||7;if(we==="ALL"&&Ne==="users"){const{expectedLength:Ge}=cs();Ce=Ge||Ce}if(we==="ALL"&&Ne==="activity"){const{expectedLength:Ge}=cs();Ce=Ge||Ce}if(!Re||Re.length===0)return Array(Ce).fill(0);const Ie=[...Re];for(;Ie.length<Ce;)Ie.push(0);const ke=Ie.slice(0,Ce),Se=Math.max(...ke,1);return ke.map(Ge=>Ge/Se*100)},rl=()=>{const we=u==="ALL"?Ba("ALL","activity"):De.length>0?De:Ba(u,"activity"),Ne=we.map((me,Ce)=>xd.reduce((Ie,ke)=>{var Se;return Ie+(((Se=Z[ke.id])==null?void 0:Se[Ce])??0)},0)),Re=Math.max(...Ne,1);return a.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[a.jsx("div",{className:"px-6 overflow-hidden",children:a.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none overflow-x-auto relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.users)}),a.jsxs("div",{className:`flex items-center gap-1 ${It>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${It<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(It).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(ka,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.organizations)}),a.jsxs("div",{className:`flex items-center gap-1 ${sn>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${sn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(sn).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(RC,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.sessions)}),a.jsxs("div",{className:`flex items-center gap-1 ${In>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${In<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(In).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(AC,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(nl??0)}),a.jsxs("div",{className:`flex items-center gap-1 ${sr>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${sr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(sr).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(i??0)}),a.jsxs("div",{className:`flex items-center gap-1 ${os>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${os<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(os).toFixed(1),"%"]})]})]})]})]})}),a.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),a.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y","ALL"].map(me=>a.jsx("button",{onClick:()=>c(me),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===me?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:me},me))})]}),a.jsx("div",{className:"flex justify-between items-end mb-4",children:(()=>{const me=ds(l,"users"),Ie=(Be.length>0?Be.slice(0,me.length):Array(me.length).fill(0)).reduce((ke,Se)=>ke+Se,0);return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-4xl text-white font-light",children:pa?"...":Jn(Ie)}),a.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[a.jsx("svg",{className:`w-3 h-3 ${nt>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${nt>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(nt).toFixed(1),"%"]})]})]})})()}),a.jsxs("div",{className:"space-y-2 relative",children:[(()=>{const me=ds(l,"users"),Ce=Be.length>0?Be.slice(0,me.length):Array(me.length).fill(0),Ie=Math.max(...Ce,1),ke=Array.from({length:6},(Se,Ge)=>Ie/5*(5-Ge));return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex flex-col justify-between h-48 text-xs text-gray-500 font-mono pt-0.5 pb-0.5",children:ke.map((Se,Ge)=>a.jsx("span",{className:"leading-none",children:Jn(Math.round(Se))},Ge))}),a.jsxs("div",{className:"flex-1 h-48 relative",children:[a.jsx("div",{className:"absolute inset-0 flex flex-col justify-between z-0",children:[0,1,2,3,4,5].map(Se=>a.jsx("div",{className:"w-full h-px bg-white/10",style:{opacity:.3}},Se))}),a.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:a.jsx("defs",{children:a.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),a.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),a.jsx("div",{className:"h-48 flex items-end justify-between space-x-1 relative z-10",children:me.map((Se,Ge)=>{const Pt=C===Ge;return a.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${Se}%`,background:"url(#usersBarGradient)"},onMouseEnter:Ft=>{const ea=Ft.currentTarget.getBoundingClientRect(),ga=ea.left+ea.width/2,Cr=ea.top,kr=150,Gc=60,ch=Math.max(kr/2,Math.min(window.innerWidth-kr/2,ga)),sl=Math.max(Gc+10,Math.min(window.innerHeight-10,Cr));T(Ge),q({x:ch,y:sl})},onMouseLeave:()=>{T(null),q(null)},children:a.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.285))",opacity:Pt?1:.8}})},Ge)})}),C!==null&&O&&a.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${O.x}px`,top:`${O.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[a.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:so(l,"users")[C]}),a.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[Be[C]!==void 0?Be[C].toLocaleString():"0"," ",a.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]})]})})(),a.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ba(l,"users").map((me,Ce)=>a.jsx("span",{className:"flex-1 text-center truncate",children:me},Ce))})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),a.jsx("p",{className:"text-4xl text-white font-light mt-1",children:tt?"...":ir(Qs)}),a.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),a.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","3M","6M","1Y","ALL"].map(me=>a.jsx("button",{onClick:()=>h(me),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${u===me?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:me},me))})]}),a.jsxs("div",{className:"space-y-2 relative",children:[a.jsx("div",{className:"h-40 flex items-end gap-1",children:we.map((me,Ce)=>{const Ie=Ne[Ce]||0;return a.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:ke=>al(ke,Ce),onMouseLeave:()=>{M(null),W(null)},children:xd.map(ke=>{var Pt;const Se=((Pt=Z[ke.id])==null?void 0:Pt[Ce])??0,Ge=Ie===0||Re===0?0:Math.max(Se/Re*100,Se>0?4:0);return a.jsx("div",{className:`w-full ${ke.barClass}`,style:{height:`${Ge}%`}},`${ke.id}-${Ce}`)})},`${me}-${Ce}`)})}),tt&&a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),k!==null&&$&&a.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${$.x}px`,top:`${$.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[a.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:we[k]||`Bucket ${k+1}`}),a.jsx("div",{className:"space-y-1",children:xd.map(me=>{var Ce;return a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[a.jsx("span",{className:`w-2 h-2 rounded-sm ${me.dotClass}`}),me.label]}),a.jsx("span",{className:"text-white font-medium",children:((Ce=Z[me.id])==null?void 0:Ce[k])??0})]},me.id)})})]})}),a.jsx("div",{className:`flex justify-between ${u==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:we.map((me,Ce)=>a.jsx("span",{className:"flex-1 text-center truncate",children:me},Ce))}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:xd.map(me=>a.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-2 h-2 rounded-sm ${me.dotClass}`}),me.label]}),a.jsx("span",{className:"text-white font-medium",children:tt?"...":ir(Zs[me.id]||0)})]},me.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>R(!j),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:b})]}),j&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{w(me),R(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),b==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),Y?Yn(Y,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:Y,onSelect:te,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),ne?Yn(ne,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:ne,onSelect:X,initialFocus:!0,disabled:me=>Y?me<Y:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ir(r)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${ce>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${ce>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(ce).toFixed(1),"%"]})]})})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>P(!L),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:x})]}),L&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{v(me),P(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),x==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),se?Yn(se,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:se,onSelect:Ee,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),re?Yn(re,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:re,onSelect:xe,initialFocus:!0,disabled:me=>se?me<se:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ir(rs)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${is>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:is<0?{transform:"rotate(180deg)"}:{},children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${is>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(is).toFixed(1),"%"]})]})})]})]})]}),a.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>F(!U),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:g})]}),U&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{N(me),F(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),g==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),ye?Yn(ye,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:ye,onSelect:ze,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),He?Yn(He,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:He,onSelect:Fe,initialFocus:!0,disabled:me=>ye?me<ye:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ue?"...":ir(_e)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${Ze>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${Ze>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Ze).toFixed(1),"%"]})]})})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>_(!G),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:S})]}),G&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{E(me),_(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),S==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),Ye?Yn(Ye,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:Ye,onSelect:ft,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),et?Yn(et,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:et,onSelect:de,initialFocus:!0,disabled:me=>Ye?me<Ye:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:Le?"...":ir(je)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${pe>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${pe>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(pe).toFixed(1),"%"]})]})})]})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pt-4 overflow-hidden relative flex flex-col",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white/60"}),a.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),a.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),a.jsxs("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:[ro.length===0&&a.jsx("div",{className:"text-sm flex items-center justify-center text-gray-400",children:a.jsxs("div",{className:"flex mt-5 items-center justify-center",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400 mr-2"}),a.jsx("p",{className:"text-center",children:"No security insights found"})]})}),ro.map((me,Ce)=>a.jsx("div",{onClick:()=>ei(me),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${Ce*.1}s both`},children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:a.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:me.title})}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${jr(me.severity)}`,children:me.severity}),a.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${Tr(me.status)}`,children:me.status})]})]}),a.jsx(yu,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},me.id))]})]})]})]})]})};return a.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[a.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?rl():e==="users"?a.jsx(BU,{}):e==="organizations"?a.jsx(FU,{}):rl()}),t&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RC,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("button",{onClick:()=>{n(!1),Qn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(AC,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(Rs,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),a.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(OU,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(_U,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),a.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[a.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),m&&d&&a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:ls,children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:we=>we.stopPropagation(),children:[a.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(Ln,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light",children:d.title})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${jr(d.severity)}`,children:[d.severity," Severity"]}),a.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${Tr(d.status)}`,children:d.status}),d.cve&&a.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:d.cve})]})]}),a.jsx("button",{onClick:ls,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:a.jsx(dt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),a.jsx("p",{className:"text-white",children:new Date(d.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),d.description.includes("npm install")?a.jsxs("div",{children:[a.jsx("p",{className:"text-white leading-relaxed mb-3",children:d.description.split("Run:")[0]}),a.jsx("div",{className:"relative group",children:a.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("code",{children:[a.jsx("span",{className:"text-green-400",children:"$"})," ",a.jsx("span",{className:"text-cyan-400",children:"npm"})," ",a.jsx("span",{className:"text-yellow-400",children:"install"})," ",a.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),V.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:a.jsx(va,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):a.jsx("p",{className:"text-white leading-relaxed",children:d.description})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:d.affectedComponents.map((we,Ne)=>a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${Ne*.1}s both`},children:[a.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),a.jsx("span",{className:"text-sm text-white",children:we})]},Ne))})]}),a.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:a.jsxs("div",{className:"flex items-start gap-3",children:[d.status==="applied"&&a.jsxs(a.Fragment,{children:[a.jsx(Ep,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),d.status==="scheduled"&&a.jsxs(a.Fragment,{children:[a.jsx(RU,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),d.status==="pending"&&a.jsxs(a.Fragment,{children:[a.jsx(kae,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),a.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:a.jsx(z,{variant:"ghost",onClick:ls,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),a.jsx("style",{children:`
527
+ `;document.head.appendChild(UU);const ve=p.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:`flex h-10 w-full border border-dashed border-white/20 bg-black/30 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,ref:r,...n}));ve.displayName="Input";const ie=p.forwardRef(({className:e,...t},n)=>a.jsx("label",{className:`text-sm font-light text-white ${e}`,ref:n,...t}));ie.displayName="Label";function PU({currentPage:e,totalPages:t,onPageChange:n,totalItems:r,startIndex:s,endIndex:i}){const o=()=>{const u=[],h=[];for(let d=Math.max(2,e-2);d<=Math.min(t-1,e+2);d++)u.push(d);return e-2>2?h.push(1,"..."):h.push(1),h.push(...u),e+2<t-1?h.push("...",t):t>1&&h.push(t),h};if(t<=1)return null;const l=o();return a.jsxs("div",{className:"flex items-center justify-between mt-6",children:[a.jsxs("div",{className:"text-sm text-gray-400",children:["Showing ",s+1," to ",Math.min(i,r)," of ",r," items"]}),a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:e===1,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(h3,{className:"w-4 h-4"}),"Previous"]}),l.map((c,u)=>{if(c==="...")return a.jsx(z,{variant:"outline",size:"sm",disabled:!0,className:"border border-dashed border-white/20 text-white rounded-none",children:a.jsx(ZY,{className:"w-4 h-4"})},`dots-${u}`);const h=c,d=e===h;return a.jsx(z,{variant:d?"default":"outline",size:"sm",onClick:()=>n(h),className:d?"bg-white text-black rounded-none":"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:h},h)}),a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:["Next",a.jsx(ES,{className:"w-4 h-4"})]})]})]})}const sh=p.createContext({isOpen:!1,setIsOpen:()=>{}}),pn=p.forwardRef(({className:e,value:t,onValueChange:n,children:r,...s},i)=>{const[o,l]=p.useState(!1);return a.jsx(sh.Provider,{value:{value:t,onValueChange:n,isOpen:o,setIsOpen:l},children:a.jsx("div",{ref:i,className:`relative ${e}`,...s,children:r})})});pn.displayName="Select";const mn=p.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:s,setIsOpen:i}=p.useContext(sh);return a.jsxs("button",{ref:r,type:"button",className:`flex h-10 w-full items-center justify-between border bg-black/30 px-3 py-2 text-sm text-white focus:outline-none focus:ring-1 focus:ring-white focus:border-white/40 disabled:cursor-not-allowed disabled:opacity-50 rounded-none ${e}`,onClick:()=>i(!s),...n,children:[t,a.jsx(Zu,{className:`h-4 w-4 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})});mn.displayName="SelectTrigger";const zn=p.forwardRef(({className:e,placeholder:t,...n},r)=>{const{value:s}=p.useContext(sh);return a.jsx("span",{ref:r,className:`text-sm text-white ${e}`,...n,children:s||t})});zn.displayName="SelectValue";const gn=p.forwardRef(({className:e,children:t,...n},r)=>{const{isOpen:s}=p.useContext(sh);return s?a.jsx("div",{ref:r,className:`absolute top-full left-0 right-0 z-[100] mt-1 border border-dashed border-white/20 bg-black rounded-none shadow-lg max-h-60 overflow-y-auto ${e}`,...n,children:t}):null});gn.displayName="SelectContent";const Pe=p.forwardRef(({className:e,children:t,value:n,...r},s)=>{const{onValueChange:i,setIsOpen:o}=p.useContext(sh);return a.jsx("div",{ref:s,className:`px-3 py-2 text-sm text-white hover:bg-white/10 cursor-pointer ${e}`,onClick:()=>{i==null||i(n),o(!1)},...r,children:t})});Pe.displayName="SelectItem";const FC=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function FU(){const e=ha(),{counts:t,refetchCounts:n}=bm(),[r,s]=p.useState([]),[i,o]=p.useState(!0),[l,c]=p.useState(null),[u,h]=p.useState(""),[d,f]=p.useState("all"),[m,y]=p.useState([]),[b,w]=p.useState(1),[x]=p.useState(20),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(null),[A,C]=p.useState([]),[T,O]=p.useState(!1),[q,k]=p.useState(!1),[M,$]=p.useState({name:"",slug:""}),[W,Y]=p.useState({name:"",slug:""});p.useEffect(()=>{re();const ce=setInterval(()=>{l!=null&&l.enabled||re()},2e3);return()=>clearInterval(ce)},[l==null?void 0:l.enabled]);const te=ce=>ce.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),ne=ce=>{const Te=te(ce);$({name:ce,slug:Te})},X=ce=>{$(Te=>({...Te,slug:te(ce)}))},se=ce=>{const Te=te(ce);Y({name:ce,slug:Te})},Ee=ce=>{Y(Te=>({...Te,slug:te(ce)}))},re=async()=>{try{const Te=await(await fetch("/api/plugins")).json(),Ze=(Te==null?void 0:Te.plugins).find(K=>K.id==="organization");c({enabled:!!Ze,availablePlugins:(Te==null?void 0:Te.plugins).map(K=>K.id),configPath:Te.configPath,organizationPlugin:(Te==null?void 0:Te.plugins).find(K=>K.id==="organization")}),Ze?await xe():o(!1)}catch(ce){console.error("Failed to check plugin status:",ce),c({enabled:!1,error:"Failed to check plugin status"}),o(!1)}},xe=async()=>{try{const Te=await(await fetch("/api/organizations?limit=10000")).json();console.log({lenght:Te.organizations.length}),s(Te.organizations||[])}catch(ce){console.error("Failed to fetch organizations:",ce),V.error("Failed to fetch organizations")}finally{o(!1)}},ye=async ce=>{C([]),O(!0),C([{id:"start",type:"info",message:`Starting organization seeding process for ${ce} organizations...`,timestamp:new Date}]);try{const Ze=await(await fetch("/api/seed/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:ce})})).json();if(Ze.success){const K=Ze.results.map((be,_e)=>be.success?{id:`org-${_e}`,type:"progress",message:`Creating organization: ${be.organization.name} (${be.organization.slug})`,timestamp:new Date,status:"completed"}:{id:`org-${_e}`,type:"error",message:`Failed to create organization ${_e+1}: ${be.error}`,timestamp:new Date});C(be=>[...be,...K]);const pe=Ze.results.filter(be=>be.success).length;C(be=>[...be,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${pe}/${ce} organizations successfully`,timestamp:new Date}]),await xe(),await n()}else C(K=>[...K,{id:"error",type:"error",message:`❌ Seeding failed: ${Ze.error||"Unknown error"}`,timestamp:new Date}])}catch(Te){C(Ze=>[...Ze,{id:"error",type:"error",message:`❌ Network error: ${Te}`,timestamp:new Date}])}finally{O(!1)}},ze=ce=>{I(ce),U(!0)},He=ce=>{I(ce),Y({name:ce.name,slug:ce.slug}),j(!0)},Fe=ce=>{I(ce),L(!0)},Ye=async()=>{if(!M.name){V.error("Please fill in the organization name");return}const ce=V.loading("Creating organization...");try{const Ze=await(await fetch("/api/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:M.name,slug:M.slug})})).json();Ze.success?(await xe(),g(!1),$({name:"",slug:""}),V.success("Organization created successfully!",{id:ce})):V.error(`Error creating organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error creating organization:",Te),V.error("Error creating organization",{id:ce})}},ft=async()=>{if(!_){V.error("No organization selected");return}if(!W.name){V.error("Please fill in the organization name");return}k(!0);const ce=V.loading("Updating organization...");try{const Ze=await(await fetch(`/api/organizations/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name,slug:W.slug})})).json();Ze.success?(await xe(),j(!1),I(null),Y({name:"",slug:""}),V.success("Organization updated successfully!",{id:ce})):V.error(`Error updating organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error updating organization:",Te),V.error("Error updating organization",{id:ce})}finally{k(!1)}},et=async()=>{if(!_){V.error("No organization selected");return}const ce=V.loading("Deleting organization...");try{const Ze=await(await fetch(`/api/organizations/${_.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ze.success?(await xe(),await n(),L(!1),I(null),V.success("Organization deleted successfully!",{id:ce})):V.error(`Error deleting organization: ${Ze.error||"Unknown error"}`,{id:ce})}catch(Te){console.error("Error deleting organization:",Te),V.error("Error deleting organization",{id:ce})}},de=()=>{if(r.length===0){V.error("No organizations to export");return}const ce=["ID","Name","Slug","Created At","Updated At"],Te=r.map(_e=>[_e.id,_e.name||"",_e.slug||"",new Date(_e.createdAt).toLocaleString(),new Date(_e.updatedAt).toLocaleString()]),Ze=[ce.join(","),...Te.map(_e=>_e.map($e=>`"${$e}"`).join(","))].join(`
528
+ `),K=new Blob([Ze],{type:"text/csv;charset=utf-8;"}),pe=document.createElement("a"),be=URL.createObjectURL(K);pe.setAttribute("href",be),pe.setAttribute("download",`organizations-export-${new Date().toISOString().split("T")[0]}.csv`),pe.style.visibility="hidden",document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),V.success(`Exported ${r.length} organizations to CSV`)},Be=ce=>{m.some(Te=>Te.type===ce)||y([...m,{type:ce}])},Ue=ce=>{y(m.filter(Te=>Te.type!==ce))},Oe=()=>{y([])},We=(ce,Te)=>{y(Ze=>Ze.map(K=>K.type===ce?{...K,dateRange:Te}:K))},nt=r.filter(ce=>{const Te=ce.name.toLowerCase().includes(u.toLowerCase())||ce.slug.toLowerCase().includes(u.toLowerCase());if(m.length===0)return Te;const Ze=m.every(K=>{var pe,be,_e,$e;switch(K.type){case"createdAt":{if(!((pe=K.dateRange)!=null&&pe.from)&&!((be=K.dateRange)!=null&&be.to))return!0;const je=new Date(ce.createdAt);return!((_e=K.dateRange)!=null&&_e.from&&K.dateRange.from>je||($e=K.dateRange)!=null&&$e.to&&K.dateRange.to<je)}default:return!0}});return Te&&Ze}),lt=Math.ceil(nt.length/x),Ut=(b-1)*x,Kt=Ut+x,Gt=nt.slice(Ut,Kt),_t=ce=>{w(ce)};return i?a.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading organizations..."})]})}):l&&!l.enabled?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl text-white font-light",children:"Organizations"}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application organizations"})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Mr,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-md text-white tracking-tight font-light font-mono uppercase mb-1",children:"Organization Plugin Required"}),a.jsx("p",{className:"text-gray-300 mb-6 text-sm",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsxs("li",{children:["Import the plugin in your auth configuration file",l.configPath&&a.jsxs("span",{className:"text-gray-400",children:[" (",l.configPath,")"]}),":"]})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins/organization"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),l.availablePlugins&&l.availablePlugins.length>0&&a.jsx("div",{className:"mb-4",children:a.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",l.availablePlugins.join(", ")]})}),a.jsx(z,{onClick:re,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Organizations",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:t.organizations??0,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your organizations and teams"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:de,children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>G(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>g(!0),children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Add Organization"]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search organizations...",value:u,onChange:ce=>h(ce.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs(pn,{value:"",onValueChange:Be,children:[a.jsx(mn,{className:"w-[180px]",children:a.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[a.jsx(Fi,{className:"w-4 h-4"}),a.jsx("span",{children:"Add Filter"})]})}),a.jsx(gn,{children:!m.some(ce=>ce.type==="createdAt")&&a.jsx(Pe,{value:"createdAt",children:"Created Date"})})]})}),m.length>0&&a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(z,{onClick:Oe,children:"Clear all"})})]}),m.length>0&&a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex flex-wrap gap-3",children:m.map(ce=>{var Te,Ze,K,pe;return a.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[a.jsx(jS,{className:"w-3 h-3 text-white"}),ce.type==="createdAt"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Created:"}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(Te=ce.dateRange)!=null&&Te.from?Yn(ce.dateRange.from,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(Ze=ce.dateRange)==null?void 0:Ze.from,onSelect:be=>{var _e;return We("createdAt",{from:be,to:(_e=ce.dateRange)==null?void 0:_e.to})},initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(K=ce.dateRange)!=null&&K.to?Yn(ce.dateRange.to,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(pe=ce.dateRange)==null?void 0:pe.to,onSelect:be=>{var _e;return We("createdAt",{from:(_e=ce.dateRange)==null?void 0:_e.from,to:be})},initialFocus:!0,disabled:be=>{var _e;return(_e=ce.dateRange)!=null&&_e.from?be<ce.dateRange.from:!1},className:"rounded-none"})})]})]}),a.jsx("button",{onClick:()=>Ue(ce.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:a.jsx(an,{className:"w-3 h-3 text-white"})})]},ce.type)})})})]}),a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Organization"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Slug"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:nt.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"py-12 px-4 text-center",children:a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-8 h-8 text-white/50"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium text-lg",children:"No organizations found"}),a.jsx("p",{className:"text-gray-400 text-sm mt-1",children:u||d!=="all"?"Try adjusting your search or filter criteria":"Get started by creating your first organization"})]}),!u&&d==="all"&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>g(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Organization"]}),a.jsxs(z,{onClick:()=>G(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):Gt.map(ce=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>e(`/organizations/${ce.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:ce.name}),a.jsx(Jt,{id:ce.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:ce.slug}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:a.jsxs("div",{className:"flex flex-col",children:[new Date(ce.createdAt).toLocaleDateString(),a.jsx("p",{className:"text-xs",children:new Date(ce.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Te=>{Te.stopPropagation(),ze(ce)},children:a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Te=>{Te.stopPropagation(),He(ce)},children:a.jsx(zo,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:Te=>{Te.stopPropagation(),Fe(ce)},children:a.jsx(Qu,{className:"w-4 h-4"})})]})})]},ce.id))})]})}),a.jsx(PU,{currentPage:b,totalPages:lt,onPageChange:_t,totalItems:nt.length,startIndex:Ut,endIndex:Kt})]}),F&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(Mr,{className:"inline mr-2 w-3.5 h-3.5 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Organizations"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"organization-count",className:"text-sm text-gray-400 font-light",children:"Number of organizations"}),a.jsx(ve,{id:"organization-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var Te;const ce=parseInt(((Te=document.getElementById("organization-count"))==null?void 0:Te.value)||"5",10);ye(ce)},disabled:T,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:T?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Organizations"]})})]})}),A.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Organization Seeding Terminal",lines:A,isRunning:T,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"create-name",value:M.name,onChange:ce=>ne(ce.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"create-slug",value:M.slug,onChange:ce=>X(ce.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),$({name:"",slug:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ye,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),E&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:ce=>{ce.target===ce.currentTarget&&(j(!1),I(null),Y({name:"",slug:""}))},children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",onClick:ce=>ce.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{j(!1),I(null),Y({name:"",slug:""})},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",value:W.name,onChange:ce=>se(ce.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"edit-slug",value:W.slug,onChange:ce=>Ee(ce.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{j(!1),Y({name:"",slug:""})},disabled:q,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:ft,disabled:q,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:q?"Updating...":"Update"})]})]})}),R&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[_.name,a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this organization? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:et,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),P&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none w-full max-w-xl p-6 shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Organization Details"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>U(!1),className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-6 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(Mr,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.slug})]})]}),a.jsx("div",{className:"space-y-2 text-sm",children:[{label:"Created",value:FC(_.createdAt)},{label:"Updated",value:FC(_.updatedAt)}].map(ce=>a.jsxs("div",{className:"flex items-center justify-between border border-dashed border-white/15 bg-black/90 px-3 py-2 rounded-none",children:[a.jsx("div",{className:"text-[11px] font-mono font-light uppercase tracking-wide text-gray-400",children:ce.label}),a.jsx("div",{className:"text-[10px] font-mono uppercase text-white text-right break-words max-w-[60%]",children:ce.value})]},ce.label))})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-8",children:[a.jsx(z,{onClick:()=>U(!1),className:"border border-white/20 bg-white/5 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:()=>{U(!1),e(`/organizations/${_.id}`)},className:"border border-white/20 bg-white text-black hover:bg-white/90 rounded-none",children:"View Details"})]})]})})]})}const ix=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function BU(){const e=ha(),{counts:t,refetchCounts:n}=bm(),[r,s]=p.useState([]),[i,o]=p.useState(!0),[l,c]=p.useState(""),[u,h]=p.useState([]),[d,f]=p.useState(1),[m]=p.useState(20),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(null),[A,C]=p.useState(null),[T,O]=p.useState(""),[q,k]=p.useState(),[M,$]=p.useState(!1),[W,Y]=p.useState(""),[te,ne]=p.useState(""),[X,se]=p.useState(""),[Ee,re]=p.useState([]),[xe,ye]=p.useState(!1),[ze,He]=p.useState(!1),Fe=p.useCallback(async()=>{try{const ue=await(await fetch("/api/users?limit=10000")).json();s(ue.users||[])}catch{}finally{o(!1)}},[]),Ye=p.useCallback(async()=>{try{const ue=await(await fetch("/api/admin/status")).json();$(ue.enabled)}catch{$(!1)}},[]);p.useEffect(()=>{Fe(),Ye();const Z=()=>{A&&C(null)};return document.addEventListener("click",Z),()=>document.removeEventListener("click",Z)},[A,Ye,Fe]),p.useEffect(()=>(N?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N,_]);const ft=async(Z,ue)=>{re([]),ye(!0),re([{id:"start",type:"info",message:`Starting user seeding process for ${Z} users...`,timestamp:new Date}]);try{const Le=await(await fetch("/api/seed/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Z,role:ue||void 0})})).json();if(Le.success){const he=Le.results.map((oe,De)=>oe.success?{id:`user-${De}`,type:"progress",message:`Creating user: ${oe.user.name} (${oe.user.email})`,timestamp:new Date,status:"completed"}:{id:`user-${De}`,type:"error",message:`Failed to create user ${De+1}: ${oe.error}`,timestamp:new Date});re(oe=>[...oe,...he]);const Q=Le.results.filter(oe=>oe.success).length;re(oe=>[...oe,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${Q}/${Z} users successfully`,timestamp:new Date}]),await Fe(),await n()}else re(he=>[...he,{id:"error",type:"error",message:`❌ Seeding failed: ${Le.error||"Unknown error"}`,timestamp:new Date}])}catch(Ae){re(Le=>[...Le,{id:"error",type:"error",message:`❌ Network error: ${Ae}`,timestamp:new Date}])}finally{ye(!1)}},et=Z=>{I(Z),S(!0)},de=Z=>{I(Z),Y(Z.role||""),x(!0)},Be=Z=>{I(Z),g(!0)},Ue=async()=>{var he,Q,oe;const Z=(he=document.getElementById("create-name"))==null?void 0:he.value,ue=(Q=document.getElementById("create-email"))==null?void 0:Q.value,Ae=(oe=document.getElementById("create-password"))==null?void 0:oe.value;if(!Z||!ue||!Ae){V.error("Please fill in all fields");return}const Le=V.loading("Creating user...");try{const it=await(await fetch("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z,email:ue,password:Ae,role:X||null})})).json();it.success?(await Fe(),b(!1),se(""),document.getElementById("create-name").value="",document.getElementById("create-email").value="",document.getElementById("create-password").value="",V.success("User created successfully!",{id:Le})):V.error(`Error creating user: ${it.error||"Unknown error"}`,{id:Le})}catch{V.error("Error creating user",{id:Le})}},Oe=async()=>{var Le,he;if(!_){V.error("No user selected");return}const Z=(Le=document.getElementById("edit-name"))==null?void 0:Le.value,ue=(he=document.getElementById("edit-email"))==null?void 0:he.value;if(!Z||!ue){V.error("Please fill in all fields");return}He(!0);const Ae=V.loading("Updating user...");try{const oe=await(await fetch(`/api/users/${_.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z,email:ue,role:W||null})})).json();oe.success?(await Fe(),x(!1),I(null),Y(""),V.success("User updated successfully!",{id:Ae})):V.error(`Error updating user: ${oe.error||"Unknown error"}`,{id:Ae})}catch{V.error("Error updating user",{id:Ae})}finally{He(!1)}},We=async()=>{if(!_){V.error("No user selected");return}const Z=V.loading("Deleting user...");try{const Ae=await(await fetch(`/api/users/${_.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();Ae.success?(await Fe(),await n(),g(!1),I(null),V.success("User deleted successfully!",{id:Z})):V.error(`Error deleting user: ${Ae.error||"Unknown error"}`,{id:Z})}catch{V.error("Error deleting user",{id:Z})}},nt=async()=>{if(!_)return;if(!M){V.error("Admin plugin is not enabled");return}const Z=V.loading("Banning user...");try{const ue=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:_.id,banReason:T||"No reason provided",banExpiresIn:q})}),Ae=await ue.json();ue.ok?(V.success("User banned successfully!",{id:Z}),L(!1),O(""),k(void 0),I(null),C(null),Fe()):V.error(`Error banning user: ${Ae.error||Ae.message||"Unknown error"}`,{id:Z})}catch{V.error("Error banning user",{id:Z})}},lt=async()=>{if(!_)return;if(!M){V.error("Admin plugin is not enabled");return}const Z=V.loading("Unbanning user...");try{const ue=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:_.id})}),Ae=await ue.json();ue.ok?(V.success("User unbanned successfully!",{id:Z}),U(!1),I(null),C(null),Fe()):V.error(`Error unbanning user: ${Ae.error||Ae.message||"Unknown error"}`,{id:Z})}catch{V.error("Error unbanning user",{id:Z})}},Ut=async()=>{var Ae;if(!_){V.error("No user selected");return}const Z=(Ae=document.getElementById("update-password"))==null?void 0:Ae.value;if(!Z){V.error("Please enter a new password");return}const ue=V.loading("Updating password...");try{const Le=await fetch(`/api/users/${_.id}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Z})}),he=await Le.json();Le.ok&&he.success?(V.success("Password updated successfully!",{id:ue}),G(!1),I(null),document.getElementById("update-password").value=""):V.error(`Error updating password: ${he.error||"Unknown error"}`,{id:ue})}catch{V.error("Error updating password",{id:ue})}},Kt=()=>{if(r.length===0){V.error("No users to export");return}const Z=["ID","Name","Email","Email Verified","Created At","Updated At"],ue=r.map(oe=>[oe.id,oe.name||"",oe.email||"",!!oe.emailVerified,new Date(oe.createdAt).toLocaleString(),new Date(oe.updatedAt).toLocaleString()]),Ae=[Z.join(","),...ue.map(oe=>oe.map(De=>`"${De}"`).join(","))].join(`
529
+ `),Le=new Blob([Ae],{type:"text/csv;charset=utf-8;"}),he=document.createElement("a"),Q=URL.createObjectURL(Le);he.setAttribute("href",Q),he.setAttribute("download",`users-export-${new Date().toISOString().split("T")[0]}.csv`),he.style.visibility="hidden",document.body.appendChild(he),he.click(),document.body.removeChild(he),V.success(`Exported ${r.length} users to CSV`)},Gt=Z=>{u.some(Ae=>Ae.type===Z)||(h(Ae=>[...Ae,{type:Z}]),f(1))},_t=Z=>{h(ue=>ue.filter(Ae=>Ae.type!==Z)),f(1)},ce=(Z,ue)=>{h(Ae=>Ae.map(Le=>Le.type===Z?{...Le,value:ue}:Le))},Te=(Z,ue)=>{h(Ae=>Ae.map(Le=>Le.type===Z?{...Le,dateRange:ue}:Le))},Ze=r.filter(Z=>{const ue=Z.name.toLowerCase().includes(l.toLowerCase())||Z.email.toLowerCase().includes(l.toLowerCase());if(u.length===0)return ue;const Ae=u.every(Le=>{var he,Q,oe,De,it;switch(Le.type){case"emailVerified":return Le.value===void 0?!0:Z.emailVerified===(Le.value==="true");case"banned":return Le.value===void 0?!0:Z.banned===(Le.value==="true");case"active":return Z.banned!==!0;case"createdAt":{if(!((he=Le.dateRange)!=null&&he.from)&&!((Q=Le.dateRange)!=null&&Q.to))return!0;const tt=new Date(Z.createdAt);return!((oe=Le.dateRange)!=null&&oe.from&&Le.dateRange.from>tt||(De=Le.dateRange)!=null&&De.to&&Le.dateRange.to<tt)}case"role":return Le.value?(it=Z.role)==null?void 0:it.toLowerCase().includes(Le.value.toLowerCase()):!0;default:return!0}});return ue&&Ae}),K=r.filter(Z=>Z.banned).length,pe=Math.ceil(Ze.length/m),be=(d-1)*m,_e=be+m,$e=Ze.slice(be,_e),je=Z=>{f(Z)};return i?a.jsx("div",{className:"flex min-h-screen items-center justify-center h-full",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading users..."})]})}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Users",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:t.users??0,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsx("p",{className:"text-gray-400 font-light text-sm mt-1 uppercase font-mono",children:"Manage your application users"}),a.jsx("div",{className:"flex items-center space-x-4 mt-2",children:K>0&&a.jsxs("span",{className:"text-sm text-red-400 flex items-center space-x-1",children:[a.jsx(Lh,{className:"w-3 h-3"}),a.jsxs("span",{children:[K," Banned"]})]})})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:Kt,children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export CSV"]}),a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",onClick:()=>j(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>b(!0),children:[a.jsx(ON,{className:"w-4 h-4 mr-2"}),"Add User"]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search users...",value:l,onChange:Z=>c(Z.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs(pn,{value:"",onValueChange:Gt,children:[a.jsx(mn,{className:"w-[180px]",children:a.jsxs("div",{className:"flex mr-3 items-center space-x-2",children:[a.jsx(Fi,{className:"w-4 h-4"}),a.jsx("span",{children:"Add Filter"})]})}),a.jsxs(gn,{children:[!u.some(Z=>Z.type==="emailVerified")&&a.jsx(Pe,{value:"emailVerified",children:"Email Verified"}),!u.some(Z=>Z.type==="banned")&&a.jsx(Pe,{value:"banned",children:"Banned Status"}),!u.some(Z=>Z.type==="createdAt")&&a.jsx(Pe,{value:"createdAt",children:"Created Date"}),!u.some(Z=>Z.type==="role")&&a.jsx(Pe,{value:"role",children:"Role"})]})]})}),u.length>0&&a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(z,{onClick:()=>h([]),className:"",children:"Clear all"})})]}),u.length>0&&a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex flex-wrap gap-3",children:u.map(Z=>{var ue,Ae,Le,he;return a.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-white/10 border border-white/20 rounded-sm",children:[a.jsx(jS,{className:"w-3 h-3 text-white"}),Z.type==="emailVerified"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Email Verified:"}),a.jsxs(pn,{value:Z.value||"",onValueChange:Q=>ce("emailVerified",Q),children:[a.jsx(mn,{className:"h-7 w-24 text-xs",children:a.jsx("span",{children:Z.value==="true"?"True":Z.value==="false"?"False":"Select"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"true",children:"True"}),a.jsx(Pe,{value:"false",children:"False"})]})]})]}),Z.type==="banned"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Banned:"}),a.jsxs(pn,{value:Z.value||"",onValueChange:Q=>ce("banned",Q),children:[a.jsx(mn,{className:"h-7 w-24 text-xs",children:a.jsx("span",{children:Z.value==="true"?"Yes":Z.value==="false"?"No":"Select"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"true",children:"Yes"}),a.jsx(Pe,{value:"false",children:"No"})]})]})]}),Z.type==="createdAt"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Created:"}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(ue=Z.dateRange)!=null&&ue.from?Yn(Z.dateRange.from,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(Ae=Z.dateRange)==null?void 0:Ae.from,onSelect:Q=>{var oe;return Te("createdAt",{from:Q,to:(oe=Z.dateRange)==null?void 0:oe.to})},initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-8 px-3 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(fp,{className:"mr-1 h-3 w-3"}),(Le=Z.dateRange)!=null&&Le.to?Yn(Z.dateRange.to,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:(he=Z.dateRange)==null?void 0:he.to,onSelect:Q=>{var oe;return Te("createdAt",{from:(oe=Z.dateRange)==null?void 0:oe.from,to:Q})},initialFocus:!0,disabled:Q=>{var oe;return(oe=Z.dateRange)!=null&&oe.from?Q<Z.dateRange.from:!1},className:"rounded-none"})})]})]}),Z.type==="role"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-white",children:"Role:"}),a.jsx(ve,{type:"text",value:Z.value||"",onChange:Q=>ce("role",Q.target.value),className:"h-7 w-32 text-xs bg-black border-white/20 text-white",placeholder:"Enter role..."})]}),a.jsx("button",{onClick:()=>_t(Z.type),className:"ml-1 hover:bg-white/20 rounded-full p-0.5",children:a.jsx(an,{className:"w-3 h-3 text-white"})})]},Z.type)})})})]}),a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"overflow-x-auto overflow-y-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:$e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 px-4 text-center",children:a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(Ho,{className:"w-8 h-8 text-white/50"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium text-lg",children:"No users found"}),a.jsx("p",{className:"text-gray-400 text-sm mt-1",children:l||u.length>0?"Try adjusting your search or filter criteria":"Get started by creating your first user or seeding some data"})]}),!l&&u.length===0&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>b(!0),className:"bg-white text-black hover:bg-gray-200 rounded-none",children:[a.jsx(ON,{className:"w-4 h-4 mr-2"}),"Create User"]}),a.jsxs(z,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed Data"]})]})]})})}):$e.map(Z=>a.jsxs("tr",{className:`border-b border-dashed hover:bg-white/5 cursor-pointer ${Z.banned?"border-red-500/30 bg-red-500/5":"border-white/5"}`,onClick:()=>e(`/users/${Z.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:Z.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Z.id}`,alt:Z.name,className:`w-10 h-10 rounded-none border border-dashed ${Z.banned?"border-red-400/50 opacity-60":"border-white/20"}`}),Z.banned&&a.jsx("div",{className:"absolute -top-1 -right-1 bg-red-500 rounded-full p-0.5",children:a.jsx(Lh,{className:"w-3 h-3 text-white"})})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"text-white font-light",children:Z.name}),Z.banned&&a.jsxs("span",{className:"relative group inline-block",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-red-500/20 border border-red-500/50 text-red-400 rounded-sm uppercase tracking-wide cursor-help",children:"Banned"}),Z.banReason&&a.jsxs("span",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-1.5 px-2 py-1 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[Z.banReason,a.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),a.jsx("div",{className:"text-sm text-gray-400 mt-0.5",children:Z.email})]})]})}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[Z.emailVerified?a.jsx(wu,{className:"w-4 h-4 text-green-400"}):a.jsx(jc,{className:"w-4 h-4 text-yellow-400"}),a.jsx("span",{className:"text-sm text-gray-400",children:Z.emailVerified?"Verified":"Not Verified"})]})}),a.jsx("td",{className:"py-4 px-4",children:Z.role?a.jsx("span",{className:"px-2 py-1 text-xs font-mono uppercase bg-white/5 border border-dashed border-white/15 text-white/80 rounded-sm tracking-wide",children:Z.role}):a.jsx("span",{className:"text-sm text-gray-500",children:"—"})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:a.jsxs("div",{className:"flex flex-col",children:[new Date(Z.createdAt).toLocaleDateString(),a.jsx("p",{className:"text-xs",children:new Date(Z.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"relative flex items-center justify-end",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:ue=>{ue.stopPropagation(),C(A===Z.id?null:Z.id)},children:a.jsx(p3,{className:"w-4 h-4"})}),A===Z.id&&a.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:ue=>ue.stopPropagation(),children:[a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),et(Z)},children:[a.jsx(Ms,{className:"w-4 h-4"}),a.jsx("span",{children:"View"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),de(Z)},children:[a.jsx(zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Edit User"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),I(Z),G(!0)},children:[a.jsx(Ln,{className:"w-4 h-4"}),a.jsx("span",{children:"Update Password"})]}),M&&(Z.banned?a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),I(Z),U(!0),C(null)},children:[a.jsx(Lh,{className:"w-4 h-4"}),a.jsx("span",{children:"Unban User"})]}):a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),I(Z),L(!0),C(null)},children:[a.jsx(Lh,{className:"w-4 h-4"}),a.jsx("span",{children:"Ban User"})]})),a.jsx("div",{className:"border-t border-white/10 my-1"}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:ue=>{ue.stopPropagation(),C(null),Be(Z)},children:[a.jsx(Qu,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete User"})]})]})]})})]},Z.id))})]})}),a.jsx(PU,{currentPage:d,totalPages:pe,onPageChange:je,totalItems:Ze.length,startIndex:be,endIndex:_e})]}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"overflow-x-hidden bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(Ho,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed User"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{j(!1),ne("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center space-x-2"}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center space-x-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"user-count",className:"text-sm text-gray-400 font-light",children:"Number of users"}),a.jsx(ve,{id:"user-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"seed-role",className:"text-sm text-gray-400 font-light",children:"Role (optional)"}),a.jsxs(pn,{className:"bg-black text-white",value:te,onValueChange:ne,children:[a.jsx(mn,{id:"seed-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role (optional)"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"}),a.jsx(Pe,{value:"mix",children:"Mix (Random)"})]})]})]}),a.jsx(z,{onClick:()=>{var ue;const Z=parseInt(((ue=document.getElementById("user-count"))==null?void 0:ue.value)||"5",10);ft(Z,te||void 0)},disabled:xe,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:xe?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Users"]})})]})]}),Ee.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"User Seeding Terminal",lines:Ee,isRunning:xe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>{j(!1),ne("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),y&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-white/10 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{b(!1),se("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"create-name",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"create-email",type:"email",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-password",className:"text-sm text-gray-400 font-light",children:"Password"}),a.jsx(ve,{id:"create-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{className:"bg-black text-white",value:X,onValueChange:se,children:[a.jsx(mn,{id:"create-role",className:"mt-1 border border-dashed border-white/20 bg-black text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{b(!1),se("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ue,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),w&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{x(!1),Y("")},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center overflow-hidden",children:_.image?a.jsx("img",{src:_.image,alt:_.name,className:"w-14 h-14 object-cover"}):a.jsx(pp,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",defaultValue:_.name,placeholder:"e.g. John Doe",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"edit-email",type:"email",defaultValue:_.email,placeholder:"e.g. john@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{value:W,onValueChange:Y,children:[a.jsx(mn,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{x(!1),Y("")},disabled:ze,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Oe,disabled:ze,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:ze?"Updating...":"Update"})]})]})}),v&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:_.name}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>g(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:We,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),N&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none w-full max-w-lg p-6 shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"User Details"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-6 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-14 h-14 rounded-none border border-dashed border-white/15"}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:_.name}),a.jsx(Jt,{id:_.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsx("div",{className:"space-y-2 text-sm",children:[{label:"Email Verified",value:_.emailVerified?"Yes":"No"},{label:"Role",value:_.role||"—"},{label:"Banned",value:_.banned?"Yes":"No"},{label:"Ban Reason",value:_.banReason||"—"},{label:"Ban Expires",value:ix(_.banExpires)},{label:"Created",value:ix(_.createdAt)},{label:"Updated",value:ix(_.updatedAt)}].map(Z=>a.jsxs("div",{className:"flex items-center justify-between border border-dashed border-white/15 bg-black/90 px-3 py-2 rounded-none",children:[a.jsx("div",{className:"text-[11px] font-mono font-light uppercase tracking-wide text-gray-400",children:Z.label}),a.jsx("div",{className:"text-[10px] font-mono uppercase text-white text-right break-words max-w-[60%]",children:Z.value})]},Z.label))})]}),a.jsxs("div",{className:"flex justify-end gap-3 mt-8",children:[a.jsx(z,{onClick:()=>S(!1),className:"border border-white/20 bg-white/5 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:()=>{S(!1),e(`/users/${_.id}`)},className:"border border-white/20 bg-white text-black hover:bg-white/90 rounded-none",children:"View Details"})]})]})}),R&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),a.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",a.jsx("strong",{children:_.name})," from accessing the system."]}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),a.jsx(ve,{id:"banReason",value:T,onChange:Z=>O(Z.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),a.jsx(ve,{id:"banExpires",type:"number",value:q||"",onChange:Z=>k(Z.target.value?Number(Z.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{L(!1),O(""),k(void 0),I(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:nt,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),P&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-dashed border-green-400/50 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),a.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",a.jsx("strong",{children:_.name}),"? This will restore their access to the system."]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{U(!1),I(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:lt,className:"bg-green-600 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),F&&_&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{G(!1),I(null),document.getElementById("update-password").value=""},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:_.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${_.id}`,alt:_.name,className:"w-16 h-16 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:_.name}),a.jsx("div",{className:"text-sm text-gray-400",children:_.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"update-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),a.jsx(ve,{id:"update-password",type:"password",placeholder:"Enter new password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{G(!1),I(null),document.getElementById("update-password").value=""},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ut,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Password"})]})]})})]})}const xd=[{id:"signups",label:"Signups",analyticsKey:"newUsers",barClass:"bg-white/25 border border-white/10",dotClass:"bg-white/25"},{id:"logins",label:"Logins",analyticsKey:"activeUsers",barClass:"bg-white/20 border border-white/10",dotClass:"bg-white/20"},{id:"organizations",label:"Organizations",analyticsKey:"organizations",barClass:"bg-white/15 border border-white/10",dotClass:"bg-white/15"},{id:"teams",label:"Teams",analyticsKey:"teams",barClass:"bg-white/10 border border-white/10",dotClass:"bg-white/10"},{id:"sessions",label:"Sessions",analyticsKey:"sessions",barClass:"bg-white/5 border border-white/10",dotClass:"bg-white/5"}];function Xae(){const[e]=p.useState("overview"),[t,n]=p.useState(!1),[r,s]=p.useState(0),[i,o]=p.useState(0),[l,c]=p.useState("1D"),[u,h]=p.useState("1D"),[d,f]=p.useState(null),[m,y]=p.useState(!1),[b,w]=p.useState("Daily"),[x,v]=p.useState("Daily"),[g,N]=p.useState("Daily"),[S,E]=p.useState("Daily"),[j,R]=p.useState(!1),[L,P]=p.useState(!1),[U,F]=p.useState(!1),[G,_]=p.useState(!1),[I,A]=p.useState(null),[C,T]=p.useState(null),[O,q]=p.useState(null),[k,M]=p.useState(null),[$,W]=p.useState(null),[Y,te]=p.useState(void 0),[ne,X]=p.useState(void 0),[se,Ee]=p.useState(void 0),[re,xe]=p.useState(void 0),[ye,ze]=p.useState(void 0),[He,Fe]=p.useState(void 0),[Ye,ft]=p.useState(void 0),[et,de]=p.useState(void 0),[Be,Ue]=p.useState([]),[Oe,We]=p.useState([]),[nt,lt]=p.useState(0),[Ut,Kt]=p.useState([]),[Gt,_t]=p.useState([]),[ce,Te]=p.useState(0),[Ze,K]=p.useState(0),[pe,be]=p.useState(0),[_e,$e]=p.useState(0),[je,Z]=p.useState(0),[ue,Ae]=p.useState(!1),[Le,he]=p.useState(!1),[Q,oe]=p.useState({signups:[],logins:[],organizations:[],teams:[],sessions:[]}),[De,it]=p.useState([]),[tt,at]=p.useState(!1),[It,wn]=p.useState(0),[sn,ns]=p.useState(0),[In,qn]=p.useState(0),[sr,as]=p.useState(0),[nl,Ws]=p.useState(0),[Fn,Mt]=p.useState([]),[rs,ss]=p.useState(0),[is,Sr]=p.useState(0),[os,Er]=p.useState(0),{counts:Xs,loading:pa}=bm(),Qn=ha(),Fa=["Daily","Weekly","Monthly","Yearly","Custom"],Ks={Daily:"1D",Weekly:"1W",Monthly:"1M",Yearly:"1Y",Custom:"Custom"},ma=p.useMemo(()=>new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),[]),Jn=we=>we==null?"...":ma.format(Number(we)),ir=we=>we==null?"...":Number(we).toLocaleString(),Zs=p.useMemo(()=>xd.reduce((we,Ne)=>(we[Ne.id]=(Q[Ne.id]||[]).reduce((Re,me)=>Re+me,0),we),{}),[Q]),Qs=p.useMemo(()=>Object.values(Zs).reduce((we,Ne)=>we+Ne,0),[Zs]),al=(we,Ne)=>{const Re=we.currentTarget.getBoundingClientRect();M(Ne),W({x:Re.left+Re.width/2,y:Re.top})},ro=(()=>{const we=[];return I!=null&&I.isOutdated?we.push({id:"version-check",title:`Update Better-Auth to v${I.latest}`,severity:"high",date:new Date().toISOString().split("T")[0],description:"Your current version is outdated. Update to the latest version to get the latest security fixes, features, and improvements. Run: `pnpm install better-auth@latest`",affectedComponents:["All Components"],status:"pending",cve:""}):I&&we.push({id:"version-check",title:"Better-Auth is Up to date",severity:"low",date:new Date().toISOString().split("T")[0],description:"You are running the latest version of better-auth. Great job keeping your dependencies up to date!",affectedComponents:["All Components"],status:"applied",cve:""}),we.push(),we.push({id:"3",title:"Rate Limiting Configuration",severity:"medium",date:new Date().toISOString().split("T")[0],description:"Configure rate limiting for authentication endpoints to prevent brute force attacks. Better-auth provides built-in rate limiting middleware.",affectedComponents:["Auth Endpoints"],status:"pending"}),we.filter(Ne=>Ne.status!=="applied")})(),xt=p.useCallback(async(we,Ne,Re,me)=>{try{const Ce=new URLSearchParams({type:we,period:Ne});return Re&&Ce.append("from",Re.toISOString()),me&&Ce.append("to",me.toISOString()),await(await fetch(`/api/analytics?${Ce.toString()}`)).json()}catch{return null}},[]);p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/users/all")).json();Re!=null&&Re.success&&Re.users&&Mt(Re.users)}catch{Mt([])}})()},[]),p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/stats")).json();Re&&s(Re.activeUsers||0)}catch{s(0)}})()},[]),p.useEffect(()=>{(async()=>{const Ne=await xt("users",l,Y,ne);Ne&&(Ue(Ne.data||[]),We(Ne.labels||[]),lt(Ne.percentageChange||0))})()},[l,Y,ne,xt]),p.useEffect(()=>{if(Fn.length===0){ss(0),Sr(0);return}const we=new Date;let Ne,Re=we,me,Ce;if(x==="Custom"){if(!se||!re){ss(0),Sr(0);return}Ne=new Date(se),Re=new Date(re),Re.setHours(23,59,59,999);const Ft=Re.getTime()-Ne.getTime();Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-Ft)}else switch(x){case"Daily":Ne=new Date(we),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-24*60*60*1e3);break;case"Weekly":Ne=new Date(we),Ne.setDate(we.getDate()-we.getDay()),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(Ce.getTime()-7*24*60*60*1e3);break;case"Monthly":Ne=new Date(we.getFullYear(),we.getMonth(),1),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(we.getFullYear(),we.getMonth()-1,1),me.setHours(0,0,0,0);break;case"Yearly":Ne=new Date(we.getFullYear(),0,1),Ne.setHours(0,0,0,0),Ce=new Date(Ne.getTime()-1),me=new Date(we.getFullYear()-1,0,1),me.setHours(0,0,0,0);break;default:ss(0),Sr(0);return}const Ie=Fn.filter(Ft=>{if(!Ft.createdAt)return!1;const ea=new Date(Ft.createdAt);return ea>=Ne&&ea<=Re}),ke=Fn.filter(Ft=>{if(!Ft.createdAt)return!1;const ea=new Date(Ft.createdAt);return ea>=me&&ea<=Ce}),Se=Ie.length,Ge=ke.length;let Pt=0;Ge>0?Pt=(Se-Ge)/Ge*100:Se>0&&(Pt=100),ss(Se),Sr(Pt)},[Fn,x,se,re]),p.useEffect(()=>{(async()=>{if(!(u==="Custom"&&(!se||!re))){at(!0);try{const[Ne,Re,me,Ce,Ie]=await Promise.all([xt("newUsers",u,se,re),xt("activeUsers",u,se,re),xt("organizations",u,se,re),xt("teams",u,se,re),xt("sessions",u,se,re)]);Ne&&(Kt(Ne.data||[]),_t(Ne.labels||[])),oe({signups:(Ne==null?void 0:Ne.data)||[],logins:(Re==null?void 0:Re.data)||[],organizations:(me==null?void 0:me.data)||[],teams:(Ce==null?void 0:Ce.data)||[],sessions:(Ie==null?void 0:Ie.data)||[]}),it((Ne==null?void 0:Ne.labels)||(Re==null?void 0:Re.labels)||(me==null?void 0:me.labels)||(Ce==null?void 0:Ce.labels)||(Ie==null?void 0:Ie.labels)||[])}finally{at(!1)}}})()},[u,se,re,xt]),p.useEffect(()=>{(async()=>{const Ne=await xt("activeUsers","1D");Ne&&Te(Ne.percentageChange||0)})()},[xt]),p.useEffect(()=>{(async()=>{const Ne=Ks[g]||"1D",Re=Ne==="Custom";if(!(Re&&(!ye||!He))){Ae(!0);try{const me=await xt("organizations",Ne,Re?ye:void 0,Re?He:void 0);me&&($e(me.total||0),K(me.percentageChange||0))}catch{$e(0),K(0)}finally{Ae(!1)}}})()},[g,ye,He,xt]),p.useEffect(()=>{(async()=>{const Ne=Ks[S]||"1D",Re=Ne==="Custom";if(!(Re&&(!Ye||!et))){he(!0);try{const me=await xt("teams",Ne,Re?Ye:void 0,Re?et:void 0);me&&(Z(me.total||0),be(me.percentageChange||0))}catch{Z(0),be(0)}finally{he(!1)}}})()},[S,Ye,et,xt]),p.useEffect(()=>{(async()=>{const Ne=await xt("users","1D");Ne&&wn(Ne.percentageChange||0);const Re=await xt("organizations","1D");Re&&ns(Re.percentageChange||0);const me=await xt("activeUsers","1D");me&&qn(me.percentageChange||0);const[Ce,Ie,ke,Se,Ge]=await Promise.all([xt("newUsers","1D"),xt("activeUsers","1D"),xt("organizations","1D"),xt("teams","1D"),xt("sessions","1D")]);Ce?(o(Ce.total||0),Er(Ce.percentageChange||0)):(o(0),Er(0));const Ft=[(Ce==null?void 0:Ce.total)||0,(Ie==null?void 0:Ie.total)||0,(ke==null?void 0:ke.total)||0,(Se==null?void 0:Se.total)||0,(Ge==null?void 0:Ge.total)||0].reduce((Cr,kr)=>Cr+kr,0);Ws(Ft);const ga=[(Ce==null?void 0:Ce.previousTotal)||0,(Ie==null?void 0:Ie.previousTotal)||0,(ke==null?void 0:ke.previousTotal)||0,(Se==null?void 0:Se.previousTotal)||0,(Ge==null?void 0:Ge.previousTotal)||0].reduce((Cr,kr)=>Cr+kr,0);if(ga>0){const Cr=(Ft-ga)/ga*100;as(Cr)}else Ft>0?as(100):as(0)})()},[xt]),p.useEffect(()=>{(async()=>{try{const Re=await(await fetch("/api/version-check")).json();Re&&A({current:Re.current||"1.0.0",latest:Re.latest||"1.0.0",isOutdated:Re.isOutdated||!1})}catch{try{const Ce=(await(await fetch("/api/package-info")).json()).betterAuthVersion||"1.0.0",Ie="1.5.0";A({current:Ce,latest:Ie,isOutdated:Ce!==Ie})}catch{A({current:"1.0.0",latest:"1.5.0",isOutdated:!0})}}})()},[]);const jr=we=>{switch(we){case"critical":return"bg-white/10 text-white border-white/20";case"high":return"bg-white/10 text-white border-white/20";case"medium":return"bg-white/10 text-gray-300 border-white/20";case"low":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},Tr=we=>{switch(we){case"applied":return"bg-white/10 text-white border-white/20";case"scheduled":return"bg-white/10 text-gray-300 border-white/20";case"pending":return"bg-white/10 text-gray-400 border-white/20";default:return"bg-white/10 text-gray-400 border-white/20"}},ei=we=>{f(we),y(!0)},ls=()=>{y(!1),setTimeout(()=>f(null),300)},or=()=>{if(!Fn||Fn.length===0)return 0;const we=Fn.reduce((me,Ce)=>{const Ie=Ce!=null&&Ce.createdAt?new Date(Ce.createdAt):null;return!Ie||Number.isNaN(Ie.getTime())?me:me?Ie<me?Ie:me:Ie},null);if(!we)return 0;const Ne=new Date,Re=(Ne.getFullYear()-we.getFullYear())*12+(Ne.getMonth()-we.getMonth())+1;return Math.max(Re,0)},cs=()=>{const we=or();if(we<=0)return{labels:Array.from({length:12},(Ie,ke)=>`Week ${ke+1}`),expectedLength:12};if(we<3)return{labels:Array.from({length:12},(Ie,ke)=>`Week ${ke+1}`),expectedLength:12};if(we<=12){const ke=Fn.reduce((Ge,Pt)=>{const Ft=Pt!=null&&Pt.createdAt?new Date(Pt.createdAt):null;return!Ft||Number.isNaN(Ft.getTime())?Ge:Ge?Ft<Ge?Ft:Ge:Ft},null)||new Date,Se=Array.from({length:12},(Ge,Pt)=>new Date(ke.getFullYear(),ke.getMonth()+Pt,1).toLocaleDateString("en-US",{month:"short"}));return{labels:Se,expectedLength:Se.length}}const Ne=Math.max(1,Math.ceil(we/12)),me=(Fn.reduce((Ie,ke)=>{const Se=ke!=null&&ke.createdAt?new Date(ke.createdAt):null;return!Se||Number.isNaN(Se.getTime())?Ie:Ie?Se<Ie?Se:Ie:Se},null)||new Date).getFullYear(),Ce=Array.from({length:Ne},(Ie,ke)=>`${me+ke}`);return{labels:Ce,expectedLength:Ce.length}},Ba=(we,Ne="users")=>{const Re=Ne==="users"?Oe:Ne==="newUsers"?Gt:De,me={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7};if(we==="ALL"){if(Ne==="users"||Ne==="activity"){const{labels:ke}=cs();return ke}return[]}const Ce=me[we]||7;if(Re&&Re.length>0&&Re.length===Ce)return we==="1D"?Re.filter((ke,Se)=>Se%4===0).map(ke=>{const Se=parseInt(ke.replace("h",""),10);return Se===0?"12am":Se<12?`${Se}am`:Se===12?"12pm":`${Se-12}pm`}):we==="1W"?Re.map(ke=>ke.length>3?ke.substring(0,3):ke):we==="1M"?Re.map(ke=>{const Se=ke.split(" ");return Se.length>=2?Se[1]:ke}):we==="1Y"||we==="3M"||we==="6M"?Re.map(ke=>ke.length>3?ke.substring(0,3):ke):Re.map(ke=>ke.length>3?ke.substring(0,3):ke);const Ie=new Date;switch(we){case"1D":return["12am","4am","8am","12pm","4pm","8pm"];case"1W":return Array.from({length:7},(ke,Se)=>new Date(Ie.getTime()-(6-Se)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"short"}));case"1M":return Array.from({length:30},(ke,Se)=>new Date(Ie.getTime()-(29-Se)*24*60*60*1e3).getDate().toString());case"3M":return Array.from({length:3},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(2-Se),1).toLocaleDateString("en-US",{month:"short"}));case"6M":return Array.from({length:6},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(5-Se),1).toLocaleDateString("en-US",{month:"short"}));case"1Y":return Array.from({length:12},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(11-Se),1).toLocaleDateString("en-US",{month:"short"}));case"ALL":return Array.from({length:7},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(6-Se),1).toLocaleDateString("en-US",{month:"short"}));default:return["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},so=(we,Ne="users")=>{const Re=Ne==="users"?Oe:Gt;let Ce={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[we]||7;if(we==="ALL"&&Ne==="users"){const{labels:ke,expectedLength:Se}=cs();return Ce=Se||Ce,Re&&Re.length===ke.length,ke}if(we==="ALL"&&Ne!=="users")return[];if(Re&&Re.length>0&&Re.length===Ce)return we==="1D"?Re.map(ke=>{const Se=parseInt(ke.replace("h",""),10);return Se===0?"12am":Se<12?`${Se}am`:Se===12?"12pm":`${Se-12}pm`}):we==="1Y"||we==="3M"||we==="6M"?Re.map(ke=>{const Se=["January","February","March","April","May","June","July","August","September","October","November","December"],Pt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(ke);return Pt!==-1?Se[Pt]:ke}):Re;const Ie=new Date;switch(we){case"1D":return Array.from({length:24},(ke,Se)=>{const Ge=new Date;return Ge.setHours(Se,0,0,0),Ge.toLocaleTimeString("en-US",{hour:"numeric",hour12:!0})});case"1W":return Array.from({length:7},(ke,Se)=>new Date(Ie.getTime()-(6-Se)*24*60*60*1e3).toLocaleDateString("en-US",{weekday:"long"}));case"1M":return Array.from({length:30},(ke,Se)=>{const Ge=new Date(Ie.getTime()-(29-Se)*24*60*60*1e3),Pt=Ge.toLocaleDateString("en-US",{month:"short"}),Ft=Ge.getDate();return`${Pt} ${Ft}`});case"3M":return Array.from({length:3},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(2-Se),1).toLocaleDateString("en-US",{month:"long"}));case"6M":return Array.from({length:6},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(5-Se),1).toLocaleDateString("en-US",{month:"long"}));case"1Y":return Array.from({length:12},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(11-Se),1).toLocaleDateString("en-US",{month:"long"}));case"ALL":return Array.from({length:7},(ke,Se)=>new Date(Ie.getFullYear(),Ie.getMonth()-(6-Se),1).toLocaleDateString("en-US",{month:"long"}));default:return["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]}},ds=(we,Ne="users")=>{const Re=Ne==="users"?Be:Ut;let Ce={"1D":24,"1W":7,"1M":30,"3M":3,"6M":6,"1Y":12,ALL:7}[we]||7;if(we==="ALL"&&Ne==="users"){const{expectedLength:Ge}=cs();Ce=Ge||Ce}if(we==="ALL"&&Ne==="activity"){const{expectedLength:Ge}=cs();Ce=Ge||Ce}if(!Re||Re.length===0)return Array(Ce).fill(0);const Ie=[...Re];for(;Ie.length<Ce;)Ie.push(0);const ke=Ie.slice(0,Ce),Se=Math.max(...ke,1);return ke.map(Ge=>Ge/Se*100)},rl=()=>{const we=u==="ALL"?Ba("ALL","activity"):De.length>0?De:Ba(u,"activity"),Ne=we.map((me,Ce)=>xd.reduce((Ie,ke)=>{var Se;return Ie+(((Se=Q[ke.id])==null?void 0:Se[Ce])??0)},0)),Re=Math.max(...Ne,1);return a.jsxs("div",{className:"space-y-6 min-h-screen h-full mt-5 flex-1 overflow-y-hidden overflow-x-hidden px-0",children:[a.jsx("div",{className:"px-6 overflow-hidden",children:a.jsxs("div",{className:"flex items-center justify-between gap-8 py-4 px-6 bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none overflow-x-auto relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Users"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.users)}),a.jsxs("div",{className:`flex items-center gap-1 ${It>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${It<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(It).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(ka,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Organizations"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.organizations)}),a.jsxs("div",{className:`flex items-center gap-1 ${sn>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${sn<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(sn).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(RC,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Sessions"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(Xs.sessions)}),a.jsxs("div",{className:`flex items-center gap-1 ${In>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${In<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(In).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(AC,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"Activity Hits"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(nl??0)}),a.jsxs("div",{className:`flex items-center gap-1 ${sr>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${sr<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(sr).toFixed(1),"%"]})]})]})]}),a.jsx("div",{className:"h-8 w-[1px] bg-white/10"}),a.jsxs("div",{className:"flex items-center gap-3 min-w-fit",children:[a.jsx("div",{className:"w-10 h-10 rounded-none bg-white/5 border border-dashed border-white/10 flex items-center justify-center flex-shrink-0",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-400 text-sm uppercase tracking-wide",children:"New Users"}),a.jsx("span",{className:"text-white text-lg font-medium",children:pa?"...":Jn(i??0)}),a.jsxs("div",{className:`flex items-center gap-1 ${os>=0?"text-green-500":"text-red-500"}`,children:[a.jsx("svg",{className:`w-3 h-3 ${os<0?"rotate-180":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.abs(os).toFixed(1),"%"]})]})]})]})]})}),a.jsxs("div",{className:"px-6 pb-10 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"TOTAL USER"}),a.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","6M","1Y","ALL"].map(me=>a.jsx("button",{onClick:()=>c(me),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${l===me?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:me},me))})]}),a.jsx("div",{className:"flex justify-between items-end mb-4",children:(()=>{const me=ds(l,"users"),Ie=(Be.length>0?Be.slice(0,me.length):Array(me.length).fill(0)).reduce((ke,Se)=>ke+Se,0);return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-4xl text-white font-light",children:pa?"...":Jn(Ie)}),a.jsxs("div",{className:"flex items-center gap-1 px-2 py-1",children:[a.jsx("svg",{className:`w-3 h-3 ${nt>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${nt>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(nt).toFixed(1),"%"]})]})]})})()}),a.jsxs("div",{className:"space-y-2 relative",children:[(()=>{const me=ds(l,"users"),Ce=Be.length>0?Be.slice(0,me.length):Array(me.length).fill(0),Ie=Math.max(...Ce,1),ke=Array.from({length:6},(Se,Ge)=>Ie/5*(5-Ge));return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex flex-col justify-between h-48 text-xs text-gray-500 font-mono pt-0.5 pb-0.5",children:ke.map((Se,Ge)=>a.jsx("span",{className:"leading-none",children:Jn(Math.round(Se))},Ge))}),a.jsxs("div",{className:"flex-1 h-48 relative",children:[a.jsx("div",{className:"absolute inset-0 flex flex-col justify-between z-0",children:[0,1,2,3,4,5].map(Se=>a.jsx("div",{className:"w-full h-px bg-white/10",style:{opacity:.3}},Se))}),a.jsx("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:a.jsx("defs",{children:a.jsxs("linearGradient",{id:"usersBarGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",style:{stopColor:"rgba(255, 255, 255, 0.3)",stopOpacity:1}}),a.jsx("stop",{offset:"100%",style:{stopColor:"rgba(255, 255, 255, 0.05)",stopOpacity:1}})]})})}),a.jsx("div",{className:"h-48 flex items-end justify-between space-x-1 relative z-10",children:me.map((Se,Ge)=>{const Pt=C===Ge;return a.jsx("div",{className:"flex-1 transition-all duration-200 ease-out relative cursor-pointer group",style:{height:`${Se}%`,background:"url(#usersBarGradient)"},onMouseEnter:Ft=>{const ea=Ft.currentTarget.getBoundingClientRect(),ga=ea.left+ea.width/2,Cr=ea.top,kr=150,Gc=60,ch=Math.max(kr/2,Math.min(window.innerWidth-kr/2,ga)),sl=Math.max(Gc+10,Math.min(window.innerHeight-10,Cr));T(Ge),q({x:ch,y:sl})},onMouseLeave:()=>{T(null),q(null)},children:a.jsx("div",{className:"w-full h-full",style:{background:"linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.285))",opacity:Pt?1:.8}})},Ge)})}),C!==null&&O&&a.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${O.x}px`,top:`${O.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg whitespace-nowrap",children:[a.jsx("div",{className:"text-xs text-gray-400 mb-1 font-mono uppercase",children:so(l,"users")[C]}),a.jsxs("div",{className:"text-sm text-white font-sans font-medium",children:[Be[C]!==void 0?Be[C].toLocaleString():"0"," ",a.jsx("span",{className:"font-mono text-xs text-gray-400",children:"users"})]})]})})]})]})})(),a.jsx("div",{className:`flex justify-between ${l==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:Ba(l,"users").map((me,Ce)=>a.jsx("span",{className:"flex-1 text-center truncate",children:me},Ce))})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm text-white uppercase font-light",children:"Activity Hits"}),a.jsx("p",{className:"text-4xl text-white font-light mt-1",children:tt?"...":ir(Qs)}),a.jsx("p",{className:"text-xs text-gray-400",children:"Tracked events in selected period"})]}),a.jsx("div",{className:"flex items-center space-x-1 overflow-x-auto",children:["1D","1W","3M","6M","1Y","ALL"].map(me=>a.jsx("button",{onClick:()=>h(me),className:`px-2 py-1 text-xs font-light transition-colors whitespace-nowrap ${u===me?"bg-white/20 text-white border border-white/30":"text-gray-500 hover:text-white"}`,children:me},me))})]}),a.jsxs("div",{className:"space-y-2 relative",children:[a.jsx("div",{className:"h-40 flex items-end gap-1",children:we.map((me,Ce)=>{const Ie=Ne[Ce]||0;return a.jsx("div",{className:"flex-1 flex flex-col justify-end gap-[1px] h-full cursor-pointer",onMouseEnter:ke=>al(ke,Ce),onMouseLeave:()=>{M(null),W(null)},children:xd.map(ke=>{var Pt;const Se=((Pt=Q[ke.id])==null?void 0:Pt[Ce])??0,Ge=Ie===0||Re===0?0:Math.max(Se/Re*100,Se>0?4:0);return a.jsx("div",{className:`w-full ${ke.barClass}`,style:{height:`${Ge}%`}},`${ke.id}-${Ce}`)})},`${me}-${Ce}`)})}),tt&&a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center text-xs uppercase text-gray-400 pointer-events-none",children:"Loading activity..."}),k!==null&&$&&a.jsx("div",{className:"fixed z-50 pointer-events-none transition-all duration-200 ease-out animate-in fade-in",style:{left:`${$.x}px`,top:`${$.y}px`,transform:"translate(-50%, -100%)",maxWidth:"calc(100vw - 20px)"},children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-sm px-3 py-2 shadow-lg min-w-[180px]",children:[a.jsx("div",{className:"text-xs text-gray-400 mb-2 font-mono uppercase",children:we[k]||`Bucket ${k+1}`}),a.jsx("div",{className:"space-y-1",children:xd.map(me=>{var Ce;return a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[a.jsx("span",{className:`w-2 h-2 rounded-sm ${me.dotClass}`}),me.label]}),a.jsx("span",{className:"text-white font-medium",children:((Ce=Q[me.id])==null?void 0:Ce[k])??0})]},me.id)})})]})}),a.jsx("div",{className:`flex justify-between ${u==="1M"?"text-[10px]":"text-xs"} text-gray-500 font-mono`,children:we.map((me,Ce)=>a.jsx("span",{className:"flex-1 text-center truncate",children:me},Ce))}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3 mt-4 pt-4 border-t border-white/10",children:xd.map(me=>a.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-2 h-2 rounded-sm ${me.dotClass}`}),me.label]}),a.jsx("span",{className:"text-white font-medium",children:tt?"...":ir(Zs[me.id]||0)})]},me.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>R(!j),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:b})]}),j&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{w(me),R(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),b==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),Y?Yn(Y,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:Y,onSelect:te,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),ne?Yn(ne,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:ne,onSelect:X,initialFocus:!0,disabled:me=>Y?me<Y:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Active Users"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Users with active session in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ir(r)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 border-white/5 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${ce>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${ce>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(ce).toFixed(1),"%"]})]})})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>P(!L),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:x})]}),L&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{v(me),P(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),x==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),se?Yn(se,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:se,onSelect:Ee,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),re?Yn(re,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:re,onSelect:xe,initialFocus:!0,disabled:me=>se?me<se:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"New Users"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Newly registered Users in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ir(rs)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${is>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",style:is<0?{transform:"rotate(180deg)"}:{},children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${is>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(is).toFixed(1),"%"]})]})})]})]})]}),a.jsxs("div",{className:"space-y-4 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>F(!U),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:g})]}),U&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{N(me),F(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),g==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),ye?Yn(ye,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:ye,onSelect:ze,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),He?Yn(He,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:He,onSelect:Fe,initialFocus:!0,disabled:me=>ye?me<ye:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Organizations"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total organizations in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:ue?"...":ir(_e)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${Ze>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${Ze>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(Ze).toFixed(1),"%"]})]})})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pb-2 relative",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsxs("div",{className:"flex items-center justify-between mb-2 relative -mt-2 pb-1",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>_(!G),className:"text-xs h-full font-mono uppercase text-gray-400 flex items-center space-x-1 hover:text-white transition-colors",children:[a.jsx(qh,{className:"w-3 h-3"}),a.jsx("span",{children:S})]}),G&&a.jsx("div",{className:"absolute top-6 left-0 w-[150px] z-10 bg-black border border-white/10 rounded-none shadow-lg",children:Fa.map(me=>a.jsx("button",{onClick:()=>{E(me),_(!1)},className:"block border-b border-dashed border-white/5 w-full text-left px-4 py-2 text-xs text-white hover:bg-white/10 transition-colors whitespace-nowrap",children:me},me))})]}),S==="Custom"&&a.jsxs("div",{className:"h-0 flex items-center gap-2",children:[a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),Ye?Yn(Ye,"MMM dd yyyy"):"From"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:Ye,onSelect:ft,initialFocus:!0,className:"rounded-none"})})]}),a.jsxs(Va,{children:[a.jsx(Ya,{asChild:!0,children:a.jsxs(z,{variant:"outline",className:"h-6 px-2 text-xs font-mono uppercase text-gray-400 hover:text-white bg-transparent border-white/10 hover:bg-white/5",children:[a.jsx(dr,{className:"mr-1 h-3 w-3"}),et?Yn(et,"MMM dd yyyy"):"To"]})}),a.jsx(Ta,{className:"w-auto p-0 bg-black border-white/10",children:a.jsx(Ga,{mode:"single",selected:et,onSelect:de,initialFocus:!0,disabled:me=>Ye?me<Ye:!1,className:"rounded-none"})})]})]})]}),a.jsx("hr",{className:"mb-2 -mx-10 border-white/10"}),a.jsx("h4",{className:"text-md text-white/80 uppercase font-mono font-light mb-1",children:"Teams"}),a.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Total teams in the time frame"}),a.jsxs("div",{className:"flex pt-4 justify-between items-end",children:[a.jsx("p",{className:"text-3xl text-white font-light",children:Le?"...":ir(je)}),a.jsx("div",{className:"mt-2 mb-1 flex items-center gap-2",children:a.jsxs("div",{className:"flex items-center -mr-5 gap-1 px-2 py-1 rounded-none",children:[a.jsx("svg",{className:`w-3 h-3 ${pe>=0?"text-green-500":"text-red-500 rotate-180"}`,viewBox:"0 0 12 12",fill:"currentColor",children:a.jsx("path",{d:"M6 0 L12 12 L0 12 Z"})}),a.jsxs("span",{className:`text-xs font-medium ${pe>=0?"text-green-500":"text-red-500"}`,children:[Math.abs(pe).toFixed(1),"%"]})]})})]})]})]}),a.jsxs("div",{className:"bg-gradient-to-b from-white/[4%] to-white/[2.5%] border border-white/10 rounded-none p-6 pt-4 overflow-hidden relative flex flex-col",children:[a.jsx("div",{className:"absolute top-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute top-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[12px] h-[0.5px] bg-white/20"}),a.jsx("div",{className:"absolute bottom-0 right-0 w-[0.5px] h-[12px] bg-white/20"}),a.jsx("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white/60"}),a.jsx("h4",{className:"text-xs text-gray-400 uppercase font-mono font-light",children:"Security Insights"})]})}),a.jsx("hr",{className:"-mx-10 -mt-1 border-white/10"}),a.jsxs("div",{className:"space-y-3 overflow-y-auto custom-scrollbar max-h-[400px]",children:[ro.length===0&&a.jsx("div",{className:"text-sm flex items-center justify-center text-gray-400",children:a.jsxs("div",{className:"flex mt-5 items-center justify-center",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400 mr-2"}),a.jsx("p",{className:"text-center",children:"No security insights found"})]})}),ro.map((me,Ce)=>a.jsx("div",{onClick:()=>ei(me),className:"group py-2 border-b border-white/5 cursor-pointer transition-all duration-200 hover:border-white/20",style:{animation:`slideIn 0.3s ease-out ${Ce*.1}s both`},children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:a.jsx("span",{className:"text-sm text-white/90 font-light truncate group-hover:text-white transition-colors",children:me.title})}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm uppercase font-mono ${jr(me.severity)}`,children:me.severity}),a.jsx("span",{className:`text-[9px] px-1.5 py-0.5 border rounded-sm capitalize font-mono ${Tr(me.status)}`,children:me.status})]})]}),a.jsx(yu,{className:"w-3.5 h-3.5 text-gray-500 group-hover:text-white transition-all flex-shrink-0 mt-0.5"})]})},me.id))]})]})]})]})]})};return a.jsxs("div",{className:"h-screen bg-black text-white overflow-hidden flex flex-col",style:{overflowX:"hidden"},children:[a.jsx("div",{className:"flex-1 overflow-hidden",children:e==="overview"?rl():e==="users"?a.jsx(BU,{}):e==="organizations"?a.jsx(FU,{}):rl()}),t&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-3xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RC,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-lg text-white font-light",children:"Quick Actions"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("button",{onClick:()=>{n(!1),Qn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View All Users"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Manage user accounts"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/organizations")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View Organizations"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Manage organizations"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/sessions")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(AC,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"View Sessions"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Monitor active sessions"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/database")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(Rs,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Database Schema"}),a.jsx("p",{className:"text-sm text-gray-400",children:"View schema visualizer"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/settings")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(OU,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Settings"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Configure system"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]}),a.jsxs("button",{onClick:()=>{n(!1),Qn("/users")},className:"flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none hover:bg-black/50 transition-colors text-left group",children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:a.jsx(_U,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:"Search Users"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Find specific users"})]}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]})]}),a.jsx("div",{className:"mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-400",children:[a.jsx("span",{children:"Tip: Press Ctrl+K or Cmd+K for command palette"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>n(!1),className:"text-gray-400 hover:text-white rounded-none",children:"Close"})]})})]})}),m&&d&&a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",style:{animation:"fadeIn 0.3s ease-out"},onClick:ls,children:a.jsxs("div",{className:"bg-black border border-white/20 rounded-none max-w-2xl w-full max-h-[80vh] overflow-y-auto",style:{animation:"slideUp 0.3s ease-out"},onClick:we=>we.stopPropagation(),children:[a.jsx("div",{className:"sticky top-0 bg-black border-b border-white/10 p-6 z-10",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(Ln,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light",children:d.title})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:`text-xs px-2 py-1 border rounded-none uppercase font-medium ${jr(d.severity)}`,children:[d.severity," Severity"]}),a.jsx("span",{className:`text-xs px-2 py-1 border rounded-none capitalize ${Tr(d.status)}`,children:d.status}),d.cve&&a.jsx("span",{className:"text-xs text-gray-400 font-mono bg-white/5 px-2 py-1 border border-white/10 rounded-none",children:d.cve})]})]}),a.jsx("button",{onClick:ls,className:"p-2 hover:bg-white/10 transition-colors rounded-none",children:a.jsx(dt,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]})}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Release Date"}),a.jsx("p",{className:"text-white",children:new Date(d.date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-2",children:"Description"}),d.description.includes("npm install")?a.jsxs("div",{children:[a.jsx("p",{className:"text-white leading-relaxed mb-3",children:d.description.split("Run:")[0]}),a.jsx("div",{className:"relative group",children:a.jsx("div",{className:"bg-black border border-white/20 rounded-none p-3 font-mono text-sm",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("code",{children:[a.jsx("span",{className:"text-green-400",children:"$"})," ",a.jsx("span",{className:"text-cyan-400",children:"npm"})," ",a.jsx("span",{className:"text-yellow-400",children:"install"})," ",a.jsx("span",{className:"text-white",children:"better-auth@latest"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("npm install better-auth@latest"),V.success("Command copied to clipboard")},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded",title:"Copy command",children:a.jsx(va,{className:"w-4 h-4 text-gray-400 hover:text-white"})})]})})})]}):a.jsx("p",{className:"text-white leading-relaxed",children:d.description})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm text-gray-400 uppercase tracking-wide mb-3",children:"Affected Components"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:d.affectedComponents.map((we,Ne)=>a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-white/5 border border-white/10 rounded-none",style:{animation:`slideIn 0.3s ease-out ${Ne*.1}s both`},children:[a.jsx("div",{className:"w-2 h-2 bg-white rounded-none flex-shrink-0"}),a.jsx("span",{className:"text-sm text-white",children:we})]},Ne))})]}),a.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-none",children:a.jsxs("div",{className:"flex items-start gap-3",children:[d.status==="applied"&&a.jsxs(a.Fragment,{children:[a.jsx(Ep,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Patch Applied"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This security patch has been successfully applied to your system."})]})]}),d.status==="scheduled"&&a.jsxs(a.Fragment,{children:[a.jsx(RU,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Scheduled"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This patch is scheduled for deployment in the next maintenance window."})]})]}),d.status==="pending"&&a.jsxs(a.Fragment,{children:[a.jsx(kae,{className:"w-5 h-5 text-white flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-sm text-white font-medium mb-1",children:"Action Required"}),a.jsx("p",{className:"text-xs text-gray-400",children:"This patch is pending review and requires manual approval before deployment."})]})]})]})}),a.jsx("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:a.jsx(z,{variant:"ghost",onClick:ls,className:"text-gray-400 hover:text-white rounded-none",children:"Close"})})]})]})}),a.jsx("style",{children:`
530
530
  @keyframes fadeIn {
531
531
  from {
532
532
  opacity: 0;
@@ -935,7 +935,7 @@ export const auth = betterAuth({
935
935
  },
936
936
  }),
937
937
  ],
938
- });`}[de]||""},ye=de=>{navigator.clipboard.writeText(de),V.success("Copied to clipboard")},ze=Object.values(aa).filter(de=>c==="all"||de.category===c);return a.jsxs("div",{className:"h-full flex flex-col bg-black",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{className:"pb-8",children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Emails"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Customize your email templates with a visual editor"})]})}),a.jsxs("div",{className:"flex flex-col items-center space-y-8",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{className:"w-[340px] border-r border-dashed border-white/15 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-dashed border-white/15 flex-shrink-0",children:[a.jsx("h2",{className:"text-lg font-light text-white uppercase tracking-wider mb-4",children:"Templates"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:["all","authentication","organization","notification"].map(de=>a.jsx("button",{onClick:()=>u(de),className:`px-2 py-1 text-[10px] font-mono uppercase border border-dashed rounded-none transition-colors ${c===de?"border-white/30 bg-white/5 text-white":"border-white/10 bg-black/40 text-gray-300 hover:border-white/20"}`,children:de},de))})]}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-2",style:{overscrollBehavior:"contain"},children:ze.map(de=>a.jsxs("button",{onClick:()=>W(de.id),className:`w-full text-left p-3 border border-dashed rounded-none transition-colors ${e===de.id?"border-white/30 bg-white/5 text-white":"border-white/15 bg-black/40 text-gray-300 hover:border-white/20 hover:bg-white/5"}`,children:[a.jsx("div",{className:"text-sm uppercase font-mono",children:de.name}),a.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[de.fields.length," fields"]})]},de.id))})]}),a.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border-b border-dashed border-white/15 p-4 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-light text-white uppercase tracking-wider",children:(He=aa[e])==null?void 0:He.name}),a.jsx("p",{className:"text-xs text-gray-400 font-mono mt-1",children:(Fe=aa[e])==null?void 0:Fe.category})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs(z,{variant:"outline",onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(m3,{className:"w-4 h-4 mr-2"}),"Test Email"]}),a.jsxs(z,{variant:"outline",onClick:()=>{xe(e)&&l(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(fi,{className:"w-4 h-4 mr-2"}),"Export Code"]}),a.jsxs(z,{variant:"outline",onClick:()=>ye(n),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(Ec,{className:"w-4 h-4 mr-2"}),"Copy HTML"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-dashed border-white/10 bg-black/40",children:a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject"}),a.jsx(ve,{value:s,onChange:de=>te(de.target.value),placeholder:"Email subject",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-sm"})]}),a.jsxs(z,{variant:"outline",onClick:()=>m(!f),className:"h-10 border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[f?"Hide":"Show"," Fields"]})]})}),f&&e&&a.jsxs("div",{className:"p-4 border-b overflow-hidden border-dashed border-white/10 bg-black/30",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Fields"}),a.jsx("div",{className:"grid grid-cols-2 gap-3 max-h-full overflow-y-hidden",children:(Ye=aa[e])==null?void 0:Ye.fields.map(de=>a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs font-mono text-gray-400 mb-1 block",children:de}),a.jsx(ve,{value:h[de]||"",onChange:Be=>d(Ue=>({...Ue,[de]:Be.target.value})),placeholder:`{{${de}}}`,className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"})]},de))}),a.jsx("div",{className:"mt-4 flex justify-end",children:a.jsx(z,{variant:"outline",onClick:Ee,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Apply Changes"})})]}),e&&a.jsxs("div",{className:"p-4 border-b border-dashed border-white/10 bg-black/40",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Dynamic Fields"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:(ft=aa[e])==null?void 0:ft.fields.map(de=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ye(`{{${de}}}`),className:"text-xs rounded-none border border-dashed border-white/20 hover:bg-white/10",children:de}),a.jsx("span",{className:"text-xs text-gray-500 font-mono",children:`{{${de}}}`})]},de))})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Efe,{html:re,onChange:Y})})]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-0",children:a.jsxs("div",{className:"text-center",children:[a.jsx(jc,{className:"w-16 h-16 text-white/20 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-400 font-mono uppercase text-sm",children:"Select a template to start editing"})]})})})]}),o&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&l(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-5xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-0 pt-2 border-white/15 border-b-0 bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between p-2 pt-2",children:a.jsxs("div",{className:"pb-2",children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Export"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Export the code for the selected template"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>l(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("div",{className:"relative z-20 h-8 w-[calc(100%)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#e0f2fe,#e0f2fe_1px,transparent_1px,transparent_6px)] opacity-[8%]"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),a.jsx("div",{className:"flex-1 overflow-auto p-6 bg-black",children:a.jsx(w6,{code:xe(e),language:"typescript",fileName:"auth.ts"})}),a.jsx("div",{className:"flex items-center justify-end p-6 border-t border-white/15 bg-black/50",children:a.jsx(z,{onClick:ne,disabled:w,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2",children:w?"Applying...":"Apply to auth config"})})]})}),v&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&g(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-white/15 border-b bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Setup Required"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Install Resend before applying email template"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 bg-black",children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{children:[a.jsx("h2",{className:"text-md font-mono uppercase font-normal text-white mb-3",children:"Install Resend"}),a.jsx("p",{className:"text-gray-300 mb-4 font-sans leading-relaxed",children:"You need to install the Resend package to send emails. Run the following command in your terminal:"}),a.jsx("div",{className:"bg-black/80 border border-dashed border-white/20 p-2 pl-3 rounded-none font-mono text-sm relative group",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("code",{className:"text-gray-200",children:[a.jsx("span",{className:"text-white",children:"$"})," ",a.jsx("span",{className:"text-blue-600",children:"pnpm"})," ",a.jsx("span",{className:"text-white",children:"install"})," ",a.jsx("span",{className:"text-white",children:"resend"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("pnpm install resend"),S(!0),setTimeout(()=>S(!1),2e3)},className:"flex items-center gap-2 px-2 py-1.5 rounded-none transition-colors text-gray-300 hover:text-white",title:"Copy command",children:N?a.jsx(a.Fragment,{children:a.jsx(Cd,{className:"w-4 h-4"})}):a.jsx(a.Fragment,{children:a.jsx(Ec,{className:"w-4 h-4"})})})]})})]})})}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/15 bg-black/50",children:[a.jsx(z,{variant:"ghost",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none font-mono uppercase text-xs px-6 py-2",children:"Cancel"}),a.jsx(z,{onClick:()=>X(e),disabled:w,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2",children:w?"Applying...":"Continue"})]})]})}),E&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&j(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-white/15 border-b bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Test Email"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Send a test email with dynamic values"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 bg-black",children:a.jsxs("div",{className:"space-y-6",children:[_==="checking"&&a.jsx("div",{className:"bg-black/90 flex border p-4 rounded-none border-dashed border-white/20",children:a.jsxs("p",{className:"text-white text-sm font-sans flex items-center gap-2 leading-relaxed",children:[a.jsx(er,{className:"w-4 h-4 animate-spin mr-1"})," Checking for RESEND_API_KEY..."]})}),_==="missing"&&a.jsxs("div",{className:"bg-red-900/20 border border-red-500/30 border-dashed p-4 rounded-none",children:[a.jsx("p",{className:"text-red-200 text-sm font-sans leading-relaxed mb-2",children:a.jsx("strong",{className:"font-normal uppercase font-mono",children:"RESEND_API_KEY not found"})}),a.jsxs("p",{className:"text-red-200 text-sm font-sans leading-relaxed",children:["Please add"," ",a.jsx("code",{className:"bg-black/50 px-1 py-0.5 rounded font-mono text-xs",children:"RESEND_API_KEY"})," ","to your"," ",a.jsx("code",{className:"bg-black/50 px-1 py-0.5 rounded font-mono text-xs",children:".env"})," ","file."]})]}),_==="found"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"From Email (Verified Sender) *"}),A.length>0?a.jsx("select",{value:T,onChange:de=>O(de.target.value),className:"w-full bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs p-2 focus:outline-none focus:border-white/40",children:A.map(de=>a.jsx("option",{value:de,children:de},de))}):a.jsx(ve,{type:"email",value:T,onChange:de=>O(de.target.value),placeholder:"noreply@yourdomain.com",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:A.length>0?"Select a verified sender email from your Resend account":"Enter a verified sender email address from your Resend account"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject *"}),a.jsx(ve,{type:"text",value:q,onChange:de=>k(de.target.value),placeholder:"Email subject",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:"Email subject line (supports dynamic placeholders)"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"To Email Address *"}),a.jsx(ve,{type:"email",value:R,onChange:de=>L(de.target.value),placeholder:"recipient@example.com",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:"Any email address to receive the test email"})]}),((et=aa[e])==null?void 0:et.fields)&&aa[e].fields.length>0&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Dynamic Values"}),a.jsx("div",{className:"space-y-3",children:aa[e].fields.map(de=>a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-500 mb-1 block",children:de}),a.jsx(ve,{value:P[de]||"",onChange:Be=>U({...P,[de]:Be.target.value}),placeholder:`Enter ${de}`,className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"})]},de))})]})]})]})}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/15 bg-black/50",children:[a.jsx(z,{variant:"ghost",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none font-mono uppercase text-xs px-6 py-2",children:"Cancel"}),a.jsx(z,{onClick:$,disabled:F||_!=="found"||!R||!T||!q,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2 disabled:opacity-50 disabled:cursor-not-allowed",children:F?"Sending...":"Send Test Email"})]})]})})]})}function Tfe(){const e=ha(),[t]=yM(),n=t.get("redirect")||"/",[r,s]=p.useState(""),[i,o]=p.useState(""),[l,c]=p.useState(""),[u,h]=p.useState(!1),d=async f=>{var m;f.preventDefault(),h(!0),c("");try{const y=((m=window.__STUDIO_CONFIG__)==null?void 0:m.basePath)||"",b=y?`${y}/auth`:"/api/auth",w=await fetch(`${b}/sign-in`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:i}),credentials:"include"}),x=await w.json();if(!w.ok){if(w.status===403){e("/access-denied");return}throw new Error(x.message||"Invalid credentials")}if(x.success)e(n);else throw new Error(x.message||"Login failed")}catch(y){c(y.message||"Login failed")}finally{h(!1)}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-[3%]",children:a.jsx("div",{className:"absolute inset-0 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_8px)]"})}),a.jsx("div",{className:"w-full max-w-md relative z-10",children:a.jsxs("div",{className:"border border-dashed border-white/20 bg-black p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"flex relative justify-between items-center gap-2 mb-4",children:a.jsxs("span",{className:"flex w-full text-left justify-start items-center text-white text-xs font-mono uppercase tracking-wider",children:["better auth"," ",a.jsx("span",{className:"bg-white text-black px-1 ml-1 rounded-none",children:"studio"})]})}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-white text-lg font-mono uppercase tracking-wide mb-1",children:"Admin Access"}),a.jsx("p",{className:"text-white/40 text-xs font-mono",children:"Sign in with your admin account"})]}),l&&a.jsx("div",{className:"mb-4 p-3 border border-dashed border-red-500/30 bg-red-500/5",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wl,{className:"w-4 h-4 text-red-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-red-400 text-xs font-mono",children:l})]})}),a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-white/50 text-[10px] font-mono uppercase tracking-wider block mb-1.5",children:"Email"}),a.jsx("input",{type:"email",value:r,onChange:f=>s(f.target.value),placeholder:"admin@example.com",className:"w-full h-10 px-3 bg-black border border-dashed border-white/20 text-white text-sm font-mono placeholder:text-white/20 focus:outline-none focus:border-white/40 transition-colors",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-white/50 text-[10px] font-mono uppercase tracking-wider block mb-1.5",children:"Password"}),a.jsx("input",{type:"password",value:i,onChange:f=>o(f.target.value),placeholder:"••••••••",className:"w-full h-10 px-3 bg-black border border-dashed border-white/20 text-white text-sm font-mono placeholder:text-white/20 focus:outline-none focus:border-white/40 transition-colors",required:!0})]}),a.jsx("button",{type:"submit",disabled:u,className:"w-full h-10 bg-white text-black text-xs font-mono uppercase tracking-wider hover:bg-white/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:u?a.jsx(WY,{className:"w-3 h-3 animate-spin"}):"Sign In"})]}),a.jsx("div",{className:"mt-6",children:a.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2"})}),a.jsx("div",{className:"mt-6 pt-4 border-t border-dashed border-white/10",children:a.jsx("p",{className:"text-white/30 uppercase tracking-wider text-[10px] font-mono text-center",children:"admin role required for access"})})]})})]})}const Cfe=q5("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-white text-black hover:bg-white",secondary:"border-transparent bg-gray-800 text-white hover:bg-gray-800 border border-gray-600",destructive:"border-transparent bg-red-500 text-white hover:bg-red-600",outline:"text-gray-300 border-gray-600",success:"border-transparent bg-green-900 text-green-300",warning:"border-transparent bg-yellow-900 text-yellow-300",error:"border-transparent bg-red-900 text-red-300",info:"border-transparent bg-gray-800 text-white border border-gray-600"}},defaultVariants:{variant:"default"}});function $t({className:e,variant:t,...n}){return a.jsx("div",{className:Ve(Cfe({variant:t}),e),...n})}function kfe(){const{orgId:e}=iS(),t=ha(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState([]),[h,d]=p.useState(!0),[f,m]=p.useState("details"),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(!1),[A,C]=p.useState(null),[T,O]=p.useState({name:"",slug:""}),[q,k]=p.useState(""),[M,$]=p.useState(""),[W,Y]=p.useState([]),[te,ne]=p.useState({name:""}),[X,se]=p.useState(!1),[Ee,re]=p.useState([]),[xe,ye]=p.useState(!1),[ze,He]=p.useState([]),[Fe,Ye]=p.useState(!1),[ft,et]=p.useState(!1);p.useEffect(()=>{e&&(Be(),Oe(),Ue(),nt(),lt(),We());const Z=setInterval(()=>{!w&&e&&Oe()},2e3);return()=>clearInterval(Z)},[e,w]),p.useEffect(()=>{y&&e&&We()},[]),p.useEffect(()=>{f==="members"&&e&&lt()},[f,e]),p.useEffect(()=>{f==="invitations"&&e&&nt()},[f,e]);const de=Z=>{ne({name:Z})},Be=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}`)).json();oe.success&&oe.organization||oe.organization?r(oe.organization):V.error("Organization not found")}catch(Z){console.error("Failed to fetch organization:",Z),V.error("Failed to load organization")}finally{d(!1)}},Ue=async()=>{try{const oe=await(await fetch("/api/plugins/teams/status")).json();b(oe.enabled)}catch(Z){console.error("Failed to check teams status:",Z),b(!1)}},Oe=async()=>{try{const oe=await(await fetch("/api/plugins/organization/status")).json();x(oe.enabled)}catch(Z){console.error("Failed to check organization status:",Z),x(!1)}},We=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/teams`)).json();oe.success&&i(oe.teams||[])}catch(Z){console.error("Failed to fetch teams:",Z),V.error("Failed to load teams")}},nt=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/invitations`)).json();oe.success&&l(oe.invitations||[])}catch(Z){console.error("Failed to fetch invitations:",Z),V.error("Failed to load invitations")}},lt=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/members`)).json();oe.success&&u(oe.members||[])}catch(Z){console.error("Failed to fetch members:",Z),V.error("Failed to load members")}},Ut=async Z=>{re([]),ye(!0),re([{id:"start",type:"info",message:`Starting member seeding process for ${Z} members...`,timestamp:new Date}]);try{const De=await(await fetch(`/api/organizations/${e}/seed-members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Z})})).json();if(De.success){const it=De.results.map((at,It)=>at.success?{id:`member-${It}`,type:"progress",message:`Adding member: ${at.member.user.name} (${at.member.user.email})`,timestamp:new Date,status:"completed"}:{id:`member-${It}`,type:"error",message:`Failed to add member ${It+1}: ${at.error}`,timestamp:new Date});re(at=>[...at,...it]);const tt=De.results.filter(at=>at.success).length;re(at=>[...at,{id:"complete",type:"success",message:`✅ Seeding completed! Added ${tt}/${Z} members successfully`,timestamp:new Date}]),await lt(),V.success(`Successfully added ${tt} members!`)}else re(it=>[...it,{id:"error",type:"error",message:`❌ Seeding failed: ${De.error||"Unknown error"}`,timestamp:new Date}]),V.error(De.error||"Failed to seed members")}catch(oe){re(De=>[...De,{id:"error",type:"error",message:`❌ Network error: ${oe}`,timestamp:new Date}]),V.error("Failed to seed members")}finally{ye(!1)}},Kt=async Z=>{He([]),Ye(!0),He([{id:"start",type:"info",message:`Starting team seeding process for ${Z} teams...`,timestamp:new Date}]);try{const De=await(await fetch(`/api/organizations/${e}/seed-teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Z})})).json();if(De.success){const it=De.results.map((at,It)=>at.success?{id:`team-${It}`,type:"progress",message:`Creating team: ${at.team.name}`,timestamp:new Date,status:"completed"}:{id:`team-${It}`,type:"error",message:`Failed to create team ${It+1}: ${at.error}`,timestamp:new Date});He(at=>[...at,...it]);const tt=De.results.filter(at=>at.success).length;He(at=>[...at,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${tt}/${Z} teams successfully`,timestamp:new Date}]),await We(),V.success(`Successfully created ${tt} teams!`)}else He(it=>[...it,{id:"error",type:"error",message:`❌ Seeding failed: ${De.error||"Unknown error"}`,timestamp:new Date}]),V.error(De.error||"Failed to seed teams")}catch(oe){He(De=>[...De,{id:"error",type:"error",message:`❌ Network error: ${oe}`,timestamp:new Date}]),V.error("Failed to seed teams")}finally{Ye(!1)}},Gt=async()=>{try{const oe=await(await fetch("/api/users/all")).json();oe.success&&Y(oe.users||[])}catch(Z){console.error("Failed to fetch users:",Z)}},_t=Z=>Z.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),ce=()=>{n&&(O({name:n.name,slug:n.slug}),I(!0))},Te=Z=>{const oe=_t(Z);O({name:Z,slug:oe})},Ze=Z=>{O(oe=>({...oe,slug:_t(Z)}))},Q=async()=>{if(!n){V.error("No organization selected");return}if(!T.name){V.error("Please fill in the organization name");return}et(!0);const Z=V.loading("Updating organization...");try{const De=await(await fetch(`/api/organizations/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T.name,slug:T.slug})})).json();De.success?(await Be(),I(!1),O({name:"",slug:""}),V.success("Organization updated successfully!",{id:Z})):V.error(`Error updating organization: ${De.error||"Unknown error"}`,{id:Z})}catch(oe){console.error("Error updating organization:",oe),V.error("Error updating organization",{id:Z})}finally{et(!1)}},pe=()=>{Gt(),g(!0)},be=async()=>{if(!q){V.error("Please enter an email address");return}if(!M){V.error("Please select an inviter");return}se(!0);const Z=V.loading("Sending invitation...");try{const De=await(await fetch(`/api/organizations/${e}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:q,role:"member",inviterId:M})})).json();De.success?(await nt(),g(!1),k(""),$(""),V.success("Invitation sent successfully!",{id:Z})):V.error(`Error sending invitation: ${De.error||"Unknown error"}`,{id:Z})}catch(oe){console.error("Error sending invitation:",oe),V.error("Error sending invitation",{id:Z})}finally{se(!1)}},_e=async Z=>{const oe=V.loading("Cancelling invitation...");try{const it=await(await fetch(`/api/invitations/${Z}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();it.success?(await nt(),V.success("Invitation cancelled successfully!",{id:oe})):V.error(`Error cancelling invitation: ${it.error||"Unknown error"}`,{id:oe})}catch(De){console.error("Error cancelling invitation:",De),V.error("Error cancelling invitation",{id:oe})}},$e=async(Z,oe)=>{const De=V.loading("Resending invitation...");try{const tt=await(await fetch(`/api/invitations/${Z}/resend`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();tt.success?(await nt(),V.success(`Invitation resent to ${oe}!`,{id:De})):V.error(`Error resending invitation: ${tt.error||"Unknown error"}`,{id:De})}catch(it){console.error("Error resending invitation:",it),V.error("Error resending invitation",{id:De})}},je=async(Z,oe)=>{const De=V.loading(`Removing ${oe}...`);try{const tt=await(await fetch(`/api/members/${Z}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();tt.success?(await lt(),V.success(`${oe} removed from organization!`,{id:De})):V.error(`Error removing member: ${tt.error||"Unknown error"}`,{id:De})}catch(it){console.error("Error removing member:",it),V.error("Error removing member",{id:De})}},K=async()=>{if(!te.name){V.error("Please enter a team name");return}const Z=V.loading("Creating team...");try{const De=await(await fetch(`/api/organizations/${e}/teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:te.name,organizationId:e})})).json();De.success?(await We(),L(!1),ne({name:""}),V.success("Team created successfully!",{id:Z})):V.error(`Error creating team: ${De.error||"Unknown error"}`,{id:Z})}catch(oe){console.error("Error creating team:",oe),V.error("Error creating team",{id:Z})}},ue=async()=>{if(!A||!te.name){V.error("Please enter a team name");return}const Z=V.loading("Updating team...");try{const De=await(await fetch(`/api/teams/${A.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:te.name})})).json();De.success?(await We(),U(!1),C(null),ne({name:""}),V.success("Team updated successfully!",{id:Z})):V.error(`Error updating team: ${De.error||"Unknown error"}`,{id:Z})}catch(oe){console.error("Error updating team:",oe),V.error("Error updating team",{id:Z})}},Ae=async()=>{if(!A){V.error("No team selected");return}const Z=V.loading("Deleting team...");try{const De=await(await fetch(`/api/teams/${A.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();De.success?(await We(),G(!1),C(null),V.success("Team deleted successfully!",{id:Z})):V.error(`Error deleting team: ${De.error||"Unknown error"}`,{id:Z})}catch(oe){console.error("Error deleting team:",oe),V.error("Error deleting team",{id:Z})}},Le=Z=>{C(Z),ne({name:Z.name}),U(!0)},he=Z=>{C(Z),G(!0)};return h?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading organization details..."})]})}):n?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>t("/organizations"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["orgs /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:e})]})})}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[a.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),a.jsxs(z,{onClick:pe,className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Invite User"]}),a.jsxs(z,{onClick:ce,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(zo,{className:"w-4 h-4 mr-2"}),"Edit Organization"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsx("div",{children:a.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[n.name,a.jsx(Jt,{id:n.slug,nonSliced:!0,variant:"subscript"})]})})]}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsxs("nav",{className:"flex space-x-8 px-6",children:[a.jsxs("button",{onClick:()=>m("details"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(ka,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Details",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:0,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("members"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Members",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:c.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("invitations"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="invitations"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(ys,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Invitations",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:o.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("teams"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="teams"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Teams",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:s.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),a.jsxs("div",{className:"p-6",children:[f==="details"&&a.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"ORGANIZATION INFORMATION"}),a.jsx("hr",{className:"border-white/15 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),a.jsx("p",{className:"text-white font-sans mt-1",children:n.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Slug"}),a.jsx("p",{className:"text-white font-mono mt-1",children:n.slug})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),a.jsx("p",{className:"text-white font-sans mt-1",children:new Date(n.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:c.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:s.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Teams"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ys,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:o.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Invitations"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(dr,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:Math.ceil((new Date().getTime()-new Date(n.createdAt).getTime())/(1e3*60*60*24)),format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})})]})]}),f==="teams"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:s.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-xs font-light",children:"Manage teams within this organization"})]}),y&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Rs,{className:"w-4 h-4 mr-2"}),"Seed Teams"]}),a.jsxs(z,{onClick:()=>L(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Create Team"]})]})]}),y?s.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Team"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Members"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:s.map(Z=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>t(`/organizations/${e}/teams/${Z.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:Z.name}),a.jsx(Jt,{id:Z.id,label:"Team ID"})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:Z.memberCount||0}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(Z.createdAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:oe=>{oe.stopPropagation(),Le(Z)},children:[a.jsx(zo,{className:"w-4 h-4 mr-1"}),"Edit"]}),a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:oe=>{oe.stopPropagation(),he(Z)},children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Delete"]})]})})]},Z.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Teams Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Create your first team to start organizing members within this organization."}),a.jsxs(z,{onClick:()=>L(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Create First Team"]})]})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl text-white font-light font-mono uppercase mb-2",children:"Teams Feature Required"}),a.jsx("p",{className:"text-gray-300 mb-6 text-sm",children:"To use Teams in Better Auth Studio, you need to enable the teams feature in your organization plugin configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsx("li",{children:"Update your auth configuration file to enable teams:"})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsx("span",{className:"text-yellow-300 pl-12",children:"organization"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-16",children:"teams"}),": ","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-yellow-300 pl-20",children:"enabled"}),":"," ",a.jsx("span",{className:"text-blue-400",children:"true"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-16",children:"}"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-12",children:"})"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Run migrations to create the teams table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),a.jsx(z,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}),f==="members"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Members",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage organization members and their roles"})]})}),c.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:c.map(Z=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 group",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:Z.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Z.user.id}`,alt:Z.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light inline-flex items-center gap-2",children:[a.jsx("span",{children:Z.user.name}),a.jsx("button",{onClick:oe=>{oe.stopPropagation(),t(`/users/${Z.user.id}`)},className:"opacity-0 group-hover:opacity-100 text-white/60 hover:text-white transition-all",title:"View user details",children:a.jsx(yu,{className:"w-4 h-4"})})]}),a.jsx(Jt,{id:Z.user.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:Z.user.email}),a.jsx("td",{className:"py-4 px-4",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed rounded-none border-blue-500/30 text-blue-400/70 capitalize",children:Z.role})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(Z.joinedAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>je(Z.id,Z.user.name),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},Z.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Invite users or seed members from existing users to get started."}),a.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[a.jsxs(z,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),a.jsxs(z,{onClick:pe,className:"bg-white text-black hover:bg-white/90 border border-white/20 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Invite User"]})]})]})})]}),f==="invitations"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Invitations",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage pending invitations to this organization"})]})}),o.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:o.map(Z=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(ys,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:Z.email}),a.jsxs("div",{className:"text-sm text-gray-400",children:["Expires on"," ",new Date(Z.expiresAt).toLocaleDateString("en-US",{month:"short",year:"numeric",day:"numeric"})]})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white capitalize",children:Z.role}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs($t,{variant:"secondary",className:`text-xs font-normal font-mono uppercase rounded-none border-dashed flex items-center gap-1 w-fit ${Z.status==="pending"?"bg-yellow-900/10 border border-yellow-500/30 text-yellow-400/70":Z.status==="accepted"?"bg-green-900/10 border border-green-500/30 text-green-400/70":"bg-red-900/10 border border-red-500/30 text-red-400/70"}`,children:[Z.status==="pending"&&a.jsx(RU,{className:"w-2 h-2"}),Z.status==="accepted"&&a.jsx(Ep,{className:"w-3 h-3"}),Z.status==="expired"&&a.jsx(dt,{className:"w-2 h-2"}),Z.status]})}),a.jsxs("td",{className:"py-4 px-4 text-sm text-gray-400",children:[new Date(Z.expiresAt).toLocaleDateString(),a.jsx("br",{}),a.jsx("span",{className:"text-xs text-gray-400",children:new Date(Z.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>$e(Z.id,Z.email),children:[a.jsx(_C,{className:"w-4 h-4 mr-1"}),"Resend"]}),a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>_e(Z.id),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Cancel"]})]})})]},Z.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(ys,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Invitations"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Start inviting users to join this organization."}),a.jsxs(z,{onClick:pe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Send First Invitation"]})]})})]})]})]}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Invite User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{g(!1),k(""),$("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"invite-email",className:"text-sm text-gray-400 font-light",children:"Email Address"}),a.jsx(ve,{id:"invite-email",type:"email",value:q,onChange:Z=>k(Z.target.value),placeholder:"user@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"inviter-select",className:"text-sm text-gray-400 font-light",children:"Inviter"}),a.jsxs(pn,{value:M,onValueChange:$,children:[a.jsx(mn,{children:a.jsx(zn,{placeholder:"Select an inviter..."})}),a.jsx(gn,{children:W.map(Z=>a.jsx(Pe,{value:Z.id,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("img",{src:Z.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Z.id}`,alt:Z.name,className:"w-6 h-6 rounded-none border border-dashed border-white/20"}),a.jsxs("span",{children:[Z.name," (",Z.email,")"]})]})},Z.id))})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),k(""),$("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsxs(z,{onClick:be,disabled:X,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[a.jsx(_C,{className:"w-4 h-4 mr-2"}),X?"Sending...":"Send Invitation"]})]})]})}),R&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{L(!1),ne({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"team-name",value:te.name,onChange:Z=>de(Z.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{L(!1),ne({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:K,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create Team"})]})]})}),P&&A&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{U(!1),ne({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsx("div",{children:a.jsxs("div",{className:"text-white font-light",children:[A.name,a.jsx(Jt,{id:A.id,variant:"subscript",nonSliced:!0})]})})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"edit-team-name",value:te.name,onChange:Z=>de(Z.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{U(!1),ne({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:ue,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})}),F&&A&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[A.name,a.jsx(Jt,{id:A.id,variant:"subscript",nonSliced:!0})]}),a.jsx(Jt,{id:A.id,label:"Team ID",variant:"detail"})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this team? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ae,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete Team"})]})]})}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Members"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ot,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Add Members from Existing Users"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"member-count",className:"text-sm text-gray-400 font-light",children:"Number of members to add"}),a.jsx(ve,{id:"member-count",type:"number",min:"1",max:"50",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var oe;const Z=parseInt(((oe=document.getElementById("member-count"))==null?void 0:oe.value)||"5");Ut(Z)},disabled:xe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:xe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ot,{className:"w-3 h-3 mr-2"}),"Seed Members"]})})]})]}),Ee.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Member Seeding Terminal",lines:Ee,isRunning:xe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Teams"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ka,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Create Teams"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"team-count",className:"text-sm text-gray-400 font-light",children:"Number of teams to create"}),a.jsx(ve,{id:"team-count",type:"number",min:"1",max:"20",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var oe;const Z=parseInt(((oe=document.getElementById("team-count"))==null?void 0:oe.value)||"3");Kt(Z)},disabled:Fe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:Fe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ka,{className:"w-3 h-3 mr-2"}),"Seed Teams"]})})]})]}),ze.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Team Seeding Terminal",lines:ze,isRunning:Fe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),_&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:Z=>{Z.target===Z.currentTarget&&(I(!1),O({name:"",slug:""}))},children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",onClick:Z=>Z.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{I(!1),O({name:"",slug:""})},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(ka,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:n.name}),a.jsx(Jt,{id:n.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:n.slug})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",value:T.name,onChange:Z=>Te(Z.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"edit-slug",value:T.slug,onChange:Z=>Ze(Z.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{I(!1),O({name:"",slug:""})},disabled:ft,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Q,disabled:ft,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:ft?"Updating...":"Update"})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx(tp,{to:"/organizations",children:a.jsxs(z,{variant:"ghost",className:"text-gray-400 hover:text-white rounded-none",children:[a.jsx(Eae,{className:"w-4 h-4 mr-2"}),"Back to Organizations"]})})}),a.jsx("br",{}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx(ka,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Organization Not Found"}),a.jsx("p",{className:"text-gray-400",children:"The organization you're looking for doesn't exist."})]})]})}function Afe(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[s,i]=p.useState(""),[o,l]=p.useState("all"),[c,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(null),[N,S]=p.useState([]),[E,j]=p.useState(!1),R=p.useCallback(async()=>{try{const O=await(await fetch("/api/sessions")).json();t(O.sessions||[])}catch{}finally{r(!1)}},[]);p.useEffect(()=>{R()},[R]);const L=async T=>{S([]),j(!0),S([{id:"start",type:"info",message:`Starting session seeding process for ${T} sessions...`,timestamp:new Date}]);try{const q=await(await fetch("/api/seed/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:T})})).json();if(q.success){const k=q.results.map(($,W)=>$.success?{id:`session-${W}`,type:"progress",message:`Creating session: ${$.session.id}`,timestamp:new Date,status:"completed"}:{id:`session-${W}`,type:"error",message:`Failed to create session ${W+1}: ${$.error}`,timestamp:new Date});S($=>[...$,...k]);const M=q.results.filter($=>$.success).length;S($=>[...$,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${M}/${T} sessions successfully`,timestamp:new Date}]),await R()}else S(k=>[...k,{id:"error",type:"error",message:`❌ Seeding failed: ${q.error||"Unknown error"}`,timestamp:new Date}])}catch(O){S(q=>[...q,{id:"error",type:"error",message:`❌ Network error: ${O}`,timestamp:new Date}])}finally{j(!1)}},P=async T=>{S([]),j(!0),S([{id:"start",type:"info",message:`Starting account seeding process for ${T} accounts...`,timestamp:new Date}]);try{const q=await(await fetch("/api/seed/accounts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:T})})).json();if(q.success){const k=q.results.map(($,W)=>$.success?{id:`account-${W}`,type:"progress",message:`Creating account: ${$.account.provider}`,timestamp:new Date,status:"completed"}:{id:`account-${W}`,type:"error",message:`Failed to create account ${W+1}: ${$.error}`,timestamp:new Date});S($=>[...$,...k]);const M=q.results.filter($=>$.success).length;S($=>[...$,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${M}/${T} accounts successfully`,timestamp:new Date}]),await R()}else S(k=>[...k,{id:"error",type:"error",message:`❌ Seeding failed: ${q.error||"Unknown error"}`,timestamp:new Date}])}catch(O){S(q=>[...q,{id:"error",type:"error",message:`❌ Network error: ${O}`,timestamp:new Date}])}finally{j(!1)}},U=T=>{g(T),b(!0)},F=T=>{g(T),d(!0)},G=T=>{g(T),m(!0)},_=async T=>{u(!1)},I=async T=>{d(!1)},A=async()=>{m(!1)},C=e.filter(T=>{const O=T.id.toLowerCase().includes(s.toLowerCase())||T.userId.toLowerCase().includes(s.toLowerCase()),q=o==="all"||o==="active"&&new Date(T.expiresAt)>new Date||o==="expired"&&new Date(T.expiresAt)<=new Date;return O&&q});return n?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading sessions..."})]})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Sessions",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-sm",children:e.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light",children:"Manage user sessions and accounts"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>x(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>u(!0),children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Add Session"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search sessions...",value:s,onChange:T=>i(T.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jS,{className:"w-4 h-4 text-gray-400"}),a.jsxs(pn,{value:o,onValueChange:l,children:[a.jsx(mn,{children:a.jsx(zn,{})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"all",children:"All"}),a.jsx(Pe,{value:"active",children:"Active"}),a.jsx(Pe,{value:"expired",children:"Expired"})]})]})]})]}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Session"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User ID"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:C.map(T=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",T.id.slice(0,8),"..."]}),a.jsx(Jt,{id:T.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:T.userId}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[new Date(T.expiresAt)>new Date?a.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}):a.jsx("div",{className:"w-2 h-2 bg-red-400 rounded-full"}),a.jsx("span",{className:"text-sm text-gray-400",children:new Date(T.expiresAt)>new Date?"Active":"Expired"})]})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(T.expiresAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>U(T),children:a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>F(T),children:a.jsx(zo,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:()=>G(T),children:a.jsx(Qu,{className:"w-4 h-4"})})]})})]},T.id))})]})})}),w&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Data"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Seed Sessions"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),a.jsx(ve,{id:"session-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var O;const T=parseInt(((O=document.getElementById("session-count"))==null?void 0:O.value)||"5",10);L(T)},disabled:E,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:E?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(pp,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Seed Accounts"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),a.jsx(ve,{id:"account-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var O;const T=parseInt(((O=document.getElementById("account-count"))==null?void 0:O.value)||"5",10);P(T)},disabled:E,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:E?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(pp,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]})]}),N.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Session Seeding Terminal",lines:N,isRunning:E,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>x(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),c&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>u(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),a.jsx(ve,{id:"create-user-id",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),a.jsx(ve,{id:"create-expires",type:"datetime-local",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>u(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:()=>_(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),h&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>d(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),a.jsx(ve,{id:"edit-user-id",defaultValue:v.userId,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),a.jsx(ve,{id:"edit-expires",type:"datetime-local",defaultValue:new Date(v.expiresAt).toISOString().slice(0,16),className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>d(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:()=>I(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),f&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>m(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this session? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>m(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:A,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),y&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Session Details"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>b(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Jt,{id:v.id,variant:"detail"}),a.jsx(Jt,{id:v.userId,label:"User ID",variant:"detail"}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Status:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.expiresAt)>new Date?"Active":"Expired"})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Expires:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.expiresAt).toLocaleString()})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Created:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.createdAt).toLocaleString()})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Updated:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.updatedAt).toLocaleString()})]})]})]}),a.jsx("div",{className:"flex justify-end mt-6",children:a.jsx(z,{onClick:()=>b(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function _fe(){var v,g,N,S,E,j,R,L,P,U,F,G,_,I,A,C,T,O,q,k,M,$,W,Y,te,ne,X,se,Ee;const[e,t]=p.useState(null),[n,r]=p.useState(null),[s,i]=p.useState(null),[o,l]=p.useState(null),[c,u]=p.useState(!0),[h,d]=p.useState(null);i5(re=>{re.type==="config_changed"?setTimeout(()=>{f(),m(),y(),b()},500):re.type});const f=p.useCallback(async()=>{var re;try{const ye=await(await fetch("/api/config")).json();(re=ye.studio)!=null&&re.version&&d(`v${ye.studio.version}`),t(ye)}catch{}finally{u(!1)}},[]),m=p.useCallback(async()=>{try{const xe=await(await fetch("/api/health")).json();r(xe.system||{studioVersion:h||"v1.0.0",nodeVersion:process.version,platform:navigator.platform})}catch{r({studioVersion:h||"v1.0.0",nodeVersion:"v18.0.0",platform:"macOS"})}},[h]),y=p.useCallback(async()=>{try{const xe=await(await fetch("/api/plugins")).json();i(xe)}catch{i({plugins:[],configPath:null,totalPlugins:0,error:"Failed to fetch plugins"})}},[]),b=p.useCallback(async()=>{try{const xe=await(await fetch("/api/db")).json();l(xe)}catch{l({success:!1,name:"unknown",version:"unknown",dialect:"unknown",adapter:"unknown",displayName:"Unknown",autoDetected:!1,message:"Failed to fetch database info"})}},[]),w=re=>{switch(re==null?void 0:re.toLowerCase()){case"postgresql":case"postgres":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Connected"]});case"mysql":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Connected"]});case"sqlite":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(zl,{className:"w-3 h-3"}),"Local"]});default:return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Or,{className:"w-3 h-3"}),"Unknown"]})}};p.useEffect(()=>{f(),m(),y(),b()},[f,b,y,m]);const x=re=>{switch(re.toLowerCase()){case"google":return a.jsx(la,{className:"w-5 h-5 text-white"});case"github":return a.jsx(Ln,{className:"w-5 h-5 text-white"});case"discord":return a.jsx(la,{className:"w-5 h-5 text-white"});case"twitter":return a.jsx(la,{className:"w-5 h-5 text-white"});default:return a.jsx(la,{className:"w-5 h-5 text-white"})}};return c?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(er,{className:"w-6 h-6 text-white animate-spin"})}):a.jsxs("div",{className:"space-y-8",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Settings"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Configure your Better Auth application"})]})}),a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-5",children:[a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Do,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Application"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Basic application configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"App Name"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application display name"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.appName)||"Better Auth"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base URL"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application base URL"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-mono font-light text-white",children:(e==null?void 0:e.baseURL)||"http://localhost:3000"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base Path"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auth API base path"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-mono font-light text-white",children:(e==null?void 0:e.basePath)||"/api/auth"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secret"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Encryption secret"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.secret)==="Configured"?"Configured":"Not set"})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(nn,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Database"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Database connection and configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:(o==null?void 0:o.displayName)||((v=e==null?void 0:e.database)==null?void 0:v.type)&&((g=e==null?void 0:e.database)==null?void 0:g.type.charAt(0).toUpperCase())+((N=e==null?void 0:e.database)==null?void 0:N.type.slice(1))||"Unknown"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database Type"})]})]}),((o==null?void 0:o.name)||((S=e==null?void 0:e.database)==null?void 0:S.type))&&w((o==null?void 0:o.name)||((E=e==null?void 0:e.database)==null?void 0:E.type)||"")]}),((o==null?void 0:o.dialect)||((j=e==null?void 0:e.database)==null?void 0:j.dialect))&&(o==null?void 0:o.dialect)!=="unknown"&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Dialect"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database dialect"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:((R=e==null?void 0:e.database)==null?void 0:R.dialect)||(o==null?void 0:o.dialect)})})]}),((L=e==null?void 0:e.database)==null?void 0:L.url)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Connection URL"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database connection string"})]})]}),a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Configured"]})]}),((P=e==null?void 0:e.database)==null?void 0:P.casing)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Do,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Casing"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Table name casing"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white capitalize",children:e.database.casing})})]}),(e==null?void 0:e.database)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RN,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Debug Logs"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database debug logging"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:e.database.debugLogs?a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Disabled"]})})]}),!(o!=null&&o.success)&&!(e!=null&&e.database)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Or,{className:"w-5 h-5 text-yellow-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"No Database Detected"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:(o==null?void 0:o.message)||"No supported database packages found"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"Unknown"})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Providers"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Configured authentication providers"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsx(Sa,{className:"p-0",children:e!=null&&e.socialProviders&&e.socialProviders.length>0?e.socialProviders.map((re,xe)=>a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[x(re.type),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white capitalize",children:re.type}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:re.clientId?"Configured":"Not configured"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:re.clientId?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Active"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Setup Required"]})})]},xe)):a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Ln,{className:"w-8 h-8 text-white mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-400",children:"No providers configured"})]})})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(jc,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Email & Password"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Email authentication settings"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(jc,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Authentication"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow users to sign up with email"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(U=e==null?void 0:e.emailAndPassword)!=null&&U.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]})})]}),((F=e==null?void 0:e.emailAndPassword)==null?void 0:F.enabled)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ho,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Sign Up"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow new user registration"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(G=e==null?void 0:e.emailAndPassword)!=null&&G.disableSignUp?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Verification"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Require email verification"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(_=e==null?void 0:e.emailAndPassword)!=null&&_.requireEmailVerification?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Required"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Optional"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Password Length"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Min/Max password length"})]})]}),a.jsx("div",{className:"text-right",children:a.jsxs("p",{className:"text-sm font-medium text-white",children:[((I=e==null?void 0:e.emailAndPassword)==null?void 0:I.minPasswordLength)||8," -"," ",((A=e==null?void 0:e.emailAndPassword)==null?void 0:A.maxPasswordLength)||128]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Auto Sign In"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto sign in after registration"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(C=e==null?void 0:e.emailAndPassword)!=null&&C.autoSignIn?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ig,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Session"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Session management settings"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ig,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Duration"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"How long sessions last"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(T=e==null?void 0:e.session)!=null&&T.expiresIn?`${Math.floor(e.session.expiresIn/(60*60*24))} days`:"7 days"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Default"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RN,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Update Age"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Session refresh interval"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(O=e==null?void 0:e.session)!=null&&O.updateAge?`${Math.floor(e.session.updateAge/(60*60))} hours`:"24 hours"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Refresh"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto refresh sessions"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(q=e==null?void 0:e.session)!=null&&q.disableSessionRefresh?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Store in Database"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Store sessions in database"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(k=e==null?void 0:e.session)!=null&&k.storeSessionInDatabase?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(zl,{className:"w-3 h-3"}),"Secondary Storage"]})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Rate Limiting"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"API rate limiting configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limiting"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Enable rate limiting"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(M=e==null?void 0:e.rateLimit)!=null&&M.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ig,{className:"w-5 h-5 text-red-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limit Window"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Time window for rate limiting"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:($=e==null?void 0:e.rateLimit)!=null&&$.window?`${e.rateLimit.window} seconds`:"10 seconds"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Window"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Max Requests"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Maximum requests per window"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:((W=e==null?void 0:e.rateLimit)==null?void 0:W.max)||100}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Requests"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Storage"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Rate limit storage type"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white capitalize",children:((Y=e==null?void 0:e.rateLimit)==null?void 0:Y.storage)||"memory"})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Do,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Advanced"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Advanced configuration options"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secure Cookies"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Use secure cookies"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(te=e==null?void 0:e.advanced)!=null&&te.useSecureCookies?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"CSRF Check"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"CSRF protection"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(ne=e==null?void 0:e.advanced)!=null&&ne.disableCSRFCheck?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ms,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"IP Tracking"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Track IP addresses"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(se=(X=e==null?void 0:e.advanced)==null?void 0:X.ipAddress)!=null&&se.disableIpTracking?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(FY,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Telemetry"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Usage analytics"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(Ee=e==null?void 0:e.telemetry)!=null&&Ee.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Disabled"]})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(zl,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"System Info"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth Studio system information"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Studio Version"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Better Auth Studio"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:h||"v1.0.0"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Latest"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(zl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Node.js Version"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Runtime environment"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.nodeVersion)||"v18.0.0"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Current"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Platform"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Operating system"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.platform)||"macOS"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"System"})]})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none lg:col-span-2",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(OT,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Plugins"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth plugins enabled in your configuration"]})]}),a.jsxs("div",{className:"pr-6",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(s==null?void 0:s.totalPlugins)||0}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Active"})]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsx(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:s!=null&&s.plugins&&s.plugins.length>0?a.jsxs(a.Fragment,{children:[s.plugins.map((re,xe)=>a.jsxs("div",{className:`flex items-center justify-between p-3 px-5 ${xe<s.plugins.length-1?"border-b border-white/15":""}`,children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(OT,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:re.name.slice(0,1).toUpperCase()+re.name.slice(1).replace("-"," ")}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:re.description})]})]}),a.jsx("div",{className:"text-right flex items-center space-x-2",children:a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400 flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]},re.id)),s.configPath&&a.jsx("div",{className:"p-4 px-5 bg-black/30 border-t border-white/10",children:a.jsxs("p",{className:"text-xs text-gray-400",children:["Config file:"," ",a.jsx("span",{className:"text-white font-mono",children:s.configPath})]})})]}):a.jsxs("div",{className:"flex items-center justify-between p-4 px-5",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Or,{className:"w-5 h-5 text-yellow-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-white",children:"No Plugins Enabled"}),a.jsx("p",{className:"text-xs text-gray-400",children:(s==null?void 0:s.error)||"No plugins are currently configured in your Better Auth setup"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"None"})]})})]})]})]})}const d4=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function u4(){var A,C;const{orgId:e,teamId:t}=iS(),n=ha(),[r,s]=p.useState(null),[i,o]=p.useState([]),[l,c]=p.useState(!0),[u,h]=p.useState("details"),[d,f]=p.useState(!1),[m,y]=p.useState(!1),[b,w]=p.useState(""),[x,v]=p.useState([]),[g,N]=p.useState([]),[S,E]=p.useState({name:""}),j=p.useCallback(async()=>{if(t)try{const O=await(await fetch(`/api/teams/${t}`)).json();O.success&&O.team?(s(O.team),E({name:O.team.name})):O.team?(s(O.team),E({name:O.team.name})):V.error("Team not found")}catch{V.error("Failed to load team")}finally{c(!1)}},[t]),R=p.useCallback(async()=>{if(t)try{const O=await(await fetch(`/api/teams/${t}/members`)).json();O.success&&o(O.members||[])}catch{V.error("Failed to load team members")}},[t]),L=async()=>{try{const O=await(await fetch("/api/users?limit=10000")).json(),q=i.map(M=>M.userId),k=(O.users||[]).filter(M=>!q.includes(M.id));v(k)}catch{V.error("Failed to load users")}};p.useEffect(()=>{t&&(j(),R())},[t,j,R]);const P=async()=>{if(!S.name){V.error("Please enter a team name");return}const T=V.loading("Updating team...");try{const q=await(await fetch(`/api/teams/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S.name})})).json();q.success?(await j(),y(!1),V.success("Team updated successfully!",{id:T})):V.error(`Error updating team: ${q.error||"Unknown error"}`,{id:T})}catch{V.error("Error updating team",{id:T})}},U=async()=>{if(g.length===0){V.error("Please select at least one user");return}const T=V.loading(`Adding ${g.length} members...`);try{const q=await(await fetch(`/api/teams/${t}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userIds:g})})).json();q.success?(await R(),f(!1),N([]),w(""),V.success(`Successfully added ${g.length} members!`,{id:T})):V.error(`Error adding members: ${q.error||"Unknown error"}`,{id:T})}catch{V.error("Error adding members",{id:T})}},F=async(T,O)=>{const q=V.loading(`Removing ${O}...`);try{const M=await(await fetch(`/api/team-members/${T}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();M.success?(await R(),V.success(`${O} removed from team!`,{id:q})):V.error(`Error removing member: ${M.error||"Unknown error"}`,{id:q})}catch{V.error("Error removing team member",{id:q})}},G=()=>{L(),f(!0)},_=T=>{N(O=>O.includes(T)?O.filter(q=>q!==T):[...O,T])},I=x.filter(T=>T.name.toLowerCase().includes(b.toLowerCase())||T.email.toLowerCase().includes(b.toLowerCase()));return l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading team details..."})]})}):r?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>n(`/organizations/${r.organizationId}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:G,className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add Members"]}),a.jsxs(z,{onClick:()=>y(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(zo,{className:"w-4 h-4 mr-2"}),"Edit Team"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[r.name,a.jsx(Jt,{id:t,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"flex items-center space-x-2 mt-1",children:r.organization&&a.jsxs(tp,{to:`/organizations/${r.organizationId}`,className:"text-gray-400 hover:text-white text-sm font-sans",children:[a.jsx(ka,{className:"w-4 h-4 inline mr-1"}),r.organization.name]})})]})]}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsxs("nav",{className:"flex space-x-8 px-6",children:[a.jsxs("button",{onClick:()=>h("details"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${u==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsx("span",{className:"font-mono uppercase text-xs font-normal",children:"Details"})]}),a.jsxs("button",{onClick:()=>h("members"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${u==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Members",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),a.jsxs("div",{className:"p-6",children:[u==="details"&&a.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"TEAM INFORMATION"}),a.jsx("hr",{className:"border-white/15 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),a.jsx("p",{className:"text-white font-sans mt-1",children:r.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"}),a.jsx("p",{className:"text-white font-sans mt-1",children:((A=r.organization)==null?void 0:A.name)||"Unknown"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),a.jsx("p",{className:"text-white font-sans mt-1",children:d4(r.createdAt)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Last Updated"}),a.jsx("p",{className:"text-white font-sans mt-1",children:d4(r.updatedAt)})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:i.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(dr,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:Math.ceil((Date.now()-new Date(r.createdAt).getTime())/(1e3*60*60*24)),format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ka,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:1,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"})]})]})})]})]}),u==="members"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Team Members",a.jsx(_n,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage members of this team"})]})}),i.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:i.map(T=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 group",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:T.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${T.user.id}`,alt:T.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light inline-flex items-center gap-2",children:[a.jsx("span",{children:T.user.name}),a.jsx("button",{onClick:O=>{O.stopPropagation(),n(`/users/${T.user.id}`)},className:"opacity-0 group-hover:opacity-100 text-white/60 hover:text-white transition-all",title:"View user details",children:a.jsx(yu,{className:"w-4 h-4"})})]}),a.jsx(Jt,{id:T.user.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:T.user.email}),a.jsx("td",{className:"py-4 px-4",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed border-blue-500/30 text-blue-400/70 rounded-none capitalize",children:T.role})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(T.joinedAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>F(T.id,T.user.name),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},T.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Add members to this team to get started."}),a.jsxs(z,{onClick:G,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add First Members"]})]})})]})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Add Team Members"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{f(!1),N([]),w("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(_U,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search users by name or email...",value:b,onChange:T=>w(T.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),g.length>0&&a.jsx("div",{className:"bg-blue-900/20 border border-blue-500/30 rounded-none p-3",children:a.jsxs("p",{className:"text-blue-400 text-sm",children:[g.length," user",g.length!==1?"s":""," selected"]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none max-h-96 overflow-y-auto",children:I.length>0?a.jsx("div",{className:"divide-y divide-white/5",children:I.map(T=>a.jsxs("div",{className:`flex items-center space-x-3 p-4 cursor-pointer hover:bg-white/5 ${g.includes(T.id)?"bg-blue-900/20":""}`,onClick:()=>_(T.id),children:[a.jsx("input",{type:"checkbox",checked:g.includes(T.id),onChange:()=>_(T.id),className:"rounded border-gray-300"}),a.jsx("img",{src:T.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${T.id}`,alt:T.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-white font-light",children:T.name}),a.jsx("div",{className:"text-sm text-gray-400",children:T.email})]})]},T.id))}):a.jsx("div",{className:"p-8 text-center",children:a.jsx("p",{className:"text-gray-400",children:"No users found matching your search."})})})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{f(!1),N([]),w("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsxs(z,{onClick:U,disabled:g.length===0,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add ",g.length," Member",g.length!==1?"s":""]})]})]})}),m&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>y(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[r.name,a.jsx(Jt,{id:r.id,variant:"subscript"})]}),a.jsx("div",{className:"text-sm text-gray-400",children:(C=r.organization)==null?void 0:C.name})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"edit-team-name",value:S.name,onChange:T=>E({name:T.target.value}),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>y(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:P,disabled:S.name===r.name,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>n(`/organizations/${e}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Team Not Found"}),a.jsx("p",{className:"text-gray-400",children:"The team you're looking for doesn't exist."})]})]})}function Rfe(){const e=ha(),[t,n]=p.useState([]),[r,s]=p.useState(!0),[i,o]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState("all"),[d,f]=p.useState(1),[m]=p.useState(20);p.useEffect(()=>{y();const S=setInterval(()=>{i!=null&&i.enabled||y()},2e3);return()=>clearInterval(S)},[i==null?void 0:i.enabled]);const y=async()=>{try{const E=await(await fetch("/api/plugins")).json(),j=(E==null?void 0:E.plugins).find(R=>R.id==="teams");o({enabled:!!j,availablePlugins:(E==null?void 0:E.plugins).map(R=>R.id),configPath:E.configPath,teamsPlugin:(E==null?void 0:E.plugins).find(R=>R.id==="teams")}),j?await b():s(!1)}catch(S){console.error("Failed to check teams plugin status:",S),o({enabled:!1,error:"Failed to check plugin status"}),s(!1)}},b=async()=>{try{const E=await(await fetch("/api/teams")).json();E.success&&n(E.teams||[])}catch(S){console.error("Failed to fetch teams:",S),V.error("Failed to load teams")}finally{s(!1)}},w=t.filter(S=>{var j;const E=S.name.toLowerCase().includes(l.toLowerCase())||((j=S.organization)==null?void 0:j.name.toLowerCase().includes(l.toLowerCase()));if(u==="all")return E;if(u==="recent"){const R=new Date;return R.setDate(R.getDate()-7),E&&new Date(S.createdAt)>R}return E}),x=d*m,v=x-m,g=w.slice(v,x),N=Math.ceil(w.length/m);return r?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(er,{className:"w-8 h-8 animate-spin text-white"})}):i!=null&&i.enabled?a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Teams",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:w.length,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsxs("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light flex items-baseline gap-1",children:[a.jsx(_n,{value:w.length,className:"text-white font-mono text-sm",format:{notation:"standard",maximumFractionDigits:0}}),a.jsxs("span",{children:["team",w.length!==1?"s":""," found"]})]})]}),a.jsx("div",{className:"flex items-center space-x-3",children:a.jsxs(z,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Team"]})})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"relative flex-1 max-w-md",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{type:"text",placeholder:"Search teams...",value:l,onChange:S=>c(S.target.value),className:"pl-10 bg-black border-dashed border-white/20 text-white placeholder-gray-400 focus:ring-2 focus:ring-white focus:border-transparent"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(z,{variant:u==="all"?"default":"outline",size:"sm",onClick:()=>h("all"),className:u==="all"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"All"}),a.jsx(z,{variant:u==="recent"?"default":"outline",size:"sm",onClick:()=>h("recent"),className:u==="recent"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"Recent"})]})]}),g.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ho,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-light text-white mb-2",children:"No teams found"}),a.jsx("p",{className:"text-gray-400 mb-6",children:l?"Try adjusting your search terms":"Get started by creating your first team"}),!l&&a.jsxs(z,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Team"]})]}):a.jsx("div",{className:"grid gap-4",children:g.map(S=>{var E;return a.jsx("div",{className:"bg-black/30 border border-white/15 rounded-none p-4 hover:bg-black/40 transition-colors cursor-pointer",onClick:()=>e(`/teams/${S.id}`),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 rounded-none flex items-center justify-center",children:a.jsx(Ho,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium",children:S.name}),a.jsxs("p",{className:"text-gray-400 text-sm",children:[(E=S.organization)==null?void 0:E.name," • ",S.memberCount||0," members"]})]})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400",children:"Active"})})]})},S.id)})}),N>1&&a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx(z,{variant:"outline",size:"sm",onClick:()=>f(Math.max(1,d-1)),disabled:d===1,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Previous"}),a.jsxs("span",{className:"text-gray-400 text-sm",children:["Page ",d," of ",N]}),a.jsx(z,{variant:"outline",size:"sm",onClick:()=>f(Math.min(N,d+1)),disabled:d===N,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Next"})]})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl text-white font-light",children:"Teams"}),a.jsx("p",{className:"text-gray-400 mt-1",children:"Manage your application organizations"})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Mr,{className:"w-12 h-12 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),a.jsx("p",{className:"text-gray-300 mb-6",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsxs("li",{children:["Import the plugin in your auth configuration file",(i==null?void 0:i.configPath)&&a.jsxs("span",{className:"text-gray-400",children:[" (",i.configPath,")"]}),":"]})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),(i==null?void 0:i.availablePlugins)&&i.availablePlugins.length>0&&a.jsx("div",{className:"mb-4",children:a.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",i.availablePlugins.join(", ")]})}),a.jsx(z,{onClick:y,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]})}function Cp(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}function N6(e,t,n){let r="",s=0,i=0;for(const o of e)for(s=s<<8|o,i+=8;i>=6;)i-=6,r+=t[s>>i&63];if(i>0&&(r+=t[s<<6-i&63]),n){const o=(4-r.length%4)%4;r+="=".repeat(o)}return r}function S6(e,t){const n=new Map;for(let o=0;o<t.length;o++)n.set(t[o],o);const r=[];let s=0,i=0;for(const o of e){if(o==="=")break;const l=n.get(o);if(l===void 0)throw new Error(`Invalid Base64 character: ${o}`);s=s<<6|l,i+=6,i>=8&&(i-=8,r.push(s>>i&255))}return Uint8Array.from(r)}const Ofe={encode(e,t={}){const n=Cp(!1),r=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return N6(r,n,t.padding??!0)},decode(e){typeof e!="string"&&(e=new TextDecoder().decode(e));const t=e.includes("-")||e.includes("_"),n=Cp(t);return S6(e,n)}},Dfe={encode(e,t={}){const n=Cp(!0),r=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return N6(r,n,t.padding??!0)},decode(e){const t=e.includes("-")||e.includes("_"),n=Cp(t);return S6(e,n)}};function Ife(){const e=typeof globalThis<"u"&&globalThis.crypto;if(e&&typeof e.subtle=="object"&&e.subtle!=null)return e.subtle;throw new Error("crypto.subtle must be defined")}function Mfe(e,t){return{digest:async n=>{const r=new TextEncoder,s=typeof n=="string"?r.encode(n):n,i=await Ife().digest(e,s);return t==="hex"?Array.from(new Uint8Array(i)).map(c=>c.toString(16).padStart(2,"0")).join(""):t==="base64"||t==="base64url"||t==="base64urlnopad"?t.includes("url")?Dfe.encode(i,{padding:t!=="base64urlnopad"}):Ofe.encode(i):i}}}function hw({value:e,onChange:t,language:n="typescript",placeholder:r="",className:s=""}){const i=p.useRef(null),o=p.useRef(null),[l,c]=p.useState(e||r);p.useEffect(()=>{c(e||r)},[e,r]),p.useEffect(()=>{const b=i.current,w=o.current;if(b&&w){const x=()=>{w&&(w.scrollTop=b.scrollTop,w.scrollLeft=b.scrollLeft)};return b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[]);const u="12px",h="1.5",d="0.75rem",f='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',m={...rc,'pre[class*="language-"]':{...rc['pre[class*="language-"]'],background:"transparent",padding:0,margin:0,borderRadius:0,overflow:"visible"},'code[class*="language-"]':{...rc['code[class*="language-"]'],background:"transparent",fontSize:u,lineHeight:h,fontFamily:f}},y={fontFamily:f,fontSize:u,lineHeight:h,padding:d,margin:0,border:"none",outline:"none",resize:"none",color:"transparent",caretColor:"#fff",background:"transparent",width:"100%",minHeight:"200px",overflow:"auto",tabSize:2};return a.jsxs("div",{className:`relative border border-dashed border-white/20 rounded-none focus-within:border-white/40 ${s}`,children:[a.jsx("div",{ref:o,className:"absolute inset-0 pointer-events-none overflow-auto",style:{padding:d,boxSizing:"border-box"},children:a.jsx(NE,{language:n,style:m,customStyle:{margin:0,padding:0,background:"transparent",minHeight:"200px"},codeTagProps:{style:{fontFamily:f,fontSize:u,lineHeight:h,display:"block"}},PreTag:({children:b,...w})=>a.jsx("pre",{...w,style:{margin:0,padding:0,background:"transparent",fontSize:u,lineHeight:h,fontFamily:f},children:b}),children:l})}),a.jsx("textarea",{ref:i,value:e,onChange:b=>t(b.target.value),placeholder:r,className:"relative w-full min-h-[200px] bg-transparent text-white font-mono text-xs rounded-none focus:outline-none resize-none",style:{...y,boxSizing:"border-box",position:"relative",zIndex:1},spellCheck:!1})]})}function E6(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _m="Checkbox",[Lfe]=Vs(_m),[Ufe,SE]=Lfe(_m);function Pfe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:h="on",internal_do_not_use_render:d}=e,[f,m]=$c({prop:n,defaultProp:s??!1,onChange:c,caller:_m}),[y,b]=p.useState(null),[w,x]=p.useState(null),v=p.useRef(!1),g=y?!!o||!!y.closest("form"):!0,N={checked:f,disabled:i,setChecked:m,control:y,setControl:b,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:zi(s)?!1:s,isFormControl:g,bubbleInput:w,setBubbleInput:x};return a.jsx(Ufe,{scope:t,...N,children:Ffe(d)?d(N):r})}var j6="CheckboxTrigger",T6=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:h,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:y}=SE(j6,e),b=dn(s,h),w=p.useRef(c);return p.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const v=()=>d(w.current);return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[i,d]),a.jsx(qt.button,{type:"button",role:"checkbox","aria-checked":zi(c)?"mixed":c,"aria-required":u,"data-state":R6(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:b,onKeyDown:Nt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Nt(n,x=>{d(v=>zi(v)?!0:!v),y&&m&&(f.current=x.isPropagationStopped(),f.current||x.stopPropagation())})})});T6.displayName=j6;var EE=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:h,...d}=e;return a.jsx(Pfe,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:h,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(T6,{...d,ref:t,__scopeCheckbox:n}),f&&a.jsx(_6,{__scopeCheckbox:n})]})})});EE.displayName=_m;var C6="CheckboxIndicator",k6=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=SE(C6,n);return a.jsx(Ys,{present:r||zi(i.checked)||i.checked===!0,children:a.jsx(qt.span,{"data-state":R6(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});k6.displayName=C6;var A6="CheckboxBubbleInput",_6=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:h,form:d,bubbleInput:f,setBubbleInput:m}=SE(A6,e),y=dn(n,m),b=E6(i),w=DS(r);p.useEffect(()=>{const v=f;if(!v)return;const g=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(g,"checked").set,E=!s.current;if(b!==i&&S){const j=new Event("click",{bubbles:E});v.indeterminate=zi(i),S.call(v,zi(i)?!1:i),v.dispatchEvent(j)}},[f,b,i,s]);const x=p.useRef(zi(i)?!1:i);return a.jsx(qt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:u,value:h,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_6.displayName=A6;function Ffe(e){return typeof e=="function"}function zi(e){return e==="indeterminate"}function R6(e){return zi(e)?"indeterminate":e?"checked":"unchecked"}const Nf=p.forwardRef(({className:e,...t},n)=>a.jsx(EE,{ref:n,className:Ve("peer h-4 w-4 shrink-0 rounded-none border border-white/20 bg-black ring-offset-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-white data-[state=checked]:text-black data-[state=checked]:border-white",e),...t,children:a.jsx(k6,{className:Ve("flex items-center justify-center text-current"),children:a.jsx(wu,{className:"h-4 w-4"})})}));Nf.displayName=EE.displayName;function Bfe(e){const t=e+"CollectionProvider",[n,r]=Vs(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:w,children:x}=b,v=ee.useRef(null),g=ee.useRef(new Map).current;return a.jsx(s,{scope:w,itemMap:g,collectionRef:v,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=Nu(l),u=ee.forwardRef((b,w)=>{const{scope:x,children:v}=b,g=i(l,x),N=dn(w,g.collectionRef);return a.jsx(c,{ref:N,children:v})});u.displayName=l;const h=e+"CollectionItemSlot",d="data-radix-collection-item",f=Nu(h),m=ee.forwardRef((b,w)=>{const{scope:x,children:v,...g}=b,N=ee.useRef(null),S=dn(w,N),E=i(h,x);return ee.useEffect(()=>(E.itemMap.set(N,{ref:N,...g}),()=>void E.itemMap.delete(N))),a.jsx(f,{[d]:"",ref:S,children:v})});m.displayName=h;function y(b){const w=i(e+"CollectionConsumer",b);return ee.useCallback(()=>{const v=w.collectionRef.current;if(!v)return[];const g=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((E,j)=>g.indexOf(E.ref.current)-g.indexOf(j.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},y,r]}var zfe=p.createContext(void 0);function O6(e){const t=p.useContext(zfe);return e||t||"ltr"}var fw="rovingFocusGroup.onEntryFocus",$fe={bubbles:!1,cancelable:!0},lh="RovingFocusGroup",[e1,D6,Hfe]=Bfe(lh),[qfe,I6]=Vs(lh,[Hfe]),[Gfe,Vfe]=qfe(lh),M6=p.forwardRef((e,t)=>a.jsx(e1.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(e1.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Yfe,{...e,ref:t})})}));M6.displayName=lh;var Yfe=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:h=!1,...d}=e,f=p.useRef(null),m=dn(t,f),y=O6(i),[b,w]=$c({prop:o,defaultProp:l??null,onChange:c,caller:lh}),[x,v]=p.useState(!1),g=qo(u),N=D6(n),S=p.useRef(!1),[E,j]=p.useState(0);return p.useEffect(()=>{const R=f.current;if(R)return R.addEventListener(fw,g),()=>R.removeEventListener(fw,g)},[g]),a.jsx(Gfe,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:b,onItemFocus:p.useCallback(R=>w(R),[w]),onItemShiftTab:p.useCallback(()=>v(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:p.useCallback(()=>j(R=>R-1),[]),children:a.jsx(qt.div,{tabIndex:x||E===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Nt(e.onMouseDown,()=>{S.current=!0}),onFocus:Nt(e.onFocus,R=>{const L=!S.current;if(R.target===R.currentTarget&&L&&!x){const P=new CustomEvent(fw,$fe);if(R.currentTarget.dispatchEvent(P),!P.defaultPrevented){const U=N().filter(A=>A.focusable),F=U.find(A=>A.active),G=U.find(A=>A.id===b),I=[F,G,...U].filter(Boolean).map(A=>A.ref.current);P6(I,h)}}S.current=!1}),onBlur:Nt(e.onBlur,()=>v(!1))})})}),L6="RovingFocusGroupItem",U6=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=e,c=tr(),u=i||c,h=Vfe(L6,n),d=h.currentTabStopId===u,f=D6(n),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:b}=h;return p.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),a.jsx(e1.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:a.jsx(qt.span,{tabIndex:d?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:Nt(e.onMouseDown,w=>{r?h.onItemFocus(u):w.preventDefault()}),onFocus:Nt(e.onFocus,()=>h.onItemFocus(u)),onKeyDown:Nt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=Kfe(w,h.orientation,h.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let g=f().filter(N=>N.focusable).map(N=>N.ref.current);if(x==="last")g.reverse();else if(x==="prev"||x==="next"){x==="prev"&&g.reverse();const N=g.indexOf(w.currentTarget);g=h.loop?Zfe(g,N+1):g.slice(N+1)}setTimeout(()=>P6(g))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:b!=null}):o})})});U6.displayName=L6;var Wfe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xfe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Kfe(e,t,n){const r=Xfe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wfe[r]}function P6(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Zfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Qfe=M6,Jfe=U6,jE="Radio",[epe,F6]=Vs(jE),[tpe,npe]=epe(jE),B6=p.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:i,disabled:o,value:l="on",onCheck:c,form:u,...h}=e,[d,f]=p.useState(null),m=dn(t,w=>f(w)),y=p.useRef(!1),b=d?u||!!d.closest("form"):!0;return a.jsxs(tpe,{scope:n,checked:s,disabled:o,children:[a.jsx(qt.button,{type:"button",role:"radio","aria-checked":s,"data-state":q6(s),"data-disabled":o?"":void 0,disabled:o,value:l,...h,ref:m,onClick:Nt(e.onClick,w=>{s||c==null||c(),b&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})}),b&&a.jsx(H6,{control:d,bubbles:!y.current,name:r,value:l,checked:s,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});B6.displayName=jE;var z6="RadioIndicator",$6=p.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=npe(z6,n);return a.jsx(Ys,{present:r||i.checked,children:a.jsx(qt.span,{"data-state":q6(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});$6.displayName=z6;var ape="RadioBubbleInput",H6=p.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...s},i)=>{const o=p.useRef(null),l=dn(o,i),c=E6(n),u=DS(t);return p.useEffect(()=>{const h=o.current;if(!h)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==n&&m){const y=new Event("click",{bubbles:r});m.call(h,n),h.dispatchEvent(y)}},[c,n,r]),a.jsx(qt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H6.displayName=ape;function q6(e){return e?"checked":"unchecked"}var rpe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rm="RadioGroup",[spe]=Vs(Rm,[I6,F6]),G6=I6(),V6=F6(),[ipe,ope]=spe(Rm),Y6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:h=!0,onValueChange:d,...f}=e,m=G6(n),y=O6(u),[b,w]=$c({prop:i,defaultProp:s??null,onChange:d,caller:Rm});return a.jsx(ipe,{scope:n,name:r,required:o,disabled:l,value:b,onValueChange:w,children:a.jsx(Qfe,{asChild:!0,...m,orientation:c,dir:y,loop:h,children:a.jsx(qt.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:y,...f,ref:t})})})});Y6.displayName=Rm;var W6="RadioGroupItem",X6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,i=ope(W6,n),o=i.disabled||r,l=G6(n),c=V6(n),u=p.useRef(null),h=dn(t,u),d=i.value===s.value,f=p.useRef(!1);return p.useEffect(()=>{const m=b=>{rpe.includes(b.key)&&(f.current=!0)},y=()=>f.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",y)}},[]),a.jsx(Jfe,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(B6,{disabled:o,required:i.required,checked:d,...c,...s,name:i.name,ref:h,onCheck:()=>i.onValueChange(s.value),onKeyDown:Nt(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:Nt(s.onFocus,()=>{var m;f.current&&((m=u.current)==null||m.click())})})})});X6.displayName=W6;var lpe="RadioGroupIndicator",K6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=V6(n);return a.jsx($6,{...s,...r,ref:t})});K6.displayName=lpe;var Z6=Y6,Q6=X6,cpe=K6;const t1=p.forwardRef(({className:e,...t},n)=>a.jsx(Z6,{className:Ve("grid gap-2",e),...t,ref:n}));t1.displayName=Z6.displayName;const jl=p.forwardRef(({className:e,...t},n)=>a.jsx(Q6,{ref:n,className:Ve("aspect-square h-4 w-4 rounded-none border border-white/20 bg-black text-white ring-offset-black focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-white data-[state=checked]:border-white",e),...t,children:a.jsx(cpe,{className:"flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-none bg-black"})})}));jl.displayName=Q6.displayName;const J6=e=>{if(!e)return a.jsx(la,{className:"w-6 h-6 text-white"});const t=e.toLowerCase(),n="w-6 h-6 text-white";switch(t){case"github":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 15 15",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M7.5.25a7.25 7.25 0 0 0-2.292 14.13c.363.066.495-.158.495-.35c0-.172-.006-.628-.01-1.233c-2.016.438-2.442-.972-2.442-.972c-.33-.838-.805-1.06-.805-1.06c-.658-.45.05-.441.05-.441c.728.051 1.11.747 1.11.747c.647 1.108 1.697.788 2.11.602c.066-.468.254-.788.46-.969c-1.61-.183-3.302-.805-3.302-3.583a2.8 2.8 0 0 1 .747-1.945c-.075-.184-.324-.92.07-1.92c0 0 .61-.194 1.994.744A6.963 6.963 0 0 1 7.5 3.756A6.97 6.97 0 0 1 9.315 4c1.384-.938 1.992-.743 1.992-.743c.396.998.147 1.735.072 1.919c.465.507.745 1.153.745 1.945c0 2.785-1.695 3.398-3.31 3.577c.26.224.492.667.492 1.343c0 .97-.009 1.751-.009 1.989c0 .194.131.42.499.349A7.25 7.25 0 0 0 7.499.25",clipRule:"evenodd"})});case"google":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 56 56",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M28.458 5c6.167 0 11.346 2.2 15.368 5.804l.323.295l-6.62 6.464c-1.695-1.59-4.666-3.493-9.07-3.493c-6.204 0-11.47 4.093-13.372 9.749c-.47 1.46-.756 3.023-.756 4.64c0 1.615.287 3.18.782 4.639c1.877 5.656 7.142 9.748 13.345 9.748c3.347 0 5.928-.886 7.881-2.176l.251-.17l.307-.222c2.813-2.108 4.144-5.084 4.46-7.169l.03-.22h-12.93v-8.705h22.025c.339 1.46.495 2.867.495 4.795c0 7.142-2.554 13.163-6.985 17.255c-3.884 3.597-9.201 5.682-15.535 5.682c-9.031 0-16.85-5.102-20.772-12.57l-.184-.358l-.222-.457A23.45 23.45 0 0 1 5 28.458c0-3.6.827-7.01 2.28-10.073l.222-.457l.184-.357C11.608 10.1 19.426 5 28.458 5"})});case"apple":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M14.122 4.682c1.35 0 2.781.743 3.8 2.028c-3.34 1.851-2.797 6.674.578 7.963c-.465 1.04-.687 1.505-1.285 2.426c-.835 1.284-2.01 2.884-3.469 2.898c-1.295.012-1.628-.853-3.386-.843c-1.758.01-2.125.858-3.42.846c-1.458-.014-2.573-1.458-3.408-2.743C1.198 13.665.954 9.45 2.394 7.21C3.417 5.616 5.03 4.683 6.548 4.683c1.545 0 2.516.857 3.794.857c1.24 0 1.994-.858 3.78-.858M13.73 0c.18 1.215-.314 2.405-.963 3.247c-.695.902-1.892 1.601-3.05 1.565c-.21-1.163.332-2.36.99-3.167C11.43.755 12.67.074 13.73 0"})});case"discord":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M18.59 5.89c-1.23-.57-2.54-.99-3.92-1.23c-.17.3-.37.71-.5 1.04c-1.46-.22-2.91-.22-4.34 0c-.14-.33-.34-.74-.51-1.04c-1.38.24-2.69.66-3.92 1.23c-2.48 3.74-3.15 7.39-2.82 10.98c1.65 1.23 3.24 1.97 4.81 2.46c.39-.53.73-1.1 1.03-1.69c-.57-.21-1.11-.48-1.62-.79c.14-.1.27-.21.4-.31c3.13 1.46 6.52 1.46 9.61 0c.13.11.26.21.4.31c-.51.31-1.06.57-1.62.79c.3.59.64 1.16 1.03 1.69c1.57-.49 3.17-1.23 4.81-2.46c.39-4.17-.67-7.78-2.82-10.98Zm-9.75 8.78c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94s1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94m6.31 0c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94s1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94"})});case"facebook":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 64 64",fill:"#888888",children:a.jsx("path",{d:"M59.5 1h-55C2.5 1 1 2.6 1 4.5v55c0 2 1.6 3.5 3.5 3.5h29.6V38.9h-8v-9.3h8v-6.9c0-8 4.8-12.4 12-12.4c2.4 0 4.8.1 7.2.4V19h-4.8c-3.8 0-4.6 1.8-4.6 4.5v5.9H53l-1.3 9.4h-8v23.8h15.8c2 0 3.5-1.5 3.5-3.5V4.5c-.1-2-1.7-3.5-3.5-3.5"})});case"microsoft":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M2 3h9v9H2zm9 19H2v-9h9zM21 3v9h-9V3zm0 19h-9v-9h9z"})});case"twitter":case"x":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 448 512",fill:"currentColor",children:a.jsx("path",{d:"M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64zm297.1 84L257.3 234.6L379.4 396h-95.6L209 298.1L123.3 396H75.8l111-126.9L69.7 116h98l67.7 89.5l78.2-89.5zm-37.8 251.6L153.4 142.9h-28.3l171.8 224.7h26.3z"})});case"linkedin":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 448 512",fill:"currentColor",children:a.jsx("path",{d:"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"})});case"gitlab":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 32 32",fill:"currentColor",children:a.jsx("path",{d:"M28.568 12.893l-.037-.094l-3.539-9.235a.92.92 0 0 0-.364-.439a.95.95 0 0 0-1.083.058a.95.95 0 0 0-.314.477l-2.39 7.31h-9.675l-2.39-7.31a.93.93 0 0 0-.313-.478a.95.95 0 0 0-1.083-.058a.93.93 0 0 0-.365.438L3.47 12.794l-.035.093a6.57 6.57 0 0 0 2.18 7.595l.011.01l.033.022l5.39 4.037l2.668 2.019l1.624 1.226c.39.297.931.297 1.322 0l1.624-1.226l2.667-2.019l5.424-4.061l.013-.01a6.574 6.574 0 0 0 2.177-7.588Z"})});case"reddit":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 32 32",fill:"currentColor",children:a.jsx("path",{d:"M16 0C7.164 0 0 7.164 0 16s7.164 16 16 16s16-7.164 16-16S24.836 0 16 0m8.5 10.5a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m-17 0a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m1.5 6.5c0 1.5 1.5 2.5 3 2.5c.5 0 1-.1 1.5-.3c.5.6 1.2 1 2 1c.8 0 1.5-.4 2-1c.5.2 1 .3 1.5.3c1.5 0 3-1 3-2.5c0-1.5-1.5-2.5-3-2.5c-.5 0-1 .1-1.5.3c-.5-.6-1.2-1-2-1c-.8 0-1.5.4-2 1c-.5-.2-1-.3-1.5-.3c-1.5 0-3 1-3 2.5"})});case"spotify":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 256 256",fill:"currentColor",children:a.jsx("path",{d:"M128 0C57.308 0 0 57.309 0 128c0 70.696 57.309 128 128 128 70.697 0 128-57.304 128-32.3C256 57.314 198.697.007 127.998.007l.001-.006Zm58.699 184.614c-2.293 3.76-7.215 4.952-10.975 2.644c-30.053-18.357-67.885-22.515-112.44-12.335a7.981 7.981 0 0 1-9.552-6.007 7.968 7.968 0 0 1 6-9.553c48.76-11.14 90.583-6.344 124.323 14.276 3.76 2.308 4.952 7.215 2.644 10.975Zm15.667-34.853c-2.89 4.695-9.034 6.178-13.726 3.289c-34.406-21.148-86.853-27.273-127.548-14.92c-5.278 1.594-10.852-1.38-12.454-6.649c-1.59-5.278 1.386-10.842 6.655-12.446c46.485-14.106 104.275-7.273 143.787 17.007c4.692 2.89 6.175 9.034 3.286 13.72v-.001Zm1.345-36.293C162.457 88.964 94.394 86.71 55.007 98.666c-6.325 1.918-13.014-1.653-14.93-7.978c-1.917-6.328 1.65-13.012 7.98-14.935C93.27 62.027 168.434 64.68 215.929 92.876c5.702 3.376 7.566 10.724 4.188 16.405c-3.362 5.69-10.73 7.565-16.4 4.187h-.006Z"})});case"slack":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2447.6 2452.5",className:n,fill:"currentColor",children:a.jsxs("g",{fill:"currentColor",children:[a.jsx("path",{d:"m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z"}),a.jsx("path",{d:"m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2c-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2c-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z"}),a.jsx("path",{d:"m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z"}),a.jsx("path",{d:"M0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3c-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0"})]})});case"notion":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.28c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514c-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933z"})});case"tiktok":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M19.589 6.686a4.793 4.793 0 0 1-3.77-4.245V2h-3.445v13.672a2.896 2.896 0 0 1-5.201 1.743l-.002-.001.002.001a2.895 2.895 0 0 1 3.183-4.51v-3.5a6.329 6.329 0 0 0-5.394 10.692 6.33 6.33 0 0 0 10.857-4.424V8.687a8.182 8.182 0 0 0 4.773 1.526V6.79a4.831 4.831 0 0 1-1.003-.104z"})});case"twitch":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M3.9 2.5a.9.9 0 0 0-.9.9v14.194a.9.9 0 0 0 .9.9h4.116v3.03a.7.7 0 0 0 1.194.494l3.525-3.524h4.643a.9.9 0 0 0 .636-.264l2.722-2.722a.9.9 0 0 0 .264-.636V3.4a.9.9 0 0 0-.9-.9zm7.319 5.2a.75.75 0 0 0-1.5 0v4.272a.75.75 0 1 0 1.5 0zm5.016 0a.75.75 0 0 0-1.5 0v4.272a.75.75 0 1 0 1.5 0z",clipRule:"evenodd"})});case"dropbox":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 528 512",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z"})});case"linear":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"1.2em",height:"1.2em",viewBox:"0 0 100 100",children:a.jsx("path",{fill:"currentColor",d:"M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259c.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684c.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3542-.0443L12.6587 18.074Z"})});case"huggingface":case"hugging face":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12.025 1.13c-5.77 0-10.449 4.647-10.449 10.378c0 1.112.178 2.181.503 3.185c.064-.222.203-.444.416-.577a.96.96 0 0 1 .524-.15c.293 0 .584.124.84.284c.278.173.48.408.71.694c.226.282.458.611.684.951v-.014c.017-.324.106-.622.264-.874s.403-.487.762-.543c.3-.047.596.06.787.203s.31.313.4.467c.15.257.212.468.233.542c.01.026.653 1.552 1.657 2.54c.616.605 1.01 1.223 1.082 1.912c.055.537-.096 1.059-.38 1.572c.637.121 1.294.187 1.967.187c.657 0 1.298-.063 1.921-.178c-.287-.517-.44-1.041-.384-1.581c.07-.69.465-1.307 1.081-1.913c1.004-.987 1.647-2.513 1.657-2.539c.021-.074.083-.285.233-.542c.09-.154.208-.323.4-.467a1.08 1.08 0 0 1 .787-.203c.359.056.604.29.762.543s.247.55.265.874v.015c.225-.34.457-.67.683-.952c.23-.286.432-.52.71-.694c.257-.16.547-.284.84-.285a.97.97 0 0 1 .524.151c.228.143.373.388.43.625l.006.04a10.3 10.3 0 0 0 .534-3.273c0-5.731-4.678-10.378-10.449-10.378M8.327 6.583a1.5 1.5 0 0 1 .713.174a1.487 1.487 0 0 1 .617 2.013c-.183.343-.762-.214-1.102-.094c-.38.134-.532.914-.917.71a1.487 1.487 0 0 1 .69-2.803m7.486 0a1.487 1.487 0 0 1 .689 2.803c-.385.204-.536-.576-.916-.71c-.34-.12-.92.437-1.103.094a1.487 1.487 0 0 1 .617-2.013a1.5 1.5 0 0 1 .713-.174m-10.68 1.55a.96.96 0 1 1 0 1.921a.96.96 0 0 1 0-1.92m13.838 0a.96.96 0 1 1 0 1.92a.96.96 0 0 1 0-1.92M8.489 11.458c.588.01 1.965 1.157 3.572 1.164c1.607-.007 2.984-1.155 3.572-1.164c.196-.003.305.12.305.454c0 .886-.424 2.328-1.563 3.202c-.22-.756-1.396-1.366-1.63-1.32q-.011.001-.02.006l-.044.026l-.01.008l-.03.024q-.018.017-.035.036l-.032.04a1 1 0 0 0-.058.09l-.014.025q-.049.088-.11.19a1 1 0 0 1-.083.116a1.2 1.2 0 0 1-.173.18q-.035.029-.075.058a1.3 1.3 0 0 1-.251-.243a1 1 0 0 1-.076-.107c-.124-.193-.177-.363-.337-.444c-.034-.016-.104-.008-.2.022q-.094.03-.216.087q-.06.028-.125.063l-.13.074q-.067.04-.136.086a3 3 0 0 0-.135.096a3 3 0 0 0-.26.219a2 2 0 0 0-.12.121a2 2 0 0 0-.106.128l-.002.002a2 2 0 0 0-.09.132l-.001.001a1.2 1.2 0 0 0-.105.212q-.013.036-.024.073c-1.139-.875-1.563-2.317-1.563-3.203c0-.334.109-.457.305-.454m.836 10.354c.824-1.19.766-2.082-.365-3.194c-1.13-1.112-1.789-2.738-1.789-2.738s-.246-.945-.806-.858s-.97 1.499.202 2.362c1.173.864-.233 1.45-.685.64c-.45-.812-1.683-2.896-2.322-3.295s-1.089-.175-.938.647s2.822 2.813 2.562 3.244s-1.176-.506-1.176-.506s-2.866-2.567-3.49-1.898s.473 1.23 2.037 2.16c1.564.932 1.686 1.178 1.464 1.53s-3.675-2.511-4-1.297c-.323 1.214 3.524 1.567 3.287 2.405c-.238.839-2.71-1.587-3.216-.642c-.506.946 3.49 2.056 3.522 2.064c1.29.33 4.568 1.028 5.713-.624m5.349 0c-.824-1.19-.766-2.082.365-3.194c1.13-1.112 1.789-2.738 1.789-2.738s.246-.945.806-.858s.97 1.499-.202 2.362c-1.173.864.233 1.45.685.64c.451-.812 1.683-2.896 2.322-3.295s1.089-.175.938.647s-2.822 2.813-2.562 3.244s1.176-.506 1.176-.506s2.866-2.567 3.49-1.898s-.473 1.23-2.037 2.16c-1.564.932-1.686 1.178-1.464 1.53s3.675-2.511 4-1.297c.323 1.214-3.524 1.567-3.287 2.405c.238.839 2.71-1.587 3.216-.642c.506.946-3.49 2.056-3.522 2.064c-1.29.33-4.568 1.028-5.713-.624"})});case"kick":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"#888888",children:a.jsx("path",{d:"M9 3a1 1 0 0 1 1 1v3h1V6a1 1 0 0 1 .883-.993L12 5h1V4a1 1 0 0 1 .883-.993L14 3h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-1v1a1 1 0 0 1-.883.993L18 11h-1v2h1a1 1 0 0 1 .993.883L19 14v1h1a1 1 0 0 1 .993.883L21 16v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1h-1a1 1 0 0 1-.993-.883L11 18v-1h-1v3a1 1 0 0 1-.883.993L9 21H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"})});case"zoom":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 16 16",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M1.45 3.334C.648 3.334 0 3.982 0 4.783v4.986c0 1.6 1.298 2.898 2.898 2.898h6.986c.8 0 1.45-.649 1.45-1.45V6.233a2.9 2.9 0 0 0-2.899-2.899zM16 4.643v6.715c0 .544-.618.86-1.059.539l-2.059-1.498a1.33 1.33 0 0 1-.549-1.078V6.679c0-.427.204-.827.55-1.078l2.058-1.498a.667.667 0 0 1 1.059.54",clipRule:"evenodd"})});case"vk":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M17.802 12.298s1.617 1.597 2.017 2.336a.1.1 0 0 1 .018.035q.244.409.123.645c-.135.261-.592.392-.747.403h-2.858c-.199 0-.613-.052-1.117-.4c-.385-.269-.768-.712-1.139-1.145c-.554-.643-1.033-1.201-1.518-1.201a.6.6 0 0 0-.18.03c-.367.116-.833.639-.833 2.032c0 .436-.344.684-.585.684H9.674c-.446 0-2.768-.156-4.827-2.327C2.324 10.732.058 5.4.036 5.353c-.141-.345.155-.533.475-.533h2.886c.387 0 .513.234.601.444c.102.241.48 1.205 1.1 2.288c1.004 1.762 1.621 2.479 2.114 2.479a.53.53 0 0 0 .264-.07c.644-.354.524-2.654.494-3.128c0-.092-.001-1.027-.331-1.479c-.236-.324-.638-.45-.881-.496c.065-.094.203-.238.38-.323c.441-.22 1.238-.252 2.029-.252h.439c.858.012 1.08.067 1.392.146c.628.15.64.557.585 1.943c-.016.396-.033.842-.033 1.367c0 .112-.005.237-.005.364c-.019.711-.044 1.512.458 1.841a.4.4 0 0 0 .217.062c.174 0 .695 0 2.108-2.425c.62-1.071 1.1-2.334 1.133-2.429c.028-.053.112-.202.214-.262a.5.5 0 0 1 .236-.056h3.395c.37 0 .621.056.67.196c.082.227-.016.92-1.566 3.016c-.261.349-.49.651-.691.915c-1.405 1.844-1.405 1.937.083 3.337",clipRule:"evenodd"})});case"roblox":return a.jsx("svg",{version:"1.1",id:"svg10",x:"0px",y:"0px",viewBox:"0 0 302.7 302.7",width:"1.2em",height:"1.2em",fill:"currentColor",children:a.jsx("path",{id:"path20",d:"M120.5,271.7c-110.9-28.6-120-31-119.9-31.5C0.7,239.6,62.1,0.5,62.2,0.4c0,0,54,13.8,119.9,30.8S302.1,62,302.2,62c0.2,0,0.2,0.4,0.1,0.9c-0.2,1.5-61.5,239.3-61.7,239.5C240.6,302.5,186.5,288.7,120.5,271.7z M174.9,158c3.2-12.6,5.9-23.1,6-23.4c0.1-0.5-2.3-1.2-23.2-6.6c-12.8-3.3-23.5-5.9-23.6-5.8c-0.3,0.3-12.1,46.6-12,46.7c0.2,0.2,46.7,12.2,46.8,12.1C168.9,180.9,171.6,170.6,174.9,158L174.9,158z"})});default:return a.jsx(la,{className:"w-6 h-6 text-white"})}},pw=`// Example custom migration script
938
+ });`}[de]||""},ye=de=>{navigator.clipboard.writeText(de),V.success("Copied to clipboard")},ze=Object.values(aa).filter(de=>c==="all"||de.category===c);return a.jsxs("div",{className:"h-full flex flex-col bg-black",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{className:"pb-8",children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Emails"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Customize your email templates with a visual editor"})]})}),a.jsxs("div",{className:"flex flex-col items-center space-y-8",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),a.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[a.jsxs("div",{className:"w-[340px] border-r border-dashed border-white/15 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"p-4 border-b border-dashed border-white/15 flex-shrink-0",children:[a.jsx("h2",{className:"text-lg font-light text-white uppercase tracking-wider mb-4",children:"Templates"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:["all","authentication","organization","notification"].map(de=>a.jsx("button",{onClick:()=>u(de),className:`px-2 py-1 text-[10px] font-mono uppercase border border-dashed rounded-none transition-colors ${c===de?"border-white/30 bg-white/5 text-white":"border-white/10 bg-black/40 text-gray-300 hover:border-white/20"}`,children:de},de))})]}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-2",style:{overscrollBehavior:"contain"},children:ze.map(de=>a.jsxs("button",{onClick:()=>W(de.id),className:`w-full text-left p-3 border border-dashed rounded-none transition-colors ${e===de.id?"border-white/30 bg-white/5 text-white":"border-white/15 bg-black/40 text-gray-300 hover:border-white/20 hover:bg-white/5"}`,children:[a.jsx("div",{className:"text-sm uppercase font-mono",children:de.name}),a.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[de.fields.length," fields"]})]},de.id))})]}),a.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border-b border-dashed border-white/15 p-4 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-light text-white uppercase tracking-wider",children:(He=aa[e])==null?void 0:He.name}),a.jsx("p",{className:"text-xs text-gray-400 font-mono mt-1",children:(Fe=aa[e])==null?void 0:Fe.category})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs(z,{variant:"outline",onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(m3,{className:"w-4 h-4 mr-2"}),"Test Email"]}),a.jsxs(z,{variant:"outline",onClick:()=>{xe(e)&&l(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(fi,{className:"w-4 h-4 mr-2"}),"Export Code"]}),a.jsxs(z,{variant:"outline",onClick:()=>ye(n),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(Ec,{className:"w-4 h-4 mr-2"}),"Copy HTML"]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-dashed border-white/10 bg-black/40",children:a.jsxs("div",{className:"flex items-end gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject"}),a.jsx(ve,{value:s,onChange:de=>te(de.target.value),placeholder:"Email subject",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-sm"})]}),a.jsxs(z,{variant:"outline",onClick:()=>m(!f),className:"h-10 border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[f?"Hide":"Show"," Fields"]})]})}),f&&e&&a.jsxs("div",{className:"p-4 border-b overflow-hidden border-dashed border-white/10 bg-black/30",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Fields"}),a.jsx("div",{className:"grid grid-cols-2 gap-3 max-h-full overflow-y-hidden",children:(Ye=aa[e])==null?void 0:Ye.fields.map(de=>a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs font-mono text-gray-400 mb-1 block",children:de}),a.jsx(ve,{value:h[de]||"",onChange:Be=>d(Ue=>({...Ue,[de]:Be.target.value})),placeholder:`{{${de}}}`,className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"})]},de))}),a.jsx("div",{className:"mt-4 flex justify-end",children:a.jsx(z,{variant:"outline",onClick:Ee,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Apply Changes"})})]}),e&&a.jsxs("div",{className:"p-4 border-b border-dashed border-white/10 bg-black/40",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Dynamic Fields"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:(ft=aa[e])==null?void 0:ft.fields.map(de=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ye(`{{${de}}}`),className:"text-xs rounded-none border border-dashed border-white/20 hover:bg-white/10",children:de}),a.jsx("span",{className:"text-xs text-gray-500 font-mono",children:`{{${de}}}`})]},de))})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Efe,{html:re,onChange:Y})})]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-0",children:a.jsxs("div",{className:"text-center",children:[a.jsx(jc,{className:"w-16 h-16 text-white/20 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-400 font-mono uppercase text-sm",children:"Select a template to start editing"})]})})})]}),o&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&l(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-5xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-0 pt-2 border-white/15 border-b-0 bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between p-2 pt-2",children:a.jsxs("div",{className:"pb-2",children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Export"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Export the code for the selected template"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>l(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("div",{className:"relative z-20 h-8 w-[calc(100%)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#e0f2fe,#e0f2fe_1px,transparent_1px,transparent_6px)] opacity-[8%]"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),a.jsx("div",{className:"flex-1 overflow-auto p-6 bg-black",children:a.jsx(w6,{code:xe(e),language:"typescript",fileName:"auth.ts"})}),a.jsx("div",{className:"flex items-center justify-end p-6 border-t border-white/15 bg-black/50",children:a.jsx(z,{onClick:ne,disabled:w,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2",children:w?"Applying...":"Apply to auth config"})})]})}),v&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&g(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-white/15 border-b bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Setup Required"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Install Resend before applying email template"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 bg-black",children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{children:[a.jsx("h2",{className:"text-md font-mono uppercase font-normal text-white mb-3",children:"Install Resend"}),a.jsx("p",{className:"text-gray-300 mb-4 font-sans leading-relaxed",children:"You need to install the Resend package to send emails. Run the following command in your terminal:"}),a.jsx("div",{className:"bg-black/80 border border-dashed border-white/20 p-2 pl-3 rounded-none font-mono text-sm relative group",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("code",{className:"text-gray-200",children:[a.jsx("span",{className:"text-white",children:"$"})," ",a.jsx("span",{className:"text-blue-600",children:"pnpm"})," ",a.jsx("span",{className:"text-white",children:"install"})," ",a.jsx("span",{className:"text-white",children:"resend"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText("pnpm install resend"),S(!0),setTimeout(()=>S(!1),2e3)},className:"flex items-center gap-2 px-2 py-1.5 rounded-none transition-colors text-gray-300 hover:text-white",title:"Copy command",children:N?a.jsx(a.Fragment,{children:a.jsx(Cd,{className:"w-4 h-4"})}):a.jsx(a.Fragment,{children:a.jsx(Ec,{className:"w-4 h-4"})})})]})})]})})}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/15 bg-black/50",children:[a.jsx(z,{variant:"ghost",onClick:()=>g(!1),className:"text-gray-400 hover:text-white rounded-none font-mono uppercase text-xs px-6 py-2",children:"Cancel"}),a.jsx(z,{onClick:()=>X(e),disabled:w,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2",children:w?"Applying...":"Continue"})]})]})}),E&&e&&a.jsx("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 overflow-hidden",onClick:de=>{de.target===de.currentTarget&&j(!1)},children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-0 w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",onClick:de=>de.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-white/15 border-b bg-black/50",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-normal uppercase text-white tracking-tight",children:"Test Email"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Send a test email with dynamic values"})]})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 bg-black",children:a.jsxs("div",{className:"space-y-6",children:[_==="checking"&&a.jsx("div",{className:"bg-black/90 flex border p-4 rounded-none border-dashed border-white/20",children:a.jsxs("p",{className:"text-white text-sm font-sans flex items-center gap-2 leading-relaxed",children:[a.jsx(er,{className:"w-4 h-4 animate-spin mr-1"})," Checking for RESEND_API_KEY..."]})}),_==="missing"&&a.jsxs("div",{className:"bg-red-900/20 border border-red-500/30 border-dashed p-4 rounded-none",children:[a.jsx("p",{className:"text-red-200 text-sm font-sans leading-relaxed mb-2",children:a.jsx("strong",{className:"font-normal uppercase font-mono",children:"RESEND_API_KEY not found"})}),a.jsxs("p",{className:"text-red-200 text-sm font-sans leading-relaxed",children:["Please add"," ",a.jsx("code",{className:"bg-black/50 px-1 py-0.5 rounded font-mono text-xs",children:"RESEND_API_KEY"})," ","to your"," ",a.jsx("code",{className:"bg-black/50 px-1 py-0.5 rounded font-mono text-xs",children:".env"})," ","file."]})]}),_==="found"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"From Email (Verified Sender) *"}),A.length>0?a.jsx("select",{value:T,onChange:de=>O(de.target.value),className:"w-full bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs p-2 focus:outline-none focus:border-white/40",children:A.map(de=>a.jsx("option",{value:de,children:de},de))}):a.jsx(ve,{type:"email",value:T,onChange:de=>O(de.target.value),placeholder:"noreply@yourdomain.com",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:A.length>0?"Select a verified sender email from your Resend account":"Enter a verified sender email address from your Resend account"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject *"}),a.jsx(ve,{type:"text",value:q,onChange:de=>k(de.target.value),placeholder:"Email subject",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:"Email subject line (supports dynamic placeholders)"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"To Email Address *"}),a.jsx(ve,{type:"email",value:R,onChange:de=>L(de.target.value),placeholder:"recipient@example.com",className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:"Any email address to receive the test email"})]}),((et=aa[e])==null?void 0:et.fields)&&aa[e].fields.length>0&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Dynamic Values"}),a.jsx("div",{className:"space-y-3",children:aa[e].fields.map(de=>a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-500 mb-1 block",children:de}),a.jsx(ve,{value:P[de]||"",onChange:Be=>U({...P,[de]:Be.target.value}),placeholder:`Enter ${de}`,className:"bg-black border border-dashed border-white/20 text-white rounded-none font-mono text-xs"})]},de))})]})]})]})}),a.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/15 bg-black/50",children:[a.jsx(z,{variant:"ghost",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none font-mono uppercase text-xs px-6 py-2",children:"Cancel"}),a.jsx(z,{onClick:$,disabled:F||_!=="found"||!R||!T||!q,className:"bg-white text-black hover:bg-white/90 rounded-none font-mono uppercase text-xs px-6 py-2 disabled:opacity-50 disabled:cursor-not-allowed",children:F?"Sending...":"Send Test Email"})]})]})})]})}function Tfe(){const e=ha(),[t]=yM(),n=t.get("redirect")||"/",[r,s]=p.useState(""),[i,o]=p.useState(""),[l,c]=p.useState(""),[u,h]=p.useState(!1),d=async f=>{var m;f.preventDefault(),h(!0),c("");try{const y=((m=window.__STUDIO_CONFIG__)==null?void 0:m.basePath)||"",b=y?`${y}/auth`:"/api/auth",w=await fetch(`${b}/sign-in`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:i}),credentials:"include"}),x=await w.json();if(!w.ok){if(w.status===403){e("/access-denied");return}throw new Error(x.message||"Invalid credentials")}if(x.success)e(n);else throw new Error(x.message||"Login failed")}catch(y){c(y.message||"Login failed")}finally{h(!1)}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 opacity-[3%]",children:a.jsx("div",{className:"absolute inset-0 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_8px)]"})}),a.jsx("div",{className:"w-full max-w-md relative z-10",children:a.jsxs("div",{className:"border border-dashed border-white/20 bg-black p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"flex relative justify-between items-center gap-2 mb-4",children:a.jsxs("span",{className:"flex w-full text-left justify-start items-center text-white text-xs font-mono uppercase tracking-wider",children:["better auth"," ",a.jsx("span",{className:"bg-white text-black px-1 ml-1 rounded-none",children:"studio"})]})}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-white text-lg font-mono uppercase tracking-wide mb-1",children:"Admin Access"}),a.jsx("p",{className:"text-white/40 text-xs font-mono",children:"Sign in with your admin account"})]}),l&&a.jsx("div",{className:"mb-4 p-3 border border-dashed border-red-500/30 bg-red-500/5",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(wl,{className:"w-4 h-4 text-red-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-red-400 text-xs font-mono",children:l})]})}),a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-white/50 text-[10px] font-mono uppercase tracking-wider block mb-1.5",children:"Email"}),a.jsx("input",{type:"email",value:r,onChange:f=>s(f.target.value),placeholder:"admin@example.com",className:"w-full h-10 px-3 bg-black border border-dashed border-white/20 text-white text-sm font-mono placeholder:text-white/20 focus:outline-none focus:border-white/40 transition-colors",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-white/50 text-[10px] font-mono uppercase tracking-wider block mb-1.5",children:"Password"}),a.jsx("input",{type:"password",value:i,onChange:f=>o(f.target.value),placeholder:"••••••••",className:"w-full h-10 px-3 bg-black border border-dashed border-white/20 text-white text-sm font-mono placeholder:text-white/20 focus:outline-none focus:border-white/40 transition-colors",required:!0})]}),a.jsx("button",{type:"submit",disabled:u,className:"w-full h-10 bg-white text-black text-xs font-mono uppercase tracking-wider hover:bg-white/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:u?a.jsx(WY,{className:"w-3 h-3 animate-spin"}):"Sign In"})]}),a.jsx("div",{className:"mt-6",children:a.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2"})}),a.jsx("div",{className:"mt-6 pt-4 border-t border-dashed border-white/10",children:a.jsx("p",{className:"text-white/30 uppercase tracking-wider text-[10px] font-mono text-center",children:"admin role required for access"})})]})})]})}const Cfe=q5("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-white text-black hover:bg-white",secondary:"border-transparent bg-gray-800 text-white hover:bg-gray-800 border border-gray-600",destructive:"border-transparent bg-red-500 text-white hover:bg-red-600",outline:"text-gray-300 border-gray-600",success:"border-transparent bg-green-900 text-green-300",warning:"border-transparent bg-yellow-900 text-yellow-300",error:"border-transparent bg-red-900 text-red-300",info:"border-transparent bg-gray-800 text-white border border-gray-600"}},defaultVariants:{variant:"default"}});function $t({className:e,variant:t,...n}){return a.jsx("div",{className:Ve(Cfe({variant:t}),e),...n})}function kfe(){const{orgId:e}=iS(),t=ha(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState([]),[h,d]=p.useState(!0),[f,m]=p.useState("details"),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState(!1),[F,G]=p.useState(!1),[_,I]=p.useState(!1),[A,C]=p.useState(null),[T,O]=p.useState({name:"",slug:""}),[q,k]=p.useState(""),[M,$]=p.useState(""),[W,Y]=p.useState([]),[te,ne]=p.useState({name:""}),[X,se]=p.useState(!1),[Ee,re]=p.useState([]),[xe,ye]=p.useState(!1),[ze,He]=p.useState([]),[Fe,Ye]=p.useState(!1),[ft,et]=p.useState(!1);p.useEffect(()=>{e&&(Be(),Oe(),Ue(),nt(),lt(),We());const Q=setInterval(()=>{!w&&e&&Oe()},2e3);return()=>clearInterval(Q)},[e,w]),p.useEffect(()=>{y&&e&&We()},[]),p.useEffect(()=>{f==="members"&&e&&lt()},[f,e]),p.useEffect(()=>{f==="invitations"&&e&&nt()},[f,e]);const de=Q=>{ne({name:Q})},Be=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}`)).json();oe.success&&oe.organization||oe.organization?r(oe.organization):V.error("Organization not found")}catch(Q){console.error("Failed to fetch organization:",Q),V.error("Failed to load organization")}finally{d(!1)}},Ue=async()=>{try{const oe=await(await fetch("/api/plugins/teams/status")).json();b(oe.enabled)}catch(Q){console.error("Failed to check teams status:",Q),b(!1)}},Oe=async()=>{try{const oe=await(await fetch("/api/plugins/organization/status")).json();x(oe.enabled)}catch(Q){console.error("Failed to check organization status:",Q),x(!1)}},We=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/teams`)).json();oe.success&&i(oe.teams||[])}catch(Q){console.error("Failed to fetch teams:",Q),V.error("Failed to load teams")}},nt=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/invitations`)).json();oe.success&&l(oe.invitations||[])}catch(Q){console.error("Failed to fetch invitations:",Q),V.error("Failed to load invitations")}},lt=async()=>{try{const oe=await(await fetch(`/api/organizations/${e}/members`)).json();oe.success&&u(oe.members||[])}catch(Q){console.error("Failed to fetch members:",Q),V.error("Failed to load members")}},Ut=async Q=>{re([]),ye(!0),re([{id:"start",type:"info",message:`Starting member seeding process for ${Q} members...`,timestamp:new Date}]);try{const De=await(await fetch(`/api/organizations/${e}/seed-members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Q})})).json();if(De.success){const it=De.results.map((at,It)=>at.success?{id:`member-${It}`,type:"progress",message:`Adding member: ${at.member.user.name} (${at.member.user.email})`,timestamp:new Date,status:"completed"}:{id:`member-${It}`,type:"error",message:`Failed to add member ${It+1}: ${at.error}`,timestamp:new Date});re(at=>[...at,...it]);const tt=De.results.filter(at=>at.success).length;re(at=>[...at,{id:"complete",type:"success",message:`✅ Seeding completed! Added ${tt}/${Q} members successfully`,timestamp:new Date}]),await lt(),V.success(`Successfully added ${tt} members!`)}else re(it=>[...it,{id:"error",type:"error",message:`❌ Seeding failed: ${De.error||"Unknown error"}`,timestamp:new Date}]),V.error(De.error||"Failed to seed members")}catch(oe){re(De=>[...De,{id:"error",type:"error",message:`❌ Network error: ${oe}`,timestamp:new Date}]),V.error("Failed to seed members")}finally{ye(!1)}},Kt=async Q=>{He([]),Ye(!0),He([{id:"start",type:"info",message:`Starting team seeding process for ${Q} teams...`,timestamp:new Date}]);try{const De=await(await fetch(`/api/organizations/${e}/seed-teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Q})})).json();if(De.success){const it=De.results.map((at,It)=>at.success?{id:`team-${It}`,type:"progress",message:`Creating team: ${at.team.name}`,timestamp:new Date,status:"completed"}:{id:`team-${It}`,type:"error",message:`Failed to create team ${It+1}: ${at.error}`,timestamp:new Date});He(at=>[...at,...it]);const tt=De.results.filter(at=>at.success).length;He(at=>[...at,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${tt}/${Q} teams successfully`,timestamp:new Date}]),await We(),V.success(`Successfully created ${tt} teams!`)}else He(it=>[...it,{id:"error",type:"error",message:`❌ Seeding failed: ${De.error||"Unknown error"}`,timestamp:new Date}]),V.error(De.error||"Failed to seed teams")}catch(oe){He(De=>[...De,{id:"error",type:"error",message:`❌ Network error: ${oe}`,timestamp:new Date}]),V.error("Failed to seed teams")}finally{Ye(!1)}},Gt=async()=>{try{const oe=await(await fetch("/api/users/all")).json();oe.success&&Y(oe.users||[])}catch(Q){console.error("Failed to fetch users:",Q)}},_t=Q=>Q.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),ce=()=>{n&&(O({name:n.name,slug:n.slug}),I(!0))},Te=Q=>{const oe=_t(Q);O({name:Q,slug:oe})},Ze=Q=>{O(oe=>({...oe,slug:_t(Q)}))},K=async()=>{if(!n){V.error("No organization selected");return}if(!T.name){V.error("Please fill in the organization name");return}et(!0);const Q=V.loading("Updating organization...");try{const De=await(await fetch(`/api/organizations/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T.name,slug:T.slug})})).json();De.success?(await Be(),I(!1),O({name:"",slug:""}),V.success("Organization updated successfully!",{id:Q})):V.error(`Error updating organization: ${De.error||"Unknown error"}`,{id:Q})}catch(oe){console.error("Error updating organization:",oe),V.error("Error updating organization",{id:Q})}finally{et(!1)}},pe=()=>{Gt(),g(!0)},be=async()=>{if(!q){V.error("Please enter an email address");return}if(!M){V.error("Please select an inviter");return}se(!0);const Q=V.loading("Sending invitation...");try{const De=await(await fetch(`/api/organizations/${e}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:q,role:"member",inviterId:M})})).json();De.success?(await nt(),g(!1),k(""),$(""),V.success("Invitation sent successfully!",{id:Q})):V.error(`Error sending invitation: ${De.error||"Unknown error"}`,{id:Q})}catch(oe){console.error("Error sending invitation:",oe),V.error("Error sending invitation",{id:Q})}finally{se(!1)}},_e=async Q=>{const oe=V.loading("Cancelling invitation...");try{const it=await(await fetch(`/api/invitations/${Q}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();it.success?(await nt(),V.success("Invitation cancelled successfully!",{id:oe})):V.error(`Error cancelling invitation: ${it.error||"Unknown error"}`,{id:oe})}catch(De){console.error("Error cancelling invitation:",De),V.error("Error cancelling invitation",{id:oe})}},$e=async(Q,oe)=>{const De=V.loading("Resending invitation...");try{const tt=await(await fetch(`/api/invitations/${Q}/resend`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();tt.success?(await nt(),V.success(`Invitation resent to ${oe}!`,{id:De})):V.error(`Error resending invitation: ${tt.error||"Unknown error"}`,{id:De})}catch(it){console.error("Error resending invitation:",it),V.error("Error resending invitation",{id:De})}},je=async(Q,oe)=>{const De=V.loading(`Removing ${oe}...`);try{const tt=await(await fetch(`/api/members/${Q}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();tt.success?(await lt(),V.success(`${oe} removed from organization!`,{id:De})):V.error(`Error removing member: ${tt.error||"Unknown error"}`,{id:De})}catch(it){console.error("Error removing member:",it),V.error("Error removing member",{id:De})}},Z=async()=>{if(!te.name){V.error("Please enter a team name");return}const Q=V.loading("Creating team...");try{const De=await(await fetch(`/api/organizations/${e}/teams`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:te.name,organizationId:e})})).json();De.success?(await We(),L(!1),ne({name:""}),V.success("Team created successfully!",{id:Q})):V.error(`Error creating team: ${De.error||"Unknown error"}`,{id:Q})}catch(oe){console.error("Error creating team:",oe),V.error("Error creating team",{id:Q})}},ue=async()=>{if(!A||!te.name){V.error("Please enter a team name");return}const Q=V.loading("Updating team...");try{const De=await(await fetch(`/api/teams/${A.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:te.name})})).json();De.success?(await We(),U(!1),C(null),ne({name:""}),V.success("Team updated successfully!",{id:Q})):V.error(`Error updating team: ${De.error||"Unknown error"}`,{id:Q})}catch(oe){console.error("Error updating team:",oe),V.error("Error updating team",{id:Q})}},Ae=async()=>{if(!A){V.error("No team selected");return}const Q=V.loading("Deleting team...");try{const De=await(await fetch(`/api/teams/${A.id}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();De.success?(await We(),G(!1),C(null),V.success("Team deleted successfully!",{id:Q})):V.error(`Error deleting team: ${De.error||"Unknown error"}`,{id:Q})}catch(oe){console.error("Error deleting team:",oe),V.error("Error deleting team",{id:Q})}},Le=Q=>{C(Q),ne({name:Q.name}),U(!0)},he=Q=>{C(Q),G(!0)};return h?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading organization details..."})]})}):n?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>t("/organizations"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["orgs /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:e})]})})}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[a.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),a.jsxs(z,{onClick:pe,className:"border border-dashed border-white/20 text-white bg-transparent hover:bg-white/10 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Invite User"]}),a.jsxs(z,{onClick:ce,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(zo,{className:"w-4 h-4 mr-2"}),"Edit Organization"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsx("div",{children:a.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[n.name,a.jsx(Jt,{id:n.slug,nonSliced:!0,variant:"subscript"})]})})]}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsxs("nav",{className:"flex space-x-8 px-6",children:[a.jsxs("button",{onClick:()=>m("details"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(ka,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Details",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:0,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("members"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Members",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:c.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("invitations"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="invitations"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(ys,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Invitations",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:o.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]}),a.jsxs("button",{onClick:()=>m("teams"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${f==="teams"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Teams",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:s.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),a.jsxs("div",{className:"p-6",children:[f==="details"&&a.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"ORGANIZATION INFORMATION"}),a.jsx("hr",{className:"border-white/15 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),a.jsx("p",{className:"text-white font-sans mt-1",children:n.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Slug"}),a.jsx("p",{className:"text-white font-mono mt-1",children:n.slug})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),a.jsx("p",{className:"text-white font-sans mt-1",children:new Date(n.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:c.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:s.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Teams"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ys,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:o.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Invitations"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(dr,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:Math.ceil((new Date().getTime()-new Date(n.createdAt).getTime())/(1e3*60*60*24)),format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})})]})]}),f==="teams"&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:s.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-xs font-light",children:"Manage teams within this organization"})]}),y&&a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:()=>j(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Rs,{className:"w-4 h-4 mr-2"}),"Seed Teams"]}),a.jsxs(z,{onClick:()=>L(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Create Team"]})]})]}),y?s.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Team"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Members"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Created"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:s.map(Q=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>t(`/organizations/${e}/teams/${Q.id}`),children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:Q.name}),a.jsx(Jt,{id:Q.id,label:"Team ID"})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:Q.memberCount||0}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(Q.createdAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:oe=>{oe.stopPropagation(),Le(Q)},children:[a.jsx(zo,{className:"w-4 h-4 mr-1"}),"Edit"]}),a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:oe=>{oe.stopPropagation(),he(Q)},children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Delete"]})]})})]},Q.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Teams Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Create your first team to start organizing members within this organization."}),a.jsxs(z,{onClick:()=>L(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Create First Team"]})]})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-md text-white tracking-tight font-light font-mono uppercase mb-1",children:"Teams Feature Required"}),a.jsx("p",{className:"text-gray-300 mb-6 text-sm",children:"To use Teams in Better Auth Studio, you need to enable the teams feature in your organization plugin configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsx("li",{children:"Update your auth configuration file to enable teams:"})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsx("span",{className:"text-yellow-300 pl-12",children:"organization"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-16",children:"teams"}),": ","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-yellow-300 pl-20",children:"enabled"}),":"," ",a.jsx("span",{className:"text-blue-400",children:"true"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-16",children:"}"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-12",children:"})"})," ",a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Run migrations to create the teams table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),a.jsx(z,{onClick:()=>window.location.reload(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]}),f==="members"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Members",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage organization members and their roles"})]})}),c.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:c.map(Q=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 group",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:Q.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Q.user.id}`,alt:Q.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light inline-flex items-center gap-2",children:[a.jsx("span",{children:Q.user.name}),a.jsx("button",{onClick:oe=>{oe.stopPropagation(),t(`/users/${Q.user.id}`)},className:"opacity-0 group-hover:opacity-100 text-white/60 hover:text-white transition-all",title:"View user details",children:a.jsx(yu,{className:"w-4 h-4"})})]}),a.jsx(Jt,{id:Q.user.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:Q.user.email}),a.jsx("td",{className:"py-4 px-4",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed rounded-none border-blue-500/30 text-blue-400/70 capitalize",children:Q.role})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(Q.joinedAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>je(Q.id,Q.user.name),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},Q.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Invite users or seed members from existing users to get started."}),a.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[a.jsxs(z,{onClick:()=>S(!0),className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Seed Members"]}),a.jsxs(z,{onClick:pe,className:"bg-white text-black hover:bg-white/90 border border-white/20 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Invite User"]})]})]})})]}),f==="invitations"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Invitations",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage pending invitations to this organization"})]})}),o.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:o.map(Q=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(ys,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:Q.email}),a.jsxs("div",{className:"text-sm text-gray-400",children:["Expires on"," ",new Date(Q.expiresAt).toLocaleDateString("en-US",{month:"short",year:"numeric",day:"numeric"})]})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white capitalize",children:Q.role}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs($t,{variant:"secondary",className:`text-xs font-normal font-mono uppercase rounded-none border-dashed flex items-center gap-1 w-fit ${Q.status==="pending"?"bg-yellow-900/10 border border-yellow-500/30 text-yellow-400/70":Q.status==="accepted"?"bg-green-900/10 border border-green-500/30 text-green-400/70":"bg-red-900/10 border border-red-500/30 text-red-400/70"}`,children:[Q.status==="pending"&&a.jsx(RU,{className:"w-2 h-2"}),Q.status==="accepted"&&a.jsx(Ep,{className:"w-3 h-3"}),Q.status==="expired"&&a.jsx(dt,{className:"w-2 h-2"}),Q.status]})}),a.jsxs("td",{className:"py-4 px-4 text-sm text-gray-400",children:[new Date(Q.expiresAt).toLocaleDateString(),a.jsx("br",{}),a.jsx("span",{className:"text-xs text-gray-400",children:new Date(Q.expiresAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>$e(Q.id,Q.email),children:[a.jsx(_C,{className:"w-4 h-4 mr-1"}),"Resend"]}),a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>_e(Q.id),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Cancel"]})]})})]},Q.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(ys,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Invitations"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Start inviting users to join this organization."}),a.jsxs(z,{onClick:pe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(ys,{className:"w-4 h-4 mr-2"}),"Send First Invitation"]})]})})]})]})]}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Invite User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{g(!1),k(""),$("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"invite-email",className:"text-sm text-gray-400 font-light",children:"Email Address"}),a.jsx(ve,{id:"invite-email",type:"email",value:q,onChange:Q=>k(Q.target.value),placeholder:"user@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"inviter-select",className:"text-sm text-gray-400 font-light",children:"Inviter"}),a.jsxs(pn,{value:M,onValueChange:$,children:[a.jsx(mn,{children:a.jsx(zn,{placeholder:"Select an inviter..."})}),a.jsx(gn,{children:W.map(Q=>a.jsx(Pe,{value:Q.id,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("img",{src:Q.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${Q.id}`,alt:Q.name,className:"w-6 h-6 rounded-none border border-dashed border-white/20"}),a.jsxs("span",{children:[Q.name," (",Q.email,")"]})]})},Q.id))})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),k(""),$("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsxs(z,{onClick:be,disabled:X,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[a.jsx(_C,{className:"w-4 h-4 mr-2"}),X?"Sending...":"Send Invitation"]})]})]})}),R&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{L(!1),ne({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"team-name",value:te.name,onChange:Q=>de(Q.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{L(!1),ne({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Z,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create Team"})]})]})}),P&&A&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{U(!1),ne({name:""})},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsx("div",{children:a.jsxs("div",{className:"text-white font-light",children:[A.name,a.jsx(Jt,{id:A.id,variant:"subscript",nonSliced:!0})]})})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"edit-team-name",value:te.name,onChange:Q=>de(Q.target.value),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{U(!1),ne({name:""})},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:ue,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})}),F&&A&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[A.name,a.jsx(Jt,{id:A.id,variant:"subscript",nonSliced:!0})]}),a.jsx(Jt,{id:A.id,label:"Team ID",variant:"detail"})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this team? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ae,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete Team"})]})]})}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Members"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ot,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Add Members from Existing Users"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"member-count",className:"text-sm text-gray-400 font-light",children:"Number of members to add"}),a.jsx(ve,{id:"member-count",type:"number",min:"1",max:"50",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var oe;const Q=parseInt(((oe=document.getElementById("member-count"))==null?void 0:oe.value)||"5");Ut(Q)},disabled:xe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:xe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ot,{className:"w-3 h-3 mr-2"}),"Seed Members"]})})]})]}),Ee.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Member Seeding Terminal",lines:Ee,isRunning:xe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Teams"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ka,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Create Teams"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"team-count",className:"text-sm text-gray-400 font-light",children:"Number of teams to create"}),a.jsx(ve,{id:"team-count",type:"number",min:"1",max:"20",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var oe;const Q=parseInt(((oe=document.getElementById("team-count"))==null?void 0:oe.value)||"3");Kt(Q)},disabled:Fe,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:Fe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ka,{className:"w-3 h-3 mr-2"}),"Seed Teams"]})})]})]}),ze.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Team Seeding Terminal",lines:ze,isRunning:Fe,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),_&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:Q=>{Q.target===Q.currentTarget&&(I(!1),O({name:"",slug:""}))},children:a.jsxs("div",{className:"bg-black border border-white/15 p-6 w-full max-w-lg rounded-none shadow-2xl",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit Organization"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{I(!1),O({name:"",slug:""})},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center",children:a.jsx(ka,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:n.name}),a.jsx(Jt,{id:n.id,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:n.slug})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",value:T.name,onChange:Q=>Te(Q.target.value),placeholder:"e.g. Acme Corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-slug",className:"text-sm text-gray-400 font-light",children:"Slug"}),a.jsx(ve,{id:"edit-slug",value:T.slug,onChange:Q=>Ze(Q.target.value),placeholder:"e.g. acme-corp",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Auto-generated from name. You can edit it manually."})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{I(!1),O({name:"",slug:""})},disabled:ft,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:K,disabled:ft,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:ft?"Updating...":"Update"})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx(tp,{to:"/organizations",children:a.jsxs(z,{variant:"ghost",className:"text-gray-400 hover:text-white rounded-none",children:[a.jsx(Eae,{className:"w-4 h-4 mr-2"}),"Back to Organizations"]})})}),a.jsx("br",{}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx(ka,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Organization Not Found"}),a.jsx("p",{className:"text-gray-400",children:"The organization you're looking for doesn't exist."})]})]})}function Afe(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),[s,i]=p.useState(""),[o,l]=p.useState("all"),[c,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[y,b]=p.useState(!1),[w,x]=p.useState(!1),[v,g]=p.useState(null),[N,S]=p.useState([]),[E,j]=p.useState(!1),R=p.useCallback(async()=>{try{const O=await(await fetch("/api/sessions")).json();t(O.sessions||[])}catch{}finally{r(!1)}},[]);p.useEffect(()=>{R()},[R]);const L=async T=>{S([]),j(!0),S([{id:"start",type:"info",message:`Starting session seeding process for ${T} sessions...`,timestamp:new Date}]);try{const q=await(await fetch("/api/seed/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:T})})).json();if(q.success){const k=q.results.map(($,W)=>$.success?{id:`session-${W}`,type:"progress",message:`Creating session: ${$.session.id}`,timestamp:new Date,status:"completed"}:{id:`session-${W}`,type:"error",message:`Failed to create session ${W+1}: ${$.error}`,timestamp:new Date});S($=>[...$,...k]);const M=q.results.filter($=>$.success).length;S($=>[...$,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${M}/${T} sessions successfully`,timestamp:new Date}]),await R()}else S(k=>[...k,{id:"error",type:"error",message:`❌ Seeding failed: ${q.error||"Unknown error"}`,timestamp:new Date}])}catch(O){S(q=>[...q,{id:"error",type:"error",message:`❌ Network error: ${O}`,timestamp:new Date}])}finally{j(!1)}},P=async T=>{S([]),j(!0),S([{id:"start",type:"info",message:`Starting account seeding process for ${T} accounts...`,timestamp:new Date}]);try{const q=await(await fetch("/api/seed/accounts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:T})})).json();if(q.success){const k=q.results.map(($,W)=>$.success?{id:`account-${W}`,type:"progress",message:`Creating account: ${$.account.provider}`,timestamp:new Date,status:"completed"}:{id:`account-${W}`,type:"error",message:`Failed to create account ${W+1}: ${$.error}`,timestamp:new Date});S($=>[...$,...k]);const M=q.results.filter($=>$.success).length;S($=>[...$,{id:"complete",type:"success",message:`✅ Seeding completed! Created ${M}/${T} accounts successfully`,timestamp:new Date}]),await R()}else S(k=>[...k,{id:"error",type:"error",message:`❌ Seeding failed: ${q.error||"Unknown error"}`,timestamp:new Date}])}catch(O){S(q=>[...q,{id:"error",type:"error",message:`❌ Network error: ${O}`,timestamp:new Date}])}finally{j(!1)}},U=T=>{g(T),b(!0)},F=T=>{g(T),d(!0)},G=T=>{g(T),m(!0)},_=async T=>{u(!1)},I=async T=>{d(!1)},A=async()=>{m(!1)},C=e.filter(T=>{const O=T.id.toLowerCase().includes(s.toLowerCase())||T.userId.toLowerCase().includes(s.toLowerCase()),q=o==="all"||o==="active"&&new Date(T.expiresAt)>new Date||o==="expired"&&new Date(T.expiresAt)<=new Date;return O&&q});return n?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(er,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading sessions..."})]})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Sessions",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-sm",children:e.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light",children:"Manage user sessions and accounts"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",onClick:()=>x(!0),children:[a.jsx(nn,{className:"w-4 h-4 mr-2"}),"Seed"]}),a.jsxs(z,{className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",onClick:()=>u(!0),children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Add Session"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search sessions...",value:s,onChange:T=>i(T.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jS,{className:"w-4 h-4 text-gray-400"}),a.jsxs(pn,{value:o,onValueChange:l,children:[a.jsx(mn,{children:a.jsx(zn,{})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"all",children:"All"}),a.jsx(Pe,{value:"active",children:"Active"}),a.jsx(Pe,{value:"expired",children:"Expired"})]})]})]})]}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Session"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User ID"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Status"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Expires"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:C.map(T=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",T.id.slice(0,8),"..."]}),a.jsx(Jt,{id:T.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:T.userId}),a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[new Date(T.expiresAt)>new Date?a.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}):a.jsx("div",{className:"w-2 h-2 bg-red-400 rounded-full"}),a.jsx("span",{className:"text-sm text-gray-400",children:new Date(T.expiresAt)>new Date?"Active":"Expired"})]})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(T.expiresAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>U(T),children:a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:()=>F(T),children:a.jsx(zo,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 rounded-none",onClick:()=>G(T),children:a.jsx(Qu,{className:"w-4 h-4"})})]})})]},T.id))})]})})}),w&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Seed Data"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>x(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Seed Sessions"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),a.jsx(ve,{id:"session-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var O;const T=parseInt(((O=document.getElementById("session-count"))==null?void 0:O.value)||"5",10);L(T)},disabled:E,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:E?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(nn,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(pp,{className:"w-5 h-5 text-white"}),a.jsx("h4",{className:"text-white font-light",children:"Seed Accounts"})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),a.jsx(ve,{id:"account-count",type:"number",min:"1",max:"100",defaultValue:"5",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var O;const T=parseInt(((O=document.getElementById("account-count"))==null?void 0:O.value)||"5",10);P(T)},disabled:E,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:E?a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(pp,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]})]}),N.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Session Seeding Terminal",lines:N,isRunning:E,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>x(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),c&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Create Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>u(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),a.jsx(ve,{id:"create-user-id",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"create-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),a.jsx(ve,{id:"create-expires",type:"datetime-local",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>u(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:()=>_(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Create"})]})]})}),h&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>d(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-user-id",className:"text-sm text-gray-400 font-light",children:"User ID"}),a.jsx(ve,{id:"edit-user-id",defaultValue:v.userId,className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-expires",className:"text-sm text-gray-400 font-light",children:"Expires At"}),a.jsx(ve,{id:"edit-expires",type:"datetime-local",defaultValue:new Date(v.expiresAt).toISOString().slice(0,16),className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>d(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:()=>I(),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),f&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete Session"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>m(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this session? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>m(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:A,className:"bg-red-600 hover:bg-red-700 text-white border border-red-600 rounded-none",children:"Delete"})]})]})}),y&&v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Session Details"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>b(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(an,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 rounded-none border border-dashed border-white/20 bg-white/10 flex items-center justify-center",children:a.jsx(nn,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light",children:["Session ",v.id.slice(0,8),"..."]}),a.jsx("div",{className:"text-sm text-gray-400",children:v.userId})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Jt,{id:v.id,variant:"detail"}),a.jsx(Jt,{id:v.userId,label:"User ID",variant:"detail"}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Status:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.expiresAt)>new Date?"Active":"Expired"})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Expires:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.expiresAt).toLocaleString()})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Created:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.createdAt).toLocaleString()})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-gray-400",children:"Updated:"}),a.jsx("span",{className:"text-white text-sm",children:new Date(v.updatedAt).toLocaleString()})]})]})]}),a.jsx("div",{className:"flex justify-end mt-6",children:a.jsx(z,{onClick:()=>b(!1),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Close"})})]})})]})}function _fe(){var v,g,N,S,E,j,R,L,P,U,F,G,_,I,A,C,T,O,q,k,M,$,W,Y,te,ne,X,se,Ee;const[e,t]=p.useState(null),[n,r]=p.useState(null),[s,i]=p.useState(null),[o,l]=p.useState(null),[c,u]=p.useState(!0),[h,d]=p.useState(null);i5(re=>{re.type==="config_changed"?setTimeout(()=>{f(),m(),y(),b()},500):re.type});const f=p.useCallback(async()=>{var re;try{const ye=await(await fetch("/api/config")).json();(re=ye.studio)!=null&&re.version&&d(`v${ye.studio.version}`),t(ye)}catch{}finally{u(!1)}},[]),m=p.useCallback(async()=>{try{const xe=await(await fetch("/api/health")).json();r(xe.system||{studioVersion:h||"v1.0.0",nodeVersion:process.version,platform:navigator.platform})}catch{r({studioVersion:h||"v1.0.0",nodeVersion:"v18.0.0",platform:"macOS"})}},[h]),y=p.useCallback(async()=>{try{const xe=await(await fetch("/api/plugins")).json();i(xe)}catch{i({plugins:[],configPath:null,totalPlugins:0,error:"Failed to fetch plugins"})}},[]),b=p.useCallback(async()=>{try{const xe=await(await fetch("/api/db")).json();l(xe)}catch{l({success:!1,name:"unknown",version:"unknown",dialect:"unknown",adapter:"unknown",displayName:"Unknown",autoDetected:!1,message:"Failed to fetch database info"})}},[]),w=re=>{switch(re==null?void 0:re.toLowerCase()){case"postgresql":case"postgres":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Connected"]});case"mysql":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Connected"]});case"sqlite":return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(zl,{className:"w-3 h-3"}),"Local"]});default:return a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Or,{className:"w-3 h-3"}),"Unknown"]})}};p.useEffect(()=>{f(),m(),y(),b()},[f,b,y,m]);const x=re=>{switch(re.toLowerCase()){case"google":return a.jsx(la,{className:"w-5 h-5 text-white"});case"github":return a.jsx(Ln,{className:"w-5 h-5 text-white"});case"discord":return a.jsx(la,{className:"w-5 h-5 text-white"});case"twitter":return a.jsx(la,{className:"w-5 h-5 text-white"});default:return a.jsx(la,{className:"w-5 h-5 text-white"})}};return c?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(er,{className:"w-6 h-6 text-white animate-spin"})}):a.jsxs("div",{className:"space-y-8",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Settings"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Configure your Better Auth application"})]})}),a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 p-5",children:[a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Do,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Application"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Basic application configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"App Name"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application display name"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.appName)||"Better Auth"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base URL"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Application base URL"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-mono font-light text-white",children:(e==null?void 0:e.baseURL)||"http://localhost:3000"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Base Path"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auth API base path"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-mono font-light text-white",children:(e==null?void 0:e.basePath)||"/api/auth"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secret"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Encryption secret"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(e==null?void 0:e.secret)==="Configured"?"Configured":"Not set"})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(nn,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Database"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Database connection and configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:(o==null?void 0:o.displayName)||((v=e==null?void 0:e.database)==null?void 0:v.type)&&((g=e==null?void 0:e.database)==null?void 0:g.type.charAt(0).toUpperCase())+((N=e==null?void 0:e.database)==null?void 0:N.type.slice(1))||"Unknown"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database Type"})]})]}),((o==null?void 0:o.name)||((S=e==null?void 0:e.database)==null?void 0:S.type))&&w((o==null?void 0:o.name)||((E=e==null?void 0:e.database)==null?void 0:E.type)||"")]}),((o==null?void 0:o.dialect)||((j=e==null?void 0:e.database)==null?void 0:j.dialect))&&(o==null?void 0:o.dialect)!=="unknown"&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Dialect"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database dialect"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:((R=e==null?void 0:e.database)==null?void 0:R.dialect)||(o==null?void 0:o.dialect)})})]}),((L=e==null?void 0:e.database)==null?void 0:L.url)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Connection URL"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database connection string"})]})]}),a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Configured"]})]}),((P=e==null?void 0:e.database)==null?void 0:P.casing)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Do,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Casing"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Table name casing"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white capitalize",children:e.database.casing})})]}),(e==null?void 0:e.database)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RN,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Debug Logs"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Database debug logging"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:e.database.debugLogs?a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Disabled"]})})]}),!(o!=null&&o.success)&&!(e!=null&&e.database)&&a.jsxs("div",{className:"flex items-center justify-between p-3 px-5",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Or,{className:"w-5 h-5 text-yellow-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"No Database Detected"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:(o==null?void 0:o.message)||"No supported database packages found"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"Unknown"})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Providers"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Configured authentication providers"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsx(Sa,{className:"p-0",children:e!=null&&e.socialProviders&&e.socialProviders.length>0?e.socialProviders.map((re,xe)=>a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[x(re.type),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white capitalize",children:re.type}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:re.clientId?"Configured":"Not configured"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:re.clientId?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Active"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Setup Required"]})})]},xe)):a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Ln,{className:"w-8 h-8 text-white mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-400",children:"No providers configured"})]})})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(jc,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Email & Password"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Email authentication settings"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(jc,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Authentication"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow users to sign up with email"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(U=e==null?void 0:e.emailAndPassword)!=null&&U.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]})})]}),((F=e==null?void 0:e.emailAndPassword)==null?void 0:F.enabled)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ho,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Sign Up"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Allow new user registration"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(G=e==null?void 0:e.emailAndPassword)!=null&&G.disableSignUp?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Email Verification"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Require email verification"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(_=e==null?void 0:e.emailAndPassword)!=null&&_.requireEmailVerification?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Required"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Optional"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Password Length"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Min/Max password length"})]})]}),a.jsx("div",{className:"text-right",children:a.jsxs("p",{className:"text-sm font-medium text-white",children:[((I=e==null?void 0:e.emailAndPassword)==null?void 0:I.minPasswordLength)||8," -"," ",((A=e==null?void 0:e.emailAndPassword)==null?void 0:A.maxPasswordLength)||128]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Auto Sign In"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto sign in after registration"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(C=e==null?void 0:e.emailAndPassword)!=null&&C.autoSignIn?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ig,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Session"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Session management settings"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ig,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Duration"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"How long sessions last"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(T=e==null?void 0:e.session)!=null&&T.expiresIn?`${Math.floor(e.session.expiresIn/(60*60*24))} days`:"7 days"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Default"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(RN,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Update Age"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Session refresh interval"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white",children:(O=e==null?void 0:e.session)!=null&&O.updateAge?`${Math.floor(e.session.updateAge/(60*60))} hours`:"24 hours"})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Session Refresh"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Auto refresh sessions"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(q=e==null?void 0:e.session)!=null&&q.disableSessionRefresh?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Store in Database"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Store sessions in database"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(k=e==null?void 0:e.session)!=null&&k.storeSessionInDatabase?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(zl,{className:"w-3 h-3"}),"Secondary Storage"]})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Rate Limiting"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"API rate limiting configuration"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limiting"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Enable rate limiting"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(M=e==null?void 0:e.rateLimit)!=null&&M.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ig,{className:"w-5 h-5 text-red-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Rate Limit Window"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Time window for rate limiting"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:($=e==null?void 0:e.rateLimit)!=null&&$.window?`${e.rateLimit.window} seconds`:"10 seconds"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Window"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Max Requests"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Maximum requests per window"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:((W=e==null?void 0:e.rateLimit)==null?void 0:W.max)||100}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Requests"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nn,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Storage"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Rate limit storage type"})]})]}),a.jsx("div",{className:"text-right",children:a.jsx("p",{className:"text-sm font-medium text-white capitalize",children:((Y=e==null?void 0:e.rateLimit)==null?void 0:Y.storage)||"memory"})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(Do,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Advanced"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Advanced configuration options"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Secure Cookies"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Use secure cookies"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(te=e==null?void 0:e.advanced)!=null&&te.useSecureCookies?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Disabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"CSRF Check"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"CSRF protection"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(ne=e==null?void 0:e.advanced)!=null&&ne.disableCSRFCheck?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ms,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"IP Tracking"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Track IP addresses"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(se=(X=e==null?void 0:e.advanced)==null?void 0:X.ipAddress)!=null&&se.disableIpTracking?a.jsxs(a.Fragment,{children:[a.jsx(Ns,{className:"w-3 h-3"}),"Disabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(FY,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Telemetry"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Usage analytics"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1",children:(Ee=e==null?void 0:e.telemetry)!=null&&Ee.enabled?a.jsxs(a.Fragment,{children:[a.jsx(Or,{className:"w-3 h-3"}),"Enabled"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sn,{className:"w-3 h-3"}),"Disabled"]})})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(zl,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"System Info"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth Studio system information"]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsxs(Sa,{className:"p-0",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Studio Version"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Better Auth Studio"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:h||"v1.0.0"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Latest"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(zl,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Node.js Version"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Runtime environment"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.nodeVersion)||"v18.0.0"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Current"})]})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 px-5 border-b border-white/15",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:"Platform"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Operating system"})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(n==null?void 0:n.platform)||"macOS"}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"System"})]})]})]})]}),a.jsxs(ya,{className:"border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none lg:col-span-2",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs(wa,{className:"space-y-0",children:[a.jsxs(Na,{className:"text-white font-light uppercase text-lg flex items-center space-x-2",children:[a.jsx(OT,{className:"w-4 h-4 text-white"}),a.jsx("span",{children:"Plugins"})]}),a.jsxs(Dr,{className:"uppercase font-mono font-light flex items-center gap-2 text-gray-400 text-xs",children:[a.jsxs("svg",{className:"w-3 h-3 inline-flex text-gray-400",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[" ",a.jsx("path",{d:"M8 5v2h2V5H8zm4 4V7h-2v2h2zm2 2V9h-2v2h2zm0 2h2v-2h-2v2zm-2 2v-2h2v2h-2zm0 0h-2v2h2v-2zm-4 4v-2h2v2H8z",fill:"currentColor"})," "]}),"Better Auth plugins enabled in your configuration"]})]}),a.jsxs("div",{className:"pr-6",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:(s==null?void 0:s.totalPlugins)||0}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:"Active"})]})]}),a.jsx("hr",{className:"w-full border-white/15 h-px -mt-3 mb-1"}),a.jsx(Sa,{className:"space-y-0 px-0 pb-0 border-b-none",children:s!=null&&s.plugins&&s.plugins.length>0?a.jsxs(a.Fragment,{children:[s.plugins.map((re,xe)=>a.jsxs("div",{className:`flex items-center justify-between p-3 px-5 ${xe<s.plugins.length-1?"border-b border-white/15":""}`,children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(OT,{className:"w-5 h-5 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-light uppercase text-white",children:re.name.slice(0,1).toUpperCase()+re.name.slice(1).replace("-"," ")}),a.jsx("p",{className:"text-[10px] font-light uppercase font-mono text-gray-400",children:re.description})]})]}),a.jsx("div",{className:"text-right flex items-center space-x-2",children:a.jsxs($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light text-gray-400 bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400 flex items-center gap-1",children:[a.jsx(Sn,{className:"w-3 h-3"}),"Enabled"]})})]},re.id)),s.configPath&&a.jsx("div",{className:"p-4 px-5 bg-black/30 border-t border-white/10",children:a.jsxs("p",{className:"text-xs text-gray-400",children:["Config file:"," ",a.jsx("span",{className:"text-white font-mono",children:s.configPath})]})})]}):a.jsxs("div",{className:"flex items-center justify-between p-4 px-5",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Or,{className:"w-5 h-5 text-yellow-400"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-white",children:"No Plugins Enabled"}),a.jsx("p",{className:"text-xs text-gray-400",children:(s==null?void 0:s.error)||"No plugins are currently configured in your Better Auth setup"})]})]}),a.jsx($t,{variant:"secondary",className:"text-xs font-mono uppercase font-light bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm",children:"None"})]})})]})]})]})}const d4=e=>{if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":Yn(t,"dd MMM yyyy; HH:mm")};function u4(){var A,C;const{orgId:e,teamId:t}=iS(),n=ha(),[r,s]=p.useState(null),[i,o]=p.useState([]),[l,c]=p.useState(!0),[u,h]=p.useState("details"),[d,f]=p.useState(!1),[m,y]=p.useState(!1),[b,w]=p.useState(""),[x,v]=p.useState([]),[g,N]=p.useState([]),[S,E]=p.useState({name:""}),j=p.useCallback(async()=>{if(t)try{const O=await(await fetch(`/api/teams/${t}`)).json();O.success&&O.team?(s(O.team),E({name:O.team.name})):O.team?(s(O.team),E({name:O.team.name})):V.error("Team not found")}catch{V.error("Failed to load team")}finally{c(!1)}},[t]),R=p.useCallback(async()=>{if(t)try{const O=await(await fetch(`/api/teams/${t}/members`)).json();O.success&&o(O.members||[])}catch{V.error("Failed to load team members")}},[t]),L=async()=>{try{const O=await(await fetch("/api/users?limit=10000")).json(),q=i.map(M=>M.userId),k=(O.users||[]).filter(M=>!q.includes(M.id));v(k)}catch{V.error("Failed to load users")}};p.useEffect(()=>{t&&(j(),R())},[t,j,R]);const P=async()=>{if(!S.name){V.error("Please enter a team name");return}const T=V.loading("Updating team...");try{const q=await(await fetch(`/api/teams/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S.name})})).json();q.success?(await j(),y(!1),V.success("Team updated successfully!",{id:T})):V.error(`Error updating team: ${q.error||"Unknown error"}`,{id:T})}catch{V.error("Error updating team",{id:T})}},U=async()=>{if(g.length===0){V.error("Please select at least one user");return}const T=V.loading(`Adding ${g.length} members...`);try{const q=await(await fetch(`/api/teams/${t}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userIds:g})})).json();q.success?(await R(),f(!1),N([]),w(""),V.success(`Successfully added ${g.length} members!`,{id:T})):V.error(`Error adding members: ${q.error||"Unknown error"}`,{id:T})}catch{V.error("Error adding members",{id:T})}},F=async(T,O)=>{const q=V.loading(`Removing ${O}...`);try{const M=await(await fetch(`/api/team-members/${T}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();M.success?(await R(),V.success(`${O} removed from team!`,{id:q})):V.error(`Error removing member: ${M.error||"Unknown error"}`,{id:q})}catch{V.error("Error removing team member",{id:q})}},G=()=>{L(),f(!0)},_=T=>{N(O=>O.includes(T)?O.filter(q=>q!==T):[...O,T])},I=x.filter(T=>T.name.toLowerCase().includes(b.toLowerCase())||T.email.toLowerCase().includes(b.toLowerCase()));return l?a.jsx("div",{className:"flex items-center justify-center h-32",children:a.jsxs("div",{className:"flex flex-col items-center space-y-3",children:[a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}),a.jsx("div",{className:"text-white text-sm",children:"Loading team details..."})]})}):r?a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>n(`/organizations/${r.organizationId}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(z,{onClick:G,className:"border border-dashed border-white/20 text-white hover:bg-white/10 bg-transparent rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add Members"]}),a.jsxs(z,{onClick:()=>y(!0),className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(zo,{className:"w-4 h-4 mr-2"}),"Edit Team"]})]})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl text-white font-light inline-flex items-center",children:[r.name,a.jsx(Jt,{id:t,variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"flex items-center space-x-2 mt-1",children:r.organization&&a.jsxs(tp,{to:`/organizations/${r.organizationId}`,className:"text-gray-400 hover:text-white text-sm font-sans",children:[a.jsx(ka,{className:"w-4 h-4 inline mr-1"}),r.organization.name]})})]})]}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsxs("nav",{className:"flex space-x-8 px-6",children:[a.jsxs("button",{onClick:()=>h("details"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${u==="details"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsx("span",{className:"font-mono uppercase text-xs font-normal",children:"Details"})]}),a.jsxs("button",{onClick:()=>h("members"),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${u==="members"?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Ot,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start font-mono uppercase text-xs font-normal",children:["Members",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]})]})}),a.jsxs("div",{className:"p-6",children:[u==="details"&&a.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[a.jsxs("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"TEAM INFORMATION"}),a.jsx("hr",{className:"border-white/15 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Name"}),a.jsx("p",{className:"text-white font-sans mt-1",children:r.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"}),a.jsx("p",{className:"text-white font-sans mt-1",children:((A=r.organization)==null?void 0:A.name)||"Unknown"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Created"}),a.jsx("p",{className:"text-white font-sans mt-1",children:d4(r.createdAt)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm text-gray-400 font-mono uppercase",children:"Last Updated"}),a.jsx("p",{className:"text-white font-sans mt-1",children:d4(r.updatedAt)})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Ot,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:i.length,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Members"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(dr,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:Math.ceil((Date.now()-new Date(r.createdAt).getTime())/(1e3*60*60*24)),format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Days Active"})]})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-6",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ka,{className:"w-8 h-8 text-white"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl text-white font-sans font-light",children:a.jsx(_n,{value:1,format:{notation:"standard",maximumFractionDigits:0}})}),a.jsx("p",{className:"text-sm text-gray-400 font-mono uppercase",children:"Organization"})]})]})})]})]}),u==="members"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Team Members",a.jsx(_n,{value:i.length,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage members of this team"})]})}),i.length>0?a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-dashed border-white/10",children:[a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"User"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Email"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Role"}),a.jsx("th",{className:"text-left py-4 px-4 text-white font-light",children:"Joined"}),a.jsx("th",{className:"text-right py-4 px-4 text-white font-light",children:"Actions"})]})}),a.jsx("tbody",{children:i.map(T=>a.jsxs("tr",{className:"border-b border-dashed border-white/5 hover:bg-white/5 group",children:[a.jsx("td",{className:"py-4 px-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("img",{src:T.user.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${T.user.id}`,alt:T.user.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white font-light inline-flex items-center gap-2",children:[a.jsx("span",{children:T.user.name}),a.jsx("button",{onClick:O=>{O.stopPropagation(),n(`/users/${T.user.id}`)},className:"opacity-0 group-hover:opacity-100 text-white/60 hover:text-white transition-all",title:"View user details",children:a.jsx(yu,{className:"w-4 h-4"})})]}),a.jsx(Jt,{id:T.user.id})]})]})}),a.jsx("td",{className:"py-4 px-4 text-white",children:T.user.email}),a.jsx("td",{className:"py-4 px-4",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-blue-900/10 border border-dashed border-blue-500/30 text-blue-400/70 rounded-none capitalize",children:T.role})}),a.jsx("td",{className:"py-4 px-4 text-sm text-gray-400",children:new Date(T.joinedAt).toLocaleDateString()}),a.jsx("td",{className:"py-4 px-4 text-right",children:a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{variant:"outline",size:"sm",className:"border border-dashed border-red-400/50 text-red-400 hover:bg-red-400/10 rounded-none",onClick:()=>F(T.id,T.user.name),children:[a.jsx(yf,{className:"w-4 h-4 mr-1"}),"Remove"]})})})]},T.id))})]})})}):a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-12",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"No Members Yet"}),a.jsx("p",{className:"text-gray-400 mb-6",children:"Add members to this team to get started."}),a.jsxs(z,{onClick:G,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add First Members"]})]})})]})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Add Team Members"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{f(!1),N([]),w("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(_U,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{placeholder:"Search users by name or email...",value:b,onChange:T=>w(T.target.value),className:"pl-10 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),g.length>0&&a.jsx("div",{className:"bg-blue-900/20 border border-blue-500/30 rounded-none p-3",children:a.jsxs("p",{className:"text-blue-400 text-sm",children:[g.length," user",g.length!==1?"s":""," selected"]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none max-h-96 overflow-y-auto",children:I.length>0?a.jsx("div",{className:"divide-y divide-white/5",children:I.map(T=>a.jsxs("div",{className:`flex items-center space-x-3 p-4 cursor-pointer hover:bg-white/5 ${g.includes(T.id)?"bg-blue-900/20":""}`,onClick:()=>_(T.id),children:[a.jsx("input",{type:"checkbox",checked:g.includes(T.id),onChange:()=>_(T.id),className:"rounded border-gray-300"}),a.jsx("img",{src:T.image||`https://api.dicebear.com/7.x/avataaars/svg?seed=${T.id}`,alt:T.name,className:"w-10 h-10 rounded-none border border-dashed border-white/20"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-white font-light",children:T.name}),a.jsx("div",{className:"text-sm text-gray-400",children:T.email})]})]},T.id))}):a.jsx("div",{className:"p-8 text-center",children:a.jsx("p",{className:"text-gray-400",children:"No users found matching your search."})})})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{f(!1),N([]),w("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsxs(z,{onClick:U,disabled:g.length===0,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:[a.jsx(Yd,{className:"w-4 h-4 mr-2"}),"Add ",g.length," Member",g.length!==1?"s":""]})]})]})}),m&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-lg rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Edit Team"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>y(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-white/10 border border-dashed border-white/20 rounded-none flex items-center justify-center",children:a.jsx(Ot,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"text-white inline-flex font-light",children:[r.name,a.jsx(Jt,{id:r.id,variant:"subscript"})]}),a.jsx("div",{className:"text-sm text-gray-400",children:(C=r.organization)==null?void 0:C.name})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-team-name",className:"text-sm text-gray-400 font-light",children:"Team Name"}),a.jsx(ve,{id:"edit-team-name",value:S.name,onChange:T=>E({name:T.target.value}),placeholder:"e.g. Development Team",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>y(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:P,disabled:S.name===r.name,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update Team"})]})]})})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center space-x-4",children:a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>n(`/organizations/${e}`),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["teams /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:t})]})})}),a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ot,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h2",{className:"text-xl text-white font-light mb-2",children:"Team Not Found"}),a.jsx("p",{className:"text-gray-400",children:"The team you're looking for doesn't exist."})]})]})}function Rfe(){const e=ha(),[t,n]=p.useState([]),[r,s]=p.useState(!0),[i,o]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState("all"),[d,f]=p.useState(1),[m]=p.useState(20);p.useEffect(()=>{y();const S=setInterval(()=>{i!=null&&i.enabled||y()},2e3);return()=>clearInterval(S)},[i==null?void 0:i.enabled]);const y=async()=>{try{const E=await(await fetch("/api/plugins")).json(),j=(E==null?void 0:E.plugins).find(R=>R.id==="teams");o({enabled:!!j,availablePlugins:(E==null?void 0:E.plugins).map(R=>R.id),configPath:E.configPath,teamsPlugin:(E==null?void 0:E.plugins).find(R=>R.id==="teams")}),j?await b():s(!1)}catch(S){console.error("Failed to check teams plugin status:",S),o({enabled:!1,error:"Failed to check plugin status"}),s(!1)}},b=async()=>{try{const E=await(await fetch("/api/teams")).json();E.success&&n(E.teams||[])}catch(S){console.error("Failed to fetch teams:",S),V.error("Failed to load teams")}finally{s(!1)}},w=t.filter(S=>{var j;const E=S.name.toLowerCase().includes(l.toLowerCase())||((j=S.organization)==null?void 0:j.name.toLowerCase().includes(l.toLowerCase()));if(u==="all")return E;if(u==="recent"){const R=new Date;return R.setDate(R.getDate()-7),E&&new Date(S.createdAt)>R}return E}),x=d*m,v=x-m,g=w.slice(v,x),N=Math.ceil(w.length/m);return r?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(er,{className:"w-8 h-8 animate-spin text-white"})}):i!=null&&i.enabled?a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl relative text-white font-light inline-flex items-start",children:["Teams",a.jsx("sup",{className:"text-xs text-gray-500 ml-1 mt-0 inline-flex items-baseline",children:a.jsx(_n,{value:w.length,className:"text-white font-mono text-sm",prefix:a.jsx("span",{className:"mr-1 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-1 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]}),a.jsxs("p",{className:"text-gray-400 mt-1 uppercase font-mono text-sm font-light flex items-baseline gap-1",children:[a.jsx(_n,{value:w.length,className:"text-white font-mono text-sm",format:{notation:"standard",maximumFractionDigits:0}}),a.jsxs("span",{children:["team",w.length!==1?"s":""," found"]})]})]}),a.jsx("div",{className:"flex items-center space-x-3",children:a.jsxs(z,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Team"]})})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("div",{className:"relative flex-1 max-w-md",children:[a.jsx($o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(ve,{type:"text",placeholder:"Search teams...",value:l,onChange:S=>c(S.target.value),className:"pl-10 bg-black border-dashed border-white/20 text-white placeholder-gray-400 focus:ring-2 focus:ring-white focus:border-transparent"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(z,{variant:u==="all"?"default":"outline",size:"sm",onClick:()=>h("all"),className:u==="all"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"All"}),a.jsx(z,{variant:u==="recent"?"default":"outline",size:"sm",onClick:()=>h("recent"),className:u==="recent"?"bg-white text-black":"border-dashed border-white/20 text-white hover:bg-white/10",children:"Recent"})]})]}),g.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ho,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-light text-white mb-2",children:"No teams found"}),a.jsx("p",{className:"text-gray-400 mb-6",children:l?"Try adjusting your search terms":"Get started by creating your first team"}),!l&&a.jsxs(z,{onClick:()=>e("/teams/new"),className:"bg-white text-black hover:bg-gray-200 border-dashed",children:[a.jsx(Fi,{className:"w-4 h-4 mr-2"}),"Create Team"]})]}):a.jsx("div",{className:"grid gap-4",children:g.map(S=>{var E;return a.jsx("div",{className:"bg-black/30 border border-white/15 rounded-none p-4 hover:bg-black/40 transition-colors cursor-pointer",onClick:()=>e(`/teams/${S.id}`),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"w-10 h-10 bg-white/10 rounded-none flex items-center justify-center",children:a.jsx(Ho,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium",children:S.name}),a.jsxs("p",{className:"text-gray-400 text-sm",children:[(E=S.organization)==null?void 0:E.name," • ",S.memberCount||0," members"]})]})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx($t,{variant:"secondary",className:"text-xs bg-green-900/50 border border-dashed rounded-none border-green-500/30 text-green-400",children:"Active"})})]})},S.id)})}),N>1&&a.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[a.jsx(z,{variant:"outline",size:"sm",onClick:()=>f(Math.max(1,d-1)),disabled:d===1,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Previous"}),a.jsxs("span",{className:"text-gray-400 text-sm",children:["Page ",d," of ",N]}),a.jsx(z,{variant:"outline",size:"sm",onClick:()=>f(Math.min(N,d+1)),disabled:d===N,className:"border-dashed border-white/20 text-white hover:bg-white/10 disabled:opacity-50",children:"Next"})]})]}):a.jsxs("div",{className:"space-y-6 p-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl text-white font-light",children:"Teams"}),a.jsx("p",{className:"text-gray-400 mt-1",children:"Manage your application organizations"})]})}),a.jsx("div",{className:"bg-black/30 border border-dashed border-white/20 rounded-none p-8",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(Mr,{className:"w-12 h-12 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-xl text-white font-light mb-2",children:"Organization Plugin Required"}),a.jsx("p",{className:"text-gray-300 mb-6",children:"To use Organizations in Better Auth Studio, you need to enable the organization plugin in your Better Auth configuration."}),a.jsxs("div",{className:"bg-black/50 border border-dashed border-white/20 rounded-none p-4 mb-6",children:[a.jsx("h4",{className:"text-white font-light mb-3",children:"Follow these steps:"}),a.jsx("ol",{className:"text-gray-300 space-y-2 text-sm list-decimal list-inside",children:a.jsxs("li",{children:["Import the plugin in your auth configuration file",(i==null?void 0:i.configPath)&&a.jsxs("span",{className:"text-gray-400",children:[" (",i.configPath,")"]}),":"]})}),a.jsx("div",{className:"mt-4 bg-black/70 border border-dashed border-white/10 rounded-none p-3 overflow-x-auto",children:a.jsxs("pre",{className:"text-sm text-gray-300",children:[a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ betterAuth }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"import"})," ","{ organization }"," ",a.jsx("span",{className:"text-blue-400",children:"from"})," ",a.jsx("span",{className:"text-green-400",children:'"better-auth/plugins"'})," ",a.jsx("br",{}),a.jsx("span",{className:"text-blue-400",children:"export const"})," ",a.jsx("span",{className:"text-yellow-300",children:"auth"})," ="," ",a.jsx("span",{className:"text-yellow-300",children:"betterAuth"}),"(","{"," ",a.jsx("br",{}),a.jsx("span",{className:"text-gray-500 pl-10",children:"// ... your existing configuration"})," ",a.jsx("br",{}),a.jsx("span",{className:"text-red-300 pl-10",children:"plugins"}),": [ ",a.jsx("br",{}),a.jsxs("span",{className:"text-yellow-300 pl-12",children:["organization(",")"]}),a.jsx("br",{}),a.jsx("span",{className:"pl-10",children:"]"})," ",a.jsx("br",{}),"}",") ",a.jsx("br",{})]})}),a.jsx("div",{className:"mt-4",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"2. Do migrations to create the organizations table"})}),a.jsx("div",{className:"mt-2",children:a.jsx("p",{className:"text-gray-400 text-sm",children:"3. Restart your application to apply the changes"})})]}),(i==null?void 0:i.availablePlugins)&&i.availablePlugins.length>0&&a.jsx("div",{className:"mb-4",children:a.jsxs("p",{className:"text-gray-400 text-sm",children:["Currently enabled plugins: ",i.availablePlugins.join(", ")]})}),a.jsx(z,{onClick:y,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Check Again"}),a.jsxs("div",{className:"mt-4 text-xs text-gray-500",children:["Need help? Check the"," ",a.jsx("a",{href:"https://better-auth.com/docs/plugins/organization",target:"_blank",rel:"noopener noreferrer",className:"text-white hover:underline",children:"Better Auth Organization Plugin Documentation"})]})]})]})})]})}function Cp(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}function N6(e,t,n){let r="",s=0,i=0;for(const o of e)for(s=s<<8|o,i+=8;i>=6;)i-=6,r+=t[s>>i&63];if(i>0&&(r+=t[s<<6-i&63]),n){const o=(4-r.length%4)%4;r+="=".repeat(o)}return r}function S6(e,t){const n=new Map;for(let o=0;o<t.length;o++)n.set(t[o],o);const r=[];let s=0,i=0;for(const o of e){if(o==="=")break;const l=n.get(o);if(l===void 0)throw new Error(`Invalid Base64 character: ${o}`);s=s<<6|l,i+=6,i>=8&&(i-=8,r.push(s>>i&255))}return Uint8Array.from(r)}const Ofe={encode(e,t={}){const n=Cp(!1),r=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return N6(r,n,t.padding??!0)},decode(e){typeof e!="string"&&(e=new TextDecoder().decode(e));const t=e.includes("-")||e.includes("_"),n=Cp(t);return S6(e,n)}},Dfe={encode(e,t={}){const n=Cp(!0),r=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return N6(r,n,t.padding??!0)},decode(e){const t=e.includes("-")||e.includes("_"),n=Cp(t);return S6(e,n)}};function Ife(){const e=typeof globalThis<"u"&&globalThis.crypto;if(e&&typeof e.subtle=="object"&&e.subtle!=null)return e.subtle;throw new Error("crypto.subtle must be defined")}function Mfe(e,t){return{digest:async n=>{const r=new TextEncoder,s=typeof n=="string"?r.encode(n):n,i=await Ife().digest(e,s);return t==="hex"?Array.from(new Uint8Array(i)).map(c=>c.toString(16).padStart(2,"0")).join(""):t==="base64"||t==="base64url"||t==="base64urlnopad"?t.includes("url")?Dfe.encode(i,{padding:t!=="base64urlnopad"}):Ofe.encode(i):i}}}function hw({value:e,onChange:t,language:n="typescript",placeholder:r="",className:s=""}){const i=p.useRef(null),o=p.useRef(null),[l,c]=p.useState(e||r);p.useEffect(()=>{c(e||r)},[e,r]),p.useEffect(()=>{const b=i.current,w=o.current;if(b&&w){const x=()=>{w&&(w.scrollTop=b.scrollTop,w.scrollLeft=b.scrollLeft)};return b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[]);const u="12px",h="1.5",d="0.75rem",f='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',m={...rc,'pre[class*="language-"]':{...rc['pre[class*="language-"]'],background:"transparent",padding:0,margin:0,borderRadius:0,overflow:"visible"},'code[class*="language-"]':{...rc['code[class*="language-"]'],background:"transparent",fontSize:u,lineHeight:h,fontFamily:f}},y={fontFamily:f,fontSize:u,lineHeight:h,padding:d,margin:0,border:"none",outline:"none",resize:"none",color:"transparent",caretColor:"#fff",background:"transparent",width:"100%",minHeight:"200px",overflow:"auto",tabSize:2};return a.jsxs("div",{className:`relative border border-dashed border-white/20 rounded-none focus-within:border-white/40 ${s}`,children:[a.jsx("div",{ref:o,className:"absolute inset-0 pointer-events-none overflow-auto",style:{padding:d,boxSizing:"border-box"},children:a.jsx(NE,{language:n,style:m,customStyle:{margin:0,padding:0,background:"transparent",minHeight:"200px"},codeTagProps:{style:{fontFamily:f,fontSize:u,lineHeight:h,display:"block"}},PreTag:({children:b,...w})=>a.jsx("pre",{...w,style:{margin:0,padding:0,background:"transparent",fontSize:u,lineHeight:h,fontFamily:f},children:b}),children:l})}),a.jsx("textarea",{ref:i,value:e,onChange:b=>t(b.target.value),placeholder:r,className:"relative w-full min-h-[200px] bg-transparent text-white font-mono text-xs rounded-none focus:outline-none resize-none",style:{...y,boxSizing:"border-box",position:"relative",zIndex:1},spellCheck:!1})]})}function E6(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _m="Checkbox",[Lfe]=Vs(_m),[Ufe,SE]=Lfe(_m);function Pfe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:h="on",internal_do_not_use_render:d}=e,[f,m]=$c({prop:n,defaultProp:s??!1,onChange:c,caller:_m}),[y,b]=p.useState(null),[w,x]=p.useState(null),v=p.useRef(!1),g=y?!!o||!!y.closest("form"):!0,N={checked:f,disabled:i,setChecked:m,control:y,setControl:b,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:zi(s)?!1:s,isFormControl:g,bubbleInput:w,setBubbleInput:x};return a.jsx(Ufe,{scope:t,...N,children:Ffe(d)?d(N):r})}var j6="CheckboxTrigger",T6=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:h,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:y}=SE(j6,e),b=dn(s,h),w=p.useRef(c);return p.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const v=()=>d(w.current);return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[i,d]),a.jsx(qt.button,{type:"button",role:"checkbox","aria-checked":zi(c)?"mixed":c,"aria-required":u,"data-state":R6(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:b,onKeyDown:Nt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Nt(n,x=>{d(v=>zi(v)?!0:!v),y&&m&&(f.current=x.isPropagationStopped(),f.current||x.stopPropagation())})})});T6.displayName=j6;var EE=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:h,...d}=e;return a.jsx(Pfe,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:r,form:h,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(T6,{...d,ref:t,__scopeCheckbox:n}),f&&a.jsx(_6,{__scopeCheckbox:n})]})})});EE.displayName=_m;var C6="CheckboxIndicator",k6=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=SE(C6,n);return a.jsx(Ys,{present:r||zi(i.checked)||i.checked===!0,children:a.jsx(qt.span,{"data-state":R6(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});k6.displayName=C6;var A6="CheckboxBubbleInput",_6=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:h,form:d,bubbleInput:f,setBubbleInput:m}=SE(A6,e),y=dn(n,m),b=E6(i),w=DS(r);p.useEffect(()=>{const v=f;if(!v)return;const g=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(g,"checked").set,E=!s.current;if(b!==i&&S){const j=new Event("click",{bubbles:E});v.indeterminate=zi(i),S.call(v,zi(i)?!1:i),v.dispatchEvent(j)}},[f,b,i,s]);const x=p.useRef(zi(i)?!1:i);return a.jsx(qt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:u,value:h,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_6.displayName=A6;function Ffe(e){return typeof e=="function"}function zi(e){return e==="indeterminate"}function R6(e){return zi(e)?"indeterminate":e?"checked":"unchecked"}const Nf=p.forwardRef(({className:e,...t},n)=>a.jsx(EE,{ref:n,className:Ve("peer h-4 w-4 shrink-0 rounded-none border border-white/20 bg-black ring-offset-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-white data-[state=checked]:text-black data-[state=checked]:border-white",e),...t,children:a.jsx(k6,{className:Ve("flex items-center justify-center text-current"),children:a.jsx(wu,{className:"h-4 w-4"})})}));Nf.displayName=EE.displayName;function Bfe(e){const t=e+"CollectionProvider",[n,r]=Vs(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:w,children:x}=b,v=ee.useRef(null),g=ee.useRef(new Map).current;return a.jsx(s,{scope:w,itemMap:g,collectionRef:v,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=Nu(l),u=ee.forwardRef((b,w)=>{const{scope:x,children:v}=b,g=i(l,x),N=dn(w,g.collectionRef);return a.jsx(c,{ref:N,children:v})});u.displayName=l;const h=e+"CollectionItemSlot",d="data-radix-collection-item",f=Nu(h),m=ee.forwardRef((b,w)=>{const{scope:x,children:v,...g}=b,N=ee.useRef(null),S=dn(w,N),E=i(h,x);return ee.useEffect(()=>(E.itemMap.set(N,{ref:N,...g}),()=>void E.itemMap.delete(N))),a.jsx(f,{[d]:"",ref:S,children:v})});m.displayName=h;function y(b){const w=i(e+"CollectionConsumer",b);return ee.useCallback(()=>{const v=w.collectionRef.current;if(!v)return[];const g=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((E,j)=>g.indexOf(E.ref.current)-g.indexOf(j.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},y,r]}var zfe=p.createContext(void 0);function O6(e){const t=p.useContext(zfe);return e||t||"ltr"}var fw="rovingFocusGroup.onEntryFocus",$fe={bubbles:!1,cancelable:!0},lh="RovingFocusGroup",[e1,D6,Hfe]=Bfe(lh),[qfe,I6]=Vs(lh,[Hfe]),[Gfe,Vfe]=qfe(lh),M6=p.forwardRef((e,t)=>a.jsx(e1.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(e1.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Yfe,{...e,ref:t})})}));M6.displayName=lh;var Yfe=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:h=!1,...d}=e,f=p.useRef(null),m=dn(t,f),y=O6(i),[b,w]=$c({prop:o,defaultProp:l??null,onChange:c,caller:lh}),[x,v]=p.useState(!1),g=qo(u),N=D6(n),S=p.useRef(!1),[E,j]=p.useState(0);return p.useEffect(()=>{const R=f.current;if(R)return R.addEventListener(fw,g),()=>R.removeEventListener(fw,g)},[g]),a.jsx(Gfe,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:b,onItemFocus:p.useCallback(R=>w(R),[w]),onItemShiftTab:p.useCallback(()=>v(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:p.useCallback(()=>j(R=>R-1),[]),children:a.jsx(qt.div,{tabIndex:x||E===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Nt(e.onMouseDown,()=>{S.current=!0}),onFocus:Nt(e.onFocus,R=>{const L=!S.current;if(R.target===R.currentTarget&&L&&!x){const P=new CustomEvent(fw,$fe);if(R.currentTarget.dispatchEvent(P),!P.defaultPrevented){const U=N().filter(A=>A.focusable),F=U.find(A=>A.active),G=U.find(A=>A.id===b),I=[F,G,...U].filter(Boolean).map(A=>A.ref.current);P6(I,h)}}S.current=!1}),onBlur:Nt(e.onBlur,()=>v(!1))})})}),L6="RovingFocusGroupItem",U6=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=e,c=tr(),u=i||c,h=Vfe(L6,n),d=h.currentTabStopId===u,f=D6(n),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:b}=h;return p.useEffect(()=>{if(r)return m(),()=>y()},[r,m,y]),a.jsx(e1.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:a.jsx(qt.span,{tabIndex:d?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:Nt(e.onMouseDown,w=>{r?h.onItemFocus(u):w.preventDefault()}),onFocus:Nt(e.onFocus,()=>h.onItemFocus(u)),onKeyDown:Nt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=Kfe(w,h.orientation,h.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let g=f().filter(N=>N.focusable).map(N=>N.ref.current);if(x==="last")g.reverse();else if(x==="prev"||x==="next"){x==="prev"&&g.reverse();const N=g.indexOf(w.currentTarget);g=h.loop?Zfe(g,N+1):g.slice(N+1)}setTimeout(()=>P6(g))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:b!=null}):o})})});U6.displayName=L6;var Wfe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xfe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Kfe(e,t,n){const r=Xfe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wfe[r]}function P6(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Zfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Qfe=M6,Jfe=U6,jE="Radio",[epe,F6]=Vs(jE),[tpe,npe]=epe(jE),B6=p.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:i,disabled:o,value:l="on",onCheck:c,form:u,...h}=e,[d,f]=p.useState(null),m=dn(t,w=>f(w)),y=p.useRef(!1),b=d?u||!!d.closest("form"):!0;return a.jsxs(tpe,{scope:n,checked:s,disabled:o,children:[a.jsx(qt.button,{type:"button",role:"radio","aria-checked":s,"data-state":q6(s),"data-disabled":o?"":void 0,disabled:o,value:l,...h,ref:m,onClick:Nt(e.onClick,w=>{s||c==null||c(),b&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})}),b&&a.jsx(H6,{control:d,bubbles:!y.current,name:r,value:l,checked:s,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});B6.displayName=jE;var z6="RadioIndicator",$6=p.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=npe(z6,n);return a.jsx(Ys,{present:r||i.checked,children:a.jsx(qt.span,{"data-state":q6(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});$6.displayName=z6;var ape="RadioBubbleInput",H6=p.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...s},i)=>{const o=p.useRef(null),l=dn(o,i),c=E6(n),u=DS(t);return p.useEffect(()=>{const h=o.current;if(!h)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==n&&m){const y=new Event("click",{bubbles:r});m.call(h,n),h.dispatchEvent(y)}},[c,n,r]),a.jsx(qt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H6.displayName=ape;function q6(e){return e?"checked":"unchecked"}var rpe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rm="RadioGroup",[spe]=Vs(Rm,[I6,F6]),G6=I6(),V6=F6(),[ipe,ope]=spe(Rm),Y6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:h=!0,onValueChange:d,...f}=e,m=G6(n),y=O6(u),[b,w]=$c({prop:i,defaultProp:s??null,onChange:d,caller:Rm});return a.jsx(ipe,{scope:n,name:r,required:o,disabled:l,value:b,onValueChange:w,children:a.jsx(Qfe,{asChild:!0,...m,orientation:c,dir:y,loop:h,children:a.jsx(qt.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:y,...f,ref:t})})})});Y6.displayName=Rm;var W6="RadioGroupItem",X6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,i=ope(W6,n),o=i.disabled||r,l=G6(n),c=V6(n),u=p.useRef(null),h=dn(t,u),d=i.value===s.value,f=p.useRef(!1);return p.useEffect(()=>{const m=b=>{rpe.includes(b.key)&&(f.current=!0)},y=()=>f.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",y)}},[]),a.jsx(Jfe,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(B6,{disabled:o,required:i.required,checked:d,...c,...s,name:i.name,ref:h,onCheck:()=>i.onValueChange(s.value),onKeyDown:Nt(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:Nt(s.onFocus,()=>{var m;f.current&&((m=u.current)==null||m.click())})})})});X6.displayName=W6;var lpe="RadioGroupIndicator",K6=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=V6(n);return a.jsx($6,{...s,...r,ref:t})});K6.displayName=lpe;var Z6=Y6,Q6=X6,cpe=K6;const t1=p.forwardRef(({className:e,...t},n)=>a.jsx(Z6,{className:Ve("grid gap-2",e),...t,ref:n}));t1.displayName=Z6.displayName;const jl=p.forwardRef(({className:e,...t},n)=>a.jsx(Q6,{ref:n,className:Ve("aspect-square h-4 w-4 rounded-none border border-white/20 bg-black text-white ring-offset-black focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-white data-[state=checked]:border-white",e),...t,children:a.jsx(cpe,{className:"flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-none bg-black"})})}));jl.displayName=Q6.displayName;const J6=e=>{if(!e)return a.jsx(la,{className:"w-6 h-6 text-white"});const t=e.toLowerCase(),n="w-6 h-6 text-white";switch(t){case"github":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 15 15",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M7.5.25a7.25 7.25 0 0 0-2.292 14.13c.363.066.495-.158.495-.35c0-.172-.006-.628-.01-1.233c-2.016.438-2.442-.972-2.442-.972c-.33-.838-.805-1.06-.805-1.06c-.658-.45.05-.441.05-.441c.728.051 1.11.747 1.11.747c.647 1.108 1.697.788 2.11.602c.066-.468.254-.788.46-.969c-1.61-.183-3.302-.805-3.302-3.583a2.8 2.8 0 0 1 .747-1.945c-.075-.184-.324-.92.07-1.92c0 0 .61-.194 1.994.744A6.963 6.963 0 0 1 7.5 3.756A6.97 6.97 0 0 1 9.315 4c1.384-.938 1.992-.743 1.992-.743c.396.998.147 1.735.072 1.919c.465.507.745 1.153.745 1.945c0 2.785-1.695 3.398-3.31 3.577c.26.224.492.667.492 1.343c0 .97-.009 1.751-.009 1.989c0 .194.131.42.499.349A7.25 7.25 0 0 0 7.499.25",clipRule:"evenodd"})});case"google":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 56 56",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M28.458 5c6.167 0 11.346 2.2 15.368 5.804l.323.295l-6.62 6.464c-1.695-1.59-4.666-3.493-9.07-3.493c-6.204 0-11.47 4.093-13.372 9.749c-.47 1.46-.756 3.023-.756 4.64c0 1.615.287 3.18.782 4.639c1.877 5.656 7.142 9.748 13.345 9.748c3.347 0 5.928-.886 7.881-2.176l.251-.17l.307-.222c2.813-2.108 4.144-5.084 4.46-7.169l.03-.22h-12.93v-8.705h22.025c.339 1.46.495 2.867.495 4.795c0 7.142-2.554 13.163-6.985 17.255c-3.884 3.597-9.201 5.682-15.535 5.682c-9.031 0-16.85-5.102-20.772-12.57l-.184-.358l-.222-.457A23.45 23.45 0 0 1 5 28.458c0-3.6.827-7.01 2.28-10.073l.222-.457l.184-.357C11.608 10.1 19.426 5 28.458 5"})});case"apple":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M14.122 4.682c1.35 0 2.781.743 3.8 2.028c-3.34 1.851-2.797 6.674.578 7.963c-.465 1.04-.687 1.505-1.285 2.426c-.835 1.284-2.01 2.884-3.469 2.898c-1.295.012-1.628-.853-3.386-.843c-1.758.01-2.125.858-3.42.846c-1.458-.014-2.573-1.458-3.408-2.743C1.198 13.665.954 9.45 2.394 7.21C3.417 5.616 5.03 4.683 6.548 4.683c1.545 0 2.516.857 3.794.857c1.24 0 1.994-.858 3.78-.858M13.73 0c.18 1.215-.314 2.405-.963 3.247c-.695.902-1.892 1.601-3.05 1.565c-.21-1.163.332-2.36.99-3.167C11.43.755 12.67.074 13.73 0"})});case"discord":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M18.59 5.89c-1.23-.57-2.54-.99-3.92-1.23c-.17.3-.37.71-.5 1.04c-1.46-.22-2.91-.22-4.34 0c-.14-.33-.34-.74-.51-1.04c-1.38.24-2.69.66-3.92 1.23c-2.48 3.74-3.15 7.39-2.82 10.98c1.65 1.23 3.24 1.97 4.81 2.46c.39-.53.73-1.1 1.03-1.69c-.57-.21-1.11-.48-1.62-.79c.14-.1.27-.21.4-.31c3.13 1.46 6.52 1.46 9.61 0c.13.11.26.21.4.31c-.51.31-1.06.57-1.62.79c.3.59.64 1.16 1.03 1.69c1.57-.49 3.17-1.23 4.81-2.46c.39-4.17-.67-7.78-2.82-10.98Zm-9.75 8.78c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94s1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94m6.31 0c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94s1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94"})});case"facebook":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 64 64",fill:"#888888",children:a.jsx("path",{d:"M59.5 1h-55C2.5 1 1 2.6 1 4.5v55c0 2 1.6 3.5 3.5 3.5h29.6V38.9h-8v-9.3h8v-6.9c0-8 4.8-12.4 12-12.4c2.4 0 4.8.1 7.2.4V19h-4.8c-3.8 0-4.6 1.8-4.6 4.5v5.9H53l-1.3 9.4h-8v23.8h15.8c2 0 3.5-1.5 3.5-3.5V4.5c-.1-2-1.7-3.5-3.5-3.5"})});case"microsoft":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M2 3h9v9H2zm9 19H2v-9h9zM21 3v9h-9V3zm0 19h-9v-9h9z"})});case"twitter":case"x":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 448 512",fill:"currentColor",children:a.jsx("path",{d:"M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64zm297.1 84L257.3 234.6L379.4 396h-95.6L209 298.1L123.3 396H75.8l111-126.9L69.7 116h98l67.7 89.5l78.2-89.5zm-37.8 251.6L153.4 142.9h-28.3l171.8 224.7h26.3z"})});case"linkedin":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 448 512",fill:"currentColor",children:a.jsx("path",{d:"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"})});case"gitlab":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 32 32",fill:"currentColor",children:a.jsx("path",{d:"M28.568 12.893l-.037-.094l-3.539-9.235a.92.92 0 0 0-.364-.439a.95.95 0 0 0-1.083.058a.95.95 0 0 0-.314.477l-2.39 7.31h-9.675l-2.39-7.31a.93.93 0 0 0-.313-.478a.95.95 0 0 0-1.083-.058a.93.93 0 0 0-.365.438L3.47 12.794l-.035.093a6.57 6.57 0 0 0 2.18 7.595l.011.01l.033.022l5.39 4.037l2.668 2.019l1.624 1.226c.39.297.931.297 1.322 0l1.624-1.226l2.667-2.019l5.424-4.061l.013-.01a6.574 6.574 0 0 0 2.177-7.588Z"})});case"reddit":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 32 32",fill:"currentColor",children:a.jsx("path",{d:"M16 0C7.164 0 0 7.164 0 16s7.164 16 16 16s16-7.164 16-16S24.836 0 16 0m8.5 10.5a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m-17 0a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m1.5 6.5c0 1.5 1.5 2.5 3 2.5c.5 0 1-.1 1.5-.3c.5.6 1.2 1 2 1c.8 0 1.5-.4 2-1c.5.2 1 .3 1.5.3c1.5 0 3-1 3-2.5c0-1.5-1.5-2.5-3-2.5c-.5 0-1 .1-1.5.3c-.5-.6-1.2-1-2-1c-.8 0-1.5.4-2 1c-.5-.2-1-.3-1.5-.3c-1.5 0-3 1-3 2.5"})});case"spotify":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:n,viewBox:"0 0 256 256",fill:"currentColor",children:a.jsx("path",{d:"M128 0C57.308 0 0 57.309 0 128c0 70.696 57.309 128 128 128 70.697 0 128-57.304 128-32.3C256 57.314 198.697.007 127.998.007l.001-.006Zm58.699 184.614c-2.293 3.76-7.215 4.952-10.975 2.644c-30.053-18.357-67.885-22.515-112.44-12.335a7.981 7.981 0 0 1-9.552-6.007 7.968 7.968 0 0 1 6-9.553c48.76-11.14 90.583-6.344 124.323 14.276 3.76 2.308 4.952 7.215 2.644 10.975Zm15.667-34.853c-2.89 4.695-9.034 6.178-13.726 3.289c-34.406-21.148-86.853-27.273-127.548-14.92c-5.278 1.594-10.852-1.38-12.454-6.649c-1.59-5.278 1.386-10.842 6.655-12.446c46.485-14.106 104.275-7.273 143.787 17.007c4.692 2.89 6.175 9.034 3.286 13.72v-.001Zm1.345-36.293C162.457 88.964 94.394 86.71 55.007 98.666c-6.325 1.918-13.014-1.653-14.93-7.978c-1.917-6.328 1.65-13.012 7.98-14.935C93.27 62.027 168.434 64.68 215.929 92.876c5.702 3.376 7.566 10.724 4.188 16.405c-3.362 5.69-10.73 7.565-16.4 4.187h-.006Z"})});case"slack":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2447.6 2452.5",className:n,fill:"currentColor",children:a.jsxs("g",{fill:"currentColor",children:[a.jsx("path",{d:"m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z"}),a.jsx("path",{d:"m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2c-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2c-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z"}),a.jsx("path",{d:"m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z"}),a.jsx("path",{d:"M0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3c-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0"})]})});case"notion":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.28c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514c-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933z"})});case"tiktok":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M19.589 6.686a4.793 4.793 0 0 1-3.77-4.245V2h-3.445v13.672a2.896 2.896 0 0 1-5.201 1.743l-.002-.001.002.001a2.895 2.895 0 0 1 3.183-4.51v-3.5a6.329 6.329 0 0 0-5.394 10.692 6.33 6.33 0 0 0 10.857-4.424V8.687a8.182 8.182 0 0 0 4.773 1.526V6.79a4.831 4.831 0 0 1-1.003-.104z"})});case"twitch":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M3.9 2.5a.9.9 0 0 0-.9.9v14.194a.9.9 0 0 0 .9.9h4.116v3.03a.7.7 0 0 0 1.194.494l3.525-3.524h4.643a.9.9 0 0 0 .636-.264l2.722-2.722a.9.9 0 0 0 .264-.636V3.4a.9.9 0 0 0-.9-.9zm7.319 5.2a.75.75 0 0 0-1.5 0v4.272a.75.75 0 1 0 1.5 0zm5.016 0a.75.75 0 0 0-1.5 0v4.272a.75.75 0 1 0 1.5 0z",clipRule:"evenodd"})});case"dropbox":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 528 512",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z"})});case"linear":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"1.2em",height:"1.2em",viewBox:"0 0 100 100",children:a.jsx("path",{fill:"currentColor",d:"M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259c.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684c.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3542-.0443L12.6587 18.074Z"})});case"huggingface":case"hugging face":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12.025 1.13c-5.77 0-10.449 4.647-10.449 10.378c0 1.112.178 2.181.503 3.185c.064-.222.203-.444.416-.577a.96.96 0 0 1 .524-.15c.293 0 .584.124.84.284c.278.173.48.408.71.694c.226.282.458.611.684.951v-.014c.017-.324.106-.622.264-.874s.403-.487.762-.543c.3-.047.596.06.787.203s.31.313.4.467c.15.257.212.468.233.542c.01.026.653 1.552 1.657 2.54c.616.605 1.01 1.223 1.082 1.912c.055.537-.096 1.059-.38 1.572c.637.121 1.294.187 1.967.187c.657 0 1.298-.063 1.921-.178c-.287-.517-.44-1.041-.384-1.581c.07-.69.465-1.307 1.081-1.913c1.004-.987 1.647-2.513 1.657-2.539c.021-.074.083-.285.233-.542c.09-.154.208-.323.4-.467a1.08 1.08 0 0 1 .787-.203c.359.056.604.29.762.543s.247.55.265.874v.015c.225-.34.457-.67.683-.952c.23-.286.432-.52.71-.694c.257-.16.547-.284.84-.285a.97.97 0 0 1 .524.151c.228.143.373.388.43.625l.006.04a10.3 10.3 0 0 0 .534-3.273c0-5.731-4.678-10.378-10.449-10.378M8.327 6.583a1.5 1.5 0 0 1 .713.174a1.487 1.487 0 0 1 .617 2.013c-.183.343-.762-.214-1.102-.094c-.38.134-.532.914-.917.71a1.487 1.487 0 0 1 .69-2.803m7.486 0a1.487 1.487 0 0 1 .689 2.803c-.385.204-.536-.576-.916-.71c-.34-.12-.92.437-1.103.094a1.487 1.487 0 0 1 .617-2.013a1.5 1.5 0 0 1 .713-.174m-10.68 1.55a.96.96 0 1 1 0 1.921a.96.96 0 0 1 0-1.92m13.838 0a.96.96 0 1 1 0 1.92a.96.96 0 0 1 0-1.92M8.489 11.458c.588.01 1.965 1.157 3.572 1.164c1.607-.007 2.984-1.155 3.572-1.164c.196-.003.305.12.305.454c0 .886-.424 2.328-1.563 3.202c-.22-.756-1.396-1.366-1.63-1.32q-.011.001-.02.006l-.044.026l-.01.008l-.03.024q-.018.017-.035.036l-.032.04a1 1 0 0 0-.058.09l-.014.025q-.049.088-.11.19a1 1 0 0 1-.083.116a1.2 1.2 0 0 1-.173.18q-.035.029-.075.058a1.3 1.3 0 0 1-.251-.243a1 1 0 0 1-.076-.107c-.124-.193-.177-.363-.337-.444c-.034-.016-.104-.008-.2.022q-.094.03-.216.087q-.06.028-.125.063l-.13.074q-.067.04-.136.086a3 3 0 0 0-.135.096a3 3 0 0 0-.26.219a2 2 0 0 0-.12.121a2 2 0 0 0-.106.128l-.002.002a2 2 0 0 0-.09.132l-.001.001a1.2 1.2 0 0 0-.105.212q-.013.036-.024.073c-1.139-.875-1.563-2.317-1.563-3.203c0-.334.109-.457.305-.454m.836 10.354c.824-1.19.766-2.082-.365-3.194c-1.13-1.112-1.789-2.738-1.789-2.738s-.246-.945-.806-.858s-.97 1.499.202 2.362c1.173.864-.233 1.45-.685.64c-.45-.812-1.683-2.896-2.322-3.295s-1.089-.175-.938.647s2.822 2.813 2.562 3.244s-1.176-.506-1.176-.506s-2.866-2.567-3.49-1.898s.473 1.23 2.037 2.16c1.564.932 1.686 1.178 1.464 1.53s-3.675-2.511-4-1.297c-.323 1.214 3.524 1.567 3.287 2.405c-.238.839-2.71-1.587-3.216-.642c-.506.946 3.49 2.056 3.522 2.064c1.29.33 4.568 1.028 5.713-.624m5.349 0c-.824-1.19-.766-2.082.365-3.194c1.13-1.112 1.789-2.738 1.789-2.738s.246-.945.806-.858s.97 1.499-.202 2.362c-1.173.864.233 1.45.685.64c.451-.812 1.683-2.896 2.322-3.295s1.089-.175.938.647s-2.822 2.813-2.562 3.244s1.176-.506 1.176-.506s2.866-2.567 3.49-1.898s-.473 1.23-2.037 2.16c-1.564.932-1.686 1.178-1.464 1.53s3.675-2.511 4-1.297c.323 1.214-3.524 1.567-3.287 2.405c.238.839 2.71-1.587 3.216-.642c.506.946-3.49 2.056-3.522 2.064c-1.29.33-4.568 1.028-5.713-.624"})});case"kick":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 24 24",fill:"#888888",children:a.jsx("path",{d:"M9 3a1 1 0 0 1 1 1v3h1V6a1 1 0 0 1 .883-.993L12 5h1V4a1 1 0 0 1 .883-.993L14 3h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-1v1a1 1 0 0 1-.883.993L18 11h-1v2h1a1 1 0 0 1 .993.883L19 14v1h1a1 1 0 0 1 .993.883L21 16v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1h-1a1 1 0 0 1-.993-.883L11 18v-1h-1v3a1 1 0 0 1-.883.993L9 21H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"})});case"zoom":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 16 16",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M1.45 3.334C.648 3.334 0 3.982 0 4.783v4.986c0 1.6 1.298 2.898 2.898 2.898h6.986c.8 0 1.45-.649 1.45-1.45V6.233a2.9 2.9 0 0 0-2.899-2.899zM16 4.643v6.715c0 .544-.618.86-1.059.539l-2.059-1.498a1.33 1.33 0 0 1-.549-1.078V6.679c0-.427.204-.827.55-1.078l2.058-1.498a.667.667 0 0 1 1.059.54",clipRule:"evenodd"})});case"vk":return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.2em",height:"1.2em",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M17.802 12.298s1.617 1.597 2.017 2.336a.1.1 0 0 1 .018.035q.244.409.123.645c-.135.261-.592.392-.747.403h-2.858c-.199 0-.613-.052-1.117-.4c-.385-.269-.768-.712-1.139-1.145c-.554-.643-1.033-1.201-1.518-1.201a.6.6 0 0 0-.18.03c-.367.116-.833.639-.833 2.032c0 .436-.344.684-.585.684H9.674c-.446 0-2.768-.156-4.827-2.327C2.324 10.732.058 5.4.036 5.353c-.141-.345.155-.533.475-.533h2.886c.387 0 .513.234.601.444c.102.241.48 1.205 1.1 2.288c1.004 1.762 1.621 2.479 2.114 2.479a.53.53 0 0 0 .264-.07c.644-.354.524-2.654.494-3.128c0-.092-.001-1.027-.331-1.479c-.236-.324-.638-.45-.881-.496c.065-.094.203-.238.38-.323c.441-.22 1.238-.252 2.029-.252h.439c.858.012 1.08.067 1.392.146c.628.15.64.557.585 1.943c-.016.396-.033.842-.033 1.367c0 .112-.005.237-.005.364c-.019.711-.044 1.512.458 1.841a.4.4 0 0 0 .217.062c.174 0 .695 0 2.108-2.425c.62-1.071 1.1-2.334 1.133-2.429c.028-.053.112-.202.214-.262a.5.5 0 0 1 .236-.056h3.395c.37 0 .621.056.67.196c.082.227-.016.92-1.566 3.016c-.261.349-.49.651-.691.915c-1.405 1.844-1.405 1.937.083 3.337",clipRule:"evenodd"})});case"roblox":return a.jsx("svg",{version:"1.1",id:"svg10",x:"0px",y:"0px",viewBox:"0 0 302.7 302.7",width:"1.2em",height:"1.2em",fill:"currentColor",children:a.jsx("path",{id:"path20",d:"M120.5,271.7c-110.9-28.6-120-31-119.9-31.5C0.7,239.6,62.1,0.5,62.2,0.4c0,0,54,13.8,119.9,30.8S302.1,62,302.2,62c0.2,0,0.2,0.4,0.1,0.9c-0.2,1.5-61.5,239.3-61.7,239.5C240.6,302.5,186.5,288.7,120.5,271.7z M174.9,158c3.2-12.6,5.9-23.1,6-23.4c0.1-0.5-2.3-1.2-23.2-6.6c-12.8-3.3-23.5-5.9-23.6-5.8c-0.3,0.3-12.1,46.6-12,46.7c0.2,0.2,46.7,12.2,46.8,12.1C168.9,180.9,171.6,170.6,174.9,158L174.9,158z"})});default:return a.jsx(la,{className:"w-6 h-6 text-white"})}},pw=`// Example custom migration script
939
939
  import { migrateUser } from '@better-auth/migration';
940
940
 
941
941
  async function run() {
@@ -1136,11 +1136,11 @@ migrateFromClerk()
1136
1136
  .catch((error) => {
1137
1137
  console.error('Migration failed:', error);
1138
1138
  process.exit(1);
1139
- });`},{id:"supabase",name:"Supabase",description:"Supabase Migration guide",docs:"https://better-auth.com/docs/migrations/supabase",logo:"",highlights:["Exports Supabase auth.users and auth.identities.","Preserves password hashes and metadata fields.","Supports incremental re-runs with idempotent operations."],disabled:!0},{id:"auth0",name:"Auth0",description:"Auth0 Migration guide",docs:"https://better-auth.com/docs/migrations/auth0",logo:"",highlights:["Uses Auth0 Management API bulk exports.","Keeps password hashes compatible with Better Auth adapters.","Migrates applications and roles to Better Auth format."],disabled:!0},{id:"nextauth",name:"NextAuth.js",description:"NextAuth.js Migration guide",docs:"https://better-auth.com/docs/migrations/nextauth",logo:"",highlights:["Reads users/accounts from your existing NextAuth database.","Moves refresh tokens and OAuth profiles into Better Auth.","Supports Prisma, MySQL, and Postgres NextAuth adapters."],disabled:!0},{id:"custom",name:"Custom Script",description:"Custom Migration guide",docs:"https://better-auth.com/docs/migrations/custom",highlights:["Use Better Auth SDK helpers to insert users safely.","Supports dry-run mode to validate before committing.","Perfect for bespoke data sources or ETL pipelines."],custom:!0}];function dpe(){var ME,LE,UE,PE,FE,BE,zE,$E,HE;const[e,t]=yM(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(!1),[h,d]=p.useState([]),[f,m]=p.useState(""),[y,b]=p.useState(!1),[w,x]=p.useState(""),[v,g]=p.useState(pw),[N,S]=p.useState(!1),[E,j]=p.useState(""),[R,L]=p.useState(""),[P,U]=p.useState("SHA-256"),[F,G]=p.useState("hex"),[_,I]=p.useState(null),[A,C]=p.useState(!1),[T,O]=p.useState(!1),[q,k]=p.useState(!1),[M,$]=p.useState(null),[W,Y]=p.useState(new Set),[te,ne]=p.useState(!1),[X,se]=p.useState([]),[Ee,re]=p.useState(new Set),[xe,ye]=p.useState("json"),[ze,He]=p.useState("1000"),[Fe,Ye]=p.useState(!1),[ft,et]=p.useState(!1),[de,Be]=p.useState(""),[Ue,Oe]=p.useState(""),[We,nt]=p.useState(null),[lt,Ut]=p.useState(!1),[Kt,Gt]=p.useState(null),[_t,ce]=p.useState(!1),[Te,Ze]=p.useState("api_key"),[Q,pe]=p.useState(""),[be,_e]=p.useState(""),[$e,je]=p.useState("15"),[K,ue]=p.useState(""),[Ae,Le]=p.useState(`{
1139
+ });`},{id:"supabase",name:"Supabase",description:"Supabase Migration guide",docs:"https://better-auth.com/docs/migrations/supabase",logo:"",highlights:["Exports Supabase auth.users and auth.identities.","Preserves password hashes and metadata fields.","Supports incremental re-runs with idempotent operations."],disabled:!0},{id:"auth0",name:"Auth0",description:"Auth0 Migration guide",docs:"https://better-auth.com/docs/migrations/auth0",logo:"",highlights:["Uses Auth0 Management API bulk exports.","Keeps password hashes compatible with Better Auth adapters.","Migrates applications and roles to Better Auth format."],disabled:!0},{id:"nextauth",name:"NextAuth.js",description:"NextAuth.js Migration guide",docs:"https://better-auth.com/docs/migrations/nextauth",logo:"",highlights:["Reads users/accounts from your existing NextAuth database.","Moves refresh tokens and OAuth profiles into Better Auth.","Supports Prisma, MySQL, and Postgres NextAuth adapters."],disabled:!0},{id:"custom",name:"Custom Script",description:"Custom Migration guide",docs:"https://better-auth.com/docs/migrations/custom",highlights:["Use Better Auth SDK helpers to insert users safely.","Supports dry-run mode to validate before committing.","Perfect for bespoke data sources or ETL pipelines."],custom:!0}];function dpe(){var ME,LE,UE,PE,FE,BE,zE,$E,HE;const[e,t]=yM(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState(!1),[c,u]=p.useState(!1),[h,d]=p.useState([]),[f,m]=p.useState(""),[y,b]=p.useState(!1),[w,x]=p.useState(""),[v,g]=p.useState(pw),[N,S]=p.useState(!1),[E,j]=p.useState(""),[R,L]=p.useState(""),[P,U]=p.useState("SHA-256"),[F,G]=p.useState("hex"),[_,I]=p.useState(null),[A,C]=p.useState(!1),[T,O]=p.useState(!1),[q,k]=p.useState(!1),[M,$]=p.useState(null),[W,Y]=p.useState(new Set),[te,ne]=p.useState(!1),[X,se]=p.useState([]),[Ee,re]=p.useState(new Set),[xe,ye]=p.useState("json"),[ze,He]=p.useState("1000"),[Fe,Ye]=p.useState(!1),[ft,et]=p.useState(!1),[de,Be]=p.useState(""),[Ue,Oe]=p.useState(""),[We,nt]=p.useState(null),[lt,Ut]=p.useState(!1),[Kt,Gt]=p.useState(null),[_t,ce]=p.useState(!1),[Te,Ze]=p.useState("api_key"),[K,pe]=p.useState(""),[be,_e]=p.useState(""),[$e,je]=p.useState("15"),[Z,ue]=p.useState(""),[Ae,Le]=p.useState(`{
1140
1140
 
1141
- }`),[he,Z]=p.useState(null),[oe,De]=p.useState(!1),[it,tt]=p.useState(!1),[at,It]=p.useState("1"),[wn,sn]=p.useState([]),[ns,In]=p.useState(""),[qn,sr]=p.useState(null),[as,nl]=p.useState(!1),[Ws,Fn]=p.useState(""),[Mt,rs]=p.useState(null),[ss,is]=p.useState(!1),[Sr,os]=p.useState(!1),[Er,Xs]=p.useState(!1),[pa,Qn]=p.useState(""),[Fa,Ks]=p.useState("localhost:3000"),[ma,Jn]=p.useState(null),[ir,Zs]=p.useState(!1),[Qs,al]=p.useState(!1),[Js,ro]=p.useState(!1),[xt,jr]=p.useState(null),[Tr,ei]=p.useState(!1),[ls,or]=p.useState(null),[cs,Ba]=p.useState(!1),[so,ds]=p.useState(!1),[rl,we]=p.useState(!1),[Ne,Re]=p.useState(null),[me,Ce]=p.useState(!1),[Ie,ke]=p.useState(!1),[Se,Ge]=p.useState(null),[Pt,Ft]=p.useState(!1),[ea,ga]=p.useState(32),[Cr,kr]=p.useState("hex"),[Gc,ch]=p.useState(!1),[sl,Om]=p.useState(""),[TE,Dm]=p.useState(""),[un,Nn]=p.useState([]),[eP,tP]=p.useState([]),[za,lr]=p.useState([]),[Ar,us]=p.useState([]),[hs,io]=p.useState([]),[Im,Mm]=p.useState(!1),[ta,ti]=p.useState({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),[Rt,Vc]=p.useState(null),CE=p.useRef(null),[kE,AE]=p.useState(!1),[_E,Yc]=p.useState(null),[ni,RE]=p.useState("server"),[OE,Lm]=p.useState("client");p.useEffect(()=>(q?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[q]),p.useEffect(()=>(Er?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Er]),p.useEffect(()=>(Tr?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Tr]),p.useEffect(()=>(as?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[as]),p.useEffect(()=>(Er?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Er]),p.useEffect(()=>(Tr?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Tr]),p.useEffect(()=>(so?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[so]),p.useEffect(()=>(it?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[it]),p.useEffect(()=>(ft?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[ft]),p.useEffect(()=>(N?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N]),p.useEffect(()=>(_t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[_t]),p.useEffect(()=>(Gc?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Gc]);const Ke=(D,B,J,ae)=>{i(le=>[...le,{id:ae??`log-${Date.now()}-${Math.random()}`,type:D,message:B,timestamp:new Date,status:J}])},fs=p.useRef(new Set),Wc=p.useRef(new Set),il=p.useRef(new Map),Xc=p.useRef(null),Um=()=>vd.find(D=>!D.disabled)??vd[0],kn=vd.find(D=>D.id===w)??Um();p.useEffect(()=>{x(y?D=>{var B;return D||((B=Um())==null?void 0:B.id)||""}:"")},[y,Um]);const nP=D=>{x(D),D!=="custom"&&g(pw)},aP=()=>{j(""),L(""),I(null),U("SHA-256"),G("hex"),S(!0)},rP=async()=>{if(!E.trim()){V.error("Enter a password to hash");return}try{C(!0);const D=R?`${R}:${E}`:E,J=await Mfe(P,F).digest(D);I(J),V.success("Password hashed successfully")}catch(D){V.error("Failed to hash password"),console.error(D)}finally{C(!1)}},$a=async D=>{try{await navigator.clipboard.writeText(D),V.success("Copied to clipboard")}catch{V.error("Failed to copy to clipboard")}},oo=()=>{Xc.current&&!Xc.current.closed&&Xc.current.close(),Xc.current=null},ai=(D,B,J,ae,le)=>{let fe=il.current.get(D);fe||(fe=new Map,il.current.set(D,fe));const Je=fe.get(J);if(Je){i(Gn=>Gn.map(pt=>pt.id===Je?{...pt,type:B,message:ae,status:le,timestamp:new Date}:pt));return}const yt=`session-${D}-${J}-${Date.now()}`;fe.set(J,yt),Ke(B,ae,le,yt)},ol=(D,B,J=0)=>{fs.current.has(D)||fs.current.add(D),fetch(`/api/tools/oauth/status?testSessionId=${encodeURIComponent(D)}`).then(le=>le.json()).then(le=>{if(le.hasResult){fs.current.delete(D),Kc(le.result);return}if(J+1>=15){fs.current.delete(D),ai(D,"error","timeout","⌛ Timed out waiting for account creation. Check Better Auth logs.","failed"),oo(),r(null),V.error("OAuth test timed out waiting for account creation");return}setTimeout(()=>ol(D,B,J+1),2e3)}).catch(le=>{J+1<15?setTimeout(()=>ol(D,B,J+1),2e3):(fs.current.delete(D),ai(D,"error","poll-error",`⚠️ Failed to check OAuth status: ${le}`,"failed"),oo(),r(null),V.error("Failed to check OAuth status"))})},Kc=D=>{l(!0);const B=D.testSessionId;if(D.success){if(Wc.current.has(B)&&D.userInfo)return;if(ai(B,"success","waiting","✅ Verified with Better Auth.","completed"),D.userInfo){Wc.current.add(B);const J=[D.userInfo.name?`👤 ${D.userInfo.name}`:null,D.userInfo.email?`✉️ ${D.userInfo.email}`:null].filter(Boolean).join(" | "),ae=J?`✅ ${D.provider} OAuth succeeded — ${J}`:`✅ ${D.provider} OAuth succeeded!`;ai(B,"success","completed",ae,"completed"),V.success(`OAuth test for ${D.provider} passed!`),oo(),r(null),il.current.delete(B)}else ai(B,"progress","await-finalize","⌛ OAuth flow finished. Waiting for Better Auth to finalize account...","running"),fs.current.has(B)||(fs.current.add(B),ol(B,D.provider))}else{if(Wc.current.has(B))return;ai(B,"error","waiting","❌ Verification failed with Better Auth.","failed");const J=D.error?` — ${D.error}`:"";ai(B,"error","failed",`❌ ${D.provider} OAuth failed${J}`,"failed"),V.error(`OAuth test for ${D.provider} failed`),oo(),r(null),il.current.delete(B)}D.success||(Wc.current.add(B),il.current.delete(B)),sessionStorage.removeItem("oauth_test_session"),sessionStorage.removeItem(`oauth_test_result_${B}`)};p.useEffect(()=>{const D=e.get("oauth_test_result");if(D)try{const B=JSON.parse(decodeURIComponent(D));l(!0),Kc(B),t({})}catch{}},[e,t,Kc]),p.useEffect(()=>{(async()=>{try{const J=await(await fetch("/api/tools/oauth/providers")).json();J.success&&J.providers&&d(J.providers.filter(ae=>ae.enabled))}catch{}})()},[]);const sP=async()=>{if(h.length===0){V.error("No OAuth providers configured"),Ke("error","❌ No OAuth providers found in configuration","failed"),Ke("info","💡 Please configure at least one OAuth provider in your Better Auth config","failed");return}u(!0)},iP=async D=>{u(!1),m(""),r("test-oauth"),l(!0),i([]),Ke("info",`🔍 Testing ${D} OAuth...`,"running");const B=new Date().toISOString();try{Ke("progress","📡 Contacting Better Auth...","running");const ae=await(await fetch("/api/tools/oauth/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:D})})).json();if(ae.success&&ae.startUrl){il.current.delete(ae.testSessionId),ai(ae.testSessionId,"progress","popup-open",`🌐 Opening ${ae.provider} OAuth popup...`,"running");const le={testSessionId:ae.testSessionId,provider:ae.provider,providerId:D,startTime:B};Wc.current.delete(ae.testSessionId),sessionStorage.setItem("oauth_test_session",JSON.stringify(le));const fe=600,Je=700,yt=(window.screen.width-fe)/2,Gn=(window.screen.height-Je)/2,pt=window.open(ae.startUrl,"oauth-test",`width=${fe},height=${Je},left=${yt},top=${Gn},scrollbars=yes,resizable=yes`);if(!pt){Ke("error","❌ Failed to open OAuth window. Please allow popups for this site.","failed"),Ke("error","💡 Check your browser popup blocker settings","failed"),V.error("Failed to open OAuth window. Please allow popups."),r(null);return}Xc.current=pt;let wt=!1;const ps=cr=>{if(cr.origin===window.location.origin){if(cr.data&&cr.data.type==="oauth_test_state"){if(cr.data.status==="redirect")fs.current.has(le.testSessionId)||ol(le.testSessionId,le.provider);else if(cr.data.status==="error"){wt=!0;const lo=sessionStorage.getItem("oauth_test_session");let zm=ae.provider;if(lo)try{zm=JSON.parse(lo).provider||zm}catch{}Kc({success:!1,provider:zm,testSessionId:cr.data.testSessionId,error:cr.data.error||"Failed to start OAuth test"}),window.removeEventListener("message",ps),clearInterval(dh),clearTimeout(Bm),oo()}return}if(cr.data&&cr.data.type==="oauth_test_result"){window.removeEventListener("message",ps),clearInterval(dh),clearTimeout(Bm),wt=!0;const lo=cr.data.result;Kc(lo),fs.current.has(lo.testSessionId)||ol(lo.testSessionId,lo.provider),oo()}}};window.addEventListener("message",ps);const dh=setInterval(()=>{pt.closed&&(clearInterval(dh),clearTimeout(Bm),window.removeEventListener("message",ps),!sessionStorage.getItem(`oauth_test_result_${le.testSessionId}`)&&!wt&&(wt=!0,ol(le.testSessionId,le.provider)))},500),Bm=setTimeout(()=>{pt.closed||(clearInterval(dh),window.removeEventListener("message",ps),oo(),wt||(wt=!0),Ke("error","❌ OAuth test timed out after 5 minutes","failed"),Ke("error","💡 Possible reasons:","failed"),Ke("error"," • Authentication took too long","failed"),Ke("error"," • Provider is not responding","failed"),Ke("error"," • Network connectivity issues","failed"),V.error("OAuth test timed out"),r(null))},5*60*1e3)}else Ke("error",`❌ Failed to initiate OAuth test: ${ae.error||"Unknown error"}`,"failed"),ae.details&&Ke("error",`💡 Details: ${JSON.stringify(ae.details)}`,"failed"),ae.cause&&Ke("error",`💡 Cause: ${ae.cause}`,"failed"),V.error(ae.error||"Failed to start OAuth test"),r(null)}catch(J){Ke("error",`❌ Network error: ${J}`,"failed"),V.error("Failed to start OAuth test"),r(null)}},oP=()=>{b(!0)},DE=async(D,B)=>{const J=vd.find(le=>le.id===D);if(!J){V.error("Unknown migration provider");return}if(J.disabled){V.info(`${J.name} migration is coming soon`);return}b(!1),r("run-migration"),l(!0),i([]);const ae=le=>new Promise(fe=>setTimeout(fe,le));try{if(Ke("info",`🚀 Preparing ${J.name} migration...`,"running"),J.highlights)for(const Je of J.highlights)await ae(350),Ke("progress",Je,"running");Ke("progress","📡 Sending migration payload to server...","running");const fe=await(await fetch("/api/tools/migrations/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:J.id,script:J.custom?B:J.script})})).json();if(fe.success)Ke("progress","🚀 Migration job acknowledged. Follow server logs for live progress.","running"),Ke("success",`✅ ${J.name} migration request accepted.`,"completed"),fe.message&&Ke("info",fe.message,"completed"),V.success(`${J.name} migration flow completed`);else throw new Error(fe.error||"Migration request failed")}catch(le){Ke("error",`❌ Migration failed: ${le}`,"failed"),V.error("Migration failed")}finally{r(null)}},lP=async()=>{r("validate-config"),l(!0),i([]),$(null),k(!0),Ke("info","Validating Better Auth configuration...","running");try{const B=await(await fetch("/api/tools/validate-config",{method:"POST",headers:{"Content-Type":"application/json"}})).json();if(B.success!==void 0)$(B),Ke("info",`Found ${B.summary.total} validation checks`,"completed"),B.summary.errors>0&&Ke("error",`❌ ${B.summary.errors} error(s) found`,"failed"),B.summary.warnings>0&&Ke("progress",`⚠️ ${B.summary.warnings} warning(s) found`,"completed"),B.summary.passes>0&&Ke("success",`✅ ${B.summary.passes} check(s) passed`,"completed"),B.success?V.success("Configuration validation completed successfully"):V.error(`Configuration validation found ${B.summary.errors} error(s)`);else throw new Error(B.error||"Failed to validate configuration")}catch(D){Ke("error",`❌ Configuration validation failed: ${D}`,"failed"),V.error("Configuration validation failed")}finally{r(null)}},cP=async()=>{r("test-db"),l(!0),i([]),Ke("info","Testing database connection...","running");try{const B=await(await fetch("/api/database/test")).json();await new Promise(J=>setTimeout(J,1e3)),Ke("progress","Checking on database con!","running"),B.success?(Ke("success","✅ Database connection successful!","completed"),B.result&&Array.isArray(B.result)&&B.result.length>0&&(Ke("info","📄 Sample user record (first row):","completed"),Ke("info",JSON.stringify(B.result[0],null,2),"completed")),V.success("Database connection test successful")):(Ke("error",`❌ Database connection failed: ${B.error||"Unknown error"}`,"failed"),V.error("Database connection test failed"))}catch(D){Ke("error",`❌ Network error: ${D}`,"failed"),V.error("Failed to test database connection")}finally{r(null)}},dP=D=>{if(!D)return"N/A";const B=new Date(D);return Number.isNaN(B.getTime())?D:B.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})},uP=()=>{ne(!0)},hP=()=>{Be(""),Oe(""),nt(null),Gt(null),et(!0)},fP=()=>{It("1"),sn([]),In(""),sr(null),tt(!0)},pP=()=>{nl(!0),Fn(""),rs(null),os(!1)},mP=async()=>{if(!Ws.trim()){V.error("Please enter a password to check");return}is(!0),rs(null);try{const B=await(await fetch("/api/tools/password-strength",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Ws})})).json();B.success?(rs(B),V.success("Password strength checked")):V.error(B.error||"Failed to check password strength")}catch(D){const B=D instanceof Error?D.message:"Failed to check password strength";V.error(B)}finally{is(!1)}},gP=()=>{ds(!0),Ge(null),ga(32),kr("hex")},xP=async()=>{Ft(!0),Ge(null);try{const D=await fetch("/api/tools/generate-secret",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({length:ea,format:Cr})});if(!D.ok)throw new Error("Failed to generate secret");const B=await D.json();if(B.success)Ge(B),V.success("Secret generated successfully");else throw new Error(B.message||"Failed to generate secret")}catch(D){V.error(D instanceof Error?D.message:"Failed to generate secret"),console.error(D)}finally{Ft(!1)}},bP=async()=>{if(!Se){V.error("Please generate a secret first");return}Ce(!0),Re(null);try{const B=await(await fetch("/api/tools/check-env-secret",{method:"POST",headers:{"Content-Type":"application/json"}})).json();if(B.success&&B.hasExisting){Re({hasExisting:!0,secret:B.existingSecret,path:B.path}),we(!0),Ce(!1);return}await IE("override")}catch(D){const B=D instanceof Error?D.message:"Failed to check secret";V.error(B),Ce(!1)}},IE=async D=>{if(Se){ke(!0),we(!1);try{const J=await(await fetch("/api/tools/write-env-secret",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:Se.secret,action:D})})).json();if(J.success)V.success(`Secret written to ${J.path}`),Re(null);else throw new Error(J.message||"Failed to write secret")}catch(B){const J=B instanceof Error?B.message:"Failed to write secret to .env";V.error(J)}finally{ke(!1),Ce(!1)}}},vP=async()=>{Xs(!0),m("google"),Jn(null),al(!1);try{const B=await(await fetch("/api/config")).json();if(B.baseURL){const J=B.baseURL.replace(/^https?:\/\//,"");Ks(J),Qn(J)}else Ks("localhost:3000"),Qn("localhost:3000")}catch{Ks("localhost:3000"),Qn("localhost:3000")}},yP=async()=>{if(!f){V.error("Please select a provider");return}const D=pa.trim()||Fa;if(!D){V.error("Please enter an origin");return}const B=D.replace(/^https?:\/\//,"");Zs(!0),Jn(null),jr(null);try{const J=await fetch(`https://studio-backend-0.vercel.app/oauth/${f}?origin=${encodeURIComponent(B)}`);if(!J.ok)throw new Error(`Failed to fetch credentials: ${J.statusText}`);const ae=await J.json();if(ae.clientId&&ae.clientSecret)Jn({clientId:ae.clientId,clientSecret:ae.clientSecret}),V.success("OAuth credentials fetched successfully");else throw new Error("Invalid response format")}catch(J){const ae=J instanceof Error?J.message:"Failed to fetch OAuth credentials";V.error(ae)}finally{Zs(!1)}},wP=async()=>{if(!f||!ma){V.error("Please fetch credentials first");return}Ba(!0),jr(null);try{const B=await(await fetch("/api/tools/check-env-credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:f})})).json();if(B.success&&B.hasExisting){or({hasExisting:!0,credentials:B.existingCredentials,path:B.path}),ei(!0),Ba(!1);return}await Pm("override")}catch(D){const B=D instanceof Error?D.message:"Failed to check credentials";V.error(B),Ba(!1)}},Pm=async D=>{if(!(!f||!ma)){ro(!0),jr(null),ei(!1);try{const J=await(await fetch("/api/tools/write-env-credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:f,clientId:ma.clientId,clientSecret:ma.clientSecret,action:D})})).json();if(J.success)jr({success:!0,message:J.message,path:J.path}),V.success(`Credentials written to ${J.path}`),or(null);else throw new Error(J.message||"Failed to write credentials")}catch(B){const J=B instanceof Error?B.message:"Failed to write credentials to .env";jr({success:!1,message:J}),V.error(J)}finally{ro(!1),Ba(!1)}}},NP=()=>{const D=Math.min(Math.max(parseInt(at)||1,1),100),B=[];for(let J=0;J<D;J++)try{const ae=crypto.randomUUID();B.push(ae)}catch{V.error("Failed to generate UUID");return}sn(B),V.success(`Generated ${B.length} UUID(s)`)},SP=()=>{var Gn,pt;const D=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,B=ns.trim();if(!B){sr(null);return}if(!D.test(B)){sr({isValid:!1});return}const ae=B.split("-"),le=(Gn=ae[2])==null?void 0:Gn[0],fe=(pt=ae[3])==null?void 0:pt[0];let Je,yt;if(le){const wt=parseInt(le,16);wt>=1&&wt<=5?Je=`v${wt}`:wt===0&&(Je="v1 (time-based)")}if(fe){const wt=parseInt(fe,16);wt>=8&&wt<=11?yt="RFC 4122":wt>=12&&wt<=15?yt="Microsoft":wt>=0&&wt<=7&&(yt="Reserved")}sr({isValid:!0,version:Je,variant:yt})},EP=()=>{Ze("api_key"),pe(""),_e(""),je("15"),ue(""),Le(`{
1141
+ }`),[he,Q]=p.useState(null),[oe,De]=p.useState(!1),[it,tt]=p.useState(!1),[at,It]=p.useState("1"),[wn,sn]=p.useState([]),[ns,In]=p.useState(""),[qn,sr]=p.useState(null),[as,nl]=p.useState(!1),[Ws,Fn]=p.useState(""),[Mt,rs]=p.useState(null),[ss,is]=p.useState(!1),[Sr,os]=p.useState(!1),[Er,Xs]=p.useState(!1),[pa,Qn]=p.useState(""),[Fa,Ks]=p.useState("localhost:3000"),[ma,Jn]=p.useState(null),[ir,Zs]=p.useState(!1),[Qs,al]=p.useState(!1),[Js,ro]=p.useState(!1),[xt,jr]=p.useState(null),[Tr,ei]=p.useState(!1),[ls,or]=p.useState(null),[cs,Ba]=p.useState(!1),[so,ds]=p.useState(!1),[rl,we]=p.useState(!1),[Ne,Re]=p.useState(null),[me,Ce]=p.useState(!1),[Ie,ke]=p.useState(!1),[Se,Ge]=p.useState(null),[Pt,Ft]=p.useState(!1),[ea,ga]=p.useState(32),[Cr,kr]=p.useState("hex"),[Gc,ch]=p.useState(!1),[sl,Om]=p.useState(""),[TE,Dm]=p.useState(""),[un,Nn]=p.useState([]),[eP,tP]=p.useState([]),[za,lr]=p.useState([]),[Ar,us]=p.useState([]),[hs,io]=p.useState([]),[Im,Mm]=p.useState(!1),[ta,ti]=p.useState({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),[Rt,Vc]=p.useState(null),CE=p.useRef(null),[kE,AE]=p.useState(!1),[_E,Yc]=p.useState(null),[ni,RE]=p.useState("server"),[OE,Lm]=p.useState("client");p.useEffect(()=>(q?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[q]),p.useEffect(()=>(Er?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Er]),p.useEffect(()=>(Tr?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Tr]),p.useEffect(()=>(as?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[as]),p.useEffect(()=>(Er?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Er]),p.useEffect(()=>(Tr?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Tr]),p.useEffect(()=>(so?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[so]),p.useEffect(()=>(it?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[it]),p.useEffect(()=>(ft?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[ft]),p.useEffect(()=>(N?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[N]),p.useEffect(()=>(_t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[_t]),p.useEffect(()=>(Gc?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[Gc]);const Ke=(D,B,J,ae)=>{i(le=>[...le,{id:ae??`log-${Date.now()}-${Math.random()}`,type:D,message:B,timestamp:new Date,status:J}])},fs=p.useRef(new Set),Wc=p.useRef(new Set),il=p.useRef(new Map),Xc=p.useRef(null),Um=()=>vd.find(D=>!D.disabled)??vd[0],kn=vd.find(D=>D.id===w)??Um();p.useEffect(()=>{x(y?D=>{var B;return D||((B=Um())==null?void 0:B.id)||""}:"")},[y,Um]);const nP=D=>{x(D),D!=="custom"&&g(pw)},aP=()=>{j(""),L(""),I(null),U("SHA-256"),G("hex"),S(!0)},rP=async()=>{if(!E.trim()){V.error("Enter a password to hash");return}try{C(!0);const D=R?`${R}:${E}`:E,J=await Mfe(P,F).digest(D);I(J),V.success("Password hashed successfully")}catch(D){V.error("Failed to hash password"),console.error(D)}finally{C(!1)}},$a=async D=>{try{await navigator.clipboard.writeText(D),V.success("Copied to clipboard")}catch{V.error("Failed to copy to clipboard")}},oo=()=>{Xc.current&&!Xc.current.closed&&Xc.current.close(),Xc.current=null},ai=(D,B,J,ae,le)=>{let fe=il.current.get(D);fe||(fe=new Map,il.current.set(D,fe));const Je=fe.get(J);if(Je){i(Gn=>Gn.map(pt=>pt.id===Je?{...pt,type:B,message:ae,status:le,timestamp:new Date}:pt));return}const yt=`session-${D}-${J}-${Date.now()}`;fe.set(J,yt),Ke(B,ae,le,yt)},ol=(D,B,J=0)=>{fs.current.has(D)||fs.current.add(D),fetch(`/api/tools/oauth/status?testSessionId=${encodeURIComponent(D)}`).then(le=>le.json()).then(le=>{if(le.hasResult){fs.current.delete(D),Kc(le.result);return}if(J+1>=15){fs.current.delete(D),ai(D,"error","timeout","⌛ Timed out waiting for account creation. Check Better Auth logs.","failed"),oo(),r(null),V.error("OAuth test timed out waiting for account creation");return}setTimeout(()=>ol(D,B,J+1),2e3)}).catch(le=>{J+1<15?setTimeout(()=>ol(D,B,J+1),2e3):(fs.current.delete(D),ai(D,"error","poll-error",`⚠️ Failed to check OAuth status: ${le}`,"failed"),oo(),r(null),V.error("Failed to check OAuth status"))})},Kc=D=>{l(!0);const B=D.testSessionId;if(D.success){if(Wc.current.has(B)&&D.userInfo)return;if(ai(B,"success","waiting","✅ Verified with Better Auth.","completed"),D.userInfo){Wc.current.add(B);const J=[D.userInfo.name?`👤 ${D.userInfo.name}`:null,D.userInfo.email?`✉️ ${D.userInfo.email}`:null].filter(Boolean).join(" | "),ae=J?`✅ ${D.provider} OAuth succeeded — ${J}`:`✅ ${D.provider} OAuth succeeded!`;ai(B,"success","completed",ae,"completed"),V.success(`OAuth test for ${D.provider} passed!`),oo(),r(null),il.current.delete(B)}else ai(B,"progress","await-finalize","⌛ OAuth flow finished. Waiting for Better Auth to finalize account...","running"),fs.current.has(B)||(fs.current.add(B),ol(B,D.provider))}else{if(Wc.current.has(B))return;ai(B,"error","waiting","❌ Verification failed with Better Auth.","failed");const J=D.error?` — ${D.error}`:"";ai(B,"error","failed",`❌ ${D.provider} OAuth failed${J}`,"failed"),V.error(`OAuth test for ${D.provider} failed`),oo(),r(null),il.current.delete(B)}D.success||(Wc.current.add(B),il.current.delete(B)),sessionStorage.removeItem("oauth_test_session"),sessionStorage.removeItem(`oauth_test_result_${B}`)};p.useEffect(()=>{const D=e.get("oauth_test_result");if(D)try{const B=JSON.parse(decodeURIComponent(D));l(!0),Kc(B),t({})}catch{}},[e,t,Kc]),p.useEffect(()=>{(async()=>{try{const J=await(await fetch("/api/tools/oauth/providers")).json();J.success&&J.providers&&d(J.providers.filter(ae=>ae.enabled))}catch{}})()},[]);const sP=async()=>{if(h.length===0){V.error("No OAuth providers configured"),Ke("error","❌ No OAuth providers found in configuration","failed"),Ke("info","💡 Please configure at least one OAuth provider in your Better Auth config","failed");return}u(!0)},iP=async D=>{u(!1),m(""),r("test-oauth"),l(!0),i([]),Ke("info",`🔍 Testing ${D} OAuth...`,"running");const B=new Date().toISOString();try{Ke("progress","📡 Contacting Better Auth...","running");const ae=await(await fetch("/api/tools/oauth/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:D})})).json();if(ae.success&&ae.startUrl){il.current.delete(ae.testSessionId),ai(ae.testSessionId,"progress","popup-open",`🌐 Opening ${ae.provider} OAuth popup...`,"running");const le={testSessionId:ae.testSessionId,provider:ae.provider,providerId:D,startTime:B};Wc.current.delete(ae.testSessionId),sessionStorage.setItem("oauth_test_session",JSON.stringify(le));const fe=600,Je=700,yt=(window.screen.width-fe)/2,Gn=(window.screen.height-Je)/2,pt=window.open(ae.startUrl,"oauth-test",`width=${fe},height=${Je},left=${yt},top=${Gn},scrollbars=yes,resizable=yes`);if(!pt){Ke("error","❌ Failed to open OAuth window. Please allow popups for this site.","failed"),Ke("error","💡 Check your browser popup blocker settings","failed"),V.error("Failed to open OAuth window. Please allow popups."),r(null);return}Xc.current=pt;let wt=!1;const ps=cr=>{if(cr.origin===window.location.origin){if(cr.data&&cr.data.type==="oauth_test_state"){if(cr.data.status==="redirect")fs.current.has(le.testSessionId)||ol(le.testSessionId,le.provider);else if(cr.data.status==="error"){wt=!0;const lo=sessionStorage.getItem("oauth_test_session");let zm=ae.provider;if(lo)try{zm=JSON.parse(lo).provider||zm}catch{}Kc({success:!1,provider:zm,testSessionId:cr.data.testSessionId,error:cr.data.error||"Failed to start OAuth test"}),window.removeEventListener("message",ps),clearInterval(dh),clearTimeout(Bm),oo()}return}if(cr.data&&cr.data.type==="oauth_test_result"){window.removeEventListener("message",ps),clearInterval(dh),clearTimeout(Bm),wt=!0;const lo=cr.data.result;Kc(lo),fs.current.has(lo.testSessionId)||ol(lo.testSessionId,lo.provider),oo()}}};window.addEventListener("message",ps);const dh=setInterval(()=>{pt.closed&&(clearInterval(dh),clearTimeout(Bm),window.removeEventListener("message",ps),!sessionStorage.getItem(`oauth_test_result_${le.testSessionId}`)&&!wt&&(wt=!0,ol(le.testSessionId,le.provider)))},500),Bm=setTimeout(()=>{pt.closed||(clearInterval(dh),window.removeEventListener("message",ps),oo(),wt||(wt=!0),Ke("error","❌ OAuth test timed out after 5 minutes","failed"),Ke("error","💡 Possible reasons:","failed"),Ke("error"," • Authentication took too long","failed"),Ke("error"," • Provider is not responding","failed"),Ke("error"," • Network connectivity issues","failed"),V.error("OAuth test timed out"),r(null))},5*60*1e3)}else Ke("error",`❌ Failed to initiate OAuth test: ${ae.error||"Unknown error"}`,"failed"),ae.details&&Ke("error",`💡 Details: ${JSON.stringify(ae.details)}`,"failed"),ae.cause&&Ke("error",`💡 Cause: ${ae.cause}`,"failed"),V.error(ae.error||"Failed to start OAuth test"),r(null)}catch(J){Ke("error",`❌ Network error: ${J}`,"failed"),V.error("Failed to start OAuth test"),r(null)}},oP=()=>{b(!0)},DE=async(D,B)=>{const J=vd.find(le=>le.id===D);if(!J){V.error("Unknown migration provider");return}if(J.disabled){V.info(`${J.name} migration is coming soon`);return}b(!1),r("run-migration"),l(!0),i([]);const ae=le=>new Promise(fe=>setTimeout(fe,le));try{if(Ke("info",`🚀 Preparing ${J.name} migration...`,"running"),J.highlights)for(const Je of J.highlights)await ae(350),Ke("progress",Je,"running");Ke("progress","📡 Sending migration payload to server...","running");const fe=await(await fetch("/api/tools/migrations/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:J.id,script:J.custom?B:J.script})})).json();if(fe.success)Ke("progress","🚀 Migration job acknowledged. Follow server logs for live progress.","running"),Ke("success",`✅ ${J.name} migration request accepted.`,"completed"),fe.message&&Ke("info",fe.message,"completed"),V.success(`${J.name} migration flow completed`);else throw new Error(fe.error||"Migration request failed")}catch(le){Ke("error",`❌ Migration failed: ${le}`,"failed"),V.error("Migration failed")}finally{r(null)}},lP=async()=>{r("validate-config"),l(!0),i([]),$(null),k(!0),Ke("info","Validating Better Auth configuration...","running");try{const B=await(await fetch("/api/tools/validate-config",{method:"POST",headers:{"Content-Type":"application/json"}})).json();if(B.success!==void 0)$(B),Ke("info",`Found ${B.summary.total} validation checks`,"completed"),B.summary.errors>0&&Ke("error",`❌ ${B.summary.errors} error(s) found`,"failed"),B.summary.warnings>0&&Ke("progress",`⚠️ ${B.summary.warnings} warning(s) found`,"completed"),B.summary.passes>0&&Ke("success",`✅ ${B.summary.passes} check(s) passed`,"completed"),B.success?V.success("Configuration validation completed successfully"):V.error(`Configuration validation found ${B.summary.errors} error(s)`);else throw new Error(B.error||"Failed to validate configuration")}catch(D){Ke("error",`❌ Configuration validation failed: ${D}`,"failed"),V.error("Configuration validation failed")}finally{r(null)}},cP=async()=>{r("test-db"),l(!0),i([]),Ke("info","Testing database connection...","running");try{const B=await(await fetch("/api/database/test")).json();await new Promise(J=>setTimeout(J,1e3)),Ke("progress","Checking on database con!","running"),B.success?(Ke("success","✅ Database connection successful!","completed"),B.result&&Array.isArray(B.result)&&B.result.length>0&&(Ke("info","📄 Sample user record (first row):","completed"),Ke("info",JSON.stringify(B.result[0],null,2),"completed")),V.success("Database connection test successful")):(Ke("error",`❌ Database connection failed: ${B.error||"Unknown error"}`,"failed"),V.error("Database connection test failed"))}catch(D){Ke("error",`❌ Network error: ${D}`,"failed"),V.error("Failed to test database connection")}finally{r(null)}},dP=D=>{if(!D)return"N/A";const B=new Date(D);return Number.isNaN(B.getTime())?D:B.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})},uP=()=>{ne(!0)},hP=()=>{Be(""),Oe(""),nt(null),Gt(null),et(!0)},fP=()=>{It("1"),sn([]),In(""),sr(null),tt(!0)},pP=()=>{nl(!0),Fn(""),rs(null),os(!1)},mP=async()=>{if(!Ws.trim()){V.error("Please enter a password to check");return}is(!0),rs(null);try{const B=await(await fetch("/api/tools/password-strength",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Ws})})).json();B.success?(rs(B),V.success("Password strength checked")):V.error(B.error||"Failed to check password strength")}catch(D){const B=D instanceof Error?D.message:"Failed to check password strength";V.error(B)}finally{is(!1)}},gP=()=>{ds(!0),Ge(null),ga(32),kr("hex")},xP=async()=>{Ft(!0),Ge(null);try{const D=await fetch("/api/tools/generate-secret",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({length:ea,format:Cr})});if(!D.ok)throw new Error("Failed to generate secret");const B=await D.json();if(B.success)Ge(B),V.success("Secret generated successfully");else throw new Error(B.message||"Failed to generate secret")}catch(D){V.error(D instanceof Error?D.message:"Failed to generate secret"),console.error(D)}finally{Ft(!1)}},bP=async()=>{if(!Se){V.error("Please generate a secret first");return}Ce(!0),Re(null);try{const B=await(await fetch("/api/tools/check-env-secret",{method:"POST",headers:{"Content-Type":"application/json"}})).json();if(B.success&&B.hasExisting){Re({hasExisting:!0,secret:B.existingSecret,path:B.path}),we(!0),Ce(!1);return}await IE("override")}catch(D){const B=D instanceof Error?D.message:"Failed to check secret";V.error(B),Ce(!1)}},IE=async D=>{if(Se){ke(!0),we(!1);try{const J=await(await fetch("/api/tools/write-env-secret",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:Se.secret,action:D})})).json();if(J.success)V.success(`Secret written to ${J.path}`),Re(null);else throw new Error(J.message||"Failed to write secret")}catch(B){const J=B instanceof Error?B.message:"Failed to write secret to .env";V.error(J)}finally{ke(!1),Ce(!1)}}},vP=async()=>{Xs(!0),m("google"),Jn(null),al(!1);try{const B=await(await fetch("/api/config")).json();if(B.baseURL){const J=B.baseURL.replace(/^https?:\/\//,"");Ks(J),Qn(J)}else Ks("localhost:3000"),Qn("localhost:3000")}catch{Ks("localhost:3000"),Qn("localhost:3000")}},yP=async()=>{if(!f){V.error("Please select a provider");return}const D=pa.trim()||Fa;if(!D){V.error("Please enter an origin");return}const B=D.replace(/^https?:\/\//,"");Zs(!0),Jn(null),jr(null);try{const J=await fetch(`https://studio-backend-0.vercel.app/oauth/${f}?origin=${encodeURIComponent(B)}`);if(!J.ok)throw new Error(`Failed to fetch credentials: ${J.statusText}`);const ae=await J.json();if(ae.clientId&&ae.clientSecret)Jn({clientId:ae.clientId,clientSecret:ae.clientSecret}),V.success("OAuth credentials fetched successfully");else throw new Error("Invalid response format")}catch(J){const ae=J instanceof Error?J.message:"Failed to fetch OAuth credentials";V.error(ae)}finally{Zs(!1)}},wP=async()=>{if(!f||!ma){V.error("Please fetch credentials first");return}Ba(!0),jr(null);try{const B=await(await fetch("/api/tools/check-env-credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:f})})).json();if(B.success&&B.hasExisting){or({hasExisting:!0,credentials:B.existingCredentials,path:B.path}),ei(!0),Ba(!1);return}await Pm("override")}catch(D){const B=D instanceof Error?D.message:"Failed to check credentials";V.error(B),Ba(!1)}},Pm=async D=>{if(!(!f||!ma)){ro(!0),jr(null),ei(!1);try{const J=await(await fetch("/api/tools/write-env-credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:f,clientId:ma.clientId,clientSecret:ma.clientSecret,action:D})})).json();if(J.success)jr({success:!0,message:J.message,path:J.path}),V.success(`Credentials written to ${J.path}`),or(null);else throw new Error(J.message||"Failed to write credentials")}catch(B){const J=B instanceof Error?B.message:"Failed to write credentials to .env";jr({success:!1,message:J}),V.error(J)}finally{ro(!1),Ba(!1)}}},NP=()=>{const D=Math.min(Math.max(parseInt(at)||1,1),100),B=[];for(let J=0;J<D;J++)try{const ae=crypto.randomUUID();B.push(ae)}catch{V.error("Failed to generate UUID");return}sn(B),V.success(`Generated ${B.length} UUID(s)`)},SP=()=>{var Gn,pt;const D=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,B=ns.trim();if(!B){sr(null);return}if(!D.test(B)){sr({isValid:!1});return}const ae=B.split("-"),le=(Gn=ae[2])==null?void 0:Gn[0],fe=(pt=ae[3])==null?void 0:pt[0];let Je,yt;if(le){const wt=parseInt(le,16);wt>=1&&wt<=5?Je=`v${wt}`:wt===0&&(Je="v1 (time-based)")}if(fe){const wt=parseInt(fe,16);wt>=8&&wt<=11?yt="RFC 4122":wt>=12&&wt<=15?yt="Microsoft":wt>=0&&wt<=7&&(yt="Reserved")}sr({isValid:!0,version:Je,variant:yt})},EP=()=>{Ze("api_key"),pe(""),_e(""),je("15"),ue(""),Le(`{
1142
1142
 
1143
- }`),Z(null),ce(!0)},jP=async()=>{try{const B=await(await fetch("/api/database/schema")).json();if(B.success&&B.schema&&B.schema.tables){const J=B.schema.tables.map(ae=>({name:ae.name,displayName:ae.displayName||ae.name}));tP(J)}}catch{}},TP=()=>{Om(""),Dm(""),Lm("react"),Nn([]),lr([]),us([]),Mm(!1),ti({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),Vc(null),Yc(null),RE("server"),jP(),ch(!0)},CP=D=>{const B=[...za];B[D].expanded=!B[D].expanded,lr(B)},kP=D=>{const B=[...Ar];B[D].expanded=!B[D].expanded,us(B)},AP=D=>{const B=[...hs];B[D].expanded=!B[D].expanded,io(B)},_P=D=>{if(!Rt)return;const J={react:"better-auth/react",svelte:"better-auth/svelte",solid:"better-auth/solid",vue:"better-auth/vue"}[D]||"better-auth/react",ae=Rt.name.charAt(0).toLowerCase()+Rt.name.slice(1),fe={react:'process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000"',svelte:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"',solid:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"',vue:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"'}[D]||'process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000"',Je=`import { createAuthClient } from "${J}";
1143
+ }`),Q(null),ce(!0)},jP=async()=>{try{const B=await(await fetch("/api/database/schema")).json();if(B.success&&B.schema&&B.schema.tables){const J=B.schema.tables.map(ae=>({name:ae.name,displayName:ae.displayName||ae.name}));tP(J)}}catch{}},TP=()=>{Om(""),Dm(""),Lm("react"),Nn([]),lr([]),us([]),Mm(!1),ti({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),Vc(null),Yc(null),RE("server"),jP(),ch(!0)},CP=D=>{const B=[...za];B[D].expanded=!B[D].expanded,lr(B)},kP=D=>{const B=[...Ar];B[D].expanded=!B[D].expanded,us(B)},AP=D=>{const B=[...hs];B[D].expanded=!B[D].expanded,io(B)},_P=D=>{if(!Rt)return;const J={react:"better-auth/react",svelte:"better-auth/svelte",solid:"better-auth/solid",vue:"better-auth/vue"}[D]||"better-auth/react",ae=Rt.name.charAt(0).toLowerCase()+Rt.name.slice(1),fe={react:'process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000"',svelte:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"',solid:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"',vue:'import.meta.env.PUBLIC_BETTER_AUTH_URL || "http://localhost:5173"'}[D]||'process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000"',Je=`import { createAuthClient } from "${J}";
1144
1144
  import { ${ae}Client } from "./plugin/${ae}/client";
1145
1145
 
1146
1146
  export const authClient = createAuthClient({
@@ -1148,8 +1148,8 @@ export const authClient = createAuthClient({
1148
1148
  plugins: [
1149
1149
  ${ae}Client(),
1150
1150
  ],
1151
- });`;Vc({...Rt,clientSetup:Je})},Fm=D=>{if(!D)return"";const B=D.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return B.length===0?"":B.map((ae,le)=>ae.split("-").map((yt,Gn)=>le===0&&Gn===0?yt.toLowerCase():yt.charAt(0).toUpperCase()+yt.slice(1).toLowerCase()).join("")).join("")},RP=async()=>{if(!sl.trim()){V.error("Please enter a plugin name");return}AE(!0),Yc(null),Vc(null);try{const D=un.filter(fe=>fe.name.trim()&&fe.fields.some(Je=>Je.name.trim())),B=za.filter(fe=>fe.name.trim()&&fe.hookLogic.trim()),J=Ar.filter(fe=>fe.name.trim()&&fe.middlewareLogic.trim()),le=await(await fetch("/api/tools/plugin-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginName:sl.trim(),description:TE.trim()||void 0,clientFramework:OE,tables:D.map(fe=>{var Je;return{name:fe.name.trim(),isExtending:fe.isExtending||!1,extendedTableName:(Je=fe.extendedTableName)==null?void 0:Je.trim(),fields:fe.fields.filter(yt=>yt.name.trim())}}),hooks:B.map(fe=>{var Je,yt;return{name:fe.name.trim(),timing:fe.timing,action:fe.action,customPath:(Je=fe.customPath)==null?void 0:Je.trim(),customMatcher:(yt=fe.customMatcher)==null?void 0:yt.trim(),hookLogic:fe.hookLogic.trim()}}),middleware:J.map(fe=>({name:fe.name.trim(),path:fe.path.trim(),pathType:fe.pathType,middlewareLogic:fe.middlewareLogic.trim()})),endpoints:hs.filter(fe=>fe.name.trim()&&fe.path.trim()).map(fe=>({name:fe.name.trim(),path:fe.path.trim(),method:fe.method,handlerLogic:fe.handlerLogic.trim()})),rateLimit:Im?{path:ta.path.trim(),pathType:ta.pathType,window:ta.window,max:ta.max}:void 0})})).json();if(le.success)Vc(le.plugin),V.success("Plugin generated successfully"),setTimeout(()=>{var fe;(fe=CE.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"})},100);else{const fe=le.error||"Failed to generate plugin";Yc(fe),V.error(fe)}}catch(D){const B=D instanceof Error?D.message:"Failed to generate plugin";Yc(B),V.error(B)}finally{AE(!1)}},OP=async()=>{try{const B=await(await fetch("/api/database/schema")).json();if(B.success&&B.schema&&B.schema.tables){const J=B.schema.tables.map(ae=>({name:ae.name,displayName:ae.displayName||ae.name}));se(J)}}catch{V.error("Failed to fetch available tables")}};p.useEffect(()=>{te&&(OP(),re(new Set))},[te]);const DP=D=>{re(B=>{const J=new Set(B);return J.has(D)?J.delete(D):J.add(D),J})},IP=()=>{re(new Set(X.map(D=>D.name)))},MP=()=>{re(new Set)},LP=async()=>{if(!de.trim()){V.error("Please paste a JWT to decode");return}Ut(!0),Gt(null),nt(null);try{const B=await(await fetch("/api/tools/jwt/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:de.trim(),secret:Ue.trim()||void 0})})).json();if(B.success)nt(B),V.success("JWT decoded successfully");else{const J=B.error||"Failed to decode JWT";Gt(J),V.error(J)}}catch(D){const B=D instanceof Error?D.message:"Failed to decode JWT";Gt(B),V.error(B)}finally{Ut(!1)}},UP=async()=>{const D=parseInt($e,10);if(isNaN(D)||D<=0){V.error("Please provide a valid expiration (minutes)");return}let B;if(Te==="jwt"){const J=Ae.trim();if(J.length>0&&J!=="{"&&J!=="}")try{B=JSON.parse(J)}catch{V.error("Custom claims must be valid JSON");return}}De(!0),Z(null);try{const ae=await(await fetch("/api/tools/token-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:Te,subject:Q||void 0,audience:be||void 0,expiresInMinutes:D,customClaims:B,secretOverride:K||void 0})})).json();if(ae.success)Z(ae),Ke("success",`✅ Generated ${Te.replace("_"," ")} token`,"completed"),V.success("Token generated successfully");else throw new Error(ae.error||"Failed to generate token")}catch(J){const ae=J instanceof Error?J.message:"Failed to generate token";Ke("error",`❌ ${ae}`,"failed"),V.error(ae)}finally{De(!1)}},PP=async()=>{if(Ee.size===0){V.error("Please select at least one table to export");return}const D=parseInt(ze,10);if(isNaN(D)||D<=0){V.error("Please enter a valid limit (greater than 0)");return}if(D>1e4){V.error("Limit cannot exceed 10,000 rows per table");return}Ye(!0),r("export-data"),l(!0),i([]);try{Ke("info",`📦 Starting export of ${Ee.size} table(s)...`,"running"),Ke("progress",`Format: ${xe.toUpperCase()} | Limit: ${D} rows per table`,"running");const J=await(await fetch("/api/tools/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tables:Array.from(Ee),format:xe,limit:D})})).json();if(J.success){Ke("success","✅ Export completed successfully!","completed"),J.rowCounts&&Object.entries(J.rowCounts).forEach(([Je,yt])=>{Ke("info",` • ${Je}: ${yt} rows`,"completed")}),Ke("info",`Downloading ${J.filename}...`,"completed");const ae=new Blob([J.data],{type:J.contentType||(xe==="json"?"application/json":"text/csv")}),le=window.URL.createObjectURL(ae),fe=document.createElement("a");fe.href=le,fe.download=J.filename,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),window.URL.revokeObjectURL(le),V.success("Export downloaded successfully"),ne(!1)}else throw new Error(J.error||"Export failed")}catch(B){Ke("error",`❌ Export failed: ${B instanceof Error?B.message:B}`,"failed"),V.error("Export failed")}finally{Ye(!1),r(null)}},FP=async()=>{r("health-check"),l(!0),i([]),Ke("info","Running Better Auth health check...","running");try{Ke("progress","Testing Better Auth endpoints...","running");const D=await fetch("/api/tools/health-check",{method:"POST"}),B=await D.json();if(!D.ok)throw new Error(B.error||B.message||"Health check failed");B.success?(Ke("success","✅ Better Auth health check passed","completed"),V.success("Health check passed")):(Ke("error","❌ Better Auth health check failed","failed"),B.failedEndpoints&&B.failedEndpoints.length>0&&B.failedEndpoints.forEach(J=>{const ae=J.status?` (Status: ${J.status})`:"",le=J.error?` - ${J.error}`:"";Ke("error",` • Endpoint ${J.endpoint}${ae}${le}`,"failed")}),V.error("Health check failed"))}catch(D){Ke("error",`❌ Health check failed: ${D instanceof Error?D.message:D}`,"failed"),V.error("Health check failed")}finally{r(null)}},BP=new Set(["test-oauth","test-db","hash-password","health-check","export-data","jwt-decoder","token-generator","validate-config","uuid-generator","password-strength","oauth-credentials","secret-generator","plugin-generator"]),zP=[{id:"test-oauth",name:"Test OAuth",description:"Test OAuth provider connections",icon:la,action:sP,category:"oauth"},{id:"hash-password",name:"Hash Password",description:"Generate SHA hashes",icon:wo,action:aP,category:"utilities"},{id:"run-migration",name:"Migrate to Better Auth",description:"Migrate to Better Auth",icon:Rs,action:oP,category:"database"},{id:"test-db",name:"Test Database",description:"Test database connection",icon:Rs,action:cP,category:"database"},{id:"validate-config",name:"Validate Config",description:"Validate Better Auth configuration",icon:Ep,action:lP,category:"utilities"},{id:"health-check",name:"Health Check",description:"Run system health check",icon:DT,action:FP,category:"testing"},{id:"export-data",name:"Export Data",description:"Export database tables to JSON or CSV",icon:Bl,action:uP,category:"database"},{id:"jwt-decoder",name:"JWT Decoder",description:"Inspect tokens and verify claims",icon:Ln,action:hP,category:"utilities"},{id:"token-generator",name:"Token Generator",description:"Mint short-lived test tokens",icon:ec,action:EP,category:"utilities"},{id:"plugin-generator",name:"Plugin Generator",description:"Generate Better Auth plugins",icon:fi,action:TP,category:"utilities"},{id:"uuid-generator",name:"UUID Generator",description:"Generate and validate UUIDs",icon:Uh,action:fP,category:"utilities"},{id:"password-strength",name:"Password Strength Checker",description:"Validate passwords against your config",icon:Jl,action:pP,category:"utilities"},{id:"oauth-credentials",name:"OAuth Credentials",description:"View and test OAuth provider credentials",icon:la,action:vP,category:"oauth"},{id:"secret-generator",name:"Secret Generator",description:"Generate secure AUTH_SECRET for Better Auth",icon:wo,action:gP,category:"utilities"}],$P=[{id:"oauth",name:"OAuth",icon:la},{id:"database",name:"Database",icon:Rs},{id:"testing",name:"Testing",icon:DT},{id:"utilities",name:"Utilities",icon:OU}].map(D=>({...D,tools:zP.filter(B=>B.category===D.id)}));return a.jsxs("div",{className:"space-y-8 bg-black w-full min-h-screen",children:[a.jsxs("div",{className:"w-full flex flex-col",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{className:"pb-8",children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Tools"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Utility tools for managing and testing your Better Auth setup"})]})}),a.jsxs("div",{className:"flex flex-col items-center space-y-8",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),o&&s.length>0&&a.jsxs("div",{className:"mb-6 p-6 gap-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 tracking-wider",children:"Tool Output"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>l(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx(Ki,{title:"Tool Execution Logs",lines:s,isRunning:n!==null,className:"w-full",defaultCollapsed:!1})]}),a.jsx("div",{className:"space-y-8 p-6 gap-8",children:$P.map(D=>a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(D.icon,{className:"w-5 h-5 text-white"}),a.jsx("h2",{className:"text-lg font-light text-white uppercase tracking-wider",children:D.name})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.tools.map(B=>{const J=B.icon,ae=n===B.id,le=BP.has(B.id),fe=!le||n!==null&&n!==B.id||ae;return a.jsxs("button",{onClick:()=>B.action(),disabled:fe,className:`relative flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none transition-colors text-left group ${le?"hover:bg-black/50 disabled:opacity-50 disabled:cursor-not-allowed":"opacity-60 cursor-not-allowed"}`,children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:ae?a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}):a.jsx(J,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:B.name}),a.jsxs("p",{className:"text-xs uppercase font-mono flex items-center text-gray-400",children:[a.jsx(md,{className:"w-4 h-4 mr-2"}),B.description]})]}),!le&&a.jsx("span",{className:"absolute top-2 right-3 text-[10px] font-mono uppercase tracking-[0.2em] text-white/60",children:"Coming Soon"}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]},B.id)})})]},D.id))})]}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Hasher"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Algorithm"}),a.jsxs("select",{value:P,onChange:D=>U(D.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[a.jsx("option",{value:"SHA-256",children:"SHA-256"}),a.jsx("option",{value:"SHA-384",children:"SHA-384"}),a.jsx("option",{value:"SHA-512",children:"SHA-512"})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Encoding"}),a.jsxs("select",{value:F,onChange:D=>G(D.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[a.jsx("option",{value:"hex",children:"Hex"}),a.jsx("option",{value:"base64",children:"Base64"}),a.jsx("option",{value:"base64url",children:"Base64 URL"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Salt (optional)"}),a.jsx(ve,{value:R,onChange:D=>L(D.target.value),placeholder:"e.g. project-specific-salt",className:"mt-2 bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsxs("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:["Salt is prepended (",a.jsx("span",{className:"text-white/80",children:"salt:password"}),")"]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Password"}),a.jsxs("div",{className:"relative mt-2",children:[a.jsx(ve,{type:T?"text":"password",value:E,onChange:D=>j(D.target.value),placeholder:"Enter password",className:"bg-black border border-dashed border-white/20 text-white rounded-none pr-10"}),a.jsx("button",{type:"button",onClick:()=>O(D=>!D),className:"absolute inset-y-0 right-0 px-3 flex items-center text-gray-400 hover:text-white","aria-label":T?"Hide password":"Show password",children:T?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})})]})]})]}),_&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Hash Result"}),a.jsxs("div",{className:"mt-2 flex items-center space-x-2",children:[a.jsx(ve,{value:_,readOnly:!0,className:"flex-1 bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx(z,{variant:"outline",size:"icon",onClick:()=>_&&$a(_),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:rP,disabled:A,className:"rounded-none",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Hashing..."]}):"Hash Password"})]})]})}),c&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-8 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(la,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light",children:"Select OAuth Provider"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{u(!1),m("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"space-y-4",children:h.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(la,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-400 mb-2 text-lg",children:"No OAuth providers configured"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Please configure OAuth providers in your Better Auth configuration"})]}):a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-400 mb-4 uppercase font-mono",children:["Available Providers (",h.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-h-96 overflow-y-auto",children:h.map(D=>a.jsxs("button",{onClick:()=>{m(D.id),setTimeout(()=>{iP(D.id)},100)},className:`w-full flex items-center space-x-4 p-4 border rounded-none transition-all text-left group ${f===D.id?"border-white/50 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/30"}`,children:[a.jsx("div",{className:"flex-shrink-0",children:J6(D.id)}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-white uppercase font-mono font-light text-base",children:D.name||D.id})}),a.jsx(bi,{className:`w-5 h-5 transition-colors flex-shrink-0 ${f===D.id?"text-white":"text-gray-400 group-hover:text-white"}`})]},D.id))}),a.jsx("p",{className:"text-xs text-gray-500 mt-4 font-mono uppercase",children:"Click on a provider to start the OAuth test"})]})}),a.jsx("div",{className:"flex justify-end space-x-3 mt-8 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>{u(!1),m("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"})})]})}),y&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/95 border border-dashed border-white/20 p-8 w-full max-w-5xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Rs,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Select Migration"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>b(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsx("div",{className:"space-y-3",children:vd.map(D=>{const B=(kn==null?void 0:kn.id)===D.id;return a.jsxs("button",{onClick:()=>nP(D.id),disabled:D.disabled,className:`w-full flex items-center space-x-3 p-4 border transition-colors rounded-none text-left ${D.disabled?"border-dashed border-white/10 bg-black/30 cursor-not-allowed opacity-60":B?"border-white/60 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/40"}`,children:[a.jsx("div",{className:"flex-shrink-0 w-10 h-10 bg-white/10 flex items-center justify-center",children:D.logo?D.logo:a.jsx(fi,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-white uppercase font-mono text-sm",children:D.name}),a.jsx("p",{className:"text-xs uppercase text-gray-400 font-mono mt-1 truncate",children:D.description})]}),D.disabled&&a.jsx("span",{className:"text-[10px] font-mono text-gray-400 uppercase",children:"Coming Soon"})]},D.id)})}),a.jsxs("div",{className:"md:col-span-2 space-y-4",children:[a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 flex items-center justify-center",children:kn.logo?kn.logo:a.jsx(fi,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-white -mb-2 text-lg font-light uppercase tracking-wider",children:kn.name}),a.jsx("p",{className:"text-sm mt-0 text-gray-400 uppercase font-mono leading-relaxed",children:kn.description}),a.jsx("div",{className:"flex items-center space-x-2",children:kn.docs&&a.jsx(z,{variant:"ghost",size:"sm",asChild:!0,className:"rounded-none border border-dashed",children:a.jsx("a",{href:kn.docs,target:"_blank",rel:"noreferrer",children:"View Docs"})})})]})]}),kn.highlights&&a.jsx("ul",{className:"space-y-2 text-xs text-gray-300 font-mono bg-black/40 border border-white/10 p-4",children:kn.highlights.map(D=>a.jsxs("li",{className:"flex items-start space-x-2",children:[a.jsx("span",{className:"text-white/60 mt-0.5",children:"•"}),a.jsx("span",{children:D})]},D))}),kn.disabled?a.jsxs("div",{className:"space-y-4 text-gray-400 font-mono text-xs",children:[a.jsx("p",{children:"This migration provider is coming soon."}),a.jsxs("p",{children:["Subscribe to updates at"," ",a.jsx("a",{href:"https://better-auth.com",target:"_blank",rel:"noreferrer",className:"text-white underline",children:"better-auth.com"}),"."]})]}):kn.custom?a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"text-xs uppercase font-mono text-gray-400",children:"Custom Migration Script"}),a.jsx("textarea",{value:v,onChange:D=>g(D.target.value),className:"w-full h-64 bg-black/70 border border-white/10 text-xs text-gray-200 font-mono p-3 rounded-none focus:outline-none focus:ring-0"}),a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"outline",size:"sm",className:"rounded-none",onClick:()=>g(pw),children:"Reset"}),a.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>$a(v),children:[a.jsx(va,{className:"w-4 h-4"}),"Copy Script"]}),a.jsx(z,{className:"rounded-none",onClick:()=>DE("custom",v),children:"Run Custom Script"})]})]}):a.jsxs("div",{className:"space-y-3",children:[kn.script&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs uppercase font-mono text-gray-400",children:[a.jsx("span",{children:"Migration Script Preview"}),a.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>$a(kn.script),children:[a.jsx(va,{className:"w-4 h-4"}),"Copy Script"]})]}),a.jsx("pre",{className:"bg-black/70 border border-white/10 text-[11px] text-green-200 font-mono p-4 overflow-auto leading-relaxed h-64",children:a.jsx("code",{children:kn.script})})]}),a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{className:"rounded-none",onClick:()=>DE(kn.id),children:["Run ",kn.name," Migration"]})})]})]})]})]})}),te&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-3xl max-h-[85vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Bl,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Export Data"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ne(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Export Format"}),a.jsxs("div",{className:"flex space-x-4",children:[a.jsx("button",{onClick:()=>ye("json"),className:`px-4 py-2 border rounded-none transition-colors ${xe==="json"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"JSON"}),a.jsx("button",{onClick:()=>ye("csv"),className:`px-4 py-2 border rounded-none transition-colors ${xe==="csv"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"CSV"})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"export-limit",className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Row Limit Per Table"}),a.jsx(ve,{id:"export-limit",type:"number",value:ze,onChange:D=>He(D.target.value),min:"1",max:"10000",placeholder:"1000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum 10,000 rows per table (default: 1000)"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs(ie,{className:"text-xs uppercase font-mono text-gray-400",children:["Select Tables (",Ee.size," selected)"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:IP,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Select All"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:MP,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Deselect All"})]})]}),a.jsx("div",{className:"border border-dashed border-white/20 rounded-none max-h-64 overflow-y-auto",children:X.length===0?a.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"Loading tables..."}):a.jsx("div",{className:"space-y-0",children:X.map(D=>{const B=Ee.has(D.name);return a.jsx("button",{onClick:()=>DP(D.name),className:`w-full text-left p-3 border-b border-dashed border-white/10 last:border-b-0 transition-colors ${B?"bg-white/10 border-white/30":"hover:bg-white/5"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-white text-sm font-mono",children:D.displayName}),a.jsxs("span",{className:"text-xs text-gray-400 ml-2 font-mono",children:["(",D.name,")"]})]}),B&&a.jsx(Cd,{className:"w-4 h-4 text-white"})]})},D.name)})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>ne(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:PP,disabled:Fe||Ee.size===0,className:"rounded-none",children:Fe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export"]})})]})]})}),ft&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"JWT Decoder"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>et(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"JWT Token"}),a.jsx("textarea",{value:de,onChange:D=>Be(D.target.value),placeholder:"Paste JWT here",className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"HMAC Secret (optional)"}),a.jsx(ve,{value:Ue,onChange:D=>Oe(D.target.value),placeholder:"Defaults to Better Auth secret if omitted",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Be(""),Oe(""),nt(null),Gt(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:LP,disabled:lt,className:"rounded-none",children:lt?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Decoding..."]}):"Decode JWT"})]})]}),Kt&&a.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:Kt}),We&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Signature"}),a.jsx("p",{className:`text-sm ${We.verified?"text-green-400":"text-yellow-300"}`,children:We.verified?"Verified (HS256)":"Not verified"}),a.jsx("p",{className:"text-gray-400 break-all",children:We.signature||"None"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Issued"}),a.jsx("p",{className:"text-white",children:We.issuedAtFormatted||"Unknown"}),a.jsx("p",{className:"text-gray-500",children:We.issuedAgo||""})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),a.jsx("p",{className:`text-white ${We.expired?"text-red-300":""}`,children:We.expiresAtFormatted||"No expiry"}),a.jsx("p",{className:"text-gray-500",children:We.expiresIn||""})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Header"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(JSON.stringify(We.header,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.header,null,2)})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Payload"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(JSON.stringify(We.payload,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.payload,null,2)})]})]}),We.customClaims&&Object.keys(We.customClaims).length>0&&a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Custom Claims"}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.customClaims,null,2)})]})]})]})]})}),_t&&a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Token Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ce(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Token Type"}),a.jsx("div",{className:"flex flex-wrap gap-3",children:[{id:"api_key",label:"API Key"},{id:"jwt",label:"JWT"}].map(D=>a.jsx("button",{onClick:()=>Ze(D.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${Te===D.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.label},D.id))})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject / User ID (optional)"}),a.jsx(ve,{value:Q,onChange:D=>pe(D.target.value),placeholder:"User identifier or email",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Audience (optional)"}),a.jsx(ve,{value:be,onChange:D=>_e(D.target.value),placeholder:"Audience / app id",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Expires In (minutes)"}),a.jsx(ve,{type:"number",value:$e,onChange:D=>je(D.target.value),min:"1",max:"1440",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),Te==="jwt"&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Override Secret (optional)"}),a.jsx(ve,{value:K,onChange:D=>ue(D.target.value),placeholder:"Defaults to Better Auth secret",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]})]}),Te==="jwt"&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Claims (JSON)"}),a.jsx("textarea",{value:Ae,onChange:D=>Le(D.target.value),placeholder:'{"role":"admin"}',className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to include only default claims (iss, sub, aud, exp, iat, jti)."})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Z(null),pe(""),_e(""),Le(`{
1151
+ });`;Vc({...Rt,clientSetup:Je})},Fm=D=>{if(!D)return"";const B=D.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return B.length===0?"":B.map((ae,le)=>ae.split("-").map((yt,Gn)=>le===0&&Gn===0?yt.toLowerCase():yt.charAt(0).toUpperCase()+yt.slice(1).toLowerCase()).join("")).join("")},RP=async()=>{if(!sl.trim()){V.error("Please enter a plugin name");return}AE(!0),Yc(null),Vc(null);try{const D=un.filter(fe=>fe.name.trim()&&fe.fields.some(Je=>Je.name.trim())),B=za.filter(fe=>fe.name.trim()&&fe.hookLogic.trim()),J=Ar.filter(fe=>fe.name.trim()&&fe.middlewareLogic.trim()),le=await(await fetch("/api/tools/plugin-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginName:sl.trim(),description:TE.trim()||void 0,clientFramework:OE,tables:D.map(fe=>{var Je;return{name:fe.name.trim(),isExtending:fe.isExtending||!1,extendedTableName:(Je=fe.extendedTableName)==null?void 0:Je.trim(),fields:fe.fields.filter(yt=>yt.name.trim())}}),hooks:B.map(fe=>{var Je,yt;return{name:fe.name.trim(),timing:fe.timing,action:fe.action,customPath:(Je=fe.customPath)==null?void 0:Je.trim(),customMatcher:(yt=fe.customMatcher)==null?void 0:yt.trim(),hookLogic:fe.hookLogic.trim()}}),middleware:J.map(fe=>({name:fe.name.trim(),path:fe.path.trim(),pathType:fe.pathType,middlewareLogic:fe.middlewareLogic.trim()})),endpoints:hs.filter(fe=>fe.name.trim()&&fe.path.trim()).map(fe=>({name:fe.name.trim(),path:fe.path.trim(),method:fe.method,handlerLogic:fe.handlerLogic.trim()})),rateLimit:Im?{path:ta.path.trim(),pathType:ta.pathType,window:ta.window,max:ta.max}:void 0})})).json();if(le.success)Vc(le.plugin),V.success("Plugin generated successfully"),setTimeout(()=>{var fe;(fe=CE.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"})},100);else{const fe=le.error||"Failed to generate plugin";Yc(fe),V.error(fe)}}catch(D){const B=D instanceof Error?D.message:"Failed to generate plugin";Yc(B),V.error(B)}finally{AE(!1)}},OP=async()=>{try{const B=await(await fetch("/api/database/schema")).json();if(B.success&&B.schema&&B.schema.tables){const J=B.schema.tables.map(ae=>({name:ae.name,displayName:ae.displayName||ae.name}));se(J)}}catch{V.error("Failed to fetch available tables")}};p.useEffect(()=>{te&&(OP(),re(new Set))},[te]);const DP=D=>{re(B=>{const J=new Set(B);return J.has(D)?J.delete(D):J.add(D),J})},IP=()=>{re(new Set(X.map(D=>D.name)))},MP=()=>{re(new Set)},LP=async()=>{if(!de.trim()){V.error("Please paste a JWT to decode");return}Ut(!0),Gt(null),nt(null);try{const B=await(await fetch("/api/tools/jwt/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:de.trim(),secret:Ue.trim()||void 0})})).json();if(B.success)nt(B),V.success("JWT decoded successfully");else{const J=B.error||"Failed to decode JWT";Gt(J),V.error(J)}}catch(D){const B=D instanceof Error?D.message:"Failed to decode JWT";Gt(B),V.error(B)}finally{Ut(!1)}},UP=async()=>{const D=parseInt($e,10);if(isNaN(D)||D<=0){V.error("Please provide a valid expiration (minutes)");return}let B;if(Te==="jwt"){const J=Ae.trim();if(J.length>0&&J!=="{"&&J!=="}")try{B=JSON.parse(J)}catch{V.error("Custom claims must be valid JSON");return}}De(!0),Q(null);try{const ae=await(await fetch("/api/tools/token-generator",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:Te,subject:K||void 0,audience:be||void 0,expiresInMinutes:D,customClaims:B,secretOverride:Z||void 0})})).json();if(ae.success)Q(ae),Ke("success",`✅ Generated ${Te.replace("_"," ")} token`,"completed"),V.success("Token generated successfully");else throw new Error(ae.error||"Failed to generate token")}catch(J){const ae=J instanceof Error?J.message:"Failed to generate token";Ke("error",`❌ ${ae}`,"failed"),V.error(ae)}finally{De(!1)}},PP=async()=>{if(Ee.size===0){V.error("Please select at least one table to export");return}const D=parseInt(ze,10);if(isNaN(D)||D<=0){V.error("Please enter a valid limit (greater than 0)");return}if(D>1e4){V.error("Limit cannot exceed 10,000 rows per table");return}Ye(!0),r("export-data"),l(!0),i([]);try{Ke("info",`📦 Starting export of ${Ee.size} table(s)...`,"running"),Ke("progress",`Format: ${xe.toUpperCase()} | Limit: ${D} rows per table`,"running");const J=await(await fetch("/api/tools/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tables:Array.from(Ee),format:xe,limit:D})})).json();if(J.success){Ke("success","✅ Export completed successfully!","completed"),J.rowCounts&&Object.entries(J.rowCounts).forEach(([Je,yt])=>{Ke("info",` • ${Je}: ${yt} rows`,"completed")}),Ke("info",`Downloading ${J.filename}...`,"completed");const ae=new Blob([J.data],{type:J.contentType||(xe==="json"?"application/json":"text/csv")}),le=window.URL.createObjectURL(ae),fe=document.createElement("a");fe.href=le,fe.download=J.filename,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),window.URL.revokeObjectURL(le),V.success("Export downloaded successfully"),ne(!1)}else throw new Error(J.error||"Export failed")}catch(B){Ke("error",`❌ Export failed: ${B instanceof Error?B.message:B}`,"failed"),V.error("Export failed")}finally{Ye(!1),r(null)}},FP=async()=>{r("health-check"),l(!0),i([]),Ke("info","Running Better Auth health check...","running");try{Ke("progress","Testing Better Auth endpoints...","running");const D=await fetch("/api/tools/health-check",{method:"POST"}),B=await D.json();if(!D.ok)throw new Error(B.error||B.message||"Health check failed");B.success?(Ke("success","✅ Better Auth health check passed","completed"),V.success("Health check passed")):(Ke("error","❌ Better Auth health check failed","failed"),B.failedEndpoints&&B.failedEndpoints.length>0&&B.failedEndpoints.forEach(J=>{const ae=J.status?` (Status: ${J.status})`:"",le=J.error?` - ${J.error}`:"";Ke("error",` • Endpoint ${J.endpoint}${ae}${le}`,"failed")}),V.error("Health check failed"))}catch(D){Ke("error",`❌ Health check failed: ${D instanceof Error?D.message:D}`,"failed"),V.error("Health check failed")}finally{r(null)}},BP=new Set(["test-oauth","test-db","hash-password","health-check","export-data","jwt-decoder","token-generator","validate-config","uuid-generator","password-strength","oauth-credentials","secret-generator","plugin-generator"]),zP=[{id:"test-oauth",name:"Test OAuth",description:"Test OAuth provider connections",icon:la,action:sP,category:"oauth"},{id:"hash-password",name:"Hash Password",description:"Generate SHA hashes",icon:wo,action:aP,category:"utilities"},{id:"run-migration",name:"Migrate to Better Auth",description:"Migrate to Better Auth",icon:Rs,action:oP,category:"database"},{id:"test-db",name:"Test Database",description:"Test database connection",icon:Rs,action:cP,category:"database"},{id:"validate-config",name:"Validate Config",description:"Validate Better Auth configuration",icon:Ep,action:lP,category:"utilities"},{id:"health-check",name:"Health Check",description:"Run system health check",icon:DT,action:FP,category:"testing"},{id:"export-data",name:"Export Data",description:"Export database tables to JSON or CSV",icon:Bl,action:uP,category:"database"},{id:"jwt-decoder",name:"JWT Decoder",description:"Inspect tokens and verify claims",icon:Ln,action:hP,category:"utilities"},{id:"token-generator",name:"Token Generator",description:"Mint short-lived test tokens",icon:ec,action:EP,category:"utilities"},{id:"plugin-generator",name:"Plugin Generator",description:"Generate Better Auth plugins",icon:fi,action:TP,category:"utilities"},{id:"uuid-generator",name:"UUID Generator",description:"Generate and validate UUIDs",icon:Uh,action:fP,category:"utilities"},{id:"password-strength",name:"Password Strength Checker",description:"Validate passwords against your config",icon:Jl,action:pP,category:"utilities"},{id:"oauth-credentials",name:"OAuth Credentials",description:"View and test OAuth provider credentials",icon:la,action:vP,category:"oauth"},{id:"secret-generator",name:"Secret Generator",description:"Generate secure AUTH_SECRET for Better Auth",icon:wo,action:gP,category:"utilities"}],$P=[{id:"oauth",name:"OAuth",icon:la},{id:"database",name:"Database",icon:Rs},{id:"testing",name:"Testing",icon:DT},{id:"utilities",name:"Utilities",icon:OU}].map(D=>({...D,tools:zP.filter(B=>B.category===D.id)}));return a.jsxs("div",{className:"space-y-8 bg-black w-full min-h-screen",children:[a.jsxs("div",{className:"w-full flex flex-col",children:[a.jsx("div",{className:"flex items-center justify-between p-5 pt-7",children:a.jsxs("div",{className:"pb-8",children:[a.jsx("h1",{className:"text-3xl font-normal text-white tracking-tight",children:"Tools"}),a.jsx("p",{className:"text-gray-300 mt-2 uppercase font-mono font-light text-xs",children:"Utility tools for managing and testing your Better Auth setup"})]})}),a.jsxs("div",{className:"flex flex-col items-center space-y-8",children:[a.jsx("hr",{className:"w-full border-white/15 h-px"}),a.jsx("hr",{className:"w-full border-white/15 h-px"})]}),o&&s.length>0&&a.jsxs("div",{className:"mb-6 p-6 gap-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 tracking-wider",children:"Tool Output"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>l(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx(Ki,{title:"Tool Execution Logs",lines:s,isRunning:n!==null,className:"w-full",defaultCollapsed:!1})]}),a.jsx("div",{className:"space-y-8 p-6 gap-8",children:$P.map(D=>a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(D.icon,{className:"w-5 h-5 text-white"}),a.jsx("h2",{className:"text-lg font-light text-white uppercase tracking-wider",children:D.name})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.tools.map(B=>{const J=B.icon,ae=n===B.id,le=BP.has(B.id),fe=!le||n!==null&&n!==B.id||ae;return a.jsxs("button",{onClick:()=>B.action(),disabled:fe,className:`relative flex items-center space-x-4 p-4 bg-black/30 border border-dashed border-white/20 rounded-none transition-colors text-left group ${le?"hover:bg-black/50 disabled:opacity-50 disabled:cursor-not-allowed":"opacity-60 cursor-not-allowed"}`,children:[a.jsx("div",{className:"p-2 bg-white/10 rounded-none group-hover:bg-white/20 transition-colors",children:ae?a.jsx(hn,{className:"w-6 h-6 text-white animate-spin"}):a.jsx(J,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-white font-light mb-1",children:B.name}),a.jsxs("p",{className:"text-xs uppercase font-mono flex items-center text-gray-400",children:[a.jsx(md,{className:"w-4 h-4 mr-2"}),B.description]})]}),!le&&a.jsx("span",{className:"absolute top-2 right-3 text-[10px] font-mono uppercase tracking-[0.2em] text-white/60",children:"Coming Soon"}),a.jsx(bi,{className:"w-4 h-4 text-gray-400 group-hover:text-white transition-colors"})]},B.id)})})]},D.id))})]}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Hasher"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Algorithm"}),a.jsxs("select",{value:P,onChange:D=>U(D.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[a.jsx("option",{value:"SHA-256",children:"SHA-256"}),a.jsx("option",{value:"SHA-384",children:"SHA-384"}),a.jsx("option",{value:"SHA-512",children:"SHA-512"})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Encoding"}),a.jsxs("select",{value:F,onChange:D=>G(D.target.value),className:"mt-2 w-full bg-black border border-dashed border-white/20 text-white px-3 py-2 text-sm focus:outline-none",children:[a.jsx("option",{value:"hex",children:"Hex"}),a.jsx("option",{value:"base64",children:"Base64"}),a.jsx("option",{value:"base64url",children:"Base64 URL"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Salt (optional)"}),a.jsx(ve,{value:R,onChange:D=>L(D.target.value),placeholder:"e.g. project-specific-salt",className:"mt-2 bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsxs("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:["Salt is prepended (",a.jsx("span",{className:"text-white/80",children:"salt:password"}),")"]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Password"}),a.jsxs("div",{className:"relative mt-2",children:[a.jsx(ve,{type:T?"text":"password",value:E,onChange:D=>j(D.target.value),placeholder:"Enter password",className:"bg-black border border-dashed border-white/20 text-white rounded-none pr-10"}),a.jsx("button",{type:"button",onClick:()=>O(D=>!D),className:"absolute inset-y-0 right-0 px-3 flex items-center text-gray-400 hover:text-white","aria-label":T?"Hide password":"Show password",children:T?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})})]})]})]}),_&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Hash Result"}),a.jsxs("div",{className:"mt-2 flex items-center space-x-2",children:[a.jsx(ve,{value:_,readOnly:!0,className:"flex-1 bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx(z,{variant:"outline",size:"icon",onClick:()=>_&&$a(_),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"}),a.jsx(z,{onClick:rP,disabled:A,className:"rounded-none",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Hashing..."]}):"Hash Password"})]})]})}),c&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-8 w-full max-w-2xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(la,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light",children:"Select OAuth Provider"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{u(!1),m("")},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"space-y-4",children:h.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(la,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-400 mb-2 text-lg",children:"No OAuth providers configured"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Please configure OAuth providers in your Better Auth configuration"})]}):a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-400 mb-4 uppercase font-mono",children:["Available Providers (",h.length,")"]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-h-96 overflow-y-auto",children:h.map(D=>a.jsxs("button",{onClick:()=>{m(D.id),setTimeout(()=>{iP(D.id)},100)},className:`w-full flex items-center space-x-4 p-4 border rounded-none transition-all text-left group ${f===D.id?"border-white/50 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/30"}`,children:[a.jsx("div",{className:"flex-shrink-0",children:J6(D.id)}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-white uppercase font-mono font-light text-base",children:D.name||D.id})}),a.jsx(bi,{className:`w-5 h-5 transition-colors flex-shrink-0 ${f===D.id?"text-white":"text-gray-400 group-hover:text-white"}`})]},D.id))}),a.jsx("p",{className:"text-xs text-gray-500 mt-4 font-mono uppercase",children:"Click on a provider to start the OAuth test"})]})}),a.jsx("div",{className:"flex justify-end space-x-3 mt-8 pt-6 border-t border-dashed border-white/10",children:a.jsx(z,{variant:"outline",onClick:()=>{u(!1),m("")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"})})]})}),y&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/95 border border-dashed border-white/20 p-8 w-full max-w-5xl rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Rs,{className:"w-6 h-6 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Select Migration"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>b(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsx("div",{className:"space-y-3",children:vd.map(D=>{const B=(kn==null?void 0:kn.id)===D.id;return a.jsxs("button",{onClick:()=>nP(D.id),disabled:D.disabled,className:`w-full flex items-center space-x-3 p-4 border transition-colors rounded-none text-left ${D.disabled?"border-dashed border-white/10 bg-black/30 cursor-not-allowed opacity-60":B?"border-white/60 bg-white/10":"border-dashed border-white/20 hover:bg-white/5 hover:border-white/40"}`,children:[a.jsx("div",{className:"flex-shrink-0 w-10 h-10 bg-white/10 flex items-center justify-center",children:D.logo?D.logo:a.jsx(fi,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-white uppercase font-mono text-sm",children:D.name}),a.jsx("p",{className:"text-xs uppercase text-gray-400 font-mono mt-1 truncate",children:D.description})]}),D.disabled&&a.jsx("span",{className:"text-[10px] font-mono text-gray-400 uppercase",children:"Coming Soon"})]},D.id)})}),a.jsxs("div",{className:"md:col-span-2 space-y-4",children:[a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"w-12 h-12 bg-white/10 flex items-center justify-center",children:kn.logo?kn.logo:a.jsx(fi,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-white -mb-2 text-lg font-light uppercase tracking-wider",children:kn.name}),a.jsx("p",{className:"text-sm mt-0 text-gray-400 uppercase font-mono leading-relaxed",children:kn.description}),a.jsx("div",{className:"flex items-center space-x-2",children:kn.docs&&a.jsx(z,{variant:"ghost",size:"sm",asChild:!0,className:"rounded-none border border-dashed",children:a.jsx("a",{href:kn.docs,target:"_blank",rel:"noreferrer",children:"View Docs"})})})]})]}),kn.highlights&&a.jsx("ul",{className:"space-y-2 text-xs text-gray-300 font-mono bg-black/40 border border-white/10 p-4",children:kn.highlights.map(D=>a.jsxs("li",{className:"flex items-start space-x-2",children:[a.jsx("span",{className:"text-white/60 mt-0.5",children:"•"}),a.jsx("span",{children:D})]},D))}),kn.disabled?a.jsxs("div",{className:"space-y-4 text-gray-400 font-mono text-xs",children:[a.jsx("p",{children:"This migration provider is coming soon."}),a.jsxs("p",{children:["Subscribe to updates at"," ",a.jsx("a",{href:"https://better-auth.com",target:"_blank",rel:"noreferrer",className:"text-white underline",children:"better-auth.com"}),"."]})]}):kn.custom?a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"text-xs uppercase font-mono text-gray-400",children:"Custom Migration Script"}),a.jsx("textarea",{value:v,onChange:D=>g(D.target.value),className:"w-full h-64 bg-black/70 border border-white/10 text-xs text-gray-200 font-mono p-3 rounded-none focus:outline-none focus:ring-0"}),a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"outline",size:"sm",className:"rounded-none",onClick:()=>g(pw),children:"Reset"}),a.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>$a(v),children:[a.jsx(va,{className:"w-4 h-4"}),"Copy Script"]}),a.jsx(z,{className:"rounded-none",onClick:()=>DE("custom",v),children:"Run Custom Script"})]})]}):a.jsxs("div",{className:"space-y-3",children:[kn.script&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between text-xs uppercase font-mono text-gray-400",children:[a.jsx("span",{children:"Migration Script Preview"}),a.jsxs(z,{variant:"ghost",size:"sm",className:"rounded-none text-gray-400 hover:text-white",onClick:()=>$a(kn.script),children:[a.jsx(va,{className:"w-4 h-4"}),"Copy Script"]})]}),a.jsx("pre",{className:"bg-black/70 border border-white/10 text-[11px] text-green-200 font-mono p-4 overflow-auto leading-relaxed h-64",children:a.jsx("code",{children:kn.script})})]}),a.jsx("div",{className:"flex items-center justify-end space-x-2",children:a.jsxs(z,{className:"rounded-none",onClick:()=>DE(kn.id),children:["Run ",kn.name," Migration"]})})]})]})]})]})}),te&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-3xl max-h-[85vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Bl,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Export Data"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ne(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Export Format"}),a.jsxs("div",{className:"flex space-x-4",children:[a.jsx("button",{onClick:()=>ye("json"),className:`px-4 py-2 border rounded-none transition-colors ${xe==="json"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"JSON"}),a.jsx("button",{onClick:()=>ye("csv"),className:`px-4 py-2 border rounded-none transition-colors ${xe==="csv"?"border-white/50 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/30"}`,children:"CSV"})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"export-limit",className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Row Limit Per Table"}),a.jsx(ve,{id:"export-limit",type:"number",value:ze,onChange:D=>He(D.target.value),min:"1",max:"10000",placeholder:"1000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum 10,000 rows per table (default: 1000)"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs(ie,{className:"text-xs uppercase font-mono text-gray-400",children:["Select Tables (",Ee.size," selected)"]}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:IP,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Select All"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:MP,className:"text-xs text-gray-400 hover:text-white rounded-none",children:"Deselect All"})]})]}),a.jsx("div",{className:"border border-dashed border-white/20 rounded-none max-h-64 overflow-y-auto",children:X.length===0?a.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"Loading tables..."}):a.jsx("div",{className:"space-y-0",children:X.map(D=>{const B=Ee.has(D.name);return a.jsx("button",{onClick:()=>DP(D.name),className:`w-full text-left p-3 border-b border-dashed border-white/10 last:border-b-0 transition-colors ${B?"bg-white/10 border-white/30":"hover:bg-white/5"}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-white text-sm font-mono",children:D.displayName}),a.jsxs("span",{className:"text-xs text-gray-400 ml-2 font-mono",children:["(",D.name,")"]})]}),B&&a.jsx(Cd,{className:"w-4 h-4 text-white"})]})},D.name)})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-8 border-t border-dashed border-white/10 pt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>ne(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:PP,disabled:Fe||Ee.size===0,className:"rounded-none",children:Fe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Exporting..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Bl,{className:"w-4 h-4 mr-2"}),"Export"]})})]})]})}),ft&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"JWT Decoder"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>et(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"JWT Token"}),a.jsx("textarea",{value:de,onChange:D=>Be(D.target.value),placeholder:"Paste JWT here",className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"HMAC Secret (optional)"}),a.jsx(ve,{value:Ue,onChange:D=>Oe(D.target.value),placeholder:"Defaults to Better Auth secret if omitted",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Be(""),Oe(""),nt(null),Gt(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:LP,disabled:lt,className:"rounded-none",children:lt?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Decoding..."]}):"Decode JWT"})]})]}),Kt&&a.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:Kt}),We&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Signature"}),a.jsx("p",{className:`text-sm ${We.verified?"text-green-400":"text-yellow-300"}`,children:We.verified?"Verified (HS256)":"Not verified"}),a.jsx("p",{className:"text-gray-400 break-all",children:We.signature||"None"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Issued"}),a.jsx("p",{className:"text-white",children:We.issuedAtFormatted||"Unknown"}),a.jsx("p",{className:"text-gray-500",children:We.issuedAgo||""})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),a.jsx("p",{className:`text-white ${We.expired?"text-red-300":""}`,children:We.expiresAtFormatted||"No expiry"}),a.jsx("p",{className:"text-gray-500",children:We.expiresIn||""})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Header"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(JSON.stringify(We.header,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.header,null,2)})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs uppercase font-mono text-gray-400",children:"Payload"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(JSON.stringify(We.payload,null,2)),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.payload,null,2)})]})]}),We.customClaims&&Object.keys(We.customClaims).length>0&&a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Custom Claims"}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto max-h-64",children:JSON.stringify(We.customClaims,null,2)})]})]})]})]})}),_t&&a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ec,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Token Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ce(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-3 block",children:"Token Type"}),a.jsx("div",{className:"flex flex-wrap gap-3",children:[{id:"api_key",label:"API Key"},{id:"jwt",label:"JWT"}].map(D=>a.jsx("button",{onClick:()=>Ze(D.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${Te===D.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.label},D.id))})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Subject / User ID (optional)"}),a.jsx(ve,{value:K,onChange:D=>pe(D.target.value),placeholder:"User identifier or email",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Audience (optional)"}),a.jsx(ve,{value:be,onChange:D=>_e(D.target.value),placeholder:"Audience / app id",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Expires In (minutes)"}),a.jsx(ve,{type:"number",value:$e,onChange:D=>je(D.target.value),min:"1",max:"1440",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),Te==="jwt"&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Override Secret (optional)"}),a.jsx(ve,{value:Z,onChange:D=>ue(D.target.value),placeholder:"Defaults to Better Auth secret",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]})]}),Te==="jwt"&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Claims (JSON)"}),a.jsx("textarea",{value:Ae,onChange:D=>Le(D.target.value),placeholder:'{"role":"admin"}',className:"w-full min-h-[120px] bg-black border border-dashed border-white/20 text-white font-mono text-xs p-3 rounded-none focus:outline-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to include only default claims (iss, sub, aud, exp, iat, jti)."})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Q(null),pe(""),_e(""),Le(`{
1152
1152
 
1153
1153
  }`)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),a.jsx(z,{onClick:UP,disabled:oe,className:"rounded-none",children:oe?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Token"})]}),he&&a.jsxs("div",{className:"space-y-4 border border-dashed border-white/15 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Token"}),a.jsx("p",{className:"text-white font-mono text-sm break-all mt-1",children:he.token})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(he.token),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Type"}),a.jsx("p",{className:"text-white mt-1 capitalize",children:he.type.replace("_"," ")})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"Expires"}),a.jsx("p",{className:"text-white mt-1",children:dP(he.expiresAt)})]}),he.url&&a.jsxs("div",{className:"col-span-1",children:[a.jsx("p",{className:"text-gray-400 uppercase tracking-wider",children:"URL"}),a.jsx("p",{className:"text-white mt-1 break-all",children:he.url})]})]}),he.metadata&&a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsx("p",{className:"text-xs uppercase font-mono text-gray-400 mb-2",children:"Metadata"}),a.jsx("pre",{className:"text-[11px] text-gray-100 font-mono bg-black/40 p-3 overflow-x-auto",children:JSON.stringify(he.metadata,null,2)})]})]})]})]})}),Gc&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60]",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-5xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(fi,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Plugin Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ch(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Plugin Name *"}),a.jsx(ve,{value:sl,onChange:D=>Om(D.target.value),placeholder:"myPlugin",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Must to be filled"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Description (optional)"}),a.jsx(ve,{value:TE,onChange:D=>Dm(D.target.value),placeholder:"Plugin description",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to use the default description"})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Tables (optional)"}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Nn([...un,{name:"",isExtending:!1,fields:[{name:"",type:"string",required:!1,unique:!1}]}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Table"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Nn([...un,{name:"",isExtending:!0,extendedTableName:"",fields:[{name:"",type:"string",required:!1,unique:!1}]}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Extend Table"})]})]}),un.length===0?a.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No tables added"}):a.jsx("div",{className:"space-y-2",children:un.map((D,B)=>a.jsxs("div",{className:"border px-5 border-dashed border-white/15 p-3 relative",children:[a.jsxs("div",{className:"flex items-center space-x-2 relative",children:[D.isExtending?a.jsxs(a.Fragment,{children:[a.jsxs(pn,{value:D.extendedTableName||"",onValueChange:J=>{const ae=[...un];ae[B].extendedTableName=J,ae[B].name=J,Nn(ae)},children:[a.jsx(mn,{className:"bg-black sm:w-40 border border-dashed border-white/20 text-white text-xs rounded-none flex-1",children:a.jsx(zn,{className:"sm:text-[11px] text-white/90 font-mono uppercase",placeholder:"Select table"})}),a.jsx(gn,{children:eP.map(J=>a.jsx(Pe,{className:"sm:text-[11px] uppercase font-mono text-white/90 border-b border-dashed last:border-b-0",value:J.name,children:J.displayName},J.name))})]}),a.jsx("span",{className:"text-xs text-gray-400 font-mono uppercase whitespace-nowrap",children:"(Extending)"})]}):a.jsx(ve,{value:D.name,onChange:J=>{const ae=[...un];ae[B].name=J.target.value,Nn(ae)},placeholder:"Table name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{Nn(un.filter((J,ae)=>ae!==B))},className:"text-red-400 hover:text-red-300 rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),D.fields.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute border border-dashed w-px border-white/30",style:{left:"7px",top:"31px",bottom:"12px"}}),a.jsx("div",{className:"absolute border border-dashed h-px w-[11px] border-white/30",style:{left:"9px",top:"31px",bottom:"12px"}}),a.jsx("div",{className:"mt-3 relative",children:a.jsxs("div",{className:"space-y-0 pl-6",children:[D.fields.map((J,ae)=>a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute border border-dashed h-px border-white/30 top-1/2 -translate-y-1/2",style:{left:"-36px",width:"36px"}}),a.jsxs("div",{className:"flex items-center space-x-2 py-1",children:[a.jsx(ve,{value:J.name,onChange:le=>{const fe=[...un];fe[B].fields[ae].name=le.target.value,Nn(fe)},placeholder:"Field name",className:"bg-black border border-dashed border-white/20 text-white text-xs rounded-none flex-1"}),a.jsxs(pn,{value:J.type,onValueChange:le=>{const fe=[...un];fe[B].fields[ae].type=le,Nn(fe)},children:[a.jsx(mn,{className:"sm:h-10 sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1",children:a.jsx(zn,{className:"font-mono uppercase text-[10px] px-0 text-white/90"})}),a.jsxs(gn,{className:"font-mono uppercase text-[10px]",children:[a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"string",children:"string"}),a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"number",children:"number"}),a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"boolean",children:"boolean"}),a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"date",children:"date"})]})]}),J.required&&a.jsxs("div",{className:"flex items-center",children:[J.type==="string"&&a.jsx(ve,{value:J.defaultValue||"",onChange:le=>{const fe=[...un];fe[B].fields[ae].defaultValue=le.target.value,Nn(fe)},placeholder:"Default value",className:"sm:h-10 sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1 font-mono uppercase text-[10px]"}),J.type==="boolean"&&a.jsxs(pn,{value:J.defaultValue||"",onValueChange:le=>{const fe=[...un];fe[B].fields[ae].defaultValue=le,Nn(fe)},children:[a.jsx(mn,{className:"sm:h-10 sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1",children:a.jsx(zn,{className:"font-mono uppercase text-[10px] px-0 text-white/90",placeholder:"Default value"})}),a.jsxs(gn,{className:"font-mono uppercase text-[10px]",children:[a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"true",children:"true"}),a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"false",children:"false"})]})]}),J.type==="date"&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs(pn,{value:J.defaultValue==="now()"?"now()":J.defaultValue&&J.defaultValue!=="now()"?"custom":"",onValueChange:le=>{const fe=[...un];if(le==="now()")fe[B].fields[ae].defaultValue="now()";else if(le==="custom"){if(!fe[B].fields[ae].defaultValue||fe[B].fields[ae].defaultValue==="now()"){const Je=new Date,yt=Je.getFullYear(),Gn=String(Je.getMonth()+1).padStart(2,"0"),pt=String(Je.getDate()).padStart(2,"0"),wt=String(Je.getHours()).padStart(2,"0"),ps=String(Je.getMinutes()).padStart(2,"0");fe[B].fields[ae].defaultValue=`${yt}-${Gn}-${pt}T${wt}:${ps}`}}else fe[B].fields[ae].defaultValue=void 0;Nn(fe)},children:[a.jsx(mn,{className:"sm:h-10 sm:w-40 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1",children:a.jsx(zn,{className:"font-mono uppercase text-[10px] px-0 text-white/90",placeholder:"Default"})}),a.jsxs(gn,{className:"font-mono uppercase text-[10px]",children:[a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"now()",children:"now()"}),a.jsx(Pe,{className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",value:"custom",children:"Custom"})]})]}),J.defaultValue&&J.defaultValue!=="now()"&&a.jsx(ve,{type:"datetime-local",value:J.defaultValue,onChange:le=>{const fe=[...un];fe[B].fields[ae].defaultValue=le.target.value,Nn(fe)},className:"sm:h-10 sm:w-40 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1 font-mono uppercase text-[10px]"})]}),J.type==="number"&&a.jsx(ve,{type:"number",value:J.defaultValue||"",onChange:le=>{const fe=[...un];fe[B].fields[ae].defaultValue=le.target.value,Nn(fe)},placeholder:"Default value",className:"sm:h-10 sm:w-56 border px-0 border-dashed border-white/20 text-white/90 text-xs rounded-none py-1 font-mono uppercase text-[10px]"})]}),a.jsxs("div",{className:"h-8 flex items-end space-x-2",children:[a.jsx(Nf,{id:`required-${B}-${ae}`,checked:J.required,onCheckedChange:le=>{const fe=[...un];fe[B].fields[ae].required=le===!0,le===!1&&(fe[B].fields[ae].defaultValue=void 0),Nn(fe)}}),a.jsx(ie,{htmlFor:`required-${B}-${ae}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Required"})]}),a.jsxs("div",{className:"flex h-8 items-end space-x-2",children:[a.jsx(Nf,{id:`unique-${B}-${ae}`,checked:J.unique,onCheckedChange:le=>{const fe=[...un];fe[B].fields[ae].unique=le===!0,Nn(fe)}}),a.jsx(ie,{htmlFor:`unique-${B}-${ae}`,className:"text-xs text-gray-400 font-mono uppercase cursor-pointer",children:"Unique"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const le=[...un];le[B].fields=le[B].fields.filter((fe,Je)=>Je!==ae),Nn(le)},className:"text-red-400 hover:text-red-300 rounded-none",children:a.jsx(dt,{className:"w-3 h-3"})})]})]},ae)),a.jsxs("div",{className:"relative pt-2",children:[a.jsx("div",{className:"absolute border border-dashed h-px border-white/30",style:{left:"-35px",width:"36px",top:"25px"}}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const J=[...un];J[B].fields.push({name:"",type:"string",required:!1,unique:!1,defaultValue:void 0}),Nn(J)},className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})]})]})})]}),D.fields.length===0&&a.jsx("div",{className:"mt-3",children:a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const J=[...un];J[B].fields.push({name:"",type:"string",required:!1,unique:!1,defaultValue:void 0}),Nn(J)},className:"text-xs text-gray-400 hover:text-white rounded-none",children:"+ Add Field"})})]},B))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Uh,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Hooks"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>lr([...za,{name:"",timing:"before",action:"sign-up",hookLogic:"const context = ctx;",expanded:!0}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Hook"})]}),za.length===0?a.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No hooks added"}):a.jsx("div",{className:"space-y-2",children:za.map((D,B)=>{const J=`${D.timing} ${D.action==="custom"?"custom":D.action}: ${D.name||`Hook ${B+1}`}`;return a.jsxs("div",{className:"border border-dashed border-white/10",children:[a.jsxs("button",{onClick:()=>CP(B),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[a.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:J}),a.jsx(md,{className:`w-4 h-4 text-white/60 transition-transform ${D.expanded?"rotate-90":""}`})]}),D.expanded&&a.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Hook Name"}),a.jsx(ve,{value:D.name,onChange:ae=>{const le=[...za];le[B].name=ae.target.value,lr(le)},placeholder:"e.g., Age Verification, TOS Check",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Timing"}),a.jsxs(t1,{value:D.timing,onValueChange:ae=>{const le=[...za];le[B].timing=ae,lr(le)},className:"flex space-x-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jl,{value:"before",id:`hook-timing-before-${B}`}),a.jsx(ie,{htmlFor:`hook-timing-before-${B}`,className:"text-xs text-white font-mono cursor-pointer",children:"Before"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jl,{value:"after",id:`hook-timing-after-${B}`}),a.jsx(ie,{htmlFor:`hook-timing-after-${B}`,className:"text-xs text-white font-mono cursor-pointer",children:"After"})]})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Action"}),a.jsxs(t1,{value:D.action,onValueChange:ae=>{const le=[...za];le[B].action=ae,lr(le)},className:"flex space-x-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jl,{value:"sign-up",id:`hook-action-signup-${B}`}),a.jsx(ie,{htmlFor:`hook-action-signup-${B}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-up"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jl,{value:"sign-in",id:`hook-action-signin-${B}`}),a.jsx(ie,{htmlFor:`hook-action-signin-${B}`,className:"text-xs text-white font-mono cursor-pointer",children:"Sign-in"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jl,{value:"custom",id:`hook-action-custom-${B}`}),a.jsx(ie,{htmlFor:`hook-action-custom-${B}`,className:"text-xs text-white font-mono cursor-pointer",children:"Custom"})]})]})]})]}),D.action==="custom"&&a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Path"}),a.jsx(ve,{value:D.customPath||"",onChange:ae=>{const le=[...za];le[B].customPath=ae.target.value,lr(le)},placeholder:"/my-plugin/custom-endpoint",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Custom Matcher (optional)"}),a.jsx(ve,{value:D.customMatcher||"",onChange:ae=>{const le=[...za];le[B].customMatcher=ae.target.value,lr(le)},placeholder:"e.g., context.headers.get('x-custom') === 'value'",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Leave empty to use default path matching"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.jsx(fi,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Hook Logic (TypeScript)"})]}),a.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the hook is triggered. This function has properties like ctx so you can access the request context, headers, body, etc. Here is a simple example of a hook logic:"}),a.jsx(hw,{value:D.hookLogic,onChange:ae=>{const le=[...za];le[B].hookLogic=ae,lr(le)},language:"typescript",placeholder:"const context = ctx;",className:"w-full"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{lr(za.filter((ae,le)=>le!==B))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[a.jsx(dt,{className:"w-4 h-4 mr-2"}),"Remove Hook"]})]})]},B)})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>us([...Ar,{name:"",path:"/my-plugin/protected",pathType:"exact",middlewareLogic:"const context = ctx;",expanded:!0}]),className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Middleware"})]}),Ar.length===0?a.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No middleware added"}):a.jsx("div",{className:"space-y-2",children:Ar.map((D,B)=>{const J=`${D.path}: ${D.name||`Middleware ${B+1}`}`;return a.jsxs("div",{className:"border border-dashed border-white/10",children:[a.jsxs("button",{onClick:()=>kP(B),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[a.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:J}),a.jsx(md,{className:`w-4 h-4 text-white/60 transition-transform ${D.expanded?"rotate-90":""}`})]}),D.expanded&&a.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Middleware Name"}),a.jsx(ve,{value:D.name,onChange:ae=>{const le=[...Ar];le[B].name=ae.target.value,us(le)},placeholder:"e.g., Auth Check, Rate Limiter",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),a.jsx(ve,{value:D.path,onChange:ae=>{const le=[...Ar];le[B].path=ae.target.value,us(le)},placeholder:"/my-plugin/protected",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),a.jsxs(pn,{value:D.pathType,onValueChange:ae=>{const le=[...Ar];le[B].pathType=ae,us(le)},children:[a.jsx(mn,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:a.jsx(zn,{})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"exact",children:"Exact Match"}),a.jsx(Pe,{value:"prefix",children:"Prefix Match"}),a.jsx(Pe,{value:"regex",children:"Regex Match"})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.jsx(fi,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Middleware Logic (TypeScript)"})]}),a.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the middleware is triggered. You can access the request context, headers, body, etc."}),a.jsx(hw,{value:D.middlewareLogic,onChange:ae=>{const le=[...Ar];le[B].middlewareLogic=ae,us(le)},language:"typescript",placeholder:"const context = ctx;",className:"w-full"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{us(Ar.filter((ae,le)=>le!==B))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[a.jsx(dt,{className:"w-4 h-4 mr-2"}),"Remove Middleware"]})]})]},B)})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ec,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Endpoints"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{const D="/my-plugin/endpoint",B=Fm(D);io([...hs,{name:B,path:D,method:"POST",handlerLogic:`// Endpoint handler logic here
1154
1154
  return ctx.json({ success: true });`,expanded:!0}])},className:"text-xs uppercase font-mono text-gray-400 hover:text-white rounded-none",children:"+ Add Endpoint"})]}),hs.length===0?a.jsx("p",{className:"text-xs text-gray-500 font-mono",children:"No endpoints added"}):a.jsx("div",{className:"space-y-2",children:hs.map((D,B)=>{const J=`${D.method} ${D.path}: ${D.name||Fm(D.path)||`Endpoint ${B+1}`}`;return a.jsxs("div",{className:"border border-dashed border-white/10",children:[a.jsxs("button",{onClick:()=>AP(B),className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[a.jsx("span",{className:"text-xs font-mono text-white px-2 py-1 bg-black/40 border border-dashed border-white/20 rounded-none",children:J}),a.jsx(md,{className:`w-4 h-4 text-white/60 transition-transform ${D.expanded?"rotate-90":""}`})]}),D.expanded&&a.jsxs("div",{className:"border-t border-dashed border-white/10 p-4 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),a.jsx(ve,{value:D.path,onChange:ae=>{const le=ae.target.value,fe=Fm(le),Je=[...hs];Je[B].path=le,Je[B].name=fe,io(Je)},placeholder:"/sign-in/anonymous",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Endpoint Name (Auto-generated)"}),a.jsx(ve,{value:D.name,readOnly:!0,className:"bg-black/50 border border-dashed border-white/10 text-white/70 rounded-none cursor-not-allowed"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Generated from path"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Method"}),a.jsxs(pn,{value:D.method,onValueChange:ae=>{const le=[...hs];le[B].method=ae,io(le)},children:[a.jsx(mn,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:a.jsx(zn,{})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"GET",children:"GET"}),a.jsx(Pe,{value:"POST",children:"POST"})]})]})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.jsx(fi,{className:"w-4 h-4 text-white"}),a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Handler Logic (TypeScript)"})]}),a.jsx("p",{className:"text-xs text-gray-400 mb-2 font-mono",children:"This is the TypeScript code that will be executed when the endpoint is called. You can access the context via ctx parameter."}),a.jsx(hw,{value:D.handlerLogic,onChange:ae=>{const le=[...hs];le[B].handlerLogic=ae,io(le)},language:"typescript",placeholder:"// Endpoint handler logic here\\nreturn ctx.json({ success: true });",className:"w-full"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{io(hs.filter((ae,le)=>le!==B))},className:"w-full border border-dashed border-red-500/50 text-red-400 hover:bg-red-500/10 rounded-none",children:[a.jsx(dt,{className:"w-4 h-4 mr-2"}),"Remove Endpoint"]})]})]},B)})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[a.jsx(Nf,{id:"rate-limit",checked:Im,onCheckedChange:D=>Mm(D===!0)}),a.jsx(ie,{htmlFor:"rate-limit",className:"text-xs uppercase font-mono text-gray-400 cursor-pointer",children:"Enable Rate Limiting"})]}),Im&&a.jsxs("div",{className:"border border-dashed border-white/10 p-4 space-y-4 mt-3",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path"}),a.jsx(ve,{value:ta.path,onChange:D=>{ti({...ta,path:D.target.value})},placeholder:"/my-plugin/*",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Path Type"}),a.jsxs(pn,{value:ta.pathType,onValueChange:D=>{ti({...ta,pathType:D})},children:[a.jsx(mn,{className:"bg-black border border-dashed border-white/20 text-white rounded-none",children:a.jsx(zn,{})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"exact",children:"Exact Match"}),a.jsx(Pe,{value:"prefix",children:"Prefix Match"}),a.jsx(Pe,{value:"regex",children:"Regex Match"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Window (ms)"}),a.jsx(ve,{type:"number",value:ta.window||"",onChange:D=>{const B=D.target.value;ti({...ta,window:B===""?0:parseInt(B,10)||0})},onBlur:D=>{(!D.target.value||parseInt(D.target.value,10)<=0)&&ti({...ta,window:15*60*1e3})},placeholder:"900000",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Time window in milliseconds (e.g., 900000 = 15 minutes)"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Max Requests"}),a.jsx(ve,{type:"number",value:ta.max||"",onChange:D=>{const B=D.target.value;ti({...ta,max:B===""?0:parseInt(B,10)||0})},onBlur:D=>{(!D.target.value||parseInt(D.target.value,10)<=0)&&ti({...ta,max:100})},placeholder:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 mt-1 font-mono",children:"Maximum requests per window"})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Om(""),Dm(""),Lm("react"),Nn([]),lr([]),us([]),io([]),Mm(!1),ti({path:"/my-plugin/*",pathType:"prefix",window:15*60*1e3,max:100}),Vc(null),Yc(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Reset"}),a.jsx(z,{onClick:RP,disabled:kE||!sl.trim(),className:"rounded-none",children:kE?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Plugin"})]}),_E&&a.jsx("div",{className:"border border-dashed border-red-500/30 bg-red-500/10 text-red-300 text-xs font-mono p-3 rounded-none",children:_E}),Rt&&a.jsxs("div",{ref:CE,className:"space-y-4 border border-dashed border-white/15 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("p",{className:"text-xs uppercase font-mono text-gray-400",children:"Generated Code"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[ni==="clientSetup"&&a.jsxs("div",{className:"flex items-center space-x-2 mr-2",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 whitespace-nowrap",children:"Framework:"}),a.jsxs(pn,{value:OE,onValueChange:D=>{Lm(D),_P(D)},children:[a.jsx(mn,{className:"bg-black sm:w-56 border border-dashed border-white/20 text-white rounded-none w-[220px] h-10 text-xs font-mono uppercase px-4 py-2",children:a.jsx(zn,{className:"font-mono uppercase text-xs text-white"})}),a.jsxs(gn,{className:"font-mono uppercase text-[10px] bg-black border border-dashed border-white/20",children:[a.jsxs(Pe,{value:"react",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","React"]}),a.jsxs(Pe,{value:"svelte",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Svelte"]}),a.jsxs(Pe,{value:"solid",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Solid"]}),a.jsxs(Pe,{value:"vue",className:"sm:text-[11px] text-white/90 border-b border-dashed last:border-b-0",children:[" ","Vue"]})]})]})]}),a.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{var Je,yt,Gn,pt,wt;const D=Rt[ni],B=((wt=[{id:"server",path:((Je=Rt.filePaths)==null?void 0:Je.server)||`plugin/${Rt.name}/index.ts`},{id:"client",path:((yt=Rt.filePaths)==null?void 0:yt.client)||`plugin/${Rt.name}/client/index.ts`},{id:"serverSetup",path:((Gn=Rt.filePaths)==null?void 0:Gn.serverSetup)||"auth.ts"},{id:"clientSetup",path:((pt=Rt.filePaths)==null?void 0:pt.clientSetup)||"auth-client.ts"}].find(ps=>ps.id===ni))==null?void 0:wt.path)||`${Rt.name}-${ni}.ts`,J=new Blob([D],{type:"text/plain"}),ae=window.URL.createObjectURL(J),le=document.createElement("a");le.href=ae;const fe=B.split("/").pop()||B;le.download=fe,document.body.appendChild(le),le.click(),document.body.removeChild(le),window.URL.revokeObjectURL(ae)},className:"text-gray-400 hover:text-white rounded-none",children:[a.jsx(Bl,{className:"w-4 h-4 mr-1"}),"Download"]})]})]}),a.jsx("div",{className:"flex space-x-2 border-b border-dashed border-white/10",children:[{id:"server",label:"Server Plugin",path:((ME=Rt.filePaths)==null?void 0:ME.server)||`plugin/${Rt.name}/index.ts`},{id:"client",label:"Client Plugin",path:((LE=Rt.filePaths)==null?void 0:LE.client)||`plugin/${Rt.name}/client/index.ts`},{id:"serverSetup",label:"Server Setup",path:((UE=Rt.filePaths)==null?void 0:UE.serverSetup)||"auth.ts"},{id:"clientSetup",label:"Client Setup",path:((PE=Rt.filePaths)==null?void 0:PE.clientSetup)||"auth-client.ts"}].map(D=>a.jsx("button",{onClick:()=>RE(D.id),className:`px-3 py-2 text-xs uppercase font-mono border-b-2 transition-colors ${ni===D.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white"}`,title:D.path,children:D.label},D.id))}),a.jsx("div",{className:"border border-dashed border-white/10",children:a.jsx(w6,{code:Rt[ni],language:"typescript",fileName:((HE=[{id:"server",path:((FE=Rt.filePaths)==null?void 0:FE.server)||`plugin/${Rt.name}/index.ts`},{id:"client",path:((BE=Rt.filePaths)==null?void 0:BE.client)||`plugin/${Rt.name}/client/index.ts`},{id:"serverSetup",path:((zE=Rt.filePaths)==null?void 0:zE.serverSetup)||"auth.ts"},{id:"clientSetup",path:(($E=Rt.filePaths)==null?void 0:$E.clientSetup)||"auth-client.ts"}].find(D=>D.id===ni))==null?void 0:HE.path)||`${Rt.name}-${ni}.ts`})})]})]})]})}),q&&M&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 overflow-hidden",onClick:D=>{D.target===D.currentTarget&&(k(!1),$(null))},children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:D=>D.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Ep,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Configuration Validator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{k(!1),$(null)},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"mb-6 p-4 border border-dashed border-white/10",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Summary"}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[a.jsx("div",{className:"text-2xl font-mono text-white",children:M.summary.total}),a.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Total Checks"})]}),a.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[a.jsx("div",{className:"text-2xl font-mono text-white",children:M.summary.passes}),a.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Passed"})]}),a.jsxs("div",{className:"text-left border-r border-dashed border-white/10 pr-4 last:border-r-0",children:[a.jsx("div",{className:"text-2xl font-mono text-white",children:M.summary.errors}),a.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Errors"})]}),a.jsxs("div",{className:"text-left",children:[a.jsx("div",{className:"text-2xl font-mono text-white",children:M.summary.warnings}),a.jsx("div",{className:"text-xs text-gray-400 uppercase mt-1 font-mono",children:"Warnings"})]})]})]}),a.jsx("div",{className:"space-y-4",children:Object.entries(M.results.reduce((D,B)=>(D[B.category]||(D[B.category]=[]),D[B.category].push(B),D),{})).map(([D,B])=>{if(D==="OAuth Providers"){const J=B.reduce((ae,le)=>{const fe=le.check.match(/^(.+?)\s*-\s*(.+)$/);if(fe){const Je=fe[1],yt=fe[2];ae[Je]||(ae[Je]=[]),ae[Je].push({...le,check:yt})}else ae.General||(ae.General=[]),ae.General.push(le);return ae},{});return a.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[a.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[D,a.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",B.length," check",B.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(J).map(([ae,le])=>{const fe=W.has(ae),Je=le.some(pt=>pt.severity==="error"),yt=le.some(pt=>pt.severity==="warning"),Gn=le.every(pt=>pt.status==="pass");return a.jsxs("div",{className:"border border-dashed border-white/10",children:[a.jsxs("button",{onClick:()=>{Y(pt=>{const wt=new Set(pt);return wt.has(ae)?wt.delete(ae):wt.add(ae),wt})},className:"w-full flex items-center justify-between p-3 hover:bg-white/5 transition-colors text-left",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(md,{className:`w-4 h-4 text-white/60 transition-transform ${fe?"rotate-90":""}`}),a.jsx("span",{className:"text-white font-mono text-sm",children:ae}),a.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:["(",le.length," check",le.length!==1?"s":"",")"]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[Je&&a.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Error"}),yt&&!Je&&a.jsx("span",{className:"text-xs text-white/60 font-mono",children:"Warning"}),Gn&&!Je&&!yt&&a.jsx(Cd,{className:"w-4 h-4 text-white/60"})]})]}),fe&&a.jsx("div",{className:"border-t border-dashed border-white/10 space-y-2 p-2",children:le.map((pt,wt)=>a.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${pt.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"mt-0.5",children:pt.severity==="error"?a.jsx(Ns,{className:"w-4 h-4 text-white/60"}):pt.severity==="warning"?a.jsx(wl,{className:"w-4 h-4 text-white/60"}):pt.status==="pass"?a.jsx(Cd,{className:"w-4 h-4 text-white/60"}):a.jsx(zl,{className:"w-4 h-4 text-white/40"})}),a.jsxs("div",{className:"flex-1 text-left",children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[a.jsx("span",{className:"text-white font-mono text-sm",children:pt.check}),a.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:pt.status.toUpperCase()})]}),a.jsx("p",{className:"text-gray-300 text-sm",children:pt.message}),pt.suggestion&&a.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),a.jsx("p",{className:"text-xs text-gray-300",children:pt.suggestion})]})]})]})},`${ae}-${pt.check}-${wt}`))})]},ae)})})]},D)}return a.jsxs("div",{className:"border border-dashed border-white/10 p-4",children:[a.jsxs("h4",{className:"text-white font-mono uppercase text-xs mb-4 text-left",children:[D,a.jsxs("span",{className:"text-gray-500 font-normal ml-2",children:["(",B.length," check",B.length!==1?"s":"",")"]})]}),a.jsx("div",{className:"space-y-3",children:B.map((J,ae)=>a.jsx("div",{className:`p-3 border-l border-dashed border-white/15 ${J.status==="pass"?"bg-green-600/[8%]":"bg-red-600/[8%]"}`,children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"mt-0.5",children:J.severity==="error"?a.jsx(Ns,{className:"w-4 h-4 text-white/60"}):J.severity==="warning"?a.jsx(wl,{className:"w-4 h-4 text-white/60"}):J.status==="pass"?a.jsx(Cd,{className:"w-4 h-4 text-white/60"}):a.jsx(zl,{className:"w-4 h-4 text-white/40"})}),a.jsxs("div",{className:"flex-1 text-left",children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[a.jsx("span",{className:"text-white font-mono text-sm",children:J.check}),a.jsx("span",{className:"text-xs px-2 py-0.5 border border-dashed border-white/20 text-white/60 font-mono",children:J.status.toUpperCase()})]}),a.jsx("p",{className:"text-gray-300 text-sm",children:J.message}),J.suggestion&&a.jsxs("div",{className:"mt-2 p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("p",{className:"text-xs text-gray-400 uppercase mb-1 font-mono",children:"Suggestion"}),a.jsx("p",{className:"text-xs text-gray-300",children:J.suggestion})]})]})]})},`${J.category}-${J.check}-${ae}`))})]},D)})}),a.jsx("div",{className:"mt-6 flex justify-end",children:a.jsx(z,{variant:"outline",onClick:()=>{k(!1),$(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),it&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",onClick:D=>{D.target===D.currentTarget&&tt(!1)},children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",onClick:D=>D.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Uh,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"UUID Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>tt(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generate UUIDs"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Count (1-100)"}),a.jsx(ve,{type:"number",value:at,onChange:D=>{const B=D.target.value;if(B===""){It("");return}const J=parseInt(B);isNaN(J)||It(B)},onBlur:D=>{const B=D.target.value,J=parseInt(B);isNaN(J)||J<1?It("1"):J>100?It("100"):It(String(J))},min:"1",max:"100",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{It("1"),sn([])},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:NP,className:"rounded-none",children:"Generate UUIDs"})]})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Validate UUID"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx("div",{children:a.jsx(ve,{value:ns,onChange:D=>{In(D.target.value)},onBlur:SP,placeholder:"Paste UUID to validate",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"})}),a.jsx("div",{className:"flex items-end justify-end space-x-2",children:a.jsx(z,{variant:"outline",onClick:()=>{In(""),sr(null)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"})})]}),qn&&a.jsx("div",{className:`mt-2 border border-dashed p-3 rounded-none ${qn.isValid?"border-white/10 bg-black/40":"border-red-500/30 bg-red-500/10"}`,children:a.jsxs("div",{className:"text-xs font-mono space-y-1",children:[a.jsx("div",{className:`${qn.isValid?"text-green-400":"text-red-300"}`,children:qn.isValid?"✓ Valid UUID":"✗ Invalid UUID"}),qn.isValid&&qn.version&&a.jsxs("div",{className:"text-gray-400",children:["Version: ",qn.version]}),qn.isValid&&qn.variant&&a.jsxs("div",{className:"text-gray-400",children:["Variant: ",qn.variant]})]})})]}),wn.length>0&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400",children:"Generated UUIDs"}),a.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>$a(wn.join(`
1155
- `)),className:"text-gray-400 hover:text-white rounded-none",children:[a.jsx(va,{className:"w-4 h-4 mr-1"}),"Copy All"]})]}),a.jsx("div",{className:"border border-dashed border-white/10 p-3",children:a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:wn.map((D,B)=>a.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("span",{className:"text-white font-mono text-xs break-all",children:D}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(D),className:"text-gray-400 hover:text-white rounded-none ml-2",children:a.jsx(va,{className:"w-3 h-3"})})]},B))})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Version"}),a.jsx("p",{className:"text-white text-sm",children:"v4 (Random)"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"Cryptographically random"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),a.jsx("p",{className:"text-white text-sm",children:"8-4-4-4-12"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"36 characters"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Standard"}),a.jsx("p",{className:"text-white text-sm",children:"RFC 4122"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"Universally unique"})]})]})]})]})}),as&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Strength Checker"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>nl(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{type:Sr?"text":"password",value:Ws,onChange:D=>Fn(D.target.value),placeholder:"Enter password to check",className:"w-full bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>os(!Sr),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:Sr?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Fn(""),rs(null),os(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:mP,disabled:ss||!Ws.trim(),className:"rounded-none",children:ss?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):"Check Strength"})]}),Mt&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Strength"}),a.jsx("p",{className:`text-sm font-medium ${Mt.strength==="very-strong"?"text-green-400":Mt.strength==="strong"?"text-green-300":Mt.strength==="good"?"text-yellow-300":Mt.strength==="fair"?"text-orange-300":"text-red-300"}`,children:Mt.strength.split("-").map(D=>D.charAt(0).toUpperCase()+D.slice(1)).join(" ")}),a.jsx("div",{className:"w-full bg-black/40 h-2 rounded-none",children:a.jsx("div",{className:`h-full transition-all ${Mt.strength==="very-strong"?"bg-green-400 w-full":Mt.strength==="strong"?"bg-green-300 w-4/5":Mt.strength==="good"?"bg-yellow-300 w-3/5":Mt.strength==="fair"?"bg-orange-300 w-2/5":"bg-red-300 w-1/5"}`})})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Score"}),a.jsxs("p",{className:"text-white text-sm",children:[Mt.score," / 5"]}),a.jsx("p",{className:"text-gray-500 text-xs",children:Mt.score===5?"Excellent":Mt.score===4?"Very Good":Mt.score===3?"Good":Mt.score===2?"Fair":"Weak"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Config Match"}),a.jsx("p",{className:`text-sm ${Mt.meetsConfig?"text-green-400":"text-red-300"}`,children:Mt.meetsConfig?"✓ Meets Requirements":"✗ Fails Requirements"}),a.jsxs("p",{className:"text-gray-500 text-xs",children:[Mt.configRequirements.minLength," -"," ",Mt.configRequirements.maxLength," chars"]})]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Checks"}),a.jsx("div",{className:"space-y-2",children:Mt.checks.map((D,B)=>a.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("span",{className:"text-white font-mono text-xs",children:D.name}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("span",{className:`text-xs font-mono ${D.passed?"text-green-400":"text-red-300"}`,children:D.passed?"✓":"✗"}),a.jsx("span",{className:"text-xs text-gray-400 font-mono",children:D.message})]})]},B))})]})]})]})]})}),Er&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"OAuth Credentials"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Xs(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Select Provider"}),a.jsx("div",{className:"flex flex-wrap gap-3",children:["google","github"].map(D=>{const B=f===D;return a.jsx("button",{onClick:()=>m(D),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${B?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.charAt(0).toUpperCase()+D.slice(1)},D)})})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Origin"}),a.jsx(ve,{value:pa,onChange:D=>Qn(D.target.value),placeholder:`http://${Fa}`,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),a.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:["The default will be http://",Fa]})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Jn(null),Qn(Fa)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:yP,disabled:ir||!f||!pa.trim()&&!Fa,className:"rounded-none",children:ir?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Fetching..."]}):"Fetch Credentials"})]}),ma&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client ID"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:ma.clientId,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(ma.clientId),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client Secret"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{type:Qs?"text":"password",value:ma.clientSecret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-20 rounded-none"}),a.jsxs("div",{className:"absolute right-0 top-0 h-full flex items-center",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>al(!Qs),className:"px-2 text-gray-400 hover:text-white rounded-none",children:Qs?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(ma.clientSecret),className:"px-2 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-dashed border-white/10",children:[a.jsx("div",{className:"flex-1",children:xt&&a.jsx("div",{className:"text-xs font-mono",children:xt.success?a.jsxs("span",{className:"text-green-400 uppercase",children:["✓ ",xt.message.toLowerCase(),a.jsxs("span",{className:"block normal-case text-gray-400",children:[a.jsx("span",{className:"text-gray-400 mr-1",children:">"})," ",xt.path]})]}):a.jsxs("span",{className:"text-red-300",children:["✗ ",xt.message]})})}),a.jsx(z,{onClick:wP,disabled:Js||cs,className:"rounded-none",children:cs?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):Js?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Uh,{className:"w-4 h-4 mr-2"}),"Write to .env"]})})]})]})]})]})}),so&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Secret Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ds(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Length (bytes)"}),a.jsx(ve,{type:"number",value:ea===0?"":ea,onChange:D=>{const B=D.target.value;if(B===""){ga(0);return}const J=parseInt(B,10);isNaN(J)||ga(J)},onBlur:D=>{const B=parseInt(D.target.value,10);isNaN(B)||B<16?ga(32):B>128?ga(128):ga(B)},min:"16",max:"128",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:"Recommended: 32 bytes (256 bits)"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Format"}),a.jsx("div",{className:"flex gap-3",children:[{id:"hex",label:"Hex"},{id:"base64",label:"Base64"}].map(D=>a.jsx("button",{onClick:()=>kr(D.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors flex-1 ${Cr===D.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.label},D.id))})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Ge(null),ga(32),kr("hex")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:xP,disabled:Pt,className:"rounded-none",children:Pt?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Secret"})]}),Se&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Length"}),a.jsxs("p",{className:"text-white text-sm",children:[Se.length," bytes"]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Entropy"}),a.jsxs("p",{className:"text-white text-sm",children:[Se.entropy," bits"]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),a.jsx("p",{className:"text-white text-sm uppercase",children:Se.format})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generated Secret"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:Se.secret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(Se.secret),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-3 h-3"})})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Environment Variable Format"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:Se.envFormat,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(Se.envFormat),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-3 h-3"})})]}),a.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-2",children:["Add this to your ",a.jsx("code",{className:"text-gray-400",children:".env"})," file. Keep it secret and never commit it to version control."]})]}),a.jsx("div",{className:"flex justify-end space-x-2 pt-2",children:a.jsx(z,{variant:"outline",onClick:bP,disabled:me||Ie,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:me||Ie?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),Ie?"Writing...":"Checking..."]}):"Write to .env"})}),a.jsx("div",{className:"border border-dashed border-white/20 bg-black text-gray-300 text-xs font-mono p-3 rounded-none",children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx(wl,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-gray-400"}),a.jsxs("div",{children:[a.jsx("div",{className:"uppercase font-mono mb-2 text-gray-400 tracking-wider",children:"Security Best Practices"}),a.jsxs("ul",{className:"list-disc list-inside space-y-1 text-[11px] text-gray-300",children:[a.jsx("li",{children:"Use a minimum of 32 bytes (256 bits) for production"}),a.jsx("li",{children:"Store secrets in environment variables, never in code"}),a.jsx("li",{children:"Use different secrets for development and production"}),a.jsx("li",{children:"Rotate secrets periodically for enhanced security"})]})]})]})})]})]})]})}),Tr&&ls&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[70] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wl,{className:"w-5 h-5 text-yellow-400"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Overwrite Existing Credentials?"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{ei(!1),or(null),Ba(!1)},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"border border-dashed border-white/20 p-4",children:[a.jsxs("p",{className:"text-sm border-b border-dashed border-white/20 pb-5 text-gray-300 font-mono mb-3",children:["The following"," ",a.jsx("span",{className:"text-white uppercase",children:(f==null?void 0:f.charAt(0).toUpperCase())+(f==null?void 0:f.slice(1))})," ","credentials already exist in"," ",a.jsx("span",{className:"text-gray-400 normal-case",children:ls.path}),":"]}),a.jsx("div",{className:"space-y-2 pt-2",children:Object.entries(ls.credentials).map(([D,B])=>a.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[a.jsx("span",{className:"text-gray-400 uppercase",children:D}),a.jsx("span",{className:"text-gray-500",children:B.length>20?`${B.substring(0,20)}...`:B})]},D))})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-dashed border-white/10",children:[a.jsx(z,{variant:"outline",onClick:()=>{ei(!1),or(null),Ba(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"No, Cancel"}),a.jsx(z,{variant:"outline",onClick:()=>Pm("append"),disabled:Js,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Append"}),a.jsx(z,{onClick:()=>Pm("override"),disabled:Js,className:"rounded-none",children:Js?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):"Yes, Overwrite"})]})]})]})}),rl&&Ne&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[70] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wl,{className:"w-5 h-5 text-yellow-400"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Overwrite Existing Secret?"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{we(!1),Re(null),Ce(!1)},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"border border-dashed border-white/20 p-4",children:[a.jsxs("p",{className:"text-sm border-b border-dashed border-white/20 pb-5 text-gray-300 font-mono mb-3",children:[a.jsx("span",{className:"text-white uppercase",children:"BETTER_AUTH_SECRET"})," already exists in"," ",a.jsx("span",{className:"text-gray-400 normal-case",children:Ne.path}),":"]}),a.jsx("div",{className:"space-y-2 pt-2",children:a.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[a.jsx("span",{className:"text-gray-400 uppercase",children:"BETTER_AUTH_SECRET"}),a.jsx("span",{className:"text-gray-500",children:Ne.secret&&Ne.secret.length>20?`${Ne.secret.substring(0,20)}...`:Ne.secret||"***"})]})})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-dashed border-white/10",children:[a.jsx(z,{variant:"outline",onClick:()=>{we(!1),Re(null),Ce(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"No, Cancel"}),a.jsx(z,{onClick:()=>IE("override"),disabled:Ie,className:"rounded-none",children:Ie?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):"Yes, Overwrite"})]})]})]})})]})}function upe(){const{userId:e}=iS(),t=ha(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState([]),[h,d]=p.useState([]),[f,m]=p.useState(!0),[y,b]=p.useState("details"),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState("random"),[F,G]=p.useState(!1),[_,I]=p.useState(!1),[A,C]=p.useState(!1),[T,O]=p.useState(""),[q,k]=p.useState(),[M,$]=p.useState(!1),[W,Y]=p.useState(""),[te,ne]=p.useState([]),[X,se]=p.useState(!1),[Ee,re]=p.useState(!1),[xe,ye]=p.useState({}),ze=p.useRef({}),He=p.useCallback(async()=>{try{const pe=await(await fetch("/api/admin/status")).json();$(pe.enabled)}catch{$(!1)}},[]),Fe=p.useCallback(async Q=>{try{const pe=await fetch("/api/geo/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ipAddress:Q})});if(pe.ok){const be=await pe.json();if(be.success&&be.location)return be.location}return null}catch{return null}},[]),Ye=p.useCallback(async Q=>{const pe=Q.filter($e=>!ze.current[$e.id]);if(pe.length===0)return;const be=await Promise.all(pe.map(async $e=>{const je=await Fe($e.ipAddress);return je?{sessionId:$e.id,location:je}:null})),_e={};be.forEach($e=>{$e&&(_e[$e.sessionId]=$e.location)}),Object.keys(_e).length>0&&(ze.current={...ze.current,..._e},ye(ze.current))},[Fe]),ft=Q=>{if(!Q)return"🌍";const pe=Q.toUpperCase().split("").map(be=>127397+be.charCodeAt(0));return String.fromCodePoint(...pe)},et=Q=>Q?Q.replace(/[_-]/g," ").replace(/\b\w/g,pe=>pe.toUpperCase()):"Unknown Provider",de=Q=>{if(!Q)return"Unknown";const pe=new Date(Q);return Number.isNaN(pe.getTime())?"Unknown":pe.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},Be=p.useCallback(async()=>{try{const Q=await fetch(`/api/users/${e}`);if(Q.ok){const pe=await Q.json();r(pe.user)}else V.error("Failed to fetch user details"),t("/users")}catch{V.error("Failed to fetch user details"),t("/users")}finally{m(!1)}},[e,t]),Ue=p.useCallback(async()=>{try{const[Q,pe,be]=await Promise.all([fetch(`/api/users/${e}/organizations`),fetch(`/api/users/${e}/teams`),fetch(`/api/users/${e}/sessions`)]);if(Q.ok){const _e=await Q.json();i(_e.memberships||[])}if(pe.ok){const _e=await pe.json();l(_e.memberships||[])}if(be.ok){const $e=(await be.json()).sessions||[];u($e),Ye($e)}}catch{}},[e,Ye]),Oe=p.useCallback(async()=>{try{const Q=await fetch(`/api/users/${e}/accounts`);if(Q.ok){const pe=await Q.json();d(pe.accounts||[])}}catch{}},[e]),We=async()=>{var _e,$e;if(!n)return;const Q=(_e=document.getElementById("edit-name"))==null?void 0:_e.value,pe=($e=document.getElementById("edit-email"))==null?void 0:$e.value;if(!Q||!pe){V.error("Please fill in all fields");return}re(!0);const be=V.loading("Updating user...");try{const K=await(await fetch(`/api/users/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Q,email:pe,role:W||null})})).json();K.success?(r({...n,name:Q,email:pe,role:W||void 0}),x(!1),Y(""),V.success("User updated successfully!",{id:be})):V.error(`Error updating user: ${K.error||"Unknown error"}`,{id:be})}catch{V.error("Error updating user",{id:be})}finally{re(!1)}},nt=async()=>{if(!n)return;const Q=V.loading("Deleting user...");try{const be=await(await fetch(`/api/users/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();be.success?(V.success("User deleted successfully!",{id:Q}),t("/users")):V.error(`Error deleting user: ${be.error||"Unknown error"}`,{id:Q})}catch{V.error("Error deleting user",{id:Q})}},lt=async()=>{if(!n)return;if(!M){V.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use ban functionality.");return}const Q=V.loading("Banning user...");try{const pe=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,banReason:T||"No reason provided",banExpiresIn:q})}),be=await pe.json();pe.ok?(V.success("User banned successfully!",{id:Q}),g(!1),O(""),k(void 0),Be()):pe.status===403?V.error("You do not have permission to ban users. Admin role required.",{id:Q}):be.adminPluginEnabled&&be.instructions?V.error(`${be.error}`,{id:Q,duration:6e3,description:`Use: ${be.instructions.example}`}):V.error(`Error banning user: ${be.error||be.message||"Unknown error"}`,{id:Q})}catch{V.error("Error banning user",{id:Q})}},Ut=async()=>{if(!n)return;if(!M){V.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use unban functionality.");return}const Q=V.loading("Unbanning user...");try{const pe=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})}),be=await pe.json();pe.ok?(V.success("User unbanned successfully!",{id:Q}),S(!1),Be()):pe.status===403?V.error("You do not have permission to unban users. Admin role required.",{id:Q}):be.adminPluginEnabled&&be.instructions?V.error(`${be.error}`,{id:Q,duration:6e3,description:`Use: ${be.instructions.example}`}):V.error(`Error unbanning user: ${be.error||be.message||"Unknown error"}`,{id:Q})}catch{V.error("Error unbanning user",{id:Q})}},Kt=async Q=>{const pe=V.loading("Removing user from organization...");try{const _e=await(await fetch(`/api/organizations/members/${Q}`,{method:"DELETE"})).json();_e.success?(i($e=>$e.filter(je=>je.id!==Q)),Ue(),V.success("User removed from organization!",{id:pe})):V.error(`Error removing user: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error removing user from organization",{id:pe})}},Gt=async Q=>{const pe=V.loading("Removing user from team...");try{const _e=await(await fetch(`/api/teams/members/${Q}`,{method:"DELETE"})).json();_e.success?(l($e=>$e.filter(je=>je.id!==Q)),Ue(),V.success("User removed from team!",{id:pe})):V.error(`Error removing user: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error removing user from team",{id:pe})}},_t=async Q=>{const pe=V.loading("Deleting session...");try{const _e=await(await fetch(`/api/sessions/${Q}`,{method:"DELETE"})).json();_e.success?(u($e=>$e.filter(je=>je.id!==Q)),V.success("Session deleted successfully!",{id:pe})):V.error(`Error deleting session: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error deleting session",{id:pe})}},ce=async Q=>{if(!e)return;const pe=V.loading("Unlinking account...");try{const be=await fetch(`/api/users/${e}/accounts/${Q}`,{method:"DELETE"}),_e=await be.json();be.ok&&_e.success?(d($e=>$e.filter(je=>je.id!==Q)),await Oe(),V.success("Account unlinked successfully",{id:pe})):V.error(_e.error||"Failed to unlink account",{id:pe})}catch{V.error("Failed to unlink account",{id:pe})}};p.useEffect(()=>{e&&(Be(),Ue(),Oe(),He())},[e,He,Be,Ue,Oe]);const Te=async(Q=3)=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting session seeding process for ${Q} sessions...`,timestamp:new Date}]);try{const be=await(await fetch(`/api/users/${e}/seed-sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Q})})).json();if(be.success){const _e=be.results.map((je,K)=>je.success?{id:`session-${K}`,type:"progress",message:`Creating session ${K+1}: ${je.session.token.substring(0,20)}... from ${je.session.ipAddress}`,timestamp:new Date,status:"completed"}:{id:`session-${K}`,type:"error",message:`Failed to create session ${K+1}: ${je.error}`,timestamp:new Date});ne(je=>[...je,..._e]);const $e=be.results.filter(je=>je.success).length;ne(je=>[...je,{id:"complete",type:"success",message:`✅ Session seeding completed! Created ${$e}/${Q} sessions successfully`,timestamp:new Date}]),Ue()}else ne(_e=>[..._e,{id:"error",type:"error",message:`❌ Session seeding failed: ${be.error||"Unknown error"}`,timestamp:new Date}])}catch(pe){ne(be=>[...be,{id:"error",type:"error",message:`❌ Network error: ${pe}`,timestamp:new Date}])}finally{se(!1)}}},Ze=async(Q=3,pe="random")=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting account seeding process for ${Q} accounts...`,timestamp:new Date}]);try{const _e=await(await fetch(`/api/users/${e}/seed-accounts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:Q,providerId:pe})})).json();if(_e.success){const $e=_e.results.map((K,ue)=>{var Ae;return K.success?{id:`account-${ue}`,type:"progress",message:`Creating account ${ue+1}: ${K.account.providerId||K.account.provider} (${((Ae=K.account.accountId)==null?void 0:Ae.substring(0,20))||K.account.id.substring(0,20)}...)`,timestamp:new Date,status:"completed"}:{id:`account-${ue}`,type:"error",message:`Failed to create account ${ue+1}: ${K.error}`,timestamp:new Date}});ne(K=>[...K,...$e]);const je=_e.results.filter(K=>K.success).length;ne(K=>[...K,{id:"complete",type:"success",message:`✅ Account seeding completed! Created ${je}/${Q} accounts successfully`,timestamp:new Date}]),Oe()}else ne($e=>[...$e,{id:"error",type:"error",message:`❌ Account seeding failed: ${_e.error||"Unknown error"}`,timestamp:new Date}])}catch(be){ne(_e=>[..._e,{id:"error",type:"error",message:`❌ Network error: ${be}`,timestamp:new Date}])}finally{se(!1)}}};return f?a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"text-white text-lg",children:"Loading user details..."})}):n?a.jsxs("div",{className:"space-y-6 p-6 bg-black w-full",children:[a.jsxs("div",{className:"w-full flex flex-col",children:[a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>t("/users"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["users /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:n.id})]})}),a.jsx("div",{className:"mb-8 mt-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"w-16 h-16 bg-gray-800 border border-dashed border-white/20 flex items-center justify-center",children:n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):a.jsx(gd,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-light text-white inline-flex items-center",children:[n.name,a.jsx(Jt,{id:n.id,nonSliced:!0,variant:"subscript"}),n.role&&a.jsx("sup",{className:"ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-white/15 bg-white/5 text-white/80 rounded-none",children:n.role}),n.banned&&a.jsxs("sup",{className:"relative group inline-block ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-red-500/30 bg-red-500/10 text-red-400/80 rounded-none cursor-help",children:["Banned",n.banReason&&a.jsxs("span",{className:"absolute lowercase left-1/2 -translate-x-1/2 bottom-full mb-3 px-2 py-2 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[a.jsx("span",{className:"text-gray-400 font-mono text-xs uppercase mr-1",children:"Banned Reason:"}),n.banReason,a.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),a.jsx("p",{className:"text-gray-400 font-mono text-sm",children:n.email})]})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:Q=>{Q.stopPropagation(),C(!A)},children:a.jsx(p3,{className:"w-4 h-4"})}),A&&a.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:Q=>{Q.stopPropagation(),C(!1),x(!0),Y(n.role||"")},children:[a.jsx(zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Edit User"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:Q=>{Q.stopPropagation(),C(!1),G(!0)},children:[a.jsx(Ln,{className:"w-4 h-4"}),a.jsx("span",{children:"Update Password"})]}),M&&(n.banned?a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:Q=>{Q.stopPropagation(),C(!1),S(!0)},children:[a.jsx(rx,{className:"w-4 h-4"}),a.jsx("span",{children:"Unban User"})]}):a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:Q=>{Q.stopPropagation(),C(!1),g(!0)},children:[a.jsx(rx,{className:"w-4 h-4"}),a.jsx("span",{children:"Ban User"})]})),a.jsx("div",{className:"border-t border-white/10 my-1"}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:Q=>{Q.stopPropagation(),C(!1),I(!0)},children:[a.jsx(Qu,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete User"})]})]})]})})]})}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsx("nav",{className:"flex space-x-8 px-6",children:[{id:"details",name:"Details",icon:gd},{id:"organizations",name:"Organizations",icon:ka,count:s.length},{id:"teams",name:"Teams",icon:Ot,count:o.length},{id:"accounts",name:"Accounts",icon:vo,count:h.length},{id:"sessions",name:"Sessions",icon:_N,count:c.length}].map(Q=>a.jsxs("button",{onClick:()=>b(Q.id),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${y===Q.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(Q.icon,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start",children:[a.jsx("span",{className:"font-mono uppercase text-xs font-normal",children:Q.name}),Q.count!==void 0&&a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:Q.count,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]},Q.id))})}),a.jsxs("div",{className:"p-6",children:[y==="details"&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"BASIC INFORMATION"}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(gd,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Name"}),a.jsx("div",{className:"text-white font-sans text-sm",children:n.name})]})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(ys,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Email"}),a.jsx("div",{className:"text-white font-mono text-sm",children:n.email})]})]}),n.username&&a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Cae,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Username"}),a.jsx("div",{className:"text-white font-mono text-sm",children:n.username})]})]}),n.phoneNumber&&a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Tae,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Phone"}),a.jsx("div",{className:"text-white font-mono text-sm",children:"+251 91 234 5678"})]})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(dr,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Member Since"}),a.jsx("div",{className:"text-white font-mono text-sm",children:new Date(n.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})})]})]})]})]}),a.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"SECURITY"}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ys,{className:"w-4 h-4 text-gray-400"}),a.jsx("div",{children:a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Email Verification"})})]}),a.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.emailVerified?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.emailVerified?"Verified":"Unverified"})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Rs,{className:"w-4 h-4 text-gray-400"}),a.jsx("div",{children:a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Two-Factor Authentication"})})]}),a.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.twoFactorEnabled?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.twoFactorEnabled?"Enabled":"Disabled"})]})]})]})]}),y==="organizations"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Organizations",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:s.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Organizations this user belongs to"})]})}),s.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(ka,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Organizations"}),a.jsx("p",{className:"text-gray-400",children:"This user is not a member of any organizations."})]}):a.jsx("div",{className:"grid gap-4",children:s.map(Q=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:Q.organization.image?a.jsx("img",{src:Q.organization.image,alt:Q.organization.name,className:"w-12 h-12 object-cover"}):a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[Q.organization.name,a.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:Q.organization.slug}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[a.jsxs("span",{children:["in ",Q.organization.slug]}),a.jsx("button",{onClick:pe=>{pe.stopPropagation(),t(`/organizations/${Q.organization.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View organization details",children:a.jsx(yu,{className:"w-3.5 h-3.5"})})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Q.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Q.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Kt(Q.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},Q.id))})]}),y==="teams"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Teams this user belongs to"})]})}),o.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ot,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Teams"}),a.jsx("p",{className:"text-gray-400",children:"This user is not a member of any teams."})]}):a.jsx("div",{className:"grid gap-4",children:o.map(Q=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[Q.team.name,a.jsx(Jt,{id:Q.team.id,variant:"subscript",nonSliced:!!(Q.team.organizationSlug||Q.team.organizationName)})]}),a.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[a.jsxs("span",{children:["in"," ",Q.team.organizationSlug||Q.team.organizationName]}),a.jsx("button",{onClick:pe=>{pe.stopPropagation(),Q.team.organizationId?t(`/organizations/${Q.team.organizationId}/teams/${Q.team.id}`):t(`/teams/${Q.team.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View team details",children:a.jsx(yu,{className:"w-3.5 h-3.5"})})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Q.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Q.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Gt(Q.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},Q.id))})]}),y==="accounts"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Linked Accounts",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:h.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user OAuth account connections"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),L(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(vo,{className:"w-4 h-4 mr-2"}),"Seed Accounts"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(vo,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Linked Accounts"}),a.jsx("p",{className:"text-gray-400",children:"This user has not connected any accounts yet."})]}):a.jsx("div",{className:"grid gap-4",children:h.map(Q=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:J6(Q.providerId)}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[et(Q.providerId),a.jsx(Jt,{id:Q.accountId,variant:"subscript",nonSliced:!!(Q.email||n.email)})]}),a.jsx("p",{className:"text-gray-400 tracking-tight uppercase text-xs font-mono mt-1",children:`ID: ${Q.id}`})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2 text-right",children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-mono text-gray-400",children:[a.jsx("span",{className:"uppercase",children:"Linked:"}),a.jsx("span",{className:"text-white",children:de(Q.createdAt||Q.updatedAt)})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>ce(Q.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Unlink"]})})]},Q.id))})]}),y==="sessions"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Sessions",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user authentication sessions"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),j(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(Rs,{className:"w-4 h-4 mr-2"}),"Seed Sessions"]})]}),c.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(_N,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Sessions"}),a.jsx("p",{className:"text-gray-400",children:"This user has no active sessions."})]}):a.jsx("div",{className:"grid gap-4",children:c.map(Q=>{var pe,be,_e,$e;return a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:a.jsx(kC,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:["Session ",Q.id.substring(0,8),"...",a.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:Q.ipAddress}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[a.jsx(jae,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsxs("span",{className:"text-gray-400 uppercase font-mono text-xs",children:[((pe=xe[Q.id])==null?void 0:pe.city)||"...",","," ",((be=xe[Q.id])==null?void 0:be.country)||"..."]}),((_e=xe[Q.id])==null?void 0:_e.countryCode)&&a.jsx("span",{className:"text-xs ml-1",children:ft(($e=xe[Q.id])==null?void 0:$e.countryCode)})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Expires:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(Q.expiresAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(Q.expiresAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>_t(Q.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(rx,{className:"w-4 h-4 mr-1"}),"Revoke"]})})]},Q.id)})})]})]})]})]}),w&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-6 w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{x(!1),Y("")},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center overflow-hidden",children:n!=null&&n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-14 h-14 object-cover"}):a.jsx(gd,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:n==null?void 0:n.name}),a.jsx(Jt,{id:(n==null?void 0:n.id)||"",variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",defaultValue:(n==null?void 0:n.name)||"",placeholder:"e.g. John Doe",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"edit-email",type:"email",defaultValue:(n==null?void 0:n.email)||"",placeholder:"e.g. john@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{value:W,onValueChange:Y,children:[a.jsx(mn,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{x(!1),Y("")},disabled:Ee,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:We,disabled:Ee,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:Ee?"Updating...":"Update"})]})]})}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),a.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",a.jsx("strong",{children:n.name})," from accessing the system."]}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),a.jsx(ve,{id:"banReason",value:T,onChange:Q=>O(Q.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),a.jsx(ve,{id:"banExpires",type:"number",value:q||"",onChange:Q=>k(Q.target.value?Number(Q.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),O(""),k(void 0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:lt,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-green-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),a.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",a.jsx("strong",{children:n.name}),"? This will restore their access to the system."]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ut,className:"bg-green-400 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),_&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>I(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-black/80 border border-dashed border-white/20 flex items-center justify-center",children:n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):a.jsx(gd,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:n.name}),a.jsx("div",{className:"text-sm text-gray-400",children:n.email})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>I(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:nt,className:"bg-red-500 hover:bg-red-600 text-white border border-red-500 rounded-none",children:"Delete"})]})]})}),F&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"new-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),a.jsx(ve,{id:"new-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:async()=>{var be;const Q=(be=document.getElementById("new-password"))==null?void 0:be.value;if(!Q){V.error("Please enter a password");return}const pe=V.loading("Updating password...");try{const $e=await(await fetch(`/api/users/${e}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:Q})})).json();$e.success?(G(!1),document.getElementById("new-password").value="",V.success("Password updated successfully!",{id:pe})):V.error(`Error updating password: ${$e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error updating password",{id:pe})}},className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:a.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(kC,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Sessions"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),a.jsx(ve,{id:"session-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var pe;const Q=parseInt(((pe=document.getElementById("session-count"))==null?void 0:pe.value)||"3",10);Te(Q)},disabled:X,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:X?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Rs,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})}),te.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Session Seeding Terminal",lines:te,isRunning:X,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),R&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:a.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(vo,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Accounts"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),a.jsx(ve,{id:"account-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"account-provider",className:"text-sm text-gray-400 font-light",children:"Provider"}),a.jsxs(pn,{value:P,onValueChange:U,children:[a.jsx(mn,{className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select provider"})}),a.jsxs(gn,{className:"bg-black border border-dashed border-white/20",children:[a.jsx(Pe,{value:"random",children:"Mix (Random)"}),a.jsx(Pe,{value:"github",children:"GitHub"}),a.jsx(Pe,{value:"google",children:"Google"}),a.jsx(Pe,{value:"discord",children:"Discord"}),a.jsx(Pe,{value:"facebook",children:"Facebook"}),a.jsx(Pe,{value:"twitter",children:"Twitter"}),a.jsx(Pe,{value:"linkedin",children:"LinkedIn"}),a.jsx(Pe,{value:"apple",children:"Apple"}),a.jsx(Pe,{value:"microsoft",children:"Microsoft"}),a.jsx(Pe,{value:"gitlab",children:"GitLab"}),a.jsx(Pe,{value:"bitbucket",children:"Bitbucket"}),a.jsx(Pe,{value:"spotify",children:"Spotify"}),a.jsx(Pe,{value:"twitch",children:"Twitch"}),a.jsx(Pe,{value:"reddit",children:"Reddit"}),a.jsx(Pe,{value:"slack",children:"Slack"}),a.jsx(Pe,{value:"notion",children:"Notion"}),a.jsx(Pe,{value:"tiktok",children:"TikTok"}),a.jsx(Pe,{value:"zoom",children:"Zoom"})]})]})]})]}),a.jsx(z,{onClick:()=>{var pe;const Q=parseInt(((pe=document.getElementById("account-count"))==null?void 0:pe.value)||"3",10);Ze(Q,P)},disabled:X,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:X?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(vo,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]}),te.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Account Seeding Terminal",lines:te,isRunning:X,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})})]}):a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"text-white text-lg",children:"User not found"})})}const Xh=window.__STUDIO_CONFIG__,kp=(Xh==null?void 0:Xh.basePath)!==void 0?Xh.basePath:"",hpe=!!kp;function fpe({children:e}){const[t,n]=p.useState({loading:!0,authenticated:!1,user:null}),r=eo();if(p.useEffect(()=>{(async()=>{try{const i=kp?`${kp}/auth`:"/api/auth",l=await(await fetch(`${i}/session`,{credentials:"include"})).json();n({loading:!1,authenticated:l.authenticated,user:l.user})}catch{n({loading:!1,authenticated:!1,user:null})}})()},[r.pathname]),t.loading)return a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"w-8 h-8 border border-dashed border-white/30 animate-spin"})});if(!t.authenticated){const s=encodeURIComponent(r.pathname+r.search);return a.jsx(_$,{to:`/login?redirect=${s}`,replace:!0})}return a.jsx(a.Fragment,{children:e})}function h4(){return a.jsx(nZ,{children:a.jsx(ZQ,{children:a.jsxs(uN,{children:[a.jsx(En,{path:"/",element:a.jsx(Xae,{})}),a.jsx(En,{path:"/users",element:a.jsx(BU,{})}),a.jsx(En,{path:"/users/:userId",element:a.jsx(upe,{})}),a.jsx(En,{path:"/organizations",element:a.jsx(FU,{})}),a.jsx(En,{path:"/organizations/:orgId",element:a.jsx(kfe,{})}),a.jsx(En,{path:"/teams",element:a.jsx(Rfe,{})}),a.jsx(En,{path:"/teams/:teamId",element:a.jsx(u4,{})}),a.jsx(En,{path:"/organizations/:orgId/teams/:teamId",element:a.jsx(u4,{})}),a.jsx(En,{path:"/sessions",element:a.jsx(Afe,{})}),a.jsx(En,{path:"/database",element:a.jsx(Qae,{})}),a.jsx(En,{path:"/database/demo",element:a.jsx(tZ,{})}),a.jsx(En,{path:"/emails",element:a.jsx(jfe,{})}),a.jsx(En,{path:"/tools",element:a.jsx(dpe,{})}),a.jsx(En,{path:"/settings",element:a.jsx(_fe,{})})]})})})}function ppe(){return a.jsxs(F$,{basename:kp,children:[hpe?a.jsxs(uN,{children:[a.jsx(En,{path:"/login",element:a.jsx(Tfe,{})}),a.jsx(En,{path:"/access-denied",element:a.jsx(QQ,{})}),a.jsx(En,{path:"/*",element:a.jsx(fpe,{children:a.jsx(h4,{})})})]}):a.jsx(uN,{children:a.jsx(En,{path:"/*",element:a.jsx(h4,{})})}),a.jsx(m8,{className:"rounded-none border-dashed border-white/20",theme:"dark",position:"top-right",richColors:!0,toastOptions:{style:{border:"dashed 1px #ffffff20",borderRadius:"0"},className:"font-mono uppercase"},closeButton:!0})]})}const mpe=window.fetch;window.fetch=(e,t)=>{var i;const n=((i=window.__STUDIO_CONFIG__)==null?void 0:i.basePath)||"";let r;return typeof e=="string"?r=e:e instanceof URL?r=e.toString():e instanceof Request?r=e.url:r="",r.startsWith("/api/")&&!r.startsWith("/api/auth/")&&n&&!r.startsWith(n)&&(r=n+r.slice(4),typeof e=="string"?e=r:e instanceof URL?e=new URL(r,window.location.origin):e instanceof Request&&(e=new Request(r,e))),mpe.call(window,e,t)};Fz.createRoot(document.getElementById("root")).render(a.jsx(ee.StrictMode,{children:a.jsx(ppe,{})}));
1155
+ `)),className:"text-gray-400 hover:text-white rounded-none",children:[a.jsx(va,{className:"w-4 h-4 mr-1"}),"Copy All"]})]}),a.jsx("div",{className:"border border-dashed border-white/10 p-3",children:a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:wn.map((D,B)=>a.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("span",{className:"text-white font-mono text-xs break-all",children:D}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(D),className:"text-gray-400 hover:text-white rounded-none ml-2",children:a.jsx(va,{className:"w-3 h-3"})})]},B))})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Version"}),a.jsx("p",{className:"text-white text-sm",children:"v4 (Random)"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"Cryptographically random"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),a.jsx("p",{className:"text-white text-sm",children:"8-4-4-4-12"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"36 characters"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Standard"}),a.jsx("p",{className:"text-white text-sm",children:"RFC 4122"}),a.jsx("p",{className:"text-gray-500 text-xs",children:"Universally unique"})]})]})]})]})}),as&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Jl,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Password Strength Checker"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>nl(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{type:Sr?"text":"password",value:Ws,onChange:D=>Fn(D.target.value),placeholder:"Enter password to check",className:"w-full bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>os(!Sr),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:Sr?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Fn(""),rs(null),os(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:mP,disabled:ss||!Ws.trim(),className:"rounded-none",children:ss?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):"Check Strength"})]}),Mt&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Strength"}),a.jsx("p",{className:`text-sm font-medium ${Mt.strength==="very-strong"?"text-green-400":Mt.strength==="strong"?"text-green-300":Mt.strength==="good"?"text-yellow-300":Mt.strength==="fair"?"text-orange-300":"text-red-300"}`,children:Mt.strength.split("-").map(D=>D.charAt(0).toUpperCase()+D.slice(1)).join(" ")}),a.jsx("div",{className:"w-full bg-black/40 h-2 rounded-none",children:a.jsx("div",{className:`h-full transition-all ${Mt.strength==="very-strong"?"bg-green-400 w-full":Mt.strength==="strong"?"bg-green-300 w-4/5":Mt.strength==="good"?"bg-yellow-300 w-3/5":Mt.strength==="fair"?"bg-orange-300 w-2/5":"bg-red-300 w-1/5"}`})})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Score"}),a.jsxs("p",{className:"text-white text-sm",children:[Mt.score," / 5"]}),a.jsx("p",{className:"text-gray-500 text-xs",children:Mt.score===5?"Excellent":Mt.score===4?"Very Good":Mt.score===3?"Good":Mt.score===2?"Fair":"Weak"})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Config Match"}),a.jsx("p",{className:`text-sm ${Mt.meetsConfig?"text-green-400":"text-red-300"}`,children:Mt.meetsConfig?"✓ Meets Requirements":"✗ Fails Requirements"}),a.jsxs("p",{className:"text-gray-500 text-xs",children:[Mt.configRequirements.minLength," -"," ",Mt.configRequirements.maxLength," chars"]})]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-400 mb-3",children:"Checks"}),a.jsx("div",{className:"space-y-2",children:Mt.checks.map((D,B)=>a.jsxs("div",{className:"flex items-center justify-between p-2 bg-black/40 border border-dashed border-white/10",children:[a.jsx("span",{className:"text-white font-mono text-xs",children:D.name}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("span",{className:`text-xs font-mono ${D.passed?"text-green-400":"text-red-300"}`,children:D.passed?"✓":"✗"}),a.jsx("span",{className:"text-xs text-gray-400 font-mono",children:D.message})]})]},B))})]})]})]})]})}),Er&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(la,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"OAuth Credentials"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>Xs(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Select Provider"}),a.jsx("div",{className:"flex flex-wrap gap-3",children:["google","github"].map(D=>{const B=f===D;return a.jsx("button",{onClick:()=>m(D),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors ${B?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.charAt(0).toUpperCase()+D.slice(1)},D)})})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Origin"}),a.jsx(ve,{value:pa,onChange:D=>Qn(D.target.value),placeholder:`http://${Fa}`,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),a.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:["The default will be http://",Fa]})]}),a.jsxs("div",{className:"flex items-end justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Jn(null),Qn(Fa)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:yP,disabled:ir||!f||!pa.trim()&&!Fa,className:"rounded-none",children:ir?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Fetching..."]}):"Fetch Credentials"})]}),ma&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client ID"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:ma.clientId,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(ma.clientId),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Client Secret"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{type:Qs?"text":"password",value:ma.clientSecret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-20 rounded-none"}),a.jsxs("div",{className:"absolute right-0 top-0 h-full flex items-center",children:[a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>al(!Qs),className:"px-2 text-gray-400 hover:text-white rounded-none",children:Qs?a.jsx(mf,{className:"w-4 h-4"}):a.jsx(Ms,{className:"w-4 h-4"})}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(ma.clientSecret),className:"px-2 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-4 h-4"})})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-dashed border-white/10",children:[a.jsx("div",{className:"flex-1",children:xt&&a.jsx("div",{className:"text-xs font-mono",children:xt.success?a.jsxs("span",{className:"text-green-400 uppercase",children:["✓ ",xt.message.toLowerCase(),a.jsxs("span",{className:"block normal-case text-gray-400",children:[a.jsx("span",{className:"text-gray-400 mr-1",children:">"})," ",xt.path]})]}):a.jsxs("span",{className:"text-red-300",children:["✗ ",xt.message]})})}),a.jsx(z,{onClick:wP,disabled:Js||cs,className:"rounded-none",children:cs?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):Js?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Uh,{className:"w-4 h-4 mr-2"}),"Write to .env"]})})]})]})]})]})}),so&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[60] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wo,{className:"w-5 h-5 text-white"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Secret Generator"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>ds(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Length (bytes)"}),a.jsx(ve,{type:"number",value:ea===0?"":ea,onChange:D=>{const B=D.target.value;if(B===""){ga(0);return}const J=parseInt(B,10);isNaN(J)||ga(J)},onBlur:D=>{const B=parseInt(D.target.value,10);isNaN(B)||B<16?ga(32):B>128?ga(128):ga(B)},min:"16",max:"128",className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs rounded-none"}),a.jsx("p",{className:"text-[11px] text-gray-500 font-mono mt-1",children:"Recommended: 32 bytes (256 bits)"})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Format"}),a.jsx("div",{className:"flex gap-3",children:[{id:"hex",label:"Hex"},{id:"base64",label:"Base64"}].map(D=>a.jsx("button",{onClick:()=>kr(D.id),className:`px-4 py-2 border rounded-none text-sm uppercase font-mono transition-colors flex-1 ${Cr===D.id?"border-white/60 bg-white/10 text-white":"border-dashed border-white/20 text-gray-400 hover:border-white/40"}`,children:D.label},D.id))})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{Ge(null),ga(32),kr("hex")},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Clear"}),a.jsx(z,{onClick:xP,disabled:Pt,className:"rounded-none",children:Pt?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Secret"})]}),Se&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs font-mono",children:[a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Length"}),a.jsxs("p",{className:"text-white text-sm",children:[Se.length," bytes"]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Entropy"}),a.jsxs("p",{className:"text-white text-sm",children:[Se.entropy," bits"]})]}),a.jsxs("div",{className:"border border-dashed border-white/10 p-3 space-y-2",children:[a.jsx("div",{className:"text-gray-400 uppercase tracking-wider",children:"Format"}),a.jsx("p",{className:"text-white text-sm uppercase",children:Se.format})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Generated Secret"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:Se.secret,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(Se.secret),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-3 h-3"})})]})]}),a.jsxs("div",{children:[a.jsx(ie,{className:"text-xs uppercase font-mono text-gray-400 mb-2 block",children:"Environment Variable Format"}),a.jsxs("div",{className:"relative",children:[a.jsx(ve,{value:Se.envFormat,readOnly:!0,className:"bg-black border border-dashed border-white/20 text-white font-mono text-xs pr-10 rounded-none"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>$a(Se.envFormat),className:"absolute right-0 top-0 h-full px-3 text-gray-400 hover:text-white rounded-none",children:a.jsx(va,{className:"w-3 h-3"})})]}),a.jsxs("p",{className:"text-[11px] text-gray-500 font-mono mt-2",children:["Add this to your ",a.jsx("code",{className:"text-gray-400",children:".env"})," file. Keep it secret and never commit it to version control."]})]}),a.jsx("div",{className:"flex justify-end space-x-2 pt-2",children:a.jsx(z,{variant:"outline",onClick:bP,disabled:me||Ie,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:me||Ie?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),Ie?"Writing...":"Checking..."]}):"Write to .env"})}),a.jsx("div",{className:"border border-dashed border-white/20 bg-black text-gray-300 text-xs font-mono p-3 rounded-none",children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx(wl,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-gray-400"}),a.jsxs("div",{children:[a.jsx("div",{className:"uppercase font-mono mb-2 text-gray-400 tracking-wider",children:"Security Best Practices"}),a.jsxs("ul",{className:"list-disc list-inside space-y-1 text-[11px] text-gray-300",children:[a.jsx("li",{children:"Use a minimum of 32 bytes (256 bits) for production"}),a.jsx("li",{children:"Store secrets in environment variables, never in code"}),a.jsx("li",{children:"Use different secrets for development and production"}),a.jsx("li",{children:"Rotate secrets periodically for enhanced security"})]})]})]})})]})]})]})}),Tr&&ls&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[70] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wl,{className:"w-5 h-5 text-yellow-400"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Overwrite Existing Credentials?"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{ei(!1),or(null),Ba(!1)},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"border border-dashed border-white/20 p-4",children:[a.jsxs("p",{className:"text-sm border-b border-dashed border-white/20 pb-5 text-gray-300 font-mono mb-3",children:["The following"," ",a.jsx("span",{className:"text-white uppercase",children:(f==null?void 0:f.charAt(0).toUpperCase())+(f==null?void 0:f.slice(1))})," ","credentials already exist in"," ",a.jsx("span",{className:"text-gray-400 normal-case",children:ls.path}),":"]}),a.jsx("div",{className:"space-y-2 pt-2",children:Object.entries(ls.credentials).map(([D,B])=>a.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[a.jsx("span",{className:"text-gray-400 uppercase",children:D}),a.jsx("span",{className:"text-gray-500",children:B.length>20?`${B.substring(0,20)}...`:B})]},D))})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-dashed border-white/10",children:[a.jsx(z,{variant:"outline",onClick:()=>{ei(!1),or(null),Ba(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"No, Cancel"}),a.jsx(z,{variant:"outline",onClick:()=>Pm("append"),disabled:Js,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Append"}),a.jsx(z,{onClick:()=>Pm("override"),disabled:Js,className:"rounded-none",children:Js?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):"Yes, Overwrite"})]})]})]})}),rl&&Ne&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[70] overflow-hidden",children:a.jsxs("div",{className:"bg-black border border-dashed border-white/20 rounded-none p-6 w-full max-w-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(wl,{className:"w-5 h-5 text-yellow-400"}),a.jsx("h3",{className:"text-xl text-white font-light uppercase tracking-wider",children:"Overwrite Existing Secret?"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{we(!1),Re(null),Ce(!1)},className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"border border-dashed border-white/20 p-4",children:[a.jsxs("p",{className:"text-sm border-b border-dashed border-white/20 pb-5 text-gray-300 font-mono mb-3",children:[a.jsx("span",{className:"text-white uppercase",children:"BETTER_AUTH_SECRET"})," already exists in"," ",a.jsx("span",{className:"text-gray-400 normal-case",children:Ne.path}),":"]}),a.jsx("div",{className:"space-y-2 pt-2",children:a.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[a.jsx("span",{className:"text-gray-400 uppercase",children:"BETTER_AUTH_SECRET"}),a.jsx("span",{className:"text-gray-500",children:Ne.secret&&Ne.secret.length>20?`${Ne.secret.substring(0,20)}...`:Ne.secret||"***"})]})})]}),a.jsxs("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-dashed border-white/10",children:[a.jsx(z,{variant:"outline",onClick:()=>{we(!1),Re(null),Ce(!1)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"No, Cancel"}),a.jsx(z,{onClick:()=>IE("override"),disabled:Ie,className:"rounded-none",children:Ie?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Writing..."]}):"Yes, Overwrite"})]})]})]})})]})}function upe(){const{userId:e}=iS(),t=ha(),[n,r]=p.useState(null),[s,i]=p.useState([]),[o,l]=p.useState([]),[c,u]=p.useState([]),[h,d]=p.useState([]),[f,m]=p.useState(!0),[y,b]=p.useState("details"),[w,x]=p.useState(!1),[v,g]=p.useState(!1),[N,S]=p.useState(!1),[E,j]=p.useState(!1),[R,L]=p.useState(!1),[P,U]=p.useState("random"),[F,G]=p.useState(!1),[_,I]=p.useState(!1),[A,C]=p.useState(!1),[T,O]=p.useState(""),[q,k]=p.useState(),[M,$]=p.useState(!1),[W,Y]=p.useState(""),[te,ne]=p.useState([]),[X,se]=p.useState(!1),[Ee,re]=p.useState(!1),[xe,ye]=p.useState({}),ze=p.useRef({}),He=p.useCallback(async()=>{try{const pe=await(await fetch("/api/admin/status")).json();$(pe.enabled)}catch{$(!1)}},[]),Fe=p.useCallback(async K=>{try{const pe=await fetch("/api/geo/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ipAddress:K})});if(pe.ok){const be=await pe.json();if(be.success&&be.location)return be.location}return null}catch{return null}},[]),Ye=p.useCallback(async K=>{const pe=K.filter($e=>!ze.current[$e.id]);if(pe.length===0)return;const be=await Promise.all(pe.map(async $e=>{const je=await Fe($e.ipAddress);return je?{sessionId:$e.id,location:je}:null})),_e={};be.forEach($e=>{$e&&(_e[$e.sessionId]=$e.location)}),Object.keys(_e).length>0&&(ze.current={...ze.current,..._e},ye(ze.current))},[Fe]),ft=K=>{if(!K)return"🌍";const pe=K.toUpperCase().split("").map(be=>127397+be.charCodeAt(0));return String.fromCodePoint(...pe)},et=K=>K?K.replace(/[_-]/g," ").replace(/\b\w/g,pe=>pe.toUpperCase()):"Unknown Provider",de=K=>{if(!K)return"Unknown";const pe=new Date(K);return Number.isNaN(pe.getTime())?"Unknown":pe.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},Be=p.useCallback(async()=>{try{const K=await fetch(`/api/users/${e}`);if(K.ok){const pe=await K.json();r(pe.user)}else V.error("Failed to fetch user details"),t("/users")}catch{V.error("Failed to fetch user details"),t("/users")}finally{m(!1)}},[e,t]),Ue=p.useCallback(async()=>{try{const[K,pe,be]=await Promise.all([fetch(`/api/users/${e}/organizations`),fetch(`/api/users/${e}/teams`),fetch(`/api/users/${e}/sessions`)]);if(K.ok){const _e=await K.json();i(_e.memberships||[])}if(pe.ok){const _e=await pe.json();l(_e.memberships||[])}if(be.ok){const $e=(await be.json()).sessions||[];u($e),Ye($e)}}catch{}},[e,Ye]),Oe=p.useCallback(async()=>{try{const K=await fetch(`/api/users/${e}/accounts`);if(K.ok){const pe=await K.json();d(pe.accounts||[])}}catch{}},[e]),We=async()=>{var _e,$e;if(!n)return;const K=(_e=document.getElementById("edit-name"))==null?void 0:_e.value,pe=($e=document.getElementById("edit-email"))==null?void 0:$e.value;if(!K||!pe){V.error("Please fill in all fields");return}re(!0);const be=V.loading("Updating user...");try{const Z=await(await fetch(`/api/users/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:K,email:pe,role:W||null})})).json();Z.success?(r({...n,name:K,email:pe,role:W||void 0}),x(!1),Y(""),V.success("User updated successfully!",{id:be})):V.error(`Error updating user: ${Z.error||"Unknown error"}`,{id:be})}catch{V.error("Error updating user",{id:be})}finally{re(!1)}},nt=async()=>{if(!n)return;const K=V.loading("Deleting user...");try{const be=await(await fetch(`/api/users/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json();be.success?(V.success("User deleted successfully!",{id:K}),t("/users")):V.error(`Error deleting user: ${be.error||"Unknown error"}`,{id:K})}catch{V.error("Error deleting user",{id:K})}},lt=async()=>{if(!n)return;if(!M){V.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use ban functionality.");return}const K=V.loading("Banning user...");try{const pe=await fetch("/api/admin/ban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,banReason:T||"No reason provided",banExpiresIn:q})}),be=await pe.json();pe.ok?(V.success("User banned successfully!",{id:K}),g(!1),O(""),k(void 0),Be()):pe.status===403?V.error("You do not have permission to ban users. Admin role required.",{id:K}):be.adminPluginEnabled&&be.instructions?V.error(`${be.error}`,{id:K,duration:6e3,description:`Use: ${be.instructions.example}`}):V.error(`Error banning user: ${be.error||be.message||"Unknown error"}`,{id:K})}catch{V.error("Error banning user",{id:K})}},Ut=async()=>{if(!n)return;if(!M){V.error("Admin plugin is not enabled. Please enable the admin plugin in your Better Auth configuration to use unban functionality.");return}const K=V.loading("Unbanning user...");try{const pe=await fetch("/api/admin/unban-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})}),be=await pe.json();pe.ok?(V.success("User unbanned successfully!",{id:K}),S(!1),Be()):pe.status===403?V.error("You do not have permission to unban users. Admin role required.",{id:K}):be.adminPluginEnabled&&be.instructions?V.error(`${be.error}`,{id:K,duration:6e3,description:`Use: ${be.instructions.example}`}):V.error(`Error unbanning user: ${be.error||be.message||"Unknown error"}`,{id:K})}catch{V.error("Error unbanning user",{id:K})}},Kt=async K=>{const pe=V.loading("Removing user from organization...");try{const _e=await(await fetch(`/api/organizations/members/${K}`,{method:"DELETE"})).json();_e.success?(i($e=>$e.filter(je=>je.id!==K)),Ue(),V.success("User removed from organization!",{id:pe})):V.error(`Error removing user: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error removing user from organization",{id:pe})}},Gt=async K=>{const pe=V.loading("Removing user from team...");try{const _e=await(await fetch(`/api/teams/members/${K}`,{method:"DELETE"})).json();_e.success?(l($e=>$e.filter(je=>je.id!==K)),Ue(),V.success("User removed from team!",{id:pe})):V.error(`Error removing user: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error removing user from team",{id:pe})}},_t=async K=>{const pe=V.loading("Deleting session...");try{const _e=await(await fetch(`/api/sessions/${K}`,{method:"DELETE"})).json();_e.success?(u($e=>$e.filter(je=>je.id!==K)),V.success("Session deleted successfully!",{id:pe})):V.error(`Error deleting session: ${_e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error deleting session",{id:pe})}},ce=async K=>{if(!e)return;const pe=V.loading("Unlinking account...");try{const be=await fetch(`/api/users/${e}/accounts/${K}`,{method:"DELETE"}),_e=await be.json();be.ok&&_e.success?(d($e=>$e.filter(je=>je.id!==K)),await Oe(),V.success("Account unlinked successfully",{id:pe})):V.error(_e.error||"Failed to unlink account",{id:pe})}catch{V.error("Failed to unlink account",{id:pe})}};p.useEffect(()=>{e&&(Be(),Ue(),Oe(),He())},[e,He,Be,Ue,Oe]);const Te=async(K=3)=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting session seeding process for ${K} sessions...`,timestamp:new Date}]);try{const be=await(await fetch(`/api/users/${e}/seed-sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:K})})).json();if(be.success){const _e=be.results.map((je,Z)=>je.success?{id:`session-${Z}`,type:"progress",message:`Creating session ${Z+1}: ${je.session.token.substring(0,20)}... from ${je.session.ipAddress}`,timestamp:new Date,status:"completed"}:{id:`session-${Z}`,type:"error",message:`Failed to create session ${Z+1}: ${je.error}`,timestamp:new Date});ne(je=>[...je,..._e]);const $e=be.results.filter(je=>je.success).length;ne(je=>[...je,{id:"complete",type:"success",message:`✅ Session seeding completed! Created ${$e}/${K} sessions successfully`,timestamp:new Date}]),Ue()}else ne(_e=>[..._e,{id:"error",type:"error",message:`❌ Session seeding failed: ${be.error||"Unknown error"}`,timestamp:new Date}])}catch(pe){ne(be=>[...be,{id:"error",type:"error",message:`❌ Network error: ${pe}`,timestamp:new Date}])}finally{se(!1)}}},Ze=async(K=3,pe="random")=>{if(e){ne([]),se(!0),ne([{id:"start",type:"info",message:`Starting account seeding process for ${K} accounts...`,timestamp:new Date}]);try{const _e=await(await fetch(`/api/users/${e}/seed-accounts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({count:K,providerId:pe})})).json();if(_e.success){const $e=_e.results.map((Z,ue)=>{var Ae;return Z.success?{id:`account-${ue}`,type:"progress",message:`Creating account ${ue+1}: ${Z.account.providerId||Z.account.provider} (${((Ae=Z.account.accountId)==null?void 0:Ae.substring(0,20))||Z.account.id.substring(0,20)}...)`,timestamp:new Date,status:"completed"}:{id:`account-${ue}`,type:"error",message:`Failed to create account ${ue+1}: ${Z.error}`,timestamp:new Date}});ne(Z=>[...Z,...$e]);const je=_e.results.filter(Z=>Z.success).length;ne(Z=>[...Z,{id:"complete",type:"success",message:`✅ Account seeding completed! Created ${je}/${K} accounts successfully`,timestamp:new Date}]),Oe()}else ne($e=>[...$e,{id:"error",type:"error",message:`❌ Account seeding failed: ${_e.error||"Unknown error"}`,timestamp:new Date}])}catch(be){ne(_e=>[..._e,{id:"error",type:"error",message:`❌ Network error: ${be}`,timestamp:new Date}])}finally{se(!1)}}};return f?a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"text-white text-lg",children:"Loading user details..."})}):n?a.jsxs("div",{className:"space-y-6 p-6 bg-black w-full",children:[a.jsxs("div",{className:"w-full flex flex-col",children:[a.jsx("span",{className:"mb-4 ml-0 flex justify-start items-start text-left border-none text-white",children:a.jsxs("span",{className:"font-light",children:[a.jsxs("span",{onClick:()=>t("/users"),className:"uppercase cursor-pointer text-white/80 font-mono text-sm",children:["users /"," "]}),a.jsx("span",{className:"text-white font-mono text-sm",children:n.id})]})}),a.jsx("div",{className:"mb-8 mt-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"w-16 h-16 bg-gray-800 border border-dashed border-white/20 flex items-center justify-center",children:n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):a.jsx(gd,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-light text-white inline-flex items-center",children:[n.name,a.jsx(Jt,{id:n.id,nonSliced:!0,variant:"subscript"}),n.role&&a.jsx("sup",{className:"ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-white/15 bg-white/5 text-white/80 rounded-none",children:n.role}),n.banned&&a.jsxs("sup",{className:"relative group inline-block ml-2 px-2 pt-2 pb-2 -mt-1 py-0.5 text-[10px] font-mono uppercase border border-dashed border-red-500/30 bg-red-500/10 text-red-400/80 rounded-none cursor-help",children:["Banned",n.banReason&&a.jsxs("span",{className:"absolute lowercase left-1/2 -translate-x-1/2 bottom-full mb-3 px-2 py-2 text-[10px] font-mono text-gray-300 bg-black border border-dashed border-white/20 rounded-none whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-150 pointer-events-none z-50",children:[a.jsx("span",{className:"text-gray-400 font-mono text-xs uppercase mr-1",children:"Banned Reason:"}),n.banReason,a.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-[4px] border-r-[4px] border-t-[4px] border-transparent border-t-white/20"})]})]})]}),a.jsx("p",{className:"text-gray-400 font-mono text-sm",children:n.email})]})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white rounded-none",onClick:K=>{K.stopPropagation(),C(!A)},children:a.jsx(p3,{className:"w-4 h-4"})}),A&&a.jsxs("div",{className:"absolute z-[999] right-0 top-full mt-1 w-48 bg-black border border-white/20 rounded-none shadow-lg",onClick:K=>K.stopPropagation(),children:[a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:K=>{K.stopPropagation(),C(!1),x(!0),Y(n.role||"")},children:[a.jsx(zo,{className:"w-4 h-4"}),a.jsx("span",{children:"Edit User"})]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-white/10 flex items-center space-x-2",onClick:K=>{K.stopPropagation(),C(!1),G(!0)},children:[a.jsx(Ln,{className:"w-4 h-4"}),a.jsx("span",{children:"Update Password"})]}),M&&(n.banned?a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-green-400 hover:bg-white/10 flex items-center space-x-2",onClick:K=>{K.stopPropagation(),C(!1),S(!0)},children:[a.jsx(rx,{className:"w-4 h-4"}),a.jsx("span",{children:"Unban User"})]}):a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-yellow-400 hover:bg-white/10 flex items-center space-x-2",onClick:K=>{K.stopPropagation(),C(!1),g(!0)},children:[a.jsx(rx,{className:"w-4 h-4"}),a.jsx("span",{children:"Ban User"})]})),a.jsx("div",{className:"border-t border-white/10 my-1"}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-white/10 flex items-center space-x-2",onClick:K=>{K.stopPropagation(),C(!1),I(!0)},children:[a.jsx(Qu,{className:"w-4 h-4"}),a.jsx("span",{children:"Delete User"})]})]})]})})]})}),a.jsxs("div",{className:"border border-dashed border-white/20 rounded-none",children:[a.jsx("div",{className:"border-b border-dashed border-white/20",children:a.jsx("nav",{className:"flex space-x-8 px-6",children:[{id:"details",name:"Details",icon:gd},{id:"organizations",name:"Organizations",icon:ka,count:s.length},{id:"teams",name:"Teams",icon:Ot,count:o.length},{id:"accounts",name:"Accounts",icon:vo,count:h.length},{id:"sessions",name:"Sessions",icon:_N,count:c.length}].map(K=>a.jsxs("button",{onClick:()=>b(K.id),className:`flex items-center space-x-2 py-4 px-2 border-b-2 font-medium text-sm ${y===K.id?"border-white text-white":"border-transparent text-gray-400 hover:text-white hover:border-white/50"}`,children:[a.jsx(K.icon,{className:"w-4 h-4 text-white/90"}),a.jsxs("span",{className:"inline-flex items-start",children:[a.jsx("span",{className:"font-mono uppercase text-xs font-normal",children:K.name}),K.count!==void 0&&a.jsx("sup",{className:"text-xs text-gray-500 ml-1 inline-flex items-baseline",children:a.jsx(_n,{value:K.count,className:"text-white/80 font-mono text-xs",prefix:a.jsx("span",{className:"mr-0.5 text-gray-500",children:"["}),suffix:a.jsx("span",{className:"ml-0.5 text-gray-500",children:"]"}),format:{notation:"standard",maximumFractionDigits:0}})})]})]},K.id))})}),a.jsxs("div",{className:"p-6",children:[y==="details"&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"BASIC INFORMATION"}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(gd,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Name"}),a.jsx("div",{className:"text-white font-sans text-sm",children:n.name})]})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(ys,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Email"}),a.jsx("div",{className:"text-white font-mono text-sm",children:n.email})]})]}),n.username&&a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Cae,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Username"}),a.jsx("div",{className:"text-white font-mono text-sm",children:n.username})]})]}),n.phoneNumber&&a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Tae,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Phone"}),a.jsx("div",{className:"text-white font-mono text-sm",children:"+251 91 234 5678"})]})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(dr,{className:"w-4 h-4 text-gray-400 mt-1"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500 mb-1",children:"Member Since"}),a.jsx("div",{className:"text-white font-mono text-sm",children:new Date(n.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})})]})]})]})]}),a.jsxs("div",{className:"overflow-x-hidden bg-white/[3%] border border-white/10 p-6 rounded-none",children:[a.jsx("h3",{className:"text-sm uppercase font-mono text-gray-400 mb-4 tracking-wider",children:"SECURITY"}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed my-4"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(ys,{className:"w-4 h-4 text-gray-400"}),a.jsx("div",{children:a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Email Verification"})})]}),a.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.emailVerified?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.emailVerified?"Verified":"Unverified"})]}),a.jsxs("div",{className:"flex items-center justify-between p-3 bg-black/30 border border-white/10 rounded-none",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Rs,{className:"w-4 h-4 text-gray-400"}),a.jsx("div",{children:a.jsx("div",{className:"text-xs uppercase font-mono text-gray-500",children:"Two-Factor Authentication"})})]}),a.jsx("div",{className:`px-2 rounded-none border border-dashed border-white/20 uppercase py-1 text-xs font-mono ${n.twoFactorEnabled?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:n.twoFactorEnabled?"Enabled":"Disabled"})]})]})]})]}),y==="organizations"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Organizations",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:s.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Organizations this user belongs to"})]})}),s.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(ka,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Organizations"}),a.jsx("p",{className:"text-gray-400",children:"This user is not a member of any organizations."})]}):a.jsx("div",{className:"grid gap-4",children:s.map(K=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:K.organization.image?a.jsx("img",{src:K.organization.image,alt:K.organization.name,className:"w-12 h-12 object-cover"}):a.jsx(ka,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[K.organization.name,a.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:K.organization.slug}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[a.jsxs("span",{children:["in ",K.organization.slug]}),a.jsx("button",{onClick:pe=>{pe.stopPropagation(),t(`/organizations/${K.organization.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View organization details",children:a.jsx(yu,{className:"w-3.5 h-3.5"})})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(K.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(K.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Kt(K.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},K.id))})]}),y==="teams"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Teams",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:o.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Teams this user belongs to"})]})}),o.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Ot,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Teams"}),a.jsx("p",{className:"text-gray-400",children:"This user is not a member of any teams."})]}):a.jsx("div",{className:"grid gap-4",children:o.map(K=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:a.jsx(Ot,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[K.team.name,a.jsx(Jt,{id:K.team.id,variant:"subscript",nonSliced:!!(K.team.organizationSlug||K.team.organizationName)})]}),a.jsxs("p",{className:"text-gray-400 text-sm font-sans mt-1 flex items-center gap-2",children:[a.jsxs("span",{children:["in"," ",K.team.organizationSlug||K.team.organizationName]}),a.jsx("button",{onClick:pe=>{pe.stopPropagation(),K.team.organizationId?t(`/organizations/${K.team.organizationId}/teams/${K.team.id}`):t(`/teams/${K.team.id}`)},className:"text-white/60 hover:text-white transition-colors",title:"View team details",children:a.jsx(yu,{className:"w-3.5 h-3.5"})})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Joined:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(K.joinedAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(K.joinedAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>Gt(K.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Remove"]})})]},K.id))})]}),y==="accounts"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Linked Accounts",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:h.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user OAuth account connections"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),L(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(vo,{className:"w-4 h-4 mr-2"}),"Seed Accounts"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(vo,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Linked Accounts"}),a.jsx("p",{className:"text-gray-400",children:"This user has not connected any accounts yet."})]}):a.jsx("div",{className:"grid gap-4",children:h.map(K=>a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:J6(K.providerId)}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:[et(K.providerId),a.jsx(Jt,{id:K.accountId,variant:"subscript",nonSliced:!!(K.email||n.email)})]}),a.jsx("p",{className:"text-gray-400 tracking-tight uppercase text-xs font-mono mt-1",children:`ID: ${K.id}`})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2 text-right",children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-mono text-gray-400",children:[a.jsx("span",{className:"uppercase",children:"Linked:"}),a.jsx("span",{className:"text-white",children:de(K.createdAt||K.updatedAt)})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>ce(K.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(ax,{className:"w-4 h-4 mr-1"}),"Unlink"]})})]},K.id))})]}),y==="sessions"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg relative text-white font-light inline-flex items-start",children:["Sessions",a.jsxs("sup",{className:"text-xs text-gray-500 ml-1 mt-0",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white font-mono text-xs",children:c.length}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsx("p",{className:"text-gray-400 font-light font-mono text-xs uppercase mt-1",children:"Manage user authentication sessions"})]}),a.jsxs(z,{variant:"outline",onClick:()=>{ne([]),se(!1),j(!0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:[a.jsx(Rs,{className:"w-4 h-4 mr-2"}),"Seed Sessions"]})]}),c.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx(_N,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Sessions"}),a.jsx("p",{className:"text-gray-400",children:"This user has no active sessions."})]}):a.jsx("div",{className:"grid gap-4",children:c.map(K=>{var pe,be,_e,$e;return a.jsxs("div",{className:"border border-dashed border-white/10 rounded-none p-4 hover:bg-white/5 transition-colors",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4 flex-1",children:[a.jsx("div",{className:"w-12 h-12 bg-black/80 border border-dashed border-white/20 flex items-center justify-center rounded-none",children:a.jsx(kC,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"text-white font-light inline-flex items-start",children:["Session ",K.id.substring(0,8),"...",a.jsxs("sup",{className:"text-xs text-gray-500 ml-2 mt-0.5",children:[a.jsx("span",{className:"mr-1",children:"["}),a.jsx("span",{className:"text-white/80 font-mono text-xs",children:K.ipAddress}),a.jsx("span",{className:"ml-1",children:"]"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[a.jsx(jae,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsxs("span",{className:"text-gray-400 uppercase font-mono text-xs",children:[((pe=xe[K.id])==null?void 0:pe.city)||"...",","," ",((be=xe[K.id])==null?void 0:be.country)||"..."]}),((_e=xe[K.id])==null?void 0:_e.countryCode)&&a.jsx("span",{className:"text-xs ml-1",children:ft(($e=xe[K.id])==null?void 0:$e.countryCode)})]})]})]}),a.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Expires:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(K.expiresAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(K.expiresAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]}),a.jsxs("span",{className:"text-gray-500 font-mono text-xs uppercase",children:["Created:"," "]}),a.jsxs("span",{className:"text-white font-mono text-xs",children:[new Date(K.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),","," ",new Date(K.createdAt).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]})})]}),a.jsx("div",{className:"flex items-center justify-end",children:a.jsxs(z,{variant:"outline",size:"sm",onClick:()=>_t(K.id),className:"border border-dashed border-red-400/20 text-red-400 hover:bg-red-400/10 rounded-none",children:[a.jsx(rx,{className:"w-4 h-4 mr-1"}),"Revoke"]})})]},K.id)})})]})]})]})]}),w&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-white/15 rounded-none p-6 w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light uppercase font-mono",children:"Edit User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{x(!1),Y("")},className:"text-gray-400 -mt-2 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center mt-2",children:[a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"}),a.jsx("div",{className:"relative z-20 h-4 w-[calc(100%+3rem)] mx-auto -translate-x-1/2 left-1/2 bg-[repeating-linear-gradient(-45deg,#ffffff,#ffffff_1px,transparent_1px,transparent_6px)] opacity-[7%]"}),a.jsx("hr",{className:"w-[calc(100%+3rem)] border-white/10 h-px"})]}),a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-14 h-14 rounded-none border border-dashed border-white/15 bg-white/10 flex items-center justify-center overflow-hidden",children:n!=null&&n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-14 h-14 object-cover"}):a.jsx(gd,{className:"w-7 h-7 text-white"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-white font-medium leading-tight flex items-center gap-2",children:[a.jsx("span",{children:n==null?void 0:n.name}),a.jsx(Jt,{id:(n==null?void 0:n.id)||"",variant:"subscript",nonSliced:!0})]}),a.jsx("div",{className:"text-sm text-gray-400",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-name",className:"text-sm text-gray-400 font-light",children:"Name"}),a.jsx(ve,{id:"edit-name",defaultValue:(n==null?void 0:n.name)||"",placeholder:"e.g. John Doe",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-email",className:"text-sm text-gray-400 font-light",children:"Email"}),a.jsx(ve,{id:"edit-email",type:"email",defaultValue:(n==null?void 0:n.email)||"",placeholder:"e.g. john@example.com",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"edit-role",className:"text-sm text-gray-400 font-light",children:"Role"}),a.jsxs(pn,{value:W,onValueChange:Y,children:[a.jsx(mn,{id:"edit-role",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select role"})}),a.jsxs(gn,{children:[a.jsx(Pe,{value:"",children:"None"}),a.jsx(Pe,{value:"admin",children:"Admin"}),a.jsx(Pe,{value:"user",children:"User"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>{x(!1),Y("")},disabled:Ee,className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:We,disabled:Ee,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:Ee?"Updating...":"Update"})]})]})}),v&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-red-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Ban User"}),a.jsxs("p",{className:"text-gray-400 mb-4",children:["Ban ",a.jsx("strong",{children:n.name})," from accessing the system."]}),a.jsxs("div",{className:"space-y-4 mb-6",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banReason",className:"text-white",children:"Ban Reason"}),a.jsx(ve,{id:"banReason",value:T,onChange:K=>O(K.target.value),placeholder:"Enter reason for ban (optional)",className:"bg-black border border-dashed border-white/20 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"banExpires",className:"text-white",children:"Ban Duration (seconds)"}),a.jsx(ve,{id:"banExpires",type:"number",value:q||"",onChange:K=>k(K.target.value?Number(K.target.value):void 0),placeholder:"Leave empty for permanent ban",className:"bg-black border border-dashed border-white/20 text-white rounded-none"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Examples: 3600 (1 hour), 86400 (1 day), 604800 (1 week)"})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>{g(!1),O(""),k(void 0)},className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:lt,className:"bg-red-600 text-white hover:bg-red-700 rounded-none",children:"Ban User"})]})]})}),N&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black border border-green-400/20 rounded-none p-6 w-full max-w-md",children:[a.jsx("h2",{className:"text-xl font-bold text-white mb-4",children:"Unban User"}),a.jsxs("p",{className:"text-gray-400 mb-6",children:["Are you sure you want to unban ",a.jsx("strong",{children:n.name}),"? This will restore their access to the system."]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(z,{variant:"outline",onClick:()=>S(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:Ut,className:"bg-green-400 text-white hover:bg-green-700 rounded-none",children:"Unban User"})]})]})}),_&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Delete User"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>I(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-16 h-16 bg-black/80 border border-dashed border-white/20 flex items-center justify-center",children:n.image?a.jsx("img",{src:n.image,alt:n.name,className:"w-16 h-16 object-cover"}):a.jsx(gd,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-light",children:n.name}),a.jsx("div",{className:"text-sm text-gray-400",children:n.email})]})]}),a.jsx("p",{className:"text-gray-400",children:"Are you sure you want to delete this user? This action cannot be undone."})]}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>I(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:nt,className:"bg-red-500 hover:bg-red-600 text-white border border-red-500 rounded-none",children:"Delete"})]})]})}),F&&n&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-black/90 border border-dashed border-white/20 p-6 w-full max-w-md rounded-none",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg text-white font-light",children:"Update Password"}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>G(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"new-password",className:"text-sm text-gray-400 font-light",children:"New Password"}),a.jsx(ve,{id:"new-password",type:"password",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]})}),a.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[a.jsx(z,{variant:"outline",onClick:()=>G(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Cancel"}),a.jsx(z,{onClick:async()=>{var be;const K=(be=document.getElementById("new-password"))==null?void 0:be.value;if(!K){V.error("Please enter a password");return}const pe=V.loading("Updating password...");try{const $e=await(await fetch(`/api/users/${e}/password`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:K})})).json();$e.success?(G(!1),document.getElementById("new-password").value="",V.success("Password updated successfully!",{id:pe})):V.error(`Error updating password: ${$e.error||"Unknown error"}`,{id:pe})}catch{V.error("Error updating password",{id:pe})}},className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none",children:"Update"})]})]})}),E&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:a.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(kC,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Sessions"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ie,{htmlFor:"session-count",className:"text-sm text-gray-400 font-light",children:"Number of sessions"}),a.jsx(ve,{id:"session-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsx(z,{onClick:()=>{var pe;const K=parseInt(((pe=document.getElementById("session-count"))==null?void 0:pe.value)||"3",10);Te(K)},disabled:X,className:"bg-transparent hover:bg-white/90 bg-white text-black border border-white/20 rounded-none mt-6 disabled:opacity-50",children:X?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Rs,{className:"w-3 h-3 mr-2"}),"Seed Sessions"]})})]})}),te.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Session Seeding Terminal",lines:te,isRunning:X,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>j(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})}),R&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 overflow-hidden",children:a.jsxs("div",{className:"overflow-x-hidden overflow-y-auto bg-black/90 border border-white/10 p-6 w-full pt-4 max-w-2xl rounded-none max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("h3",{className:"text-sm text-white flex items-center justify-center font-light uppercase",children:[a.jsx("span",{className:"text-white/50 mr-2",children:"["}),a.jsx(vo,{className:"inline mr-2 w-3 h-3 text-white"}),a.jsx("span",{className:"font-mono text-white/70 uppercase",children:"Seed Accounts"}),a.jsx("span",{className:"text-white/50 ml-2",children:"]"})]}),a.jsx(z,{variant:"ghost",size:"sm",onClick:()=>L(!1),className:"text-gray-400 hover:text-white rounded-none",children:a.jsx(dt,{className:"w-4 h-4"})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed -mt-4 mb-4"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"account-count",className:"text-sm text-gray-400 font-light",children:"Number of accounts"}),a.jsx(ve,{id:"account-count",type:"number",min:"1",max:"50",defaultValue:"3",className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none"})]}),a.jsxs("div",{children:[a.jsx(ie,{htmlFor:"account-provider",className:"text-sm text-gray-400 font-light",children:"Provider"}),a.jsxs(pn,{value:P,onValueChange:U,children:[a.jsx(mn,{className:"mt-1 border border-dashed border-white/20 bg-black/30 text-white rounded-none",children:a.jsx(zn,{placeholder:"Select provider"})}),a.jsxs(gn,{className:"bg-black border border-dashed border-white/20",children:[a.jsx(Pe,{value:"random",children:"Mix (Random)"}),a.jsx(Pe,{value:"github",children:"GitHub"}),a.jsx(Pe,{value:"google",children:"Google"}),a.jsx(Pe,{value:"discord",children:"Discord"}),a.jsx(Pe,{value:"facebook",children:"Facebook"}),a.jsx(Pe,{value:"twitter",children:"Twitter"}),a.jsx(Pe,{value:"linkedin",children:"LinkedIn"}),a.jsx(Pe,{value:"apple",children:"Apple"}),a.jsx(Pe,{value:"microsoft",children:"Microsoft"}),a.jsx(Pe,{value:"gitlab",children:"GitLab"}),a.jsx(Pe,{value:"bitbucket",children:"Bitbucket"}),a.jsx(Pe,{value:"spotify",children:"Spotify"}),a.jsx(Pe,{value:"twitch",children:"Twitch"}),a.jsx(Pe,{value:"reddit",children:"Reddit"}),a.jsx(Pe,{value:"slack",children:"Slack"}),a.jsx(Pe,{value:"notion",children:"Notion"}),a.jsx(Pe,{value:"tiktok",children:"TikTok"}),a.jsx(Pe,{value:"zoom",children:"Zoom"})]})]})]})]}),a.jsx(z,{onClick:()=>{var pe;const K=parseInt(((pe=document.getElementById("account-count"))==null?void 0:pe.value)||"3",10);Ze(K,P)},disabled:X,className:"bg-white hover:bg-white/90 text-black border border-white/20 rounded-none disabled:opacity-50",children:X?a.jsxs(a.Fragment,{children:[a.jsx(hn,{className:"w-3 h-3 mr-2 animate-spin"}),"Seeding..."]}):a.jsxs(a.Fragment,{children:[a.jsx(vo,{className:"w-3 h-3 mr-2"}),"Seed Accounts"]})})]}),te.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(Ki,{title:"Account Seeding Terminal",lines:te,isRunning:X,className:"w-full",defaultCollapsed:!0})})]}),a.jsx("hr",{className:"border-white/10 -mx-10 border-dashed mt-10"}),a.jsx("div",{className:"flex justify-end mt-6 pt-6",children:a.jsx(z,{variant:"outline",onClick:()=>L(!1),className:"border border-dashed border-white/20 text-white hover:bg-white/10 rounded-none",children:"Close"})})]})})]}):a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"text-white text-lg",children:"User not found"})})}const Xh=window.__STUDIO_CONFIG__,kp=(Xh==null?void 0:Xh.basePath)!==void 0?Xh.basePath:"",hpe=!!kp;function fpe({children:e}){const[t,n]=p.useState({loading:!0,authenticated:!1,user:null}),r=eo();if(p.useEffect(()=>{(async()=>{try{const i=kp?`${kp}/auth`:"/api/auth",l=await(await fetch(`${i}/session`,{credentials:"include"})).json();n({loading:!1,authenticated:l.authenticated,user:l.user})}catch{n({loading:!1,authenticated:!1,user:null})}})()},[r.pathname]),t.loading)return a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"w-8 h-8 border border-dashed border-white/30 animate-spin"})});if(!t.authenticated){const s=encodeURIComponent(r.pathname+r.search);return a.jsx(_$,{to:`/login?redirect=${s}`,replace:!0})}return a.jsx(a.Fragment,{children:e})}function h4(){return a.jsx(nZ,{children:a.jsx(ZQ,{children:a.jsxs(uN,{children:[a.jsx(En,{path:"/",element:a.jsx(Xae,{})}),a.jsx(En,{path:"/users",element:a.jsx(BU,{})}),a.jsx(En,{path:"/users/:userId",element:a.jsx(upe,{})}),a.jsx(En,{path:"/organizations",element:a.jsx(FU,{})}),a.jsx(En,{path:"/organizations/:orgId",element:a.jsx(kfe,{})}),a.jsx(En,{path:"/teams",element:a.jsx(Rfe,{})}),a.jsx(En,{path:"/teams/:teamId",element:a.jsx(u4,{})}),a.jsx(En,{path:"/organizations/:orgId/teams/:teamId",element:a.jsx(u4,{})}),a.jsx(En,{path:"/sessions",element:a.jsx(Afe,{})}),a.jsx(En,{path:"/database",element:a.jsx(Qae,{})}),a.jsx(En,{path:"/database/demo",element:a.jsx(tZ,{})}),a.jsx(En,{path:"/emails",element:a.jsx(jfe,{})}),a.jsx(En,{path:"/tools",element:a.jsx(dpe,{})}),a.jsx(En,{path:"/settings",element:a.jsx(_fe,{})})]})})})}function ppe(){return a.jsxs(F$,{basename:kp,children:[hpe?a.jsxs(uN,{children:[a.jsx(En,{path:"/login",element:a.jsx(Tfe,{})}),a.jsx(En,{path:"/access-denied",element:a.jsx(QQ,{})}),a.jsx(En,{path:"/*",element:a.jsx(fpe,{children:a.jsx(h4,{})})})]}):a.jsx(uN,{children:a.jsx(En,{path:"/*",element:a.jsx(h4,{})})}),a.jsx(m8,{className:"rounded-none border-dashed border-white/20",theme:"dark",position:"top-right",richColors:!0,toastOptions:{style:{border:"dashed 1px #ffffff20",borderRadius:"0"},className:"font-mono uppercase"},closeButton:!0})]})}const mpe=window.fetch;window.fetch=(e,t)=>{var i;const n=((i=window.__STUDIO_CONFIG__)==null?void 0:i.basePath)||"";let r;return typeof e=="string"?r=e:e instanceof URL?r=e.toString():e instanceof Request?r=e.url:r="",r.startsWith("/api/")&&!r.startsWith("/api/auth/")&&n&&!r.startsWith(n)&&(r=n+r.slice(4),typeof e=="string"?e=r:e instanceof URL?e=new URL(r,window.location.origin):e instanceof Request&&(e=new Request(r,e))),mpe.call(window,e,t)};Fz.createRoot(document.getElementById("root")).render(a.jsx(ee.StrictMode,{children:a.jsx(ppe,{})}));