nucleus-core-ts 0.9.27 → 0.9.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/fe/index.js +4 -4
  2. package/package.json +1 -1
package/dist/fe/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import"../index-40srsvyp.js";import{Canvas as A0,useFrame as Li}from"@react-three/fiber";import{Suspense as K0,useRef as $n}from"react";import{DoubleSide as Z0,ShaderMaterial as Nl,Vector2 as Q0}from"three";import{jsxDEV as kt}from"react/jsx-dev-runtime";var X0=[{size:32,left:"12%",top:"18%",delay:"0s",duration:"8s",opacity:0.55},{size:20,left:"28%",top:"72%",delay:"2s",duration:"7s",opacity:0.4},{size:26,left:"46%",top:"36%",delay:"1s",duration:"6.5s",opacity:0.48},{size:18,left:"64%",top:"58%",delay:"3s",duration:"7.4s",opacity:0.35},{size:24,left:"78%",top:"28%",delay:"1.8s",duration:"8.5s",opacity:0.5},{size:16,left:"86%",top:"62%",delay:"4.1s",duration:"6.8s",opacity:0.38},{size:28,left:"32%",top:"52%",delay:"2.6s",duration:"7.2s",opacity:0.44},{size:14,left:"58%",top:"22%",delay:"0.8s",duration:"6.2s",opacity:0.32}],Sl=`
2
+ import"../index-40srsvyp.js";import{Canvas as K0,useFrame as Bi}from"@react-three/fiber";import{Suspense as Z0,useRef as $n}from"react";import{DoubleSide as Q0,ShaderMaterial as Sl,Vector2 as X0}from"three";import{jsxDEV as kt}from"react/jsx-dev-runtime";var U0=[{size:32,left:"12%",top:"18%",delay:"0s",duration:"8s",opacity:0.55},{size:20,left:"28%",top:"72%",delay:"2s",duration:"7s",opacity:0.4},{size:26,left:"46%",top:"36%",delay:"1s",duration:"6.5s",opacity:0.48},{size:18,left:"64%",top:"58%",delay:"3s",duration:"7.4s",opacity:0.35},{size:24,left:"78%",top:"28%",delay:"1.8s",duration:"8.5s",opacity:0.5},{size:16,left:"86%",top:"62%",delay:"4.1s",duration:"6.8s",opacity:0.38},{size:28,left:"32%",top:"52%",delay:"2.6s",duration:"7.2s",opacity:0.44},{size:14,left:"58%",top:"22%",delay:"0.8s",duration:"6.2s",opacity:0.32}],Cl=`
3
3
  varying vec2 vUv;
4
4
  void main() {
5
5
  vUv = uv;
6
6
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7
7
  }
8
- `,U0=`
8
+ `,E0=`
9
9
  precision highp float;
10
10
 
11
11
  varying vec2 vUv;
@@ -89,7 +89,7 @@ import"../index-40srsvyp.js";import{Canvas as A0,useFrame as Li}from"@react-thre
89
89
 
90
90
  gl_FragColor = vec4(color, 0.95 + uFlashIntensity * 0.012);
91
91
  }
92
- `;function E0(e,t){if(!t)return e;return`${e} ${t}`}function D0(){let e=$n(null),t={uTime:{value:0},uPointer:{value:new Q0(0,0)},uBaseShift:{value:Math.random()*10},uAccentShift:{value:Math.random()*20},uFlashIntensity:{value:0}};function r(n,a){if(!e.current)return;t.uTime.value+=a,t.uPointer.value.set(n.pointer.x,n.pointer.y);let{uniforms:i}=e.current;if(i.uTime)i.uTime.value=t.uTime.value;if(i.uPointer)i.uPointer.value.copy(t.uPointer.value);if(i.uFlashIntensity)i.uFlashIntensity.value=t.uFlashIntensity.value}if(Li(r),e.current===null)e.current=new Nl({vertexShader:Sl,fragmentShader:U0,transparent:!0,depthWrite:!1,side:Z0,uniforms:{uTime:t.uTime,uPointer:t.uPointer,uBaseShift:t.uBaseShift,uAccentShift:t.uAccentShift,uFlashIntensity:t.uFlashIntensity}}),e.current.needsUpdate=!0;return e}function V0({lightningValue:e}){let t=D0(),r=$n(null);function n(a,i){if(!r.current)return;if(t.current?.uniforms.uFlashIntensity)t.current.uniforms.uFlashIntensity.value=e.current;r.current.rotation.z+=i*0.02,r.current.position.x=a.pointer.x*0.08,r.current.position.y=a.pointer.y*0.04;let o=1.04+Math.sin(a.clock.elapsedTime*0.45)*0.02;r.current.scale.set(o,o,o)}return Li(n),kt("mesh",{ref:r,position:[0,0,0],children:[kt("planeGeometry",{args:[4.4,3.2,64,64]},void 0,!1,void 0,this),kt("primitive",{object:t.current,attach:"material"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function j0({lightningValue:e}){let t=$n(null),r=$n(null);if(t.current===null){let a=new Nl({vertexShader:Sl,fragmentShader:`
92
+ `;function D0(e,t){if(!t)return e;return`${e} ${t}`}function V0(){let e=$n(null),t={uTime:{value:0},uPointer:{value:new X0(0,0)},uBaseShift:{value:Math.random()*10},uAccentShift:{value:Math.random()*20},uFlashIntensity:{value:0}};function r(n,a){if(!e.current)return;t.uTime.value+=a,t.uPointer.value.set(n.pointer.x,n.pointer.y);let{uniforms:i}=e.current;if(i.uTime)i.uTime.value=t.uTime.value;if(i.uPointer)i.uPointer.value.copy(t.uPointer.value);if(i.uFlashIntensity)i.uFlashIntensity.value=t.uFlashIntensity.value}if(Bi(r),e.current===null)e.current=new Sl({vertexShader:Cl,fragmentShader:E0,transparent:!0,depthWrite:!1,side:Q0,uniforms:{uTime:t.uTime,uPointer:t.uPointer,uBaseShift:t.uBaseShift,uAccentShift:t.uAccentShift,uFlashIntensity:t.uFlashIntensity}}),e.current.needsUpdate=!0;return e}function j0({lightningValue:e}){let t=V0(),r=$n(null);function n(a,i){if(!r.current)return;if(t.current?.uniforms.uFlashIntensity)t.current.uniforms.uFlashIntensity.value=e.current;r.current.rotation.z+=i*0.02,r.current.position.x=a.pointer.x*0.08,r.current.position.y=a.pointer.y*0.04;let o=1.04+Math.sin(a.clock.elapsedTime*0.45)*0.02;r.current.scale.set(o,o,o)}return Bi(n),kt("mesh",{ref:r,position:[0,0,0],children:[kt("planeGeometry",{args:[4.4,3.2,64,64]},void 0,!1,void 0,this),kt("primitive",{object:t.current,attach:"material"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ep({lightningValue:e}){let t=$n(null),r=$n(null);if(t.current===null){let a=new Sl({vertexShader:Cl,fragmentShader:`
93
93
  precision mediump float;
94
94
  varying vec2 vUv;
95
95
  uniform float uTime;
@@ -107,4 +107,4 @@ import"../index-40srsvyp.js";import{Canvas as A0,useFrame as Li}from"@react-thre
107
107
  color += highlight * 0.28 + vec3(0.82, 0.88, 1.0) * uFlash * 0.22;
108
108
  gl_FragColor = vec4(color, glow * (0.48 + uFlash * 0.12));
109
109
  }
110
- `,uniforms:{uTime:{value:0},uFlash:{value:0}},transparent:!0,depthWrite:!1});t.current=a}function n(a,i){if(!t.current||!r.current)return;if(t.current.uniforms.uTime)t.current.uniforms.uTime.value+=i;if(t.current.uniforms.uFlash)t.current.uniforms.uFlash.value=e.current;r.current.rotation.z+=i*0.08,r.current.position.x=a.pointer.x*0.05,r.current.position.y=a.pointer.y*0.03}return Li(n),kt("mesh",{ref:r,position:[0,0,-0.4],children:[kt("planeGeometry",{args:[5.4,3.8,2,2]},void 0,!1,void 0,this),kt("primitive",{object:t.current,attach:"material"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ep({lightningValue:e}){return kt("group",{children:[kt(V0,{lightningValue:e},void 0,!1,void 0,this),kt(j0,{lightningValue:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function tp(){return kt("div",{className:"absolute inset-0 pointer-events-none",children:X0.map(function(t,r){return kt("span",{className:"marble-bubble",style:{width:`${t.size}px`,height:`${t.size}px`,left:t.left,top:t.top,animationDelay:t.delay,animationDuration:t.duration,opacity:t.opacity}},`bubble-${r}`,!1,void 0,this)})},void 0,!1,void 0,this)}function xt({className:e}){let r=E0("absolute inset-0 overflow-hidden",e),n=$n(0);return kt("div",{className:r,style:{backgroundColor:"transparent"},children:[kt("div",{className:"marble-base-gradient"},void 0,!1,void 0,this),kt("div",{className:"marble-secondary-gradient"},void 0,!1,void 0,this),kt("div",{className:"marble-overlay-gradient"},void 0,!1,void 0,this),kt(K0,{fallback:null,children:kt(A0,{className:"marble-canvas",dpr:[1,1.5],gl:{antialias:!0,alpha:!0},camera:{position:[0,0,2.5],fov:45},style:{position:"absolute",top:"50%",left:"50%",width:"150%",height:"150%",transform:"translate(-50%, -50%)"},children:kt(ep,{lightningValue:n},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),kt("div",{className:"marble-swirl"},void 0,!1,void 0,this),kt(tp,{},void 0,!1,void 0,this),kt("div",{className:"marble-highlight"},void 0,!1,void 0,this),kt("div",{className:"marble-glass"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Xl}from"@gsap/react";import Ul from"gsap";import{useEffect as Wi,useEffectEvent as Yt,useRef as Zl,useState as Ql}from"react";function Pl(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Pl(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Mt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Pl(e))&&(n&&(n+=" "),n+=t);return n}var rp=(e,t)=>{let r=Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},np=(e,t)=>({classGroupId:e,validator:t}),Bl=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r});var Cl=[];var ap=(e)=>{let t=op(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:(o)=>{if(o.startsWith("[")&&o.endsWith("]"))return ip(o);let s=o.split("-"),l=s[0]===""&&s.length>1?1:0;return Wl(s,l,t)},getConflictingClassGroupIds:(o,s)=>{if(s){let l=n[o],c=r[o];if(l){if(c)return rp(c,l);return l}return c||Cl}return r[o]||Cl}}},Wl=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let a=e[t],i=r.nextPart.get(a);if(i){let c=Wl(e,t+1,i);if(c)return c}let o=r.validators;if(o===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=o.length;for(let c=0;c<l;c++){let d=o[c];if(d.validator(s))return d.classGroupId}return},ip=(e)=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),op=(e)=>{let{theme:t,classGroups:r}=e;return lp(r,t)},lp=(e,t)=>{let r=Bl();for(let n in e){let a=e[n];Ri(a,r,n,t)}return r},Ri=(e,t,r,n)=>{let a=e.length;for(let i=0;i<a;i++){let o=e[i];sp(o,t,r,n)}},sp=(e,t,r,n)=>{if(typeof e==="string"){dp(e,t,r);return}if(typeof e==="function"){cp(e,t,r,n);return}pp(e,t,r,n)},dp=(e,t,r)=>{let n=e===""?t:Il(t,e);n.classGroupId=r},cp=(e,t,r,n)=>{if(up(e)){Ri(e(n),t,r,n);return}if(t.validators===null)t.validators=[];t.validators.push(np(r,e))},pp=(e,t,r,n)=>{let a=Object.entries(e),i=a.length;for(let o=0;o<i;o++){let[s,l]=a[o];Ri(l,Il(t,s),r,n)}},Il=(e,t)=>{let r=e,n=t.split("-"),a=n.length;for(let i=0;i<a;i++){let o=n[i],s=r.nextPart.get(o);if(!s)s=Bl(),r.nextPart.set(o,s);r=s}return r},up=(e)=>("isThemeGetter"in e)&&e.isThemeGetter===!0,gp=(e)=>{if(e<1)return{get:()=>{return},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(i,o)=>{if(r[i]=o,t++,t>e)t=0,n=r,r=Object.create(null)};return{get(i){let o=r[i];if(o!==void 0)return o;if((o=n[i])!==void 0)return a(i,o),o},set(i,o){if(i in r)r[i]=o;else a(i,o)}}};var mp=[],Tl=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),bp=(e)=>{let{prefix:t,experimentalParseClassName:r}=e,n=(a)=>{let i=[],o=0,s=0,l=0,c,d=a.length;for(let z=0;z<d;z++){let b=a[z];if(o===0&&s===0){if(b===":"){i.push(a.slice(l,z)),l=z+1;continue}if(b==="/"){c=z;continue}}if(b==="[")o++;else if(b==="]")o--;else if(b==="(")s++;else if(b===")")s--}let g=i.length===0?a:a.slice(l),h=g,k=!1;if(g.endsWith("!"))h=g.slice(0,-1),k=!0;else if(g.startsWith("!"))h=g.slice(1),k=!0;let u=c&&c>l?c-l:void 0;return Tl(i,k,h,u)};if(t){let a=t+":",i=n;n=(o)=>o.startsWith(a)?i(o.slice(a.length)):Tl(mp,!1,o,void 0,!0)}if(r){let a=n;n=(i)=>r({className:i,parseClassName:a})}return n},fp=(e)=>{let t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),(r)=>{let n=[],a=[];for(let i=0;i<r.length;i++){let o=r[i],s=o[0]==="[",l=t.has(o);if(s||l){if(a.length>0)a.sort(),n.push(...a),a=[];n.push(o)}else a.push(o)}if(a.length>0)a.sort(),n.push(...a);return n}},hp=(e)=>({cache:gp(e.cacheSize),parseClassName:bp(e),sortModifiers:fp(e),...ap(e)}),yp=/\s+/,wp=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],s=e.trim().split(yp),l="";for(let c=s.length-1;c>=0;c-=1){let d=s[c],{isExternal:g,modifiers:h,hasImportantModifier:k,baseClassName:u,maybePostfixModifierPosition:z}=r(d);if(g){l=d+(l.length>0?" "+l:l);continue}let b=!!z,C=n(b?u.substring(0,z):u);if(!C){if(!b){l=d+(l.length>0?" "+l:l);continue}if(C=n(u),!C){l=d+(l.length>0?" "+l:l);continue}b=!1}let x=h.length===0?"":h.length===1?h[0]:i(h).join(":"),N=k?x+"!":x,m=N+C;if(o.indexOf(m)>-1)continue;o.push(m);let y=a(C,b);for(let v=0;v<y.length;++v){let p=y[v];o.push(N+p)}l=d+(l.length>0?" "+l:l)}return l},kp=(...e)=>{let t=0,r,n,a="";while(t<e.length)if(r=e[t++]){if(n=Hl(r))a&&(a+=" "),a+=n}return a},Hl=(e)=>{if(typeof e==="string")return e;let t,r="";for(let n=0;n<e.length;n++)if(e[n]){if(t=Hl(e[n]))r&&(r+=" "),r+=t}return r},vp=(e,...t)=>{let r,n,a,i,o=(l)=>{let c=t.reduce((d,g)=>g(d),e());return r=hp(c),n=r.cache.get,a=r.cache.set,i=s,s(l)},s=(l)=>{let c=n(l);if(c)return c;let d=wp(l,r);return a(l,d),d};return i=o,(...l)=>i(kp(...l))},xp=[],Pt=(e)=>{let t=(r)=>r[e]||xp;return t.isThemeGetter=!0,t},$l=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_l=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zp=/^\d+\/\d+$/,Np=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bn=(e)=>zp.test(e),Ie=(e)=>!!e&&!Number.isNaN(Number(e)),Or=(e)=>!!e&&Number.isInteger(Number(e)),Mi=(e)=>e.endsWith("%")&&Ie(e.slice(0,-1)),Tr=(e)=>Np.test(e),Fl=()=>!0,Lp=(e)=>Sp.test(e)&&!Pp.test(e),Bi=()=>!1,Mp=(e)=>Cp.test(e),Rp=(e)=>Tp.test(e),Bp=(e)=>!ge(e)&&!me(e),Wp=(e)=>Jr(e,Jl,Bi),ge=(e)=>$l.test(e),jr=(e)=>Jr(e,Gl,Lp),Ll=(e)=>Jr(e,Jp,Ie),Ip=(e)=>Jr(e,Al,Fl),Hp=(e)=>Jr(e,Yl,Bi),Ml=(e)=>Jr(e,ql,Bi),$p=(e)=>Jr(e,Ol,Rp),pa=(e)=>Jr(e,Kl,Mp),me=(e)=>_l.test(e),_n=(e)=>en(e,Gl),_p=(e)=>en(e,Yl),Rl=(e)=>en(e,ql),Fp=(e)=>en(e,Jl),qp=(e)=>en(e,Ol),ua=(e)=>en(e,Kl,!0),Op=(e)=>en(e,Al,!0),Jr=(e,t,r)=>{let n=$l.exec(e);if(n){if(n[1])return t(n[1]);return r(n[2])}return!1},en=(e,t,r=!1)=>{let n=_l.exec(e);if(n){if(n[1])return t(n[1]);return r}return!1},ql=(e)=>e==="position"||e==="percentage",Ol=(e)=>e==="image"||e==="url",Jl=(e)=>e==="length"||e==="size"||e==="bg-size",Gl=(e)=>e==="length",Jp=(e)=>e==="number",Yl=(e)=>e==="family-name",Al=(e)=>e==="number"||e==="weight",Kl=(e)=>e==="shadow";var Gp=()=>{let e=Pt("color"),t=Pt("font"),r=Pt("text"),n=Pt("font-weight"),a=Pt("tracking"),i=Pt("leading"),o=Pt("breakpoint"),s=Pt("container"),l=Pt("spacing"),c=Pt("radius"),d=Pt("shadow"),g=Pt("inset-shadow"),h=Pt("text-shadow"),k=Pt("drop-shadow"),u=Pt("blur"),z=Pt("perspective"),b=Pt("aspect"),C=Pt("ease"),x=Pt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...m(),me,ge],v=()=>["auto","hidden","clip","visible","scroll"],p=()=>["auto","contain","none"],f=()=>[me,ge,l],M=()=>[bn,"full","auto",...f()],$=()=>[Or,"none","subgrid",me,ge],J=()=>["auto",{span:["full",Or,me,ge]},Or,me,ge],U=()=>[Or,"auto",me,ge],E=()=>["auto","min","max","fr",me,ge],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...f()],S=()=>[bn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...f()],O=()=>[e,me,ge],A=()=>[...m(),Rl,Ml,{position:[me,ge]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",Fp,Wp,{size:[me,ge]}],H=()=>[Mi,_n,jr],T=()=>["","none","full",c,me,ge],ie=()=>["",Ie,_n,jr],q=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[Ie,Mi,Rl,Ml],Ze=()=>["","none",u,me,ge],$e=()=>["none",Ie,me,ge],Ce=()=>["none",Ie,me,ge],fe=()=>[Ie,me,ge],xe=()=>[bn,"full",...f()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tr],breakpoint:[Tr],color:[Fl],container:[Tr],"drop-shadow":[Tr],ease:["in","out","in-out"],font:[Bp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tr],shadow:[Tr],spacing:["px",Ie],text:[Tr],"text-shadow":[Tr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bn,ge,me,b]}],container:["container"],columns:[{columns:[Ie,ge,me,s]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:v()}],"overflow-x":[{"overflow-x":v()}],"overflow-y":[{"overflow-y":v()}],overscroll:[{overscroll:p()}],"overscroll-x":[{"overscroll-x":p()}],"overscroll-y":[{"overscroll-y":p()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Or,"auto",me,ge]}],basis:[{basis:[bn,"full","auto",s,...f()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,bn,"auto","initial","none",ge]}],grow:[{grow:["",Ie,me,ge]}],shrink:[{shrink:["",Ie,me,ge]}],order:[{order:[Or,"first","last","none",me,ge]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:f()}],"gap-x":[{"gap-x":f()}],"gap-y":[{"gap-y":f()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:f()}],px:[{px:f()}],py:[{py:f()}],ps:[{ps:f()}],pe:[{pe:f()}],pt:[{pt:f()}],pr:[{pr:f()}],pb:[{pb:f()}],pl:[{pl:f()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":f()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":f()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],w:[{w:[s,"screen",...S()]}],"min-w":[{"min-w":[s,"screen","none",...S()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",r,_n,jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Op,Ip]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mi,ge]}],"font-family":[{font:[_p,Hp,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,me,ge]}],"line-clamp":[{"line-clamp":[Ie,"none",me,Ll]}],leading:[{leading:[i,...f()]}],"list-image":[{"list-image":["none",me,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",me,jr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Ie,"auto",me,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:f()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",me,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Or,me,ge],radial:["",me,ge],conic:[Or,me,ge]},qp,$p]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,me,ge]}],"outline-w":[{outline:["",Ie,_n,jr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",d,ua,pa]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",g,ua,pa]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Ie,jr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,ua,pa]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Ie,me,ge]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[me,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":m()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,ge]}],filter:[{filter:["","none",me,ge]}],blur:[{blur:Ze()}],brightness:[{brightness:[Ie,me,ge]}],contrast:[{contrast:[Ie,me,ge]}],"drop-shadow":[{"drop-shadow":["","none",k,ua,pa]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Ie,me,ge]}],"hue-rotate":[{"hue-rotate":[Ie,me,ge]}],invert:[{invert:["",Ie,me,ge]}],saturate:[{saturate:[Ie,me,ge]}],sepia:[{sepia:["",Ie,me,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",me,ge]}],"backdrop-blur":[{"backdrop-blur":Ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,me,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,me,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,me,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,me,ge]}],"backdrop-invert":[{"backdrop-invert":["",Ie,me,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,me,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,me,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,me,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":f()}],"border-spacing-x":[{"border-spacing-x":f()}],"border-spacing-y":[{"border-spacing-y":f()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",me,ge]}],ease:[{ease:["linear","initial",C,me,ge]}],delay:[{delay:[Ie,me,ge]}],animate:[{animate:["none",x,me,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[z,me,ge]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:$e()}],"rotate-x":[{"rotate-x":$e()}],"rotate-y":[{"rotate-y":$e()}],"rotate-z":[{"rotate-z":$e()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[me,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",me,ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":f()}],"scroll-mx":[{"scroll-mx":f()}],"scroll-my":[{"scroll-my":f()}],"scroll-ms":[{"scroll-ms":f()}],"scroll-me":[{"scroll-me":f()}],"scroll-mt":[{"scroll-mt":f()}],"scroll-mr":[{"scroll-mr":f()}],"scroll-mb":[{"scroll-mb":f()}],"scroll-ml":[{"scroll-ml":f()}],"scroll-p":[{"scroll-p":f()}],"scroll-px":[{"scroll-px":f()}],"scroll-py":[{"scroll-py":f()}],"scroll-ps":[{"scroll-ps":f()}],"scroll-pe":[{"scroll-pe":f()}],"scroll-pt":[{"scroll-pt":f()}],"scroll-pr":[{"scroll-pr":f()}],"scroll-pb":[{"scroll-pb":f()}],"scroll-pl":[{"scroll-pl":f()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",me,ge]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Ie,_n,jr,Ll]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var Rt=vp(Gp);function w(...e){return Rt(Mt(e))}import{batch as Yp,createStore as Ap}from"h-state";var Kp={roles:[],claims:[],roleClaims:[],selectedRole:null,newRoleName:"",newRoleDescription:"",searchClaim:"",entityFilter:"all",methodFilter:"all",showAssignedOnly:!1,activeTab:"roles",editingScopeClaimId:null,scopeInputValue:"",editingRoleId:null,editRoleDescription:""},{useStore:ga}=Ap(Kp,{setRoles:(e)=>(t)=>{e.roles=t},setClaims:(e)=>(t)=>{e.claims=t},setRoleClaims:(e)=>(t)=>{e.roleClaims=t},setSelectedRole:(e)=>(t)=>{e.selectedRole=t},setNewRoleName:(e)=>(t)=>{e.newRoleName=t},setNewRoleDescription:(e)=>(t)=>{e.newRoleDescription=t},setSearchClaim:(e)=>(t)=>{e.searchClaim=t},setEntityFilter:(e)=>(t)=>{e.entityFilter=t},setMethodFilter:(e)=>(t)=>{e.methodFilter=t},setShowAssignedOnly:(e)=>(t)=>{e.showAssignedOnly=t},setActiveTab:(e)=>(t)=>{e.activeTab=t},addRole:(e)=>(t)=>{e.roles=[...e.roles,t]},removeRole:(e)=>(t)=>{if(e.roles=e.roles.filter((r)=>r.id!==t),e.selectedRole?.id===t)e.selectedRole=null},addRoleClaim:(e)=>(t)=>{e.roleClaims=[...e.roleClaims,t]},removeRoleClaim:(e)=>(t)=>{e.roleClaims=e.roleClaims.filter((r)=>r.id!==t)},updateRoleClaimScope:(e)=>(t,r)=>{e.roleClaims=e.roleClaims.map((n)=>n.id===t?{...n,scope:r}:n)},setEditingScopeClaimId:(e)=>(t)=>{if(e.editingScopeClaimId=t,t===null)e.scopeInputValue=""},setScopeInputValue:(e)=>(t)=>{e.scopeInputValue=t},setEditingRoleId:(e)=>(t)=>{if(e.editingRoleId=t,t===null)e.editRoleDescription=""},setEditRoleDescription:(e)=>(t)=>{e.editRoleDescription=t},updateRole:(e)=>(t,r)=>{if(e.roles=e.roles.map((n)=>n.id===t?{...n,...r}:n),e.selectedRole?.id===t)e.selectedRole={...e.selectedRole,...r}},resetForm:(e)=>()=>{Yp(()=>{e.newRoleName="",e.newRoleDescription=""})}});import{jsxDEV as X}from"react/jsx-dev-runtime";Ul.registerPlugin(Xl);var Zp={GET:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",POST:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",PUT:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",PATCH:"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20",DELETE:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"};function El({title:e="Authorization Management",subtitle:t,className:r,defaultEntityFilter:n="all",defaultMethodFilter:a="all",defaultShowAssignedOnly:i=!1,getRolesAction:o,addRoleAction:s,updateRoleAction:l,deleteRoleAction:c,getClaimsAction:d,getRoleClaimsAction:g,addRoleClaimAction:h,updateRoleClaimAction:k,deleteRoleClaimAction:u,onRoleCreated:z,onRoleDeleted:b,onClaimToggled:C}){let x=ga(),N=Zl(null),m=Zl(null),[y,v]=Ql(new Set),[p,f]=Ql("");Xl(()=>{if(!m.current)return;Ul.fromTo(m.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:N});let M=Yt(()=>{o.start({payload:{page:1,limit:100},onAfterHandle:(I)=>{if(I.data?.items)x.setRoles(I.data.items)}})}),$=Yt(()=>{d.start({payload:{page:1,limit:1000},onAfterHandle:(I)=>{if(I.data?.items)x.setClaims(I.data.items)}})}),J=Yt((I)=>{g.start({payload:{page:1,limit:1000,filters:[{field:"role_id",operator:"eq",value:I}]},onAfterHandle:(ue)=>{if(ue.data?.items)x.setRoleClaims(ue.data.items)}})});Wi(()=>{M(),$()},[]);let U=Yt(()=>{x.setEntityFilter(n),x.setMethodFilter(a),x.setShowAssignedOnly(i)});Wi(()=>{U()},[]),Wi(()=>{if(x.selectedRole)J(x.selectedRole.id);else x.setRoleClaims([])},[x.selectedRole]);let E=Yt(()=>{if(!x.newRoleName.trim())return;let I=`temp-${Date.now()}`,ue={id:I,name:x.newRoleName.trim(),description:x.newRoleDescription.trim()||"",createdAt:new Date,updatedAt:new Date};x.addRole(ue),x.resetForm(),s.start({payload:{name:ue.name,description:ue.description||void 0},onAfterHandle:(We)=>{if(M(),We.data)z?.(We.data)},onErrorHandle:()=>{x.removeRole(I)}})}),Z=Yt((I)=>{let ue=x.roles.find((We)=>We.id===I);if(!ue)return;x.removeRole(I),c.start({payload:{id:I},onAfterHandle:()=>{M(),b?.(I)},onErrorHandle:()=>{if(ue)x.addRole(ue)}})}),B=Yt((I)=>{x.setEditingRoleId(I.id),x.setEditRoleDescription(I.description||"")}),Q=Yt(()=>{x.setEditingRoleId(null)}),S=Yt(()=>{let I=x.editingRoleId;if(!I||!l)return;let ue=x.roles.find((gt)=>gt.id===I);if(!ue)return;let We=ue.description,Ue=x.editRoleDescription;x.updateRole(I,{description:Ue}),x.setEditingRoleId(null),l.start({payload:{id:I,description:Ue},onAfterHandle:()=>{M()},onErrorHandle:()=>{x.updateRole(I,{description:We})}})}),O=Yt((I,ue)=>{let We=x.selectedRole;if(!We)return;let Ue=We.id;if(ue){let gt=x.roleClaims.find((Ge)=>Ge.claimId===I.id);if(!gt)return;x.removeRoleClaim(gt.id),u.start({payload:{id:gt.id},onAfterHandle:()=>{J(Ue),C?.(I,!1)},onErrorHandle:()=>{x.addRoleClaim(gt)}})}else{let gt=`temp-${Date.now()}`,Ge={id:gt,roleId:Ue,claimId:I.id,scope:"",createdAt:new Date,updatedAt:new Date};x.addRoleClaim(Ge),h.start({payload:[{roleId:Ue,claimId:I.id}],onAfterHandle:()=>{J(Ue),C?.(I,!0)},onErrorHandle:()=>{x.removeRoleClaim(gt)}})}}),A=Yt((I)=>{x.setSelectedRole(I)}),ee=Yt((I)=>{x.setSearchClaim(I)}),_=Yt((I)=>{x.setEntityFilter(I||"all")}),H=Yt((I)=>{x.setMethodFilter(I||"all")}),T=Yt((I)=>{x.setShowAssignedOnly(I)}),ie=Yt((I,ue)=>{if(!k||!x.selectedRole)return;x.updateRoleClaimScope(I,ue),k.start({payload:{id:I,scope:ue},onAfterHandle:()=>{J(x.selectedRole?.id||"")},onErrorHandle:()=>{J(x.selectedRole?.id||"")}})}),q=(I)=>{let ue=I.split(".");if(ue[1]==="bulk")return ue[2]||"bulk";return ue[1]||"other"},ce=x.searchClaim.trim().toLowerCase(),oe=x.entityFilter.toLowerCase(),Ze=x.methodFilter.toLowerCase(),$e=x.showAssignedOnly&&!!x.selectedRole,Ce=new Set(x.roleClaims.map((I)=>I.claimId)),fe=x.claims.filter((I)=>{let ue=ce?I.action.toLowerCase().includes(ce)||I.description.toLowerCase().includes(ce):!0,We=q(I.action).toLowerCase(),Ue=oe==="all"||We===oe,gt=Ze==="all"||I.method.toLowerCase()===Ze,Ge=$e?Ce.has(I.id):!0;return ue&&Ue&&gt&&Ge}),xe=[{value:"all",label:"All Entities"},...Array.from(new Set(x.claims.map((I)=>q(I.action)))).sort((I,ue)=>I.localeCompare(ue)).map((I)=>({value:I,label:I}))],Oe=[{value:"all",label:"All Methods"},{value:"get",label:"GET"},{value:"post",label:"POST"},{value:"put",label:"PUT"},{value:"patch",label:"PATCH"},{value:"delete",label:"DELETE"}],Le=fe.reduce((I,ue)=>{let We=q(ue.action);if(!I[We])I[We]=[];return I[We].push(ue),I},{}),ve=Object.keys(Le).sort((I,ue)=>I.localeCompare(ue)),R=(I)=>{v((ue)=>{let We=new Set(ue);if(We.has(I))We.delete(I);else We.add(I);return We})},de=()=>{v(new Set(ve))},te=()=>{v(new Set)},ye=(I,ue)=>{let We=Le[I]||[];for(let Ue of We){let gt=Ce.has(Ue.id);if(ue&&!gt)O(Ue,!1);else if(!ue&&gt)O(Ue,!0)}},D=(I)=>{return(Le[I]||[]).filter((We)=>Ce.has(We.id)).length},j=(I)=>x.roleClaims.find((ue)=>ue.claimId===I),re=(I)=>{if(k&&x.scopeInputValue!==void 0)ie(I,x.scopeInputValue),x.setEditingScopeClaimId(null)},Ke=(I,ue)=>{x.setScopeInputValue(ue||""),x.setEditingScopeClaimId(I)};return X("main",{ref:N,className:w("min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6 lg:p-8",r),children:X("div",{ref:m,className:"max-w-[1600px] mx-auto",children:[X("header",{className:"mb-6",children:[X("h1",{className:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",children:e},void 0,!1,void 0,this),t&&X("p",{className:"mt-1 text-sm text-zinc-500 dark:text-zinc-400",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"grid grid-cols-1 xl:grid-cols-[320px_1fr] gap-6",children:[X("aside",{className:"space-y-4",children:[X("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[X("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Roles"},void 0,!1,void 0,this),X("div",{className:"space-y-2 mb-4",children:[X("input",{type:"text",value:x.newRoleName,onChange:(I)=>x.setNewRoleName(I.target.value),placeholder:"New role name",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),X("button",{type:"button",onClick:E,disabled:!x.newRoleName.trim()||s.state.isPending,className:"w-full px-3 py-2 text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:s.state.isPending?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:x.roles.map((I)=>X("div",{className:w("w-full text-left px-3 py-2 rounded-lg text-sm transition-colors group",I.id.startsWith("temp-")&&"opacity-50",x.selectedRole?.id===I.id?"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-900 dark:text-emerald-100":"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300"),children:[X("div",{className:"flex items-center justify-between",children:[X("button",{type:"button",onClick:()=>A(I),disabled:I.id.startsWith("temp-"),className:"flex-1 text-left truncate disabled:cursor-not-allowed font-medium",children:I.name},void 0,!1,void 0,this),X("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[I.name!=="godmin"&&!I.id.startsWith("temp-")&&l&&X("button",{type:"button",onClick:()=>B(I),className:"p-1 text-zinc-500 hover:text-emerald-600 transition-colors",title:"Edit description",children:X("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),I.name!=="godmin"&&!I.id.startsWith("temp-")&&X("button",{type:"button",onClick:()=>Z(I.id),className:"p-1 text-red-500 hover:text-red-700 transition-colors",title:"Delete role",children:X("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x.editingRoleId===I.id?X("div",{className:"mt-2 space-y-2",children:[X("textarea",{value:x.editRoleDescription,onChange:(ue)=>x.setEditRoleDescription(ue.target.value),placeholder:"Enter description...",rows:2,className:"w-full px-2 py-1.5 text-xs border border-zinc-200 dark:border-zinc-700 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 resize-none"},void 0,!1,void 0,this),X("div",{className:"flex gap-2",children:[X("button",{type:"button",onClick:S,className:"flex-1 px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),X("button",{type:"button",onClick:Q,className:"flex-1 px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 rounded transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):I.description&&X("p",{className:"mt-1 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:I.description},void 0,!1,void 0,this)]},I.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[X("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Filters"},void 0,!1,void 0,this),X("div",{className:"space-y-3",children:[X("div",{children:[X("label",{htmlFor:"claim-search",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Search"},void 0,!1,void 0,this),X("input",{id:"claim-search",type:"text",value:p,onChange:(I)=>{f(I.target.value),ee(I.target.value)},placeholder:"Search claims...",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{children:[X("label",{htmlFor:"entity-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Entity"},void 0,!1,void 0,this),X("select",{id:"entity-filter",value:x.entityFilter,onChange:(I)=>_(I.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:xe.map((I)=>X("option",{value:I.value,children:I.label},I.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{children:[X("label",{htmlFor:"method-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Method"},void 0,!1,void 0,this),X("select",{id:"method-filter",value:x.methodFilter,onChange:(I)=>H(I.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:Oe.map((I)=>X("option",{value:I.value,children:I.label},I.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("label",{className:"flex items-center gap-2 cursor-pointer",children:[X("input",{type:"checkbox",checked:x.showAssignedOnly,onChange:(I)=>T(I.target.checked),disabled:!x.selectedRole,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),X("span",{className:w("text-sm",!x.selectedRole?"text-zinc-400":"text-zinc-700 dark:text-zinc-300"),children:"Show assigned only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x.selectedRole&&X("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 rounded-xl border border-emerald-200 dark:border-emerald-800 p-4",children:[X("div",{className:"text-sm font-medium text-emerald-900 dark:text-emerald-100",children:x.selectedRole.name},void 0,!1,void 0,this),X("div",{className:"text-2xl font-bold text-emerald-600 dark:text-emerald-400 mt-1",children:x.roleClaims.length},void 0,!1,void 0,this),X("div",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"claims assigned"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("section",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800",children:[X("div",{className:"p-4 border-b border-zinc-200 dark:border-zinc-800 flex flex-wrap items-center justify-between gap-3",children:[X("div",{children:[X("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Claims"},void 0,!1,void 0,this),X("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[fe.length," of ",x.claims.length," claims \u2022 ",ve.length," ","entities"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"flex items-center gap-2",children:[X("button",{type:"button",onClick:de,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Expand All"},void 0,!1,void 0,this),X("button",{type:"button",onClick:te,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Collapse All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"max-h-[calc(100vh-280px)] overflow-y-auto",children:ve.length===0?X("div",{className:"p-8 text-center text-zinc-500 dark:text-zinc-400",children:"No claims match your filters"},void 0,!1,void 0,this):ve.map((I)=>{let ue=Le[I]||[],We=y.has(I),Ue=D(I),gt=Ue===ue.length;return X("div",{className:"border-b border-zinc-100 dark:border-zinc-800 last:border-b-0",children:[X("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",onClick:()=>R(I),children:X("div",{className:"flex items-center gap-3",children:[X("svg",{className:w("w-4 h-4 text-zinc-400 transition-transform",We&&"rotate-90"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X("span",{className:"font-medium text-zinc-900 dark:text-zinc-100",children:I},void 0,!1,void 0,this),X("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[ue.length," claims"]},void 0,!0,void 0,this),x.selectedRole&&X("span",{className:w("text-xs px-2 py-0.5 rounded-full",gt?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":Ue>0?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"),children:[Ue,"/",ue.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x.selectedRole&&x.selectedRole.name!=="godmin"&&X("div",{className:"flex items-center gap-2 px-4 pb-2",children:[X("button",{type:"button",onClick:()=>ye(I,!0),className:"px-2 py-1 text-xs font-medium text-emerald-600 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 border border-emerald-200 dark:border-emerald-800 rounded",children:"Assign All"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>ye(I,!1),className:"px-2 py-1 text-xs font-medium text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 border border-red-200 dark:border-red-800 rounded",children:"Remove All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),We&&X("div",{className:"px-4 pb-3",children:X("div",{className:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg divide-y divide-zinc-100 dark:divide-zinc-700/50",children:ue.map((Ge)=>{let Qt=Ce.has(Ge.id),$t=j(Ge.id),zr=x.editingScopeClaimId===Ge.id,ne=$t?.scope||"",W=Ge.id.startsWith("temp-")||$t?.id.startsWith("temp-");return X("div",{className:w("p-3 transition-colors",Qt&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:X("div",{className:"flex items-start gap-3",children:[X("input",{type:"checkbox",checked:Qt,onChange:()=>O(Ge,Qt),disabled:!x.selectedRole||x.selectedRole.name==="godmin"||W||h.state.isPending||u.state.isPending,className:"mt-1 w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),X("div",{className:"flex-1 min-w-0",children:[X("div",{className:"flex items-center gap-2 flex-wrap",children:[X("code",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:Ge.action},void 0,!1,void 0,this),X("span",{className:w("px-1.5 py-0.5 text-xs font-medium rounded border",Zp[Ge.method]||"bg-zinc-100 text-zinc-600"),children:Ge.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:Ge.description},void 0,!1,void 0,this),Qt&&$t&&!W&&X("div",{className:"mt-2",children:zr?X("div",{className:"flex items-center gap-2",children:[X("input",{type:"text",value:x.scopeInputValue,onChange:(V)=>x.setScopeInputValue(V.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>re($t.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>x.setEditingScopeClaimId(null),className:"px-2 py-1 text-xs font-medium text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):X("button",{type:"button",onClick:()=>Ke(Ge.id,ne),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:ne?X("span",{className:"font-mono bg-zinc-200 dark:bg-zinc-700 px-1.5 py-0.5 rounded",children:["scope: ",ne]},void 0,!0,void 0,this):X("span",{className:"italic hover:underline",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},Ge.id,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},I,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var vt={container:"min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6",header:{wrapper:"mb-6 sm:mb-8",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm sm:text-base text-zinc-500 dark:text-zinc-400 mt-1"},tabs:{wrapper:"flex gap-2 sm:gap-4 mb-4 sm:mb-6",button:"px-3 sm:px-4 py-2 rounded-lg font-medium transition-colors text-sm sm:text-base",buttonActive:"bg-blue-600 text-white",buttonInactive:"bg-zinc-200 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-300 dark:hover:bg-zinc-700"},filters:{wrapper:"mb-4 sm:mb-6 md:mb-6 lg:mb-8 xl:mb-8 2xl:mb-10",row:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8",control:"flex flex-col justify-end",search:"sm:col-span-2 md:col-span-2 lg:col-span-2 xl:col-span-3 2xl:col-span-4",searchContainer:"w-full",searchInput:"text-sm sm:text-sm md:text-sm lg:text-sm xl:text-base 2xl:text-base",toggle:"items-start sm:items-end"},card:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl shadow-sm border border-zinc-200 dark:border-zinc-800 p-4 sm:p-6",header:"text-lg sm:text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-4"},roleList:{wrapper:"space-y-2",item:"w-full text-left p-3 sm:p-4 rounded-lg cursor-pointer transition-colors border",itemSelected:"bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-500",itemHover:"bg-zinc-50 dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-blue-300 dark:hover:border-blue-700",name:"font-medium text-zinc-900 dark:text-zinc-100",description:"text-sm text-zinc-500 dark:text-zinc-400 mt-1",badge:"ml-2 px-2 py-0.5 text-xs bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 rounded-full",deleteButton:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors"},claimList:{wrapper:"space-y-4",group:"border border-zinc-200 dark:border-zinc-700 rounded-lg overflow-hidden",groupHeader:"bg-zinc-100 dark:bg-zinc-800 px-3 sm:px-4 py-2 font-medium text-zinc-700 dark:text-zinc-300 capitalize text-sm sm:text-base",item:"px-3 sm:px-4 py-2",itemAction:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",itemDescription:"text-xs text-zinc-500 dark:text-zinc-400",methodBadge:{get:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",post:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",put:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",patch:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",delete:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300"}},form:{wrapper:"mb-4 sm:mb-6 p-3 sm:p-4 bg-zinc-50 dark:bg-zinc-800 rounded-lg",title:"text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-3",input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors text-sm sm:text-base",buttonDisabled:"opacity-50 cursor-not-allowed"},search:{input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base mb-4"},checkbox:{wrapper:"flex items-center gap-3 px-3 sm:px-4 py-2 hover:bg-zinc-50 dark:hover:bg-zinc-800 cursor-pointer",input:"w-4 h-4 text-blue-600 rounded border-zinc-300 dark:border-zinc-600 focus:ring-blue-500",label:"flex-1 min-w-0"},empty:{wrapper:"text-center py-6 sm:py-8",icon:"w-10 h-10 sm:w-12 sm:h-12 mx-auto text-purple-500 mb-2",text:"text-zinc-600 dark:text-zinc-400"},loading:{wrapper:"text-center py-6 sm:py-8",text:"text-zinc-500 text-sm sm:text-base"},stats:{text:"text-sm text-zinc-500 dark:text-zinc-400 mb-4"}};function Dl(e){return{...vt,...e,header:{...vt.header,...e.header},tabs:{...vt.tabs,...e.tabs},filters:{...vt.filters,...e.filters},card:{...vt.card,...e.card},roleList:{...vt.roleList,...e.roleList},claimList:{...vt.claimList,...e.claimList,methodBadge:{...vt.claimList.methodBadge,...e.claimList?.methodBadge}},form:{...vt.form,...e.form},search:{...vt.search,...e.search},checkbox:{...vt.checkbox,...e.checkbox},empty:{...vt.empty,...e.empty},loading:{...vt.loading,...e.loading},stats:{...vt.stats,...e.stats}}}import{jsxDEV as Ft}from"react/jsx-dev-runtime";function Vl({claims:e,isLoading:t}){let r=vt,n=(o)=>{let s=o.split(".");if(s[1]==="bulk")return s[2]||"bulk";return s[1]||"other"},a=e.reduce((o,s)=>{let l=n(s.action);if(!o[l])o[l]=[];return o[l].push(s),o},{}),i=(o)=>{let s=o.toLowerCase();if(s==="get")return r.claimList.methodBadge.get;if(s==="post")return r.claimList.methodBadge.post;if(s==="put")return r.claimList.methodBadge.put;if(s==="patch")return r.claimList.methodBadge.patch;if(s==="delete")return r.claimList.methodBadge.delete;return r.claimList.methodBadge.get};return Ft("div",{className:r.card.wrapper,children:[Ft("h2",{className:r.card.header,children:"All Claims"},void 0,!1,void 0,this),t?Ft("div",{className:r.loading.wrapper,children:Ft("span",{className:r.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(a).length===0?Ft("div",{className:r.empty.wrapper,children:Ft("span",{className:r.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Ft("div",{className:r.claimList.wrapper,children:Object.entries(a).map(([o,s])=>Ft("div",{className:r.claimList.group,children:[Ft("div",{className:r.claimList.groupHeader,children:[o," (",s.length,")"]},void 0,!0,void 0,this),Ft("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:s.map((l)=>Ft("div",{className:r.claimList.item,children:Ft("div",{className:"flex items-center justify-between",children:[Ft("div",{className:"flex-1 min-w-0",children:[Ft("div",{className:r.claimList.itemAction,children:l.action},void 0,!1,void 0,this),Ft("div",{className:r.claimList.itemDescription,children:l.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ft("div",{className:"flex items-center gap-2",children:Ft("span",{className:w("px-2 py-0.5 text-xs rounded-full",i(l.method)),children:l.method},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},l.id,!1,void 0,this))},void 0,!1,void 0,this)]},o,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Fe}from"react/jsx-dev-runtime";function jl({selectedRole:e,claims:t,roleClaims:r,isLoading:n,isToggling:a,onToggleClaim:i,onUpdateScope:o,editingScope:s,onEditScope:l,scopeValue:c,onScopeValueChange:d}){let g=vt,h=(N)=>{let m=N.split(".");if(m[1]==="bulk")return m[2]||"bulk";return m[1]||"other"},k=t.reduce((N,m)=>{let y=h(m.action);if(!N[y])N[y]=[];return N[y].push(m),N},{}),u=(N)=>r.some((m)=>m.claimId===N),z=(N)=>r.find((m)=>m.claimId===N),b=(N)=>{if(o&&c!==void 0)o(N,c),l?.(null)},C=()=>{l?.(null)},x=(N,m)=>{d?.(m||""),l?.(N)};if(!e)return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:"Select a role"},void 0,!1,void 0,this),Fe("div",{className:g.empty.wrapper,children:Fe("span",{className:g.empty.text,children:"Select a role from the list to manage its claims"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.name==="godmin")return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),Fe("div",{className:g.empty.wrapper,children:[Fe("svg",{className:g.empty.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Fe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Fe("p",{className:g.empty.text,children:["Godmin role has full access to all resources.",Fe("br",{},void 0,!1,void 0,this),"Claims cannot be modified."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),Fe("div",{className:g.stats.text,children:[r.length," claims assigned"]},void 0,!0,void 0,this),n?Fe("div",{className:g.loading.wrapper,children:Fe("span",{className:g.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(k).length===0?Fe("div",{className:g.empty.wrapper,children:Fe("span",{className:g.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Fe("div",{className:"max-h-[500px] overflow-y-auto space-y-4",children:Object.entries(k).map(([N,m])=>Fe("div",{className:g.claimList.group,children:[Fe("div",{className:g.claimList.groupHeader,children:[N," (",m.length,")"]},void 0,!0,void 0,this),Fe("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:m.map((y)=>{let v=u(y.id),p=z(y.id),f=s===y.id,M=p?.scope||"";return Fe("div",{className:w("py-3 px-2 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",v&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:Fe("div",{className:"flex items-start gap-3",children:[Fe("input",{type:"checkbox",checked:v,onChange:()=>i(y,v),disabled:a||y.id.startsWith("temp-"),className:w(g.checkbox.input,"mt-1 shrink-0")},void 0,!1,void 0,this),Fe("div",{className:"flex-1 min-w-0",children:[Fe("div",{className:"flex items-center gap-2 flex-wrap",children:[Fe("span",{className:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",children:y.action},void 0,!1,void 0,this),Fe("span",{className:w("px-1.5 py-0.5 text-xs font-medium rounded",y.method==="GET"&&"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",y.method==="POST"&&"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",y.method==="PUT"&&"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",y.method==="PATCH"&&"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",y.method==="DELETE"&&"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:y.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Fe("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:y.description},void 0,!1,void 0,this),v&&p&&!p.id.startsWith("temp-")&&Fe("div",{className:"mt-2",children:f?Fe("div",{className:"flex items-center gap-2",children:[Fe("input",{type:"text",value:c||"",onChange:($)=>d?.($.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),Fe("button",{type:"button",onClick:()=>b(p.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),Fe("button",{type:"button",onClick:C,className:"px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Fe("button",{type:"button",onClick:()=>x(y.id,M),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:M?Fe("span",{className:"font-mono bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:["Scope: ",M]},void 0,!0,void 0,this):Fe("span",{className:"italic",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},y.id,!1,void 0,this)})},void 0,!1,void 0,this)]},N,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as zt}from"react/jsx-dev-runtime";function es({roles:e,selectedRole:t,isLoading:r,isCreating:n,isDeleting:a,newRoleName:i,newRoleDescription:o,onNewRoleNameChange:s,onNewRoleDescriptionChange:l,onSelectRole:c,onDeleteRole:d,onCreateRole:g}){let h=vt,k=(z,b)=>{if(z.stopPropagation(),confirm("Are you sure you want to delete this role?"))d(b)},u=(z)=>z.startsWith("temp-");return zt("div",{className:h.card.wrapper,children:[zt("h2",{className:h.card.header,children:"Roles"},void 0,!1,void 0,this),zt("div",{className:h.form.wrapper,children:[zt("h3",{className:h.form.title,children:"Create New Role"},void 0,!1,void 0,this),zt("div",{className:"space-y-3",children:[zt("input",{type:"text",placeholder:"Role name",value:i,onChange:(z)=>s(z.target.value),className:h.form.input},void 0,!1,void 0,this),zt("input",{type:"text",placeholder:"Description (optional)",value:o,onChange:(z)=>l(z.target.value),className:h.form.input},void 0,!1,void 0,this),zt("button",{type:"button",onClick:g,disabled:!i.trim()||n,className:w(h.form.button,(!i.trim()||n)&&h.form.buttonDisabled),children:n?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r?zt("div",{className:h.loading.wrapper,children:zt("span",{className:h.loading.text,children:"Loading roles..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):zt("div",{className:h.roleList.wrapper,children:e.map((z)=>zt("button",{type:"button",onClick:()=>c(z),disabled:u(z.id),className:w(h.roleList.item,t?.id===z.id?h.roleList.itemSelected:h.roleList.itemHover,u(z.id)&&"opacity-50 cursor-wait"),children:zt("div",{className:"flex items-center justify-between",children:[zt("div",{children:[zt("h4",{className:h.roleList.name,children:[z.name,z.name==="godmin"&&zt("span",{className:h.roleList.badge,children:"Super Admin"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.description&&zt("p",{className:h.roleList.description,children:z.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.name!=="godmin"&&!u(z.id)&&zt("button",{type:"button",onClick:(b)=>k(b,z.id),disabled:a,className:w(h.roleList.deleteButton,a&&"opacity-50 cursor-not-allowed"),children:zt("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},z.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ts}from"@gsap/react";import ba from"gsap";import{forwardRef as Qp,useLayoutEffect as Xp,useRef as Ii,useState as Up}from"react";var ma={base:"relative inline-flex items-center justify-center overflow-hidden select-none",display:"inline-flex",alignment:"items-center justify-center",font:{weight:"font-semibold",family:"font-sans"},transition:"transition-all duration-200 ease-out",focus:"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-violet-500 dark:focus-visible:ring-offset-gray-900",disabled:{opacity:"disabled:opacity-50",cursor:"disabled:cursor-not-allowed disabled:pointer-events-none"},fullWidth:"w-full",size:{xs:{padding:"px-2.5 py-1",text:"text-xs",height:"h-7",iconSize:"w-3 h-3",gap:"gap-1"},sm:{padding:"px-3 py-1.5",text:"text-sm",height:"h-8",iconSize:"w-3.5 h-3.5",gap:"gap-1.5"},md:{padding:"px-4 py-2",text:"text-sm",height:"h-10",iconSize:"w-4 h-4",gap:"gap-2"},lg:{padding:"px-5 py-2.5",text:"text-base",height:"h-12",iconSize:"w-5 h-5",gap:"gap-2.5"},xl:{padding:"px-6 py-3",text:"text-lg",height:"h-14",iconSize:"w-6 h-6",gap:"gap-3"}},shape:{default:"rounded-lg",rounded:"rounded-xl",pill:"rounded-full",square:"rounded-none"},iconOnly:{xs:"w-7 h-7 p-0",sm:"w-8 h-8 p-0",md:"w-10 h-10 p-0",lg:"w-12 h-12 p-0",xl:"w-14 h-14 p-0"},variant:{nucleus:{background:"bg-zinc-900 dark:bg-white",text:"text-white dark:text-zinc-900",border:"border-0",shadow:"shadow-sm",hover:"hover:bg-zinc-800 dark:hover:bg-zinc-100",active:"active:bg-zinc-950 dark:active:bg-zinc-200 active:scale-[0.98]"},"nucleus-outline":{background:"bg-transparent",text:"text-zinc-900 dark:text-white",border:"border-2 border-zinc-900 dark:border-white",shadow:"",hover:"hover:bg-zinc-900 hover:text-white dark:hover:bg-white dark:hover:text-zinc-900",active:"active:bg-zinc-800 dark:active:bg-zinc-100 active:scale-[0.98]"},"nucleus-ghost":{background:"bg-transparent",text:"text-zinc-700 dark:text-zinc-300",border:"border-0",shadow:"",hover:"hover:bg-zinc-100 dark:hover:bg-zinc-800",active:"active:bg-zinc-200 dark:active:bg-zinc-700"},"nucleus-soft":{background:"bg-zinc-100 dark:bg-zinc-800",text:"text-zinc-900 dark:text-white",border:"border-0",shadow:"",hover:"hover:bg-zinc-200 dark:hover:bg-zinc-700",active:"active:bg-zinc-300 dark:active:bg-zinc-600 active:scale-[0.98]"},primary:{background:"bg-blue-600 dark:bg-blue-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-blue-500/20",hover:"hover:bg-blue-500 hover:shadow-lg hover:shadow-blue-500/30 hover:-translate-y-0.5",active:"active:bg-blue-700 active:translate-y-0 active:shadow-sm"},secondary:{background:"bg-gray-100 dark:bg-gray-800",text:"text-gray-900 dark:text-gray-100",border:"border border-gray-200 dark:border-gray-700",shadow:"shadow-sm",hover:"hover:bg-gray-200 dark:hover:bg-gray-700 hover:shadow-md hover:-translate-y-0.5",active:"active:bg-gray-300 dark:active:bg-gray-600 active:translate-y-0"},success:{background:"bg-emerald-600 dark:bg-emerald-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-emerald-500/20",hover:"hover:bg-emerald-500 hover:shadow-lg hover:shadow-emerald-500/30 hover:-translate-y-0.5",active:"active:bg-emerald-700 active:translate-y-0 active:shadow-sm"},warning:{background:"bg-amber-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-amber-500/20",hover:"hover:bg-amber-400 hover:shadow-lg hover:shadow-amber-500/30 hover:-translate-y-0.5",active:"active:bg-amber-600 active:translate-y-0 active:shadow-sm"},danger:{background:"bg-red-600 dark:bg-red-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-red-500/20",hover:"hover:bg-red-500 hover:shadow-lg hover:shadow-red-500/30 hover:-translate-y-0.5",active:"active:bg-red-700 active:translate-y-0 active:shadow-sm"},ghost:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-0",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800",active:"active:bg-gray-200 dark:active:bg-gray-700"},outline:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-2 border-gray-300 dark:border-gray-600",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800 hover:border-gray-400 dark:hover:border-gray-500",active:"active:bg-gray-200 dark:active:bg-gray-700"},link:{background:"bg-transparent",text:"text-violet-600 dark:text-violet-400",border:"border-0",shadow:"",hover:"hover:underline hover:text-violet-700 dark:hover:text-violet-300",active:"active:text-violet-800 dark:active:text-violet-200"}},spinner:{base:"animate-spin",size:{xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"}},ripple:{base:"absolute rounded-full bg-white/30 pointer-events-none"},pulse:{animation:"animate-pulse"}};function Gr(...e){return Rt(Mt(e))}import{jsxDEV as Lr}from"react/jsx-dev-runtime";ba.registerPlugin(ts);var se=Qp(({children:e,variant:t="nucleus",size:r="md",shape:n="default",loading:a=!1,disabled:i=!1,fullWidth:o=!1,leftIcon:s,rightIcon:l,iconOnly:c=!1,ripple:d=!0,pulse:g=!1,className:h,onClick:k,onMouseEnter:u,onMouseLeave:z,...b},C)=>{let x=Ii(null),N=Ii(null),m=Ii(null),[y,v]=Up(void 0),p=ma,f=i||a;Xp(()=>{if(a&&x.current&&!y)v(x.current.offsetWidth);if(!a&&y)v(void 0)},[a,y]);let{contextSafe:M}=ts({scope:x}),$=M((B)=>{if(f)return;if(d&&N.current&&x.current){let Q=x.current.getBoundingClientRect(),S=B.clientX-Q.left,O=B.clientY-Q.top,A=Math.max(Q.width,Q.height)*2,ee=document.createElement("span");ee.className=p.ripple.base,ee.style.width=`${A}px`,ee.style.height=`${A}px`,ee.style.left=`${S-A/2}px`,ee.style.top=`${O-A/2}px`,N.current.appendChild(ee),ba.fromTo(ee,{scale:0,opacity:0.6},{scale:1,opacity:0,duration:0.6,ease:"power2.out",onComplete:()=>{ee.remove()}})}if(m.current)ba.to(m.current,{scale:0.95,duration:0.1,ease:"power2.out",onComplete:()=>{ba.to(m.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}});k?.(B)}),J=M((B)=>{if(f)return;u?.(B)}),U=M((B)=>{z?.(B)}),E=p.variant[t],Z=(B,Q)=>{if(!B)return null;return Lr("span",{className:Gr("inline-flex items-center justify-center shrink-0",p.size[r].iconSize,a&&Q==="left"&&"opacity-0"),children:B},void 0,!1,void 0,this)};return Lr("button",{ref:(B)=>{if(x.current=B,typeof C==="function")C(B);else if(C)C.current=B},type:"button",disabled:f,"aria-disabled":f,"aria-busy":a,onClick:$,onMouseEnter:J,onMouseLeave:U,className:Gr(p.base,p.font.weight,p.font.family,p.transition,p.focus,p.disabled.opacity,p.disabled.cursor,p.shape[n],c?p.iconOnly[r]:Gr(p.size[r].padding,p.size[r].height),p.size[r].text,p.size[r].gap,E.background,E.text,E.border,E.shadow,!f&&E.hover,!f&&E.active,o&&p.fullWidth,g&&!a&&p.pulse.animation,h),style:y?{width:y}:void 0,...b,children:[Lr("span",{ref:N,className:"absolute inset-0 overflow-hidden rounded-[inherit] pointer-events-none","aria-hidden":"true"},void 0,!1,void 0,this),Lr("span",{ref:m,className:Gr("relative inline-flex items-center justify-center z-10",p.size[r].gap),children:[a&&Lr("span",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:Lr("svg",{className:Gr("animate-spin",p.size[r].iconSize),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Lr("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Lr("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Lr("span",{className:Gr("inline-flex items-center",p.size[r].gap,a&&"invisible"),"aria-hidden":a,children:[Z(s,"left"),e,Z(l,"right")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)});se.displayName="Button";import{useGSAP as Ep}from"@gsap/react";import Dp from"gsap";import{useRef as Yf}from"react";import{jsxDEV as Qf}from"react/jsx-dev-runtime";Dp.registerPlugin(Ep);import{useGSAP as as}from"@gsap/react";import $i from"gsap";import{useEffect as rs,useEffectEvent as Vp,useRef as Hi,useState as fn}from"react";var Fn={container:{base:"w-full",wrapper:"flex flex-col gap-2"},label:{base:"text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400"},challenge:{wrapper:"relative overflow-hidden rounded-xl bg-neutral-100/80 dark:bg-neutral-800/40 p-3",math:{question:"text-xl font-bold text-center text-neutral-800 dark:text-neutral-100 font-mono tracking-wide py-2"},image:{wrapper:"flex justify-center",img:"max-w-full h-auto rounded-lg select-none pointer-events-none"},text:{question:"text-xl font-bold text-center text-neutral-800 dark:text-neutral-100 font-mono tracking-[0.25em] select-none py-2"},puzzle:{wrapper:"flex flex-col gap-2",instruction:"text-xs text-center text-neutral-500 dark:text-neutral-400",grid:"flex flex-wrap justify-center gap-1.5",piece:"w-10 h-10 flex items-center justify-center rounded-lg border border-neutral-200 dark:border-neutral-600 bg-white dark:bg-neutral-700 text-sm font-bold text-neutral-800 dark:text-neutral-100 cursor-pointer hover:border-neutral-400 dark:hover:border-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-600 transition-all duration-200 select-none",pieceSelected:"border-neutral-500 bg-neutral-100 dark:bg-neutral-600 ring-1 ring-neutral-500",pieceOrdered:"border-emerald-400 bg-emerald-50 dark:bg-emerald-900/30",orderDisplay:"flex justify-center gap-1 mt-1",orderBadge:"w-6 h-6 flex items-center justify-center rounded bg-neutral-700 dark:bg-neutral-300 text-white dark:text-neutral-900 text-xs font-medium",clearButton:"text-xs text-red-500/70 hover:text-red-600 dark:hover:text-red-400 cursor-pointer ml-2"}},input:{wrapper:"mt-1",base:"w-full px-3 py-2 rounded-lg border border-neutral-200 dark:border-neutral-600 bg-white/80 dark:bg-neutral-800/60 text-sm text-neutral-800 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 focus:outline-none focus:ring-1 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent transition-all duration-200",error:"border-red-400 focus:ring-red-400"},actions:{wrapper:"flex items-center justify-between",refresh:"flex items-center gap-1 text-xs font-medium text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 transition-colors duration-200 disabled:opacity-40 disabled:cursor-not-allowed",timer:"text-[10px] tabular-nums text-neutral-400 dark:text-neutral-500",timerExpired:"text-[10px] text-red-500/80 dark:text-red-400/80"},error:{container:"mt-1 px-2.5 py-1.5 rounded-lg bg-red-50/80 dark:bg-red-900/10 border border-red-200/60 dark:border-red-800/40",text:"text-xs text-red-500 dark:text-red-400"},loading:{wrapper:"flex items-center justify-center py-4",spinner:"w-5 h-5 border-2 border-neutral-200 dark:border-neutral-600 border-t-neutral-500 dark:border-t-neutral-300 rounded-full animate-spin"}};import{jsxDEV as Je,Fragment as ns}from"react/jsx-dev-runtime";$i.registerPlugin(as);function jp(e,t){let r={...e};for(let n of Object.keys(t)){let a=t[n];if(!a)continue;let i=r[n];if(i&&typeof i==="object"&&typeof a==="object"){let o={...i};for(let[s,l]of Object.entries(a))if(l&&typeof l==="object"&&typeof o[s]==="object")o[s]={...o[s],...l};else if(l!==void 0)o[s]=l;r[n]=o}}return r}var eu=({className:e,iconRef:t})=>Je("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[Je("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"},void 0,!1,void 0,this),Je("path",{d:"M3 3v5h5"},void 0,!1,void 0,this),Je("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"},void 0,!1,void 0,this),Je("path",{d:"M16 16h5v5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);function fa({generateAction:e,config:t,onChallengeLoad:r,onAnswerChange:n,disabled:a=!1,autoGenerate:i=!0,className:o,label:s="Security Check",errorMessage:l,themeOverride:c}){let d=c?jp(Fn,c):Fn,g=Hi(null),h=Hi(null),k=Hi(null),[u,z]=fn(null),[b,C]=fn(""),[x,N]=fn(null),[m,y]=fn(!1),[v,p]=fn(null),[f,M]=fn([]),$=e.state.isPending,{contextSafe:J}=as({scope:g}),U=Vp(()=>{C(""),y(!1),p(null),M([]),e.start({payload:{type:t?.type,difficulty:t?.difficulty},onAfterHandle:(A)=>{let{data:ee}=A;if(console.log("[DEBUG]:",A),!ee||ee.rateLimited){p(A.message??"Too many requests. Please try again later."),z(null);return}if(z(ee),r?.(A),h.current)$i.fromTo(h.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.3,ease:"power2.out"})},onErrorHandle:(A,ee)=>{if(ee===429)p("Too many requests. Please try again later.");z(null)}})}),E=J(()=>{if(k.current)$i.to(k.current,{rotation:"+=360",duration:0.5,ease:"power2.inOut"});U()}),Z=(A)=>{if(C(A),u)n?.(u.challengeId,A)},B=(A)=>{if(a||$||m)return;let ee=f.includes(A)?f.filter((H)=>H!==A):[...f,A];M(ee);let _=ee.join(",");if(C(_),u)n?.(u.challengeId,_)},Q=()=>{if(M([]),C(""),u)n?.(u.challengeId,"")};rs(()=>{if(i&&t?.enabled!==!1)U()},[i,t?.enabled]),rs(()=>{if(!u?.expiresAt){N(null);return}let A=()=>{let _=Date.now(),H=Math.max(0,Math.floor((u.expiresAt-_)/1000));if(N(H),H<=0)y(!0)};A();let ee=setInterval(A,1000);return()=>clearInterval(ee)},[u?.expiresAt]);let S=(A)=>{let ee=Math.floor(A/60),_=A%60;return`${ee}:${_.toString().padStart(2,"0")}`},O=()=>{if(!u)return"Enter answer";switch(u.type){case"math":return"Enter the result";case"image":case"text":return"Enter the text shown";case"puzzle":return"Enter piece order (e.g., 0,1,2,3)";default:return"Enter answer"}};if(t?.enabled===!1)return Je(ns,{},void 0,!1,void 0,this);return Je("div",{ref:g,className:w(d.container.base,o),children:Je("div",{className:d.container.wrapper,children:[Je("span",{className:d.label.base,children:s},void 0,!1,void 0,this),Je("div",{ref:h,className:d.challenge.wrapper,children:$?Je("div",{className:d.loading.wrapper,children:Je("div",{className:d.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this):u?Je(ns,{children:[u.type==="math"&&Je("p",{className:d.challenge.math.question,children:u.question},void 0,!1,void 0,this),u.type==="text"&&Je("p",{className:d.challenge.text.question,children:u.question},void 0,!1,void 0,this),u.type==="image"&&u.imageData&&Je("div",{className:d.challenge.image.wrapper,children:Je("img",{src:u.imageData,alt:"Captcha",className:d.challenge.image.img,draggable:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this),u.type==="puzzle"&&u.puzzleData&&Je("div",{className:d.challenge.puzzle.wrapper,children:[Je("p",{className:d.challenge.puzzle.instruction,children:["Click the pieces in the correct order (0 to"," ",u.puzzleData.pieces.length-1,")"]},void 0,!0,void 0,this),Je("div",{className:d.challenge.puzzle.grid,children:u.puzzleData.pieces.map((A)=>Je("button",{type:"button",onClick:()=>B(A.id),disabled:a||$||m,className:w(d.challenge.puzzle.piece,f.includes(A.id)&&d.challenge.puzzle.pieceOrdered),children:A.id},A.id,!1,void 0,this))},void 0,!1,void 0,this),f.length>0&&Je("div",{className:d.challenge.puzzle.orderDisplay,children:[f.map((A,ee)=>Je("span",{className:d.challenge.puzzle.orderBadge,children:A},`order-${A}-${ee}`,!1,void 0,this)),Je("button",{type:"button",onClick:Q,className:d.challenge.puzzle.clearButton,children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Je("div",{className:d.loading.wrapper,children:Je("p",{className:"text-sm text-zinc-500",children:"Click refresh to load captcha"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u?.type!=="puzzle"&&Je("div",{className:d.input.wrapper,children:[Je("label",{htmlFor:"captcha-answer",className:"sr-only",children:s},void 0,!1,void 0,this),Je("input",{id:"captcha-answer",type:"text",value:b,onChange:(A)=>Z(A.target.value),placeholder:O(),disabled:a||$||m,className:w(d.input.base,(l||m)&&d.input.error),autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Je("div",{className:d.actions.wrapper,children:[Je("button",{type:"button",onClick:E,disabled:a||$,className:d.actions.refresh,children:[Je(eu,{iconRef:k},void 0,!1,void 0,this),Je("span",{children:"New challenge"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x!==null&&Je("span",{className:m?d.actions.timerExpired:d.actions.timer,children:m?"Expired":`Expires in ${S(x)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(l||m||v)&&Je("div",{className:d.error.container,children:Je("p",{className:d.error.text,children:v?v:m?"Captcha expired. Please refresh.":l},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Zi}from"@gsap/react";import va from"gsap";import{useRef as zs}from"react";import{useGSAP as is}from"@gsap/react";import _i from"gsap";import{useRef as tu}from"react";var Mr={container:{base:"relative w-full",spacing:"mb-1"},wrapper:{base:"relative flex items-center",border:{base:"border rounded-lg",width:"border",radius:"rounded-lg"},padding:"px-4 py-3",transition:"transition-all duration-200 ease-out",states:{inactive:"border-gray-300 dark:border-gray-600",hover:"border-gray-400 dark:border-gray-500",focused:"border-blue-600 dark:border-blue-500",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"}},input:{base:"w-full bg-transparent outline-none",text:"text-base",color:"text-gray-900 dark:text-gray-100",placeholder:"placeholder:text-gray-400 dark:placeholder:text-gray-500",disabled:"text-gray-400 dark:text-gray-500 cursor-not-allowed",transition:"transition-colors duration-200"},label:{base:"absolute pointer-events-none select-none",text:"text-base",transition:"transition-all duration-200 ease-out",states:{inactive:{position:"left-3 top-1/2 -translate-y-1/2",text:"text-base",color:"text-gray-500 dark:text-gray-400",background:"bg-transparent px-1"},floated:{position:"left-3 -top-2.5 translate-y-0",text:"text-xs",color:"text-gray-600 dark:text-gray-300",background:"bg-white/50 dark:bg-gray-900/50 px-1"},focused:{color:"text-blue-600 dark:text-blue-500"},error:{color:"text-red-500 dark:text-red-400"},disabled:{color:"text-gray-400 dark:text-gray-500"}}},helperText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-gray-500 dark:text-gray-400",disabled:"text-gray-400 dark:text-gray-500"},errorText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-red-500 dark:text-red-400",minHeight:"min-h-[1.25rem]"},icon:{base:"flex-shrink-0",size:"w-5 h-5",color:"text-gray-400 dark:text-gray-500",spacing:{left:"mr-2",right:"ml-2"},states:{focused:"text-blue-600 dark:text-blue-500",error:"text-red-500 dark:text-red-400",disabled:"text-gray-300 dark:text-gray-600"}},animation:{label:{duration:0.35,ease:"power3.out",floatY:-24,floatScale:0.75},typewriter:{charDelay:0.03,ease:"none"},border:{duration:0.2,ease:"power2.out"}}};function pt(...e){return Rt(Mt(e))}import{jsxDEV as ru}from"react/jsx-dev-runtime";_i.registerPlugin(is);function Fi({label:e,isFloated:t,isFocused:r,hasError:n,isDisabled:a,hasLeftIcon:i,className:o}){let s=tu(null),l=Mr.label,c=Mr.animation.label;is(()=>{if(!s.current)return;if(t)_i.to(s.current,{y:c.floatY,x:i?-20:0,scale:c.floatScale,duration:c.duration,ease:c.ease});else _i.to(s.current,{y:0,x:0,scale:1,duration:c.duration,ease:c.ease})},[t,i]);let d=()=>{if(a)return l.states.disabled.color;if(n)return l.states.error.color;if(r)return l.states.focused.color;if(t)return l.states.floated.color;return l.states.inactive.color},g=()=>{if(t)return l.states.floated.background;return l.states.inactive.background};return ru("span",{ref:s,className:pt(l.base,g(),i?"left-9 top-1/2 origin-left":"left-3 top-1/2 origin-left",d(),o),style:{transform:"translateY(-50%)"},"aria-hidden":"true",children:e},void 0,!1,void 0,this)}import{useGSAP as xs}from"@gsap/react";import Ki from"gsap";import{useId as pu,useRef as vs,useState as qn}from"react";function ha(e,t=" "){let r=e.replace(/\D/g,"");if(!r)return"";return r.replace(/\B(?=(\d{3})+(?!\d))/g,t)}function Yr(e){return e.replace(/\D/g,"")}var nu={tr:{pattern:[3,3,2,2],prefix:""},us:{pattern:[3,3,4],prefix:""},eu:{pattern:[2,3,3,2],prefix:""}};function ya(e,t="tr"){let r=e.replace(/\D/g,"");if(!r)return"";let{pattern:n}=nu[t],a=[],i=r;for(let o of n){if(i.length===0)break;a.push(i.slice(0,o)),i=i.slice(o)}if(i.length>0)a.push(i);return a.join(" ")}function qi(e){return e.replace(/\D/g,"")}var au=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,iu=/^(https?:\/\/)?([\da-z-]+\.)+[a-z]{2,6}(\/[^\s]*)?$/i,ou=/^[+]?[(]?[0-9]{1,4}[)]?[-\s./0-9]{6,}$/,hn={minLength:8,hasUppercase:/[A-Z]/,hasLowercase:/[a-z]/,hasNumber:/[0-9]/,hasSpecial:/[!@#$%^&*(),.?":{}|<>]/},os={text:(e)=>{if(!e.trim())return{isValid:!0};return{isValid:!0}},email:(e)=>{if(!e.trim())return{isValid:!0};if(!au.test(e))return{isValid:!1,errorMessage:"Please enter a valid email address"};return{isValid:!0}},password:(e)=>{if(!e)return{isValid:!0};let t=[];if(e.length<hn.minLength)t.push(`at least ${hn.minLength} characters`);if(!hn.hasUppercase.test(e))t.push("one uppercase letter");if(!hn.hasLowercase.test(e))t.push("one lowercase letter");if(!hn.hasNumber.test(e))t.push("one number");if(!hn.hasSpecial.test(e))t.push("one special character");if(t.length>0)return{isValid:!1,errorMessage:`Password must contain ${t.join(", ")}`};return{isValid:!0}},number:(e)=>{if(!e.trim())return{isValid:!0};let t=Number(e);if(Number.isNaN(t))return{isValid:!1,errorMessage:"Please enter a valid number"};return{isValid:!0}},tel:(e)=>{if(!e.trim())return{isValid:!0};if(e.replace(/\D/g,"").length<7)return{isValid:!1,errorMessage:"Phone number must have at least 7 digits"};if(!ou.test(e))return{isValid:!1,errorMessage:"Please enter a valid phone number"};return{isValid:!0}},url:(e)=>{if(!e.trim())return{isValid:!0};if(!iu.test(e))return{isValid:!1,errorMessage:"Please enter a valid URL"};return{isValid:!0}}};function Oi(e,t,r){if(r?.required&&!e.trim())return{isValid:!1,errorMessage:r.requiredMessage||"This field is required"};if(r?.minLength&&e.length<r.minLength)return{isValid:!1,errorMessage:`Minimum ${r.minLength} characters required`};if(r?.maxLength&&e.length>r.maxLength)return{isValid:!1,errorMessage:`Maximum ${r.maxLength} characters allowed`};if(r?.pattern&&!r.pattern.test(e))return{isValid:!1,errorMessage:r.patternMessage||"Invalid format"};if(r?.customRules){for(let n of r.customRules)if(!n.validate(e))return{isValid:!1,errorMessage:n.message}}return os[t](e)}function Ji(e){switch(e){case"email":return"email";case"number":return"numeric";case"tel":return"tel";case"url":return"url";default:return"text"}}function Gi(e,t){switch(e){case"email":return"email";case"password":return t?"new-password":"current-password";case"tel":return"tel";case"url":return"url";default:return"off"}}import{jsxDEV as tt}from"react/jsx-dev-runtime";function ls({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"},void 0,!1,void 0,this),tt("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ss({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"},void 0,!1,void 0,this),tt("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ds({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"},void 0,!1,void 0,this),tt("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"},void 0,!1,void 0,this),tt("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"},void 0,!1,void 0,this),tt("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"},void 0,!1,void 0,this),tt("path",{d:"m2 2 20 20"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ps({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("line",{x1:"4",x2:"20",y1:"9",y2:"9"},void 0,!1,void 0,this),tt("line",{x1:"4",x2:"20",y1:"15",y2:"15"},void 0,!1,void 0,this),tt("line",{x1:"10",x2:"8",y1:"3",y2:"21"},void 0,!1,void 0,this),tt("line",{x1:"16",x2:"14",y1:"3",y2:"21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function us({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:tt("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function gs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},void 0,!1,void 0,this),tt("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ms({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:tt("path",{d:"M20 6 9 17l-5-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function bs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,void 0,this),tt("line",{x1:"12",x2:"12",y1:"8",y2:"12"},void 0,!1,void 0,this),tt("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as fs}from"@gsap/react";import hs from"gsap";import{useRef as lu}from"react";import{jsxDEV as yn}from"react/jsx-dev-runtime";hs.registerPlugin(fs);function ys(e){let t=0;if(!e)return{level:"weak",score:0,label:"",color:"bg-gray-200"};if(e.length>=8)t+=1;if(e.length>=12)t+=1;if(e.length>=16)t+=1;if(/[a-z]/.test(e))t+=1;if(/[A-Z]/.test(e))t+=1;if(/[0-9]/.test(e))t+=1;if(/[^a-zA-Z0-9]/.test(e))t+=1;if(/(.)\1{2,}/.test(e))t-=1;if(/^[a-zA-Z]+$/.test(e))t-=1;if(/^[0-9]+$/.test(e))t-=1;if(t=Math.max(0,Math.min(t,7)),t<=2)return{level:"weak",score:t,label:"Weak",color:"bg-red-500"};if(t<=4)return{level:"fair",score:t,label:"Fair",color:"bg-orange-500"};if(t<=5)return{level:"good",score:t,label:"Good",color:"bg-yellow-500"};return{level:"strong",score:t,label:"Strong",color:"bg-green-500"}}function Yi({password:e,className:t}){let r=lu(null),n=ys(e),a=e?Math.min(n.score/7*100,100):0;if(fs(()=>{if(!r.current)return;hs.to(r.current,{width:`${a}%`,duration:0.3,ease:"power2.out"})},[a]),!e)return null;return yn("div",{className:pt("mt-2 mb-4",t),children:[yn("div",{className:"flex items-center justify-between mb-1",children:[yn("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Password strength"},void 0,!1,void 0,this),yn("span",{className:pt("text-xs font-medium",n.level==="weak"&&"text-red-500",n.level==="fair"&&"text-orange-500",n.level==="good"&&"text-yellow-600",n.level==="strong"&&"text-green-500"),children:n.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),yn("div",{className:"h-1.5 w-full bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:yn("div",{ref:r,className:pt("h-full rounded-full transition-colors duration-300",n.color),style:{width:0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ks}from"@gsap/react";import wa from"gsap";import{TextPlugin as su}from"gsap/TextPlugin";import{useEffect as du,useRef as ws}from"react";import{jsxDEV as cu}from"react/jsx-dev-runtime";wa.registerPlugin(ks,su);function Ai({text:e,className:t,onComplete:r}){let n=ws(null),a=ws(""),i=Mr.errorText,o=Mr.animation.typewriter;if(ks(()=>{if(!n.current||!e){if(n.current)n.current.textContent="";a.current="";return}if(e===a.current)return;wa.killTweensOf(n.current),n.current.textContent="";let s=e.length*o.charDelay;wa.to(n.current,{duration:s,text:{value:e,delimiter:""},ease:o.ease,onComplete:()=>{a.current=e,r?.()}})},[e]),du(()=>{return()=>{if(n.current)wa.killTweensOf(n.current)}},[]),!e)return null;return cu("span",{ref:n,className:pt(i.base,i.text,i.color,t),role:"alert","aria-live":"polite"},void 0,!1,void 0,this)}import{jsxDEV as yt}from"react/jsx-dev-runtime";Ki.registerPlugin(xs);var uu={text:null,email:yt(ls,{},void 0,!1,void 0,this),password:yt(ss,{},void 0,!1,void 0,this),number:yt(ps,{},void 0,!1,void 0,this),tel:yt(us,{},void 0,!1,void 0,this),url:yt(gs,{},void 0,!1,void 0,this)};function Ee({value:e="",onChange:t,type:r="text",label:n,placeholder:a,helperText:i,errorMessage:o,disabled:s=!1,readOnly:l=!1,leftIcon:c,rightIcon:d,size:g="md",fullWidth:h=!0,className:k,inputClassName:u,labelClassName:z,wrapperClassName:b,showTypewriterError:C=!0,showTypeIcon:x=!0,showValidationIcon:N=!0,enableValidation:m=!0,validateOnBlur:y=!0,validateOnChange:v=!1,validationConfig:p,customValidator:f,onValidationChange:M,unit:$,unitPosition:J="suffix",formatNumber:U=!1,thousandSeparator:E=" ",phoneFormat:Z="tr",isNewPassword:B=!1,maxInputLength:Q,confirmValue:S,onConfirmChange:O,showPasswordStrength:A=!1,preventCopy:ee=!1,preventPaste:_=!1,preventContextMenu:H=!1,trimOnBlur:T=!1,onFocus:ie,onBlur:q,...ce}){let[oe,Ze]=qn(!1),[$e,Ce]=qn(!1),[fe,xe]=qn(!1),[Oe,Le]=qn(void 0),[ve,R]=qn(null),de=vs(null),te=vs(null),ye=pu(),D=Mr,j=o||Oe,re=Boolean(j),Ke=Boolean(e&&e.length>0),I=oe||Ke,{contextSafe:ue}=xs({scope:te}),We=(Ye)=>{if(!m)return{isValid:!0};if(f)return f(Ye);return Oi(Ye,r,p)},Ue=(Ye)=>{let Ut=We(Ye);R(Ut.isValid),Le(Ut.isValid?void 0:Ut.errorMessage),M?.(Ut)},gt=ue((Ye)=>{if(s)return;Ze(!0),ie?.(Ye)}),Ge=ue((Ye)=>{if(Ze(!1),T&&e){let Ut=e.trim();if(Ut!==e)t?.(Ut)}if(y&&e)Ue(W(e));if(r==="password"&&S!==void 0&&e!==S)Le("Passwords do not match"),R(!1);q?.(Ye)}),Qt=(Ye)=>{if(ee||r==="password")Ye.preventDefault()},$t=(Ye)=>{if(_)Ye.preventDefault()},zr=(Ye)=>{if(H||r==="password")Ye.preventDefault()},ne=(Ye)=>{let Lt=Ye.target.selectionStart??0,sa=e,Et=Ye.target.value,da=Yr(sa).length,Ci=Yr(Et).length<da;if(r==="number"&&U){let Sr=Yr(Et);Et=ha(Sr,E)}else if(r==="tel")Et=ya(Et,Z);if(t?.(Et),r==="number"&&U||r==="tel")requestAnimationFrame(()=>{if(!de.current)return;let Sr=Yr(Ye.target.value.slice(0,Lt)).length,Pr=0,Cr=0;for(let Dt=0;Dt<Et.length;Dt++){let ca=Et[Dt];if(ca!==void 0&&/\d/.test(ca))Cr++;if(Cr===Sr){Pr=Dt+1;break}}if(Cr<Sr)Pr=Et.length;if(Ci&&Lt>0){let Dt=Ye.target.value[Lt-1];if(Dt===" "||Dt===E)Pr=Math.max(0,Pr-1)}de.current.setSelectionRange(Pr,Pr)});if(v){let Sr=W(Et);Ue(Sr)}if(r==="password"&&S!==void 0&&Et!==S)Le("Passwords do not match"),R(!1);else if(r==="password"&&S!==void 0&&Et===S)Le(void 0),R(!0);else if(Oe&&!v)Le(void 0),R(null)},W=(Ye)=>{if(r==="number"&&U)return Yr(Ye);if(r==="tel")return qi(Ye);return Ye},V=()=>{if(r==="number"&&U&&e)return ha(Yr(e),E);if(r==="tel"&&e)return ya(e,Z);return e},Ne=()=>{xe((Ye)=>!Ye)},ze=()=>{if(r==="password")return fe?"text":"password";return r},Me=()=>{if(!x)return null;if(c)return null;if(r==="number"&&$)return null;return uu[r]},gr=()=>{if(!N||!Ke||ve===null)return null;if(re)return yt(bs,{className:"text-red-500"},void 0,!1,void 0,this);if(ve)return yt(ms,{className:"text-green-500"},void 0,!1,void 0,this);return null},br=()=>{if(r==="password")return yt("button",{type:"button",onClick:Ne,className:"focus:outline-none",tabIndex:-1,"aria-label":fe?"Hide password":"Show password",children:fe?yt(cs,{},void 0,!1,void 0,this):yt(ds,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return d;return gr()},Xt=ue(()=>{if(s)return;if(Ce(!0),te.current&&!oe&&!re)Ki.to(te.current,{borderColor:"rgb(156, 163, 175)",duration:D.animation.border.duration,ease:D.animation.border.ease})}),Nr=ue(()=>{if(Ce(!1),te.current&&!oe&&!re)Ki.to(te.current,{borderColor:"rgb(209, 213, 219)",duration:D.animation.border.duration,ease:D.animation.border.ease})}),Vr=()=>{if(s)return D.wrapper.states.disabled;if(re)return D.wrapper.states.error;if(oe)return D.wrapper.states.focused;if($e)return D.wrapper.states.hover;return D.wrapper.states.inactive},ar=()=>{switch(g){case"sm":return"px-3 py-2 text-sm";case"lg":return"px-5 py-4 text-lg";default:return D.wrapper.padding}};return yt("div",{className:pt(D.container.base,D.container.spacing,h&&"w-full",k),children:[yt("label",{ref:te,htmlFor:ye,className:pt(D.wrapper.base,D.wrapper.border.base,D.wrapper.transition,ar(),Vr(),"cursor-text",b),onMouseEnter:Xt,onMouseLeave:Nr,children:[(c||Me())&&yt("span",{className:pt(D.icon.base,D.icon.size,D.icon.color,D.icon.spacing.left,oe&&D.icon.states.focused,re&&D.icon.states.error,s&&D.icon.states.disabled),children:c||Me()},void 0,!1,void 0,this),n&&yt(Fi,{label:n,isFloated:I,isFocused:oe,hasError:re,isDisabled:s,hasLeftIcon:Boolean(c||Me()),className:z},void 0,!1,void 0,this),$&&J==="prefix"&&yt("span",{className:"text-gray-500 dark:text-gray-400 mr-1 select-none",children:$},void 0,!1,void 0,this),yt("input",{ref:de,id:ye,type:r==="number"&&U?"text":ze(),inputMode:Ji(r),autoComplete:Gi(r,B),maxLength:Q,value:V(),onChange:ne,onFocus:gt,onBlur:Ge,onCopy:Qt,onPaste:$t,onContextMenu:zr,disabled:s,readOnly:l,placeholder:I?a:"","aria-label":n,"aria-invalid":re,"aria-describedby":j?`${ye}-error`:i?`${ye}-helper`:void 0,className:pt(D.input.base,D.input.text,D.input.color,D.input.placeholder,D.input.transition,s&&D.input.disabled,u),...ce},void 0,!1,void 0,this),$&&J==="suffix"&&yt("span",{className:"text-gray-500 dark:text-gray-400 ml-1 select-none",children:$},void 0,!1,void 0,this),br()&&yt("span",{className:pt(D.icon.base,D.icon.size,D.icon.color,D.icon.spacing.right,oe&&D.icon.states.focused,re&&D.icon.states.error,s&&D.icon.states.disabled),children:br()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),yt("div",{className:D.errorText.minHeight,children:re&&C&&j?yt(Ai,{text:j},void 0,!1,void 0,this):re?yt("span",{id:`${ye}-error`,className:pt(D.errorText.base,D.errorText.text,D.errorText.color),role:"alert",children:j},void 0,!1,void 0,this):i?yt("span",{id:`${ye}-helper`,className:pt(D.helperText.base,D.helperText.text,D.helperText.color,s&&D.helperText.disabled),children:i},void 0,!1,void 0,this):null},void 0,!1,void 0,this),r==="password"&&A&&e&&yt(Yi,{password:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{batch as gu,createStore as mu}from"h-state";var bu={currentPassword:"",newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:ka}=mu(bu,{setCurrentPassword:(e)=>(t)=>{if(e.currentPassword=t,e.error)e.error=null},setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{gu(()=>{e.currentPassword="",e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var tn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",cancel:"text-sm text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as ut}from"react/jsx-dev-runtime";va.registerPlugin(Zi);function Ns({className:e}){return ut("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ut("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function fu({className:e}){return ut("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ut("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Qi({changePasswordAction:e,onSuccess:t,onCancel:r,cancelHref:n}){let a=tn,i=zs(null),o=zs(null),s=ka(),{contextSafe:l}=Zi({scope:i}),c=e.state.isPending;Zi(()=>{if(s.step==="success"&&o.current)va.fromTo(o.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[s.step]});let d=l(()=>{if(!i.current)return;va.fromTo(i.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{va.set(i.current,{x:0})}})}),g=l((k)=>{if(k.preventDefault(),s.newPassword!==s.confirmPassword){s.setError("New passwords do not match"),d();return}if(s.newPassword.length<8){s.setError("Password must be at least 8 characters"),d();return}s.setError(null),e.start({payload:{currentPassword:s.currentPassword,newPassword:s.newPassword,confirmPassword:s.confirmPassword},onAfterHandle:()=>{s.setStep("success"),t?.()},onErrorHandle:(u)=>{let z=u instanceof Error?u.message:"Failed to change password. Please try again.";s.setError(z),d()}})}),h=()=>{if(r)r();else if(n)window.location.href=n};if(s.step==="success")return ut("div",{ref:o,className:a.success.container,children:[ut("div",{className:a.success.iconWrapper,children:ut(fu,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("h2",{className:a.success.title,children:"Password Changed!"},void 0,!1,void 0,this),ut("p",{className:a.success.message,children:"Your password has been successfully updated. You can now use your new password to log in."},void 0,!1,void 0,this),(n||r)&&ut("div",{className:a.links.container,children:ut("button",{type:"button",onClick:h,className:a.links.cancel,children:[ut(Ns,{},void 0,!1,void 0,this),"Go back"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return ut("form",{ref:i,onSubmit:g,className:w(a.form.container,a.form.spacing),noValidate:!0,children:[s.error&&ut("div",{className:a.error.container,children:ut("p",{className:a.error.text,children:s.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"Current Password",type:"password",value:s.currentPassword,onChange:(k)=>s.setCurrentPassword(k),placeholder:"Enter your current password",autoComplete:"current-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"New Password",type:"password",value:s.newPassword,onChange:(k)=>s.setNewPassword(k),placeholder:"Enter your new password",autoComplete:"new-password",isNewPassword:!0,showPasswordStrength:!0,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"Confirm New Password",type:"password",value:s.confirmPassword,onChange:(k)=>s.setConfirmPassword(k),placeholder:"Confirm your new password",autoComplete:"new-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.button.wrapper,children:ut(se,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,loading:e.state.isPending,children:"Change Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),(n||r)&&ut("div",{className:a.links.container,children:ut("button",{type:"button",onClick:h,className:a.links.cancel,disabled:c,children:[ut(Ns,{},void 0,!1,void 0,this),"Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as rn}from"react/jsx-dev-runtime";function Xi({logo:e,title:t,subtitle:r}){let n=tn;return rn("header",{className:n.header.container,children:[e?rn("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):rn("div",{className:n.header.iconWrapper,children:rn("svg",{className:"w-8 h-8 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rn("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),rn("h1",{className:w(n.header.title),children:t},void 0,!1,void 0,this),rn("p",{className:w(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ps}from"@gsap/react";import Cs from"gsap";import{useRef as Ss}from"react";import{jsxDEV as wn}from"react/jsx-dev-runtime";Cs.registerPlugin(Ps);function Ts({logo:e,title:t="Change Password",subtitle:r="Enter your current password and choose a new one.",changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o,showBackground:s=!0,className:l}){let c=tn,d=Ss(null),g=Ss(null);return Ps(()=>{if(!g.current)return;Cs.fromTo(g.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:d}),wn("main",{ref:d,className:w(c.container.base,l),"aria-label":"Change password page",children:[s&&wn(xt,{},void 0,!1,void 0,this),wn("div",{className:c.container.wrapper,children:wn("article",{ref:g,className:w(c.card.base,c.card.padding,c.card.background,c.card.border,c.card.shadow,c.card.rounded),children:[wn(Xi,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),wn(Qi,{changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Bs}from"@gsap/react";import ji from"gsap";import{useId as hu,useRef as Vi}from"react";var nn={container:{base:"flex flex-col",spacing:"gap-1",disabled:"pointer-events-none"},wrapper:{base:"inline-flex items-center cursor-pointer select-none",gap:{sm:"gap-2",md:"gap-2.5",lg:"gap-3"}},label:{base:"cursor-pointer",text:{size:{sm:"text-sm",md:"text-base",lg:"text-lg"},color:{light:"text-gray-700",dark:"dark:text-gray-200"}},disabled:"opacity-50 cursor-not-allowed"},checkbox:{base:"relative flex items-center justify-center overflow-hidden",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},border:{base:"border-2",width:"border-2",color:{light:"border-gray-300",dark:"dark:border-gray-600"},focused:"ring-2 ring-offset-2 ring-blue-500 dark:ring-offset-gray-900"},background:{unchecked:{light:"bg-white",dark:"dark:bg-gray-800"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},rounded:"rounded-md",shadow:"shadow-sm",transition:"transition-all duration-200",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},checkIcon:{base:"absolute",size:{sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},stroke:{width:"stroke-[3]",color:"stroke-white"}},indeterminateIcon:{base:"absolute",size:{sm:{width:"w-2",height:"h-0.5"},md:{width:"w-2.5",height:"h-0.5"},lg:{width:"w-3",height:"h-0.5"}},background:"bg-white",rounded:"rounded-full"},switch:{track:{base:"relative inline-flex items-center cursor-pointer",size:{sm:{width:"w-8",height:"h-4"},md:{width:"w-11",height:"h-6"},lg:{width:"w-14",height:"h-7"}},background:{unchecked:{light:"bg-gray-200",dark:"dark:bg-gray-700"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},border:{base:"border",color:{light:"border-gray-300",dark:"dark:border-gray-600"}},rounded:"rounded-full",shadow:"shadow-inner",transition:"transition-all duration-300 ease-out",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},thumb:{base:"absolute flex items-center justify-center bg-white rounded-full shadow-lg",size:{sm:"w-3 h-3",md:"w-5 h-5",lg:"w-6 h-6"},background:{light:"bg-white",dark:"bg-white"},shadow:"shadow-md",rounded:"rounded-full",transition:"transition-all duration-300 ease-out",position:{sm:{unchecked:"left-0.5",checked:"left-[calc(100%-14px)]"},md:{unchecked:"left-0.5",checked:"left-[calc(100%-22px)]"},lg:{unchecked:"left-0.5",checked:"left-[calc(100%-26px)]"}}},icon:{base:"absolute",size:{sm:"w-2 h-2",md:"w-3 h-3",lg:"w-3.5 h-3.5"},color:{unchecked:{light:"text-gray-400",dark:"text-gray-500"},checked:"text-current"}}},ripple:{base:"absolute inset-0 rounded-full opacity-0",size:"scale-0",color:{primary:"bg-blue-400/30",secondary:"bg-purple-400/30",success:"bg-emerald-400/30",warning:"bg-amber-400/30",danger:"bg-red-400/30",info:"bg-cyan-400/30"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}};function Bt(...e){return Rt(Mt(e))}import{useGSAP as Ls}from"@gsap/react";import Ui from"gsap";import{useRef as xa}from"react";import{jsxDEV as On}from"react/jsx-dev-runtime";Ui.registerPlugin(Ls);function Ei({checked:e,indeterminate:t=!1,size:r,color:n,disabled:a=!1}){let i=xa(null),o=xa(null),s=xa(null),l=xa(null),c=nn;return Ls(()=>{if(!i.current)return;let d=Ui.timeline();if(e&&!t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),o.current){let g=o.current.getTotalLength();Ui.set(o.current,{strokeDasharray:g,strokeDashoffset:g}),d.to(o.current,{strokeDashoffset:0,duration:0.3,ease:"power3.out"},"-=0.1")}if(l.current)d.fromTo(l.current,{scale:0,opacity:0.6},{scale:2.5,opacity:0,duration:0.5,ease:"power2.out"},"-=0.3")}else if(t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),s.current)d.fromTo(s.current,{scaleX:0,opacity:0},{scaleX:1,opacity:1,duration:0.25,ease:"back.out(2)"},"-=0.1")}else{if(o.current){let g=o.current.getTotalLength();d.to(o.current,{strokeDashoffset:g,duration:0.2,ease:"power2.in"})}if(s.current)d.to(s.current,{scaleX:0,opacity:0,duration:0.15,ease:"power2.in"},"<");d.to(i.current,{borderColor:"",duration:0.15,ease:"power2.out"},"-=0.1")}},[e,t]),On("div",{ref:i,className:Bt(c.checkbox.base,c.checkbox.size[r],c.checkbox.border.base,c.checkbox.rounded,c.checkbox.shadow,c.checkbox.transition,!e&&!t&&c.checkbox.border.color.light,!e&&!t&&c.checkbox.border.color.dark,!e&&!t&&c.checkbox.background.unchecked.light,!e&&!t&&c.checkbox.background.unchecked.dark,(e||t)&&c.checkbox.background.checked[n],(e||t)&&"border-transparent",a&&c.checkbox.disabled.opacity,a&&c.checkbox.disabled.cursor),children:[On("div",{ref:l,className:Bt(c.ripple.base,c.ripple.color[n])},void 0,!1,void 0,this),On("svg",{viewBox:"0 0 24 24",fill:"none",className:Bt(c.checkIcon.base,c.checkIcon.size[r],"opacity-0",e&&!t&&"opacity-100"),"aria-hidden":"true",children:On("path",{ref:o,d:"M4 12.5L9.5 18L20 6",strokeLinecap:"round",strokeLinejoin:"round",className:Bt(c.checkIcon.stroke.width,c.checkIcon.stroke.color),fill:"none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),On("div",{ref:s,className:Bt(c.indeterminateIcon.base,c.indeterminateIcon.size[r].width,c.indeterminateIcon.size[r].height,c.indeterminateIcon.background,c.indeterminateIcon.rounded,"opacity-0 scale-x-0",t&&"opacity-100")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ms}from"@gsap/react";import Rs from"gsap";import{useRef as Jn}from"react";import{jsxDEV as an}from"react/jsx-dev-runtime";Rs.registerPlugin(Ms);function Di({checked:e,size:t,color:r,disabled:n=!1}){let a=Jn(null),i=Jn(null),o=Jn(null),s=Jn(null),l=Jn(null),c=nn,d=(g)=>{return{sm:{unchecked:2,checked:18},md:{unchecked:2,checked:24},lg:{unchecked:2,checked:30}}[t][g?"checked":"unchecked"]};return Ms(()=>{if(!i.current||!a.current)return;let g=Rs.timeline();if(e){if(g.to(i.current,{x:d(!0),duration:0.35,ease:"elastic.out(1, 0.75)"}),g.to(i.current,{scale:1.1,duration:0.15,ease:"power2.out"},"<"),g.to(i.current,{scale:1,duration:0.2,ease:"power2.inOut"}),o.current)g.fromTo(o.current,{scale:0,rotate:-180,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.3,ease:"back.out(2)"},"-=0.4");if(s.current)g.to(s.current,{scale:0,rotate:90,opacity:0,duration:0.2,ease:"power2.in"},"<-0.2");if(l.current)g.fromTo(l.current,{opacity:0,scale:0.8},{opacity:0.6,scale:1,duration:0.3,ease:"power2.out"},"-=0.3").to(l.current,{opacity:0,duration:0.5,ease:"power2.inOut"})}else{if(g.to(i.current,{x:d(!1),duration:0.35,ease:"elastic.out(1, 0.75)"}),g.to(i.current,{scale:0.9,duration:0.1,ease:"power2.out"},"<"),g.to(i.current,{scale:1,duration:0.15,ease:"power2.inOut"}),s.current)g.fromTo(s.current,{scale:0,rotate:-90,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.25,ease:"back.out(1.5)"},"-=0.35");if(o.current)g.to(o.current,{scale:0,rotate:180,opacity:0,duration:0.2,ease:"power2.in"},"<-0.15")}},[e,t]),an("div",{ref:a,className:Bt(c.switch.track.base,c.switch.track.size[t].width,c.switch.track.size[t].height,c.switch.track.rounded,c.switch.track.shadow,c.switch.track.transition,!e&&c.switch.track.background.unchecked.light,!e&&c.switch.track.background.unchecked.dark,e&&c.switch.track.background.checked[r],n&&c.switch.track.disabled.opacity,n&&c.switch.track.disabled.cursor),children:[an("div",{ref:l,className:Bt("absolute inset-0 rounded-full blur-md opacity-0",e&&c.switch.track.background.checked[r])},void 0,!1,void 0,this),an("div",{ref:i,className:Bt(c.switch.thumb.base,c.switch.thumb.size[t],c.switch.thumb.background.light,c.switch.thumb.shadow,c.switch.thumb.rounded,"transform-gpu"),style:{x:d(e)},children:[an("svg",{ref:o,viewBox:"0 0 24 24",fill:"none",className:Bt(c.switch.icon.base,c.switch.icon.size[t],"text-emerald-500","opacity-0"),"aria-hidden":"true",children:an("path",{d:"M5 13l4 4L19 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this),an("svg",{ref:s,viewBox:"0 0 24 24",fill:"none",className:Bt(c.switch.icon.base,c.switch.icon.size[t],c.switch.icon.color.unchecked.light,"opacity-100"),"aria-hidden":"true",children:an("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Rr}from"react/jsx-dev-runtime";ji.registerPlugin(Bs);function hr({checked:e,onChange:t,variant:r="checkbox",size:n="md",color:a="primary",label:i,labelPosition:o="right",disabled:s=!1,indeterminate:l=!1,name:c,value:d,id:g,required:h=!1,errorMessage:k,helperText:u,className:z,labelClassName:b,ariaLabel:C,ariaDescribedBy:x}){let N=Vi(null),m=Vi(null),y=Vi(null),v=hu(),p=g||v,f=nn,{contextSafe:M}=Bs({scope:N}),$=M(()=>{if(s)return;if(y.current)ji.to(y.current,{scale:0.97,duration:0.1,ease:"power2.out",onComplete:()=>{ji.to(y.current,{scale:1,duration:0.15,ease:"elastic.out(1, 0.5)"})}});t(!e)}),J=(Z)=>{if(Z.key===" "||Z.key==="Enter")Z.preventDefault(),$()},U=()=>{if(r==="switch")return Rr(Di,{checked:e,size:n,color:a,disabled:s},void 0,!1,void 0,this);return Rr(Ei,{checked:e,indeterminate:l,size:n,color:a,disabled:s},void 0,!1,void 0,this)},E=()=>{if(!i)return null;return Rr("span",{className:Bt(f.label.base,f.label.text.size[n],f.label.text.color.light,f.label.text.color.dark,s&&f.label.disabled,b),children:[i,h&&Rr("span",{className:"text-red-500 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Rr("div",{ref:N,className:Bt(f.container.base,f.container.spacing,s&&f.container.disabled,z),children:[Rr("label",{ref:y,htmlFor:p,className:Bt(f.wrapper.base,f.wrapper.gap[n],s&&"cursor-not-allowed",o==="left"&&"flex-row-reverse"),onKeyDown:J,children:[Rr("input",{ref:m,type:"checkbox",id:p,name:c,value:d,checked:e,disabled:s,required:h,onChange:$,className:"sr-only","aria-label":C||(typeof i==="string"?i:void 0),"aria-describedby":x,"aria-checked":l?"mixed":e,"aria-invalid":!!k},void 0,!1,void 0,this),U(),E()]},void 0,!0,void 0,this),k&&Rr("span",{className:Bt(f.errorText.base,f.errorText.text,f.errorText.color),children:k},void 0,!1,void 0,this),u&&!k&&Rr("span",{className:Bt(f.helperText.base,f.helperText.text,f.helperText.color.light,f.helperText.color.dark),children:u},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as pd}from"@gsap/react";import ud from"gsap";import{useRef as lo}from"react";var Re={container:{base:"w-full overflow-hidden",border:"border border-gray-200 dark:border-gray-700",rounded:"rounded-lg",shadow:"shadow-sm"},scrollContainer:{base:"overflow-y-auto overflow-x-hidden",maxHeight:"max-h-[70vh]",scrollbar:"scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-transparent"},table:{base:"w-full border-collapse table-fixed",layout:""},header:{wrapper:{base:"sticky top-0 z-10",background:"bg-gray-50 dark:bg-gray-800"},row:{base:"",border:"border-b border-gray-200 dark:border-gray-700"},cell:{base:"relative select-none bg-gray-50 dark:bg-gray-800",padding:"px-4 py-3",text:"text-left text-xs font-semibold uppercase tracking-wider",color:"text-gray-600 dark:text-gray-300",transition:"transition-colors duration-200",hover:"hover:bg-gray-100 dark:hover:bg-gray-750",sortable:"cursor-pointer",sorted:"bg-gray-100 dark:bg-gray-750"},sortIcon:{base:"inline-flex ml-1.5 transition-transform duration-300",active:"text-primary-500 dark:text-primary-400",inactive:"text-gray-400 dark:text-gray-500"},resizeHandle:{base:"absolute right-0 top-0 h-full w-1 cursor-col-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:right-[-4px] before:top-0 before:h-full before:w-[9px] before:content-[""]'}},body:{wrapper:{base:""},row:{base:"group",border:"border-b border-gray-100 dark:border-gray-700/50",transition:"transition-colors duration-150",hover:"hover:bg-gray-50 dark:hover:bg-gray-800/50",zebra:{even:"bg-white dark:bg-gray-900",odd:"bg-gray-50/50 dark:bg-gray-800/30"}},cell:{base:"relative",padding:"px-4 py-3",text:"text-sm",color:"text-gray-900 dark:text-gray-100",truncate:"truncate",transition:"transition-all duration-150",hover:"group-hover:bg-gray-50/50 dark:group-hover:bg-gray-800/30"},resizeHandle:{base:"absolute bottom-0 left-0 w-full h-1 cursor-row-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:bottom-[-4px] before:left-0 before:w-full before:h-[9px] before:content-[""]'}},loading:{wrapper:"flex items-center justify-center py-8",spinner:{base:"animate-spin rounded-full border-2",size:"h-8 w-8",color:"border-primary-500 border-t-transparent"},text:"ml-3 text-sm text-gray-500 dark:text-gray-400"},empty:{wrapper:"flex flex-col items-center justify-center py-12",icon:"h-12 w-12 text-gray-300 dark:text-gray-600 mb-4",text:"text-sm text-gray-500 dark:text-gray-400"},infiniteScroll:{trigger:"h-1 w-full",loader:"flex items-center justify-center py-4"},animation:{row:{enter:{opacity:0,y:10},visible:{opacity:1,y:0},duration:0.3,stagger:0.02},cell:{hover:{scale:1.01},duration:0.15},sort:{duration:0.3,ease:"power2.out"},resize:{duration:0.1,ease:"power1.out"}}};function ke(...e){return Rt(Mt(e))}import{jsxDEV as za}from"react/jsx-dev-runtime";function Ws({message:e="No data available",className:t}){let r=Re.empty;return za("div",{className:ke(r.wrapper,t),children:[za("svg",{className:r.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:za("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),za("p",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as Is,useRef as to}from"react";import{jsxDEV as eo}from"react/jsx-dev-runtime";function Na({text:e="Loading...",className:t}){let r=Re.loading;return eo("div",{className:ke(r.wrapper,t),children:[eo("div",{className:ke(r.spinner.base,r.spinner.size,r.spinner.color)},void 0,!1,void 0,this),e&&eo("span",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as ro}from"react/jsx-dev-runtime";function Hs({isLoading:e,hasMoreData:t,onTrigger:r,scrollContainerRef:n,autoFetchUntilScroll:a=!1,className:i}){let o=to(null),s=to(null),l=to(!1),c=()=>{if(!a||!n.current||e||!t)return;let h=n.current;if(!(h.scrollHeight>h.clientHeight))r()};Is(()=>{if(!a||!t)return;let h=setTimeout(()=>{c()},100);return()=>clearTimeout(h)},[a,t,e]),Is(()=>{l.current=!1},[]);let d=(h)=>{if(s.current)s.current.disconnect();if(!h||!t)return;s.current=new IntersectionObserver((k)=>{if(k[0]?.isIntersecting&&!e&&t)r()},{threshold:0.1,rootMargin:"100px"}),s.current.observe(h)},g=Re.infiniteScroll;if(!t&&!e)return null;return ro("div",{ref:(h)=>{o.current=h,d(h)},className:ke(g.trigger,i),children:e&&ro("div",{className:g.loader,children:ro(Na,{text:"Loading more..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Js}from"@gsap/react";import Gs from"gsap";import{useRef as Ys}from"react";import{useGSAP as $s}from"@gsap/react";import _s from"gsap";import{useRef as Fs}from"react";import{jsxDEV as Sa}from"react/jsx-dev-runtime";function qs({columnCount:e,rowIndex:t,columnWidths:r,hasActionColumn:n}){let a=Fs(null),i=Re;$s(()=>{if(!a.current)return;_s.fromTo(a.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,delay:t*0.05,ease:"power2.out"})},[t]);let o=n?e+1:e;return Sa("tr",{ref:a,className:ke(i.body.row.base,i.body.row.transition,t%2===0?i.body.row.zebra.even:i.body.row.zebra.odd),children:Array.from({length:o}).map((s,l)=>Sa("td",{style:{width:r[l]??150},className:ke(i.body.cell.base,i.body.cell.padding),children:Sa(yu,{},void 0,!1,void 0,this)},l,!1,void 0,this))},void 0,!1,void 0,this)}function yu(){let e=Fs(null);return $s(()=>{if(!e.current)return;_s.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),Sa("div",{ref:e,className:"h-4 w-3/4 rounded bg-gradient-to-r from-gray-200 via-gray-300 to-gray-200 bg-[length:200%_100%] dark:from-zinc-700 dark:via-zinc-600 dark:to-zinc-700"},void 0,!1,void 0,this)}import{jsxDEV as wr}from"react/jsx-dev-runtime";function As({columns:e,actionColumns:t,rowCount:r=5,defaultColumnWidth:n=150}){let a=Ys(null),i=Re;Js(()=>{if(!a.current)return;Gs.fromTo(a.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"})},[]);let o=e.map((s)=>s.width??n);if(t?.length)t.forEach((s)=>{o.push(s.width??n)});return wr("table",{ref:a,className:ke(i.table.base,i.table.layout),children:[wr("thead",{className:i.header.wrapper.base,children:wr("tr",{className:i.header.row.base,children:[e.map((s,l)=>wr("th",{style:{width:o[l]},className:ke(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:wr(Os,{},void 0,!1,void 0,this)},String(s.key),!1,void 0,this)),t?.map((s)=>wr("th",{style:{width:s.width??n},className:ke(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:wr(Os,{},void 0,!1,void 0,this)},s.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),wr("tbody",{className:i.body.wrapper.base,children:Array.from({length:r}).map((s,l)=>wr(qs,{columnCount:e.length,rowIndex:l,columnWidths:o,hasActionColumn:Boolean(t?.length)},l,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Os(){let e=Ys(null);return Js(()=>{if(!e.current)return;Gs.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),wr("div",{ref:e,className:"h-4 w-1/2 rounded bg-gradient-to-r from-gray-300 via-gray-400 to-gray-300 bg-[length:200%_100%] dark:from-zinc-600 dark:via-zinc-500 dark:to-zinc-600"},void 0,!1,void 0,this)}import{useRef as Ds}from"react";import{useGSAP as Ks}from"@gsap/react";import no from"gsap";import{useRef as wu}from"react";import{jsxDEV as ku}from"react/jsx-dev-runtime";no.registerPlugin(Ks);function Zs({type:e,isActive:t,onResizeStart:r,className:n}){let a=wu(null);Ks(()=>{if(!a.current)return;if(t)no.to(a.current,{scaleY:e==="column"?1.1:1,scaleX:e==="row"?1.1:1,duration:Re.animation.resize.duration,ease:Re.animation.resize.ease});else no.to(a.current,{scaleY:1,scaleX:1,duration:Re.animation.resize.duration,ease:Re.animation.resize.ease})},[t,e]);let i=e==="column"?Re.header.resizeHandle:Re.body.resizeHandle;return ku("button",{ref:a,type:"button","aria-label":`Resize ${e}`,className:ke(i.base,t?i.active:i.idle,i.hitArea,"appearance-none border-none bg-transparent p-0",n),onMouseDown:r,onTouchStart:r},void 0,!1,void 0,this)}import{useGSAP as Xs}from"@gsap/react";import Us from"gsap";import{useRef as vu}from"react";import{jsxDEV as Qs}from"react/jsx-dev-runtime";Us.registerPlugin(Xs);function Es({direction:e,isActive:t,className:r}){let n=vu(null);Xs(()=>{if(!n.current)return;let i=t&&e==="desc"?180:0;Us.to(n.current,{rotation:i,opacity:t?1:0.4,duration:Re.animation.sort.duration,ease:Re.animation.sort.ease})},[e,t]);let a=Re.header.sortIcon;return Qs("svg",{ref:n,className:ke(a.base,t?a.active:a.inactive,r),width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:Qs("path",{d:"M6 2L10 7H2L6 2Z",fill:"currentColor"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Gn}from"react/jsx-dev-runtime";function Vs({column:e,width:t,sortDirection:r,isResizing:n,isSorted:a,onSort:i,onResizeStart:o,onDoubleClick:s,headerMiddleware:l}){let c=Ds(null),d=Ds(null),g=Re.header.cell,h=()=>{if(e.sortable&&i)i()},k=()=>{if(e.headerRenderer)return e.headerRenderer(e);if(l){let u=l(e,e.key);if(u!==void 0)return u}return e.header};return Gn("th",{ref:c,scope:"col","data-column-key":String(e.key),style:{width:`${t}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.base,g.padding,g.text,g.color,g.transition,g.hover,e.sortable&&g.sortable,a&&g.sorted,e.headerClassName),onClick:h,onDoubleClick:s,"aria-sort":a?r==="asc"?"ascending":"descending":void 0,children:[Gn("div",{ref:d,className:"flex items-center",children:[Gn("span",{className:"truncate",children:k()},void 0,!1,void 0,this),e.sortable&&Gn(Es,{direction:r,isActive:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.resizable!==!1&&Gn(Zs,{type:"column",isActive:n,onResizeStart:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Nu}from"@gsap/react";import Yn from"gsap";import{useRef as ao}from"react";import{batch as Pa,createStore as xu}from"h-state";var zu={sortColumnKey:null,sortDirection:null,columnWidths:{},rowHeights:{},resizingColumn:null,resizingRow:null,hoveredRow:null,hoveredCell:null,editingCell:null,editValue:"",isLoadingMore:!1,selectedRows:[]},{useStore:Br}=xu(zu,{setSortState:(e)=>(t,r)=>{Pa(()=>{e.sortColumnKey=t,e.sortDirection=r})},setColumnWidth:(e)=>(t,r)=>{e.columnWidths[t]=r},setRowHeight:(e)=>(t,r)=>{e.rowHeights[t]=r},setResizingColumn:(e)=>(t)=>{e.resizingColumn=t},setResizingRow:(e)=>(t)=>{e.resizingRow=t},setHoveredRow:(e)=>(t)=>{e.hoveredRow=t},setHoveredCell:(e)=>(t)=>{e.hoveredCell=t},setEditingCell:(e)=>(t)=>{e.editingCell=t},setEditValue:(e)=>(t)=>{e.editValue=t},startEditing:(e)=>(t,r,n)=>{Pa(()=>{e.editingCell={row:t,column:r},e.editValue=n})},cancelEditing:(e)=>()=>{Pa(()=>{e.editingCell=null,e.editValue=""})},setIsLoadingMore:(e)=>(t)=>{e.isLoadingMore=t},resetWidths:(e)=>()=>{Pa(()=>{e.columnWidths={},e.rowHeights={}})},autoFitColumn:(e)=>(t,r)=>{e.columnWidths[t]=Math.max(r+32,60)},toggleRowSelection:(e)=>(t)=>{if(e.selectedRows.indexOf(t)===-1)e.selectedRows=[...e.selectedRows,t];else e.selectedRows=e.selectedRows.filter((n)=>n!==t)},selectAllRows:(e)=>(t)=>{e.selectedRows=Array.from({length:t},(r,n)=>n)},clearSelection:(e)=>()=>{e.selectedRows=[]},isRowSelected:(e)=>(t)=>{return e.selectedRows.includes(t)}});import{jsxDEV as on}from"react/jsx-dev-runtime";function Ca({rowIndex:e,isHovered:t,isHeader:r=!1,totalRows:n=0}){let a=ao(null),i=ao(null),o=ao(null),s=Br(),l=Re,c=r?!1:s.selectedRows.includes(e),d=r&&n>0&&s.selectedRows.length===n,g=r&&s.selectedRows.length>0&&s.selectedRows.length<n;Nu(()=>{if(!i.current||!o.current)return;if(Yn.killTweensOf([i.current,o.current]),t||c)Yn.set(i.current,{opacity:0,display:"none"}),Yn.set(o.current,{opacity:1,display:"flex"});else Yn.set(i.current,{opacity:1,display:"flex"}),Yn.set(o.current,{opacity:0,display:"none"})},[t,c]);let h=(k)=>{if(k.stopPropagation(),r)if(d||g)s.clearSelection();else s.selectAllRows(n);else s.toggleRowSelection(e)};if(r)return on("th",{ref:a,scope:"col",className:ke(l.header.cell.base,l.header.cell.padding,l.header.cell.text,l.header.cell.color,"w-12 text-center"),children:on("div",{className:"flex items-center justify-center",children:on("input",{type:"checkbox",checked:d,ref:o,onChange:()=>{},onClick:h,className:ke("h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{opacity:g?0.5:1}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return on("td",{ref:a,className:ke(l.body.cell.base,l.body.cell.padding,l.body.cell.text,l.body.cell.color,"w-12 text-center"),children:on("div",{className:"flex items-center justify-center relative",children:[on("span",{ref:i,className:"text-gray-400 dark:text-gray-500 text-xs font-medium",children:e+1},void 0,!1,void 0,this),on("input",{ref:o,type:"checkbox",checked:c,onChange:()=>{},onClick:h,className:ke("absolute h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{display:"none"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as An}from"react/jsx-dev-runtime";function js({columns:e,actionColumns:t,columnWidths:r,sortColumnKey:n,sortDirection:a,resizingColumn:i,defaultColumnWidth:o,onSort:s,onResizeStart:l,onColumnDoubleClick:c,headerMiddleware:d,enableSelection:g,totalRows:h=0}){let k=Re.header,u=(z,b)=>{return r[z]??b??o};return An("thead",{className:ke(k.wrapper.base,k.wrapper.background),children:An("tr",{className:ke(k.row.base,k.row.border),children:[g&&An(Ca,{rowIndex:-1,isHovered:!1,isHeader:!0,totalRows:h},void 0,!1,void 0,this),e.map((z)=>{let b=String(z.key);return An(Vs,{column:z,width:u(b,z.width),sortDirection:n===z.key?a:null,isResizing:i===b,isSorted:n===z.key,onSort:()=>s(z.key),onResizeStart:(C)=>l(b,C),onDoubleClick:()=>c(b),headerMiddleware:d},b,!1,void 0,this)}),t?.map((z)=>An("th",{scope:"col",style:{width:`${u(z.key,z.width)}px`,minWidth:z.minWidth},className:ke(k.cell.base,k.cell.padding,k.cell.text,k.cell.color,z.headerClassName),children:z.header},z.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as od}from"@gsap/react";import ld from"gsap";import{useRef as id}from"react";import{useRef as Su}from"react";import{jsxDEV as Pu}from"react/jsx-dev-runtime";function ed({column:e,row:t,rowIndex:r,width:n}){let a=Su(null),i=Re.body.cell,o={row:t,rowIndex:r,columnKey:e.key},s=()=>{return e.renderer(o)};return Pu("td",{ref:a,style:{width:`${n}px`,minWidth:e.minWidth},className:ke(i.base,i.padding,i.text,i.color,i.transition,e.cellClassName),children:s()},void 0,!1,void 0,this)}import{useGSAP as td}from"@gsap/react";import io from"gsap";import{useRef as Cu}from"react";import{jsxDEV as Tu}from"react/jsx-dev-runtime";io.registerPlugin(td);function rd({column:e,row:t,rowIndex:r,width:n,isHovered:a,hasClickAction:i,hasDoubleClickAction:o,onClick:s,onDoubleClick:l,cellMiddleware:c}){let d=Cu(null),g=Re.body.cell,{contextSafe:h}=td({scope:d}),k=h(()=>{if(!d.current||!a)return;io.to(d.current,{scale:Re.animation.cell.hover.scale,duration:Re.animation.cell.duration})}),u=h(()=>{if(!d.current)return;io.to(d.current,{scale:1,duration:Re.animation.cell.duration})}),z=()=>{let C=e.key;return t[C]},b=()=>{let C=z(),x={value:C,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(x);if(c){let N=c(x);if(N!==void 0)return N}if(C===null||C===void 0)return"";return String(C)};return Tu("td",{ref:d,"data-column-key":String(e.key),style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.base,g.padding,g.text,g.color,g.truncate,g.transition,(i||o)&&"cursor-pointer",e.cellClassName),onClick:i?s:void 0,onDoubleClick:o?l:void 0,onKeyDown:i||o?(C)=>{if(C.key==="Enter"&&i&&s)s()}:void 0,onMouseEnter:k,onMouseLeave:u,children:b()},void 0,!1,void 0,this)}import{useGSAP as nd}from"@gsap/react";import Ta from"gsap";import{useRef as oo}from"react";import{jsxDEV as At}from"react/jsx-dev-runtime";function ad({column:e,row:t,rowIndex:r,width:n,isHovered:a,onSave:i,cellMiddleware:o}){let s=oo(null),l=oo(null),c=oo(null),d=Br(),g=Re,h=String(e.key),k=d.editingCell?.row===r&&d.editingCell?.column===h,u=e.editConfig??{type:"text",showIconOnHover:!0},b=(()=>{let f=e.key;return t[f]})(),C=b===null||b===void 0?"":String(b);nd(()=>{if(!c.current)return;if(Ta.killTweensOf(c.current),a&&!k&&u.showIconOnHover!==!1)Ta.to(c.current,{opacity:1,scale:1,duration:0.15,ease:"power2.out",overwrite:!0});else Ta.set(c.current,{opacity:0,scale:0.8})},[a,k,u.showIconOnHover]),nd(()=>{if(k&&l.current)Ta.fromTo(l.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.2,ease:"power2.out"}),l.current.focus(),l.current.select()},[k]);let x=()=>{d.startEditing(r,h,C)},N=()=>{i(d.editValue),d.cancelEditing()},m=()=>{d.cancelEditing()},y=(f)=>{if(f.key==="Enter"&&!f.shiftKey)f.preventDefault(),N();else if(f.key==="Escape")m()},v=()=>{let f={value:b,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(f);if(o){let M=o(f);if(M!==void 0)return M}return C},p=()=>{let f=u.type??"text";if(f==="textarea")return At("textarea",{ref:l,value:d.editValue,onChange:(M)=>d.setEditValue(M.target.value),onKeyDown:y,placeholder:u.placeholder,maxLength:u.maxLength,className:ke("w-full resize-none rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),rows:2},void 0,!1,void 0,this);if(f==="select"&&u.selectOptions)return At("select",{value:d.editValue,onChange:(M)=>d.setEditValue(M.target.value),onKeyDown:y,className:ke("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),children:u.selectOptions.map((M)=>At("option",{value:M.value,children:M.label},M.value,!1,void 0,this))},void 0,!1,void 0,this);return At("input",{ref:l,type:f==="number"?"number":"text",value:d.editValue,onChange:(M)=>d.setEditValue(M.target.value),onKeyDown:y,placeholder:u.placeholder,maxLength:u.maxLength,className:ke("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white")},void 0,!1,void 0,this)};if(k)return At("td",{ref:s,"data-column-key":h,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.body.cell.base,"p-1",e.cellClassName),children:At("div",{className:"flex flex-col gap-1",children:[p(),At("div",{className:"flex justify-end gap-1",children:[At("button",{type:"button",onClick:N,className:ke("rounded bg-green-500 px-2 py-0.5 text-xs text-white","hover:bg-green-600 transition-colors"),children:"Save"},void 0,!1,void 0,this),At("button",{type:"button",onClick:m,className:ke("rounded bg-gray-400 px-2 py-0.5 text-xs text-white","hover:bg-gray-500 transition-colors dark:bg-zinc-600 dark:hover:bg-zinc-500"),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return At("td",{ref:s,"data-column-key":h,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.body.cell.base,g.body.cell.padding,g.body.cell.text,g.body.cell.color,g.body.cell.truncate,g.body.cell.transition,"group relative",e.cellClassName),children:At("div",{className:"flex items-center gap-2",children:[At("span",{className:"flex-1 truncate",children:v()},void 0,!1,void 0,this),e.editable&&At("button",{ref:c,type:"button",onClick:x,"aria-label":"Edit cell",className:ke("flex-shrink-0 rounded p-1 opacity-0","text-gray-500 hover:bg-gray-200 hover:text-gray-700","dark:text-gray-400 dark:hover:bg-zinc-700 dark:hover:text-gray-200","transition-colors"),children:At("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[At("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"},void 0,!1,void 0,this),At("path",{d:"m15 5 4 4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Kn}from"react/jsx-dev-runtime";ld.registerPlugin(od);function sd({row:e,rowIndex:t,columns:r,actionColumns:n,defaultColumnWidth:a,hasClickAction:i,hasDoubleClickAction:o,onCellClick:s,onCellDoubleClick:l,onCellEdit:c,cellMiddleware:d,animationDelay:g=0,enableSelection:h}){let k=id(null),u=Br(),z=Re.body.row,b=Re.animation.row,C=u.hoveredRow===t,x=u.columnWidths,N=id(!1);od(()=>{if(!k.current||N.current)return;ld.fromTo(k.current,{opacity:b.enter.opacity,y:b.enter.y},{opacity:b.visible.opacity,y:b.visible.y,duration:b.duration,delay:g,ease:"power2.out"}),N.current=!0},[]);let m=(f,M)=>{return x[f]??M??a},y=t%2===0,v=(f,M)=>{if(!s)return;let $=M?null:e[f];s({value:$,row:e,rowIndex:t,columnKey:f,isActionColumn:M})},p=(f,M)=>{if(!l)return;let $=M?null:e[f];l({value:$,row:e,rowIndex:t,columnKey:f,isActionColumn:M})};return Kn("tr",{ref:k,className:ke(z.base,z.border,z.transition,z.hover,y?z.zebra.even:z.zebra.odd),onMouseEnter:()=>u.setHoveredRow(t),onMouseLeave:()=>u.setHoveredRow(null),children:[h&&Kn(Ca,{rowIndex:t,isHovered:C},void 0,!1,void 0,this),r.map((f)=>{let M=String(f.key),$=m(M,f.width);if(f.editable)return Kn(ad,{column:f,row:e,rowIndex:t,width:$,isHovered:C,onSave:(J)=>{if(c){let U=e[f.key];c({row:e,rowIndex:t,columnKey:f.key,oldValue:U,newValue:J})}},cellMiddleware:d},M,!1,void 0,this);return Kn(rd,{column:f,row:e,rowIndex:t,width:$,isHovered:C,hasClickAction:i,hasDoubleClickAction:o,onClick:()=>v(f.key,!1),onDoubleClick:()=>p(f.key,!1),cellMiddleware:d},M,!1,void 0,this)}),n?.map((f)=>Kn(ed,{column:f,row:e,rowIndex:t,width:m(f.key,f.width)},f.key,!1,void 0,this))]},void 0,!0,void 0,this)}function dd({onAutoFit:e}){return{autoFit:(r,n)=>{if(!n)return;let a=n.querySelectorAll(`td[data-column="${r}"], th[data-column="${r}"]`),i=0;if(a.forEach((o)=>{let s=o.firstElementChild;if(s){let l=s.scrollWidth;i=Math.max(i,l)}else i=Math.max(i,o.scrollWidth)}),i>0)e(r,i)}}}import{useRef as Zn}from"react";function cd({minWidth:e,tableRef:t,onResizeStart:r,onResizeEnd:n}){let a=Zn(0),i=Zn(0),o=Zn(""),s=Zn(0),l=Zn(!1),c=(m)=>{if(!t.current)return null;return t.current.querySelector(`th[data-column-key="${m}"]`)},d=(m)=>{if(!t.current)return[];let y=c(m),v=t.current.querySelectorAll(`td[data-column-key="${m}"]`),p=[];if(y)p.push(y);for(let f of Array.from(v))p.push(f);return p},g=(m)=>{if(!t.current)return;let y=Array.from(t.current.querySelectorAll("th[data-column-key]")),v=y.length-1;for(let p=0;p<y.length;p++){let f=y[p];if(!f)continue;let M=f.getAttribute("data-column-key");if(!M)continue;let $=p===v,J=f.offsetWidth,U=d(M);for(let E of U)if(m&&$)E.style.width="";else E.style.width=`${J}px`,E.style.minWidth=`${J}px`,E.style.maxWidth=`${J}px`}},h=(m)=>{let y=d(o.current);for(let v of y)v.style.width=`${m}px`,v.style.minWidth=`${m}px`,v.style.maxWidth=`${m}px`;s.current=m},k=(m)=>{m.preventDefault();let y=m.clientX-a.current,v=Math.max(e,i.current+y);h(v)},u=(m)=>{m.preventDefault();let y=m.touches[0];if(!y)return;let v=y.clientX-a.current,p=Math.max(e,i.current+v);h(p)},z=()=>{document.body.style.cursor="",document.body.style.userSelect="",l.current=!0,setTimeout(()=>{l.current=!1},100)},b=()=>l.current,C=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",C),z(),n(o.current,s.current)},x=()=>{document.removeEventListener("touchmove",u),document.removeEventListener("touchend",x),z(),n(o.current,s.current)};return{startResize:(m,y)=>{y.preventDefault(),y.stopPropagation();let v=c(m);if(!v)return;let p=v.offsetWidth;if(o.current=m,i.current=p,s.current=p,g(!0),r(m),document.body.style.cursor="col-resize",document.body.style.userSelect="none","touches"in y){let f=y.touches[0];if(!f)return;a.current=f.clientX,document.addEventListener("touchmove",u,{passive:!1}),document.addEventListener("touchend",x)}else a.current=y.clientX,document.addEventListener("mousemove",k),document.addEventListener("mouseup",C)},isJustResized:b}}import{jsxDEV as qt}from"react/jsx-dev-runtime";ud.registerPlugin(pd);var Lu={hasClickAction:!1,hasDoubleClickAction:!1,isFrontendSort:!0,enableInfiniteScroll:!1,infiniteScrollThreshold:100,pageSize:20,autoFetchUntilScroll:!0,defaultColumnWidth:150,defaultRowHeight:48,minColumnWidth:60,minRowHeight:32,enableSelection:!1,selectionColumnWidth:48};function kn({data:e,columns:t,actionColumns:r,keyExtractor:n,callbacks:a,config:i,className:o,headerMiddleware:s,cellMiddleware:l,isLoading:c,isPending:d,skeletonRowCount:g=5,emptyMessage:h,selectionToolbar:k,isLoadingMore:u=!1,hasMoreData:z=!1}){let b={...Lu,...i},C=lo(null),x=lo(null),N=Br(),m=Re,{startResize:y,isJustResized:v}=cd({minWidth:b.minColumnWidth,tableRef:C,onResizeStart:(S)=>{N.setResizingColumn(S)},onResizeEnd:(S,O)=>{N.setResizingColumn(null),N.setColumnWidth(S,O),a?.onColumnResize?.(S,O)}}),{autoFit:p}=dd({onAutoFit:(S,O)=>{N.autoFitColumn(S,O)}}),f=lo(!1);pd(()=>{if(!C.current||f.current)return;ud.fromTo(C.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"}),f.current=!0},[]);let M=(S)=>{if(v())return;if(!t.find((ee)=>ee.key===S)?.sortable)return;let A="asc";if(N.sortColumnKey===S){if(N.sortDirection==="asc")A="desc";else if(N.sortDirection==="desc")A=null}if(N.setSortState(String(S),A),!b.isFrontendSort)a?.onSort?.(S,A)},$=(S,O)=>{y(S,O)},J=(S)=>{p(S,C.current)},U=()=>{if(u)return;a?.onLoadMore?.()},Z=(()=>{if(!b.isFrontendSort||!N.sortColumnKey||!N.sortDirection)return e;let{sortColumnKey:S,sortDirection:O}=N;return[...e].sort((A,ee)=>{let _=A[S],H=ee[S];if(_===H)return 0;if(_===null||_===void 0)return 1;if(H===null||H===void 0)return-1;let T=_<H?-1:1;return O==="asc"?T:-T})})(),B=N.selectedRows.map((S)=>Z[S]).filter((S)=>S!==void 0),Q=N.selectedRows.length>0;if(c)return qt("div",{className:ke(m.container.base,m.container.border,m.container.rounded,o),children:qt(Na,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return qt("div",{className:ke(m.container.base,m.container.border,m.container.rounded,m.container.shadow,o),children:qt("div",{className:ke(m.scrollContainer.base,m.scrollContainer.maxHeight,m.scrollContainer.scrollbar),children:qt(As,{columns:t,actionColumns:r,rowCount:g,defaultColumnWidth:b.defaultColumnWidth},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return qt("div",{className:ke(m.container.base,m.container.border,m.container.rounded,o),children:qt(Ws,{message:h},void 0,!1,void 0,this)},void 0,!1,void 0,this);return qt("div",{className:ke(m.container.base,m.container.border,m.container.rounded,m.container.shadow,o),children:[b.enableSelection&&Q&&k&&qt("div",{className:"flex items-center justify-between border-b border-gray-200 bg-blue-50 px-4 py-2 dark:border-gray-700 dark:bg-blue-900/20",children:[qt("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[N.selectedRows.length," item selected"]},void 0,!0,void 0,this),qt("div",{className:"flex items-center gap-2",children:k({selectedRows:N.selectedRows,selectedData:B,totalCount:Z.length,onClearSelection:N.clearSelection})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qt("div",{ref:x,className:ke(m.scrollContainer.base,m.scrollContainer.maxHeight,m.scrollContainer.scrollbar),children:[qt("table",{ref:C,className:ke(m.table.base,m.table.layout),children:[qt(js,{columns:t,actionColumns:r,columnWidths:N.columnWidths,sortColumnKey:N.sortColumnKey,sortDirection:N.sortDirection,resizingColumn:N.resizingColumn,defaultColumnWidth:b.defaultColumnWidth,onSort:M,onResizeStart:$,onColumnDoubleClick:J,headerMiddleware:s,enableSelection:b.enableSelection,totalRows:Z.length},void 0,!1,void 0,this),qt("tbody",{className:m.body.wrapper.base,children:Z.map((S,O)=>qt(sd,{row:S,rowIndex:O,columns:t,actionColumns:r,defaultColumnWidth:b.defaultColumnWidth,hasClickAction:b.hasClickAction,hasDoubleClickAction:b.hasDoubleClickAction,onCellClick:a?.onCellClick,onCellDoubleClick:a?.onCellDoubleClick,onCellEdit:a?.onCellEdit,cellMiddleware:l,animationDelay:O*m.animation.row.stagger,enableSelection:b.enableSelection},n(S,O),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.enableInfiniteScroll&&qt(Hs,{isLoading:u,hasMoreData:z,onTrigger:U,scrollContainerRef:x,autoFetchUntilScroll:b.autoFetchUntilScroll},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as bd}from"@gsap/react";import fd from"gsap";import{useRef as Mu}from"react";var Wr={container:{base:"relative flex flex-col w-full",spacing:"gap-1"},input:{wrapper:{base:"relative flex items-center w-full cursor-pointer",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 cursor-not-allowed"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:"px-4 py-3",rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},text:{base:"flex-1",size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"},placeholder:{light:"text-gray-400",dark:"dark:text-gray-500"}},icon:{base:"flex items-center justify-center flex-shrink-0",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},dropdown:{base:"absolute left-0 right-0 z-50",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-xl",shadow:"shadow-xl",padding:"p-4",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},calendar:{base:"select-none",width:"w-72"},header:{base:"flex items-center justify-between",padding:"mb-4",button:{base:"flex items-center justify-center",size:"w-8 h-8",color:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",transition:"transition-colors duration-150"},title:{base:"flex items-center justify-center cursor-pointer",text:{size:"text-base",weight:"font-semibold",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",padding:"px-3 py-1.5",transition:"transition-colors duration-150"}},weekdays:{base:"grid grid-cols-7",padding:"mb-2",text:{size:"text-xs",weight:"font-medium",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}},grid:{base:"grid grid-cols-7",gap:""},dayWrapper:{base:"flex items-center justify-center",inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:"rounded-l-lg",rangeEnd:"rounded-r-lg"},day:{base:"flex items-center justify-center cursor-pointer",size:"w-9 h-9",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},rounded:"rounded-lg",transition:"transition-all duration-150",states:{hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},today:{border:"ring-2 ring-blue-500 ring-inset",text:"text-blue-600 dark:text-blue-400 font-semibold"},disabled:{opacity:"opacity-30",cursor:"cursor-not-allowed"},inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:{rounded:"rounded-l-lg rounded-r-none"},rangeEnd:{rounded:"rounded-r-lg rounded-l-none"},otherMonth:{opacity:"opacity-40"}}},monthSelector:{base:"py-2",grid:"grid grid-cols-3 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-3 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},yearSelector:{base:"py-2 max-h-64 overflow-y-auto",grid:"grid grid-cols-4 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-2 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},footer:{base:"flex items-center justify-between",padding:"mt-4 pt-4",border:{light:"border-t border-gray-200",dark:"dark:border-gray-700"},button:{base:"flex items-center justify-center",padding:"px-4 py-2",rounded:"rounded-lg",text:{size:"text-sm font-medium"},today:{background:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},text:{light:"text-blue-600",dark:"dark:text-blue-400"},hover:{light:"hover:bg-blue-100",dark:"dark:hover:bg-blue-900/50"}},clear:{background:"bg-transparent",text:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"}},transition:"transition-colors duration-150"}},rangeIndicator:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-600",dark:"dark:text-gray-400"}},padding:"py-2 mb-2",separator:"mx-2"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"}};function Se(...e){return Rt(Mt(e))}var gd={"tr-TR":{months:["Ocak","\u015Eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011Fustos","Eyl\xFCl","Ekim","Kas\u0131m","Aral\u0131k"],monthsShort:["Oca","\u015Eub","Mar","Nis","May","Haz","Tem","A\u011Fu","Eyl","Eki","Kas","Ara"],weekdays:["Pazar","Pazartesi","Sal\u0131","\xC7ar\u015Famba","Per\u015Fembe","Cuma","Cumartesi"],weekdaysShort:["Paz","Pzt","Sal","\xC7ar","Per","Cum","Cmt"],weekdaysMin:["Pz","Pt","Sa","\xC7a","Pe","Cu","Ct"],today:"Bug\xFCn",clear:"Temizle",close:"Kapat",selectDate:"Tarih se\xE7in",selectStartDate:"Ba\u015Flang\u0131\xE7 tarihi",selectEndDate:"Biti\u015F tarihi",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"en-US":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"MM/dd/yyyy",firstDayOfWeek:0},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"de-DE":{months:["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"],weekdaysMin:["So","Mo","Di","Mi","Do","Fr","Sa"],today:"Heute",clear:"L\xF6schen",close:"Schlie\xDFen",selectDate:"Datum ausw\xE4hlen",selectStartDate:"Startdatum",selectEndDate:"Enddatum",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"fr-FR":{months:["Janvier","F\xE9vrier","Mars","Avril","Mai","Juin","Juillet","Ao\xFBt","Septembre","Octobre","Novembre","D\xE9cembre"],monthsShort:["Jan","F\xE9v","Mar","Avr","Mai","Jun","Jul","Ao\xFB","Sep","Oct","Nov","D\xE9c"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],weekdaysMin:["Di","Lu","Ma","Me","Je","Ve","Sa"],today:"Aujourd'hui",clear:"Effacer",close:"Fermer",selectDate:"S\xE9lectionner une date",selectStartDate:"Date de d\xE9but",selectEndDate:"Date de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"es-ES":{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Mi\xE9rcoles","Jueves","Viernes","S\xE1bado"],weekdaysShort:["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"],weekdaysMin:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"],today:"Hoy",clear:"Limpiar",close:"Cerrar",selectDate:"Seleccionar fecha",selectStartDate:"Fecha de inicio",selectEndDate:"Fecha de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"it-IT":{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Luned\xEC","Marted\xEC","Mercoled\xEC","Gioved\xEC","Venerd\xEC","Sabato"],weekdaysShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],weekdaysMin:["Do","Lu","Ma","Me","Gi","Ve","Sa"],today:"Oggi",clear:"Cancella",close:"Chiudi",selectDate:"Seleziona data",selectStartDate:"Data di inizio",selectEndDate:"Data di fine",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"pt-BR":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:0},"pt-PT":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"nl-NL":{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],monthsShort:["Jan","Feb","Mrt","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],weekdays:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],weekdaysShort:["Zo","Ma","Di","Wo","Do","Vr","Za"],weekdaysMin:["Zo","Ma","Di","Wo","Do","Vr","Za"],today:"Vandaag",clear:"Wissen",close:"Sluiten",selectDate:"Selecteer datum",selectStartDate:"Startdatum",selectEndDate:"Einddatum",dateFormat:"dd-MM-yyyy",firstDayOfWeek:1},"pl-PL":{months:["Stycze\u0144","Luty","Marzec","Kwiecie\u0144","Maj","Czerwiec","Lipiec","Sierpie\u0144","Wrzesie\u0144","Pa\u017Adziernik","Listopad","Grudzie\u0144"],monthsShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Pa\u017A","Lis","Gru"],weekdays:["Niedziela","Poniedzia\u0142ek","Wtorek","\u015Aroda","Czwartek","Pi\u0105tek","Sobota"],weekdaysShort:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],weekdaysMin:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],today:"Dzisiaj",clear:"Wyczy\u015B\u0107",close:"Zamknij",selectDate:"Wybierz dat\u0119",selectStartDate:"Data pocz\u0105tkowa",selectEndDate:"Data ko\u0144cowa",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ru-RU":{months:["\u042F\u043D\u0432\u0430\u0440\u044C","\u0424\u0435\u0432\u0440\u0430\u043B\u044C","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0435\u043B\u044C","\u041C\u0430\u0439","\u0418\u044E\u043D\u044C","\u0418\u044E\u043B\u044C","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C","\u041E\u043A\u0442\u044F\u0431\u0440\u044C","\u041D\u043E\u044F\u0431\u0440\u044C","\u0414\u0435\u043A\u0430\u0431\u0440\u044C"],monthsShort:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"],weekdays:["\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0435\u0440\u0433","\u041F\u044F\u0442\u043D\u0438\u0446\u0430","\u0421\u0443\u0431\u0431\u043E\u0442\u0430"],weekdaysShort:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],weekdaysMin:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],today:"\u0421\u0435\u0433\u043E\u0434\u043D\u044F",clear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",selectDate:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443",selectStartDate:"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430",selectEndDate:"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ja-JP":{months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],weekdaysShort:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],weekdaysMin:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],today:"\u4ECA\u65E5",clear:"\u30AF\u30EA\u30A2",close:"\u9589\u3058\u308B",selectDate:"\u65E5\u4ED8\u3092\u9078\u629E",selectStartDate:"\u958B\u59CB\u65E5",selectEndDate:"\u7D42\u4E86\u65E5",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ko-KR":{months:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],monthsShort:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],weekdays:["\uC77C\uC694\uC77C","\uC6D4\uC694\uC77C","\uD654\uC694\uC77C","\uC218\uC694\uC77C","\uBAA9\uC694\uC77C","\uAE08\uC694\uC77C","\uD1A0\uC694\uC77C"],weekdaysShort:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],weekdaysMin:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],today:"\uC624\uB298",clear:"\uC9C0\uC6B0\uAE30",close:"\uB2EB\uAE30",selectDate:"\uB0A0\uC9DC \uC120\uD0DD",selectStartDate:"\uC2DC\uC791\uC77C",selectEndDate:"\uC885\uB8CC\uC77C",dateFormat:"yyyy.MM.dd",firstDayOfWeek:0},"zh-CN":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u5173\u95ED",selectDate:"\u9009\u62E9\u65E5\u671F",selectStartDate:"\u5F00\u59CB\u65E5\u671F",selectEndDate:"\u7ED3\u675F\u65E5\u671F",dateFormat:"yyyy-MM-dd",firstDayOfWeek:1},"zh-TW":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u9031\u65E5","\u9031\u4E00","\u9031\u4E8C","\u9031\u4E09","\u9031\u56DB","\u9031\u4E94","\u9031\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u95DC\u9589",selectDate:"\u9078\u64C7\u65E5\u671F",selectStartDate:"\u958B\u59CB\u65E5\u671F",selectEndDate:"\u7D50\u675F\u65E5\u671F",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ar-SA":{months:["\u064A\u0646\u0627\u064A\u0631","\u0641\u0628\u0631\u0627\u064A\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064A\u0644","\u0645\u0627\u064A\u0648","\u064A\u0648\u0646\u064A\u0648","\u064A\u0648\u0644\u064A\u0648","\u0623\u063A\u0633\u0637\u0633","\u0633\u0628\u062A\u0645\u0628\u0631","\u0623\u0643\u062A\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062F\u064A\u0633\u0645\u0628\u0631"],monthsShort:["\u064A\u0646\u0627","\u0641\u0628\u0631","\u0645\u0627\u0631","\u0623\u0628\u0631","\u0645\u0627\u064A","\u064A\u0648\u0646","\u064A\u0648\u0644","\u0623\u063A\u0633","\u0633\u0628\u062A","\u0623\u0643\u062A","\u0646\u0648\u0641","\u062F\u064A\u0633"],weekdays:["\u0627\u0644\u0623\u062D\u062F","\u0627\u0644\u0625\u062B\u0646\u064A\u0646","\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621","\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621","\u0627\u0644\u062E\u0645\u064A\u0633","\u0627\u0644\u062C\u0645\u0639\u0629","\u0627\u0644\u0633\u0628\u062A"],weekdaysShort:["\u0623\u062D\u062F","\u0625\u062B\u0646","\u062B\u0644\u0627","\u0623\u0631\u0628","\u062E\u0645\u064A","\u062C\u0645\u0639","\u0633\u0628\u062A"],weekdaysMin:["\u062D","\u0646","\u062B","\u0631","\u062E","\u062C","\u0633"],today:"\u0627\u0644\u064A\u0648\u0645",clear:"\u0645\u0633\u062D",close:"\u0625\u063A\u0644\u0627\u0642",selectDate:"\u0627\u062E\u062A\u0631 \u062A\u0627\u0631\u064A\u062E",selectStartDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0628\u062F\u0627\u064A\u0629",selectEndDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0646\u0647\u0627\u064A\u0629",dateFormat:"dd/MM/yyyy",firstDayOfWeek:6}};function yr(e){return gd[e]}function so(e,t,r){let n=[],a=new Date(e,t,1),i=new Date(e,t+1,0),o=a.getDay()-r;if(o<0)o+=7;for(let l=o-1;l>=0;l--)n.push(new Date(e,t,-l));for(let l=1;l<=i.getDate();l++)n.push(new Date(e,t,l));let s=42-n.length;for(let l=1;l<=s;l++)n.push(new Date(e,t+1,l));return n}function ir(e,t){if(!e||!t)return!1;return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function co(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function po(e){return ir(e,new Date)}function xn(e,t,r){if(!t||!r)return!1;let n=e.getTime();return n>t.getTime()&&n<r.getTime()}function Qn(e,t,r,n,a){if(t&&e<t)return!0;if(r&&e>r)return!0;if(n){for(let i of n)if(ir(e,i))return!0}if(a&&a.includes(e.getDay()))return!0;return!1}function vn(e,t){if(!e)return"";let r=e.getDate().toString().padStart(2,"0"),n=(e.getMonth()+1).toString().padStart(2,"0"),a=e.getFullYear().toString();return t.replace("dd",r).replace("MM",n).replace("yyyy",a)}function md(e,t,r=" - "){if(!e.start&&!e.end)return"";if(!e.start)return vn(e.end,t);if(!e.end)return vn(e.start,t);return`${vn(e.start,t)}${r}${vn(e.end,t)}`}function Xn(e,t){if(!e)return"";let r=yr(t);return vn(e,r.dateFormat)}function uo(e,t,r=" - "){let n=yr(t);return md(e,n.dateFormat,r)}function zn(e,t){let r=new Date(e);return r.setMonth(r.getMonth()+t),r}function ln(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function go(e,t=12){let r=[],n=e-Math.floor(t/2);for(let a=0;a<t;a++)r.push(n+a);return r}function mo(e,t){let n=[...yr(e).weekdaysMin];for(let a=0;a<t;a++)n.push(n.shift());return n}import{jsxDEV as Nn}from"react/jsx-dev-runtime";fd.registerPlugin(bd);function bo({currentMonth:e,selectedDate:t,selectedRange:r,mode:n,locale:a,minDate:i,maxDate:o,disabledDates:s,disabledDaysOfWeek:l,firstDayOfWeek:c,onDateSelect:d,hoverDate:g,onHoverChange:h}){let k=Mu(null),u=Wr,z=so(e.getFullYear(),e.getMonth(),c),b=mo(a,c);bd(()=>{if(!k.current)return;let m=k.current.querySelectorAll("[data-day]");fd.fromTo(m,{opacity:0,scale:0.8},{opacity:1,scale:1,duration:0.3,stagger:{amount:0.15,grid:[6,7],from:"start"},ease:"power2.out"})},[e]);let C=(m)=>{let y=n==="single"?ir(m,t):r&&(ir(m,r.start)||ir(m,r.end)),v=co(m,e),p=Qn(m,i,o,s,l),f=po(m),M=n==="range"&&r?xn(m,r.start,r.end)||g&&r.start&&!r.end&&xn(m,r.start,g):!1,$=n==="range"&&r?.start&&!r?.end&&g&&ir(m,g);return Se(u.day.base,u.day.size,u.day.text.size,u.day.rounded,u.day.transition,!y&&!M&&u.day.text.color.light,!y&&!M&&u.day.text.color.dark,!y&&!M&&!p&&u.day.states.hover.light,!y&&!M&&!p&&u.day.states.hover.dark,!v&&u.day.states.otherMonth.opacity,p&&u.day.states.disabled.opacity,p&&u.day.states.disabled.cursor,f&&!y&&u.day.states.today.border,f&&!y&&u.day.states.today.text,y&&u.day.states.selected.background,y&&u.day.states.selected.text,$&&"ring-2 ring-blue-400 ring-inset")},x=(m)=>{if(Qn(m,i,o,s,l))return;d(m)},N=(m)=>{if(n==="range")h(m)};return Nn("div",{children:[Nn("div",{className:Se(u.weekdays.base,u.weekdays.padding),children:b.map((m,y)=>Nn("div",{className:Se("flex items-center justify-center",u.day.size,u.weekdays.text.size,u.weekdays.text.weight,u.weekdays.text.color.light,u.weekdays.text.color.dark),children:m},`weekday-${y}`,!1,void 0,this))},void 0,!1,void 0,this),Nn("div",{ref:k,className:Se(u.grid.base,u.grid.gap),children:z.map((m,y)=>{let v=n==="range"&&r?.start&&ir(m,r.start),p=n==="range"&&r?.end&&ir(m,r.end),f=n==="range"&&r?xn(m,r.start,r.end)||g&&r.start&&!r.end&&xn(m,r.start,g):!1,M=n==="range"&&r?.start&&!r?.end&&g&&ir(m,g),$=f||v||p||M;return Nn("div",{className:Se(u.dayWrapper.base,$&&u.dayWrapper.inRange.light,$&&u.dayWrapper.inRange.dark,v&&u.dayWrapper.rangeStart,(p||M)&&u.dayWrapper.rangeEnd,v&&!p&&!M&&"rounded-r-none",(p||M)&&!v&&"rounded-l-none",f&&!v&&!p&&!M&&"rounded-none"),children:Nn("button",{type:"button","data-day":!0,onClick:()=>x(m),onMouseEnter:()=>N(m),onMouseLeave:()=>N(null),disabled:Qn(m,i,o,s,l),className:C(m),"aria-label":m.toLocaleDateString(a),"aria-pressed":n==="single"?ir(m,t):!!(r&&(ir(m,r.start)||ir(m,r.end))),children:m.getDate()},void 0,!1,void 0,this)},`day-${y}`,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as hd}from"@gsap/react";import yd from"gsap";import{useRef as Ru}from"react";import{jsxDEV as Wt}from"react/jsx-dev-runtime";yd.registerPlugin(hd);function fo({currentMonth:e,onPrevMonth:t,onNextMonth:r,onPrevYear:n,onNextYear:a,onMonthYearClick:i,locale:o,minDate:s,maxDate:l}){let c=Ru(null),d=Wr,h=yr(o).months[e.getMonth()],k=e.getFullYear(),u=!s||e>s,z=!l||e<l;return hd(()=>{if(!c.current)return;yd.fromTo(c.current,{opacity:0,y:-10},{opacity:1,y:0,duration:0.2,ease:"power2.out"})},[e]),Wt("div",{className:Se(d.header.base,d.header.padding),children:[Wt("div",{className:"flex items-center gap-1",children:[Wt("button",{type:"button",onClick:n,disabled:!u,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!u&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous year",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[Wt("polyline",{points:"11 17 6 12 11 7"},void 0,!1,void 0,this),Wt("polyline",{points:"18 17 13 12 18 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Wt("button",{type:"button",onClick:t,disabled:!u,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!u&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous month",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:Wt("polyline",{points:"15 18 9 12 15 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Wt("button",{ref:c,type:"button",onClick:i,className:Se(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:[h," ",k]},void 0,!0,void 0,this),Wt("div",{className:"flex items-center gap-1",children:[Wt("button",{type:"button",onClick:r,disabled:!z,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!z&&"opacity-30 cursor-not-allowed"),"aria-label":"Next month",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:Wt("polyline",{points:"9 18 15 12 9 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Wt("button",{type:"button",onClick:a,disabled:!z,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!z&&"opacity-30 cursor-not-allowed"),"aria-label":"Next year",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[Wt("polyline",{points:"6 17 11 12 6 7"},void 0,!1,void 0,this),Wt("polyline",{points:"13 17 18 12 13 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as zd}from"@gsap/react";import yo from"gsap";import{useEffect as vd,useId as Wu,useRef as xd,useState as Un}from"react";import{useGSAP as wd}from"@gsap/react";import kd from"gsap";import{useRef as Bu}from"react";import{jsxDEV as Ar}from"react/jsx-dev-runtime";kd.registerPlugin(wd);function ho({currentMonth:e,onMonthSelect:t,onYearSelect:r,locale:n,minDate:a,maxDate:i,view:o,onViewChange:s,onClose:l}){let c=Bu(null),d=Wr,g=yr(n),h=e.getFullYear(),k=e.getMonth(),u=go(h,16);wd(()=>{if(!c.current)return;let C=c.current.querySelectorAll("[data-item]");kd.fromTo(C,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.25,stagger:0.02,ease:"power2.out"})},[o]);let z=(C)=>{t(C),l()},b=(C)=>{r(C),s("month")};if(o==="year")return Ar("div",{ref:c,className:d.yearSelector.base,children:Ar("div",{className:d.yearSelector.grid,children:u.map((C)=>{let x=C===h,N=a&&C<a.getFullYear()||i&&C>i.getFullYear();return Ar("button",{type:"button","data-item":!0,onClick:()=>b(C),disabled:N,className:Se(d.yearSelector.item.base,d.yearSelector.item.padding,d.yearSelector.item.rounded,d.yearSelector.item.text.size,d.yearSelector.item.transition,x?Se(d.yearSelector.item.selected.background,d.yearSelector.item.selected.text):Se(d.yearSelector.item.text.color.light,d.yearSelector.item.text.color.dark,d.yearSelector.item.hover.light,d.yearSelector.item.hover.dark),N&&"opacity-30 cursor-not-allowed"),children:C},C,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Ar("div",{ref:c,className:d.monthSelector.base,children:[Ar("div",{className:"flex justify-center mb-3",children:Ar("button",{type:"button",onClick:()=>s("year"),className:Se(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ar("div",{className:d.monthSelector.grid,children:g.monthsShort.map((C,x)=>{let N=x===k,m=a&&new Date(h,x+1,0)<a||i&&new Date(h,x,1)>i;return Ar("button",{type:"button","data-item":!0,onClick:()=>z(x),disabled:m,className:Se(d.monthSelector.item.base,d.monthSelector.item.padding,d.monthSelector.item.rounded,d.monthSelector.item.text.size,d.monthSelector.item.transition,N?Se(d.monthSelector.item.selected.background,d.monthSelector.item.selected.text):Se(d.monthSelector.item.text.color.light,d.monthSelector.item.text.color.dark,d.monthSelector.item.hover.light,d.monthSelector.item.hover.dark),m&&"opacity-30 cursor-not-allowed"),children:C},C,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as nt,Fragment as Iu}from"react/jsx-dev-runtime";yo.registerPlugin(zd);function Sn({mode:e,value:t,onChange:r,locale:n="en-US",placeholder:a,label:i,disabled:o=!1,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,className:g,inputClassName:h,dropdownClassName:k,showClearButton:u=!0,showTodayButton:z=!0,firstDayOfWeek:b,leftIcon:C,rightIcon:x,errorMessage:N,helperText:m,required:y=!1,onOpen:v,onClose:p}){let f=yr(n),M=b??f.firstDayOfWeek,[$,J]=Un(!1),[U,E]=Un("bottom"),[Z,B]=Un(()=>{if(e==="single"&&t)return ln(t);if(e==="range"&&t?.start){let re=t;return re.start?ln(re.start):ln(new Date)}return ln(new Date)}),[Q,S]=Un("calendar"),[O,A]=Un(null),ee=xd(null),_=xd(null),H=Wu(),T=Wr,ie=e==="single"?t:null,q=e==="range"?t:null,ce=e==="single"?Xn(ie,n):uo(q||{start:null,end:null},n),oe=a||(e==="range"?`${f.selectStartDate} - ${f.selectEndDate}`:f.selectDate),{contextSafe:Ze}=zd({scope:ee});vd(()=>{if(!$)return;let re=()=>{if(!ee.current)return;let Ke=ee.current.getBoundingClientRect(),I=window.innerHeight-Ke.bottom,ue=Ke.top;if(I<400&&ue>I)E("top");else E("bottom")};return re(),window.addEventListener("scroll",re,!0),window.addEventListener("resize",re),()=>{window.removeEventListener("scroll",re,!0),window.removeEventListener("resize",re)}},[$]),vd(()=>{if(!$)return;let re=(I)=>{if(ee.current&&!ee.current.contains(I.target))Ce()},Ke=(I)=>{if(I.key==="Escape")Ce()};return document.addEventListener("mousedown",re),document.addEventListener("keydown",Ke),()=>{document.removeEventListener("mousedown",re),document.removeEventListener("keydown",Ke)}},[$]);let $e=Ze(()=>{if(o)return;J(!0),S("calendar"),v?.(),requestAnimationFrame(()=>{if(_.current)yo.fromTo(_.current,{opacity:0,y:U==="bottom"?-12:12,scale:0.96},{opacity:1,y:0,scale:1,duration:0.25,ease:"power3.out"})})}),Ce=Ze(()=>{if(_.current)yo.to(_.current,{opacity:0,y:U==="bottom"?-8:8,scale:0.96,duration:0.15,ease:"power2.in",onComplete:()=>{J(!1),A(null),p?.()}});else J(!1),A(null),p?.()}),fe=(re)=>{if(e==="single")r(re),Ce();else{let Ke=q||{start:null,end:null};if(!Ke.start||Ke.start&&Ke.end)r({start:re,end:null});else{if(re<Ke.start)r({start:re,end:Ke.start});else r({start:Ke.start,end:re});Ce()}}},xe=Ze(()=>{if(e==="single")r(null);else r({start:null,end:null})}),Oe=()=>{let re=ln(new Date);if(B(re),e==="single")r(re),Ce()},Le=()=>B(zn(Z,-1)),ve=()=>B(zn(Z,1)),R=()=>B(zn(Z,-12)),de=()=>B(zn(Z,12)),te=()=>{S(Q==="calendar"?"month":"calendar")},ye=(re)=>{B(new Date(Z.getFullYear(),re,1)),S("calendar")},D=(re)=>{B(new Date(re,Z.getMonth(),1))},j=()=>{if($)Ce();else $e()};return nt("div",{ref:ee,className:Se(T.container.base,T.container.spacing,g),children:[i&&nt("label",{htmlFor:H,className:Se(T.label.base,T.label.text.size,T.label.text.color.light,T.label.text.color.dark,T.label.spacing),children:[i,y&&nt("span",{className:"text-red-500 ml-1",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nt("div",{className:"relative",children:[nt("button",{id:H,type:"button",onClick:j,disabled:o,className:Se(T.input.wrapper.base,T.input.wrapper.border.base,T.input.wrapper.background.light,T.input.wrapper.background.dark,T.input.wrapper.padding,T.input.wrapper.rounded,T.input.wrapper.shadow,T.input.wrapper.transition,$&&T.input.wrapper.border.focused,N&&T.input.wrapper.border.error,o&&T.input.wrapper.border.disabled,h),"aria-expanded":$,"aria-haspopup":"dialog",children:[C&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.left,$&&T.input.icon.color.focused),children:C},void 0,!1,void 0,this),!C&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.left,$&&T.input.icon.color.focused),children:nt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[nt("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),nt("line",{x1:"16",y1:"2",x2:"16",y2:"6"},void 0,!1,void 0,this),nt("line",{x1:"8",y1:"2",x2:"8",y2:"6"},void 0,!1,void 0,this),nt("line",{x1:"3",y1:"10",x2:"21",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),nt("span",{className:Se(T.input.text.base,T.input.text.size,ce?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.input.text.placeholder.light,T.input.text.placeholder.dark),"text-left"),children:ce||oe},void 0,!1,void 0,this),x&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.right,$&&T.input.icon.color.focused),children:x},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$&&nt("div",{ref:_,className:Se(T.dropdown.base,T.dropdown.background.light,T.dropdown.background.dark,T.dropdown.border.light,T.dropdown.border.dark,T.dropdown.rounded,T.dropdown.shadow,T.dropdown.padding,U==="top"&&T.dropdown.position.top,U==="top"&&T.dropdown.spacing.top,U==="bottom"&&T.dropdown.position.bottom,U==="bottom"&&T.dropdown.spacing.bottom,k),role:"dialog","aria-modal":"true","aria-label":f.selectDate,children:nt("div",{className:T.calendar.base,children:[e==="range"&&nt("div",{className:Se(T.rangeIndicator.base,T.rangeIndicator.padding,"border-b",T.footer.border.light,T.footer.border.dark),children:[nt("div",{className:Se("flex-1 text-center",T.rangeIndicator.text.size,q?.start?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.rangeIndicator.text.color.light,T.rangeIndicator.text.color.dark)),children:q?.start?Xn(q.start,n):f.selectStartDate},void 0,!1,void 0,this),nt("span",{className:Se(T.rangeIndicator.separator,T.rangeIndicator.text.color.light),children:"\u2192"},void 0,!1,void 0,this),nt("div",{className:Se("flex-1 text-center",T.rangeIndicator.text.size,q?.end?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.rangeIndicator.text.color.light,T.rangeIndicator.text.color.dark)),children:q?.end?Xn(q.end,n):f.selectEndDate},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="calendar"?nt(Iu,{children:[nt(fo,{currentMonth:Z,onPrevMonth:Le,onNextMonth:ve,onPrevYear:R,onNextYear:de,onMonthYearClick:te,locale:n,minDate:s,maxDate:l},void 0,!1,void 0,this),nt(bo,{currentMonth:Z,selectedDate:ie,selectedRange:q,mode:e,locale:n,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,firstDayOfWeek:M,onDateSelect:fe,hoverDate:O,onHoverChange:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this):nt(ho,{currentMonth:Z,onMonthSelect:ye,onYearSelect:D,locale:n,minDate:s,maxDate:l,view:Q==="month"?"month":"year",onViewChange:(re)=>S(re),onClose:()=>S("calendar")},void 0,!1,void 0,this),(z||u)&&nt("div",{className:Se(T.footer.base,T.footer.padding,T.footer.border.light,T.footer.border.dark),children:[u&&nt("button",{type:"button",onClick:xe,className:Se(T.footer.button.base,T.footer.button.padding,T.footer.button.rounded,T.footer.button.text.size,T.footer.button.clear.background,T.footer.button.clear.text.light,T.footer.button.clear.text.dark,T.footer.button.clear.hover.light,T.footer.button.clear.hover.dark,T.footer.button.transition),children:f.clear},void 0,!1,void 0,this),z&&nt("button",{type:"button",onClick:Oe,className:Se(T.footer.button.base,T.footer.button.padding,T.footer.button.rounded,T.footer.button.text.size,T.footer.button.today.background.light,T.footer.button.today.background.dark,T.footer.button.today.text.light,T.footer.button.today.text.dark,T.footer.button.today.hover.light,T.footer.button.today.hover.dark,T.footer.button.transition),children:f.today},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N&&nt("span",{className:Se(T.errorText.base,T.errorText.text,T.errorText.color),children:N},void 0,!1,void 0,this),m&&!N&&nt("span",{className:Se(T.helperText.base,T.helperText.text,T.helperText.color.light,T.helperText.color.dark),children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{batch as Nd,createStore as Hu}from"h-state";var $u={activeComponentId:null,propValues:{},themeMode:"light",viewportSize:"desktop-lg",sidebarOpen:!1,propsPanelOpen:!0,searchQuery:"",activeExampleIndex:null,activeCategory:"all"},{useStore:kr}=Hu($u,{setActiveComponent:(e)=>(t)=>{Nd(()=>{e.activeComponentId=t,e.propValues={},e.activeExampleIndex=null})},setPropValue:(e)=>(t,r)=>{e.propValues={...e.propValues,[t]:r},e.activeExampleIndex=null},setPropValues:(e)=>(t)=>{e.propValues=t},resetProps:(e)=>()=>{Nd(()=>{e.propValues={},e.activeExampleIndex=null})},setThemeMode:(e)=>(t)=>{e.themeMode=t},setViewportSize:(e)=>(t)=>{e.viewportSize=t},toggleSidebar:(e)=>()=>{e.sidebarOpen=!e.sidebarOpen},togglePropsPanel:(e)=>()=>{e.propsPanelOpen=!e.propsPanelOpen},setSearchQuery:(e)=>(t)=>{e.searchQuery=t},setActiveExample:(e)=>(t)=>{e.activeExampleIndex=t},setActiveCategory:(e)=>(t)=>{e.activeCategory=t}});var It={layout:{container:"relative min-h-screen w-full bg-white dark:bg-slate-950",wrapper:"flex h-screen overflow-hidden"},sidebar:{container:"flex flex-col w-64 h-full border-r border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-900 shrink-0 overflow-y-auto",header:"sticky top-0 z-10 bg-slate-50 dark:bg-slate-900 px-4 pt-5 pb-3 border-b border-slate-200 dark:border-slate-800",title:"text-base font-semibold text-slate-900 dark:text-slate-100",searchInput:"mt-3 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 placeholder-slate-400 dark:placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",categoryButton:"px-2.5 py-1 text-xs font-medium rounded-md transition-colors text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-200/60 dark:hover:bg-slate-800",categoryButtonActive:"px-2.5 py-1 text-xs font-medium rounded-md bg-blue-600 text-white dark:bg-blue-500 dark:text-white",componentItem:"flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-all duration-150 border-l-2 border-transparent",componentItemActive:"bg-blue-50 dark:bg-blue-500/10 border-l-2 !border-blue-600 dark:!border-blue-400",componentItemHover:"hover:bg-slate-100 dark:hover:bg-slate-800/60",componentName:"text-sm font-medium text-slate-800 dark:text-slate-200",componentCategory:"text-[10px] uppercase tracking-wider text-slate-400 dark:text-slate-500 font-medium",mobileToggle:"fixed top-4 left-4 z-50 p-2 rounded-lg bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 shadow-lg lg:hidden",overlay:"fixed inset-0 z-40 bg-black/30 backdrop-blur-sm lg:hidden"},canvas:{container:"flex-1 flex flex-col min-w-0 overflow-hidden",toolbar:"flex items-center gap-1.5 px-4 py-2.5 border-b border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shrink-0 flex-wrap",toolbarButton:"px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-800",toolbarButtonActive:"px-2.5 py-1.5 text-xs font-medium rounded-md bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900",toolbarDivider:"w-px h-5 bg-slate-200 dark:bg-slate-700 mx-1.5",viewportFrame:"flex-1 overflow-auto p-8 transition-all duration-300",viewportLabel:"mb-4 text-[11px] uppercase tracking-widest font-semibold text-slate-400 dark:text-slate-500",componentWrapper:"mx-auto rounded-xl border shadow-sm p-8 transition-all duration-300 overflow-visible",emptyState:"flex flex-col items-center justify-center h-full text-center py-24",emptyIcon:"w-16 h-16 text-slate-200 dark:text-slate-700 mb-4",emptyText:"text-sm text-slate-400 dark:text-slate-500 max-w-xs"},propsPanel:{container:"w-80 h-full border-l border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-900 shrink-0 overflow-y-auto overflow-x-hidden",header:"sticky top-0 z-10 bg-slate-50 dark:bg-slate-900 px-4 pt-5 pb-3 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between",title:"text-xs font-semibold tracking-widest text-slate-500 dark:text-slate-400 uppercase",sectionTitle:"px-4 pt-5 pb-2 text-[10px] uppercase tracking-widest font-bold text-slate-400 dark:text-slate-500",controlRow:"px-4 py-3 border-b border-slate-100 dark:border-slate-800/60",controlLabel:"block text-xs font-semibold text-slate-700 dark:text-slate-300",controlDescription:"text-[11px] text-slate-400 dark:text-slate-500 mt-0.5 leading-relaxed",textInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",numberInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",selectInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all appearance-none cursor-pointer",booleanToggle:"mt-2 relative w-10 h-[22px] rounded-full cursor-pointer transition-colors duration-200 bg-slate-300 dark:bg-slate-600",booleanToggleActive:"mt-2 relative w-10 h-[22px] rounded-full cursor-pointer transition-colors duration-200 bg-blue-600 dark:bg-blue-500",booleanTrack:"",booleanThumb:"absolute top-[3px] left-[3px] w-4 h-4 rounded-full bg-white shadow-sm transition-transform duration-200",rangeInput:"mt-2 w-full accent-blue-600 dark:accent-blue-400",resetButton:"px-3 py-1.5 text-xs font-medium rounded-lg text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-200/60 dark:hover:bg-slate-800 border border-slate-200 dark:border-slate-700 transition-colors",exampleCard:"mx-4 mb-2 px-3 py-2.5 rounded-lg border border-slate-200 dark:border-slate-700 cursor-pointer transition-all hover:border-slate-400 dark:hover:border-slate-500 hover:bg-white dark:hover:bg-slate-800/50",exampleCardActive:"mx-4 mb-2 px-3 py-2.5 rounded-lg border-2 border-blue-600 dark:border-blue-400 cursor-pointer bg-blue-50 dark:bg-blue-500/10",exampleTitle:"text-xs font-semibold text-slate-800 dark:text-slate-200",exampleDescription:"text-[11px] text-slate-400 dark:text-slate-500 mt-0.5"},propTable:{container:"mt-8 mx-auto w-full overflow-x-auto rounded-xl border shadow-sm",header:"",headerCell:"px-5 py-3 text-left text-[11px] uppercase tracking-widest font-bold",row:"border-t transition-colors",cell:"px-5 py-3 text-[13px]",propName:"font-mono font-bold",propType:"font-mono",propDefault:"font-mono",propRequired:"inline-flex px-2 py-0.5 rounded-md text-[10px] font-bold bg-rose-100 dark:bg-rose-500/15 text-rose-700 dark:text-rose-400",propDescription:""}};function Sd(e){return{...It,...e,layout:{...It.layout,...e.layout},sidebar:{...It.sidebar,...e.sidebar},canvas:{...It.canvas,...e.canvas},propsPanel:{...It.propsPanel,...e.propsPanel},propTable:{...It.propTable,...e.propTable}}}import{jsxDEV as he,Fragment as Cd}from"react/jsx-dev-runtime";var _u={"mobile-sm":"max-w-[320px]","mobile-lg":"max-w-[428px]","tablet-sm":"max-w-[768px]","tablet-lg":"max-w-[1024px]","desktop-sm":"max-w-[1280px]","desktop-lg":"max-w-full"},Pd={"mobile-sm":"320px","mobile-lg":"428px","tablet-sm":"768px","tablet-lg":"1024px","desktop-sm":"1280px","desktop-lg":"Full"},Fu=["mobile-sm","mobile-lg","tablet-sm","tablet-lg","desktop-sm","desktop-lg"],qu={mobile:"M7 2h10a2 2 0 012 2v16a2 2 0 01-2 2H7a2 2 0 01-2-2V4a2 2 0 012-2zm5 16h.01",tablet:"M6 2h12a2 2 0 012 2v16a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2zm6 16h.01",desktop:"M4 3h16a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2zm4 18h8m-4-4v4"};function La({registry:e}){let t=kr(),r=It.canvas,n=e.find((o)=>o.id===t.activeComponentId),a={};if(n)for(let o of n.props){let s=t.propValues[o.name];a[o.name]=s!==void 0&&s!==null?s:o.defaultValue??null}let i=t.themeMode==="dark";return he("main",{className:r.container,children:[he("header",{className:r.toolbar,children:[he("button",{type:"button",className:"p-2 lg:hidden rounded-md text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800",onClick:()=>t.toggleSidebar(),"aria-label":"Toggle sidebar",children:he("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:he("path",{d:"M3 12h18M3 6h18M3 18h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Fu.map((o)=>{let s=o.split("-")[0]??"",l=o.split("-")[1]?.toUpperCase()??"";return he("button",{type:"button",onClick:()=>t.setViewportSize(o),className:t.viewportSize===o?r.toolbarButtonActive:r.toolbarButton,title:`${Pd[o]} \u2014 ${s} ${l}`,children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"inline","aria-hidden":"true",children:he("path",{d:qu[s]??""},void 0,!1,void 0,this)},void 0,!1,void 0,this)},o,!1,void 0,this)}),he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.setThemeMode("light"),className:t.themeMode==="light"?r.toolbarButtonActive:r.toolbarButton,title:"Light mode",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[he("circle",{cx:"12",cy:"12",r:"5"},void 0,!1,void 0,this),he("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.setThemeMode("dark"),className:t.themeMode==="dark"?r.toolbarButtonActive:r.toolbarButton,title:"Dark mode",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:he("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.togglePropsPanel(),className:t.propsPanelOpen?r.toolbarButtonActive:r.toolbarButton,title:"Toggle props panel",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[he("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"},void 0,!1,void 0,this),he("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),n&&he(Cd,{children:[he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("span",{className:"text-xs font-semibold text-slate-900 dark:text-slate-100",children:n.name},void 0,!1,void 0,this),he("span",{className:"text-[11px] text-slate-400 dark:text-slate-500 font-mono",children:Pd[t.viewportSize]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),he("section",{className:w(r.viewportFrame,i?"bg-slate-950":"bg-slate-100/70"),style:!i?{backgroundImage:"radial-gradient(circle, #e2e8f0 1px, transparent 1px)",backgroundSize:"20px 20px"}:{backgroundImage:"radial-gradient(circle, #1e293b 1px, transparent 1px)",backgroundSize:"20px 20px"},children:n?he(Cd,{children:[he("article",{className:w(r.componentWrapper,_u[t.viewportSize],i?"bg-slate-900 border-slate-800":"bg-white border-slate-200"),children:he("section",{className:w(i?"dark":"","overflow-visible"),children:he("section",{className:w("rounded-lg overflow-visible",i?"bg-slate-900 text-white":"bg-white text-slate-900"),children:n.render(a)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he(Ou,{entry:n,isDark:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this):he("article",{className:r.emptyState,children:[he("svg",{className:r.emptyIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:[he("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),he("path",{d:"M3 9h18M9 21V9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),he("p",{className:r.emptyText,children:"Select a component from the sidebar to preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ou({entry:e,isDark:t}){let r=It.propTable,n=t?"border-slate-800":"border-slate-200",a=t?"bg-slate-800/80":"bg-slate-50",i=t?"text-slate-400":"text-slate-500",o=t?"hover:bg-slate-800/40":"hover:bg-slate-50",s=t?"text-sky-400":"text-slate-900",l=t?"text-emerald-400":"text-violet-700",c=t?"text-slate-400":"text-slate-500",d=t?"text-slate-300":"text-slate-600",g=t?"bg-slate-900":"bg-white";return he("section",{className:w(r.container,n,g),children:[he("header",{className:w("px-5 py-4 border-b",n),children:[he("h3",{className:w("text-sm font-bold tracking-tight",t?"text-slate-100":"text-slate-900"),children:"Props Reference"},void 0,!1,void 0,this),he("p",{className:w("mt-1 text-xs font-mono",t?"text-slate-500":"text-slate-400"),children:e.importPath},void 0,!1,void 0,this)]},void 0,!0,void 0,this),he("table",{className:"w-full text-left",children:[he("thead",{children:he("tr",{className:a,children:[he("th",{className:w(r.headerCell,i),children:"Prop"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Type"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Default"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Required"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Description"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),he("tbody",{children:e.props.map((h)=>he("tr",{className:w(r.row,n,o),children:[he("td",{className:w(r.cell,r.propName,s),children:h.name},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propType,l),children:h.type==="select"&&h.options?h.options.map((k)=>`'${k.value}'`).join(" | "):h.type==="boolean"?"boolean":h.type==="number"?"number":"string"},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propDefault,c),children:h.defaultValue===null?"\u2014":typeof h.defaultValue==="boolean"?String(h.defaultValue):typeof h.defaultValue==="string"?`"${h.defaultValue}"`:String(h.defaultValue)},void 0,!1,void 0,this),he("td",{className:r.cell,children:h.required&&he("span",{className:r.propRequired,children:"Required"},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propDescription,d),children:h.description},void 0,!1,void 0,this)]},h.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Vt,Fragment as Gu}from"react/jsx-dev-runtime";var Td={all:"All",inputs:"Inputs",display:"Display",feedback:"Feedback",navigation:"Navigation",layout:"Layout",data:"Data"},Ju=["all","inputs","data","display","feedback","navigation","layout"];function Ma({registry:e}){let t=kr(),r=It.sidebar,n=e.filter((i)=>{let o=t.activeCategory==="all"||i.category===t.activeCategory,s=!t.searchQuery||i.name.toLowerCase().includes(t.searchQuery.toLowerCase())||i.description.toLowerCase().includes(t.searchQuery.toLowerCase());return o&&s}),a=Ju.filter((i)=>{if(i==="all")return!0;return e.some((o)=>o.category===i)});return Vt(Gu,{children:[t.sidebarOpen&&Vt("section",{className:r.overlay,onClick:()=>t.toggleSidebar(),"aria-hidden":"true"},void 0,!1,void 0,this),Vt("nav",{className:w(r.container,"fixed lg:relative z-50 lg:z-auto transition-transform duration-300",t.sidebarOpen?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[Vt("header",{className:r.header,children:[Vt("h1",{className:r.title,children:"Design System"},void 0,!1,void 0,this),Vt("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:[e.length," components"]},void 0,!0,void 0,this),Vt("input",{type:"text",placeholder:"Search components...",value:t.searchQuery,onChange:(i)=>t.setSearchQuery(i.target.value),className:r.searchInput},void 0,!1,void 0,this),Vt("nav",{className:"flex flex-wrap gap-1 mt-3","aria-label":"Categories",children:a.map((i)=>Vt("button",{type:"button",onClick:()=>t.setActiveCategory(i),className:t.activeCategory===i?r.categoryButtonActive:r.categoryButton,children:Td[i]},i,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Vt("section",{className:"flex-1 py-2",children:[n.map((i)=>Vt("button",{type:"button",onClick:()=>t.setActiveComponent(i.id),className:w(r.componentItem,"w-full text-left",t.activeComponentId===i.id?r.componentItemActive:r.componentItemHover),children:Vt("span",{className:"flex flex-col min-w-0",children:[Vt("span",{className:r.componentName,children:i.name},void 0,!1,void 0,this),Vt("span",{className:r.componentCategory,children:Td[i.category]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},i.id,!1,void 0,this)),n.length===0&&Vt("p",{className:"px-4 py-8 text-center text-xs text-zinc-400 dark:text-zinc-500",children:"No components found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as at,Fragment as Au}from"react/jsx-dev-runtime";function Ra({registry:e}){let t=kr(),r=It.propsPanel,n=e.find((i)=>i.id===t.activeComponentId);if(!n||!t.propsPanelOpen)return null;let a=(i)=>{let o=t.propValues[i.name];if(o!==void 0)return o;return i.defaultValue};return at("aside",{className:r.container,children:[at("header",{className:r.header,children:[at("h2",{className:r.title,children:"Controls"},void 0,!1,void 0,this),at("button",{type:"button",onClick:()=>t.resetProps(),className:r.resetButton,children:"Reset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.examples.length>0&&at(Au,{children:[at("p",{className:r.sectionTitle,children:"Examples"},void 0,!1,void 0,this),n.examples.map((i,o)=>at("button",{type:"button",onClick:()=>{t.setPropValues(i.props),t.setActiveExample(o)},className:w("w-full text-left",t.activeExampleIndex===o?r.exampleCardActive:r.exampleCard),children:[at("span",{className:r.exampleTitle,children:i.title},void 0,!1,void 0,this),i.description&&at("span",{className:r.exampleDescription,children:i.description},void 0,!1,void 0,this)]},i.title,!0,void 0,this))]},void 0,!0,void 0,this),at("p",{className:r.sectionTitle,children:"Properties"},void 0,!1,void 0,this),n.props.map((i)=>at(Yu,{prop:i,value:a(i),onChange:(o)=>t.setPropValue(i.name,o)},i.name,!1,void 0,this))]},void 0,!0,void 0,this)}function Yu({prop:e,value:t,onChange:r}){let n=It.propsPanel;return at("section",{className:n.controlRow,children:[at("span",{className:n.controlLabel,id:`prop-label-${e.name}`,children:[e.name,e.required&&at("span",{className:"text-red-500 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.description&&at("p",{className:n.controlDescription,children:e.description},void 0,!1,void 0,this),e.type==="text"&&at("input",{type:"text",value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),placeholder:`Enter ${e.name}...`,className:n.textInput},void 0,!1,void 0,this),e.type==="number"&&at("input",{type:"number",value:t!==null&&t!==void 0?Number(t):"",onChange:(a)=>r(a.target.value?Number(a.target.value):null),min:e.min,max:e.max,step:e.step,className:n.numberInput},void 0,!1,void 0,this),e.type==="boolean"&&at("button",{type:"button",onClick:()=>r(t!==!0),className:t===!0?n.booleanToggleActive:n.booleanToggle,"aria-pressed":t===!0,"aria-label":`Toggle ${e.name}`,children:at("span",{className:w(n.booleanThumb,t===!0?"translate-x-4":"translate-x-0")},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.type==="select"&&e.options&&at("select",{value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),className:n.selectInput,children:e.options.map((a)=>at("option",{value:a.value,children:a.label},a.value,!1,void 0,this))},void 0,!1,void 0,this),e.type==="range"&&at("section",{className:"flex items-center gap-2 mt-1.5",children:[at("input",{type:"range",value:t!==null&&t!==void 0?Number(t):e.min??0,onChange:(a)=>r(Number(a.target.value)),min:e.min,max:e.max,step:e.step,className:n.rangeInput},void 0,!1,void 0,this),at("span",{className:"text-xs font-mono text-zinc-500 dark:text-zinc-400 min-w-[3ch] text-right",children:t!==null&&t!==void 0?String(t):"\u2014"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="color"&&at("section",{className:"flex items-center gap-2 mt-1.5",children:[at("input",{type:"color",value:t!==null&&t!==void 0?String(t):"#000000",onChange:(a)=>r(a.target.value),className:"w-8 h-8 rounded-md border border-zinc-200 dark:border-zinc-700 cursor-pointer"},void 0,!1,void 0,this),at("span",{className:"text-xs font-mono text-zinc-500 dark:text-zinc-400",children:t!==null&&t!==void 0?String(t):"#000000"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="json"&&at("textarea",{value:t!==null&&t!==void 0?String(t):"{}",onChange:(a)=>r(a.target.value),rows:3,className:w(n.textInput,"font-mono resize-y")},void 0,!1,void 0,this),e.type==="reactnode"&&at("input",{type:"text",value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),placeholder:"ReactNode as string...",className:n.textInput},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as En}from"react/jsx-dev-runtime";function Ld({registry:e,className:t}){let r=kr(),n=It.layout;return En("section",{className:w(n.container,t),children:En("section",{className:n.wrapper,children:[En(Ma,{registry:e},void 0,!1,void 0,this),En(La,{registry:e},void 0,!1,void 0,this),r.propsPanelOpen&&En(Ra,{registry:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useState as Zr}from"react";import{useGSAP as xo}from"@gsap/react";import zo from"gsap";import{useEffect as Zu,useRef as Dn,useState as ko}from"react";var Kr={container:{base:"relative w-full select-none",orientation:{horizontal:"py-2",vertical:"px-2 h-32"},disabled:"opacity-40 pointer-events-none"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-3",size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},track:{container:{base:"relative cursor-pointer",size:{sm:"h-0.5",md:"h-1",lg:"h-1.5"},orientation:{horizontal:"w-full",vertical:"h-full w-1"}},background:{base:"absolute inset-0 rounded-full",variant:{default:"bg-zinc-200 dark:bg-zinc-700",filled:"bg-zinc-300 dark:bg-zinc-600",minimal:"bg-zinc-100 dark:bg-zinc-800"},disabled:"bg-zinc-100 dark:bg-zinc-800"},range:{base:"absolute rounded-full",variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-zinc-600 dark:bg-zinc-400"},disabled:"bg-zinc-400 dark:bg-zinc-500"}},thumb:{base:"absolute rounded-full cursor-grab active:cursor-grabbing touch-none z-10",size:{sm:"w-2.5 h-2.5",md:"w-3.5 h-3.5",lg:"w-4 h-4"},variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-600"},states:{hover:"",active:"",focus:"outline-none ring-2 ring-zinc-400/50 dark:ring-zinc-500/50",disabled:"cursor-not-allowed"},shadow:"shadow-sm"},tooltip:{base:"absolute pointer-events-none bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 font-medium rounded whitespace-nowrap left-1/2 -translate-x-1/2",size:{sm:"px-1.5 py-0.5 text-[10px] -top-6",md:"px-2 py-0.5 text-xs -top-7",lg:"px-2 py-1 text-xs -top-8"},arrow:"after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-zinc-900 dark:after:border-t-white"},ticks:{container:"absolute inset-x-0 flex justify-between pointer-events-none mt-2",tick:"w-px h-1 bg-zinc-300 dark:bg-zinc-600",label:"text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5"},labels:{container:"flex justify-between mt-1.5",label:"text-[10px] text-zinc-400 dark:text-zinc-500"}};var or=(...e)=>Rt(Mt(e));import{forwardRef as Ku}from"react";import{jsxDEV as wo}from"react/jsx-dev-runtime";var Ba=Ku(({min:e,max:t,value:r,size:n,variant:a,orientation:i,disabled:o},s)=>{let l=Kr,c=t-e,d=(r.min-e)/c*100,g=(r.max-e)/c*100,h=i==="horizontal";return wo("div",{ref:s,className:or(l.track.container.base,l.track.container.size[n],l.track.container.orientation[i]),children:[wo("div",{className:or(l.track.background.base,l.track.background.variant[a],o&&l.track.background.disabled)},void 0,!1,void 0,this),wo("div",{className:or(l.track.range.base,l.track.range.variant[a],o&&l.track.range.disabled,h?"top-0 bottom-0":"left-0 right-0"),style:h?{left:`${d}%`,right:`${100-g}%`}:{bottom:`${d}%`,top:`${100-g}%`}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});Ba.displayName="RangeTrack";import{jsxDEV as jt}from"react/jsx-dev-runtime";zo.registerPlugin(xo);var vo=(e,t,r)=>Math.min(Math.max(e,t),r),Md=(e,t,r)=>{let n=Math.round((e-r)/t);return r+n*t};function Pn({value:e,defaultValue:t,min:r=0,max:n=100,step:a=1,minRange:i=0,disabled:o=!1,readOnly:s=!1,size:l="md",variant:c="default",orientation:d="horizontal",showTooltip:g=!1,showLabels:h=!1,showTicks:k=!1,tickCount:u=5,debounceMs:z=0,formatValue:b,onChange:C,onChangeCommit:x,label:N,minLabel:m,maxLabel:y,ariaLabel:v,ariaLabelMin:p,ariaLabelMax:f,className:M,...$}){let J=Kr,U=Dn(null),E=Dn(null),Z=Dn(null),B=Dn(null),[Q,S]=ko(t||{min:r+(n-r)*0.25,max:r+(n-r)*0.75}),[O,A]=ko(null),[ee,_]=ko(null);xo(()=>{if(Z.current)zo.to(Z.current,{scale:O==="min"?1.3:ee==="min"?1.15:1,duration:0.2,ease:O==="min"?"power2.out":"elastic.out(1, 0.4)"})},[O,ee]),xo(()=>{if(B.current)zo.to(B.current,{scale:O==="max"?1.3:ee==="max"?1.15:1,duration:0.2,ease:O==="max"?"power2.out":"elastic.out(1, 0.4)"})},[O,ee]);let H=e??Q,T=e!==void 0,ie=(R)=>{if(s)return;let de=vo(Md(R.min,a,r),r,R.max-i),te=vo(Md(R.max,a,r),R.min+i,n),ye={min:de,max:te};if(!T)S(ye);C?.(ye)},q=(R,de)=>{if(!E.current)return r;let te=E.current.getBoundingClientRect(),ye=d==="horizontal",D;if(ye)D=(R-te.left)/te.width;else D=1-(de-te.top)/te.height;return D=vo(D,0,1),r+D*(n-r)},ce=(R)=>{if(o||s)return;let de=q(R.clientX,R.clientY),te=Math.abs(de-H.min),ye=Math.abs(de-H.max);if(te<=ye)ie({...H,min:de});else ie({...H,max:de})},oe=Dn(null),Ze=(R)=>{if(o||s)return;A(R)},$e=()=>{if(O)if(A(null),z>0){if(oe.current)clearTimeout(oe.current);oe.current=setTimeout(()=>{x?.(H)},z)}else x?.(H)};Zu(()=>{if(!O)return;let R=(te)=>{te.preventDefault();let ye="touches"in te?te.touches[0]?.clientX??0:te.clientX,D="touches"in te?te.touches[0]?.clientY??0:te.clientY,j=q(ye,D);if(O==="min")ie({...H,min:Math.min(j,H.max-i)});else ie({...H,max:Math.max(j,H.min+i)})},de=()=>{$e()};return document.addEventListener("mousemove",R),document.addEventListener("mouseup",de),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("touchend",de),()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",de),document.removeEventListener("touchmove",R),document.removeEventListener("touchend",de)}},[O,H,r,n,i]);let Ce=(R,de)=>{if(o||s)return;let te=de==="min"?H.min:H.max,ye=te;switch(R.key){case"ArrowRight":case"ArrowUp":ye=te+a;break;case"ArrowLeft":case"ArrowDown":ye=te-a;break;case"PageUp":ye=te+a*10;break;case"PageDown":ye=te-a*10;break;case"Home":ye=r;break;case"End":ye=n;break;default:return}if(R.preventDefault(),de==="min")ie({...H,min:ye});else ie({...H,max:ye})},fe=(H.min-r)/(n-r)*100,xe=(H.max-r)/(n-r)*100,Oe=g&&(O==="min"||ee==="min"),Le=g&&(O==="max"||ee==="max"),ve=k?Array.from({length:u},(R,de)=>r+de/(u-1)*(n-r)):[];return jt("div",{ref:U,className:or(J.container.base,J.container.orientation[d],o&&J.container.disabled,M),...$,children:[N&&jt("span",{className:or(J.label.base,J.label.size[l]),id:`${$.id||"range"}-label`,children:N},void 0,!1,void 0,this),jt("div",{ref:E,className:"relative",onClick:ce,"aria-hidden":"true",children:[jt(Ba,{min:r,max:n,value:H,size:l,variant:c,orientation:d,disabled:o},void 0,!1,void 0,this),jt("div",{ref:Z,role:"slider",tabIndex:o?-1:0,"aria-label":p||v||"Minimum value","aria-valuemin":r,"aria-valuemax":H.max-i,"aria-valuenow":H.min,"aria-valuetext":b?b(H.min):String(H.min),"aria-disabled":o,"aria-orientation":d,className:or(J.thumb.base,J.thumb.size[l],J.thumb.variant[c],J.thumb.shadow,!o&&J.thumb.states.hover,O==="min"&&J.thumb.states.active,o&&J.thumb.states.disabled),style:{left:`${fe}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(R)=>{R.preventDefault(),R.stopPropagation(),Ze("min")},onTouchStart:(R)=>{R.stopPropagation(),Ze("min")},onMouseEnter:()=>_("min"),onMouseLeave:()=>_(null),onKeyDown:(R)=>Ce(R,"min"),onFocus:()=>_("min"),onBlur:()=>_(null),children:Oe&&jt("span",{className:or(J.tooltip.base,J.tooltip.size[l],J.tooltip.arrow),"aria-hidden":"true",children:b?b(H.min):H.min},void 0,!1,void 0,this)},void 0,!1,void 0,this),jt("div",{ref:B,role:"slider",tabIndex:o?-1:0,"aria-label":f||v||"Maximum value","aria-valuemin":H.min+i,"aria-valuemax":n,"aria-valuenow":H.max,"aria-valuetext":b?b(H.max):String(H.max),"aria-disabled":o,"aria-orientation":d,className:or(J.thumb.base,J.thumb.size[l],J.thumb.variant[c],J.thumb.shadow,!o&&J.thumb.states.hover,O==="max"&&J.thumb.states.active,o&&J.thumb.states.disabled),style:{left:`${xe}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(R)=>{R.preventDefault(),R.stopPropagation(),Ze("max")},onTouchStart:(R)=>{R.stopPropagation(),Ze("max")},onMouseEnter:()=>_("max"),onMouseLeave:()=>_(null),onKeyDown:(R)=>Ce(R,"max"),onFocus:()=>_("max"),onBlur:()=>_(null),children:Le&&jt("span",{className:or(J.tooltip.base,J.tooltip.size[l],J.tooltip.arrow),"aria-hidden":"true",children:b?b(H.max):H.max},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k&&jt("div",{className:J.ticks.container,style:{top:"100%",marginTop:"8px"},children:ve.map((R,de)=>jt("div",{className:"flex flex-col items-center",children:[jt("div",{className:J.ticks.tick},void 0,!1,void 0,this),jt("span",{className:J.ticks.label,children:b?b(R):R},void 0,!1,void 0,this)]},de,!0,void 0,this))},void 0,!1,void 0,this),h&&jt("div",{className:J.labels.container,children:[jt("span",{className:J.labels.label,children:m||(b?b(r):r)},void 0,!1,void 0,this),jt("span",{className:J.labels.label,children:y||(b?b(n):n)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Rd}from"@gsap/react";import No from"gsap";import{forwardRef as Qu,useRef as Xu}from"react";import{jsxDEV as Uu}from"react/jsx-dev-runtime";No.registerPlugin(Rd);var Bd=Qu(({position:e,value:t,min:r,max:n,size:a,variant:i,disabled:o,isDragging:s,onDragStart:l,onDragEnd:c,ariaLabel:d,ariaValueText:g},h)=>{let k=Kr,u=Xu(null),z=(t-r)/(n-r)*100;return Rd(()=>{if(!u.current)return;if(s)No.to(u.current,{scale:1.2,duration:0.15,ease:"power2.out"});else No.to(u.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})},[s]),Uu("div",{ref:(b)=>{if(u.current=b,typeof h==="function")h(b);else if(h)h.current=b},role:"slider",tabIndex:o?-1:0,"aria-label":d||`${e} value`,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":t,"aria-valuetext":g||String(t),"aria-disabled":o,"data-position":e,className:or(k.thumb.base,k.thumb.size[a],k.thumb.variant[i],k.thumb.shadow,!o&&k.thumb.states.hover,s&&k.thumb.states.active,o&&k.thumb.states.disabled),style:{left:`${z}%`},onMouseDown:(b)=>{if(b.preventDefault(),!o)l()},onTouchStart:(b)=>{if(b.preventDefault(),!o)l()},onMouseUp:c,onTouchEnd:c,onKeyDown:()=>{if(o)return}},void 0,!1,void 0,this)});Bd.displayName="RangeThumb";import{useGSAP as Eu}from"@gsap/react";import Du from"gsap";import{useRef as Zv}from"react";import{jsxDEV as Ev}from"react/jsx-dev-runtime";Du.registerPlugin(Eu);import{useGSAP as _d}from"@gsap/react";import Wa from"gsap";import{useEffect as To,useId as tg,useRef as jn,useState as Lo}from"react";var Vn={container:{base:"relative flex flex-col",spacing:"gap-1"},wrapper:{base:"relative flex items-center w-full",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:{sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"},rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},input:{base:"flex-1 bg-transparent border-none outline-none w-full",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},placeholder:{light:"placeholder:text-gray-400",dark:"dark:placeholder:text-gray-500"}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},icon:{base:"flex items-center justify-center flex-shrink-0",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}},clearButton:{base:"flex items-center justify-center cursor-pointer",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",hover:"hover:text-gray-600 dark:hover:text-gray-300"},transition:"transition-colors duration-150"},dropdown:{base:"absolute left-0 right-0 z-50 overflow-hidden",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-lg",shadow:"shadow-lg",maxHeight:"max-h-64 overflow-y-auto",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},item:{base:"cursor-pointer",padding:"px-4 py-3",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-50",dark:"dark:hover:bg-gray-700"},active:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},transition:"transition-colors duration-150",rounded:""},loading:{base:"flex items-center justify-center py-4",size:"w-6 h-6",color:"text-blue-500"},empty:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},padding:"py-4 px-4"}};function er(...e){return Rt(Mt(e))}function So(e,t){let r=null;return{call:(...i)=>{if(r)clearTimeout(r);r=setTimeout(()=>{e(...i),r=null},t)},cancel:()=>{if(r)clearTimeout(r),r=null}}}var Vu=[/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,/javascript:/gi,/on\w+\s*=/gi,/<iframe/gi,/<object/gi,/<embed/gi,/<link/gi,/data:/gi,/vbscript:/gi],ju={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Wd(e){let t=e;for(let r of Vu)t=t.replace(r,"");return t}function Id(e){return e.replace(/[&<>"'`=/]/g,(t)=>ju[t]||t)}function Po(e,t={}){let{trim:r=!0,escapeHtml:n=!1,maxLength:a,removeScripts:i=!0}=t,o=e;if(i)o=Wd(o);if(r)o=o.trim();if(n)o=Id(o);if(a&&o.length>a)o=o.slice(0,a);return o}import{useGSAP as Hd}from"@gsap/react";import $d from"gsap";import{useRef as eg}from"react";import{jsxDEV as vr}from"react/jsx-dev-runtime";$d.registerPlugin(Hd);function Co({results:e,renderItem:t,onSelect:r,loading:n=!1,emptyMessage:a="No results found",className:i,itemClassName:o,position:s,activeIndex:l,onActiveIndexChange:c}){let d=eg(null),g=Vn;Hd(()=>{if(!d.current)return;$d.fromTo(d.current,{opacity:0,y:s==="bottom"?-8:8,scale:0.98},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[s]);let h=(z)=>{r?.(z)},k=(z)=>{c(z)},u=(z)=>vr("span",{children:String(z.data)},void 0,!1,void 0,this);if(n)return vr("div",{className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:vr("div",{className:g.loading.base,children:vr("svg",{className:er(g.loading.size,g.loading.color,"animate-spin"),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[vr("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),vr("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return vr("div",{className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:vr("div",{className:er(g.empty.base,g.empty.text.size,g.empty.text.color.light,g.empty.text.color.dark,g.empty.padding),children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this);return vr("div",{ref:d,className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,g.dropdown.maxHeight,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:e.map((z,b)=>vr("button",{type:"button",onClick:()=>h(z),onMouseEnter:()=>k(b),className:er("w-full text-left",g.item.base,g.item.padding,g.item.text.size,g.item.text.color.light,g.item.text.color.dark,g.item.hover.light,g.item.hover.dark,g.item.transition,g.item.rounded,l===b&&g.item.active.light,l===b&&g.item.active.dark,o),children:t?t(z,b):u(z)},z.id,!1,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as tr}from"react/jsx-dev-runtime";Wa.registerPlugin(_d);function Cn({value:e,onChange:t,onSearch:r,results:n,renderItem:a,onSelect:i,placeholder:o="Search...",label:s,debounceMs:l=300,minSearchLength:c=1,disabled:d=!1,loading:g=!1,emptyMessage:h="No results found",className:k,inputClassName:u,dropdownClassName:z,itemClassName:b,showClearButton:C=!0,leftIcon:x,rightIcon:N,disableDropdown:m=!1,showSearchIcon:y=!0,maxLength:v=200,sanitize:p=!0,trimOnSearch:f=!0,preventXSS:M=!0}){let[$,J]=Lo(!1),[U,E]=Lo(-1),[Z,B]=Lo("bottom"),Q=jn(null),S=jn(null),O=jn(null),A=jn(null),ee=jn(r),_=tg();ee.current=r;let H=Vn,T=!m&&$&&n!==void 0&&n.length>=0&&e.length>=c,{contextSafe:ie}=_d({scope:S});To(()=>{return A.current=So((fe)=>{if(fe.length>=c||fe.length===0){let xe=p?Po(fe,{trim:f,escapeHtml:M,maxLength:v,removeScripts:!0}):fe;ee.current(xe)}},l),()=>{A.current?.cancel()}},[l,c,p,f,M,v]),To(()=>{if(!T)return;let fe=()=>{if(!O.current)return;let xe=O.current.getBoundingClientRect(),Oe=window.innerHeight-xe.bottom,Le=xe.top;if(Oe<256&&Le>Oe)B("top");else B("bottom")};return fe(),window.addEventListener("scroll",fe,!0),window.addEventListener("resize",fe),()=>{window.removeEventListener("scroll",fe,!0),window.removeEventListener("resize",fe)}},[T]),To(()=>{E(-1)},[n]);let q=ie(()=>{if(d)return;if(J(!0),S.current)Wa.to(S.current,{scale:1.01,duration:0.15,ease:"power2.out"})}),ce=ie(()=>{if(setTimeout(()=>{J(!1),E(-1)},150),S.current)Wa.to(S.current,{scale:1,duration:0.15,ease:"power2.out"})}),oe=(fe)=>{let xe=fe.target.value;t(xe),A.current?.call(xe)},Ze=ie(()=>{if(t(""),A.current?.call(""),Q.current?.focus(),S.current)Wa.fromTo(S.current,{scale:0.98},{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}),$e=(fe)=>{if(!n||n.length===0)return;switch(fe.key){case"ArrowDown":fe.preventDefault(),E((xe)=>xe<n.length-1?xe+1:0);break;case"ArrowUp":fe.preventDefault(),E((xe)=>xe>0?xe-1:n.length-1);break;case"Enter":{fe.preventDefault();let xe=n[U];if(U>=0&&U<n.length&&xe)Ce(xe);break}case"Escape":fe.preventDefault(),J(!1),Q.current?.blur();break}},Ce=(fe)=>{i?.(fe),J(!1),E(-1)};return tr("div",{ref:O,className:er(H.container.base,H.container.spacing,k),children:[s&&tr("label",{htmlFor:_,className:er(H.label.base,H.label.text.size,H.label.text.color.light,H.label.text.color.dark,H.label.spacing),children:s},void 0,!1,void 0,this),tr("div",{className:"relative",children:[tr("div",{ref:S,className:er(H.wrapper.base,H.wrapper.border.base,H.wrapper.background.light,H.wrapper.background.dark,H.wrapper.padding.md,H.wrapper.rounded,H.wrapper.shadow,H.wrapper.transition,$&&H.wrapper.border.focused,d&&H.wrapper.border.disabled),children:[(x||y)&&tr("span",{className:er(H.icon.base,H.icon.size.md,H.icon.color.light,H.icon.color.dark,H.icon.spacing.left,$&&H.icon.color.focused),children:x||tr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[tr("circle",{cx:"11",cy:"11",r:"8"},void 0,!1,void 0,this),tr("path",{d:"m21 21-4.3-4.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),tr("input",{ref:Q,id:_,type:"text",value:e,onChange:oe,onFocus:q,onBlur:ce,onKeyDown:$e,disabled:d,placeholder:o,maxLength:v,autoComplete:"off",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":s||o,role:"combobox","aria-expanded":T,"aria-autocomplete":"list","aria-haspopup":"listbox",className:er(H.input.base,H.input.text.size,H.input.text.color.light,H.input.text.color.dark,H.input.placeholder.light,H.input.placeholder.dark,u)},void 0,!1,void 0,this),C&&e&&tr("button",{type:"button",onClick:Ze,className:er(H.clearButton.base,H.clearButton.size,H.clearButton.color.light,H.clearButton.color.dark,H.clearButton.color.hover,H.clearButton.transition),"aria-label":"Clear search",children:tr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[tr("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),tr("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N&&tr("span",{className:er(H.icon.base,H.icon.size.md,H.icon.color.light,H.icon.color.dark,H.icon.spacing.right,$&&H.icon.color.focused),children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T&&tr(Co,{results:n,renderItem:a,onSelect:Ce,loading:g,emptyMessage:h,className:z,itemClassName:b,position:Z,activeIndex:U,onActiveIndexChange:E},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Gd}from"@gsap/react";import Yd from"gsap";import{useEffect as Ro,useRef as ta,useState as ra}from"react";var Ir={container:{base:"relative w-full"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",size:{sm:"text-xs",md:"text-sm",lg:"text-base"},required:'after:content-["*"] after:ml-0.5 after:text-red-500',error:"text-red-600 dark:text-red-400"},trigger:{base:"relative w-full flex items-center justify-between gap-2 rounded-lg border bg-white dark:bg-zinc-900 text-left cursor-pointer transition-all duration-150",size:{sm:"px-2.5 py-1.5 text-sm min-h-[32px]",md:"px-3 py-2 text-sm min-h-[40px]",lg:"px-4 py-2.5 text-base min-h-[48px]"},variant:{default:"border-zinc-300 dark:border-zinc-600",filled:"border-transparent bg-zinc-100 dark:bg-zinc-800",ghost:"border-transparent bg-transparent"},states:{hover:"hover:border-zinc-400 dark:hover:border-zinc-500",focus:"focus:outline-none focus:ring-2 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 focus:border-zinc-400 dark:focus:border-zinc-500",disabled:"opacity-50 cursor-not-allowed pointer-events-none",error:"border-red-500 dark:border-red-400 focus:ring-red-400/50",open:"ring-2 ring-zinc-400/50 dark:ring-zinc-500/50 border-zinc-400 dark:border-zinc-500"}},placeholder:{base:"text-zinc-400 dark:text-zinc-500 truncate"},value:{base:"text-zinc-900 dark:text-white truncate flex items-center gap-2"},icon:{base:"flex-shrink-0 text-zinc-400 dark:text-zinc-500 transition-transform duration-200",size:{sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5"},open:"rotate-180"},clearButton:{base:"flex-shrink-0 p-0.5 rounded text-zinc-400 dark:text-zinc-500 transition-colors",hover:"hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"},dropdown:{base:"absolute left-0 right-0 z-50 bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg overflow-hidden",position:{top:"bottom-full mb-1",bottom:"top-full mt-1"},size:{sm:"py-1",md:"py-1.5",lg:"py-2"}},search:{container:"px-2 pb-1.5 border-b border-zinc-100 dark:border-zinc-800",input:"w-full px-2.5 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md outline-none focus:ring-1 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400 dark:placeholder:text-zinc-500",icon:"absolute left-4.5 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-400"},option:{base:"relative flex items-center gap-2 cursor-pointer transition-colors duration-100",size:{sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-base"},states:{hover:"bg-zinc-50 dark:bg-zinc-800",selected:"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-white",highlighted:"bg-zinc-100 dark:bg-zinc-800",disabled:"opacity-50 cursor-not-allowed pointer-events-none"},icon:"flex-shrink-0 w-4 h-4",checkmark:"ml-auto flex-shrink-0 w-4 h-4 text-zinc-900 dark:text-white"},empty:{base:"px-3 py-6 text-center text-sm text-zinc-400 dark:text-zinc-500"},loading:{base:"px-3 py-6 flex items-center justify-center gap-2 text-sm text-zinc-400 dark:text-zinc-500",spinner:"w-4 h-4 animate-spin"},helper:{base:"mt-1.5 text-xs text-zinc-500 dark:text-zinc-400",error:"text-red-600 dark:text-red-400"}};var sr=(...e)=>Rt(Mt(e));import{useGSAP as Od}from"@gsap/react";import Jd from"gsap";import{forwardRef as rg,useEffect as Fd,useRef as ng,useState as qd}from"react";import{createPortal as ag}from"react-dom";import{jsxDEV as ig}from"react/jsx-dev-runtime";Jd.registerPlugin(Od);var Ia=rg(({isOpen:e,position:t,size:r,maxHeight:n,children:a,triggerRef:i},o)=>{let s=Ir,l=ng(null),[c,d]=qd(!1),[g,h]=qd({});if(Fd(()=>{d(!0)},[]),Fd(()=>{if(!e||!i?.current)return;let u=()=>{let z=i.current?.getBoundingClientRect();if(!z)return;h({position:"fixed",left:z.left,width:z.width,maxHeight:n,overflowY:"auto",zIndex:9999,...t==="top"?{bottom:window.innerHeight-z.top+4}:{top:z.bottom+4}})};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[e,t,n,i]),Od(()=>{if(!l.current)return;if(e)Jd.fromTo(l.current,{opacity:0,y:t==="bottom"?-8:8,scale:0.96},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[e,t]),!e||!c)return null;let k=ig("div",{ref:(u)=>{if(l.current=u,typeof o==="function")o(u);else if(o)o.current=u},role:"listbox",className:sr(s.dropdown.base,s.dropdown.size[r],!i&&s.dropdown.position[t]),style:i?g:{maxHeight:n,overflowY:"auto"},children:a},void 0,!1,void 0,this);if(i)return ag(k,document.body);return k});Ia.displayName="SelectDropdown";import{jsxDEV as ea}from"react/jsx-dev-runtime";function Mo({option:e,isSelected:t,isHighlighted:r,size:n,onClick:a,onMouseEnter:i}){let o=Ir;return ea("div",{role:"option",tabIndex:e.disabled?-1:0,"aria-selected":t,"aria-disabled":e.disabled,onClick:e.disabled?void 0:a,onKeyDown:(s)=>{if(s.key==="Enter"||s.key===" "){if(s.preventDefault(),!e.disabled)a()}},onMouseEnter:i,className:sr(o.option.base,o.option.size[n],!e.disabled&&o.option.states.hover,t&&o.option.states.selected,r&&!t&&o.option.states.highlighted,e.disabled&&o.option.states.disabled),children:[e.icon&&ea("span",{className:o.option.icon,children:e.icon},void 0,!1,void 0,this),ea("span",{className:"truncate",children:e.label},void 0,!1,void 0,this),t&&ea("svg",{className:o.option.checkmark,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:ea("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{forwardRef as og}from"react";import{jsxDEV as lg}from"react/jsx-dev-runtime";var Ha=og(({isOpen:e,disabled:t,loading:r,size:n,variant:a,hasValue:i,hasError:o,onClick:s,onKeyDown:l,children:c},d)=>{let g=Ir;return lg("button",{ref:d,type:"button",role:"combobox","aria-expanded":e,"aria-haspopup":"listbox","aria-disabled":t,disabled:t,onClick:s,onKeyDown:l,className:sr(g.trigger.base,g.trigger.size[n],g.trigger.variant[a],!t&&g.trigger.states.hover,g.trigger.states.focus,t&&g.trigger.states.disabled,o&&g.trigger.states.error,e&&g.trigger.states.open),children:c},void 0,!1,void 0,this)});Ha.displayName="SelectTrigger";import{jsxDEV as dt,Fragment as sg}from"react/jsx-dev-runtime";Yd.registerPlugin(Gd);function dr({options:e,value:t,defaultValue:r,placeholder:n="Select...",disabled:a=!1,readOnly:i=!1,loading:o=!1,clearable:s=!1,searchable:l=!1,size:c="md",variant:d="default",position:g="auto",maxHeight:h=240,emptyText:k="No options",loadingText:u="Loading...",searchPlaceholder:z="Search...",onChange:b,onSearch:C,onOpen:x,onClose:N,renderOption:m,renderValue:y,label:v,error:p,helperText:f,required:M=!1,name:$,ariaLabel:J,className:U,...E}){let Z=Ir,B=ta(null),Q=ta(null),S=ta(null),O=ta(null),[A,ee]=ra(!1),[_,H]=ra(r),[T,ie]=ra(""),[q,ce]=ra(-1),[oe,Ze]=ra("bottom"),$e=t!==void 0?t:_,Ce=t!==void 0,fe=e.find((j)=>j.value===$e),xe=l&&T?e.filter((j)=>j.label.toLowerCase().includes(T.toLowerCase())):e,Oe=()=>{if(g!=="auto"){Ze(g);return}if(!Q.current)return;let j=Q.current.getBoundingClientRect(),re=window.innerHeight-j.bottom,Ke=j.top,I=Math.min(h+50,300);if(re<I&&Ke>re)Ze("top");else Ze("bottom")},Le=()=>{if(a||i)return;Oe(),ee(!0),ce(-1),x?.()},ve=()=>{ee(!1),ie(""),ce(-1),N?.()},R=(j)=>{if(j.disabled)return;if(!Ce)H(j.value);b?.(j.value),ve(),Q.current?.focus()},de=(j)=>{if(j.stopPropagation(),!Ce)H(void 0);b?.(void 0)},te=(j)=>{let re=j.target.value;ie(re),ce(-1),C?.(re)},ye=(j)=>{switch(j.key){case"Enter":case" ":if(j.preventDefault(),A){if(q>=0&&xe[q])R(xe[q])}else Le();break;case"ArrowDown":if(j.preventDefault(),!A)Le();else ce((re)=>re<xe.length-1?re+1:0);break;case"ArrowUp":if(j.preventDefault(),!A)Le();else ce((re)=>re>0?re-1:xe.length-1);break;case"Escape":if(A)j.preventDefault(),ve();break;case"Tab":if(A)ve();break;case"Home":if(A)j.preventDefault(),ce(0);break;case"End":if(A)j.preventDefault(),ce(xe.length-1);break}};Ro(()=>{if(!A)return;let j=(Ke)=>{let I=Ke.target,ue=B.current?.contains(I),We=S.current?.contains(I);if(!ue&&!We)ve()},re=(Ke)=>{if(Ke.key==="Escape")ve()};return document.addEventListener("mousedown",j),document.addEventListener("keydown",re),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",re)}},[A]),Ro(()=>{if(A&&l&&O.current)O.current.focus()},[A,l]),Ro(()=>{if(A&&q>=0&&S.current){let j=S.current.querySelector(`[data-index="${q}"]`);if(j)j.scrollIntoView({block:"nearest"})}},[q,A]);let D=ta(null);return Gd(()=>{if(D.current)Yd.to(D.current,{rotation:A?180:0,duration:0.2,ease:"power2.out"})},[A]),dt("div",{ref:B,className:sr(Z.container.base,U),...E,children:[v&&dt("span",{className:sr(Z.label.base,Z.label.size[c],M&&Z.label.required,p&&Z.label.error),id:`${E.id||"select"}-label`,children:v},void 0,!1,void 0,this),dt(Ha,{ref:Q,isOpen:A,disabled:a,loading:o,size:c,variant:d,hasValue:!!fe,hasError:!!p,onClick:()=>A?ve():Le(),onKeyDown:ye,children:[dt("span",{className:fe?Z.value.base:Z.placeholder.base,children:fe?y?y(fe):fe.icon?dt(sg,{children:[fe.icon,fe.label]},void 0,!0,void 0,this):fe.label:n},void 0,!1,void 0,this),dt("div",{className:"flex items-center gap-1",children:[s&&$e!==void 0&&$e!==""&&!a&&dt("span",{role:"button",tabIndex:0,onClick:de,onKeyDown:(j)=>{if(j.key==="Enter"||j.key===" ")j.preventDefault(),de(j)},className:sr(Z.clearButton.base,Z.clearButton.hover),"aria-label":"Clear selection",children:dt("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:dt("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?dt("svg",{className:sr(Z.loading.spinner,Z.icon.size[c]),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[dt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),dt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):dt("svg",{ref:D,className:sr(Z.icon.base,Z.icon.size[c]),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:dt("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$&&dt("input",{type:"hidden",name:$,value:String($e??"")},void 0,!1,void 0,this),dt(Ia,{ref:S,isOpen:A,position:oe,size:c,maxHeight:h,triggerRef:Q,children:[l&&dt("div",{className:Z.search.container,children:dt("input",{ref:O,type:"text",value:T,onChange:te,placeholder:z,className:Z.search.input,onClick:(j)=>j.stopPropagation()},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?dt("div",{className:Z.loading.base,children:[dt("svg",{className:Z.loading.spinner,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[dt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),dt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u]},void 0,!0,void 0,this):xe.length===0?dt("div",{className:Z.empty.base,children:k},void 0,!1,void 0,this):xe.map((j,re)=>dt("div",{"data-index":re,children:m?dt("div",{onClick:()=>R(j),onKeyDown:(Ke)=>{if(Ke.key==="Enter")R(j)},role:"option",tabIndex:0,"aria-selected":j.value===$e,children:m(j,j.value===$e)},void 0,!1,void 0,this):dt(Mo,{option:j,isSelected:j.value===$e,isHighlighted:re===q,size:c,onClick:()=>R(j),onMouseEnter:()=>ce(re)},void 0,!1,void 0,this)},String(j.value),!1,void 0,this))]},void 0,!0,void 0,this),(f||p)&&dt("p",{className:sr(Z.helper.base,p&&Z.helper.error),children:p||f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import Ad from"gsap";import{useRef as Bo,useState as dg}from"react";import{createPortal as cg}from"react-dom";var $a={container:{base:"relative inline-flex"},tooltip:{base:"absolute z-50 pointer-events-none whitespace-normal break-words text-center",size:{sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},variant:{dark:"bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900",light:"bg-white text-gray-900 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:border-gray-700",info:"bg-blue-600 text-white dark:bg-blue-500",success:"bg-emerald-600 text-white dark:bg-emerald-500",warning:"bg-amber-500 text-white dark:bg-amber-400 dark:text-gray-900",danger:"bg-red-600 text-white dark:bg-red-500"},rounded:"rounded-lg",shadow:"shadow-lg",maxWidth:"max-w-xs"},arrow:{base:"absolute w-0 h-0 pointer-events-none",size:"border-[6px]",variant:{dark:"border-gray-900 dark:border-gray-100",light:"border-white dark:border-gray-800",info:"border-blue-600 dark:border-blue-500",success:"border-emerald-600 dark:border-emerald-500",warning:"border-amber-500 dark:border-amber-400",danger:"border-red-600 dark:border-red-500"},placement:{top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"}}};import{jsxDEV as Wo}from"react/jsx-dev-runtime";function pg(e,t,r,n){let a={top:0,left:0};if(r==="top")a.top=e.top-t.height-n,a.left=e.left+e.width/2-t.width/2;else if(r==="bottom")a.top=e.bottom+n,a.left=e.left+e.width/2-t.width/2;else if(r==="left")a.top=e.top+e.height/2-t.height/2,a.left=e.left-t.width-n;else if(r==="right")a.top=e.top+e.height/2-t.height/2,a.left=e.right+n;return a}function _a({children:e,content:t,placement:r="top",trigger:n="hover",variant:a="dark",size:i="md",delay:o=0,offset:s=8,disabled:l=!1,showArrow:c=!0,maxWidth:d,className:g,contentClassName:h}){let[k,u]=dg(!1),z=Bo(null),b=Bo(null),C=Bo(null),x=$a,N=()=>{if(!z.current||!b.current)return;let $=z.current.getBoundingClientRect(),J=b.current.getBoundingClientRect(),U=pg($,J,r,s);b.current.style.top=`${U.top}px`,b.current.style.left=`${U.left}px`},m=()=>{requestAnimationFrame(()=>{if(!b.current)return;N();let $={opacity:0,duration:0.2,ease:"power2.out"},J={opacity:1,duration:0.2,ease:"power2.out"};if(r==="top")$.y=6,J.y=0;else if(r==="bottom")$.y=-6,J.y=0;else if(r==="left")$.x=6,J.x=0;else if(r==="right")$.x=-6,J.x=0;Ad.fromTo(b.current,$,J)})},y=()=>{if(l)return;if(C.current!==null)window.clearTimeout(C.current);if(o>0)C.current=window.setTimeout(()=>{u(!0),m()},o);else u(!0),m()},v=()=>{if(C.current!==null)window.clearTimeout(C.current),C.current=null;if(!b.current){u(!1);return}let $={opacity:0,duration:0.15,ease:"power2.in",onComplete:()=>u(!1)};if(r==="top")$.y=6;else if(r==="bottom")$.y=-6;else if(r==="left")$.x=6;else if(r==="right")$.x=-6;Ad.to(b.current,$)},p={};if(n==="hover")p.onMouseEnter=y,p.onMouseLeave=v;else if(n==="click")p.onClick=()=>k?v():y();else if(n==="focus")p.onFocus=y,p.onBlur=v;let f={top:"left-1/2 -translate-x-1/2 top-full border-l-transparent border-r-transparent border-b-transparent",bottom:"left-1/2 -translate-x-1/2 bottom-full border-l-transparent border-r-transparent border-t-transparent",left:"top-1/2 -translate-y-1/2 left-full border-t-transparent border-b-transparent border-r-transparent",right:"top-1/2 -translate-y-1/2 right-full border-t-transparent border-b-transparent border-l-transparent"},M=k?cg(Wo("span",{ref:b,role:"tooltip",className:w("fixed z-[9999] pointer-events-none whitespace-normal break-words text-center",x.tooltip.size[i],x.tooltip.variant[a],x.tooltip.rounded,x.tooltip.shadow,h),style:{...d?{maxWidth:`${d}px`}:{maxWidth:"320px"},opacity:0},children:[t,c&&Wo("span",{className:w("absolute w-0 h-0 pointer-events-none border-[6px]",f[r]),style:ug(a,r),"aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body):null;return Wo("span",{ref:z,className:w("relative inline-flex",g),...p,children:[e,M]},void 0,!0,void 0,this)}function ug(e,t){let r={dark:"rgb(17 24 39)",light:"rgb(255 255 255)",info:"rgb(37 99 235)",success:"rgb(5 150 105)",warning:"rgb(245 158 11)",danger:"rgb(220 38 38)"},n=r[e??"dark"]??r.dark;if(t==="top")return{borderTopColor:n};if(t==="bottom")return{borderBottomColor:n};if(t==="left")return{borderLeftColor:n};if(t==="right")return{borderRightColor:n};return{}}import{jsxDEV as Nt}from"react/jsx-dev-runtime";var gg=(e)=>{let[t,r]=Zr(e.checked===!0);return Nt(hr,{checked:t,onChange:r,variant:e.variant||"checkbox",size:e.size||"md",color:e.color||"primary",label:e.label!==null&&e.label!==void 0?String(e.label):"Checkbox label",labelPosition:e.labelPosition||"right",disabled:e.disabled===!0,indeterminate:e.indeterminate===!0,helperText:e.helperText?String(e.helperText):void 0,errorMessage:e.errorMessage?String(e.errorMessage):void 0},void 0,!1,void 0,this)},mg=(e)=>{let[t,r]=Zr(null);return Nt(Sn,{mode:"single",value:t,onChange:(n)=>r(n),placeholder:e.placeholder?String(e.placeholder):"Select date...",label:e.label?String(e.label):void 0,disabled:e.disabled===!0,showClearButton:e.showClearButton!==!1,showTodayButton:e.showTodayButton!==!1},void 0,!1,void 0,this)},bg=(e)=>{let[t,r]=Zr(e.value?String(e.value):"");return Nt(Ee,{value:t,onChange:r,type:e.type||"text",label:e.label?String(e.label):void 0,placeholder:e.placeholder?String(e.placeholder):"Type something...",size:e.size||"md",disabled:e.disabled===!0,readOnly:e.readOnly===!0,fullWidth:e.fullWidth!==!1,helperText:e.helperText?String(e.helperText):void 0,errorMessage:e.errorMessage?String(e.errorMessage):void 0,showValidationIcon:e.showValidationIcon===!0},void 0,!1,void 0,this)},fg=(e)=>{let[t,r]=Zr({min:20,max:80});return Nt(Pn,{value:t,onChange:r,min:typeof e.min==="number"?e.min:0,max:typeof e.max==="number"?e.max:100,step:typeof e.step==="number"?e.step:1,size:e.size||"md",variant:e.variant||"default",orientation:e.orientation||"horizontal",showTooltip:e.showTooltip!==!1,showLabels:e.showLabels!==!1,disabled:e.disabled===!0,label:e.label?String(e.label):void 0},void 0,!1,void 0,this)},hg=[{id:"1",data:{name:"Button",category:"Inputs"}},{id:"2",data:{name:"Checkbox",category:"Inputs"}},{id:"3",data:{name:"DataTable",category:"Data"}},{id:"4",data:{name:"DatePicker",category:"Inputs"}},{id:"5",data:{name:"TextInput",category:"Inputs"}},{id:"6",data:{name:"RangePicker",category:"Inputs"}},{id:"7",data:{name:"SearchBox",category:"Inputs"}},{id:"8",data:{name:"SelectBox",category:"Inputs"}},{id:"9",data:{name:"Dialog",category:"Feedback"}},{id:"10",data:{name:"Tooltip",category:"Display"}}],yg=(e)=>{let[t,r]=Zr(""),[n,a]=Zr([]),[i,o]=Zr(!1);return Nt(Cn,{value:t,onChange:r,onSearch:(l)=>{if(!l.trim()){a([]);return}o(!0);let c=window.setTimeout(()=>{let d=hg.filter((g)=>g.data.name.toLowerCase().includes(l.toLowerCase()));a(d),o(!1)},200);return()=>window.clearTimeout(c)},results:n,renderItem:(l)=>Nt("span",{className:"flex items-center justify-between w-full px-3 py-2",children:[Nt("span",{className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:l.data.name},void 0,!1,void 0,this),Nt("span",{className:"text-xs text-slate-400 dark:text-slate-500",children:l.data.category},void 0,!1,void 0,this)]},void 0,!0,void 0,this),onSelect:(l)=>r(l.data.name),placeholder:e.placeholder?String(e.placeholder):"Search...",label:e.label?String(e.label):void 0,disabled:e.disabled===!0,loading:e.loading===!0||i,showClearButton:e.showClearButton!==!1,showSearchIcon:e.showSearchIcon!==!1,disableDropdown:e.disableDropdown===!0,debounceMs:typeof e.debounceMs==="number"?e.debounceMs:300},void 0,!1,void 0,this)},wg=(e)=>{let[t,r]=Zr(void 0);return Nt(dr,{options:[{value:"react",label:"React"},{value:"vue",label:"Vue"},{value:"angular",label:"Angular"},{value:"svelte",label:"Svelte"},{value:"solid",label:"SolidJS"}],value:t,onChange:(a)=>r(a),placeholder:e.placeholder?String(e.placeholder):"Select...",label:e.label?String(e.label):void 0,size:e.size||"md",variant:e.variant||"default",disabled:e.disabled===!0,clearable:e.clearable===!0,searchable:e.searchable===!0,loading:e.loading===!0},void 0,!1,void 0,this)},Fa=["Alice Johnson","Bob Smith","Charlie Brown","Diana Prince","Eve Wilson","Frank Castle","Grace Hopper","Henry Ford","Iris West","Jack Daniels","Karen Page","Leo Messi","Maya Angelou","Noah Bennett","Olivia Pope","Paul Graham","Quinn Hughes","Rachel Green","Sam Altman","Tina Turner"],Kd=["Admin","Editor","Viewer","Manager","Developer"],Zd=["Active","Inactive","Pending","Suspended"],Qd=["Engineering","Design","Marketing","Sales","Support","HR"];function kg(e){return Array.from({length:e},(t,r)=>({id:r+1,name:Fa[r%Fa.length]??`User ${r+1}`,email:`${(Fa[r%Fa.length]??"user").split(" ")[0]?.toLowerCase()}${r+1}@example.com`,role:Kd[r%Kd.length]??"Viewer",status:Zd[r%Zd.length]??"Active",department:Qd[r%Qd.length]??"Engineering",joined:`2024-${String(r%12+1).padStart(2,"0")}-${String(r%28+1).padStart(2,"0")}`}))}var vg=[{key:"id",header:"ID",width:60,sortable:!0},{key:"name",header:"Name",sortable:!0},{key:"email",header:"Email",sortable:!0},{key:"role",header:"Role",sortable:!0},{key:"status",header:"Status",sortable:!0},{key:"department",header:"Department",sortable:!0},{key:"joined",header:"Joined",sortable:!0}],xg=(e)=>{let t=typeof e.rowCount==="number"?Math.max(0,Math.min(e.rowCount,100)):5,r=e.showDepartment===!0,n=e.showJoined===!0,a=vg.filter((o)=>{if(o.key==="department")return r;if(o.key==="joined")return n;return!0}),i=kg(t);return Nt(kn,{data:e.showEmptyState===!0?[]:i,columns:a,keyExtractor:(o)=>o.id,isLoading:e.isLoading===!0,isPending:e.isPending===!0,config:{enableSelection:e.enableSelection===!0,isFrontendSort:e.isFrontendSort!==!1,hasClickAction:e.hasClickAction===!0,hasDoubleClickAction:e.hasDoubleClickAction===!0,enableInfiniteScroll:e.enableInfiniteScroll===!0,defaultColumnWidth:typeof e.defaultColumnWidth==="number"?e.defaultColumnWidth:150,defaultRowHeight:typeof e.defaultRowHeight==="number"?e.defaultRowHeight:48,minColumnWidth:typeof e.minColumnWidth==="number"?e.minColumnWidth:60,pageSize:typeof e.pageSize==="number"?e.pageSize:20,selectionColumnWidth:typeof e.selectionColumnWidth==="number"?e.selectionColumnWidth:48},skeletonRowCount:typeof e.skeletonRowCount==="number"?e.skeletonRowCount:5,emptyMessage:e.emptyMessage?String(e.emptyMessage):"No data available"},void 0,!1,void 0,this)};function Io(){return[{id:"button",name:"Button",description:"Versatile button component with multiple variants, sizes, shapes, and states.",category:"inputs",importPath:"import { Button } from 'nucleus-core-ts/fe'",props:[{name:"children",type:"text",defaultValue:"Click me",description:"Button label text"},{name:"variant",type:"select",defaultValue:"nucleus",description:"Visual style variant",options:[{label:"Nucleus",value:"nucleus"},{label:"Nucleus Outline",value:"nucleus-outline"},{label:"Nucleus Ghost",value:"nucleus-ghost"},{label:"Nucleus Soft",value:"nucleus-soft"},{label:"Primary",value:"primary"},{label:"Secondary",value:"secondary"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"},{label:"Ghost",value:"ghost"},{label:"Outline",value:"outline"},{label:"Link",value:"link"}]},{name:"size",type:"select",defaultValue:"md",description:"Button size",options:[{label:"XS",value:"xs"},{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"},{label:"XL",value:"xl"}]},{name:"shape",type:"select",defaultValue:"default",description:"Button border radius shape",options:[{label:"Default",value:"default"},{label:"Rounded",value:"rounded"},{label:"Pill",value:"pill"},{label:"Square",value:"square"}]},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading spinner"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the button"},{name:"fullWidth",type:"boolean",defaultValue:!1,description:"Stretch to full container width"},{name:"ripple",type:"boolean",defaultValue:!1,description:"Enable ripple click effect"},{name:"pulse",type:"boolean",defaultValue:!1,description:"Enable pulse animation"}],examples:[{title:"Default",props:{children:"Click me",variant:"nucleus",size:"md"}},{title:"Primary Large",props:{children:"Submit",variant:"primary",size:"lg",shape:"pill"}},{title:"Danger",props:{children:"Delete",variant:"danger",size:"sm"}},{title:"Loading",props:{children:"Processing...",variant:"primary",loading:!0}},{title:"Full Width",props:{children:"Full Width",variant:"nucleus",fullWidth:!0}}],render:(e)=>Nt(se,{variant:e.variant||"nucleus",size:e.size||"md",shape:e.shape||"default",loading:e.loading===!0,disabled:e.disabled===!0,fullWidth:e.fullWidth===!0,ripple:e.ripple===!0,pulse:e.pulse===!0,children:e.children?String(e.children):"Click me"},void 0,!1,void 0,this)},{id:"checkbox",name:"Checkbox",description:"Checkbox and switch toggle component with multiple colors and sizes.",category:"inputs",importPath:"import { Checkbox } from 'nucleus-core-ts/fe'",props:[{name:"checked",type:"boolean",defaultValue:!1,description:"Checked state"},{name:"variant",type:"select",defaultValue:"checkbox",description:"Checkbox or switch mode",options:[{label:"Checkbox",value:"checkbox"},{label:"Switch",value:"switch"}]},{name:"size",type:"select",defaultValue:"md",description:"Component size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"color",type:"select",defaultValue:"primary",description:"Accent color",options:[{label:"Primary",value:"primary"},{label:"Secondary",value:"secondary"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"},{label:"Info",value:"info"}]},{name:"label",type:"text",defaultValue:"Checkbox label",description:"Label text"},{name:"labelPosition",type:"select",defaultValue:"right",description:"Label position relative to control",options:[{label:"Left",value:"left"},{label:"Right",value:"right"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the control"},{name:"indeterminate",type:"boolean",defaultValue:!1,description:"Indeterminate state (checkbox only)"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below control"},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message"}],examples:[{title:"Default Checkbox",props:{variant:"checkbox",label:"Accept terms"}},{title:"Switch",props:{variant:"switch",label:"Enable notifications",color:"success"}},{title:"Indeterminate",props:{variant:"checkbox",indeterminate:!0,label:"Select all"}},{title:"With Error",props:{variant:"checkbox",label:"Required field",errorMessage:"This field is required"}}],render:(e)=>Nt(gg,{...e},void 0,!1,void 0,this)},{id:"datatable",name:"DataTable",description:"Feature-rich data table with sorting, resizable columns, selection, infinite scroll, and inline editing.",category:"data",importPath:"import { DataTable } from 'nucleus-core-ts/fe'",props:[{name:"rowCount",type:"number",defaultValue:5,description:"Number of sample data rows to display",min:0,max:100},{name:"showDepartment",type:"boolean",defaultValue:!1,description:"Show 'Department' column"},{name:"showJoined",type:"boolean",defaultValue:!1,description:"Show 'Joined' date column"},{name:"emptyMessage",type:"text",defaultValue:"No data available",description:"Message shown when data is empty"},{name:"showEmptyState",type:"boolean",defaultValue:!1,description:"Force empty state (renders with no data)"},{name:"isLoading",type:"boolean",defaultValue:!1,description:"Show full loading spinner overlay"},{name:"isPending",type:"boolean",defaultValue:!1,description:"Show skeleton table while data is pending"},{name:"enableSelection",type:"boolean",defaultValue:!1,description:"Enable row selection checkboxes"},{name:"isFrontendSort",type:"boolean",defaultValue:!0,description:"Sort data on the frontend (client-side sorting)"},{name:"hasClickAction",type:"boolean",defaultValue:!1,description:"Enable single-click action on cells (shows pointer cursor)"},{name:"hasDoubleClickAction",type:"boolean",defaultValue:!1,description:"Enable double-click action on cells"},{name:"enableInfiniteScroll",type:"boolean",defaultValue:!1,description:"Enable infinite scroll loading for large datasets"},{name:"defaultColumnWidth",type:"number",defaultValue:150,description:"Default width (px) for columns without explicit width",min:60,max:500},{name:"defaultRowHeight",type:"number",defaultValue:48,description:"Default row height (px)",min:32,max:120},{name:"minColumnWidth",type:"number",defaultValue:60,description:"Minimum column width (px) when resizing",min:30,max:200},{name:"pageSize",type:"number",defaultValue:20,description:"Number of rows per page (for infinite scroll)",min:5,max:100},{name:"skeletonRowCount",type:"number",defaultValue:5,description:"Number of skeleton rows shown during isPending",min:1,max:20},{name:"selectionColumnWidth",type:"number",defaultValue:48,description:"Width (px) of the selection checkbox column",min:32,max:80}],examples:[{title:"Default (5 rows)",props:{rowCount:5}},{title:"Large Dataset (20 rows)",props:{rowCount:20}},{title:"All Columns",props:{rowCount:10,showDepartment:!0,showJoined:!0}},{title:"With Selection",props:{rowCount:8,enableSelection:!0}},{title:"Loading Spinner",props:{isLoading:!0}},{title:"Skeleton Loading",props:{isPending:!0,skeletonRowCount:5}},{title:"Empty State",props:{showEmptyState:!0,emptyMessage:"No records found"}},{title:"Click Actions",props:{rowCount:5,hasClickAction:!0,hasDoubleClickAction:!0}}],render:(e)=>Nt(xg,{...e},void 0,!1,void 0,this)},{id:"datepicker",name:"DatePicker",description:"Calendar date picker with single and range modes, locale support, and customizable constraints.",category:"inputs",importPath:"import { DatePicker } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Select date...",description:"Input placeholder text"},{name:"label",type:"text",defaultValue:null,description:"Label above the input"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the picker"},{name:"showClearButton",type:"boolean",defaultValue:!0,description:"Show clear button when date selected"},{name:"showTodayButton",type:"boolean",defaultValue:!0,description:'Show "Today" quick-select button'},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message below input"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below input"},{name:"required",type:"boolean",defaultValue:!1,description:"Mark as required"}],examples:[{title:"Default",props:{placeholder:"Select date..."}},{title:"With Label",props:{label:"Start Date",placeholder:"Pick a date"}},{title:"Required with Error",props:{label:"Due Date",required:!0,errorMessage:"Date is required"}}],render:(e)=>Nt(mg,{...e},void 0,!1,void 0,this)},{id:"textinput",name:"TextInput",description:"Rich text input with floating labels, validation, formatting, password strength, and multiple input types.",category:"inputs",importPath:"import { NucleusTextInput } from 'nucleus-core-ts/fe'",props:[{name:"value",type:"text",defaultValue:"",description:"Input value"},{name:"type",type:"select",defaultValue:"text",description:"Input type",options:[{label:"Text",value:"text"},{label:"Email",value:"email"},{label:"Password",value:"password"},{label:"URL",value:"url"},{label:"Tel",value:"tel"},{label:"Number",value:"number"}]},{name:"label",type:"text",defaultValue:null,description:"Floating label text"},{name:"placeholder",type:"text",defaultValue:"Type something...",description:"Placeholder text"},{name:"size",type:"select",defaultValue:"md",description:"Input size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the input"},{name:"readOnly",type:"boolean",defaultValue:!1,description:"Make read-only"},{name:"fullWidth",type:"boolean",defaultValue:!0,description:"Stretch to full width"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below input"},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message"},{name:"showValidationIcon",type:"boolean",defaultValue:!1,description:"Show validation status icon"}],examples:[{title:"Default",props:{placeholder:"Enter your name..."}},{title:"With Label",props:{label:"Email Address",type:"email",placeholder:"you@example.com"}},{title:"Password",props:{label:"Password",type:"password",placeholder:"Enter password"}},{title:"With Error",props:{label:"Username",errorMessage:"Username already taken",value:"john"}}],render:(e)=>Nt(bg,{...e},void 0,!1,void 0,this)},{id:"rangepicker",name:"RangePicker",description:"Dual-thumb range slider with tooltips, labels, ticks, and multiple visual variants.",category:"inputs",importPath:"import { RangePicker } from 'nucleus-core-ts/fe'",props:[{name:"min",type:"number",defaultValue:0,description:"Minimum value",min:0,max:100},{name:"max",type:"number",defaultValue:100,description:"Maximum value",min:0,max:1000},{name:"step",type:"number",defaultValue:1,description:"Step increment",min:1,max:50},{name:"size",type:"select",defaultValue:"md",description:"Slider size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"variant",type:"select",defaultValue:"default",description:"Visual variant",options:[{label:"Default",value:"default"},{label:"Filled",value:"filled"},{label:"Minimal",value:"minimal"}]},{name:"orientation",type:"select",defaultValue:"horizontal",description:"Slider orientation",options:[{label:"Horizontal",value:"horizontal"},{label:"Vertical",value:"vertical"}]},{name:"showTooltip",type:"boolean",defaultValue:!0,description:"Show value tooltips on thumbs"},{name:"showLabels",type:"boolean",defaultValue:!0,description:"Show min/max labels"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the slider"},{name:"label",type:"text",defaultValue:null,description:"Label above the slider"}],examples:[{title:"Default",props:{min:0,max:100}},{title:"Price Range",props:{min:0,max:1000,step:10,label:"Price Range ($)"}},{title:"Filled Variant",props:{variant:"filled",showTooltip:!0}}],render:(e)=>Nt(fg,{...e},void 0,!1,void 0,this)},{id:"searchbox",name:"SearchBox",description:"Search input with debounced queries, autocomplete dropdown, keyboard navigation, and XSS protection.",category:"inputs",importPath:"import { SearchBox } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Search...",description:"Input placeholder"},{name:"label",type:"text",defaultValue:null,description:"Label above input"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the search box"},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading state in dropdown"},{name:"showClearButton",type:"boolean",defaultValue:!0,description:"Show clear button"},{name:"showSearchIcon",type:"boolean",defaultValue:!0,description:"Show search icon"},{name:"disableDropdown",type:"boolean",defaultValue:!1,description:"Disable dropdown results"},{name:"debounceMs",type:"number",defaultValue:300,description:"Debounce delay (ms)",min:0,max:2000}],examples:[{title:"Default",props:{placeholder:"Search..."}},{title:"Loading",props:{placeholder:"Searching...",loading:!0}},{title:"No Dropdown",props:{placeholder:"Filter...",disableDropdown:!0,showSearchIcon:!0}}],render:(e)=>Nt(yg,{...e},void 0,!1,void 0,this)},{id:"selectbox",name:"SelectBox",description:"Dropdown select with search, custom rendering, keyboard navigation, and multiple variants.",category:"inputs",importPath:"import { SelectBox } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Select...",description:"Placeholder text"},{name:"label",type:"text",defaultValue:null,description:"Label above select"},{name:"size",type:"select",defaultValue:"md",description:"Component size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"variant",type:"select",defaultValue:"default",description:"Visual variant",options:[{label:"Default",value:"default"},{label:"Filled",value:"filled"},{label:"Ghost",value:"ghost"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the select"},{name:"clearable",type:"boolean",defaultValue:!1,description:"Allow clearing value"},{name:"searchable",type:"boolean",defaultValue:!1,description:"Enable search within options"},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading state"},{name:"error",type:"text",defaultValue:null,description:"Error message"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text"},{name:"required",type:"boolean",defaultValue:!1,description:"Mark as required"}],examples:[{title:"Default",props:{placeholder:"Choose framework..."}},{title:"Searchable",props:{placeholder:"Search frameworks...",searchable:!0,clearable:!0}},{title:"With Label",props:{label:"Framework",placeholder:"Select one",required:!0}},{title:"Filled Variant",props:{variant:"filled",placeholder:"Choose..."}}],render:(e)=>Nt(wg,{...e},void 0,!1,void 0,this)},{id:"tooltip",name:"Tooltip",description:"Lightweight tooltip with GSAP animations, multiple placements, variants, triggers, and arrow support.",category:"display",importPath:"import { Tooltip } from 'nucleus-core-ts/fe'",props:[{name:"content",type:"text",defaultValue:"Tooltip content",description:"Text or content to display inside the tooltip"},{name:"placement",type:"select",defaultValue:"top",description:"Tooltip placement relative to trigger element",options:[{label:"Top",value:"top"},{label:"Bottom",value:"bottom"},{label:"Left",value:"left"},{label:"Right",value:"right"}]},{name:"trigger",type:"select",defaultValue:"hover",description:"How the tooltip is triggered",options:[{label:"Hover",value:"hover"},{label:"Click",value:"click"},{label:"Focus",value:"focus"}]},{name:"variant",type:"select",defaultValue:"dark",description:"Visual color variant",options:[{label:"Dark",value:"dark"},{label:"Light",value:"light"},{label:"Info",value:"info"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"}]},{name:"size",type:"select",defaultValue:"md",description:"Tooltip size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"delay",type:"number",defaultValue:0,description:"Delay (ms) before showing the tooltip",min:0,max:2000},{name:"offset",type:"number",defaultValue:8,description:"Distance (px) from trigger element",min:0,max:32},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the tooltip"},{name:"showArrow",type:"boolean",defaultValue:!0,description:"Show directional arrow on tooltip"},{name:"maxWidth",type:"number",defaultValue:320,description:"Max width (px) of the tooltip",min:100,max:600}],examples:[{title:"Default",props:{content:"Helpful tooltip text",placement:"top"}},{title:"Bottom Placement",props:{content:"Bottom tooltip",placement:"bottom"}},{title:"Click Trigger",props:{content:"Click to toggle",trigger:"click",variant:"light"}},{title:"Info Variant",props:{content:"This is an informational tooltip",variant:"info"}},{title:"Danger Variant",props:{content:"This action is destructive!",variant:"danger",placement:"right"}},{title:"With Delay",props:{content:"Appears after 500ms",delay:500,variant:"success"}}],render:(e)=>Nt(_a,{content:e.content?String(e.content):"Tooltip content",placement:e.placement||"top",trigger:e.trigger||"hover",variant:e.variant||"dark",size:e.size||"md",delay:typeof e.delay==="number"?e.delay:0,offset:typeof e.offset==="number"?e.offset:8,disabled:e.disabled===!0,showArrow:e.showArrow!==!1,maxWidth:typeof e.maxWidth==="number"?e.maxWidth:320,children:Nt("button",{type:"button",className:"px-4 py-2 rounded-lg bg-slate-200 dark:bg-slate-700 text-slate-800 dark:text-slate-200 text-sm font-medium hover:bg-slate-300 dark:hover:bg-slate-600 transition-colors",children:"Hover me"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}]}import{useGSAP as Ud}from"@gsap/react";import Ed from"gsap";import{useRef as zg}from"react";var sn={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-6xl mx-auto px-4 py-8 sm:px-6 lg:px-8"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",titleWrapper:"flex-1",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white",subtitle:"mt-1 text-sm sm:text-base text-zinc-600 dark:text-zinc-400",badge:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 ml-3",actions:"flex-shrink-0"},stats:{container:"grid grid-cols-3 gap-4 mb-8 p-4 rounded-xl bg-zinc-50 dark:bg-zinc-800/50",item:"text-center",value:"text-2xl font-bold text-zinc-900 dark:text-white",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"},deviceList:{container:"mt-6",grid:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"}},deviceCard:{base:"group relative flex flex-col transition-all duration-200",padding:"p-4 sm:p-5",background:"bg-white dark:bg-zinc-800/60",backgroundCurrent:"bg-blue-50/50 dark:bg-blue-900/10",border:"border border-zinc-200 dark:border-zinc-700/50",borderCurrent:"border-blue-300 dark:border-blue-700/50",shadow:"shadow-sm",rounded:"rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3 mb-3",icon:"flex-shrink-0 w-10 h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",iconCurrent:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",info:"flex-1 min-w-0",deviceName:"font-medium text-zinc-900 dark:text-white truncate",deviceType:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5"},details:{container:"space-y-2 text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"},footer:{container:"flex items-center justify-between mt-4 pt-4 border-t border-zinc-100 dark:border-zinc-700/50",currentBadge:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",revokeButton:"text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 font-medium transition-colors"},trustScore:{container:"mt-3",bar:"h-1.5 w-full bg-zinc-200 dark:bg-zinc-700 rounded-full overflow-hidden",barFill:"h-full rounded-full transition-all duration-300",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-2xl shadow-2xl max-w-md w-full p-6",title:"text-lg font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 mb-6",actions:"flex gap-3 justify-end"},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400"}};import{jsxDEV as qe}from"react/jsx-dev-runtime";Ed.registerPlugin(Ud);function Ng(e){switch(e?.toLowerCase()){case"mobile":return qe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Mobile device",children:[qe("title",{children:"Mobile device"},void 0,!1,void 0,this),qe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"tablet":return qe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Tablet device",children:[qe("title",{children:"Tablet device"},void 0,!1,void 0,this),qe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);default:return qe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Desktop device",children:[qe("title",{children:"Desktop device"},void 0,!1,void 0,this),qe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}function Sg(e){if(!e)return"bg-zinc-400";if(e>=80)return"bg-green-500";if(e>=60)return"bg-yellow-500";if(e>=40)return"bg-orange-500";return"bg-red-500"}function Xd(e){if(!e)return"Unknown";return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function qa({device:e,isCurrent:t=!1,onRevoke:r,isRevoking:n=!1}){let a=sn,i=zg(null);Ud(()=>{if(!i.current)return;Ed.fromTo(i.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.4,ease:"power2.out"})},{scope:i});let o=e.deviceName||`${e.browserName||"Unknown"} on ${e.osName||"Unknown"}`;return qe("article",{ref:i,className:w(a.deviceCard.base,a.deviceCard.padding,t?a.deviceCard.backgroundCurrent:a.deviceCard.background,t?a.deviceCard.borderCurrent:a.deviceCard.border,a.deviceCard.shadow,a.deviceCard.rounded,!t&&a.deviceCard.hover),children:[qe("header",{className:a.deviceCard.header.container,children:[qe("div",{className:w(a.deviceCard.header.icon,t&&a.deviceCard.header.iconCurrent),children:Ng(e.deviceType)},void 0,!1,void 0,this),qe("div",{className:a.deviceCard.header.info,children:[qe("h3",{className:a.deviceCard.header.deviceName,children:o},void 0,!1,void 0,this),qe("p",{className:a.deviceCard.header.deviceType,children:[e.deviceType||"Desktop"," \u2022 ",e.browserName," ",e.browserVersion]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qe("dl",{className:a.deviceCard.details.container,children:[qe("div",{className:a.deviceCard.details.row,children:[qe("dt",{className:a.deviceCard.details.label,children:"IP Address"},void 0,!1,void 0,this),qe("dd",{className:a.deviceCard.details.value,children:e.ipAddress||"Unknown"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.locationCity&&qe("div",{className:a.deviceCard.details.row,children:[qe("dt",{className:a.deviceCard.details.label,children:"Location"},void 0,!1,void 0,this),qe("dd",{className:a.deviceCard.details.value,children:[e.locationCity,e.locationCountry?`, ${e.locationCountry}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qe("div",{className:a.deviceCard.details.row,children:[qe("dt",{className:a.deviceCard.details.label,children:"Last Active"},void 0,!1,void 0,this),qe("dd",{className:a.deviceCard.details.value,children:Xd(e.lastActivityAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe("div",{className:a.deviceCard.details.row,children:[qe("dt",{className:a.deviceCard.details.label,children:"First Seen"},void 0,!1,void 0,this),qe("dd",{className:a.deviceCard.details.value,children:Xd(e.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.trustScore!==void 0&&qe("div",{className:a.deviceCard.trustScore.container,children:[qe("div",{className:a.deviceCard.trustScore.bar,children:qe("div",{className:w(a.deviceCard.trustScore.barFill,Sg(e.trustScore)),style:{width:`${e.trustScore}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),qe("p",{className:a.deviceCard.trustScore.label,children:["Trust Score: ",e.trustScore,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qe("footer",{className:a.deviceCard.footer.container,children:[t?qe("span",{className:a.deviceCard.footer.currentBadge,children:[qe("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:qe("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Current Device"]},void 0,!0,void 0,this):qe("span",{},void 0,!1,void 0,this),r&&!t&&qe("button",{type:"button",onClick:()=>r(e.id),disabled:n,className:w(a.deviceCard.footer.revokeButton,n&&"opacity-50 cursor-not-allowed"),children:n?"Revoking...":"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as dn}from"react/jsx-dev-runtime";function Oa({title:e="Active Devices",subtitle:t="Manage devices that have access to your account",totalDevices:r=0,onRevokeAll:n,isRevokingAll:a=!1,allowRevokeAll:i=!0}){let o=sn;return dn("header",{className:o.header.container,children:[dn("div",{className:o.header.titleWrapper,children:[dn("h1",{className:o.header.title,children:[e,r>0&&dn("span",{className:o.header.badge,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),dn("p",{className:o.header.subtitle,children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&r>1&&n&&dn("div",{className:o.header.actions,children:dn(se,{variant:"outline",size:"sm",onClick:n,disabled:a,className:"text-red-600 border-red-200 hover:bg-red-50 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20",children:a?"Revoking...":"Revoke All Other Devices"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Vd}from"@gsap/react";import jd from"gsap";import{useEffect as Lg,useEffectEvent as Ho,useRef as Dd,useState as Ga}from"react";import{batch as Pg,createStore as Cg}from"h-state";var Tg={devices:[],currentSessionId:null,isLoading:!1,isRevoking:null,isRevokingAll:!1,error:null,stats:null},{useStore:Ja}=Cg(Tg,{setDevices:(e)=>(t)=>{e.devices=t},setCurrentSessionId:(e)=>(t)=>{e.currentSessionId=t},setLoading:(e)=>(t)=>{e.isLoading=t},setRevoking:(e)=>(t)=>{e.isRevoking=t},setRevokingAll:(e)=>(t)=>{e.isRevokingAll=t},setError:(e)=>(t)=>{e.error=t},setStats:(e)=>(t)=>{e.stats=t},removeDevice:(e)=>(t)=>{e.devices=e.devices.filter((r)=>r.id!==t)},clearAllDevices:(e)=>(t)=>{if(t&&e.currentSessionId)e.devices=e.devices.filter((r)=>r.id===e.currentSessionId);else e.devices=[]},reset:(e)=>()=>{Pg(()=>{e.devices=[],e.currentSessionId=null,e.isLoading=!1,e.isRevoking=null,e.isRevokingAll=!1,e.error=null,e.stats=null})}});import{jsxDEV as we}from"react/jsx-dev-runtime";jd.registerPlugin(Vd);function ec({variant:e="default",title:t="Active Devices",subtitle:r="Manage devices that have access to your account",sessionsAction:n,sessionRevokeAction:a,sessionRevokeAllAction:i,sessionsStatsAction:o,sessionsPendingAction:s,sessionApproveAction:l,sessionRejectAction:c,onDeviceRevoked:d,onAllDevicesRevoked:g,onDeviceApproved:h,onDeviceRejected:k,showBackground:u=!1,showStats:z=!0,showPendingDevices:b=!0,allowRevokeAll:C=!0,allowRevokeCurrent:x=!1,className:N}){let m=sn,y=Dd(null),v=Dd(null),[p,f]=Ga(!1),[M,$]=Ga(null),[J,U]=Ga([]),[E,Z]=Ga(null),B=Ja(),Q=Ho(()=>{B.setLoading(!0),B.setError(null),n.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data?.sessions)B.setDevices(ce.data.sessions),B.setCurrentSessionId(ce.data.currentSessionId||null);B.setLoading(!1)},onErrorHandle:(q)=>{B.setError(q instanceof Error?q.message:"Failed to load devices"),B.setLoading(!1)}})}),S=Ho(()=>{if(!o)return;o.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data)B.setStats(ce.data)},onErrorHandle:()=>{}})}),O=Ho(()=>{if(!s||!b)return;s.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data?.sessions)U(ce.data.sessions)},onErrorHandle:()=>{}})}),A=(q)=>{if(!l||!q.approvalToken)return;Z(q.id),l.start({payload:{token:q.approvalToken},onAfterHandle:()=>{U((ce)=>ce.filter((oe)=>oe.id!==q.id)),Z(null),h?.(q.id),Q()},onErrorHandle:()=>{Z(null)}})},ee=(q)=>{if(!c||!q.approvalToken)return;Z(q.id),c.start({payload:{token:q.approvalToken},onAfterHandle:()=>{U((ce)=>ce.filter((oe)=>oe.id!==q.id)),Z(null),k?.(q.id)},onErrorHandle:()=>{Z(null)}})};Lg(()=>{if(Q(),z)S();if(b)O()},[z,b]),Vd(()=>{if(!v.current)return;jd.fromTo(v.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:y});let _=(q)=>{$(q),f(!0)},H=()=>{if(!M)return;B.setRevoking(M),f(!1),a.start({payload:{_sessionId:M,reason:"user_revoked"},onAfterHandle:()=>{B.removeDevice(M),B.setRevoking(null),d?.(M),$(null)},onErrorHandle:(q)=>{B.setError(q instanceof Error?q.message:"Failed to revoke device"),B.setRevoking(null),$(null)}})},T=()=>{B.setRevokingAll(!0),i.start({payload:{excludeCurrent:!0,reason:"user_revoked_all"},onAfterHandle:()=>{B.clearAllDevices(!0),B.setRevokingAll(!1),g?.()},onErrorHandle:(q)=>{B.setError(q instanceof Error?q.message:"Failed to revoke all devices"),B.setRevokingAll(!1)}})},ie=B.devices.filter((q)=>q.id!==B.currentSessionId).length;return we("main",{ref:y,className:w(m.container.base,N),"aria-label":"Devices management page",children:[u&&we(xt,{},void 0,!1,void 0,this),we("div",{className:m.container.wrapper,children:we("article",{ref:v,className:w(m.card.base,m.card.padding,m.card.background,m.card.border,m.card.shadow,m.card.rounded),children:[we(Oa,{title:t,subtitle:r,totalDevices:B.devices.length,onRevokeAll:T,isRevokingAll:B.isRevokingAll,allowRevokeAll:C&&ie>0},void 0,!1,void 0,this),z&&B.stats&&we("div",{className:m.stats.container,children:[we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:B.stats.activeSessions},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"Active Sessions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:B.stats.uniqueDevices},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"Unique Devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:B.stats.uniqueIpAddresses},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"IP Addresses"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.error&&we("div",{className:m.error.container,children:we("p",{className:m.error.text,children:B.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),b&&J.length>0&&we("section",{className:"mb-8",children:[we("h2",{className:"text-lg font-semibold text-amber-600 mb-4 flex items-center gap-2",children:[we("span",{className:"inline-block w-2 h-2 bg-amber-500 rounded-full animate-pulse"},void 0,!1,void 0,this),"Pending Approval (",J.length,")"]},void 0,!0,void 0,this),we("div",{className:m.deviceList.grid,children:J.map((q)=>we("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 dark:bg-amber-900/20 dark:border-amber-800",children:[we("div",{className:"flex items-start gap-3 mb-3",children:[we("div",{className:"p-2 bg-amber-100 rounded-lg dark:bg-amber-800",children:we("svg",{className:"w-5 h-5 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[we("title",{children:"Device"},void 0,!1,void 0,this),we("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),we("div",{children:[we("p",{className:"font-medium text-gray-900 dark:text-white",children:q.deviceName||"Unknown Device"},void 0,!1,void 0,this),we("p",{className:"text-sm text-gray-500",children:[q.browserName," \u2022 ",q.osName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),we("div",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:[we("p",{children:["IP: ",q.ipAddress||"Unknown"]},void 0,!0,void 0,this),we("p",{children:["Requested:"," ",q.approvalRequestedAt?new Date(q.approvalRequestedAt).toLocaleString():"Unknown"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),we("div",{className:"flex gap-2",children:[we(se,{variant:"primary",size:"sm",onClick:()=>A(q),disabled:E===q.id,className:"flex-1 bg-green-600 hover:bg-green-700",children:E===q.id?"...":"\u2713 Approve"},void 0,!1,void 0,this),we(se,{variant:"outline",size:"sm",onClick:()=>ee(q),disabled:E===q.id,className:"flex-1 text-red-600 border-red-200 hover:bg-red-50",children:E===q.id?"...":"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},q.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B.isLoading?we("div",{className:m.loading.container,children:[we("div",{className:m.loading.spinner},void 0,!1,void 0,this),we("p",{className:m.loading.text,children:"Loading devices..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):B.devices.length===0?we("div",{className:m.deviceList.empty.container,children:[we("svg",{className:m.deviceList.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[we("title",{children:"No devices"},void 0,!1,void 0,this),we("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("p",{className:m.deviceList.empty.text,children:"No active devices found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):we("section",{className:m.deviceList.container,children:we("div",{className:m.deviceList.grid,children:B.devices.map((q)=>we(qa,{device:q,isCurrent:q.id===B.currentSessionId||q.isCurrent,onRevoke:q.id!==B.currentSessionId&&!q.isCurrent||x?_:void 0,isRevoking:B.isRevoking===q.id},q.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),p&&we("div",{className:m.modal.overlay,onClick:()=>f(!1),onKeyDown:(q)=>q.key==="Escape"&&f(!1),role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:we("div",{className:m.modal.container,onClick:(q)=>q.stopPropagation(),onKeyDown:(q)=>q.stopPropagation(),role:"document",children:[we("h2",{id:"confirm-modal-title",className:m.modal.title,children:"Revoke Device Access"},void 0,!1,void 0,this),we("p",{className:m.modal.message,children:"Are you sure you want to revoke access for this device? The user will be logged out immediately."},void 0,!1,void 0,this),we("div",{className:m.modal.actions,children:[we(se,{variant:"outline",size:"sm",onClick:()=>{f(!1),$(null)},children:"Cancel"},void 0,!1,void 0,this),we(se,{variant:"primary",size:"sm",onClick:H,className:"bg-red-600 hover:bg-red-700",children:"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as $o}from"@gsap/react";import Aa from"gsap";import{useRef as tc}from"react";import{batch as Mg,createStore as Rg}from"h-state";var Bg={email:"",step:"request",error:null},{useStore:Ya}=Rg(Bg,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Mg(()=>{e.email="",e.step="request",e.error=null})}});var cn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as mt}from"react/jsx-dev-runtime";Aa.registerPlugin($o);function rc({className:e}){return mt("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:mt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Wg({className:e}){return mt("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:mt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function _o({forgotPasswordAction:e,onBackToLogin:t,backToLoginHref:r}){let n=cn,a=tc(null),i=tc(null),o=Ya(),{contextSafe:s}=$o({scope:a}),l=e.state.isPending,c=s((h)=>{if(h.preventDefault(),!o.email){o.setError("Please enter your email address"),d();return}o.setError(null),e.start({payload:{email:o.email},onAfterHandle:()=>{o.setStep("success")},onErrorHandle:(k)=>{let u=k instanceof Error?k.message:"Failed to send reset email. Please try again.";o.setError(u),d()}})}),d=s(()=>{if(!a.current)return;Aa.fromTo(a.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Aa.set(a.current,{x:0})}})});$o(()=>{if(o.step==="success"&&i.current)Aa.fromTo(i.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[o.step]});let g=()=>{if(t)t();else if(r)window.location.href=r};if(o.step==="success")return mt("div",{ref:i,className:n.success.container,children:[mt("div",{className:n.success.iconWrapper,children:mt(Wg,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("h2",{className:n.success.title,children:"Check your email"},void 0,!1,void 0,this),mt("p",{className:n.success.message,children:["We've sent a password reset link to ",mt("strong",{children:o.email},void 0,!1,void 0,this),". Please check your inbox and follow the instructions."]},void 0,!0,void 0,this),mt("div",{className:n.links.container,children:mt("button",{type:"button",onClick:g,className:n.links.backToLogin,children:[mt(rc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return mt("form",{ref:a,onSubmit:c,className:n.form.container,noValidate:!0,children:[o.error&&mt("div",{className:n.error.container,role:"alert",children:mt("p",{className:n.error.text,children:o.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.form.spacing,children:[mt("div",{className:n.input.wrapper,children:mt(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:o.email,onChange:o.setEmail,disabled:l,enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.button.wrapper,children:mt(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:l,disabled:l,children:"Send Reset Link"},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.links.container,children:mt("button",{type:"button",onClick:g,className:n.links.backToLogin,disabled:l,children:[mt(rc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Qr}from"react/jsx-dev-runtime";function Ig({className:e}){return Qr("svg",{className:w("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Qr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Fo({logo:e,title:t,subtitle:r}){let n=cn;return Qr("header",{className:n.header.container,children:[e?Qr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):Qr("div",{className:n.header.iconWrapper,children:Qr(Ig,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Qr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),Qr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ac}from"@gsap/react";import ic from"gsap";import{useRef as nc}from"react";import{jsxDEV as Tn}from"react/jsx-dev-runtime";ic.registerPlugin(ac);function oc({logo:e,title:t="Forgot Password?",subtitle:r="No worries, we'll send you reset instructions.",forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i,showBackground:o=!0,className:s}){let l=cn,c=nc(null),d=nc(null);return ac(()=>{if(!d.current)return;ic.fromTo(d.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:c}),Tn("main",{ref:c,className:w(l.container.base,s),"aria-label":"Forgot password page",children:[o&&Tn(xt,{},void 0,!1,void 0,this),Tn("div",{className:l.container.wrapper,children:Tn("article",{ref:d,className:w(l.card.base,l.card.padding,l.card.background,l.card.border,l.card.shadow,l.card.rounded),children:[Tn(Fo,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Tn(_o,{forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as sc}from"@gsap/react";import qo from"gsap";import{useRef as _g}from"react";import{batch as lc,createStore as Hg}from"h-state";var $g={email:"",password:"",rememberMe:!1,isLoading:!1,error:null,captchaId:null,captchaAnswer:"",isAuthenticated:!1,user:null},{useStore:Ln}=Hg($g,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t)=>{if(e.password=t,e.error)e.error=null},setRememberMe:(e)=>(t)=>{e.rememberMe=t},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},setCaptchaId:(e)=>(t)=>{e.captchaId=t},setCaptchaAnswer:(e)=>(t)=>{e.captchaAnswer=t},setAuthenticated:(e)=>(t,r)=>{lc(()=>{e.isAuthenticated=t,e.user=r??null})},reset:(e)=>()=>{lc(()=>{e.email="",e.password="",e.rememberMe=!1,e.isLoading=!1,e.error=null,e.captchaId=null,e.captchaAnswer=""})}});var pn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-center",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer"},links:{container:"flex items-center justify-between mt-1",forgotPassword:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signUp:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as Ct}from"react/jsx-dev-runtime";qo.registerPlugin(sc);function Oo({loginAction:e,captchaGenerateAction:t,captchaConfig:r,showRememberMe:n=!0,showForgotPassword:a=!0,showSignUp:i=!0,forgotPasswordHref:o,signUpHref:s,onForgotPassword:l,onSignUp:c,onSuccess:d}){let g=pn,h=_g(null),k=Ln(),{contextSafe:u}=sc({scope:h}),z=e.state.isPending,b=r?.enabled&&t,C=u((y)=>{if(y.preventDefault(),!k.email||!k.password){k.setError("Please fill in all fields"),x();return}if(b&&(!k.captchaId||!k.captchaAnswer)){k.setError("Please complete the security check"),x();return}k.setError(null),e.start({payload:{email:k.email,password:k.password,rememberMe:k.rememberMe,captchaId:k.captchaId??void 0,captchaAnswer:k.captchaAnswer||void 0},onAfterHandle:(v)=>{let p=v;if(p.success===!1)k.setError(p.message||"Login failed. Please try again."),x();else if(p.success)k.reset(),d?.()},onErrorHandle:(v)=>{let p=v instanceof Error?v.message:"Login failed. Please try again.";k.setError(p),x()}})}),x=u(()=>{if(!h.current)return;qo.fromTo(h.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{qo.set(h.current,{x:0})}})}),N=()=>{if(l)l();else if(o)window.location.href=o},m=()=>{if(c)c();else if(s)window.location.href=s};return Ct("form",{ref:h,onSubmit:C,className:g.form.container,noValidate:!0,children:[k.error&&Ct("div",{className:g.error.container,role:"alert",children:Ct("p",{className:g.error.text,children:k.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ct("div",{className:g.form.spacing,children:[Ct("div",{className:g.input.wrapper,children:Ct(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:k.email,onChange:k.setEmail,disabled:z,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ct("div",{className:g.input.wrapper,children:Ct(Ee,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:k.password,onChange:k.setPassword,disabled:z,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b&&t&&Ct(fa,{generateAction:t,config:r,onChallengeLoad:(y)=>{k.setCaptchaId(y.data?.challengeId??""),k.setCaptchaAnswer("")},onAnswerChange:(y,v)=>{k.setCaptchaAnswer(v)},disabled:z,autoGenerate:!0},void 0,!1,void 0,this),(n||a)&&Ct("div",{className:g.links.container,children:[n&&Ct("div",{className:g.checkbox.wrapper,children:[Ct(hr,{checked:k.rememberMe,onChange:k.setRememberMe,disabled:z,size:"sm"},void 0,!1,void 0,this),Ct("button",{type:"button",className:g.checkbox.label,onClick:()=>k.setRememberMe(!k.rememberMe),children:"Remember me"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&Ct("button",{type:"button",onClick:N,className:w(g.links.forgotPassword),disabled:z,children:"Forgot password?"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ct("div",{className:g.button.wrapper,children:Ct(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:z,disabled:z,children:"Sign In"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i&&Ct("div",{className:g.links.signUp.wrapper,children:Ct("span",{className:g.links.signUp.text,children:["Don't have an account?"," ",Ct("button",{type:"button",onClick:m,className:g.links.signUp.link,disabled:z,children:"Sign up"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ka}from"react/jsx-dev-runtime";function Za({logo:e,title:t,subtitle:r}){let n=pn;return Ka("header",{className:n.header.container,children:[e&&Ka("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),t&&Ka("h1",{className:w(n.header.title),children:t},void 0,!1,void 0,this),r&&Ka("p",{className:w(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as uc}from"@gsap/react";import gc from"gsap";import{useEffect as Fg,useEffectEvent as dc,useRef as cc}from"react";import{jsxDEV as lr,Fragment as pc}from"react/jsx-dev-runtime";gc.registerPlugin(uc);function mc({variant:e="default",logo:t,title:r="Welcome Back",subtitle:n="Sign in to your account to continue",loggedInTitle:a="You're Logged In",showRememberMe:i=!0,showForgotPassword:o=!0,showSignUp:s=!0,forgotPasswordHref:l,signUpHref:c,loginAction:d,meAction:g,logoutAction:h,captchaGenerateAction:k,config:u,onForgotPassword:z,onSignUp:b,onSuccess:C,onLogout:x,showBackground:N=!0,className:m}){let y=pn,v=cc(null),p=cc(null),f=Ln(),M=dc(()=>{if(!g)return;g.start({payload:void 0,onAfterHandle:(E)=>{let Z=E;if(Z.success&&Z.data?.user)f.setAuthenticated(!0,Z.data.user)},onErrorHandle:()=>{f.setAuthenticated(!1,null)}})});Fg(()=>{M()},[]);let $=dc(()=>{if(!h)return;h.start({payload:void 0,onAfterHandle:()=>{f.setAuthenticated(!1,null),f.reset(),x?.()},onErrorHandle:()=>{}})});uc(()=>{if(!p.current)return;gc.fromTo(p.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:v});let J=g?.state.isPending,U=h?.state.isPending;return lr("main",{ref:v,className:w(y.container.base,m),"aria-label":"Login page",children:[N&&lr(xt,{},void 0,!1,void 0,this),lr("div",{className:y.container.wrapper,children:lr("article",{ref:p,className:w(y.card.base,y.card.padding,y.card.background,y.card.border,y.card.shadow,y.card.rounded),children:J?lr("div",{className:"flex items-center justify-center py-12",children:lr("div",{className:"w-8 h-8 border-2 border-zinc-300 dark:border-zinc-600 border-t-blue-500 rounded-full animate-spin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):f.isAuthenticated&&f.user?lr(pc,{children:[lr(Za,{logo:t,title:a,subtitle:`Signed in as ${f.user.email}`},void 0,!1,void 0,this),lr("div",{className:"mt-6 space-y-4",children:[lr(se,{variant:"nucleus",size:"lg",fullWidth:!0,onClick:C,children:"Continue to Dashboard"},void 0,!1,void 0,this),h&&lr(se,{variant:"outline",size:"lg",fullWidth:!0,onClick:$,loading:U,disabled:U,children:"Sign Out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):lr(pc,{children:[lr(Za,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),lr(Oo,{loginAction:d,captchaGenerateAction:k,captchaConfig:u?.login?.captcha,showRememberMe:i,showForgotPassword:o,showSignUp:s,forgotPasswordHref:l,signUpHref:c,onForgotPassword:z,onSignUp:b,onSuccess:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as fc}from"@gsap/react";import hc from"gsap";import{useEffect as Gg,useEffectEvent as bc,useRef as Jo}from"react";import{batch as qg,createStore as Og}from"h-state";var Jg={step:"verifying",message:"Please wait while we verify your magic link..."},{useStore:Qa}=Og(Jg,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},reset:(e)=>()=>{qg(()=>{e.step="verifying",e.message="Please wait while we verify your magic link..."})}});var Xa={container:{base:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-zinc-50 via-white to-zinc-100 dark:from-zinc-950 dark:via-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white dark:bg-zinc-900",border:"border border-zinc-200 dark:border-zinc-800",shadow:"shadow-xl shadow-zinc-200/50 dark:shadow-zinc-950/50",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center space-y-4"},states:{verifying:{spinner:"w-12 h-12 border-4 border-zinc-200 dark:border-zinc-700 border-t-blue-500 rounded-full animate-spin",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",icon:"w-8 h-8 text-green-600 dark:text-green-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-green-600 dark:text-green-400",redirectText:"text-xs text-zinc-400 dark:text-zinc-500 animate-pulse"},error:{iconWrapper:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",icon:"w-8 h-8 text-red-600 dark:text-red-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-red-600 dark:text-red-400"},ready:{iconWrapper:"w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",icon:"w-8 h-8 text-blue-600 dark:text-blue-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400",button:"mt-6 w-full px-6 py-3 text-sm font-semibold text-white bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 dark:text-black rounded-xl transition-all duration-200 active:scale-[0.98] shadow-lg shadow-blue-600/20 dark:shadow-blue-500/20"}},backButton:"mt-6 px-6 py-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors duration-200"};import{jsxDEV as ot,Fragment as Ua}from"react/jsx-dev-runtime";hc.registerPlugin(fc);function Yg(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function yc({token:e,verifyAction:t,onSuccess:r,onError:n,onBackToLogin:a,backToLoginHref:i,redirectDelay:o=2000,requireConfirmation:s=!1,className:l,texts:c}){let d=Xa,g=Jo(null),h=Jo(null),k=Jo(!1),u=Qa(),z=bc((x)=>{if(!x){u.setStep("error"),u.setMessage("Invalid magic link. No token provided.");return}if(k.current)return;k.current=!0,u.setStep("verifying"),t.start({payload:{token:x},onAfterHandle:(N)=>{if(!N){u.setStep("error"),u.setMessage("Verification failed. Please try again."),n?.();return}if(N.success&&N.data)u.setStep("success"),u.setMessage(c?.successSubtitle||"You have been logged in successfully!"),setTimeout(()=>{r?.(N)},o);else u.setStep("error"),u.setMessage("Verification failed. The link may be expired or invalid."),n?.()},onErrorHandle:(N)=>{u.setStep("error"),u.setMessage(Yg(N,"Verification failed. The link may be expired or invalid.")),n?.()}})}),b=bc(()=>{if(e)z(e)});Gg(()=>{if(!e)u.setStep("error"),u.setMessage("Invalid magic link. No token provided.");else if(s)u.setStep("ready"),u.setMessage(c?.confirmSubtitle||"Click below to verify and sign in securely.");else z(e);return()=>{u.reset()}},[e]),fc(()=>{if(!h.current)return;hc.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g});let C=()=>{if(a)a();else if(i)window.location.href=i};return ot("main",{ref:g,className:w(d.container.base,l),children:ot("article",{ref:h,className:w(d.card.base,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:ot("div",{className:d.content.wrapper,children:[u.step==="ready"&&ot(Ua,{children:[ot("div",{className:d.states.ready.iconWrapper,children:ot("svg",{className:d.states.ready.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.ready.title,children:c?.confirmTitle||"Magic Link Verification"},void 0,!1,void 0,this),ot("p",{className:d.states.ready.subtitle,children:u.message},void 0,!1,void 0,this),ot("button",{type:"button",onClick:b,className:d.states.ready.button,children:c?.confirmButton||"Verify & Sign In"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="verifying"&&ot(Ua,{children:[ot("div",{className:d.states.verifying.spinner},void 0,!1,void 0,this),ot("h1",{className:d.states.verifying.title,children:c?.verifyingTitle||"Verifying Magic Link"},void 0,!1,void 0,this),ot("p",{className:d.states.verifying.subtitle,children:c?.verifyingSubtitle||u.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="success"&&ot(Ua,{children:[ot("div",{className:d.states.success.iconWrapper,children:ot("svg",{className:d.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.success.title,children:c?.successTitle||"Login Successful!"},void 0,!1,void 0,this),ot("p",{className:d.states.success.subtitle,children:u.message},void 0,!1,void 0,this),ot("p",{className:d.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="error"&&ot(Ua,{children:[ot("div",{className:d.states.error.iconWrapper,children:ot("svg",{className:d.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.error.title,children:c?.errorTitle||"Verification Failed"},void 0,!1,void 0,this),ot("p",{className:d.states.error.subtitle,children:u.message},void 0,!1,void 0,this),(a||i)&&ot("button",{type:"button",onClick:C,className:d.backButton,children:c?.backToLogin||"Back to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useEffect as Ag,useEffectEvent as Kg,useState as Zg}from"react";var Kt={container:{base:"relative w-full",wrapper:"relative z-10 w-full"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex items-center justify-between mb-6",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",subtitle:"text-sm text-zinc-600 dark:text-zinc-400 mt-1",markAllButton:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors disabled:opacity-50",countBadge:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},notificationItem:{base:"flex gap-3 p-4 rounded-xl transition-all duration-200 cursor-pointer",unseen:"bg-blue-50/50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-800/30",seen:"bg-transparent border border-transparent hover:bg-zinc-50 dark:hover:bg-zinc-800/30",hover:"hover:shadow-sm",iconWrapper:{base:"flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",verification:"bg-violet-100 dark:bg-violet-900/30 text-violet-600 dark:text-violet-400",system:"bg-zinc-100 dark:bg-zinc-700 text-zinc-600 dark:text-zinc-400",custom:"bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400"},content:"flex-1 min-w-0",title:"text-sm font-medium text-zinc-900 dark:text-white",body:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",meta:"flex items-center gap-2 mt-1.5",timestamp:"text-xs text-zinc-400 dark:text-zinc-500",dot:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"},bell:{button:"relative p-2 rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",icon:"w-5 h-5 text-zinc-600 dark:text-zinc-400",badge:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] flex items-center justify-center rounded-full bg-red-500 text-white text-[10px] font-bold px-1"},empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 mb-4",text:"text-sm text-red-600 dark:text-red-400"},loadMore:{button:"w-full py-2 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors"}};function wc(e){return{...Kt,...e,container:{...Kt.container,...e.container},card:{...Kt.card,...e.card},header:{...Kt.header,...e.header},notificationItem:{...Kt.notificationItem,...e.notificationItem},bell:{...Kt.bell,...e.bell},empty:{...Kt.empty,...e.empty},loading:{...Kt.loading,...e.loading},error:{...Kt.error,...e.error},loadMore:{...Kt.loadMore,...e.loadMore}}}import{jsxDEV as na}from"react/jsx-dev-runtime";function kc({unseenCountAction:e,onClick:t,pollInterval:r=30000,className:n}){let a=Kt,[i,o]=Zg(0),s=Kg(()=>{e.start({payload:void 0,onAfterHandle:(l)=>{let c=l;if(c?.data)o(c.data.count)},onErrorHandle:()=>{}})});return Ag(()=>{if(s(),r>0){let l=setInterval(s,r);return()=>clearInterval(l)}},[r]),na("button",{type:"button",className:w(a.bell.button,n),onClick:t,"aria-label":`Notifications${i>0?` (${i} unread)`:""}`,children:[na("svg",{className:a.bell.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[na("title",{children:"Notifications"},void 0,!1,void 0,this),na("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i>0&&na("span",{className:a.bell.badge,children:i>99?"99+":i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as xc}from"@gsap/react";import zc from"gsap";import{useEffect as Eg,useEffectEvent as Da,useRef as vc}from"react";import{batch as Qg,createStore as Xg}from"h-state";var Ug={notifications:[],unseenCount:0,isLoading:!1,isMarkingAll:!1,markingId:null,error:null,hasMore:!0,offset:0},{useStore:Ea}=Xg(Ug,{setNotifications:(e)=>(t)=>{e.notifications=t},appendNotifications:(e)=>(t)=>{e.notifications=[...e.notifications,...t]},setUnseenCount:(e)=>(t)=>{e.unseenCount=t},setLoading:(e)=>(t)=>{e.isLoading=t},setMarkingAll:(e)=>(t)=>{e.isMarkingAll=t},setMarkingId:(e)=>(t)=>{e.markingId=t},setError:(e)=>(t)=>{e.error=t},setHasMore:(e)=>(t)=>{e.hasMore=t},setOffset:(e)=>(t)=>{e.offset=t},markAsSeen:(e)=>(t)=>{e.notifications=e.notifications.map((r)=>r.id===t?{...r,is_seen:!0,seen_at:new Date().toISOString()}:r)},markAllAsSeen:(e)=>()=>{let t=new Date().toISOString();e.notifications=e.notifications.map((r)=>({...r,is_seen:!0,seen_at:r.seen_at||t})),e.unseenCount=0},decrementUnseen:(e)=>()=>{e.unseenCount=Math.max(0,e.unseenCount-1)},reset:(e)=>()=>{Qg(()=>{e.notifications=[],e.unseenCount=0,e.isLoading=!1,e.isMarkingAll=!1,e.markingId=null,e.error=null,e.hasMore=!0,e.offset=0})}});import{jsxDEV as He}from"react/jsx-dev-runtime";zc.registerPlugin(xc);function Nc({variant:e="default",title:t="Notifications",subtitle:r,listAction:n,unseenCountAction:a,markSeenAction:i,markAllSeenAction:o,onNotificationClick:s,pageSize:l=20,className:c}){let d=Kt,g=vc(null),h=vc(null),k=Ea(),u=Da((y)=>{let v=y?0:k.offset;if(y)k.setLoading(!0),k.setOffset(0);k.setError(null),n.start({payload:{limit:l,offset:v},onAfterHandle:(p)=>{let f=p;if(f?.data){let M=f.data;if(y||v===0)k.setNotifications(M);else k.appendNotifications(M);k.setHasMore(M.length===l),k.setOffset(v+M.length)}k.setLoading(!1)},onErrorHandle:(p)=>{k.setError(p instanceof Error?p.message:"Failed to load notifications"),k.setLoading(!1)}})}),z=Da(()=>{a.start({payload:void 0,onAfterHandle:(y)=>{let v=y;if(v?.data)k.setUnseenCount(v.data.count)},onErrorHandle:()=>{}})}),b=Da((y)=>{if(y.is_seen){s?.(y);return}k.setMarkingId(y.id),k.markAsSeen(y.id),k.decrementUnseen(),i.start({payload:{notification_id:y.id},onAfterHandle:()=>{k.setMarkingId(null),s?.(y)},onErrorHandle:()=>{k.setMarkingId(null)}})}),C=Da(()=>{k.setMarkingAll(!0),k.markAllAsSeen(),o.start({payload:void 0,onAfterHandle:()=>{k.setMarkingAll(!1)},onErrorHandle:()=>{k.setMarkingAll(!1),u(!0),z()}})});Eg(()=>{u(!0),z()},[]),xc(()=>{if(!h.current)return;zc.fromTo(h.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:g});let x=(y)=>{switch(y){case"verification":return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"Verification"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"system":return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"System"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);default:return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"Notification"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},N=(y)=>{switch(y){case"verification":return d.notificationItem.iconWrapper.verification;case"system":return d.notificationItem.iconWrapper.system;default:return d.notificationItem.iconWrapper.custom}},m=(y)=>{let v=new Date(y),f=new Date().getTime()-v.getTime(),M=Math.floor(f/60000),$=Math.floor(f/3600000),J=Math.floor(f/86400000);if(M<1)return"Just now";if(M<60)return`${M}m ago`;if($<24)return`${$}h ago`;if(J<7)return`${J}d ago`;return v.toLocaleDateString()};return He("div",{ref:g,className:w(d.container.base,c),children:He("div",{className:d.container.wrapper,children:He("div",{ref:h,className:w(d.card.base,d.card.padding,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:[He("div",{className:d.header.container,children:[He("div",{children:[He("h2",{className:d.header.title,children:[t,k.unseenCount>0&&He("span",{className:d.header.countBadge,children:k.unseenCount},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&He("p",{className:d.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.unseenCount>0&&He("button",{type:"button",className:d.header.markAllButton,disabled:k.isMarkingAll,onClick:C,children:k.isMarkingAll?"Marking...":"Mark all as read"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&He("div",{className:d.error.container,children:He("p",{className:d.error.text,children:k.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),k.isLoading&&k.notifications.length===0?He("div",{className:d.loading.container,children:[He("div",{className:d.loading.spinner},void 0,!1,void 0,this),He("p",{className:d.loading.text,children:"Loading notifications..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):k.notifications.length===0?He("div",{className:d.empty.container,children:[He("svg",{className:d.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"No notifications"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),He("p",{className:d.empty.text,children:"No notifications yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):He("div",{className:"space-y-2",children:[k.notifications.map((y)=>He("button",{type:"button",className:w(d.notificationItem.base,y.is_seen?d.notificationItem.seen:d.notificationItem.unseen,d.notificationItem.hover,"text-left w-full"),onClick:()=>b(y),children:[He("div",{className:w(d.notificationItem.iconWrapper.base,N(y.type)),children:x(y.type)},void 0,!1,void 0,this),He("div",{className:d.notificationItem.content,children:[He("p",{className:d.notificationItem.title,children:y.title},void 0,!1,void 0,this),y.body&&He("p",{className:d.notificationItem.body,children:y.body},void 0,!1,void 0,this),He("div",{className:d.notificationItem.meta,children:[He("span",{className:d.notificationItem.timestamp,children:m(y.created_at)},void 0,!1,void 0,this),y.entity_name&&He("span",{className:"text-xs px-1.5 py-0.5 rounded bg-zinc-100 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400",children:y.entity_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!y.is_seen&&He("div",{className:d.notificationItem.dot},void 0,!1,void 0,this)]},y.id,!0,void 0,this)),k.hasMore&&He("button",{type:"button",className:d.loadMore.button,onClick:()=>u(!1),disabled:k.isLoading,children:k.isLoading?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Rc}from"@gsap/react";import Bc from"gsap";import{useCallback as dm,useEffect as Uo,useMemo as cm,useRef as ia,useState as xr}from"react";import{createPortal as Mc}from"react-dom";import{useEffect as jg,useRef as em,useState as Hr}from"react";function Mn(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toUpperCase()}function Go(e){if(e.endsWith("ies"))return`${e.slice(0,-3)}y`;if(e.endsWith("ses"))return`${e.slice(0,-2)}`;if(e.endsWith("s"))return e.slice(0,-1);return e}function Yo(e,t){let r=Mn(e),n=Mn(Go(e));switch(t){case"GET":return`GET_${r}`;case"POST":return`ADD_${n}`;case"PUT":return`UPDATE_${n}`;case"PATCH":return`PATCH_${n}`;case"DELETE":return`DELETE_${n}`}}function Ao(e,t){let r=Mn(e);switch(t){case"POST":return`BULK_ADD_${r}`;case"PUT":return`BULK_UPDATE_${r}`;case"DELETE":return`BULK_DELETE_${r}`}}function Dg(e){return`GET_${Mn(Go(e))}_BY_ID`}function Vg(e){return`GET_${Mn(e)}_DISTINCT`}function Ko({entity:e,apiActions:t,pageSize:r=20,initialSort:n=[],initialFilters:a=[]}){let i=e.table_name,[o,s]=Hr([]),[l,c]=Hr(null),[d,g]=Hr(!1),[h,k]=Hr(!1),[u,z]=Hr(null),[b,C]=Hr(""),[x,N]=Hr(n),[m,y]=Hr(a),[v,p]=Hr(1),f=em(!0),M=Yo,$=Ao,J=(_)=>{let H={page:_?.page??v,limit:r},T=_?.search??b;if(T){H.search=T;let ce=e.columns?.filter((oe)=>["text","varchar","char"].includes(oe.type)).map((oe)=>oe.name);if(ce&&ce.length>0)H.searchFields=ce.join(",")}let ie=_?.sort??x;if(ie.length>0)H.sort=JSON.stringify(ie);let q=_?.filters??m;if(q.length>0)H.filters=JSON.stringify(q);return H},U=(_)=>{let H=M(i,"GET"),T=t[H];if(!T){console.error(`Endpoint ${H} not found`);return}g(!0),z(null);let ie=_?.page??1;p(ie),T.start({payload:J({..._,page:ie}),onAfterHandle:(q)=>{let ce=q;if(ce?.data?.items)s(ce.data.items),c(ce.data.meta??null);g(!1)},onErrorHandle:(q)=>{z(q),g(!1)}})},E=()=>{if(!l||!l.hasNextPage||h)return;let _=M(i,"GET"),H=t[_];if(!H)return;k(!0);let T=v+1;H.start({payload:J({page:T}),onAfterHandle:(ie)=>{let q=ie;if(q?.data?.items&&q.data.items.length>0){let ce=q.data.items;s((oe)=>{let Ze=new Set(oe.map((Ce)=>Ce.id)),$e=ce.filter((Ce)=>!Ze.has(Ce.id));return[...oe,...$e]}),c(q.data.meta??null),p(T)}k(!1)},onErrorHandle:(ie)=>{z(ie),k(!1)}})},Z=async(_)=>{let H=M(i,"POST"),T=t[H];if(!T)throw Error(`Endpoint ${H} not found`);return new Promise((ie,q)=>{T.start({payload:_,onAfterHandle:()=>{U({page:1}),ie()},onErrorHandle:(ce)=>{q(ce)}})})},B=async(_,H)=>{let T=M(i,"PUT"),ie=t[T];if(!ie)throw Error(`Endpoint ${T} not found`);return new Promise((q,ce)=>{ie.start({payload:{_id:_,...H},onAfterHandle:()=>{U(),q()},onErrorHandle:(oe)=>{ce(oe)}})})},Q=async(_)=>{let H=M(i,"DELETE"),T=t[H];if(!T)throw Error(`Endpoint ${H} not found`);return new Promise((ie,q)=>{T.start({payload:{_id:_},onAfterHandle:()=>{U(),ie()},onErrorHandle:(ce)=>{q(ce)}})})},S=async(_)=>{let H=$(i,"POST"),T=t[H];if(!T)throw Error(`Endpoint ${H} not found`);return new Promise((ie,q)=>{T.start({payload:_,onAfterHandle:()=>{U({page:1}),ie()},onErrorHandle:(ce)=>{q(ce)}})})},O=async(_)=>{let H=$(i,"DELETE"),T=t[H];if(!T)throw Error(`Endpoint ${H} not found`);return new Promise((ie,q)=>{T.start({payload:_,onAfterHandle:()=>{U(),ie()},onErrorHandle:(ce)=>{q(ce)}})})},A=()=>{U()};jg(()=>{if(f.current)f.current=!1,U()},[]);let ee=l?.hasNextPage??!1;return{items:o,meta:l,isLoading:d,isLoadingMore:h,error:u,loadData:U,loadMore:E,hasMore:ee,addItem:Z,updateItem:B,deleteItem:Q,bulkAdd:S,bulkDelete:O,search:b,setSearch:C,sort:x,setSort:N,filters:m,setFilters:y,currentPage:v,setCurrentPage:p,refetch:A}}function rr(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,(t)=>t.toUpperCase())}function Va(e){if(e.primaryKey&&e.type==="serial")return!0;if(e.primaryKey&&e.type==="bigserial")return!0;if(e.primaryKey&&e.type==="smallserial")return!0;if(e.generatedAlwaysAs)return!0;if(e.generatedAlwaysAsIdentity)return!0;if(["created_at","updated_at","deleted_at"].includes(e.name))return!0;return!1}function Zo(e,t){if(Va(e))return!0;if(e.primaryKey)return!0;if(e.name==="id")return!0;if(t==="add"){if(e.defaultRaw?.includes("gen_random_uuid"))return!0;if(e.generatedByDefaultAsIdentity)return!0}return!1}function aa(e){return!!e.references}function Qo(e){return e.type==="json"||e.type==="jsonb"}function ja(e){return!!e.array}function ei(e){if(e.enumValues||e.enum)return"select";switch(e.type){case"integer":case"smallint":case"bigint":case"serial":case"smallserial":case"bigserial":case"real":case"doublePrecision":case"numeric":case"decimal":case"money":return"number";case"boolean":return"boolean";case"date":case"time":case"timestamp":case"timestamptz":return"date";case"json":case"jsonb":return"json";case"bytea":case"vector":case"geometry":case"geography":return"hidden";default:return"text"}}function tm(e){if(e.default!==void 0)return e.default;switch(ei(e)){case"number":return e.nullable?null:0;case"boolean":return!1;case"date":return null;case"select":return e.nullable?null:"";case"json":return e.nullable?null:{};default:return""}}var rm=["text","varchar","char"],nm=["integer","smallint","bigint","serial","smallserial","bigserial","real","doublePrecision","numeric","decimal","money"],am=["date","time","timestamp","timestamptz"];function im(e){return rm.includes(e.type)}function om(e){if((e.enumValues?.length??0)>0)return!0;if((e.enum?.values?.length??0)>0)return!0;if(e.type==="customType"&&e.enum)return!0;return!1}function Xo(e){return e.type==="boolean"}function lm(e){return nm.includes(e.type)}function sm(e){return am.includes(e.type)}function Sc(e){if(e.enumValues?.length)return e.enumValues;if(e.enum?.values?.length)return e.enum.values;return[]}function Pc(e){return e.filter(im)}function Cc(e){return e.filter((t)=>om(t)||Xo(t))}function Tc(e){return e.filter((t)=>lm(t)&&!t.primaryKey)}function Lc(e){return e.filter((t)=>sm(t))}import{jsxDEV as K,Fragment as um}from"react/jsx-dev-runtime";Bc.registerPlugin(Rc);var bt={container:"w-full h-full flex flex-col min-h-0",header:{base:"mb-4",title:"text-xl font-semibold text-zinc-900 dark:text-white",description:"mt-1 text-sm text-zinc-500 dark:text-zinc-400"},toolbar:{base:"flex flex-col gap-3 mb-4",row:"flex flex-wrap items-center gap-3",search:"flex-1 min-w-[200px] max-w-md",searchFields:"flex flex-wrap items-center gap-2",filters:"flex flex-wrap items-center gap-2",actions:"flex items-center gap-2 ml-auto"},table:{container:"w-full flex-1 overflow-auto rounded-lg border border-zinc-200 dark:border-zinc-700 min-h-0 relative",table:"w-full text-sm table-fixed",thead:"bg-zinc-50 dark:bg-zinc-800 sticky top-0 z-10",th:"px-3 py-2.5 text-left text-xs font-medium text-zinc-600 dark:text-zinc-400 uppercase tracking-wider bg-zinc-50 dark:bg-zinc-800",thSortable:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-700 select-none",tbody:"divide-y divide-zinc-100 dark:divide-zinc-800",tr:"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",trSelected:"bg-blue-50 dark:bg-blue-900/20",td:"px-3 py-2.5 text-sm text-zinc-700 dark:text-zinc-300 truncate relative",empty:"px-4 py-12 text-center text-zinc-500 dark:text-zinc-400",loading:"px-4 py-8 text-center text-zinc-500"},pagination:{base:"flex items-center justify-between py-3 text-sm border-t border-zinc-200 dark:border-zinc-700",info:"text-zinc-500 dark:text-zinc-400",buttons:"flex items-center gap-2"},modal:{overlay:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",container:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 animate-in zoom-in-95 slide-in-from-bottom-4 duration-200",header:"mb-6 flex items-center justify-between border-b border-zinc-100 dark:border-zinc-800 pb-4",title:"text-lg font-semibold text-zinc-900 dark:text-white",closeButton:"rounded-full p-1 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300"},button:{base:"inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500",ghost:"text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",sizes:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},input:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 placeholder-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder-zinc-500",label:"mb-1.5 block text-sm font-medium text-zinc-700 dark:text-zinc-300",error:"mt-1 text-xs text-red-500 dark:text-red-400"},select:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100"},checkbox:{base:"h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800"},skeleton:{base:"animate-pulse rounded bg-zinc-200 dark:bg-zinc-700",row:"h-12"}};function pm({entity:e,apiActions:t,title:r,description:n,pageSize:a=20,searchable:i=!0,searchFields:o,filterable:s=!0,sortable:l=!0,selectable:c=!0,showAdd:d=!0,showEdit:g=!0,showDelete:h=!0,showBulkAdd:k=!1,showBulkDelete:u=!0,columnConfigs:z,fieldConfigs:b,excludeColumns:C=[],excludeFields:x=[],onRowClick:N,renderHeader:m,renderToolbar:y,className:v}){let p=e.table_name,f=ia(null),[M,$]=xr(!1),[J,U]=xr([]),[E,Z]=xr({isOpen:!1,mode:"add"}),[B,Q]=xr({}),[S,O]=xr({}),[A,ee]=xr({isOpen:!1,table:"",data:null});Uo(()=>{$(!0)},[]);let{items:_,meta:H,isLoading:T,isLoadingMore:ie,loadData:q,loadMore:ce,hasMore:oe,addItem:Ze,updateItem:$e,deleteItem:Ce,bulkDelete:fe,search:xe,setSearch:Oe,setSort:Le,filters:ve,setFilters:R}=Ko({entity:e,apiActions:t,pageSize:a}),de=e.add_base_columns?[{name:"id",type:"uuid",primaryKey:!0},{name:"created_at",type:"timestamptz"},{name:"updated_at",type:"timestamptz"}]:[],te=new Set((e.columns??[]).map((P)=>P.name)),ye=de.filter((P)=>!te.has(P.name)),D=[...e.columns??[],...ye],j=D.filter((P)=>{if(Va(P))return!1;if(C.includes(P.name))return!1;if(z?.[P.name]?.hidden)return!1;return!0}),re=(P)=>D.filter((F)=>{if(Zo(F,P))return!1;if(x.includes(F.name))return!1;if(b?.[F.name]?.hidden)return!1;return!0}),[Ke,I]=xr({}),[ue,We]=xr({}),Ue=cm(()=>D.filter((P)=>aa(P)),[D]),gt=ia(new Set),Ge=dm((P)=>{if(!P.references)return;let F=P.references.table;if(gt.current.has(F))return;gt.current.add(F);let le=`GET_${F.toUpperCase()}`,pe=t[le];if(pe)pe.start({payload:{limit:100},onAfterHandle:(be)=>{let et=(be?.data?.items??[]).map((it)=>({id:String(it.id??""),label:String(it.name??it.title??it.label??it.id??""),data:it}));I((it)=>({...it,[F]:et})),We((it)=>({...it,[F]:!1}))},onErrorHandle:()=>{We((be)=>({...be,[F]:!1}))}})},[t]),Qt=(P,F)=>{let pe=(Ke[P]??[]).find((be)=>be.id===F);if(pe)ee({isOpen:!0,table:P,data:pe.data})},$t=()=>{ee({isOpen:!1,table:"",data:null})};Uo(()=>{for(let P of Ue)Ge(P)},[Ue,Ge]),Rc(()=>{if(f.current)Bc.fromTo(f.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},[]);let zr=(P)=>{Oe(P),q({search:P,page:1})},ne=()=>{U([])},W=()=>{let P={};for(let F of re("add")){let le=F.enumValues??F.enum?.values;if(F.default!==void 0)P[F.name]=F.default;else if(le&&le.length>0)P[F.name]=le[0];else if(F.type==="boolean")P[F.name]=!1;else P[F.name]=""}Q(P),O({}),Z({isOpen:!0,mode:"add"})},V=(P)=>{let F={},le=P;for(let pe of D){let be=pe.name,_e=be.replace(/_([a-z])/g,(st,et)=>et.toUpperCase());if(pe.references?.foreignKey){let st=pe.references.foreignKey;if(st in le){F[be]=le[st];continue}}if(be in le)F[be]=le[be];else if(_e in le)F[be]=le[_e];else{let st=`${_e}Id`;if(st in le)F[be]=le[st];else F[be]=void 0}}Q(F),O({}),Z({isOpen:!0,mode:"edit",data:P})},Ne=()=>{Z({isOpen:!1,mode:"add"}),Q({}),O({}),gr(null)},ze=()=>{let P={};for(let F of re(E.mode)){let le=B[F.name],pe=le===void 0||le===null||le==="";if(F.notNull&&pe){P[F.name]="This field is required";continue}if(!pe&&F.validation){if(F.validation.minLength&&String(le).length<F.validation.minLength)P[F.name]=`Minimum ${F.validation.minLength} characters`;if(F.validation.maxLength&&String(le).length>F.validation.maxLength)P[F.name]=`Maximum ${F.validation.maxLength} characters`;if(F.validation.min!==void 0&&Number(le)<F.validation.min)P[F.name]=`Minimum value is ${F.validation.min}`;if(F.validation.max!==void 0&&Number(le)>F.validation.max)P[F.name]=`Maximum value is ${F.validation.max}`}}return O(P),Object.keys(P).length===0},[Me,gr]=xr(null),br=(P)=>{let F={},le=re(E.mode),pe=["integer","smallint","bigint","real","doublePrecision","numeric","decimal","money"];for(let be of le){let _e=P[be.name],st=be.references?.foreignKey??be.name;if(_e===void 0||_e===null||_e===""){if(!be.notNull)F[st]=null;continue}if(ja(be))F[st]=Array.isArray(_e)?_e.join(","):String(_e);else if(pe.includes(be.type))F[st]=Number(_e);else F[st]=_e}return F},Xt=async()=>{if(!ze())return;gr(null);let P=br(B);try{if(E.mode==="add")await Ze(P);else{let F=E.data?.id;if(F)await $e(F,P)}Ne()}catch(F){let le="An error occurred",pe=(be)=>{if(typeof be==="string")return be;if(be&&typeof be==="object"){let _e=be;if(_e.summary)return String(_e.summary);if(_e.message)return String(_e.message);if(_e.errors&&Array.isArray(_e.errors))return _e.errors.map((st)=>pe(st)).join(", ")}return JSON.stringify(be)};try{let be=F;if(be.errors&&Array.isArray(be.errors)&&be.errors.length>0)le=be.errors.map((_e)=>pe(_e)).join(", ");else if(be.message)try{let _e=JSON.parse(be.message);le=pe(_e)}catch{le=be.message}else le=pe(F)}catch{le=String(F)}gr(le)}},Nr=async(P)=>{if(window.confirm("Are you sure you want to delete this item?"))await Ce(P)},Vr=async()=>{if(J.length===0)return;if(window.confirm(`Are you sure you want to delete ${J.length} items?`)){let P=J.map((F)=>F.id);await fe(P),U([])}},ar=(P,F)=>{let le=z?.[P.name];if(le?.cellRenderer)return le.cellRenderer({value:F,row:{}});if(F===null||F===void 0)return K("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this);if(P.type==="boolean")return F?"Yes":"No";if(P.type==="timestamp"||P.type==="timestamptz"||P.type==="date")return new Date(F).toLocaleDateString();if(P.type==="json"||P.type==="jsonb")return K("code",{className:"text-xs",children:[JSON.stringify(F).slice(0,50),"..."]},void 0,!0,void 0,this);if(aa(P)&&P.references){let pe=P.references.table,_e=(Ke[pe]??[]).find((st)=>st.id===String(F));if(_e)return K("button",{type:"button",onClick:(st)=>{st.stopPropagation(),Qt(pe,_e.id)},className:"group inline-flex items-center gap-1.5 rounded-md border border-zinc-200 bg-zinc-50 px-2 py-1 text-xs font-medium text-zinc-700 transition-all hover:border-zinc-300 hover:bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:border-zinc-600 dark:hover:bg-zinc-700",children:[K("span",{className:"max-w-[120px] truncate",children:_e.label},void 0,!1,void 0,this),K("svg",{className:"h-3 w-3 text-zinc-400 transition-transform group-hover:translate-x-0.5 group-hover:text-zinc-600 dark:group-hover:text-zinc-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:K("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return K("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this)}return String(F)},Ye=(P)=>{let F=b?.[P.name],le=F?.label??rr(P.name),pe=B[P.name],be=S[P.name],_e=ei(P);if(F?.render)return K("div",{className:"mb-4",children:[K("label",{htmlFor:`field-${P.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),F.render({value:pe,onChange:(et)=>Q((it)=>({...it,[P.name]:et}))}),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this);if(_e==="boolean")return K("div",{className:"mb-4",children:[K("label",{htmlFor:`field-${P.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),K(hr,{checked:Boolean(pe),onChange:(et)=>Q((it)=>({...it,[P.name]:et})),disabled:F?.disabled,size:"sm"},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this);let st=P.enumValues??P.enum?.values;if(_e==="select"&&st)return K("div",{className:"mb-4",children:[K("label",{htmlFor:`field-${P.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),K(dr,{value:String(pe??""),onChange:(et)=>Q((it)=>({...it,[P.name]:et})),options:st.map((et)=>({value:et,label:rr(et)})),placeholder:`Select ${le.toLowerCase()}`,size:"sm"},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this);if(aa(P)&&P.references){let et=P.references.table,it=Ke[et]??[],_t=ue[et]??!1,fr=pe?String(pe):void 0;return K("div",{className:"mb-4",children:[K("label",{htmlFor:`ref-${P.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),K(dr,{value:fr,onChange:(mr)=>Q((mn)=>({...mn,[P.name]:mr??null})),options:it.map((mr)=>({value:mr.id,label:mr.label})),placeholder:_t?"Loading...":`Select ${le.toLowerCase()}`,size:"sm",clearable:!0},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this)}if(Qo(P)){let et=typeof pe==="object"?JSON.stringify(pe,null,2):String(pe??"{}");return K("div",{className:"mb-4",children:[K("label",{htmlFor:`json-${P.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),K("textarea",{id:`json-${P.name}`,value:et,onChange:(it)=>{try{let _t=JSON.parse(it.target.value);Q((fr)=>({...fr,[P.name]:_t})),O((fr)=>{let mr={...fr};return delete mr[P.name],mr})}catch{Q((_t)=>({..._t,[P.name]:it.target.value})),O((_t)=>({..._t,[P.name]:"Invalid JSON"}))}},placeholder:F?.placeholder??"Enter JSON...",className:w(bt.input.base,"min-h-[100px] font-mono text-xs"),disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this)}if(ja(P)){let et=Array.isArray(pe)?pe:[],it=`array-${P.name}`;return K("div",{className:"mb-4",children:[K("label",{htmlFor:it,className:bt.input.label,children:le},void 0,!1,void 0,this),K("div",{className:"flex flex-wrap gap-1 rounded-lg border border-zinc-300 bg-white p-2 dark:border-zinc-600 dark:bg-zinc-800",children:[et.map((_t,fr)=>K("span",{className:"inline-flex items-center gap-1 rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:[_t,K("button",{type:"button",onClick:()=>{let mr=et.filter((mn,Y0)=>Y0!==fr);Q((mn)=>({...mn,[P.name]:mr}))},className:"ml-1 text-blue-600 hover:text-blue-800 dark:text-blue-300",children:"\xD7"},void 0,!1,void 0,this)]},fr,!0,void 0,this)),K("input",{id:it,type:"text",className:"min-w-[100px] flex-1 border-none bg-transparent text-sm outline-none",placeholder:et.length===0?F?.placeholder??"Type and press Enter":"",onKeyDown:(_t)=>{if(_t.key==="Enter"){_t.preventDefault();let fr=_t.currentTarget,mr=fr.value.trim();if(mr)Q((mn)=>({...mn,[P.name]:[...et,mr]})),fr.value=""}},disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("p",{className:"mt-1 text-xs text-zinc-500",children:"Press Enter to add"},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this)}return K("div",{className:"mb-4",children:[K(Ee,{type:_e==="number"?"number":"text",label:le,value:String(pe??""),onChange:(et)=>{let it=_e==="number"?et===""?"":Number(et):et;Q((_t)=>({..._t,[P.name]:it}))},placeholder:F?.placeholder??`Enter ${le.toLowerCase()}`,disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this),be&&K("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},P.name,!0,void 0,this)},Ut=ia(null),Lt=Pc(D),sa=Cc(D),Et=Tc(D),da=Lc(D),[zl,Ci]=xr(()=>{let P={};for(let F of Lt)P[F.name]=!0;return P}),Sr=ia(ce);Sr.current=ce;let Pr=ia({hasMore:oe,isLoadingMore:ie,isLoading:T});Pr.current={hasMore:oe,isLoadingMore:ie,isLoading:T},Uo(()=>{let P=Ut.current;if(!P)return;let F=()=>{let{scrollTop:le,scrollHeight:pe,clientHeight:be}=P,_e=100,st=pe<=be||pe-le-be<100,{hasMore:et,isLoadingMore:it,isLoading:_t}=Pr.current;if(st&&et&&!it&&!_t)Sr.current()};return F(),P.addEventListener("scroll",F),()=>P.removeEventListener("scroll",F)},[_.length]);let Cr=(P,F)=>{if(!F)R(ve.filter((le)=>le.field!==P));else if(ve.find((pe)=>pe.field===P))R(ve.map((pe)=>pe.field===P?{...pe,value:F}:pe));else R([...ve,{field:P,operator:"eq",value:F}]);q({filters:F?[...ve.filter((le)=>le.field!==P),{field:P,operator:"eq",value:F}]:ve.filter((le)=>le.field!==P),page:1})},Dt=(P)=>{let F=ve.find((le)=>le.field===P);return F?String(F.value):""},ca=(P)=>{Ci((F)=>({...F,[P]:!F[P]}))},J0=(P)=>{let F=z?.[P.name];if(F?.width)return`${F.width}px`;switch(P.type){case"uuid":return"140px";case"boolean":return"80px";case"integer":case"smallint":case"bigint":return"90px";case"numeric":case"decimal":case"real":case"doublePrecision":return"100px";case"timestamp":case"timestamptz":case"date":return"120px";case"json":case"jsonb":return"100px";default:return"150px"}},Ti=r??rr(p),G0=(P,F,le)=>{let pe=P;if(le?.references?.foreignKey){let st=le.references.foreignKey;if(st in pe)return pe[st]}if(F in pe)return pe[F];let be=F.replace(/_([a-z])/g,(st,et)=>et.toUpperCase());if(be in pe)return pe[be];let _e=`${be}Id`;if(_e in pe)return pe[_e];return};return K("div",{ref:f,className:w(bt.container,v),children:[m?m():K("div",{className:bt.header.base,children:[K("h2",{className:bt.header.title,children:Ti},void 0,!1,void 0,this),n&&K("p",{className:bt.header.description,children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&K("div",{className:"mb-6 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-4",children:[K(Cn,{value:xe,onChange:Oe,onSearch:zr,placeholder:`Search ${Ti.toLowerCase()}...`,loading:T,debounceMs:400,disableDropdown:!0,showSearchIcon:!0,showClearButton:!0},void 0,!1,void 0,this),Lt.length>0&&K("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[K("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Search in:"},void 0,!1,void 0,this),Lt.map((P)=>K("label",{htmlFor:`search-field-${P.name}`,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 cursor-pointer transition-colors",children:[K(hr,{checked:zl[P.name]??!1,onChange:()=>ca(P.name),size:"sm"},void 0,!1,void 0,this),K("span",{className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:rr(P.name)},void 0,!1,void 0,this)]},P.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(d||J.length>0)&&K("div",{className:"mb-6 flex items-center gap-3",children:[J.length>0&&u&&K(se,{variant:"danger",size:"sm",onClick:Vr,children:["Delete (",J.length,")"]},void 0,!0,void 0,this),d&&!e.excluded_methods?.includes("POST")&&K(se,{variant:"success",size:"sm",onClick:W,children:["Add ",rr(p.endsWith("s")?p.slice(0,-1):p)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&(sa.length>0||Et.length>0||da.length>0)&&K("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-6",children:[K("div",{className:"mb-6 flex items-center justify-between",children:[K("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-white",children:"Filters"},void 0,!1,void 0,this),ve.length>0&&K("button",{type:"button",onClick:()=>R([]),className:"text-xs px-2 py-1 rounded text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-950 dark:text-emerald-400 font-medium transition-colors",children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[sa.map((P)=>{let F=Sc(P),le=Xo(P)?[{value:"",label:"All"},{value:"true",label:"Yes"},{value:"false",label:"No"}]:[{value:"",label:"All"},...F.map((pe)=>({value:pe,label:rr(pe)}))];return K("div",{className:"flex flex-col gap-2",children:[K("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(P.name)},void 0,!1,void 0,this),K(dr,{value:Dt(P.name)||void 0,onChange:(pe)=>Cr(P.name,pe??""),options:le,placeholder:"All",size:"sm",clearable:!0},void 0,!1,void 0,this)]},P.name,!0,void 0,this)}),Et.map((P)=>{let F=Number(Dt(`${P.name}_min`))||0,le=Number(Dt(`${P.name}_max`))||1e4;return K("div",{className:"flex flex-col gap-3",children:[K("div",{className:"flex items-center justify-between",children:[K("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(P.name)},void 0,!1,void 0,this),K("span",{className:"text-xs font-semibold text-zinc-700 dark:text-zinc-300",children:[F," - ",le]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K(Pn,{min:0,max:1e4,step:P.type==="numeric"||P.type==="decimal"?0.01:1,value:{min:F,max:le},onChange:(pe)=>{Cr(`${P.name}_min`,String(pe.min)),Cr(`${P.name}_max`,String(pe.max))},showTooltip:!0,size:"md"},void 0,!1,void 0,this)]},P.name,!0,void 0,this)}),da.map((P)=>K("div",{className:"flex flex-col gap-2",children:[K("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(P.name)},void 0,!1,void 0,this),K(Sn,{mode:"range",value:{start:Dt(`${P.name}_from`)?new Date(Dt(`${P.name}_from`)):null,end:Dt(`${P.name}_to`)?new Date(Dt(`${P.name}_to`)):null},onChange:(F)=>{Cr(`${P.name}_from`,F.start?.toISOString().split("T")[0]??""),Cr(`${P.name}_to`,F.end?.toISOString().split("T")[0]??"")},placeholder:"Select range"},void 0,!1,void 0,this)]},P.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y?.({selectedRows:J,onClearSelection:ne}),K("div",{className:"mt-6 flex-1 min-h-0 overflow-x-auto",children:K(kn,{data:_,columns:j.map((P)=>{let F=z?.[P.name],le=J0(P);return{key:`col_${P.name}`,header:F?.header??rr(P.name),width:Number.parseInt(le,10)||150,sortable:l&&F?.sortable!==!1,resizable:!0,cellRenderer:({row:pe})=>{let be=G0(pe,P.name,P);return ar(P,be)}}}),actionColumns:g||h?[{key:"actions",header:"Actions",width:120,renderer:({row:P})=>{let F=P.id??"";return K("div",{className:"flex items-center gap-2",children:[g&&!e.excluded_methods?.includes("PUT")&&K(se,{variant:"outline",size:"xs",onClick:()=>V(P),children:"Edit"},void 0,!1,void 0,this),h&&!e.excluded_methods?.includes("DELETE")&&K(se,{variant:"ghost",size:"xs",onClick:()=>Nr(F),className:"text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-950",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}]:void 0,keyExtractor:(P)=>P.id??String(Math.random()),callbacks:{onSort:(P,F)=>{if(F)Le([{field:String(P),direction:F}]),q({sort:[{field:String(P),direction:F}]});else Le([]),q({sort:[]})},onLoadMore:ce,onCellClick:N?({row:P})=>{N(P)}:void 0},config:{hasClickAction:Boolean(N),isFrontendSort:!1,enableInfiniteScroll:!0,autoFetchUntilScroll:!0,enableSelection:c},isLoading:T&&_.length===0,isPending:T&&_.length===0,isLoadingMore:ie,hasMoreData:oe,emptyMessage:`No ${Ti.toLowerCase()} found`,selectionToolbar:c?({selectedData:P,onClearSelection:F})=>K(um,{children:u&&P.length>0&&K(se,{variant:"danger",size:"sm",onClick:()=>{let le=P.map((pe)=>pe.id).filter(Boolean);if(le.length>0&&window.confirm(`Delete ${le.length} items?`))fe(le).then(()=>F())},children:["Delete (",P.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||ie)&&K("div",{className:bt.pagination.base,children:[K("span",{className:bt.pagination.info,children:H?`Showing ${_.length} of ${H.totalItems} items`:""},void 0,!1,void 0,this),ie&&K("span",{className:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400",children:[K("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[K("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),K("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Loading more..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&E.isOpen&&Mc(K("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:Ne,onKeyDown:(P)=>P.key==="Escape"&&Ne(),role:"dialog","aria-modal":"true",children:K("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(P)=>P.stopPropagation(),onKeyDown:(P)=>{if(P.stopPropagation(),P.key==="Escape")Ne()},role:"document",children:[K("div",{className:bt.modal.header,children:[K("h3",{className:bt.modal.title,children:[E.mode==="add"?"Add":"Edit"," ",rr(p.endsWith("s")?p.slice(0,-1):p)]},void 0,!0,void 0,this),K(se,{variant:"ghost",size:"sm",onClick:Ne,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("form",{onSubmit:(P)=>{P.preventDefault(),Xt()},children:[Me&&K("div",{className:"mb-4 rounded-lg bg-red-50 p-3 text-sm text-red-600 dark:bg-red-900/20 dark:text-red-400",children:Me},void 0,!1,void 0,this),re(E.mode).map((P)=>Ye(P)),K("div",{className:"mt-6 flex justify-end gap-2",children:[K(se,{variant:"secondary",size:"sm",onClick:Ne,children:"Cancel"},void 0,!1,void 0,this),K(se,{variant:"primary",size:"sm",type:"submit",children:E.mode==="add"?"Create":"Update"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body),M&&A.isOpen&&A.data&&Mc(K("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:$t,onKeyDown:(P)=>P.key==="Escape"&&$t(),role:"dialog","aria-modal":"true",children:K("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(P)=>P.stopPropagation(),onKeyDown:(P)=>{if(P.stopPropagation(),P.key==="Escape")$t()},role:"document",children:[K("div",{className:bt.modal.header,children:[K("h3",{className:bt.modal.title,children:[rr(A.table.endsWith("s")?A.table.slice(0,-1):A.table)," ","Details"]},void 0,!0,void 0,this),K(se,{variant:"ghost",size:"sm",onClick:$t,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{className:"space-y-3",children:Object.entries(A.data).map(([P,F])=>{if(P==="id"||P.endsWith("At")||P.endsWith("By"))return null;return K("div",{className:"flex flex-col gap-1",children:[K("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:rr(P)},void 0,!1,void 0,this),K("span",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:F===null||F===void 0?"-":typeof F==="object"?JSON.stringify(F):String(F)},void 0,!1,void 0,this)]},P,!0,void 0,this)})},void 0,!1,void 0,this),K("div",{className:"mt-6 flex justify-end",children:K(se,{variant:"secondary",size:"sm",onClick:$t,children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body)]},void 0,!0,void 0,this)}var $r={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8"},card:{base:"w-full",padding:"p-4 sm:p-6 lg:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-xl sm:rounded-2xl"},header:{container:"flex flex-col sm:flex-row items-center sm:items-start gap-4 sm:gap-6 pb-6 border-b border-zinc-200 dark:border-zinc-700/50",avatar:{wrapper:"relative flex-shrink-0",image:"w-20 h-20 sm:w-24 sm:h-24 rounded-full object-cover ring-4 ring-white dark:ring-zinc-800 shadow-lg",placeholder:"w-20 h-20 sm:w-24 sm:h-24 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white text-2xl sm:text-3xl font-bold ring-4 ring-white dark:ring-zinc-800 shadow-lg",uploadButton:"absolute -bottom-1 -right-1 p-1.5 sm:p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors cursor-pointer"},info:{container:"flex-1 text-center sm:text-left",name:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",email:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400 mt-1",meta:"flex flex-wrap justify-center sm:justify-start gap-3 sm:gap-4 mt-3 text-xs sm:text-sm text-zinc-500 dark:text-zinc-400"}},section:{container:"mt-6 sm:mt-8",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white",titleWrapper:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 mb-4",addButton:"text-xs sm:text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors",content:"space-y-3 sm:space-y-4",empty:{container:"flex flex-col items-center justify-center py-8 sm:py-12 text-center bg-zinc-50 dark:bg-zinc-800/30 rounded-xl",icon:"w-10 h-10 sm:w-12 sm:h-12 text-zinc-300 dark:text-zinc-600 mb-3",text:"text-sm text-zinc-500 dark:text-zinc-400"}},profileForm:{container:"mt-4 sm:mt-6",grid:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",field:{container:"space-y-1 sm:space-y-1.5",label:"block text-xs sm:text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 py-2 text-sm rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all",error:"text-xs text-red-500 mt-1"},actions:"flex flex-col-reverse sm:flex-row justify-end gap-2 sm:gap-3 mt-4 sm:mt-6"},itemCard:{base:"group relative transition-all duration-200",padding:"p-3 sm:p-4",background:"bg-white dark:bg-zinc-800/60",border:"border border-zinc-200 dark:border-zinc-700/50",rounded:"rounded-lg sm:rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3",icon:"flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",title:"font-medium text-sm sm:text-base text-zinc-900 dark:text-white",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5",actions:"flex items-center gap-1 sm:gap-2 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"},details:{container:"mt-2 sm:mt-3 space-y-1 sm:space-y-1.5 text-xs sm:text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-xl sm:rounded-2xl shadow-2xl max-w-md w-full p-4 sm:p-6 max-h-[90vh] overflow-y-auto",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white mb-4",form:"space-y-3 sm:space-y-4",actions:"flex flex-col-reverse sm:flex-row gap-2 sm:gap-3 justify-end mt-4 sm:mt-6"},loading:{container:"flex flex-col items-center justify-center py-12 sm:py-16",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-3 sm:mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-3 sm:p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-xs sm:text-sm text-red-600 dark:text-red-400"},accountSettings:{container:"space-y-2",item:"w-full flex items-center justify-between p-3 rounded-lg border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",iconWrapper:"w-10 h-10 rounded-full flex items-center justify-center",content:"flex items-center gap-3",title:"text-sm font-medium text-zinc-900 dark:text-white",description:"text-xs text-zinc-500 dark:text-zinc-400",arrow:"w-5 h-5 text-zinc-400"}};import{jsxDEV as De}from"react/jsx-dev-runtime";function ti({address:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=$r,s=e.id.startsWith("temp-"),l=()=>{return[e.street,e.apartment,e.neighborhood,e.district,e.city,e.state,e.province,e.zip,e.country].filter(Boolean).join(", ")||"No address details"},c=()=>{if(e.type==="home"||e.type==="residential")return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Home"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="work"||e.type==="office")return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Work"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Location"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return De("article",{className:w(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[De("div",{className:o.itemCard.header.container,children:[De("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),De("div",{className:"flex-1 min-w-0",children:[De("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),De("p",{className:o.itemCard.header.subtitle,children:e.type||"Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&De("div",{className:o.itemCard.header.actions,children:[De(se,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit address",children:De("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Edit"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),De(se,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete address",children:a?De("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[De("title",{children:"Deleting"},void 0,!1,void 0,this),De("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),De("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):De("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Delete"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),De("div",{className:o.itemCard.details.container,children:De("p",{className:"text-zinc-600 dark:text-zinc-400 text-sm leading-relaxed",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Qe}from"react/jsx-dev-runtime";function ri({phone:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=$r,s=e.id.startsWith("temp-"),l=()=>{let d=[e.countryCode,e.number];if(e.extension)d.push(`ext. ${e.extension}`);return d.join(" ")},c=()=>{if(e.type==="mobile")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Mobile"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 1.5H8.25A2.25 2.25 0 006 3.75v16.5a2.25 2.25 0 002.25 2.25h7.5A2.25 2.25 0 0018 20.25V3.75a2.25 2.25 0 00-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="office")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Office"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="fax")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Fax"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Phone"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Qe("article",{className:w(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[Qe("div",{className:o.itemCard.header.container,children:[Qe("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),Qe("div",{className:"flex-1 min-w-0",children:[Qe("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),Qe("p",{className:o.itemCard.header.subtitle,children:e.type||"Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&Qe("div",{className:o.itemCard.header.actions,children:[Qe(se,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit phone",children:Qe("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Edit"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Qe(se,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete phone",children:a?Qe("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[Qe("title",{children:"Deleting"},void 0,!1,void 0,this),Qe("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Qe("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Qe("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Delete"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Qe("div",{className:o.itemCard.details.container,children:Qe("p",{className:"text-zinc-900 dark:text-white font-medium",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as wt}from"react/jsx-dev-runtime";function ni({user:e,profile:t,profilePicture:r,fileProxyBasePath:n="/file-proxy",onUploadPicture:a,isUploading:i=!1}){let o=$r,s=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName[0]}${t.lastName[0]}`.toUpperCase();if(e?.email&&e.email.length>0)return e.email[0]?.toUpperCase()||"?";return"?"},l=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName} ${t.lastName}`;return"No name set"},c=(d)=>{if(!d)return"N/A";return(typeof d==="string"?new Date(d):d).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})};return wt("header",{className:o.header.container,children:[wt("div",{className:o.header.avatar.wrapper,children:[r?.id?wt("img",{src:`${n}/${r.id}`,alt:l(),className:o.header.avatar.image},void 0,!1,void 0,this):wt("div",{className:o.header.avatar.placeholder,children:s()},void 0,!1,void 0,this),a&&wt("button",{type:"button",onClick:a,disabled:i,className:o.header.avatar.uploadButton,"aria-label":"Upload profile picture",children:i?wt("svg",{className:"w-4 h-4 animate-spin text-zinc-500",viewBox:"0 0 24 24",fill:"none",children:[wt("title",{children:"Uploading"},void 0,!1,void 0,this),wt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),wt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):wt("svg",{className:"w-4 h-4 text-zinc-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[wt("title",{children:"Upload"},void 0,!1,void 0,this),wt("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"},void 0,!1,void 0,this),wt("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),wt("div",{className:o.header.info.container,children:[wt("h1",{className:o.header.info.name,children:l()},void 0,!1,void 0,this),wt("p",{className:o.header.info.email,children:e?.email||"No email"},void 0,!1,void 0,this),wt("div",{className:o.header.info.meta,children:[e?.verifiedAt&&wt("span",{className:"flex items-center gap-1",children:[wt("svg",{className:"w-3.5 h-3.5 text-green-500",viewBox:"0 0 24 24",fill:"currentColor",children:[wt("title",{children:"Verified"},void 0,!1,void 0,this),wt("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Verified"]},void 0,!0,void 0,this),e?.lastLoginAt&&wt("span",{children:["Last login: ",c(e.lastLoginAt)]},void 0,!0,void 0,this),e?.createdAt&&wt("span",{children:["Member since: ",c(e.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Wc}from"@gsap/react";import Ic from"gsap";import{useEffect as fm,useEffectEvent as hm,useRef as ii,useState as un}from"react";import{batch as gm,createStore as mm}from"h-state";var bm={user:null,profile:null,addresses:[],phones:[],files:[],roles:[],profilePicture:null,isEditingProfile:!1},{useStore:ai}=mm(bm,{setUser:(e)=>(t)=>{e.user=t},setProfile:(e)=>(t)=>{if(t===null)e.profile=null;else if(e.profile)e.profile={...e.profile,...t};else e.profile=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setProfilePicture:(e)=>(t)=>{e.profilePicture=t},setEditingProfile:(e)=>(t)=>{e.isEditingProfile=t},addAddress:(e)=>(t)=>{e.addresses=[...e.addresses,t]},updateAddress:(e)=>(t)=>{e.addresses=e.addresses.map((r)=>r.id===t.id?{...r,...t}:r)},removeAddress:(e)=>(t)=>{e.addresses=e.addresses.filter((r)=>r.id!==t)},addPhone:(e)=>(t)=>{e.phones=[...e.phones,t]},updatePhone:(e)=>(t)=>{e.phones=e.phones.map((r)=>r.id===t.id?{...r,...t}:r)},removePhone:(e)=>(t)=>{e.phones=e.phones.filter((r)=>r.id!==t)},addFile:(e)=>(t)=>{if(e.files=[...e.files,t],t.type==="profile_picture"){let n=e.files.filter((a)=>a.type==="profile_picture").sort((a,i)=>new Date(i.updatedAt).getTime()-new Date(a.updatedAt).getTime())[0];e.profilePicture=n||t}},updateFile:(e)=>(t)=>{if(e.files=e.files.map((r)=>r.id===t.id?t:r),t.type==="profile_picture")e.profilePicture=t;else if(e.profilePicture?.id===t.id)e.profilePicture=null},removeFile:(e)=>(t)=>{let r=e.files.find((n)=>n.id===t);if(e.files=e.files.filter((n)=>n.id!==t),r?.type==="profile_picture"&&e.profilePicture?.id===t)e.profilePicture=null},reset:(e)=>()=>{gm(()=>{e.user=null,e.profile=null,e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.profilePicture=null,e.isEditingProfile=!1})}});import{jsxDEV as L,Fragment as ym}from"react/jsx-dev-runtime";Ic.registerPlugin(Wc);function Hc({meAction:e,addProfileAction:t,updateProfileAction:r,addAddressAction:n,updateAddressAction:a,deleteAddressAction:i,addPhoneAction:o,updatePhoneAction:s,deletePhoneAction:l,uploadFileAction:c,updateFileAction:d,deleteFileAction:g,fileProxyBasePath:h="/file-proxy",onProfileUpdated:k,onAddressAdded:u,onAddressUpdated:z,onAddressDeleted:b,onPhoneAdded:C,onPhoneUpdated:x,onPhoneDeleted:N,onFileUploaded:m,onFileUpdated:y,onFileDeleted:v,onProfilePictureChanged:p,showBackground:f=!1,allowProfileEdit:M=!0,allowAddressEdit:$=!0,allowPhoneEdit:J=!0,allowFileUpload:U=!0,changePasswordHref:E,devicesHref:Z,onChangePassword:B,onViewDevices:Q}){let S=$r,O=ii(null),A=ii(null),ee=ii(null),_=ai(),[H,T]=un(null),[ie,q]=un(null),[ce,oe]=un(!1),[Ze,$e]=un(!1),Ce=ii(null),[fe,xe]=un({}),[Oe,Le]=un({}),[ve,R]=un({}),de=hm(()=>{e.start({payload:void 0,onAfterHandle:(W)=>{let V=W.data;if(!V?.user?.id)return;let{user:Ne,profile:ze,addresses:Me,phones:gr,files:br,roles:Xt}=V;_.setUser(Ne),_.setProfile(ze),_.setAddresses(Me),_.setPhones(gr),_.setFiles(br),_.setRoles(Xt||[]);let Nr=br.filter((ar)=>ar.type==="profile_picture"),Vr=Nr.length>0?Nr.sort((ar,Ye)=>new Date(Ye.updatedAt).getTime()-new Date(ar.updatedAt).getTime())[0]:null;if(_.setProfilePicture(Vr||null),ze)xe({firstName:ze.firstName,lastName:ze.lastName})}})});fm(()=>{de()},[]),Wc(()=>{if(!A.current)return;Ic.fromTo(A.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:O});let te=()=>{if(!_.user?.id)return;let W=!!_.profile?.id,V=_.profile,Ne={...V,...fe};if(_.setProfile(Ne),_.setEditingProfile(!1),W&&V?.id)r.start({payload:{id:V.id,...fe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.setProfile(Me),k?.(Me)},onErrorHandle:()=>{_.setProfile(V)}});else t.start({payload:{userId:_.user.id,...fe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.setProfile(Me),k?.(Me)},onErrorHandle:()=>{_.setProfile(V)}})},ye=()=>{if(!_.user?.id)return;let W=`temp-${Date.now()}`,V={id:W,...Oe,ownerType:"user",ownerId:_.user.id,name:Oe.name||"New Address"};_.addAddress(V),oe(!1),Le({}),n.start({payload:{...Oe,ownerType:"user",ownerId:_.user.id,name:Oe.name||"New Address"},onAfterHandle:(Ne)=>{let ze=Ne.data;if(ze)_.removeAddress(W),_.addAddress(ze),u?.(ze)},onErrorHandle:()=>{_.removeAddress(W)}})},D=()=>{if(!H?.id)return;let W=H.id,V=_.addresses.find((ze)=>ze.id===W),Ne={...V,...Oe,id:W};_.updateAddress(Ne),T(null),oe(!1),Le({}),a.start({payload:{id:W,...Oe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.updateAddress(Me),z?.(Me)},onErrorHandle:()=>{if(V)_.updateAddress(V)}})},j=(W)=>{i.start({payload:{id:W},onAfterHandle:()=>{_.removeAddress(W),b?.(W)}})},re=()=>{if(!_.user?.id)return;let W=`temp-${Date.now()}`,V={id:W,...ve,ownerType:"user",ownerId:_.user.id,name:ve.name||"New Phone",number:ve.number||"",countryCode:ve.countryCode||"+1"};_.addPhone(V),$e(!1),R({}),o.start({payload:{...ve,ownerType:"user",ownerId:_.user.id,name:ve.name||"New Phone",number:ve.number||"",countryCode:ve.countryCode||"+1"},onAfterHandle:(Ne)=>{let ze=Ne.data;if(ze)_.removePhone(W),_.addPhone(ze),C?.(ze)},onErrorHandle:()=>{_.removePhone(W)}})},Ke=()=>{if(!ie?.id)return;let W=ie.id,V=_.phones.find((ze)=>ze.id===W),Ne={...V,...ve,id:W};_.updatePhone(Ne),q(null),$e(!1),R({}),s.start({payload:{id:W,...ve},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.updatePhone(Me),x?.(Me)},onErrorHandle:()=>{if(V)_.updatePhone(V)}})},I=(W)=>{l.start({payload:{id:W},onAfterHandle:()=>{_.removePhone(W),N?.(W)}})},ue=(W)=>{let V=W.target.files?.[0];if(!V||!c)return;let Ne=new FormData;Ne.append("files",V),Ne.append("data",JSON.stringify({type:"profile_picture"})),c.start({payload:Ne,onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.addFile(Me),m?.(Me),p?.(Me)}})},We=(W)=>{if(!d)return;let V=_.files.find((ze)=>ze.id===W.id),Ne={...W,type:"profile_picture"};_.updateFile(Ne),d.start({payload:{id:W.id,type:"profile_picture"},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)_.updateFile(Me),y?.(Me),p?.(Me)},onErrorHandle:()=>{if(V)_.updateFile(V)}})},Ue=(W)=>{if(!g)return;g.start({payload:{id:W},onAfterHandle:()=>{_.removeFile(W),v?.(W)}})},gt=(W)=>`${h}/${W.id}`,Ge=(W)=>{return["image","profile_picture"].includes(W.type||"")||W.mimeType?.startsWith("image/")},Qt=(W)=>{T(W),Le({name:W.name,street:W.street,city:W.city,state:W.state,zip:W.zip,country:W.country}),oe(!0)},$t=(W)=>{q(W),R({name:W.name,number:W.number,countryCode:W.countryCode,type:W.type,extension:W.extension}),$e(!0)},zr=()=>{T(null),Le({}),oe(!0)},ne=()=>{q(null),R({}),$e(!0)};return L("main",{ref:O,className:w(S.container.base),"aria-label":"Profile page",children:[f&&L(xt,{},void 0,!1,void 0,this),L("div",{className:S.container.wrapper,children:L("article",{ref:A,className:w(S.card.base,S.card.padding,S.card.background,S.card.border,S.card.shadow,S.card.rounded),children:e.state.isPending?L("div",{className:S.loading.container,children:[L("div",{className:S.loading.spinner},void 0,!1,void 0,this),L("p",{className:S.loading.text,children:"Loading profile..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L(ym,{children:[L(ni,{user:_.user||void 0,profile:_.profile||void 0,profilePicture:_.profilePicture||void 0,fileProxyBasePath:h,onUploadPicture:U&&c?()=>ee.current?.click():void 0,isUploading:c?.state.isPending},void 0,!1,void 0,this),L("input",{ref:ee,type:"file",accept:"image/*",className:"hidden",onChange:ue},void 0,!1,void 0,this),L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:[L("h2",{className:S.section.title,children:"Profile Information"},void 0,!1,void 0,this),M&&!_.isEditingProfile&&L("button",{type:"button",onClick:()=>_.setEditingProfile(!0),className:S.section.addButton,children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.isEditingProfile?L("div",{className:S.profileForm.container,children:[L("div",{className:S.profileForm.grid,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"firstName",className:S.profileForm.field.label,children:"First Name"},void 0,!1,void 0,this),L("input",{id:"firstName",type:"text",value:fe.firstName||"",onChange:(W)=>xe((V)=>({...V,firstName:W.target.value})),className:S.profileForm.field.input,placeholder:"Enter first name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"lastName",className:S.profileForm.field.label,children:"Last Name"},void 0,!1,void 0,this),L("input",{id:"lastName",type:"text",value:fe.lastName||"",onChange:(W)=>xe((V)=>({...V,lastName:W.target.value})),className:S.profileForm.field.input,placeholder:"Enter last name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>_.setEditingProfile(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:te,disabled:r.state.isPending||t.state.isPending,children:r.state.isPending||t.state.isPending?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):L("div",{className:S.profileForm.grid,children:[L("div",{children:[L("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"First Name"},void 0,!1,void 0,this),L("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:_.profile?.firstName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{children:[L("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Last Name"},void 0,!1,void 0,this),L("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:_.profile?.lastName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:[L("h2",{className:S.section.title,children:"Addresses"},void 0,!1,void 0,this),$&&L("button",{type:"button",onClick:zr,className:S.section.addButton,children:"+ Add Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.addresses.length===0?L("div",{className:S.section.empty.container,children:[L("svg",{className:S.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No addresses"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:S.section.empty.text,children:"No addresses added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:S.section.content,children:_.addresses.map((W)=>L(ti,{address:W,onEdit:Qt,onDelete:j,isUpdating:a.state.isPending,isDeleting:i.state.isPending,allowEdit:$},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:[L("h2",{className:S.section.title,children:"Phone Numbers"},void 0,!1,void 0,this),J&&L("button",{type:"button",onClick:ne,className:S.section.addButton,children:"+ Add Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.phones.length===0?L("div",{className:S.section.empty.container,children:[L("svg",{className:S.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No phones"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:S.section.empty.text,children:"No phone numbers added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:S.section.content,children:_.phones.map((W)=>L(ri,{phone:W,onEdit:$t,onDelete:I,isUpdating:s.state.isPending,isDeleting:l.state.isPending,allowEdit:J},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:[L("h2",{className:S.section.title,children:"My Files"},void 0,!1,void 0,this),U&&c&&L("button",{type:"button",onClick:()=>ee.current?.click(),className:S.section.addButton,children:"+ Upload File"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.files.length===0?L("div",{className:S.section.empty.container,children:[L("svg",{className:S.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No files"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:S.section.empty.text,children:"No files uploaded yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 sm:gap-4",children:_.files.map((W)=>L("div",{className:w("group relative rounded-lg overflow-hidden border border-zinc-200 dark:border-zinc-700","hover:border-zinc-300 dark:hover:border-zinc-600 transition-all",W.type==="profile_picture"&&"ring-2 ring-blue-500"),children:[Ge(W)?L("img",{src:gt(W),alt:W.originalName||W.name,className:"w-full aspect-square object-cover"},void 0,!1,void 0,this):L("div",{className:"w-full aspect-square bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:L("svg",{className:"w-8 h-8 text-zinc-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"File"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all flex items-center justify-center opacity-0 group-hover:opacity-100",children:L("div",{className:"flex gap-1",children:[Ge(W)&&_.profilePicture?.id!==W.id&&d&&L("button",{type:"button",onClick:()=>We(W),disabled:d.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-zinc-100 dark:hover:bg-zinc-700 transition-colors",title:"Set as profile picture",children:L("svg",{className:"w-4 h-4 text-blue-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[L("title",{children:"Set as profile"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),g&&L("button",{type:"button",onClick:()=>Ue(W.id),disabled:g.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors",title:"Delete file",children:L("svg",{className:"w-4 h-4 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[L("title",{children:"Delete"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.type==="profile_picture"&&L("div",{className:"absolute top-1 left-1 px-1.5 py-0.5 bg-blue-500 text-white text-xs rounded-full",children:"Profile"},void 0,!1,void 0,this),L("div",{className:"p-2 bg-white dark:bg-zinc-800",children:L("p",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate",children:W.originalName||W.name},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.roles.length>0&&L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:L("h2",{className:S.section.title,children:"My Roles"},void 0,!1,void 0,this)},void 0,!1,void 0,this),L("div",{className:"flex flex-wrap gap-2",children:_.roles.map((W)=>L("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800",children:[L("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.name]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(E||B||Z||Q)&&L("section",{className:S.section.container,children:[L("div",{className:S.section.titleWrapper,children:L("h2",{className:S.section.title,children:"Account Settings"},void 0,!1,void 0,this)},void 0,!1,void 0,this),L("div",{className:S.accountSettings.container,children:[(E||B)&&L("button",{type:"button",onClick:()=>{if(B)B();else if(E)window.location.href=E},className:S.accountSettings.item,children:[L("div",{className:S.accountSettings.content,children:[L("div",{className:w(S.accountSettings.iconWrapper,"bg-blue-100 dark:bg-blue-900/30"),children:L("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Change Password"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{children:[L("p",{className:S.accountSettings.title,children:"Change Password"},void 0,!1,void 0,this),L("p",{className:S.accountSettings.description,children:"Update your account password"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("svg",{className:S.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Go"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(Z||Q)&&L("button",{type:"button",onClick:()=>{if(Q)Q();else if(Z)window.location.href=Z},className:S.accountSettings.item,children:[L("div",{className:S.accountSettings.content,children:[L("div",{className:w(S.accountSettings.iconWrapper,"bg-green-100 dark:bg-green-900/30"),children:L("svg",{className:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Devices"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{children:[L("p",{className:S.accountSettings.title,children:"Active Sessions"},void 0,!1,void 0,this),L("p",{className:S.accountSettings.description,children:"Manage your logged-in devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("svg",{className:S.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Go"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ce&&L("div",{className:S.modal.overlay,onMouseDown:(W)=>{Ce.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Ce.current===W.target)oe(!1)},onKeyDown:(W)=>W.key==="Escape"&&oe(!1),role:"dialog","aria-modal":"true",children:L("div",{className:S.modal.container,role:"document",children:[L("h2",{className:S.modal.title,children:H?"Edit Address":"Add Address"},void 0,!1,void 0,this),L("div",{className:S.modal.form,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"addressName",className:S.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),L("input",{id:"addressName",type:"text",value:Oe.name||"",onChange:(W)=>Le((V)=>({...V,name:W.target.value})),className:S.profileForm.field.input,placeholder:"e.g., Home, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"street",className:S.profileForm.field.label,children:"Street"},void 0,!1,void 0,this),L("input",{id:"street",type:"text",value:Oe.street||"",onChange:(W)=>Le((V)=>({...V,street:W.target.value})),className:S.profileForm.field.input,placeholder:"Street address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.grid,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"city",className:S.profileForm.field.label,children:"City"},void 0,!1,void 0,this),L("input",{id:"city",type:"text",value:Oe.city||"",onChange:(W)=>Le((V)=>({...V,city:W.target.value})),className:S.profileForm.field.input,placeholder:"City"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"state",className:S.profileForm.field.label,children:"State/Province"},void 0,!1,void 0,this),L("input",{id:"state",type:"text",value:Oe.state||"",onChange:(W)=>Le((V)=>({...V,state:W.target.value})),className:S.profileForm.field.input,placeholder:"State"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.grid,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"zip",className:S.profileForm.field.label,children:"ZIP Code"},void 0,!1,void 0,this),L("input",{id:"zip",type:"text",value:Oe.zip||"",onChange:(W)=>Le((V)=>({...V,zip:W.target.value})),className:S.profileForm.field.input,placeholder:"ZIP"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"country",className:S.profileForm.field.label,children:"Country"},void 0,!1,void 0,this),L("input",{id:"country",type:"text",value:Oe.country||"",onChange:(W)=>Le((V)=>({...V,country:W.target.value})),className:S.profileForm.field.input,placeholder:"Country"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.modal.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>oe(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:H?D:ye,disabled:n.state.isPending||a.state.isPending,children:n.state.isPending||a.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ze&&L("div",{className:S.modal.overlay,onMouseDown:(W)=>{Ce.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Ce.current===W.target)$e(!1)},onKeyDown:(W)=>W.key==="Escape"&&$e(!1),role:"dialog","aria-modal":"true",children:L("div",{className:S.modal.container,role:"document",children:[L("h2",{className:S.modal.title,children:ie?"Edit Phone":"Add Phone"},void 0,!1,void 0,this),L("div",{className:S.modal.form,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"phoneName",className:S.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),L("input",{id:"phoneName",type:"text",value:ve.name||"",onChange:(W)=>R((V)=>({...V,name:W.target.value})),className:S.profileForm.field.input,placeholder:"e.g., Mobile, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"phoneType",className:S.profileForm.field.label,children:"Type"},void 0,!1,void 0,this),L("select",{id:"phoneType",value:ve.type||"",onChange:(W)=>{let V=W.target.value;R((Ne)=>({...Ne,type:V||void 0}))},className:S.profileForm.field.input,children:[L("option",{value:"",children:"Select type"},void 0,!1,void 0,this),L("option",{value:"mobile",children:"Mobile"},void 0,!1,void 0,this),L("option",{value:"office",children:"Office"},void 0,!1,void 0,this),L("option",{value:"fax",children:"Fax"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.grid,children:[L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"countryCode",className:S.profileForm.field.label,children:"Country Code"},void 0,!1,void 0,this),L("input",{id:"countryCode",type:"text",value:ve.countryCode||"+1",onChange:(W)=>R((V)=>({...V,countryCode:W.target.value})),className:S.profileForm.field.input,placeholder:"+1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"phoneNumber",className:S.profileForm.field.label,children:"Number"},void 0,!1,void 0,this),L("input",{id:"phoneNumber",type:"tel",value:ve.number||"",onChange:(W)=>R((V)=>({...V,number:W.target.value})),className:S.profileForm.field.input,placeholder:"Phone number"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.profileForm.field.container,children:[L("label",{htmlFor:"extension",className:S.profileForm.field.label,children:"Extension (optional)"},void 0,!1,void 0,this),L("input",{id:"extension",type:"text",value:ve.extension||"",onChange:(W)=>R((V)=>({...V,extension:W.target.value})),className:S.profileForm.field.input,placeholder:"Extension"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:S.modal.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>$e(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:ie?Ke:re,disabled:o.state.isPending||s.state.isPending,children:o.state.isPending||s.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var _r={container:{base:"relative min-h-screen w-full flex items-center justify-center py-8 sm:py-12",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4",row:"grid grid-cols-1 sm:grid-cols-2 gap-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-start",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer leading-tight"},links:{container:"flex items-center justify-between mt-1",terms:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signIn:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},passwordStrength:{container:"mt-2",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-300",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-lime-500",veryStrong:"bg-green-500"},inactive:"bg-zinc-200 dark:bg-zinc-700"},requirements:{container:"mt-3 space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-500",unmet:"text-zinc-300 dark:text-zinc-600"}}},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as cr}from"react/jsx-dev-runtime";var wm=()=>cr("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:cr("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),km=()=>cr("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:cr("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function oi({strength:e,showRequirements:t=!0,passwordMinLength:r=8,requireUppercase:n=!0,requireLowercase:a=!0,requireNumber:i=!0,requireSpecialChar:o=!0}){let s=_r.passwordStrength,l=(d)=>{if(d>=e.score)return s.bar.inactive;if(e.score===1)return s.bar.active.weak;if(e.score===2)return s.bar.active.fair;if(e.score===3)return s.bar.active.good;if(e.score===4)return s.bar.active.strong;return s.bar.active.veryStrong},c=[{key:"minLength",label:`At least ${r} characters`,met:e.hasMinLength,show:!0},{key:"uppercase",label:"One uppercase letter",met:e.hasUppercase,show:n},{key:"lowercase",label:"One lowercase letter",met:e.hasLowercase,show:a},{key:"number",label:"One number",met:e.hasNumber,show:i},{key:"special",label:"One special character",met:e.hasSpecialChar,show:o}].filter((d)=>d.show);return cr("div",{className:s.container,children:[cr("div",{className:s.bar.wrapper,role:"progressbar","aria-valuenow":e.score,"aria-valuemin":0,"aria-valuemax":5,"aria-label":"Password strength",children:[0,1,2,3,4].map((d)=>cr("div",{className:w(s.bar.segment,l(d))},d,!1,void 0,this))},void 0,!1,void 0,this),t&&cr("ul",{className:s.requirements.container,"aria-label":"Password requirements",children:c.map((d)=>cr("li",{className:w(s.requirements.item,d.met?s.requirements.met:s.requirements.unmet),children:[cr("span",{className:d.met?s.requirements.icon.met:s.requirements.icon.unmet,children:d.met?cr(wm,{},void 0,!1,void 0,this):cr(km,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),cr("span",{children:d.label},void 0,!1,void 0,this)]},d.key,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as $c}from"@gsap/react";import Eo from"gsap";import{useRef as Sm}from"react";import{batch as vm,createStore as xm}from"h-state";var zm=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},Nm={email:"",password:"",confirmPassword:"",firstName:"",lastName:"",acceptTerms:!1,isLoading:!1,error:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:li}=xm(Nm,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t,r=8)=>{if(e.password=t,e.passwordStrength=zm(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setFirstName:(e)=>(t)=>{if(e.firstName=t,e.error)e.error=null},setLastName:(e)=>(t)=>{if(e.lastName=t,e.error)e.error=null},setAcceptTerms:(e)=>(t)=>{if(e.acceptTerms=t,e.error)e.error=null},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{vm(()=>{e.email="",e.password="",e.confirmPassword="",e.firstName="",e.lastName="",e.acceptTerms=!1,e.isLoading=!1,e.error=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as ct,Fragment as Pm}from"react/jsx-dev-runtime";Eo.registerPlugin($c);function Do({registerAction:e,showFirstName:t=!1,showLastName:r=!1,showTerms:n=!0,showSignIn:a=!0,termsHref:i,privacyHref:o,signInHref:s,onTermsClick:l,onPrivacyClick:c,onSignIn:d,onSuccess:g,passwordMinLength:h=8,requireUppercase:k=!0,requireLowercase:u=!0,requireNumber:z=!0,requireSpecialChar:b=!1,createProfileOnRegister:C=!1}){let x=_r,N=Sm(null),m=li(),{contextSafe:y}=$c({scope:N}),v=e.state.isPending,p=()=>{if(!m.email)return"Email is required";if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m.email))return"Please enter a valid email address";if(!m.password)return"Password is required";if(m.password.length<h)return`Password must be at least ${h} characters`;if(k&&!m.passwordStrength.hasUppercase)return"Password must contain at least one uppercase letter";if(u&&!m.passwordStrength.hasLowercase)return"Password must contain at least one lowercase letter";if(z&&!m.passwordStrength.hasNumber)return"Password must contain at least one number";if(b&&!m.passwordStrength.hasSpecialChar)return"Password must contain at least one special character";if(!m.confirmPassword)return"Please confirm your password";if(m.password!==m.confirmPassword)return"Passwords do not match";if(n&&!m.acceptTerms)return"You must accept the terms and conditions";return null},f=y((E)=>{E.preventDefault();let Z=p();if(Z){m.setError(Z),M();return}m.setError(null),e.start({payload:{email:m.email,password:m.password,...t&&m.firstName?{firstName:m.firstName}:{},...r&&m.lastName?{lastName:m.lastName}:{},...C?{createProfile:!0}:{}},onAfterHandle:()=>{m.reset(),g?.()},onErrorHandle:(B)=>{let Q="Registration failed. Please try again.";if(B&&typeof B==="object"){if("message"in B&&typeof B.message==="string")try{let S=JSON.parse(B.message);Q=S.message||S.error||B.message}catch{Q=B.message}else if("error"in B&&typeof B.error==="string")Q=B.error}else if(B instanceof Error)Q=B.message;m.setError(Q),M()}})}),M=y(()=>{if(!N.current)return;Eo.fromTo(N.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Eo.set(N.current,{x:0})}})}),$=()=>{if(l)l();else if(i)window.location.href=i},J=()=>{if(c)c();else if(o)window.location.href=o},U=()=>{if(d)d();else if(s)window.location.href=s};return ct("form",{ref:N,onSubmit:f,className:x.form.container,noValidate:!0,children:[m.error&&ct("div",{className:x.error.container,role:"alert",children:ct("p",{className:x.error.text,children:m.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:x.form.spacing,children:[(t||r)&&ct("div",{className:x.form.row,children:[t&&ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"text",label:"First Name",placeholder:"John",value:m.firstName,onChange:m.setFirstName,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"text",label:"Last Name",placeholder:"Doe",value:m.lastName,onChange:m.setLastName,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:m.email,onChange:m.setEmail,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:x.input.wrapper,children:[ct(Ee,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:m.password,onChange:(E)=>m.setPassword(E,h),disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this),m.password&&ct(oi,{strength:m.passwordStrength,passwordMinLength:h,requireUppercase:k,requireLowercase:u,requireNumber:z,requireSpecialChar:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:m.confirmPassword,onChange:m.setConfirmPassword,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),n&&ct("div",{className:x.checkbox.wrapper,children:[ct(hr,{checked:m.acceptTerms,onChange:m.setAcceptTerms,disabled:v,size:"sm"},void 0,!1,void 0,this),ct("span",{className:x.checkbox.label,children:["I agree to the"," ",ct("button",{type:"button",onClick:$,className:x.links.terms,children:"Terms of Service"},void 0,!1,void 0,this),(o||c)&&ct(Pm,{children:[" ","and"," ",ct("button",{type:"button",onClick:J,className:x.links.terms,children:"Privacy Policy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.button.wrapper,children:ct(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:v,disabled:v,children:"Create Account"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&ct("div",{className:x.links.signIn.wrapper,children:ct("span",{className:x.links.signIn.text,children:["Already have an account?"," ",ct("button",{type:"button",onClick:U,className:x.links.signIn.link,disabled:v,children:"Sign in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as si}from"react/jsx-dev-runtime";function Vo({logo:e,title:t="Create Account",subtitle:r="Sign up to get started"}){let n=_r;return si("header",{className:n.header.container,children:[e&&si("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),si("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),r&&si("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Fc}from"@gsap/react";import qc from"gsap";import{useRef as _c}from"react";import{jsxDEV as Rn}from"react/jsx-dev-runtime";qc.registerPlugin(Fc);function Oc({variant:e="default",logo:t,title:r="Create Account",subtitle:n="Sign up to get started with your account",showFirstName:a,showLastName:i,showTerms:o=!0,showSignIn:s=!0,termsHref:l,privacyHref:c,signInHref:d,registerAction:g,onTermsClick:h,onPrivacyClick:k,onSignIn:u,onSuccess:z,showBackground:b=!0,className:C,passwordMinLength:x,requireUppercase:N,requireLowercase:m,requireNumber:y,requireSpecialChar:v,config:p}){let f=p?.register?.showFirstName??a??!1,M=p?.register?.showLastName??i??!1,$=p?.register?.termsUrl??l,J=p?.register?.privacyUrl??c,U=p?.passwordPolicy?.minLength??x??8,E=p?.passwordPolicy?.requireUppercase??N??!0,Z=p?.passwordPolicy?.requireLowercase??m??!0,B=p?.passwordPolicy?.requireNumber??y??!0,Q=p?.passwordPolicy?.requireSpecialChar??v??!1,S=p?.register?.createProfileOnRegister??(f||M),O=_r,A=_c(null),ee=_c(null);return Fc(()=>{if(!ee.current)return;qc.fromTo(ee.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:A}),Rn("main",{ref:A,className:w(O.container.base,C),"aria-label":"Registration page",children:[b&&Rn(xt,{},void 0,!1,void 0,this),Rn("div",{className:O.container.wrapper,children:Rn("article",{ref:ee,className:w(O.card.base,O.card.padding,O.card.background,O.card.border,O.card.shadow,O.card.rounded),children:[Rn(Vo,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),Rn(Do,{registerAction:g,showFirstName:f,showLastName:M,showTerms:o,showSignIn:s,termsHref:$,privacyHref:J,signInHref:d,onTermsClick:h,onPrivacyClick:k,onSignIn:u,onSuccess:z,passwordMinLength:U,requireUppercase:E,requireLowercase:Z,requireNumber:B,requireSpecialChar:Q,createProfileOnRegister:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as jo}from"@gsap/react";import ci from"gsap";import{useMemo as Mm,useRef as Jc}from"react";var Bn={minLength:8,maxLength:128,requireUppercase:!0,requireLowercase:!0,requireNumber:!0,requireSpecialChar:!1,specialChars:"!@#$%^&*()_+-=[]{}|;:,.<>?",preventCommonPasswords:!0,preventUserInfoInPassword:!0,showStrengthIndicator:!0};import{batch as Cm,createStore as Tm}from"h-state";var Lm={newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:di}=Tm(Lm,{setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Cm(()=>{e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var gn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"},requirements:{container:"mt-3 p-3 rounded-lg bg-zinc-50 dark:bg-zinc-800/50",title:"text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-2",list:"space-y-1",item:"text-xs flex items-center gap-2",itemValid:"text-green-600 dark:text-green-400",itemInvalid:"text-zinc-400 dark:text-zinc-500"}};import{jsxDEV as Ae}from"react/jsx-dev-runtime";ci.registerPlugin(jo);function Gc({className:e}){return Ae("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Rm({className:e}){return Ae("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Bm({className:e}){return Ae("svg",{className:w("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Wm({className:e}){return Ae("svg",{className:w("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function el({token:e,resetPasswordAction:t,onBackToLogin:r,backToLoginHref:n,passwordPolicy:a={}}){let i=gn,o=Jc(null),s=Jc(null),l=di(),c={...Bn,...a},d=Mm(()=>{let b=[{key:"length",label:`At least ${c.minLength} characters`,test:(C)=>C.length>=c.minLength}];if(c.requireUppercase)b.push({key:"uppercase",label:"One uppercase letter",test:(C)=>/[A-Z]/.test(C)});if(c.requireLowercase)b.push({key:"lowercase",label:"One lowercase letter",test:(C)=>/[a-z]/.test(C)});if(c.requireNumber)b.push({key:"number",label:"One number",test:(C)=>/\d/.test(C)});if(c.requireSpecialChar)b.push({key:"special",label:"One special character",test:(C)=>{let x=c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(`[${x}]`).test(C)}});return b},[c.minLength,c.requireUppercase,c.requireLowercase,c.requireNumber,c.requireSpecialChar,c.specialChars]),{contextSafe:g}=jo({scope:o}),h=t.state.isPending,k=g((b)=>{if(b.preventDefault(),!l.newPassword||!l.confirmPassword){l.setError("Please fill in all fields"),u();return}if(l.newPassword!==l.confirmPassword){l.setError("Passwords do not match"),u();return}if(!d.every((x)=>x.test(l.newPassword))){l.setError("Password does not meet all requirements"),u();return}l.setError(null),t.start({payload:{token:e,newPassword:l.newPassword,confirmPassword:l.confirmPassword},onAfterHandle:()=>{l.setStep("success")},onErrorHandle:(x)=>{let N=x instanceof Error?x.message:"Failed to reset password. Please try again.";l.setError(N),u()}})}),u=g(()=>{if(!o.current)return;ci.fromTo(o.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{ci.set(o.current,{x:0})}})});jo(()=>{if(l.step==="success"&&s.current)ci.fromTo(s.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[l.step]});let z=()=>{if(r)r();else if(n)window.location.href=n};if(l.step==="success")return Ae("div",{ref:s,className:i.success.container,children:[Ae("div",{className:i.success.iconWrapper,children:Ae(Rm,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ae("h2",{className:i.success.title,children:"Password Reset Successful"},void 0,!1,void 0,this),Ae("p",{className:i.success.message,children:"Your password has been successfully reset. You can now log in with your new password."},void 0,!1,void 0,this),Ae("div",{className:i.links.container,children:Ae("button",{type:"button",onClick:z,className:i.links.backToLogin,children:[Ae(Gc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ae("form",{ref:o,onSubmit:k,className:i.form.container,noValidate:!0,children:[l.error&&Ae("div",{className:i.error.container,role:"alert",children:Ae("p",{className:i.error.text,children:l.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ae("div",{className:i.form.spacing,children:[Ae("div",{className:i.input.wrapper,children:Ae(Ee,{type:"password",label:"New Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.newPassword,onChange:l.setNewPassword,disabled:h,enableValidation:!1,isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ae("div",{className:i.input.wrapper,children:Ae(Ee,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.confirmPassword,onChange:l.setConfirmPassword,disabled:h,enableValidation:!1,isNewPassword:!0,confirmValue:l.newPassword,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),l.newPassword&&Ae("div",{className:i.requirements.container,children:[Ae("p",{className:i.requirements.title,children:"Password requirements:"},void 0,!1,void 0,this),Ae("ul",{className:i.requirements.list,children:d.map((b)=>{let C=b.test(l.newPassword);return Ae("li",{className:w(i.requirements.item,C?i.requirements.itemValid:i.requirements.itemInvalid),children:[C?Ae(Bm,{},void 0,!1,void 0,this):Ae(Wm,{},void 0,!1,void 0,this),b.label]},b.key,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ae("div",{className:i.button.wrapper,children:Ae(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:h,disabled:h,children:"Reset Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ae("div",{className:i.links.container,children:Ae("button",{type:"button",onClick:z,className:i.links.backToLogin,disabled:h,children:[Ae(Gc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Xr}from"react/jsx-dev-runtime";function Im({className:e}){return Xr("svg",{className:w("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Xr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function tl({logo:e,title:t,subtitle:r}){let n=gn;return Xr("header",{className:n.header.container,children:[e?Xr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):Xr("div",{className:n.header.iconWrapper,children:Xr(Im,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Xr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),Xr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ac}from"@gsap/react";import Kc from"gsap";import{useRef as Yc}from"react";import{jsxDEV as Wn}from"react/jsx-dev-runtime";Kc.registerPlugin(Ac);function Zc({logo:e,title:t="Reset Password",subtitle:r="Enter your new password below.",token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,showBackground:s=!0,className:l,passwordPolicy:c}){let d=gn,g=Yc(null),h=Yc(null);return Ac(()=>{if(!h.current)return;Kc.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g}),Wn("main",{ref:g,className:w(d.container.base,l),"aria-label":"Reset password page",children:[s&&Wn(xt,{},void 0,!1,void 0,this),Wn("div",{className:d.container.wrapper,children:Wn("article",{ref:h,className:w(d.card.base,d.card.padding,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:[Wn(tl,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Wn(el,{token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,passwordPolicy:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ur={container:{base:"min-h-screen flex items-center justify-center bg-gradient-to-br from-zinc-50 via-zinc-100 to-zinc-200 dark:from-zinc-900 dark:via-zinc-900 dark:to-zinc-800 px-4 sm:px-6 lg:px-8",wrapper:"w-full max-w-md relative z-10"},card:{base:"relative overflow-hidden",padding:"p-6 sm:p-8 lg:p-10",background:"bg-white dark:bg-zinc-800",border:"border border-zinc-200 dark:border-zinc-700",shadow:"shadow-xl",rounded:"rounded-2xl"},header:{wrapper:"text-center mb-6 sm:mb-8",logo:"mx-auto mb-4 sm:mb-6",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-2 sm:mb-3",subtitle:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400"},form:{wrapper:"space-y-4 sm:space-y-5",inputGroup:"space-y-1",label:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 sm:px-4 py-2 sm:py-3 border border-zinc-300 dark:border-zinc-600 rounded-xl bg-white dark:bg-zinc-700 text-zinc-900 dark:text-white placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",error:"text-sm text-red-500 dark:text-red-400 mt-1",submitButton:"w-full py-2.5 sm:py-3 px-4 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",backLink:"w-full mt-3 sm:mt-4 text-center",backLinkText:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"},alert:{error:"mb-4 p-3 sm:p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl text-red-600 dark:text-red-400 text-sm",success:"text-center"},states:{verifying:{wrapper:"text-center py-8",iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-6",spinner:"animate-spin rounded-full h-8 w-8 sm:h-10 sm:w-10 border-3 border-blue-600 border-t-transparent",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base"},error:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-red-500 dark:text-red-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 mb-2 text-sm sm:text-base",errorMessage:"text-red-500 dark:text-red-400 text-sm mb-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 rounded-lg",helpText:"text-zinc-500 dark:text-zinc-500 text-sm mb-8",buttonPrimary:"w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",buttonSecondary:"w-full py-3 px-4 bg-zinc-100 dark:bg-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-600 text-zinc-700 dark:text-zinc-300 font-medium rounded-xl transition-colors duration-200"},success:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-green-500 dark:text-green-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base mb-6",redirectSpinner:"animate-spin rounded-full h-4 w-4 border-2 border-zinc-400 border-t-transparent",redirectText:"text-zinc-500 dark:text-zinc-400 text-sm"}},footer:"text-center text-zinc-500 dark:text-zinc-500 text-xs mt-6",layout:{textCenter:"text-center",buttonGroup:"space-y-3",redirectWrapper:"flex items-center justify-center gap-2"},passwordStrength:{container:"mt-3 space-y-3",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-200",inactive:"bg-zinc-200 dark:bg-zinc-700",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-green-500",veryStrong:"bg-emerald-500"}},requirements:{container:"space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500"}}}};import{jsxDEV as o6}from"react/jsx-dev-runtime";import{batch as Hm,createStore as $m}from"h-state";var _m=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},Fm={newPassword:"",confirmPassword:"",step:"verifying",error:null,userId:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:In}=$m(Fm,{setNewPassword:(e)=>(t,r=8)=>{if(e.newPassword=t,e.passwordStrength=_m(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},setUserId:(e)=>(t)=>{e.userId=t},reset:(e)=>()=>{Hm(()=>{e.newPassword="",e.confirmPassword="",e.step="verifying",e.error=null,e.userId=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as Er}from"react/jsx-dev-runtime";function rl({passwordChangeAction:e,passwordSetAction:t,isInvite:r=!1,onSuccess:n,onBackToLogin:a,backToLoginHref:i,passwordPolicy:o={}}){let s=Ur,l=In(),c={...Bn,...o},d=r&&t?t:e,g=()=>{if(!l.newPassword)return"Password is required";if(l.newPassword.length<c.minLength)return`Password must be at least ${c.minLength} characters`;if(c.maxLength&&l.newPassword.length>c.maxLength)return`Password must be at most ${c.maxLength} characters`;if(c.requireUppercase&&!/[A-Z]/.test(l.newPassword))return"Password must contain at least one uppercase letter";if(c.requireLowercase&&!/[a-z]/.test(l.newPassword))return"Password must contain at least one lowercase letter";if(c.requireNumber&&!/[0-9]/.test(l.newPassword))return"Password must contain at least one number";if(c.requireSpecialChar){if(!new RegExp(`[${c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}]`).test(l.newPassword))return"Password must contain at least one special character"}if(!l.confirmPassword)return"Please confirm your password";if(l.newPassword!==l.confirmPassword)return"Passwords do not match";return null};return Er("form",{onSubmit:(k)=>{k.preventDefault();let u=g();if(u){l.setError(u);return}if(l.setError(null),!d){l.setError("No action configured");return}let z=()=>{if(l.setStep("success"),n)setTimeout(n,2000);else if(a)setTimeout(a,2000)},b=(C)=>{l.setError(C?.message||"Failed to set password")};if(r&&t&&l.userId)t.start({payload:{newPassword:l.newPassword,userId:l.userId},onAfterHandle:z,onErrorHandle:b});else if(e)e.start({payload:{currentPassword:"",newPassword:l.newPassword,confirmPassword:l.confirmPassword},onAfterHandle:z,onErrorHandle:b})},className:s.form.wrapper,children:[l.error&&Er("div",{className:s.alert.error,role:"alert",children:l.error},void 0,!1,void 0,this),Er(Ee,{type:"password",label:"New Password",value:l.newPassword,onChange:(k)=>l.setNewPassword(k,c.minLength),placeholder:"Enter your new password",isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,enableValidation:!1},void 0,!1,void 0,this),Er(Ee,{type:"password",label:"Confirm Password",value:l.confirmPassword,onChange:l.setConfirmPassword,placeholder:"Confirm your new password",isNewPassword:!0,confirmValue:l.newPassword,enableValidation:!1},void 0,!1,void 0,this),Er("button",{type:"submit",disabled:d?.state.isPending,className:s.form.submitButton,children:d?.state.isPending?"Setting Password...":"Set Password"},void 0,!1,void 0,this),Er("div",{className:s.form.backLink,children:i?Er("a",{href:i,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):a?Er("button",{type:"button",onClick:a,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as pi}from"react/jsx-dev-runtime";function nl({logo:e,title:t,subtitle:r}){let n=Ur;return pi("header",{className:n.header.wrapper,children:[e&&pi("div",{className:n.header.logo,children:e},void 0,!1,void 0,this),pi("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),pi("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Xc}from"@gsap/react";import Uc from"gsap";import{useEffect as qm,useEffectEvent as Om,useRef as Qc}from"react";import{jsxDEV as Pe}from"react/jsx-dev-runtime";Uc.registerPlugin(Xc);function Ec({logo:e,title:t="Set Password",subtitle:r="Enter your new password below.",inviteTitle:n="Set Your Password",inviteSubtitle:a="Welcome! Please set your password to complete your account setup.",token:i,isInvite:o=!1,magicLinkVerifyAction:s,passwordChangeAction:l,passwordSetAction:c,onBackToLogin:d,onSuccess:g,backToLoginHref:h,showBackground:k=!0,className:u,passwordPolicy:z}){let b=Ur,C=Qc(null),x=Qc(null),N=In(),m=Om((p)=>{if(!p){N.setStep("error"),N.setError("Invalid or missing token");return}s.start({payload:{token:p},onAfterHandle:(f)=>{let $=f?.data?.user?.id;if($)N.setUserId($);N.setStep("form")},onErrorHandle:(f)=>{N.setStep("error"),N.setError(f?.message||"Token verification failed")}})});qm(()=>{return m(i),()=>{N.reset()}},[i]),Xc(()=>{if(!x.current)return;Uc.fromTo(x.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:C});let y=o?n:t,v=o?a:r;if(N.step==="verifying")return Pe("main",{ref:C,className:w(b.container.base,u),children:[k&&Pe(xt,{},void 0,!1,void 0,this),Pe("div",{className:b.container.wrapper,children:Pe("article",{ref:x,className:w(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:Pe("div",{className:b.states.verifying.wrapper,children:[Pe("div",{className:b.states.verifying.iconWrapper,children:Pe("div",{className:b.states.verifying.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),Pe("h1",{className:b.states.verifying.title,children:"Verifying Invitation"},void 0,!1,void 0,this),Pe("p",{className:b.states.verifying.subtitle,children:"Please wait while we verify your invitation link..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(N.step==="error")return Pe("main",{ref:C,className:w(b.container.base,u),children:[k&&Pe(xt,{},void 0,!1,void 0,this),Pe("div",{className:b.container.wrapper,children:Pe("article",{ref:x,className:w(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:[Pe("div",{className:b.layout.textCenter,children:[Pe("div",{className:b.states.error.iconWrapper,children:Pe("svg",{className:b.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Pe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Pe("h1",{className:b.states.error.title,children:"Invalid Link"},void 0,!1,void 0,this),Pe("p",{className:b.states.error.subtitle,children:o?"This invitation link is invalid or has expired.":"This link is invalid or has expired."},void 0,!1,void 0,this),N.error&&N.error!=="Token verification failed"&&Pe("p",{className:b.states.error.errorMessage,children:N.error},void 0,!1,void 0,this),Pe("p",{className:b.states.error.helpText,children:o?"Please contact your administrator to request a new invitation.":"Please request a new link or contact support."},void 0,!1,void 0,this),Pe("div",{className:b.layout.buttonGroup,children:h?Pe("a",{href:h,className:b.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this):Pe("button",{type:"button",onClick:d,className:b.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Pe("p",{className:b.footer,children:"Need help? Contact your system administrator."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(N.step==="success")return Pe("main",{ref:C,className:w(b.container.base,u),children:[k&&Pe(xt,{},void 0,!1,void 0,this),Pe("div",{className:b.container.wrapper,children:Pe("article",{ref:x,className:w(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:Pe("div",{className:b.layout.textCenter,children:[Pe("div",{className:b.states.success.iconWrapper,children:Pe("svg",{className:b.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Pe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Pe("h1",{className:b.states.success.title,children:"Password Set Successfully!"},void 0,!1,void 0,this),Pe("p",{className:b.states.success.subtitle,children:"Your account is now ready. Redirecting you to login..."},void 0,!1,void 0,this),Pe("div",{className:b.layout.redirectWrapper,children:[Pe("div",{className:b.states.success.redirectSpinner},void 0,!1,void 0,this),Pe("span",{className:b.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Pe("main",{ref:C,className:w(b.container.base,u),"aria-label":"Set password page",children:[k&&Pe(xt,{},void 0,!1,void 0,this),Pe("div",{className:b.container.wrapper,children:Pe("article",{ref:x,className:w(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:[Pe(nl,{logo:e,title:y,subtitle:v},void 0,!1,void 0,this),Pe(rl,{passwordChangeAction:l,passwordSetAction:c,isInvite:o,onSuccess:g,onBackToLogin:d,backToLoginHref:h,passwordPolicy:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as e0}from"@gsap/react";import al from"gsap";import{useEffect as Dc,useRef as Vc,useState as jc}from"react";import{jsxDEV as Ve,Fragment as Jm}from"react/jsx-dev-runtime";al.registerPlugin(e0);function il({theme:e,isOpen:t,isLoading:r,onClose:n,onInvite:a}){let[i,o]=jc(""),[s,l]=jc(""),c=Vc(null),d=Vc(null);e0(()=>{if(!c.current||!d.current)return;if(t)al.fromTo(c.current,{opacity:0},{opacity:1,duration:0.2,ease:"power2.out"}),al.fromTo(d.current,{opacity:0,scale:0.95,y:20},{opacity:1,scale:1,y:0,duration:0.3,ease:"back.out(1.7)"})},{dependencies:[t]}),Dc(()=>{if(t)o(""),l("")},[t]),Dc(()=>{let u=(z)=>{if(z.key==="Escape"&&t&&!r)n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t,r,n]);let g=(u)=>{return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)},h=()=>{if(!i.trim()){l("Email is required");return}if(!g(i)){l("Please enter a valid email address");return}l(""),a(i.trim())},k=(u)=>{if(u.key==="Enter"&&!r)h()};if(!t)return null;return Ve(Jm,{children:[Ve("div",{ref:c,className:w(e.modal.overlay),onClick:()=>!r&&n(),"aria-hidden":"true"},void 0,!1,void 0,this),Ve("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:Ve("div",{ref:d,className:w(e.modal.wrapper),role:"dialog","aria-modal":"true","aria-labelledby":"invite-modal-title",children:[Ve("div",{className:w(e.modal.header.wrapper),children:[Ve("div",{className:"flex items-center gap-3",children:[Ve("div",{className:w(e.modal.header.icon),children:Ve("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ve("div",{children:[Ve("h2",{id:"invite-modal-title",className:w(e.modal.header.title),children:"Invite User"},void 0,!1,void 0,this),Ve("p",{className:w(e.modal.header.subtitle),children:"Send an invitation email to add a new user"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ve(se,{variant:"ghost",size:"sm",onClick:n,disabled:r,"aria-label":"Close modal",iconOnly:!0,children:Ve("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve("div",{className:w(e.modal.content),children:Ve("div",{className:"space-y-4",children:[Ve("div",{children:[Ve("label",{htmlFor:"invite-email",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email Address"},void 0,!1,void 0,this),Ve(Ee,{id:"invite-email",type:"email",value:i,onChange:o,onKeyDown:k,placeholder:"colleague@company.com",size:"md",disabled:r,errorMessage:s||void 0,leftIcon:Ve("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve("div",{className:w(e.modal.infoBox),children:[Ve("svg",{className:"w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ve("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"The user will receive an email with a secure link to set their password and complete registration."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ve("div",{className:w(e.modal.footer),children:[Ve(se,{variant:"outline",size:"md",onClick:n,disabled:r,children:"Cancel"},void 0,!1,void 0,this),Ve(se,{variant:"primary",size:"md",onClick:h,loading:r,leftIcon:Ve("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:"Send Invitation"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as nr}from"react/jsx-dev-runtime";function ol({theme:e,currentPage:t,totalPages:r,totalItems:n,pageSize:a,pageSizeOptions:i=[10,25,50,100],onPageChange:o,onPageSizeChange:s}){let l=(t-1)*a+1,c=Math.min(t*a,n),d=i.map((h)=>({value:String(h),label:`${h} / page`})),g=()=>{let h=[],k=5;if(r<=5)for(let u=1;u<=r;u++)h.push(u);else{if(h.push(1),t>3)h.push("ellipsis");let u=Math.max(2,t-1),z=Math.min(r-1,t+1);for(let b=u;b<=z;b++)h.push(b);if(t<r-2)h.push("ellipsis");if(r>1)h.push(r)}return h};if(n===0)return null;return nr("div",{className:w(e.pagination.wrapper),children:[nr("div",{className:w(e.pagination.info),children:[nr("span",{className:"hidden sm:inline",children:["Showing ",l,"-",c," of ",n," users"]},void 0,!0,void 0,this),nr("span",{className:"sm:hidden",children:[l,"-",c," / ",n]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),nr("div",{className:"flex items-center gap-3",children:[nr(dr,{options:d,value:String(a),onChange:(h)=>{if(h)s(Number(h))},size:"sm",className:"min-w-[100px]"},void 0,!1,void 0,this),nr("div",{className:w(e.pagination.controls.wrapper),children:[nr(se,{variant:"ghost",size:"sm",onClick:()=>o(t-1),disabled:t===1,"aria-label":"Previous page",iconOnly:!0,children:nr("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:nr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),g().map((h,k)=>h==="ellipsis"?nr("span",{className:"px-2 text-zinc-400 dark:text-zinc-600",children:"..."},`ellipsis-${k}`,!1,void 0,this):nr(se,{variant:h===t?"primary":"ghost",size:"sm",onClick:()=>o(h),children:h},h,!1,void 0,this)),nr(se,{variant:"ghost",size:"sm",onClick:()=>o(t+1),disabled:t===r,"aria-label":"Next page",iconOnly:!0,children:nr("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:nr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as t0}from"@gsap/react";import r0 from"gsap";import{useRef as Gm}from"react";import{jsxDEV as pr}from"react/jsx-dev-runtime";r0.registerPlugin(t0);function ll({theme:e,totalUsers:t,verifiedUsers:r,lockedUsers:n,unverifiedUsers:a}){let i=Gm(null);t0(()=>{if(!i.current)return;let s=i.current.querySelectorAll("[data-stat-card]");r0.fromTo(s,{opacity:0,y:20,scale:0.95},{opacity:1,y:0,scale:1,duration:0.4,stagger:0.08,ease:"back.out(1.7)"})},{scope:i});let o=[{label:"Total Users",value:t,iconColor:"primary",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Verified",value:r,iconColor:"success",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Unverified",value:a,iconColor:"warning",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Locked",value:n,iconColor:"danger",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}];return pr("div",{ref:i,className:w(e.stats.wrapper),children:o.map((s)=>pr("div",{"data-stat-card":!0,className:w(e.stats.card.base),children:[pr("div",{className:w(e.stats.card.icon.wrapper,e.stats.card.icon[s.iconColor]),children:s.icon},void 0,!1,void 0,this),pr("div",{className:w(e.stats.card.value),children:s.value},void 0,!1,void 0,this),pr("div",{className:w(e.stats.card.label),children:s.label},void 0,!1,void 0,this)]},s.label,!0,void 0,this))},void 0,!1,void 0,this)}import{useEffect as i0,useRef as Km,useState as Zm}from"react";import{useEffect as sl,useRef as Ym,useState as n0}from"react";import{createPortal as Am}from"react-dom";import{jsxDEV as ft}from"react/jsx-dev-runtime";function a0({isOpen:e,roles:t,userRoles:r,userId:n,onClose:a,onAssignRole:i,onRemoveRole:o}){let s=Ym(null),[l,c]=n0(""),[d,g]=n0(!1);if(sl(()=>{g(!0)},[]),sl(()=>{let C=(x)=>{if(x.key==="Escape"&&e)a()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,a]),sl(()=>{if(e)document.body.style.overflow="hidden",c("");else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[e]),!e||!d)return null;let h=r.filter((C)=>C.userId===n).map((C)=>C.roleId),k=t.filter((C)=>C.name.toLowerCase().includes(l.toLowerCase())),u=(C)=>{if(h.includes(C.id)){let N=r.find((m)=>m.userId===n&&m.roleId===C.id);if(N&&!N.id.startsWith("temp-")&&C.name!=="godmin")o(N.id)}else i(n,C.id)},z=(C)=>{if(C.name==="godmin")return!0;return r.find((N)=>N.userId===n&&N.roleId===C.id)?.id.startsWith("temp-")||!1},b=ft("div",{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:99999},children:[ft("div",{className:"fixed inset-0 bg-black/60",onClick:a,"aria-hidden":"true"},void 0,!1,void 0,this),ft("div",{ref:s,className:"relative bg-white dark:bg-zinc-900 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col border border-zinc-200 dark:border-zinc-700",children:[ft("div",{className:"flex items-center justify-between px-5 py-4 border-b border-zinc-200 dark:border-zinc-700",children:[ft("h3",{className:"text-base font-semibold text-zinc-900 dark:text-white",children:"Manage Roles"},void 0,!1,void 0,this),ft("button",{type:"button",onClick:a,className:"p-1 rounded-md text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors","aria-label":"Close",children:ft("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ft("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ft("div",{className:"px-5 py-3 border-b border-zinc-200 dark:border-zinc-700",children:ft("input",{type:"text",placeholder:"Search roles...",value:l,onChange:(C)=>c(C.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg outline-none focus:ring-2 focus:ring-blue-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"flex-1 overflow-y-auto px-3 py-2 min-h-[200px]",children:k.length===0?ft("div",{className:"text-center py-8 text-zinc-500 dark:text-zinc-400 text-sm",children:"No roles found"},void 0,!1,void 0,this):ft("div",{className:"space-y-1",children:k.map((C)=>{let x=h.includes(C.id),N=z(C);return ft("button",{type:"button",onClick:()=>!N&&u(C),disabled:N,className:w("w-full flex items-start gap-3 px-3 py-3 rounded-lg text-left transition-colors",N?"opacity-50 cursor-not-allowed":"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer",x&&!N&&"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30"),children:[ft("div",{className:w("w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-colors",x?"bg-blue-600 border-blue-600":"border-zinc-300 dark:border-zinc-600"),children:x&&ft("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ft("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"flex-1 min-w-0",children:[ft("div",{className:"flex items-center gap-2",children:[ft("span",{className:"font-medium text-sm text-zinc-900 dark:text-white",children:C.name},void 0,!1,void 0,this),C.name==="godmin"&&ft("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 font-medium",children:"Protected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C.description&&ft("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",children:C.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},C.id,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"px-5 py-3 border-t border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 rounded-b-xl",children:ft("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[h.length," role",h.length!==1?"s":""," assigned"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return Am(b,document.body)}import{jsxDEV as ae,Fragment as Qm}from"react/jsx-dev-runtime";function dl({theme:e,user:t,roles:r,allUserRoles:n,isOpen:a,actionLoading:i,onClose:o,onVerifyEmail:s,onLockAccount:l,onUnlockAccount:c,onResetPassword:d,onSendMagicLink:g,onResendInvite:h,onAssignRole:k,onRemoveRole:u,hasPasswordReset:z=!1,hasMagicLink:b=!1,hasInvite:C=!1}){let x=Km(null),[N,m]=Zm(!1);if(i0(()=>{let p=(f)=>{if(f.key==="Escape"&&a)o()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a,o]),i0(()=>{if(a)document.body.style.overflow="hidden";else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[a]),!t||!a)return null;let y=(p)=>{if(!p)return"Never";return(typeof p==="string"?new Date(p):p).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},v=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return(t.email??"").split("@")[0]};return ae(Qm,{children:[ae("div",{className:w(e.detailPanel.overlay),onClick:o,"aria-hidden":"true"},void 0,!1,void 0,this),ae("div",{ref:x,className:w(e.detailPanel.wrapper.base,"lg:relative",e.detailPanel.wrapper.mobile,"sm:rounded-t-2xl md:rounded-none","md:fixed md:inset-y-0 md:right-0 md:w-[400px] md:rounded-l-2xl","lg:static lg:w-full lg:rounded-xl"),children:[ae("div",{className:w(e.detailPanel.header.wrapper),children:[ae("div",{children:[ae("h2",{className:w(e.detailPanel.header.title),children:v()},void 0,!1,void 0,this),ae("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:t.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae(se,{variant:"ghost",size:"sm",onClick:o,"aria-label":"Close panel",iconOnly:!0,children:ae("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.wrapper),children:[ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:"Account Status"},void 0,!1,void 0,this),ae("div",{className:w(e.detailPanel.content.section.content),children:[ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Status"},void 0,!1,void 0,this),ae("span",{className:w("text-sm font-medium",t.isLocked?"text-red-600 dark:text-red-400":t.verifiedAt?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"),children:t.isLocked?"Locked":t.verifiedAt?"Active":"Unverified"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Last Login"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.lastLoginAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Login Count"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:t.loginCount||0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Created"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.isLocked&&t.lockedUntil&&ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Locked Until"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.lockedUntil)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t.profile&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:"Profile"},void 0,!1,void 0,this),ae("div",{className:w(e.detailPanel.content.section.content),children:ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Name"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:[t.profile.firstName," ",t.profile.lastName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.addresses&&t.addresses.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Addresses (",t.addresses.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:t.addresses.map((p)=>ae("div",{className:w(e.detailPanel.content.section.content),children:[ae("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:p.name||"Address"},void 0,!1,void 0,this),ae("div",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[p.street,p.city,p.state,p.zip,p.country].filter(Boolean).join(", ")},void 0,!1,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.phones&&t.phones.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Phones (",t.phones.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:t.phones.map((p)=>ae("div",{className:w(e.detailPanel.content.section.content,"flex justify-between items-center"),children:[ae("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:p.name||p.type||"Phone"},void 0,!1,void 0,this),ae("span",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:[p.countryCode," ",p.number]},void 0,!0,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.files&&t.files.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Files (",t.files.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:[t.files.slice(0,5).map((p)=>ae("div",{className:w(e.detailPanel.content.section.content,"flex justify-between items-center"),children:ae("div",{className:"min-w-0 flex-1",children:[ae("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:p.originalName||p.name},void 0,!1,void 0,this),ae("div",{className:"text-xs text-zinc-500",children:[p.mimeType," \u2022 ",Math.round((p.size||0)/1024),"KB"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},p.id,!1,void 0,this)),t.files.length>5&&ae("div",{className:"text-xs text-zinc-500 dark:text-zinc-400 text-center py-1",children:["+",t.files.length-5," more files"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("div",{className:"flex items-center justify-between mb-3",children:[ae("h3",{className:w(e.detailPanel.content.section.title,"mb-0"),children:"Roles"},void 0,!1,void 0,this),ae(se,{variant:"ghost",size:"xs",onClick:()=>m(!0),className:"text-blue-600 hover:text-blue-700 dark:text-blue-400",children:"Manage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:"flex flex-wrap gap-2",children:(()=>{let p=new Set,f=n.filter((M)=>M.userId===t.id).filter((M)=>{if(p.has(M.roleId))return!1;return p.add(M.roleId),!0});return f.length>0?f.map((M)=>{let $=r.find((U)=>U.id===M.roleId),J=M.id.startsWith("temp-");return ae("span",{className:w("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium",J?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500":"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"),children:[$?.name||"...",$?.name==="godmin"&&ae("svg",{className:"w-3 h-3 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:ae("path",{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M.id,!0,void 0,this)}):ae("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No roles assigned"},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae(a0,{isOpen:N,roles:r,userRoles:n,userId:t.id,onClose:()=>m(!1),onAssignRole:k,onRemoveRole:u},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.actions.wrapper),children:ae("div",{className:"grid grid-cols-2 gap-2",children:[!t.verifiedAt&&ae(se,{variant:"success",size:"sm",onClick:()=>s(t.id),loading:i===`verify-${t.id}`,fullWidth:!0,children:"Verify Email"},void 0,!1,void 0,this),t.isLocked?ae(se,{variant:"primary",size:"sm",onClick:()=>c(t.id),loading:i===`unlock-${t.id}`,fullWidth:!0,children:"Unlock Account"},void 0,!1,void 0,this):ae(se,{variant:"danger",size:"sm",onClick:()=>l(t.id),loading:i===`lock-${t.id}`,fullWidth:!0,children:"Lock Account"},void 0,!1,void 0,this),z&&ae(se,{variant:"warning",size:"sm",onClick:()=>t.email&&d(t.email),loading:i===`reset-${t.email}`,fullWidth:!0,children:"Reset Password"},void 0,!1,void 0,this),b&&ae(se,{variant:"secondary",size:"sm",onClick:()=>t.email&&g(t.email),loading:i===`magic-${t.email}`,fullWidth:!0,children:"Send Magic Link"},void 0,!1,void 0,this),C&&!t.verifiedAt&&!t.lastLoginAt&&ae(se,{variant:"primary",size:"sm",onClick:()=>t.email&&h(t.email),loading:i===`invite-${t.email}`,fullWidth:!0,children:"Resend Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Zt}from"react/jsx-dev-runtime";function cl({theme:e,searchQuery:t,statusFilter:r,roleFilter:n,roles:a,totalCount:i,filteredCount:o,onSearchChange:s,onStatusChange:l,onRoleChange:c,onRefresh:d,isLoading:g}){let h=[{value:"all",label:"All Status"},{value:"active",label:"Active"},{value:"locked",label:"Locked"},{value:"unverified",label:"Unverified"}],k=[{value:"all",label:"All Roles"},...a.map((u)=>({value:u.id,label:u.name}))];return Zt("div",{className:w(e.filters.wrapper),children:[Zt("div",{className:"flex flex-col sm:flex-row gap-3",children:[Zt("div",{className:"flex-1",children:Zt(Ee,{type:"text",value:t,onChange:(u)=>s(u),placeholder:"Search by name or email...",size:"md",leftIcon:Zt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Zt("div",{className:"flex flex-wrap gap-2",children:[Zt(dr,{options:h,value:r,onChange:(u)=>{if(u)l(u)},placeholder:"Status",size:"md",className:"min-w-[140px]"},void 0,!1,void 0,this),Zt(dr,{options:k,value:n,onChange:(u)=>{if(u)c(u)},placeholder:"Role",size:"md",searchable:a.length>5,className:"min-w-[140px]"},void 0,!1,void 0,this),d&&Zt(se,{variant:"outline",size:"md",onClick:d,loading:g,leftIcon:Zt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:Zt("span",{className:"hidden sm:inline",children:"Refresh"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Zt("div",{className:"flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[Zt("span",{children:["Showing ",o," of ",i," users"]},void 0,!0,void 0,this),(r!=="all"||n!=="all"||t)&&Zt(se,{variant:"ghost",size:"sm",onClick:()=>{s(""),l("all"),c("all")},children:"Clear filters"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ot}from"react/jsx-dev-runtime";function pl({theme:e,user:t,roles:r,isSelected:n,onSelect:a}){let i=(k)=>{let u=k.split(" ");if(u.length>=2&&u[0]&&u[1])return`${u[0][0]}${u[1][0]}`.toUpperCase();return k.slice(0,2).toUpperCase()},o=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return t.email.split("@")[0]},s=()=>{if(!t.userRoles)return[];return t.userRoles.map((k)=>r.find((u)=>u.id===k.roleId)).filter(Boolean).slice(0,3)},l=()=>{if(t.isLocked)return e.userCard.avatar.statusDot.locked;if(!t.verifiedAt)return e.userCard.avatar.statusDot.unverified;return e.userCard.avatar.statusDot.active},c=(k)=>{if(!k)return"Never logged in";let u=typeof k==="string"?new Date(k):k,b=new Date().getTime()-u.getTime(),C=Math.floor(b/86400000);if(C===0)return"Today";if(C===1)return"Yesterday";if(C<7)return`${C} days ago`;if(C<30)return`${Math.floor(C/7)} weeks ago`;if(C<365)return`${Math.floor(C/30)} months ago`;return`${Math.floor(C/365)} years ago`},d=o(),g=s(),h=(t.userRoles?.length||0)>3;return Ot("button",{type:"button",onClick:()=>a(t),className:w(e.userCard.wrapper.base,e.userCard.wrapper.hover,n&&e.userCard.wrapper.selected,"w-full text-left flex items-start gap-3"),children:[Ot("div",{className:w(e.userCard.avatar.wrapper),children:[Ot("div",{className:w(e.userCard.avatar.placeholder),children:i(d||"U")},void 0,!1,void 0,this),Ot("div",{className:w(e.userCard.avatar.statusDot.base,l())},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ot("div",{className:w(e.userCard.content.wrapper),children:[Ot("div",{className:"flex items-center gap-2",children:[Ot("span",{className:w(e.userCard.content.name),children:d},void 0,!1,void 0,this),t.isGod&&Ot("span",{className:w(e.userCard.badges.status.god),children:"God"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ot("p",{className:w(e.userCard.content.email),children:t.email},void 0,!1,void 0,this),Ot("p",{className:w(e.userCard.content.meta),children:c(t.lastLoginAt)},void 0,!1,void 0,this),(g.length>0||t.isLocked||!t.verifiedAt)&&Ot("div",{className:w(e.userCard.badges.wrapper),children:[t.isLocked&&Ot("span",{className:w(e.userCard.badges.status.locked),children:"Locked"},void 0,!1,void 0,this),!t.verifiedAt&&!t.isLocked&&Ot("span",{className:w(e.userCard.badges.status.unverified),children:"Unverified"},void 0,!1,void 0,this),g.map((k)=>Ot("span",{className:w(e.userCard.badges.role),children:k?.name},k?.id,!1,void 0,this)),h&&Ot("span",{className:w(e.userCard.badges.role),children:["+",(t.userRoles?.length||0)-3]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ot("svg",{className:"w-5 h-5 text-zinc-400 flex-shrink-0 mt-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Fr}from"react/jsx-dev-runtime";function ul({theme:e,count:t=5}){return Fr("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:Array.from({length:t}).map((r,n)=>Fr("div",{className:"p-3 sm:p-4 flex items-start gap-3",children:[Fr("div",{className:w(e.skeleton.base,e.skeleton.avatar)},void 0,!1,void 0,this),Fr("div",{className:"flex-1 space-y-2",children:[Fr("div",{className:w(e.skeleton.base,e.skeleton.text,"w-32")},void 0,!1,void 0,this),Fr("div",{className:w(e.skeleton.base,e.skeleton.text,"w-48")},void 0,!1,void 0,this),Fr("div",{className:"flex gap-1.5 mt-1",children:[Fr("div",{className:w(e.skeleton.base,"h-5 w-16 rounded")},void 0,!1,void 0,this),Fr("div",{className:w(e.skeleton.base,"h-5 w-12 rounded")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},n,!0,void 0,this))},void 0,!1,void 0,this)}import{useGSAP as o0}from"@gsap/react";import l0 from"gsap";import{useEffect as Dm,useEffectEvent as Jt,useRef as gl,useState as ml}from"react";import{batch as Xm,createStore as Um}from"h-state";var Em={users:[],profiles:[],addresses:[],phones:[],files:[],roles:[],userRoles:[],selectedUser:null,searchQuery:"",statusFilter:"all",roleFilter:"all",isDetailPanelOpen:!1,assigningRoleId:null,currentPage:1,pageSize:25,totalItems:0,totalPages:0,isLoading:!1},{useStore:ui}=Um(Em,{setUsers:(e)=>(t)=>{e.users=t},setProfiles:(e)=>(t)=>{e.profiles=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setUserRoles:(e)=>(t)=>{e.userRoles=t},setSelectedUser:(e)=>(t)=>{e.selectedUser=t,e.isDetailPanelOpen=t!==null},setSearchQuery:(e)=>(t)=>{e.searchQuery=t},setStatusFilter:(e)=>(t)=>{e.statusFilter=t},setRoleFilter:(e)=>(t)=>{e.roleFilter=t},setDetailPanelOpen:(e)=>(t)=>{if(e.isDetailPanelOpen=t,!t)e.selectedUser=null},setAssigningRoleId:(e)=>(t)=>{e.assigningRoleId=t},setCurrentPage:(e)=>(t)=>{e.currentPage=t},setPageSize:(e)=>(t)=>{e.pageSize=t,e.currentPage=1},setPagination:(e)=>(t,r)=>{e.totalItems=t,e.totalPages=r},setIsLoading:(e)=>(t)=>{e.isLoading=t},updateUser:(e)=>(t,r)=>{if(e.users=e.users.map((n)=>n.id===t?{...n,...r}:n),e.selectedUser?.id===t)e.selectedUser={...e.selectedUser,...r}},addUser:(e)=>(t)=>{e.users=[t,...e.users],e.totalItems=e.totalItems+1},addUserRole:(e)=>(t)=>{if(e.userRoles.some((n)=>n.userId===t.userId&&n.roleId===t.roleId&&!n.id.startsWith("temp-"))&&!t.id.startsWith("temp-"))return;e.userRoles=[...e.userRoles,t]},removeUserRole:(e)=>(t)=>{e.userRoles=e.userRoles.filter((r)=>r.id!==t)},getUserWithDetails:(e)=>(t)=>{let r=e.users.find((c)=>c.id===t);if(!r)return null;let n=e.profiles.find((c)=>c.userId===t),a=e.addresses.filter((c)=>c.ownerType==="user"&&c.ownerId===t),i=e.phones.filter((c)=>c.ownerType==="user"&&c.ownerId===t),o=e.files.filter((c)=>c.uploadedBy===t),s=new Set,l=e.userRoles.filter((c)=>c.userId===t).filter((c)=>{if(s.has(c.roleId))return!1;return s.add(c.roleId),!0}).map((c)=>({...c,role:e.roles.find((d)=>d.id===c.roleId)}));return{...r,profile:n||null,addresses:a,phones:i,files:o,userRoles:l}},reset:(e)=>()=>{Xm(()=>{e.users=[],e.profiles=[],e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.userRoles=[],e.selectedUser=null,e.searchQuery="",e.statusFilter="all",e.roleFilter="all",e.isDetailPanelOpen=!1,e.assigningRoleId=null,e.currentPage=1,e.pageSize=25,e.totalItems=0,e.totalPages=0,e.isLoading=!1})}});var gi={container:{base:"min-h-screen bg-zinc-50 dark:bg-zinc-950 transition-colors",padding:{sm:"p-3",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-10"}},header:{wrapper:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between mb-4 sm:mb-6",title:"text-xl sm:text-2xl lg:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400",actions:"flex items-center gap-2 mt-2 sm:mt-0"},layout:{wrapper:"flex flex-col lg:flex-row gap-4 lg:gap-6",sidebar:{base:"transition-all duration-300 ease-in-out",collapsed:"w-full",expanded:"w-full lg:w-3/5 xl:w-2/3"},main:"w-full lg:w-2/5 xl:w-1/3 lg:sticky lg:top-4 lg:self-start"},filters:{wrapper:"flex flex-col gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mb-4",searchInput:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",select:"px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",button:{base:"px-3 py-2 text-sm font-medium rounded-lg transition-colors",active:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300",inactive:"bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700"},badge:"px-2 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded-full"},table:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{row:"border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",cell:"px-3 sm:px-4 py-3 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider"},body:{row:{base:"border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20"},cell:"px-3 sm:px-4 py-3 text-sm"}},userCard:{wrapper:{base:"p-3 sm:p-4 border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20 border-l-2 border-l-emerald-500"},avatar:{wrapper:"relative flex-shrink-0",image:"w-10 h-10 sm:w-12 sm:h-12 rounded-full object-cover",placeholder:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gradient-to-br from-emerald-400 to-emerald-600 flex items-center justify-center text-white font-semibold text-sm sm:text-base",statusDot:{base:"absolute -bottom-0.5 -right-0.5 w-3 h-3 sm:w-3.5 sm:h-3.5 rounded-full border-2 border-white dark:border-zinc-900",active:"bg-emerald-500",locked:"bg-red-500",unverified:"bg-amber-500"}},content:{wrapper:"flex-1 min-w-0 ml-3",name:"font-medium text-sm sm:text-base text-zinc-900 dark:text-zinc-100 truncate",email:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 truncate",meta:"text-xs text-zinc-400 dark:text-zinc-500 mt-0.5"},badges:{wrapper:"flex flex-wrap gap-1 mt-1.5",role:"px-1.5 py-0.5 text-xs bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 rounded",status:{active:"px-1.5 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded",locked:"px-1.5 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 rounded",unverified:"px-1.5 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 rounded",god:"px-1.5 py-0.5 text-xs font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded"}}},detailPanel:{overlay:"fixed inset-0 bg-black/50 z-40 lg:hidden",wrapper:{base:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 overflow-hidden z-50 transition-all duration-300",mobile:"fixed inset-x-0 bottom-0 rounded-t-2xl max-h-[85vh]",tablet:"fixed inset-y-0 right-0 w-96 rounded-l-2xl",desktop:"rounded-xl sticky top-4"},header:{wrapper:"flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-zinc-100",closeButton:"p-1.5 rounded-lg text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"},content:{wrapper:"p-4 space-y-4 overflow-y-auto max-h-[calc(100vh-200px)]",section:{wrapper:"space-y-2",title:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",content:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg p-3 space-y-2"},row:{wrapper:"flex items-center justify-between gap-2",label:"text-sm text-zinc-500 dark:text-zinc-400",value:"text-sm font-medium text-zinc-900 dark:text-zinc-100 text-right truncate"}},actions:{wrapper:"p-4 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",button:{base:"w-full px-3 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-emerald-600 hover:bg-emerald-700 text-white",danger:"bg-red-100 hover:bg-red-200 dark:bg-red-900/30 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300",warning:"bg-amber-100 hover:bg-amber-200 dark:bg-amber-900/30 dark:hover:bg-amber-900/50 text-amber-700 dark:text-amber-300",info:"bg-blue-100 hover:bg-blue-200 dark:bg-blue-900/30 dark:hover:bg-blue-900/50 text-blue-700 dark:text-blue-300"}}},pagination:{wrapper:"flex flex-col sm:flex-row items-center justify-between gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mt-4",info:"text-sm text-zinc-500 dark:text-zinc-400",controls:{wrapper:"flex items-center gap-1 sm:gap-2",button:{base:"px-2 sm:px-3 py-1.5 text-sm rounded-lg transition-colors",active:"bg-emerald-600 text-white",disabled:"text-zinc-300 dark:text-zinc-600 cursor-not-allowed"},pageSize:"px-2 py-1.5 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100"}},skeleton:{base:"animate-pulse bg-zinc-200 dark:bg-zinc-800 rounded",avatar:"w-10 h-10 sm:w-12 sm:h-12 rounded-full",text:"h-4 rounded",button:"h-9 rounded-lg"},emptyState:{wrapper:"flex flex-col items-center justify-center py-12 px-4 text-center",icon:"w-12 h-12 text-zinc-300 dark:text-zinc-600 mb-4",title:"text-lg font-medium text-zinc-900 dark:text-zinc-100 mb-1",description:"text-sm text-zinc-500 dark:text-zinc-400"},modal:{overlay:"fixed inset-0 bg-black/60 backdrop-blur-sm z-40",wrapper:"w-full max-w-md bg-white dark:bg-zinc-900 rounded-2xl shadow-2xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{wrapper:"flex items-start justify-between gap-4 p-5 border-b border-zinc-200 dark:border-zinc-800",icon:"flex-shrink-0 w-10 h-10 flex items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",title:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"},content:"p-5",infoBox:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800/30",footer:"flex items-center justify-end gap-3 p-5 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50"},stats:{wrapper:"grid grid-cols-2 sm:grid-cols-4 gap-3 sm:gap-4 mb-4 sm:mb-6",card:{base:"p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 transition-all hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-700",icon:{wrapper:"w-8 h-8 sm:w-10 sm:h-10 flex items-center justify-center rounded-lg mb-2 sm:mb-3",primary:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",success:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",warning:"bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400",danger:"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400"},value:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-zinc-100",label:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"}}};import{jsxDEV as rt}from"react/jsx-dev-runtime";l0.registerPlugin(o0);function s0({title:e="User Management",subtitle:t,className:r,theme:n,getUsersAction:a,updateUserAction:i,getProfilesAction:o,getAddressesAction:s,getPhonesAction:l,getFilesAction:c,getRolesAction:d,getUserRolesAction:g,addUserRoleAction:h,deleteUserRoleAction:k,passwordResetRequestAction:u,magicLinkRequestAction:z,inviteUserAction:b,onUserUpdated:C,onRoleAssigned:x,onRoleRemoved:N,onUserInvited:m}){let y=n?{...gi,...n}:gi,v=ui(),p=gl(null),f=gl(null),[M,$]=ml(null),[J,U]=ml(!1),[E,Z]=ml(!1),B=gl(null);o0(()=>{if(!f.current)return;l0.fromTo(f.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:p});let Q=Jt((R=v.currentPage,de=v.pageSize)=>{v.setIsLoading(!0),a.start({payload:{page:R,limit:de},onAfterHandle:(te)=>{if(v.setIsLoading(!1),te.data)v.setUsers(te.data.items||[]),v.setPagination(te.data.meta?.totalItems||0,te.data.meta?.totalPages||1)},onErrorHandle:()=>{v.setIsLoading(!1)}})}),S=Jt(()=>{o.start({payload:{page:1,limit:1000},onAfterHandle:(R)=>{if(R.data?.items)v.setProfiles(R.data.items)}}),s.start({payload:{page:1,limit:1000},onAfterHandle:(R)=>{if(R.data?.items)v.setAddresses(R.data.items)}}),l.start({payload:{page:1,limit:1000},onAfterHandle:(R)=>{if(R.data?.items)v.setPhones(R.data.items)}}),c.start({payload:{page:1,limit:1000},onAfterHandle:(R)=>{if(R.data?.items)v.setFiles(R.data.items)}}),d.start({payload:{page:1,limit:100},onAfterHandle:(R)=>{if(R.data?.items)v.setRoles(R.data.items)}}),g.start({payload:{page:1,limit:5000},onAfterHandle:(R)=>{if(R.data?.items)v.setUserRoles(R.data.items)}})});Dm(()=>{Q(1,v.pageSize),S()},[]);let O=Jt((R)=>{v.setCurrentPage(R),Q(R,v.pageSize)}),A=Jt((R)=>{v.setPageSize(R),Q(1,R)}),ee=Jt(()=>{Q(v.currentPage,v.pageSize),S()}),_=Jt((R)=>{if(v.setSearchQuery(R),B.current)clearTimeout(B.current);B.current=setTimeout(()=>{v.setCurrentPage(1)},300)}),H=Jt((R)=>{let de=v.getUserWithDetails(R.id);v.setSelectedUser(de)}),T=Jt(()=>{v.setDetailPanelOpen(!1)}),ie=Jt((R)=>{$(`verify-${R}`);let de=v.users.find((te)=>te.id===R);if(!de)return;v.updateUser(R,{verifiedAt:new Date().toISOString()}),i.start({payload:{id:R,verifiedAt:new Date().toISOString()},onAfterHandle:(te)=>{if($(null),te.data){C?.(te.data);let ye=v.getUserWithDetails(R);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(R,{verifiedAt:de.verifiedAt})}})}),q=Jt((R)=>{$(`lock-${R}`);let de=v.users.find((te)=>te.id===R);if(!de)return;v.updateUser(R,{isLocked:!0}),i.start({payload:{id:R,isLocked:!0},onAfterHandle:(te)=>{if($(null),te.data){C?.(te.data);let ye=v.getUserWithDetails(R);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(R,{isLocked:de.isLocked})}})}),ce=Jt((R)=>{$(`unlock-${R}`);let de=v.users.find((te)=>te.id===R);if(!de)return;v.updateUser(R,{isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0}),i.start({payload:{id:R,isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0},onAfterHandle:(te)=>{if($(null),te.data){C?.(te.data);let ye=v.getUserWithDetails(R);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(R,{isLocked:de.isLocked,lockedUntil:de.lockedUntil,failedLoginAttempts:de.failedLoginAttempts})}})}),oe=Jt((R)=>{if(!u)return;$(`reset-${R}`),u.start({payload:{email:R},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),Ze=Jt((R)=>{if(!z)return;$(`magic-${R}`),z.start({payload:{email:R},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),$e=Jt((R,de)=>{let te=`temp-${Date.now()}`;v.addUserRole({id:te,userId:R,roleId:de}),h.start({payload:{userId:R,roleId:de},onAfterHandle:(ye)=>{if(v.removeUserRole(te),ye.data){v.addUserRole(ye.data),x?.(R,de);let D=v.getUserWithDetails(R);if(D)v.setSelectedUser(D)}},onErrorHandle:()=>{v.removeUserRole(te)}})}),Ce=Jt((R)=>{let de=v.userRoles.find((te)=>te.id===R);if(!de)return;v.removeUserRole(R),k.start({payload:{id:R},onAfterHandle:()=>{N?.(de.userId,de.roleId);let te=v.getUserWithDetails(de.userId);if(te)v.setSelectedUser(te)},onErrorHandle:()=>{v.addUserRole(de)}})}),fe=Jt((R)=>{if(!b)return;Z(!0),b.start({payload:{email:R},onAfterHandle:()=>{Z(!1),U(!1),m?.(R),Q(v.currentPage,v.pageSize)},onErrorHandle:()=>{Z(!1)}})}),xe=Jt((R)=>{if(!b)return;$(`invite-${R}`),b.start({payload:{email:R},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),Oe={total:v.totalItems,verified:v.users.filter((R)=>R.verifiedAt).length,unverified:v.users.filter((R)=>!R.verifiedAt).length,locked:v.users.filter((R)=>R.isLocked).length},Le=v.users.filter((R)=>{let de=v.profiles.find((re)=>re.userId===R.id),te=de?.firstName||de?.lastName?`${de.firstName||""} ${de.lastName||""}`.toLowerCase():"",ye=v.searchQuery===""||(R.email??"").toLowerCase().includes(v.searchQuery.toLowerCase())||te.includes(v.searchQuery.toLowerCase()),D=v.statusFilter==="all"||v.statusFilter==="locked"&&R.isLocked||v.statusFilter==="active"&&!R.isLocked&&R.verifiedAt||v.statusFilter==="unverified"&&!R.verifiedAt,j=v.roleFilter==="all"||v.userRoles.some((re)=>re.userId===R.id&&re.roleId===v.roleFilter);return ye&&D&&j}),ve=(R)=>{let de=v.users.find((j)=>j.id===R);if(!de)return{};let te=v.profiles.find((j)=>j.userId===R),ye=new Set,D=v.userRoles.filter((j)=>j.userId===R).filter((j)=>{if(ye.has(j.roleId))return!1;return ye.add(j.roleId),!0}).map((j)=>({...j,role:v.roles.find((re)=>re.id===j.roleId)}));return{...de,profile:te||null,userRoles:D}};return rt("div",{ref:p,className:w(y.container.base,"p-3 sm:p-4 md:p-6 lg:p-8 xl:p-10",r),children:[rt("div",{ref:f,className:"max-w-7xl mx-auto",children:[rt("header",{className:w(y.header.wrapper),children:[rt("div",{children:[rt("h1",{className:w(y.header.title),children:e},void 0,!1,void 0,this),t&&rt("p",{className:w(y.header.subtitle),children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rt("div",{className:w(y.header.actions),children:b&&rt(se,{variant:"primary",size:"md",onClick:()=>U(!0),leftIcon:rt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:[rt("span",{className:"hidden sm:inline",children:"Invite User"},void 0,!1,void 0,this),rt("span",{className:"sm:hidden",children:"Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rt(ll,{theme:y,totalUsers:Oe.total,verifiedUsers:Oe.verified,lockedUsers:Oe.locked,unverifiedUsers:Oe.unverified},void 0,!1,void 0,this),rt("div",{className:w(y.layout.wrapper),children:[rt("div",{className:w(y.layout.sidebar.base,v.isDetailPanelOpen?y.layout.sidebar.expanded:y.layout.sidebar.collapsed),children:[rt(cl,{theme:y,searchQuery:v.searchQuery,statusFilter:v.statusFilter,roleFilter:v.roleFilter,roles:v.roles,totalCount:v.totalItems,filteredCount:Le.length,onSearchChange:_,onStatusChange:v.setStatusFilter,onRoleChange:v.setRoleFilter,onRefresh:ee,isLoading:v.isLoading},void 0,!1,void 0,this),rt("div",{className:w(y.table.wrapper),children:rt("div",{className:"max-h-[calc(100vh-380px)] sm:max-h-[calc(100vh-340px)] lg:max-h-[calc(100vh-300px)] overflow-y-auto",children:v.isLoading?rt(ul,{theme:y,count:v.pageSize>10?10:v.pageSize},void 0,!1,void 0,this):Le.length===0?rt("div",{className:w(y.emptyState.wrapper),children:[rt("svg",{className:w(y.emptyState.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),rt("h3",{className:w(y.emptyState.title),children:"No users found"},void 0,!1,void 0,this),rt("p",{className:w(y.emptyState.description),children:v.searchQuery||v.statusFilter!=="all"||v.roleFilter!=="all"?"Try adjusting your filters":"No users have been created yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):rt("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:Le.map((R)=>rt(pl,{theme:y,user:ve(R.id),roles:v.roles,isSelected:v.selectedUser?.id===R.id,onSelect:H},R.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),v.totalPages>1&&rt(ol,{theme:y,currentPage:v.currentPage,totalPages:v.totalPages,totalItems:v.totalItems,pageSize:v.pageSize,pageSizeOptions:[10,25,50,100],onPageChange:O,onPageSizeChange:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.isDetailPanelOpen&&rt("div",{className:w(y.layout.main),children:rt(dl,{theme:y,user:v.selectedUser,roles:v.roles,allUserRoles:v.userRoles,isOpen:v.isDetailPanelOpen,actionLoading:M,onClose:T,onVerifyEmail:ie,onLockAccount:q,onUnlockAccount:ce,onResetPassword:oe,onSendMagicLink:Ze,onResendInvite:xe,onAssignRole:$e,onRemoveRole:Ce,hasPasswordReset:!!u,hasMagicLink:!!z,hasInvite:!!b},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),rt(il,{theme:y,isOpen:J,isLoading:E,onClose:()=>U(!1),onInvite:fe},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{Handle as oa,Position as la}from"@xyflow/react";var ht={layout:{root:"h-screen flex flex-col bg-[#0a0a0f] text-white overflow-hidden",main:"flex-1 flex overflow-hidden",sidebar:"w-64 flex-shrink-0 border-r border-white/[0.06] bg-[#0d0d14] flex flex-col",canvas:"flex-1 relative",propertiesPanel:"w-80 flex-shrink-0 border-l border-white/[0.06] bg-[#0d0d14] flex flex-col overflow-hidden"},header:{container:"flex-shrink-0 h-14 border-b border-white/[0.06] bg-[#0d0d14]/80 backdrop-blur-xl px-5 flex items-center justify-between",backButton:"w-8 h-8 rounded-lg flex items-center justify-center text-white/40 hover:text-white/70 hover:bg-white/[0.06] transition-all mr-2",title:"text-sm font-semibold text-white/90 tracking-tight",subtitle:"text-[11px] text-white/40 ml-3",actions:"flex items-center gap-2",descriptionInput:"px-2.5 py-1 text-[10px] rounded-md bg-white/[0.04] text-white/80 border border-white/[0.08] w-44 placeholder:text-white/20",saveButton:"rounded-lg bg-white/10 border border-white/[0.08] px-3.5 py-1.5 text-[11px] font-medium text-white/80 hover:bg-white/15 hover:text-white transition-all",saveButtonDisabled:"rounded-lg bg-white/[0.03] border border-white/[0.04] px-3.5 py-1.5 text-[11px] font-medium text-white/20 cursor-not-allowed",publishButton:"rounded-lg bg-emerald-500/20 border border-emerald-500/30 px-3.5 py-1.5 text-[11px] font-medium text-emerald-400 hover:bg-emerald-500/30 transition-all",deleteButton:"rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-1.5 text-[11px] font-medium text-red-400 hover:bg-red-500/20 transition-all"},tabs:{container:"flex gap-0.5 p-0.5 bg-white/[0.04] border border-white/[0.06] rounded-lg",tab:"px-3 py-1 rounded-md text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",tabActive:"px-3 py-1 rounded-md text-[11px] font-medium bg-white/[0.08] text-white/90 shadow-sm"},flowSelector:{select:"rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/70 outline-none focus:border-white/20"},palette:{container:"flex-1 overflow-auto p-4",title:"text-[10px] font-bold uppercase tracking-[0.15em] text-white/30 mb-3 px-1",item:"flex items-start gap-3 rounded-xl p-3 mb-2 cursor-grab active:cursor-grabbing transition-all border border-transparent hover:border-white/[0.08]",itemIcon:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",itemLabel:"text-[12px] font-medium text-white/80",itemDescription:"text-[10px] text-white/30 mt-0.5 leading-relaxed",stepItem:"hover:bg-blue-500/[0.06]",verifierItem:"hover:bg-amber-500/[0.06]",notificationItem:"hover:bg-violet-500/[0.06]",dragHint:"text-[10px] text-white/20 text-center mt-4 px-3 leading-relaxed"},canvas:{container:"flex-1 relative bg-[#08080d]",background:"bg-[#08080d]",dropIndicator:"absolute inset-4 border-2 border-dashed border-white/10 rounded-2xl bg-white/[0.02] pointer-events-none z-10"},stepNode:{container:"group relative rounded-2xl border border-blue-500/20 bg-gradient-to-br from-blue-500/[0.08] to-blue-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-blue-500/[0.04] transition-all hover:border-blue-500/30 hover:shadow-blue-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-blue-400/50 bg-gradient-to-br from-blue-500/[0.12] to-blue-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-blue-500/[0.12] ring-4 ring-blue-500/10",icon:"text-blue-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-blue-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",handleSource:"!w-3 !h-3 !bg-blue-400/60 !border-2 !border-[#08080d] hover:!bg-blue-400",handleTarget:"!w-3 !h-3 !bg-blue-400/60 !border-2 !border-[#08080d] hover:!bg-blue-400",orderBadge:"absolute -top-2 -right-2 w-5 h-5 rounded-full bg-blue-500/80 text-[9px] font-bold text-white flex items-center justify-center"},verifierNode:{container:"group relative rounded-2xl border border-amber-500/20 bg-gradient-to-br from-amber-500/[0.08] to-orange-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-amber-500/[0.04] transition-all hover:border-amber-500/30 hover:shadow-amber-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-amber-400/50 bg-gradient-to-br from-amber-500/[0.12] to-orange-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-amber-500/[0.12] ring-4 ring-amber-500/10",hexShape:"",icon:"text-amber-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-amber-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",assignedBadge:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 border border-amber-500/20 px-2 py-0.5 text-[10px] font-medium text-amber-300/80 mt-2",signatureBadge:"inline-flex items-center gap-1 rounded-md bg-rose-500/10 border border-rose-500/20 px-2 py-0.5 text-[10px] font-medium text-rose-300/80",handleSource:"!w-3 !h-3 !bg-amber-400/60 !border-2 !border-[#08080d] hover:!bg-amber-400",handleTarget:"!w-3 !h-3 !bg-amber-400/60 !border-2 !border-[#08080d] hover:!bg-amber-400"},notificationNode:{container:"group relative rounded-2xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.08] to-purple-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-violet-500/[0.04] transition-all hover:border-violet-500/30 hover:shadow-violet-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-violet-400/50 bg-gradient-to-br from-violet-500/[0.12] to-purple-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-violet-500/[0.12] ring-4 ring-violet-500/10",icon:"text-violet-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-violet-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",channelBadge:"inline-flex items-center gap-1 rounded-md bg-violet-500/10 border border-violet-500/20 px-2 py-0.5 text-[10px] font-medium text-violet-300/80",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-cyan-500/10 border border-cyan-500/20 px-2 py-0.5 text-[10px] font-medium text-cyan-300/80",handleSource:"!w-3 !h-3 !bg-violet-400/60 !border-2 !border-[#08080d] hover:!bg-violet-400",handleTarget:"!w-3 !h-3 !bg-violet-400/60 !border-2 !border-[#08080d] hover:!bg-violet-400"},propertiesPanel:{container:"flex flex-col h-full",header:"flex items-center justify-between px-4 py-3 border-b border-white/[0.06]",headerTitle:"text-[12px] font-semibold text-white/80",closeButton:"w-6 h-6 rounded-md flex items-center justify-center text-white/30 hover:text-white/60 hover:bg-white/[0.06] transition-all",body:"flex-1 overflow-auto p-4 space-y-5",section:"space-y-2.5",sectionTitle:"text-[10px] font-bold uppercase tracking-[0.15em] text-white/30 mb-2",label:"block text-[11px] font-medium text-white/50 mb-1",input:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 focus:bg-white/[0.06] transition-all placeholder:text-white/20",select:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20",textarea:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 resize-none placeholder:text-white/20",checkbox:"rounded border-white/20 bg-white/[0.04] text-blue-500 focus:ring-blue-500/30",checkboxLabel:"text-[11px] text-white/60",deleteButton:"w-full rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-2 text-[11px] font-medium text-red-400 hover:bg-red-500/20 transition-all",multiSelect:{container:"flex flex-wrap gap-1.5 rounded-lg border border-white/[0.08] bg-white/[0.04] p-2 min-h-[38px]",badge:"inline-flex items-center gap-1 rounded-md bg-white/[0.08] px-2 py-0.5 text-[10px] font-medium text-white/70",badgeRemove:"w-3.5 h-3.5 rounded-sm flex items-center justify-center hover:bg-white/10 text-white/40 hover:text-white/70 transition-colors cursor-pointer",dropdown:"absolute z-30 mt-1 w-full rounded-lg border border-white/[0.08] bg-[#12121a] shadow-2xl py-1 max-h-48 overflow-auto",option:"px-3 py-1.5 text-[11px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 cursor-pointer transition-colors",optionSelected:"px-3 py-1.5 text-[11px] text-blue-400 bg-blue-500/10 font-medium"},userRoleSearch:{container:"space-y-2",searchInput:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 placeholder:text-white/20",listContainer:"rounded-lg border border-white/[0.06] bg-white/[0.02] max-h-48 overflow-auto",listItem:"w-full text-left flex items-center gap-2.5 px-3 py-2 hover:bg-white/[0.04] cursor-pointer transition-colors border-b border-white/[0.04] last:border-b-0",listItemSelected:"w-full text-left flex items-center gap-2.5 px-3 py-2 bg-blue-500/20 border-l-2 border-l-blue-400 cursor-pointer border-b border-white/[0.04] last:border-b-0",listItemAvatar:"w-7 h-7 rounded-full bg-white/[0.08] flex items-center justify-center text-[10px] font-bold text-white/50 flex-shrink-0",listItemName:"text-[12px] font-medium text-white/80",listItemEmail:"text-[10px] text-white/40",loadMore:"w-full py-2 text-center text-[10px] text-white/30 hover:text-white/50 cursor-pointer transition-colors",empty:"py-6 text-center text-[11px] text-white/25"}},overlay:{info:"absolute top-4 left-4 bg-[#0d0d14]/90 backdrop-blur-xl rounded-xl border border-white/[0.06] p-4 shadow-2xl max-w-xs z-10",infoTitle:"text-[12px] font-semibold text-white/90",infoDescription:"text-[11px] text-white/40 mt-1",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-500/15 border border-amber-500/20 text-amber-400",badgePublished:"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400"},legend:{container:"absolute bottom-4 left-4 bg-[#0d0d14]/90 backdrop-blur-xl rounded-xl border border-white/[0.06] p-3 shadow-2xl z-10",item:"flex items-center gap-1.5",dot:{step:"w-2.5 h-2.5 rounded-full bg-blue-400",verifier:"w-2.5 h-2.5 rounded-full bg-amber-400",notification:"w-2.5 h-2.5 rounded-full bg-violet-400"},label:"text-[10px] text-white/40"},pending:{container:"max-w-3xl mx-auto space-y-3",title:"text-lg font-semibold text-white/90 mb-4",empty:{container:"text-center py-20",icon:"w-16 h-16 text-white/10 mx-auto mb-4",text:"text-white/30"},card:{container:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4 shadow-sm hover:bg-white/[0.04] transition-colors",title:"text-sm font-medium text-white/90",subtitle:"text-xs text-white/40 mt-0.5",actions:"flex items-center gap-2"},input:"rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/80 w-40 outline-none focus:border-white/20",approveButton:"rounded-lg bg-emerald-500/20 border border-emerald-500/30 px-3 py-1.5 text-[11px] font-medium text-emerald-400 hover:bg-emerald-500/30 transition-all",rejectButton:"rounded-lg bg-red-500/20 border border-red-500/30 px-3 py-1.5 text-[11px] font-medium text-red-400 hover:bg-red-500/30 transition-all",cancelButton:"rounded-lg bg-white/[0.06] border border-white/[0.08] px-3 py-1.5 text-[11px] font-medium text-white/50 hover:bg-white/[0.1] transition-all",reviewButton:"rounded-lg bg-blue-500/20 border border-blue-500/30 px-3 py-1.5 text-[11px] font-medium text-blue-400 hover:bg-blue-500/30 transition-all"},flowList:{container:"flex-1 overflow-auto p-6",grid:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl mx-auto",createButton:"group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-white/[0.08] bg-white/[0.02] p-8 min-h-[180px] cursor-pointer hover:border-white/[0.15] hover:bg-white/[0.04] transition-all",card:{container:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-5 hover:bg-white/[0.04] hover:border-white/[0.1] transition-all group cursor-pointer",header:"flex items-start justify-between gap-3 mb-3",name:"text-[13px] font-semibold text-white/90 leading-tight",description:"text-[11px] text-white/40 mt-1.5 leading-relaxed line-clamp-2",meta:"flex items-center gap-2 mt-3 flex-wrap",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-500/15 border border-amber-500/20 text-amber-400",badgePublished:"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-white/[0.06] border border-white/[0.08] px-2 py-0.5 text-[9px] font-medium text-white/50",actions:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",editButton:"w-7 h-7 rounded-lg flex items-center justify-center text-white/30 hover:text-white/70 hover:bg-white/[0.08] transition-all",deleteButton:"w-7 h-7 rounded-lg flex items-center justify-center text-white/30 hover:text-red-400 hover:bg-red-500/10 transition-all"},empty:{container:"col-span-full flex flex-col items-center justify-center py-20",icon:"w-16 h-16 text-white/[0.06] mb-4",title:"text-[14px] font-medium text-white/40 mb-1",description:"text-[12px] text-white/25"}},loading:{container:"absolute inset-0 flex items-center justify-center bg-[#08080d]/80 backdrop-blur-sm z-10",spinner:"w-8 h-8 border-2 border-white/10 border-t-blue-400 rounded-full animate-spin"}},d0={...ht,layout:{root:"h-screen flex flex-col bg-gray-50 text-gray-900 overflow-hidden",main:"flex-1 flex overflow-hidden",sidebar:"w-64 flex-shrink-0 border-r border-gray-200 bg-white flex flex-col",canvas:"flex-1 relative",propertiesPanel:"w-80 flex-shrink-0 border-l border-gray-200 bg-white flex flex-col overflow-hidden"},header:{container:"flex-shrink-0 h-14 border-b border-gray-200 bg-white/80 backdrop-blur-xl px-5 flex items-center justify-between",backButton:"w-8 h-8 rounded-lg flex items-center justify-center text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-all mr-2",title:"text-sm font-semibold text-gray-900 tracking-tight",subtitle:"text-[11px] text-gray-400 ml-3",actions:"flex items-center gap-2",descriptionInput:"px-2.5 py-1 text-[10px] rounded-md bg-gray-50 text-gray-700 border border-gray-200 w-44 placeholder:text-gray-300",saveButton:"rounded-lg bg-gray-100 border border-gray-200 px-3.5 py-1.5 text-[11px] font-medium text-gray-700 hover:bg-gray-200 transition-all",saveButtonDisabled:"rounded-lg bg-gray-50 border border-gray-100 px-3.5 py-1.5 text-[11px] font-medium text-gray-300 cursor-not-allowed",publishButton:"rounded-lg bg-emerald-50 border border-emerald-200 px-3.5 py-1.5 text-[11px] font-medium text-emerald-700 hover:bg-emerald-100 transition-all",deleteButton:"rounded-lg bg-red-50 border border-red-200 px-3 py-1.5 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all"},tabs:{container:"flex gap-0.5 p-0.5 bg-gray-100 border border-gray-200 rounded-lg",tab:"px-3 py-1 rounded-md text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all",tabActive:"px-3 py-1 rounded-md text-[11px] font-medium bg-white text-gray-900 shadow-sm"},flowSelector:{select:"rounded-lg border border-gray-200 bg-gray-50 px-3 py-1.5 text-[11px] text-gray-600 outline-none focus:border-gray-400"},palette:{container:"flex-1 overflow-auto p-4",title:"text-[10px] font-bold uppercase tracking-[0.15em] text-gray-400 mb-3 px-1",item:"flex items-start gap-3 rounded-xl p-3 mb-2 cursor-grab active:cursor-grabbing transition-all border border-transparent hover:border-gray-200",itemIcon:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",itemLabel:"text-[12px] font-medium text-gray-700",itemDescription:"text-[10px] text-gray-400 mt-0.5 leading-relaxed",stepItem:"hover:bg-blue-50",verifierItem:"hover:bg-amber-50",notificationItem:"hover:bg-violet-50",dragHint:"text-[10px] text-gray-300 text-center mt-4 px-3 leading-relaxed"},canvas:{container:"flex-1 relative bg-gray-50",background:"bg-gray-50",dropIndicator:"absolute inset-4 border-2 border-dashed border-gray-300 rounded-2xl bg-gray-100/50 pointer-events-none z-10"},stepNode:{...ht.stepNode,container:"group relative rounded-2xl border border-blue-200 bg-gradient-to-br from-blue-50 to-blue-100/50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-blue-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-blue-400 bg-gradient-to-br from-blue-50 to-blue-100/50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-blue-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-blue-500",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},verifierNode:{...ht.verifierNode,container:"group relative rounded-2xl border border-amber-200 bg-gradient-to-br from-amber-50 to-orange-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-amber-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-amber-400 bg-gradient-to-br from-amber-50 to-orange-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-amber-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-amber-600",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},notificationNode:{...ht.notificationNode,container:"group relative rounded-2xl border border-violet-200 bg-gradient-to-br from-violet-50 to-purple-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-violet-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-violet-400 bg-gradient-to-br from-violet-50 to-purple-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-violet-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-violet-600",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},propertiesPanel:{container:"flex flex-col h-full",header:"flex items-center justify-between px-4 py-3 border-b border-gray-200",headerTitle:"text-[12px] font-semibold text-gray-800",closeButton:"w-6 h-6 rounded-md flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-all",body:"flex-1 overflow-auto p-4 space-y-5",section:"space-y-2.5",sectionTitle:"text-[10px] font-bold uppercase tracking-[0.15em] text-gray-400 mb-2",label:"block text-[11px] font-medium text-gray-500 mb-1",input:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 focus:bg-white transition-all placeholder:text-gray-300",select:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400",textarea:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 resize-none placeholder:text-gray-300",checkbox:"rounded border-gray-300 bg-gray-50 text-blue-500 focus:ring-blue-300",checkboxLabel:"text-[11px] text-gray-600",deleteButton:"w-full rounded-lg bg-red-50 border border-red-200 px-3 py-2 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all",multiSelect:{container:"flex flex-wrap gap-1.5 rounded-lg border border-gray-200 bg-gray-50 p-2 min-h-[38px]",badge:"inline-flex items-center gap-1 rounded-md bg-gray-200 px-2 py-0.5 text-[10px] font-medium text-gray-700",badgeRemove:"w-3.5 h-3.5 rounded-sm flex items-center justify-center hover:bg-gray-300 text-gray-500 hover:text-gray-700 transition-colors cursor-pointer",dropdown:"absolute z-30 mt-1 w-full rounded-lg border border-gray-200 bg-white shadow-xl py-1 max-h-48 overflow-auto",option:"px-3 py-1.5 text-[11px] text-gray-600 hover:bg-gray-100 hover:text-gray-800 cursor-pointer transition-colors",optionSelected:"px-3 py-1.5 text-[11px] text-blue-600 bg-blue-50 font-medium"},userRoleSearch:{container:"space-y-2",searchInput:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 placeholder:text-gray-300",listContainer:"rounded-lg border border-gray-200 bg-white max-h-48 overflow-auto",listItem:"w-full text-left flex items-center gap-2.5 px-3 py-2 hover:bg-gray-50 cursor-pointer transition-colors border-b border-gray-100 last:border-b-0",listItemSelected:"w-full text-left flex items-center gap-2.5 px-3 py-2 bg-blue-50 border-l-2 border-l-blue-400 cursor-pointer border-b border-gray-100 last:border-b-0",listItemAvatar:"w-7 h-7 rounded-full bg-gray-100 flex items-center justify-center text-[10px] font-bold text-gray-500 flex-shrink-0",listItemName:"text-[12px] font-medium text-gray-800",listItemEmail:"text-[10px] text-gray-400",loadMore:"w-full py-2 text-center text-[10px] text-gray-400 hover:text-gray-600 cursor-pointer transition-colors",empty:"py-6 text-center text-[11px] text-gray-300"}},overlay:{info:"absolute top-4 left-4 bg-white/90 backdrop-blur-xl rounded-xl border border-gray-200 p-4 shadow-lg max-w-xs z-10",infoTitle:"text-[12px] font-semibold text-gray-800",infoDescription:"text-[11px] text-gray-500 mt-1",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-100 border border-amber-200 text-amber-700",badgePublished:"bg-emerald-100 border border-emerald-200 text-emerald-700"},legend:{container:"absolute bottom-4 left-4 bg-white/90 backdrop-blur-xl rounded-xl border border-gray-200 p-3 shadow-lg z-10",item:"flex items-center gap-1.5",dot:{step:"w-2.5 h-2.5 rounded-full bg-blue-400",verifier:"w-2.5 h-2.5 rounded-full bg-amber-400",notification:"w-2.5 h-2.5 rounded-full bg-violet-400"},label:"text-[10px] text-gray-500"},pending:{container:"max-w-3xl mx-auto space-y-3",title:"text-lg font-semibold text-gray-800 mb-4",empty:{container:"text-center py-20",icon:"w-16 h-16 text-gray-200 mx-auto mb-4",text:"text-gray-400"},card:{container:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm hover:bg-gray-50 transition-colors",title:"text-sm font-medium text-gray-800",subtitle:"text-xs text-gray-400 mt-0.5",actions:"flex items-center gap-2"},input:"rounded-lg border border-gray-200 bg-gray-50 px-3 py-1.5 text-[11px] text-gray-800 w-40 outline-none focus:border-gray-400",approveButton:"rounded-lg bg-emerald-50 border border-emerald-200 px-3 py-1.5 text-[11px] font-medium text-emerald-700 hover:bg-emerald-100 transition-all",rejectButton:"rounded-lg bg-red-50 border border-red-200 px-3 py-1.5 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all",cancelButton:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-1.5 text-[11px] font-medium text-gray-500 hover:bg-gray-100 transition-all",reviewButton:"rounded-lg bg-blue-50 border border-blue-200 px-3 py-1.5 text-[11px] font-medium text-blue-600 hover:bg-blue-100 transition-all"},flowList:{container:"flex-1 overflow-auto p-6",grid:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl mx-auto",createButton:"group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-gray-200 bg-gray-50 p-8 min-h-[180px] cursor-pointer hover:border-gray-300 hover:bg-gray-100 transition-all",card:{container:"rounded-xl border border-gray-200 bg-white p-5 hover:bg-gray-50 hover:border-gray-300 transition-all group cursor-pointer shadow-sm",header:"flex items-start justify-between gap-3 mb-3",name:"text-[13px] font-semibold text-gray-800 leading-tight",description:"text-[11px] text-gray-400 mt-1.5 leading-relaxed line-clamp-2",meta:"flex items-center gap-2 mt-3 flex-wrap",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-100 border border-amber-200 text-amber-700",badgePublished:"bg-emerald-100 border border-emerald-200 text-emerald-700",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-gray-100 border border-gray-200 px-2 py-0.5 text-[9px] font-medium text-gray-500",actions:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",editButton:"w-7 h-7 rounded-lg flex items-center justify-center text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-all",deleteButton:"w-7 h-7 rounded-lg flex items-center justify-center text-gray-400 hover:text-red-600 hover:bg-red-50 transition-all"},empty:{container:"col-span-full flex flex-col items-center justify-center py-20",icon:"w-16 h-16 text-gray-200 mb-4",title:"text-[14px] font-medium text-gray-500 mb-1",description:"text-[12px] text-gray-400"}},loading:{container:"absolute inset-0 flex items-center justify-center bg-white/80 backdrop-blur-sm z-10",spinner:"w-8 h-8 border-2 border-gray-200 border-t-blue-400 rounded-full animate-spin"}};function bl(e){return e==="light"?d0:ht}function c0(e){return{...ht,...e,layout:{...ht.layout,...e.layout},header:{...ht.header,...e.header},tabs:{...ht.tabs,...e.tabs},palette:{...ht.palette,...e.palette},canvas:{...ht.canvas,...e.canvas},stepNode:{...ht.stepNode,...e.stepNode},verifierNode:{...ht.verifierNode,...e.verifierNode},notificationNode:{...ht.notificationNode,...e.notificationNode},propertiesPanel:{...ht.propertiesPanel,...e.propertiesPanel},overlay:{...ht.overlay,...e.overlay},legend:{...ht.legend,...e.legend},pending:{...ht.pending,...e.pending},flowList:{...ht.flowList,...e.flowList},loading:{...ht.loading,...e.loading}}}var p0=ht;function u0(e){p0=e}function Dr(){return p0}import{jsxDEV as Be}from"react/jsx-dev-runtime";var Vm=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Step"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),jm=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Verifier"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),eb=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Notification"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);function mi({data:e}){let t=Dr().stepNode,r=e.selected===!0;return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),e.stepOrder>0&&Be("span",{className:t.orderBadge,children:e.stepOrder},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(Vm,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Step"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||`Step ${e.stepOrder}`},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be(oa,{type:"source",position:la.Right,className:t.handleSource},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bi({data:e}){let t=Dr().verifierNode,r=e.selected===!0,n=e.verifierType==="role"?e.verifierRole||"No role":e.verifierUserEmail||"No user";return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(jm,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Verifier"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||"Verifier"},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[Be("span",{className:t.assignedBadge,children:[e.verifierType==="role"?"\u26CA":"\u2687"," ",n]},void 0,!0,void 0,this),e.requireSignature&&Be("span",{className:t.signatureBadge,children:"\u270D Signature"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be(oa,{type:"source",position:la.Right,className:t.handleSource},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fi({data:e}){let t=Dr().notificationNode,r=e.selected===!0,n=e.channels||[],i=(e.trigger||"on_step_reached").replace(/^on_/,"").replace(/_/g," "),o=(()=>{if(!e.recipientType)return null;if(e.recipientType==="user")return e.recipientUserEmail||"No user";if(e.recipientType==="role")return e.recipientRole||"No role";if(e.recipientType==="all_verifiers")return"All Verifiers";if(e.recipientType==="step_verifier")return"Step Verifier";if(e.recipientType==="entity_creator")return"Entity Creator";return e.recipientType})();return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(eb,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Notification"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||"Notification"},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[Be("span",{className:t.triggerBadge,children:["\u26A1 ",i]},void 0,!0,void 0,this),n.map((s)=>Be("span",{className:t.channelBadge,children:s},s,!1,void 0,this))]},void 0,!0,void 0,this),o&&Be("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:Be("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-purple-500/15 text-purple-300 border border-purple-500/20",children:[e.recipientType==="role"?"\u26CA":"\u2687"," ",o]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ht}from"react/jsx-dev-runtime";var tb=[{type:"step",label:"Step",description:"A verification checkpoint in the flow",iconBg:"bg-blue-500/20 text-blue-400",themeKey:"stepItem"},{type:"verifier",label:"Verifier",description:"Assign a user or role to approve",iconBg:"bg-amber-500/20 text-amber-400",themeKey:"verifierItem"},{type:"notification",label:"Notification",description:"Send alerts via portal, email, or webhook",iconBg:"bg-violet-500/20 text-violet-400",themeKey:"notificationItem"}],rb=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Step"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nb=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Verifier"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ab=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Notification"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ib={step:rb,verifier:nb,notification:ab};function hi(){let e=Dr().palette,t=(r,n)=>{r.dataTransfer.setData("application/reactflow-nodetype",n),r.dataTransfer.effectAllowed="move"};return Ht("div",{className:e.container,children:[Ht("p",{className:e.title,children:"Components"},void 0,!1,void 0,this),tb.map((r)=>{let n=ib[r.type];return Ht("div",{role:"button",tabIndex:0,className:w(e.item,e[r.themeKey]),draggable:!0,onDragStart:(a)=>t(a,r.type),children:[Ht("div",{className:w(e.itemIcon,r.iconBg),children:Ht(n,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ht("div",{children:[Ht("p",{className:e.itemLabel,children:r.label},void 0,!1,void 0,this),Ht("p",{className:e.itemDescription,children:r.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},r.type,!0,void 0,this)}),Ht("p",{className:e.dragHint,children:"Drag a component onto the canvas to add it to your flow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as db,useEffectEvent as m0}from"react";import{batch as ob,createStore as lb}from"h-state";var g0={steps:[],edges:[],verifier_configs:[],notification_rules:[],notification_recipients:[],notification_channels:[]},sb={flows:[],selectedFlowId:null,graphData:{...g0},pendingItems:[],activeTab:"flow",isLoadingFlows:!1,isLoadingGraph:!1,isLoadingPending:!1,decidingId:null,decisionReason:"",selectedNodeId:null,draggedNodeType:null,isSaving:!1,isDirty:!1,error:null},{useStore:Hn}=lb(sb,{setFlows:(e)=>(t)=>{e.flows=t},setSelectedFlowId:(e)=>(t)=>{e.selectedFlowId=t},setGraphData:(e)=>(t)=>{e.graphData=t},setPendingItems:(e)=>(t)=>{e.pendingItems=t},setActiveTab:(e)=>(t)=>{e.activeTab=t},setLoadingFlows:(e)=>(t)=>{e.isLoadingFlows=t},setLoadingGraph:(e)=>(t)=>{e.isLoadingGraph=t},setLoadingPending:(e)=>(t)=>{e.isLoadingPending=t},setDecidingId:(e)=>(t)=>{e.decidingId=t},setDecisionReason:(e)=>(t)=>{e.decisionReason=t},setSelectedNodeId:(e)=>(t)=>{e.selectedNodeId=t},setDraggedNodeType:(e)=>(t)=>{e.draggedNodeType=t},setIsSaving:(e)=>(t)=>{e.isSaving=t},setIsDirty:(e)=>(t)=>{e.isDirty=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{ob(()=>{e.flows=[],e.selectedFlowId=null,e.graphData={...g0},e.pendingItems=[],e.activeTab="flow",e.isLoadingFlows=!1,e.isLoadingGraph=!1,e.isLoadingPending=!1,e.decidingId=null,e.decisionReason="",e.selectedNodeId=null,e.draggedNodeType=null,e.isSaving=!1,e.isDirty=!1,e.error=null})}});import{jsxDEV as St}from"react/jsx-dev-runtime";function yi({pendingAction:e,decideAction:t,onDecisionMade:r}){let n=Dr(),a=Hn(),i=m0(()=>{a.setLoadingPending(!0),e.start({payload:void 0,onAfterHandle:(s)=>{let l=s;if(l.success===!1){console.error("[PendingTab] API returned success=false:",s),a.setPendingItems([]),a.setLoadingPending(!1);return}a.setPendingItems(l.data??[]),a.setLoadingPending(!1)},onErrorHandle:(s,l)=>{let c=s,d=c?.message||c?.error||JSON.stringify(s);console.error(`[PendingTab] Pending error (HTTP ${l??"?"}):`,d),a.setPendingItems([]),a.setLoadingPending(!1)}})});db(()=>{i()},[]);let o=m0((s,l)=>{t.start({payload:{entity_name:s.entity_name,entity_id:s.entity_id,decision:l,reason:a.decisionReason||void 0},onAfterHandle:()=>{a.setDecidingId(null),a.setDecisionReason(""),r?.(s.entity_name,s.entity_id),i()}})});if(a.isLoadingPending)return St("div",{className:"flex items-center justify-center py-20",children:St("div",{className:n.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(a.pendingItems.length===0)return St("div",{className:n.pending.empty.container,children:[St("svg",{className:n.pending.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[St("title",{children:"No pending items"},void 0,!1,void 0,this),St("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),St("p",{className:n.pending.empty.text,children:"No pending verifications"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return St("div",{className:n.pending.container,children:[St("h2",{className:n.pending.title,children:["Pending Approvals (",a.pendingItems.length,")"]},void 0,!0,void 0,this),a.pendingItems.map((s)=>St("div",{className:n.pending.card.container,children:St("div",{className:"flex items-center justify-between",children:[St("div",{children:[St("p",{className:n.pending.card.title,children:[s.flow_name," \u2014 Step ",s.step_order]},void 0,!0,void 0,this),St("p",{className:n.pending.card.subtitle,children:[s.entity_name,"/",s.entity_id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a.decidingId===s.instance_id?St("div",{className:n.pending.card.actions,children:[St("input",{type:"text",placeholder:"Reason (optional)",value:a.decisionReason,onChange:(l)=>a.setDecisionReason(l.target.value),className:n.pending.input},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>o(s,"approved"),className:n.pending.approveButton,children:"Approve"},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>o(s,"rejected"),className:n.pending.rejectButton,children:"Reject"},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>{a.setDecidingId(null),a.setDecisionReason("")},className:n.pending.cancelButton,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):St("button",{type:"button",onClick:()=>a.setDecidingId(s.instance_id),className:n.pending.reviewButton,children:"Review"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},`${s.instance_id}-${s.step_order}`,!1,void 0,this))]},void 0,!0,void 0,this)}import{useEffect as y0,useEffectEvent as vi,useState as ur}from"react";import{jsxDEV as Y,Fragment as h0}from"react/jsx-dev-runtime";var cb=["portal","email","sms","telegram","webhook"],pb=[{value:"on_flow_started",label:"Flow Started"},{value:"on_step_reached",label:"Step Reached"},{value:"on_approved",label:"Approved"},{value:"on_rejected",label:"Rejected"},{value:"on_flow_completed",label:"Flow Completed"}],ub=[{value:"all_verifiers",label:"All Verifiers"},{value:"step_verifier",label:"Step Verifier"},{value:"entity_creator",label:"Entity Creator"},{value:"role",label:"Specific Role"},{value:"user",label:"Specific User"}];function gb({selected:e,onChange:t,msTheme:r}){let n=r,[a,i]=ur(!1),o=(l)=>{if(e.includes(l))t(e.filter((c)=>c!==l));else t([...e,l])},s=(l)=>{t(e.filter((c)=>c!==l))};return Y("div",{className:"relative",children:[Y("div",{role:"combobox",tabIndex:0,"aria-expanded":a,className:`${n.container} cursor-pointer`,onClick:()=>i(!a),onKeyDown:(l)=>{if(l.key==="Enter"||l.key===" ")l.preventDefault(),i(!a)},children:[e.length===0&&Y("span",{className:"text-[10px] text-white/20",children:"Select channels..."},void 0,!1,void 0,this),e.map((l)=>Y("span",{className:n.badge,children:[l,Y("span",{role:"button",tabIndex:0,className:n.badgeRemove,onClick:(c)=>{c.stopPropagation(),s(l)},onKeyDown:(c)=>{if(c.key==="Enter"||c.key===" ")c.stopPropagation(),s(l)},children:"\xD7"},void 0,!1,void 0,this)]},l,!0,void 0,this))]},void 0,!0,void 0,this),a&&Y("div",{className:n.dropdown,children:cb.map((l)=>Y("button",{type:"button",className:e.includes(l)?n.optionSelected:n.option,onClick:()=>o(l),children:[e.includes(l)?"\u2713 ":"",l]},l,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var wi=[],ki=[];function b0({listUsersAction:e,selectedUserId:t,onSelect:r,ursTheme:n}){let a=n,[i,o]=ur(""),[s,l]=ur(wi),[c,d]=ur(1),[g,h]=ur(!1),[k,u]=ur(!1),[z,b]=ur(!!t),C=vi((m,y)=>{if(!e)return;u(!0),e.start({payload:{page:m,limit:20,search:y||void 0},onAfterHandle:(v)=>{let f=v.data,M=f?.items||f?.data||[],J=f?.meta?.hasNextPage===!0||M.length>=20;if(m===1){if(l(M),!y)wi=M}else l((U)=>[...U,...M]);h(J&&M.length>0),u(!1)},onErrorHandle:()=>{u(!1)}})});y0(()=>{if(i===""&&wi.length>0){l(wi);return}C(1,i),d(1)},[i]);let x=vi(()=>{let m=c+1;d(m),C(m,i)});if(!e)return Y("p",{className:a.empty,children:"No user data source configured"},void 0,!1,void 0,this);let N=t?s.find((m)=>m.id===t):null;if(z&&N)return Y("div",{className:a.container,children:Y("div",{className:"flex items-center gap-2 rounded-lg bg-blue-500/15 border border-blue-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 flex items-center justify-center text-[10px] font-bold text-blue-300 flex-shrink-0",children:(N.name||N.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0 flex-1",children:[Y("span",{className:"text-[11px] font-medium text-blue-300 truncate",children:N.name||N.email},void 0,!1,void 0,this),N.name&&Y("span",{className:"text-[10px] text-blue-300/50 truncate",children:N.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("button",{type:"button",className:"text-[10px] text-blue-400 hover:text-blue-300 ml-auto flex-shrink-0",onClick:()=>b(!1),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Y("div",{className:a.container,children:[N&&Y("div",{className:"flex items-center gap-2 rounded-lg bg-blue-500/15 border border-blue-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 flex items-center justify-center text-[10px] font-bold text-blue-300 flex-shrink-0",children:(N.name||N.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0",children:[Y("span",{className:"text-[11px] font-medium text-blue-300 truncate",children:N.name||N.email},void 0,!1,void 0,this),N.name&&Y("span",{className:"text-[10px] text-blue-300/50 truncate",children:N.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("input",{type:"text",className:a.searchInput,placeholder:"Search users...",value:i,onChange:(m)=>o(m.target.value)},void 0,!1,void 0,this),Y("div",{className:a.listContainer,children:[s.length===0&&!k&&Y("p",{className:a.empty,children:"No users found"},void 0,!1,void 0,this),s.map((m)=>Y("button",{type:"button",className:m.id===t?a.listItemSelected:a.listItem,onClick:()=>{r(m),b(!0)},children:[Y("span",{className:a.listItemAvatar,children:(m.name||m.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0",children:[Y("span",{className:a.listItemName,children:m.name||m.email},void 0,!1,void 0,this),m.name?Y("span",{className:a.listItemEmail,children:m.email},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},m.id,!0,void 0,this)),g&&Y("button",{type:"button",className:a.loadMore,onClick:x,children:k?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function f0({listRolesAction:e,selectedRole:t,onSelect:r,ursTheme:n}){let a=n,[i,o]=ur(""),[s,l]=ur(ki),[c,d]=ur(1),[g,h]=ur(!1),[k,u]=ur(!1),[z,b]=ur(!!t),C=vi((N,m)=>{if(!e)return;u(!0),e.start({payload:{page:N,limit:20,search:m||void 0},onAfterHandle:(y)=>{let p=y.data,f=p?.items||p?.data||[],$=p?.meta?.hasNextPage===!0||f.length>=20;if(N===1){if(l(f),!m)ki=f}else l((J)=>[...J,...f]);h($&&f.length>0),u(!1)},onErrorHandle:()=>{u(!1)}})});y0(()=>{if(i===""&&ki.length>0){l(ki);return}C(1,i),d(1)},[i]);let x=vi(()=>{let N=c+1;d(N),C(N,i)});if(!e)return Y("p",{className:a.empty,children:"No role data source configured"},void 0,!1,void 0,this);if(z&&t)return Y("div",{className:a.container,children:Y("div",{className:"flex items-center gap-2 rounded-lg bg-emerald-500/15 border border-emerald-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-emerald-500/20 flex items-center justify-center text-[10px] font-bold text-emerald-300 flex-shrink-0",children:t.charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"text-[11px] font-medium text-emerald-300 truncate flex-1",children:t},void 0,!1,void 0,this),Y("button",{type:"button",className:"text-[10px] text-emerald-400 hover:text-emerald-300 ml-auto flex-shrink-0",onClick:()=>b(!1),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Y("div",{className:a.container,children:[Y("input",{type:"text",className:a.searchInput,placeholder:"Search roles...",value:i,onChange:(N)=>o(N.target.value)},void 0,!1,void 0,this),Y("div",{className:a.listContainer,children:[s.length===0&&!k&&Y("p",{className:a.empty,children:"No roles found"},void 0,!1,void 0,this),s.map((N)=>Y("button",{type:"button",className:N.name===t?a.listItemSelected:a.listItem,onClick:()=>{r(N),b(!0)},children:[Y("span",{className:a.listItemAvatar,children:N.name.charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{children:[Y("span",{className:a.listItemName,children:N.name},void 0,!1,void 0,this),N.description?Y("span",{className:a.listItemEmail,children:N.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)),g&&Y("button",{type:"button",className:a.loadMore,onClick:x,children:k?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function xi({nodeId:e,nodeData:t,onUpdateNode:r,onDeleteNode:n,onClose:a,listUsersAction:i,listRolesAction:o,panelTheme:s}){let l=s,c=t,d=c.nodeType,g=(h)=>{r(e,{...c,...h})};return Y("div",{className:l.container,children:[Y("div",{className:l.header,children:[Y("h3",{className:l.headerTitle,children:[d==="step"&&"Step Properties",d==="verifier"&&"Verifier Properties",d==="notification"&&"Notification Properties"]},void 0,!0,void 0,this),Y("button",{type:"button",className:l.closeButton,onClick:a,children:Y("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[Y("title",{children:"Close"},void 0,!1,void 0,this),Y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.body,children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"General"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-name-${e}`,className:l.label,children:"Name"},void 0,!1,void 0,this),Y("input",{id:`prop-name-${e}`,type:"text",className:l.input,value:c.label||"",onChange:(h)=>g({label:h.target.value}),placeholder:"Node name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-desc-${e}`,className:l.label,children:"Description"},void 0,!1,void 0,this),Y("textarea",{id:`prop-desc-${e}`,className:l.textarea,rows:2,value:c.description||"",onChange:(h)=>g({description:h.target.value}),placeholder:"Describe this node..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d==="verifier"&&Y(h0,{children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Assignment"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-vtype-${e}`,className:l.label,children:"Verifier Type"},void 0,!1,void 0,this),Y("select",{id:`prop-vtype-${e}`,className:l.select,value:c.verifierType||"role",onChange:(h)=>g({verifierType:h.target.value,verifierUserId:void 0,verifierUserEmail:void 0,verifierRole:void 0}),children:[Y("option",{value:"role",children:"Role"},void 0,!1,void 0,this),Y("option",{value:"user",children:"Specific User"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),c.verifierType==="user"&&Y(b0,{listUsersAction:i,selectedUserId:c.verifierUserId,onSelect:(h)=>g({verifierUserId:h.id,verifierUserEmail:h.email}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this),(c.verifierType==="role"||!c.verifierType)&&Y(f0,{listRolesAction:o,selectedRole:c.verifierRole,onSelect:(h)=>g({verifierRole:h.name}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Options"},void 0,!1,void 0,this),Y("div",{className:"flex items-center gap-2",children:[Y("input",{type:"checkbox",id:`prop-sig-${e}`,className:l.checkbox,checked:c.requireSignature||!1,onChange:(h)=>g({requireSignature:h.target.checked})},void 0,!1,void 0,this),Y("label",{htmlFor:`prop-sig-${e}`,className:l.checkboxLabel,children:"Require Signature"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c.verifierType==="role"&&Y("div",{className:"flex items-center gap-2",children:[Y("input",{type:"checkbox",id:`prop-all-${e}`,className:l.checkbox,checked:c.allMustApprove||!1,onChange:(h)=>g({allMustApprove:h.target.checked})},void 0,!1,void 0,this),Y("label",{htmlFor:`prop-all-${e}`,className:l.checkboxLabel,children:"All Must Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d==="notification"&&Y(h0,{children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Trigger"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-trigger-${e}`,className:l.label,children:"When to Notify"},void 0,!1,void 0,this),Y("select",{id:`prop-trigger-${e}`,className:l.select,value:c.trigger||"on_step_reached",onChange:(h)=>g({trigger:h.target.value}),children:pb.map((h)=>Y("option",{value:h.value,children:h.label},h.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Channels"},void 0,!1,void 0,this),Y(gb,{selected:c.channels||[],onChange:(h)=>g({channels:h}),msTheme:l.multiSelect},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Recipient"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-rtype-${e}`,className:l.label,children:"Recipient Type"},void 0,!1,void 0,this),Y("select",{id:`prop-rtype-${e}`,className:l.select,value:c.recipientType||"all_verifiers",onChange:(h)=>g({recipientType:h.target.value,recipientUserId:void 0,recipientUserEmail:void 0,recipientRole:void 0}),children:ub.map((h)=>Y("option",{value:h.value,children:h.label},h.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c.recipientType==="user"&&Y(b0,{listUsersAction:i,selectedUserId:c.recipientUserId,onSelect:(h)=>g({recipientUserId:h.id,recipientUserEmail:h.email}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this),c.recipientType==="role"&&Y(f0,{listRolesAction:o,selectedRole:c.recipientRole,onSelect:(h)=>g({recipientRole:h.name,recipientUserEmail:void 0}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Templates"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-title-tpl-${e}`,className:l.label,children:"Title Template"},void 0,!1,void 0,this),Y("input",{id:`prop-title-tpl-${e}`,type:"text",className:l.input,value:c.titleTemplate||"",onChange:(h)=>g({titleTemplate:h.target.value}),placeholder:"e.g. Verification required for {{entity_name}}"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-body-tpl-${e}`,className:l.label,children:"Body Template"},void 0,!1,void 0,this),Y("textarea",{id:`prop-body-tpl-${e}`,className:l.textarea,rows:3,value:c.bodyTemplate||"",onChange:(h)=>g({bodyTemplate:h.target.value}),placeholder:"Notification body..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:"pt-3 mt-auto",children:Y("button",{type:"button",className:l.deleteButton,onClick:()=>n(e),children:"Delete Node"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as mb,useEffectEvent as fl,useState as w0}from"react";import{jsxDEV as Xe}from"react/jsx-dev-runtime";var bb={container:"space-y-4",header:"space-y-1",title:"text-lg font-bold text-white/90 tracking-tight",description:"text-sm text-white/40",tabs:"flex items-center gap-1 p-1 rounded-xl bg-white/5 border border-white/10",tab:"px-3.5 py-1.5 rounded-lg text-xs font-medium text-white/40 transition-all cursor-pointer hover:text-white/60",tabActive:"px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-white/10 text-white/90 shadow-sm cursor-pointer",tabCount:"ml-1 text-[10px] opacity-50",list:"space-y-2",listItem:"flex items-center gap-4 p-4 rounded-xl border border-white/8 bg-white/[0.03] transition-all",listItemHover:"hover:bg-white/[0.06] hover:border-white/12",entityInfo:"flex-1 min-w-0 space-y-0.5",entityName:"text-sm font-semibold text-white/80 truncate",entityId:"text-[11px] text-white/30 font-mono truncate",flowName:"text-[11px] text-white/40",statusBadge:"px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider shrink-0",statusActive:"bg-amber-500/15 text-amber-300 ring-1 ring-amber-500/20",statusCompleted:"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/20",statusRejected:"bg-red-500/15 text-red-300 ring-1 ring-red-500/20",statusCancelled:"bg-white/8 text-white/30 ring-1 ring-white/10",progressSection:"flex items-center gap-2.5 shrink-0 w-[140px]",progressBar:"flex-1 h-1.5 rounded-full bg-white/8 overflow-hidden",progressFill:"h-full rounded-full transition-all duration-500",progressLabel:"text-[10px] text-white/40 font-medium whitespace-nowrap w-[45px] text-right",metaSection:"flex items-center gap-4 shrink-0",metaLabel:"text-[10px] text-white/30 uppercase tracking-wider",metaValue:"text-xs text-white/60",emptyState:"flex flex-col items-center gap-3 py-12",emptyIcon:"text-white/15",emptyText:"text-sm text-white/30",pagination:"flex items-center justify-center gap-2 pt-2",pageButton:"px-3 py-1.5 rounded-lg text-xs font-medium text-white/40 bg-white/5 border border-white/10 hover:bg-white/10 transition-all cursor-pointer",pageButtonActive:"px-3 py-1.5 rounded-lg text-xs font-semibold text-white/80 bg-white/10 border border-white/15",pageInfo:"text-xs text-white/30",loadingSpinner:"flex items-center justify-center py-8"},fb={container:"space-y-4",header:"space-y-1",title:"text-lg font-bold text-gray-900 tracking-tight",description:"text-sm text-gray-500",tabs:"flex items-center gap-1 p-1 rounded-xl bg-gray-100 border border-gray-200",tab:"px-3.5 py-1.5 rounded-lg text-xs font-medium text-gray-400 transition-all cursor-pointer hover:text-gray-600",tabActive:"px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-white text-gray-900 shadow-sm cursor-pointer",tabCount:"ml-1 text-[10px] opacity-50",list:"space-y-2",listItem:"flex items-center gap-4 p-4 rounded-xl border border-gray-200 bg-white transition-all",listItemHover:"hover:bg-gray-50 hover:border-gray-300",entityInfo:"flex-1 min-w-0 space-y-0.5",entityName:"text-sm font-semibold text-gray-800 truncate",entityId:"text-[11px] text-gray-400 font-mono truncate",flowName:"text-[11px] text-gray-500",statusBadge:"px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider shrink-0",statusActive:"bg-amber-100 text-amber-700 ring-1 ring-amber-200",statusCompleted:"bg-emerald-100 text-emerald-700 ring-1 ring-emerald-200",statusRejected:"bg-red-100 text-red-700 ring-1 ring-red-200",statusCancelled:"bg-gray-100 text-gray-400 ring-1 ring-gray-200",progressSection:"flex items-center gap-2.5 shrink-0 w-[140px]",progressBar:"flex-1 h-1.5 rounded-full bg-gray-200 overflow-hidden",progressFill:"h-full rounded-full transition-all duration-500",progressLabel:"text-[10px] text-gray-500 font-medium whitespace-nowrap w-[45px] text-right",metaSection:"flex items-center gap-4 shrink-0",metaLabel:"text-[10px] text-gray-400 uppercase tracking-wider",metaValue:"text-xs text-gray-600",emptyState:"flex flex-col items-center gap-3 py-12",emptyIcon:"text-gray-300",emptyText:"text-sm text-gray-400",pagination:"flex items-center justify-center gap-2 pt-2",pageButton:"px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 bg-white border border-gray-200 hover:bg-gray-50 transition-all cursor-pointer",pageButtonActive:"px-3 py-1.5 rounded-lg text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-300",pageInfo:"text-xs text-gray-400",loadingSpinner:"flex items-center justify-center py-8"},hb=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"completed",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"cancelled",label:"Cancelled"}];function hl({entityName:e,entityStatusesAction:t,theme:r,themeMode:n="dark",onEntityClick:a,pageSize:i=20}){let s={...n==="light"?fb:bb,...r},[l,c]=w0("all"),[d,g]=w0(1),h=fl((f,M)=>{t.start({payload:{entity_name:e,status:f==="all"?void 0:f,page:M||1,limit:i}})}),k=fl((f)=>{c(f),g(1),h(f==="all"?void 0:f,1)}),u=fl((f)=>{g(f),h(l==="all"?void 0:l,f)});mb(()=>{h(void 0,1)},[]);let z=t.state.data,b=t.state.isPending,C=z,x=C?.data?.items||[],N=C?.data?.total||0,m=Math.ceil(N/i)||1,y=(f)=>{switch(f){case"active":return s.statusActive;case"completed":return s.statusCompleted;case"rejected":return s.statusRejected;case"cancelled":return s.statusCancelled;default:return s.statusActive}},v=(f)=>{switch(f){case"completed":return"bg-emerald-400";case"rejected":return"bg-red-400";case"active":return"bg-gradient-to-r from-amber-400 to-cyan-400";default:return"bg-white/20"}},p=(f)=>{if(f.status==="completed")return 100;if(f.total_steps===0)return 0;return Math.round((f.current_step_order-1)/f.total_steps*100)};return Xe("div",{className:s.container,children:[Xe("header",{className:s.header,children:[Xe("h2",{className:s.title,children:"Verification Status"},void 0,!1,void 0,this),Xe("p",{className:s.description,children:[N," record",N!==1?"s":""," for ",e]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Xe("nav",{className:s.tabs,children:hb.map((f)=>Xe("button",{type:"button",className:l===f.value?s.tabActive:s.tab,onClick:()=>k(f.value),children:f.label},f.value,!1,void 0,this))},void 0,!1,void 0,this),b?Xe("div",{className:s.loadingSpinner,children:Xe("div",{className:`w-6 h-6 rounded-full border-2 animate-spin ${n==="light"?"border-gray-200 border-t-blue-500":"border-white/10 border-t-cyan-400"}`},void 0,!1,void 0,this)},void 0,!1,void 0,this):x.length===0?Xe("div",{className:s.emptyState,children:[Xe("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:s.emptyIcon,role:"img",children:[Xe("title",{children:"No records"},void 0,!1,void 0,this),Xe("path",{d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe("p",{className:s.emptyText,children:["No ",l==="all"?"":l," verification records found"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Xe("div",{className:s.list,children:x.map((f)=>{let M=p(f);return Xe("article",{className:`${s.listItem} ${a?s.listItemHover:""} ${a?"cursor-pointer":""}`,onClick:()=>a?.(f),onKeyDown:($)=>{if($.key==="Enter"||$.key===" ")a?.(f)},role:a?"button":void 0,tabIndex:a?0:void 0,children:[Xe("div",{className:s.entityInfo,children:[Xe("p",{className:s.entityName,children:f.entity_name},void 0,!1,void 0,this),Xe("p",{className:s.entityId,children:f.entity_id},void 0,!1,void 0,this),Xe("p",{className:s.flowName,children:f.flow_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe("div",{className:s.progressSection,children:[Xe("div",{className:s.progressBar,children:Xe("div",{className:`${s.progressFill} ${v(f.status)}`,style:{width:`${M}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Xe("span",{className:s.progressLabel,children:[f.current_step_order,"/",f.total_steps]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Xe("div",{className:s.metaSection,children:Xe("div",{children:[Xe("p",{className:s.metaLabel,children:"Started"},void 0,!1,void 0,this),Xe("p",{className:s.metaValue,children:new Date(f.started_at).toLocaleDateString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Xe("span",{className:`${s.statusBadge} ${y(f.status)}`,children:f.status==="completed"?"approved":f.status},void 0,!1,void 0,this)]},f.instance_id,!0,void 0,this)})},void 0,!1,void 0,this),m>1&&Xe("nav",{className:s.pagination,children:[Xe("button",{type:"button",className:s.pageButton,disabled:d<=1,onClick:()=>u(d-1),children:"Prev"},void 0,!1,void 0,this),Xe("span",{className:s.pageInfo,children:["Page ",d," of ",m]},void 0,!0,void 0,this),Xe("button",{type:"button",className:s.pageButton,disabled:d>=m,onClick:()=>u(d+1),children:"Next"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{addEdge as yb,applyEdgeChanges as wb,applyNodeChanges as kb,Background as vb,Controls as xb,MarkerType as zb,MiniMap as Nb,ReactFlow as Sb}from"@xyflow/react";import"@xyflow/react/dist/style.css";import{useEffect as k0,useEffectEvent as Tt,useRef as v0,useState as qr}from"react";import{jsxDEV as G,Fragment as Wb}from"react/jsx-dev-runtime";var Pb={step:mi,verifier:bi,notification:fi};function Cb(e){return{type:"default",animated:e,markerEnd:{type:zb.ArrowClosed,width:e?16:20,height:e?16:20,color:e?"rgba(255,255,255,0.35)":"#000000"},style:{stroke:e?"rgba(255,255,255,0.35)":"#000000",strokeWidth:e?1.5:2}}}var x0=0;function Tb(){return x0+=1,`node_${Date.now()}_${x0}`}function Lb(e,t,r){return e.map((n)=>{let a={label:n.name||`Step ${n.step_order}`,description:n.description||"",nodeType:n.node_type,stepOrder:n.step_order,selected:n.node_id===r};if(n.node_type==="verifier"){let i=t.verifier_configs.find((o)=>o.node_id===n.node_id);return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:{...a,verifierType:i?.verifier_type||"role",verifierUserId:i?.verifier_user_id||"",verifierRole:i?.verifier_role||"",verifierUserEmail:"",requireSignature:i?.require_signature||!1,allMustApprove:i?.all_must_approve||!1}}}if(n.node_type==="notification"){let i=t.notification_rules.find((c)=>c.node_id===n.node_id),o=i?.id||n.node_id,s=t.notification_channels.filter((c)=>c.rule_id===o||c.rule_id===n.node_id).map((c)=>c.channel),l=t.notification_recipients.find((c)=>c.rule_id===o||c.rule_id===n.node_id);return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:{...a,trigger:i?.trigger||"on_step_reached",channels:s,titleTemplate:i?.title_template||"",bodyTemplate:i?.body_template||"",recipientType:l?.recipient_type||"",recipientUserId:l?.recipient_user_id||"",recipientRole:l?.recipient_role||"",recipientUserEmail:""}}}return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:a}})}function Mb(e,t){return e.map((r)=>({id:r.edge_id,source:r.source_node_id,target:r.target_node_id,sourceHandle:r.source_handle||void 0,targetHandle:r.target_handle||void 0,...t,label:r.label||void 0}))}function Rb(e,t){let r={step:"New Step",verifier:"New Verifier",notification:"New Notification"},n={id:Tb(),type:e,position:t,data:{label:r[e],description:"",nodeType:e,stepOrder:0,selected:!1}};if(e==="verifier")n.data={...n.data,verifierType:"role",verifierRole:"",requireSignature:!1,allMustApprove:!1};if(e==="notification")n.data={...n.data,trigger:"on_step_reached",channels:[]};return n}function Bb(e,t,r,n,a,i,o,s,l){let c=l.map((p)=>({edge_id:p.id,source_node_id:p.source,target_node_id:p.target,source_handle:p.sourceHandle||void 0,target_handle:p.targetHandle||void 0,edge_type:"default",label:String(p.label||""),animated:!0})),d=new Set(s.filter((p)=>{return(p.data.nodeType||p.type)==="step"}).map((p)=>p.id)),g={};for(let p of c){if(!g[p.source_node_id])g[p.source_node_id]=[];g[p.source_node_id]?.push(p.target_node_id)}let h=(p,f=new Set)=>{let M=[];for(let $ of g[p]||[]){if(f.has($))continue;if(f.add($),d.has($))M.push($);else M.push(...h($,f))}return M},k={},u=new Set;for(let p of d){k[p]=h(p);for(let f of k[p])u.add(f)}let z={},b=[...d].filter((p)=>!u.has(p)),C=1;while(b.length>0){let p=b.shift();if(!p)break;if(z[p]!==void 0)continue;z[p]=C++;for(let f of k[p]||[])b.push(f)}let x=s.map((p)=>{let f=p.data,M=String(f.nodeType||p.type);return{node_id:p.id,node_type:M,step_order:M==="step"?z[p.id]??0:0,name:String(f.label||""),description:String(f.description||""),position_x:Math.round(p.position.x),position_y:Math.round(p.position.y),width:p.width||void 0,height:p.height||void 0}}),N=s.filter((p)=>{return p.data.nodeType==="verifier"}).map((p)=>{let f=p.data;return{node_id:p.id,verifier_type:f.verifierType||"role",verifier_user_id:f.verifierUserId,verifier_role:f.verifierRole,require_signature:Boolean(f.requireSignature),all_must_approve:Boolean(f.allMustApprove)}}),m=[],y=[],v=[];for(let p of s){let f=p.data;if(f.nodeType!=="notification")continue;let M=`rule_${p.id}`;m.push({id:M,node_id:p.id,trigger:f.trigger||"on_step_reached",title_template:f.titleTemplate,body_template:f.bodyTemplate});let $=f.channels||[];for(let J of $)y.push({rule_id:p.id,channel:J});if(f.recipientType)v.push({rule_id:p.id,recipient_type:f.recipientType,recipient_user_id:f.recipientUserId,recipient_role:f.recipientRole})}return{flow_id:e,entity_name:t,name:r,description:n,trigger_on:a,is_draft:i,viewport:o,graph:{steps:x,edges:c,verifier_configs:N,notification_rules:m,notification_recipients:v,notification_channels:y}}}function z0({entityName:e,title:t,subtitle:r,flowListAction:n,flowGetAction:a,flowSaveAction:i,flowPublishAction:o,flowDeleteAction:s,pendingAction:l,decideAction:c,listUsersAction:d,listRolesAction:g,entityStatusesAction:h,onFlowSelected:k,onDecisionMade:u,onEntityClick:z,onBack:b,showPending:C=!0,showEntityStatuses:x=!1,className:N,themeMode:m="dark"}){let y=bl(m);u0(y);let v=Cb(m==="dark"),p=Hn(),[f,M]=qr([]),[$,J]=qr([]),[U,E]=qr(!1),[Z,B]=qr(""),[Q,S]=qr(""),[O,A]=qr("create"),[ee,_]=qr(null),[H,T]=qr("list"),[ie,q]=qr(!1),ce=v0(null),oe=v0(null),Ze=t||`${e} Verification`,$e=r||e,Ce=Tt((ne)=>{M((W)=>kb(ne,W)),p.setIsDirty(!0)}),fe=Tt((ne)=>{J((W)=>wb(ne,W)),p.setIsDirty(!0)}),xe=Tt((ne)=>{J((W)=>yb({...ne,...v},W)),p.setIsDirty(!0)}),Oe=Tt((ne,W)=>{p.setSelectedNodeId(W.id),M((V)=>V.map((Ne)=>({...Ne,data:{...Ne.data,selected:Ne.id===W.id}})))}),Le=Tt(()=>{p.setSelectedNodeId(null),M((ne)=>ne.map((W)=>({...W,data:{...W.data,selected:!1}})))}),ve=Tt((ne)=>{ne.preventDefault(),ne.dataTransfer.dropEffect="move",E(!0)}),R=Tt(()=>{E(!1)}),de=Tt((ne)=>{ne.preventDefault(),E(!1);let W=ne.dataTransfer.getData("application/reactflow-nodetype");if(!W)return;let V=ce.current?.getBoundingClientRect();if(!V||!oe.current)return;let Ne=oe.current.screenToFlowPosition({x:ne.clientX-V.left,y:ne.clientY-V.top}),ze=Rb(W,Ne);M((Me)=>[...Me,ze]),p.setSelectedNodeId(ze.id),p.setIsDirty(!0)}),te=Tt((ne,W)=>{M((V)=>V.map((Ne)=>{if(Ne.id!==ne)return Ne;return{...Ne,data:{...W,selected:!0}}})),p.setIsDirty(!0)}),ye=Tt((ne)=>{M((W)=>W.filter((V)=>V.id!==ne)),J((W)=>W.filter((V)=>V.source!==ne&&V.target!==ne)),p.setSelectedNodeId(null),p.setIsDirty(!0)}),D=Tt(()=>{if(!i)return;let ne=p.selectedFlowId;if(!ne)ne=crypto.randomUUID(),p.setSelectedFlowId(ne);let W=Z||`${e} Flow`;p.setIsSaving(!0);let V=oe.current?oe.current.getViewport():void 0,Ne=Bb(ne,e,W,Q,O,!0,V,f,$);i.start({payload:Ne,onAfterHandle:(ze)=>{let Me=ze;if(Me.flow_id)p.setSelectedFlowId(Me.flow_id);p.setIsSaving(!1),p.setIsDirty(!1),Ue()},onErrorHandle:()=>{p.setIsSaving(!1)}})}),j=Tt(()=>{if(!o||!p.selectedFlowId)return;o.start({payload:{flow_id:p.selectedFlowId},onAfterHandle:()=>{Ue()}})}),re=Tt(()=>{if(!s||!ee)return;s.start({payload:{flow_id:ee},onAfterHandle:()=>{_(null),p.setSelectedFlowId(null),B(""),S(""),M([]),J([]),T("list"),Ue()},onErrorHandle:()=>{_(null)}})}),Ke=Tt((ne)=>{p.setSelectedFlowId(ne),k?.(ne),T("designer")}),I=Tt(()=>{B(`${e} Flow`),S(""),A("create"),q(!0)}),ue=Tt(()=>{p.setSelectedFlowId(null),M([]),J([]),p.setIsDirty(!0),q(!1),T("designer")}),We=Tt(()=>{T("list"),p.setSelectedNodeId(null),Ue()}),Ue=Tt(()=>{p.setLoadingFlows(!0),n.start({payload:{entity_name:e},onAfterHandle:(ne)=>{let V=ne.data;if(V)p.setFlows(V);else p.setFlows([]);p.setLoadingFlows(!1)},onErrorHandle:()=>{p.setFlows([]),p.setLoadingFlows(!1)}})}),gt=Tt((ne)=>{p.setLoadingGraph(!0),a.start({payload:{flow_id:ne},onAfterHandle:(W)=>{let V=W,Ne=V.data?.flow;if(Ne)B(Ne.name||""),S(Ne.description||""),A(Ne.trigger_on||"create");let ze=V.data?.graph;if(ze?.steps&&ze.steps.length>0){p.setGraphData(ze);let Me=Lb(ze.steps,ze,null);M(Me),J(Mb(ze.edges,v));let gr=new Set;for(let br of Me){let Xt=br.data;if(Xt.nodeType==="verifier"&&Xt.verifierType==="user"&&Xt.verifierUserId)gr.add(Xt.verifierUserId);if(Xt.nodeType==="notification"&&Xt.recipientType==="user"&&Xt.recipientUserId)gr.add(Xt.recipientUserId)}if(gr.size>0&&d)d.start({payload:{page:1,limit:100},onAfterHandle:(br)=>{let Nr=br.data,Vr=Nr?.items||Nr?.data||[],ar=new Map;for(let Ye of Vr)if(gr.has(Ye.id))ar.set(Ye.id,Ye.email);if(ar.size>0)M((Ye)=>Ye.map((Ut)=>{let Lt=Ut.data;if(Lt.nodeType==="verifier"&&Lt.verifierUserId&&ar.has(Lt.verifierUserId))return{...Ut,data:{...Lt,verifierUserEmail:ar.get(Lt.verifierUserId)}};if(Lt.nodeType==="notification"&&Lt.recipientUserId&&ar.has(Lt.recipientUserId))return{...Ut,data:{...Lt,recipientUserEmail:ar.get(Lt.recipientUserId)}};return Ut}))}})}else M([]),J([]);p.setLoadingGraph(!1),p.setIsDirty(!1)},onErrorHandle:()=>{p.setLoadingGraph(!1)}})});k0(()=>{Ue()},[]),k0(()=>{if(p.selectedFlowId)gt(p.selectedFlowId)},[p.selectedFlowId]);let Ge=p.flows.find((ne)=>ne.id===p.selectedFlowId),Qt=p.selectedNodeId?f.find((ne)=>ne.id===p.selectedNodeId)||null:null,$t=G("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[G("title",{children:"Back"},void 0,!1,void 0,this),G("path",{d:"M19 12H5"},void 0,!1,void 0,this),G("path",{d:"m12 19-7-7 7-7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),zr={create:"On Create",update:"On Update",delete:"On Delete",manual:"Manual"};return G("div",{className:w(y.layout.root,N),children:[ee&&G("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[G("button",{type:"button","aria-label":"Close",className:"absolute inset-0 cursor-default",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>_(null)},void 0,!1,void 0,this),G("div",{className:m==="light"?"relative rounded-xl border border-gray-200 bg-white p-6 w-full max-w-sm space-y-4 shadow-2xl":"relative rounded-xl border border-white/[0.08] bg-[#12121a] p-6 w-full max-w-sm space-y-4 shadow-2xl",children:[G("p",{className:m==="light"?"text-[13px] font-semibold text-gray-900":"text-[13px] font-semibold text-white/90",children:"Delete Flow"},void 0,!1,void 0,this),G("p",{className:m==="light"?"text-[12px] text-gray-500 leading-relaxed":"text-[12px] text-white/50 leading-relaxed",children:['Are you sure you want to delete "',p.flows.find((ne)=>ne.id===ee)?.name||"this flow",'"? This action cannot be undone.']},void 0,!0,void 0,this),G("div",{className:"flex items-center justify-end gap-2 pt-1",children:[G("button",{type:"button",onClick:()=>_(null),className:m==="light"?"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all":"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",children:"Cancel"},void 0,!1,void 0,this),G("button",{type:"button",onClick:re,className:y.header.deleteButton,children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ie&&G("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[G("button",{type:"button","aria-label":"Close",className:"absolute inset-0 cursor-default",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>q(!1)},void 0,!1,void 0,this),G("div",{className:m==="light"?"relative rounded-xl border border-gray-200 bg-white p-6 w-full max-w-md space-y-5 shadow-2xl":"relative rounded-xl border border-white/[0.08] bg-[#12121a] p-6 w-full max-w-md space-y-5 shadow-2xl",children:[G("p",{className:m==="light"?"text-[14px] font-semibold text-gray-900":"text-[14px] font-semibold text-white/90",children:"Create New Flow"},void 0,!1,void 0,this),G("div",{className:"space-y-3",children:[G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-name",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Flow Name"},void 0,!1,void 0,this),G("input",{id:"vf-create-name",type:"text",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 placeholder:text-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 placeholder:text-white/20",placeholder:"Enter flow name...",value:Z,onChange:(ne)=>B(ne.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-desc",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Description"},void 0,!1,void 0,this),G("textarea",{id:"vf-create-desc",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 resize-none placeholder:text-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 resize-none placeholder:text-white/20",placeholder:"Describe this verification flow...",rows:3,value:Q,onChange:(ne)=>S(ne.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-trigger",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Trigger On"},void 0,!1,void 0,this),G("select",{id:"vf-create-trigger",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20",value:O,onChange:(ne)=>A(ne.target.value),children:[G("option",{value:"create",children:"On Create"},void 0,!1,void 0,this),G("option",{value:"update",children:"On Update"},void 0,!1,void 0,this),G("option",{value:"delete",children:"On Delete"},void 0,!1,void 0,this),G("option",{value:"manual",children:"Manual"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"flex items-center justify-end gap-2 pt-1",children:[G("button",{type:"button",onClick:()=>q(!1),className:m==="light"?"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all":"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",children:"Cancel"},void 0,!1,void 0,this),G("button",{type:"button",onClick:ue,disabled:!Z.trim(),className:Z.trim()?y.header.saveButton:y.header.saveButtonDisabled,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("header",{className:y.header.container,children:[G("div",{className:"flex items-center gap-3",children:[H==="list"&&b&&G("button",{type:"button",onClick:b,className:y.header.backButton,title:"Back",children:$t},void 0,!1,void 0,this),H==="designer"&&G("button",{type:"button",onClick:We,className:y.header.backButton,title:"Back to Flows",children:$t},void 0,!1,void 0,this),G("h1",{className:y.header.title,children:Ze},void 0,!1,void 0,this),H==="list"&&G("span",{className:y.header.subtitle,children:$e},void 0,!1,void 0,this),H==="list"&&(C||x)&&G("nav",{className:y.tabs.container,children:[G("button",{type:"button",className:p.activeTab==="flow"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("flow"),children:"Flows"},void 0,!1,void 0,this),C&&G("button",{type:"button",className:p.activeTab==="pending"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("pending"),children:"Pending"},void 0,!1,void 0,this),x&&h&&G("button",{type:"button",className:p.activeTab==="statuses"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("statuses"),children:"Statuses"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.header.actions,children:H==="designer"&&p.activeTab==="flow"&&G(Wb,{children:[G("span",{className:"text-[11px] text-white/50 font-medium",children:Z||"Untitled Flow"},void 0,!1,void 0,this),Ge?.is_draft!==void 0&&G("span",{className:w("text-[9px] font-medium px-2 py-0.5 rounded-full",Ge?.is_draft?"bg-amber-500/15 border border-amber-500/20 text-amber-400":"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400"),children:Ge?.is_draft?"Draft":"Published"},void 0,!1,void 0,this),i&&G("button",{type:"button",onClick:D,disabled:p.isSaving||!p.isDirty,className:p.isDirty?y.header.saveButton:y.header.saveButtonDisabled,children:p.isSaving?"Saving...":"Save"},void 0,!1,void 0,this),o&&Ge?.is_draft&&G("button",{type:"button",onClick:j,className:y.header.publishButton,children:"Publish"},void 0,!1,void 0,this),s&&p.selectedFlowId&&G("button",{type:"button",onClick:()=>_(p.selectedFlowId),className:y.header.deleteButton,children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H==="list"&&p.activeTab==="flow"&&G("div",{className:y.flowList.container,children:[p.isLoadingFlows&&G("div",{className:"flex items-center justify-center py-20",children:G("div",{className:y.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),!p.isLoadingFlows&&G("div",{className:y.flowList.grid,children:[i&&G("button",{type:"button",className:y.flowList.createButton,onClick:I,children:[G("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/20 group-hover:text-white/40 transition-colors mb-3","aria-hidden":"true",children:[G("title",{children:"Create"},void 0,!1,void 0,this),G("path",{d:"M12 5v14"},void 0,!1,void 0,this),G("path",{d:"M5 12h14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{className:"text-[12px] font-medium text-white/30 group-hover:text-white/50 transition-colors",children:"Create New Flow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.flows.map((ne)=>G("div",{className:y.flowList.card.container,children:[G("div",{className:y.flowList.card.header,children:[G("button",{type:"button",className:"flex-1 min-w-0 text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>Ke(ne.id),children:[G("h3",{className:y.flowList.card.name,children:ne.name},void 0,!1,void 0,this),ne.description&&G("p",{className:y.flowList.card.description,children:ne.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.flowList.card.actions,children:s&&G("button",{type:"button",className:y.flowList.card.deleteButton,onClick:()=>_(ne.id),title:"Delete flow",children:G("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[G("title",{children:"Delete"},void 0,!1,void 0,this),G("path",{d:"M3 6h18"},void 0,!1,void 0,this),G("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"},void 0,!1,void 0,this),G("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",className:"w-full text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>Ke(ne.id),children:G("div",{className:y.flowList.card.meta,children:[G("span",{className:w(y.flowList.card.badge,ne.is_draft?y.flowList.card.badgeDraft:y.flowList.card.badgePublished),children:ne.is_draft?"Draft":"Published"},void 0,!1,void 0,this),ne.trigger_on&&G("span",{className:y.flowList.card.triggerBadge,children:zr[ne.trigger_on]||ne.trigger_on},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},ne.id,!0,void 0,this)),p.flows.length===0&&!i&&G("div",{className:y.flowList.empty.container,children:[G("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",className:y.flowList.empty.icon,"aria-hidden":"true",children:[G("title",{children:"No flows"},void 0,!1,void 0,this),G("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"},void 0,!1,void 0,this),G("path",{d:"M14 2v6h6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{className:y.flowList.empty.title,children:"No verification flows"},void 0,!1,void 0,this),G("p",{className:y.flowList.empty.description,children:"No flows have been created for this entity yet."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H==="designer"&&p.activeTab==="flow"&&G("div",{className:y.layout.main,children:[G("aside",{className:y.layout.sidebar,children:G(hi,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{ref:ce,className:y.layout.canvas,role:"application",onDragOver:ve,onDragLeave:R,onDrop:de,children:[p.isLoadingGraph&&G("div",{className:y.loading.container,children:G("div",{className:y.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),U&&G("div",{className:y.canvas.dropIndicator},void 0,!1,void 0,this),G(Sb,{nodes:f,edges:$,nodeTypes:Pb,onNodesChange:Ce,onEdgesChange:fe,onConnect:xe,onNodeClick:Oe,onPaneClick:Le,onInit:(ne)=>{oe.current=ne},deleteKeyCode:["Backspace","Delete"],fitView:!0,minZoom:0.2,maxZoom:3,snapToGrid:!0,snapGrid:[20,20],defaultEdgeOptions:v,proOptions:{hideAttribution:!0},className:y.canvas.background,children:[G(vb,{color:m==="dark"?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.05)",gap:24,size:1},void 0,!1,void 0,this),G(xb,{showInteractive:!1,position:"bottom-right",className:m==="dark"?"!bg-white/[0.04] !border-white/[0.06] !rounded-lg [&>button]:!bg-transparent [&>button]:!border-white/[0.06] [&>button]:!text-white/40 [&>button:hover]:!bg-white/[0.06]":"!bg-white !border-gray-200 !rounded-lg !shadow-sm [&>button]:!bg-transparent [&>button]:!border-gray-200 [&>button]:!text-gray-400 [&>button:hover]:!bg-gray-50"},void 0,!1,void 0,this),G(Nb,{nodeColor:(ne)=>{let W=String(ne.data?.nodeType||"step");if(W==="verifier")return"#f59e0b";if(W==="notification")return"#8b5cf6";return"#3b82f6"},maskColor:m==="dark"?"rgba(0,0,0,0.7)":"rgba(255,255,255,0.7)",className:m==="dark"?"!bg-white/[0.02] !border-white/[0.06] !rounded-lg":"!bg-white/80 !border-gray-200 !rounded-lg !shadow-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ge&&!Qt&&G("div",{className:y.overlay.info,children:[G("h3",{className:y.overlay.infoTitle,children:Ge.name},void 0,!1,void 0,this),G("p",{className:y.overlay.infoDescription,children:Ge.description||"No description"},void 0,!1,void 0,this),G("div",{className:"flex gap-2 mt-2",children:G("span",{className:w(y.overlay.badge,Ge.is_draft?y.overlay.badgeDraft:y.overlay.badgePublished),children:Ge.is_draft?"Draft":"Published"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.container,children:G("div",{className:"flex items-center gap-4 text-xs",children:[G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.step},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Step"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.verifier},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Verifier"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.notification},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Notification"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Qt&&G("aside",{className:y.layout.propertiesPanel,children:G(xi,{nodeId:Qt.id,nodeData:Qt.data,onUpdateNode:te,onDeleteNode:ye,onClose:()=>{p.setSelectedNodeId(null),Le()},listUsersAction:d,listRolesAction:g,panelTheme:y.propertiesPanel},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.activeTab==="pending"&&C&&G("div",{className:"flex-1 overflow-auto p-6",children:G(yi,{pendingAction:l,decideAction:c,onDecisionMade:u},void 0,!1,void 0,this)},void 0,!1,void 0,this),p.activeTab==="statuses"&&x&&h&&G("div",{className:"flex-1 overflow-auto p-6",children:G(hl,{entityName:e,entityStatusesAction:h,onEntityClick:z,themeMode:m},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffectEvent as AC}from"react";import{jsxDEV as ZC}from"react/jsx-dev-runtime";import{useGSAP as L0}from"@gsap/react";import M0 from"gsap";import{useEffect as $b,useEffectEvent as C0,useRef as T0,useState as _b}from"react";import{batch as N0,createStore as S0}from"h-state";var Ib={instance:null,flow:null,verifications:[],pendingRequirements:[],currentStep:0,totalSteps:0,isCompleted:!1,isRejected:!1,isLoading:!1,isDeciding:!1,isStarting:!1,error:null,decisionReason:""},{useStore:zi}=S0(Ib,{setInstance:(e)=>(t)=>{e.instance=t},setFlow:(e)=>(t)=>{e.flow=t},setVerifications:(e)=>(t)=>{e.verifications=t},setPendingRequirements:(e)=>(t)=>{e.pendingRequirements=t},setProgress:(e)=>(t,r)=>{e.currentStep=t,e.totalSteps=r},setCompleted:(e)=>(t)=>{e.isCompleted=t},setRejected:(e)=>(t)=>{e.isRejected=t},setLoading:(e)=>(t)=>{e.isLoading=t},setDeciding:(e)=>(t)=>{e.isDeciding=t},setStarting:(e)=>(t)=>{e.isStarting=t},setError:(e)=>(t)=>{e.error=t},setDecisionReason:(e)=>(t)=>{e.decisionReason=t},reset:(e)=>()=>{N0(()=>{e.instance=null,e.flow=null,e.verifications=[],e.pendingRequirements=[],e.currentStep=0,e.totalSteps=0,e.isCompleted=!1,e.isRejected=!1,e.isLoading=!1,e.isDeciding=!1,e.isStarting=!1,e.error=null,e.decisionReason=""})}}),Hb={items:[],isLoading:!1,decidingId:null,error:null},{useStore:Ni}=S0(Hb,{setItems:(e)=>(t)=>{e.items=t},setLoading:(e)=>(t)=>{e.isLoading=t},setDecidingId:(e)=>(t)=>{e.decidingId=t},setError:(e)=>(t)=>{e.error=t},removeItem:(e)=>(t)=>{e.items=e.items.filter((r)=>r.instance_id!==t)},reset:(e)=>()=>{N0(()=>{e.items=[],e.isLoading=!1,e.decidingId=null,e.error=null})}});var Gt={container:{base:"relative w-full",wrapper:"relative z-10 w-full"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",titleWrapper:"flex-1",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",subtitle:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",statusBadge:{base:"inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold uppercase tracking-wide",active:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",completed:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400",rejected:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",none:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"}},progress:{container:"mb-6",bar:"h-2 w-full bg-zinc-200 dark:bg-zinc-700 rounded-full overflow-hidden",barFill:"h-full bg-blue-500 rounded-full transition-all duration-500 ease-out",barFillCompleted:"h-full bg-emerald-500 rounded-full transition-all duration-500 ease-out",barFillRejected:"h-full bg-red-500 rounded-full transition-all duration-500 ease-out",label:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400 mt-2",stepIndicator:"font-medium text-zinc-700 dark:text-zinc-300"},requirements:{container:"space-y-2 mb-6",title:"text-sm font-semibold text-zinc-700 dark:text-zinc-300 mb-3",item:{base:"flex items-center justify-between p-3 rounded-lg text-sm transition-colors",pending:"bg-amber-50 border border-amber-200 dark:bg-amber-900/10 dark:border-amber-800/50",approved:"bg-emerald-50 border border-emerald-200 dark:bg-emerald-900/10 dark:border-emerald-800/50",rejected:"bg-red-50 border border-red-200 dark:bg-red-900/10 dark:border-red-800/50"},verifierLabel:"text-zinc-700 dark:text-zinc-300 font-medium",signatureBadge:"text-xs px-2 py-0.5 rounded bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400"},actions:{container:"flex flex-col sm:flex-row gap-3 mb-6",approveButton:"flex-1 px-4 py-2.5 rounded-xl bg-emerald-600 text-white font-medium text-sm hover:bg-emerald-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",rejectButton:"flex-1 px-4 py-2.5 rounded-xl bg-red-600 text-white font-medium text-sm hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",startButton:"px-6 py-2.5 rounded-xl bg-blue-600 text-white font-medium text-sm hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",reasonInput:"w-full px-4 py-2.5 rounded-xl border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white text-sm placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent mb-3"},history:{container:"space-y-3",title:"text-sm font-semibold text-zinc-700 dark:text-zinc-300 mb-3",item:{base:"flex items-start gap-3 p-3 rounded-lg text-sm",approved:"bg-emerald-50/50 dark:bg-emerald-900/5",rejected:"bg-red-50/50 dark:bg-red-900/5",pending:"bg-zinc-50 dark:bg-zinc-800/30"},decision:"font-medium text-zinc-900 dark:text-white",reason:"text-zinc-500 dark:text-zinc-400 text-xs mt-1",timestamp:"text-zinc-400 dark:text-zinc-500 text-xs whitespace-nowrap"},pendingList:{container:"space-y-3",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-1",subtitle:"text-sm text-zinc-600 dark:text-zinc-400 mb-6",item:{base:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl border border-zinc-200 dark:border-zinc-700/50 bg-white dark:bg-zinc-800/60 hover:shadow-md transition-shadow",entityName:"text-xs font-mono px-2 py-0.5 rounded bg-zinc-100 dark:bg-zinc-700 text-zinc-600 dark:text-zinc-400",flowName:"font-medium text-zinc-900 dark:text-white",stepInfo:"text-sm text-zinc-500 dark:text-zinc-400",timestamp:"text-xs text-zinc-400 dark:text-zinc-500"},actions:"flex gap-2 flex-shrink-0",empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"}},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 mb-4",text:"text-sm text-red-600 dark:text-red-400"}};function P0(e){return{...Gt,...e,container:{...Gt.container,...e.container},card:{...Gt.card,...e.card},header:{...Gt.header,...e.header},progress:{...Gt.progress,...e.progress},requirements:{...Gt.requirements,...e.requirements},actions:{...Gt.actions,...e.actions},history:{...Gt.history,...e.history},pendingList:{...Gt.pendingList,...e.pendingList},loading:{...Gt.loading,...e.loading},error:{...Gt.error,...e.error}}}import{jsxDEV as je}from"react/jsx-dev-runtime";M0.registerPlugin(L0);function R0({pendingAction:e,decideAction:t,title:r="Pending Verifications",subtitle:n="Items waiting for your approval",onDecisionMade:a,className:i}){let o=Gt,s=T0(null),l=T0(null),[c,d]=_b(null),g=Ni(),h=C0(()=>{g.setLoading(!0),g.setError(null),e.start({payload:void 0,onAfterHandle:(u)=>{let z=u;if(z?.data)g.setItems(z.data);g.setLoading(!1)},onErrorHandle:(u)=>{g.setError(u instanceof Error?u.message:"Failed to load pending verifications"),g.setLoading(!1)}})}),k=C0((u,z,b)=>{g.setDecidingId(u.instance_id),t.start({payload:{entity_name:u.entity_name,entity_id:u.entity_id,decision:z,reason:b},onAfterHandle:()=>{g.removeItem(u.instance_id),g.setDecidingId(null),d(null),a?.(u.entity_name,u.entity_id)},onErrorHandle:(C)=>{g.setError(C instanceof Error?C.message:"Failed to submit decision"),g.setDecidingId(null)}})});return $b(()=>{h()},[]),L0(()=>{if(!l.current)return;M0.fromTo(l.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:s}),je("div",{ref:s,className:w(o.container.base,i),children:je("div",{className:o.container.wrapper,children:je("div",{ref:l,className:w(o.card.base,o.card.padding,o.card.background,o.card.border,o.card.shadow,o.card.rounded),children:[je("h2",{className:o.pendingList.title,children:r},void 0,!1,void 0,this),je("p",{className:o.pendingList.subtitle,children:n},void 0,!1,void 0,this),g.error&&je("div",{className:o.error.container,children:je("p",{className:o.error.text,children:g.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),g.isLoading?je("div",{className:o.loading.container,children:[je("div",{className:o.loading.spinner},void 0,!1,void 0,this),je("p",{className:o.loading.text,children:"Loading pending items..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):g.items.length===0?je("div",{className:o.pendingList.empty.container,children:[je("svg",{className:o.pendingList.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[je("title",{children:"No pending verifications"},void 0,!1,void 0,this),je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),je("p",{className:o.pendingList.empty.text,children:"No pending verifications"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):je("div",{className:o.pendingList.container,children:g.items.map((u)=>je("div",{className:o.pendingList.item.base,children:[je("div",{className:"flex-1 min-w-0",children:[je("div",{className:"flex items-center gap-2 mb-1",children:[je("span",{className:o.pendingList.item.entityName,children:u.entity_name},void 0,!1,void 0,this),je("span",{className:o.pendingList.item.flowName,children:u.flow_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),je("p",{className:o.pendingList.item.stepInfo,children:["Step ",u.step_order,u.step_name&&` \u2014 ${u.step_name}`,u.require_signature&&" \u2022 Signature required"]},void 0,!0,void 0,this),je("p",{className:o.pendingList.item.timestamp,children:new Date(u.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c?.id===u.instance_id?je("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[je("input",{type:"text",placeholder:"Reason (optional)",value:c.reason,onChange:(z)=>d({...c,reason:z.target.value}),className:"px-3 py-1.5 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-sm text-zinc-900 dark:text-white w-48"},void 0,!1,void 0,this),je("div",{className:"flex gap-2",children:[je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-emerald-600 text-white text-xs font-medium hover:bg-emerald-700 disabled:opacity-50",disabled:g.decidingId===u.instance_id,onClick:()=>k(u,c.decision,c.reason),children:g.decidingId===u.instance_id?"...":"Confirm"},void 0,!1,void 0,this),je("button",{type:"button",className:"px-3 py-1.5 rounded-lg border border-zinc-300 dark:border-zinc-600 text-zinc-700 dark:text-zinc-300 text-xs font-medium hover:bg-zinc-50 dark:hover:bg-zinc-800",onClick:()=>d(null),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):je("div",{className:o.pendingList.actions,children:[je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-emerald-600 text-white text-xs font-medium hover:bg-emerald-700 transition-colors",onClick:()=>d({id:u.instance_id,decision:"approved",reason:""}),children:"\u2713 Approve"},void 0,!1,void 0,this),je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-red-600 text-white text-xs font-medium hover:bg-red-700 transition-colors",onClick:()=>d({id:u.instance_id,decision:"rejected",reason:""}),children:"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},u.instance_id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as I0}from"@gsap/react";import H0 from"gsap";import{useEffect as Fb,useEffectEvent as yl,useRef as B0,useState as W0}from"react";import{jsxDEV as Te,Fragment as qb}from"react/jsx-dev-runtime";H0.registerPlugin(I0);function $0({variant:e="default",entityName:t,entityId:r,title:n="Verification",subtitle:a,statusAction:i,decideAction:o,startAction:s,flowId:l,showHistory:c=!0,showProgress:d=!0,allowStart:g=!1,onDecisionMade:h,onFlowStarted:k,onFlowCompleted:u,className:z}){let b=Gt,C=B0(null),x=B0(null),[N,m]=W0(!1),[y,v]=W0(null),p=zi(),f=yl(()=>{p.setLoading(!0),p.setError(null),i.start({payload:{entity_name:t,entity_id:r},onAfterHandle:(B)=>{let Q=B;if(Q?.data)p.setInstance(Q.data.instance),p.setFlow(Q.data.flow),p.setVerifications(Q.data.verifications),p.setPendingRequirements(Q.data.pending_requirements),p.setProgress(Q.data.current_step,Q.data.total_steps),p.setCompleted(Q.data.is_completed),p.setRejected(Q.data.is_rejected);p.setLoading(!1)},onErrorHandle:(B)=>{p.setError(B instanceof Error?B.message:"Failed to load verification status"),p.setLoading(!1)}})}),M=yl((B)=>{p.setDeciding(!0),p.setError(null),o.start({payload:{entity_name:t,entity_id:r,decision:B,reason:p.decisionReason||void 0},onAfterHandle:(Q)=>{let S=Q;if(p.setDeciding(!1),p.setDecisionReason(""),m(!1),v(null),S?.flow_completed)u?.();h?.(B),f()},onErrorHandle:(Q)=>{p.setError(Q instanceof Error?Q.message:"Failed to submit decision"),p.setDeciding(!1)}})}),$=yl(()=>{if(!s||!l)return;p.setStarting(!0),p.setError(null),s.start({payload:{flow_id:l,entity_name:t,entity_id:r},onAfterHandle:(B)=>{let Q=B;if(p.setStarting(!1),Q?.instance_id)k?.(Q.instance_id);f()},onErrorHandle:(B)=>{p.setError(B instanceof Error?B.message:"Failed to start verification flow"),p.setStarting(!1)}})});Fb(()=>{f()},[t,r]),I0(()=>{if(!x.current)return;H0.fromTo(x.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:C});let J=()=>{if(p.isCompleted)return{label:"Completed",style:b.header.statusBadge.completed};if(p.isRejected)return{label:"Rejected",style:b.header.statusBadge.rejected};if(p.instance)return{label:"In Progress",style:b.header.statusBadge.active};return{label:"No Flow",style:b.header.statusBadge.none}},U=p.totalSteps>0?Math.round(p.currentStep/p.totalSteps*100):0,E=p.pendingRequirements.some((B)=>B.status==="pending"),Z=J();return Te("div",{ref:C,className:w(b.container.base,z),children:Te("div",{className:b.container.wrapper,children:Te("div",{ref:x,className:w(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:[Te("div",{className:b.header.container,children:[Te("div",{className:b.header.titleWrapper,children:[Te("h2",{className:b.header.title,children:[n,p.flow&&Te("span",{className:"text-sm font-normal text-zinc-500 dark:text-zinc-400 ml-2",children:["\u2014 ",p.flow.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a&&Te("p",{className:b.header.subtitle,children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:w(b.header.statusBadge.base,Z.style),children:Z.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.error&&Te("div",{className:b.error.container,children:Te("p",{className:b.error.text,children:p.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),p.isLoading?Te("div",{className:b.loading.container,children:[Te("div",{className:b.loading.spinner},void 0,!1,void 0,this),Te("p",{className:b.loading.text,children:"Loading verification status..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Te(qb,{children:[d&&p.totalSteps>0&&Te("div",{className:b.progress.container,children:[Te("div",{className:b.progress.bar,children:Te("div",{className:w(p.isCompleted?b.progress.barFillCompleted:p.isRejected?b.progress.barFillRejected:b.progress.barFill),style:{width:`${U}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te("div",{className:b.progress.label,children:[Te("span",{className:b.progress.stepIndicator,children:["Step ",p.currentStep," of ",p.totalSteps]},void 0,!0,void 0,this),Te("span",{children:[U,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),p.pendingRequirements.length>0&&Te("div",{className:b.requirements.container,children:[Te("h3",{className:b.requirements.title,children:["Pending Verifiers (",p.pendingRequirements.filter((B)=>B.status==="pending").length,")"]},void 0,!0,void 0,this),p.pendingRequirements.map((B)=>Te("div",{className:w(b.requirements.item.base,B.status==="approved"?b.requirements.item.approved:B.status==="rejected"?b.requirements.item.rejected:b.requirements.item.pending),children:[Te("div",{className:"flex items-center gap-2",children:[Te("span",{className:b.requirements.verifierLabel,children:B.verifier_type==="user"?`User: ${B.verifier_user_id?.slice(0,8)}...`:`Role: ${B.verifier_role}`},void 0,!1,void 0,this),B.require_signature&&Te("span",{className:b.requirements.signatureBadge,children:"Signature Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:w("text-xs font-medium uppercase",B.status==="approved"&&"text-emerald-600 dark:text-emerald-400",B.status==="rejected"&&"text-red-600 dark:text-red-400",B.status==="pending"&&"text-amber-600 dark:text-amber-400"),children:B.status},void 0,!1,void 0,this)]},B.id,!0,void 0,this))]},void 0,!0,void 0,this),E&&!p.isCompleted&&!p.isRejected&&Te("div",{children:[N&&Te("input",{type:"text",placeholder:"Reason for your decision (optional)",value:p.decisionReason,onChange:(B)=>p.setDecisionReason(B.target.value),className:b.actions.reasonInput},void 0,!1,void 0,this),Te("div",{className:b.actions.container,children:[Te("button",{type:"button",className:b.actions.approveButton,disabled:p.isDeciding,onClick:()=>{if(!N)m(!0),v("approved");else if(y==="approved")M("approved");else v("approved")},children:p.isDeciding&&y==="approved"?"Submitting...":y==="approved"&&N?"Confirm Approve":"\u2713 Approve"},void 0,!1,void 0,this),Te("button",{type:"button",className:b.actions.rejectButton,disabled:p.isDeciding,onClick:()=>{if(!N)m(!0),v("rejected");else if(y==="rejected")M("rejected");else v("rejected")},children:p.isDeciding&&y==="rejected"?"Submitting...":y==="rejected"&&N?"Confirm Reject":"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),g&&!p.instance&&s&&l&&Te("div",{className:"mb-6",children:Te("button",{type:"button",className:b.actions.startButton,disabled:p.isStarting,onClick:$,children:p.isStarting?"Starting...":"Start Verification Flow"},void 0,!1,void 0,this)},void 0,!1,void 0,this),c&&p.verifications.length>0&&Te("div",{className:b.history.container,children:[Te("h3",{className:b.history.title,children:"History"},void 0,!1,void 0,this),p.verifications.map((B)=>Te("div",{className:w(b.history.item.base,B.decision==="approved"?b.history.item.approved:B.decision==="rejected"?b.history.item.rejected:b.history.item.pending),children:[Te("div",{className:"flex-1",children:[Te("p",{className:b.history.decision,children:[Te("span",{className:w("inline-block w-2 h-2 rounded-full mr-2",B.decision==="approved"&&"bg-emerald-500",B.decision==="rejected"&&"bg-red-500",B.decision==="pending"&&"bg-amber-500")},void 0,!1,void 0,this),"Step ",B.step_order," \u2014 ",B.decision]},void 0,!0,void 0,this),B.reason&&Te("p",{className:b.history.reason,children:['"',B.reason,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:b.history.timestamp,children:new Date(B.created_at).toLocaleString()},void 0,!1,void 0,this)]},B.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as F0}from"@gsap/react";import q0 from"gsap";import{useEffect as kl,useEffectEvent as Pi,useRef as vl}from"react";import{batch as Ob,createStore as Jb}from"h-state";var Gb={step:"verifying",message:"Verifying your email...",email:"",cooldown:0,resendStatus:"idle",resendMessage:""},{useStore:Si}=Jb(Gb,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},setEmail:(e)=>(t)=>{e.email=t},setCooldown:(e)=>(t)=>{e.cooldown=t},decrementCooldown:(e)=>()=>{if(e.cooldown>0)e.cooldown=e.cooldown-1},setResendStatus:(e)=>(t)=>{e.resendStatus=t},setResendMessage:(e)=>(t)=>{e.resendMessage=t},reset:(e)=>()=>{Ob(()=>{e.step="verifying",e.message="Verifying your email...",e.email="",e.cooldown=0,e.resendStatus="idle",e.resendMessage=""})}});var wl={container:{base:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-zinc-50 to-zinc-100 dark:from-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center"},states:{verifying:{spinner:"w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mb-6",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-green-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4",redirectText:"text-sm text-zinc-500 dark:text-zinc-500"},error:{iconWrapper:"w-16 h-16 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-red-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4"}},resendForm:{wrapper:"w-full mt-4 p-4 bg-zinc-50 dark:bg-zinc-800/50 rounded-xl",label:"text-sm text-zinc-600 dark:text-zinc-400 mb-3",input:"w-full px-4 py-2 mb-3 border border-zinc-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",buttonContent:"flex items-center justify-center gap-2",buttonSpinner:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin",messageSuccess:"mt-2 text-sm text-green-600 dark:text-green-400",messageError:"mt-2 text-sm text-red-600 dark:text-red-400"},backButton:"mt-4 px-6 py-2 text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white transition-colors"};import{jsxDEV as lt,Fragment as xl}from"react/jsx-dev-runtime";q0.registerPlugin(F0);function _0(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function O0({token:e,email:t="",verifyEmailAction:r,resendVerificationAction:n,onSuccess:a,onBackToLogin:i,backToLoginHref:o,showResendForm:s=!0,redirectDelay:l=3000,className:c}){let d=wl,g=vl(null),h=vl(null),k=vl(!1),u=Si(),z=Pi((m)=>{if(m)u.setEmail(m)}),b=Pi((m)=>{if(!m){u.setStep("error"),u.setMessage("Invalid verification link. No token provided.");return}if(k.current)return;k.current=!0,r.start({payload:{token:m},onAfterHandle:(y)=>{if(!y){u.setStep("error"),u.setMessage("Verification failed. Please try again.");return}if(y.success)u.setStep("success"),u.setMessage(y.message||"Email verified successfully!"),setTimeout(()=>{if(a)a();else if(i)i()},l);else u.setStep("error"),u.setMessage(y.message||"Verification failed. Please try again.")},onErrorHandle:(y)=>{u.setStep("error"),u.setMessage(_0(y,"Verification failed. Please try again."))}})}),C=Pi(()=>{u.decrementCooldown()});kl(()=>{z(t)},[t]),kl(()=>{if(e)b(e);else u.setStep("error"),u.setMessage("Invalid verification link. No token provided.");return()=>{u.reset()}},[e]),kl(()=>{if(u.cooldown<=0)return;let m=setInterval(C,1000);return()=>clearInterval(m)},[u.cooldown]),F0(()=>{if(!h.current)return;q0.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g});let x=Pi(()=>{if(!u.email||u.cooldown>0||u.resendStatus==="loading"||!n)return;u.setResendStatus("loading"),u.setResendMessage(""),n.start({payload:{email:u.email},onAfterHandle:(m)=>{if(!m){u.setResendStatus("error"),u.setResendMessage("Failed to resend verification email.");return}if(m.success){if(u.setResendStatus("success"),u.setResendMessage(m.message||"Verification email sent!"),m.data?.cooldownSeconds)u.setCooldown(m.data.cooldownSeconds)}else if(u.setResendStatus("error"),u.setResendMessage(m.message||"Failed to resend."),m.data?.cooldownRemaining)u.setCooldown(m.data.cooldownRemaining)},onErrorHandle:(m)=>{u.setResendStatus("error"),u.setResendMessage(_0(m,"Failed to resend verification email."))}})}),N=()=>{if(i)i();else if(o)window.location.href=o};return lt("main",{ref:g,className:w(d.container.base,c),children:lt("article",{ref:h,className:w(d.card.base,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:lt("div",{className:d.content.wrapper,children:[u.step==="verifying"&&lt(xl,{children:[lt("div",{className:d.states.verifying.spinner},void 0,!1,void 0,this),lt("h1",{className:d.states.verifying.title,children:"Verifying Email"},void 0,!1,void 0,this),lt("p",{className:d.states.verifying.subtitle,children:u.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="success"&&lt(xl,{children:[lt("div",{className:d.states.success.iconWrapper,children:lt("svg",{className:d.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:lt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),lt("h1",{className:d.states.success.title,children:"Email Verified!"},void 0,!1,void 0,this),lt("p",{className:d.states.success.subtitle,children:u.message},void 0,!1,void 0,this),lt("p",{className:d.states.success.redirectText,children:"Redirecting to login..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="error"&&lt(xl,{children:[lt("div",{className:d.states.error.iconWrapper,children:lt("svg",{className:d.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:lt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),lt("h1",{className:d.states.error.title,children:"Verification Failed"},void 0,!1,void 0,this),lt("p",{className:d.states.error.subtitle,children:u.message},void 0,!1,void 0,this),s&&n&&lt("div",{className:d.resendForm.wrapper,children:[lt("p",{className:d.resendForm.label,children:"Request a new verification email:"},void 0,!1,void 0,this),lt("input",{type:"email",value:u.email,onChange:(m)=>u.setEmail(m.target.value),placeholder:"Enter your email",className:d.resendForm.input},void 0,!1,void 0,this),lt("button",{type:"button",onClick:x,disabled:!u.email||u.cooldown>0||u.resendStatus==="loading",className:d.resendForm.button,children:u.resendStatus==="loading"?lt("span",{className:d.resendForm.buttonContent,children:[lt("span",{className:d.resendForm.buttonSpinner},void 0,!1,void 0,this),"Sending..."]},void 0,!0,void 0,this):u.cooldown>0?`Resend in ${u.cooldown}s`:"Resend Verification Email"},void 0,!1,void 0,this),u.resendMessage&&lt("p",{className:u.resendStatus==="success"?d.resendForm.messageSuccess:d.resendForm.messageError,children:u.resendMessage},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(i||o)&&lt("button",{type:"button",onClick:N,className:d.backButton,children:"Go to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{Gt as verificationPanelTheme,ht as verificationFlowPageTheme,Si as useVerifyEmailStore,zi as useVerificationPanelStore,Hn as useVerificationFlowStore,ui as useUsersStore,In as useSetPasswordStore,di as useResetPasswordStore,li as useRegisterStore,ai as useProfileStore,Ni as usePendingVerificationsStore,Ko as useNucleusEntity,Ea as useNotificationCenterStore,Qa as useMagicLinkVerifyStore,Ln as useLoginStore,Ya as useForgotPasswordStore,Ja as useDevicesStore,kr as useDesignSystemStore,ka as useChangePasswordStore,ga as useAuthorizationStore,$a as tooltipTheme,Mn as toUpperSnakeCase,Go as singularize,Zo as shouldExcludeFromForm,Va as shouldExcludeColumn,Kt as notificationCenterTheme,Xa as magicLinkVerifyPageTheme,aa as isReferenceColumn,Qo as isJsonColumn,ja as isArrayColumn,tm as getDefaultValue,ei as getColumnType,Dg as generateGetByIdEndpointKey,Yo as generateEntityEndpointKey,Vg as generateDistinctEndpointKey,Ao as generateBulkEndpointKey,rr as formatLabel,P0 as extendVerificationPanelTheme,c0 as extendVerificationFlowPageTheme,wc as extendNotificationCenterTheme,Sd as extendDesignSystemTheme,Dl as extendAuthorizationPageTheme,It as designSystemTheme,Io as createDefaultRegistry,w as cn,Fn as captchaTheme,vt as authorizationPageTheme,O0 as VerifyEmailPage,bi as VerifierFlowNode,$0 as VerificationPanel,z0 as VerificationFlowPage,s0 as UsersPage,_a as Tooltip,mi as StepFlowNode,Ec as SetPasswordPage,dr as SelectBox,Cn as SearchBox,es as RoleList,jl as RoleClaimEditor,Zc as ResetPasswordPage,Oc as RegisterPage,Pn as RangePicker,Ra as PropsPanel,xi as PropertiesPanel,Hc as ProfilePage,ni as ProfileHeader,ri as PhoneCard,R0 as PendingVerifications,yi as PendingTab,oi as PasswordStrengthIndicator,Ee as NucleusTextInput,pm as NucleusEntityShowcase,fi as NotificationFlowNode,Nc as NotificationCenter,kc as NotificationBell,hi as NodePalette,yc as MagicLinkVerifyPage,mc as LoginPage,oc as ForgotPasswordPage,ec as DevicesPage,Oa as DevicesHeader,qa as DeviceCard,Ld as DesignSystemPage,Sn as DatePicker,kn as DataTable,Bn as DEFAULT_PASSWORD_POLICY,Ma as ComponentSidebar,La as ComponentCanvas,Vl as ClaimList,hr as Checkbox,Ts as ChangePasswordPage,fa as Captcha,se as Button,El as AuthorizationPage,ti as AddressCard,xt as AbstractAnimatedBackground};
110
+ `,uniforms:{uTime:{value:0},uFlash:{value:0}},transparent:!0,depthWrite:!1});t.current=a}function n(a,i){if(!t.current||!r.current)return;if(t.current.uniforms.uTime)t.current.uniforms.uTime.value+=i;if(t.current.uniforms.uFlash)t.current.uniforms.uFlash.value=e.current;r.current.rotation.z+=i*0.08,r.current.position.x=a.pointer.x*0.05,r.current.position.y=a.pointer.y*0.03}return Bi(n),kt("mesh",{ref:r,position:[0,0,-0.4],children:[kt("planeGeometry",{args:[5.4,3.8,2,2]},void 0,!1,void 0,this),kt("primitive",{object:t.current,attach:"material"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function tp({lightningValue:e}){return kt("group",{children:[kt(j0,{lightningValue:e},void 0,!1,void 0,this),kt(ep,{lightningValue:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rp(){return kt("div",{className:"absolute inset-0 pointer-events-none",children:U0.map(function(t,r){return kt("span",{className:"marble-bubble",style:{width:`${t.size}px`,height:`${t.size}px`,left:t.left,top:t.top,animationDelay:t.delay,animationDuration:t.duration,opacity:t.opacity}},`bubble-${r}`,!1,void 0,this)})},void 0,!1,void 0,this)}function xt({className:e}){let r=D0("absolute inset-0 overflow-hidden",e),n=$n(0);return kt("div",{className:r,style:{backgroundColor:"transparent"},children:[kt("div",{className:"marble-base-gradient"},void 0,!1,void 0,this),kt("div",{className:"marble-secondary-gradient"},void 0,!1,void 0,this),kt("div",{className:"marble-overlay-gradient"},void 0,!1,void 0,this),kt(Z0,{fallback:null,children:kt(K0,{className:"marble-canvas",dpr:[1,1.5],gl:{antialias:!0,alpha:!0},camera:{position:[0,0,2.5],fov:45},style:{position:"absolute",top:"50%",left:"50%",width:"150%",height:"150%",transform:"translate(-50%, -50%)"},children:kt(tp,{lightningValue:n},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),kt("div",{className:"marble-swirl"},void 0,!1,void 0,this),kt(rp,{},void 0,!1,void 0,this),kt("div",{className:"marble-highlight"},void 0,!1,void 0,this),kt("div",{className:"marble-glass"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ul}from"@gsap/react";import El from"gsap";import{useEffect as $i,useEffectEvent as At,useRef as Ql,useState as Xl}from"react";function Pl(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Pl(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Mt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Pl(e))&&(n&&(n+=" "),n+=t);return n}var np=(e,t)=>{let r=Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},ap=(e,t)=>({classGroupId:e,validator:t}),Wl=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r});var Tl=[];var ip=(e)=>{let t=lp(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:(o)=>{if(o.startsWith("[")&&o.endsWith("]"))return op(o);let s=o.split("-"),l=s[0]===""&&s.length>1?1:0;return Il(s,l,t)},getConflictingClassGroupIds:(o,s)=>{if(s){let l=n[o],c=r[o];if(l){if(c)return np(c,l);return l}return c||Tl}return r[o]||Tl}}},Il=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let a=e[t],i=r.nextPart.get(a);if(i){let c=Il(e,t+1,i);if(c)return c}let o=r.validators;if(o===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=o.length;for(let c=0;c<l;c++){let d=o[c];if(d.validator(s))return d.classGroupId}return},op=(e)=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),lp=(e)=>{let{theme:t,classGroups:r}=e;return sp(r,t)},sp=(e,t)=>{let r=Wl();for(let n in e){let a=e[n];Ii(a,r,n,t)}return r},Ii=(e,t,r,n)=>{let a=e.length;for(let i=0;i<a;i++){let o=e[i];dp(o,t,r,n)}},dp=(e,t,r,n)=>{if(typeof e==="string"){cp(e,t,r);return}if(typeof e==="function"){pp(e,t,r,n);return}up(e,t,r,n)},cp=(e,t,r)=>{let n=e===""?t:Hl(t,e);n.classGroupId=r},pp=(e,t,r,n)=>{if(gp(e)){Ii(e(n),t,r,n);return}if(t.validators===null)t.validators=[];t.validators.push(ap(r,e))},up=(e,t,r,n)=>{let a=Object.entries(e),i=a.length;for(let o=0;o<i;o++){let[s,l]=a[o];Ii(l,Hl(t,s),r,n)}},Hl=(e,t)=>{let r=e,n=t.split("-"),a=n.length;for(let i=0;i<a;i++){let o=n[i],s=r.nextPart.get(o);if(!s)s=Wl(),r.nextPart.set(o,s);r=s}return r},gp=(e)=>("isThemeGetter"in e)&&e.isThemeGetter===!0,mp=(e)=>{if(e<1)return{get:()=>{return},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(i,o)=>{if(r[i]=o,t++,t>e)t=0,n=r,r=Object.create(null)};return{get(i){let o=r[i];if(o!==void 0)return o;if((o=n[i])!==void 0)return a(i,o),o},set(i,o){if(i in r)r[i]=o;else a(i,o)}}};var bp=[],Ll=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),fp=(e)=>{let{prefix:t,experimentalParseClassName:r}=e,n=(a)=>{let i=[],o=0,s=0,l=0,c,d=a.length;for(let S=0;S<d;S++){let f=a[S];if(o===0&&s===0){if(f===":"){i.push(a.slice(l,S)),l=S+1;continue}if(f==="/"){c=S;continue}}if(f==="[")o++;else if(f==="]")o--;else if(f==="(")s++;else if(f===")")s--}let g=i.length===0?a:a.slice(l),h=g,k=!1;if(g.endsWith("!"))h=g.slice(0,-1),k=!0;else if(g.startsWith("!"))h=g.slice(1),k=!0;let u=c&&c>l?c-l:void 0;return Ll(i,k,h,u)};if(t){let a=t+":",i=n;n=(o)=>o.startsWith(a)?i(o.slice(a.length)):Ll(bp,!1,o,void 0,!0)}if(r){let a=n;n=(i)=>r({className:i,parseClassName:a})}return n},hp=(e)=>{let t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),(r)=>{let n=[],a=[];for(let i=0;i<r.length;i++){let o=r[i],s=o[0]==="[",l=t.has(o);if(s||l){if(a.length>0)a.sort(),n.push(...a),a=[];n.push(o)}else a.push(o)}if(a.length>0)a.sort(),n.push(...a);return n}},yp=(e)=>({cache:mp(e.cacheSize),parseClassName:fp(e),sortModifiers:hp(e),...ip(e)}),wp=/\s+/,kp=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],s=e.trim().split(wp),l="";for(let c=s.length-1;c>=0;c-=1){let d=s[c],{isExternal:g,modifiers:h,hasImportantModifier:k,baseClassName:u,maybePostfixModifierPosition:S}=r(d);if(g){l=d+(l.length>0?" "+l:l);continue}let f=!!S,P=n(f?u.substring(0,S):u);if(!P){if(!f){l=d+(l.length>0?" "+l:l);continue}if(P=n(u),!P){l=d+(l.length>0?" "+l:l);continue}f=!1}let x=h.length===0?"":h.length===1?h[0]:i(h).join(":"),z=k?x+"!":x,m=z+P;if(o.indexOf(m)>-1)continue;o.push(m);let y=a(P,f);for(let v=0;v<y.length;++v){let p=y[v];o.push(z+p)}l=d+(l.length>0?" "+l:l)}return l},vp=(...e)=>{let t=0,r,n,a="";while(t<e.length)if(r=e[t++]){if(n=$l(r))a&&(a+=" "),a+=n}return a},$l=(e)=>{if(typeof e==="string")return e;let t,r="";for(let n=0;n<e.length;n++)if(e[n]){if(t=$l(e[n]))r&&(r+=" "),r+=t}return r},xp=(e,...t)=>{let r,n,a,i,o=(l)=>{let c=t.reduce((d,g)=>g(d),e());return r=yp(c),n=r.cache.get,a=r.cache.set,i=s,s(l)},s=(l)=>{let c=n(l);if(c)return c;let d=kp(l,r);return a(l,d),d};return i=o,(...l)=>i(vp(...l))},zp=[],Ct=(e)=>{let t=(r)=>r[e]||zp;return t.isThemeGetter=!0,t},_l=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Np=/^\d+\/\d+$/,Sp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Tp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Lp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bn=(e)=>Np.test(e),Ie=(e)=>!!e&&!Number.isNaN(Number(e)),qr=(e)=>!!e&&Number.isInteger(Number(e)),Wi=(e)=>e.endsWith("%")&&Ie(e.slice(0,-1)),Tr=(e)=>Sp.test(e),Ol=()=>!0,Mp=(e)=>Cp.test(e)&&!Pp.test(e),Hi=()=>!1,Rp=(e)=>Tp.test(e),Bp=(e)=>Lp.test(e),Wp=(e)=>!ge(e)&&!me(e),Ip=(e)=>Jr(e,Gl,Hi),ge=(e)=>_l.test(e),jr=(e)=>Jr(e,Al,Mp),Ml=(e)=>Jr(e,Gp,Ie),Hp=(e)=>Jr(e,Kl,Ol),$p=(e)=>Jr(e,Yl,Hi),Rl=(e)=>Jr(e,ql,Hi),_p=(e)=>Jr(e,Jl,Bp),pa=(e)=>Jr(e,Zl,Rp),me=(e)=>Fl.test(e),_n=(e)=>en(e,Al),Fp=(e)=>en(e,Yl),Bl=(e)=>en(e,ql),Op=(e)=>en(e,Gl),qp=(e)=>en(e,Jl),ua=(e)=>en(e,Zl,!0),Jp=(e)=>en(e,Kl,!0),Jr=(e,t,r)=>{let n=_l.exec(e);if(n){if(n[1])return t(n[1]);return r(n[2])}return!1},en=(e,t,r=!1)=>{let n=Fl.exec(e);if(n){if(n[1])return t(n[1]);return r}return!1},ql=(e)=>e==="position"||e==="percentage",Jl=(e)=>e==="image"||e==="url",Gl=(e)=>e==="length"||e==="size"||e==="bg-size",Al=(e)=>e==="length",Gp=(e)=>e==="number",Yl=(e)=>e==="family-name",Kl=(e)=>e==="number"||e==="weight",Zl=(e)=>e==="shadow";var Ap=()=>{let e=Ct("color"),t=Ct("font"),r=Ct("text"),n=Ct("font-weight"),a=Ct("tracking"),i=Ct("leading"),o=Ct("breakpoint"),s=Ct("container"),l=Ct("spacing"),c=Ct("radius"),d=Ct("shadow"),g=Ct("inset-shadow"),h=Ct("text-shadow"),k=Ct("drop-shadow"),u=Ct("blur"),S=Ct("perspective"),f=Ct("aspect"),P=Ct("ease"),x=Ct("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...m(),me,ge],v=()=>["auto","hidden","clip","visible","scroll"],p=()=>["auto","contain","none"],b=()=>[me,ge,l],R=()=>[bn,"full","auto",...b()],$=()=>[qr,"none","subgrid",me,ge],J=()=>["auto",{span:["full",qr,me,ge]},qr,me,ge],U=()=>[qr,"auto",me,ge],E=()=>["auto","min","max","fr",me,ge],K=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...b()],N=()=>[bn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],O=()=>[e,me,ge],A=()=>[...m(),Bl,Rl,{position:[me,ge]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",Op,Ip,{size:[me,ge]}],_=()=>[Wi,_n,jr],T=()=>["","none","full",c,me,ge],ie=()=>["",Ie,_n,jr],q=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[Ie,Wi,Bl,Rl],Ze=()=>["","none",u,me,ge],$e=()=>["none",Ie,me,ge],Pe=()=>["none",Ie,me,ge],fe=()=>[Ie,me,ge],xe=()=>[bn,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tr],breakpoint:[Tr],color:[Ol],container:[Tr],"drop-shadow":[Tr],ease:["in","out","in-out"],font:[Wp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tr],shadow:[Tr],spacing:["px",Ie],text:[Tr],"text-shadow":[Tr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bn,ge,me,f]}],container:["container"],columns:[{columns:[Ie,ge,me,s]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:v()}],"overflow-x":[{"overflow-x":v()}],"overflow-y":[{"overflow-y":v()}],overscroll:[{overscroll:p()}],"overscroll-x":[{"overscroll-x":p()}],"overscroll-y":[{"overscroll-y":p()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[qr,"auto",me,ge]}],basis:[{basis:[bn,"full","auto",s,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,bn,"auto","initial","none",ge]}],grow:[{grow:["",Ie,me,ge]}],shrink:[{shrink:["",Ie,me,ge]}],order:[{order:[qr,"first","last","none",me,ge]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...K(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...K()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":K()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[s,"screen",...N()]}],"min-w":[{"min-w":[s,"screen","none",...N()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,_n,jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Jp,Hp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wi,ge]}],"font-family":[{font:[Fp,$p,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,me,ge]}],"line-clamp":[{"line-clamp":[Ie,"none",me,Ml]}],leading:[{leading:[i,...b()]}],"list-image":[{"list-image":["none",me,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",me,jr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Ie,"auto",me,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",me,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qr,me,ge],radial:["",me,ge],conic:[qr,me,ge]},qp,_p]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:_()}],"gradient-via-pos":[{via:_()}],"gradient-to-pos":[{to:_()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,me,ge]}],"outline-w":[{outline:["",Ie,_n,jr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",d,ua,pa]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",g,ua,pa]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Ie,jr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,ua,pa]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Ie,me,ge]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[me,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":m()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,ge]}],filter:[{filter:["","none",me,ge]}],blur:[{blur:Ze()}],brightness:[{brightness:[Ie,me,ge]}],contrast:[{contrast:[Ie,me,ge]}],"drop-shadow":[{"drop-shadow":["","none",k,ua,pa]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Ie,me,ge]}],"hue-rotate":[{"hue-rotate":[Ie,me,ge]}],invert:[{invert:["",Ie,me,ge]}],saturate:[{saturate:[Ie,me,ge]}],sepia:[{sepia:["",Ie,me,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",me,ge]}],"backdrop-blur":[{"backdrop-blur":Ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,me,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,me,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,me,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,me,ge]}],"backdrop-invert":[{"backdrop-invert":["",Ie,me,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,me,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,me,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,me,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",me,ge]}],ease:[{ease:["linear","initial",P,me,ge]}],delay:[{delay:[Ie,me,ge]}],animate:[{animate:["none",x,me,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,me,ge]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:$e()}],"rotate-x":[{"rotate-x":$e()}],"rotate-y":[{"rotate-y":$e()}],"rotate-z":[{"rotate-z":$e()}],scale:[{scale:Pe()}],"scale-x":[{"scale-x":Pe()}],"scale-y":[{"scale-y":Pe()}],"scale-z":[{"scale-z":Pe()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[me,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",me,ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",me,ge]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Ie,_n,jr,Ml]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var Rt=xp(Ap);function w(...e){return Rt(Mt(e))}import{batch as Yp,createStore as Kp}from"h-state";var Zp={roles:[],claims:[],roleClaims:[],selectedRole:null,newRoleName:"",newRoleDescription:"",searchClaim:"",entityFilter:"all",methodFilter:"all",showAssignedOnly:!1,activeTab:"roles",editingScopeClaimId:null,scopeInputValue:"",editingRoleId:null,editRoleDescription:""},{useStore:ga}=Kp(Zp,{setRoles:(e)=>(t)=>{e.roles=t},setClaims:(e)=>(t)=>{e.claims=t},setRoleClaims:(e)=>(t)=>{e.roleClaims=t},setSelectedRole:(e)=>(t)=>{e.selectedRole=t},setNewRoleName:(e)=>(t)=>{e.newRoleName=t},setNewRoleDescription:(e)=>(t)=>{e.newRoleDescription=t},setSearchClaim:(e)=>(t)=>{e.searchClaim=t},setEntityFilter:(e)=>(t)=>{e.entityFilter=t},setMethodFilter:(e)=>(t)=>{e.methodFilter=t},setShowAssignedOnly:(e)=>(t)=>{e.showAssignedOnly=t},setActiveTab:(e)=>(t)=>{e.activeTab=t},addRole:(e)=>(t)=>{e.roles=[...e.roles,t]},removeRole:(e)=>(t)=>{if(e.roles=e.roles.filter((r)=>r.id!==t),e.selectedRole?.id===t)e.selectedRole=null},addRoleClaim:(e)=>(t)=>{e.roleClaims=[...e.roleClaims,t]},removeRoleClaim:(e)=>(t)=>{e.roleClaims=e.roleClaims.filter((r)=>r.id!==t)},updateRoleClaimScope:(e)=>(t,r)=>{e.roleClaims=e.roleClaims.map((n)=>n.id===t?{...n,scope:r}:n)},setEditingScopeClaimId:(e)=>(t)=>{if(e.editingScopeClaimId=t,t===null)e.scopeInputValue=""},setScopeInputValue:(e)=>(t)=>{e.scopeInputValue=t},setEditingRoleId:(e)=>(t)=>{if(e.editingRoleId=t,t===null)e.editRoleDescription=""},setEditRoleDescription:(e)=>(t)=>{e.editRoleDescription=t},updateRole:(e)=>(t,r)=>{if(e.roles=e.roles.map((n)=>n.id===t?{...n,...r}:n),e.selectedRole?.id===t)e.selectedRole={...e.selectedRole,...r}},resetForm:(e)=>()=>{Yp(()=>{e.newRoleName="",e.newRoleDescription=""})}});import{jsxDEV as X}from"react/jsx-dev-runtime";El.registerPlugin(Ul);var Qp={GET:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",POST:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",PUT:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",PATCH:"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20",DELETE:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"};function Dl({title:e="Authorization Management",subtitle:t,className:r,defaultEntityFilter:n="all",defaultMethodFilter:a="all",defaultShowAssignedOnly:i=!1,getRolesAction:o,addRoleAction:s,updateRoleAction:l,deleteRoleAction:c,getClaimsAction:d,getRoleClaimsAction:g,addRoleClaimAction:h,updateRoleClaimAction:k,deleteRoleClaimAction:u,onRoleCreated:S,onRoleDeleted:f,onClaimToggled:P}){let x=ga(),z=Ql(null),m=Ql(null),[y,v]=Xl(new Set),[p,b]=Xl("");Ul(()=>{if(!m.current)return;El.fromTo(m.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:z});let R=At(()=>{o.start({payload:{page:1,limit:100},onAfterHandle:(H)=>{if(H.data?.items)x.setRoles(H.data.items)}})}),$=At(()=>{d.start({payload:{page:1,limit:1000},onAfterHandle:(H)=>{if(H.data?.items)x.setClaims(H.data.items)}})}),J=At((H)=>{g.start({payload:{page:1,limit:1000,filters:[{field:"role_id",operator:"eq",value:H}]},onAfterHandle:(ue)=>{if(ue.data?.items)x.setRoleClaims(ue.data.items)}})});$i(()=>{R(),$()},[]);let U=At(()=>{x.setEntityFilter(n),x.setMethodFilter(a),x.setShowAssignedOnly(i)});$i(()=>{U()},[]),$i(()=>{if(x.selectedRole)J(x.selectedRole.id);else x.setRoleClaims([])},[x.selectedRole]);let E=At(()=>{if(!x.newRoleName.trim())return;let H=`temp-${Date.now()}`,ue={id:H,name:x.newRoleName.trim(),description:x.newRoleDescription.trim()||"",createdAt:new Date,updatedAt:new Date};x.addRole(ue),x.resetForm(),s.start({payload:{name:ue.name,description:ue.description||void 0},onAfterHandle:(We)=>{if(R(),We.data)S?.(We.data)},onErrorHandle:()=>{x.removeRole(H)}})}),K=At((H)=>{let ue=x.roles.find((We)=>We.id===H);if(!ue)return;x.removeRole(H),c.start({payload:{id:H},onAfterHandle:()=>{R(),f?.(H)},onErrorHandle:()=>{if(ue)x.addRole(ue)}})}),M=At((H)=>{x.setEditingRoleId(H.id),x.setEditRoleDescription(H.description||"")}),Q=At(()=>{x.setEditingRoleId(null)}),N=At(()=>{let H=x.editingRoleId;if(!H||!l)return;let ue=x.roles.find((gt)=>gt.id===H);if(!ue)return;let We=ue.description,Ue=x.editRoleDescription;x.updateRole(H,{description:Ue}),x.setEditingRoleId(null),l.start({payload:{id:H,description:Ue},onAfterHandle:()=>{R()},onErrorHandle:()=>{x.updateRole(H,{description:We})}})}),O=At((H,ue)=>{let We=x.selectedRole;if(!We)return;let Ue=We.id;if(ue){let gt=x.roleClaims.find((Ge)=>Ge.claimId===H.id);if(!gt)return;x.removeRoleClaim(gt.id),u.start({payload:{id:gt.id},onAfterHandle:()=>{J(Ue),P?.(H,!1)},onErrorHandle:()=>{x.addRoleClaim(gt)}})}else{let gt=`temp-${Date.now()}`,Ge={id:gt,roleId:Ue,claimId:H.id,scope:"",createdAt:new Date,updatedAt:new Date};x.addRoleClaim(Ge),h.start({payload:[{roleId:Ue,claimId:H.id}],onAfterHandle:()=>{J(Ue),P?.(H,!0)},onErrorHandle:()=>{x.removeRoleClaim(gt)}})}}),A=At((H)=>{x.setSelectedRole(H)}),D=At((H)=>{x.setSearchClaim(H)}),I=At((H)=>{x.setEntityFilter(H||"all")}),_=At((H)=>{x.setMethodFilter(H||"all")}),T=At((H)=>{x.setShowAssignedOnly(H)}),ie=At((H,ue)=>{if(!k||!x.selectedRole)return;x.updateRoleClaimScope(H,ue),k.start({payload:{id:H,scope:ue},onAfterHandle:()=>{J(x.selectedRole?.id||"")},onErrorHandle:()=>{J(x.selectedRole?.id||"")}})}),q=(H)=>{let ue=H.split(".");if(ue[1]==="bulk")return ue[2]||"bulk";return ue[1]||"other"},ce=x.searchClaim.trim().toLowerCase(),oe=x.entityFilter.toLowerCase(),Ze=x.methodFilter.toLowerCase(),$e=x.showAssignedOnly&&!!x.selectedRole,Pe=new Set(x.roleClaims.map((H)=>H.claimId)),fe=x.claims.filter((H)=>{let ue=ce?H.action.toLowerCase().includes(ce)||H.description.toLowerCase().includes(ce):!0,We=q(H.action).toLowerCase(),Ue=oe==="all"||We===oe,gt=Ze==="all"||H.method.toLowerCase()===Ze,Ge=$e?Pe.has(H.id):!0;return ue&&Ue&&gt&&Ge}),xe=[{value:"all",label:"All Entities"},...Array.from(new Set(x.claims.map((H)=>q(H.action)))).sort((H,ue)=>H.localeCompare(ue)).map((H)=>({value:H,label:H}))],qe=[{value:"all",label:"All Methods"},{value:"get",label:"GET"},{value:"post",label:"POST"},{value:"put",label:"PUT"},{value:"patch",label:"PATCH"},{value:"delete",label:"DELETE"}],Le=fe.reduce((H,ue)=>{let We=q(ue.action);if(!H[We])H[We]=[];return H[We].push(ue),H},{}),ve=Object.keys(Le).sort((H,ue)=>H.localeCompare(ue)),B=(H)=>{v((ue)=>{let We=new Set(ue);if(We.has(H))We.delete(H);else We.add(H);return We})},de=()=>{v(new Set(ve))},te=()=>{v(new Set)},ye=(H,ue)=>{let We=Le[H]||[];for(let Ue of We){let gt=Pe.has(Ue.id);if(ue&&!gt)O(Ue,!1);else if(!ue&&gt)O(Ue,!0)}},V=(H)=>{return(Le[H]||[]).filter((We)=>Pe.has(We.id)).length},ee=(H)=>x.roleClaims.find((ue)=>ue.claimId===H),re=(H)=>{if(k&&x.scopeInputValue!==void 0)ie(H,x.scopeInputValue),x.setEditingScopeClaimId(null)},Ke=(H,ue)=>{x.setScopeInputValue(ue||""),x.setEditingScopeClaimId(H)};return X("main",{ref:z,className:w("min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6 lg:p-8",r),children:X("div",{ref:m,className:"max-w-[1600px] mx-auto",children:[X("header",{className:"mb-6",children:[X("h1",{className:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",children:e},void 0,!1,void 0,this),t&&X("p",{className:"mt-1 text-sm text-zinc-500 dark:text-zinc-400",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"grid grid-cols-1 xl:grid-cols-[320px_1fr] gap-6",children:[X("aside",{className:"space-y-4",children:[X("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[X("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Roles"},void 0,!1,void 0,this),X("div",{className:"space-y-2 mb-4",children:[X("input",{type:"text",value:x.newRoleName,onChange:(H)=>x.setNewRoleName(H.target.value),placeholder:"New role name",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),X("button",{type:"button",onClick:E,disabled:!x.newRoleName.trim()||s.state.isPending,className:"w-full px-3 py-2 text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:s.state.isPending?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:x.roles.map((H)=>X("div",{className:w("w-full text-left px-3 py-2 rounded-lg text-sm transition-colors group",H.id.startsWith("temp-")&&"opacity-50",x.selectedRole?.id===H.id?"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-900 dark:text-emerald-100":"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300"),children:[X("div",{className:"flex items-center justify-between",children:[X("button",{type:"button",onClick:()=>A(H),disabled:H.id.startsWith("temp-"),className:"flex-1 text-left truncate disabled:cursor-not-allowed font-medium",children:H.name},void 0,!1,void 0,this),X("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[H.name!=="godmin"&&!H.id.startsWith("temp-")&&l&&X("button",{type:"button",onClick:()=>M(H),className:"p-1 text-zinc-500 hover:text-emerald-600 transition-colors",title:"Edit description",children:X("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.name!=="godmin"&&!H.id.startsWith("temp-")&&X("button",{type:"button",onClick:()=>K(H.id),className:"p-1 text-red-500 hover:text-red-700 transition-colors",title:"Delete role",children:X("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x.editingRoleId===H.id?X("div",{className:"mt-2 space-y-2",children:[X("textarea",{value:x.editRoleDescription,onChange:(ue)=>x.setEditRoleDescription(ue.target.value),placeholder:"Enter description...",rows:2,className:"w-full px-2 py-1.5 text-xs border border-zinc-200 dark:border-zinc-700 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 resize-none"},void 0,!1,void 0,this),X("div",{className:"flex gap-2",children:[X("button",{type:"button",onClick:N,className:"flex-1 px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),X("button",{type:"button",onClick:Q,className:"flex-1 px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 rounded transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):H.description&&X("p",{className:"mt-1 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:H.description},void 0,!1,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[X("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Filters"},void 0,!1,void 0,this),X("div",{className:"space-y-3",children:[X("div",{children:[X("label",{htmlFor:"claim-search",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Search"},void 0,!1,void 0,this),X("input",{id:"claim-search",type:"text",value:p,onChange:(H)=>{b(H.target.value),D(H.target.value)},placeholder:"Search claims...",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{children:[X("label",{htmlFor:"entity-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Entity"},void 0,!1,void 0,this),X("select",{id:"entity-filter",value:x.entityFilter,onChange:(H)=>I(H.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:xe.map((H)=>X("option",{value:H.value,children:H.label},H.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("div",{children:[X("label",{htmlFor:"method-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Method"},void 0,!1,void 0,this),X("select",{id:"method-filter",value:x.methodFilter,onChange:(H)=>_(H.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:qe.map((H)=>X("option",{value:H.value,children:H.label},H.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("label",{className:"flex items-center gap-2 cursor-pointer",children:[X("input",{type:"checkbox",checked:x.showAssignedOnly,onChange:(H)=>T(H.target.checked),disabled:!x.selectedRole,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),X("span",{className:w("text-sm",!x.selectedRole?"text-zinc-400":"text-zinc-700 dark:text-zinc-300"),children:"Show assigned only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x.selectedRole&&X("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 rounded-xl border border-emerald-200 dark:border-emerald-800 p-4",children:[X("div",{className:"text-sm font-medium text-emerald-900 dark:text-emerald-100",children:x.selectedRole.name},void 0,!1,void 0,this),X("div",{className:"text-2xl font-bold text-emerald-600 dark:text-emerald-400 mt-1",children:x.roleClaims.length},void 0,!1,void 0,this),X("div",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"claims assigned"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("section",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800",children:[X("div",{className:"p-4 border-b border-zinc-200 dark:border-zinc-800 flex flex-wrap items-center justify-between gap-3",children:[X("div",{children:[X("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Claims"},void 0,!1,void 0,this),X("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[fe.length," of ",x.claims.length," claims \u2022 ",ve.length," ","entities"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"flex items-center gap-2",children:[X("button",{type:"button",onClick:de,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Expand All"},void 0,!1,void 0,this),X("button",{type:"button",onClick:te,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Collapse All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("div",{className:"max-h-[calc(100vh-280px)] overflow-y-auto",children:ve.length===0?X("div",{className:"p-8 text-center text-zinc-500 dark:text-zinc-400",children:"No claims match your filters"},void 0,!1,void 0,this):ve.map((H)=>{let ue=Le[H]||[],We=y.has(H),Ue=V(H),gt=Ue===ue.length;return X("div",{className:"border-b border-zinc-100 dark:border-zinc-800 last:border-b-0",children:[X("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",onClick:()=>B(H),children:X("div",{className:"flex items-center gap-3",children:[X("svg",{className:w("w-4 h-4 text-zinc-400 transition-transform",We&&"rotate-90"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:X("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X("span",{className:"font-medium text-zinc-900 dark:text-zinc-100",children:H},void 0,!1,void 0,this),X("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[ue.length," claims"]},void 0,!0,void 0,this),x.selectedRole&&X("span",{className:w("text-xs px-2 py-0.5 rounded-full",gt?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":Ue>0?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"),children:[Ue,"/",ue.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x.selectedRole&&x.selectedRole.name!=="godmin"&&X("div",{className:"flex items-center gap-2 px-4 pb-2",children:[X("button",{type:"button",onClick:()=>ye(H,!0),className:"px-2 py-1 text-xs font-medium text-emerald-600 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 border border-emerald-200 dark:border-emerald-800 rounded",children:"Assign All"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>ye(H,!1),className:"px-2 py-1 text-xs font-medium text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 border border-red-200 dark:border-red-800 rounded",children:"Remove All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),We&&X("div",{className:"px-4 pb-3",children:X("div",{className:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg divide-y divide-zinc-100 dark:divide-zinc-700/50",children:ue.map((Ge)=>{let Qt=Pe.has(Ge.id),$t=ee(Ge.id),zr=x.editingScopeClaimId===Ge.id,ne=$t?.scope||"",W=Ge.id.startsWith("temp-")||$t?.id.startsWith("temp-");return X("div",{className:w("p-3 transition-colors",Qt&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:X("div",{className:"flex items-start gap-3",children:[X("input",{type:"checkbox",checked:Qt,onChange:()=>O(Ge,Qt),disabled:!x.selectedRole||x.selectedRole.name==="godmin"||W||h.state.isPending||u.state.isPending,className:"mt-1 w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),X("div",{className:"flex-1 min-w-0",children:[X("div",{className:"flex items-center gap-2 flex-wrap",children:[X("code",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:Ge.action},void 0,!1,void 0,this),X("span",{className:w("px-1.5 py-0.5 text-xs font-medium rounded border",Qp[Ge.method]||"bg-zinc-100 text-zinc-600"),children:Ge.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:Ge.description},void 0,!1,void 0,this),Qt&&$t&&!W&&X("div",{className:"mt-2",children:zr?X("div",{className:"flex items-center gap-2",children:[X("input",{type:"text",value:x.scopeInputValue,onChange:(j)=>x.setScopeInputValue(j.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>re($t.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),X("button",{type:"button",onClick:()=>x.setEditingScopeClaimId(null),className:"px-2 py-1 text-xs font-medium text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):X("button",{type:"button",onClick:()=>Ke(Ge.id,ne),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:ne?X("span",{className:"font-mono bg-zinc-200 dark:bg-zinc-700 px-1.5 py-0.5 rounded",children:["scope: ",ne]},void 0,!0,void 0,this):X("span",{className:"italic hover:underline",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},Ge.id,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var vt={container:"min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6",header:{wrapper:"mb-6 sm:mb-8",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm sm:text-base text-zinc-500 dark:text-zinc-400 mt-1"},tabs:{wrapper:"flex gap-2 sm:gap-4 mb-4 sm:mb-6",button:"px-3 sm:px-4 py-2 rounded-lg font-medium transition-colors text-sm sm:text-base",buttonActive:"bg-blue-600 text-white",buttonInactive:"bg-zinc-200 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-300 dark:hover:bg-zinc-700"},filters:{wrapper:"mb-4 sm:mb-6 md:mb-6 lg:mb-8 xl:mb-8 2xl:mb-10",row:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8",control:"flex flex-col justify-end",search:"sm:col-span-2 md:col-span-2 lg:col-span-2 xl:col-span-3 2xl:col-span-4",searchContainer:"w-full",searchInput:"text-sm sm:text-sm md:text-sm lg:text-sm xl:text-base 2xl:text-base",toggle:"items-start sm:items-end"},card:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl shadow-sm border border-zinc-200 dark:border-zinc-800 p-4 sm:p-6",header:"text-lg sm:text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-4"},roleList:{wrapper:"space-y-2",item:"w-full text-left p-3 sm:p-4 rounded-lg cursor-pointer transition-colors border",itemSelected:"bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-500",itemHover:"bg-zinc-50 dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-blue-300 dark:hover:border-blue-700",name:"font-medium text-zinc-900 dark:text-zinc-100",description:"text-sm text-zinc-500 dark:text-zinc-400 mt-1",badge:"ml-2 px-2 py-0.5 text-xs bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 rounded-full",deleteButton:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors"},claimList:{wrapper:"space-y-4",group:"border border-zinc-200 dark:border-zinc-700 rounded-lg overflow-hidden",groupHeader:"bg-zinc-100 dark:bg-zinc-800 px-3 sm:px-4 py-2 font-medium text-zinc-700 dark:text-zinc-300 capitalize text-sm sm:text-base",item:"px-3 sm:px-4 py-2",itemAction:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",itemDescription:"text-xs text-zinc-500 dark:text-zinc-400",methodBadge:{get:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",post:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",put:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",patch:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",delete:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300"}},form:{wrapper:"mb-4 sm:mb-6 p-3 sm:p-4 bg-zinc-50 dark:bg-zinc-800 rounded-lg",title:"text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-3",input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors text-sm sm:text-base",buttonDisabled:"opacity-50 cursor-not-allowed"},search:{input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base mb-4"},checkbox:{wrapper:"flex items-center gap-3 px-3 sm:px-4 py-2 hover:bg-zinc-50 dark:hover:bg-zinc-800 cursor-pointer",input:"w-4 h-4 text-blue-600 rounded border-zinc-300 dark:border-zinc-600 focus:ring-blue-500",label:"flex-1 min-w-0"},empty:{wrapper:"text-center py-6 sm:py-8",icon:"w-10 h-10 sm:w-12 sm:h-12 mx-auto text-purple-500 mb-2",text:"text-zinc-600 dark:text-zinc-400"},loading:{wrapper:"text-center py-6 sm:py-8",text:"text-zinc-500 text-sm sm:text-base"},stats:{text:"text-sm text-zinc-500 dark:text-zinc-400 mb-4"}};function Vl(e){return{...vt,...e,header:{...vt.header,...e.header},tabs:{...vt.tabs,...e.tabs},filters:{...vt.filters,...e.filters},card:{...vt.card,...e.card},roleList:{...vt.roleList,...e.roleList},claimList:{...vt.claimList,...e.claimList,methodBadge:{...vt.claimList.methodBadge,...e.claimList?.methodBadge}},form:{...vt.form,...e.form},search:{...vt.search,...e.search},checkbox:{...vt.checkbox,...e.checkbox},empty:{...vt.empty,...e.empty},loading:{...vt.loading,...e.loading},stats:{...vt.stats,...e.stats}}}import{jsxDEV as Ft}from"react/jsx-dev-runtime";function jl({claims:e,isLoading:t}){let r=vt,n=(o)=>{let s=o.split(".");if(s[1]==="bulk")return s[2]||"bulk";return s[1]||"other"},a=e.reduce((o,s)=>{let l=n(s.action);if(!o[l])o[l]=[];return o[l].push(s),o},{}),i=(o)=>{let s=o.toLowerCase();if(s==="get")return r.claimList.methodBadge.get;if(s==="post")return r.claimList.methodBadge.post;if(s==="put")return r.claimList.methodBadge.put;if(s==="patch")return r.claimList.methodBadge.patch;if(s==="delete")return r.claimList.methodBadge.delete;return r.claimList.methodBadge.get};return Ft("div",{className:r.card.wrapper,children:[Ft("h2",{className:r.card.header,children:"All Claims"},void 0,!1,void 0,this),t?Ft("div",{className:r.loading.wrapper,children:Ft("span",{className:r.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(a).length===0?Ft("div",{className:r.empty.wrapper,children:Ft("span",{className:r.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Ft("div",{className:r.claimList.wrapper,children:Object.entries(a).map(([o,s])=>Ft("div",{className:r.claimList.group,children:[Ft("div",{className:r.claimList.groupHeader,children:[o," (",s.length,")"]},void 0,!0,void 0,this),Ft("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:s.map((l)=>Ft("div",{className:r.claimList.item,children:Ft("div",{className:"flex items-center justify-between",children:[Ft("div",{className:"flex-1 min-w-0",children:[Ft("div",{className:r.claimList.itemAction,children:l.action},void 0,!1,void 0,this),Ft("div",{className:r.claimList.itemDescription,children:l.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ft("div",{className:"flex items-center gap-2",children:Ft("span",{className:w("px-2 py-0.5 text-xs rounded-full",i(l.method)),children:l.method},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},l.id,!1,void 0,this))},void 0,!1,void 0,this)]},o,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Fe}from"react/jsx-dev-runtime";function es({selectedRole:e,claims:t,roleClaims:r,isLoading:n,isToggling:a,onToggleClaim:i,onUpdateScope:o,editingScope:s,onEditScope:l,scopeValue:c,onScopeValueChange:d}){let g=vt,h=(z)=>{let m=z.split(".");if(m[1]==="bulk")return m[2]||"bulk";return m[1]||"other"},k=t.reduce((z,m)=>{let y=h(m.action);if(!z[y])z[y]=[];return z[y].push(m),z},{}),u=(z)=>r.some((m)=>m.claimId===z),S=(z)=>r.find((m)=>m.claimId===z),f=(z)=>{if(o&&c!==void 0)o(z,c),l?.(null)},P=()=>{l?.(null)},x=(z,m)=>{d?.(m||""),l?.(z)};if(!e)return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:"Select a role"},void 0,!1,void 0,this),Fe("div",{className:g.empty.wrapper,children:Fe("span",{className:g.empty.text,children:"Select a role from the list to manage its claims"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.name==="godmin")return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),Fe("div",{className:g.empty.wrapper,children:[Fe("svg",{className:g.empty.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Fe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Fe("p",{className:g.empty.text,children:["Godmin role has full access to all resources.",Fe("br",{},void 0,!1,void 0,this),"Claims cannot be modified."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return Fe("div",{className:g.card.wrapper,children:[Fe("h2",{className:g.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),Fe("div",{className:g.stats.text,children:[r.length," claims assigned"]},void 0,!0,void 0,this),n?Fe("div",{className:g.loading.wrapper,children:Fe("span",{className:g.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(k).length===0?Fe("div",{className:g.empty.wrapper,children:Fe("span",{className:g.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Fe("div",{className:"max-h-[500px] overflow-y-auto space-y-4",children:Object.entries(k).map(([z,m])=>Fe("div",{className:g.claimList.group,children:[Fe("div",{className:g.claimList.groupHeader,children:[z," (",m.length,")"]},void 0,!0,void 0,this),Fe("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:m.map((y)=>{let v=u(y.id),p=S(y.id),b=s===y.id,R=p?.scope||"";return Fe("div",{className:w("py-3 px-2 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",v&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:Fe("div",{className:"flex items-start gap-3",children:[Fe("input",{type:"checkbox",checked:v,onChange:()=>i(y,v),disabled:a||y.id.startsWith("temp-"),className:w(g.checkbox.input,"mt-1 shrink-0")},void 0,!1,void 0,this),Fe("div",{className:"flex-1 min-w-0",children:[Fe("div",{className:"flex items-center gap-2 flex-wrap",children:[Fe("span",{className:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",children:y.action},void 0,!1,void 0,this),Fe("span",{className:w("px-1.5 py-0.5 text-xs font-medium rounded",y.method==="GET"&&"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",y.method==="POST"&&"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",y.method==="PUT"&&"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",y.method==="PATCH"&&"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",y.method==="DELETE"&&"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:y.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Fe("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:y.description},void 0,!1,void 0,this),v&&p&&!p.id.startsWith("temp-")&&Fe("div",{className:"mt-2",children:b?Fe("div",{className:"flex items-center gap-2",children:[Fe("input",{type:"text",value:c||"",onChange:($)=>d?.($.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),Fe("button",{type:"button",onClick:()=>f(p.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),Fe("button",{type:"button",onClick:P,className:"px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Fe("button",{type:"button",onClick:()=>x(y.id,R),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:R?Fe("span",{className:"font-mono bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:["Scope: ",R]},void 0,!0,void 0,this):Fe("span",{className:"italic",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},y.id,!1,void 0,this)})},void 0,!1,void 0,this)]},z,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as zt}from"react/jsx-dev-runtime";function ts({roles:e,selectedRole:t,isLoading:r,isCreating:n,isDeleting:a,newRoleName:i,newRoleDescription:o,onNewRoleNameChange:s,onNewRoleDescriptionChange:l,onSelectRole:c,onDeleteRole:d,onCreateRole:g}){let h=vt,k=(S,f)=>{if(S.stopPropagation(),confirm("Are you sure you want to delete this role?"))d(f)},u=(S)=>S.startsWith("temp-");return zt("div",{className:h.card.wrapper,children:[zt("h2",{className:h.card.header,children:"Roles"},void 0,!1,void 0,this),zt("div",{className:h.form.wrapper,children:[zt("h3",{className:h.form.title,children:"Create New Role"},void 0,!1,void 0,this),zt("div",{className:"space-y-3",children:[zt("input",{type:"text",placeholder:"Role name",value:i,onChange:(S)=>s(S.target.value),className:h.form.input},void 0,!1,void 0,this),zt("input",{type:"text",placeholder:"Description (optional)",value:o,onChange:(S)=>l(S.target.value),className:h.form.input},void 0,!1,void 0,this),zt("button",{type:"button",onClick:g,disabled:!i.trim()||n,className:w(h.form.button,(!i.trim()||n)&&h.form.buttonDisabled),children:n?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r?zt("div",{className:h.loading.wrapper,children:zt("span",{className:h.loading.text,children:"Loading roles..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):zt("div",{className:h.roleList.wrapper,children:e.map((S)=>zt("button",{type:"button",onClick:()=>c(S),disabled:u(S.id),className:w(h.roleList.item,t?.id===S.id?h.roleList.itemSelected:h.roleList.itemHover,u(S.id)&&"opacity-50 cursor-wait"),children:zt("div",{className:"flex items-center justify-between",children:[zt("div",{children:[zt("h4",{className:h.roleList.name,children:[S.name,S.name==="godmin"&&zt("span",{className:h.roleList.badge,children:"Super Admin"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.description&&zt("p",{className:h.roleList.description,children:S.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.name!=="godmin"&&!u(S.id)&&zt("button",{type:"button",onClick:(f)=>k(f,S.id),disabled:a,className:w(h.roleList.deleteButton,a&&"opacity-50 cursor-not-allowed"),children:zt("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},S.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as rs}from"@gsap/react";import ba from"gsap";import{forwardRef as Xp,useLayoutEffect as Up,useRef as _i,useState as Ep}from"react";var ma={base:"relative inline-flex items-center justify-center overflow-hidden select-none",display:"inline-flex",alignment:"items-center justify-center",font:{weight:"font-semibold",family:"font-sans"},transition:"transition-all duration-200 ease-out",focus:"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-violet-500 dark:focus-visible:ring-offset-gray-900",disabled:{opacity:"disabled:opacity-50",cursor:"disabled:cursor-not-allowed disabled:pointer-events-none"},fullWidth:"w-full",size:{xs:{padding:"px-2.5 py-1",text:"text-xs",height:"h-7",iconSize:"w-3 h-3",gap:"gap-1"},sm:{padding:"px-3 py-1.5",text:"text-sm",height:"h-8",iconSize:"w-3.5 h-3.5",gap:"gap-1.5"},md:{padding:"px-4 py-2",text:"text-sm",height:"h-10",iconSize:"w-4 h-4",gap:"gap-2"},lg:{padding:"px-5 py-2.5",text:"text-base",height:"h-12",iconSize:"w-5 h-5",gap:"gap-2.5"},xl:{padding:"px-6 py-3",text:"text-lg",height:"h-14",iconSize:"w-6 h-6",gap:"gap-3"}},shape:{default:"rounded-lg",rounded:"rounded-xl",pill:"rounded-full",square:"rounded-none"},iconOnly:{xs:"w-7 h-7 p-0",sm:"w-8 h-8 p-0",md:"w-10 h-10 p-0",lg:"w-12 h-12 p-0",xl:"w-14 h-14 p-0"},variant:{nucleus:{background:"bg-zinc-900 dark:bg-white",text:"text-white dark:text-zinc-900",border:"border-0",shadow:"shadow-sm",hover:"hover:bg-zinc-800 dark:hover:bg-zinc-100",active:"active:bg-zinc-950 dark:active:bg-zinc-200 active:scale-[0.98]"},"nucleus-outline":{background:"bg-transparent",text:"text-zinc-900 dark:text-white",border:"border-2 border-zinc-900 dark:border-white",shadow:"",hover:"hover:bg-zinc-900 hover:text-white dark:hover:bg-white dark:hover:text-zinc-900",active:"active:bg-zinc-800 dark:active:bg-zinc-100 active:scale-[0.98]"},"nucleus-ghost":{background:"bg-transparent",text:"text-zinc-700 dark:text-zinc-300",border:"border-0",shadow:"",hover:"hover:bg-zinc-100 dark:hover:bg-zinc-800",active:"active:bg-zinc-200 dark:active:bg-zinc-700"},"nucleus-soft":{background:"bg-zinc-100 dark:bg-zinc-800",text:"text-zinc-900 dark:text-white",border:"border-0",shadow:"",hover:"hover:bg-zinc-200 dark:hover:bg-zinc-700",active:"active:bg-zinc-300 dark:active:bg-zinc-600 active:scale-[0.98]"},primary:{background:"bg-blue-600 dark:bg-blue-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-blue-500/20",hover:"hover:bg-blue-500 hover:shadow-lg hover:shadow-blue-500/30 hover:-translate-y-0.5",active:"active:bg-blue-700 active:translate-y-0 active:shadow-sm"},secondary:{background:"bg-gray-100 dark:bg-gray-800",text:"text-gray-900 dark:text-gray-100",border:"border border-gray-200 dark:border-gray-700",shadow:"shadow-sm",hover:"hover:bg-gray-200 dark:hover:bg-gray-700 hover:shadow-md hover:-translate-y-0.5",active:"active:bg-gray-300 dark:active:bg-gray-600 active:translate-y-0"},success:{background:"bg-emerald-600 dark:bg-emerald-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-emerald-500/20",hover:"hover:bg-emerald-500 hover:shadow-lg hover:shadow-emerald-500/30 hover:-translate-y-0.5",active:"active:bg-emerald-700 active:translate-y-0 active:shadow-sm"},warning:{background:"bg-amber-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-amber-500/20",hover:"hover:bg-amber-400 hover:shadow-lg hover:shadow-amber-500/30 hover:-translate-y-0.5",active:"active:bg-amber-600 active:translate-y-0 active:shadow-sm"},danger:{background:"bg-red-600 dark:bg-red-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-red-500/20",hover:"hover:bg-red-500 hover:shadow-lg hover:shadow-red-500/30 hover:-translate-y-0.5",active:"active:bg-red-700 active:translate-y-0 active:shadow-sm"},ghost:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-0",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800",active:"active:bg-gray-200 dark:active:bg-gray-700"},outline:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-2 border-gray-300 dark:border-gray-600",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800 hover:border-gray-400 dark:hover:border-gray-500",active:"active:bg-gray-200 dark:active:bg-gray-700"},link:{background:"bg-transparent",text:"text-violet-600 dark:text-violet-400",border:"border-0",shadow:"",hover:"hover:underline hover:text-violet-700 dark:hover:text-violet-300",active:"active:text-violet-800 dark:active:text-violet-200"}},spinner:{base:"animate-spin",size:{xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"}},ripple:{base:"absolute rounded-full bg-white/30 pointer-events-none"},pulse:{animation:"animate-pulse"}};function Gr(...e){return Rt(Mt(e))}import{jsxDEV as Lr}from"react/jsx-dev-runtime";ba.registerPlugin(rs);var se=Xp(({children:e,variant:t="nucleus",size:r="md",shape:n="default",loading:a=!1,disabled:i=!1,fullWidth:o=!1,leftIcon:s,rightIcon:l,iconOnly:c=!1,ripple:d=!0,pulse:g=!1,className:h,onClick:k,onMouseEnter:u,onMouseLeave:S,...f},P)=>{let x=_i(null),z=_i(null),m=_i(null),[y,v]=Ep(void 0),p=ma,b=i||a;Up(()=>{if(a&&x.current&&!y)v(x.current.offsetWidth);if(!a&&y)v(void 0)},[a,y]);let{contextSafe:R}=rs({scope:x}),$=R((M)=>{if(b)return;if(d&&z.current&&x.current){let Q=x.current.getBoundingClientRect(),N=M.clientX-Q.left,O=M.clientY-Q.top,A=Math.max(Q.width,Q.height)*2,D=document.createElement("span");D.className=p.ripple.base,D.style.width=`${A}px`,D.style.height=`${A}px`,D.style.left=`${N-A/2}px`,D.style.top=`${O-A/2}px`,z.current.appendChild(D),ba.fromTo(D,{scale:0,opacity:0.6},{scale:1,opacity:0,duration:0.6,ease:"power2.out",onComplete:()=>{D.remove()}})}if(m.current)ba.to(m.current,{scale:0.95,duration:0.1,ease:"power2.out",onComplete:()=>{ba.to(m.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}});k?.(M)}),J=R((M)=>{if(b)return;u?.(M)}),U=R((M)=>{S?.(M)}),E=p.variant[t],K=(M,Q)=>{if(!M)return null;return Lr("span",{className:Gr("inline-flex items-center justify-center shrink-0",p.size[r].iconSize,a&&Q==="left"&&"opacity-0"),children:M},void 0,!1,void 0,this)};return Lr("button",{ref:(M)=>{if(x.current=M,typeof P==="function")P(M);else if(P)P.current=M},type:"button",disabled:b,"aria-disabled":b,"aria-busy":a,onClick:$,onMouseEnter:J,onMouseLeave:U,className:Gr(p.base,p.font.weight,p.font.family,p.transition,p.focus,p.disabled.opacity,p.disabled.cursor,p.shape[n],c?p.iconOnly[r]:Gr(p.size[r].padding,p.size[r].height),p.size[r].text,p.size[r].gap,E.background,E.text,E.border,E.shadow,!b&&E.hover,!b&&E.active,o&&p.fullWidth,g&&!a&&p.pulse.animation,h),style:y?{width:y}:void 0,...f,children:[Lr("span",{ref:z,className:"absolute inset-0 overflow-hidden rounded-[inherit] pointer-events-none","aria-hidden":"true"},void 0,!1,void 0,this),Lr("span",{ref:m,className:Gr("relative inline-flex items-center justify-center z-10",p.size[r].gap),children:[a&&Lr("span",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:Lr("svg",{className:Gr("animate-spin",p.size[r].iconSize),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Lr("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Lr("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Lr("span",{className:Gr("inline-flex items-center",p.size[r].gap,a&&"invisible"),"aria-hidden":a,children:[K(s,"left"),e,K(l,"right")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)});se.displayName="Button";import{useGSAP as Dp}from"@gsap/react";import Vp from"gsap";import{useRef as Qf}from"react";import{jsxDEV as Df}from"react/jsx-dev-runtime";Vp.registerPlugin(Dp);import{useGSAP as is}from"@gsap/react";import Oi from"gsap";import{useEffect as ns,useEffectEvent as jp,useRef as Fi,useState as fn}from"react";var Fn={container:{base:"w-full",wrapper:"flex flex-col gap-2"},label:{base:"text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400"},challenge:{wrapper:"relative overflow-hidden rounded-xl bg-neutral-100/80 dark:bg-neutral-800/40 p-3",math:{question:"text-xl font-bold text-center text-neutral-800 dark:text-neutral-100 font-mono tracking-wide py-2"},image:{wrapper:"flex justify-center",img:"max-w-full h-auto rounded-lg select-none pointer-events-none"},text:{question:"text-xl font-bold text-center text-neutral-800 dark:text-neutral-100 font-mono tracking-[0.25em] select-none py-2"},puzzle:{wrapper:"flex flex-col gap-2",instruction:"text-xs text-center text-neutral-500 dark:text-neutral-400",grid:"flex flex-wrap justify-center gap-1.5",piece:"w-10 h-10 flex items-center justify-center rounded-lg border border-neutral-200 dark:border-neutral-600 bg-white dark:bg-neutral-700 text-sm font-bold text-neutral-800 dark:text-neutral-100 cursor-pointer hover:border-neutral-400 dark:hover:border-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-600 transition-all duration-200 select-none",pieceSelected:"border-neutral-500 bg-neutral-100 dark:bg-neutral-600 ring-1 ring-neutral-500",pieceOrdered:"border-emerald-400 bg-emerald-50 dark:bg-emerald-900/30",orderDisplay:"flex justify-center gap-1 mt-1",orderBadge:"w-6 h-6 flex items-center justify-center rounded bg-neutral-700 dark:bg-neutral-300 text-white dark:text-neutral-900 text-xs font-medium",clearButton:"text-xs text-red-500/70 hover:text-red-600 dark:hover:text-red-400 cursor-pointer ml-2"}},input:{wrapper:"mt-1",base:"w-full px-3 py-2 rounded-lg border border-neutral-200 dark:border-neutral-600 bg-white/80 dark:bg-neutral-800/60 text-sm text-neutral-800 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 focus:outline-none focus:ring-1 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent transition-all duration-200",error:"border-red-400 focus:ring-red-400"},actions:{wrapper:"flex items-center justify-between",refresh:"flex items-center gap-1 text-xs font-medium text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 transition-colors duration-200 disabled:opacity-40 disabled:cursor-not-allowed",timer:"text-[10px] tabular-nums text-neutral-400 dark:text-neutral-500",timerExpired:"text-[10px] text-red-500/80 dark:text-red-400/80"},error:{container:"mt-1 px-2.5 py-1.5 rounded-lg bg-red-50/80 dark:bg-red-900/10 border border-red-200/60 dark:border-red-800/40",text:"text-xs text-red-500 dark:text-red-400"},loading:{wrapper:"flex items-center justify-center py-4",spinner:"w-5 h-5 border-2 border-neutral-200 dark:border-neutral-600 border-t-neutral-500 dark:border-t-neutral-300 rounded-full animate-spin"}};import{jsxDEV as Je,Fragment as as}from"react/jsx-dev-runtime";Oi.registerPlugin(is);function eu(e,t){let r={...e};for(let n of Object.keys(t)){let a=t[n];if(!a)continue;let i=r[n];if(i&&typeof i==="object"&&typeof a==="object"){let o={...i};for(let[s,l]of Object.entries(a))if(l&&typeof l==="object"&&typeof o[s]==="object")o[s]={...o[s],...l};else if(l!==void 0)o[s]=l;r[n]=o}}return r}var tu=({className:e,iconRef:t})=>Je("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[Je("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"},void 0,!1,void 0,this),Je("path",{d:"M3 3v5h5"},void 0,!1,void 0,this),Je("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"},void 0,!1,void 0,this),Je("path",{d:"M16 16h5v5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);function fa({generateAction:e,config:t,onChallengeLoad:r,onAnswerChange:n,disabled:a=!1,autoGenerate:i=!0,className:o,label:s="Security Check",errorMessage:l,themeOverride:c}){let d=c?eu(Fn,c):Fn,g=Fi(null),h=Fi(null),k=Fi(null),[u,S]=fn(null),[f,P]=fn(""),[x,z]=fn(null),[m,y]=fn(!1),[v,p]=fn(null),[b,R]=fn([]),$=e.state.isPending,{contextSafe:J}=is({scope:g}),U=jp(()=>{P(""),y(!1),p(null),R([]),e.start({payload:{type:t?.type,difficulty:t?.difficulty},onAfterHandle:(A)=>{let{data:D}=A;if(console.log("[DEBUG]:",A),!D||D.rateLimited){p(A.message??"Too many requests. Please try again later."),S(null);return}if(S(D),r?.(A),h.current)Oi.fromTo(h.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.3,ease:"power2.out"})},onErrorHandle:(A,D)=>{if(D===429)p("Too many requests. Please try again later.");S(null)}})}),E=J(()=>{if(k.current)Oi.to(k.current,{rotation:"+=360",duration:0.5,ease:"power2.inOut"});U()}),K=(A)=>{if(P(A),u)n?.(u.challengeId,A)},M=(A)=>{if(a||$||m)return;let D=b.includes(A)?b.filter((_)=>_!==A):[...b,A];R(D);let I=D.join(",");if(P(I),u)n?.(u.challengeId,I)},Q=()=>{if(R([]),P(""),u)n?.(u.challengeId,"")};ns(()=>{if(i&&t?.enabled!==!1)U()},[i,t?.enabled]),ns(()=>{if(!u?.expiresAt){z(null);return}let A=()=>{let I=Date.now(),_=Math.max(0,Math.floor((u.expiresAt-I)/1000));if(z(_),_<=0)y(!0)};A();let D=setInterval(A,1000);return()=>clearInterval(D)},[u?.expiresAt]);let N=(A)=>{let D=Math.floor(A/60),I=A%60;return`${D}:${I.toString().padStart(2,"0")}`},O=()=>{if(!u)return"Enter answer";switch(u.type){case"math":return"Enter the result";case"image":case"text":return"Enter the text shown";case"puzzle":return"Enter piece order (e.g., 0,1,2,3)";default:return"Enter answer"}};if(t?.enabled===!1)return Je(as,{},void 0,!1,void 0,this);return Je("div",{ref:g,className:w(d.container.base,o),children:Je("div",{className:d.container.wrapper,children:[Je("span",{className:d.label.base,children:s},void 0,!1,void 0,this),Je("div",{ref:h,className:d.challenge.wrapper,children:$?Je("div",{className:d.loading.wrapper,children:Je("div",{className:d.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this):u?Je(as,{children:[u.type==="math"&&Je("p",{className:d.challenge.math.question,children:u.question},void 0,!1,void 0,this),u.type==="text"&&Je("p",{className:d.challenge.text.question,children:u.question},void 0,!1,void 0,this),u.type==="image"&&u.imageData&&Je("div",{className:d.challenge.image.wrapper,children:Je("img",{src:u.imageData,alt:"Captcha",className:d.challenge.image.img,draggable:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this),u.type==="puzzle"&&u.puzzleData&&Je("div",{className:d.challenge.puzzle.wrapper,children:[Je("p",{className:d.challenge.puzzle.instruction,children:["Click the pieces in the correct order (0 to"," ",u.puzzleData.pieces.length-1,")"]},void 0,!0,void 0,this),Je("div",{className:d.challenge.puzzle.grid,children:u.puzzleData.pieces.map((A)=>Je("button",{type:"button",onClick:()=>M(A.id),disabled:a||$||m,className:w(d.challenge.puzzle.piece,b.includes(A.id)&&d.challenge.puzzle.pieceOrdered),children:A.id},A.id,!1,void 0,this))},void 0,!1,void 0,this),b.length>0&&Je("div",{className:d.challenge.puzzle.orderDisplay,children:[b.map((A,D)=>Je("span",{className:d.challenge.puzzle.orderBadge,children:A},`order-${A}-${D}`,!1,void 0,this)),Je("button",{type:"button",onClick:Q,className:d.challenge.puzzle.clearButton,children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Je("div",{className:d.loading.wrapper,children:Je("p",{className:"text-sm text-zinc-500",children:"Click refresh to load captcha"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u?.type!=="puzzle"&&Je("div",{className:d.input.wrapper,children:[Je("label",{htmlFor:"captcha-answer",className:"sr-only",children:s},void 0,!1,void 0,this),Je("input",{id:"captcha-answer",type:"text",value:f,onChange:(A)=>K(A.target.value),placeholder:O(),disabled:a||$||m,className:w(d.input.base,(l||m)&&d.input.error),autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Je("div",{className:d.actions.wrapper,children:[Je("button",{type:"button",onClick:E,disabled:a||$,className:d.actions.refresh,children:[Je(tu,{iconRef:k},void 0,!1,void 0,this),Je("span",{children:"New challenge"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x!==null&&Je("span",{className:m?d.actions.timerExpired:d.actions.timer,children:m?"Expired":`Expires in ${N(x)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(l||m||v)&&Je("div",{className:d.error.container,children:Je("p",{className:d.error.text,children:v?v:m?"Captcha expired. Please refresh.":l},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Ui}from"@gsap/react";import va from"gsap";import{useRef as Ns}from"react";import{useGSAP as os}from"@gsap/react";import qi from"gsap";import{useRef as ru}from"react";var Mr={container:{base:"relative w-full",spacing:"mb-1"},wrapper:{base:"relative flex items-center",border:{base:"border rounded-lg",width:"border",radius:"rounded-lg"},padding:"px-4 py-3",transition:"transition-all duration-200 ease-out",states:{inactive:"border-gray-300 dark:border-gray-600",hover:"border-gray-400 dark:border-gray-500",focused:"border-blue-600 dark:border-blue-500",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"}},input:{base:"w-full bg-transparent outline-none",text:"text-base",color:"text-gray-900 dark:text-gray-100",placeholder:"placeholder:text-gray-400 dark:placeholder:text-gray-500",disabled:"text-gray-400 dark:text-gray-500 cursor-not-allowed",transition:"transition-colors duration-200"},label:{base:"absolute pointer-events-none select-none",text:"text-base",transition:"transition-all duration-200 ease-out",states:{inactive:{position:"left-3 top-1/2 -translate-y-1/2",text:"text-base",color:"text-gray-500 dark:text-gray-400",background:"bg-transparent px-1"},floated:{position:"left-3 -top-2.5 translate-y-0",text:"text-xs",color:"text-gray-600 dark:text-gray-300",background:"bg-white/50 dark:bg-gray-900/50 px-1"},focused:{color:"text-blue-600 dark:text-blue-500"},error:{color:"text-red-500 dark:text-red-400"},disabled:{color:"text-gray-400 dark:text-gray-500"}}},helperText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-gray-500 dark:text-gray-400",disabled:"text-gray-400 dark:text-gray-500"},errorText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-red-500 dark:text-red-400",minHeight:"min-h-[1.25rem]"},icon:{base:"flex-shrink-0",size:"w-5 h-5",color:"text-gray-400 dark:text-gray-500",spacing:{left:"mr-2",right:"ml-2"},states:{focused:"text-blue-600 dark:text-blue-500",error:"text-red-500 dark:text-red-400",disabled:"text-gray-300 dark:text-gray-600"}},animation:{label:{duration:0.35,ease:"power3.out",floatY:-24,floatScale:0.75},typewriter:{charDelay:0.03,ease:"none"},border:{duration:0.2,ease:"power2.out"}}};function pt(...e){return Rt(Mt(e))}import{jsxDEV as nu}from"react/jsx-dev-runtime";qi.registerPlugin(os);function Ji({label:e,isFloated:t,isFocused:r,hasError:n,isDisabled:a,hasLeftIcon:i,className:o}){let s=ru(null),l=Mr.label,c=Mr.animation.label;os(()=>{if(!s.current)return;if(t)qi.to(s.current,{y:c.floatY,x:i?-20:0,scale:c.floatScale,duration:c.duration,ease:c.ease});else qi.to(s.current,{y:0,x:0,scale:1,duration:c.duration,ease:c.ease})},[t,i]);let d=()=>{if(a)return l.states.disabled.color;if(n)return l.states.error.color;if(r)return l.states.focused.color;if(t)return l.states.floated.color;return l.states.inactive.color},g=()=>{if(t)return l.states.floated.background;return l.states.inactive.background};return nu("span",{ref:s,className:pt(l.base,g(),i?"left-9 top-1/2 origin-left":"left-3 top-1/2 origin-left",d(),o),style:{transform:"translateY(-50%)"},"aria-hidden":"true",children:e},void 0,!1,void 0,this)}import{useGSAP as zs}from"@gsap/react";import Xi from"gsap";import{useId as uu,useRef as xs,useState as On}from"react";function ha(e,t=" "){let r=e.replace(/\D/g,"");if(!r)return"";return r.replace(/\B(?=(\d{3})+(?!\d))/g,t)}function Ar(e){return e.replace(/\D/g,"")}var au={tr:{pattern:[3,3,2,2],prefix:""},us:{pattern:[3,3,4],prefix:""},eu:{pattern:[2,3,3,2],prefix:""}};function ya(e,t="tr"){let r=e.replace(/\D/g,"");if(!r)return"";let{pattern:n}=au[t],a=[],i=r;for(let o of n){if(i.length===0)break;a.push(i.slice(0,o)),i=i.slice(o)}if(i.length>0)a.push(i);return a.join(" ")}function Gi(e){return e.replace(/\D/g,"")}var iu=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ou=/^(https?:\/\/)?([\da-z-]+\.)+[a-z]{2,6}(\/[^\s]*)?$/i,lu=/^[+]?[(]?[0-9]{1,4}[)]?[-\s./0-9]{6,}$/,hn={minLength:8,hasUppercase:/[A-Z]/,hasLowercase:/[a-z]/,hasNumber:/[0-9]/,hasSpecial:/[!@#$%^&*(),.?":{}|<>]/},ls={text:(e)=>{if(!e.trim())return{isValid:!0};return{isValid:!0}},email:(e)=>{if(!e.trim())return{isValid:!0};if(!iu.test(e))return{isValid:!1,errorMessage:"Please enter a valid email address"};return{isValid:!0}},password:(e)=>{if(!e)return{isValid:!0};let t=[];if(e.length<hn.minLength)t.push(`at least ${hn.minLength} characters`);if(!hn.hasUppercase.test(e))t.push("one uppercase letter");if(!hn.hasLowercase.test(e))t.push("one lowercase letter");if(!hn.hasNumber.test(e))t.push("one number");if(!hn.hasSpecial.test(e))t.push("one special character");if(t.length>0)return{isValid:!1,errorMessage:`Password must contain ${t.join(", ")}`};return{isValid:!0}},number:(e)=>{if(!e.trim())return{isValid:!0};let t=Number(e);if(Number.isNaN(t))return{isValid:!1,errorMessage:"Please enter a valid number"};return{isValid:!0}},tel:(e)=>{if(!e.trim())return{isValid:!0};if(e.replace(/\D/g,"").length<7)return{isValid:!1,errorMessage:"Phone number must have at least 7 digits"};if(!lu.test(e))return{isValid:!1,errorMessage:"Please enter a valid phone number"};return{isValid:!0}},url:(e)=>{if(!e.trim())return{isValid:!0};if(!ou.test(e))return{isValid:!1,errorMessage:"Please enter a valid URL"};return{isValid:!0}}};function Ai(e,t,r){if(r?.required&&!e.trim())return{isValid:!1,errorMessage:r.requiredMessage||"This field is required"};if(r?.minLength&&e.length<r.minLength)return{isValid:!1,errorMessage:`Minimum ${r.minLength} characters required`};if(r?.maxLength&&e.length>r.maxLength)return{isValid:!1,errorMessage:`Maximum ${r.maxLength} characters allowed`};if(r?.pattern&&!r.pattern.test(e))return{isValid:!1,errorMessage:r.patternMessage||"Invalid format"};if(r?.customRules){for(let n of r.customRules)if(!n.validate(e))return{isValid:!1,errorMessage:n.message}}return ls[t](e)}function Yi(e){switch(e){case"email":return"email";case"number":return"numeric";case"tel":return"tel";case"url":return"url";default:return"text"}}function Ki(e,t){switch(e){case"email":return"email";case"password":return t?"new-password":"current-password";case"tel":return"tel";case"url":return"url";default:return"off"}}import{jsxDEV as tt}from"react/jsx-dev-runtime";function ss({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"},void 0,!1,void 0,this),tt("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ds({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"},void 0,!1,void 0,this),tt("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"},void 0,!1,void 0,this),tt("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ps({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"},void 0,!1,void 0,this),tt("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"},void 0,!1,void 0,this),tt("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"},void 0,!1,void 0,this),tt("path",{d:"m2 2 20 20"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function us({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("line",{x1:"4",x2:"20",y1:"9",y2:"9"},void 0,!1,void 0,this),tt("line",{x1:"4",x2:"20",y1:"15",y2:"15"},void 0,!1,void 0,this),tt("line",{x1:"10",x2:"8",y1:"3",y2:"21"},void 0,!1,void 0,this),tt("line",{x1:"16",x2:"14",y1:"3",y2:"21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:tt("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function ms({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},void 0,!1,void 0,this),tt("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:tt("path",{d:"M20 6 9 17l-5-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function fs({className:e}){return tt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:pt("h-5 w-5",e),"aria-hidden":"true",children:[tt("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,void 0,this),tt("line",{x1:"12",x2:"12",y1:"8",y2:"12"},void 0,!1,void 0,this),tt("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as hs}from"@gsap/react";import ys from"gsap";import{useRef as su}from"react";import{jsxDEV as yn}from"react/jsx-dev-runtime";ys.registerPlugin(hs);function ws(e){let t=0;if(!e)return{level:"weak",score:0,label:"",color:"bg-gray-200"};if(e.length>=8)t+=1;if(e.length>=12)t+=1;if(e.length>=16)t+=1;if(/[a-z]/.test(e))t+=1;if(/[A-Z]/.test(e))t+=1;if(/[0-9]/.test(e))t+=1;if(/[^a-zA-Z0-9]/.test(e))t+=1;if(/(.)\1{2,}/.test(e))t-=1;if(/^[a-zA-Z]+$/.test(e))t-=1;if(/^[0-9]+$/.test(e))t-=1;if(t=Math.max(0,Math.min(t,7)),t<=2)return{level:"weak",score:t,label:"Weak",color:"bg-red-500"};if(t<=4)return{level:"fair",score:t,label:"Fair",color:"bg-orange-500"};if(t<=5)return{level:"good",score:t,label:"Good",color:"bg-yellow-500"};return{level:"strong",score:t,label:"Strong",color:"bg-green-500"}}function Zi({password:e,className:t}){let r=su(null),n=ws(e),a=e?Math.min(n.score/7*100,100):0;if(hs(()=>{if(!r.current)return;ys.to(r.current,{width:`${a}%`,duration:0.3,ease:"power2.out"})},[a]),!e)return null;return yn("div",{className:pt("mt-2 mb-4",t),children:[yn("div",{className:"flex items-center justify-between mb-1",children:[yn("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Password strength"},void 0,!1,void 0,this),yn("span",{className:pt("text-xs font-medium",n.level==="weak"&&"text-red-500",n.level==="fair"&&"text-orange-500",n.level==="good"&&"text-yellow-600",n.level==="strong"&&"text-green-500"),children:n.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),yn("div",{className:"h-1.5 w-full bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:yn("div",{ref:r,className:pt("h-full rounded-full transition-colors duration-300",n.color),style:{width:0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as vs}from"@gsap/react";import wa from"gsap";import{TextPlugin as du}from"gsap/TextPlugin";import{useEffect as cu,useRef as ks}from"react";import{jsxDEV as pu}from"react/jsx-dev-runtime";wa.registerPlugin(vs,du);function Qi({text:e,className:t,onComplete:r}){let n=ks(null),a=ks(""),i=Mr.errorText,o=Mr.animation.typewriter;if(vs(()=>{if(!n.current||!e){if(n.current)n.current.textContent="";a.current="";return}if(e===a.current)return;wa.killTweensOf(n.current),n.current.textContent="";let s=e.length*o.charDelay;wa.to(n.current,{duration:s,text:{value:e,delimiter:""},ease:o.ease,onComplete:()=>{a.current=e,r?.()}})},[e]),cu(()=>{return()=>{if(n.current)wa.killTweensOf(n.current)}},[]),!e)return null;return pu("span",{ref:n,className:pt(i.base,i.text,i.color,t),role:"alert","aria-live":"polite"},void 0,!1,void 0,this)}import{jsxDEV as yt}from"react/jsx-dev-runtime";Xi.registerPlugin(zs);var gu={text:null,email:yt(ss,{},void 0,!1,void 0,this),password:yt(ds,{},void 0,!1,void 0,this),number:yt(us,{},void 0,!1,void 0,this),tel:yt(gs,{},void 0,!1,void 0,this),url:yt(ms,{},void 0,!1,void 0,this)};function Ee({value:e="",onChange:t,type:r="text",label:n,placeholder:a,helperText:i,errorMessage:o,disabled:s=!1,readOnly:l=!1,leftIcon:c,rightIcon:d,size:g="md",fullWidth:h=!0,className:k,inputClassName:u,labelClassName:S,wrapperClassName:f,showTypewriterError:P=!0,showTypeIcon:x=!0,showValidationIcon:z=!0,enableValidation:m=!0,validateOnBlur:y=!0,validateOnChange:v=!1,validationConfig:p,customValidator:b,onValidationChange:R,unit:$,unitPosition:J="suffix",formatNumber:U=!1,thousandSeparator:E=" ",phoneFormat:K="tr",isNewPassword:M=!1,maxInputLength:Q,confirmValue:N,onConfirmChange:O,showPasswordStrength:A=!1,preventCopy:D=!1,preventPaste:I=!1,preventContextMenu:_=!1,trimOnBlur:T=!1,onFocus:ie,onBlur:q,...ce}){let[oe,Ze]=On(!1),[$e,Pe]=On(!1),[fe,xe]=On(!1),[qe,Le]=On(void 0),[ve,B]=On(null),de=xs(null),te=xs(null),ye=uu(),V=Mr,ee=o||qe,re=Boolean(ee),Ke=Boolean(e&&e.length>0),H=oe||Ke,{contextSafe:ue}=zs({scope:te}),We=(Ae)=>{if(!m)return{isValid:!0};if(b)return b(Ae);return Ai(Ae,r,p)},Ue=(Ae)=>{let Ut=We(Ae);B(Ut.isValid),Le(Ut.isValid?void 0:Ut.errorMessage),R?.(Ut)},gt=ue((Ae)=>{if(s)return;Ze(!0),ie?.(Ae)}),Ge=ue((Ae)=>{if(Ze(!1),T&&e){let Ut=e.trim();if(Ut!==e)t?.(Ut)}if(y&&e)Ue(W(e));if(r==="password"&&N!==void 0&&e!==N)Le("Passwords do not match"),B(!1);q?.(Ae)}),Qt=(Ae)=>{if(D||r==="password")Ae.preventDefault()},$t=(Ae)=>{if(I)Ae.preventDefault()},zr=(Ae)=>{if(_||r==="password")Ae.preventDefault()},ne=(Ae)=>{let Lt=Ae.target.selectionStart??0,sa=e,Et=Ae.target.value,da=Ar(sa).length,Mi=Ar(Et).length<da;if(r==="number"&&U){let Sr=Ar(Et);Et=ha(Sr,E)}else if(r==="tel")Et=ya(Et,K);if(t?.(Et),r==="number"&&U||r==="tel")requestAnimationFrame(()=>{if(!de.current)return;let Sr=Ar(Ae.target.value.slice(0,Lt)).length,Cr=0,Pr=0;for(let Dt=0;Dt<Et.length;Dt++){let ca=Et[Dt];if(ca!==void 0&&/\d/.test(ca))Pr++;if(Pr===Sr){Cr=Dt+1;break}}if(Pr<Sr)Cr=Et.length;if(Mi&&Lt>0){let Dt=Ae.target.value[Lt-1];if(Dt===" "||Dt===E)Cr=Math.max(0,Cr-1)}de.current.setSelectionRange(Cr,Cr)});if(v){let Sr=W(Et);Ue(Sr)}if(r==="password"&&N!==void 0&&Et!==N)Le("Passwords do not match"),B(!1);else if(r==="password"&&N!==void 0&&Et===N)Le(void 0),B(!0);else if(qe&&!v)Le(void 0),B(null)},W=(Ae)=>{if(r==="number"&&U)return Ar(Ae);if(r==="tel")return Gi(Ae);return Ae},j=()=>{if(r==="number"&&U&&e)return ha(Ar(e),E);if(r==="tel"&&e)return ya(e,K);return e},Ne=()=>{xe((Ae)=>!Ae)},ze=()=>{if(r==="password")return fe?"text":"password";return r},Me=()=>{if(!x)return null;if(c)return null;if(r==="number"&&$)return null;return gu[r]},gr=()=>{if(!z||!Ke||ve===null)return null;if(re)return yt(fs,{className:"text-red-500"},void 0,!1,void 0,this);if(ve)return yt(bs,{className:"text-green-500"},void 0,!1,void 0,this);return null},br=()=>{if(r==="password")return yt("button",{type:"button",onClick:Ne,className:"focus:outline-none",tabIndex:-1,"aria-label":fe?"Hide password":"Show password",children:fe?yt(ps,{},void 0,!1,void 0,this):yt(cs,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return d;return gr()},Xt=ue(()=>{if(s)return;if(Pe(!0),te.current&&!oe&&!re)Xi.to(te.current,{borderColor:"rgb(156, 163, 175)",duration:V.animation.border.duration,ease:V.animation.border.ease})}),Nr=ue(()=>{if(Pe(!1),te.current&&!oe&&!re)Xi.to(te.current,{borderColor:"rgb(209, 213, 219)",duration:V.animation.border.duration,ease:V.animation.border.ease})}),Vr=()=>{if(s)return V.wrapper.states.disabled;if(re)return V.wrapper.states.error;if(oe)return V.wrapper.states.focused;if($e)return V.wrapper.states.hover;return V.wrapper.states.inactive},ar=()=>{switch(g){case"sm":return"px-3 py-2 text-sm";case"lg":return"px-5 py-4 text-lg";default:return V.wrapper.padding}};return yt("div",{className:pt(V.container.base,V.container.spacing,h&&"w-full",k),children:[yt("label",{ref:te,htmlFor:ye,className:pt(V.wrapper.base,V.wrapper.border.base,V.wrapper.transition,ar(),Vr(),"cursor-text",f),onMouseEnter:Xt,onMouseLeave:Nr,children:[(c||Me())&&yt("span",{className:pt(V.icon.base,V.icon.size,V.icon.color,V.icon.spacing.left,oe&&V.icon.states.focused,re&&V.icon.states.error,s&&V.icon.states.disabled),children:c||Me()},void 0,!1,void 0,this),n&&yt(Ji,{label:n,isFloated:H,isFocused:oe,hasError:re,isDisabled:s,hasLeftIcon:Boolean(c||Me()),className:S},void 0,!1,void 0,this),$&&J==="prefix"&&yt("span",{className:"text-gray-500 dark:text-gray-400 mr-1 select-none",children:$},void 0,!1,void 0,this),yt("input",{ref:de,id:ye,type:r==="number"&&U?"text":ze(),inputMode:Yi(r),autoComplete:Ki(r,M),maxLength:Q,value:j(),onChange:ne,onFocus:gt,onBlur:Ge,onCopy:Qt,onPaste:$t,onContextMenu:zr,disabled:s,readOnly:l,placeholder:H?a:"","aria-label":n,"aria-invalid":re,"aria-describedby":ee?`${ye}-error`:i?`${ye}-helper`:void 0,className:pt(V.input.base,V.input.text,V.input.color,V.input.placeholder,V.input.transition,s&&V.input.disabled,u),...ce},void 0,!1,void 0,this),$&&J==="suffix"&&yt("span",{className:"text-gray-500 dark:text-gray-400 ml-1 select-none",children:$},void 0,!1,void 0,this),br()&&yt("span",{className:pt(V.icon.base,V.icon.size,V.icon.color,V.icon.spacing.right,oe&&V.icon.states.focused,re&&V.icon.states.error,s&&V.icon.states.disabled),children:br()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),yt("div",{className:V.errorText.minHeight,children:re&&P&&ee?yt(Qi,{text:ee},void 0,!1,void 0,this):re?yt("span",{id:`${ye}-error`,className:pt(V.errorText.base,V.errorText.text,V.errorText.color),role:"alert",children:ee},void 0,!1,void 0,this):i?yt("span",{id:`${ye}-helper`,className:pt(V.helperText.base,V.helperText.text,V.helperText.color,s&&V.helperText.disabled),children:i},void 0,!1,void 0,this):null},void 0,!1,void 0,this),r==="password"&&A&&e&&yt(Zi,{password:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{batch as mu,createStore as bu}from"h-state";var fu={currentPassword:"",newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:ka}=bu(fu,{setCurrentPassword:(e)=>(t)=>{if(e.currentPassword=t,e.error)e.error=null},setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{mu(()=>{e.currentPassword="",e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var tn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",cancel:"text-sm text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as ut}from"react/jsx-dev-runtime";va.registerPlugin(Ui);function Ss({className:e}){return ut("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ut("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function hu({className:e}){return ut("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ut("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Ei({changePasswordAction:e,onSuccess:t,onCancel:r,cancelHref:n}){let a=tn,i=Ns(null),o=Ns(null),s=ka(),{contextSafe:l}=Ui({scope:i}),c=e.state.isPending;Ui(()=>{if(s.step==="success"&&o.current)va.fromTo(o.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[s.step]});let d=l(()=>{if(!i.current)return;va.fromTo(i.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{va.set(i.current,{x:0})}})}),g=l((k)=>{if(k.preventDefault(),s.newPassword!==s.confirmPassword){s.setError("New passwords do not match"),d();return}if(s.newPassword.length<8){s.setError("Password must be at least 8 characters"),d();return}s.setError(null),e.start({payload:{currentPassword:s.currentPassword,newPassword:s.newPassword,confirmPassword:s.confirmPassword},onAfterHandle:()=>{s.setStep("success"),t?.()},onErrorHandle:(u)=>{let S=u instanceof Error?u.message:"Failed to change password. Please try again.";s.setError(S),d()}})}),h=()=>{if(r)r();else if(n)window.location.href=n};if(s.step==="success")return ut("div",{ref:o,className:a.success.container,children:[ut("div",{className:a.success.iconWrapper,children:ut(hu,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("h2",{className:a.success.title,children:"Password Changed!"},void 0,!1,void 0,this),ut("p",{className:a.success.message,children:"Your password has been successfully updated. You can now use your new password to log in."},void 0,!1,void 0,this),(n||r)&&ut("div",{className:a.links.container,children:ut("button",{type:"button",onClick:h,className:a.links.cancel,children:[ut(Ss,{},void 0,!1,void 0,this),"Go back"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return ut("form",{ref:i,onSubmit:g,className:w(a.form.container,a.form.spacing),noValidate:!0,children:[s.error&&ut("div",{className:a.error.container,children:ut("p",{className:a.error.text,children:s.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"Current Password",type:"password",value:s.currentPassword,onChange:(k)=>s.setCurrentPassword(k),placeholder:"Enter your current password",autoComplete:"current-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"New Password",type:"password",value:s.newPassword,onChange:(k)=>s.setNewPassword(k),placeholder:"Enter your new password",autoComplete:"new-password",isNewPassword:!0,showPasswordStrength:!0,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.input.wrapper,children:ut(Ee,{label:"Confirm New Password",type:"password",value:s.confirmPassword,onChange:(k)=>s.setConfirmPassword(k),placeholder:"Confirm your new password",autoComplete:"new-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ut("div",{className:a.button.wrapper,children:ut(se,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,loading:e.state.isPending,children:"Change Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),(n||r)&&ut("div",{className:a.links.container,children:ut("button",{type:"button",onClick:h,className:a.links.cancel,disabled:c,children:[ut(Ss,{},void 0,!1,void 0,this),"Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as rn}from"react/jsx-dev-runtime";function Di({logo:e,title:t,subtitle:r}){let n=tn;return rn("header",{className:n.header.container,children:[e?rn("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):rn("div",{className:n.header.iconWrapper,children:rn("svg",{className:"w-8 h-8 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rn("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),rn("h1",{className:w(n.header.title),children:t},void 0,!1,void 0,this),rn("p",{className:w(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ps}from"@gsap/react";import Ts from"gsap";import{useRef as Cs}from"react";import{jsxDEV as wn}from"react/jsx-dev-runtime";Ts.registerPlugin(Ps);function Ls({logo:e,title:t="Change Password",subtitle:r="Enter your current password and choose a new one.",changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o,showBackground:s=!0,className:l}){let c=tn,d=Cs(null),g=Cs(null);return Ps(()=>{if(!g.current)return;Ts.fromTo(g.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:d}),wn("main",{ref:d,className:w(c.container.base,l),"aria-label":"Change password page",children:[s&&wn(xt,{},void 0,!1,void 0,this),wn("div",{className:c.container.wrapper,children:wn("article",{ref:g,className:w(c.card.base,c.card.padding,c.card.background,c.card.border,c.card.shadow,c.card.rounded),children:[wn(Di,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),wn(Ei,{changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ws}from"@gsap/react";import ro from"gsap";import{useId as yu,useRef as to}from"react";var nn={container:{base:"flex flex-col",spacing:"gap-1",disabled:"pointer-events-none"},wrapper:{base:"inline-flex items-center cursor-pointer select-none",gap:{sm:"gap-2",md:"gap-2.5",lg:"gap-3"}},label:{base:"cursor-pointer",text:{size:{sm:"text-sm",md:"text-base",lg:"text-lg"},color:{light:"text-gray-700",dark:"dark:text-gray-200"}},disabled:"opacity-50 cursor-not-allowed"},checkbox:{base:"relative flex items-center justify-center overflow-hidden",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},border:{base:"border-2",width:"border-2",color:{light:"border-gray-300",dark:"dark:border-gray-600"},focused:"ring-2 ring-offset-2 ring-blue-500 dark:ring-offset-gray-900"},background:{unchecked:{light:"bg-white",dark:"dark:bg-gray-800"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},rounded:"rounded-md",shadow:"shadow-sm",transition:"transition-all duration-200",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},checkIcon:{base:"absolute",size:{sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},stroke:{width:"stroke-[3]",color:"stroke-white"}},indeterminateIcon:{base:"absolute",size:{sm:{width:"w-2",height:"h-0.5"},md:{width:"w-2.5",height:"h-0.5"},lg:{width:"w-3",height:"h-0.5"}},background:"bg-white",rounded:"rounded-full"},switch:{track:{base:"relative inline-flex items-center cursor-pointer",size:{sm:{width:"w-8",height:"h-4"},md:{width:"w-11",height:"h-6"},lg:{width:"w-14",height:"h-7"}},background:{unchecked:{light:"bg-gray-200",dark:"dark:bg-gray-700"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},border:{base:"border",color:{light:"border-gray-300",dark:"dark:border-gray-600"}},rounded:"rounded-full",shadow:"shadow-inner",transition:"transition-all duration-300 ease-out",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},thumb:{base:"absolute flex items-center justify-center bg-white rounded-full shadow-lg",size:{sm:"w-3 h-3",md:"w-5 h-5",lg:"w-6 h-6"},background:{light:"bg-white",dark:"bg-white"},shadow:"shadow-md",rounded:"rounded-full",transition:"transition-all duration-300 ease-out",position:{sm:{unchecked:"left-0.5",checked:"left-[calc(100%-14px)]"},md:{unchecked:"left-0.5",checked:"left-[calc(100%-22px)]"},lg:{unchecked:"left-0.5",checked:"left-[calc(100%-26px)]"}}},icon:{base:"absolute",size:{sm:"w-2 h-2",md:"w-3 h-3",lg:"w-3.5 h-3.5"},color:{unchecked:{light:"text-gray-400",dark:"text-gray-500"},checked:"text-current"}}},ripple:{base:"absolute inset-0 rounded-full opacity-0",size:"scale-0",color:{primary:"bg-blue-400/30",secondary:"bg-purple-400/30",success:"bg-emerald-400/30",warning:"bg-amber-400/30",danger:"bg-red-400/30",info:"bg-cyan-400/30"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}};function Bt(...e){return Rt(Mt(e))}import{useGSAP as Ms}from"@gsap/react";import Vi from"gsap";import{useRef as xa}from"react";import{jsxDEV as qn}from"react/jsx-dev-runtime";Vi.registerPlugin(Ms);function ji({checked:e,indeterminate:t=!1,size:r,color:n,disabled:a=!1}){let i=xa(null),o=xa(null),s=xa(null),l=xa(null),c=nn;return Ms(()=>{if(!i.current)return;let d=Vi.timeline();if(e&&!t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),o.current){let g=o.current.getTotalLength();Vi.set(o.current,{strokeDasharray:g,strokeDashoffset:g}),d.to(o.current,{strokeDashoffset:0,duration:0.3,ease:"power3.out"},"-=0.1")}if(l.current)d.fromTo(l.current,{scale:0,opacity:0.6},{scale:2.5,opacity:0,duration:0.5,ease:"power2.out"},"-=0.3")}else if(t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),s.current)d.fromTo(s.current,{scaleX:0,opacity:0},{scaleX:1,opacity:1,duration:0.25,ease:"back.out(2)"},"-=0.1")}else{if(o.current){let g=o.current.getTotalLength();d.to(o.current,{strokeDashoffset:g,duration:0.2,ease:"power2.in"})}if(s.current)d.to(s.current,{scaleX:0,opacity:0,duration:0.15,ease:"power2.in"},"<");d.to(i.current,{borderColor:"",duration:0.15,ease:"power2.out"},"-=0.1")}},[e,t]),qn("div",{ref:i,className:Bt(c.checkbox.base,c.checkbox.size[r],c.checkbox.border.base,c.checkbox.rounded,c.checkbox.shadow,c.checkbox.transition,!e&&!t&&c.checkbox.border.color.light,!e&&!t&&c.checkbox.border.color.dark,!e&&!t&&c.checkbox.background.unchecked.light,!e&&!t&&c.checkbox.background.unchecked.dark,(e||t)&&c.checkbox.background.checked[n],(e||t)&&"border-transparent",a&&c.checkbox.disabled.opacity,a&&c.checkbox.disabled.cursor),children:[qn("div",{ref:l,className:Bt(c.ripple.base,c.ripple.color[n])},void 0,!1,void 0,this),qn("svg",{viewBox:"0 0 24 24",fill:"none",className:Bt(c.checkIcon.base,c.checkIcon.size[r],"opacity-0",e&&!t&&"opacity-100"),"aria-hidden":"true",children:qn("path",{ref:o,d:"M4 12.5L9.5 18L20 6",strokeLinecap:"round",strokeLinejoin:"round",className:Bt(c.checkIcon.stroke.width,c.checkIcon.stroke.color),fill:"none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),qn("div",{ref:s,className:Bt(c.indeterminateIcon.base,c.indeterminateIcon.size[r].width,c.indeterminateIcon.size[r].height,c.indeterminateIcon.background,c.indeterminateIcon.rounded,"opacity-0 scale-x-0",t&&"opacity-100")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Rs}from"@gsap/react";import Bs from"gsap";import{useRef as Jn}from"react";import{jsxDEV as an}from"react/jsx-dev-runtime";Bs.registerPlugin(Rs);function eo({checked:e,size:t,color:r,disabled:n=!1}){let a=Jn(null),i=Jn(null),o=Jn(null),s=Jn(null),l=Jn(null),c=nn,d=(g)=>{return{sm:{unchecked:2,checked:18},md:{unchecked:2,checked:24},lg:{unchecked:2,checked:30}}[t][g?"checked":"unchecked"]};return Rs(()=>{if(!i.current||!a.current)return;let g=Bs.timeline();if(e){if(g.to(i.current,{x:d(!0),duration:0.35,ease:"elastic.out(1, 0.75)"}),g.to(i.current,{scale:1.1,duration:0.15,ease:"power2.out"},"<"),g.to(i.current,{scale:1,duration:0.2,ease:"power2.inOut"}),o.current)g.fromTo(o.current,{scale:0,rotate:-180,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.3,ease:"back.out(2)"},"-=0.4");if(s.current)g.to(s.current,{scale:0,rotate:90,opacity:0,duration:0.2,ease:"power2.in"},"<-0.2");if(l.current)g.fromTo(l.current,{opacity:0,scale:0.8},{opacity:0.6,scale:1,duration:0.3,ease:"power2.out"},"-=0.3").to(l.current,{opacity:0,duration:0.5,ease:"power2.inOut"})}else{if(g.to(i.current,{x:d(!1),duration:0.35,ease:"elastic.out(1, 0.75)"}),g.to(i.current,{scale:0.9,duration:0.1,ease:"power2.out"},"<"),g.to(i.current,{scale:1,duration:0.15,ease:"power2.inOut"}),s.current)g.fromTo(s.current,{scale:0,rotate:-90,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.25,ease:"back.out(1.5)"},"-=0.35");if(o.current)g.to(o.current,{scale:0,rotate:180,opacity:0,duration:0.2,ease:"power2.in"},"<-0.15")}},[e,t]),an("div",{ref:a,className:Bt(c.switch.track.base,c.switch.track.size[t].width,c.switch.track.size[t].height,c.switch.track.rounded,c.switch.track.shadow,c.switch.track.transition,!e&&c.switch.track.background.unchecked.light,!e&&c.switch.track.background.unchecked.dark,e&&c.switch.track.background.checked[r],n&&c.switch.track.disabled.opacity,n&&c.switch.track.disabled.cursor),children:[an("div",{ref:l,className:Bt("absolute inset-0 rounded-full blur-md opacity-0",e&&c.switch.track.background.checked[r])},void 0,!1,void 0,this),an("div",{ref:i,className:Bt(c.switch.thumb.base,c.switch.thumb.size[t],c.switch.thumb.background.light,c.switch.thumb.shadow,c.switch.thumb.rounded,"transform-gpu"),style:{x:d(e)},children:[an("svg",{ref:o,viewBox:"0 0 24 24",fill:"none",className:Bt(c.switch.icon.base,c.switch.icon.size[t],"text-emerald-500","opacity-0"),"aria-hidden":"true",children:an("path",{d:"M5 13l4 4L19 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this),an("svg",{ref:s,viewBox:"0 0 24 24",fill:"none",className:Bt(c.switch.icon.base,c.switch.icon.size[t],c.switch.icon.color.unchecked.light,"opacity-100"),"aria-hidden":"true",children:an("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Rr}from"react/jsx-dev-runtime";ro.registerPlugin(Ws);function hr({checked:e,onChange:t,variant:r="checkbox",size:n="md",color:a="primary",label:i,labelPosition:o="right",disabled:s=!1,indeterminate:l=!1,name:c,value:d,id:g,required:h=!1,errorMessage:k,helperText:u,className:S,labelClassName:f,ariaLabel:P,ariaDescribedBy:x}){let z=to(null),m=to(null),y=to(null),v=yu(),p=g||v,b=nn,{contextSafe:R}=Ws({scope:z}),$=R(()=>{if(s)return;if(y.current)ro.to(y.current,{scale:0.97,duration:0.1,ease:"power2.out",onComplete:()=>{ro.to(y.current,{scale:1,duration:0.15,ease:"elastic.out(1, 0.5)"})}});t(!e)}),J=(K)=>{if(K.key===" "||K.key==="Enter")K.preventDefault(),$()},U=()=>{if(r==="switch")return Rr(eo,{checked:e,size:n,color:a,disabled:s},void 0,!1,void 0,this);return Rr(ji,{checked:e,indeterminate:l,size:n,color:a,disabled:s},void 0,!1,void 0,this)},E=()=>{if(!i)return null;return Rr("span",{className:Bt(b.label.base,b.label.text.size[n],b.label.text.color.light,b.label.text.color.dark,s&&b.label.disabled,f),children:[i,h&&Rr("span",{className:"text-red-500 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Rr("div",{ref:z,className:Bt(b.container.base,b.container.spacing,s&&b.container.disabled,S),children:[Rr("label",{ref:y,htmlFor:p,className:Bt(b.wrapper.base,b.wrapper.gap[n],s&&"cursor-not-allowed",o==="left"&&"flex-row-reverse"),onKeyDown:J,children:[Rr("input",{ref:m,type:"checkbox",id:p,name:c,value:d,checked:e,disabled:s,required:h,onChange:$,className:"sr-only","aria-label":P||(typeof i==="string"?i:void 0),"aria-describedby":x,"aria-checked":l?"mixed":e,"aria-invalid":!!k},void 0,!1,void 0,this),U(),E()]},void 0,!0,void 0,this),k&&Rr("span",{className:Bt(b.errorText.base,b.errorText.text,b.errorText.color),children:k},void 0,!1,void 0,this),u&&!k&&Rr("span",{className:Bt(b.helperText.base,b.helperText.text,b.helperText.color.light,b.helperText.color.dark),children:u},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ud}from"@gsap/react";import gd from"gsap";import{useRef as po}from"react";var Re={container:{base:"w-full overflow-hidden",border:"border border-gray-200 dark:border-gray-700",rounded:"rounded-lg",shadow:"shadow-sm"},scrollContainer:{base:"overflow-y-auto overflow-x-hidden",maxHeight:"max-h-[70vh]",scrollbar:"scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-transparent"},table:{base:"w-full border-collapse table-fixed",layout:""},header:{wrapper:{base:"sticky top-0 z-10",background:"bg-gray-50 dark:bg-gray-800"},row:{base:"",border:"border-b border-gray-200 dark:border-gray-700"},cell:{base:"relative select-none bg-gray-50 dark:bg-gray-800",padding:"px-4 py-3",text:"text-left text-xs font-semibold uppercase tracking-wider",color:"text-gray-600 dark:text-gray-300",transition:"transition-colors duration-200",hover:"hover:bg-gray-100 dark:hover:bg-gray-750",sortable:"cursor-pointer",sorted:"bg-gray-100 dark:bg-gray-750"},sortIcon:{base:"inline-flex ml-1.5 transition-transform duration-300",active:"text-primary-500 dark:text-primary-400",inactive:"text-gray-400 dark:text-gray-500"},resizeHandle:{base:"absolute right-0 top-0 h-full w-1 cursor-col-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:right-[-4px] before:top-0 before:h-full before:w-[9px] before:content-[""]'}},body:{wrapper:{base:""},row:{base:"group",border:"border-b border-gray-100 dark:border-gray-700/50",transition:"transition-colors duration-150",hover:"hover:bg-gray-50 dark:hover:bg-gray-800/50",zebra:{even:"bg-white dark:bg-gray-900",odd:"bg-gray-50/50 dark:bg-gray-800/30"}},cell:{base:"relative",padding:"px-4 py-3",text:"text-sm",color:"text-gray-900 dark:text-gray-100",truncate:"truncate",transition:"transition-all duration-150",hover:"group-hover:bg-gray-50/50 dark:group-hover:bg-gray-800/30"},resizeHandle:{base:"absolute bottom-0 left-0 w-full h-1 cursor-row-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:bottom-[-4px] before:left-0 before:w-full before:h-[9px] before:content-[""]'}},loading:{wrapper:"flex items-center justify-center py-8",spinner:{base:"animate-spin rounded-full border-2",size:"h-8 w-8",color:"border-primary-500 border-t-transparent"},text:"ml-3 text-sm text-gray-500 dark:text-gray-400"},empty:{wrapper:"flex flex-col items-center justify-center py-12",icon:"h-12 w-12 text-gray-300 dark:text-gray-600 mb-4",text:"text-sm text-gray-500 dark:text-gray-400"},infiniteScroll:{trigger:"h-1 w-full",loader:"flex items-center justify-center py-4"},animation:{row:{enter:{opacity:0,y:10},visible:{opacity:1,y:0},duration:0.3,stagger:0.02},cell:{hover:{scale:1.01},duration:0.15},sort:{duration:0.3,ease:"power2.out"},resize:{duration:0.1,ease:"power1.out"}}};function ke(...e){return Rt(Mt(e))}import{jsxDEV as za}from"react/jsx-dev-runtime";function Is({message:e="No data available",className:t}){let r=Re.empty;return za("div",{className:ke(r.wrapper,t),children:[za("svg",{className:r.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:za("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),za("p",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as Hs,useRef as ao}from"react";import{jsxDEV as no}from"react/jsx-dev-runtime";function Na({text:e="Loading...",className:t}){let r=Re.loading;return no("div",{className:ke(r.wrapper,t),children:[no("div",{className:ke(r.spinner.base,r.spinner.size,r.spinner.color)},void 0,!1,void 0,this),e&&no("span",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as io}from"react/jsx-dev-runtime";function $s({isLoading:e,hasMoreData:t,onTrigger:r,scrollContainerRef:n,autoFetchUntilScroll:a=!1,className:i}){let o=ao(null),s=ao(null),l=ao(!1),c=()=>{if(!a||!n.current||e||!t)return;let h=n.current;if(!(h.scrollHeight>h.clientHeight))r()};Hs(()=>{if(!a||!t)return;let h=setTimeout(()=>{c()},100);return()=>clearTimeout(h)},[a,t,e]),Hs(()=>{l.current=!1},[]);let d=(h)=>{if(s.current)s.current.disconnect();if(!h||!t)return;s.current=new IntersectionObserver((k)=>{if(k[0]?.isIntersecting&&!e&&t)r()},{threshold:0.1,rootMargin:"100px"}),s.current.observe(h)},g=Re.infiniteScroll;if(!t&&!e)return null;return io("div",{ref:(h)=>{o.current=h,d(h)},className:ke(g.trigger,i),children:e&&io("div",{className:g.loader,children:io(Na,{text:"Loading more..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Gs}from"@gsap/react";import As from"gsap";import{useRef as Ys}from"react";import{useGSAP as _s}from"@gsap/react";import Fs from"gsap";import{useRef as Os}from"react";import{jsxDEV as Sa}from"react/jsx-dev-runtime";function qs({columnCount:e,rowIndex:t,columnWidths:r,hasActionColumn:n}){let a=Os(null),i=Re;_s(()=>{if(!a.current)return;Fs.fromTo(a.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,delay:t*0.05,ease:"power2.out"})},[t]);let o=n?e+1:e;return Sa("tr",{ref:a,className:ke(i.body.row.base,i.body.row.transition,t%2===0?i.body.row.zebra.even:i.body.row.zebra.odd),children:Array.from({length:o}).map((s,l)=>Sa("td",{style:{width:r[l]??150},className:ke(i.body.cell.base,i.body.cell.padding),children:Sa(wu,{},void 0,!1,void 0,this)},l,!1,void 0,this))},void 0,!1,void 0,this)}function wu(){let e=Os(null);return _s(()=>{if(!e.current)return;Fs.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),Sa("div",{ref:e,className:"h-4 w-3/4 rounded bg-gradient-to-r from-gray-200 via-gray-300 to-gray-200 bg-[length:200%_100%] dark:from-zinc-700 dark:via-zinc-600 dark:to-zinc-700"},void 0,!1,void 0,this)}import{jsxDEV as wr}from"react/jsx-dev-runtime";function Ks({columns:e,actionColumns:t,rowCount:r=5,defaultColumnWidth:n=150}){let a=Ys(null),i=Re;Gs(()=>{if(!a.current)return;As.fromTo(a.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"})},[]);let o=e.map((s)=>s.width??n);if(t?.length)t.forEach((s)=>{o.push(s.width??n)});return wr("table",{ref:a,className:ke(i.table.base,i.table.layout),children:[wr("thead",{className:i.header.wrapper.base,children:wr("tr",{className:i.header.row.base,children:[e.map((s,l)=>wr("th",{style:{width:o[l]},className:ke(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:wr(Js,{},void 0,!1,void 0,this)},String(s.key),!1,void 0,this)),t?.map((s)=>wr("th",{style:{width:s.width??n},className:ke(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:wr(Js,{},void 0,!1,void 0,this)},s.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),wr("tbody",{className:i.body.wrapper.base,children:Array.from({length:r}).map((s,l)=>wr(qs,{columnCount:e.length,rowIndex:l,columnWidths:o,hasActionColumn:Boolean(t?.length)},l,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Js(){let e=Ys(null);return Gs(()=>{if(!e.current)return;As.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),wr("div",{ref:e,className:"h-4 w-1/2 rounded bg-gradient-to-r from-gray-300 via-gray-400 to-gray-300 bg-[length:200%_100%] dark:from-zinc-600 dark:via-zinc-500 dark:to-zinc-600"},void 0,!1,void 0,this)}import{useRef as Vs}from"react";import{useGSAP as Zs}from"@gsap/react";import oo from"gsap";import{useRef as ku}from"react";import{jsxDEV as vu}from"react/jsx-dev-runtime";oo.registerPlugin(Zs);function Qs({type:e,isActive:t,onResizeStart:r,className:n}){let a=ku(null);Zs(()=>{if(!a.current)return;if(t)oo.to(a.current,{scaleY:e==="column"?1.1:1,scaleX:e==="row"?1.1:1,duration:Re.animation.resize.duration,ease:Re.animation.resize.ease});else oo.to(a.current,{scaleY:1,scaleX:1,duration:Re.animation.resize.duration,ease:Re.animation.resize.ease})},[t,e]);let i=e==="column"?Re.header.resizeHandle:Re.body.resizeHandle;return vu("button",{ref:a,type:"button","aria-label":`Resize ${e}`,className:ke(i.base,t?i.active:i.idle,i.hitArea,"appearance-none border-none bg-transparent p-0",n),onMouseDown:r,onTouchStart:r},void 0,!1,void 0,this)}import{useGSAP as Us}from"@gsap/react";import Es from"gsap";import{useRef as xu}from"react";import{jsxDEV as Xs}from"react/jsx-dev-runtime";Es.registerPlugin(Us);function Ds({direction:e,isActive:t,className:r}){let n=xu(null);Us(()=>{if(!n.current)return;let i=t&&e==="desc"?180:0;Es.to(n.current,{rotation:i,opacity:t?1:0.4,duration:Re.animation.sort.duration,ease:Re.animation.sort.ease})},[e,t]);let a=Re.header.sortIcon;return Xs("svg",{ref:n,className:ke(a.base,t?a.active:a.inactive,r),width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:Xs("path",{d:"M6 2L10 7H2L6 2Z",fill:"currentColor"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Gn}from"react/jsx-dev-runtime";function js({column:e,width:t,sortDirection:r,isResizing:n,isSorted:a,onSort:i,onResizeStart:o,onDoubleClick:s,headerMiddleware:l}){let c=Vs(null),d=Vs(null),g=Re.header.cell,h=()=>{if(e.sortable&&i)i()},k=()=>{if(e.headerRenderer)return e.headerRenderer(e);if(l){let u=l(e,e.key);if(u!==void 0)return u}return e.header};return Gn("th",{ref:c,scope:"col","data-column-key":String(e.key),style:{width:`${t}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.base,g.padding,g.text,g.color,g.transition,g.hover,e.sortable&&g.sortable,a&&g.sorted,e.headerClassName),onClick:h,onDoubleClick:s,"aria-sort":a?r==="asc"?"ascending":"descending":void 0,children:[Gn("div",{ref:d,className:"flex items-center",children:[Gn("span",{className:"truncate",children:k()},void 0,!1,void 0,this),e.sortable&&Gn(Ds,{direction:r,isActive:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.resizable!==!1&&Gn(Qs,{type:"column",isActive:n,onResizeStart:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Su}from"@gsap/react";import An from"gsap";import{useRef as lo}from"react";import{batch as Ca,createStore as zu}from"h-state";var Nu={sortColumnKey:null,sortDirection:null,columnWidths:{},rowHeights:{},resizingColumn:null,resizingRow:null,hoveredRow:null,hoveredCell:null,editingCell:null,editValue:"",isLoadingMore:!1,selectedRows:[]},{useStore:Br}=zu(Nu,{setSortState:(e)=>(t,r)=>{Ca(()=>{e.sortColumnKey=t,e.sortDirection=r})},setColumnWidth:(e)=>(t,r)=>{e.columnWidths[t]=r},setRowHeight:(e)=>(t,r)=>{e.rowHeights[t]=r},setResizingColumn:(e)=>(t)=>{e.resizingColumn=t},setResizingRow:(e)=>(t)=>{e.resizingRow=t},setHoveredRow:(e)=>(t)=>{e.hoveredRow=t},setHoveredCell:(e)=>(t)=>{e.hoveredCell=t},setEditingCell:(e)=>(t)=>{e.editingCell=t},setEditValue:(e)=>(t)=>{e.editValue=t},startEditing:(e)=>(t,r,n)=>{Ca(()=>{e.editingCell={row:t,column:r},e.editValue=n})},cancelEditing:(e)=>()=>{Ca(()=>{e.editingCell=null,e.editValue=""})},setIsLoadingMore:(e)=>(t)=>{e.isLoadingMore=t},resetWidths:(e)=>()=>{Ca(()=>{e.columnWidths={},e.rowHeights={}})},autoFitColumn:(e)=>(t,r)=>{e.columnWidths[t]=Math.max(r+32,60)},toggleRowSelection:(e)=>(t)=>{if(e.selectedRows.indexOf(t)===-1)e.selectedRows=[...e.selectedRows,t];else e.selectedRows=e.selectedRows.filter((n)=>n!==t)},selectAllRows:(e)=>(t)=>{e.selectedRows=Array.from({length:t},(r,n)=>n)},clearSelection:(e)=>()=>{e.selectedRows=[]},isRowSelected:(e)=>(t)=>{return e.selectedRows.includes(t)}});import{jsxDEV as on}from"react/jsx-dev-runtime";function Pa({rowIndex:e,isHovered:t,isHeader:r=!1,totalRows:n=0}){let a=lo(null),i=lo(null),o=lo(null),s=Br(),l=Re,c=r?!1:s.selectedRows.includes(e),d=r&&n>0&&s.selectedRows.length===n,g=r&&s.selectedRows.length>0&&s.selectedRows.length<n;Su(()=>{if(!i.current||!o.current)return;if(An.killTweensOf([i.current,o.current]),t||c)An.set(i.current,{opacity:0,display:"none"}),An.set(o.current,{opacity:1,display:"flex"});else An.set(i.current,{opacity:1,display:"flex"}),An.set(o.current,{opacity:0,display:"none"})},[t,c]);let h=(k)=>{if(k.stopPropagation(),r)if(d||g)s.clearSelection();else s.selectAllRows(n);else s.toggleRowSelection(e)};if(r)return on("th",{ref:a,scope:"col",className:ke(l.header.cell.base,l.header.cell.padding,l.header.cell.text,l.header.cell.color,"w-12 text-center"),children:on("div",{className:"flex items-center justify-center",children:on("input",{type:"checkbox",checked:d,ref:o,onChange:()=>{},onClick:h,className:ke("h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{opacity:g?0.5:1}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return on("td",{ref:a,className:ke(l.body.cell.base,l.body.cell.padding,l.body.cell.text,l.body.cell.color,"w-12 text-center"),children:on("div",{className:"flex items-center justify-center relative",children:[on("span",{ref:i,className:"text-gray-400 dark:text-gray-500 text-xs font-medium",children:e+1},void 0,!1,void 0,this),on("input",{ref:o,type:"checkbox",checked:c,onChange:()=>{},onClick:h,className:ke("absolute h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{display:"none"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Yn}from"react/jsx-dev-runtime";function ed({columns:e,actionColumns:t,columnWidths:r,sortColumnKey:n,sortDirection:a,resizingColumn:i,defaultColumnWidth:o,onSort:s,onResizeStart:l,onColumnDoubleClick:c,headerMiddleware:d,enableSelection:g,totalRows:h=0}){let k=Re.header,u=(S,f)=>{return r[S]??f??o};return Yn("thead",{className:ke(k.wrapper.base,k.wrapper.background),children:Yn("tr",{className:ke(k.row.base,k.row.border),children:[g&&Yn(Pa,{rowIndex:-1,isHovered:!1,isHeader:!0,totalRows:h},void 0,!1,void 0,this),e.map((S)=>{let f=String(S.key);return Yn(js,{column:S,width:u(f,S.width),sortDirection:n===S.key?a:null,isResizing:i===f,isSorted:n===S.key,onSort:()=>s(S.key),onResizeStart:(P)=>l(f,P),onDoubleClick:()=>c(f),headerMiddleware:d},f,!1,void 0,this)}),t?.map((S)=>Yn("th",{scope:"col",style:{width:`${u(S.key,S.width)}px`,minWidth:S.minWidth},className:ke(k.cell.base,k.cell.padding,k.cell.text,k.cell.color,S.headerClassName),children:S.header},S.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as ld}from"@gsap/react";import sd from"gsap";import{useRef as od}from"react";import{useRef as Cu}from"react";import{jsxDEV as Pu}from"react/jsx-dev-runtime";function td({column:e,row:t,rowIndex:r,width:n}){let a=Cu(null),i=Re.body.cell,o={row:t,rowIndex:r,columnKey:e.key},s=()=>{return e.renderer(o)};return Pu("td",{ref:a,style:{width:`${n}px`,minWidth:e.minWidth},className:ke(i.base,i.padding,i.text,i.color,i.transition,e.cellClassName),children:s()},void 0,!1,void 0,this)}import{useGSAP as rd}from"@gsap/react";import so from"gsap";import{useRef as Tu}from"react";import{jsxDEV as Lu}from"react/jsx-dev-runtime";so.registerPlugin(rd);function nd({column:e,row:t,rowIndex:r,width:n,isHovered:a,hasClickAction:i,hasDoubleClickAction:o,onClick:s,onDoubleClick:l,cellMiddleware:c}){let d=Tu(null),g=Re.body.cell,{contextSafe:h}=rd({scope:d}),k=h(()=>{if(!d.current||!a)return;so.to(d.current,{scale:Re.animation.cell.hover.scale,duration:Re.animation.cell.duration})}),u=h(()=>{if(!d.current)return;so.to(d.current,{scale:1,duration:Re.animation.cell.duration})}),S=()=>{let P=e.key;return t[P]},f=()=>{let P=S(),x={value:P,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(x);if(c){let z=c(x);if(z!==void 0)return z}if(P===null||P===void 0)return"";return String(P)};return Lu("td",{ref:d,"data-column-key":String(e.key),style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.base,g.padding,g.text,g.color,g.truncate,g.transition,(i||o)&&"cursor-pointer",e.cellClassName),onClick:i?s:void 0,onDoubleClick:o?l:void 0,onKeyDown:i||o?(P)=>{if(P.key==="Enter"&&i&&s)s()}:void 0,onMouseEnter:k,onMouseLeave:u,children:f()},void 0,!1,void 0,this)}import{useGSAP as ad}from"@gsap/react";import Ta from"gsap";import{useRef as co}from"react";import{jsxDEV as Yt}from"react/jsx-dev-runtime";function id({column:e,row:t,rowIndex:r,width:n,isHovered:a,onSave:i,cellMiddleware:o}){let s=co(null),l=co(null),c=co(null),d=Br(),g=Re,h=String(e.key),k=d.editingCell?.row===r&&d.editingCell?.column===h,u=e.editConfig??{type:"text",showIconOnHover:!0},f=(()=>{let b=e.key;return t[b]})(),P=f===null||f===void 0?"":String(f);ad(()=>{if(!c.current)return;if(Ta.killTweensOf(c.current),a&&!k&&u.showIconOnHover!==!1)Ta.to(c.current,{opacity:1,scale:1,duration:0.15,ease:"power2.out",overwrite:!0});else Ta.set(c.current,{opacity:0,scale:0.8})},[a,k,u.showIconOnHover]),ad(()=>{if(k&&l.current)Ta.fromTo(l.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.2,ease:"power2.out"}),l.current.focus(),l.current.select()},[k]);let x=()=>{d.startEditing(r,h,P)},z=()=>{i(d.editValue),d.cancelEditing()},m=()=>{d.cancelEditing()},y=(b)=>{if(b.key==="Enter"&&!b.shiftKey)b.preventDefault(),z();else if(b.key==="Escape")m()},v=()=>{let b={value:f,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(b);if(o){let R=o(b);if(R!==void 0)return R}return P},p=()=>{let b=u.type??"text";if(b==="textarea")return Yt("textarea",{ref:l,value:d.editValue,onChange:(R)=>d.setEditValue(R.target.value),onKeyDown:y,placeholder:u.placeholder,maxLength:u.maxLength,className:ke("w-full resize-none rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),rows:2},void 0,!1,void 0,this);if(b==="select"&&u.selectOptions)return Yt("select",{value:d.editValue,onChange:(R)=>d.setEditValue(R.target.value),onKeyDown:y,className:ke("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),children:u.selectOptions.map((R)=>Yt("option",{value:R.value,children:R.label},R.value,!1,void 0,this))},void 0,!1,void 0,this);return Yt("input",{ref:l,type:b==="number"?"number":"text",value:d.editValue,onChange:(R)=>d.setEditValue(R.target.value),onKeyDown:y,placeholder:u.placeholder,maxLength:u.maxLength,className:ke("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white")},void 0,!1,void 0,this)};if(k)return Yt("td",{ref:s,"data-column-key":h,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.body.cell.base,"p-1",e.cellClassName),children:Yt("div",{className:"flex flex-col gap-1",children:[p(),Yt("div",{className:"flex justify-end gap-1",children:[Yt("button",{type:"button",onClick:z,className:ke("rounded bg-green-500 px-2 py-0.5 text-xs text-white","hover:bg-green-600 transition-colors"),children:"Save"},void 0,!1,void 0,this),Yt("button",{type:"button",onClick:m,className:ke("rounded bg-gray-400 px-2 py-0.5 text-xs text-white","hover:bg-gray-500 transition-colors dark:bg-zinc-600 dark:hover:bg-zinc-500"),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Yt("td",{ref:s,"data-column-key":h,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ke(g.body.cell.base,g.body.cell.padding,g.body.cell.text,g.body.cell.color,g.body.cell.truncate,g.body.cell.transition,"group relative",e.cellClassName),children:Yt("div",{className:"flex items-center gap-2",children:[Yt("span",{className:"flex-1 truncate",children:v()},void 0,!1,void 0,this),e.editable&&Yt("button",{ref:c,type:"button",onClick:x,"aria-label":"Edit cell",className:ke("flex-shrink-0 rounded p-1 opacity-0","text-gray-500 hover:bg-gray-200 hover:text-gray-700","dark:text-gray-400 dark:hover:bg-zinc-700 dark:hover:text-gray-200","transition-colors"),children:Yt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[Yt("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"},void 0,!1,void 0,this),Yt("path",{d:"m15 5 4 4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Kn}from"react/jsx-dev-runtime";sd.registerPlugin(ld);function dd({row:e,rowIndex:t,columns:r,actionColumns:n,defaultColumnWidth:a,hasClickAction:i,hasDoubleClickAction:o,onCellClick:s,onCellDoubleClick:l,onCellEdit:c,cellMiddleware:d,animationDelay:g=0,enableSelection:h}){let k=od(null),u=Br(),S=Re.body.row,f=Re.animation.row,P=u.hoveredRow===t,x=u.columnWidths,z=od(!1);ld(()=>{if(!k.current||z.current)return;sd.fromTo(k.current,{opacity:f.enter.opacity,y:f.enter.y},{opacity:f.visible.opacity,y:f.visible.y,duration:f.duration,delay:g,ease:"power2.out"}),z.current=!0},[]);let m=(b,R)=>{return x[b]??R??a},y=t%2===0,v=(b,R)=>{if(!s)return;let $=R?null:e[b];s({value:$,row:e,rowIndex:t,columnKey:b,isActionColumn:R})},p=(b,R)=>{if(!l)return;let $=R?null:e[b];l({value:$,row:e,rowIndex:t,columnKey:b,isActionColumn:R})};return Kn("tr",{ref:k,className:ke(S.base,S.border,S.transition,S.hover,y?S.zebra.even:S.zebra.odd),onMouseEnter:()=>u.setHoveredRow(t),onMouseLeave:()=>u.setHoveredRow(null),children:[h&&Kn(Pa,{rowIndex:t,isHovered:P},void 0,!1,void 0,this),r.map((b)=>{let R=String(b.key),$=m(R,b.width);if(b.editable)return Kn(id,{column:b,row:e,rowIndex:t,width:$,isHovered:P,onSave:(J)=>{if(c){let U=e[b.key];c({row:e,rowIndex:t,columnKey:b.key,oldValue:U,newValue:J})}},cellMiddleware:d},R,!1,void 0,this);return Kn(nd,{column:b,row:e,rowIndex:t,width:$,isHovered:P,hasClickAction:i,hasDoubleClickAction:o,onClick:()=>v(b.key,!1),onDoubleClick:()=>p(b.key,!1),cellMiddleware:d},R,!1,void 0,this)}),n?.map((b)=>Kn(td,{column:b,row:e,rowIndex:t,width:m(b.key,b.width)},b.key,!1,void 0,this))]},void 0,!0,void 0,this)}function cd({onAutoFit:e}){return{autoFit:(r,n)=>{if(!n)return;let a=n.querySelectorAll(`td[data-column="${r}"], th[data-column="${r}"]`),i=0;if(a.forEach((o)=>{let s=o.firstElementChild;if(s){let l=s.scrollWidth;i=Math.max(i,l)}else i=Math.max(i,o.scrollWidth)}),i>0)e(r,i)}}}import{useRef as Zn}from"react";function pd({minWidth:e,tableRef:t,onResizeStart:r,onResizeEnd:n}){let a=Zn(0),i=Zn(0),o=Zn(""),s=Zn(0),l=Zn(!1),c=(m)=>{if(!t.current)return null;return t.current.querySelector(`th[data-column-key="${m}"]`)},d=(m)=>{if(!t.current)return[];let y=c(m),v=t.current.querySelectorAll(`td[data-column-key="${m}"]`),p=[];if(y)p.push(y);for(let b of Array.from(v))p.push(b);return p},g=(m)=>{if(!t.current)return;let y=Array.from(t.current.querySelectorAll("th[data-column-key]")),v=y.length-1;for(let p=0;p<y.length;p++){let b=y[p];if(!b)continue;let R=b.getAttribute("data-column-key");if(!R)continue;let $=p===v,J=b.offsetWidth,U=d(R);for(let E of U)if(m&&$)E.style.width="";else E.style.width=`${J}px`,E.style.minWidth=`${J}px`,E.style.maxWidth=`${J}px`}},h=(m)=>{let y=d(o.current);for(let v of y)v.style.width=`${m}px`,v.style.minWidth=`${m}px`,v.style.maxWidth=`${m}px`;s.current=m},k=(m)=>{m.preventDefault();let y=m.clientX-a.current,v=Math.max(e,i.current+y);h(v)},u=(m)=>{m.preventDefault();let y=m.touches[0];if(!y)return;let v=y.clientX-a.current,p=Math.max(e,i.current+v);h(p)},S=()=>{document.body.style.cursor="",document.body.style.userSelect="",l.current=!0,setTimeout(()=>{l.current=!1},100)},f=()=>l.current,P=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",P),S(),n(o.current,s.current)},x=()=>{document.removeEventListener("touchmove",u),document.removeEventListener("touchend",x),S(),n(o.current,s.current)};return{startResize:(m,y)=>{y.preventDefault(),y.stopPropagation();let v=c(m);if(!v)return;let p=v.offsetWidth;if(o.current=m,i.current=p,s.current=p,g(!0),r(m),document.body.style.cursor="col-resize",document.body.style.userSelect="none","touches"in y){let b=y.touches[0];if(!b)return;a.current=b.clientX,document.addEventListener("touchmove",u,{passive:!1}),document.addEventListener("touchend",x)}else a.current=y.clientX,document.addEventListener("mousemove",k),document.addEventListener("mouseup",P)},isJustResized:f}}import{jsxDEV as Ot}from"react/jsx-dev-runtime";gd.registerPlugin(ud);var Mu={hasClickAction:!1,hasDoubleClickAction:!1,isFrontendSort:!0,enableInfiniteScroll:!1,infiniteScrollThreshold:100,pageSize:20,autoFetchUntilScroll:!0,defaultColumnWidth:150,defaultRowHeight:48,minColumnWidth:60,minRowHeight:32,enableSelection:!1,selectionColumnWidth:48};function kn({data:e,columns:t,actionColumns:r,keyExtractor:n,callbacks:a,config:i,className:o,headerMiddleware:s,cellMiddleware:l,isLoading:c,isPending:d,skeletonRowCount:g=5,emptyMessage:h,selectionToolbar:k,isLoadingMore:u=!1,hasMoreData:S=!1}){let f={...Mu,...i},P=po(null),x=po(null),z=Br(),m=Re,{startResize:y,isJustResized:v}=pd({minWidth:f.minColumnWidth,tableRef:P,onResizeStart:(N)=>{z.setResizingColumn(N)},onResizeEnd:(N,O)=>{z.setResizingColumn(null),z.setColumnWidth(N,O),a?.onColumnResize?.(N,O)}}),{autoFit:p}=cd({onAutoFit:(N,O)=>{z.autoFitColumn(N,O)}}),b=po(!1);ud(()=>{if(!P.current||b.current)return;gd.fromTo(P.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"}),b.current=!0},[]);let R=(N)=>{if(v())return;if(!t.find((D)=>D.key===N)?.sortable)return;let A="asc";if(z.sortColumnKey===N){if(z.sortDirection==="asc")A="desc";else if(z.sortDirection==="desc")A=null}if(z.setSortState(String(N),A),!f.isFrontendSort)a?.onSort?.(N,A)},$=(N,O)=>{y(N,O)},J=(N)=>{p(N,P.current)},U=()=>{if(u)return;a?.onLoadMore?.()},K=(()=>{if(!f.isFrontendSort||!z.sortColumnKey||!z.sortDirection)return e;let{sortColumnKey:N,sortDirection:O}=z;return[...e].sort((A,D)=>{let I=A[N],_=D[N];if(I===_)return 0;if(I===null||I===void 0)return 1;if(_===null||_===void 0)return-1;let T=I<_?-1:1;return O==="asc"?T:-T})})(),M=z.selectedRows.map((N)=>K[N]).filter((N)=>N!==void 0),Q=z.selectedRows.length>0;if(c)return Ot("div",{className:ke(m.container.base,m.container.border,m.container.rounded,o),children:Ot(Na,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return Ot("div",{className:ke(m.container.base,m.container.border,m.container.rounded,m.container.shadow,o),children:Ot("div",{className:ke(m.scrollContainer.base,m.scrollContainer.maxHeight,m.scrollContainer.scrollbar),children:Ot(Ks,{columns:t,actionColumns:r,rowCount:g,defaultColumnWidth:f.defaultColumnWidth},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return Ot("div",{className:ke(m.container.base,m.container.border,m.container.rounded,o),children:Ot(Is,{message:h},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Ot("div",{className:ke(m.container.base,m.container.border,m.container.rounded,m.container.shadow,o),children:[f.enableSelection&&Q&&k&&Ot("div",{className:"flex items-center justify-between border-b border-gray-200 bg-blue-50 px-4 py-2 dark:border-gray-700 dark:bg-blue-900/20",children:[Ot("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[z.selectedRows.length," item selected"]},void 0,!0,void 0,this),Ot("div",{className:"flex items-center gap-2",children:k({selectedRows:z.selectedRows,selectedData:M,totalCount:K.length,onClearSelection:z.clearSelection})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ot("div",{ref:x,className:ke(m.scrollContainer.base,m.scrollContainer.maxHeight,m.scrollContainer.scrollbar),children:[Ot("table",{ref:P,className:ke(m.table.base,m.table.layout),children:[Ot(ed,{columns:t,actionColumns:r,columnWidths:z.columnWidths,sortColumnKey:z.sortColumnKey,sortDirection:z.sortDirection,resizingColumn:z.resizingColumn,defaultColumnWidth:f.defaultColumnWidth,onSort:R,onResizeStart:$,onColumnDoubleClick:J,headerMiddleware:s,enableSelection:f.enableSelection,totalRows:K.length},void 0,!1,void 0,this),Ot("tbody",{className:m.body.wrapper.base,children:K.map((N,O)=>Ot(dd,{row:N,rowIndex:O,columns:t,actionColumns:r,defaultColumnWidth:f.defaultColumnWidth,hasClickAction:f.hasClickAction,hasDoubleClickAction:f.hasDoubleClickAction,onCellClick:a?.onCellClick,onCellDoubleClick:a?.onCellDoubleClick,onCellEdit:a?.onCellEdit,cellMiddleware:l,animationDelay:O*m.animation.row.stagger,enableSelection:f.enableSelection},n(N,O),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f.enableInfiniteScroll&&Ot($s,{isLoading:u,hasMoreData:S,onTrigger:U,scrollContainerRef:x,autoFetchUntilScroll:f.autoFetchUntilScroll},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as fd}from"@gsap/react";import hd from"gsap";import{useRef as Ru}from"react";var Wr={container:{base:"relative flex flex-col w-full",spacing:"gap-1"},input:{wrapper:{base:"relative flex items-center w-full cursor-pointer",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 cursor-not-allowed"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:"px-4 py-3",rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},text:{base:"flex-1",size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"},placeholder:{light:"text-gray-400",dark:"dark:text-gray-500"}},icon:{base:"flex items-center justify-center flex-shrink-0",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},dropdown:{base:"absolute left-0 right-0 z-50",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-xl",shadow:"shadow-xl",padding:"p-4",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},calendar:{base:"select-none",width:"w-72"},header:{base:"flex items-center justify-between",padding:"mb-4",button:{base:"flex items-center justify-center",size:"w-8 h-8",color:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",transition:"transition-colors duration-150"},title:{base:"flex items-center justify-center cursor-pointer",text:{size:"text-base",weight:"font-semibold",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",padding:"px-3 py-1.5",transition:"transition-colors duration-150"}},weekdays:{base:"grid grid-cols-7",padding:"mb-2",text:{size:"text-xs",weight:"font-medium",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}},grid:{base:"grid grid-cols-7",gap:""},dayWrapper:{base:"flex items-center justify-center",inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:"rounded-l-lg",rangeEnd:"rounded-r-lg"},day:{base:"flex items-center justify-center cursor-pointer",size:"w-9 h-9",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},rounded:"rounded-lg",transition:"transition-all duration-150",states:{hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},today:{border:"ring-2 ring-blue-500 ring-inset",text:"text-blue-600 dark:text-blue-400 font-semibold"},disabled:{opacity:"opacity-30",cursor:"cursor-not-allowed"},inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:{rounded:"rounded-l-lg rounded-r-none"},rangeEnd:{rounded:"rounded-r-lg rounded-l-none"},otherMonth:{opacity:"opacity-40"}}},monthSelector:{base:"py-2",grid:"grid grid-cols-3 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-3 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},yearSelector:{base:"py-2 max-h-64 overflow-y-auto",grid:"grid grid-cols-4 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-2 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},footer:{base:"flex items-center justify-between",padding:"mt-4 pt-4",border:{light:"border-t border-gray-200",dark:"dark:border-gray-700"},button:{base:"flex items-center justify-center",padding:"px-4 py-2",rounded:"rounded-lg",text:{size:"text-sm font-medium"},today:{background:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},text:{light:"text-blue-600",dark:"dark:text-blue-400"},hover:{light:"hover:bg-blue-100",dark:"dark:hover:bg-blue-900/50"}},clear:{background:"bg-transparent",text:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"}},transition:"transition-colors duration-150"}},rangeIndicator:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-600",dark:"dark:text-gray-400"}},padding:"py-2 mb-2",separator:"mx-2"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"}};function Se(...e){return Rt(Mt(e))}var md={"tr-TR":{months:["Ocak","\u015Eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011Fustos","Eyl\xFCl","Ekim","Kas\u0131m","Aral\u0131k"],monthsShort:["Oca","\u015Eub","Mar","Nis","May","Haz","Tem","A\u011Fu","Eyl","Eki","Kas","Ara"],weekdays:["Pazar","Pazartesi","Sal\u0131","\xC7ar\u015Famba","Per\u015Fembe","Cuma","Cumartesi"],weekdaysShort:["Paz","Pzt","Sal","\xC7ar","Per","Cum","Cmt"],weekdaysMin:["Pz","Pt","Sa","\xC7a","Pe","Cu","Ct"],today:"Bug\xFCn",clear:"Temizle",close:"Kapat",selectDate:"Tarih se\xE7in",selectStartDate:"Ba\u015Flang\u0131\xE7 tarihi",selectEndDate:"Biti\u015F tarihi",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"en-US":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"MM/dd/yyyy",firstDayOfWeek:0},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"de-DE":{months:["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"],weekdaysMin:["So","Mo","Di","Mi","Do","Fr","Sa"],today:"Heute",clear:"L\xF6schen",close:"Schlie\xDFen",selectDate:"Datum ausw\xE4hlen",selectStartDate:"Startdatum",selectEndDate:"Enddatum",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"fr-FR":{months:["Janvier","F\xE9vrier","Mars","Avril","Mai","Juin","Juillet","Ao\xFBt","Septembre","Octobre","Novembre","D\xE9cembre"],monthsShort:["Jan","F\xE9v","Mar","Avr","Mai","Jun","Jul","Ao\xFB","Sep","Oct","Nov","D\xE9c"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],weekdaysMin:["Di","Lu","Ma","Me","Je","Ve","Sa"],today:"Aujourd'hui",clear:"Effacer",close:"Fermer",selectDate:"S\xE9lectionner une date",selectStartDate:"Date de d\xE9but",selectEndDate:"Date de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"es-ES":{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Mi\xE9rcoles","Jueves","Viernes","S\xE1bado"],weekdaysShort:["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"],weekdaysMin:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"],today:"Hoy",clear:"Limpiar",close:"Cerrar",selectDate:"Seleccionar fecha",selectStartDate:"Fecha de inicio",selectEndDate:"Fecha de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"it-IT":{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Luned\xEC","Marted\xEC","Mercoled\xEC","Gioved\xEC","Venerd\xEC","Sabato"],weekdaysShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],weekdaysMin:["Do","Lu","Ma","Me","Gi","Ve","Sa"],today:"Oggi",clear:"Cancella",close:"Chiudi",selectDate:"Seleziona data",selectStartDate:"Data di inizio",selectEndDate:"Data di fine",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"pt-BR":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:0},"pt-PT":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"nl-NL":{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],monthsShort:["Jan","Feb","Mrt","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],weekdays:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],weekdaysShort:["Zo","Ma","Di","Wo","Do","Vr","Za"],weekdaysMin:["Zo","Ma","Di","Wo","Do","Vr","Za"],today:"Vandaag",clear:"Wissen",close:"Sluiten",selectDate:"Selecteer datum",selectStartDate:"Startdatum",selectEndDate:"Einddatum",dateFormat:"dd-MM-yyyy",firstDayOfWeek:1},"pl-PL":{months:["Stycze\u0144","Luty","Marzec","Kwiecie\u0144","Maj","Czerwiec","Lipiec","Sierpie\u0144","Wrzesie\u0144","Pa\u017Adziernik","Listopad","Grudzie\u0144"],monthsShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Pa\u017A","Lis","Gru"],weekdays:["Niedziela","Poniedzia\u0142ek","Wtorek","\u015Aroda","Czwartek","Pi\u0105tek","Sobota"],weekdaysShort:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],weekdaysMin:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],today:"Dzisiaj",clear:"Wyczy\u015B\u0107",close:"Zamknij",selectDate:"Wybierz dat\u0119",selectStartDate:"Data pocz\u0105tkowa",selectEndDate:"Data ko\u0144cowa",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ru-RU":{months:["\u042F\u043D\u0432\u0430\u0440\u044C","\u0424\u0435\u0432\u0440\u0430\u043B\u044C","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0435\u043B\u044C","\u041C\u0430\u0439","\u0418\u044E\u043D\u044C","\u0418\u044E\u043B\u044C","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C","\u041E\u043A\u0442\u044F\u0431\u0440\u044C","\u041D\u043E\u044F\u0431\u0440\u044C","\u0414\u0435\u043A\u0430\u0431\u0440\u044C"],monthsShort:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"],weekdays:["\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0435\u0440\u0433","\u041F\u044F\u0442\u043D\u0438\u0446\u0430","\u0421\u0443\u0431\u0431\u043E\u0442\u0430"],weekdaysShort:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],weekdaysMin:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],today:"\u0421\u0435\u0433\u043E\u0434\u043D\u044F",clear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",selectDate:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443",selectStartDate:"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430",selectEndDate:"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ja-JP":{months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],weekdaysShort:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],weekdaysMin:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],today:"\u4ECA\u65E5",clear:"\u30AF\u30EA\u30A2",close:"\u9589\u3058\u308B",selectDate:"\u65E5\u4ED8\u3092\u9078\u629E",selectStartDate:"\u958B\u59CB\u65E5",selectEndDate:"\u7D42\u4E86\u65E5",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ko-KR":{months:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],monthsShort:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],weekdays:["\uC77C\uC694\uC77C","\uC6D4\uC694\uC77C","\uD654\uC694\uC77C","\uC218\uC694\uC77C","\uBAA9\uC694\uC77C","\uAE08\uC694\uC77C","\uD1A0\uC694\uC77C"],weekdaysShort:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],weekdaysMin:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],today:"\uC624\uB298",clear:"\uC9C0\uC6B0\uAE30",close:"\uB2EB\uAE30",selectDate:"\uB0A0\uC9DC \uC120\uD0DD",selectStartDate:"\uC2DC\uC791\uC77C",selectEndDate:"\uC885\uB8CC\uC77C",dateFormat:"yyyy.MM.dd",firstDayOfWeek:0},"zh-CN":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u5173\u95ED",selectDate:"\u9009\u62E9\u65E5\u671F",selectStartDate:"\u5F00\u59CB\u65E5\u671F",selectEndDate:"\u7ED3\u675F\u65E5\u671F",dateFormat:"yyyy-MM-dd",firstDayOfWeek:1},"zh-TW":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u9031\u65E5","\u9031\u4E00","\u9031\u4E8C","\u9031\u4E09","\u9031\u56DB","\u9031\u4E94","\u9031\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u95DC\u9589",selectDate:"\u9078\u64C7\u65E5\u671F",selectStartDate:"\u958B\u59CB\u65E5\u671F",selectEndDate:"\u7D50\u675F\u65E5\u671F",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ar-SA":{months:["\u064A\u0646\u0627\u064A\u0631","\u0641\u0628\u0631\u0627\u064A\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064A\u0644","\u0645\u0627\u064A\u0648","\u064A\u0648\u0646\u064A\u0648","\u064A\u0648\u0644\u064A\u0648","\u0623\u063A\u0633\u0637\u0633","\u0633\u0628\u062A\u0645\u0628\u0631","\u0623\u0643\u062A\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062F\u064A\u0633\u0645\u0628\u0631"],monthsShort:["\u064A\u0646\u0627","\u0641\u0628\u0631","\u0645\u0627\u0631","\u0623\u0628\u0631","\u0645\u0627\u064A","\u064A\u0648\u0646","\u064A\u0648\u0644","\u0623\u063A\u0633","\u0633\u0628\u062A","\u0623\u0643\u062A","\u0646\u0648\u0641","\u062F\u064A\u0633"],weekdays:["\u0627\u0644\u0623\u062D\u062F","\u0627\u0644\u0625\u062B\u0646\u064A\u0646","\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621","\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621","\u0627\u0644\u062E\u0645\u064A\u0633","\u0627\u0644\u062C\u0645\u0639\u0629","\u0627\u0644\u0633\u0628\u062A"],weekdaysShort:["\u0623\u062D\u062F","\u0625\u062B\u0646","\u062B\u0644\u0627","\u0623\u0631\u0628","\u062E\u0645\u064A","\u062C\u0645\u0639","\u0633\u0628\u062A"],weekdaysMin:["\u062D","\u0646","\u062B","\u0631","\u062E","\u062C","\u0633"],today:"\u0627\u0644\u064A\u0648\u0645",clear:"\u0645\u0633\u062D",close:"\u0625\u063A\u0644\u0627\u0642",selectDate:"\u0627\u062E\u062A\u0631 \u062A\u0627\u0631\u064A\u062E",selectStartDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0628\u062F\u0627\u064A\u0629",selectEndDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0646\u0647\u0627\u064A\u0629",dateFormat:"dd/MM/yyyy",firstDayOfWeek:6}};function yr(e){return md[e]}function uo(e,t,r){let n=[],a=new Date(e,t,1),i=new Date(e,t+1,0),o=a.getDay()-r;if(o<0)o+=7;for(let l=o-1;l>=0;l--)n.push(new Date(e,t,-l));for(let l=1;l<=i.getDate();l++)n.push(new Date(e,t,l));let s=42-n.length;for(let l=1;l<=s;l++)n.push(new Date(e,t+1,l));return n}function ir(e,t){if(!e||!t)return!1;return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function go(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function mo(e){return ir(e,new Date)}function xn(e,t,r){if(!t||!r)return!1;let n=e.getTime();return n>t.getTime()&&n<r.getTime()}function Qn(e,t,r,n,a){if(t&&e<t)return!0;if(r&&e>r)return!0;if(n){for(let i of n)if(ir(e,i))return!0}if(a&&a.includes(e.getDay()))return!0;return!1}function vn(e,t){if(!e)return"";let r=e.getDate().toString().padStart(2,"0"),n=(e.getMonth()+1).toString().padStart(2,"0"),a=e.getFullYear().toString();return t.replace("dd",r).replace("MM",n).replace("yyyy",a)}function bd(e,t,r=" - "){if(!e.start&&!e.end)return"";if(!e.start)return vn(e.end,t);if(!e.end)return vn(e.start,t);return`${vn(e.start,t)}${r}${vn(e.end,t)}`}function Xn(e,t){if(!e)return"";let r=yr(t);return vn(e,r.dateFormat)}function bo(e,t,r=" - "){let n=yr(t);return bd(e,n.dateFormat,r)}function zn(e,t){let r=new Date(e);return r.setMonth(r.getMonth()+t),r}function ln(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function fo(e,t=12){let r=[],n=e-Math.floor(t/2);for(let a=0;a<t;a++)r.push(n+a);return r}function ho(e,t){let n=[...yr(e).weekdaysMin];for(let a=0;a<t;a++)n.push(n.shift());return n}import{jsxDEV as Nn}from"react/jsx-dev-runtime";hd.registerPlugin(fd);function yo({currentMonth:e,selectedDate:t,selectedRange:r,mode:n,locale:a,minDate:i,maxDate:o,disabledDates:s,disabledDaysOfWeek:l,firstDayOfWeek:c,onDateSelect:d,hoverDate:g,onHoverChange:h}){let k=Ru(null),u=Wr,S=uo(e.getFullYear(),e.getMonth(),c),f=ho(a,c);fd(()=>{if(!k.current)return;let m=k.current.querySelectorAll("[data-day]");hd.fromTo(m,{opacity:0,scale:0.8},{opacity:1,scale:1,duration:0.3,stagger:{amount:0.15,grid:[6,7],from:"start"},ease:"power2.out"})},[e]);let P=(m)=>{let y=n==="single"?ir(m,t):r&&(ir(m,r.start)||ir(m,r.end)),v=go(m,e),p=Qn(m,i,o,s,l),b=mo(m),R=n==="range"&&r?xn(m,r.start,r.end)||g&&r.start&&!r.end&&xn(m,r.start,g):!1,$=n==="range"&&r?.start&&!r?.end&&g&&ir(m,g);return Se(u.day.base,u.day.size,u.day.text.size,u.day.rounded,u.day.transition,!y&&!R&&u.day.text.color.light,!y&&!R&&u.day.text.color.dark,!y&&!R&&!p&&u.day.states.hover.light,!y&&!R&&!p&&u.day.states.hover.dark,!v&&u.day.states.otherMonth.opacity,p&&u.day.states.disabled.opacity,p&&u.day.states.disabled.cursor,b&&!y&&u.day.states.today.border,b&&!y&&u.day.states.today.text,y&&u.day.states.selected.background,y&&u.day.states.selected.text,$&&"ring-2 ring-blue-400 ring-inset")},x=(m)=>{if(Qn(m,i,o,s,l))return;d(m)},z=(m)=>{if(n==="range")h(m)};return Nn("div",{children:[Nn("div",{className:Se(u.weekdays.base,u.weekdays.padding),children:f.map((m,y)=>Nn("div",{className:Se("flex items-center justify-center",u.day.size,u.weekdays.text.size,u.weekdays.text.weight,u.weekdays.text.color.light,u.weekdays.text.color.dark),children:m},`weekday-${y}`,!1,void 0,this))},void 0,!1,void 0,this),Nn("div",{ref:k,className:Se(u.grid.base,u.grid.gap),children:S.map((m,y)=>{let v=n==="range"&&r?.start&&ir(m,r.start),p=n==="range"&&r?.end&&ir(m,r.end),b=n==="range"&&r?xn(m,r.start,r.end)||g&&r.start&&!r.end&&xn(m,r.start,g):!1,R=n==="range"&&r?.start&&!r?.end&&g&&ir(m,g),$=b||v||p||R;return Nn("div",{className:Se(u.dayWrapper.base,$&&u.dayWrapper.inRange.light,$&&u.dayWrapper.inRange.dark,v&&u.dayWrapper.rangeStart,(p||R)&&u.dayWrapper.rangeEnd,v&&!p&&!R&&"rounded-r-none",(p||R)&&!v&&"rounded-l-none",b&&!v&&!p&&!R&&"rounded-none"),children:Nn("button",{type:"button","data-day":!0,onClick:()=>x(m),onMouseEnter:()=>z(m),onMouseLeave:()=>z(null),disabled:Qn(m,i,o,s,l),className:P(m),"aria-label":m.toLocaleDateString(a),"aria-pressed":n==="single"?ir(m,t):!!(r&&(ir(m,r.start)||ir(m,r.end))),children:m.getDate()},void 0,!1,void 0,this)},`day-${y}`,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as yd}from"@gsap/react";import wd from"gsap";import{useRef as Bu}from"react";import{jsxDEV as Wt}from"react/jsx-dev-runtime";wd.registerPlugin(yd);function wo({currentMonth:e,onPrevMonth:t,onNextMonth:r,onPrevYear:n,onNextYear:a,onMonthYearClick:i,locale:o,minDate:s,maxDate:l}){let c=Bu(null),d=Wr,h=yr(o).months[e.getMonth()],k=e.getFullYear(),u=!s||e>s,S=!l||e<l;return yd(()=>{if(!c.current)return;wd.fromTo(c.current,{opacity:0,y:-10},{opacity:1,y:0,duration:0.2,ease:"power2.out"})},[e]),Wt("div",{className:Se(d.header.base,d.header.padding),children:[Wt("div",{className:"flex items-center gap-1",children:[Wt("button",{type:"button",onClick:n,disabled:!u,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!u&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous year",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[Wt("polyline",{points:"11 17 6 12 11 7"},void 0,!1,void 0,this),Wt("polyline",{points:"18 17 13 12 18 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Wt("button",{type:"button",onClick:t,disabled:!u,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!u&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous month",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:Wt("polyline",{points:"15 18 9 12 15 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Wt("button",{ref:c,type:"button",onClick:i,className:Se(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:[h," ",k]},void 0,!0,void 0,this),Wt("div",{className:"flex items-center gap-1",children:[Wt("button",{type:"button",onClick:r,disabled:!S,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!S&&"opacity-30 cursor-not-allowed"),"aria-label":"Next month",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:Wt("polyline",{points:"9 18 15 12 9 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Wt("button",{type:"button",onClick:a,disabled:!S,className:Se(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!S&&"opacity-30 cursor-not-allowed"),"aria-label":"Next year",children:Wt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[Wt("polyline",{points:"6 17 11 12 6 7"},void 0,!1,void 0,this),Wt("polyline",{points:"13 17 18 12 13 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Nd}from"@gsap/react";import vo from"gsap";import{useEffect as xd,useId as Iu,useRef as zd,useState as Un}from"react";import{useGSAP as kd}from"@gsap/react";import vd from"gsap";import{useRef as Wu}from"react";import{jsxDEV as Yr}from"react/jsx-dev-runtime";vd.registerPlugin(kd);function ko({currentMonth:e,onMonthSelect:t,onYearSelect:r,locale:n,minDate:a,maxDate:i,view:o,onViewChange:s,onClose:l}){let c=Wu(null),d=Wr,g=yr(n),h=e.getFullYear(),k=e.getMonth(),u=fo(h,16);kd(()=>{if(!c.current)return;let P=c.current.querySelectorAll("[data-item]");vd.fromTo(P,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.25,stagger:0.02,ease:"power2.out"})},[o]);let S=(P)=>{t(P),l()},f=(P)=>{r(P),s("month")};if(o==="year")return Yr("div",{ref:c,className:d.yearSelector.base,children:Yr("div",{className:d.yearSelector.grid,children:u.map((P)=>{let x=P===h,z=a&&P<a.getFullYear()||i&&P>i.getFullYear();return Yr("button",{type:"button","data-item":!0,onClick:()=>f(P),disabled:z,className:Se(d.yearSelector.item.base,d.yearSelector.item.padding,d.yearSelector.item.rounded,d.yearSelector.item.text.size,d.yearSelector.item.transition,x?Se(d.yearSelector.item.selected.background,d.yearSelector.item.selected.text):Se(d.yearSelector.item.text.color.light,d.yearSelector.item.text.color.dark,d.yearSelector.item.hover.light,d.yearSelector.item.hover.dark),z&&"opacity-30 cursor-not-allowed"),children:P},P,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Yr("div",{ref:c,className:d.monthSelector.base,children:[Yr("div",{className:"flex justify-center mb-3",children:Yr("button",{type:"button",onClick:()=>s("year"),className:Se(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),Yr("div",{className:d.monthSelector.grid,children:g.monthsShort.map((P,x)=>{let z=x===k,m=a&&new Date(h,x+1,0)<a||i&&new Date(h,x,1)>i;return Yr("button",{type:"button","data-item":!0,onClick:()=>S(x),disabled:m,className:Se(d.monthSelector.item.base,d.monthSelector.item.padding,d.monthSelector.item.rounded,d.monthSelector.item.text.size,d.monthSelector.item.transition,z?Se(d.monthSelector.item.selected.background,d.monthSelector.item.selected.text):Se(d.monthSelector.item.text.color.light,d.monthSelector.item.text.color.dark,d.monthSelector.item.hover.light,d.monthSelector.item.hover.dark),m&&"opacity-30 cursor-not-allowed"),children:P},P,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as nt,Fragment as Hu}from"react/jsx-dev-runtime";vo.registerPlugin(Nd);function Sn({mode:e,value:t,onChange:r,locale:n="en-US",placeholder:a,label:i,disabled:o=!1,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,className:g,inputClassName:h,dropdownClassName:k,showClearButton:u=!0,showTodayButton:S=!0,firstDayOfWeek:f,leftIcon:P,rightIcon:x,errorMessage:z,helperText:m,required:y=!1,onOpen:v,onClose:p}){let b=yr(n),R=f??b.firstDayOfWeek,[$,J]=Un(!1),[U,E]=Un("bottom"),[K,M]=Un(()=>{if(e==="single"&&t)return ln(t);if(e==="range"&&t?.start){let re=t;return re.start?ln(re.start):ln(new Date)}return ln(new Date)}),[Q,N]=Un("calendar"),[O,A]=Un(null),D=zd(null),I=zd(null),_=Iu(),T=Wr,ie=e==="single"?t:null,q=e==="range"?t:null,ce=e==="single"?Xn(ie,n):bo(q||{start:null,end:null},n),oe=a||(e==="range"?`${b.selectStartDate} - ${b.selectEndDate}`:b.selectDate),{contextSafe:Ze}=Nd({scope:D});xd(()=>{if(!$)return;let re=()=>{if(!D.current)return;let Ke=D.current.getBoundingClientRect(),H=window.innerHeight-Ke.bottom,ue=Ke.top;if(H<400&&ue>H)E("top");else E("bottom")};return re(),window.addEventListener("scroll",re,!0),window.addEventListener("resize",re),()=>{window.removeEventListener("scroll",re,!0),window.removeEventListener("resize",re)}},[$]),xd(()=>{if(!$)return;let re=(H)=>{if(D.current&&!D.current.contains(H.target))Pe()},Ke=(H)=>{if(H.key==="Escape")Pe()};return document.addEventListener("mousedown",re),document.addEventListener("keydown",Ke),()=>{document.removeEventListener("mousedown",re),document.removeEventListener("keydown",Ke)}},[$]);let $e=Ze(()=>{if(o)return;J(!0),N("calendar"),v?.(),requestAnimationFrame(()=>{if(I.current)vo.fromTo(I.current,{opacity:0,y:U==="bottom"?-12:12,scale:0.96},{opacity:1,y:0,scale:1,duration:0.25,ease:"power3.out"})})}),Pe=Ze(()=>{if(I.current)vo.to(I.current,{opacity:0,y:U==="bottom"?-8:8,scale:0.96,duration:0.15,ease:"power2.in",onComplete:()=>{J(!1),A(null),p?.()}});else J(!1),A(null),p?.()}),fe=(re)=>{if(e==="single")r(re),Pe();else{let Ke=q||{start:null,end:null};if(!Ke.start||Ke.start&&Ke.end)r({start:re,end:null});else{if(re<Ke.start)r({start:re,end:Ke.start});else r({start:Ke.start,end:re});Pe()}}},xe=Ze(()=>{if(e==="single")r(null);else r({start:null,end:null})}),qe=()=>{let re=ln(new Date);if(M(re),e==="single")r(re),Pe()},Le=()=>M(zn(K,-1)),ve=()=>M(zn(K,1)),B=()=>M(zn(K,-12)),de=()=>M(zn(K,12)),te=()=>{N(Q==="calendar"?"month":"calendar")},ye=(re)=>{M(new Date(K.getFullYear(),re,1)),N("calendar")},V=(re)=>{M(new Date(re,K.getMonth(),1))},ee=()=>{if($)Pe();else $e()};return nt("div",{ref:D,className:Se(T.container.base,T.container.spacing,g),children:[i&&nt("label",{htmlFor:_,className:Se(T.label.base,T.label.text.size,T.label.text.color.light,T.label.text.color.dark,T.label.spacing),children:[i,y&&nt("span",{className:"text-red-500 ml-1",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nt("div",{className:"relative",children:[nt("button",{id:_,type:"button",onClick:ee,disabled:o,className:Se(T.input.wrapper.base,T.input.wrapper.border.base,T.input.wrapper.background.light,T.input.wrapper.background.dark,T.input.wrapper.padding,T.input.wrapper.rounded,T.input.wrapper.shadow,T.input.wrapper.transition,$&&T.input.wrapper.border.focused,z&&T.input.wrapper.border.error,o&&T.input.wrapper.border.disabled,h),"aria-expanded":$,"aria-haspopup":"dialog",children:[P&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.left,$&&T.input.icon.color.focused),children:P},void 0,!1,void 0,this),!P&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.left,$&&T.input.icon.color.focused),children:nt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[nt("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),nt("line",{x1:"16",y1:"2",x2:"16",y2:"6"},void 0,!1,void 0,this),nt("line",{x1:"8",y1:"2",x2:"8",y2:"6"},void 0,!1,void 0,this),nt("line",{x1:"3",y1:"10",x2:"21",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),nt("span",{className:Se(T.input.text.base,T.input.text.size,ce?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.input.text.placeholder.light,T.input.text.placeholder.dark),"text-left"),children:ce||oe},void 0,!1,void 0,this),x&&nt("span",{className:Se(T.input.icon.base,T.input.icon.size,T.input.icon.color.light,T.input.icon.color.dark,T.input.icon.spacing.right,$&&T.input.icon.color.focused),children:x},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$&&nt("div",{ref:I,className:Se(T.dropdown.base,T.dropdown.background.light,T.dropdown.background.dark,T.dropdown.border.light,T.dropdown.border.dark,T.dropdown.rounded,T.dropdown.shadow,T.dropdown.padding,U==="top"&&T.dropdown.position.top,U==="top"&&T.dropdown.spacing.top,U==="bottom"&&T.dropdown.position.bottom,U==="bottom"&&T.dropdown.spacing.bottom,k),role:"dialog","aria-modal":"true","aria-label":b.selectDate,children:nt("div",{className:T.calendar.base,children:[e==="range"&&nt("div",{className:Se(T.rangeIndicator.base,T.rangeIndicator.padding,"border-b",T.footer.border.light,T.footer.border.dark),children:[nt("div",{className:Se("flex-1 text-center",T.rangeIndicator.text.size,q?.start?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.rangeIndicator.text.color.light,T.rangeIndicator.text.color.dark)),children:q?.start?Xn(q.start,n):b.selectStartDate},void 0,!1,void 0,this),nt("span",{className:Se(T.rangeIndicator.separator,T.rangeIndicator.text.color.light),children:"\u2192"},void 0,!1,void 0,this),nt("div",{className:Se("flex-1 text-center",T.rangeIndicator.text.size,q?.end?Se(T.input.text.color.light,T.input.text.color.dark):Se(T.rangeIndicator.text.color.light,T.rangeIndicator.text.color.dark)),children:q?.end?Xn(q.end,n):b.selectEndDate},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="calendar"?nt(Hu,{children:[nt(wo,{currentMonth:K,onPrevMonth:Le,onNextMonth:ve,onPrevYear:B,onNextYear:de,onMonthYearClick:te,locale:n,minDate:s,maxDate:l},void 0,!1,void 0,this),nt(yo,{currentMonth:K,selectedDate:ie,selectedRange:q,mode:e,locale:n,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,firstDayOfWeek:R,onDateSelect:fe,hoverDate:O,onHoverChange:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this):nt(ko,{currentMonth:K,onMonthSelect:ye,onYearSelect:V,locale:n,minDate:s,maxDate:l,view:Q==="month"?"month":"year",onViewChange:(re)=>N(re),onClose:()=>N("calendar")},void 0,!1,void 0,this),(S||u)&&nt("div",{className:Se(T.footer.base,T.footer.padding,T.footer.border.light,T.footer.border.dark),children:[u&&nt("button",{type:"button",onClick:xe,className:Se(T.footer.button.base,T.footer.button.padding,T.footer.button.rounded,T.footer.button.text.size,T.footer.button.clear.background,T.footer.button.clear.text.light,T.footer.button.clear.text.dark,T.footer.button.clear.hover.light,T.footer.button.clear.hover.dark,T.footer.button.transition),children:b.clear},void 0,!1,void 0,this),S&&nt("button",{type:"button",onClick:qe,className:Se(T.footer.button.base,T.footer.button.padding,T.footer.button.rounded,T.footer.button.text.size,T.footer.button.today.background.light,T.footer.button.today.background.dark,T.footer.button.today.text.light,T.footer.button.today.text.dark,T.footer.button.today.hover.light,T.footer.button.today.hover.dark,T.footer.button.transition),children:b.today},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&nt("span",{className:Se(T.errorText.base,T.errorText.text,T.errorText.color),children:z},void 0,!1,void 0,this),m&&!z&&nt("span",{className:Se(T.helperText.base,T.helperText.text,T.helperText.color.light,T.helperText.color.dark),children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{batch as Sd,createStore as $u}from"h-state";var _u={activeComponentId:null,propValues:{},themeMode:"light",viewportSize:"desktop-lg",sidebarOpen:!1,propsPanelOpen:!0,searchQuery:"",activeExampleIndex:null,activeCategory:"all"},{useStore:kr}=$u(_u,{setActiveComponent:(e)=>(t)=>{Sd(()=>{e.activeComponentId=t,e.propValues={},e.activeExampleIndex=null})},setPropValue:(e)=>(t,r)=>{e.propValues={...e.propValues,[t]:r},e.activeExampleIndex=null},setPropValues:(e)=>(t)=>{e.propValues=t},resetProps:(e)=>()=>{Sd(()=>{e.propValues={},e.activeExampleIndex=null})},setThemeMode:(e)=>(t)=>{e.themeMode=t},setViewportSize:(e)=>(t)=>{e.viewportSize=t},toggleSidebar:(e)=>()=>{e.sidebarOpen=!e.sidebarOpen},togglePropsPanel:(e)=>()=>{e.propsPanelOpen=!e.propsPanelOpen},setSearchQuery:(e)=>(t)=>{e.searchQuery=t},setActiveExample:(e)=>(t)=>{e.activeExampleIndex=t},setActiveCategory:(e)=>(t)=>{e.activeCategory=t}});var It={layout:{container:"relative min-h-screen w-full bg-white dark:bg-slate-950",wrapper:"flex h-screen overflow-hidden"},sidebar:{container:"flex flex-col w-64 h-full border-r border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-900 shrink-0 overflow-y-auto",header:"sticky top-0 z-10 bg-slate-50 dark:bg-slate-900 px-4 pt-5 pb-3 border-b border-slate-200 dark:border-slate-800",title:"text-base font-semibold text-slate-900 dark:text-slate-100",searchInput:"mt-3 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 placeholder-slate-400 dark:placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",categoryButton:"px-2.5 py-1 text-xs font-medium rounded-md transition-colors text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-200/60 dark:hover:bg-slate-800",categoryButtonActive:"px-2.5 py-1 text-xs font-medium rounded-md bg-blue-600 text-white dark:bg-blue-500 dark:text-white",componentItem:"flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-all duration-150 border-l-2 border-transparent",componentItemActive:"bg-blue-50 dark:bg-blue-500/10 border-l-2 !border-blue-600 dark:!border-blue-400",componentItemHover:"hover:bg-slate-100 dark:hover:bg-slate-800/60",componentName:"text-sm font-medium text-slate-800 dark:text-slate-200",componentCategory:"text-[10px] uppercase tracking-wider text-slate-400 dark:text-slate-500 font-medium",mobileToggle:"fixed top-4 left-4 z-50 p-2 rounded-lg bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 shadow-lg lg:hidden",overlay:"fixed inset-0 z-40 bg-black/30 backdrop-blur-sm lg:hidden"},canvas:{container:"flex-1 flex flex-col min-w-0 overflow-hidden",toolbar:"flex items-center gap-1.5 px-4 py-2.5 border-b border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shrink-0 flex-wrap",toolbarButton:"px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-800",toolbarButtonActive:"px-2.5 py-1.5 text-xs font-medium rounded-md bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900",toolbarDivider:"w-px h-5 bg-slate-200 dark:bg-slate-700 mx-1.5",viewportFrame:"flex-1 overflow-auto p-8 transition-all duration-300",viewportLabel:"mb-4 text-[11px] uppercase tracking-widest font-semibold text-slate-400 dark:text-slate-500",componentWrapper:"mx-auto rounded-xl border shadow-sm p-8 transition-all duration-300 overflow-visible",emptyState:"flex flex-col items-center justify-center h-full text-center py-24",emptyIcon:"w-16 h-16 text-slate-200 dark:text-slate-700 mb-4",emptyText:"text-sm text-slate-400 dark:text-slate-500 max-w-xs"},propsPanel:{container:"w-80 h-full border-l border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-900 shrink-0 overflow-y-auto overflow-x-hidden",header:"sticky top-0 z-10 bg-slate-50 dark:bg-slate-900 px-4 pt-5 pb-3 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between",title:"text-xs font-semibold tracking-widest text-slate-500 dark:text-slate-400 uppercase",sectionTitle:"px-4 pt-5 pb-2 text-[10px] uppercase tracking-widest font-bold text-slate-400 dark:text-slate-500",controlRow:"px-4 py-3 border-b border-slate-100 dark:border-slate-800/60",controlLabel:"block text-xs font-semibold text-slate-700 dark:text-slate-300",controlDescription:"text-[11px] text-slate-400 dark:text-slate-500 mt-0.5 leading-relaxed",textInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",numberInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all",selectInput:"mt-2 w-full px-3 py-2 text-sm rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-500 dark:focus:ring-blue-400/30 dark:focus:border-blue-400 transition-all appearance-none cursor-pointer",booleanToggle:"mt-2 relative w-10 h-[22px] rounded-full cursor-pointer transition-colors duration-200 bg-slate-300 dark:bg-slate-600",booleanToggleActive:"mt-2 relative w-10 h-[22px] rounded-full cursor-pointer transition-colors duration-200 bg-blue-600 dark:bg-blue-500",booleanTrack:"",booleanThumb:"absolute top-[3px] left-[3px] w-4 h-4 rounded-full bg-white shadow-sm transition-transform duration-200",rangeInput:"mt-2 w-full accent-blue-600 dark:accent-blue-400",resetButton:"px-3 py-1.5 text-xs font-medium rounded-lg text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 hover:bg-slate-200/60 dark:hover:bg-slate-800 border border-slate-200 dark:border-slate-700 transition-colors",exampleCard:"mx-4 mb-2 px-3 py-2.5 rounded-lg border border-slate-200 dark:border-slate-700 cursor-pointer transition-all hover:border-slate-400 dark:hover:border-slate-500 hover:bg-white dark:hover:bg-slate-800/50",exampleCardActive:"mx-4 mb-2 px-3 py-2.5 rounded-lg border-2 border-blue-600 dark:border-blue-400 cursor-pointer bg-blue-50 dark:bg-blue-500/10",exampleTitle:"text-xs font-semibold text-slate-800 dark:text-slate-200",exampleDescription:"text-[11px] text-slate-400 dark:text-slate-500 mt-0.5"},propTable:{container:"mt-8 mx-auto w-full overflow-x-auto rounded-xl border shadow-sm",header:"",headerCell:"px-5 py-3 text-left text-[11px] uppercase tracking-widest font-bold",row:"border-t transition-colors",cell:"px-5 py-3 text-[13px]",propName:"font-mono font-bold",propType:"font-mono",propDefault:"font-mono",propRequired:"inline-flex px-2 py-0.5 rounded-md text-[10px] font-bold bg-rose-100 dark:bg-rose-500/15 text-rose-700 dark:text-rose-400",propDescription:""}};function Cd(e){return{...It,...e,layout:{...It.layout,...e.layout},sidebar:{...It.sidebar,...e.sidebar},canvas:{...It.canvas,...e.canvas},propsPanel:{...It.propsPanel,...e.propsPanel},propTable:{...It.propTable,...e.propTable}}}import{jsxDEV as he,Fragment as Td}from"react/jsx-dev-runtime";var Fu={"mobile-sm":"max-w-[320px]","mobile-lg":"max-w-[428px]","tablet-sm":"max-w-[768px]","tablet-lg":"max-w-[1024px]","desktop-sm":"max-w-[1280px]","desktop-lg":"max-w-full"},Pd={"mobile-sm":"320px","mobile-lg":"428px","tablet-sm":"768px","tablet-lg":"1024px","desktop-sm":"1280px","desktop-lg":"Full"},Ou=["mobile-sm","mobile-lg","tablet-sm","tablet-lg","desktop-sm","desktop-lg"],qu={mobile:"M7 2h10a2 2 0 012 2v16a2 2 0 01-2 2H7a2 2 0 01-2-2V4a2 2 0 012-2zm5 16h.01",tablet:"M6 2h12a2 2 0 012 2v16a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2zm6 16h.01",desktop:"M4 3h16a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2zm4 18h8m-4-4v4"};function La({registry:e}){let t=kr(),r=It.canvas,n=e.find((o)=>o.id===t.activeComponentId),a={};if(n)for(let o of n.props){let s=t.propValues[o.name];a[o.name]=s!==void 0&&s!==null?s:o.defaultValue??null}let i=t.themeMode==="dark";return he("main",{className:r.container,children:[he("header",{className:r.toolbar,children:[he("button",{type:"button",className:"p-2 lg:hidden rounded-md text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800",onClick:()=>t.toggleSidebar(),"aria-label":"Toggle sidebar",children:he("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:he("path",{d:"M3 12h18M3 6h18M3 18h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ou.map((o)=>{let s=o.split("-")[0]??"",l=o.split("-")[1]?.toUpperCase()??"";return he("button",{type:"button",onClick:()=>t.setViewportSize(o),className:t.viewportSize===o?r.toolbarButtonActive:r.toolbarButton,title:`${Pd[o]} \u2014 ${s} ${l}`,children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"inline","aria-hidden":"true",children:he("path",{d:qu[s]??""},void 0,!1,void 0,this)},void 0,!1,void 0,this)},o,!1,void 0,this)}),he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.setThemeMode("light"),className:t.themeMode==="light"?r.toolbarButtonActive:r.toolbarButton,title:"Light mode",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[he("circle",{cx:"12",cy:"12",r:"5"},void 0,!1,void 0,this),he("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.setThemeMode("dark"),className:t.themeMode==="dark"?r.toolbarButtonActive:r.toolbarButton,title:"Dark mode",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:he("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("button",{type:"button",onClick:()=>t.togglePropsPanel(),className:t.propsPanelOpen?r.toolbarButtonActive:r.toolbarButton,title:"Toggle props panel",children:he("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[he("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"},void 0,!1,void 0,this),he("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),n&&he(Td,{children:[he("span",{className:r.toolbarDivider,"aria-hidden":"true"},void 0,!1,void 0,this),he("span",{className:"text-xs font-semibold text-slate-900 dark:text-slate-100",children:n.name},void 0,!1,void 0,this),he("span",{className:"text-[11px] text-slate-400 dark:text-slate-500 font-mono",children:Pd[t.viewportSize]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),he("section",{className:w(r.viewportFrame,i?"bg-slate-950":"bg-slate-100/70"),style:!i?{backgroundImage:"radial-gradient(circle, #e2e8f0 1px, transparent 1px)",backgroundSize:"20px 20px"}:{backgroundImage:"radial-gradient(circle, #1e293b 1px, transparent 1px)",backgroundSize:"20px 20px"},children:n?he(Td,{children:[he("article",{className:w(r.componentWrapper,Fu[t.viewportSize],i?"bg-slate-900 border-slate-800":"bg-white border-slate-200"),children:he("section",{className:w(i?"dark":"","overflow-visible"),children:he("section",{className:w("rounded-lg overflow-visible",i?"bg-slate-900 text-white":"bg-white text-slate-900"),children:n.render(a)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he(Ju,{entry:n,isDark:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this):he("article",{className:r.emptyState,children:[he("svg",{className:r.emptyIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:[he("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),he("path",{d:"M3 9h18M9 21V9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),he("p",{className:r.emptyText,children:"Select a component from the sidebar to preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ju({entry:e,isDark:t}){let r=It.propTable,n=t?"border-slate-800":"border-slate-200",a=t?"bg-slate-800/80":"bg-slate-50",i=t?"text-slate-400":"text-slate-500",o=t?"hover:bg-slate-800/40":"hover:bg-slate-50",s=t?"text-sky-400":"text-slate-900",l=t?"text-emerald-400":"text-violet-700",c=t?"text-slate-400":"text-slate-500",d=t?"text-slate-300":"text-slate-600",g=t?"bg-slate-900":"bg-white";return he("section",{className:w(r.container,n,g),children:[he("header",{className:w("px-5 py-4 border-b",n),children:[he("h3",{className:w("text-sm font-bold tracking-tight",t?"text-slate-100":"text-slate-900"),children:"Props Reference"},void 0,!1,void 0,this),he("p",{className:w("mt-1 text-xs font-mono",t?"text-slate-500":"text-slate-400"),children:e.importPath},void 0,!1,void 0,this)]},void 0,!0,void 0,this),he("table",{className:"w-full text-left",children:[he("thead",{children:he("tr",{className:a,children:[he("th",{className:w(r.headerCell,i),children:"Prop"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Type"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Default"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Required"},void 0,!1,void 0,this),he("th",{className:w(r.headerCell,i),children:"Description"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),he("tbody",{children:e.props.map((h)=>he("tr",{className:w(r.row,n,o),children:[he("td",{className:w(r.cell,r.propName,s),children:h.name},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propType,l),children:h.type==="select"&&h.options?h.options.map((k)=>`'${k.value}'`).join(" | "):h.type==="boolean"?"boolean":h.type==="number"?"number":"string"},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propDefault,c),children:h.defaultValue===null?"\u2014":typeof h.defaultValue==="boolean"?String(h.defaultValue):typeof h.defaultValue==="string"?`"${h.defaultValue}"`:String(h.defaultValue)},void 0,!1,void 0,this),he("td",{className:r.cell,children:h.required&&he("span",{className:r.propRequired,children:"Required"},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("td",{className:w(r.cell,r.propDescription,d),children:h.description},void 0,!1,void 0,this)]},h.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Vt,Fragment as Au}from"react/jsx-dev-runtime";var Ld={all:"All",inputs:"Inputs",display:"Display",feedback:"Feedback",navigation:"Navigation",layout:"Layout",data:"Data"},Gu=["all","inputs","data","display","feedback","navigation","layout"];function Ma({registry:e}){let t=kr(),r=It.sidebar,n=e.filter((i)=>{let o=t.activeCategory==="all"||i.category===t.activeCategory,s=!t.searchQuery||i.name.toLowerCase().includes(t.searchQuery.toLowerCase())||i.description.toLowerCase().includes(t.searchQuery.toLowerCase());return o&&s}),a=Gu.filter((i)=>{if(i==="all")return!0;return e.some((o)=>o.category===i)});return Vt(Au,{children:[t.sidebarOpen&&Vt("section",{className:r.overlay,onClick:()=>t.toggleSidebar(),"aria-hidden":"true"},void 0,!1,void 0,this),Vt("nav",{className:w(r.container,"fixed lg:relative z-50 lg:z-auto transition-transform duration-300",t.sidebarOpen?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[Vt("header",{className:r.header,children:[Vt("h1",{className:r.title,children:"Design System"},void 0,!1,void 0,this),Vt("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:[e.length," components"]},void 0,!0,void 0,this),Vt("input",{type:"text",placeholder:"Search components...",value:t.searchQuery,onChange:(i)=>t.setSearchQuery(i.target.value),className:r.searchInput},void 0,!1,void 0,this),Vt("nav",{className:"flex flex-wrap gap-1 mt-3","aria-label":"Categories",children:a.map((i)=>Vt("button",{type:"button",onClick:()=>t.setActiveCategory(i),className:t.activeCategory===i?r.categoryButtonActive:r.categoryButton,children:Ld[i]},i,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Vt("section",{className:"flex-1 py-2",children:[n.map((i)=>Vt("button",{type:"button",onClick:()=>t.setActiveComponent(i.id),className:w(r.componentItem,"w-full text-left",t.activeComponentId===i.id?r.componentItemActive:r.componentItemHover),children:Vt("span",{className:"flex flex-col min-w-0",children:[Vt("span",{className:r.componentName,children:i.name},void 0,!1,void 0,this),Vt("span",{className:r.componentCategory,children:Ld[i.category]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},i.id,!1,void 0,this)),n.length===0&&Vt("p",{className:"px-4 py-8 text-center text-xs text-zinc-400 dark:text-zinc-500",children:"No components found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as at,Fragment as Ku}from"react/jsx-dev-runtime";function Ra({registry:e}){let t=kr(),r=It.propsPanel,n=e.find((i)=>i.id===t.activeComponentId);if(!n||!t.propsPanelOpen)return null;let a=(i)=>{let o=t.propValues[i.name];if(o!==void 0)return o;return i.defaultValue};return at("aside",{className:r.container,children:[at("header",{className:r.header,children:[at("h2",{className:r.title,children:"Controls"},void 0,!1,void 0,this),at("button",{type:"button",onClick:()=>t.resetProps(),className:r.resetButton,children:"Reset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.examples.length>0&&at(Ku,{children:[at("p",{className:r.sectionTitle,children:"Examples"},void 0,!1,void 0,this),n.examples.map((i,o)=>at("button",{type:"button",onClick:()=>{t.setPropValues(i.props),t.setActiveExample(o)},className:w("w-full text-left",t.activeExampleIndex===o?r.exampleCardActive:r.exampleCard),children:[at("span",{className:r.exampleTitle,children:i.title},void 0,!1,void 0,this),i.description&&at("span",{className:r.exampleDescription,children:i.description},void 0,!1,void 0,this)]},i.title,!0,void 0,this))]},void 0,!0,void 0,this),at("p",{className:r.sectionTitle,children:"Properties"},void 0,!1,void 0,this),n.props.map((i)=>at(Yu,{prop:i,value:a(i),onChange:(o)=>t.setPropValue(i.name,o)},i.name,!1,void 0,this))]},void 0,!0,void 0,this)}function Yu({prop:e,value:t,onChange:r}){let n=It.propsPanel;return at("section",{className:n.controlRow,children:[at("span",{className:n.controlLabel,id:`prop-label-${e.name}`,children:[e.name,e.required&&at("span",{className:"text-red-500 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.description&&at("p",{className:n.controlDescription,children:e.description},void 0,!1,void 0,this),e.type==="text"&&at("input",{type:"text",value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),placeholder:`Enter ${e.name}...`,className:n.textInput},void 0,!1,void 0,this),e.type==="number"&&at("input",{type:"number",value:t!==null&&t!==void 0?Number(t):"",onChange:(a)=>r(a.target.value?Number(a.target.value):null),min:e.min,max:e.max,step:e.step,className:n.numberInput},void 0,!1,void 0,this),e.type==="boolean"&&at("button",{type:"button",onClick:()=>r(t!==!0),className:t===!0?n.booleanToggleActive:n.booleanToggle,"aria-pressed":t===!0,"aria-label":`Toggle ${e.name}`,children:at("span",{className:w(n.booleanThumb,t===!0?"translate-x-4":"translate-x-0")},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.type==="select"&&e.options&&at("select",{value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),className:n.selectInput,children:e.options.map((a)=>at("option",{value:a.value,children:a.label},a.value,!1,void 0,this))},void 0,!1,void 0,this),e.type==="range"&&at("section",{className:"flex items-center gap-2 mt-1.5",children:[at("input",{type:"range",value:t!==null&&t!==void 0?Number(t):e.min??0,onChange:(a)=>r(Number(a.target.value)),min:e.min,max:e.max,step:e.step,className:n.rangeInput},void 0,!1,void 0,this),at("span",{className:"text-xs font-mono text-zinc-500 dark:text-zinc-400 min-w-[3ch] text-right",children:t!==null&&t!==void 0?String(t):"\u2014"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="color"&&at("section",{className:"flex items-center gap-2 mt-1.5",children:[at("input",{type:"color",value:t!==null&&t!==void 0?String(t):"#000000",onChange:(a)=>r(a.target.value),className:"w-8 h-8 rounded-md border border-zinc-200 dark:border-zinc-700 cursor-pointer"},void 0,!1,void 0,this),at("span",{className:"text-xs font-mono text-zinc-500 dark:text-zinc-400",children:t!==null&&t!==void 0?String(t):"#000000"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="json"&&at("textarea",{value:t!==null&&t!==void 0?String(t):"{}",onChange:(a)=>r(a.target.value),rows:3,className:w(n.textInput,"font-mono resize-y")},void 0,!1,void 0,this),e.type==="reactnode"&&at("input",{type:"text",value:t!==null&&t!==void 0?String(t):"",onChange:(a)=>r(a.target.value||null),placeholder:"ReactNode as string...",className:n.textInput},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as En}from"react/jsx-dev-runtime";function Md({registry:e,className:t}){let r=kr(),n=It.layout;return En("section",{className:w(n.container,t),children:En("section",{className:n.wrapper,children:[En(Ma,{registry:e},void 0,!1,void 0,this),En(La,{registry:e},void 0,!1,void 0,this),r.propsPanelOpen&&En(Ra,{registry:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useState as Zr}from"react";import{useGSAP as So}from"@gsap/react";import Co from"gsap";import{useEffect as Qu,useRef as Dn,useState as zo}from"react";var Kr={container:{base:"relative w-full select-none",orientation:{horizontal:"py-2",vertical:"px-2 h-32"},disabled:"opacity-40 pointer-events-none"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-3",size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},track:{container:{base:"relative cursor-pointer",size:{sm:"h-0.5",md:"h-1",lg:"h-1.5"},orientation:{horizontal:"w-full",vertical:"h-full w-1"}},background:{base:"absolute inset-0 rounded-full",variant:{default:"bg-zinc-200 dark:bg-zinc-700",filled:"bg-zinc-300 dark:bg-zinc-600",minimal:"bg-zinc-100 dark:bg-zinc-800"},disabled:"bg-zinc-100 dark:bg-zinc-800"},range:{base:"absolute rounded-full",variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-zinc-600 dark:bg-zinc-400"},disabled:"bg-zinc-400 dark:bg-zinc-500"}},thumb:{base:"absolute rounded-full cursor-grab active:cursor-grabbing touch-none z-10",size:{sm:"w-2.5 h-2.5",md:"w-3.5 h-3.5",lg:"w-4 h-4"},variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-600"},states:{hover:"",active:"",focus:"outline-none ring-2 ring-zinc-400/50 dark:ring-zinc-500/50",disabled:"cursor-not-allowed"},shadow:"shadow-sm"},tooltip:{base:"absolute pointer-events-none bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 font-medium rounded whitespace-nowrap left-1/2 -translate-x-1/2",size:{sm:"px-1.5 py-0.5 text-[10px] -top-6",md:"px-2 py-0.5 text-xs -top-7",lg:"px-2 py-1 text-xs -top-8"},arrow:"after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-zinc-900 dark:after:border-t-white"},ticks:{container:"absolute inset-x-0 flex justify-between pointer-events-none mt-2",tick:"w-px h-1 bg-zinc-300 dark:bg-zinc-600",label:"text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5"},labels:{container:"flex justify-between mt-1.5",label:"text-[10px] text-zinc-400 dark:text-zinc-500"}};var or=(...e)=>Rt(Mt(e));import{forwardRef as Zu}from"react";import{jsxDEV as xo}from"react/jsx-dev-runtime";var Ba=Zu(({min:e,max:t,value:r,size:n,variant:a,orientation:i,disabled:o},s)=>{let l=Kr,c=t-e,d=(r.min-e)/c*100,g=(r.max-e)/c*100,h=i==="horizontal";return xo("div",{ref:s,className:or(l.track.container.base,l.track.container.size[n],l.track.container.orientation[i]),children:[xo("div",{className:or(l.track.background.base,l.track.background.variant[a],o&&l.track.background.disabled)},void 0,!1,void 0,this),xo("div",{className:or(l.track.range.base,l.track.range.variant[a],o&&l.track.range.disabled,h?"top-0 bottom-0":"left-0 right-0"),style:h?{left:`${d}%`,right:`${100-g}%`}:{bottom:`${d}%`,top:`${100-g}%`}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});Ba.displayName="RangeTrack";import{jsxDEV as jt}from"react/jsx-dev-runtime";Co.registerPlugin(So);var No=(e,t,r)=>Math.min(Math.max(e,t),r),Rd=(e,t,r)=>{let n=Math.round((e-r)/t);return r+n*t};function Cn({value:e,defaultValue:t,min:r=0,max:n=100,step:a=1,minRange:i=0,disabled:o=!1,readOnly:s=!1,size:l="md",variant:c="default",orientation:d="horizontal",showTooltip:g=!1,showLabels:h=!1,showTicks:k=!1,tickCount:u=5,debounceMs:S=0,formatValue:f,onChange:P,onChangeCommit:x,label:z,minLabel:m,maxLabel:y,ariaLabel:v,ariaLabelMin:p,ariaLabelMax:b,className:R,...$}){let J=Kr,U=Dn(null),E=Dn(null),K=Dn(null),M=Dn(null),[Q,N]=zo(t||{min:r+(n-r)*0.25,max:r+(n-r)*0.75}),[O,A]=zo(null),[D,I]=zo(null);So(()=>{if(K.current)Co.to(K.current,{scale:O==="min"?1.3:D==="min"?1.15:1,duration:0.2,ease:O==="min"?"power2.out":"elastic.out(1, 0.4)"})},[O,D]),So(()=>{if(M.current)Co.to(M.current,{scale:O==="max"?1.3:D==="max"?1.15:1,duration:0.2,ease:O==="max"?"power2.out":"elastic.out(1, 0.4)"})},[O,D]);let _=e??Q,T=e!==void 0,ie=(B)=>{if(s)return;let de=No(Rd(B.min,a,r),r,B.max-i),te=No(Rd(B.max,a,r),B.min+i,n),ye={min:de,max:te};if(!T)N(ye);P?.(ye)},q=(B,de)=>{if(!E.current)return r;let te=E.current.getBoundingClientRect(),ye=d==="horizontal",V;if(ye)V=(B-te.left)/te.width;else V=1-(de-te.top)/te.height;return V=No(V,0,1),r+V*(n-r)},ce=(B)=>{if(o||s)return;let de=q(B.clientX,B.clientY),te=Math.abs(de-_.min),ye=Math.abs(de-_.max);if(te<=ye)ie({..._,min:de});else ie({..._,max:de})},oe=Dn(null),Ze=(B)=>{if(o||s)return;A(B)},$e=()=>{if(O)if(A(null),S>0){if(oe.current)clearTimeout(oe.current);oe.current=setTimeout(()=>{x?.(_)},S)}else x?.(_)};Qu(()=>{if(!O)return;let B=(te)=>{te.preventDefault();let ye="touches"in te?te.touches[0]?.clientX??0:te.clientX,V="touches"in te?te.touches[0]?.clientY??0:te.clientY,ee=q(ye,V);if(O==="min")ie({..._,min:Math.min(ee,_.max-i)});else ie({..._,max:Math.max(ee,_.min+i)})},de=()=>{$e()};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",de),document.addEventListener("touchmove",B,{passive:!1}),document.addEventListener("touchend",de),()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",de),document.removeEventListener("touchmove",B),document.removeEventListener("touchend",de)}},[O,_,r,n,i]);let Pe=(B,de)=>{if(o||s)return;let te=de==="min"?_.min:_.max,ye=te;switch(B.key){case"ArrowRight":case"ArrowUp":ye=te+a;break;case"ArrowLeft":case"ArrowDown":ye=te-a;break;case"PageUp":ye=te+a*10;break;case"PageDown":ye=te-a*10;break;case"Home":ye=r;break;case"End":ye=n;break;default:return}if(B.preventDefault(),de==="min")ie({..._,min:ye});else ie({..._,max:ye})},fe=(_.min-r)/(n-r)*100,xe=(_.max-r)/(n-r)*100,qe=g&&(O==="min"||D==="min"),Le=g&&(O==="max"||D==="max"),ve=k?Array.from({length:u},(B,de)=>r+de/(u-1)*(n-r)):[];return jt("div",{ref:U,className:or(J.container.base,J.container.orientation[d],o&&J.container.disabled,R),...$,children:[z&&jt("span",{className:or(J.label.base,J.label.size[l]),id:`${$.id||"range"}-label`,children:z},void 0,!1,void 0,this),jt("div",{ref:E,className:"relative",onClick:ce,"aria-hidden":"true",children:[jt(Ba,{min:r,max:n,value:_,size:l,variant:c,orientation:d,disabled:o},void 0,!1,void 0,this),jt("div",{ref:K,role:"slider",tabIndex:o?-1:0,"aria-label":p||v||"Minimum value","aria-valuemin":r,"aria-valuemax":_.max-i,"aria-valuenow":_.min,"aria-valuetext":f?f(_.min):String(_.min),"aria-disabled":o,"aria-orientation":d,className:or(J.thumb.base,J.thumb.size[l],J.thumb.variant[c],J.thumb.shadow,!o&&J.thumb.states.hover,O==="min"&&J.thumb.states.active,o&&J.thumb.states.disabled),style:{left:`${fe}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(B)=>{B.preventDefault(),B.stopPropagation(),Ze("min")},onTouchStart:(B)=>{B.stopPropagation(),Ze("min")},onMouseEnter:()=>I("min"),onMouseLeave:()=>I(null),onKeyDown:(B)=>Pe(B,"min"),onFocus:()=>I("min"),onBlur:()=>I(null),children:qe&&jt("span",{className:or(J.tooltip.base,J.tooltip.size[l],J.tooltip.arrow),"aria-hidden":"true",children:f?f(_.min):_.min},void 0,!1,void 0,this)},void 0,!1,void 0,this),jt("div",{ref:M,role:"slider",tabIndex:o?-1:0,"aria-label":b||v||"Maximum value","aria-valuemin":_.min+i,"aria-valuemax":n,"aria-valuenow":_.max,"aria-valuetext":f?f(_.max):String(_.max),"aria-disabled":o,"aria-orientation":d,className:or(J.thumb.base,J.thumb.size[l],J.thumb.variant[c],J.thumb.shadow,!o&&J.thumb.states.hover,O==="max"&&J.thumb.states.active,o&&J.thumb.states.disabled),style:{left:`${xe}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(B)=>{B.preventDefault(),B.stopPropagation(),Ze("max")},onTouchStart:(B)=>{B.stopPropagation(),Ze("max")},onMouseEnter:()=>I("max"),onMouseLeave:()=>I(null),onKeyDown:(B)=>Pe(B,"max"),onFocus:()=>I("max"),onBlur:()=>I(null),children:Le&&jt("span",{className:or(J.tooltip.base,J.tooltip.size[l],J.tooltip.arrow),"aria-hidden":"true",children:f?f(_.max):_.max},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k&&jt("div",{className:J.ticks.container,style:{top:"100%",marginTop:"8px"},children:ve.map((B,de)=>jt("div",{className:"flex flex-col items-center",children:[jt("div",{className:J.ticks.tick},void 0,!1,void 0,this),jt("span",{className:J.ticks.label,children:f?f(B):B},void 0,!1,void 0,this)]},de,!0,void 0,this))},void 0,!1,void 0,this),h&&jt("div",{className:J.labels.container,children:[jt("span",{className:J.labels.label,children:m||(f?f(r):r)},void 0,!1,void 0,this),jt("span",{className:J.labels.label,children:y||(f?f(n):n)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Bd}from"@gsap/react";import Po from"gsap";import{forwardRef as Xu,useRef as Uu}from"react";import{jsxDEV as Eu}from"react/jsx-dev-runtime";Po.registerPlugin(Bd);var Wd=Xu(({position:e,value:t,min:r,max:n,size:a,variant:i,disabled:o,isDragging:s,onDragStart:l,onDragEnd:c,ariaLabel:d,ariaValueText:g},h)=>{let k=Kr,u=Uu(null),S=(t-r)/(n-r)*100;return Bd(()=>{if(!u.current)return;if(s)Po.to(u.current,{scale:1.2,duration:0.15,ease:"power2.out"});else Po.to(u.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})},[s]),Eu("div",{ref:(f)=>{if(u.current=f,typeof h==="function")h(f);else if(h)h.current=f},role:"slider",tabIndex:o?-1:0,"aria-label":d||`${e} value`,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":t,"aria-valuetext":g||String(t),"aria-disabled":o,"data-position":e,className:or(k.thumb.base,k.thumb.size[a],k.thumb.variant[i],k.thumb.shadow,!o&&k.thumb.states.hover,s&&k.thumb.states.active,o&&k.thumb.states.disabled),style:{left:`${S}%`},onMouseDown:(f)=>{if(f.preventDefault(),!o)l()},onTouchStart:(f)=>{if(f.preventDefault(),!o)l()},onMouseUp:c,onTouchEnd:c,onKeyDown:()=>{if(o)return}},void 0,!1,void 0,this)});Wd.displayName="RangeThumb";import{useGSAP as Du}from"@gsap/react";import Vu from"gsap";import{useRef as Ev}from"react";import{jsxDEV as ex}from"react/jsx-dev-runtime";Vu.registerPlugin(Du);import{useGSAP as Fd}from"@gsap/react";import Wa from"gsap";import{useEffect as Ro,useId as rg,useRef as jn,useState as Bo}from"react";var Vn={container:{base:"relative flex flex-col",spacing:"gap-1"},wrapper:{base:"relative flex items-center w-full",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:{sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"},rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},input:{base:"flex-1 bg-transparent border-none outline-none w-full",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},placeholder:{light:"placeholder:text-gray-400",dark:"dark:placeholder:text-gray-500"}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},icon:{base:"flex items-center justify-center flex-shrink-0",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}},clearButton:{base:"flex items-center justify-center cursor-pointer",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",hover:"hover:text-gray-600 dark:hover:text-gray-300"},transition:"transition-colors duration-150"},dropdown:{base:"absolute left-0 right-0 z-50 overflow-hidden",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-lg",shadow:"shadow-lg",maxHeight:"max-h-64 overflow-y-auto",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},item:{base:"cursor-pointer",padding:"px-4 py-3",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-50",dark:"dark:hover:bg-gray-700"},active:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},transition:"transition-colors duration-150",rounded:""},loading:{base:"flex items-center justify-center py-4",size:"w-6 h-6",color:"text-blue-500"},empty:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},padding:"py-4 px-4"}};function er(...e){return Rt(Mt(e))}function To(e,t){let r=null;return{call:(...i)=>{if(r)clearTimeout(r);r=setTimeout(()=>{e(...i),r=null},t)},cancel:()=>{if(r)clearTimeout(r),r=null}}}var ju=[/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,/javascript:/gi,/on\w+\s*=/gi,/<iframe/gi,/<object/gi,/<embed/gi,/<link/gi,/data:/gi,/vbscript:/gi],eg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Id(e){let t=e;for(let r of ju)t=t.replace(r,"");return t}function Hd(e){return e.replace(/[&<>"'`=/]/g,(t)=>eg[t]||t)}function Lo(e,t={}){let{trim:r=!0,escapeHtml:n=!1,maxLength:a,removeScripts:i=!0}=t,o=e;if(i)o=Id(o);if(r)o=o.trim();if(n)o=Hd(o);if(a&&o.length>a)o=o.slice(0,a);return o}import{useGSAP as $d}from"@gsap/react";import _d from"gsap";import{useRef as tg}from"react";import{jsxDEV as vr}from"react/jsx-dev-runtime";_d.registerPlugin($d);function Mo({results:e,renderItem:t,onSelect:r,loading:n=!1,emptyMessage:a="No results found",className:i,itemClassName:o,position:s,activeIndex:l,onActiveIndexChange:c}){let d=tg(null),g=Vn;$d(()=>{if(!d.current)return;_d.fromTo(d.current,{opacity:0,y:s==="bottom"?-8:8,scale:0.98},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[s]);let h=(S)=>{r?.(S)},k=(S)=>{c(S)},u=(S)=>vr("span",{children:String(S.data)},void 0,!1,void 0,this);if(n)return vr("div",{className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:vr("div",{className:g.loading.base,children:vr("svg",{className:er(g.loading.size,g.loading.color,"animate-spin"),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[vr("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),vr("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return vr("div",{className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:vr("div",{className:er(g.empty.base,g.empty.text.size,g.empty.text.color.light,g.empty.text.color.dark,g.empty.padding),children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this);return vr("div",{ref:d,className:er(g.dropdown.base,g.dropdown.background.light,g.dropdown.background.dark,g.dropdown.border.light,g.dropdown.border.dark,g.dropdown.rounded,g.dropdown.shadow,g.dropdown.maxHeight,s==="top"&&g.dropdown.position.top,s==="top"&&g.dropdown.spacing.top,s==="bottom"&&g.dropdown.position.bottom,s==="bottom"&&g.dropdown.spacing.bottom,i),children:e.map((S,f)=>vr("button",{type:"button",onClick:()=>h(S),onMouseEnter:()=>k(f),className:er("w-full text-left",g.item.base,g.item.padding,g.item.text.size,g.item.text.color.light,g.item.text.color.dark,g.item.hover.light,g.item.hover.dark,g.item.transition,g.item.rounded,l===f&&g.item.active.light,l===f&&g.item.active.dark,o),children:t?t(S,f):u(S)},S.id,!1,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as tr}from"react/jsx-dev-runtime";Wa.registerPlugin(Fd);function Pn({value:e,onChange:t,onSearch:r,results:n,renderItem:a,onSelect:i,placeholder:o="Search...",label:s,debounceMs:l=300,minSearchLength:c=1,disabled:d=!1,loading:g=!1,emptyMessage:h="No results found",className:k,inputClassName:u,dropdownClassName:S,itemClassName:f,showClearButton:P=!0,leftIcon:x,rightIcon:z,disableDropdown:m=!1,showSearchIcon:y=!0,maxLength:v=200,sanitize:p=!0,trimOnSearch:b=!0,preventXSS:R=!0}){let[$,J]=Bo(!1),[U,E]=Bo(-1),[K,M]=Bo("bottom"),Q=jn(null),N=jn(null),O=jn(null),A=jn(null),D=jn(r),I=rg();D.current=r;let _=Vn,T=!m&&$&&n!==void 0&&n.length>=0&&e.length>=c,{contextSafe:ie}=Fd({scope:N});Ro(()=>{return A.current=To((fe)=>{if(fe.length>=c||fe.length===0){let xe=p?Lo(fe,{trim:b,escapeHtml:R,maxLength:v,removeScripts:!0}):fe;D.current(xe)}},l),()=>{A.current?.cancel()}},[l,c,p,b,R,v]),Ro(()=>{if(!T)return;let fe=()=>{if(!O.current)return;let xe=O.current.getBoundingClientRect(),qe=window.innerHeight-xe.bottom,Le=xe.top;if(qe<256&&Le>qe)M("top");else M("bottom")};return fe(),window.addEventListener("scroll",fe,!0),window.addEventListener("resize",fe),()=>{window.removeEventListener("scroll",fe,!0),window.removeEventListener("resize",fe)}},[T]),Ro(()=>{E(-1)},[n]);let q=ie(()=>{if(d)return;if(J(!0),N.current)Wa.to(N.current,{scale:1.01,duration:0.15,ease:"power2.out"})}),ce=ie(()=>{if(setTimeout(()=>{J(!1),E(-1)},150),N.current)Wa.to(N.current,{scale:1,duration:0.15,ease:"power2.out"})}),oe=(fe)=>{let xe=fe.target.value;t(xe),A.current?.call(xe)},Ze=ie(()=>{if(t(""),A.current?.call(""),Q.current?.focus(),N.current)Wa.fromTo(N.current,{scale:0.98},{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}),$e=(fe)=>{if(!n||n.length===0)return;switch(fe.key){case"ArrowDown":fe.preventDefault(),E((xe)=>xe<n.length-1?xe+1:0);break;case"ArrowUp":fe.preventDefault(),E((xe)=>xe>0?xe-1:n.length-1);break;case"Enter":{fe.preventDefault();let xe=n[U];if(U>=0&&U<n.length&&xe)Pe(xe);break}case"Escape":fe.preventDefault(),J(!1),Q.current?.blur();break}},Pe=(fe)=>{i?.(fe),J(!1),E(-1)};return tr("div",{ref:O,className:er(_.container.base,_.container.spacing,k),children:[s&&tr("label",{htmlFor:I,className:er(_.label.base,_.label.text.size,_.label.text.color.light,_.label.text.color.dark,_.label.spacing),children:s},void 0,!1,void 0,this),tr("div",{className:"relative",children:[tr("div",{ref:N,className:er(_.wrapper.base,_.wrapper.border.base,_.wrapper.background.light,_.wrapper.background.dark,_.wrapper.padding.md,_.wrapper.rounded,_.wrapper.shadow,_.wrapper.transition,$&&_.wrapper.border.focused,d&&_.wrapper.border.disabled),children:[(x||y)&&tr("span",{className:er(_.icon.base,_.icon.size.md,_.icon.color.light,_.icon.color.dark,_.icon.spacing.left,$&&_.icon.color.focused),children:x||tr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[tr("circle",{cx:"11",cy:"11",r:"8"},void 0,!1,void 0,this),tr("path",{d:"m21 21-4.3-4.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),tr("input",{ref:Q,id:I,type:"text",value:e,onChange:oe,onFocus:q,onBlur:ce,onKeyDown:$e,disabled:d,placeholder:o,maxLength:v,autoComplete:"off",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":s||o,role:"combobox","aria-expanded":T,"aria-autocomplete":"list","aria-haspopup":"listbox",className:er(_.input.base,_.input.text.size,_.input.text.color.light,_.input.text.color.dark,_.input.placeholder.light,_.input.placeholder.dark,u)},void 0,!1,void 0,this),P&&e&&tr("button",{type:"button",onClick:Ze,className:er(_.clearButton.base,_.clearButton.size,_.clearButton.color.light,_.clearButton.color.dark,_.clearButton.color.hover,_.clearButton.transition),"aria-label":"Clear search",children:tr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[tr("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),tr("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z&&tr("span",{className:er(_.icon.base,_.icon.size.md,_.icon.color.light,_.icon.color.dark,_.icon.spacing.right,$&&_.icon.color.focused),children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T&&tr(Mo,{results:n,renderItem:a,onSelect:Pe,loading:g,emptyMessage:h,className:S,itemClassName:f,position:K,activeIndex:U,onActiveIndexChange:E},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ad}from"@gsap/react";import Yd from"gsap";import{useEffect as Io,useRef as ta,useState as ra}from"react";var Ir={container:{base:"relative w-full"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",size:{sm:"text-xs",md:"text-sm",lg:"text-base"},required:'after:content-["*"] after:ml-0.5 after:text-red-500',error:"text-red-600 dark:text-red-400"},trigger:{base:"relative w-full flex items-center justify-between gap-2 rounded-lg border bg-white dark:bg-zinc-900 text-left cursor-pointer transition-all duration-150",size:{sm:"px-2.5 py-1.5 text-sm min-h-[32px]",md:"px-3 py-2 text-sm min-h-[40px]",lg:"px-4 py-2.5 text-base min-h-[48px]"},variant:{default:"border-zinc-300 dark:border-zinc-600",filled:"border-transparent bg-zinc-100 dark:bg-zinc-800",ghost:"border-transparent bg-transparent"},states:{hover:"hover:border-zinc-400 dark:hover:border-zinc-500",focus:"focus:outline-none focus:ring-2 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 focus:border-zinc-400 dark:focus:border-zinc-500",disabled:"opacity-50 cursor-not-allowed pointer-events-none",error:"border-red-500 dark:border-red-400 focus:ring-red-400/50",open:"ring-2 ring-zinc-400/50 dark:ring-zinc-500/50 border-zinc-400 dark:border-zinc-500"}},placeholder:{base:"text-zinc-400 dark:text-zinc-500 truncate"},value:{base:"text-zinc-900 dark:text-white truncate flex items-center gap-2"},icon:{base:"flex-shrink-0 text-zinc-400 dark:text-zinc-500 transition-transform duration-200",size:{sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5"},open:"rotate-180"},clearButton:{base:"flex-shrink-0 p-0.5 rounded text-zinc-400 dark:text-zinc-500 transition-colors",hover:"hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"},dropdown:{base:"absolute left-0 right-0 z-50 bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg overflow-hidden",position:{top:"bottom-full mb-1",bottom:"top-full mt-1"},size:{sm:"py-1",md:"py-1.5",lg:"py-2"}},search:{container:"px-2 pb-1.5 border-b border-zinc-100 dark:border-zinc-800",input:"w-full px-2.5 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md outline-none focus:ring-1 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400 dark:placeholder:text-zinc-500",icon:"absolute left-4.5 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-400"},option:{base:"relative flex items-center gap-2 cursor-pointer transition-colors duration-100",size:{sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-base"},states:{hover:"bg-zinc-50 dark:bg-zinc-800",selected:"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-white",highlighted:"bg-zinc-100 dark:bg-zinc-800",disabled:"opacity-50 cursor-not-allowed pointer-events-none"},icon:"flex-shrink-0 w-4 h-4",checkmark:"ml-auto flex-shrink-0 w-4 h-4 text-zinc-900 dark:text-white"},empty:{base:"px-3 py-6 text-center text-sm text-zinc-400 dark:text-zinc-500"},loading:{base:"px-3 py-6 flex items-center justify-center gap-2 text-sm text-zinc-400 dark:text-zinc-500",spinner:"w-4 h-4 animate-spin"},helper:{base:"mt-1.5 text-xs text-zinc-500 dark:text-zinc-400",error:"text-red-600 dark:text-red-400"}};var sr=(...e)=>Rt(Mt(e));import{useGSAP as Jd}from"@gsap/react";import Gd from"gsap";import{forwardRef as ng,useEffect as Od,useRef as ag,useState as qd}from"react";import{createPortal as ig}from"react-dom";import{jsxDEV as og}from"react/jsx-dev-runtime";Gd.registerPlugin(Jd);var Ia=ng(({isOpen:e,position:t,size:r,maxHeight:n,children:a,triggerRef:i},o)=>{let s=Ir,l=ag(null),[c,d]=qd(!1),[g,h]=qd({});if(Od(()=>{d(!0)},[]),Od(()=>{if(!e||!i?.current)return;let u=()=>{let S=i.current?.getBoundingClientRect();if(!S)return;h({position:"fixed",left:S.left,width:S.width,maxHeight:n,overflowY:"auto",zIndex:9999,...t==="top"?{bottom:window.innerHeight-S.top+4}:{top:S.bottom+4}})};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[e,t,n,i]),Jd(()=>{if(!l.current)return;if(e)Gd.fromTo(l.current,{opacity:0,y:t==="bottom"?-8:8,scale:0.96},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[e,t]),!e||!c)return null;let k=og("div",{ref:(u)=>{if(l.current=u,typeof o==="function")o(u);else if(o)o.current=u},role:"listbox",className:sr(s.dropdown.base,s.dropdown.size[r],!i&&s.dropdown.position[t]),style:i?g:{maxHeight:n,overflowY:"auto"},children:a},void 0,!1,void 0,this);if(i)return ig(k,document.body);return k});Ia.displayName="SelectDropdown";import{jsxDEV as ea}from"react/jsx-dev-runtime";function Wo({option:e,isSelected:t,isHighlighted:r,size:n,onClick:a,onMouseEnter:i}){let o=Ir;return ea("div",{role:"option",tabIndex:e.disabled?-1:0,"aria-selected":t,"aria-disabled":e.disabled,onClick:e.disabled?void 0:a,onKeyDown:(s)=>{if(s.key==="Enter"||s.key===" "){if(s.preventDefault(),!e.disabled)a()}},onMouseEnter:i,className:sr(o.option.base,o.option.size[n],!e.disabled&&o.option.states.hover,t&&o.option.states.selected,r&&!t&&o.option.states.highlighted,e.disabled&&o.option.states.disabled),children:[e.icon&&ea("span",{className:o.option.icon,children:e.icon},void 0,!1,void 0,this),ea("span",{className:"truncate",children:e.label},void 0,!1,void 0,this),t&&ea("svg",{className:o.option.checkmark,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:ea("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{forwardRef as lg}from"react";import{jsxDEV as sg}from"react/jsx-dev-runtime";var Ha=lg(({isOpen:e,disabled:t,loading:r,size:n,variant:a,hasValue:i,hasError:o,onClick:s,onKeyDown:l,children:c},d)=>{let g=Ir;return sg("button",{ref:d,type:"button",role:"combobox","aria-expanded":e,"aria-haspopup":"listbox","aria-disabled":t,disabled:t,onClick:s,onKeyDown:l,className:sr(g.trigger.base,g.trigger.size[n],g.trigger.variant[a],!t&&g.trigger.states.hover,g.trigger.states.focus,t&&g.trigger.states.disabled,o&&g.trigger.states.error,e&&g.trigger.states.open),children:c},void 0,!1,void 0,this)});Ha.displayName="SelectTrigger";import{jsxDEV as dt,Fragment as dg}from"react/jsx-dev-runtime";Yd.registerPlugin(Ad);function dr({options:e,value:t,defaultValue:r,placeholder:n="Select...",disabled:a=!1,readOnly:i=!1,loading:o=!1,clearable:s=!1,searchable:l=!1,size:c="md",variant:d="default",position:g="auto",maxHeight:h=240,emptyText:k="No options",loadingText:u="Loading...",searchPlaceholder:S="Search...",onChange:f,onSearch:P,onOpen:x,onClose:z,renderOption:m,renderValue:y,label:v,error:p,helperText:b,required:R=!1,name:$,ariaLabel:J,className:U,...E}){let K=Ir,M=ta(null),Q=ta(null),N=ta(null),O=ta(null),[A,D]=ra(!1),[I,_]=ra(r),[T,ie]=ra(""),[q,ce]=ra(-1),[oe,Ze]=ra("bottom"),$e=t!==void 0?t:I,Pe=t!==void 0,fe=e.find((ee)=>ee.value===$e),xe=l&&T?e.filter((ee)=>ee.label.toLowerCase().includes(T.toLowerCase())):e,qe=()=>{if(g!=="auto"){Ze(g);return}if(!Q.current)return;let ee=Q.current.getBoundingClientRect(),re=window.innerHeight-ee.bottom,Ke=ee.top,H=Math.min(h+50,300);if(re<H&&Ke>re)Ze("top");else Ze("bottom")},Le=()=>{if(a||i)return;qe(),D(!0),ce(-1),x?.()},ve=()=>{D(!1),ie(""),ce(-1),z?.()},B=(ee)=>{if(ee.disabled)return;if(!Pe)_(ee.value);f?.(ee.value),ve(),Q.current?.focus()},de=(ee)=>{if(ee.stopPropagation(),!Pe)_(void 0);f?.(void 0)},te=(ee)=>{let re=ee.target.value;ie(re),ce(-1),P?.(re)},ye=(ee)=>{switch(ee.key){case"Enter":case" ":if(ee.preventDefault(),A){if(q>=0&&xe[q])B(xe[q])}else Le();break;case"ArrowDown":if(ee.preventDefault(),!A)Le();else ce((re)=>re<xe.length-1?re+1:0);break;case"ArrowUp":if(ee.preventDefault(),!A)Le();else ce((re)=>re>0?re-1:xe.length-1);break;case"Escape":if(A)ee.preventDefault(),ve();break;case"Tab":if(A)ve();break;case"Home":if(A)ee.preventDefault(),ce(0);break;case"End":if(A)ee.preventDefault(),ce(xe.length-1);break}};Io(()=>{if(!A)return;let ee=(Ke)=>{let H=Ke.target,ue=M.current?.contains(H),We=N.current?.contains(H);if(!ue&&!We)ve()},re=(Ke)=>{if(Ke.key==="Escape")ve()};return document.addEventListener("mousedown",ee),document.addEventListener("keydown",re),()=>{document.removeEventListener("mousedown",ee),document.removeEventListener("keydown",re)}},[A]),Io(()=>{if(A&&l&&O.current)O.current.focus()},[A,l]),Io(()=>{if(A&&q>=0&&N.current){let ee=N.current.querySelector(`[data-index="${q}"]`);if(ee)ee.scrollIntoView({block:"nearest"})}},[q,A]);let V=ta(null);return Ad(()=>{if(V.current)Yd.to(V.current,{rotation:A?180:0,duration:0.2,ease:"power2.out"})},[A]),dt("div",{ref:M,className:sr(K.container.base,U),...E,children:[v&&dt("span",{className:sr(K.label.base,K.label.size[c],R&&K.label.required,p&&K.label.error),id:`${E.id||"select"}-label`,children:v},void 0,!1,void 0,this),dt(Ha,{ref:Q,isOpen:A,disabled:a,loading:o,size:c,variant:d,hasValue:!!fe,hasError:!!p,onClick:()=>A?ve():Le(),onKeyDown:ye,children:[dt("span",{className:fe?K.value.base:K.placeholder.base,children:fe?y?y(fe):fe.icon?dt(dg,{children:[fe.icon,fe.label]},void 0,!0,void 0,this):fe.label:n},void 0,!1,void 0,this),dt("div",{className:"flex items-center gap-1",children:[s&&$e!==void 0&&$e!==""&&!a&&dt("span",{role:"button",tabIndex:0,onClick:de,onKeyDown:(ee)=>{if(ee.key==="Enter"||ee.key===" ")ee.preventDefault(),de(ee)},className:sr(K.clearButton.base,K.clearButton.hover),"aria-label":"Clear selection",children:dt("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:dt("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?dt("svg",{className:sr(K.loading.spinner,K.icon.size[c]),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[dt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),dt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):dt("svg",{ref:V,className:sr(K.icon.base,K.icon.size[c]),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:dt("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$&&dt("input",{type:"hidden",name:$,value:String($e??"")},void 0,!1,void 0,this),dt(Ia,{ref:N,isOpen:A,position:oe,size:c,maxHeight:h,triggerRef:Q,children:[l&&dt("div",{className:K.search.container,children:dt("input",{ref:O,type:"text",value:T,onChange:te,placeholder:S,className:K.search.input,onClick:(ee)=>ee.stopPropagation()},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?dt("div",{className:K.loading.base,children:[dt("svg",{className:K.loading.spinner,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[dt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),dt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u]},void 0,!0,void 0,this):xe.length===0?dt("div",{className:K.empty.base,children:k},void 0,!1,void 0,this):xe.map((ee,re)=>dt("div",{"data-index":re,children:m?dt("div",{onClick:()=>B(ee),onKeyDown:(Ke)=>{if(Ke.key==="Enter")B(ee)},role:"option",tabIndex:0,"aria-selected":ee.value===$e,children:m(ee,ee.value===$e)},void 0,!1,void 0,this):dt(Wo,{option:ee,isSelected:ee.value===$e,isHighlighted:re===q,size:c,onClick:()=>B(ee),onMouseEnter:()=>ce(re)},void 0,!1,void 0,this)},String(ee.value),!1,void 0,this))]},void 0,!0,void 0,this),(b||p)&&dt("p",{className:sr(K.helper.base,p&&K.helper.error),children:p||b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import _a from"gsap";import{useRef as Fa,useState as cg}from"react";import{createPortal as pg}from"react-dom";var $a={container:{base:"relative inline-flex"},tooltip:{base:"absolute z-50 pointer-events-none whitespace-normal break-words text-center",size:{sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},variant:{dark:"bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900",light:"bg-white text-gray-900 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:border-gray-700",info:"bg-blue-600 text-white dark:bg-blue-500",success:"bg-emerald-600 text-white dark:bg-emerald-500",warning:"bg-amber-500 text-white dark:bg-amber-400 dark:text-gray-900",danger:"bg-red-600 text-white dark:bg-red-500"},rounded:"rounded-lg",shadow:"shadow-lg",maxWidth:"max-w-xs"},arrow:{base:"absolute w-0 h-0 pointer-events-none",size:"border-[6px]",variant:{dark:"border-gray-900 dark:border-gray-100",light:"border-white dark:border-gray-800",info:"border-blue-600 dark:border-blue-500",success:"border-emerald-600 dark:border-emerald-500",warning:"border-amber-500 dark:border-amber-400",danger:"border-red-600 dark:border-red-500"},placement:{top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"}}};import{jsxDEV as Oa}from"react/jsx-dev-runtime";var Kd={top:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-[6px] border-l-transparent border-r-transparent border-b-transparent",bottom:"absolute left-1/2 -translate-x-1/2 bottom-full w-0 h-0 border-[6px] border-l-transparent border-r-transparent border-t-transparent",left:"absolute top-1/2 -translate-y-1/2 left-full w-0 h-0 border-[6px] border-t-transparent border-b-transparent border-r-transparent",right:"absolute top-1/2 -translate-y-1/2 right-full w-0 h-0 border-[6px] border-t-transparent border-b-transparent border-l-transparent"},ug={dark:"rgb(17 24 39)",light:"rgb(255 255 255)",info:"rgb(37 99 235)",success:"rgb(5 150 105)",warning:"rgb(245 158 11)",danger:"rgb(220 38 38)"},gg={dark:"rgb(243 244 246)",light:"rgb(31 41 55)",info:"rgb(59 130 246)",success:"rgb(16 185 129)",warning:"rgb(251 191 36)",danger:"rgb(239 68 68)"};function mg(e,t,r){let n=r?gg:ug,a=n[e]??n.dark;if(t==="top")return{borderTopColor:a};if(t==="bottom")return{borderBottomColor:a};if(t==="left")return{borderLeftColor:a};if(t==="right")return{borderRightColor:a};return{}}function bg(e,t,r,n){if(e==="top"&&t.top-r.height-n<8)return"bottom";if(e==="bottom"&&t.bottom+r.height+n>window.innerHeight-8)return"top";if(e==="left"&&t.left-r.width-n<8)return"right";if(e==="right"&&t.right+r.width+n>window.innerWidth-8)return"left";return e}function fg(e,t,r,n){let a=0,i=0;if(e==="top")a=t.top-r.height-n,i=t.left+t.width/2-r.width/2;else if(e==="bottom")a=t.bottom+n,i=t.left+t.width/2-r.width/2;else if(e==="left")a=t.top+t.height/2-r.height/2,i=t.left-r.width-n;else if(e==="right")a=t.top+t.height/2-r.height/2,i=t.right+n;return i=Math.max(4,Math.min(i,window.innerWidth-r.width-4)),a=Math.max(4,Math.min(a,window.innerHeight-r.height-4)),{top:a,left:i}}function qa({children:e,content:t,placement:r="top",trigger:n="hover",variant:a="dark",size:i="md",delay:o=0,offset:s=8,disabled:l=!1,showArrow:c=!0,maxWidth:d,className:g,contentClassName:h}){let[k,u]=cg(!1),S=Fa(null),f=Fa(null),P=Fa(null),x=Fa(!1),z=$a,m=($)=>{if(f.current=$,!$||!x.current||!S.current)return;x.current=!1;let J=!!S.current.closest(".dark"),U=$.parentElement;if(U)U.classList.toggle("dark",J);let E=S.current.getBoundingClientRect(),K=$.getBoundingClientRect(),M=bg(r,E,K,s),{top:Q,left:N}=fg(M,E,K,s);$.style.top=`${Q}px`,$.style.left=`${N}px`;let O=$.querySelector("[data-arrow]");if(O){O.className=Kd[M]??"";let I=mg(a??"dark",M,J);if(O.style.borderTopColor="",O.style.borderBottomColor="",O.style.borderLeftColor="",O.style.borderRightColor="",I.borderTopColor)O.style.borderTopColor=I.borderTopColor;if(I.borderBottomColor)O.style.borderBottomColor=I.borderBottomColor;if(I.borderLeftColor)O.style.borderLeftColor=I.borderLeftColor;if(I.borderRightColor)O.style.borderRightColor=I.borderRightColor}_a.killTweensOf($);let A={opacity:0,duration:0.2,ease:"power2.out"},D={opacity:1,duration:0.2,ease:"power2.out"};if(M==="top")A.y=4,D.y=0;else if(M==="bottom")A.y=-4,D.y=0;else if(M==="left")A.x=4,D.x=0;else if(M==="right")A.x=-4,D.x=0;_a.fromTo($,A,D)},y=()=>{if(P.current!==null)window.clearTimeout(P.current),P.current=null},v=()=>{if(l)return;y();let $=()=>{x.current=!0,u(!0)};if(o>0)P.current=window.setTimeout($,o);else $()},p=()=>{y(),x.current=!1;let $=f.current;if(!$){u(!1);return}_a.killTweensOf($),_a.to($,{opacity:0,duration:0.15,ease:"power2.in",onComplete:()=>u(!1)})},b={};if(n==="hover")b.onMouseEnter=v,b.onMouseLeave=p;else if(n==="click")b.onClick=()=>k?p():v();else if(n==="focus")b.onFocus=v,b.onBlur=p;let R=k?pg(Oa("span",{children:Oa("span",{ref:m,role:"tooltip",className:w("fixed z-[9999] pointer-events-none whitespace-normal break-words text-center",z.tooltip.size[i],z.tooltip.variant[a],z.tooltip.rounded,z.tooltip.shadow,h),style:{maxWidth:d?`${d}px`:"320px",opacity:0},children:[t,c&&Oa("span",{"data-arrow":"",className:Kd[r],"aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body):null;return Oa("span",{ref:S,className:w("relative inline-flex",g),...b,children:[e,R]},void 0,!0,void 0,this)}import{jsxDEV as Nt}from"react/jsx-dev-runtime";var hg=(e)=>{let[t,r]=Zr(e.checked===!0);return Nt(hr,{checked:t,onChange:r,variant:e.variant||"checkbox",size:e.size||"md",color:e.color||"primary",label:e.label!==null&&e.label!==void 0?String(e.label):"Checkbox label",labelPosition:e.labelPosition||"right",disabled:e.disabled===!0,indeterminate:e.indeterminate===!0,helperText:e.helperText?String(e.helperText):void 0,errorMessage:e.errorMessage?String(e.errorMessage):void 0},void 0,!1,void 0,this)},yg=(e)=>{let[t,r]=Zr(null);return Nt(Sn,{mode:"single",value:t,onChange:(n)=>r(n),placeholder:e.placeholder?String(e.placeholder):"Select date...",label:e.label?String(e.label):void 0,disabled:e.disabled===!0,showClearButton:e.showClearButton!==!1,showTodayButton:e.showTodayButton!==!1},void 0,!1,void 0,this)},wg=(e)=>{let[t,r]=Zr(e.value?String(e.value):"");return Nt(Ee,{value:t,onChange:r,type:e.type||"text",label:e.label?String(e.label):void 0,placeholder:e.placeholder?String(e.placeholder):"Type something...",size:e.size||"md",disabled:e.disabled===!0,readOnly:e.readOnly===!0,fullWidth:e.fullWidth!==!1,helperText:e.helperText?String(e.helperText):void 0,errorMessage:e.errorMessage?String(e.errorMessage):void 0,showValidationIcon:e.showValidationIcon===!0},void 0,!1,void 0,this)},kg=(e)=>{let[t,r]=Zr({min:20,max:80});return Nt(Cn,{value:t,onChange:r,min:typeof e.min==="number"?e.min:0,max:typeof e.max==="number"?e.max:100,step:typeof e.step==="number"?e.step:1,size:e.size||"md",variant:e.variant||"default",orientation:e.orientation||"horizontal",showTooltip:e.showTooltip!==!1,showLabels:e.showLabels!==!1,disabled:e.disabled===!0,label:e.label?String(e.label):void 0},void 0,!1,void 0,this)},vg=[{id:"1",data:{name:"Button",category:"Inputs"}},{id:"2",data:{name:"Checkbox",category:"Inputs"}},{id:"3",data:{name:"DataTable",category:"Data"}},{id:"4",data:{name:"DatePicker",category:"Inputs"}},{id:"5",data:{name:"TextInput",category:"Inputs"}},{id:"6",data:{name:"RangePicker",category:"Inputs"}},{id:"7",data:{name:"SearchBox",category:"Inputs"}},{id:"8",data:{name:"SelectBox",category:"Inputs"}},{id:"9",data:{name:"Dialog",category:"Feedback"}},{id:"10",data:{name:"Tooltip",category:"Display"}}],xg=(e)=>{let[t,r]=Zr(""),[n,a]=Zr([]),[i,o]=Zr(!1);return Nt(Pn,{value:t,onChange:r,onSearch:(l)=>{if(!l.trim()){a([]);return}o(!0);let c=window.setTimeout(()=>{let d=vg.filter((g)=>g.data.name.toLowerCase().includes(l.toLowerCase()));a(d),o(!1)},200);return()=>window.clearTimeout(c)},results:n,renderItem:(l)=>Nt("span",{className:"flex items-center justify-between w-full px-3 py-2",children:[Nt("span",{className:"text-sm font-medium text-slate-800 dark:text-slate-200",children:l.data.name},void 0,!1,void 0,this),Nt("span",{className:"text-xs text-slate-400 dark:text-slate-500",children:l.data.category},void 0,!1,void 0,this)]},void 0,!0,void 0,this),onSelect:(l)=>r(l.data.name),placeholder:e.placeholder?String(e.placeholder):"Search...",label:e.label?String(e.label):void 0,disabled:e.disabled===!0,loading:e.loading===!0||i,showClearButton:e.showClearButton!==!1,showSearchIcon:e.showSearchIcon!==!1,disableDropdown:e.disableDropdown===!0,debounceMs:typeof e.debounceMs==="number"?e.debounceMs:300},void 0,!1,void 0,this)},zg=(e)=>{let[t,r]=Zr(void 0);return Nt(dr,{options:[{value:"react",label:"React"},{value:"vue",label:"Vue"},{value:"angular",label:"Angular"},{value:"svelte",label:"Svelte"},{value:"solid",label:"SolidJS"}],value:t,onChange:(a)=>r(a),placeholder:e.placeholder?String(e.placeholder):"Select...",label:e.label?String(e.label):void 0,size:e.size||"md",variant:e.variant||"default",disabled:e.disabled===!0,clearable:e.clearable===!0,searchable:e.searchable===!0,loading:e.loading===!0},void 0,!1,void 0,this)},Ja=["Alice Johnson","Bob Smith","Charlie Brown","Diana Prince","Eve Wilson","Frank Castle","Grace Hopper","Henry Ford","Iris West","Jack Daniels","Karen Page","Leo Messi","Maya Angelou","Noah Bennett","Olivia Pope","Paul Graham","Quinn Hughes","Rachel Green","Sam Altman","Tina Turner"],Zd=["Admin","Editor","Viewer","Manager","Developer"],Qd=["Active","Inactive","Pending","Suspended"],Xd=["Engineering","Design","Marketing","Sales","Support","HR"];function Ng(e){return Array.from({length:e},(t,r)=>({id:r+1,name:Ja[r%Ja.length]??`User ${r+1}`,email:`${(Ja[r%Ja.length]??"user").split(" ")[0]?.toLowerCase()}${r+1}@example.com`,role:Zd[r%Zd.length]??"Viewer",status:Qd[r%Qd.length]??"Active",department:Xd[r%Xd.length]??"Engineering",joined:`2024-${String(r%12+1).padStart(2,"0")}-${String(r%28+1).padStart(2,"0")}`}))}var Sg=[{key:"id",header:"ID",width:60,sortable:!0},{key:"name",header:"Name",sortable:!0},{key:"email",header:"Email",sortable:!0},{key:"role",header:"Role",sortable:!0},{key:"status",header:"Status",sortable:!0},{key:"department",header:"Department",sortable:!0},{key:"joined",header:"Joined",sortable:!0}],Cg=(e)=>{let t=typeof e.rowCount==="number"?Math.max(0,Math.min(e.rowCount,100)):5,r=e.showDepartment===!0,n=e.showJoined===!0,a=Sg.filter((o)=>{if(o.key==="department")return r;if(o.key==="joined")return n;return!0}),i=Ng(t);return Nt(kn,{data:e.showEmptyState===!0?[]:i,columns:a,keyExtractor:(o)=>o.id,isLoading:e.isLoading===!0,isPending:e.isPending===!0,config:{enableSelection:e.enableSelection===!0,isFrontendSort:e.isFrontendSort!==!1,hasClickAction:e.hasClickAction===!0,hasDoubleClickAction:e.hasDoubleClickAction===!0,enableInfiniteScroll:e.enableInfiniteScroll===!0,defaultColumnWidth:typeof e.defaultColumnWidth==="number"?e.defaultColumnWidth:150,defaultRowHeight:typeof e.defaultRowHeight==="number"?e.defaultRowHeight:48,minColumnWidth:typeof e.minColumnWidth==="number"?e.minColumnWidth:60,pageSize:typeof e.pageSize==="number"?e.pageSize:20,selectionColumnWidth:typeof e.selectionColumnWidth==="number"?e.selectionColumnWidth:48},skeletonRowCount:typeof e.skeletonRowCount==="number"?e.skeletonRowCount:5,emptyMessage:e.emptyMessage?String(e.emptyMessage):"No data available"},void 0,!1,void 0,this)};function Ho(){return[{id:"button",name:"Button",description:"Versatile button component with multiple variants, sizes, shapes, and states.",category:"inputs",importPath:"import { Button } from 'nucleus-core-ts/fe'",props:[{name:"children",type:"text",defaultValue:"Click me",description:"Button label text"},{name:"variant",type:"select",defaultValue:"nucleus",description:"Visual style variant",options:[{label:"Nucleus",value:"nucleus"},{label:"Nucleus Outline",value:"nucleus-outline"},{label:"Nucleus Ghost",value:"nucleus-ghost"},{label:"Nucleus Soft",value:"nucleus-soft"},{label:"Primary",value:"primary"},{label:"Secondary",value:"secondary"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"},{label:"Ghost",value:"ghost"},{label:"Outline",value:"outline"},{label:"Link",value:"link"}]},{name:"size",type:"select",defaultValue:"md",description:"Button size",options:[{label:"XS",value:"xs"},{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"},{label:"XL",value:"xl"}]},{name:"shape",type:"select",defaultValue:"default",description:"Button border radius shape",options:[{label:"Default",value:"default"},{label:"Rounded",value:"rounded"},{label:"Pill",value:"pill"},{label:"Square",value:"square"}]},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading spinner"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the button"},{name:"fullWidth",type:"boolean",defaultValue:!1,description:"Stretch to full container width"},{name:"ripple",type:"boolean",defaultValue:!1,description:"Enable ripple click effect"},{name:"pulse",type:"boolean",defaultValue:!1,description:"Enable pulse animation"}],examples:[{title:"Default",props:{children:"Click me",variant:"nucleus",size:"md"}},{title:"Primary Large",props:{children:"Submit",variant:"primary",size:"lg",shape:"pill"}},{title:"Danger",props:{children:"Delete",variant:"danger",size:"sm"}},{title:"Loading",props:{children:"Processing...",variant:"primary",loading:!0}},{title:"Full Width",props:{children:"Full Width",variant:"nucleus",fullWidth:!0}}],render:(e)=>Nt(se,{variant:e.variant||"nucleus",size:e.size||"md",shape:e.shape||"default",loading:e.loading===!0,disabled:e.disabled===!0,fullWidth:e.fullWidth===!0,ripple:e.ripple===!0,pulse:e.pulse===!0,children:e.children?String(e.children):"Click me"},void 0,!1,void 0,this)},{id:"checkbox",name:"Checkbox",description:"Checkbox and switch toggle component with multiple colors and sizes.",category:"inputs",importPath:"import { Checkbox } from 'nucleus-core-ts/fe'",props:[{name:"checked",type:"boolean",defaultValue:!1,description:"Checked state"},{name:"variant",type:"select",defaultValue:"checkbox",description:"Checkbox or switch mode",options:[{label:"Checkbox",value:"checkbox"},{label:"Switch",value:"switch"}]},{name:"size",type:"select",defaultValue:"md",description:"Component size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"color",type:"select",defaultValue:"primary",description:"Accent color",options:[{label:"Primary",value:"primary"},{label:"Secondary",value:"secondary"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"},{label:"Info",value:"info"}]},{name:"label",type:"text",defaultValue:"Checkbox label",description:"Label text"},{name:"labelPosition",type:"select",defaultValue:"right",description:"Label position relative to control",options:[{label:"Left",value:"left"},{label:"Right",value:"right"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the control"},{name:"indeterminate",type:"boolean",defaultValue:!1,description:"Indeterminate state (checkbox only)"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below control"},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message"}],examples:[{title:"Default Checkbox",props:{variant:"checkbox",label:"Accept terms"}},{title:"Switch",props:{variant:"switch",label:"Enable notifications",color:"success"}},{title:"Indeterminate",props:{variant:"checkbox",indeterminate:!0,label:"Select all"}},{title:"With Error",props:{variant:"checkbox",label:"Required field",errorMessage:"This field is required"}}],render:(e)=>Nt(hg,{...e},void 0,!1,void 0,this)},{id:"datatable",name:"DataTable",description:"Feature-rich data table with sorting, resizable columns, selection, infinite scroll, and inline editing.",category:"data",importPath:"import { DataTable } from 'nucleus-core-ts/fe'",props:[{name:"rowCount",type:"number",defaultValue:5,description:"Number of sample data rows to display",min:0,max:100},{name:"showDepartment",type:"boolean",defaultValue:!1,description:"Show 'Department' column"},{name:"showJoined",type:"boolean",defaultValue:!1,description:"Show 'Joined' date column"},{name:"emptyMessage",type:"text",defaultValue:"No data available",description:"Message shown when data is empty"},{name:"showEmptyState",type:"boolean",defaultValue:!1,description:"Force empty state (renders with no data)"},{name:"isLoading",type:"boolean",defaultValue:!1,description:"Show full loading spinner overlay"},{name:"isPending",type:"boolean",defaultValue:!1,description:"Show skeleton table while data is pending"},{name:"enableSelection",type:"boolean",defaultValue:!1,description:"Enable row selection checkboxes"},{name:"isFrontendSort",type:"boolean",defaultValue:!0,description:"Sort data on the frontend (client-side sorting)"},{name:"hasClickAction",type:"boolean",defaultValue:!1,description:"Enable single-click action on cells (shows pointer cursor)"},{name:"hasDoubleClickAction",type:"boolean",defaultValue:!1,description:"Enable double-click action on cells"},{name:"enableInfiniteScroll",type:"boolean",defaultValue:!1,description:"Enable infinite scroll loading for large datasets"},{name:"defaultColumnWidth",type:"number",defaultValue:150,description:"Default width (px) for columns without explicit width",min:60,max:500},{name:"defaultRowHeight",type:"number",defaultValue:48,description:"Default row height (px)",min:32,max:120},{name:"minColumnWidth",type:"number",defaultValue:60,description:"Minimum column width (px) when resizing",min:30,max:200},{name:"pageSize",type:"number",defaultValue:20,description:"Number of rows per page (for infinite scroll)",min:5,max:100},{name:"skeletonRowCount",type:"number",defaultValue:5,description:"Number of skeleton rows shown during isPending",min:1,max:20},{name:"selectionColumnWidth",type:"number",defaultValue:48,description:"Width (px) of the selection checkbox column",min:32,max:80}],examples:[{title:"Default (5 rows)",props:{rowCount:5}},{title:"Large Dataset (20 rows)",props:{rowCount:20}},{title:"All Columns",props:{rowCount:10,showDepartment:!0,showJoined:!0}},{title:"With Selection",props:{rowCount:8,enableSelection:!0}},{title:"Loading Spinner",props:{isLoading:!0}},{title:"Skeleton Loading",props:{isPending:!0,skeletonRowCount:5}},{title:"Empty State",props:{showEmptyState:!0,emptyMessage:"No records found"}},{title:"Click Actions",props:{rowCount:5,hasClickAction:!0,hasDoubleClickAction:!0}}],render:(e)=>Nt(Cg,{...e},void 0,!1,void 0,this)},{id:"datepicker",name:"DatePicker",description:"Calendar date picker with single and range modes, locale support, and customizable constraints.",category:"inputs",importPath:"import { DatePicker } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Select date...",description:"Input placeholder text"},{name:"label",type:"text",defaultValue:null,description:"Label above the input"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the picker"},{name:"showClearButton",type:"boolean",defaultValue:!0,description:"Show clear button when date selected"},{name:"showTodayButton",type:"boolean",defaultValue:!0,description:'Show "Today" quick-select button'},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message below input"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below input"},{name:"required",type:"boolean",defaultValue:!1,description:"Mark as required"}],examples:[{title:"Default",props:{placeholder:"Select date..."}},{title:"With Label",props:{label:"Start Date",placeholder:"Pick a date"}},{title:"Required with Error",props:{label:"Due Date",required:!0,errorMessage:"Date is required"}}],render:(e)=>Nt(yg,{...e},void 0,!1,void 0,this)},{id:"textinput",name:"TextInput",description:"Rich text input with floating labels, validation, formatting, password strength, and multiple input types.",category:"inputs",importPath:"import { NucleusTextInput } from 'nucleus-core-ts/fe'",props:[{name:"value",type:"text",defaultValue:"",description:"Input value"},{name:"type",type:"select",defaultValue:"text",description:"Input type",options:[{label:"Text",value:"text"},{label:"Email",value:"email"},{label:"Password",value:"password"},{label:"URL",value:"url"},{label:"Tel",value:"tel"},{label:"Number",value:"number"}]},{name:"label",type:"text",defaultValue:null,description:"Floating label text"},{name:"placeholder",type:"text",defaultValue:"Type something...",description:"Placeholder text"},{name:"size",type:"select",defaultValue:"md",description:"Input size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the input"},{name:"readOnly",type:"boolean",defaultValue:!1,description:"Make read-only"},{name:"fullWidth",type:"boolean",defaultValue:!0,description:"Stretch to full width"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text below input"},{name:"errorMessage",type:"text",defaultValue:null,description:"Error message"},{name:"showValidationIcon",type:"boolean",defaultValue:!1,description:"Show validation status icon"}],examples:[{title:"Default",props:{placeholder:"Enter your name..."}},{title:"With Label",props:{label:"Email Address",type:"email",placeholder:"you@example.com"}},{title:"Password",props:{label:"Password",type:"password",placeholder:"Enter password"}},{title:"With Error",props:{label:"Username",errorMessage:"Username already taken",value:"john"}}],render:(e)=>Nt(wg,{...e},void 0,!1,void 0,this)},{id:"rangepicker",name:"RangePicker",description:"Dual-thumb range slider with tooltips, labels, ticks, and multiple visual variants.",category:"inputs",importPath:"import { RangePicker } from 'nucleus-core-ts/fe'",props:[{name:"min",type:"number",defaultValue:0,description:"Minimum value",min:0,max:100},{name:"max",type:"number",defaultValue:100,description:"Maximum value",min:0,max:1000},{name:"step",type:"number",defaultValue:1,description:"Step increment",min:1,max:50},{name:"size",type:"select",defaultValue:"md",description:"Slider size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"variant",type:"select",defaultValue:"default",description:"Visual variant",options:[{label:"Default",value:"default"},{label:"Filled",value:"filled"},{label:"Minimal",value:"minimal"}]},{name:"orientation",type:"select",defaultValue:"horizontal",description:"Slider orientation",options:[{label:"Horizontal",value:"horizontal"},{label:"Vertical",value:"vertical"}]},{name:"showTooltip",type:"boolean",defaultValue:!0,description:"Show value tooltips on thumbs"},{name:"showLabels",type:"boolean",defaultValue:!0,description:"Show min/max labels"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the slider"},{name:"label",type:"text",defaultValue:null,description:"Label above the slider"}],examples:[{title:"Default",props:{min:0,max:100}},{title:"Price Range",props:{min:0,max:1000,step:10,label:"Price Range ($)"}},{title:"Filled Variant",props:{variant:"filled",showTooltip:!0}}],render:(e)=>Nt(kg,{...e},void 0,!1,void 0,this)},{id:"searchbox",name:"SearchBox",description:"Search input with debounced queries, autocomplete dropdown, keyboard navigation, and XSS protection.",category:"inputs",importPath:"import { SearchBox } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Search...",description:"Input placeholder"},{name:"label",type:"text",defaultValue:null,description:"Label above input"},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the search box"},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading state in dropdown"},{name:"showClearButton",type:"boolean",defaultValue:!0,description:"Show clear button"},{name:"showSearchIcon",type:"boolean",defaultValue:!0,description:"Show search icon"},{name:"disableDropdown",type:"boolean",defaultValue:!1,description:"Disable dropdown results"},{name:"debounceMs",type:"number",defaultValue:300,description:"Debounce delay (ms)",min:0,max:2000}],examples:[{title:"Default",props:{placeholder:"Search..."}},{title:"Loading",props:{placeholder:"Searching...",loading:!0}},{title:"No Dropdown",props:{placeholder:"Filter...",disableDropdown:!0,showSearchIcon:!0}}],render:(e)=>Nt(xg,{...e},void 0,!1,void 0,this)},{id:"selectbox",name:"SelectBox",description:"Dropdown select with search, custom rendering, keyboard navigation, and multiple variants.",category:"inputs",importPath:"import { SelectBox } from 'nucleus-core-ts/fe'",props:[{name:"placeholder",type:"text",defaultValue:"Select...",description:"Placeholder text"},{name:"label",type:"text",defaultValue:null,description:"Label above select"},{name:"size",type:"select",defaultValue:"md",description:"Component size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"variant",type:"select",defaultValue:"default",description:"Visual variant",options:[{label:"Default",value:"default"},{label:"Filled",value:"filled"},{label:"Ghost",value:"ghost"}]},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the select"},{name:"clearable",type:"boolean",defaultValue:!1,description:"Allow clearing value"},{name:"searchable",type:"boolean",defaultValue:!1,description:"Enable search within options"},{name:"loading",type:"boolean",defaultValue:!1,description:"Show loading state"},{name:"error",type:"text",defaultValue:null,description:"Error message"},{name:"helperText",type:"text",defaultValue:null,description:"Helper text"},{name:"required",type:"boolean",defaultValue:!1,description:"Mark as required"}],examples:[{title:"Default",props:{placeholder:"Choose framework..."}},{title:"Searchable",props:{placeholder:"Search frameworks...",searchable:!0,clearable:!0}},{title:"With Label",props:{label:"Framework",placeholder:"Select one",required:!0}},{title:"Filled Variant",props:{variant:"filled",placeholder:"Choose..."}}],render:(e)=>Nt(zg,{...e},void 0,!1,void 0,this)},{id:"tooltip",name:"Tooltip",description:"Lightweight tooltip with GSAP animations, multiple placements, variants, triggers, and arrow support.",category:"display",importPath:"import { Tooltip } from 'nucleus-core-ts/fe'",props:[{name:"content",type:"text",defaultValue:"Tooltip content",description:"Text or content to display inside the tooltip"},{name:"placement",type:"select",defaultValue:"top",description:"Tooltip placement relative to trigger element",options:[{label:"Top",value:"top"},{label:"Bottom",value:"bottom"},{label:"Left",value:"left"},{label:"Right",value:"right"}]},{name:"trigger",type:"select",defaultValue:"hover",description:"How the tooltip is triggered",options:[{label:"Hover",value:"hover"},{label:"Click",value:"click"},{label:"Focus",value:"focus"}]},{name:"variant",type:"select",defaultValue:"dark",description:"Visual color variant",options:[{label:"Dark",value:"dark"},{label:"Light",value:"light"},{label:"Info",value:"info"},{label:"Success",value:"success"},{label:"Warning",value:"warning"},{label:"Danger",value:"danger"}]},{name:"size",type:"select",defaultValue:"md",description:"Tooltip size",options:[{label:"SM",value:"sm"},{label:"MD",value:"md"},{label:"LG",value:"lg"}]},{name:"delay",type:"number",defaultValue:0,description:"Delay (ms) before showing the tooltip",min:0,max:2000},{name:"offset",type:"number",defaultValue:8,description:"Distance (px) from trigger element",min:0,max:32},{name:"disabled",type:"boolean",defaultValue:!1,description:"Disable the tooltip"},{name:"showArrow",type:"boolean",defaultValue:!0,description:"Show directional arrow on tooltip"},{name:"maxWidth",type:"number",defaultValue:320,description:"Max width (px) of the tooltip",min:100,max:600}],examples:[{title:"Default",props:{content:"Helpful tooltip text",placement:"top"}},{title:"Bottom Placement",props:{content:"Bottom tooltip",placement:"bottom"}},{title:"Click Trigger",props:{content:"Click to toggle",trigger:"click",variant:"light"}},{title:"Info Variant",props:{content:"This is an informational tooltip",variant:"info"}},{title:"Danger Variant",props:{content:"This action is destructive!",variant:"danger",placement:"right"}},{title:"With Delay",props:{content:"Appears after 500ms",delay:500,variant:"success"}}],render:(e)=>Nt(qa,{content:e.content?String(e.content):"Tooltip content",placement:e.placement||"top",trigger:e.trigger||"hover",variant:e.variant||"dark",size:e.size||"md",delay:typeof e.delay==="number"?e.delay:0,offset:typeof e.offset==="number"?e.offset:8,disabled:e.disabled===!0,showArrow:e.showArrow!==!1,maxWidth:typeof e.maxWidth==="number"?e.maxWidth:320,children:Nt("button",{type:"button",className:"px-4 py-2 rounded-lg bg-slate-200 dark:bg-slate-700 text-slate-800 dark:text-slate-200 text-sm font-medium hover:bg-slate-300 dark:hover:bg-slate-600 transition-colors",children:"Hover me"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}]}import{useGSAP as Ed}from"@gsap/react";import Dd from"gsap";import{useRef as Pg}from"react";var sn={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-6xl mx-auto px-4 py-8 sm:px-6 lg:px-8"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",titleWrapper:"flex-1",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white",subtitle:"mt-1 text-sm sm:text-base text-zinc-600 dark:text-zinc-400",badge:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 ml-3",actions:"flex-shrink-0"},stats:{container:"grid grid-cols-3 gap-4 mb-8 p-4 rounded-xl bg-zinc-50 dark:bg-zinc-800/50",item:"text-center",value:"text-2xl font-bold text-zinc-900 dark:text-white",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"},deviceList:{container:"mt-6",grid:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"}},deviceCard:{base:"group relative flex flex-col transition-all duration-200",padding:"p-4 sm:p-5",background:"bg-white dark:bg-zinc-800/60",backgroundCurrent:"bg-blue-50/50 dark:bg-blue-900/10",border:"border border-zinc-200 dark:border-zinc-700/50",borderCurrent:"border-blue-300 dark:border-blue-700/50",shadow:"shadow-sm",rounded:"rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3 mb-3",icon:"flex-shrink-0 w-10 h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",iconCurrent:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",info:"flex-1 min-w-0",deviceName:"font-medium text-zinc-900 dark:text-white truncate",deviceType:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5"},details:{container:"space-y-2 text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"},footer:{container:"flex items-center justify-between mt-4 pt-4 border-t border-zinc-100 dark:border-zinc-700/50",currentBadge:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",revokeButton:"text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 font-medium transition-colors"},trustScore:{container:"mt-3",bar:"h-1.5 w-full bg-zinc-200 dark:bg-zinc-700 rounded-full overflow-hidden",barFill:"h-full rounded-full transition-all duration-300",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-2xl shadow-2xl max-w-md w-full p-6",title:"text-lg font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 mb-6",actions:"flex gap-3 justify-end"},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400"}};import{jsxDEV as Oe}from"react/jsx-dev-runtime";Dd.registerPlugin(Ed);function Tg(e){switch(e?.toLowerCase()){case"mobile":return Oe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Mobile device",children:[Oe("title",{children:"Mobile device"},void 0,!1,void 0,this),Oe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"tablet":return Oe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Tablet device",children:[Oe("title",{children:"Tablet device"},void 0,!1,void 0,this),Oe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);default:return Oe("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Desktop device",children:[Oe("title",{children:"Desktop device"},void 0,!1,void 0,this),Oe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}function Lg(e){if(!e)return"bg-zinc-400";if(e>=80)return"bg-green-500";if(e>=60)return"bg-yellow-500";if(e>=40)return"bg-orange-500";return"bg-red-500"}function Ud(e){if(!e)return"Unknown";return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ga({device:e,isCurrent:t=!1,onRevoke:r,isRevoking:n=!1}){let a=sn,i=Pg(null);Ed(()=>{if(!i.current)return;Dd.fromTo(i.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.4,ease:"power2.out"})},{scope:i});let o=e.deviceName||`${e.browserName||"Unknown"} on ${e.osName||"Unknown"}`;return Oe("article",{ref:i,className:w(a.deviceCard.base,a.deviceCard.padding,t?a.deviceCard.backgroundCurrent:a.deviceCard.background,t?a.deviceCard.borderCurrent:a.deviceCard.border,a.deviceCard.shadow,a.deviceCard.rounded,!t&&a.deviceCard.hover),children:[Oe("header",{className:a.deviceCard.header.container,children:[Oe("div",{className:w(a.deviceCard.header.icon,t&&a.deviceCard.header.iconCurrent),children:Tg(e.deviceType)},void 0,!1,void 0,this),Oe("div",{className:a.deviceCard.header.info,children:[Oe("h3",{className:a.deviceCard.header.deviceName,children:o},void 0,!1,void 0,this),Oe("p",{className:a.deviceCard.header.deviceType,children:[e.deviceType||"Desktop"," \u2022 ",e.browserName," ",e.browserVersion]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Oe("dl",{className:a.deviceCard.details.container,children:[Oe("div",{className:a.deviceCard.details.row,children:[Oe("dt",{className:a.deviceCard.details.label,children:"IP Address"},void 0,!1,void 0,this),Oe("dd",{className:a.deviceCard.details.value,children:e.ipAddress||"Unknown"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.locationCity&&Oe("div",{className:a.deviceCard.details.row,children:[Oe("dt",{className:a.deviceCard.details.label,children:"Location"},void 0,!1,void 0,this),Oe("dd",{className:a.deviceCard.details.value,children:[e.locationCity,e.locationCountry?`, ${e.locationCountry}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Oe("div",{className:a.deviceCard.details.row,children:[Oe("dt",{className:a.deviceCard.details.label,children:"Last Active"},void 0,!1,void 0,this),Oe("dd",{className:a.deviceCard.details.value,children:Ud(e.lastActivityAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Oe("div",{className:a.deviceCard.details.row,children:[Oe("dt",{className:a.deviceCard.details.label,children:"First Seen"},void 0,!1,void 0,this),Oe("dd",{className:a.deviceCard.details.value,children:Ud(e.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.trustScore!==void 0&&Oe("div",{className:a.deviceCard.trustScore.container,children:[Oe("div",{className:a.deviceCard.trustScore.bar,children:Oe("div",{className:w(a.deviceCard.trustScore.barFill,Lg(e.trustScore)),style:{width:`${e.trustScore}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe("p",{className:a.deviceCard.trustScore.label,children:["Trust Score: ",e.trustScore,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Oe("footer",{className:a.deviceCard.footer.container,children:[t?Oe("span",{className:a.deviceCard.footer.currentBadge,children:[Oe("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:Oe("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Current Device"]},void 0,!0,void 0,this):Oe("span",{},void 0,!1,void 0,this),r&&!t&&Oe("button",{type:"button",onClick:()=>r(e.id),disabled:n,className:w(a.deviceCard.footer.revokeButton,n&&"opacity-50 cursor-not-allowed"),children:n?"Revoking...":"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as dn}from"react/jsx-dev-runtime";function Aa({title:e="Active Devices",subtitle:t="Manage devices that have access to your account",totalDevices:r=0,onRevokeAll:n,isRevokingAll:a=!1,allowRevokeAll:i=!0}){let o=sn;return dn("header",{className:o.header.container,children:[dn("div",{className:o.header.titleWrapper,children:[dn("h1",{className:o.header.title,children:[e,r>0&&dn("span",{className:o.header.badge,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),dn("p",{className:o.header.subtitle,children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&r>1&&n&&dn("div",{className:o.header.actions,children:dn(se,{variant:"outline",size:"sm",onClick:n,disabled:a,className:"text-red-600 border-red-200 hover:bg-red-50 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20",children:a?"Revoking...":"Revoke All Other Devices"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as jd}from"@gsap/react";import ec from"gsap";import{useEffect as Wg,useEffectEvent as $o,useRef as Vd,useState as Ka}from"react";import{batch as Mg,createStore as Rg}from"h-state";var Bg={devices:[],currentSessionId:null,isLoading:!1,isRevoking:null,isRevokingAll:!1,error:null,stats:null},{useStore:Ya}=Rg(Bg,{setDevices:(e)=>(t)=>{e.devices=t},setCurrentSessionId:(e)=>(t)=>{e.currentSessionId=t},setLoading:(e)=>(t)=>{e.isLoading=t},setRevoking:(e)=>(t)=>{e.isRevoking=t},setRevokingAll:(e)=>(t)=>{e.isRevokingAll=t},setError:(e)=>(t)=>{e.error=t},setStats:(e)=>(t)=>{e.stats=t},removeDevice:(e)=>(t)=>{e.devices=e.devices.filter((r)=>r.id!==t)},clearAllDevices:(e)=>(t)=>{if(t&&e.currentSessionId)e.devices=e.devices.filter((r)=>r.id===e.currentSessionId);else e.devices=[]},reset:(e)=>()=>{Mg(()=>{e.devices=[],e.currentSessionId=null,e.isLoading=!1,e.isRevoking=null,e.isRevokingAll=!1,e.error=null,e.stats=null})}});import{jsxDEV as we}from"react/jsx-dev-runtime";ec.registerPlugin(jd);function tc({variant:e="default",title:t="Active Devices",subtitle:r="Manage devices that have access to your account",sessionsAction:n,sessionRevokeAction:a,sessionRevokeAllAction:i,sessionsStatsAction:o,sessionsPendingAction:s,sessionApproveAction:l,sessionRejectAction:c,onDeviceRevoked:d,onAllDevicesRevoked:g,onDeviceApproved:h,onDeviceRejected:k,showBackground:u=!1,showStats:S=!0,showPendingDevices:f=!0,allowRevokeAll:P=!0,allowRevokeCurrent:x=!1,className:z}){let m=sn,y=Vd(null),v=Vd(null),[p,b]=Ka(!1),[R,$]=Ka(null),[J,U]=Ka([]),[E,K]=Ka(null),M=Ya(),Q=$o(()=>{M.setLoading(!0),M.setError(null),n.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data?.sessions)M.setDevices(ce.data.sessions),M.setCurrentSessionId(ce.data.currentSessionId||null);M.setLoading(!1)},onErrorHandle:(q)=>{M.setError(q instanceof Error?q.message:"Failed to load devices"),M.setLoading(!1)}})}),N=$o(()=>{if(!o)return;o.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data)M.setStats(ce.data)},onErrorHandle:()=>{}})}),O=$o(()=>{if(!s||!f)return;s.start({payload:void 0,onAfterHandle:(q)=>{let ce=q;if(ce?.data?.sessions)U(ce.data.sessions)},onErrorHandle:()=>{}})}),A=(q)=>{if(!l||!q.approvalToken)return;K(q.id),l.start({payload:{token:q.approvalToken},onAfterHandle:()=>{U((ce)=>ce.filter((oe)=>oe.id!==q.id)),K(null),h?.(q.id),Q()},onErrorHandle:()=>{K(null)}})},D=(q)=>{if(!c||!q.approvalToken)return;K(q.id),c.start({payload:{token:q.approvalToken},onAfterHandle:()=>{U((ce)=>ce.filter((oe)=>oe.id!==q.id)),K(null),k?.(q.id)},onErrorHandle:()=>{K(null)}})};Wg(()=>{if(Q(),S)N();if(f)O()},[S,f]),jd(()=>{if(!v.current)return;ec.fromTo(v.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:y});let I=(q)=>{$(q),b(!0)},_=()=>{if(!R)return;M.setRevoking(R),b(!1),a.start({payload:{_sessionId:R,reason:"user_revoked"},onAfterHandle:()=>{M.removeDevice(R),M.setRevoking(null),d?.(R),$(null)},onErrorHandle:(q)=>{M.setError(q instanceof Error?q.message:"Failed to revoke device"),M.setRevoking(null),$(null)}})},T=()=>{M.setRevokingAll(!0),i.start({payload:{excludeCurrent:!0,reason:"user_revoked_all"},onAfterHandle:()=>{M.clearAllDevices(!0),M.setRevokingAll(!1),g?.()},onErrorHandle:(q)=>{M.setError(q instanceof Error?q.message:"Failed to revoke all devices"),M.setRevokingAll(!1)}})},ie=M.devices.filter((q)=>q.id!==M.currentSessionId).length;return we("main",{ref:y,className:w(m.container.base,z),"aria-label":"Devices management page",children:[u&&we(xt,{},void 0,!1,void 0,this),we("div",{className:m.container.wrapper,children:we("article",{ref:v,className:w(m.card.base,m.card.padding,m.card.background,m.card.border,m.card.shadow,m.card.rounded),children:[we(Aa,{title:t,subtitle:r,totalDevices:M.devices.length,onRevokeAll:T,isRevokingAll:M.isRevokingAll,allowRevokeAll:P&&ie>0},void 0,!1,void 0,this),S&&M.stats&&we("div",{className:m.stats.container,children:[we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:M.stats.activeSessions},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"Active Sessions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:M.stats.uniqueDevices},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"Unique Devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("div",{className:m.stats.item,children:[we("p",{className:m.stats.value,children:M.stats.uniqueIpAddresses},void 0,!1,void 0,this),we("p",{className:m.stats.label,children:"IP Addresses"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M.error&&we("div",{className:m.error.container,children:we("p",{className:m.error.text,children:M.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),f&&J.length>0&&we("section",{className:"mb-8",children:[we("h2",{className:"text-lg font-semibold text-amber-600 mb-4 flex items-center gap-2",children:[we("span",{className:"inline-block w-2 h-2 bg-amber-500 rounded-full animate-pulse"},void 0,!1,void 0,this),"Pending Approval (",J.length,")"]},void 0,!0,void 0,this),we("div",{className:m.deviceList.grid,children:J.map((q)=>we("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 dark:bg-amber-900/20 dark:border-amber-800",children:[we("div",{className:"flex items-start gap-3 mb-3",children:[we("div",{className:"p-2 bg-amber-100 rounded-lg dark:bg-amber-800",children:we("svg",{className:"w-5 h-5 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[we("title",{children:"Device"},void 0,!1,void 0,this),we("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),we("div",{children:[we("p",{className:"font-medium text-gray-900 dark:text-white",children:q.deviceName||"Unknown Device"},void 0,!1,void 0,this),we("p",{className:"text-sm text-gray-500",children:[q.browserName," \u2022 ",q.osName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),we("div",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:[we("p",{children:["IP: ",q.ipAddress||"Unknown"]},void 0,!0,void 0,this),we("p",{children:["Requested:"," ",q.approvalRequestedAt?new Date(q.approvalRequestedAt).toLocaleString():"Unknown"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),we("div",{className:"flex gap-2",children:[we(se,{variant:"primary",size:"sm",onClick:()=>A(q),disabled:E===q.id,className:"flex-1 bg-green-600 hover:bg-green-700",children:E===q.id?"...":"\u2713 Approve"},void 0,!1,void 0,this),we(se,{variant:"outline",size:"sm",onClick:()=>D(q),disabled:E===q.id,className:"flex-1 text-red-600 border-red-200 hover:bg-red-50",children:E===q.id?"...":"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},q.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.isLoading?we("div",{className:m.loading.container,children:[we("div",{className:m.loading.spinner},void 0,!1,void 0,this),we("p",{className:m.loading.text,children:"Loading devices..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):M.devices.length===0?we("div",{className:m.deviceList.empty.container,children:[we("svg",{className:m.deviceList.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[we("title",{children:"No devices"},void 0,!1,void 0,this),we("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),we("p",{className:m.deviceList.empty.text,children:"No active devices found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):we("section",{className:m.deviceList.container,children:we("div",{className:m.deviceList.grid,children:M.devices.map((q)=>we(Ga,{device:q,isCurrent:q.id===M.currentSessionId||q.isCurrent,onRevoke:q.id!==M.currentSessionId&&!q.isCurrent||x?I:void 0,isRevoking:M.isRevoking===q.id},q.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),p&&we("div",{className:m.modal.overlay,onClick:()=>b(!1),onKeyDown:(q)=>q.key==="Escape"&&b(!1),role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:we("div",{className:m.modal.container,onClick:(q)=>q.stopPropagation(),onKeyDown:(q)=>q.stopPropagation(),role:"document",children:[we("h2",{id:"confirm-modal-title",className:m.modal.title,children:"Revoke Device Access"},void 0,!1,void 0,this),we("p",{className:m.modal.message,children:"Are you sure you want to revoke access for this device? The user will be logged out immediately."},void 0,!1,void 0,this),we("div",{className:m.modal.actions,children:[we(se,{variant:"outline",size:"sm",onClick:()=>{b(!1),$(null)},children:"Cancel"},void 0,!1,void 0,this),we(se,{variant:"primary",size:"sm",onClick:_,className:"bg-red-600 hover:bg-red-700",children:"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as _o}from"@gsap/react";import Qa from"gsap";import{useRef as rc}from"react";import{batch as Ig,createStore as Hg}from"h-state";var $g={email:"",step:"request",error:null},{useStore:Za}=Hg($g,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Ig(()=>{e.email="",e.step="request",e.error=null})}});var cn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as mt}from"react/jsx-dev-runtime";Qa.registerPlugin(_o);function nc({className:e}){return mt("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:mt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function _g({className:e}){return mt("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:mt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Fo({forgotPasswordAction:e,onBackToLogin:t,backToLoginHref:r}){let n=cn,a=rc(null),i=rc(null),o=Za(),{contextSafe:s}=_o({scope:a}),l=e.state.isPending,c=s((h)=>{if(h.preventDefault(),!o.email){o.setError("Please enter your email address"),d();return}o.setError(null),e.start({payload:{email:o.email},onAfterHandle:()=>{o.setStep("success")},onErrorHandle:(k)=>{let u=k instanceof Error?k.message:"Failed to send reset email. Please try again.";o.setError(u),d()}})}),d=s(()=>{if(!a.current)return;Qa.fromTo(a.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Qa.set(a.current,{x:0})}})});_o(()=>{if(o.step==="success"&&i.current)Qa.fromTo(i.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[o.step]});let g=()=>{if(t)t();else if(r)window.location.href=r};if(o.step==="success")return mt("div",{ref:i,className:n.success.container,children:[mt("div",{className:n.success.iconWrapper,children:mt(_g,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("h2",{className:n.success.title,children:"Check your email"},void 0,!1,void 0,this),mt("p",{className:n.success.message,children:["We've sent a password reset link to ",mt("strong",{children:o.email},void 0,!1,void 0,this),". Please check your inbox and follow the instructions."]},void 0,!0,void 0,this),mt("div",{className:n.links.container,children:mt("button",{type:"button",onClick:g,className:n.links.backToLogin,children:[mt(nc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return mt("form",{ref:a,onSubmit:c,className:n.form.container,noValidate:!0,children:[o.error&&mt("div",{className:n.error.container,role:"alert",children:mt("p",{className:n.error.text,children:o.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.form.spacing,children:[mt("div",{className:n.input.wrapper,children:mt(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:o.email,onChange:o.setEmail,disabled:l,enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.button.wrapper,children:mt(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:l,disabled:l,children:"Send Reset Link"},void 0,!1,void 0,this)},void 0,!1,void 0,this),mt("div",{className:n.links.container,children:mt("button",{type:"button",onClick:g,className:n.links.backToLogin,disabled:l,children:[mt(nc,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Qr}from"react/jsx-dev-runtime";function Fg({className:e}){return Qr("svg",{className:w("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Qr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Oo({logo:e,title:t,subtitle:r}){let n=cn;return Qr("header",{className:n.header.container,children:[e?Qr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):Qr("div",{className:n.header.iconWrapper,children:Qr(Fg,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Qr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),Qr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ic}from"@gsap/react";import oc from"gsap";import{useRef as ac}from"react";import{jsxDEV as Tn}from"react/jsx-dev-runtime";oc.registerPlugin(ic);function lc({logo:e,title:t="Forgot Password?",subtitle:r="No worries, we'll send you reset instructions.",forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i,showBackground:o=!0,className:s}){let l=cn,c=ac(null),d=ac(null);return ic(()=>{if(!d.current)return;oc.fromTo(d.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:c}),Tn("main",{ref:c,className:w(l.container.base,s),"aria-label":"Forgot password page",children:[o&&Tn(xt,{},void 0,!1,void 0,this),Tn("div",{className:l.container.wrapper,children:Tn("article",{ref:d,className:w(l.card.base,l.card.padding,l.card.background,l.card.border,l.card.shadow,l.card.rounded),children:[Tn(Oo,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Tn(Fo,{forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as dc}from"@gsap/react";import qo from"gsap";import{useRef as Jg}from"react";import{batch as sc,createStore as Og}from"h-state";var qg={email:"",password:"",rememberMe:!1,isLoading:!1,error:null,captchaId:null,captchaAnswer:"",isAuthenticated:!1,user:null},{useStore:Ln}=Og(qg,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t)=>{if(e.password=t,e.error)e.error=null},setRememberMe:(e)=>(t)=>{e.rememberMe=t},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},setCaptchaId:(e)=>(t)=>{e.captchaId=t},setCaptchaAnswer:(e)=>(t)=>{e.captchaAnswer=t},setAuthenticated:(e)=>(t,r)=>{sc(()=>{e.isAuthenticated=t,e.user=r??null})},reset:(e)=>()=>{sc(()=>{e.email="",e.password="",e.rememberMe=!1,e.isLoading=!1,e.error=null,e.captchaId=null,e.captchaAnswer=""})}});var pn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-center",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer"},links:{container:"flex items-center justify-between mt-1",forgotPassword:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signUp:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as Pt}from"react/jsx-dev-runtime";qo.registerPlugin(dc);function Jo({loginAction:e,captchaGenerateAction:t,captchaConfig:r,showRememberMe:n=!0,showForgotPassword:a=!0,showSignUp:i=!0,forgotPasswordHref:o,signUpHref:s,onForgotPassword:l,onSignUp:c,onSuccess:d}){let g=pn,h=Jg(null),k=Ln(),{contextSafe:u}=dc({scope:h}),S=e.state.isPending,f=r?.enabled&&t,P=u((y)=>{if(y.preventDefault(),!k.email||!k.password){k.setError("Please fill in all fields"),x();return}if(f&&(!k.captchaId||!k.captchaAnswer)){k.setError("Please complete the security check"),x();return}k.setError(null),e.start({payload:{email:k.email,password:k.password,rememberMe:k.rememberMe,captchaId:k.captchaId??void 0,captchaAnswer:k.captchaAnswer||void 0},onAfterHandle:(v)=>{let p=v;if(p.success===!1)k.setError(p.message||"Login failed. Please try again."),x();else if(p.success)k.reset(),d?.()},onErrorHandle:(v)=>{let p=v instanceof Error?v.message:"Login failed. Please try again.";k.setError(p),x()}})}),x=u(()=>{if(!h.current)return;qo.fromTo(h.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{qo.set(h.current,{x:0})}})}),z=()=>{if(l)l();else if(o)window.location.href=o},m=()=>{if(c)c();else if(s)window.location.href=s};return Pt("form",{ref:h,onSubmit:P,className:g.form.container,noValidate:!0,children:[k.error&&Pt("div",{className:g.error.container,role:"alert",children:Pt("p",{className:g.error.text,children:k.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Pt("div",{className:g.form.spacing,children:[Pt("div",{className:g.input.wrapper,children:Pt(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:k.email,onChange:k.setEmail,disabled:S,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Pt("div",{className:g.input.wrapper,children:Pt(Ee,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:k.password,onChange:k.setPassword,disabled:S,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),f&&t&&Pt(fa,{generateAction:t,config:r,onChallengeLoad:(y)=>{k.setCaptchaId(y.data?.challengeId??""),k.setCaptchaAnswer("")},onAnswerChange:(y,v)=>{k.setCaptchaAnswer(v)},disabled:S,autoGenerate:!0},void 0,!1,void 0,this),(n||a)&&Pt("div",{className:g.links.container,children:[n&&Pt("div",{className:g.checkbox.wrapper,children:[Pt(hr,{checked:k.rememberMe,onChange:k.setRememberMe,disabled:S,size:"sm"},void 0,!1,void 0,this),Pt("button",{type:"button",className:g.checkbox.label,onClick:()=>k.setRememberMe(!k.rememberMe),children:"Remember me"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&Pt("button",{type:"button",onClick:z,className:w(g.links.forgotPassword),disabled:S,children:"Forgot password?"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Pt("div",{className:g.button.wrapper,children:Pt(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:S,disabled:S,children:"Sign In"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i&&Pt("div",{className:g.links.signUp.wrapper,children:Pt("span",{className:g.links.signUp.text,children:["Don't have an account?"," ",Pt("button",{type:"button",onClick:m,className:g.links.signUp.link,disabled:S,children:"Sign up"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Xa}from"react/jsx-dev-runtime";function Ua({logo:e,title:t,subtitle:r}){let n=pn;return Xa("header",{className:n.header.container,children:[e&&Xa("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),t&&Xa("h1",{className:w(n.header.title),children:t},void 0,!1,void 0,this),r&&Xa("p",{className:w(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as gc}from"@gsap/react";import mc from"gsap";import{useEffect as Gg,useEffectEvent as cc,useRef as pc}from"react";import{jsxDEV as lr,Fragment as uc}from"react/jsx-dev-runtime";mc.registerPlugin(gc);function bc({variant:e="default",logo:t,title:r="Welcome Back",subtitle:n="Sign in to your account to continue",loggedInTitle:a="You're Logged In",showRememberMe:i=!0,showForgotPassword:o=!0,showSignUp:s=!0,forgotPasswordHref:l,signUpHref:c,loginAction:d,meAction:g,logoutAction:h,captchaGenerateAction:k,config:u,onForgotPassword:S,onSignUp:f,onSuccess:P,onLogout:x,showBackground:z=!0,className:m}){let y=pn,v=pc(null),p=pc(null),b=Ln(),R=cc(()=>{if(!g)return;g.start({payload:void 0,onAfterHandle:(E)=>{let K=E;if(K.success&&K.data?.user)b.setAuthenticated(!0,K.data.user)},onErrorHandle:()=>{b.setAuthenticated(!1,null)}})});Gg(()=>{R()},[]);let $=cc(()=>{if(!h)return;h.start({payload:void 0,onAfterHandle:()=>{b.setAuthenticated(!1,null),b.reset(),x?.()},onErrorHandle:()=>{}})});gc(()=>{if(!p.current)return;mc.fromTo(p.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:v});let J=g?.state.isPending,U=h?.state.isPending;return lr("main",{ref:v,className:w(y.container.base,m),"aria-label":"Login page",children:[z&&lr(xt,{},void 0,!1,void 0,this),lr("div",{className:y.container.wrapper,children:lr("article",{ref:p,className:w(y.card.base,y.card.padding,y.card.background,y.card.border,y.card.shadow,y.card.rounded),children:J?lr("div",{className:"flex items-center justify-center py-12",children:lr("div",{className:"w-8 h-8 border-2 border-zinc-300 dark:border-zinc-600 border-t-blue-500 rounded-full animate-spin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):b.isAuthenticated&&b.user?lr(uc,{children:[lr(Ua,{logo:t,title:a,subtitle:`Signed in as ${b.user.email}`},void 0,!1,void 0,this),lr("div",{className:"mt-6 space-y-4",children:[lr(se,{variant:"nucleus",size:"lg",fullWidth:!0,onClick:P,children:"Continue to Dashboard"},void 0,!1,void 0,this),h&&lr(se,{variant:"outline",size:"lg",fullWidth:!0,onClick:$,loading:U,disabled:U,children:"Sign Out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):lr(uc,{children:[lr(Ua,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),lr(Jo,{loginAction:d,captchaGenerateAction:k,captchaConfig:u?.login?.captcha,showRememberMe:i,showForgotPassword:o,showSignUp:s,forgotPasswordHref:l,signUpHref:c,onForgotPassword:S,onSignUp:f,onSuccess:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as hc}from"@gsap/react";import yc from"gsap";import{useEffect as Zg,useEffectEvent as fc,useRef as Go}from"react";import{batch as Ag,createStore as Yg}from"h-state";var Kg={step:"verifying",message:"Please wait while we verify your magic link..."},{useStore:Ea}=Yg(Kg,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},reset:(e)=>()=>{Ag(()=>{e.step="verifying",e.message="Please wait while we verify your magic link..."})}});var Da={container:{base:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-zinc-50 via-white to-zinc-100 dark:from-zinc-950 dark:via-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white dark:bg-zinc-900",border:"border border-zinc-200 dark:border-zinc-800",shadow:"shadow-xl shadow-zinc-200/50 dark:shadow-zinc-950/50",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center space-y-4"},states:{verifying:{spinner:"w-12 h-12 border-4 border-zinc-200 dark:border-zinc-700 border-t-blue-500 rounded-full animate-spin",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",icon:"w-8 h-8 text-green-600 dark:text-green-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-green-600 dark:text-green-400",redirectText:"text-xs text-zinc-400 dark:text-zinc-500 animate-pulse"},error:{iconWrapper:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",icon:"w-8 h-8 text-red-600 dark:text-red-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-red-600 dark:text-red-400"},ready:{iconWrapper:"w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",icon:"w-8 h-8 text-blue-600 dark:text-blue-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400",button:"mt-6 w-full px-6 py-3 text-sm font-semibold text-white bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 dark:text-black rounded-xl transition-all duration-200 active:scale-[0.98] shadow-lg shadow-blue-600/20 dark:shadow-blue-500/20"}},backButton:"mt-6 px-6 py-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors duration-200"};import{jsxDEV as ot,Fragment as Va}from"react/jsx-dev-runtime";yc.registerPlugin(hc);function Qg(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function wc({token:e,verifyAction:t,onSuccess:r,onError:n,onBackToLogin:a,backToLoginHref:i,redirectDelay:o=2000,requireConfirmation:s=!1,className:l,texts:c}){let d=Da,g=Go(null),h=Go(null),k=Go(!1),u=Ea(),S=fc((x)=>{if(!x){u.setStep("error"),u.setMessage("Invalid magic link. No token provided.");return}if(k.current)return;k.current=!0,u.setStep("verifying"),t.start({payload:{token:x},onAfterHandle:(z)=>{if(!z){u.setStep("error"),u.setMessage("Verification failed. Please try again."),n?.();return}if(z.success&&z.data)u.setStep("success"),u.setMessage(c?.successSubtitle||"You have been logged in successfully!"),setTimeout(()=>{r?.(z)},o);else u.setStep("error"),u.setMessage("Verification failed. The link may be expired or invalid."),n?.()},onErrorHandle:(z)=>{u.setStep("error"),u.setMessage(Qg(z,"Verification failed. The link may be expired or invalid.")),n?.()}})}),f=fc(()=>{if(e)S(e)});Zg(()=>{if(!e)u.setStep("error"),u.setMessage("Invalid magic link. No token provided.");else if(s)u.setStep("ready"),u.setMessage(c?.confirmSubtitle||"Click below to verify and sign in securely.");else S(e);return()=>{u.reset()}},[e]),hc(()=>{if(!h.current)return;yc.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g});let P=()=>{if(a)a();else if(i)window.location.href=i};return ot("main",{ref:g,className:w(d.container.base,l),children:ot("article",{ref:h,className:w(d.card.base,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:ot("div",{className:d.content.wrapper,children:[u.step==="ready"&&ot(Va,{children:[ot("div",{className:d.states.ready.iconWrapper,children:ot("svg",{className:d.states.ready.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.ready.title,children:c?.confirmTitle||"Magic Link Verification"},void 0,!1,void 0,this),ot("p",{className:d.states.ready.subtitle,children:u.message},void 0,!1,void 0,this),ot("button",{type:"button",onClick:f,className:d.states.ready.button,children:c?.confirmButton||"Verify & Sign In"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="verifying"&&ot(Va,{children:[ot("div",{className:d.states.verifying.spinner},void 0,!1,void 0,this),ot("h1",{className:d.states.verifying.title,children:c?.verifyingTitle||"Verifying Magic Link"},void 0,!1,void 0,this),ot("p",{className:d.states.verifying.subtitle,children:c?.verifyingSubtitle||u.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="success"&&ot(Va,{children:[ot("div",{className:d.states.success.iconWrapper,children:ot("svg",{className:d.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.success.title,children:c?.successTitle||"Login Successful!"},void 0,!1,void 0,this),ot("p",{className:d.states.success.subtitle,children:u.message},void 0,!1,void 0,this),ot("p",{className:d.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="error"&&ot(Va,{children:[ot("div",{className:d.states.error.iconWrapper,children:ot("svg",{className:d.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ot("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ot("h1",{className:d.states.error.title,children:c?.errorTitle||"Verification Failed"},void 0,!1,void 0,this),ot("p",{className:d.states.error.subtitle,children:u.message},void 0,!1,void 0,this),(a||i)&&ot("button",{type:"button",onClick:P,className:d.backButton,children:c?.backToLogin||"Back to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useEffect as Xg,useEffectEvent as Ug,useState as Eg}from"react";var Kt={container:{base:"relative w-full",wrapper:"relative z-10 w-full"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex items-center justify-between mb-6",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",subtitle:"text-sm text-zinc-600 dark:text-zinc-400 mt-1",markAllButton:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors disabled:opacity-50",countBadge:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},notificationItem:{base:"flex gap-3 p-4 rounded-xl transition-all duration-200 cursor-pointer",unseen:"bg-blue-50/50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-800/30",seen:"bg-transparent border border-transparent hover:bg-zinc-50 dark:hover:bg-zinc-800/30",hover:"hover:shadow-sm",iconWrapper:{base:"flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center",verification:"bg-violet-100 dark:bg-violet-900/30 text-violet-600 dark:text-violet-400",system:"bg-zinc-100 dark:bg-zinc-700 text-zinc-600 dark:text-zinc-400",custom:"bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400"},content:"flex-1 min-w-0",title:"text-sm font-medium text-zinc-900 dark:text-white",body:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",meta:"flex items-center gap-2 mt-1.5",timestamp:"text-xs text-zinc-400 dark:text-zinc-500",dot:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"},bell:{button:"relative p-2 rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",icon:"w-5 h-5 text-zinc-600 dark:text-zinc-400",badge:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] flex items-center justify-center rounded-full bg-red-500 text-white text-[10px] font-bold px-1"},empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 mb-4",text:"text-sm text-red-600 dark:text-red-400"},loadMore:{button:"w-full py-2 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors"}};function kc(e){return{...Kt,...e,container:{...Kt.container,...e.container},card:{...Kt.card,...e.card},header:{...Kt.header,...e.header},notificationItem:{...Kt.notificationItem,...e.notificationItem},bell:{...Kt.bell,...e.bell},empty:{...Kt.empty,...e.empty},loading:{...Kt.loading,...e.loading},error:{...Kt.error,...e.error},loadMore:{...Kt.loadMore,...e.loadMore}}}import{jsxDEV as na}from"react/jsx-dev-runtime";function vc({unseenCountAction:e,onClick:t,pollInterval:r=30000,className:n}){let a=Kt,[i,o]=Eg(0),s=Ug(()=>{e.start({payload:void 0,onAfterHandle:(l)=>{let c=l;if(c?.data)o(c.data.count)},onErrorHandle:()=>{}})});return Xg(()=>{if(s(),r>0){let l=setInterval(s,r);return()=>clearInterval(l)}},[r]),na("button",{type:"button",className:w(a.bell.button,n),onClick:t,"aria-label":`Notifications${i>0?` (${i} unread)`:""}`,children:[na("svg",{className:a.bell.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[na("title",{children:"Notifications"},void 0,!1,void 0,this),na("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i>0&&na("span",{className:a.bell.badge,children:i>99?"99+":i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as zc}from"@gsap/react";import Nc from"gsap";import{useEffect as em,useEffectEvent as ei,useRef as xc}from"react";import{batch as Dg,createStore as Vg}from"h-state";var jg={notifications:[],unseenCount:0,isLoading:!1,isMarkingAll:!1,markingId:null,error:null,hasMore:!0,offset:0},{useStore:ja}=Vg(jg,{setNotifications:(e)=>(t)=>{e.notifications=t},appendNotifications:(e)=>(t)=>{e.notifications=[...e.notifications,...t]},setUnseenCount:(e)=>(t)=>{e.unseenCount=t},setLoading:(e)=>(t)=>{e.isLoading=t},setMarkingAll:(e)=>(t)=>{e.isMarkingAll=t},setMarkingId:(e)=>(t)=>{e.markingId=t},setError:(e)=>(t)=>{e.error=t},setHasMore:(e)=>(t)=>{e.hasMore=t},setOffset:(e)=>(t)=>{e.offset=t},markAsSeen:(e)=>(t)=>{e.notifications=e.notifications.map((r)=>r.id===t?{...r,is_seen:!0,seen_at:new Date().toISOString()}:r)},markAllAsSeen:(e)=>()=>{let t=new Date().toISOString();e.notifications=e.notifications.map((r)=>({...r,is_seen:!0,seen_at:r.seen_at||t})),e.unseenCount=0},decrementUnseen:(e)=>()=>{e.unseenCount=Math.max(0,e.unseenCount-1)},reset:(e)=>()=>{Dg(()=>{e.notifications=[],e.unseenCount=0,e.isLoading=!1,e.isMarkingAll=!1,e.markingId=null,e.error=null,e.hasMore=!0,e.offset=0})}});import{jsxDEV as He}from"react/jsx-dev-runtime";Nc.registerPlugin(zc);function Sc({variant:e="default",title:t="Notifications",subtitle:r,listAction:n,unseenCountAction:a,markSeenAction:i,markAllSeenAction:o,onNotificationClick:s,pageSize:l=20,className:c}){let d=Kt,g=xc(null),h=xc(null),k=ja(),u=ei((y)=>{let v=y?0:k.offset;if(y)k.setLoading(!0),k.setOffset(0);k.setError(null),n.start({payload:{limit:l,offset:v},onAfterHandle:(p)=>{let b=p;if(b?.data){let R=b.data;if(y||v===0)k.setNotifications(R);else k.appendNotifications(R);k.setHasMore(R.length===l),k.setOffset(v+R.length)}k.setLoading(!1)},onErrorHandle:(p)=>{k.setError(p instanceof Error?p.message:"Failed to load notifications"),k.setLoading(!1)}})}),S=ei(()=>{a.start({payload:void 0,onAfterHandle:(y)=>{let v=y;if(v?.data)k.setUnseenCount(v.data.count)},onErrorHandle:()=>{}})}),f=ei((y)=>{if(y.is_seen){s?.(y);return}k.setMarkingId(y.id),k.markAsSeen(y.id),k.decrementUnseen(),i.start({payload:{notification_id:y.id},onAfterHandle:()=>{k.setMarkingId(null),s?.(y)},onErrorHandle:()=>{k.setMarkingId(null)}})}),P=ei(()=>{k.setMarkingAll(!0),k.markAllAsSeen(),o.start({payload:void 0,onAfterHandle:()=>{k.setMarkingAll(!1)},onErrorHandle:()=>{k.setMarkingAll(!1),u(!0),S()}})});em(()=>{u(!0),S()},[]),zc(()=>{if(!h.current)return;Nc.fromTo(h.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:g});let x=(y)=>{switch(y){case"verification":return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"Verification"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"system":return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"System"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);default:return He("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"Notification"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}},z=(y)=>{switch(y){case"verification":return d.notificationItem.iconWrapper.verification;case"system":return d.notificationItem.iconWrapper.system;default:return d.notificationItem.iconWrapper.custom}},m=(y)=>{let v=new Date(y),b=new Date().getTime()-v.getTime(),R=Math.floor(b/60000),$=Math.floor(b/3600000),J=Math.floor(b/86400000);if(R<1)return"Just now";if(R<60)return`${R}m ago`;if($<24)return`${$}h ago`;if(J<7)return`${J}d ago`;return v.toLocaleDateString()};return He("div",{ref:g,className:w(d.container.base,c),children:He("div",{className:d.container.wrapper,children:He("div",{ref:h,className:w(d.card.base,d.card.padding,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:[He("div",{className:d.header.container,children:[He("div",{children:[He("h2",{className:d.header.title,children:[t,k.unseenCount>0&&He("span",{className:d.header.countBadge,children:k.unseenCount},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&He("p",{className:d.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.unseenCount>0&&He("button",{type:"button",className:d.header.markAllButton,disabled:k.isMarkingAll,onClick:P,children:k.isMarkingAll?"Marking...":"Mark all as read"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&He("div",{className:d.error.container,children:He("p",{className:d.error.text,children:k.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),k.isLoading&&k.notifications.length===0?He("div",{className:d.loading.container,children:[He("div",{className:d.loading.spinner},void 0,!1,void 0,this),He("p",{className:d.loading.text,children:"Loading notifications..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):k.notifications.length===0?He("div",{className:d.empty.container,children:[He("svg",{className:d.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[He("title",{children:"No notifications"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),He("p",{className:d.empty.text,children:"No notifications yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):He("div",{className:"space-y-2",children:[k.notifications.map((y)=>He("button",{type:"button",className:w(d.notificationItem.base,y.is_seen?d.notificationItem.seen:d.notificationItem.unseen,d.notificationItem.hover,"text-left w-full"),onClick:()=>f(y),children:[He("div",{className:w(d.notificationItem.iconWrapper.base,z(y.type)),children:x(y.type)},void 0,!1,void 0,this),He("div",{className:d.notificationItem.content,children:[He("p",{className:d.notificationItem.title,children:y.title},void 0,!1,void 0,this),y.body&&He("p",{className:d.notificationItem.body,children:y.body},void 0,!1,void 0,this),He("div",{className:d.notificationItem.meta,children:[He("span",{className:d.notificationItem.timestamp,children:m(y.created_at)},void 0,!1,void 0,this),y.entity_name&&He("span",{className:"text-xs px-1.5 py-0.5 rounded bg-zinc-100 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400",children:y.entity_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!y.is_seen&&He("div",{className:d.notificationItem.dot},void 0,!1,void 0,this)]},y.id,!0,void 0,this)),k.hasMore&&He("button",{type:"button",className:d.loadMore.button,onClick:()=>u(!1),disabled:k.isLoading,children:k.isLoading?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Bc}from"@gsap/react";import Wc from"gsap";import{useCallback as gm,useEffect as Eo,useMemo as mm,useRef as ia,useState as xr}from"react";import{createPortal as Rc}from"react-dom";import{useEffect as nm,useRef as am,useState as Hr}from"react";function Mn(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toUpperCase()}function Ao(e){if(e.endsWith("ies"))return`${e.slice(0,-3)}y`;if(e.endsWith("ses"))return`${e.slice(0,-2)}`;if(e.endsWith("s"))return e.slice(0,-1);return e}function Yo(e,t){let r=Mn(e),n=Mn(Ao(e));switch(t){case"GET":return`GET_${r}`;case"POST":return`ADD_${n}`;case"PUT":return`UPDATE_${n}`;case"PATCH":return`PATCH_${n}`;case"DELETE":return`DELETE_${n}`}}function Ko(e,t){let r=Mn(e);switch(t){case"POST":return`BULK_ADD_${r}`;case"PUT":return`BULK_UPDATE_${r}`;case"DELETE":return`BULK_DELETE_${r}`}}function tm(e){return`GET_${Mn(Ao(e))}_BY_ID`}function rm(e){return`GET_${Mn(e)}_DISTINCT`}function Zo({entity:e,apiActions:t,pageSize:r=20,initialSort:n=[],initialFilters:a=[]}){let i=e.table_name,[o,s]=Hr([]),[l,c]=Hr(null),[d,g]=Hr(!1),[h,k]=Hr(!1),[u,S]=Hr(null),[f,P]=Hr(""),[x,z]=Hr(n),[m,y]=Hr(a),[v,p]=Hr(1),b=am(!0),R=Yo,$=Ko,J=(I)=>{let _={page:I?.page??v,limit:r},T=I?.search??f;if(T){_.search=T;let ce=e.columns?.filter((oe)=>["text","varchar","char"].includes(oe.type)).map((oe)=>oe.name);if(ce&&ce.length>0)_.searchFields=ce.join(",")}let ie=I?.sort??x;if(ie.length>0)_.sort=JSON.stringify(ie);let q=I?.filters??m;if(q.length>0)_.filters=JSON.stringify(q);return _},U=(I)=>{let _=R(i,"GET"),T=t[_];if(!T){console.error(`Endpoint ${_} not found`);return}g(!0),S(null);let ie=I?.page??1;p(ie),T.start({payload:J({...I,page:ie}),onAfterHandle:(q)=>{let ce=q;if(ce?.data?.items)s(ce.data.items),c(ce.data.meta??null);g(!1)},onErrorHandle:(q)=>{S(q),g(!1)}})},E=()=>{if(!l||!l.hasNextPage||h)return;let I=R(i,"GET"),_=t[I];if(!_)return;k(!0);let T=v+1;_.start({payload:J({page:T}),onAfterHandle:(ie)=>{let q=ie;if(q?.data?.items&&q.data.items.length>0){let ce=q.data.items;s((oe)=>{let Ze=new Set(oe.map((Pe)=>Pe.id)),$e=ce.filter((Pe)=>!Ze.has(Pe.id));return[...oe,...$e]}),c(q.data.meta??null),p(T)}k(!1)},onErrorHandle:(ie)=>{S(ie),k(!1)}})},K=async(I)=>{let _=R(i,"POST"),T=t[_];if(!T)throw Error(`Endpoint ${_} not found`);return new Promise((ie,q)=>{T.start({payload:I,onAfterHandle:()=>{U({page:1}),ie()},onErrorHandle:(ce)=>{q(ce)}})})},M=async(I,_)=>{let T=R(i,"PUT"),ie=t[T];if(!ie)throw Error(`Endpoint ${T} not found`);return new Promise((q,ce)=>{ie.start({payload:{_id:I,..._},onAfterHandle:()=>{U(),q()},onErrorHandle:(oe)=>{ce(oe)}})})},Q=async(I)=>{let _=R(i,"DELETE"),T=t[_];if(!T)throw Error(`Endpoint ${_} not found`);return new Promise((ie,q)=>{T.start({payload:{_id:I},onAfterHandle:()=>{U(),ie()},onErrorHandle:(ce)=>{q(ce)}})})},N=async(I)=>{let _=$(i,"POST"),T=t[_];if(!T)throw Error(`Endpoint ${_} not found`);return new Promise((ie,q)=>{T.start({payload:I,onAfterHandle:()=>{U({page:1}),ie()},onErrorHandle:(ce)=>{q(ce)}})})},O=async(I)=>{let _=$(i,"DELETE"),T=t[_];if(!T)throw Error(`Endpoint ${_} not found`);return new Promise((ie,q)=>{T.start({payload:I,onAfterHandle:()=>{U(),ie()},onErrorHandle:(ce)=>{q(ce)}})})},A=()=>{U()};nm(()=>{if(b.current)b.current=!1,U()},[]);let D=l?.hasNextPage??!1;return{items:o,meta:l,isLoading:d,isLoadingMore:h,error:u,loadData:U,loadMore:E,hasMore:D,addItem:K,updateItem:M,deleteItem:Q,bulkAdd:N,bulkDelete:O,search:f,setSearch:P,sort:x,setSort:z,filters:m,setFilters:y,currentPage:v,setCurrentPage:p,refetch:A}}function rr(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,(t)=>t.toUpperCase())}function ti(e){if(e.primaryKey&&e.type==="serial")return!0;if(e.primaryKey&&e.type==="bigserial")return!0;if(e.primaryKey&&e.type==="smallserial")return!0;if(e.generatedAlwaysAs)return!0;if(e.generatedAlwaysAsIdentity)return!0;if(["created_at","updated_at","deleted_at"].includes(e.name))return!0;return!1}function Qo(e,t){if(ti(e))return!0;if(e.primaryKey)return!0;if(e.name==="id")return!0;if(t==="add"){if(e.defaultRaw?.includes("gen_random_uuid"))return!0;if(e.generatedByDefaultAsIdentity)return!0}return!1}function aa(e){return!!e.references}function Xo(e){return e.type==="json"||e.type==="jsonb"}function ri(e){return!!e.array}function ni(e){if(e.enumValues||e.enum)return"select";switch(e.type){case"integer":case"smallint":case"bigint":case"serial":case"smallserial":case"bigserial":case"real":case"doublePrecision":case"numeric":case"decimal":case"money":return"number";case"boolean":return"boolean";case"date":case"time":case"timestamp":case"timestamptz":return"date";case"json":case"jsonb":return"json";case"bytea":case"vector":case"geometry":case"geography":return"hidden";default:return"text"}}function im(e){if(e.default!==void 0)return e.default;switch(ni(e)){case"number":return e.nullable?null:0;case"boolean":return!1;case"date":return null;case"select":return e.nullable?null:"";case"json":return e.nullable?null:{};default:return""}}var om=["text","varchar","char"],lm=["integer","smallint","bigint","serial","smallserial","bigserial","real","doublePrecision","numeric","decimal","money"],sm=["date","time","timestamp","timestamptz"];function dm(e){return om.includes(e.type)}function cm(e){if((e.enumValues?.length??0)>0)return!0;if((e.enum?.values?.length??0)>0)return!0;if(e.type==="customType"&&e.enum)return!0;return!1}function Uo(e){return e.type==="boolean"}function pm(e){return lm.includes(e.type)}function um(e){return sm.includes(e.type)}function Cc(e){if(e.enumValues?.length)return e.enumValues;if(e.enum?.values?.length)return e.enum.values;return[]}function Pc(e){return e.filter(dm)}function Tc(e){return e.filter((t)=>cm(t)||Uo(t))}function Lc(e){return e.filter((t)=>pm(t)&&!t.primaryKey)}function Mc(e){return e.filter((t)=>um(t))}import{jsxDEV as Z,Fragment as fm}from"react/jsx-dev-runtime";Wc.registerPlugin(Bc);var bt={container:"w-full h-full flex flex-col min-h-0",header:{base:"mb-4",title:"text-xl font-semibold text-zinc-900 dark:text-white",description:"mt-1 text-sm text-zinc-500 dark:text-zinc-400"},toolbar:{base:"flex flex-col gap-3 mb-4",row:"flex flex-wrap items-center gap-3",search:"flex-1 min-w-[200px] max-w-md",searchFields:"flex flex-wrap items-center gap-2",filters:"flex flex-wrap items-center gap-2",actions:"flex items-center gap-2 ml-auto"},table:{container:"w-full flex-1 overflow-auto rounded-lg border border-zinc-200 dark:border-zinc-700 min-h-0 relative",table:"w-full text-sm table-fixed",thead:"bg-zinc-50 dark:bg-zinc-800 sticky top-0 z-10",th:"px-3 py-2.5 text-left text-xs font-medium text-zinc-600 dark:text-zinc-400 uppercase tracking-wider bg-zinc-50 dark:bg-zinc-800",thSortable:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-700 select-none",tbody:"divide-y divide-zinc-100 dark:divide-zinc-800",tr:"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",trSelected:"bg-blue-50 dark:bg-blue-900/20",td:"px-3 py-2.5 text-sm text-zinc-700 dark:text-zinc-300 truncate relative",empty:"px-4 py-12 text-center text-zinc-500 dark:text-zinc-400",loading:"px-4 py-8 text-center text-zinc-500"},pagination:{base:"flex items-center justify-between py-3 text-sm border-t border-zinc-200 dark:border-zinc-700",info:"text-zinc-500 dark:text-zinc-400",buttons:"flex items-center gap-2"},modal:{overlay:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",container:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 animate-in zoom-in-95 slide-in-from-bottom-4 duration-200",header:"mb-6 flex items-center justify-between border-b border-zinc-100 dark:border-zinc-800 pb-4",title:"text-lg font-semibold text-zinc-900 dark:text-white",closeButton:"rounded-full p-1 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300"},button:{base:"inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500",ghost:"text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",sizes:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},input:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 placeholder-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder-zinc-500",label:"mb-1.5 block text-sm font-medium text-zinc-700 dark:text-zinc-300",error:"mt-1 text-xs text-red-500 dark:text-red-400"},select:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100"},checkbox:{base:"h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800"},skeleton:{base:"animate-pulse rounded bg-zinc-200 dark:bg-zinc-700",row:"h-12"}};function bm({entity:e,apiActions:t,title:r,description:n,pageSize:a=20,searchable:i=!0,searchFields:o,filterable:s=!0,sortable:l=!0,selectable:c=!0,showAdd:d=!0,showEdit:g=!0,showDelete:h=!0,showBulkAdd:k=!1,showBulkDelete:u=!0,columnConfigs:S,fieldConfigs:f,excludeColumns:P=[],excludeFields:x=[],onRowClick:z,renderHeader:m,renderToolbar:y,className:v}){let p=e.table_name,b=ia(null),[R,$]=xr(!1),[J,U]=xr([]),[E,K]=xr({isOpen:!1,mode:"add"}),[M,Q]=xr({}),[N,O]=xr({}),[A,D]=xr({isOpen:!1,table:"",data:null});Eo(()=>{$(!0)},[]);let{items:I,meta:_,isLoading:T,isLoadingMore:ie,loadData:q,loadMore:ce,hasMore:oe,addItem:Ze,updateItem:$e,deleteItem:Pe,bulkDelete:fe,search:xe,setSearch:qe,setSort:Le,filters:ve,setFilters:B}=Zo({entity:e,apiActions:t,pageSize:a}),de=e.add_base_columns?[{name:"id",type:"uuid",primaryKey:!0},{name:"created_at",type:"timestamptz"},{name:"updated_at",type:"timestamptz"}]:[],te=new Set((e.columns??[]).map((C)=>C.name)),ye=de.filter((C)=>!te.has(C.name)),V=[...e.columns??[],...ye],ee=V.filter((C)=>{if(ti(C))return!1;if(P.includes(C.name))return!1;if(S?.[C.name]?.hidden)return!1;return!0}),re=(C)=>V.filter((F)=>{if(Qo(F,C))return!1;if(x.includes(F.name))return!1;if(f?.[F.name]?.hidden)return!1;return!0}),[Ke,H]=xr({}),[ue,We]=xr({}),Ue=mm(()=>V.filter((C)=>aa(C)),[V]),gt=ia(new Set),Ge=gm((C)=>{if(!C.references)return;let F=C.references.table;if(gt.current.has(F))return;gt.current.add(F);let le=`GET_${F.toUpperCase()}`,pe=t[le];if(pe)pe.start({payload:{limit:100},onAfterHandle:(be)=>{let et=(be?.data?.items??[]).map((it)=>({id:String(it.id??""),label:String(it.name??it.title??it.label??it.id??""),data:it}));H((it)=>({...it,[F]:et})),We((it)=>({...it,[F]:!1}))},onErrorHandle:()=>{We((be)=>({...be,[F]:!1}))}})},[t]),Qt=(C,F)=>{let pe=(Ke[C]??[]).find((be)=>be.id===F);if(pe)D({isOpen:!0,table:C,data:pe.data})},$t=()=>{D({isOpen:!1,table:"",data:null})};Eo(()=>{for(let C of Ue)Ge(C)},[Ue,Ge]),Bc(()=>{if(b.current)Wc.fromTo(b.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},[]);let zr=(C)=>{qe(C),q({search:C,page:1})},ne=()=>{U([])},W=()=>{let C={};for(let F of re("add")){let le=F.enumValues??F.enum?.values;if(F.default!==void 0)C[F.name]=F.default;else if(le&&le.length>0)C[F.name]=le[0];else if(F.type==="boolean")C[F.name]=!1;else C[F.name]=""}Q(C),O({}),K({isOpen:!0,mode:"add"})},j=(C)=>{let F={},le=C;for(let pe of V){let be=pe.name,_e=be.replace(/_([a-z])/g,(st,et)=>et.toUpperCase());if(pe.references?.foreignKey){let st=pe.references.foreignKey;if(st in le){F[be]=le[st];continue}}if(be in le)F[be]=le[be];else if(_e in le)F[be]=le[_e];else{let st=`${_e}Id`;if(st in le)F[be]=le[st];else F[be]=void 0}}Q(F),O({}),K({isOpen:!0,mode:"edit",data:C})},Ne=()=>{K({isOpen:!1,mode:"add"}),Q({}),O({}),gr(null)},ze=()=>{let C={};for(let F of re(E.mode)){let le=M[F.name],pe=le===void 0||le===null||le==="";if(F.notNull&&pe){C[F.name]="This field is required";continue}if(!pe&&F.validation){if(F.validation.minLength&&String(le).length<F.validation.minLength)C[F.name]=`Minimum ${F.validation.minLength} characters`;if(F.validation.maxLength&&String(le).length>F.validation.maxLength)C[F.name]=`Maximum ${F.validation.maxLength} characters`;if(F.validation.min!==void 0&&Number(le)<F.validation.min)C[F.name]=`Minimum value is ${F.validation.min}`;if(F.validation.max!==void 0&&Number(le)>F.validation.max)C[F.name]=`Maximum value is ${F.validation.max}`}}return O(C),Object.keys(C).length===0},[Me,gr]=xr(null),br=(C)=>{let F={},le=re(E.mode),pe=["integer","smallint","bigint","real","doublePrecision","numeric","decimal","money"];for(let be of le){let _e=C[be.name],st=be.references?.foreignKey??be.name;if(_e===void 0||_e===null||_e===""){if(!be.notNull)F[st]=null;continue}if(ri(be))F[st]=Array.isArray(_e)?_e.join(","):String(_e);else if(pe.includes(be.type))F[st]=Number(_e);else F[st]=_e}return F},Xt=async()=>{if(!ze())return;gr(null);let C=br(M);try{if(E.mode==="add")await Ze(C);else{let F=E.data?.id;if(F)await $e(F,C)}Ne()}catch(F){let le="An error occurred",pe=(be)=>{if(typeof be==="string")return be;if(be&&typeof be==="object"){let _e=be;if(_e.summary)return String(_e.summary);if(_e.message)return String(_e.message);if(_e.errors&&Array.isArray(_e.errors))return _e.errors.map((st)=>pe(st)).join(", ")}return JSON.stringify(be)};try{let be=F;if(be.errors&&Array.isArray(be.errors)&&be.errors.length>0)le=be.errors.map((_e)=>pe(_e)).join(", ");else if(be.message)try{let _e=JSON.parse(be.message);le=pe(_e)}catch{le=be.message}else le=pe(F)}catch{le=String(F)}gr(le)}},Nr=async(C)=>{if(window.confirm("Are you sure you want to delete this item?"))await Pe(C)},Vr=async()=>{if(J.length===0)return;if(window.confirm(`Are you sure you want to delete ${J.length} items?`)){let C=J.map((F)=>F.id);await fe(C),U([])}},ar=(C,F)=>{let le=S?.[C.name];if(le?.cellRenderer)return le.cellRenderer({value:F,row:{}});if(F===null||F===void 0)return Z("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this);if(C.type==="boolean")return F?"Yes":"No";if(C.type==="timestamp"||C.type==="timestamptz"||C.type==="date")return new Date(F).toLocaleDateString();if(C.type==="json"||C.type==="jsonb")return Z("code",{className:"text-xs",children:[JSON.stringify(F).slice(0,50),"..."]},void 0,!0,void 0,this);if(aa(C)&&C.references){let pe=C.references.table,_e=(Ke[pe]??[]).find((st)=>st.id===String(F));if(_e)return Z("button",{type:"button",onClick:(st)=>{st.stopPropagation(),Qt(pe,_e.id)},className:"group inline-flex items-center gap-1.5 rounded-md border border-zinc-200 bg-zinc-50 px-2 py-1 text-xs font-medium text-zinc-700 transition-all hover:border-zinc-300 hover:bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:border-zinc-600 dark:hover:bg-zinc-700",children:[Z("span",{className:"max-w-[120px] truncate",children:_e.label},void 0,!1,void 0,this),Z("svg",{className:"h-3 w-3 text-zinc-400 transition-transform group-hover:translate-x-0.5 group-hover:text-zinc-600 dark:group-hover:text-zinc-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:Z("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Z("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this)}return String(F)},Ae=(C)=>{let F=f?.[C.name],le=F?.label??rr(C.name),pe=M[C.name],be=N[C.name],_e=ni(C);if(F?.render)return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:`field-${C.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),F.render({value:pe,onChange:(et)=>Q((it)=>({...it,[C.name]:et}))}),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this);if(_e==="boolean")return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:`field-${C.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),Z(hr,{checked:Boolean(pe),onChange:(et)=>Q((it)=>({...it,[C.name]:et})),disabled:F?.disabled,size:"sm"},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this);let st=C.enumValues??C.enum?.values;if(_e==="select"&&st)return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:`field-${C.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),Z(dr,{value:String(pe??""),onChange:(et)=>Q((it)=>({...it,[C.name]:et})),options:st.map((et)=>({value:et,label:rr(et)})),placeholder:`Select ${le.toLowerCase()}`,size:"sm"},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this);if(aa(C)&&C.references){let et=C.references.table,it=Ke[et]??[],_t=ue[et]??!1,fr=pe?String(pe):void 0;return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:`ref-${C.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),Z(dr,{value:fr,onChange:(mr)=>Q((mn)=>({...mn,[C.name]:mr??null})),options:it.map((mr)=>({value:mr.id,label:mr.label})),placeholder:_t?"Loading...":`Select ${le.toLowerCase()}`,size:"sm",clearable:!0},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this)}if(Xo(C)){let et=typeof pe==="object"?JSON.stringify(pe,null,2):String(pe??"{}");return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:`json-${C.name}`,className:bt.input.label,children:le},void 0,!1,void 0,this),Z("textarea",{id:`json-${C.name}`,value:et,onChange:(it)=>{try{let _t=JSON.parse(it.target.value);Q((fr)=>({...fr,[C.name]:_t})),O((fr)=>{let mr={...fr};return delete mr[C.name],mr})}catch{Q((_t)=>({..._t,[C.name]:it.target.value})),O((_t)=>({..._t,[C.name]:"Invalid JSON"}))}},placeholder:F?.placeholder??"Enter JSON...",className:w(bt.input.base,"min-h-[100px] font-mono text-xs"),disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this)}if(ri(C)){let et=Array.isArray(pe)?pe:[],it=`array-${C.name}`;return Z("div",{className:"mb-4",children:[Z("label",{htmlFor:it,className:bt.input.label,children:le},void 0,!1,void 0,this),Z("div",{className:"flex flex-wrap gap-1 rounded-lg border border-zinc-300 bg-white p-2 dark:border-zinc-600 dark:bg-zinc-800",children:[et.map((_t,fr)=>Z("span",{className:"inline-flex items-center gap-1 rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:[_t,Z("button",{type:"button",onClick:()=>{let mr=et.filter((mn,Y0)=>Y0!==fr);Q((mn)=>({...mn,[C.name]:mr}))},className:"ml-1 text-blue-600 hover:text-blue-800 dark:text-blue-300",children:"\xD7"},void 0,!1,void 0,this)]},fr,!0,void 0,this)),Z("input",{id:it,type:"text",className:"min-w-[100px] flex-1 border-none bg-transparent text-sm outline-none",placeholder:et.length===0?F?.placeholder??"Type and press Enter":"",onKeyDown:(_t)=>{if(_t.key==="Enter"){_t.preventDefault();let fr=_t.currentTarget,mr=fr.value.trim();if(mr)Q((mn)=>({...mn,[C.name]:[...et,mr]})),fr.value=""}},disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("p",{className:"mt-1 text-xs text-zinc-500",children:"Press Enter to add"},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this)}return Z("div",{className:"mb-4",children:[Z(Ee,{type:_e==="number"?"number":"text",label:le,value:String(pe??""),onChange:(et)=>{let it=_e==="number"?et===""?"":Number(et):et;Q((_t)=>({..._t,[C.name]:it}))},placeholder:F?.placeholder??`Enter ${le.toLowerCase()}`,disabled:F?.disabled,readOnly:F?.readOnly},void 0,!1,void 0,this),be&&Z("p",{className:bt.input.error,children:be},void 0,!1,void 0,this)]},C.name,!0,void 0,this)},Ut=ia(null),Lt=Pc(V),sa=Tc(V),Et=Lc(V),da=Mc(V),[Nl,Mi]=xr(()=>{let C={};for(let F of Lt)C[F.name]=!0;return C}),Sr=ia(ce);Sr.current=ce;let Cr=ia({hasMore:oe,isLoadingMore:ie,isLoading:T});Cr.current={hasMore:oe,isLoadingMore:ie,isLoading:T},Eo(()=>{let C=Ut.current;if(!C)return;let F=()=>{let{scrollTop:le,scrollHeight:pe,clientHeight:be}=C,_e=100,st=pe<=be||pe-le-be<100,{hasMore:et,isLoadingMore:it,isLoading:_t}=Cr.current;if(st&&et&&!it&&!_t)Sr.current()};return F(),C.addEventListener("scroll",F),()=>C.removeEventListener("scroll",F)},[I.length]);let Pr=(C,F)=>{if(!F)B(ve.filter((le)=>le.field!==C));else if(ve.find((pe)=>pe.field===C))B(ve.map((pe)=>pe.field===C?{...pe,value:F}:pe));else B([...ve,{field:C,operator:"eq",value:F}]);q({filters:F?[...ve.filter((le)=>le.field!==C),{field:C,operator:"eq",value:F}]:ve.filter((le)=>le.field!==C),page:1})},Dt=(C)=>{let F=ve.find((le)=>le.field===C);return F?String(F.value):""},ca=(C)=>{Mi((F)=>({...F,[C]:!F[C]}))},G0=(C)=>{let F=S?.[C.name];if(F?.width)return`${F.width}px`;switch(C.type){case"uuid":return"140px";case"boolean":return"80px";case"integer":case"smallint":case"bigint":return"90px";case"numeric":case"decimal":case"real":case"doublePrecision":return"100px";case"timestamp":case"timestamptz":case"date":return"120px";case"json":case"jsonb":return"100px";default:return"150px"}},Ri=r??rr(p),A0=(C,F,le)=>{let pe=C;if(le?.references?.foreignKey){let st=le.references.foreignKey;if(st in pe)return pe[st]}if(F in pe)return pe[F];let be=F.replace(/_([a-z])/g,(st,et)=>et.toUpperCase());if(be in pe)return pe[be];let _e=`${be}Id`;if(_e in pe)return pe[_e];return};return Z("div",{ref:b,className:w(bt.container,v),children:[m?m():Z("div",{className:bt.header.base,children:[Z("h2",{className:bt.header.title,children:Ri},void 0,!1,void 0,this),n&&Z("p",{className:bt.header.description,children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&Z("div",{className:"mb-6 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-4",children:[Z(Pn,{value:xe,onChange:qe,onSearch:zr,placeholder:`Search ${Ri.toLowerCase()}...`,loading:T,debounceMs:400,disableDropdown:!0,showSearchIcon:!0,showClearButton:!0},void 0,!1,void 0,this),Lt.length>0&&Z("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[Z("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Search in:"},void 0,!1,void 0,this),Lt.map((C)=>Z("label",{htmlFor:`search-field-${C.name}`,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 cursor-pointer transition-colors",children:[Z(hr,{checked:Nl[C.name]??!1,onChange:()=>ca(C.name),size:"sm"},void 0,!1,void 0,this),Z("span",{className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:rr(C.name)},void 0,!1,void 0,this)]},C.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(d||J.length>0)&&Z("div",{className:"mb-6 flex items-center gap-3",children:[J.length>0&&u&&Z(se,{variant:"danger",size:"sm",onClick:Vr,children:["Delete (",J.length,")"]},void 0,!0,void 0,this),d&&!e.excluded_methods?.includes("POST")&&Z(se,{variant:"success",size:"sm",onClick:W,children:["Add ",rr(p.endsWith("s")?p.slice(0,-1):p)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&(sa.length>0||Et.length>0||da.length>0)&&Z("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-6",children:[Z("div",{className:"mb-6 flex items-center justify-between",children:[Z("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-white",children:"Filters"},void 0,!1,void 0,this),ve.length>0&&Z("button",{type:"button",onClick:()=>B([]),className:"text-xs px-2 py-1 rounded text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-950 dark:text-emerald-400 font-medium transition-colors",children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[sa.map((C)=>{let F=Cc(C),le=Uo(C)?[{value:"",label:"All"},{value:"true",label:"Yes"},{value:"false",label:"No"}]:[{value:"",label:"All"},...F.map((pe)=>({value:pe,label:rr(pe)}))];return Z("div",{className:"flex flex-col gap-2",children:[Z("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(C.name)},void 0,!1,void 0,this),Z(dr,{value:Dt(C.name)||void 0,onChange:(pe)=>Pr(C.name,pe??""),options:le,placeholder:"All",size:"sm",clearable:!0},void 0,!1,void 0,this)]},C.name,!0,void 0,this)}),Et.map((C)=>{let F=Number(Dt(`${C.name}_min`))||0,le=Number(Dt(`${C.name}_max`))||1e4;return Z("div",{className:"flex flex-col gap-3",children:[Z("div",{className:"flex items-center justify-between",children:[Z("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(C.name)},void 0,!1,void 0,this),Z("span",{className:"text-xs font-semibold text-zinc-700 dark:text-zinc-300",children:[F," - ",le]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z(Cn,{min:0,max:1e4,step:C.type==="numeric"||C.type==="decimal"?0.01:1,value:{min:F,max:le},onChange:(pe)=>{Pr(`${C.name}_min`,String(pe.min)),Pr(`${C.name}_max`,String(pe.max))},showTooltip:!0,size:"md"},void 0,!1,void 0,this)]},C.name,!0,void 0,this)}),da.map((C)=>Z("div",{className:"flex flex-col gap-2",children:[Z("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:rr(C.name)},void 0,!1,void 0,this),Z(Sn,{mode:"range",value:{start:Dt(`${C.name}_from`)?new Date(Dt(`${C.name}_from`)):null,end:Dt(`${C.name}_to`)?new Date(Dt(`${C.name}_to`)):null},onChange:(F)=>{Pr(`${C.name}_from`,F.start?.toISOString().split("T")[0]??""),Pr(`${C.name}_to`,F.end?.toISOString().split("T")[0]??"")},placeholder:"Select range"},void 0,!1,void 0,this)]},C.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y?.({selectedRows:J,onClearSelection:ne}),Z("div",{className:"mt-6 flex-1 min-h-0 overflow-x-auto",children:Z(kn,{data:I,columns:ee.map((C)=>{let F=S?.[C.name],le=G0(C);return{key:`col_${C.name}`,header:F?.header??rr(C.name),width:Number.parseInt(le,10)||150,sortable:l&&F?.sortable!==!1,resizable:!0,cellRenderer:({row:pe})=>{let be=A0(pe,C.name,C);return ar(C,be)}}}),actionColumns:g||h?[{key:"actions",header:"Actions",width:120,renderer:({row:C})=>{let F=C.id??"";return Z("div",{className:"flex items-center gap-2",children:[g&&!e.excluded_methods?.includes("PUT")&&Z(se,{variant:"outline",size:"xs",onClick:()=>j(C),children:"Edit"},void 0,!1,void 0,this),h&&!e.excluded_methods?.includes("DELETE")&&Z(se,{variant:"ghost",size:"xs",onClick:()=>Nr(F),className:"text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-950",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}]:void 0,keyExtractor:(C)=>C.id??String(Math.random()),callbacks:{onSort:(C,F)=>{if(F)Le([{field:String(C),direction:F}]),q({sort:[{field:String(C),direction:F}]});else Le([]),q({sort:[]})},onLoadMore:ce,onCellClick:z?({row:C})=>{z(C)}:void 0},config:{hasClickAction:Boolean(z),isFrontendSort:!1,enableInfiniteScroll:!0,autoFetchUntilScroll:!0,enableSelection:c},isLoading:T&&I.length===0,isPending:T&&I.length===0,isLoadingMore:ie,hasMoreData:oe,emptyMessage:`No ${Ri.toLowerCase()} found`,selectionToolbar:c?({selectedData:C,onClearSelection:F})=>Z(fm,{children:u&&C.length>0&&Z(se,{variant:"danger",size:"sm",onClick:()=>{let le=C.map((pe)=>pe.id).filter(Boolean);if(le.length>0&&window.confirm(`Delete ${le.length} items?`))fe(le).then(()=>F())},children:["Delete (",C.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this),(_||ie)&&Z("div",{className:bt.pagination.base,children:[Z("span",{className:bt.pagination.info,children:_?`Showing ${I.length} of ${_.totalItems} items`:""},void 0,!1,void 0,this),ie&&Z("span",{className:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400",children:[Z("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Z("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Z("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Loading more..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R&&E.isOpen&&Rc(Z("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:Ne,onKeyDown:(C)=>C.key==="Escape"&&Ne(),role:"dialog","aria-modal":"true",children:Z("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(C)=>C.stopPropagation(),onKeyDown:(C)=>{if(C.stopPropagation(),C.key==="Escape")Ne()},role:"document",children:[Z("div",{className:bt.modal.header,children:[Z("h3",{className:bt.modal.title,children:[E.mode==="add"?"Add":"Edit"," ",rr(p.endsWith("s")?p.slice(0,-1):p)]},void 0,!0,void 0,this),Z(se,{variant:"ghost",size:"sm",onClick:Ne,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("form",{onSubmit:(C)=>{C.preventDefault(),Xt()},children:[Me&&Z("div",{className:"mb-4 rounded-lg bg-red-50 p-3 text-sm text-red-600 dark:bg-red-900/20 dark:text-red-400",children:Me},void 0,!1,void 0,this),re(E.mode).map((C)=>Ae(C)),Z("div",{className:"mt-6 flex justify-end gap-2",children:[Z(se,{variant:"secondary",size:"sm",onClick:Ne,children:"Cancel"},void 0,!1,void 0,this),Z(se,{variant:"primary",size:"sm",type:"submit",children:E.mode==="add"?"Create":"Update"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body),R&&A.isOpen&&A.data&&Rc(Z("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:$t,onKeyDown:(C)=>C.key==="Escape"&&$t(),role:"dialog","aria-modal":"true",children:Z("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(C)=>C.stopPropagation(),onKeyDown:(C)=>{if(C.stopPropagation(),C.key==="Escape")$t()},role:"document",children:[Z("div",{className:bt.modal.header,children:[Z("h3",{className:bt.modal.title,children:[rr(A.table.endsWith("s")?A.table.slice(0,-1):A.table)," ","Details"]},void 0,!0,void 0,this),Z(se,{variant:"ghost",size:"sm",onClick:$t,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("div",{className:"space-y-3",children:Object.entries(A.data).map(([C,F])=>{if(C==="id"||C.endsWith("At")||C.endsWith("By"))return null;return Z("div",{className:"flex flex-col gap-1",children:[Z("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:rr(C)},void 0,!1,void 0,this),Z("span",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:F===null||F===void 0?"-":typeof F==="object"?JSON.stringify(F):String(F)},void 0,!1,void 0,this)]},C,!0,void 0,this)})},void 0,!1,void 0,this),Z("div",{className:"mt-6 flex justify-end",children:Z(se,{variant:"secondary",size:"sm",onClick:$t,children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body)]},void 0,!0,void 0,this)}var $r={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8"},card:{base:"w-full",padding:"p-4 sm:p-6 lg:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-xl sm:rounded-2xl"},header:{container:"flex flex-col sm:flex-row items-center sm:items-start gap-4 sm:gap-6 pb-6 border-b border-zinc-200 dark:border-zinc-700/50",avatar:{wrapper:"relative flex-shrink-0",image:"w-20 h-20 sm:w-24 sm:h-24 rounded-full object-cover ring-4 ring-white dark:ring-zinc-800 shadow-lg",placeholder:"w-20 h-20 sm:w-24 sm:h-24 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white text-2xl sm:text-3xl font-bold ring-4 ring-white dark:ring-zinc-800 shadow-lg",uploadButton:"absolute -bottom-1 -right-1 p-1.5 sm:p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors cursor-pointer"},info:{container:"flex-1 text-center sm:text-left",name:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",email:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400 mt-1",meta:"flex flex-wrap justify-center sm:justify-start gap-3 sm:gap-4 mt-3 text-xs sm:text-sm text-zinc-500 dark:text-zinc-400"}},section:{container:"mt-6 sm:mt-8",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white",titleWrapper:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 mb-4",addButton:"text-xs sm:text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors",content:"space-y-3 sm:space-y-4",empty:{container:"flex flex-col items-center justify-center py-8 sm:py-12 text-center bg-zinc-50 dark:bg-zinc-800/30 rounded-xl",icon:"w-10 h-10 sm:w-12 sm:h-12 text-zinc-300 dark:text-zinc-600 mb-3",text:"text-sm text-zinc-500 dark:text-zinc-400"}},profileForm:{container:"mt-4 sm:mt-6",grid:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",field:{container:"space-y-1 sm:space-y-1.5",label:"block text-xs sm:text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 py-2 text-sm rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all",error:"text-xs text-red-500 mt-1"},actions:"flex flex-col-reverse sm:flex-row justify-end gap-2 sm:gap-3 mt-4 sm:mt-6"},itemCard:{base:"group relative transition-all duration-200",padding:"p-3 sm:p-4",background:"bg-white dark:bg-zinc-800/60",border:"border border-zinc-200 dark:border-zinc-700/50",rounded:"rounded-lg sm:rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3",icon:"flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",title:"font-medium text-sm sm:text-base text-zinc-900 dark:text-white",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5",actions:"flex items-center gap-1 sm:gap-2 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"},details:{container:"mt-2 sm:mt-3 space-y-1 sm:space-y-1.5 text-xs sm:text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-xl sm:rounded-2xl shadow-2xl max-w-md w-full p-4 sm:p-6 max-h-[90vh] overflow-y-auto",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white mb-4",form:"space-y-3 sm:space-y-4",actions:"flex flex-col-reverse sm:flex-row gap-2 sm:gap-3 justify-end mt-4 sm:mt-6"},loading:{container:"flex flex-col items-center justify-center py-12 sm:py-16",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-3 sm:mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-3 sm:p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-xs sm:text-sm text-red-600 dark:text-red-400"},accountSettings:{container:"space-y-2",item:"w-full flex items-center justify-between p-3 rounded-lg border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",iconWrapper:"w-10 h-10 rounded-full flex items-center justify-center",content:"flex items-center gap-3",title:"text-sm font-medium text-zinc-900 dark:text-white",description:"text-xs text-zinc-500 dark:text-zinc-400",arrow:"w-5 h-5 text-zinc-400"}};import{jsxDEV as De}from"react/jsx-dev-runtime";function ai({address:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=$r,s=e.id.startsWith("temp-"),l=()=>{return[e.street,e.apartment,e.neighborhood,e.district,e.city,e.state,e.province,e.zip,e.country].filter(Boolean).join(", ")||"No address details"},c=()=>{if(e.type==="home"||e.type==="residential")return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Home"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="work"||e.type==="office")return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Work"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return De("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Location"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return De("article",{className:w(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[De("div",{className:o.itemCard.header.container,children:[De("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),De("div",{className:"flex-1 min-w-0",children:[De("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),De("p",{className:o.itemCard.header.subtitle,children:e.type||"Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&De("div",{className:o.itemCard.header.actions,children:[De(se,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit address",children:De("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Edit"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),De(se,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete address",children:a?De("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[De("title",{children:"Deleting"},void 0,!1,void 0,this),De("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),De("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):De("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[De("title",{children:"Delete"},void 0,!1,void 0,this),De("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),De("div",{className:o.itemCard.details.container,children:De("p",{className:"text-zinc-600 dark:text-zinc-400 text-sm leading-relaxed",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Qe}from"react/jsx-dev-runtime";function ii({phone:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=$r,s=e.id.startsWith("temp-"),l=()=>{let d=[e.countryCode,e.number];if(e.extension)d.push(`ext. ${e.extension}`);return d.join(" ")},c=()=>{if(e.type==="mobile")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Mobile"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 1.5H8.25A2.25 2.25 0 006 3.75v16.5a2.25 2.25 0 002.25 2.25h7.5A2.25 2.25 0 0018 20.25V3.75a2.25 2.25 0 00-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="office")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Office"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="fax")return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Fax"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Qe("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Phone"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Qe("article",{className:w(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[Qe("div",{className:o.itemCard.header.container,children:[Qe("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),Qe("div",{className:"flex-1 min-w-0",children:[Qe("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),Qe("p",{className:o.itemCard.header.subtitle,children:e.type||"Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&Qe("div",{className:o.itemCard.header.actions,children:[Qe(se,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit phone",children:Qe("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Edit"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Qe(se,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete phone",children:a?Qe("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[Qe("title",{children:"Deleting"},void 0,!1,void 0,this),Qe("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Qe("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Qe("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Qe("title",{children:"Delete"},void 0,!1,void 0,this),Qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Qe("div",{className:o.itemCard.details.container,children:Qe("p",{className:"text-zinc-900 dark:text-white font-medium",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as wt}from"react/jsx-dev-runtime";function oi({user:e,profile:t,profilePicture:r,fileProxyBasePath:n="/file-proxy",onUploadPicture:a,isUploading:i=!1}){let o=$r,s=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName[0]}${t.lastName[0]}`.toUpperCase();if(e?.email&&e.email.length>0)return e.email[0]?.toUpperCase()||"?";return"?"},l=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName} ${t.lastName}`;return"No name set"},c=(d)=>{if(!d)return"N/A";return(typeof d==="string"?new Date(d):d).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})};return wt("header",{className:o.header.container,children:[wt("div",{className:o.header.avatar.wrapper,children:[r?.id?wt("img",{src:`${n}/${r.id}`,alt:l(),className:o.header.avatar.image},void 0,!1,void 0,this):wt("div",{className:o.header.avatar.placeholder,children:s()},void 0,!1,void 0,this),a&&wt("button",{type:"button",onClick:a,disabled:i,className:o.header.avatar.uploadButton,"aria-label":"Upload profile picture",children:i?wt("svg",{className:"w-4 h-4 animate-spin text-zinc-500",viewBox:"0 0 24 24",fill:"none",children:[wt("title",{children:"Uploading"},void 0,!1,void 0,this),wt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),wt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):wt("svg",{className:"w-4 h-4 text-zinc-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[wt("title",{children:"Upload"},void 0,!1,void 0,this),wt("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"},void 0,!1,void 0,this),wt("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),wt("div",{className:o.header.info.container,children:[wt("h1",{className:o.header.info.name,children:l()},void 0,!1,void 0,this),wt("p",{className:o.header.info.email,children:e?.email||"No email"},void 0,!1,void 0,this),wt("div",{className:o.header.info.meta,children:[e?.verifiedAt&&wt("span",{className:"flex items-center gap-1",children:[wt("svg",{className:"w-3.5 h-3.5 text-green-500",viewBox:"0 0 24 24",fill:"currentColor",children:[wt("title",{children:"Verified"},void 0,!1,void 0,this),wt("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Verified"]},void 0,!0,void 0,this),e?.lastLoginAt&&wt("span",{children:["Last login: ",c(e.lastLoginAt)]},void 0,!0,void 0,this),e?.createdAt&&wt("span",{children:["Member since: ",c(e.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ic}from"@gsap/react";import Hc from"gsap";import{useEffect as km,useEffectEvent as vm,useRef as si,useState as un}from"react";import{batch as hm,createStore as ym}from"h-state";var wm={user:null,profile:null,addresses:[],phones:[],files:[],roles:[],profilePicture:null,isEditingProfile:!1},{useStore:li}=ym(wm,{setUser:(e)=>(t)=>{e.user=t},setProfile:(e)=>(t)=>{if(t===null)e.profile=null;else if(e.profile)e.profile={...e.profile,...t};else e.profile=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setProfilePicture:(e)=>(t)=>{e.profilePicture=t},setEditingProfile:(e)=>(t)=>{e.isEditingProfile=t},addAddress:(e)=>(t)=>{e.addresses=[...e.addresses,t]},updateAddress:(e)=>(t)=>{e.addresses=e.addresses.map((r)=>r.id===t.id?{...r,...t}:r)},removeAddress:(e)=>(t)=>{e.addresses=e.addresses.filter((r)=>r.id!==t)},addPhone:(e)=>(t)=>{e.phones=[...e.phones,t]},updatePhone:(e)=>(t)=>{e.phones=e.phones.map((r)=>r.id===t.id?{...r,...t}:r)},removePhone:(e)=>(t)=>{e.phones=e.phones.filter((r)=>r.id!==t)},addFile:(e)=>(t)=>{if(e.files=[...e.files,t],t.type==="profile_picture"){let n=e.files.filter((a)=>a.type==="profile_picture").sort((a,i)=>new Date(i.updatedAt).getTime()-new Date(a.updatedAt).getTime())[0];e.profilePicture=n||t}},updateFile:(e)=>(t)=>{if(e.files=e.files.map((r)=>r.id===t.id?t:r),t.type==="profile_picture")e.profilePicture=t;else if(e.profilePicture?.id===t.id)e.profilePicture=null},removeFile:(e)=>(t)=>{let r=e.files.find((n)=>n.id===t);if(e.files=e.files.filter((n)=>n.id!==t),r?.type==="profile_picture"&&e.profilePicture?.id===t)e.profilePicture=null},reset:(e)=>()=>{hm(()=>{e.user=null,e.profile=null,e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.profilePicture=null,e.isEditingProfile=!1})}});import{jsxDEV as L,Fragment as xm}from"react/jsx-dev-runtime";Hc.registerPlugin(Ic);function $c({meAction:e,addProfileAction:t,updateProfileAction:r,addAddressAction:n,updateAddressAction:a,deleteAddressAction:i,addPhoneAction:o,updatePhoneAction:s,deletePhoneAction:l,uploadFileAction:c,updateFileAction:d,deleteFileAction:g,fileProxyBasePath:h="/file-proxy",onProfileUpdated:k,onAddressAdded:u,onAddressUpdated:S,onAddressDeleted:f,onPhoneAdded:P,onPhoneUpdated:x,onPhoneDeleted:z,onFileUploaded:m,onFileUpdated:y,onFileDeleted:v,onProfilePictureChanged:p,showBackground:b=!1,allowProfileEdit:R=!0,allowAddressEdit:$=!0,allowPhoneEdit:J=!0,allowFileUpload:U=!0,changePasswordHref:E,devicesHref:K,onChangePassword:M,onViewDevices:Q}){let N=$r,O=si(null),A=si(null),D=si(null),I=li(),[_,T]=un(null),[ie,q]=un(null),[ce,oe]=un(!1),[Ze,$e]=un(!1),Pe=si(null),[fe,xe]=un({}),[qe,Le]=un({}),[ve,B]=un({}),de=vm(()=>{e.start({payload:void 0,onAfterHandle:(W)=>{let j=W.data;if(!j?.user?.id)return;let{user:Ne,profile:ze,addresses:Me,phones:gr,files:br,roles:Xt}=j;I.setUser(Ne),I.setProfile(ze),I.setAddresses(Me),I.setPhones(gr),I.setFiles(br),I.setRoles(Xt||[]);let Nr=br.filter((ar)=>ar.type==="profile_picture"),Vr=Nr.length>0?Nr.sort((ar,Ae)=>new Date(Ae.updatedAt).getTime()-new Date(ar.updatedAt).getTime())[0]:null;if(I.setProfilePicture(Vr||null),ze)xe({firstName:ze.firstName,lastName:ze.lastName})}})});km(()=>{de()},[]),Ic(()=>{if(!A.current)return;Hc.fromTo(A.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:O});let te=()=>{if(!I.user?.id)return;let W=!!I.profile?.id,j=I.profile,Ne={...j,...fe};if(I.setProfile(Ne),I.setEditingProfile(!1),W&&j?.id)r.start({payload:{id:j.id,...fe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.setProfile(Me),k?.(Me)},onErrorHandle:()=>{I.setProfile(j)}});else t.start({payload:{userId:I.user.id,...fe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.setProfile(Me),k?.(Me)},onErrorHandle:()=>{I.setProfile(j)}})},ye=()=>{if(!I.user?.id)return;let W=`temp-${Date.now()}`,j={id:W,...qe,ownerType:"user",ownerId:I.user.id,name:qe.name||"New Address"};I.addAddress(j),oe(!1),Le({}),n.start({payload:{...qe,ownerType:"user",ownerId:I.user.id,name:qe.name||"New Address"},onAfterHandle:(Ne)=>{let ze=Ne.data;if(ze)I.removeAddress(W),I.addAddress(ze),u?.(ze)},onErrorHandle:()=>{I.removeAddress(W)}})},V=()=>{if(!_?.id)return;let W=_.id,j=I.addresses.find((ze)=>ze.id===W),Ne={...j,...qe,id:W};I.updateAddress(Ne),T(null),oe(!1),Le({}),a.start({payload:{id:W,...qe},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.updateAddress(Me),S?.(Me)},onErrorHandle:()=>{if(j)I.updateAddress(j)}})},ee=(W)=>{i.start({payload:{id:W},onAfterHandle:()=>{I.removeAddress(W),f?.(W)}})},re=()=>{if(!I.user?.id)return;let W=`temp-${Date.now()}`,j={id:W,...ve,ownerType:"user",ownerId:I.user.id,name:ve.name||"New Phone",number:ve.number||"",countryCode:ve.countryCode||"+1"};I.addPhone(j),$e(!1),B({}),o.start({payload:{...ve,ownerType:"user",ownerId:I.user.id,name:ve.name||"New Phone",number:ve.number||"",countryCode:ve.countryCode||"+1"},onAfterHandle:(Ne)=>{let ze=Ne.data;if(ze)I.removePhone(W),I.addPhone(ze),P?.(ze)},onErrorHandle:()=>{I.removePhone(W)}})},Ke=()=>{if(!ie?.id)return;let W=ie.id,j=I.phones.find((ze)=>ze.id===W),Ne={...j,...ve,id:W};I.updatePhone(Ne),q(null),$e(!1),B({}),s.start({payload:{id:W,...ve},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.updatePhone(Me),x?.(Me)},onErrorHandle:()=>{if(j)I.updatePhone(j)}})},H=(W)=>{l.start({payload:{id:W},onAfterHandle:()=>{I.removePhone(W),z?.(W)}})},ue=(W)=>{let j=W.target.files?.[0];if(!j||!c)return;let Ne=new FormData;Ne.append("files",j),Ne.append("data",JSON.stringify({type:"profile_picture"})),c.start({payload:Ne,onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.addFile(Me),m?.(Me),p?.(Me)}})},We=(W)=>{if(!d)return;let j=I.files.find((ze)=>ze.id===W.id),Ne={...W,type:"profile_picture"};I.updateFile(Ne),d.start({payload:{id:W.id,type:"profile_picture"},onAfterHandle:(ze)=>{let Me=ze.data;if(Me)I.updateFile(Me),y?.(Me),p?.(Me)},onErrorHandle:()=>{if(j)I.updateFile(j)}})},Ue=(W)=>{if(!g)return;g.start({payload:{id:W},onAfterHandle:()=>{I.removeFile(W),v?.(W)}})},gt=(W)=>`${h}/${W.id}`,Ge=(W)=>{return["image","profile_picture"].includes(W.type||"")||W.mimeType?.startsWith("image/")},Qt=(W)=>{T(W),Le({name:W.name,street:W.street,city:W.city,state:W.state,zip:W.zip,country:W.country}),oe(!0)},$t=(W)=>{q(W),B({name:W.name,number:W.number,countryCode:W.countryCode,type:W.type,extension:W.extension}),$e(!0)},zr=()=>{T(null),Le({}),oe(!0)},ne=()=>{q(null),B({}),$e(!0)};return L("main",{ref:O,className:w(N.container.base),"aria-label":"Profile page",children:[b&&L(xt,{},void 0,!1,void 0,this),L("div",{className:N.container.wrapper,children:L("article",{ref:A,className:w(N.card.base,N.card.padding,N.card.background,N.card.border,N.card.shadow,N.card.rounded),children:e.state.isPending?L("div",{className:N.loading.container,children:[L("div",{className:N.loading.spinner},void 0,!1,void 0,this),L("p",{className:N.loading.text,children:"Loading profile..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L(xm,{children:[L(oi,{user:I.user||void 0,profile:I.profile||void 0,profilePicture:I.profilePicture||void 0,fileProxyBasePath:h,onUploadPicture:U&&c?()=>D.current?.click():void 0,isUploading:c?.state.isPending},void 0,!1,void 0,this),L("input",{ref:D,type:"file",accept:"image/*",className:"hidden",onChange:ue},void 0,!1,void 0,this),L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:[L("h2",{className:N.section.title,children:"Profile Information"},void 0,!1,void 0,this),R&&!I.isEditingProfile&&L("button",{type:"button",onClick:()=>I.setEditingProfile(!0),className:N.section.addButton,children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.isEditingProfile?L("div",{className:N.profileForm.container,children:[L("div",{className:N.profileForm.grid,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"firstName",className:N.profileForm.field.label,children:"First Name"},void 0,!1,void 0,this),L("input",{id:"firstName",type:"text",value:fe.firstName||"",onChange:(W)=>xe((j)=>({...j,firstName:W.target.value})),className:N.profileForm.field.input,placeholder:"Enter first name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"lastName",className:N.profileForm.field.label,children:"Last Name"},void 0,!1,void 0,this),L("input",{id:"lastName",type:"text",value:fe.lastName||"",onChange:(W)=>xe((j)=>({...j,lastName:W.target.value})),className:N.profileForm.field.input,placeholder:"Enter last name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>I.setEditingProfile(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:te,disabled:r.state.isPending||t.state.isPending,children:r.state.isPending||t.state.isPending?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):L("div",{className:N.profileForm.grid,children:[L("div",{children:[L("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"First Name"},void 0,!1,void 0,this),L("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:I.profile?.firstName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{children:[L("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Last Name"},void 0,!1,void 0,this),L("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:I.profile?.lastName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:[L("h2",{className:N.section.title,children:"Addresses"},void 0,!1,void 0,this),$&&L("button",{type:"button",onClick:zr,className:N.section.addButton,children:"+ Add Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.addresses.length===0?L("div",{className:N.section.empty.container,children:[L("svg",{className:N.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No addresses"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:N.section.empty.text,children:"No addresses added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:N.section.content,children:I.addresses.map((W)=>L(ai,{address:W,onEdit:Qt,onDelete:ee,isUpdating:a.state.isPending,isDeleting:i.state.isPending,allowEdit:$},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:[L("h2",{className:N.section.title,children:"Phone Numbers"},void 0,!1,void 0,this),J&&L("button",{type:"button",onClick:ne,className:N.section.addButton,children:"+ Add Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.phones.length===0?L("div",{className:N.section.empty.container,children:[L("svg",{className:N.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No phones"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:N.section.empty.text,children:"No phone numbers added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:N.section.content,children:I.phones.map((W)=>L(ii,{phone:W,onEdit:$t,onDelete:H,isUpdating:s.state.isPending,isDeleting:l.state.isPending,allowEdit:J},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:[L("h2",{className:N.section.title,children:"My Files"},void 0,!1,void 0,this),U&&c&&L("button",{type:"button",onClick:()=>D.current?.click(),className:N.section.addButton,children:"+ Upload File"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.files.length===0?L("div",{className:N.section.empty.container,children:[L("svg",{className:N.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"No files"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("p",{className:N.section.empty.text,children:"No files uploaded yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):L("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 sm:gap-4",children:I.files.map((W)=>L("div",{className:w("group relative rounded-lg overflow-hidden border border-zinc-200 dark:border-zinc-700","hover:border-zinc-300 dark:hover:border-zinc-600 transition-all",W.type==="profile_picture"&&"ring-2 ring-blue-500"),children:[Ge(W)?L("img",{src:gt(W),alt:W.originalName||W.name,className:"w-full aspect-square object-cover"},void 0,!1,void 0,this):L("div",{className:"w-full aspect-square bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:L("svg",{className:"w-8 h-8 text-zinc-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[L("title",{children:"File"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all flex items-center justify-center opacity-0 group-hover:opacity-100",children:L("div",{className:"flex gap-1",children:[Ge(W)&&I.profilePicture?.id!==W.id&&d&&L("button",{type:"button",onClick:()=>We(W),disabled:d.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-zinc-100 dark:hover:bg-zinc-700 transition-colors",title:"Set as profile picture",children:L("svg",{className:"w-4 h-4 text-blue-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[L("title",{children:"Set as profile"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),g&&L("button",{type:"button",onClick:()=>Ue(W.id),disabled:g.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors",title:"Delete file",children:L("svg",{className:"w-4 h-4 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[L("title",{children:"Delete"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.type==="profile_picture"&&L("div",{className:"absolute top-1 left-1 px-1.5 py-0.5 bg-blue-500 text-white text-xs rounded-full",children:"Profile"},void 0,!1,void 0,this),L("div",{className:"p-2 bg-white dark:bg-zinc-800",children:L("p",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate",children:W.originalName||W.name},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.roles.length>0&&L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:L("h2",{className:N.section.title,children:"My Roles"},void 0,!1,void 0,this)},void 0,!1,void 0,this),L("div",{className:"flex flex-wrap gap-2",children:I.roles.map((W)=>L("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800",children:[L("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:L("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.name]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(E||M||K||Q)&&L("section",{className:N.section.container,children:[L("div",{className:N.section.titleWrapper,children:L("h2",{className:N.section.title,children:"Account Settings"},void 0,!1,void 0,this)},void 0,!1,void 0,this),L("div",{className:N.accountSettings.container,children:[(E||M)&&L("button",{type:"button",onClick:()=>{if(M)M();else if(E)window.location.href=E},className:N.accountSettings.item,children:[L("div",{className:N.accountSettings.content,children:[L("div",{className:w(N.accountSettings.iconWrapper,"bg-blue-100 dark:bg-blue-900/30"),children:L("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Change Password"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{children:[L("p",{className:N.accountSettings.title,children:"Change Password"},void 0,!1,void 0,this),L("p",{className:N.accountSettings.description,children:"Update your account password"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("svg",{className:N.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Go"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(K||Q)&&L("button",{type:"button",onClick:()=>{if(Q)Q();else if(K)window.location.href=K},className:N.accountSettings.item,children:[L("div",{className:N.accountSettings.content,children:[L("div",{className:w(N.accountSettings.iconWrapper,"bg-green-100 dark:bg-green-900/30"),children:L("svg",{className:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Devices"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),L("div",{children:[L("p",{className:N.accountSettings.title,children:"Active Sessions"},void 0,!1,void 0,this),L("p",{className:N.accountSettings.description,children:"Manage your logged-in devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("svg",{className:N.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[L("title",{children:"Go"},void 0,!1,void 0,this),L("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ce&&L("div",{className:N.modal.overlay,onMouseDown:(W)=>{Pe.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Pe.current===W.target)oe(!1)},onKeyDown:(W)=>W.key==="Escape"&&oe(!1),role:"dialog","aria-modal":"true",children:L("div",{className:N.modal.container,role:"document",children:[L("h2",{className:N.modal.title,children:_?"Edit Address":"Add Address"},void 0,!1,void 0,this),L("div",{className:N.modal.form,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"addressName",className:N.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),L("input",{id:"addressName",type:"text",value:qe.name||"",onChange:(W)=>Le((j)=>({...j,name:W.target.value})),className:N.profileForm.field.input,placeholder:"e.g., Home, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"street",className:N.profileForm.field.label,children:"Street"},void 0,!1,void 0,this),L("input",{id:"street",type:"text",value:qe.street||"",onChange:(W)=>Le((j)=>({...j,street:W.target.value})),className:N.profileForm.field.input,placeholder:"Street address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.grid,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"city",className:N.profileForm.field.label,children:"City"},void 0,!1,void 0,this),L("input",{id:"city",type:"text",value:qe.city||"",onChange:(W)=>Le((j)=>({...j,city:W.target.value})),className:N.profileForm.field.input,placeholder:"City"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"state",className:N.profileForm.field.label,children:"State/Province"},void 0,!1,void 0,this),L("input",{id:"state",type:"text",value:qe.state||"",onChange:(W)=>Le((j)=>({...j,state:W.target.value})),className:N.profileForm.field.input,placeholder:"State"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.grid,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"zip",className:N.profileForm.field.label,children:"ZIP Code"},void 0,!1,void 0,this),L("input",{id:"zip",type:"text",value:qe.zip||"",onChange:(W)=>Le((j)=>({...j,zip:W.target.value})),className:N.profileForm.field.input,placeholder:"ZIP"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"country",className:N.profileForm.field.label,children:"Country"},void 0,!1,void 0,this),L("input",{id:"country",type:"text",value:qe.country||"",onChange:(W)=>Le((j)=>({...j,country:W.target.value})),className:N.profileForm.field.input,placeholder:"Country"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.modal.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>oe(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:_?V:ye,disabled:n.state.isPending||a.state.isPending,children:n.state.isPending||a.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ze&&L("div",{className:N.modal.overlay,onMouseDown:(W)=>{Pe.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Pe.current===W.target)$e(!1)},onKeyDown:(W)=>W.key==="Escape"&&$e(!1),role:"dialog","aria-modal":"true",children:L("div",{className:N.modal.container,role:"document",children:[L("h2",{className:N.modal.title,children:ie?"Edit Phone":"Add Phone"},void 0,!1,void 0,this),L("div",{className:N.modal.form,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"phoneName",className:N.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),L("input",{id:"phoneName",type:"text",value:ve.name||"",onChange:(W)=>B((j)=>({...j,name:W.target.value})),className:N.profileForm.field.input,placeholder:"e.g., Mobile, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"phoneType",className:N.profileForm.field.label,children:"Type"},void 0,!1,void 0,this),L("select",{id:"phoneType",value:ve.type||"",onChange:(W)=>{let j=W.target.value;B((Ne)=>({...Ne,type:j||void 0}))},className:N.profileForm.field.input,children:[L("option",{value:"",children:"Select type"},void 0,!1,void 0,this),L("option",{value:"mobile",children:"Mobile"},void 0,!1,void 0,this),L("option",{value:"office",children:"Office"},void 0,!1,void 0,this),L("option",{value:"fax",children:"Fax"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.grid,children:[L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"countryCode",className:N.profileForm.field.label,children:"Country Code"},void 0,!1,void 0,this),L("input",{id:"countryCode",type:"text",value:ve.countryCode||"+1",onChange:(W)=>B((j)=>({...j,countryCode:W.target.value})),className:N.profileForm.field.input,placeholder:"+1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"phoneNumber",className:N.profileForm.field.label,children:"Number"},void 0,!1,void 0,this),L("input",{id:"phoneNumber",type:"tel",value:ve.number||"",onChange:(W)=>B((j)=>({...j,number:W.target.value})),className:N.profileForm.field.input,placeholder:"Phone number"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.profileForm.field.container,children:[L("label",{htmlFor:"extension",className:N.profileForm.field.label,children:"Extension (optional)"},void 0,!1,void 0,this),L("input",{id:"extension",type:"text",value:ve.extension||"",onChange:(W)=>B((j)=>({...j,extension:W.target.value})),className:N.profileForm.field.input,placeholder:"Extension"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),L("div",{className:N.modal.actions,children:[L(se,{variant:"outline",size:"sm",onClick:()=>$e(!1),children:"Cancel"},void 0,!1,void 0,this),L(se,{variant:"primary",size:"sm",onClick:ie?Ke:re,disabled:o.state.isPending||s.state.isPending,children:o.state.isPending||s.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var _r={container:{base:"relative min-h-screen w-full flex items-center justify-center py-8 sm:py-12",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4",row:"grid grid-cols-1 sm:grid-cols-2 gap-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-start",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer leading-tight"},links:{container:"flex items-center justify-between mt-1",terms:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signIn:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},passwordStrength:{container:"mt-2",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-300",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-lime-500",veryStrong:"bg-green-500"},inactive:"bg-zinc-200 dark:bg-zinc-700"},requirements:{container:"mt-3 space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-500",unmet:"text-zinc-300 dark:text-zinc-600"}}},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as cr}from"react/jsx-dev-runtime";var zm=()=>cr("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:cr("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Nm=()=>cr("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:cr("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function di({strength:e,showRequirements:t=!0,passwordMinLength:r=8,requireUppercase:n=!0,requireLowercase:a=!0,requireNumber:i=!0,requireSpecialChar:o=!0}){let s=_r.passwordStrength,l=(d)=>{if(d>=e.score)return s.bar.inactive;if(e.score===1)return s.bar.active.weak;if(e.score===2)return s.bar.active.fair;if(e.score===3)return s.bar.active.good;if(e.score===4)return s.bar.active.strong;return s.bar.active.veryStrong},c=[{key:"minLength",label:`At least ${r} characters`,met:e.hasMinLength,show:!0},{key:"uppercase",label:"One uppercase letter",met:e.hasUppercase,show:n},{key:"lowercase",label:"One lowercase letter",met:e.hasLowercase,show:a},{key:"number",label:"One number",met:e.hasNumber,show:i},{key:"special",label:"One special character",met:e.hasSpecialChar,show:o}].filter((d)=>d.show);return cr("div",{className:s.container,children:[cr("div",{className:s.bar.wrapper,role:"progressbar","aria-valuenow":e.score,"aria-valuemin":0,"aria-valuemax":5,"aria-label":"Password strength",children:[0,1,2,3,4].map((d)=>cr("div",{className:w(s.bar.segment,l(d))},d,!1,void 0,this))},void 0,!1,void 0,this),t&&cr("ul",{className:s.requirements.container,"aria-label":"Password requirements",children:c.map((d)=>cr("li",{className:w(s.requirements.item,d.met?s.requirements.met:s.requirements.unmet),children:[cr("span",{className:d.met?s.requirements.icon.met:s.requirements.icon.unmet,children:d.met?cr(zm,{},void 0,!1,void 0,this):cr(Nm,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),cr("span",{children:d.label},void 0,!1,void 0,this)]},d.key,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as _c}from"@gsap/react";import Do from"gsap";import{useRef as Lm}from"react";import{batch as Sm,createStore as Cm}from"h-state";var Pm=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},Tm={email:"",password:"",confirmPassword:"",firstName:"",lastName:"",acceptTerms:!1,isLoading:!1,error:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:ci}=Cm(Tm,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t,r=8)=>{if(e.password=t,e.passwordStrength=Pm(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setFirstName:(e)=>(t)=>{if(e.firstName=t,e.error)e.error=null},setLastName:(e)=>(t)=>{if(e.lastName=t,e.error)e.error=null},setAcceptTerms:(e)=>(t)=>{if(e.acceptTerms=t,e.error)e.error=null},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Sm(()=>{e.email="",e.password="",e.confirmPassword="",e.firstName="",e.lastName="",e.acceptTerms=!1,e.isLoading=!1,e.error=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as ct,Fragment as Mm}from"react/jsx-dev-runtime";Do.registerPlugin(_c);function Vo({registerAction:e,showFirstName:t=!1,showLastName:r=!1,showTerms:n=!0,showSignIn:a=!0,termsHref:i,privacyHref:o,signInHref:s,onTermsClick:l,onPrivacyClick:c,onSignIn:d,onSuccess:g,passwordMinLength:h=8,requireUppercase:k=!0,requireLowercase:u=!0,requireNumber:S=!0,requireSpecialChar:f=!1,createProfileOnRegister:P=!1}){let x=_r,z=Lm(null),m=ci(),{contextSafe:y}=_c({scope:z}),v=e.state.isPending,p=()=>{if(!m.email)return"Email is required";if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m.email))return"Please enter a valid email address";if(!m.password)return"Password is required";if(m.password.length<h)return`Password must be at least ${h} characters`;if(k&&!m.passwordStrength.hasUppercase)return"Password must contain at least one uppercase letter";if(u&&!m.passwordStrength.hasLowercase)return"Password must contain at least one lowercase letter";if(S&&!m.passwordStrength.hasNumber)return"Password must contain at least one number";if(f&&!m.passwordStrength.hasSpecialChar)return"Password must contain at least one special character";if(!m.confirmPassword)return"Please confirm your password";if(m.password!==m.confirmPassword)return"Passwords do not match";if(n&&!m.acceptTerms)return"You must accept the terms and conditions";return null},b=y((E)=>{E.preventDefault();let K=p();if(K){m.setError(K),R();return}m.setError(null),e.start({payload:{email:m.email,password:m.password,...t&&m.firstName?{firstName:m.firstName}:{},...r&&m.lastName?{lastName:m.lastName}:{},...P?{createProfile:!0}:{}},onAfterHandle:()=>{m.reset(),g?.()},onErrorHandle:(M)=>{let Q="Registration failed. Please try again.";if(M&&typeof M==="object"){if("message"in M&&typeof M.message==="string")try{let N=JSON.parse(M.message);Q=N.message||N.error||M.message}catch{Q=M.message}else if("error"in M&&typeof M.error==="string")Q=M.error}else if(M instanceof Error)Q=M.message;m.setError(Q),R()}})}),R=y(()=>{if(!z.current)return;Do.fromTo(z.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Do.set(z.current,{x:0})}})}),$=()=>{if(l)l();else if(i)window.location.href=i},J=()=>{if(c)c();else if(o)window.location.href=o},U=()=>{if(d)d();else if(s)window.location.href=s};return ct("form",{ref:z,onSubmit:b,className:x.form.container,noValidate:!0,children:[m.error&&ct("div",{className:x.error.container,role:"alert",children:ct("p",{className:x.error.text,children:m.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:x.form.spacing,children:[(t||r)&&ct("div",{className:x.form.row,children:[t&&ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"text",label:"First Name",placeholder:"John",value:m.firstName,onChange:m.setFirstName,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"text",label:"Last Name",placeholder:"Doe",value:m.lastName,onChange:m.setLastName,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"email",label:"Email",placeholder:"you@example.com",value:m.email,onChange:m.setEmail,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:x.input.wrapper,children:[ct(Ee,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:m.password,onChange:(E)=>m.setPassword(E,h),disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this),m.password&&ct(di,{strength:m.passwordStrength,passwordMinLength:h,requireUppercase:k,requireLowercase:u,requireNumber:S,requireSpecialChar:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.input.wrapper,children:ct(Ee,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:m.confirmPassword,onChange:m.setConfirmPassword,disabled:v,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),n&&ct("div",{className:x.checkbox.wrapper,children:[ct(hr,{checked:m.acceptTerms,onChange:m.setAcceptTerms,disabled:v,size:"sm"},void 0,!1,void 0,this),ct("span",{className:x.checkbox.label,children:["I agree to the"," ",ct("button",{type:"button",onClick:$,className:x.links.terms,children:"Terms of Service"},void 0,!1,void 0,this),(o||c)&&ct(Mm,{children:[" ","and"," ",ct("button",{type:"button",onClick:J,className:x.links.terms,children:"Privacy Policy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:x.button.wrapper,children:ct(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:v,disabled:v,children:"Create Account"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&ct("div",{className:x.links.signIn.wrapper,children:ct("span",{className:x.links.signIn.text,children:["Already have an account?"," ",ct("button",{type:"button",onClick:U,className:x.links.signIn.link,disabled:v,children:"Sign in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as pi}from"react/jsx-dev-runtime";function jo({logo:e,title:t="Create Account",subtitle:r="Sign up to get started"}){let n=_r;return pi("header",{className:n.header.container,children:[e&&pi("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),pi("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),r&&pi("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Oc}from"@gsap/react";import qc from"gsap";import{useRef as Fc}from"react";import{jsxDEV as Rn}from"react/jsx-dev-runtime";qc.registerPlugin(Oc);function Jc({variant:e="default",logo:t,title:r="Create Account",subtitle:n="Sign up to get started with your account",showFirstName:a,showLastName:i,showTerms:o=!0,showSignIn:s=!0,termsHref:l,privacyHref:c,signInHref:d,registerAction:g,onTermsClick:h,onPrivacyClick:k,onSignIn:u,onSuccess:S,showBackground:f=!0,className:P,passwordMinLength:x,requireUppercase:z,requireLowercase:m,requireNumber:y,requireSpecialChar:v,config:p}){let b=p?.register?.showFirstName??a??!1,R=p?.register?.showLastName??i??!1,$=p?.register?.termsUrl??l,J=p?.register?.privacyUrl??c,U=p?.passwordPolicy?.minLength??x??8,E=p?.passwordPolicy?.requireUppercase??z??!0,K=p?.passwordPolicy?.requireLowercase??m??!0,M=p?.passwordPolicy?.requireNumber??y??!0,Q=p?.passwordPolicy?.requireSpecialChar??v??!1,N=p?.register?.createProfileOnRegister??(b||R),O=_r,A=Fc(null),D=Fc(null);return Oc(()=>{if(!D.current)return;qc.fromTo(D.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:A}),Rn("main",{ref:A,className:w(O.container.base,P),"aria-label":"Registration page",children:[f&&Rn(xt,{},void 0,!1,void 0,this),Rn("div",{className:O.container.wrapper,children:Rn("article",{ref:D,className:w(O.card.base,O.card.padding,O.card.background,O.card.border,O.card.shadow,O.card.rounded),children:[Rn(jo,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),Rn(Vo,{registerAction:g,showFirstName:b,showLastName:R,showTerms:o,showSignIn:s,termsHref:$,privacyHref:J,signInHref:d,onTermsClick:h,onPrivacyClick:k,onSignIn:u,onSuccess:S,passwordMinLength:U,requireUppercase:E,requireLowercase:K,requireNumber:M,requireSpecialChar:Q,createProfileOnRegister:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as el}from"@gsap/react";import gi from"gsap";import{useMemo as Im,useRef as Gc}from"react";var Bn={minLength:8,maxLength:128,requireUppercase:!0,requireLowercase:!0,requireNumber:!0,requireSpecialChar:!1,specialChars:"!@#$%^&*()_+-=[]{}|;:,.<>?",preventCommonPasswords:!0,preventUserInfoInPassword:!0,showStrengthIndicator:!0};import{batch as Rm,createStore as Bm}from"h-state";var Wm={newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:ui}=Bm(Wm,{setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Rm(()=>{e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var gn={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"},requirements:{container:"mt-3 p-3 rounded-lg bg-zinc-50 dark:bg-zinc-800/50",title:"text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-2",list:"space-y-1",item:"text-xs flex items-center gap-2",itemValid:"text-green-600 dark:text-green-400",itemInvalid:"text-zinc-400 dark:text-zinc-500"}};import{jsxDEV as Ye}from"react/jsx-dev-runtime";gi.registerPlugin(el);function Ac({className:e}){return Ye("svg",{className:w("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ye("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Hm({className:e}){return Ye("svg",{className:w("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ye("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function $m({className:e}){return Ye("svg",{className:w("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ye("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function _m({className:e}){return Ye("svg",{className:w("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ye("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function tl({token:e,resetPasswordAction:t,onBackToLogin:r,backToLoginHref:n,passwordPolicy:a={}}){let i=gn,o=Gc(null),s=Gc(null),l=ui(),c={...Bn,...a},d=Im(()=>{let f=[{key:"length",label:`At least ${c.minLength} characters`,test:(P)=>P.length>=c.minLength}];if(c.requireUppercase)f.push({key:"uppercase",label:"One uppercase letter",test:(P)=>/[A-Z]/.test(P)});if(c.requireLowercase)f.push({key:"lowercase",label:"One lowercase letter",test:(P)=>/[a-z]/.test(P)});if(c.requireNumber)f.push({key:"number",label:"One number",test:(P)=>/\d/.test(P)});if(c.requireSpecialChar)f.push({key:"special",label:"One special character",test:(P)=>{let x=c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(`[${x}]`).test(P)}});return f},[c.minLength,c.requireUppercase,c.requireLowercase,c.requireNumber,c.requireSpecialChar,c.specialChars]),{contextSafe:g}=el({scope:o}),h=t.state.isPending,k=g((f)=>{if(f.preventDefault(),!l.newPassword||!l.confirmPassword){l.setError("Please fill in all fields"),u();return}if(l.newPassword!==l.confirmPassword){l.setError("Passwords do not match"),u();return}if(!d.every((x)=>x.test(l.newPassword))){l.setError("Password does not meet all requirements"),u();return}l.setError(null),t.start({payload:{token:e,newPassword:l.newPassword,confirmPassword:l.confirmPassword},onAfterHandle:()=>{l.setStep("success")},onErrorHandle:(x)=>{let z=x instanceof Error?x.message:"Failed to reset password. Please try again.";l.setError(z),u()}})}),u=g(()=>{if(!o.current)return;gi.fromTo(o.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{gi.set(o.current,{x:0})}})});el(()=>{if(l.step==="success"&&s.current)gi.fromTo(s.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[l.step]});let S=()=>{if(r)r();else if(n)window.location.href=n};if(l.step==="success")return Ye("div",{ref:s,className:i.success.container,children:[Ye("div",{className:i.success.iconWrapper,children:Ye(Hm,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ye("h2",{className:i.success.title,children:"Password Reset Successful"},void 0,!1,void 0,this),Ye("p",{className:i.success.message,children:"Your password has been successfully reset. You can now log in with your new password."},void 0,!1,void 0,this),Ye("div",{className:i.links.container,children:Ye("button",{type:"button",onClick:S,className:i.links.backToLogin,children:[Ye(Ac,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ye("form",{ref:o,onSubmit:k,className:i.form.container,noValidate:!0,children:[l.error&&Ye("div",{className:i.error.container,role:"alert",children:Ye("p",{className:i.error.text,children:l.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ye("div",{className:i.form.spacing,children:[Ye("div",{className:i.input.wrapper,children:Ye(Ee,{type:"password",label:"New Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.newPassword,onChange:l.setNewPassword,disabled:h,enableValidation:!1,isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ye("div",{className:i.input.wrapper,children:Ye(Ee,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.confirmPassword,onChange:l.setConfirmPassword,disabled:h,enableValidation:!1,isNewPassword:!0,confirmValue:l.newPassword,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),l.newPassword&&Ye("div",{className:i.requirements.container,children:[Ye("p",{className:i.requirements.title,children:"Password requirements:"},void 0,!1,void 0,this),Ye("ul",{className:i.requirements.list,children:d.map((f)=>{let P=f.test(l.newPassword);return Ye("li",{className:w(i.requirements.item,P?i.requirements.itemValid:i.requirements.itemInvalid),children:[P?Ye($m,{},void 0,!1,void 0,this):Ye(_m,{},void 0,!1,void 0,this),f.label]},f.key,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ye("div",{className:i.button.wrapper,children:Ye(se,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:h,disabled:h,children:"Reset Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ye("div",{className:i.links.container,children:Ye("button",{type:"button",onClick:S,className:i.links.backToLogin,disabled:h,children:[Ye(Ac,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Xr}from"react/jsx-dev-runtime";function Fm({className:e}){return Xr("svg",{className:w("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Xr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function rl({logo:e,title:t,subtitle:r}){let n=gn;return Xr("header",{className:n.header.container,children:[e?Xr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):Xr("div",{className:n.header.iconWrapper,children:Xr(Fm,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Xr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),Xr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Kc}from"@gsap/react";import Zc from"gsap";import{useRef as Yc}from"react";import{jsxDEV as Wn}from"react/jsx-dev-runtime";Zc.registerPlugin(Kc);function Qc({logo:e,title:t="Reset Password",subtitle:r="Enter your new password below.",token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,showBackground:s=!0,className:l,passwordPolicy:c}){let d=gn,g=Yc(null),h=Yc(null);return Kc(()=>{if(!h.current)return;Zc.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g}),Wn("main",{ref:g,className:w(d.container.base,l),"aria-label":"Reset password page",children:[s&&Wn(xt,{},void 0,!1,void 0,this),Wn("div",{className:d.container.wrapper,children:Wn("article",{ref:h,className:w(d.card.base,d.card.padding,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:[Wn(rl,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Wn(tl,{token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,passwordPolicy:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ur={container:{base:"min-h-screen flex items-center justify-center bg-gradient-to-br from-zinc-50 via-zinc-100 to-zinc-200 dark:from-zinc-900 dark:via-zinc-900 dark:to-zinc-800 px-4 sm:px-6 lg:px-8",wrapper:"w-full max-w-md relative z-10"},card:{base:"relative overflow-hidden",padding:"p-6 sm:p-8 lg:p-10",background:"bg-white dark:bg-zinc-800",border:"border border-zinc-200 dark:border-zinc-700",shadow:"shadow-xl",rounded:"rounded-2xl"},header:{wrapper:"text-center mb-6 sm:mb-8",logo:"mx-auto mb-4 sm:mb-6",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-2 sm:mb-3",subtitle:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400"},form:{wrapper:"space-y-4 sm:space-y-5",inputGroup:"space-y-1",label:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 sm:px-4 py-2 sm:py-3 border border-zinc-300 dark:border-zinc-600 rounded-xl bg-white dark:bg-zinc-700 text-zinc-900 dark:text-white placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",error:"text-sm text-red-500 dark:text-red-400 mt-1",submitButton:"w-full py-2.5 sm:py-3 px-4 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",backLink:"w-full mt-3 sm:mt-4 text-center",backLinkText:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"},alert:{error:"mb-4 p-3 sm:p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl text-red-600 dark:text-red-400 text-sm",success:"text-center"},states:{verifying:{wrapper:"text-center py-8",iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-6",spinner:"animate-spin rounded-full h-8 w-8 sm:h-10 sm:w-10 border-3 border-blue-600 border-t-transparent",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base"},error:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-red-500 dark:text-red-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 mb-2 text-sm sm:text-base",errorMessage:"text-red-500 dark:text-red-400 text-sm mb-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 rounded-lg",helpText:"text-zinc-500 dark:text-zinc-500 text-sm mb-8",buttonPrimary:"w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",buttonSecondary:"w-full py-3 px-4 bg-zinc-100 dark:bg-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-600 text-zinc-700 dark:text-zinc-300 font-medium rounded-xl transition-colors duration-200"},success:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-green-500 dark:text-green-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base mb-6",redirectSpinner:"animate-spin rounded-full h-4 w-4 border-2 border-zinc-400 border-t-transparent",redirectText:"text-zinc-500 dark:text-zinc-400 text-sm"}},footer:"text-center text-zinc-500 dark:text-zinc-500 text-xs mt-6",layout:{textCenter:"text-center",buttonGroup:"space-y-3",redirectWrapper:"flex items-center justify-center gap-2"},passwordStrength:{container:"mt-3 space-y-3",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-200",inactive:"bg-zinc-200 dark:bg-zinc-700",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-green-500",veryStrong:"bg-emerald-500"}},requirements:{container:"space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500"}}}};import{jsxDEV as c6}from"react/jsx-dev-runtime";import{batch as Om,createStore as qm}from"h-state";var Jm=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},Gm={newPassword:"",confirmPassword:"",step:"verifying",error:null,userId:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:In}=qm(Gm,{setNewPassword:(e)=>(t,r=8)=>{if(e.newPassword=t,e.passwordStrength=Jm(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},setUserId:(e)=>(t)=>{e.userId=t},reset:(e)=>()=>{Om(()=>{e.newPassword="",e.confirmPassword="",e.step="verifying",e.error=null,e.userId=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as Er}from"react/jsx-dev-runtime";function nl({passwordChangeAction:e,passwordSetAction:t,isInvite:r=!1,onSuccess:n,onBackToLogin:a,backToLoginHref:i,passwordPolicy:o={}}){let s=Ur,l=In(),c={...Bn,...o},d=r&&t?t:e,g=()=>{if(!l.newPassword)return"Password is required";if(l.newPassword.length<c.minLength)return`Password must be at least ${c.minLength} characters`;if(c.maxLength&&l.newPassword.length>c.maxLength)return`Password must be at most ${c.maxLength} characters`;if(c.requireUppercase&&!/[A-Z]/.test(l.newPassword))return"Password must contain at least one uppercase letter";if(c.requireLowercase&&!/[a-z]/.test(l.newPassword))return"Password must contain at least one lowercase letter";if(c.requireNumber&&!/[0-9]/.test(l.newPassword))return"Password must contain at least one number";if(c.requireSpecialChar){if(!new RegExp(`[${c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}]`).test(l.newPassword))return"Password must contain at least one special character"}if(!l.confirmPassword)return"Please confirm your password";if(l.newPassword!==l.confirmPassword)return"Passwords do not match";return null};return Er("form",{onSubmit:(k)=>{k.preventDefault();let u=g();if(u){l.setError(u);return}if(l.setError(null),!d){l.setError("No action configured");return}let S=()=>{if(l.setStep("success"),n)setTimeout(n,2000);else if(a)setTimeout(a,2000)},f=(P)=>{l.setError(P?.message||"Failed to set password")};if(r&&t&&l.userId)t.start({payload:{newPassword:l.newPassword,userId:l.userId},onAfterHandle:S,onErrorHandle:f});else if(e)e.start({payload:{currentPassword:"",newPassword:l.newPassword,confirmPassword:l.confirmPassword},onAfterHandle:S,onErrorHandle:f})},className:s.form.wrapper,children:[l.error&&Er("div",{className:s.alert.error,role:"alert",children:l.error},void 0,!1,void 0,this),Er(Ee,{type:"password",label:"New Password",value:l.newPassword,onChange:(k)=>l.setNewPassword(k,c.minLength),placeholder:"Enter your new password",isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,enableValidation:!1},void 0,!1,void 0,this),Er(Ee,{type:"password",label:"Confirm Password",value:l.confirmPassword,onChange:l.setConfirmPassword,placeholder:"Confirm your new password",isNewPassword:!0,confirmValue:l.newPassword,enableValidation:!1},void 0,!1,void 0,this),Er("button",{type:"submit",disabled:d?.state.isPending,className:s.form.submitButton,children:d?.state.isPending?"Setting Password...":"Set Password"},void 0,!1,void 0,this),Er("div",{className:s.form.backLink,children:i?Er("a",{href:i,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):a?Er("button",{type:"button",onClick:a,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as mi}from"react/jsx-dev-runtime";function al({logo:e,title:t,subtitle:r}){let n=Ur;return mi("header",{className:n.header.wrapper,children:[e&&mi("div",{className:n.header.logo,children:e},void 0,!1,void 0,this),mi("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),mi("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Uc}from"@gsap/react";import Ec from"gsap";import{useEffect as Am,useEffectEvent as Ym,useRef as Xc}from"react";import{jsxDEV as Ce}from"react/jsx-dev-runtime";Ec.registerPlugin(Uc);function Dc({logo:e,title:t="Set Password",subtitle:r="Enter your new password below.",inviteTitle:n="Set Your Password",inviteSubtitle:a="Welcome! Please set your password to complete your account setup.",token:i,isInvite:o=!1,magicLinkVerifyAction:s,passwordChangeAction:l,passwordSetAction:c,onBackToLogin:d,onSuccess:g,backToLoginHref:h,showBackground:k=!0,className:u,passwordPolicy:S}){let f=Ur,P=Xc(null),x=Xc(null),z=In(),m=Ym((p)=>{if(!p){z.setStep("error"),z.setError("Invalid or missing token");return}s.start({payload:{token:p},onAfterHandle:(b)=>{let $=b?.data?.user?.id;if($)z.setUserId($);z.setStep("form")},onErrorHandle:(b)=>{z.setStep("error"),z.setError(b?.message||"Token verification failed")}})});Am(()=>{return m(i),()=>{z.reset()}},[i]),Uc(()=>{if(!x.current)return;Ec.fromTo(x.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:P});let y=o?n:t,v=o?a:r;if(z.step==="verifying")return Ce("main",{ref:P,className:w(f.container.base,u),children:[k&&Ce(xt,{},void 0,!1,void 0,this),Ce("div",{className:f.container.wrapper,children:Ce("article",{ref:x,className:w(f.card.base,f.card.padding,f.card.background,f.card.border,f.card.shadow,f.card.rounded),children:Ce("div",{className:f.states.verifying.wrapper,children:[Ce("div",{className:f.states.verifying.iconWrapper,children:Ce("div",{className:f.states.verifying.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("h1",{className:f.states.verifying.title,children:"Verifying Invitation"},void 0,!1,void 0,this),Ce("p",{className:f.states.verifying.subtitle,children:"Please wait while we verify your invitation link..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(z.step==="error")return Ce("main",{ref:P,className:w(f.container.base,u),children:[k&&Ce(xt,{},void 0,!1,void 0,this),Ce("div",{className:f.container.wrapper,children:Ce("article",{ref:x,className:w(f.card.base,f.card.padding,f.card.background,f.card.border,f.card.shadow,f.card.rounded),children:[Ce("div",{className:f.layout.textCenter,children:[Ce("div",{className:f.states.error.iconWrapper,children:Ce("svg",{className:f.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("h1",{className:f.states.error.title,children:"Invalid Link"},void 0,!1,void 0,this),Ce("p",{className:f.states.error.subtitle,children:o?"This invitation link is invalid or has expired.":"This link is invalid or has expired."},void 0,!1,void 0,this),z.error&&z.error!=="Token verification failed"&&Ce("p",{className:f.states.error.errorMessage,children:z.error},void 0,!1,void 0,this),Ce("p",{className:f.states.error.helpText,children:o?"Please contact your administrator to request a new invitation.":"Please request a new link or contact support."},void 0,!1,void 0,this),Ce("div",{className:f.layout.buttonGroup,children:h?Ce("a",{href:h,className:f.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this):Ce("button",{type:"button",onClick:d,className:f.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ce("p",{className:f.footer,children:"Need help? Contact your system administrator."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(z.step==="success")return Ce("main",{ref:P,className:w(f.container.base,u),children:[k&&Ce(xt,{},void 0,!1,void 0,this),Ce("div",{className:f.container.wrapper,children:Ce("article",{ref:x,className:w(f.card.base,f.card.padding,f.card.background,f.card.border,f.card.shadow,f.card.rounded),children:Ce("div",{className:f.layout.textCenter,children:[Ce("div",{className:f.states.success.iconWrapper,children:Ce("svg",{className:f.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("h1",{className:f.states.success.title,children:"Password Set Successfully!"},void 0,!1,void 0,this),Ce("p",{className:f.states.success.subtitle,children:"Your account is now ready. Redirecting you to login..."},void 0,!1,void 0,this),Ce("div",{className:f.layout.redirectWrapper,children:[Ce("div",{className:f.states.success.redirectSpinner},void 0,!1,void 0,this),Ce("span",{className:f.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ce("main",{ref:P,className:w(f.container.base,u),"aria-label":"Set password page",children:[k&&Ce(xt,{},void 0,!1,void 0,this),Ce("div",{className:f.container.wrapper,children:Ce("article",{ref:x,className:w(f.card.base,f.card.padding,f.card.background,f.card.border,f.card.shadow,f.card.rounded),children:[Ce(al,{logo:e,title:y,subtitle:v},void 0,!1,void 0,this),Ce(nl,{passwordChangeAction:l,passwordSetAction:c,isInvite:o,onSuccess:g,onBackToLogin:d,backToLoginHref:h,passwordPolicy:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as t0}from"@gsap/react";import il from"gsap";import{useEffect as Vc,useRef as jc,useState as e0}from"react";import{jsxDEV as Ve,Fragment as Km}from"react/jsx-dev-runtime";il.registerPlugin(t0);function ol({theme:e,isOpen:t,isLoading:r,onClose:n,onInvite:a}){let[i,o]=e0(""),[s,l]=e0(""),c=jc(null),d=jc(null);t0(()=>{if(!c.current||!d.current)return;if(t)il.fromTo(c.current,{opacity:0},{opacity:1,duration:0.2,ease:"power2.out"}),il.fromTo(d.current,{opacity:0,scale:0.95,y:20},{opacity:1,scale:1,y:0,duration:0.3,ease:"back.out(1.7)"})},{dependencies:[t]}),Vc(()=>{if(t)o(""),l("")},[t]),Vc(()=>{let u=(S)=>{if(S.key==="Escape"&&t&&!r)n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t,r,n]);let g=(u)=>{return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)},h=()=>{if(!i.trim()){l("Email is required");return}if(!g(i)){l("Please enter a valid email address");return}l(""),a(i.trim())},k=(u)=>{if(u.key==="Enter"&&!r)h()};if(!t)return null;return Ve(Km,{children:[Ve("div",{ref:c,className:w(e.modal.overlay),onClick:()=>!r&&n(),"aria-hidden":"true"},void 0,!1,void 0,this),Ve("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:Ve("div",{ref:d,className:w(e.modal.wrapper),role:"dialog","aria-modal":"true","aria-labelledby":"invite-modal-title",children:[Ve("div",{className:w(e.modal.header.wrapper),children:[Ve("div",{className:"flex items-center gap-3",children:[Ve("div",{className:w(e.modal.header.icon),children:Ve("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ve("div",{children:[Ve("h2",{id:"invite-modal-title",className:w(e.modal.header.title),children:"Invite User"},void 0,!1,void 0,this),Ve("p",{className:w(e.modal.header.subtitle),children:"Send an invitation email to add a new user"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ve(se,{variant:"ghost",size:"sm",onClick:n,disabled:r,"aria-label":"Close modal",iconOnly:!0,children:Ve("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve("div",{className:w(e.modal.content),children:Ve("div",{className:"space-y-4",children:[Ve("div",{children:[Ve("label",{htmlFor:"invite-email",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email Address"},void 0,!1,void 0,this),Ve(Ee,{id:"invite-email",type:"email",value:i,onChange:o,onKeyDown:k,placeholder:"colleague@company.com",size:"md",disabled:r,errorMessage:s||void 0,leftIcon:Ve("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ve("div",{className:w(e.modal.infoBox),children:[Ve("svg",{className:"w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ve("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"The user will receive an email with a secure link to set their password and complete registration."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ve("div",{className:w(e.modal.footer),children:[Ve(se,{variant:"outline",size:"md",onClick:n,disabled:r,children:"Cancel"},void 0,!1,void 0,this),Ve(se,{variant:"primary",size:"md",onClick:h,loading:r,leftIcon:Ve("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ve("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:"Send Invitation"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as nr}from"react/jsx-dev-runtime";function ll({theme:e,currentPage:t,totalPages:r,totalItems:n,pageSize:a,pageSizeOptions:i=[10,25,50,100],onPageChange:o,onPageSizeChange:s}){let l=(t-1)*a+1,c=Math.min(t*a,n),d=i.map((h)=>({value:String(h),label:`${h} / page`})),g=()=>{let h=[],k=5;if(r<=5)for(let u=1;u<=r;u++)h.push(u);else{if(h.push(1),t>3)h.push("ellipsis");let u=Math.max(2,t-1),S=Math.min(r-1,t+1);for(let f=u;f<=S;f++)h.push(f);if(t<r-2)h.push("ellipsis");if(r>1)h.push(r)}return h};if(n===0)return null;return nr("div",{className:w(e.pagination.wrapper),children:[nr("div",{className:w(e.pagination.info),children:[nr("span",{className:"hidden sm:inline",children:["Showing ",l,"-",c," of ",n," users"]},void 0,!0,void 0,this),nr("span",{className:"sm:hidden",children:[l,"-",c," / ",n]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),nr("div",{className:"flex items-center gap-3",children:[nr(dr,{options:d,value:String(a),onChange:(h)=>{if(h)s(Number(h))},size:"sm",className:"min-w-[100px]"},void 0,!1,void 0,this),nr("div",{className:w(e.pagination.controls.wrapper),children:[nr(se,{variant:"ghost",size:"sm",onClick:()=>o(t-1),disabled:t===1,"aria-label":"Previous page",iconOnly:!0,children:nr("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:nr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),g().map((h,k)=>h==="ellipsis"?nr("span",{className:"px-2 text-zinc-400 dark:text-zinc-600",children:"..."},`ellipsis-${k}`,!1,void 0,this):nr(se,{variant:h===t?"primary":"ghost",size:"sm",onClick:()=>o(h),children:h},h,!1,void 0,this)),nr(se,{variant:"ghost",size:"sm",onClick:()=>o(t+1),disabled:t===r,"aria-label":"Next page",iconOnly:!0,children:nr("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:nr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as r0}from"@gsap/react";import n0 from"gsap";import{useRef as Zm}from"react";import{jsxDEV as pr}from"react/jsx-dev-runtime";n0.registerPlugin(r0);function sl({theme:e,totalUsers:t,verifiedUsers:r,lockedUsers:n,unverifiedUsers:a}){let i=Zm(null);r0(()=>{if(!i.current)return;let s=i.current.querySelectorAll("[data-stat-card]");n0.fromTo(s,{opacity:0,y:20,scale:0.95},{opacity:1,y:0,scale:1,duration:0.4,stagger:0.08,ease:"back.out(1.7)"})},{scope:i});let o=[{label:"Total Users",value:t,iconColor:"primary",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Verified",value:r,iconColor:"success",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Unverified",value:a,iconColor:"warning",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Locked",value:n,iconColor:"danger",icon:pr("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:pr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}];return pr("div",{ref:i,className:w(e.stats.wrapper),children:o.map((s)=>pr("div",{"data-stat-card":!0,className:w(e.stats.card.base),children:[pr("div",{className:w(e.stats.card.icon.wrapper,e.stats.card.icon[s.iconColor]),children:s.icon},void 0,!1,void 0,this),pr("div",{className:w(e.stats.card.value),children:s.value},void 0,!1,void 0,this),pr("div",{className:w(e.stats.card.label),children:s.label},void 0,!1,void 0,this)]},s.label,!0,void 0,this))},void 0,!1,void 0,this)}import{useEffect as o0,useRef as Um,useState as Em}from"react";import{useEffect as dl,useRef as Qm,useState as a0}from"react";import{createPortal as Xm}from"react-dom";import{jsxDEV as ft}from"react/jsx-dev-runtime";function i0({isOpen:e,roles:t,userRoles:r,userId:n,onClose:a,onAssignRole:i,onRemoveRole:o}){let s=Qm(null),[l,c]=a0(""),[d,g]=a0(!1);if(dl(()=>{g(!0)},[]),dl(()=>{let P=(x)=>{if(x.key==="Escape"&&e)a()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,a]),dl(()=>{if(e)document.body.style.overflow="hidden",c("");else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[e]),!e||!d)return null;let h=r.filter((P)=>P.userId===n).map((P)=>P.roleId),k=t.filter((P)=>P.name.toLowerCase().includes(l.toLowerCase())),u=(P)=>{if(h.includes(P.id)){let z=r.find((m)=>m.userId===n&&m.roleId===P.id);if(z&&!z.id.startsWith("temp-")&&P.name!=="godmin")o(z.id)}else i(n,P.id)},S=(P)=>{if(P.name==="godmin")return!0;return r.find((z)=>z.userId===n&&z.roleId===P.id)?.id.startsWith("temp-")||!1},f=ft("div",{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:99999},children:[ft("div",{className:"fixed inset-0 bg-black/60",onClick:a,"aria-hidden":"true"},void 0,!1,void 0,this),ft("div",{ref:s,className:"relative bg-white dark:bg-zinc-900 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col border border-zinc-200 dark:border-zinc-700",children:[ft("div",{className:"flex items-center justify-between px-5 py-4 border-b border-zinc-200 dark:border-zinc-700",children:[ft("h3",{className:"text-base font-semibold text-zinc-900 dark:text-white",children:"Manage Roles"},void 0,!1,void 0,this),ft("button",{type:"button",onClick:a,className:"p-1 rounded-md text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors","aria-label":"Close",children:ft("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ft("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ft("div",{className:"px-5 py-3 border-b border-zinc-200 dark:border-zinc-700",children:ft("input",{type:"text",placeholder:"Search roles...",value:l,onChange:(P)=>c(P.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg outline-none focus:ring-2 focus:ring-blue-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"flex-1 overflow-y-auto px-3 py-2 min-h-[200px]",children:k.length===0?ft("div",{className:"text-center py-8 text-zinc-500 dark:text-zinc-400 text-sm",children:"No roles found"},void 0,!1,void 0,this):ft("div",{className:"space-y-1",children:k.map((P)=>{let x=h.includes(P.id),z=S(P);return ft("button",{type:"button",onClick:()=>!z&&u(P),disabled:z,className:w("w-full flex items-start gap-3 px-3 py-3 rounded-lg text-left transition-colors",z?"opacity-50 cursor-not-allowed":"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer",x&&!z&&"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30"),children:[ft("div",{className:w("w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-colors",x?"bg-blue-600 border-blue-600":"border-zinc-300 dark:border-zinc-600"),children:x&&ft("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ft("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"flex-1 min-w-0",children:[ft("div",{className:"flex items-center gap-2",children:[ft("span",{className:"font-medium text-sm text-zinc-900 dark:text-white",children:P.name},void 0,!1,void 0,this),P.name==="godmin"&&ft("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 font-medium",children:"Protected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.description&&ft("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",children:P.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.id,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),ft("div",{className:"px-5 py-3 border-t border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 rounded-b-xl",children:ft("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[h.length," role",h.length!==1?"s":""," assigned"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return Xm(f,document.body)}import{jsxDEV as ae,Fragment as Dm}from"react/jsx-dev-runtime";function cl({theme:e,user:t,roles:r,allUserRoles:n,isOpen:a,actionLoading:i,onClose:o,onVerifyEmail:s,onLockAccount:l,onUnlockAccount:c,onResetPassword:d,onSendMagicLink:g,onResendInvite:h,onAssignRole:k,onRemoveRole:u,hasPasswordReset:S=!1,hasMagicLink:f=!1,hasInvite:P=!1}){let x=Um(null),[z,m]=Em(!1);if(o0(()=>{let p=(b)=>{if(b.key==="Escape"&&a)o()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a,o]),o0(()=>{if(a)document.body.style.overflow="hidden";else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[a]),!t||!a)return null;let y=(p)=>{if(!p)return"Never";return(typeof p==="string"?new Date(p):p).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},v=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return(t.email??"").split("@")[0]};return ae(Dm,{children:[ae("div",{className:w(e.detailPanel.overlay),onClick:o,"aria-hidden":"true"},void 0,!1,void 0,this),ae("div",{ref:x,className:w(e.detailPanel.wrapper.base,"lg:relative",e.detailPanel.wrapper.mobile,"sm:rounded-t-2xl md:rounded-none","md:fixed md:inset-y-0 md:right-0 md:w-[400px] md:rounded-l-2xl","lg:static lg:w-full lg:rounded-xl"),children:[ae("div",{className:w(e.detailPanel.header.wrapper),children:[ae("div",{children:[ae("h2",{className:w(e.detailPanel.header.title),children:v()},void 0,!1,void 0,this),ae("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:t.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae(se,{variant:"ghost",size:"sm",onClick:o,"aria-label":"Close panel",iconOnly:!0,children:ae("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ae("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.wrapper),children:[ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:"Account Status"},void 0,!1,void 0,this),ae("div",{className:w(e.detailPanel.content.section.content),children:[ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Status"},void 0,!1,void 0,this),ae("span",{className:w("text-sm font-medium",t.isLocked?"text-red-600 dark:text-red-400":t.verifiedAt?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"),children:t.isLocked?"Locked":t.verifiedAt?"Active":"Unverified"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Last Login"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.lastLoginAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Login Count"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:t.loginCount||0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Created"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.isLocked&&t.lockedUntil&&ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Locked Until"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:y(t.lockedUntil)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t.profile&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:"Profile"},void 0,!1,void 0,this),ae("div",{className:w(e.detailPanel.content.section.content),children:ae("div",{className:w(e.detailPanel.content.row.wrapper),children:[ae("span",{className:w(e.detailPanel.content.row.label),children:"Name"},void 0,!1,void 0,this),ae("span",{className:w(e.detailPanel.content.row.value),children:[t.profile.firstName," ",t.profile.lastName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.addresses&&t.addresses.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Addresses (",t.addresses.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:t.addresses.map((p)=>ae("div",{className:w(e.detailPanel.content.section.content),children:[ae("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:p.name||"Address"},void 0,!1,void 0,this),ae("div",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[p.street,p.city,p.state,p.zip,p.country].filter(Boolean).join(", ")},void 0,!1,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.phones&&t.phones.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Phones (",t.phones.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:t.phones.map((p)=>ae("div",{className:w(e.detailPanel.content.section.content,"flex justify-between items-center"),children:[ae("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:p.name||p.type||"Phone"},void 0,!1,void 0,this),ae("span",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:[p.countryCode," ",p.number]},void 0,!0,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.files&&t.files.length>0&&ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("h3",{className:w(e.detailPanel.content.section.title),children:["Files (",t.files.length,")"]},void 0,!0,void 0,this),ae("div",{className:"space-y-2",children:[t.files.slice(0,5).map((p)=>ae("div",{className:w(e.detailPanel.content.section.content,"flex justify-between items-center"),children:ae("div",{className:"min-w-0 flex-1",children:[ae("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:p.originalName||p.name},void 0,!1,void 0,this),ae("div",{className:"text-xs text-zinc-500",children:[p.mimeType," \u2022 ",Math.round((p.size||0)/1024),"KB"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},p.id,!1,void 0,this)),t.files.length>5&&ae("div",{className:"text-xs text-zinc-500 dark:text-zinc-400 text-center py-1",children:["+",t.files.length-5," more files"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ae("section",{className:w(e.detailPanel.content.section.wrapper),children:[ae("div",{className:"flex items-center justify-between mb-3",children:[ae("h3",{className:w(e.detailPanel.content.section.title,"mb-0"),children:"Roles"},void 0,!1,void 0,this),ae(se,{variant:"ghost",size:"xs",onClick:()=>m(!0),className:"text-blue-600 hover:text-blue-700 dark:text-blue-400",children:"Manage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:"flex flex-wrap gap-2",children:(()=>{let p=new Set,b=n.filter((R)=>R.userId===t.id).filter((R)=>{if(p.has(R.roleId))return!1;return p.add(R.roleId),!0});return b.length>0?b.map((R)=>{let $=r.find((U)=>U.id===R.roleId),J=R.id.startsWith("temp-");return ae("span",{className:w("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium",J?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500":"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"),children:[$?.name||"...",$?.name==="godmin"&&ae("svg",{className:"w-3 h-3 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:ae("path",{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},R.id,!0,void 0,this)}):ae("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No roles assigned"},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae(i0,{isOpen:z,roles:r,userRoles:n,userId:t.id,onClose:()=>m(!1),onAssignRole:k,onRemoveRole:u},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ae("div",{className:w(e.detailPanel.actions.wrapper),children:ae("div",{className:"grid grid-cols-2 gap-2",children:[!t.verifiedAt&&ae(se,{variant:"success",size:"sm",onClick:()=>s(t.id),loading:i===`verify-${t.id}`,fullWidth:!0,children:"Verify Email"},void 0,!1,void 0,this),t.isLocked?ae(se,{variant:"primary",size:"sm",onClick:()=>c(t.id),loading:i===`unlock-${t.id}`,fullWidth:!0,children:"Unlock Account"},void 0,!1,void 0,this):ae(se,{variant:"danger",size:"sm",onClick:()=>l(t.id),loading:i===`lock-${t.id}`,fullWidth:!0,children:"Lock Account"},void 0,!1,void 0,this),S&&ae(se,{variant:"warning",size:"sm",onClick:()=>t.email&&d(t.email),loading:i===`reset-${t.email}`,fullWidth:!0,children:"Reset Password"},void 0,!1,void 0,this),f&&ae(se,{variant:"secondary",size:"sm",onClick:()=>t.email&&g(t.email),loading:i===`magic-${t.email}`,fullWidth:!0,children:"Send Magic Link"},void 0,!1,void 0,this),P&&!t.verifiedAt&&!t.lastLoginAt&&ae(se,{variant:"primary",size:"sm",onClick:()=>t.email&&h(t.email),loading:i===`invite-${t.email}`,fullWidth:!0,children:"Resend Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Zt}from"react/jsx-dev-runtime";function pl({theme:e,searchQuery:t,statusFilter:r,roleFilter:n,roles:a,totalCount:i,filteredCount:o,onSearchChange:s,onStatusChange:l,onRoleChange:c,onRefresh:d,isLoading:g}){let h=[{value:"all",label:"All Status"},{value:"active",label:"Active"},{value:"locked",label:"Locked"},{value:"unverified",label:"Unverified"}],k=[{value:"all",label:"All Roles"},...a.map((u)=>({value:u.id,label:u.name}))];return Zt("div",{className:w(e.filters.wrapper),children:[Zt("div",{className:"flex flex-col sm:flex-row gap-3",children:[Zt("div",{className:"flex-1",children:Zt(Ee,{type:"text",value:t,onChange:(u)=>s(u),placeholder:"Search by name or email...",size:"md",leftIcon:Zt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Zt("div",{className:"flex flex-wrap gap-2",children:[Zt(dr,{options:h,value:r,onChange:(u)=>{if(u)l(u)},placeholder:"Status",size:"md",className:"min-w-[140px]"},void 0,!1,void 0,this),Zt(dr,{options:k,value:n,onChange:(u)=>{if(u)c(u)},placeholder:"Role",size:"md",searchable:a.length>5,className:"min-w-[140px]"},void 0,!1,void 0,this),d&&Zt(se,{variant:"outline",size:"md",onClick:d,loading:g,leftIcon:Zt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:Zt("span",{className:"hidden sm:inline",children:"Refresh"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Zt("div",{className:"flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[Zt("span",{children:["Showing ",o," of ",i," users"]},void 0,!0,void 0,this),(r!=="all"||n!=="all"||t)&&Zt(se,{variant:"ghost",size:"sm",onClick:()=>{s(""),l("all"),c("all")},children:"Clear filters"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as qt}from"react/jsx-dev-runtime";function ul({theme:e,user:t,roles:r,isSelected:n,onSelect:a}){let i=(k)=>{let u=k.split(" ");if(u.length>=2&&u[0]&&u[1])return`${u[0][0]}${u[1][0]}`.toUpperCase();return k.slice(0,2).toUpperCase()},o=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return t.email.split("@")[0]},s=()=>{if(!t.userRoles)return[];return t.userRoles.map((k)=>r.find((u)=>u.id===k.roleId)).filter(Boolean).slice(0,3)},l=()=>{if(t.isLocked)return e.userCard.avatar.statusDot.locked;if(!t.verifiedAt)return e.userCard.avatar.statusDot.unverified;return e.userCard.avatar.statusDot.active},c=(k)=>{if(!k)return"Never logged in";let u=typeof k==="string"?new Date(k):k,f=new Date().getTime()-u.getTime(),P=Math.floor(f/86400000);if(P===0)return"Today";if(P===1)return"Yesterday";if(P<7)return`${P} days ago`;if(P<30)return`${Math.floor(P/7)} weeks ago`;if(P<365)return`${Math.floor(P/30)} months ago`;return`${Math.floor(P/365)} years ago`},d=o(),g=s(),h=(t.userRoles?.length||0)>3;return qt("button",{type:"button",onClick:()=>a(t),className:w(e.userCard.wrapper.base,e.userCard.wrapper.hover,n&&e.userCard.wrapper.selected,"w-full text-left flex items-start gap-3"),children:[qt("div",{className:w(e.userCard.avatar.wrapper),children:[qt("div",{className:w(e.userCard.avatar.placeholder),children:i(d||"U")},void 0,!1,void 0,this),qt("div",{className:w(e.userCard.avatar.statusDot.base,l())},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qt("div",{className:w(e.userCard.content.wrapper),children:[qt("div",{className:"flex items-center gap-2",children:[qt("span",{className:w(e.userCard.content.name),children:d},void 0,!1,void 0,this),t.isGod&&qt("span",{className:w(e.userCard.badges.status.god),children:"God"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qt("p",{className:w(e.userCard.content.email),children:t.email},void 0,!1,void 0,this),qt("p",{className:w(e.userCard.content.meta),children:c(t.lastLoginAt)},void 0,!1,void 0,this),(g.length>0||t.isLocked||!t.verifiedAt)&&qt("div",{className:w(e.userCard.badges.wrapper),children:[t.isLocked&&qt("span",{className:w(e.userCard.badges.status.locked),children:"Locked"},void 0,!1,void 0,this),!t.verifiedAt&&!t.isLocked&&qt("span",{className:w(e.userCard.badges.status.unverified),children:"Unverified"},void 0,!1,void 0,this),g.map((k)=>qt("span",{className:w(e.userCard.badges.role),children:k?.name},k?.id,!1,void 0,this)),h&&qt("span",{className:w(e.userCard.badges.role),children:["+",(t.userRoles?.length||0)-3]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qt("svg",{className:"w-5 h-5 text-zinc-400 flex-shrink-0 mt-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:qt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Fr}from"react/jsx-dev-runtime";function gl({theme:e,count:t=5}){return Fr("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:Array.from({length:t}).map((r,n)=>Fr("div",{className:"p-3 sm:p-4 flex items-start gap-3",children:[Fr("div",{className:w(e.skeleton.base,e.skeleton.avatar)},void 0,!1,void 0,this),Fr("div",{className:"flex-1 space-y-2",children:[Fr("div",{className:w(e.skeleton.base,e.skeleton.text,"w-32")},void 0,!1,void 0,this),Fr("div",{className:w(e.skeleton.base,e.skeleton.text,"w-48")},void 0,!1,void 0,this),Fr("div",{className:"flex gap-1.5 mt-1",children:[Fr("div",{className:w(e.skeleton.base,"h-5 w-16 rounded")},void 0,!1,void 0,this),Fr("div",{className:w(e.skeleton.base,"h-5 w-12 rounded")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},n,!0,void 0,this))},void 0,!1,void 0,this)}import{useGSAP as l0}from"@gsap/react";import s0 from"gsap";import{useEffect as tb,useEffectEvent as Jt,useRef as ml,useState as bl}from"react";import{batch as Vm,createStore as jm}from"h-state";var eb={users:[],profiles:[],addresses:[],phones:[],files:[],roles:[],userRoles:[],selectedUser:null,searchQuery:"",statusFilter:"all",roleFilter:"all",isDetailPanelOpen:!1,assigningRoleId:null,currentPage:1,pageSize:25,totalItems:0,totalPages:0,isLoading:!1},{useStore:bi}=jm(eb,{setUsers:(e)=>(t)=>{e.users=t},setProfiles:(e)=>(t)=>{e.profiles=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setUserRoles:(e)=>(t)=>{e.userRoles=t},setSelectedUser:(e)=>(t)=>{e.selectedUser=t,e.isDetailPanelOpen=t!==null},setSearchQuery:(e)=>(t)=>{e.searchQuery=t},setStatusFilter:(e)=>(t)=>{e.statusFilter=t},setRoleFilter:(e)=>(t)=>{e.roleFilter=t},setDetailPanelOpen:(e)=>(t)=>{if(e.isDetailPanelOpen=t,!t)e.selectedUser=null},setAssigningRoleId:(e)=>(t)=>{e.assigningRoleId=t},setCurrentPage:(e)=>(t)=>{e.currentPage=t},setPageSize:(e)=>(t)=>{e.pageSize=t,e.currentPage=1},setPagination:(e)=>(t,r)=>{e.totalItems=t,e.totalPages=r},setIsLoading:(e)=>(t)=>{e.isLoading=t},updateUser:(e)=>(t,r)=>{if(e.users=e.users.map((n)=>n.id===t?{...n,...r}:n),e.selectedUser?.id===t)e.selectedUser={...e.selectedUser,...r}},addUser:(e)=>(t)=>{e.users=[t,...e.users],e.totalItems=e.totalItems+1},addUserRole:(e)=>(t)=>{if(e.userRoles.some((n)=>n.userId===t.userId&&n.roleId===t.roleId&&!n.id.startsWith("temp-"))&&!t.id.startsWith("temp-"))return;e.userRoles=[...e.userRoles,t]},removeUserRole:(e)=>(t)=>{e.userRoles=e.userRoles.filter((r)=>r.id!==t)},getUserWithDetails:(e)=>(t)=>{let r=e.users.find((c)=>c.id===t);if(!r)return null;let n=e.profiles.find((c)=>c.userId===t),a=e.addresses.filter((c)=>c.ownerType==="user"&&c.ownerId===t),i=e.phones.filter((c)=>c.ownerType==="user"&&c.ownerId===t),o=e.files.filter((c)=>c.uploadedBy===t),s=new Set,l=e.userRoles.filter((c)=>c.userId===t).filter((c)=>{if(s.has(c.roleId))return!1;return s.add(c.roleId),!0}).map((c)=>({...c,role:e.roles.find((d)=>d.id===c.roleId)}));return{...r,profile:n||null,addresses:a,phones:i,files:o,userRoles:l}},reset:(e)=>()=>{Vm(()=>{e.users=[],e.profiles=[],e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.userRoles=[],e.selectedUser=null,e.searchQuery="",e.statusFilter="all",e.roleFilter="all",e.isDetailPanelOpen=!1,e.assigningRoleId=null,e.currentPage=1,e.pageSize=25,e.totalItems=0,e.totalPages=0,e.isLoading=!1})}});var fi={container:{base:"min-h-screen bg-zinc-50 dark:bg-zinc-950 transition-colors",padding:{sm:"p-3",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-10"}},header:{wrapper:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between mb-4 sm:mb-6",title:"text-xl sm:text-2xl lg:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400",actions:"flex items-center gap-2 mt-2 sm:mt-0"},layout:{wrapper:"flex flex-col lg:flex-row gap-4 lg:gap-6",sidebar:{base:"transition-all duration-300 ease-in-out",collapsed:"w-full",expanded:"w-full lg:w-3/5 xl:w-2/3"},main:"w-full lg:w-2/5 xl:w-1/3 lg:sticky lg:top-4 lg:self-start"},filters:{wrapper:"flex flex-col gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mb-4",searchInput:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",select:"px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",button:{base:"px-3 py-2 text-sm font-medium rounded-lg transition-colors",active:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300",inactive:"bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700"},badge:"px-2 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded-full"},table:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{row:"border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",cell:"px-3 sm:px-4 py-3 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider"},body:{row:{base:"border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20"},cell:"px-3 sm:px-4 py-3 text-sm"}},userCard:{wrapper:{base:"p-3 sm:p-4 border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20 border-l-2 border-l-emerald-500"},avatar:{wrapper:"relative flex-shrink-0",image:"w-10 h-10 sm:w-12 sm:h-12 rounded-full object-cover",placeholder:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gradient-to-br from-emerald-400 to-emerald-600 flex items-center justify-center text-white font-semibold text-sm sm:text-base",statusDot:{base:"absolute -bottom-0.5 -right-0.5 w-3 h-3 sm:w-3.5 sm:h-3.5 rounded-full border-2 border-white dark:border-zinc-900",active:"bg-emerald-500",locked:"bg-red-500",unverified:"bg-amber-500"}},content:{wrapper:"flex-1 min-w-0 ml-3",name:"font-medium text-sm sm:text-base text-zinc-900 dark:text-zinc-100 truncate",email:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 truncate",meta:"text-xs text-zinc-400 dark:text-zinc-500 mt-0.5"},badges:{wrapper:"flex flex-wrap gap-1 mt-1.5",role:"px-1.5 py-0.5 text-xs bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 rounded",status:{active:"px-1.5 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded",locked:"px-1.5 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 rounded",unverified:"px-1.5 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 rounded",god:"px-1.5 py-0.5 text-xs font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded"}}},detailPanel:{overlay:"fixed inset-0 bg-black/50 z-40 lg:hidden",wrapper:{base:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 overflow-hidden z-50 transition-all duration-300",mobile:"fixed inset-x-0 bottom-0 rounded-t-2xl max-h-[85vh]",tablet:"fixed inset-y-0 right-0 w-96 rounded-l-2xl",desktop:"rounded-xl sticky top-4"},header:{wrapper:"flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-zinc-100",closeButton:"p-1.5 rounded-lg text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"},content:{wrapper:"p-4 space-y-4 overflow-y-auto max-h-[calc(100vh-200px)]",section:{wrapper:"space-y-2",title:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",content:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg p-3 space-y-2"},row:{wrapper:"flex items-center justify-between gap-2",label:"text-sm text-zinc-500 dark:text-zinc-400",value:"text-sm font-medium text-zinc-900 dark:text-zinc-100 text-right truncate"}},actions:{wrapper:"p-4 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",button:{base:"w-full px-3 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-emerald-600 hover:bg-emerald-700 text-white",danger:"bg-red-100 hover:bg-red-200 dark:bg-red-900/30 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300",warning:"bg-amber-100 hover:bg-amber-200 dark:bg-amber-900/30 dark:hover:bg-amber-900/50 text-amber-700 dark:text-amber-300",info:"bg-blue-100 hover:bg-blue-200 dark:bg-blue-900/30 dark:hover:bg-blue-900/50 text-blue-700 dark:text-blue-300"}}},pagination:{wrapper:"flex flex-col sm:flex-row items-center justify-between gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mt-4",info:"text-sm text-zinc-500 dark:text-zinc-400",controls:{wrapper:"flex items-center gap-1 sm:gap-2",button:{base:"px-2 sm:px-3 py-1.5 text-sm rounded-lg transition-colors",active:"bg-emerald-600 text-white",disabled:"text-zinc-300 dark:text-zinc-600 cursor-not-allowed"},pageSize:"px-2 py-1.5 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100"}},skeleton:{base:"animate-pulse bg-zinc-200 dark:bg-zinc-800 rounded",avatar:"w-10 h-10 sm:w-12 sm:h-12 rounded-full",text:"h-4 rounded",button:"h-9 rounded-lg"},emptyState:{wrapper:"flex flex-col items-center justify-center py-12 px-4 text-center",icon:"w-12 h-12 text-zinc-300 dark:text-zinc-600 mb-4",title:"text-lg font-medium text-zinc-900 dark:text-zinc-100 mb-1",description:"text-sm text-zinc-500 dark:text-zinc-400"},modal:{overlay:"fixed inset-0 bg-black/60 backdrop-blur-sm z-40",wrapper:"w-full max-w-md bg-white dark:bg-zinc-900 rounded-2xl shadow-2xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{wrapper:"flex items-start justify-between gap-4 p-5 border-b border-zinc-200 dark:border-zinc-800",icon:"flex-shrink-0 w-10 h-10 flex items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",title:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"},content:"p-5",infoBox:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800/30",footer:"flex items-center justify-end gap-3 p-5 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50"},stats:{wrapper:"grid grid-cols-2 sm:grid-cols-4 gap-3 sm:gap-4 mb-4 sm:mb-6",card:{base:"p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 transition-all hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-700",icon:{wrapper:"w-8 h-8 sm:w-10 sm:h-10 flex items-center justify-center rounded-lg mb-2 sm:mb-3",primary:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",success:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",warning:"bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400",danger:"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400"},value:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-zinc-100",label:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"}}};import{jsxDEV as rt}from"react/jsx-dev-runtime";s0.registerPlugin(l0);function d0({title:e="User Management",subtitle:t,className:r,theme:n,getUsersAction:a,updateUserAction:i,getProfilesAction:o,getAddressesAction:s,getPhonesAction:l,getFilesAction:c,getRolesAction:d,getUserRolesAction:g,addUserRoleAction:h,deleteUserRoleAction:k,passwordResetRequestAction:u,magicLinkRequestAction:S,inviteUserAction:f,onUserUpdated:P,onRoleAssigned:x,onRoleRemoved:z,onUserInvited:m}){let y=n?{...fi,...n}:fi,v=bi(),p=ml(null),b=ml(null),[R,$]=bl(null),[J,U]=bl(!1),[E,K]=bl(!1),M=ml(null);l0(()=>{if(!b.current)return;s0.fromTo(b.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:p});let Q=Jt((B=v.currentPage,de=v.pageSize)=>{v.setIsLoading(!0),a.start({payload:{page:B,limit:de},onAfterHandle:(te)=>{if(v.setIsLoading(!1),te.data)v.setUsers(te.data.items||[]),v.setPagination(te.data.meta?.totalItems||0,te.data.meta?.totalPages||1)},onErrorHandle:()=>{v.setIsLoading(!1)}})}),N=Jt(()=>{o.start({payload:{page:1,limit:1000},onAfterHandle:(B)=>{if(B.data?.items)v.setProfiles(B.data.items)}}),s.start({payload:{page:1,limit:1000},onAfterHandle:(B)=>{if(B.data?.items)v.setAddresses(B.data.items)}}),l.start({payload:{page:1,limit:1000},onAfterHandle:(B)=>{if(B.data?.items)v.setPhones(B.data.items)}}),c.start({payload:{page:1,limit:1000},onAfterHandle:(B)=>{if(B.data?.items)v.setFiles(B.data.items)}}),d.start({payload:{page:1,limit:100},onAfterHandle:(B)=>{if(B.data?.items)v.setRoles(B.data.items)}}),g.start({payload:{page:1,limit:5000},onAfterHandle:(B)=>{if(B.data?.items)v.setUserRoles(B.data.items)}})});tb(()=>{Q(1,v.pageSize),N()},[]);let O=Jt((B)=>{v.setCurrentPage(B),Q(B,v.pageSize)}),A=Jt((B)=>{v.setPageSize(B),Q(1,B)}),D=Jt(()=>{Q(v.currentPage,v.pageSize),N()}),I=Jt((B)=>{if(v.setSearchQuery(B),M.current)clearTimeout(M.current);M.current=setTimeout(()=>{v.setCurrentPage(1)},300)}),_=Jt((B)=>{let de=v.getUserWithDetails(B.id);v.setSelectedUser(de)}),T=Jt(()=>{v.setDetailPanelOpen(!1)}),ie=Jt((B)=>{$(`verify-${B}`);let de=v.users.find((te)=>te.id===B);if(!de)return;v.updateUser(B,{verifiedAt:new Date().toISOString()}),i.start({payload:{id:B,verifiedAt:new Date().toISOString()},onAfterHandle:(te)=>{if($(null),te.data){P?.(te.data);let ye=v.getUserWithDetails(B);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(B,{verifiedAt:de.verifiedAt})}})}),q=Jt((B)=>{$(`lock-${B}`);let de=v.users.find((te)=>te.id===B);if(!de)return;v.updateUser(B,{isLocked:!0}),i.start({payload:{id:B,isLocked:!0},onAfterHandle:(te)=>{if($(null),te.data){P?.(te.data);let ye=v.getUserWithDetails(B);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(B,{isLocked:de.isLocked})}})}),ce=Jt((B)=>{$(`unlock-${B}`);let de=v.users.find((te)=>te.id===B);if(!de)return;v.updateUser(B,{isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0}),i.start({payload:{id:B,isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0},onAfterHandle:(te)=>{if($(null),te.data){P?.(te.data);let ye=v.getUserWithDetails(B);if(ye)v.setSelectedUser(ye)}},onErrorHandle:()=>{$(null),v.updateUser(B,{isLocked:de.isLocked,lockedUntil:de.lockedUntil,failedLoginAttempts:de.failedLoginAttempts})}})}),oe=Jt((B)=>{if(!u)return;$(`reset-${B}`),u.start({payload:{email:B},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),Ze=Jt((B)=>{if(!S)return;$(`magic-${B}`),S.start({payload:{email:B},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),$e=Jt((B,de)=>{let te=`temp-${Date.now()}`;v.addUserRole({id:te,userId:B,roleId:de}),h.start({payload:{userId:B,roleId:de},onAfterHandle:(ye)=>{if(v.removeUserRole(te),ye.data){v.addUserRole(ye.data),x?.(B,de);let V=v.getUserWithDetails(B);if(V)v.setSelectedUser(V)}},onErrorHandle:()=>{v.removeUserRole(te)}})}),Pe=Jt((B)=>{let de=v.userRoles.find((te)=>te.id===B);if(!de)return;v.removeUserRole(B),k.start({payload:{id:B},onAfterHandle:()=>{z?.(de.userId,de.roleId);let te=v.getUserWithDetails(de.userId);if(te)v.setSelectedUser(te)},onErrorHandle:()=>{v.addUserRole(de)}})}),fe=Jt((B)=>{if(!f)return;K(!0),f.start({payload:{email:B},onAfterHandle:()=>{K(!1),U(!1),m?.(B),Q(v.currentPage,v.pageSize)},onErrorHandle:()=>{K(!1)}})}),xe=Jt((B)=>{if(!f)return;$(`invite-${B}`),f.start({payload:{email:B},onAfterHandle:()=>{$(null)},onErrorHandle:()=>{$(null)}})}),qe={total:v.totalItems,verified:v.users.filter((B)=>B.verifiedAt).length,unverified:v.users.filter((B)=>!B.verifiedAt).length,locked:v.users.filter((B)=>B.isLocked).length},Le=v.users.filter((B)=>{let de=v.profiles.find((re)=>re.userId===B.id),te=de?.firstName||de?.lastName?`${de.firstName||""} ${de.lastName||""}`.toLowerCase():"",ye=v.searchQuery===""||(B.email??"").toLowerCase().includes(v.searchQuery.toLowerCase())||te.includes(v.searchQuery.toLowerCase()),V=v.statusFilter==="all"||v.statusFilter==="locked"&&B.isLocked||v.statusFilter==="active"&&!B.isLocked&&B.verifiedAt||v.statusFilter==="unverified"&&!B.verifiedAt,ee=v.roleFilter==="all"||v.userRoles.some((re)=>re.userId===B.id&&re.roleId===v.roleFilter);return ye&&V&&ee}),ve=(B)=>{let de=v.users.find((ee)=>ee.id===B);if(!de)return{};let te=v.profiles.find((ee)=>ee.userId===B),ye=new Set,V=v.userRoles.filter((ee)=>ee.userId===B).filter((ee)=>{if(ye.has(ee.roleId))return!1;return ye.add(ee.roleId),!0}).map((ee)=>({...ee,role:v.roles.find((re)=>re.id===ee.roleId)}));return{...de,profile:te||null,userRoles:V}};return rt("div",{ref:p,className:w(y.container.base,"p-3 sm:p-4 md:p-6 lg:p-8 xl:p-10",r),children:[rt("div",{ref:b,className:"max-w-7xl mx-auto",children:[rt("header",{className:w(y.header.wrapper),children:[rt("div",{children:[rt("h1",{className:w(y.header.title),children:e},void 0,!1,void 0,this),t&&rt("p",{className:w(y.header.subtitle),children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rt("div",{className:w(y.header.actions),children:f&&rt(se,{variant:"primary",size:"md",onClick:()=>U(!0),leftIcon:rt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:[rt("span",{className:"hidden sm:inline",children:"Invite User"},void 0,!1,void 0,this),rt("span",{className:"sm:hidden",children:"Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),rt(sl,{theme:y,totalUsers:qe.total,verifiedUsers:qe.verified,lockedUsers:qe.locked,unverifiedUsers:qe.unverified},void 0,!1,void 0,this),rt("div",{className:w(y.layout.wrapper),children:[rt("div",{className:w(y.layout.sidebar.base,v.isDetailPanelOpen?y.layout.sidebar.expanded:y.layout.sidebar.collapsed),children:[rt(pl,{theme:y,searchQuery:v.searchQuery,statusFilter:v.statusFilter,roleFilter:v.roleFilter,roles:v.roles,totalCount:v.totalItems,filteredCount:Le.length,onSearchChange:I,onStatusChange:v.setStatusFilter,onRoleChange:v.setRoleFilter,onRefresh:D,isLoading:v.isLoading},void 0,!1,void 0,this),rt("div",{className:w(y.table.wrapper),children:rt("div",{className:"max-h-[calc(100vh-380px)] sm:max-h-[calc(100vh-340px)] lg:max-h-[calc(100vh-300px)] overflow-y-auto",children:v.isLoading?rt(gl,{theme:y,count:v.pageSize>10?10:v.pageSize},void 0,!1,void 0,this):Le.length===0?rt("div",{className:w(y.emptyState.wrapper),children:[rt("svg",{className:w(y.emptyState.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:rt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),rt("h3",{className:w(y.emptyState.title),children:"No users found"},void 0,!1,void 0,this),rt("p",{className:w(y.emptyState.description),children:v.searchQuery||v.statusFilter!=="all"||v.roleFilter!=="all"?"Try adjusting your filters":"No users have been created yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):rt("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:Le.map((B)=>rt(ul,{theme:y,user:ve(B.id),roles:v.roles,isSelected:v.selectedUser?.id===B.id,onSelect:_},B.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),v.totalPages>1&&rt(ll,{theme:y,currentPage:v.currentPage,totalPages:v.totalPages,totalItems:v.totalItems,pageSize:v.pageSize,pageSizeOptions:[10,25,50,100],onPageChange:O,onPageSizeChange:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.isDetailPanelOpen&&rt("div",{className:w(y.layout.main),children:rt(cl,{theme:y,user:v.selectedUser,roles:v.roles,allUserRoles:v.userRoles,isOpen:v.isDetailPanelOpen,actionLoading:R,onClose:T,onVerifyEmail:ie,onLockAccount:q,onUnlockAccount:ce,onResetPassword:oe,onSendMagicLink:Ze,onResendInvite:xe,onAssignRole:$e,onRemoveRole:Pe,hasPasswordReset:!!u,hasMagicLink:!!S,hasInvite:!!f},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),rt(ol,{theme:y,isOpen:J,isLoading:E,onClose:()=>U(!1),onInvite:fe},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{Handle as oa,Position as la}from"@xyflow/react";var ht={layout:{root:"h-screen flex flex-col bg-[#0a0a0f] text-white overflow-hidden",main:"flex-1 flex overflow-hidden",sidebar:"w-64 flex-shrink-0 border-r border-white/[0.06] bg-[#0d0d14] flex flex-col",canvas:"flex-1 relative",propertiesPanel:"w-80 flex-shrink-0 border-l border-white/[0.06] bg-[#0d0d14] flex flex-col overflow-hidden"},header:{container:"flex-shrink-0 h-14 border-b border-white/[0.06] bg-[#0d0d14]/80 backdrop-blur-xl px-5 flex items-center justify-between",backButton:"w-8 h-8 rounded-lg flex items-center justify-center text-white/40 hover:text-white/70 hover:bg-white/[0.06] transition-all mr-2",title:"text-sm font-semibold text-white/90 tracking-tight",subtitle:"text-[11px] text-white/40 ml-3",actions:"flex items-center gap-2",descriptionInput:"px-2.5 py-1 text-[10px] rounded-md bg-white/[0.04] text-white/80 border border-white/[0.08] w-44 placeholder:text-white/20",saveButton:"rounded-lg bg-white/10 border border-white/[0.08] px-3.5 py-1.5 text-[11px] font-medium text-white/80 hover:bg-white/15 hover:text-white transition-all",saveButtonDisabled:"rounded-lg bg-white/[0.03] border border-white/[0.04] px-3.5 py-1.5 text-[11px] font-medium text-white/20 cursor-not-allowed",publishButton:"rounded-lg bg-emerald-500/20 border border-emerald-500/30 px-3.5 py-1.5 text-[11px] font-medium text-emerald-400 hover:bg-emerald-500/30 transition-all",deleteButton:"rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-1.5 text-[11px] font-medium text-red-400 hover:bg-red-500/20 transition-all"},tabs:{container:"flex gap-0.5 p-0.5 bg-white/[0.04] border border-white/[0.06] rounded-lg",tab:"px-3 py-1 rounded-md text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",tabActive:"px-3 py-1 rounded-md text-[11px] font-medium bg-white/[0.08] text-white/90 shadow-sm"},flowSelector:{select:"rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/70 outline-none focus:border-white/20"},palette:{container:"flex-1 overflow-auto p-4",title:"text-[10px] font-bold uppercase tracking-[0.15em] text-white/30 mb-3 px-1",item:"flex items-start gap-3 rounded-xl p-3 mb-2 cursor-grab active:cursor-grabbing transition-all border border-transparent hover:border-white/[0.08]",itemIcon:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",itemLabel:"text-[12px] font-medium text-white/80",itemDescription:"text-[10px] text-white/30 mt-0.5 leading-relaxed",stepItem:"hover:bg-blue-500/[0.06]",verifierItem:"hover:bg-amber-500/[0.06]",notificationItem:"hover:bg-violet-500/[0.06]",dragHint:"text-[10px] text-white/20 text-center mt-4 px-3 leading-relaxed"},canvas:{container:"flex-1 relative bg-[#08080d]",background:"bg-[#08080d]",dropIndicator:"absolute inset-4 border-2 border-dashed border-white/10 rounded-2xl bg-white/[0.02] pointer-events-none z-10"},stepNode:{container:"group relative rounded-2xl border border-blue-500/20 bg-gradient-to-br from-blue-500/[0.08] to-blue-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-blue-500/[0.04] transition-all hover:border-blue-500/30 hover:shadow-blue-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-blue-400/50 bg-gradient-to-br from-blue-500/[0.12] to-blue-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-blue-500/[0.12] ring-4 ring-blue-500/10",icon:"text-blue-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-blue-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",handleSource:"!w-3 !h-3 !bg-blue-400/60 !border-2 !border-[#08080d] hover:!bg-blue-400",handleTarget:"!w-3 !h-3 !bg-blue-400/60 !border-2 !border-[#08080d] hover:!bg-blue-400",orderBadge:"absolute -top-2 -right-2 w-5 h-5 rounded-full bg-blue-500/80 text-[9px] font-bold text-white flex items-center justify-center"},verifierNode:{container:"group relative rounded-2xl border border-amber-500/20 bg-gradient-to-br from-amber-500/[0.08] to-orange-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-amber-500/[0.04] transition-all hover:border-amber-500/30 hover:shadow-amber-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-amber-400/50 bg-gradient-to-br from-amber-500/[0.12] to-orange-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-amber-500/[0.12] ring-4 ring-amber-500/10",hexShape:"",icon:"text-amber-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-amber-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",assignedBadge:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 border border-amber-500/20 px-2 py-0.5 text-[10px] font-medium text-amber-300/80 mt-2",signatureBadge:"inline-flex items-center gap-1 rounded-md bg-rose-500/10 border border-rose-500/20 px-2 py-0.5 text-[10px] font-medium text-rose-300/80",handleSource:"!w-3 !h-3 !bg-amber-400/60 !border-2 !border-[#08080d] hover:!bg-amber-400",handleTarget:"!w-3 !h-3 !bg-amber-400/60 !border-2 !border-[#08080d] hover:!bg-amber-400"},notificationNode:{container:"group relative rounded-2xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.08] to-purple-600/[0.03] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-violet-500/[0.04] transition-all hover:border-violet-500/30 hover:shadow-violet-500/[0.08]",containerSelected:"group relative rounded-2xl border-2 border-violet-400/50 bg-gradient-to-br from-violet-500/[0.12] to-purple-600/[0.06] backdrop-blur-sm px-5 py-4 min-w-[200px] max-w-[260px] shadow-lg shadow-violet-500/[0.12] ring-4 ring-violet-500/10",icon:"text-violet-400",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-violet-400/60",nameLabel:"text-[13px] font-semibold text-white/90 mt-1.5 leading-tight",description:"text-[11px] text-white/40 mt-1 leading-relaxed line-clamp-2",channelBadge:"inline-flex items-center gap-1 rounded-md bg-violet-500/10 border border-violet-500/20 px-2 py-0.5 text-[10px] font-medium text-violet-300/80",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-cyan-500/10 border border-cyan-500/20 px-2 py-0.5 text-[10px] font-medium text-cyan-300/80",handleSource:"!w-3 !h-3 !bg-violet-400/60 !border-2 !border-[#08080d] hover:!bg-violet-400",handleTarget:"!w-3 !h-3 !bg-violet-400/60 !border-2 !border-[#08080d] hover:!bg-violet-400"},propertiesPanel:{container:"flex flex-col h-full",header:"flex items-center justify-between px-4 py-3 border-b border-white/[0.06]",headerTitle:"text-[12px] font-semibold text-white/80",closeButton:"w-6 h-6 rounded-md flex items-center justify-center text-white/30 hover:text-white/60 hover:bg-white/[0.06] transition-all",body:"flex-1 overflow-auto p-4 space-y-5",section:"space-y-2.5",sectionTitle:"text-[10px] font-bold uppercase tracking-[0.15em] text-white/30 mb-2",label:"block text-[11px] font-medium text-white/50 mb-1",input:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 focus:bg-white/[0.06] transition-all placeholder:text-white/20",select:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20",textarea:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 resize-none placeholder:text-white/20",checkbox:"rounded border-white/20 bg-white/[0.04] text-blue-500 focus:ring-blue-500/30",checkboxLabel:"text-[11px] text-white/60",deleteButton:"w-full rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-2 text-[11px] font-medium text-red-400 hover:bg-red-500/20 transition-all",multiSelect:{container:"flex flex-wrap gap-1.5 rounded-lg border border-white/[0.08] bg-white/[0.04] p-2 min-h-[38px]",badge:"inline-flex items-center gap-1 rounded-md bg-white/[0.08] px-2 py-0.5 text-[10px] font-medium text-white/70",badgeRemove:"w-3.5 h-3.5 rounded-sm flex items-center justify-center hover:bg-white/10 text-white/40 hover:text-white/70 transition-colors cursor-pointer",dropdown:"absolute z-30 mt-1 w-full rounded-lg border border-white/[0.08] bg-[#12121a] shadow-2xl py-1 max-h-48 overflow-auto",option:"px-3 py-1.5 text-[11px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 cursor-pointer transition-colors",optionSelected:"px-3 py-1.5 text-[11px] text-blue-400 bg-blue-500/10 font-medium"},userRoleSearch:{container:"space-y-2",searchInput:"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 placeholder:text-white/20",listContainer:"rounded-lg border border-white/[0.06] bg-white/[0.02] max-h-48 overflow-auto",listItem:"w-full text-left flex items-center gap-2.5 px-3 py-2 hover:bg-white/[0.04] cursor-pointer transition-colors border-b border-white/[0.04] last:border-b-0",listItemSelected:"w-full text-left flex items-center gap-2.5 px-3 py-2 bg-blue-500/20 border-l-2 border-l-blue-400 cursor-pointer border-b border-white/[0.04] last:border-b-0",listItemAvatar:"w-7 h-7 rounded-full bg-white/[0.08] flex items-center justify-center text-[10px] font-bold text-white/50 flex-shrink-0",listItemName:"text-[12px] font-medium text-white/80",listItemEmail:"text-[10px] text-white/40",loadMore:"w-full py-2 text-center text-[10px] text-white/30 hover:text-white/50 cursor-pointer transition-colors",empty:"py-6 text-center text-[11px] text-white/25"}},overlay:{info:"absolute top-4 left-4 bg-[#0d0d14]/90 backdrop-blur-xl rounded-xl border border-white/[0.06] p-4 shadow-2xl max-w-xs z-10",infoTitle:"text-[12px] font-semibold text-white/90",infoDescription:"text-[11px] text-white/40 mt-1",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-500/15 border border-amber-500/20 text-amber-400",badgePublished:"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400"},legend:{container:"absolute bottom-4 left-4 bg-[#0d0d14]/90 backdrop-blur-xl rounded-xl border border-white/[0.06] p-3 shadow-2xl z-10",item:"flex items-center gap-1.5",dot:{step:"w-2.5 h-2.5 rounded-full bg-blue-400",verifier:"w-2.5 h-2.5 rounded-full bg-amber-400",notification:"w-2.5 h-2.5 rounded-full bg-violet-400"},label:"text-[10px] text-white/40"},pending:{container:"max-w-3xl mx-auto space-y-3",title:"text-lg font-semibold text-white/90 mb-4",empty:{container:"text-center py-20",icon:"w-16 h-16 text-white/10 mx-auto mb-4",text:"text-white/30"},card:{container:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4 shadow-sm hover:bg-white/[0.04] transition-colors",title:"text-sm font-medium text-white/90",subtitle:"text-xs text-white/40 mt-0.5",actions:"flex items-center gap-2"},input:"rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-1.5 text-[11px] text-white/80 w-40 outline-none focus:border-white/20",approveButton:"rounded-lg bg-emerald-500/20 border border-emerald-500/30 px-3 py-1.5 text-[11px] font-medium text-emerald-400 hover:bg-emerald-500/30 transition-all",rejectButton:"rounded-lg bg-red-500/20 border border-red-500/30 px-3 py-1.5 text-[11px] font-medium text-red-400 hover:bg-red-500/30 transition-all",cancelButton:"rounded-lg bg-white/[0.06] border border-white/[0.08] px-3 py-1.5 text-[11px] font-medium text-white/50 hover:bg-white/[0.1] transition-all",reviewButton:"rounded-lg bg-blue-500/20 border border-blue-500/30 px-3 py-1.5 text-[11px] font-medium text-blue-400 hover:bg-blue-500/30 transition-all"},flowList:{container:"flex-1 overflow-auto p-6",grid:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl mx-auto",createButton:"group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-white/[0.08] bg-white/[0.02] p-8 min-h-[180px] cursor-pointer hover:border-white/[0.15] hover:bg-white/[0.04] transition-all",card:{container:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-5 hover:bg-white/[0.04] hover:border-white/[0.1] transition-all group cursor-pointer",header:"flex items-start justify-between gap-3 mb-3",name:"text-[13px] font-semibold text-white/90 leading-tight",description:"text-[11px] text-white/40 mt-1.5 leading-relaxed line-clamp-2",meta:"flex items-center gap-2 mt-3 flex-wrap",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-500/15 border border-amber-500/20 text-amber-400",badgePublished:"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-white/[0.06] border border-white/[0.08] px-2 py-0.5 text-[9px] font-medium text-white/50",actions:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",editButton:"w-7 h-7 rounded-lg flex items-center justify-center text-white/30 hover:text-white/70 hover:bg-white/[0.08] transition-all",deleteButton:"w-7 h-7 rounded-lg flex items-center justify-center text-white/30 hover:text-red-400 hover:bg-red-500/10 transition-all"},empty:{container:"col-span-full flex flex-col items-center justify-center py-20",icon:"w-16 h-16 text-white/[0.06] mb-4",title:"text-[14px] font-medium text-white/40 mb-1",description:"text-[12px] text-white/25"}},loading:{container:"absolute inset-0 flex items-center justify-center bg-[#08080d]/80 backdrop-blur-sm z-10",spinner:"w-8 h-8 border-2 border-white/10 border-t-blue-400 rounded-full animate-spin"}},c0={...ht,layout:{root:"h-screen flex flex-col bg-gray-50 text-gray-900 overflow-hidden",main:"flex-1 flex overflow-hidden",sidebar:"w-64 flex-shrink-0 border-r border-gray-200 bg-white flex flex-col",canvas:"flex-1 relative",propertiesPanel:"w-80 flex-shrink-0 border-l border-gray-200 bg-white flex flex-col overflow-hidden"},header:{container:"flex-shrink-0 h-14 border-b border-gray-200 bg-white/80 backdrop-blur-xl px-5 flex items-center justify-between",backButton:"w-8 h-8 rounded-lg flex items-center justify-center text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-all mr-2",title:"text-sm font-semibold text-gray-900 tracking-tight",subtitle:"text-[11px] text-gray-400 ml-3",actions:"flex items-center gap-2",descriptionInput:"px-2.5 py-1 text-[10px] rounded-md bg-gray-50 text-gray-700 border border-gray-200 w-44 placeholder:text-gray-300",saveButton:"rounded-lg bg-gray-100 border border-gray-200 px-3.5 py-1.5 text-[11px] font-medium text-gray-700 hover:bg-gray-200 transition-all",saveButtonDisabled:"rounded-lg bg-gray-50 border border-gray-100 px-3.5 py-1.5 text-[11px] font-medium text-gray-300 cursor-not-allowed",publishButton:"rounded-lg bg-emerald-50 border border-emerald-200 px-3.5 py-1.5 text-[11px] font-medium text-emerald-700 hover:bg-emerald-100 transition-all",deleteButton:"rounded-lg bg-red-50 border border-red-200 px-3 py-1.5 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all"},tabs:{container:"flex gap-0.5 p-0.5 bg-gray-100 border border-gray-200 rounded-lg",tab:"px-3 py-1 rounded-md text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all",tabActive:"px-3 py-1 rounded-md text-[11px] font-medium bg-white text-gray-900 shadow-sm"},flowSelector:{select:"rounded-lg border border-gray-200 bg-gray-50 px-3 py-1.5 text-[11px] text-gray-600 outline-none focus:border-gray-400"},palette:{container:"flex-1 overflow-auto p-4",title:"text-[10px] font-bold uppercase tracking-[0.15em] text-gray-400 mb-3 px-1",item:"flex items-start gap-3 rounded-xl p-3 mb-2 cursor-grab active:cursor-grabbing transition-all border border-transparent hover:border-gray-200",itemIcon:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",itemLabel:"text-[12px] font-medium text-gray-700",itemDescription:"text-[10px] text-gray-400 mt-0.5 leading-relaxed",stepItem:"hover:bg-blue-50",verifierItem:"hover:bg-amber-50",notificationItem:"hover:bg-violet-50",dragHint:"text-[10px] text-gray-300 text-center mt-4 px-3 leading-relaxed"},canvas:{container:"flex-1 relative bg-gray-50",background:"bg-gray-50",dropIndicator:"absolute inset-4 border-2 border-dashed border-gray-300 rounded-2xl bg-gray-100/50 pointer-events-none z-10"},stepNode:{...ht.stepNode,container:"group relative rounded-2xl border border-blue-200 bg-gradient-to-br from-blue-50 to-blue-100/50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-blue-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-blue-400 bg-gradient-to-br from-blue-50 to-blue-100/50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-blue-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-blue-500",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},verifierNode:{...ht.verifierNode,container:"group relative rounded-2xl border border-amber-200 bg-gradient-to-br from-amber-50 to-orange-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-amber-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-amber-400 bg-gradient-to-br from-amber-50 to-orange-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-amber-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-amber-600",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},notificationNode:{...ht.notificationNode,container:"group relative rounded-2xl border border-violet-200 bg-gradient-to-br from-violet-50 to-purple-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-sm transition-all hover:border-violet-300 hover:shadow-md",containerSelected:"group relative rounded-2xl border-2 border-violet-400 bg-gradient-to-br from-violet-50 to-purple-50 px-5 py-4 min-w-[200px] max-w-[260px] shadow-md ring-4 ring-violet-100",typeLabel:"text-[9px] font-bold uppercase tracking-[0.2em] text-violet-600",nameLabel:"text-[13px] font-semibold text-gray-800 mt-1.5 leading-tight",description:"text-[11px] text-gray-500 mt-1 leading-relaxed line-clamp-2"},propertiesPanel:{container:"flex flex-col h-full",header:"flex items-center justify-between px-4 py-3 border-b border-gray-200",headerTitle:"text-[12px] font-semibold text-gray-800",closeButton:"w-6 h-6 rounded-md flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-all",body:"flex-1 overflow-auto p-4 space-y-5",section:"space-y-2.5",sectionTitle:"text-[10px] font-bold uppercase tracking-[0.15em] text-gray-400 mb-2",label:"block text-[11px] font-medium text-gray-500 mb-1",input:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 focus:bg-white transition-all placeholder:text-gray-300",select:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400",textarea:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 resize-none placeholder:text-gray-300",checkbox:"rounded border-gray-300 bg-gray-50 text-blue-500 focus:ring-blue-300",checkboxLabel:"text-[11px] text-gray-600",deleteButton:"w-full rounded-lg bg-red-50 border border-red-200 px-3 py-2 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all",multiSelect:{container:"flex flex-wrap gap-1.5 rounded-lg border border-gray-200 bg-gray-50 p-2 min-h-[38px]",badge:"inline-flex items-center gap-1 rounded-md bg-gray-200 px-2 py-0.5 text-[10px] font-medium text-gray-700",badgeRemove:"w-3.5 h-3.5 rounded-sm flex items-center justify-center hover:bg-gray-300 text-gray-500 hover:text-gray-700 transition-colors cursor-pointer",dropdown:"absolute z-30 mt-1 w-full rounded-lg border border-gray-200 bg-white shadow-xl py-1 max-h-48 overflow-auto",option:"px-3 py-1.5 text-[11px] text-gray-600 hover:bg-gray-100 hover:text-gray-800 cursor-pointer transition-colors",optionSelected:"px-3 py-1.5 text-[11px] text-blue-600 bg-blue-50 font-medium"},userRoleSearch:{container:"space-y-2",searchInput:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 placeholder:text-gray-300",listContainer:"rounded-lg border border-gray-200 bg-white max-h-48 overflow-auto",listItem:"w-full text-left flex items-center gap-2.5 px-3 py-2 hover:bg-gray-50 cursor-pointer transition-colors border-b border-gray-100 last:border-b-0",listItemSelected:"w-full text-left flex items-center gap-2.5 px-3 py-2 bg-blue-50 border-l-2 border-l-blue-400 cursor-pointer border-b border-gray-100 last:border-b-0",listItemAvatar:"w-7 h-7 rounded-full bg-gray-100 flex items-center justify-center text-[10px] font-bold text-gray-500 flex-shrink-0",listItemName:"text-[12px] font-medium text-gray-800",listItemEmail:"text-[10px] text-gray-400",loadMore:"w-full py-2 text-center text-[10px] text-gray-400 hover:text-gray-600 cursor-pointer transition-colors",empty:"py-6 text-center text-[11px] text-gray-300"}},overlay:{info:"absolute top-4 left-4 bg-white/90 backdrop-blur-xl rounded-xl border border-gray-200 p-4 shadow-lg max-w-xs z-10",infoTitle:"text-[12px] font-semibold text-gray-800",infoDescription:"text-[11px] text-gray-500 mt-1",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-100 border border-amber-200 text-amber-700",badgePublished:"bg-emerald-100 border border-emerald-200 text-emerald-700"},legend:{container:"absolute bottom-4 left-4 bg-white/90 backdrop-blur-xl rounded-xl border border-gray-200 p-3 shadow-lg z-10",item:"flex items-center gap-1.5",dot:{step:"w-2.5 h-2.5 rounded-full bg-blue-400",verifier:"w-2.5 h-2.5 rounded-full bg-amber-400",notification:"w-2.5 h-2.5 rounded-full bg-violet-400"},label:"text-[10px] text-gray-500"},pending:{container:"max-w-3xl mx-auto space-y-3",title:"text-lg font-semibold text-gray-800 mb-4",empty:{container:"text-center py-20",icon:"w-16 h-16 text-gray-200 mx-auto mb-4",text:"text-gray-400"},card:{container:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm hover:bg-gray-50 transition-colors",title:"text-sm font-medium text-gray-800",subtitle:"text-xs text-gray-400 mt-0.5",actions:"flex items-center gap-2"},input:"rounded-lg border border-gray-200 bg-gray-50 px-3 py-1.5 text-[11px] text-gray-800 w-40 outline-none focus:border-gray-400",approveButton:"rounded-lg bg-emerald-50 border border-emerald-200 px-3 py-1.5 text-[11px] font-medium text-emerald-700 hover:bg-emerald-100 transition-all",rejectButton:"rounded-lg bg-red-50 border border-red-200 px-3 py-1.5 text-[11px] font-medium text-red-600 hover:bg-red-100 transition-all",cancelButton:"rounded-lg bg-gray-50 border border-gray-200 px-3 py-1.5 text-[11px] font-medium text-gray-500 hover:bg-gray-100 transition-all",reviewButton:"rounded-lg bg-blue-50 border border-blue-200 px-3 py-1.5 text-[11px] font-medium text-blue-600 hover:bg-blue-100 transition-all"},flowList:{container:"flex-1 overflow-auto p-6",grid:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 max-w-6xl mx-auto",createButton:"group flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-gray-200 bg-gray-50 p-8 min-h-[180px] cursor-pointer hover:border-gray-300 hover:bg-gray-100 transition-all",card:{container:"rounded-xl border border-gray-200 bg-white p-5 hover:bg-gray-50 hover:border-gray-300 transition-all group cursor-pointer shadow-sm",header:"flex items-start justify-between gap-3 mb-3",name:"text-[13px] font-semibold text-gray-800 leading-tight",description:"text-[11px] text-gray-400 mt-1.5 leading-relaxed line-clamp-2",meta:"flex items-center gap-2 mt-3 flex-wrap",badge:"text-[9px] font-medium px-2 py-0.5 rounded-full",badgeDraft:"bg-amber-100 border border-amber-200 text-amber-700",badgePublished:"bg-emerald-100 border border-emerald-200 text-emerald-700",triggerBadge:"inline-flex items-center gap-1 rounded-md bg-gray-100 border border-gray-200 px-2 py-0.5 text-[9px] font-medium text-gray-500",actions:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",editButton:"w-7 h-7 rounded-lg flex items-center justify-center text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-all",deleteButton:"w-7 h-7 rounded-lg flex items-center justify-center text-gray-400 hover:text-red-600 hover:bg-red-50 transition-all"},empty:{container:"col-span-full flex flex-col items-center justify-center py-20",icon:"w-16 h-16 text-gray-200 mb-4",title:"text-[14px] font-medium text-gray-500 mb-1",description:"text-[12px] text-gray-400"}},loading:{container:"absolute inset-0 flex items-center justify-center bg-white/80 backdrop-blur-sm z-10",spinner:"w-8 h-8 border-2 border-gray-200 border-t-blue-400 rounded-full animate-spin"}};function fl(e){return e==="light"?c0:ht}function p0(e){return{...ht,...e,layout:{...ht.layout,...e.layout},header:{...ht.header,...e.header},tabs:{...ht.tabs,...e.tabs},palette:{...ht.palette,...e.palette},canvas:{...ht.canvas,...e.canvas},stepNode:{...ht.stepNode,...e.stepNode},verifierNode:{...ht.verifierNode,...e.verifierNode},notificationNode:{...ht.notificationNode,...e.notificationNode},propertiesPanel:{...ht.propertiesPanel,...e.propertiesPanel},overlay:{...ht.overlay,...e.overlay},legend:{...ht.legend,...e.legend},pending:{...ht.pending,...e.pending},flowList:{...ht.flowList,...e.flowList},loading:{...ht.loading,...e.loading}}}var u0=ht;function g0(e){u0=e}function Dr(){return u0}import{jsxDEV as Be}from"react/jsx-dev-runtime";var rb=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Step"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nb=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Verifier"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ab=({className:e})=>Be("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Be("title",{children:"Notification"},void 0,!1,void 0,this),Be("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);function hi({data:e}){let t=Dr().stepNode,r=e.selected===!0;return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),e.stepOrder>0&&Be("span",{className:t.orderBadge,children:e.stepOrder},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(rb,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Step"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||`Step ${e.stepOrder}`},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be(oa,{type:"source",position:la.Right,className:t.handleSource},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yi({data:e}){let t=Dr().verifierNode,r=e.selected===!0,n=e.verifierType==="role"?e.verifierRole||"No role":e.verifierUserEmail||"No user";return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(nb,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Verifier"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||"Verifier"},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[Be("span",{className:t.assignedBadge,children:[e.verifierType==="role"?"\u26CA":"\u2687"," ",n]},void 0,!0,void 0,this),e.requireSignature&&Be("span",{className:t.signatureBadge,children:"\u270D Signature"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be(oa,{type:"source",position:la.Right,className:t.handleSource},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wi({data:e}){let t=Dr().notificationNode,r=e.selected===!0,n=e.channels||[],i=(e.trigger||"on_step_reached").replace(/^on_/,"").replace(/_/g," "),o=(()=>{if(!e.recipientType)return null;if(e.recipientType==="user")return e.recipientUserEmail||"No user";if(e.recipientType==="role")return e.recipientRole||"No role";if(e.recipientType==="all_verifiers")return"All Verifiers";if(e.recipientType==="step_verifier")return"Step Verifier";if(e.recipientType==="entity_creator")return"Entity Creator";return e.recipientType})();return Be("div",{className:r?t.containerSelected:t.container,children:[Be(oa,{type:"target",position:la.Left,className:t.handleTarget},void 0,!1,void 0,this),Be("div",{className:"flex items-center gap-2",children:[Be(ab,{className:`w-4 h-4 ${t.icon}`},void 0,!1,void 0,this),Be("span",{className:t.typeLabel,children:"Notification"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Be("p",{className:t.nameLabel,children:e.label||"Notification"},void 0,!1,void 0,this),e.description?Be("p",{className:t.description,children:String(e.description)},void 0,!1,void 0,this):null,Be("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[Be("span",{className:t.triggerBadge,children:["\u26A1 ",i]},void 0,!0,void 0,this),n.map((s)=>Be("span",{className:t.channelBadge,children:s},s,!1,void 0,this))]},void 0,!0,void 0,this),o&&Be("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:Be("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-purple-500/15 text-purple-300 border border-purple-500/20",children:[e.recipientType==="role"?"\u26CA":"\u2687"," ",o]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ht}from"react/jsx-dev-runtime";var ib=[{type:"step",label:"Step",description:"A verification checkpoint in the flow",iconBg:"bg-blue-500/20 text-blue-400",themeKey:"stepItem"},{type:"verifier",label:"Verifier",description:"Assign a user or role to approve",iconBg:"bg-amber-500/20 text-amber-400",themeKey:"verifierItem"},{type:"notification",label:"Notification",description:"Send alerts via portal, email, or webhook",iconBg:"bg-violet-500/20 text-violet-400",themeKey:"notificationItem"}],ob=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Step"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),lb=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Verifier"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),sb=()=>Ht("svg",{className:"w-4.5 h-4.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[Ht("title",{children:"Notification"},void 0,!1,void 0,this),Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),db={step:ob,verifier:lb,notification:sb};function ki(){let e=Dr().palette,t=(r,n)=>{r.dataTransfer.setData("application/reactflow-nodetype",n),r.dataTransfer.effectAllowed="move"};return Ht("div",{className:e.container,children:[Ht("p",{className:e.title,children:"Components"},void 0,!1,void 0,this),ib.map((r)=>{let n=db[r.type];return Ht("div",{role:"button",tabIndex:0,className:w(e.item,e[r.themeKey]),draggable:!0,onDragStart:(a)=>t(a,r.type),children:[Ht("div",{className:w(e.itemIcon,r.iconBg),children:Ht(n,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ht("div",{children:[Ht("p",{className:e.itemLabel,children:r.label},void 0,!1,void 0,this),Ht("p",{className:e.itemDescription,children:r.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},r.type,!0,void 0,this)}),Ht("p",{className:e.dragHint,children:"Drag a component onto the canvas to add it to your flow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as gb,useEffectEvent as b0}from"react";import{batch as cb,createStore as pb}from"h-state";var m0={steps:[],edges:[],verifier_configs:[],notification_rules:[],notification_recipients:[],notification_channels:[]},ub={flows:[],selectedFlowId:null,graphData:{...m0},pendingItems:[],activeTab:"flow",isLoadingFlows:!1,isLoadingGraph:!1,isLoadingPending:!1,decidingId:null,decisionReason:"",selectedNodeId:null,draggedNodeType:null,isSaving:!1,isDirty:!1,error:null},{useStore:Hn}=pb(ub,{setFlows:(e)=>(t)=>{e.flows=t},setSelectedFlowId:(e)=>(t)=>{e.selectedFlowId=t},setGraphData:(e)=>(t)=>{e.graphData=t},setPendingItems:(e)=>(t)=>{e.pendingItems=t},setActiveTab:(e)=>(t)=>{e.activeTab=t},setLoadingFlows:(e)=>(t)=>{e.isLoadingFlows=t},setLoadingGraph:(e)=>(t)=>{e.isLoadingGraph=t},setLoadingPending:(e)=>(t)=>{e.isLoadingPending=t},setDecidingId:(e)=>(t)=>{e.decidingId=t},setDecisionReason:(e)=>(t)=>{e.decisionReason=t},setSelectedNodeId:(e)=>(t)=>{e.selectedNodeId=t},setDraggedNodeType:(e)=>(t)=>{e.draggedNodeType=t},setIsSaving:(e)=>(t)=>{e.isSaving=t},setIsDirty:(e)=>(t)=>{e.isDirty=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{cb(()=>{e.flows=[],e.selectedFlowId=null,e.graphData={...m0},e.pendingItems=[],e.activeTab="flow",e.isLoadingFlows=!1,e.isLoadingGraph=!1,e.isLoadingPending=!1,e.decidingId=null,e.decisionReason="",e.selectedNodeId=null,e.draggedNodeType=null,e.isSaving=!1,e.isDirty=!1,e.error=null})}});import{jsxDEV as St}from"react/jsx-dev-runtime";function vi({pendingAction:e,decideAction:t,onDecisionMade:r}){let n=Dr(),a=Hn(),i=b0(()=>{a.setLoadingPending(!0),e.start({payload:void 0,onAfterHandle:(s)=>{let l=s;if(l.success===!1){console.error("[PendingTab] API returned success=false:",s),a.setPendingItems([]),a.setLoadingPending(!1);return}a.setPendingItems(l.data??[]),a.setLoadingPending(!1)},onErrorHandle:(s,l)=>{let c=s,d=c?.message||c?.error||JSON.stringify(s);console.error(`[PendingTab] Pending error (HTTP ${l??"?"}):`,d),a.setPendingItems([]),a.setLoadingPending(!1)}})});gb(()=>{i()},[]);let o=b0((s,l)=>{t.start({payload:{entity_name:s.entity_name,entity_id:s.entity_id,decision:l,reason:a.decisionReason||void 0},onAfterHandle:()=>{a.setDecidingId(null),a.setDecisionReason(""),r?.(s.entity_name,s.entity_id),i()}})});if(a.isLoadingPending)return St("div",{className:"flex items-center justify-center py-20",children:St("div",{className:n.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(a.pendingItems.length===0)return St("div",{className:n.pending.empty.container,children:[St("svg",{className:n.pending.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[St("title",{children:"No pending items"},void 0,!1,void 0,this),St("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),St("p",{className:n.pending.empty.text,children:"No pending verifications"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return St("div",{className:n.pending.container,children:[St("h2",{className:n.pending.title,children:["Pending Approvals (",a.pendingItems.length,")"]},void 0,!0,void 0,this),a.pendingItems.map((s)=>St("div",{className:n.pending.card.container,children:St("div",{className:"flex items-center justify-between",children:[St("div",{children:[St("p",{className:n.pending.card.title,children:[s.flow_name," \u2014 Step ",s.step_order]},void 0,!0,void 0,this),St("p",{className:n.pending.card.subtitle,children:[s.entity_name,"/",s.entity_id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a.decidingId===s.instance_id?St("div",{className:n.pending.card.actions,children:[St("input",{type:"text",placeholder:"Reason (optional)",value:a.decisionReason,onChange:(l)=>a.setDecisionReason(l.target.value),className:n.pending.input},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>o(s,"approved"),className:n.pending.approveButton,children:"Approve"},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>o(s,"rejected"),className:n.pending.rejectButton,children:"Reject"},void 0,!1,void 0,this),St("button",{type:"button",onClick:()=>{a.setDecidingId(null),a.setDecisionReason("")},className:n.pending.cancelButton,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):St("button",{type:"button",onClick:()=>a.setDecidingId(s.instance_id),className:n.pending.reviewButton,children:"Review"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},`${s.instance_id}-${s.step_order}`,!1,void 0,this))]},void 0,!0,void 0,this)}import{useEffect as w0,useEffectEvent as Ni,useState as ur}from"react";import{jsxDEV as Y,Fragment as y0}from"react/jsx-dev-runtime";var mb=["portal","email","sms","telegram","webhook"],bb=[{value:"on_flow_started",label:"Flow Started"},{value:"on_step_reached",label:"Step Reached"},{value:"on_approved",label:"Approved"},{value:"on_rejected",label:"Rejected"},{value:"on_flow_completed",label:"Flow Completed"}],fb=[{value:"all_verifiers",label:"All Verifiers"},{value:"step_verifier",label:"Step Verifier"},{value:"entity_creator",label:"Entity Creator"},{value:"role",label:"Specific Role"},{value:"user",label:"Specific User"}];function hb({selected:e,onChange:t,msTheme:r}){let n=r,[a,i]=ur(!1),o=(l)=>{if(e.includes(l))t(e.filter((c)=>c!==l));else t([...e,l])},s=(l)=>{t(e.filter((c)=>c!==l))};return Y("div",{className:"relative",children:[Y("div",{role:"combobox",tabIndex:0,"aria-expanded":a,className:`${n.container} cursor-pointer`,onClick:()=>i(!a),onKeyDown:(l)=>{if(l.key==="Enter"||l.key===" ")l.preventDefault(),i(!a)},children:[e.length===0&&Y("span",{className:"text-[10px] text-white/20",children:"Select channels..."},void 0,!1,void 0,this),e.map((l)=>Y("span",{className:n.badge,children:[l,Y("span",{role:"button",tabIndex:0,className:n.badgeRemove,onClick:(c)=>{c.stopPropagation(),s(l)},onKeyDown:(c)=>{if(c.key==="Enter"||c.key===" ")c.stopPropagation(),s(l)},children:"\xD7"},void 0,!1,void 0,this)]},l,!0,void 0,this))]},void 0,!0,void 0,this),a&&Y("div",{className:n.dropdown,children:mb.map((l)=>Y("button",{type:"button",className:e.includes(l)?n.optionSelected:n.option,onClick:()=>o(l),children:[e.includes(l)?"\u2713 ":"",l]},l,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var xi=[],zi=[];function f0({listUsersAction:e,selectedUserId:t,onSelect:r,ursTheme:n}){let a=n,[i,o]=ur(""),[s,l]=ur(xi),[c,d]=ur(1),[g,h]=ur(!1),[k,u]=ur(!1),[S,f]=ur(!!t),P=Ni((m,y)=>{if(!e)return;u(!0),e.start({payload:{page:m,limit:20,search:y||void 0},onAfterHandle:(v)=>{let b=v.data,R=b?.items||b?.data||[],J=b?.meta?.hasNextPage===!0||R.length>=20;if(m===1){if(l(R),!y)xi=R}else l((U)=>[...U,...R]);h(J&&R.length>0),u(!1)},onErrorHandle:()=>{u(!1)}})});w0(()=>{if(i===""&&xi.length>0){l(xi);return}P(1,i),d(1)},[i]);let x=Ni(()=>{let m=c+1;d(m),P(m,i)});if(!e)return Y("p",{className:a.empty,children:"No user data source configured"},void 0,!1,void 0,this);let z=t?s.find((m)=>m.id===t):null;if(S&&z)return Y("div",{className:a.container,children:Y("div",{className:"flex items-center gap-2 rounded-lg bg-blue-500/15 border border-blue-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 flex items-center justify-center text-[10px] font-bold text-blue-300 flex-shrink-0",children:(z.name||z.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0 flex-1",children:[Y("span",{className:"text-[11px] font-medium text-blue-300 truncate",children:z.name||z.email},void 0,!1,void 0,this),z.name&&Y("span",{className:"text-[10px] text-blue-300/50 truncate",children:z.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("button",{type:"button",className:"text-[10px] text-blue-400 hover:text-blue-300 ml-auto flex-shrink-0",onClick:()=>f(!1),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Y("div",{className:a.container,children:[z&&Y("div",{className:"flex items-center gap-2 rounded-lg bg-blue-500/15 border border-blue-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 flex items-center justify-center text-[10px] font-bold text-blue-300 flex-shrink-0",children:(z.name||z.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0",children:[Y("span",{className:"text-[11px] font-medium text-blue-300 truncate",children:z.name||z.email},void 0,!1,void 0,this),z.name&&Y("span",{className:"text-[10px] text-blue-300/50 truncate",children:z.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("input",{type:"text",className:a.searchInput,placeholder:"Search users...",value:i,onChange:(m)=>o(m.target.value)},void 0,!1,void 0,this),Y("div",{className:a.listContainer,children:[s.length===0&&!k&&Y("p",{className:a.empty,children:"No users found"},void 0,!1,void 0,this),s.map((m)=>Y("button",{type:"button",className:m.id===t?a.listItemSelected:a.listItem,onClick:()=>{r(m),f(!0)},children:[Y("span",{className:a.listItemAvatar,children:(m.name||m.email||"?").charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"flex flex-col min-w-0",children:[Y("span",{className:a.listItemName,children:m.name||m.email},void 0,!1,void 0,this),m.name?Y("span",{className:a.listItemEmail,children:m.email},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},m.id,!0,void 0,this)),g&&Y("button",{type:"button",className:a.loadMore,onClick:x,children:k?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h0({listRolesAction:e,selectedRole:t,onSelect:r,ursTheme:n}){let a=n,[i,o]=ur(""),[s,l]=ur(zi),[c,d]=ur(1),[g,h]=ur(!1),[k,u]=ur(!1),[S,f]=ur(!!t),P=Ni((z,m)=>{if(!e)return;u(!0),e.start({payload:{page:z,limit:20,search:m||void 0},onAfterHandle:(y)=>{let p=y.data,b=p?.items||p?.data||[],$=p?.meta?.hasNextPage===!0||b.length>=20;if(z===1){if(l(b),!m)zi=b}else l((J)=>[...J,...b]);h($&&b.length>0),u(!1)},onErrorHandle:()=>{u(!1)}})});w0(()=>{if(i===""&&zi.length>0){l(zi);return}P(1,i),d(1)},[i]);let x=Ni(()=>{let z=c+1;d(z),P(z,i)});if(!e)return Y("p",{className:a.empty,children:"No role data source configured"},void 0,!1,void 0,this);if(S&&t)return Y("div",{className:a.container,children:Y("div",{className:"flex items-center gap-2 rounded-lg bg-emerald-500/15 border border-emerald-500/25 px-3 py-2",children:[Y("span",{className:"w-6 h-6 rounded-full bg-emerald-500/20 flex items-center justify-center text-[10px] font-bold text-emerald-300 flex-shrink-0",children:t.charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{className:"text-[11px] font-medium text-emerald-300 truncate flex-1",children:t},void 0,!1,void 0,this),Y("button",{type:"button",className:"text-[10px] text-emerald-400 hover:text-emerald-300 ml-auto flex-shrink-0",onClick:()=>f(!1),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Y("div",{className:a.container,children:[Y("input",{type:"text",className:a.searchInput,placeholder:"Search roles...",value:i,onChange:(z)=>o(z.target.value)},void 0,!1,void 0,this),Y("div",{className:a.listContainer,children:[s.length===0&&!k&&Y("p",{className:a.empty,children:"No roles found"},void 0,!1,void 0,this),s.map((z)=>Y("button",{type:"button",className:z.name===t?a.listItemSelected:a.listItem,onClick:()=>{r(z),f(!0)},children:[Y("span",{className:a.listItemAvatar,children:z.name.charAt(0).toUpperCase()},void 0,!1,void 0,this),Y("span",{children:[Y("span",{className:a.listItemName,children:z.name},void 0,!1,void 0,this),z.description?Y("span",{className:a.listItemEmail,children:z.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},z.id,!0,void 0,this)),g&&Y("button",{type:"button",className:a.loadMore,onClick:x,children:k?"Loading...":"Load more"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Si({nodeId:e,nodeData:t,onUpdateNode:r,onDeleteNode:n,onClose:a,listUsersAction:i,listRolesAction:o,panelTheme:s}){let l=s,c=t,d=c.nodeType,g=(h)=>{r(e,{...c,...h})};return Y("div",{className:l.container,children:[Y("div",{className:l.header,children:[Y("h3",{className:l.headerTitle,children:[d==="step"&&"Step Properties",d==="verifier"&&"Verifier Properties",d==="notification"&&"Notification Properties"]},void 0,!0,void 0,this),Y("button",{type:"button",className:l.closeButton,onClick:a,children:Y("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[Y("title",{children:"Close"},void 0,!1,void 0,this),Y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.body,children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"General"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-name-${e}`,className:l.label,children:"Name"},void 0,!1,void 0,this),Y("input",{id:`prop-name-${e}`,type:"text",className:l.input,value:c.label||"",onChange:(h)=>g({label:h.target.value}),placeholder:"Node name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-desc-${e}`,className:l.label,children:"Description"},void 0,!1,void 0,this),Y("textarea",{id:`prop-desc-${e}`,className:l.textarea,rows:2,value:c.description||"",onChange:(h)=>g({description:h.target.value}),placeholder:"Describe this node..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d==="verifier"&&Y(y0,{children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Assignment"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-vtype-${e}`,className:l.label,children:"Verifier Type"},void 0,!1,void 0,this),Y("select",{id:`prop-vtype-${e}`,className:l.select,value:c.verifierType||"role",onChange:(h)=>g({verifierType:h.target.value,verifierUserId:void 0,verifierUserEmail:void 0,verifierRole:void 0}),children:[Y("option",{value:"role",children:"Role"},void 0,!1,void 0,this),Y("option",{value:"user",children:"Specific User"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),c.verifierType==="user"&&Y(f0,{listUsersAction:i,selectedUserId:c.verifierUserId,onSelect:(h)=>g({verifierUserId:h.id,verifierUserEmail:h.email}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this),(c.verifierType==="role"||!c.verifierType)&&Y(h0,{listRolesAction:o,selectedRole:c.verifierRole,onSelect:(h)=>g({verifierRole:h.name}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Options"},void 0,!1,void 0,this),Y("div",{className:"flex items-center gap-2",children:[Y("input",{type:"checkbox",id:`prop-sig-${e}`,className:l.checkbox,checked:c.requireSignature||!1,onChange:(h)=>g({requireSignature:h.target.checked})},void 0,!1,void 0,this),Y("label",{htmlFor:`prop-sig-${e}`,className:l.checkboxLabel,children:"Require Signature"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c.verifierType==="role"&&Y("div",{className:"flex items-center gap-2",children:[Y("input",{type:"checkbox",id:`prop-all-${e}`,className:l.checkbox,checked:c.allMustApprove||!1,onChange:(h)=>g({allMustApprove:h.target.checked})},void 0,!1,void 0,this),Y("label",{htmlFor:`prop-all-${e}`,className:l.checkboxLabel,children:"All Must Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d==="notification"&&Y(y0,{children:[Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Trigger"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-trigger-${e}`,className:l.label,children:"When to Notify"},void 0,!1,void 0,this),Y("select",{id:`prop-trigger-${e}`,className:l.select,value:c.trigger||"on_step_reached",onChange:(h)=>g({trigger:h.target.value}),children:bb.map((h)=>Y("option",{value:h.value,children:h.label},h.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Channels"},void 0,!1,void 0,this),Y(hb,{selected:c.channels||[],onChange:(h)=>g({channels:h}),msTheme:l.multiSelect},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Recipient"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-rtype-${e}`,className:l.label,children:"Recipient Type"},void 0,!1,void 0,this),Y("select",{id:`prop-rtype-${e}`,className:l.select,value:c.recipientType||"all_verifiers",onChange:(h)=>g({recipientType:h.target.value,recipientUserId:void 0,recipientUserEmail:void 0,recipientRole:void 0}),children:fb.map((h)=>Y("option",{value:h.value,children:h.label},h.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c.recipientType==="user"&&Y(f0,{listUsersAction:i,selectedUserId:c.recipientUserId,onSelect:(h)=>g({recipientUserId:h.id,recipientUserEmail:h.email}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this),c.recipientType==="role"&&Y(h0,{listRolesAction:o,selectedRole:c.recipientRole,onSelect:(h)=>g({recipientRole:h.name,recipientUserEmail:void 0}),ursTheme:l.userRoleSearch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:l.section,children:[Y("p",{className:l.sectionTitle,children:"Templates"},void 0,!1,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-title-tpl-${e}`,className:l.label,children:"Title Template"},void 0,!1,void 0,this),Y("input",{id:`prop-title-tpl-${e}`,type:"text",className:l.input,value:c.titleTemplate||"",onChange:(h)=>g({titleTemplate:h.target.value}),placeholder:"e.g. Verification required for {{entity_name}}"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y("div",{children:[Y("label",{htmlFor:`prop-body-tpl-${e}`,className:l.label,children:"Body Template"},void 0,!1,void 0,this),Y("textarea",{id:`prop-body-tpl-${e}`,className:l.textarea,rows:3,value:c.bodyTemplate||"",onChange:(h)=>g({bodyTemplate:h.target.value}),placeholder:"Notification body..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y("div",{className:"pt-3 mt-auto",children:Y("button",{type:"button",className:l.deleteButton,onClick:()=>n(e),children:"Delete Node"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as yb,useEffectEvent as hl,useState as k0}from"react";import{jsxDEV as Xe}from"react/jsx-dev-runtime";var wb={container:"space-y-4",header:"space-y-1",title:"text-lg font-bold text-white/90 tracking-tight",description:"text-sm text-white/40",tabs:"flex items-center gap-1 p-1 rounded-xl bg-white/5 border border-white/10",tab:"px-3.5 py-1.5 rounded-lg text-xs font-medium text-white/40 transition-all cursor-pointer hover:text-white/60",tabActive:"px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-white/10 text-white/90 shadow-sm cursor-pointer",tabCount:"ml-1 text-[10px] opacity-50",list:"space-y-2",listItem:"flex items-center gap-4 p-4 rounded-xl border border-white/8 bg-white/[0.03] transition-all",listItemHover:"hover:bg-white/[0.06] hover:border-white/12",entityInfo:"flex-1 min-w-0 space-y-0.5",entityName:"text-sm font-semibold text-white/80 truncate",entityId:"text-[11px] text-white/30 font-mono truncate",flowName:"text-[11px] text-white/40",statusBadge:"px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider shrink-0",statusActive:"bg-amber-500/15 text-amber-300 ring-1 ring-amber-500/20",statusCompleted:"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/20",statusRejected:"bg-red-500/15 text-red-300 ring-1 ring-red-500/20",statusCancelled:"bg-white/8 text-white/30 ring-1 ring-white/10",progressSection:"flex items-center gap-2.5 shrink-0 w-[140px]",progressBar:"flex-1 h-1.5 rounded-full bg-white/8 overflow-hidden",progressFill:"h-full rounded-full transition-all duration-500",progressLabel:"text-[10px] text-white/40 font-medium whitespace-nowrap w-[45px] text-right",metaSection:"flex items-center gap-4 shrink-0",metaLabel:"text-[10px] text-white/30 uppercase tracking-wider",metaValue:"text-xs text-white/60",emptyState:"flex flex-col items-center gap-3 py-12",emptyIcon:"text-white/15",emptyText:"text-sm text-white/30",pagination:"flex items-center justify-center gap-2 pt-2",pageButton:"px-3 py-1.5 rounded-lg text-xs font-medium text-white/40 bg-white/5 border border-white/10 hover:bg-white/10 transition-all cursor-pointer",pageButtonActive:"px-3 py-1.5 rounded-lg text-xs font-semibold text-white/80 bg-white/10 border border-white/15",pageInfo:"text-xs text-white/30",loadingSpinner:"flex items-center justify-center py-8"},kb={container:"space-y-4",header:"space-y-1",title:"text-lg font-bold text-gray-900 tracking-tight",description:"text-sm text-gray-500",tabs:"flex items-center gap-1 p-1 rounded-xl bg-gray-100 border border-gray-200",tab:"px-3.5 py-1.5 rounded-lg text-xs font-medium text-gray-400 transition-all cursor-pointer hover:text-gray-600",tabActive:"px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-white text-gray-900 shadow-sm cursor-pointer",tabCount:"ml-1 text-[10px] opacity-50",list:"space-y-2",listItem:"flex items-center gap-4 p-4 rounded-xl border border-gray-200 bg-white transition-all",listItemHover:"hover:bg-gray-50 hover:border-gray-300",entityInfo:"flex-1 min-w-0 space-y-0.5",entityName:"text-sm font-semibold text-gray-800 truncate",entityId:"text-[11px] text-gray-400 font-mono truncate",flowName:"text-[11px] text-gray-500",statusBadge:"px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider shrink-0",statusActive:"bg-amber-100 text-amber-700 ring-1 ring-amber-200",statusCompleted:"bg-emerald-100 text-emerald-700 ring-1 ring-emerald-200",statusRejected:"bg-red-100 text-red-700 ring-1 ring-red-200",statusCancelled:"bg-gray-100 text-gray-400 ring-1 ring-gray-200",progressSection:"flex items-center gap-2.5 shrink-0 w-[140px]",progressBar:"flex-1 h-1.5 rounded-full bg-gray-200 overflow-hidden",progressFill:"h-full rounded-full transition-all duration-500",progressLabel:"text-[10px] text-gray-500 font-medium whitespace-nowrap w-[45px] text-right",metaSection:"flex items-center gap-4 shrink-0",metaLabel:"text-[10px] text-gray-400 uppercase tracking-wider",metaValue:"text-xs text-gray-600",emptyState:"flex flex-col items-center gap-3 py-12",emptyIcon:"text-gray-300",emptyText:"text-sm text-gray-400",pagination:"flex items-center justify-center gap-2 pt-2",pageButton:"px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 bg-white border border-gray-200 hover:bg-gray-50 transition-all cursor-pointer",pageButtonActive:"px-3 py-1.5 rounded-lg text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-300",pageInfo:"text-xs text-gray-400",loadingSpinner:"flex items-center justify-center py-8"},vb=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"completed",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"cancelled",label:"Cancelled"}];function yl({entityName:e,entityStatusesAction:t,theme:r,themeMode:n="dark",onEntityClick:a,pageSize:i=20}){let s={...n==="light"?kb:wb,...r},[l,c]=k0("all"),[d,g]=k0(1),h=hl((b,R)=>{t.start({payload:{entity_name:e,status:b==="all"?void 0:b,page:R||1,limit:i}})}),k=hl((b)=>{c(b),g(1),h(b==="all"?void 0:b,1)}),u=hl((b)=>{g(b),h(l==="all"?void 0:l,b)});yb(()=>{h(void 0,1)},[]);let S=t.state.data,f=t.state.isPending,P=S,x=P?.data?.items||[],z=P?.data?.total||0,m=Math.ceil(z/i)||1,y=(b)=>{switch(b){case"active":return s.statusActive;case"completed":return s.statusCompleted;case"rejected":return s.statusRejected;case"cancelled":return s.statusCancelled;default:return s.statusActive}},v=(b)=>{switch(b){case"completed":return"bg-emerald-400";case"rejected":return"bg-red-400";case"active":return"bg-gradient-to-r from-amber-400 to-cyan-400";default:return"bg-white/20"}},p=(b)=>{if(b.status==="completed")return 100;if(b.total_steps===0)return 0;return Math.round((b.current_step_order-1)/b.total_steps*100)};return Xe("div",{className:s.container,children:[Xe("header",{className:s.header,children:[Xe("h2",{className:s.title,children:"Verification Status"},void 0,!1,void 0,this),Xe("p",{className:s.description,children:[z," record",z!==1?"s":""," for ",e]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Xe("nav",{className:s.tabs,children:vb.map((b)=>Xe("button",{type:"button",className:l===b.value?s.tabActive:s.tab,onClick:()=>k(b.value),children:b.label},b.value,!1,void 0,this))},void 0,!1,void 0,this),f?Xe("div",{className:s.loadingSpinner,children:Xe("div",{className:`w-6 h-6 rounded-full border-2 animate-spin ${n==="light"?"border-gray-200 border-t-blue-500":"border-white/10 border-t-cyan-400"}`},void 0,!1,void 0,this)},void 0,!1,void 0,this):x.length===0?Xe("div",{className:s.emptyState,children:[Xe("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:s.emptyIcon,role:"img",children:[Xe("title",{children:"No records"},void 0,!1,void 0,this),Xe("path",{d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe("p",{className:s.emptyText,children:["No ",l==="all"?"":l," verification records found"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Xe("div",{className:s.list,children:x.map((b)=>{let R=p(b);return Xe("article",{className:`${s.listItem} ${a?s.listItemHover:""} ${a?"cursor-pointer":""}`,onClick:()=>a?.(b),onKeyDown:($)=>{if($.key==="Enter"||$.key===" ")a?.(b)},role:a?"button":void 0,tabIndex:a?0:void 0,children:[Xe("div",{className:s.entityInfo,children:[Xe("p",{className:s.entityName,children:b.entity_name},void 0,!1,void 0,this),Xe("p",{className:s.entityId,children:b.entity_id},void 0,!1,void 0,this),Xe("p",{className:s.flowName,children:b.flow_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Xe("div",{className:s.progressSection,children:[Xe("div",{className:s.progressBar,children:Xe("div",{className:`${s.progressFill} ${v(b.status)}`,style:{width:`${R}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Xe("span",{className:s.progressLabel,children:[b.current_step_order,"/",b.total_steps]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Xe("div",{className:s.metaSection,children:Xe("div",{children:[Xe("p",{className:s.metaLabel,children:"Started"},void 0,!1,void 0,this),Xe("p",{className:s.metaValue,children:new Date(b.started_at).toLocaleDateString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Xe("span",{className:`${s.statusBadge} ${y(b.status)}`,children:b.status==="completed"?"approved":b.status},void 0,!1,void 0,this)]},b.instance_id,!0,void 0,this)})},void 0,!1,void 0,this),m>1&&Xe("nav",{className:s.pagination,children:[Xe("button",{type:"button",className:s.pageButton,disabled:d<=1,onClick:()=>u(d-1),children:"Prev"},void 0,!1,void 0,this),Xe("span",{className:s.pageInfo,children:["Page ",d," of ",m]},void 0,!0,void 0,this),Xe("button",{type:"button",className:s.pageButton,disabled:d>=m,onClick:()=>u(d+1),children:"Next"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{addEdge as xb,applyEdgeChanges as zb,applyNodeChanges as Nb,Background as Sb,Controls as Cb,MarkerType as Pb,MiniMap as Tb,ReactFlow as Lb}from"@xyflow/react";import"@xyflow/react/dist/style.css";import{useEffect as v0,useEffectEvent as Tt,useRef as x0,useState as Or}from"react";import{jsxDEV as G,Fragment as _b}from"react/jsx-dev-runtime";var Mb={step:hi,verifier:yi,notification:wi};function Rb(e){return{type:"default",animated:e,markerEnd:{type:Pb.ArrowClosed,width:e?16:20,height:e?16:20,color:e?"rgba(255,255,255,0.35)":"#000000"},style:{stroke:e?"rgba(255,255,255,0.35)":"#000000",strokeWidth:e?1.5:2}}}var z0=0;function Bb(){return z0+=1,`node_${Date.now()}_${z0}`}function Wb(e,t,r){return e.map((n)=>{let a={label:n.name||`Step ${n.step_order}`,description:n.description||"",nodeType:n.node_type,stepOrder:n.step_order,selected:n.node_id===r};if(n.node_type==="verifier"){let i=t.verifier_configs.find((o)=>o.node_id===n.node_id);return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:{...a,verifierType:i?.verifier_type||"role",verifierUserId:i?.verifier_user_id||"",verifierRole:i?.verifier_role||"",verifierUserEmail:"",requireSignature:i?.require_signature||!1,allMustApprove:i?.all_must_approve||!1}}}if(n.node_type==="notification"){let i=t.notification_rules.find((c)=>c.node_id===n.node_id),o=i?.id||n.node_id,s=t.notification_channels.filter((c)=>c.rule_id===o||c.rule_id===n.node_id).map((c)=>c.channel),l=t.notification_recipients.find((c)=>c.rule_id===o||c.rule_id===n.node_id);return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:{...a,trigger:i?.trigger||"on_step_reached",channels:s,titleTemplate:i?.title_template||"",bodyTemplate:i?.body_template||"",recipientType:l?.recipient_type||"",recipientUserId:l?.recipient_user_id||"",recipientRole:l?.recipient_role||"",recipientUserEmail:""}}}return{id:n.node_id,type:n.node_type,position:{x:n.position_x,y:n.position_y},data:a}})}function Ib(e,t){return e.map((r)=>({id:r.edge_id,source:r.source_node_id,target:r.target_node_id,sourceHandle:r.source_handle||void 0,targetHandle:r.target_handle||void 0,...t,label:r.label||void 0}))}function Hb(e,t){let r={step:"New Step",verifier:"New Verifier",notification:"New Notification"},n={id:Bb(),type:e,position:t,data:{label:r[e],description:"",nodeType:e,stepOrder:0,selected:!1}};if(e==="verifier")n.data={...n.data,verifierType:"role",verifierRole:"",requireSignature:!1,allMustApprove:!1};if(e==="notification")n.data={...n.data,trigger:"on_step_reached",channels:[]};return n}function $b(e,t,r,n,a,i,o,s,l){let c=l.map((p)=>({edge_id:p.id,source_node_id:p.source,target_node_id:p.target,source_handle:p.sourceHandle||void 0,target_handle:p.targetHandle||void 0,edge_type:"default",label:String(p.label||""),animated:!0})),d=new Set(s.filter((p)=>{return(p.data.nodeType||p.type)==="step"}).map((p)=>p.id)),g={};for(let p of c){if(!g[p.source_node_id])g[p.source_node_id]=[];g[p.source_node_id]?.push(p.target_node_id)}let h=(p,b=new Set)=>{let R=[];for(let $ of g[p]||[]){if(b.has($))continue;if(b.add($),d.has($))R.push($);else R.push(...h($,b))}return R},k={},u=new Set;for(let p of d){k[p]=h(p);for(let b of k[p])u.add(b)}let S={},f=[...d].filter((p)=>!u.has(p)),P=1;while(f.length>0){let p=f.shift();if(!p)break;if(S[p]!==void 0)continue;S[p]=P++;for(let b of k[p]||[])f.push(b)}let x=s.map((p)=>{let b=p.data,R=String(b.nodeType||p.type);return{node_id:p.id,node_type:R,step_order:R==="step"?S[p.id]??0:0,name:String(b.label||""),description:String(b.description||""),position_x:Math.round(p.position.x),position_y:Math.round(p.position.y),width:p.width||void 0,height:p.height||void 0}}),z=s.filter((p)=>{return p.data.nodeType==="verifier"}).map((p)=>{let b=p.data;return{node_id:p.id,verifier_type:b.verifierType||"role",verifier_user_id:b.verifierUserId,verifier_role:b.verifierRole,require_signature:Boolean(b.requireSignature),all_must_approve:Boolean(b.allMustApprove)}}),m=[],y=[],v=[];for(let p of s){let b=p.data;if(b.nodeType!=="notification")continue;let R=`rule_${p.id}`;m.push({id:R,node_id:p.id,trigger:b.trigger||"on_step_reached",title_template:b.titleTemplate,body_template:b.bodyTemplate});let $=b.channels||[];for(let J of $)y.push({rule_id:p.id,channel:J});if(b.recipientType)v.push({rule_id:p.id,recipient_type:b.recipientType,recipient_user_id:b.recipientUserId,recipient_role:b.recipientRole})}return{flow_id:e,entity_name:t,name:r,description:n,trigger_on:a,is_draft:i,viewport:o,graph:{steps:x,edges:c,verifier_configs:z,notification_rules:m,notification_recipients:v,notification_channels:y}}}function N0({entityName:e,title:t,subtitle:r,flowListAction:n,flowGetAction:a,flowSaveAction:i,flowPublishAction:o,flowDeleteAction:s,pendingAction:l,decideAction:c,listUsersAction:d,listRolesAction:g,entityStatusesAction:h,onFlowSelected:k,onDecisionMade:u,onEntityClick:S,onBack:f,showPending:P=!0,showEntityStatuses:x=!1,className:z,themeMode:m="dark"}){let y=fl(m);g0(y);let v=Rb(m==="dark"),p=Hn(),[b,R]=Or([]),[$,J]=Or([]),[U,E]=Or(!1),[K,M]=Or(""),[Q,N]=Or(""),[O,A]=Or("create"),[D,I]=Or(null),[_,T]=Or("list"),[ie,q]=Or(!1),ce=x0(null),oe=x0(null),Ze=t||`${e} Verification`,$e=r||e,Pe=Tt((ne)=>{R((W)=>Nb(ne,W)),p.setIsDirty(!0)}),fe=Tt((ne)=>{J((W)=>zb(ne,W)),p.setIsDirty(!0)}),xe=Tt((ne)=>{J((W)=>xb({...ne,...v},W)),p.setIsDirty(!0)}),qe=Tt((ne,W)=>{p.setSelectedNodeId(W.id),R((j)=>j.map((Ne)=>({...Ne,data:{...Ne.data,selected:Ne.id===W.id}})))}),Le=Tt(()=>{p.setSelectedNodeId(null),R((ne)=>ne.map((W)=>({...W,data:{...W.data,selected:!1}})))}),ve=Tt((ne)=>{ne.preventDefault(),ne.dataTransfer.dropEffect="move",E(!0)}),B=Tt(()=>{E(!1)}),de=Tt((ne)=>{ne.preventDefault(),E(!1);let W=ne.dataTransfer.getData("application/reactflow-nodetype");if(!W)return;let j=ce.current?.getBoundingClientRect();if(!j||!oe.current)return;let Ne=oe.current.screenToFlowPosition({x:ne.clientX-j.left,y:ne.clientY-j.top}),ze=Hb(W,Ne);R((Me)=>[...Me,ze]),p.setSelectedNodeId(ze.id),p.setIsDirty(!0)}),te=Tt((ne,W)=>{R((j)=>j.map((Ne)=>{if(Ne.id!==ne)return Ne;return{...Ne,data:{...W,selected:!0}}})),p.setIsDirty(!0)}),ye=Tt((ne)=>{R((W)=>W.filter((j)=>j.id!==ne)),J((W)=>W.filter((j)=>j.source!==ne&&j.target!==ne)),p.setSelectedNodeId(null),p.setIsDirty(!0)}),V=Tt(()=>{if(!i)return;let ne=p.selectedFlowId;if(!ne)ne=crypto.randomUUID(),p.setSelectedFlowId(ne);let W=K||`${e} Flow`;p.setIsSaving(!0);let j=oe.current?oe.current.getViewport():void 0,Ne=$b(ne,e,W,Q,O,!0,j,b,$);i.start({payload:Ne,onAfterHandle:(ze)=>{let Me=ze;if(Me.flow_id)p.setSelectedFlowId(Me.flow_id);p.setIsSaving(!1),p.setIsDirty(!1),Ue()},onErrorHandle:()=>{p.setIsSaving(!1)}})}),ee=Tt(()=>{if(!o||!p.selectedFlowId)return;o.start({payload:{flow_id:p.selectedFlowId},onAfterHandle:()=>{Ue()}})}),re=Tt(()=>{if(!s||!D)return;s.start({payload:{flow_id:D},onAfterHandle:()=>{I(null),p.setSelectedFlowId(null),M(""),N(""),R([]),J([]),T("list"),Ue()},onErrorHandle:()=>{I(null)}})}),Ke=Tt((ne)=>{p.setSelectedFlowId(ne),k?.(ne),T("designer")}),H=Tt(()=>{M(`${e} Flow`),N(""),A("create"),q(!0)}),ue=Tt(()=>{p.setSelectedFlowId(null),R([]),J([]),p.setIsDirty(!0),q(!1),T("designer")}),We=Tt(()=>{T("list"),p.setSelectedNodeId(null),Ue()}),Ue=Tt(()=>{p.setLoadingFlows(!0),n.start({payload:{entity_name:e},onAfterHandle:(ne)=>{let j=ne.data;if(j)p.setFlows(j);else p.setFlows([]);p.setLoadingFlows(!1)},onErrorHandle:()=>{p.setFlows([]),p.setLoadingFlows(!1)}})}),gt=Tt((ne)=>{p.setLoadingGraph(!0),a.start({payload:{flow_id:ne},onAfterHandle:(W)=>{let j=W,Ne=j.data?.flow;if(Ne)M(Ne.name||""),N(Ne.description||""),A(Ne.trigger_on||"create");let ze=j.data?.graph;if(ze?.steps&&ze.steps.length>0){p.setGraphData(ze);let Me=Wb(ze.steps,ze,null);R(Me),J(Ib(ze.edges,v));let gr=new Set;for(let br of Me){let Xt=br.data;if(Xt.nodeType==="verifier"&&Xt.verifierType==="user"&&Xt.verifierUserId)gr.add(Xt.verifierUserId);if(Xt.nodeType==="notification"&&Xt.recipientType==="user"&&Xt.recipientUserId)gr.add(Xt.recipientUserId)}if(gr.size>0&&d)d.start({payload:{page:1,limit:100},onAfterHandle:(br)=>{let Nr=br.data,Vr=Nr?.items||Nr?.data||[],ar=new Map;for(let Ae of Vr)if(gr.has(Ae.id))ar.set(Ae.id,Ae.email);if(ar.size>0)R((Ae)=>Ae.map((Ut)=>{let Lt=Ut.data;if(Lt.nodeType==="verifier"&&Lt.verifierUserId&&ar.has(Lt.verifierUserId))return{...Ut,data:{...Lt,verifierUserEmail:ar.get(Lt.verifierUserId)}};if(Lt.nodeType==="notification"&&Lt.recipientUserId&&ar.has(Lt.recipientUserId))return{...Ut,data:{...Lt,recipientUserEmail:ar.get(Lt.recipientUserId)}};return Ut}))}})}else R([]),J([]);p.setLoadingGraph(!1),p.setIsDirty(!1)},onErrorHandle:()=>{p.setLoadingGraph(!1)}})});v0(()=>{Ue()},[]),v0(()=>{if(p.selectedFlowId)gt(p.selectedFlowId)},[p.selectedFlowId]);let Ge=p.flows.find((ne)=>ne.id===p.selectedFlowId),Qt=p.selectedNodeId?b.find((ne)=>ne.id===p.selectedNodeId)||null:null,$t=G("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[G("title",{children:"Back"},void 0,!1,void 0,this),G("path",{d:"M19 12H5"},void 0,!1,void 0,this),G("path",{d:"m12 19-7-7 7-7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),zr={create:"On Create",update:"On Update",delete:"On Delete",manual:"Manual"};return G("div",{className:w(y.layout.root,z),children:[D&&G("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[G("button",{type:"button","aria-label":"Close",className:"absolute inset-0 cursor-default",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>I(null)},void 0,!1,void 0,this),G("div",{className:m==="light"?"relative rounded-xl border border-gray-200 bg-white p-6 w-full max-w-sm space-y-4 shadow-2xl":"relative rounded-xl border border-white/[0.08] bg-[#12121a] p-6 w-full max-w-sm space-y-4 shadow-2xl",children:[G("p",{className:m==="light"?"text-[13px] font-semibold text-gray-900":"text-[13px] font-semibold text-white/90",children:"Delete Flow"},void 0,!1,void 0,this),G("p",{className:m==="light"?"text-[12px] text-gray-500 leading-relaxed":"text-[12px] text-white/50 leading-relaxed",children:['Are you sure you want to delete "',p.flows.find((ne)=>ne.id===D)?.name||"this flow",'"? This action cannot be undone.']},void 0,!0,void 0,this),G("div",{className:"flex items-center justify-end gap-2 pt-1",children:[G("button",{type:"button",onClick:()=>I(null),className:m==="light"?"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all":"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",children:"Cancel"},void 0,!1,void 0,this),G("button",{type:"button",onClick:re,className:y.header.deleteButton,children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ie&&G("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[G("button",{type:"button","aria-label":"Close",className:"absolute inset-0 cursor-default",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>q(!1)},void 0,!1,void 0,this),G("div",{className:m==="light"?"relative rounded-xl border border-gray-200 bg-white p-6 w-full max-w-md space-y-5 shadow-2xl":"relative rounded-xl border border-white/[0.08] bg-[#12121a] p-6 w-full max-w-md space-y-5 shadow-2xl",children:[G("p",{className:m==="light"?"text-[14px] font-semibold text-gray-900":"text-[14px] font-semibold text-white/90",children:"Create New Flow"},void 0,!1,void 0,this),G("div",{className:"space-y-3",children:[G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-name",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Flow Name"},void 0,!1,void 0,this),G("input",{id:"vf-create-name",type:"text",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 placeholder:text-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 placeholder:text-white/20",placeholder:"Enter flow name...",value:K,onChange:(ne)=>M(ne.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-desc",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Description"},void 0,!1,void 0,this),G("textarea",{id:"vf-create-desc",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400 resize-none placeholder:text-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20 resize-none placeholder:text-white/20",placeholder:"Describe this verification flow...",rows:3,value:Q,onChange:(ne)=>N(ne.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1.5",children:[G("label",{htmlFor:"vf-create-trigger",className:m==="light"?"block text-[11px] font-medium text-gray-500":"block text-[11px] font-medium text-white/50",children:"Trigger On"},void 0,!1,void 0,this),G("select",{id:"vf-create-trigger",className:m==="light"?"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-[12px] text-gray-800 outline-none focus:border-gray-400":"w-full rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-[12px] text-white/80 outline-none focus:border-white/20",value:O,onChange:(ne)=>A(ne.target.value),children:[G("option",{value:"create",children:"On Create"},void 0,!1,void 0,this),G("option",{value:"update",children:"On Update"},void 0,!1,void 0,this),G("option",{value:"delete",children:"On Delete"},void 0,!1,void 0,this),G("option",{value:"manual",children:"Manual"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"flex items-center justify-end gap-2 pt-1",children:[G("button",{type:"button",onClick:()=>q(!1),className:m==="light"?"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-gray-400 hover:text-gray-600 transition-all":"rounded-lg px-3.5 py-1.5 text-[11px] font-medium text-white/40 hover:text-white/60 transition-all",children:"Cancel"},void 0,!1,void 0,this),G("button",{type:"button",onClick:ue,disabled:!K.trim(),className:K.trim()?y.header.saveButton:y.header.saveButtonDisabled,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("header",{className:y.header.container,children:[G("div",{className:"flex items-center gap-3",children:[_==="list"&&f&&G("button",{type:"button",onClick:f,className:y.header.backButton,title:"Back",children:$t},void 0,!1,void 0,this),_==="designer"&&G("button",{type:"button",onClick:We,className:y.header.backButton,title:"Back to Flows",children:$t},void 0,!1,void 0,this),G("h1",{className:y.header.title,children:Ze},void 0,!1,void 0,this),_==="list"&&G("span",{className:y.header.subtitle,children:$e},void 0,!1,void 0,this),_==="list"&&(P||x)&&G("nav",{className:y.tabs.container,children:[G("button",{type:"button",className:p.activeTab==="flow"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("flow"),children:"Flows"},void 0,!1,void 0,this),P&&G("button",{type:"button",className:p.activeTab==="pending"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("pending"),children:"Pending"},void 0,!1,void 0,this),x&&h&&G("button",{type:"button",className:p.activeTab==="statuses"?y.tabs.tabActive:y.tabs.tab,onClick:()=>p.setActiveTab("statuses"),children:"Statuses"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.header.actions,children:_==="designer"&&p.activeTab==="flow"&&G(_b,{children:[G("span",{className:"text-[11px] text-white/50 font-medium",children:K||"Untitled Flow"},void 0,!1,void 0,this),Ge?.is_draft!==void 0&&G("span",{className:w("text-[9px] font-medium px-2 py-0.5 rounded-full",Ge?.is_draft?"bg-amber-500/15 border border-amber-500/20 text-amber-400":"bg-emerald-500/15 border border-emerald-500/20 text-emerald-400"),children:Ge?.is_draft?"Draft":"Published"},void 0,!1,void 0,this),i&&G("button",{type:"button",onClick:V,disabled:p.isSaving||!p.isDirty,className:p.isDirty?y.header.saveButton:y.header.saveButtonDisabled,children:p.isSaving?"Saving...":"Save"},void 0,!1,void 0,this),o&&Ge?.is_draft&&G("button",{type:"button",onClick:ee,className:y.header.publishButton,children:"Publish"},void 0,!1,void 0,this),s&&p.selectedFlowId&&G("button",{type:"button",onClick:()=>I(p.selectedFlowId),className:y.header.deleteButton,children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_==="list"&&p.activeTab==="flow"&&G("div",{className:y.flowList.container,children:[p.isLoadingFlows&&G("div",{className:"flex items-center justify-center py-20",children:G("div",{className:y.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),!p.isLoadingFlows&&G("div",{className:y.flowList.grid,children:[i&&G("button",{type:"button",className:y.flowList.createButton,onClick:H,children:[G("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/20 group-hover:text-white/40 transition-colors mb-3","aria-hidden":"true",children:[G("title",{children:"Create"},void 0,!1,void 0,this),G("path",{d:"M12 5v14"},void 0,!1,void 0,this),G("path",{d:"M5 12h14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{className:"text-[12px] font-medium text-white/30 group-hover:text-white/50 transition-colors",children:"Create New Flow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.flows.map((ne)=>G("div",{className:y.flowList.card.container,children:[G("div",{className:y.flowList.card.header,children:[G("button",{type:"button",className:"flex-1 min-w-0 text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>Ke(ne.id),children:[G("h3",{className:y.flowList.card.name,children:ne.name},void 0,!1,void 0,this),ne.description&&G("p",{className:y.flowList.card.description,children:ne.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.flowList.card.actions,children:s&&G("button",{type:"button",className:y.flowList.card.deleteButton,onClick:()=>I(ne.id),title:"Delete flow",children:G("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[G("title",{children:"Delete"},void 0,!1,void 0,this),G("path",{d:"M3 6h18"},void 0,!1,void 0,this),G("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"},void 0,!1,void 0,this),G("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",className:"w-full text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>Ke(ne.id),children:G("div",{className:y.flowList.card.meta,children:[G("span",{className:w(y.flowList.card.badge,ne.is_draft?y.flowList.card.badgeDraft:y.flowList.card.badgePublished),children:ne.is_draft?"Draft":"Published"},void 0,!1,void 0,this),ne.trigger_on&&G("span",{className:y.flowList.card.triggerBadge,children:zr[ne.trigger_on]||ne.trigger_on},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},ne.id,!0,void 0,this)),p.flows.length===0&&!i&&G("div",{className:y.flowList.empty.container,children:[G("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",className:y.flowList.empty.icon,"aria-hidden":"true",children:[G("title",{children:"No flows"},void 0,!1,void 0,this),G("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"},void 0,!1,void 0,this),G("path",{d:"M14 2v6h6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{className:y.flowList.empty.title,children:"No verification flows"},void 0,!1,void 0,this),G("p",{className:y.flowList.empty.description,children:"No flows have been created for this entity yet."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_==="designer"&&p.activeTab==="flow"&&G("div",{className:y.layout.main,children:[G("aside",{className:y.layout.sidebar,children:G(ki,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{ref:ce,className:y.layout.canvas,role:"application",onDragOver:ve,onDragLeave:B,onDrop:de,children:[p.isLoadingGraph&&G("div",{className:y.loading.container,children:G("div",{className:y.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),U&&G("div",{className:y.canvas.dropIndicator},void 0,!1,void 0,this),G(Lb,{nodes:b,edges:$,nodeTypes:Mb,onNodesChange:Pe,onEdgesChange:fe,onConnect:xe,onNodeClick:qe,onPaneClick:Le,onInit:(ne)=>{oe.current=ne},deleteKeyCode:["Backspace","Delete"],fitView:!0,minZoom:0.2,maxZoom:3,snapToGrid:!0,snapGrid:[20,20],defaultEdgeOptions:v,proOptions:{hideAttribution:!0},className:y.canvas.background,children:[G(Sb,{color:m==="dark"?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.05)",gap:24,size:1},void 0,!1,void 0,this),G(Cb,{showInteractive:!1,position:"bottom-right",className:m==="dark"?"!bg-white/[0.04] !border-white/[0.06] !rounded-lg [&>button]:!bg-transparent [&>button]:!border-white/[0.06] [&>button]:!text-white/40 [&>button:hover]:!bg-white/[0.06]":"!bg-white !border-gray-200 !rounded-lg !shadow-sm [&>button]:!bg-transparent [&>button]:!border-gray-200 [&>button]:!text-gray-400 [&>button:hover]:!bg-gray-50"},void 0,!1,void 0,this),G(Tb,{nodeColor:(ne)=>{let W=String(ne.data?.nodeType||"step");if(W==="verifier")return"#f59e0b";if(W==="notification")return"#8b5cf6";return"#3b82f6"},maskColor:m==="dark"?"rgba(0,0,0,0.7)":"rgba(255,255,255,0.7)",className:m==="dark"?"!bg-white/[0.02] !border-white/[0.06] !rounded-lg":"!bg-white/80 !border-gray-200 !rounded-lg !shadow-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ge&&!Qt&&G("div",{className:y.overlay.info,children:[G("h3",{className:y.overlay.infoTitle,children:Ge.name},void 0,!1,void 0,this),G("p",{className:y.overlay.infoDescription,children:Ge.description||"No description"},void 0,!1,void 0,this),G("div",{className:"flex gap-2 mt-2",children:G("span",{className:w(y.overlay.badge,Ge.is_draft?y.overlay.badgeDraft:y.overlay.badgePublished),children:Ge.is_draft?"Draft":"Published"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.container,children:G("div",{className:"flex items-center gap-4 text-xs",children:[G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.step},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Step"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.verifier},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Verifier"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:y.legend.item,children:[G("div",{className:y.legend.dot.notification},void 0,!1,void 0,this),G("span",{className:y.legend.label,children:"Notification"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Qt&&G("aside",{className:y.layout.propertiesPanel,children:G(Si,{nodeId:Qt.id,nodeData:Qt.data,onUpdateNode:te,onDeleteNode:ye,onClose:()=>{p.setSelectedNodeId(null),Le()},listUsersAction:d,listRolesAction:g,panelTheme:y.propertiesPanel},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.activeTab==="pending"&&P&&G("div",{className:"flex-1 overflow-auto p-6",children:G(vi,{pendingAction:l,decideAction:c,onDecisionMade:u},void 0,!1,void 0,this)},void 0,!1,void 0,this),p.activeTab==="statuses"&&x&&h&&G("div",{className:"flex-1 overflow-auto p-6",children:G(yl,{entityName:e,entityStatusesAction:h,onEntityClick:S,themeMode:m},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffectEvent as XP}from"react";import{jsxDEV as EP}from"react/jsx-dev-runtime";import{useGSAP as M0}from"@gsap/react";import R0 from"gsap";import{useEffect as qb,useEffectEvent as T0,useRef as L0,useState as Jb}from"react";import{batch as S0,createStore as C0}from"h-state";var Fb={instance:null,flow:null,verifications:[],pendingRequirements:[],currentStep:0,totalSteps:0,isCompleted:!1,isRejected:!1,isLoading:!1,isDeciding:!1,isStarting:!1,error:null,decisionReason:""},{useStore:Ci}=C0(Fb,{setInstance:(e)=>(t)=>{e.instance=t},setFlow:(e)=>(t)=>{e.flow=t},setVerifications:(e)=>(t)=>{e.verifications=t},setPendingRequirements:(e)=>(t)=>{e.pendingRequirements=t},setProgress:(e)=>(t,r)=>{e.currentStep=t,e.totalSteps=r},setCompleted:(e)=>(t)=>{e.isCompleted=t},setRejected:(e)=>(t)=>{e.isRejected=t},setLoading:(e)=>(t)=>{e.isLoading=t},setDeciding:(e)=>(t)=>{e.isDeciding=t},setStarting:(e)=>(t)=>{e.isStarting=t},setError:(e)=>(t)=>{e.error=t},setDecisionReason:(e)=>(t)=>{e.decisionReason=t},reset:(e)=>()=>{S0(()=>{e.instance=null,e.flow=null,e.verifications=[],e.pendingRequirements=[],e.currentStep=0,e.totalSteps=0,e.isCompleted=!1,e.isRejected=!1,e.isLoading=!1,e.isDeciding=!1,e.isStarting=!1,e.error=null,e.decisionReason=""})}}),Ob={items:[],isLoading:!1,decidingId:null,error:null},{useStore:Pi}=C0(Ob,{setItems:(e)=>(t)=>{e.items=t},setLoading:(e)=>(t)=>{e.isLoading=t},setDecidingId:(e)=>(t)=>{e.decidingId=t},setError:(e)=>(t)=>{e.error=t},removeItem:(e)=>(t)=>{e.items=e.items.filter((r)=>r.instance_id!==t)},reset:(e)=>()=>{S0(()=>{e.items=[],e.isLoading=!1,e.decidingId=null,e.error=null})}});var Gt={container:{base:"relative w-full",wrapper:"relative z-10 w-full"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",titleWrapper:"flex-1",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",subtitle:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",statusBadge:{base:"inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold uppercase tracking-wide",active:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",completed:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400",rejected:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",none:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"}},progress:{container:"mb-6",bar:"h-2 w-full bg-zinc-200 dark:bg-zinc-700 rounded-full overflow-hidden",barFill:"h-full bg-blue-500 rounded-full transition-all duration-500 ease-out",barFillCompleted:"h-full bg-emerald-500 rounded-full transition-all duration-500 ease-out",barFillRejected:"h-full bg-red-500 rounded-full transition-all duration-500 ease-out",label:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400 mt-2",stepIndicator:"font-medium text-zinc-700 dark:text-zinc-300"},requirements:{container:"space-y-2 mb-6",title:"text-sm font-semibold text-zinc-700 dark:text-zinc-300 mb-3",item:{base:"flex items-center justify-between p-3 rounded-lg text-sm transition-colors",pending:"bg-amber-50 border border-amber-200 dark:bg-amber-900/10 dark:border-amber-800/50",approved:"bg-emerald-50 border border-emerald-200 dark:bg-emerald-900/10 dark:border-emerald-800/50",rejected:"bg-red-50 border border-red-200 dark:bg-red-900/10 dark:border-red-800/50"},verifierLabel:"text-zinc-700 dark:text-zinc-300 font-medium",signatureBadge:"text-xs px-2 py-0.5 rounded bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400"},actions:{container:"flex flex-col sm:flex-row gap-3 mb-6",approveButton:"flex-1 px-4 py-2.5 rounded-xl bg-emerald-600 text-white font-medium text-sm hover:bg-emerald-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",rejectButton:"flex-1 px-4 py-2.5 rounded-xl bg-red-600 text-white font-medium text-sm hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",startButton:"px-6 py-2.5 rounded-xl bg-blue-600 text-white font-medium text-sm hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",reasonInput:"w-full px-4 py-2.5 rounded-xl border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white text-sm placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent mb-3"},history:{container:"space-y-3",title:"text-sm font-semibold text-zinc-700 dark:text-zinc-300 mb-3",item:{base:"flex items-start gap-3 p-3 rounded-lg text-sm",approved:"bg-emerald-50/50 dark:bg-emerald-900/5",rejected:"bg-red-50/50 dark:bg-red-900/5",pending:"bg-zinc-50 dark:bg-zinc-800/30"},decision:"font-medium text-zinc-900 dark:text-white",reason:"text-zinc-500 dark:text-zinc-400 text-xs mt-1",timestamp:"text-zinc-400 dark:text-zinc-500 text-xs whitespace-nowrap"},pendingList:{container:"space-y-3",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-1",subtitle:"text-sm text-zinc-600 dark:text-zinc-400 mb-6",item:{base:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl border border-zinc-200 dark:border-zinc-700/50 bg-white dark:bg-zinc-800/60 hover:shadow-md transition-shadow",entityName:"text-xs font-mono px-2 py-0.5 rounded bg-zinc-100 dark:bg-zinc-700 text-zinc-600 dark:text-zinc-400",flowName:"font-medium text-zinc-900 dark:text-white",stepInfo:"text-sm text-zinc-500 dark:text-zinc-400",timestamp:"text-xs text-zinc-400 dark:text-zinc-500"},actions:"flex gap-2 flex-shrink-0",empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"}},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 mb-4",text:"text-sm text-red-600 dark:text-red-400"}};function P0(e){return{...Gt,...e,container:{...Gt.container,...e.container},card:{...Gt.card,...e.card},header:{...Gt.header,...e.header},progress:{...Gt.progress,...e.progress},requirements:{...Gt.requirements,...e.requirements},actions:{...Gt.actions,...e.actions},history:{...Gt.history,...e.history},pendingList:{...Gt.pendingList,...e.pendingList},loading:{...Gt.loading,...e.loading},error:{...Gt.error,...e.error}}}import{jsxDEV as je}from"react/jsx-dev-runtime";R0.registerPlugin(M0);function B0({pendingAction:e,decideAction:t,title:r="Pending Verifications",subtitle:n="Items waiting for your approval",onDecisionMade:a,className:i}){let o=Gt,s=L0(null),l=L0(null),[c,d]=Jb(null),g=Pi(),h=T0(()=>{g.setLoading(!0),g.setError(null),e.start({payload:void 0,onAfterHandle:(u)=>{let S=u;if(S?.data)g.setItems(S.data);g.setLoading(!1)},onErrorHandle:(u)=>{g.setError(u instanceof Error?u.message:"Failed to load pending verifications"),g.setLoading(!1)}})}),k=T0((u,S,f)=>{g.setDecidingId(u.instance_id),t.start({payload:{entity_name:u.entity_name,entity_id:u.entity_id,decision:S,reason:f},onAfterHandle:()=>{g.removeItem(u.instance_id),g.setDecidingId(null),d(null),a?.(u.entity_name,u.entity_id)},onErrorHandle:(P)=>{g.setError(P instanceof Error?P.message:"Failed to submit decision"),g.setDecidingId(null)}})});return qb(()=>{h()},[]),M0(()=>{if(!l.current)return;R0.fromTo(l.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:s}),je("div",{ref:s,className:w(o.container.base,i),children:je("div",{className:o.container.wrapper,children:je("div",{ref:l,className:w(o.card.base,o.card.padding,o.card.background,o.card.border,o.card.shadow,o.card.rounded),children:[je("h2",{className:o.pendingList.title,children:r},void 0,!1,void 0,this),je("p",{className:o.pendingList.subtitle,children:n},void 0,!1,void 0,this),g.error&&je("div",{className:o.error.container,children:je("p",{className:o.error.text,children:g.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),g.isLoading?je("div",{className:o.loading.container,children:[je("div",{className:o.loading.spinner},void 0,!1,void 0,this),je("p",{className:o.loading.text,children:"Loading pending items..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):g.items.length===0?je("div",{className:o.pendingList.empty.container,children:[je("svg",{className:o.pendingList.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[je("title",{children:"No pending verifications"},void 0,!1,void 0,this),je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),je("p",{className:o.pendingList.empty.text,children:"No pending verifications"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):je("div",{className:o.pendingList.container,children:g.items.map((u)=>je("div",{className:o.pendingList.item.base,children:[je("div",{className:"flex-1 min-w-0",children:[je("div",{className:"flex items-center gap-2 mb-1",children:[je("span",{className:o.pendingList.item.entityName,children:u.entity_name},void 0,!1,void 0,this),je("span",{className:o.pendingList.item.flowName,children:u.flow_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),je("p",{className:o.pendingList.item.stepInfo,children:["Step ",u.step_order,u.step_name&&` \u2014 ${u.step_name}`,u.require_signature&&" \u2022 Signature required"]},void 0,!0,void 0,this),je("p",{className:o.pendingList.item.timestamp,children:new Date(u.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c?.id===u.instance_id?je("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[je("input",{type:"text",placeholder:"Reason (optional)",value:c.reason,onChange:(S)=>d({...c,reason:S.target.value}),className:"px-3 py-1.5 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-sm text-zinc-900 dark:text-white w-48"},void 0,!1,void 0,this),je("div",{className:"flex gap-2",children:[je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-emerald-600 text-white text-xs font-medium hover:bg-emerald-700 disabled:opacity-50",disabled:g.decidingId===u.instance_id,onClick:()=>k(u,c.decision,c.reason),children:g.decidingId===u.instance_id?"...":"Confirm"},void 0,!1,void 0,this),je("button",{type:"button",className:"px-3 py-1.5 rounded-lg border border-zinc-300 dark:border-zinc-600 text-zinc-700 dark:text-zinc-300 text-xs font-medium hover:bg-zinc-50 dark:hover:bg-zinc-800",onClick:()=>d(null),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):je("div",{className:o.pendingList.actions,children:[je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-emerald-600 text-white text-xs font-medium hover:bg-emerald-700 transition-colors",onClick:()=>d({id:u.instance_id,decision:"approved",reason:""}),children:"\u2713 Approve"},void 0,!1,void 0,this),je("button",{type:"button",className:"px-3 py-1.5 rounded-lg bg-red-600 text-white text-xs font-medium hover:bg-red-700 transition-colors",onClick:()=>d({id:u.instance_id,decision:"rejected",reason:""}),children:"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},u.instance_id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as H0}from"@gsap/react";import $0 from"gsap";import{useEffect as Gb,useEffectEvent as wl,useRef as W0,useState as I0}from"react";import{jsxDEV as Te,Fragment as Ab}from"react/jsx-dev-runtime";$0.registerPlugin(H0);function _0({variant:e="default",entityName:t,entityId:r,title:n="Verification",subtitle:a,statusAction:i,decideAction:o,startAction:s,flowId:l,showHistory:c=!0,showProgress:d=!0,allowStart:g=!1,onDecisionMade:h,onFlowStarted:k,onFlowCompleted:u,className:S}){let f=Gt,P=W0(null),x=W0(null),[z,m]=I0(!1),[y,v]=I0(null),p=Ci(),b=wl(()=>{p.setLoading(!0),p.setError(null),i.start({payload:{entity_name:t,entity_id:r},onAfterHandle:(M)=>{let Q=M;if(Q?.data)p.setInstance(Q.data.instance),p.setFlow(Q.data.flow),p.setVerifications(Q.data.verifications),p.setPendingRequirements(Q.data.pending_requirements),p.setProgress(Q.data.current_step,Q.data.total_steps),p.setCompleted(Q.data.is_completed),p.setRejected(Q.data.is_rejected);p.setLoading(!1)},onErrorHandle:(M)=>{p.setError(M instanceof Error?M.message:"Failed to load verification status"),p.setLoading(!1)}})}),R=wl((M)=>{p.setDeciding(!0),p.setError(null),o.start({payload:{entity_name:t,entity_id:r,decision:M,reason:p.decisionReason||void 0},onAfterHandle:(Q)=>{let N=Q;if(p.setDeciding(!1),p.setDecisionReason(""),m(!1),v(null),N?.flow_completed)u?.();h?.(M),b()},onErrorHandle:(Q)=>{p.setError(Q instanceof Error?Q.message:"Failed to submit decision"),p.setDeciding(!1)}})}),$=wl(()=>{if(!s||!l)return;p.setStarting(!0),p.setError(null),s.start({payload:{flow_id:l,entity_name:t,entity_id:r},onAfterHandle:(M)=>{let Q=M;if(p.setStarting(!1),Q?.instance_id)k?.(Q.instance_id);b()},onErrorHandle:(M)=>{p.setError(M instanceof Error?M.message:"Failed to start verification flow"),p.setStarting(!1)}})});Gb(()=>{b()},[t,r]),H0(()=>{if(!x.current)return;$0.fromTo(x.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.5,ease:"power3.out"})},{scope:P});let J=()=>{if(p.isCompleted)return{label:"Completed",style:f.header.statusBadge.completed};if(p.isRejected)return{label:"Rejected",style:f.header.statusBadge.rejected};if(p.instance)return{label:"In Progress",style:f.header.statusBadge.active};return{label:"No Flow",style:f.header.statusBadge.none}},U=p.totalSteps>0?Math.round(p.currentStep/p.totalSteps*100):0,E=p.pendingRequirements.some((M)=>M.status==="pending"),K=J();return Te("div",{ref:P,className:w(f.container.base,S),children:Te("div",{className:f.container.wrapper,children:Te("div",{ref:x,className:w(f.card.base,f.card.padding,f.card.background,f.card.border,f.card.shadow,f.card.rounded),children:[Te("div",{className:f.header.container,children:[Te("div",{className:f.header.titleWrapper,children:[Te("h2",{className:f.header.title,children:[n,p.flow&&Te("span",{className:"text-sm font-normal text-zinc-500 dark:text-zinc-400 ml-2",children:["\u2014 ",p.flow.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a&&Te("p",{className:f.header.subtitle,children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:w(f.header.statusBadge.base,K.style),children:K.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.error&&Te("div",{className:f.error.container,children:Te("p",{className:f.error.text,children:p.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),p.isLoading?Te("div",{className:f.loading.container,children:[Te("div",{className:f.loading.spinner},void 0,!1,void 0,this),Te("p",{className:f.loading.text,children:"Loading verification status..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Te(Ab,{children:[d&&p.totalSteps>0&&Te("div",{className:f.progress.container,children:[Te("div",{className:f.progress.bar,children:Te("div",{className:w(p.isCompleted?f.progress.barFillCompleted:p.isRejected?f.progress.barFillRejected:f.progress.barFill),style:{width:`${U}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Te("div",{className:f.progress.label,children:[Te("span",{className:f.progress.stepIndicator,children:["Step ",p.currentStep," of ",p.totalSteps]},void 0,!0,void 0,this),Te("span",{children:[U,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),p.pendingRequirements.length>0&&Te("div",{className:f.requirements.container,children:[Te("h3",{className:f.requirements.title,children:["Pending Verifiers (",p.pendingRequirements.filter((M)=>M.status==="pending").length,")"]},void 0,!0,void 0,this),p.pendingRequirements.map((M)=>Te("div",{className:w(f.requirements.item.base,M.status==="approved"?f.requirements.item.approved:M.status==="rejected"?f.requirements.item.rejected:f.requirements.item.pending),children:[Te("div",{className:"flex items-center gap-2",children:[Te("span",{className:f.requirements.verifierLabel,children:M.verifier_type==="user"?`User: ${M.verifier_user_id?.slice(0,8)}...`:`Role: ${M.verifier_role}`},void 0,!1,void 0,this),M.require_signature&&Te("span",{className:f.requirements.signatureBadge,children:"Signature Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:w("text-xs font-medium uppercase",M.status==="approved"&&"text-emerald-600 dark:text-emerald-400",M.status==="rejected"&&"text-red-600 dark:text-red-400",M.status==="pending"&&"text-amber-600 dark:text-amber-400"),children:M.status},void 0,!1,void 0,this)]},M.id,!0,void 0,this))]},void 0,!0,void 0,this),E&&!p.isCompleted&&!p.isRejected&&Te("div",{children:[z&&Te("input",{type:"text",placeholder:"Reason for your decision (optional)",value:p.decisionReason,onChange:(M)=>p.setDecisionReason(M.target.value),className:f.actions.reasonInput},void 0,!1,void 0,this),Te("div",{className:f.actions.container,children:[Te("button",{type:"button",className:f.actions.approveButton,disabled:p.isDeciding,onClick:()=>{if(!z)m(!0),v("approved");else if(y==="approved")R("approved");else v("approved")},children:p.isDeciding&&y==="approved"?"Submitting...":y==="approved"&&z?"Confirm Approve":"\u2713 Approve"},void 0,!1,void 0,this),Te("button",{type:"button",className:f.actions.rejectButton,disabled:p.isDeciding,onClick:()=>{if(!z)m(!0),v("rejected");else if(y==="rejected")R("rejected");else v("rejected")},children:p.isDeciding&&y==="rejected"?"Submitting...":y==="rejected"&&z?"Confirm Reject":"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),g&&!p.instance&&s&&l&&Te("div",{className:"mb-6",children:Te("button",{type:"button",className:f.actions.startButton,disabled:p.isStarting,onClick:$,children:p.isStarting?"Starting...":"Start Verification Flow"},void 0,!1,void 0,this)},void 0,!1,void 0,this),c&&p.verifications.length>0&&Te("div",{className:f.history.container,children:[Te("h3",{className:f.history.title,children:"History"},void 0,!1,void 0,this),p.verifications.map((M)=>Te("div",{className:w(f.history.item.base,M.decision==="approved"?f.history.item.approved:M.decision==="rejected"?f.history.item.rejected:f.history.item.pending),children:[Te("div",{className:"flex-1",children:[Te("p",{className:f.history.decision,children:[Te("span",{className:w("inline-block w-2 h-2 rounded-full mr-2",M.decision==="approved"&&"bg-emerald-500",M.decision==="rejected"&&"bg-red-500",M.decision==="pending"&&"bg-amber-500")},void 0,!1,void 0,this),"Step ",M.step_order," \u2014 ",M.decision]},void 0,!0,void 0,this),M.reason&&Te("p",{className:f.history.reason,children:['"',M.reason,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Te("span",{className:f.history.timestamp,children:new Date(M.created_at).toLocaleString()},void 0,!1,void 0,this)]},M.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as O0}from"@gsap/react";import q0 from"gsap";import{useEffect as vl,useEffectEvent as Li,useRef as xl}from"react";import{batch as Yb,createStore as Kb}from"h-state";var Zb={step:"verifying",message:"Verifying your email...",email:"",cooldown:0,resendStatus:"idle",resendMessage:""},{useStore:Ti}=Kb(Zb,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},setEmail:(e)=>(t)=>{e.email=t},setCooldown:(e)=>(t)=>{e.cooldown=t},decrementCooldown:(e)=>()=>{if(e.cooldown>0)e.cooldown=e.cooldown-1},setResendStatus:(e)=>(t)=>{e.resendStatus=t},setResendMessage:(e)=>(t)=>{e.resendMessage=t},reset:(e)=>()=>{Yb(()=>{e.step="verifying",e.message="Verifying your email...",e.email="",e.cooldown=0,e.resendStatus="idle",e.resendMessage=""})}});var kl={container:{base:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-zinc-50 to-zinc-100 dark:from-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center"},states:{verifying:{spinner:"w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mb-6",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-green-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4",redirectText:"text-sm text-zinc-500 dark:text-zinc-500"},error:{iconWrapper:"w-16 h-16 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-red-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4"}},resendForm:{wrapper:"w-full mt-4 p-4 bg-zinc-50 dark:bg-zinc-800/50 rounded-xl",label:"text-sm text-zinc-600 dark:text-zinc-400 mb-3",input:"w-full px-4 py-2 mb-3 border border-zinc-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",buttonContent:"flex items-center justify-center gap-2",buttonSpinner:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin",messageSuccess:"mt-2 text-sm text-green-600 dark:text-green-400",messageError:"mt-2 text-sm text-red-600 dark:text-red-400"},backButton:"mt-4 px-6 py-2 text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white transition-colors"};import{jsxDEV as lt,Fragment as zl}from"react/jsx-dev-runtime";q0.registerPlugin(O0);function F0(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function J0({token:e,email:t="",verifyEmailAction:r,resendVerificationAction:n,onSuccess:a,onBackToLogin:i,backToLoginHref:o,showResendForm:s=!0,redirectDelay:l=3000,className:c}){let d=kl,g=xl(null),h=xl(null),k=xl(!1),u=Ti(),S=Li((m)=>{if(m)u.setEmail(m)}),f=Li((m)=>{if(!m){u.setStep("error"),u.setMessage("Invalid verification link. No token provided.");return}if(k.current)return;k.current=!0,r.start({payload:{token:m},onAfterHandle:(y)=>{if(!y){u.setStep("error"),u.setMessage("Verification failed. Please try again.");return}if(y.success)u.setStep("success"),u.setMessage(y.message||"Email verified successfully!"),setTimeout(()=>{if(a)a();else if(i)i()},l);else u.setStep("error"),u.setMessage(y.message||"Verification failed. Please try again.")},onErrorHandle:(y)=>{u.setStep("error"),u.setMessage(F0(y,"Verification failed. Please try again."))}})}),P=Li(()=>{u.decrementCooldown()});vl(()=>{S(t)},[t]),vl(()=>{if(e)f(e);else u.setStep("error"),u.setMessage("Invalid verification link. No token provided.");return()=>{u.reset()}},[e]),vl(()=>{if(u.cooldown<=0)return;let m=setInterval(P,1000);return()=>clearInterval(m)},[u.cooldown]),O0(()=>{if(!h.current)return;q0.fromTo(h.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:g});let x=Li(()=>{if(!u.email||u.cooldown>0||u.resendStatus==="loading"||!n)return;u.setResendStatus("loading"),u.setResendMessage(""),n.start({payload:{email:u.email},onAfterHandle:(m)=>{if(!m){u.setResendStatus("error"),u.setResendMessage("Failed to resend verification email.");return}if(m.success){if(u.setResendStatus("success"),u.setResendMessage(m.message||"Verification email sent!"),m.data?.cooldownSeconds)u.setCooldown(m.data.cooldownSeconds)}else if(u.setResendStatus("error"),u.setResendMessage(m.message||"Failed to resend."),m.data?.cooldownRemaining)u.setCooldown(m.data.cooldownRemaining)},onErrorHandle:(m)=>{u.setResendStatus("error"),u.setResendMessage(F0(m,"Failed to resend verification email."))}})}),z=()=>{if(i)i();else if(o)window.location.href=o};return lt("main",{ref:g,className:w(d.container.base,c),children:lt("article",{ref:h,className:w(d.card.base,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:lt("div",{className:d.content.wrapper,children:[u.step==="verifying"&&lt(zl,{children:[lt("div",{className:d.states.verifying.spinner},void 0,!1,void 0,this),lt("h1",{className:d.states.verifying.title,children:"Verifying Email"},void 0,!1,void 0,this),lt("p",{className:d.states.verifying.subtitle,children:u.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="success"&&lt(zl,{children:[lt("div",{className:d.states.success.iconWrapper,children:lt("svg",{className:d.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:lt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),lt("h1",{className:d.states.success.title,children:"Email Verified!"},void 0,!1,void 0,this),lt("p",{className:d.states.success.subtitle,children:u.message},void 0,!1,void 0,this),lt("p",{className:d.states.success.redirectText,children:"Redirecting to login..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.step==="error"&&lt(zl,{children:[lt("div",{className:d.states.error.iconWrapper,children:lt("svg",{className:d.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:lt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),lt("h1",{className:d.states.error.title,children:"Verification Failed"},void 0,!1,void 0,this),lt("p",{className:d.states.error.subtitle,children:u.message},void 0,!1,void 0,this),s&&n&&lt("div",{className:d.resendForm.wrapper,children:[lt("p",{className:d.resendForm.label,children:"Request a new verification email:"},void 0,!1,void 0,this),lt("input",{type:"email",value:u.email,onChange:(m)=>u.setEmail(m.target.value),placeholder:"Enter your email",className:d.resendForm.input},void 0,!1,void 0,this),lt("button",{type:"button",onClick:x,disabled:!u.email||u.cooldown>0||u.resendStatus==="loading",className:d.resendForm.button,children:u.resendStatus==="loading"?lt("span",{className:d.resendForm.buttonContent,children:[lt("span",{className:d.resendForm.buttonSpinner},void 0,!1,void 0,this),"Sending..."]},void 0,!0,void 0,this):u.cooldown>0?`Resend in ${u.cooldown}s`:"Resend Verification Email"},void 0,!1,void 0,this),u.resendMessage&&lt("p",{className:u.resendStatus==="success"?d.resendForm.messageSuccess:d.resendForm.messageError,children:u.resendMessage},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(i||o)&&lt("button",{type:"button",onClick:z,className:d.backButton,children:"Go to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{Gt as verificationPanelTheme,ht as verificationFlowPageTheme,Ti as useVerifyEmailStore,Ci as useVerificationPanelStore,Hn as useVerificationFlowStore,bi as useUsersStore,In as useSetPasswordStore,ui as useResetPasswordStore,ci as useRegisterStore,li as useProfileStore,Pi as usePendingVerificationsStore,Zo as useNucleusEntity,ja as useNotificationCenterStore,Ea as useMagicLinkVerifyStore,Ln as useLoginStore,Za as useForgotPasswordStore,Ya as useDevicesStore,kr as useDesignSystemStore,ka as useChangePasswordStore,ga as useAuthorizationStore,$a as tooltipTheme,Mn as toUpperSnakeCase,Ao as singularize,Qo as shouldExcludeFromForm,ti as shouldExcludeColumn,Kt as notificationCenterTheme,Da as magicLinkVerifyPageTheme,aa as isReferenceColumn,Xo as isJsonColumn,ri as isArrayColumn,im as getDefaultValue,ni as getColumnType,tm as generateGetByIdEndpointKey,Yo as generateEntityEndpointKey,rm as generateDistinctEndpointKey,Ko as generateBulkEndpointKey,rr as formatLabel,P0 as extendVerificationPanelTheme,p0 as extendVerificationFlowPageTheme,kc as extendNotificationCenterTheme,Cd as extendDesignSystemTheme,Vl as extendAuthorizationPageTheme,It as designSystemTheme,Ho as createDefaultRegistry,w as cn,Fn as captchaTheme,vt as authorizationPageTheme,J0 as VerifyEmailPage,yi as VerifierFlowNode,_0 as VerificationPanel,N0 as VerificationFlowPage,d0 as UsersPage,qa as Tooltip,hi as StepFlowNode,Dc as SetPasswordPage,dr as SelectBox,Pn as SearchBox,ts as RoleList,es as RoleClaimEditor,Qc as ResetPasswordPage,Jc as RegisterPage,Cn as RangePicker,Ra as PropsPanel,Si as PropertiesPanel,$c as ProfilePage,oi as ProfileHeader,ii as PhoneCard,B0 as PendingVerifications,vi as PendingTab,di as PasswordStrengthIndicator,Ee as NucleusTextInput,bm as NucleusEntityShowcase,wi as NotificationFlowNode,Sc as NotificationCenter,vc as NotificationBell,ki as NodePalette,wc as MagicLinkVerifyPage,bc as LoginPage,lc as ForgotPasswordPage,tc as DevicesPage,Aa as DevicesHeader,Ga as DeviceCard,Md as DesignSystemPage,Sn as DatePicker,kn as DataTable,Bn as DEFAULT_PASSWORD_POLICY,Ma as ComponentSidebar,La as ComponentCanvas,jl as ClaimList,hr as Checkbox,Ls as ChangePasswordPage,fa as Captcha,se as Button,Dl as AuthorizationPage,ai as AddressCard,xt as AbstractAnimatedBackground};