@hanzo/ui 5.6.1 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/3d/carousel.js +1 -1
  2. package/dist/3d/carousel.mjs +1 -1
  3. package/dist/animation/animated-background.js +1 -1
  4. package/dist/animation/animated-background.mjs +1 -1
  5. package/dist/animation/animated-icon.js +2 -2
  6. package/dist/animation/animated-icon.mjs +2 -2
  7. package/dist/animation/animated-list.js +1 -1
  8. package/dist/animation/animated-list.mjs +1 -1
  9. package/dist/animation/animated-number.js +1 -1
  10. package/dist/animation/animated-number.mjs +1 -1
  11. package/dist/animation/index.js +2 -2
  12. package/dist/animation/index.mjs +2 -2
  13. package/dist/auth/index.js +2 -2
  14. package/dist/auth/index.mjs +2 -2
  15. package/dist/billing/index.js +2 -2
  16. package/dist/billing/index.mjs +2 -2
  17. package/dist/drawer.js +1 -1
  18. package/dist/drawer.mjs +1 -1
  19. package/dist/models/index.js +1 -1
  20. package/dist/models/index.mjs +1 -1
  21. package/dist/navigation/hanzo-shell.js +1 -1
  22. package/dist/navigation/hanzo-shell.mjs +1 -1
  23. package/dist/navigation/index.js +2 -2
  24. package/dist/navigation/index.mjs +2 -2
  25. package/dist/primitives/drawer.d.ts +2 -2
  26. package/dist/primitives/drawer.d.ts.map +1 -1
  27. package/dist/primitives/form.d.ts +1 -1
  28. package/dist/primitives/form.d.ts.map +1 -1
  29. package/dist/src/auth/AuthGuard.d.ts.map +1 -1
  30. package/dist/src/auth/AuthGuard.js +3 -7
  31. package/dist/src/auth/IAMLoginButton.d.ts +10 -3
  32. package/dist/src/auth/IAMLoginButton.d.ts.map +1 -1
  33. package/dist/src/auth/IAMLoginButton.js +14 -19
  34. package/dist/src/auth/PasswordForm.d.ts +22 -0
  35. package/dist/src/auth/PasswordForm.d.ts.map +1 -0
  36. package/dist/src/auth/PasswordForm.js +28 -0
  37. package/dist/src/auth/SignIn.d.ts +37 -0
  38. package/dist/src/auth/SignIn.d.ts.map +1 -0
  39. package/dist/src/auth/SignIn.js +26 -0
  40. package/dist/src/auth/SocialButton.d.ts +27 -0
  41. package/dist/src/auth/SocialButton.d.ts.map +1 -0
  42. package/dist/src/auth/SocialButton.js +37 -0
  43. package/dist/src/auth/Web3Connect.d.ts +9 -0
  44. package/dist/src/auth/Web3Connect.d.ts.map +1 -0
  45. package/dist/src/auth/Web3Connect.js +11 -0
  46. package/dist/src/auth/iam.d.ts +56 -0
  47. package/dist/src/auth/iam.d.ts.map +1 -0
  48. package/dist/src/auth/iam.js +78 -0
  49. package/dist/src/auth/index.d.ts +11 -0
  50. package/dist/src/auth/index.d.ts.map +1 -1
  51. package/dist/src/auth/index.js +9 -0
  52. package/dist/src/auth/types.d.ts +43 -0
  53. package/dist/src/auth/types.d.ts.map +1 -0
  54. package/dist/src/auth/types.js +8 -0
  55. package/dist/src/billing/components/payment-manager.d.ts.map +1 -1
  56. package/dist/src/billing/components/payment-manager.js +13 -1
  57. package/dist/src/form/form.d.ts +4 -2
  58. package/dist/src/form/form.d.ts.map +1 -1
  59. package/dist/src/models/ModelCard.js +2 -2
  60. package/dist/src/navigation/hanzo-shell/AppSwitcher.js +1 -1
  61. package/dist/src/navigation/hanzo-shell/types.d.ts +1 -0
  62. package/dist/src/navigation/hanzo-shell/types.d.ts.map +1 -1
  63. package/dist/src/navigation/hanzo-shell/types.js +11 -0
  64. package/dist/src/navigation/hanzo-shell/useHanzoAuth.js +2 -2
  65. package/dist/util/index.mjs +1 -1
  66. package/package.json +7 -15
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import*as T from'react';import {useMemo,useState,useEffect,useCallback,useRef}from'react';import {motion,AnimatePresence,Reorder,useMotionValue as useMotionValue$1,useTransform as useTransform$1,useSpring}from'motion/react';import {cn as cn$1}from'@/lib/utils';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {cn}from'@hanzo/ui/lib/utils';import {Avatar,AvatarImage,AvatarFallback}from'@hanzo/ui/primitives/avatar';import {Card,CardContent,Button}from'@hanzo/ui';import {AnimatePresence as AnimatePresence$1,motion as motion$1,useMotionValue,useTransform}from'framer-motion';import {ChevronLeft,ChevronRight}from'lucide-react';var Se=Object.defineProperty;var i=(e,n)=>Se(e,"name",{value:n,configurable:true});function $e(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=i(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}i($e,"usePrefersReducedMotion");function Be({colors:e,speed:n,intensity:a,paused:o}){let s=e.length>=2?e:["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4"];return jsx(motion.div,{className:"absolute inset-0",style:{background:`linear-gradient(-45deg, ${s.join(", ")})`,backgroundSize:"400% 400%"},animate:o?{}:{x:["0%","100%","0%"]},transition:{duration:10/n,repeat:1/0,ease:"linear"}})}i(Be,"GradientBackground");function De({colors:e,speed:n,elementCount:a,intensity:o,paused:s}){let r=useMemo(()=>Array.from({length:a},(t,l)=>({id:l,color:e[l%e.length],size:Math.random()*200+100,x:Math.random()*100,y:Math.random()*100,duration:(Math.random()*10+10)/n})),[a,e,n]);return jsx("div",{className:"absolute inset-0 overflow-hidden",children:r.map(t=>jsx(motion.div,{className:"absolute rounded-full",style:{background:`radial-gradient(circle, ${t.color}40, transparent)`,width:t.size*o,height:t.size*o,filter:"blur(40px)"},initial:{x:`${t.x}%`,y:`${t.y}%`},animate:s?{}:{x:[`${t.x}%`,`${(t.x+50)%100}%`,`${t.x}%`],y:[`${t.y}%`,`${(t.y+30)%100}%`,`${t.y}%`],scale:[1,1.2,1]},transition:{duration:t.duration,repeat:1/0,ease:"easeInOut"}},t.id))})}i(De,"BlobBackground");function He({colors:e,speed:n,intensity:a,paused:o}){let s=e[0]||"#4ecdc4";return jsx("div",{className:"absolute inset-0 overflow-hidden",children:[0,1,2].map(r=>jsx(motion.div,{className:"absolute inset-0",style:{background:`radial-gradient(ellipse 100% 50% at center ${50+r*20}%, ${s}${Math.round(30*a).toString(16).padStart(2,"0")}, transparent)`},animate:o?{}:{y:[r*10,r*10+20*a,r*10]},transition:{duration:(3+r)/n,repeat:1/0,ease:"easeInOut"}},r))})}i(He,"WaveBackground");function Fe({colors:e,speed:n,intensity:a,paused:o}){let s=e.length>=4?e.slice(0,4):["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4"];return jsx("div",{className:"absolute inset-0 overflow-hidden",children:s.map((r,t)=>jsx(motion.div,{className:"absolute rounded-full",style:{background:`radial-gradient(circle, ${r}60, transparent)`,width:`${60+t*20}%`,height:`${60+t*20}%`,filter:"blur(60px)",mixBlendMode:"multiply"},initial:{x:`${25+t*15}%`,y:`${25+t*15}%`},animate:o?{}:{x:[`${25+t*15}%`,`${35+t*15}%`,`${25+t*15}%`],y:[`${25+t*15}%`,`${15+t*15}%`,`${25+t*15}%`],rotate:[0,180,360]},transition:{duration:(8+t*2)/n,repeat:1/0,ease:"easeInOut"}},t))})}i(Fe,"MeshBackground");function ze({layers:e,speed:n,paused:a}){let o=useMotionValue$1(0),s=useMotionValue$1(0);return useEffect(()=>{let r=i(t=>{let{clientX:l,clientY:d}=t,{innerWidth:c,innerHeight:y}=window;o.set((l/c-.5)*100),s.set((d/y-.5)*100);},"handleMouseMove");return window.addEventListener("mousemove",r),()=>window.removeEventListener("mousemove",r)},[o,s]),jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.map((r,t)=>{let l=useTransform$1(o,[-50,50],[-r.speed*10,r.speed*10]),d=useTransform$1(s,[-50,50],[-r.speed*10,r.speed*10]);return jsx(motion.div,{className:"absolute inset-0",style:{background:`radial-gradient(circle, ${r.color}, transparent)`,opacity:r.opacity,x:a?0:l,y:a?0:d}},t)})})}i(ze,"ParallaxBackground");function Ge({colors:e,speed:n,elementCount:a,intensity:o,paused:s}){let r=useMemo(()=>Array.from({length:a},(t,l)=>({id:l,color:e[l%e.length],size:Math.random()*4+2,x:Math.random()*100,y:Math.random()*100,duration:(Math.random()*20+20)/n,delay:Math.random()*5})),[a,e,n]);return jsx("div",{className:"absolute inset-0 overflow-hidden",children:r.map(t=>jsx(motion.div,{className:"absolute rounded-full",style:{backgroundColor:t.color,width:t.size*o,height:t.size*o,opacity:.6},initial:{x:`${t.x}%`,y:`${t.y}%`},animate:s?{}:{y:[`${t.y}%`,`${t.y-100}%`],opacity:[0,.6,0]},transition:{duration:t.duration,repeat:1/0,delay:t.delay,ease:"linear"}},t.id))})}i(Ge,"ParticlesBackground");function We({animation:e="gradient",speed:n=1,colors:a=["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4","#ffeaa7"],paused:o=false,className:s,style:r,children:t,intensity:l=1,blur:d=false,blurAmount:c=20,opacity:y=1,elementCount:k=5,width:g="100%",height:f="100%",fullscreen:M=false,parallaxLayers:v=[{speed:.5,color:"#ff6b6b50",opacity:.3},{speed:1,color:"#4ecdc450",opacity:.4},{speed:1.5,color:"#45b7d150",opacity:.3}]}){let A=$e(),h=o||A,b=useMemo(()=>({width:M?"100vw":g,height:M?"100vh":f,opacity:y,filter:d?`blur(${c}px)`:void 0,...r}),[M,g,f,y,d,c,r]),R=i(()=>{let x={colors:a,speed:n,intensity:l,paused:h};switch(e){case "blob":return jsx(De,{...x,elementCount:k});case "wave":return jsx(He,{...x});case "mesh":return jsx(Fe,{...x});case "parallax":return jsx(ze,{layers:v,speed:n,paused:h});case "particles":return jsx(Ge,{...x,elementCount:k});default:return jsx(Be,{...x})}},"renderAnimation");return jsxs("div",{className:cn$1("relative overflow-hidden",M&&"fixed inset-0 z-0",s),style:b,children:[R(),t&&jsx("div",{className:"relative z-10 h-full w-full",children:t})]})}i(We,"AnimatedBackground");var be=T.forwardRef(({className:e,duration:n=3,delay:a=0,pathColor:o="gray",pathWidth:s=2,gradientStartColor:r="#18CCFC",gradientStopColor:t="#6344F5",containerRef:l,fromRef:d,toRef:c,...y},k)=>{let[g,f]=T.useState("");return T.useEffect(()=>{if(!l?.current||!d?.current||!c?.current)return;let M=i(()=>{let v=l.current.getBoundingClientRect(),A=d.current.getBoundingClientRect(),h=c.current.getBoundingClientRect(),b=A.left-v.left+A.width/2,R=A.top-v.top+A.height/2,x=h.left-v.left+h.width/2,P=h.top-v.top+h.height/2,D=(b+x)/2,L=Math.min(R,P)-50;f(`M ${b} ${R} Q ${D} ${L} ${x} ${P}`);},"updatePath");return M(),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[l,d,c]),jsxs("svg",{ref:k,className:cn("pointer-events-none absolute inset-0",e),...y,children:[jsx("path",{d:g,stroke:o,strokeWidth:s,fill:"none",strokeOpacity:.2}),jsx(motion.path,{d:g,stroke:`url(#gradient-${r}-${t})`,strokeWidth:s,fill:"none",initial:{pathLength:0},animate:{pathLength:1},transition:{duration:n,delay:a,ease:"easeInOut",repeat:1/0}}),jsx("defs",{children:jsxs("linearGradient",{id:`gradient-${r}-${t}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:r}),jsx("stop",{offset:"100%",stopColor:t})]})})]})});be.displayName="AnimatedBeam";var _e=["a","button","input","textarea","select",'[role="button"]','[role="link"]','[tabindex]:not([tabindex="-1"])',".cursor-pointer",'[data-cursor="pointer"]'].join(", "),Ke=['input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]',"textarea",'[contenteditable="true"]','[data-cursor="text"]'].join(", "),Ye=['[data-cursor="grab"]',".cursor-grab"].join(", "),qe=['[data-cursor="grabbing"]',".cursor-grabbing"].join(", ");function Ze(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}i(Ze,"isTouchDevice");function Je(){let[e,n]=useState({position:{x:0,y:0},isHovering:false,isClicking:false,cursorType:"default"}),a=useCallback((r,t)=>{n(l=>({...l,position:{x:r,y:t}}));},[]),o=useCallback((r,t="default")=>{n(l=>({...l,isHovering:r,cursorType:t}));},[]),s=useCallback(r=>{n(t=>({...t,isClicking:r}));},[]);return {cursorState:e,updatePosition:a,updateHoverState:o,updateClickState:s}}i(Je,"useCursorState");function et(e,n){let[a,o]=useState([]),s=useRef([]);return useEffect(()=>{s.current.push(n),s.current.length>e&&s.current.shift(),o([...s.current]);},[n,e]),a}i(et,"useCursorTrail");function tt({isVisible:e=true,size:n=20,color:a="#000000",trailColor:o="#00000050",animationDuration:s=200,showTrail:r=true,trailLength:t=8,blendMode:l="normal",hoverScale:d=1.5,hideOnTouch:c=true,className:y,clickAnimationDuration:k=100,zIndex:g=9999}){let{cursorState:f,updatePosition:M,updateHoverState:v,updateClickState:A}=Je(),h=et(t,f.position),[b,R]=useState(false),[x,P]=useState(false);if(useEffect(()=>{R(Ze()),P(true);},[]),useEffect(()=>{if(!x||c&&b)return;let m=i(H=>{try{requestAnimationFrame(()=>{M(H.clientX,H.clientY);});}catch(O){console.warn("AnimatedCursor: Error updating position",O);}},"handleMouseMove"),w=i(H=>{try{let O=H.target;O?.closest?.(_e)?v(!0,"pointer"):O?.closest?.(Ke)?v(!0,"text"):O?.closest?.(Ye)?v(!0,"grab"):O?.closest?.(qe)?v(!0,"grabbing"):v(!1,"default");}catch(O){console.warn("AnimatedCursor: Error handling mouse over",O),v(false,"default");}},"handleMouseOver"),I=i(()=>{A(true);},"handleMouseDown"),S=i(()=>{A(false);},"handleMouseUp"),V=i(()=>{v(false,"default");},"handleMouseLeave");return document.addEventListener("mousemove",m),document.addEventListener("mouseover",w),document.addEventListener("mousedown",I),document.addEventListener("mouseup",S),document.addEventListener("mouseleave",V),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseover",w),document.removeEventListener("mousedown",I),document.removeEventListener("mouseup",S),document.removeEventListener("mouseleave",V);}},[x,c,b,M,v,A]),useEffect(()=>{if(!(!x||c&&b))try{let m=document.body.style.cursor;return document.body.style.cursor="none",()=>{try{document.body.style.cursor=m;}catch(w){console.warn("AnimatedCursor: Error restoring cursor style",w);}}}catch(m){console.warn("AnimatedCursor: Error hiding cursor",m);}},[x,c,b]),!x||!e||c&&b)return null;let D=f.isHovering?d:1,L=f.isClicking?.8:1,u=D*L,p=i(()=>{switch(f.cursorType){case "text":return "h-6 w-0.5";case "grab":case "grabbing":return "rounded-md";default:return "rounded-full"}},"getCursorShape");return jsxs("div",{className:cn("pointer-events-none fixed inset-0",y),children:[r&&h.map((m,w)=>{let I=(w+1)/h.length*.5,S=(w+1)/h.length*.8;return jsx("div",{className:"absolute",style:{left:m.x-n/2,top:m.y-n/2,width:n,height:n,backgroundColor:o,borderRadius:"50%",opacity:I,transform:`scale(${S})`,zIndex:g-w-1,mixBlendMode:l}},w)}),jsx("div",{className:cn("absolute transition-transform duration-100 ease-out",p()),style:{left:f.position.x-n/2,top:f.position.y-n/2,width:f.cursorType==="text"?2:n,height:f.cursorType==="text"?24:n,backgroundColor:a,transform:`scale(${u})`,transitionDuration:`${s}ms`,zIndex:g,mixBlendMode:l}}),f.isHovering&&f.cursorType!=="text"&&jsx("div",{className:"absolute rounded-full border-2 transition-all duration-200 ease-out",style:{left:f.position.x-n*d/2,top:f.position.y-n*d/2,width:n*d,height:n*d,borderColor:a,opacity:.3,zIndex:g-1,mixBlendMode:l}})]})}i(tt,"AnimatedCursor");function it(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=i(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}i(it,"usePrefersReducedMotion");var st={loading:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83",heart:["M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z","M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"],star:"m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2Z",hamburger:["M3 12h18M3 6h18M3 18h18","m6 6 12 12M6 18 18 6"],arrow:"M5 12l14 0m-7 -7l7 7l-7 7",check:"m9 12 2 2 4-4",x:"m18 6-12 12M6 6l12 12"},lt={spin:{animate:{rotate:360,transition:{duration:1,repeat:1/0,ease:"linear"}}},pulse:{animate:{scale:[1,1.2,1],transition:{duration:1,repeat:1/0,ease:"easeInOut"}}},bounce:{animate:{y:[0,-10,0],transition:{duration:.6,repeat:1/0,ease:"easeInOut"}}},draw:{initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1,transition:{duration:2,ease:"easeInOut"}}},hover:{whileHover:{scale:1.1,transition:{duration:.2}}}},ct={scale:{scale:1.2},rotate:{rotate:15},glow:{filter:"drop-shadow(0 0 8px currentColor)"},shake:{x:[-2,2,-2,2,0]}},ut={scale:{scale:.9},rotate:{rotate:180},ripple:{scale:[1,1.3,1]}};function dt({paths:e,duration:n,strokeWidth:a=2,autoAnimate:o,repeat:s,onComplete:r}){let[t,l]=useState(0);return useEffect(()=>{if(!o||e.length<2)return;let d=setInterval(()=>{l(c=>{let y=(c+1)%e.length;return y===0&&!s&&(clearInterval(d),r?.()),y});},n);return ()=>clearInterval(d)},[o,e.length,n,s,r]),jsx(motion.path,{d:e[t],fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round",animate:{d:e[t]},transition:{duration:n/1e3,ease:"easeInOut"}})}i(dt,"MorphingPath");function mt({path:e,duration:n,strokeWidth:a=2,progress:o,autoAnimate:s}){let r=useRef(null),[t,l]=useState(0);useEffect(()=>{if(r.current){let c=r.current.getTotalLength();l(c);}},[e]);let d=o!==void 0?t*o:t;return jsx(motion.path,{ref:r,d:e,fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round",initial:{pathLength:0},animate:s?{pathLength:1}:{pathLength:d/t},transition:{duration:n/1e3,ease:"easeInOut"},style:{strokeDasharray:t,strokeDashoffset:t-d}})}i(mt,"DrawingPath");function pt({size:e,strokeWidth:n=2}){return jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},style:{width:e,height:e},children:jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",fill:"none",children:jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeDasharray:"60 40",opacity:"0.3"})})})}i(pt,"LoadingSpinner");function ft({icon:e="loading",paths:n,animation:a="spin",size:o=24,color:s="currentColor",duration:r=1e3,autoAnimate:t=true,repeat:l=true,className:d,style:c,onAnimationComplete:y,onClick:k,interactive:g=true,hoverAnimation:f="scale",clickAnimation:M="scale",customVariants:v,viewBox:A="0 0 24 24",strokeWidth:h=2,loading:b=false,progress:R}){let[x,P]=useState(false),[D,L]=useState(false),u=it(),p=v||lt[a]||{},m=t&&!u,I=i(()=>{if(n)return Array.isArray(n)?n:[n];let C=st[e];return Array.isArray(C)?C:[C]},"getIconPaths")(),S=i(()=>{g&&(L(true),setTimeout(()=>L(false),200),k?.());},"handleClick"),V=i(()=>!g||!x?{}:ct[f]||{},"getHoverVariant"),H=i(()=>!g||!D?{}:ut[M]||{},"getClickVariant");if(b)return jsx(pt,{size:o,strokeWidth:h});let O=i(()=>a==="morph"&&I.length>1?jsx(dt,{paths:I,duration:r,strokeWidth:h,autoAnimate:m,repeat:l,onComplete:y}):a==="draw"?jsx(mt,{path:I[0],duration:r,strokeWidth:h,progress:R,autoAnimate:m}):I.map((C,$)=>jsx(motion.path,{d:C,fill:e==="heart"?"currentColor":"none",stroke:e==="heart"?"none":"currentColor",strokeWidth:h,strokeLinecap:"round",strokeLinejoin:"round"},$)),"renderIcon");return jsx(motion.div,{className:cn$1("inline-flex items-center justify-center",g&&"cursor-pointer",d),style:{width:o,height:o,color:s,...c},onClick:S,onMouseEnter:()=>P(true),onMouseLeave:()=>P(false),variants:p,animate:m?"animate":"initial",whileHover:u?{}:V(),whileTap:u?{}:H(),onAnimationComplete:y,children:jsx("svg",{width:"100%",height:"100%",viewBox:A,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx(AnimatePresence,{mode:"wait",children:O()})})})}i(ft,"AnimatedIcon");function gt(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=i(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}i(gt,"usePrefersReducedMotion");var ht={hidden:{opacity:0,x:-50},visible:i(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:50,transition:{duration:.3}}},yt={hidden:{opacity:0},visible:i(e=>({opacity:1,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,transition:{duration:.3}}},vt={hidden:{opacity:0,scale:.8},visible:i(e=>({opacity:1,scale:1,transition:{delay:e*.1,duration:.5,ease:"easeOut",type:"spring",stiffness:100}}),"visible"),exit:{opacity:0,scale:.8,transition:{duration:.3}}},xt={hidden:{opacity:0,y:50},visible:i(e=>({opacity:1,y:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,y:-50,transition:{duration:.3}}},wt={hidden:{opacity:0,y:-50},visible:i(e=>({opacity:1,y:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,y:50,transition:{duration:.3}}},At={hidden:{opacity:0,x:50},visible:i(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:-50,transition:{duration:.3}}},Ct={hidden:{opacity:0,x:-50},visible:i(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:50,transition:{duration:.3}}},kt={slide:ht,fade:yt,scale:vt,slideUp:xt,slideDown:wt,slideLeft:At,slideRight:Ct};function Mt(e,n,a,o){let[s,r]=useState(0),t=useMemo(()=>{if(!o)return e;let c=Math.floor(s/a),y=Math.min(c+Math.ceil(n/a)+1,e.length);return e.slice(c,y).map((k,g)=>({...k,virtualIndex:c+g,style:{position:"absolute",top:(c+g)*a,height:a,width:"100%"}}))},[e,s,a,n,o]),l=e.length*a,d=useCallback(c=>{r(c.currentTarget.scrollTop);},[]);return {visibleItems:t,totalHeight:l,handleScroll:d}}i(Mt,"useVirtualizedList");function Lt({items:e,animation:n="slideUp",staggerDelay:a=100,duration:o=500,reorderable:s=false,enableAddRemove:r=true,layout:t="vertical",gridColumns:l=3,className:d,itemClassName:c,style:y,onReorder:k,onItemClick:g,showHoverEffects:f=true,customVariants:M,virtualized:v=false,itemHeight:A=60,containerHeight:h=400,autoStart:b=true,onAnimationComplete:R}){let[x,P]=useState(e),[D,L]=useState(0),u=gt(),p=M||kt[n],m=!u&&b,{visibleItems:w,totalHeight:I,handleScroll:S}=Mt(e,h,A,v);useEffect(()=>{P(e);},[e]);let V=useMemo(()=>!p.visible||typeof p.visible!="function"?p:{...p,visible:i(C=>{let $=p.visible,te=$(C);return {...te,transition:{...te.transition,delay:C*(a/1e3),duration:o/1e3}}},"visible")},[p,a,o]),H=i(()=>{switch(t){case "horizontal":return "flex flex-row gap-4 overflow-x-auto";case "grid":return `grid gap-4 grid-cols-${l}`;default:return "flex flex-col gap-4"}},"getLayoutClassName"),O=i((C,$,te)=>jsx(motion.div,{custom:$,variants:V,initial:m?"hidden":"visible",animate:"visible",exit:"exit",layout:r,className:cn$1("cursor-pointer select-none",f&&"hover:scale-105 transition-transform",c),style:te,onClick:()=>g?.(C,$),whileHover:f?{scale:1.02}:void 0,whileTap:f?{scale:.98}:void 0,onAnimationComplete:()=>{$===x.length-1&&R?.();},children:C.content},C.id),"renderListItem");return s&&!v?jsx(Reorder.Group,{axis:t==="horizontal"?"x":"y",values:x,onReorder:C=>{P(C),k?.(C);},className:cn$1(H(),d),style:y,children:jsx(AnimatePresence,{mode:"popLayout",children:x.map((C,$)=>jsx(Reorder.Item,{value:C,className:cn$1("cursor-grab active:cursor-grabbing",c),whileDrag:{scale:1.05,zIndex:10},children:C.content},C.id))})}):v?jsx("div",{className:cn$1("overflow-auto",d),style:{height:h,...y},onScroll:S,children:jsx("div",{style:{height:I,position:"relative"},children:jsx(AnimatePresence,{mode:"popLayout",children:w.map((C,$)=>O(C,C.virtualIndex||$,C.style))})})}):jsx(motion.div,{className:cn$1(H(),d),style:y,initial:"hidden",animate:"visible",children:jsx(AnimatePresence,{mode:"popLayout",children:x.map((C,$)=>O(C,$))})},D)}i(Lt,"AnimatedList");function Ae(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=i(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}i(Ae,"usePrefersReducedMotion");function Tt(e,n,a,o,s,r,t,l,d,c,y,k){let[g,f]=useState(n),[M,v]=useState(false),A=useRef(null),h=Ae(),b=useSpring(n,{stiffness:y.tension||100,damping:y.friction||10,mass:y.mass||1}),[R,x]=useState(n),P=useCallback(()=>{if(h){f(e);return}if(v(true),c)b.set(e);else {let L=Date.now(),u=g,p=e-u,m=i(()=>{let w=Date.now()-L,I=Math.min(w/a,1),V=u+p*I;f(V),x(V),I<1?A.current=requestAnimationFrame(m):(v(false),A.current=null);},"animate");A.current=requestAnimationFrame(m);}},[e,g,a,c,b,h]);return useEffect(()=>()=>{A.current&&cancelAnimationFrame(A.current);},[]),useEffect(()=>{if(c){let L=b.onChange(u=>{f(u),Math.abs(u-e)<.01&&v(false);});return ()=>{L();}}},[b,c,e]),useEffect(()=>{d&&P();},[d,P]),{formattedValue:useMemo(()=>{let L=Math.round(g*Math.pow(10,o))/Math.pow(10,o);try{switch(s){case "currency":return new Intl.NumberFormat(t,{style:"currency",currency:r,minimumFractionDigits:o,maximumFractionDigits:o}).format(L);case "percent":return new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:o,maximumFractionDigits:o}).format(L/100);default:let u=new Intl.NumberFormat(t,{minimumFractionDigits:o,maximumFractionDigits:o}).format(L);return k&&k!==","&&(u=u.replace(/,/g,k)),u}}catch{return L.toFixed(o)}},[g,o,s,r,t,k]),displayValue:g,isAnimating:M,startAnimation:P}}i(Tt,"useAnimatedNumber");function St({value:e,from:n=0,duration:a=2e3,decimals:o=0,format:s="number",currency:r="USD",locale:t="en-US",easing:l="easeOut",autoStart:d=true,onComplete:c,className:y,style:k,prefix:g="",suffix:f="",useSpring:M=false,springConfig:v={},separator:A,animateOnHover:h=false,hoverValue:b}){let[R,x]=useState(false),[P,D]=useState(0),L=h&&R&&b!==void 0?b:e,{formattedValue:u,displayValue:p,isAnimating:m,startAnimation:w}=Tt(L,n,a,o,s,r,t,l,d,M,v,A);useEffect(()=>{!m&&c&&Math.abs(p-L)<.001&&c(p);},[m,p,L,c]),useEffect(()=>{h&&b!==void 0&&w();},[R,h,b,w]);let I=i(()=>{h&&x(true);},"handleMouseEnter"),S=i(()=>{h&&x(false);},"handleMouseLeave"),V=Ae();return jsxs(motion.span,{className:cn$1("inline-block tabular-nums",y),style:k,onMouseEnter:I,onMouseLeave:S,initial:{scale:1},animate:!V&&m?{scale:[1,1.05,1]}:{scale:1},transition:{duration:.3},children:[g,jsx(motion.span,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},children:u},P),f]})}i(St,"AnimatedNumber");var ke=T.forwardRef(({className:e,testimonials:n,autoPlay:a=true,duration:o=5e3,...s},r)=>{let[t,l]=T.useState(0);return T.useEffect(()=>{if(!a)return;let d=setInterval(()=>{l(c=>(c+1)%n.length);},o);return ()=>clearInterval(d)},[a,o,n.length]),jsxs("div",{ref:r,className:cn("relative min-h-[200px]",e),...s,children:[jsx(AnimatePresence,{mode:"wait",children:jsx(motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},children:jsx(Card,{children:jsx(CardContent,{className:"pt-6",children:jsxs("blockquote",{className:"space-y-4",children:[jsxs("p",{className:"text-lg italic",children:['"',n[t].content,'"']}),jsxs("footer",{className:"flex items-center gap-4",children:[jsxs(Avatar,{children:[jsx(AvatarImage,{src:n[t].avatar}),jsx(AvatarFallback,{children:n[t].author.slice(0,2).toUpperCase()})]}),jsxs("div",{children:[jsx("cite",{className:"not-italic font-medium",children:n[t].author}),n[t].role&&jsxs("p",{className:"text-sm text-muted-foreground",children:[n[t].role,n[t].company&&`, ${n[t].company}`]})]})]})]})})})},t)}),jsx("div",{className:"mt-4 flex justify-center gap-2",children:n.map((d,c)=>jsx("button",{onClick:()=>l(c),className:cn("h-2 w-2 rounded-full transition-all",c===t?"w-8 bg-primary":"bg-muted hover:bg-muted-foreground"),"aria-label":`Go to testimonial ${c+1}`},c))})]})});ke.displayName="AnimatedTestimonials";var Re=T.forwardRef(({className:e,content:n,children:a,delay:o=0,...s},r)=>{let[t,l]=T.useState(false);return jsxs("div",{ref:r,className:cn("relative inline-block",e),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),...s,children:[a,jsx(AnimatePresence$1,{children:t&&jsxs(motion$1.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.2,delay:o/1e3,ease:"easeOut"},className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 px-3 py-1.5 bg-popover text-popover-foreground text-sm rounded-md shadow-md whitespace-nowrap z-50",children:[n,jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-popover"})]})})]})});Re.displayName="AnimatedTooltip";function Zt({cards:e,autoPlay:n=false,autoPlayInterval:a=5e3,className:o,cardClassName:s,showArrows:r=true,showDots:t=true,parallaxOffset:l=50,stackOffset:d=10,stackScale:c=.95,swipeThreshold:y=50}){let[k,g]=T.useState(0),[f,M]=T.useState(n),v=T.useRef(null),A=useMotionValue(0),h=i(u=>{let p=u-k,m=Math.abs(p);if(m>2)return {display:"none",x:0,scale:1,opacity:0,zIndex:0};let I=p*d,S=Math.pow(c,m),V=Math.max(0,1-m*.3),H=e.length-m;return {display:"block",x:I,scale:S,opacity:V,zIndex:H}},"getCardStyle"),b=T.useCallback(()=>{g(u=>(u+1)%e.length);},[e.length]),R=T.useCallback(()=>{g(u=>(u-1+e.length)%e.length);},[e.length]),x=T.useCallback(u=>{g(u);},[]),P=T.useCallback((u,p)=>{let{offset:m,velocity:w}=p;(Math.abs(m.x)>y||Math.abs(w.x)>500)&&(m.x>0?R():b());},[b,R,y]);T.useEffect(()=>{if(!f)return;let u=setInterval(b,a);return ()=>clearInterval(u)},[f,b,a]);let D=T.useCallback(()=>{n&&M(false);},[n]),L=T.useCallback(()=>{n&&M(true);},[n]);return T.useEffect(()=>{let u=i(p=>{p.key==="ArrowLeft"?R():p.key==="ArrowRight"&&b();},"handleKeyDown");return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[b,R]),jsxs("div",{ref:v,className:cn("relative w-full max-w-6xl mx-auto px-4 py-8",o),onMouseEnter:D,onMouseLeave:L,children:[jsx("div",{className:"relative h-[400px] md:h-[500px] lg:h-[600px] flex items-center justify-center",children:jsx(AnimatePresence$1,{mode:"popLayout",children:e.map((u,p)=>{let m=h(p),w=p===k;return jsx(motion$1.div,{className:cn("absolute inset-0 w-full h-full",!w&&"pointer-events-none"),initial:false,animate:{x:m.x,scale:m.scale,opacity:m.opacity,zIndex:m.zIndex},transition:{type:"spring",stiffness:300,damping:30},drag:w?"x":false,dragSnapToOrigin:true,dragElastic:.2,onDragEnd:P,whileDrag:{cursor:"grabbing"},style:{x:A,display:m.display},children:jsxs(Card,{className:cn("relative w-full h-full overflow-hidden cursor-grab","bg-gradient-to-br from-white to-gray-50 dark:from-gray-900 dark:to-gray-950","shadow-2xl hover:shadow-3xl transition-shadow duration-300",s),style:{background:u.gradient},children:[u.image&&jsxs(motion$1.div,{className:"absolute inset-0 w-full h-full",style:{x:useTransform(A,[-200,0,200],[l,0,-l])},children:[jsx("img",{src:u.image,alt:u.title,className:"w-full h-full object-cover"}),jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"})]}),jsx("div",{className:"relative z-10 flex flex-col justify-end h-full p-8 md:p-12",children:u.content?u.content:jsxs(Fragment,{children:[jsx(motion$1.h3,{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white mb-2",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.1},children:u.title}),u.subtitle&&jsx(motion$1.p,{className:"text-xl md:text-2xl text-white/80 mb-4",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.2},children:u.subtitle}),u.description&&jsx(motion$1.p,{className:"text-base md:text-lg text-white/70 max-w-2xl",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.3},children:u.description})]})})]})},u.id)})})}),r&&jsxs(Fragment,{children:[jsxs(Button,{variant:"ghost",size:"icon",className:cn("absolute left-4 top-1/2 -translate-y-1/2 z-20","bg-white/10 backdrop-blur-md hover:bg-white/20","text-white border border-white/20","hidden md:flex"),onClick:R,children:[jsx(ChevronLeft,{className:"h-6 w-6"}),jsx("span",{className:"sr-only",children:"Previous card"})]}),jsxs(Button,{variant:"ghost",size:"icon",className:cn("absolute right-4 top-1/2 -translate-y-1/2 z-20","bg-white/10 backdrop-blur-md hover:bg-white/20","text-white border border-white/20","hidden md:flex"),onClick:b,children:[jsx(ChevronRight,{className:"h-6 w-6"}),jsx("span",{className:"sr-only",children:"Next card"})]})]}),t&&jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex gap-2",children:e.map((u,p)=>jsx("button",{className:cn("w-2 h-2 rounded-full transition-all duration-300","bg-white/40 hover:bg-white/60",p===k&&"w-8 bg-white"),onClick:()=>x(p),children:jsxs("span",{className:"sr-only",children:["Go to card ",p+1]})},p))})]})}i(Zt,"AppleCardsCarousel");var Jt={sunset:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",ocean:"linear-gradient(135deg, #667eea 0%, #4ca1af 100%)",fire:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",forest:"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",galaxy:"linear-gradient(135deg, #7303c0 0%, #ec38bc 50%, #fdeff9 100%)",aurora:"linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)",peach:"linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%)",lavender:"linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"};var Te=T.forwardRef(({className:e,text:n="Hello",duration:a=2,...o},s)=>{let r=n.split("");return jsx("div",{ref:s,className:cn("relative flex items-center justify-center text-6xl font-bold",e),...o,children:r.map((t,l)=>jsx(motion$1.span,{initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{duration:a,delay:l*.1,ease:[.215,.61,.355,1]},className:"inline-block",children:t},l))})});Te.displayName="AppleHelloEffect";
3
- export{We as AnimatedBackground,be as AnimatedBeam,tt as AnimatedCursor,ft as AnimatedIcon,Lt as AnimatedList,St as AnimatedNumber,ke as AnimatedTestimonials,Re as AnimatedTooltip,Zt as AppleCardsCarousel,Te as AppleHelloEffect,Jt as gradientPresets};
2
+ import*as T from'react';import {useMemo,useState,useEffect,useCallback,useRef}from'react';import {motion,AnimatePresence,Reorder,useMotionValue as useMotionValue$1,useTransform as useTransform$1,useSpring}from'motion/react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {cn}from'@hanzo/ui/lib/utils';import {Avatar,AvatarImage,AvatarFallback}from'@hanzo/ui/primitives/avatar';import {Card,CardContent,Button}from'@hanzo/ui';import {AnimatePresence as AnimatePresence$1,motion as motion$1,useMotionValue,useTransform}from'framer-motion';import {ChevronLeft,ChevronRight}from'lucide-react';var Se=Object.defineProperty;var r=(e,n)=>Se(e,"name",{value:n,configurable:true});function B(...e){return twMerge(clsx(e))}r(B,"cn");function Be(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=r(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}r(Be,"usePrefersReducedMotion");function De({colors:e,speed:n,intensity:a,paused:o}){let s=e.length>=2?e:["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4"];return jsx(motion.div,{className:"absolute inset-0",style:{background:`linear-gradient(-45deg, ${s.join(", ")})`,backgroundSize:"400% 400%"},animate:o?{}:{x:["0%","100%","0%"]},transition:{duration:10/n,repeat:1/0,ease:"linear"}})}r(De,"GradientBackground");function He({colors:e,speed:n,elementCount:a,intensity:o,paused:s}){let i=useMemo(()=>Array.from({length:a},(t,l)=>({id:l,color:e[l%e.length],size:Math.random()*200+100,x:Math.random()*100,y:Math.random()*100,duration:(Math.random()*10+10)/n})),[a,e,n]);return jsx("div",{className:"absolute inset-0 overflow-hidden",children:i.map(t=>jsx(motion.div,{className:"absolute rounded-full",style:{background:`radial-gradient(circle, ${t.color}40, transparent)`,width:t.size*o,height:t.size*o,filter:"blur(40px)"},initial:{x:`${t.x}%`,y:`${t.y}%`},animate:s?{}:{x:[`${t.x}%`,`${(t.x+50)%100}%`,`${t.x}%`],y:[`${t.y}%`,`${(t.y+30)%100}%`,`${t.y}%`],scale:[1,1.2,1]},transition:{duration:t.duration,repeat:1/0,ease:"easeInOut"}},t.id))})}r(He,"BlobBackground");function Fe({colors:e,speed:n,intensity:a,paused:o}){let s=e[0]||"#4ecdc4";return jsx("div",{className:"absolute inset-0 overflow-hidden",children:[0,1,2].map(i=>jsx(motion.div,{className:"absolute inset-0",style:{background:`radial-gradient(ellipse 100% 50% at center ${50+i*20}%, ${s}${Math.round(30*a).toString(16).padStart(2,"0")}, transparent)`},animate:o?{}:{y:[i*10,i*10+20*a,i*10]},transition:{duration:(3+i)/n,repeat:1/0,ease:"easeInOut"}},i))})}r(Fe,"WaveBackground");function ze({colors:e,speed:n,intensity:a,paused:o}){let s=e.length>=4?e.slice(0,4):["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4"];return jsx("div",{className:"absolute inset-0 overflow-hidden",children:s.map((i,t)=>jsx(motion.div,{className:"absolute rounded-full",style:{background:`radial-gradient(circle, ${i}60, transparent)`,width:`${60+t*20}%`,height:`${60+t*20}%`,filter:"blur(60px)",mixBlendMode:"multiply"},initial:{x:`${25+t*15}%`,y:`${25+t*15}%`},animate:o?{}:{x:[`${25+t*15}%`,`${35+t*15}%`,`${25+t*15}%`],y:[`${25+t*15}%`,`${15+t*15}%`,`${25+t*15}%`],rotate:[0,180,360]},transition:{duration:(8+t*2)/n,repeat:1/0,ease:"easeInOut"}},t))})}r(ze,"MeshBackground");function Ge({layers:e,speed:n,paused:a}){let o=useMotionValue$1(0),s=useMotionValue$1(0);return useEffect(()=>{let i=r(t=>{let{clientX:l,clientY:d}=t,{innerWidth:c,innerHeight:y}=window;o.set((l/c-.5)*100),s.set((d/y-.5)*100);},"handleMouseMove");return window.addEventListener("mousemove",i),()=>window.removeEventListener("mousemove",i)},[o,s]),jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.map((i,t)=>{let l=useTransform$1(o,[-50,50],[-i.speed*10,i.speed*10]),d=useTransform$1(s,[-50,50],[-i.speed*10,i.speed*10]);return jsx(motion.div,{className:"absolute inset-0",style:{background:`radial-gradient(circle, ${i.color}, transparent)`,opacity:i.opacity,x:a?0:l,y:a?0:d}},t)})})}r(Ge,"ParallaxBackground");function Ue({colors:e,speed:n,elementCount:a,intensity:o,paused:s}){let i=useMemo(()=>Array.from({length:a},(t,l)=>({id:l,color:e[l%e.length],size:Math.random()*4+2,x:Math.random()*100,y:Math.random()*100,duration:(Math.random()*20+20)/n,delay:Math.random()*5})),[a,e,n]);return jsx("div",{className:"absolute inset-0 overflow-hidden",children:i.map(t=>jsx(motion.div,{className:"absolute rounded-full",style:{backgroundColor:t.color,width:t.size*o,height:t.size*o,opacity:.6},initial:{x:`${t.x}%`,y:`${t.y}%`},animate:s?{}:{y:[`${t.y}%`,`${t.y-100}%`],opacity:[0,.6,0]},transition:{duration:t.duration,repeat:1/0,delay:t.delay,ease:"linear"}},t.id))})}r(Ue,"ParticlesBackground");function We({animation:e="gradient",speed:n=1,colors:a=["#ff6b6b","#4ecdc4","#45b7d1","#96ceb4","#ffeaa7"],paused:o=false,className:s,style:i,children:t,intensity:l=1,blur:d=false,blurAmount:c=20,opacity:y=1,elementCount:k=5,width:g="100%",height:f="100%",fullscreen:L=false,parallaxLayers:v=[{speed:.5,color:"#ff6b6b50",opacity:.3},{speed:1,color:"#4ecdc450",opacity:.4},{speed:1.5,color:"#45b7d150",opacity:.3}]}){let A=Be(),h=o||A,b=useMemo(()=>({width:L?"100vw":g,height:L?"100vh":f,opacity:y,filter:d?`blur(${c}px)`:void 0,...i}),[L,g,f,y,d,c,i]),R=r(()=>{let x={colors:a,speed:n,intensity:l,paused:h};switch(e){case "blob":return jsx(He,{...x,elementCount:k});case "wave":return jsx(Fe,{...x});case "mesh":return jsx(ze,{...x});case "parallax":return jsx(Ge,{layers:v,speed:n,paused:h});case "particles":return jsx(Ue,{...x,elementCount:k});default:return jsx(De,{...x})}},"renderAnimation");return jsxs("div",{className:B("relative overflow-hidden",L&&"fixed inset-0 z-0",s),style:b,children:[R(),t&&jsx("div",{className:"relative z-10 h-full w-full",children:t})]})}r(We,"AnimatedBackground");var be=T.forwardRef(({className:e,duration:n=3,delay:a=0,pathColor:o="gray",pathWidth:s=2,gradientStartColor:i="#18CCFC",gradientStopColor:t="#6344F5",containerRef:l,fromRef:d,toRef:c,...y},k)=>{let[g,f]=T.useState("");return T.useEffect(()=>{if(!l?.current||!d?.current||!c?.current)return;let L=r(()=>{let v=l.current.getBoundingClientRect(),A=d.current.getBoundingClientRect(),h=c.current.getBoundingClientRect(),b=A.left-v.left+A.width/2,R=A.top-v.top+A.height/2,x=h.left-v.left+h.width/2,P=h.top-v.top+h.height/2,H=(b+x)/2,M=Math.min(R,P)-50;f(`M ${b} ${R} Q ${H} ${M} ${x} ${P}`);},"updatePath");return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[l,d,c]),jsxs("svg",{ref:k,className:cn("pointer-events-none absolute inset-0",e),...y,children:[jsx("path",{d:g,stroke:o,strokeWidth:s,fill:"none",strokeOpacity:.2}),jsx(motion.path,{d:g,stroke:`url(#gradient-${i}-${t})`,strokeWidth:s,fill:"none",initial:{pathLength:0},animate:{pathLength:1},transition:{duration:n,delay:a,ease:"easeInOut",repeat:1/0}}),jsx("defs",{children:jsxs("linearGradient",{id:`gradient-${i}-${t}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx("stop",{offset:"0%",stopColor:i}),jsx("stop",{offset:"100%",stopColor:t})]})})]})});be.displayName="AnimatedBeam";var Ke=["a","button","input","textarea","select",'[role="button"]','[role="link"]','[tabindex]:not([tabindex="-1"])',".cursor-pointer",'[data-cursor="pointer"]'].join(", "),Ye=['input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]',"textarea",'[contenteditable="true"]','[data-cursor="text"]'].join(", "),qe=['[data-cursor="grab"]',".cursor-grab"].join(", "),Ze=['[data-cursor="grabbing"]',".cursor-grabbing"].join(", ");function Je(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}r(Je,"isTouchDevice");function et(){let[e,n]=useState({position:{x:0,y:0},isHovering:false,isClicking:false,cursorType:"default"}),a=useCallback((i,t)=>{n(l=>({...l,position:{x:i,y:t}}));},[]),o=useCallback((i,t="default")=>{n(l=>({...l,isHovering:i,cursorType:t}));},[]),s=useCallback(i=>{n(t=>({...t,isClicking:i}));},[]);return {cursorState:e,updatePosition:a,updateHoverState:o,updateClickState:s}}r(et,"useCursorState");function tt(e,n){let[a,o]=useState([]),s=useRef([]);return useEffect(()=>{s.current.push(n),s.current.length>e&&s.current.shift(),o([...s.current]);},[n,e]),a}r(tt,"useCursorTrail");function nt({isVisible:e=true,size:n=20,color:a="#000000",trailColor:o="#00000050",animationDuration:s=200,showTrail:i=true,trailLength:t=8,blendMode:l="normal",hoverScale:d=1.5,hideOnTouch:c=true,className:y,clickAnimationDuration:k=100,zIndex:g=9999}){let{cursorState:f,updatePosition:L,updateHoverState:v,updateClickState:A}=et(),h=tt(t,f.position),[b,R]=useState(false),[x,P]=useState(false);if(useEffect(()=>{R(Je()),P(true);},[]),useEffect(()=>{if(!x||c&&b)return;let m=r(F=>{try{requestAnimationFrame(()=>{L(F.clientX,F.clientY);});}catch(O){console.warn("AnimatedCursor: Error updating position",O);}},"handleMouseMove"),w=r(F=>{try{let O=F.target;O?.closest?.(Ke)?v(!0,"pointer"):O?.closest?.(Ye)?v(!0,"text"):O?.closest?.(qe)?v(!0,"grab"):O?.closest?.(Ze)?v(!0,"grabbing"):v(!1,"default");}catch(O){console.warn("AnimatedCursor: Error handling mouse over",O),v(false,"default");}},"handleMouseOver"),I=r(()=>{A(true);},"handleMouseDown"),S=r(()=>{A(false);},"handleMouseUp"),V=r(()=>{v(false,"default");},"handleMouseLeave");return document.addEventListener("mousemove",m),document.addEventListener("mouseover",w),document.addEventListener("mousedown",I),document.addEventListener("mouseup",S),document.addEventListener("mouseleave",V),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseover",w),document.removeEventListener("mousedown",I),document.removeEventListener("mouseup",S),document.removeEventListener("mouseleave",V);}},[x,c,b,L,v,A]),useEffect(()=>{if(!(!x||c&&b))try{let m=document.body.style.cursor;return document.body.style.cursor="none",()=>{try{document.body.style.cursor=m;}catch(w){console.warn("AnimatedCursor: Error restoring cursor style",w);}}}catch(m){console.warn("AnimatedCursor: Error hiding cursor",m);}},[x,c,b]),!x||!e||c&&b)return null;let H=f.isHovering?d:1,M=f.isClicking?.8:1,u=H*M,p=r(()=>{switch(f.cursorType){case "text":return "h-6 w-0.5";case "grab":case "grabbing":return "rounded-md";default:return "rounded-full"}},"getCursorShape");return jsxs("div",{className:cn("pointer-events-none fixed inset-0",y),children:[i&&h.map((m,w)=>{let I=(w+1)/h.length*.5,S=(w+1)/h.length*.8;return jsx("div",{className:"absolute",style:{left:m.x-n/2,top:m.y-n/2,width:n,height:n,backgroundColor:o,borderRadius:"50%",opacity:I,transform:`scale(${S})`,zIndex:g-w-1,mixBlendMode:l}},w)}),jsx("div",{className:cn("absolute transition-transform duration-100 ease-out",p()),style:{left:f.position.x-n/2,top:f.position.y-n/2,width:f.cursorType==="text"?2:n,height:f.cursorType==="text"?24:n,backgroundColor:a,transform:`scale(${u})`,transitionDuration:`${s}ms`,zIndex:g,mixBlendMode:l}}),f.isHovering&&f.cursorType!=="text"&&jsx("div",{className:"absolute rounded-full border-2 transition-all duration-200 ease-out",style:{left:f.position.x-n*d/2,top:f.position.y-n*d/2,width:n*d,height:n*d,borderColor:a,opacity:.3,zIndex:g-1,mixBlendMode:l}})]})}r(nt,"AnimatedCursor");function it(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=r(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}r(it,"usePrefersReducedMotion");var st={loading:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83",heart:["M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z","M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"],star:"m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2Z",hamburger:["M3 12h18M3 6h18M3 18h18","m6 6 12 12M6 18 18 6"],arrow:"M5 12l14 0m-7 -7l7 7l-7 7",check:"m9 12 2 2 4-4",x:"m18 6-12 12M6 6l12 12"},lt={spin:{animate:{rotate:360,transition:{duration:1,repeat:1/0,ease:"linear"}}},pulse:{animate:{scale:[1,1.2,1],transition:{duration:1,repeat:1/0,ease:"easeInOut"}}},bounce:{animate:{y:[0,-10,0],transition:{duration:.6,repeat:1/0,ease:"easeInOut"}}},draw:{initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1,transition:{duration:2,ease:"easeInOut"}}},hover:{whileHover:{scale:1.1,transition:{duration:.2}}}},ct={scale:{scale:1.2},rotate:{rotate:15},glow:{filter:"drop-shadow(0 0 8px currentColor)"},shake:{x:[-2,2,-2,2,0]}},ut={scale:{scale:.9},rotate:{rotate:180},ripple:{scale:[1,1.3,1]}};function dt({paths:e,duration:n,strokeWidth:a=2,autoAnimate:o,repeat:s,onComplete:i}){let[t,l]=useState(0);return useEffect(()=>{if(!o||e.length<2)return;let d=setInterval(()=>{l(c=>{let y=(c+1)%e.length;return y===0&&!s&&(clearInterval(d),i?.()),y});},n);return ()=>clearInterval(d)},[o,e.length,n,s,i]),jsx(motion.path,{d:e[t],fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round",animate:{d:e[t]},transition:{duration:n/1e3,ease:"easeInOut"}})}r(dt,"MorphingPath");function mt({path:e,duration:n,strokeWidth:a=2,progress:o,autoAnimate:s}){let i=useRef(null),[t,l]=useState(0);useEffect(()=>{if(i.current){let c=i.current.getTotalLength();l(c);}},[e]);let d=o!==void 0?t*o:t;return jsx(motion.path,{ref:i,d:e,fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round",initial:{pathLength:0},animate:s?{pathLength:1}:{pathLength:d/t},transition:{duration:n/1e3,ease:"easeInOut"},style:{strokeDasharray:t,strokeDashoffset:t-d}})}r(mt,"DrawingPath");function pt({size:e,strokeWidth:n=2}){return jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},style:{width:e,height:e},children:jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",fill:"none",children:jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeDasharray:"60 40",opacity:"0.3"})})})}r(pt,"LoadingSpinner");function ft({icon:e="loading",paths:n,animation:a="spin",size:o=24,color:s="currentColor",duration:i=1e3,autoAnimate:t=true,repeat:l=true,className:d,style:c,onAnimationComplete:y,onClick:k,interactive:g=true,hoverAnimation:f="scale",clickAnimation:L="scale",customVariants:v,viewBox:A="0 0 24 24",strokeWidth:h=2,loading:b=false,progress:R}){let[x,P]=useState(false),[H,M]=useState(false),u=it(),p=v||lt[a]||{},m=t&&!u,I=r(()=>{if(n)return Array.isArray(n)?n:[n];let C=st[e];return Array.isArray(C)?C:[C]},"getIconPaths")(),S=r(()=>{g&&(M(true),setTimeout(()=>M(false),200),k?.());},"handleClick"),V=r(()=>!g||!x?{}:ct[f]||{},"getHoverVariant"),F=r(()=>!g||!H?{}:ut[L]||{},"getClickVariant");if(b)return jsx(pt,{size:o,strokeWidth:h});let O=r(()=>a==="morph"&&I.length>1?jsx(dt,{paths:I,duration:i,strokeWidth:h,autoAnimate:m,repeat:l,onComplete:y}):a==="draw"?jsx(mt,{path:I[0],duration:i,strokeWidth:h,progress:R,autoAnimate:m}):I.map((C,$)=>jsx(motion.path,{d:C,fill:e==="heart"?"currentColor":"none",stroke:e==="heart"?"none":"currentColor",strokeWidth:h,strokeLinecap:"round",strokeLinejoin:"round"},$)),"renderIcon");return jsx(motion.div,{className:B("inline-flex items-center justify-center",g&&"cursor-pointer",d),style:{width:o,height:o,color:s,...c},onClick:S,onMouseEnter:()=>P(true),onMouseLeave:()=>P(false),variants:p,animate:m?"animate":"initial",whileHover:u?{}:V(),whileTap:u?{}:F(),onAnimationComplete:y,children:jsx("svg",{width:"100%",height:"100%",viewBox:A,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx(AnimatePresence,{mode:"wait",children:O()})})})}r(ft,"AnimatedIcon");function gt(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=r(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}r(gt,"usePrefersReducedMotion");var ht={hidden:{opacity:0,x:-50},visible:r(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:50,transition:{duration:.3}}},yt={hidden:{opacity:0},visible:r(e=>({opacity:1,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,transition:{duration:.3}}},vt={hidden:{opacity:0,scale:.8},visible:r(e=>({opacity:1,scale:1,transition:{delay:e*.1,duration:.5,ease:"easeOut",type:"spring",stiffness:100}}),"visible"),exit:{opacity:0,scale:.8,transition:{duration:.3}}},xt={hidden:{opacity:0,y:50},visible:r(e=>({opacity:1,y:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,y:-50,transition:{duration:.3}}},wt={hidden:{opacity:0,y:-50},visible:r(e=>({opacity:1,y:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,y:50,transition:{duration:.3}}},At={hidden:{opacity:0,x:50},visible:r(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:-50,transition:{duration:.3}}},Ct={hidden:{opacity:0,x:-50},visible:r(e=>({opacity:1,x:0,transition:{delay:e*.1,duration:.5,ease:"easeOut"}}),"visible"),exit:{opacity:0,x:50,transition:{duration:.3}}},kt={slide:ht,fade:yt,scale:vt,slideUp:xt,slideDown:wt,slideLeft:At,slideRight:Ct};function Lt(e,n,a,o){let[s,i]=useState(0),t=useMemo(()=>{if(!o)return e;let c=Math.floor(s/a),y=Math.min(c+Math.ceil(n/a)+1,e.length);return e.slice(c,y).map((k,g)=>({...k,virtualIndex:c+g,style:{position:"absolute",top:(c+g)*a,height:a,width:"100%"}}))},[e,s,a,n,o]),l=e.length*a,d=useCallback(c=>{i(c.currentTarget.scrollTop);},[]);return {visibleItems:t,totalHeight:l,handleScroll:d}}r(Lt,"useVirtualizedList");function Mt({items:e,animation:n="slideUp",staggerDelay:a=100,duration:o=500,reorderable:s=false,enableAddRemove:i=true,layout:t="vertical",gridColumns:l=3,className:d,itemClassName:c,style:y,onReorder:k,onItemClick:g,showHoverEffects:f=true,customVariants:L,virtualized:v=false,itemHeight:A=60,containerHeight:h=400,autoStart:b=true,onAnimationComplete:R}){let[x,P]=useState(e),[H,M]=useState(0),u=gt(),p=L||kt[n],m=!u&&b,{visibleItems:w,totalHeight:I,handleScroll:S}=Lt(e,h,A,v);useEffect(()=>{P(e);},[e]);let V=useMemo(()=>!p.visible||typeof p.visible!="function"?p:{...p,visible:r(C=>{let $=p.visible,te=$(C);return {...te,transition:{...te.transition,delay:C*(a/1e3),duration:o/1e3}}},"visible")},[p,a,o]),F=r(()=>{switch(t){case "horizontal":return "flex flex-row gap-4 overflow-x-auto";case "grid":return `grid gap-4 grid-cols-${l}`;default:return "flex flex-col gap-4"}},"getLayoutClassName"),O=r((C,$,te)=>jsx(motion.div,{custom:$,variants:V,initial:m?"hidden":"visible",animate:"visible",exit:"exit",layout:i,className:B("cursor-pointer select-none",f&&"hover:scale-105 transition-transform",c),style:te,onClick:()=>g?.(C,$),whileHover:f?{scale:1.02}:void 0,whileTap:f?{scale:.98}:void 0,onAnimationComplete:()=>{$===x.length-1&&R?.();},children:C.content},C.id),"renderListItem");return s&&!v?jsx(Reorder.Group,{axis:t==="horizontal"?"x":"y",values:x,onReorder:C=>{P(C),k?.(C);},className:B(F(),d),style:y,children:jsx(AnimatePresence,{mode:"popLayout",children:x.map((C,$)=>jsx(Reorder.Item,{value:C,className:B("cursor-grab active:cursor-grabbing",c),whileDrag:{scale:1.05,zIndex:10},children:C.content},C.id))})}):v?jsx("div",{className:B("overflow-auto",d),style:{height:h,...y},onScroll:S,children:jsx("div",{style:{height:I,position:"relative"},children:jsx(AnimatePresence,{mode:"popLayout",children:w.map((C,$)=>O(C,C.virtualIndex||$,C.style))})})}):jsx(motion.div,{className:B(F(),d),style:y,initial:"hidden",animate:"visible",children:jsx(AnimatePresence,{mode:"popLayout",children:x.map((C,$)=>O(C,$))})},H)}r(Mt,"AnimatedList");function Ae(){let[e,n]=useState(false);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia("(prefers-reduced-motion: reduce)");n(a.matches);let o=r(s=>{n(s.matches);},"handleChange");return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[]),e}r(Ae,"usePrefersReducedMotion");function Et(e,n,a,o,s,i,t,l,d,c,y,k){let[g,f]=useState(n),[L,v]=useState(false),A=useRef(null),h=Ae(),b=useSpring(n,{stiffness:y.tension||100,damping:y.friction||10,mass:y.mass||1}),[R,x]=useState(n),P=useCallback(()=>{if(h){f(e);return}if(v(true),c)b.set(e);else {let M=Date.now(),u=g,p=e-u,m=r(()=>{let w=Date.now()-M,I=Math.min(w/a,1),V=u+p*I;f(V),x(V),I<1?A.current=requestAnimationFrame(m):(v(false),A.current=null);},"animate");A.current=requestAnimationFrame(m);}},[e,g,a,c,b,h]);return useEffect(()=>()=>{A.current&&cancelAnimationFrame(A.current);},[]),useEffect(()=>{if(c){let M=b.onChange(u=>{f(u),Math.abs(u-e)<.01&&v(false);});return ()=>{M();}}},[b,c,e]),useEffect(()=>{d&&P();},[d,P]),{formattedValue:useMemo(()=>{let M=Math.round(g*Math.pow(10,o))/Math.pow(10,o);try{switch(s){case "currency":return new Intl.NumberFormat(t,{style:"currency",currency:i,minimumFractionDigits:o,maximumFractionDigits:o}).format(M);case "percent":return new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:o,maximumFractionDigits:o}).format(M/100);default:let u=new Intl.NumberFormat(t,{minimumFractionDigits:o,maximumFractionDigits:o}).format(M);return k&&k!==","&&(u=u.replace(/,/g,k)),u}}catch{return M.toFixed(o)}},[g,o,s,i,t,k]),displayValue:g,isAnimating:L,startAnimation:P}}r(Et,"useAnimatedNumber");function Tt({value:e,from:n=0,duration:a=2e3,decimals:o=0,format:s="number",currency:i="USD",locale:t="en-US",easing:l="easeOut",autoStart:d=true,onComplete:c,className:y,style:k,prefix:g="",suffix:f="",useSpring:L=false,springConfig:v={},separator:A,animateOnHover:h=false,hoverValue:b}){let[R,x]=useState(false),[P,H]=useState(0),M=h&&R&&b!==void 0?b:e,{formattedValue:u,displayValue:p,isAnimating:m,startAnimation:w}=Et(M,n,a,o,s,i,t,l,d,L,v,A);useEffect(()=>{!m&&c&&Math.abs(p-M)<.001&&c(p);},[m,p,M,c]),useEffect(()=>{h&&b!==void 0&&w();},[R,h,b,w]);let I=r(()=>{h&&x(true);},"handleMouseEnter"),S=r(()=>{h&&x(false);},"handleMouseLeave"),V=Ae();return jsxs(motion.span,{className:B("inline-block tabular-nums",y),style:k,onMouseEnter:I,onMouseLeave:S,initial:{scale:1},animate:!V&&m?{scale:[1,1.05,1]}:{scale:1},transition:{duration:.3},children:[g,jsx(motion.span,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},children:u},P),f]})}r(Tt,"AnimatedNumber");var ke=T.forwardRef(({className:e,testimonials:n,autoPlay:a=true,duration:o=5e3,...s},i)=>{let[t,l]=T.useState(0);return T.useEffect(()=>{if(!a)return;let d=setInterval(()=>{l(c=>(c+1)%n.length);},o);return ()=>clearInterval(d)},[a,o,n.length]),jsxs("div",{ref:i,className:cn("relative min-h-[200px]",e),...s,children:[jsx(AnimatePresence,{mode:"wait",children:jsx(motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},children:jsx(Card,{children:jsx(CardContent,{className:"pt-6",children:jsxs("blockquote",{className:"space-y-4",children:[jsxs("p",{className:"text-lg italic",children:['"',n[t].content,'"']}),jsxs("footer",{className:"flex items-center gap-4",children:[jsxs(Avatar,{children:[jsx(AvatarImage,{src:n[t].avatar}),jsx(AvatarFallback,{children:n[t].author.slice(0,2).toUpperCase()})]}),jsxs("div",{children:[jsx("cite",{className:"not-italic font-medium",children:n[t].author}),n[t].role&&jsxs("p",{className:"text-sm text-muted-foreground",children:[n[t].role,n[t].company&&`, ${n[t].company}`]})]})]})]})})})},t)}),jsx("div",{className:"mt-4 flex justify-center gap-2",children:n.map((d,c)=>jsx("button",{onClick:()=>l(c),className:cn("h-2 w-2 rounded-full transition-all",c===t?"w-8 bg-primary":"bg-muted hover:bg-muted-foreground"),"aria-label":`Go to testimonial ${c+1}`},c))})]})});ke.displayName="AnimatedTestimonials";var Re=T.forwardRef(({className:e,content:n,children:a,delay:o=0,...s},i)=>{let[t,l]=T.useState(false);return jsxs("div",{ref:i,className:cn("relative inline-block",e),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),...s,children:[a,jsx(AnimatePresence$1,{children:t&&jsxs(motion$1.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.2,delay:o/1e3,ease:"easeOut"},className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 px-3 py-1.5 bg-popover text-popover-foreground text-sm rounded-md shadow-md whitespace-nowrap z-50",children:[n,jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-popover"})]})})]})});Re.displayName="AnimatedTooltip";function qt({cards:e,autoPlay:n=false,autoPlayInterval:a=5e3,className:o,cardClassName:s,showArrows:i=true,showDots:t=true,parallaxOffset:l=50,stackOffset:d=10,stackScale:c=.95,swipeThreshold:y=50}){let[k,g]=T.useState(0),[f,L]=T.useState(n),v=T.useRef(null),A=useMotionValue(0),h=r(u=>{let p=u-k,m=Math.abs(p);if(m>2)return {display:"none",x:0,scale:1,opacity:0,zIndex:0};let I=p*d,S=Math.pow(c,m),V=Math.max(0,1-m*.3),F=e.length-m;return {display:"block",x:I,scale:S,opacity:V,zIndex:F}},"getCardStyle"),b=T.useCallback(()=>{g(u=>(u+1)%e.length);},[e.length]),R=T.useCallback(()=>{g(u=>(u-1+e.length)%e.length);},[e.length]),x=T.useCallback(u=>{g(u);},[]),P=T.useCallback((u,p)=>{let{offset:m,velocity:w}=p;(Math.abs(m.x)>y||Math.abs(w.x)>500)&&(m.x>0?R():b());},[b,R,y]);T.useEffect(()=>{if(!f)return;let u=setInterval(b,a);return ()=>clearInterval(u)},[f,b,a]);let H=T.useCallback(()=>{n&&L(false);},[n]),M=T.useCallback(()=>{n&&L(true);},[n]);return T.useEffect(()=>{let u=r(p=>{p.key==="ArrowLeft"?R():p.key==="ArrowRight"&&b();},"handleKeyDown");return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[b,R]),jsxs("div",{ref:v,className:cn("relative w-full max-w-6xl mx-auto px-4 py-8",o),onMouseEnter:H,onMouseLeave:M,children:[jsx("div",{className:"relative h-[400px] md:h-[500px] lg:h-[600px] flex items-center justify-center",children:jsx(AnimatePresence$1,{mode:"popLayout",children:e.map((u,p)=>{let m=h(p),w=p===k;return jsx(motion$1.div,{className:cn("absolute inset-0 w-full h-full",!w&&"pointer-events-none"),initial:false,animate:{x:m.x,scale:m.scale,opacity:m.opacity,zIndex:m.zIndex},transition:{type:"spring",stiffness:300,damping:30},drag:w?"x":false,dragSnapToOrigin:true,dragElastic:.2,onDragEnd:P,whileDrag:{cursor:"grabbing"},style:{x:A,display:m.display},children:jsxs(Card,{className:cn("relative w-full h-full overflow-hidden cursor-grab","bg-gradient-to-br from-white to-gray-50 dark:from-gray-900 dark:to-gray-950","shadow-2xl hover:shadow-3xl transition-shadow duration-300",s),style:{background:u.gradient},children:[u.image&&jsxs(motion$1.div,{className:"absolute inset-0 w-full h-full",style:{x:useTransform(A,[-200,0,200],[l,0,-l])},children:[jsx("img",{src:u.image,alt:u.title,className:"w-full h-full object-cover"}),jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"})]}),jsx("div",{className:"relative z-10 flex flex-col justify-end h-full p-8 md:p-12",children:u.content?u.content:jsxs(Fragment,{children:[jsx(motion$1.h3,{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white mb-2",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.1},children:u.title}),u.subtitle&&jsx(motion$1.p,{className:"text-xl md:text-2xl text-white/80 mb-4",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.2},children:u.subtitle}),u.description&&jsx(motion$1.p,{className:"text-base md:text-lg text-white/70 max-w-2xl",initial:{opacity:0,y:20},animate:{opacity:w?1:.7,y:0},transition:{delay:.3},children:u.description})]})})]})},u.id)})})}),i&&jsxs(Fragment,{children:[jsxs(Button,{variant:"ghost",size:"icon",className:cn("absolute left-4 top-1/2 -translate-y-1/2 z-20","bg-white/10 backdrop-blur-md hover:bg-white/20","text-white border border-white/20","hidden md:flex"),onClick:R,children:[jsx(ChevronLeft,{className:"h-6 w-6"}),jsx("span",{className:"sr-only",children:"Previous card"})]}),jsxs(Button,{variant:"ghost",size:"icon",className:cn("absolute right-4 top-1/2 -translate-y-1/2 z-20","bg-white/10 backdrop-blur-md hover:bg-white/20","text-white border border-white/20","hidden md:flex"),onClick:b,children:[jsx(ChevronRight,{className:"h-6 w-6"}),jsx("span",{className:"sr-only",children:"Next card"})]})]}),t&&jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-20 flex gap-2",children:e.map((u,p)=>jsx("button",{className:cn("w-2 h-2 rounded-full transition-all duration-300","bg-white/40 hover:bg-white/60",p===k&&"w-8 bg-white"),onClick:()=>x(p),children:jsxs("span",{className:"sr-only",children:["Go to card ",p+1]})},p))})]})}r(qt,"AppleCardsCarousel");var Zt={sunset:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",ocean:"linear-gradient(135deg, #667eea 0%, #4ca1af 100%)",fire:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",forest:"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",galaxy:"linear-gradient(135deg, #7303c0 0%, #ec38bc 50%, #fdeff9 100%)",aurora:"linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)",peach:"linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%)",lavender:"linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"};var Te=T.forwardRef(({className:e,text:n="Hello",duration:a=2,...o},s)=>{let i=n.split("");return jsx("div",{ref:s,className:cn("relative flex items-center justify-center text-6xl font-bold",e),...o,children:i.map((t,l)=>jsx(motion$1.span,{initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{duration:a,delay:l*.1,ease:[.215,.61,.355,1]},className:"inline-block",children:t},l))})});Te.displayName="AppleHelloEffect";
3
+ export{We as AnimatedBackground,be as AnimatedBeam,nt as AnimatedCursor,ft as AnimatedIcon,Mt as AnimatedList,Tt as AnimatedNumber,ke as AnimatedTestimonials,Re as AnimatedTooltip,qt as AppleCardsCarousel,Te as AppleHelloEffect,Zt as gradientPresets};
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=react.useState(false),u=react.useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxRuntime.jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=react.useState(void 0),[o,r]=react.useState([]),[l,s]=react.useState(void 0),[c,i]=react.useState(null),[u,f]=react.useState(true),g=react.useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);react.useEffect(()=>{g();},[g]);let a=react.useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=react.useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return react.useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:o??jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxRuntime.jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsxRuntime.jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsxRuntime.jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxRuntime.jsxs("g",{mask:`url(#beam-${s})`,children:[jsxRuntime.jsx("rect",{width:36,height:36,fill:c}),jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxRuntime.jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsxRuntime.jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsxRuntime.jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsxRuntime.jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=react.useState(null);return react.useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=react.useState(false),[u,f]=react.useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsxRuntime.jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsxRuntime.jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsxRuntime.jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=react.useState(false),i=react.useRef(null);if(react.useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxRuntime.jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsxRuntime.jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsxRuntime.jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsxRuntime.jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxRuntime.jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsxRuntime.jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsxRuntime.jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsxRuntime.jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsxRuntime.jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsxRuntime.jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsxRuntime.jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
- exports.AuthGuard=Q;exports.IAMLoginButton=Y;exports.UserOrgDropdown=ht;exports.useHanzoAuth=A;
2
+ 'use strict';var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var at=Object.defineProperty;var n=(t,e)=>at(t,"name",{value:e,configurable:true});function b(...t){return tailwindMerge.twMerge(clsx.clsx(t))}n(b,"cn");var K={authorize:"/v1/iam/oauth/authorize",token:"/v1/iam/oauth/token",userinfo:"/v1/iam/oauth/userinfo",jwks:"/v1/iam/.well-known/jwks",logout:"/v1/iam/oauth/logout"},ct=n(t=>t.replace(/\/+$/,""),"trim");function V(t,e){return `${ct(t)}${K[e]}`}n(V,"iamUrl");var pt="hanzo_iam_pkce_verifier",dt="hanzo_iam_state";function Y(t){let e=new Uint8Array(t),o="";for(let s of e)o+=String.fromCharCode(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(Y,"base64UrlEncode");function ht(){let t=new Uint8Array(48);return crypto.getRandomValues(t),Y(t.buffer)}n(ht,"randomVerifier");async function gt(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Y(e)}n(gt,"challengeFor");async function q(t){let e=t.redirectUri||`${window.location.origin}/auth/callback`,o=ht(),s=await gt(o),a=crypto.randomUUID();sessionStorage.setItem(pt,o),sessionStorage.setItem(dt,a);let r=new URL(V(t.serverUrl,"authorize"));return r.searchParams.set("client_id",t.clientId),r.searchParams.set("response_type","code"),r.searchParams.set("redirect_uri",e),r.searchParams.set("scope",t.scope||"openid profile email"),r.searchParams.set("state",a),r.searchParams.set("code_challenge",s),r.searchParams.set("code_challenge_method","S256"),t.provider&&r.searchParams.set("provider",t.provider),r.toString()}n(q,"buildIamAuthorizeUrl");async function z(t){window.location.href=await q(t);}n(z,"startIamLogin");var ft={google:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M21.35 11.1h-9.17v2.96h5.27c-.23 1.4-1.66 4.1-5.27 4.1-3.17 0-5.76-2.62-5.76-5.86s2.59-5.86 5.76-5.86c1.8 0 3.01.77 3.7 1.43l2.52-2.43C16.9 3.5 14.76 2.6 12.18 2.6 6.98 2.6 2.8 6.78 2.8 12.3s4.18 9.7 9.38 9.7c5.42 0 9-3.8 9-9.16 0-.62-.07-1.09-.18-1.74z",fill:"currentColor"})}),github:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.25c0 4.53 2.87 8.37 6.84 9.73.5.1.68-.22.68-.49v-1.7c-2.78.62-3.37-1.22-3.37-1.22-.45-1.18-1.11-1.5-1.11-1.5-.91-.64.07-.62.07-.62 1 .07 1.53 1.06 1.53 1.06.9 1.56 2.36 1.11 2.94.85.09-.66.35-1.11.63-1.37-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.27 2.75 1.05A9.36 9.36 0 0 1 12 6.84c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.82c0 .27.18.59.69.49A10.26 10.26 0 0 0 22 12.25C22 6.58 17.52 2 12 2z"})}),web3:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":true,children:[jsxRuntime.jsx("path",{d:"M3 7l9-4 9 4-9 4-9-4z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 12l9 4 9-4M3 17l9 4 9-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})},bt={google:"Continue with Google",github:"Continue with GitHub",web3:"Connect Wallet"};function I({provider:t,config:e,onLogin:o,label:s,icon:a,className:r}){let[l,c]=react.useState(false),d=react.useCallback(()=>{let h=o??(p=>z(p));if(!o&&!e)throw new Error("SocialButton: provide `config` (serverUrl + clientId) or an `onLogin` starter.");c(true),Promise.resolve(h({...e,provider:t})).catch(()=>c(false));},[o,e,t]);return jsxRuntime.jsxs("button",{type:"button",onClick:d,disabled:l,"data-provider":t,className:b("inline-flex w-full items-center justify-center gap-2 rounded-md border border-input bg-background px-4 py-2.5","text-sm font-medium text-foreground transition-colors","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",r),children:[a??ft[t]??null,l?"Redirecting\u2026":s??bt[t]??`Continue with ${t}`]})}n(I,"SocialButton");function B(t){return jsxRuntime.jsx(I,{provider:"web3",...t})}n(B,"Web3Connect");function U({onSubmit:t,onForgot:e,submitLabel:o="Sign in",className:s}){let[a,r]=react.useState(""),[l,c]=react.useState(""),[d,h]=react.useState(false),[p,i]=react.useState(null),f=react.useCallback(x=>{x.preventDefault(),t&&(h(true),i(null),Promise.resolve(t({email:a,password:l})).catch(C=>i(C instanceof Error?C.message:"Sign-in failed")).finally(()=>h(false)));},[t,a,l]),m=b("w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2");return jsxRuntime.jsxs("form",{onSubmit:f,className:b("flex flex-col gap-3",s),children:[jsxRuntime.jsxs("label",{className:"flex flex-col gap-1.5",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:"Email"}),jsxRuntime.jsx("input",{type:"email",autoComplete:"email",required:true,value:a,onChange:x=>r(x.target.value),placeholder:"you@example.com",className:m})]}),jsxRuntime.jsxs("label",{className:"flex flex-col gap-1.5",children:[jsxRuntime.jsxs("span",{className:"flex items-center justify-between text-sm font-medium text-foreground",children:["Password",e&&jsxRuntime.jsx("button",{type:"button",onClick:e,className:"text-xs font-normal text-muted-foreground hover:text-foreground",children:"Forgot?"})]}),jsxRuntime.jsx("input",{type:"password",autoComplete:"current-password",required:true,value:l,onChange:x=>c(x.target.value),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",className:m})]}),p&&jsxRuntime.jsx("p",{role:"alert",className:"text-sm text-destructive",children:p}),jsxRuntime.jsx("button",{type:"submit",disabled:d||!t,className:b("inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2.5","text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),children:d?"Signing in\u2026":o})]})}n(U,"PasswordForm");var J=n(t=>t==="password","isPassword");function yt({providers:t,config:e,onLogin:o,onPasswordSubmit:s,onForgot:a,title:r,className:l}){let c=t.filter(p=>!J(p)),d=t.some(J),h=d&&c.length>0;return jsxRuntime.jsxs("div",{className:b("flex w-full max-w-sm flex-col gap-4",l),children:[r&&jsxRuntime.jsx("div",{className:"text-lg font-semibold text-foreground",children:r}),d&&jsxRuntime.jsx(U,{onSubmit:s,onForgot:a}),h&&jsxRuntime.jsxs("div",{className:"flex items-center gap-3","aria-hidden":true,children:[jsxRuntime.jsx("span",{className:"h-px flex-1 bg-border"}),jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"or"}),jsxRuntime.jsx("span",{className:"h-px flex-1 bg-border"})]}),c.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-2",children:c.map(p=>p==="web3"?jsxRuntime.jsx(B,{config:e,onLogin:o},p):jsxRuntime.jsx(I,{provider:p,config:e,onLogin:o},p))})]})}n(yt,"SignIn");function zt({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,provider:s,label:a="Sign in",className:r,variant:l="default"}){let[c,d]=react.useState(false),h=react.useCallback(()=>{d(true),z({serverUrl:t,clientId:e,redirectUri:o,provider:s}).catch(()=>{d(false);});},[t,e,o,s]);return jsxRuntime.jsx("button",{type:"button",className:b("inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",l==="outline"?"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground":"bg-primary text-primary-foreground hover:bg-primary/90",r),onClick:h,disabled:c,children:c?"Redirecting\u2026":a})}n(zt,"IAMLoginButton");var Q="hanzo-auth-token",H="hanzo-user",tt="hanzo-auth-expires",Ct="https://iam.hanzo.ai",It={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function D(){let[t,e]=react.useState(void 0),[o,s]=react.useState([]),[a,r]=react.useState(void 0),[l,c]=react.useState(null),[d,h]=react.useState(true),p=react.useCallback(async()=>{try{let m=localStorage.getItem(Q),x=localStorage.getItem(tt);if(!m||x&&Date.now()>Number(x)){h(!1);return}c(m);let C=localStorage.getItem(H);if(C)try{let g=JSON.parse(C);g?.email&&e({id:g.id,name:g.displayName||g.name,email:g.email,avatar:g.avatar});}catch{}let W=await fetch(`${Ct}/v1/iam/oauth/userinfo`,{headers:{Authorization:`Bearer ${m}`}});if(W.ok){let g=await W.json(),G={id:g.sub||g.id,name:g.name||g.displayName,email:g.email,avatar:g.picture||g.avatar};e(G),localStorage.setItem(H,JSON.stringify(g));let A=(g.groups||[]).map(st=>{let j=st.toLowerCase().replace(/^\//,""),R=It[j];return R?{id:j,name:R.name,slug:R.slug}:null}).filter(Boolean);A.length===0&&G.email&&A.push({id:"personal",name:"Personal",slug:"personal"}),s(A),r(A[0]?.id);}}catch{}finally{h(false);}},[]);react.useEffect(()=>{p();},[p]);let i=react.useCallback(()=>{localStorage.removeItem(Q),localStorage.removeItem(H),localStorage.removeItem(tt),window.location.href="https://hanzo.id";},[]),f=react.useCallback(m=>{r(m);},[]);return {user:t,organizations:o,currentOrgId:a,token:l,loading:d,signOut:i,switchOrg:f}}n(D,"useHanzoAuth");function At({loginUrl:t,clientId:e,fallback:o,children:s}){let{user:a,loading:r}=D();return react.useEffect(()=>{!r&&!a&&(t?window.location.href=t:e?z({serverUrl:"https://hanzo.id",clientId:e}):window.location.href="https://hanzo.id");},[r,a,t,e]),r?jsxRuntime.jsx(jsxRuntime.Fragment,{children:o??jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):a?jsxRuntime.jsx(jsxRuntime.Fragment,{children:s}):null}n(At,"AuthGuard");var _={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",web3:"https://web3.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",web3:"https://web3.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",web3:"https://web3.zoo.ngo",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",web3:"https://web3.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var Lt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function Ot(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(Ot,"hashStr");function k(t,e,o){return t%(e*(o+1))%e}n(k,"getUnit");function Rt(t,e){return k(t,2,e)===0}n(Rt,"getBoolean");function ot(t,e,o){return o[k(t,o.length,e)]}n(ot,"getRandomColor");function Bt(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),s=parseInt(t.slice(5,7),16);return e*.299+o*.587+s*.114>128?"#000":"#fff"}n(Bt,"getContrast");function rt({name:t,size:e=40,colors:o=Lt,className:s,square:a=false}){let r=Ot(t),l=ot(r,0,o),c=Bt(l),d=Rt(r,2),h=k(r,3,7),p=k(r,5,8),i=k(r,10,9),f=i>6?i-10:i,m=k(r,5,10)>3?k(r,5,10)-5:k(r,5,10);return jsxRuntime.jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:s,style:a?void 0:{borderRadius:"50%"},children:[jsxRuntime.jsx("mask",{id:`beam-${r}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsxRuntime.jsx("rect",{width:36,height:36,rx:a?void 0:72,fill:"#fff"})}),jsxRuntime.jsxs("g",{mask:`url(#beam-${r})`,children:[jsxRuntime.jsx("rect",{width:36,height:36,fill:l}),jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${f} ${m}) rotate(${i} 18 18)`,fill:ot(r,1,o),rx:6}),jsxRuntime.jsxs("g",{transform:`translate(${f} ${m}) rotate(${i} 18 18)`,children:[d?jsxRuntime.jsx("path",{d:`M15 ${19+h}c2 1 4 1 6 0`,stroke:c,fill:"none",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:`M13 ${19+h}a1 .75 0 0 0 10 0`,fill:c}),jsxRuntime.jsx("rect",{x:14-p,y:14,width:1.5,height:2,rx:1,fill:c}),jsxRuntime.jsx("rect",{x:20+p,y:14,width:1.5,height:2,rx:1,fill:c})]})]})]})}n(rt,"BeamAvatar");async function Et(t){let o=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(s)).map(a=>a.toString(16).padStart(2,"0")).join("")}n(Et,"sha256");function Ht(t,e){let[o,s]=react.useState(null);return react.useMemo(()=>{if(!t){s(null);return}let a=t.trim().toLowerCase();Et(a).then(r=>{s(`https://www.gravatar.com/avatar/${r}?s=${e||80}&d=404`);});},[t,e]),o}n(Ht,"useGravatarUrl");function nt({src:t,email:e,name:o,size:s=40,colors:a,className:r}){let[l,c]=react.useState(false),[d,h]=react.useState(false),p=Ht(e,s*2),i=`rounded-full object-cover ${r||""}`,f={width:s,height:s};return t&&!l?jsxRuntime.jsx("img",{src:t,alt:o||e||"avatar",className:i,style:f,onError:()=>c(true)}):p&&!d?jsxRuntime.jsx("img",{src:p,alt:o||e||"avatar",className:i,style:f,onError:()=>h(true)}):jsxRuntime.jsx(rt,{name:o||e||"user",size:s,colors:a,className:r})}n(nt,"UserAvatar");function Ft({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:s,onSignOut:a}){let[r,l]=react.useState(false),c=react.useRef(null);if(react.useEffect(()=>{let i=n(f=>{c.current&&!c.current.contains(f.target)&&l(false);},"handler");return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]),!t)return null;let d=e.find(i=>i.id===o),h=d?.slug||"hanzo",p=_[h]||_.hanzo;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>l(i=>!i),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsx(nt,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxRuntime.jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsxRuntime.jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsxRuntime.jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsxRuntime.jsx("path",{d:"M6 9l6 6 6-6"})})]}),r&&jsxRuntime.jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsxRuntime.jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsxRuntime.jsx("p",{className:"text-[11px] text-white/40",children:t.email}),d&&jsxRuntime.jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:d.name})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsxRuntime.jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(i=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{s?.(i.id),l(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-[13px] text-white/70",children:i.name}),i.role&&jsxRuntime.jsx("span",{className:"text-[10px] text-white/25 capitalize",children:i.role})]}),i.id===o&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},i.id))]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsx("a",{href:`${p.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>l(false),children:"Account settings"}),jsxRuntime.jsx("a",{href:p.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>l(false),children:"Billing"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{l(false),a?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(Ft,"UserOrgDropdown");
3
+ exports.AuthGuard=At;exports.IAMLoginButton=zt;exports.IAM_OIDC_PATHS=K;exports.PasswordForm=U;exports.SignIn=yt;exports.SocialButton=I;exports.UserOrgDropdown=Ft;exports.Web3Connect=B;exports.buildIamAuthorizeUrl=q;exports.iamUrl=V;exports.startIamLogin=z;exports.useHanzoAuth=D;
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import {useState,useCallback,useEffect,useRef,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=useState(false),u=useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=useState(void 0),[o,r]=useState([]),[l,s]=useState(void 0),[c,i]=useState(null),[u,f]=useState(true),g=useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);useEffect(()=>{g();},[g]);let a=useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsx(Fragment,{children:o??jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsx(Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxs("g",{mask:`url(#beam-${s})`,children:[jsx("rect",{width:36,height:36,fill:c}),jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=useState(null);return useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=useState(false),[u,f]=useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=useState(false),i=useRef(null);if(useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxs("div",{className:"p-2",children:[jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
- export{Q as AuthGuard,Y as IAMLoginButton,ht as UserOrgDropdown,A as useHanzoAuth};
2
+ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {useState,useCallback,useEffect,useRef,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var at=Object.defineProperty;var n=(t,e)=>at(t,"name",{value:e,configurable:true});function b(...t){return twMerge(clsx(t))}n(b,"cn");var K={authorize:"/v1/iam/oauth/authorize",token:"/v1/iam/oauth/token",userinfo:"/v1/iam/oauth/userinfo",jwks:"/v1/iam/.well-known/jwks",logout:"/v1/iam/oauth/logout"},ct=n(t=>t.replace(/\/+$/,""),"trim");function V(t,e){return `${ct(t)}${K[e]}`}n(V,"iamUrl");var pt="hanzo_iam_pkce_verifier",dt="hanzo_iam_state";function Y(t){let e=new Uint8Array(t),o="";for(let s of e)o+=String.fromCharCode(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(Y,"base64UrlEncode");function ht(){let t=new Uint8Array(48);return crypto.getRandomValues(t),Y(t.buffer)}n(ht,"randomVerifier");async function gt(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Y(e)}n(gt,"challengeFor");async function q(t){let e=t.redirectUri||`${window.location.origin}/auth/callback`,o=ht(),s=await gt(o),a=crypto.randomUUID();sessionStorage.setItem(pt,o),sessionStorage.setItem(dt,a);let r=new URL(V(t.serverUrl,"authorize"));return r.searchParams.set("client_id",t.clientId),r.searchParams.set("response_type","code"),r.searchParams.set("redirect_uri",e),r.searchParams.set("scope",t.scope||"openid profile email"),r.searchParams.set("state",a),r.searchParams.set("code_challenge",s),r.searchParams.set("code_challenge_method","S256"),t.provider&&r.searchParams.set("provider",t.provider),r.toString()}n(q,"buildIamAuthorizeUrl");async function z(t){window.location.href=await q(t);}n(z,"startIamLogin");var ft={google:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":true,children:jsx("path",{d:"M21.35 11.1h-9.17v2.96h5.27c-.23 1.4-1.66 4.1-5.27 4.1-3.17 0-5.76-2.62-5.76-5.86s2.59-5.86 5.76-5.86c1.8 0 3.01.77 3.7 1.43l2.52-2.43C16.9 3.5 14.76 2.6 12.18 2.6 6.98 2.6 2.8 6.78 2.8 12.3s4.18 9.7 9.38 9.7c5.42 0 9-3.8 9-9.16 0-.62-.07-1.09-.18-1.74z",fill:"currentColor"})}),github:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":true,children:jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.25c0 4.53 2.87 8.37 6.84 9.73.5.1.68-.22.68-.49v-1.7c-2.78.62-3.37-1.22-3.37-1.22-.45-1.18-1.11-1.5-1.11-1.5-.91-.64.07-.62.07-.62 1 .07 1.53 1.06 1.53 1.06.9 1.56 2.36 1.11 2.94.85.09-.66.35-1.11.63-1.37-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.27 2.75 1.05A9.36 9.36 0 0 1 12 6.84c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.82c0 .27.18.59.69.49A10.26 10.26 0 0 0 22 12.25C22 6.58 17.52 2 12 2z"})}),web3:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":true,children:[jsx("path",{d:"M3 7l9-4 9 4-9 4-9-4z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),jsx("path",{d:"M3 12l9 4 9-4M3 17l9 4 9-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})},bt={google:"Continue with Google",github:"Continue with GitHub",web3:"Connect Wallet"};function I({provider:t,config:e,onLogin:o,label:s,icon:a,className:r}){let[l,c]=useState(false),d=useCallback(()=>{let h=o??(p=>z(p));if(!o&&!e)throw new Error("SocialButton: provide `config` (serverUrl + clientId) or an `onLogin` starter.");c(true),Promise.resolve(h({...e,provider:t})).catch(()=>c(false));},[o,e,t]);return jsxs("button",{type:"button",onClick:d,disabled:l,"data-provider":t,className:b("inline-flex w-full items-center justify-center gap-2 rounded-md border border-input bg-background px-4 py-2.5","text-sm font-medium text-foreground transition-colors","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",r),children:[a??ft[t]??null,l?"Redirecting\u2026":s??bt[t]??`Continue with ${t}`]})}n(I,"SocialButton");function B(t){return jsx(I,{provider:"web3",...t})}n(B,"Web3Connect");function U({onSubmit:t,onForgot:e,submitLabel:o="Sign in",className:s}){let[a,r]=useState(""),[l,c]=useState(""),[d,h]=useState(false),[p,i]=useState(null),f=useCallback(x=>{x.preventDefault(),t&&(h(true),i(null),Promise.resolve(t({email:a,password:l})).catch(C=>i(C instanceof Error?C.message:"Sign-in failed")).finally(()=>h(false)));},[t,a,l]),m=b("w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2");return jsxs("form",{onSubmit:f,className:b("flex flex-col gap-3",s),children:[jsxs("label",{className:"flex flex-col gap-1.5",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Email"}),jsx("input",{type:"email",autoComplete:"email",required:true,value:a,onChange:x=>r(x.target.value),placeholder:"you@example.com",className:m})]}),jsxs("label",{className:"flex flex-col gap-1.5",children:[jsxs("span",{className:"flex items-center justify-between text-sm font-medium text-foreground",children:["Password",e&&jsx("button",{type:"button",onClick:e,className:"text-xs font-normal text-muted-foreground hover:text-foreground",children:"Forgot?"})]}),jsx("input",{type:"password",autoComplete:"current-password",required:true,value:l,onChange:x=>c(x.target.value),placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",className:m})]}),p&&jsx("p",{role:"alert",className:"text-sm text-destructive",children:p}),jsx("button",{type:"submit",disabled:d||!t,className:b("inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2.5","text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),children:d?"Signing in\u2026":o})]})}n(U,"PasswordForm");var J=n(t=>t==="password","isPassword");function yt({providers:t,config:e,onLogin:o,onPasswordSubmit:s,onForgot:a,title:r,className:l}){let c=t.filter(p=>!J(p)),d=t.some(J),h=d&&c.length>0;return jsxs("div",{className:b("flex w-full max-w-sm flex-col gap-4",l),children:[r&&jsx("div",{className:"text-lg font-semibold text-foreground",children:r}),d&&jsx(U,{onSubmit:s,onForgot:a}),h&&jsxs("div",{className:"flex items-center gap-3","aria-hidden":true,children:[jsx("span",{className:"h-px flex-1 bg-border"}),jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"or"}),jsx("span",{className:"h-px flex-1 bg-border"})]}),c.length>0&&jsx("div",{className:"flex flex-col gap-2",children:c.map(p=>p==="web3"?jsx(B,{config:e,onLogin:o},p):jsx(I,{provider:p,config:e,onLogin:o},p))})]})}n(yt,"SignIn");function zt({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,provider:s,label:a="Sign in",className:r,variant:l="default"}){let[c,d]=useState(false),h=useCallback(()=>{d(true),z({serverUrl:t,clientId:e,redirectUri:o,provider:s}).catch(()=>{d(false);});},[t,e,o,s]);return jsx("button",{type:"button",className:b("inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50",l==="outline"?"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground":"bg-primary text-primary-foreground hover:bg-primary/90",r),onClick:h,disabled:c,children:c?"Redirecting\u2026":a})}n(zt,"IAMLoginButton");var Q="hanzo-auth-token",H="hanzo-user",tt="hanzo-auth-expires",Ct="https://iam.hanzo.ai",It={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function D(){let[t,e]=useState(void 0),[o,s]=useState([]),[a,r]=useState(void 0),[l,c]=useState(null),[d,h]=useState(true),p=useCallback(async()=>{try{let m=localStorage.getItem(Q),x=localStorage.getItem(tt);if(!m||x&&Date.now()>Number(x)){h(!1);return}c(m);let C=localStorage.getItem(H);if(C)try{let g=JSON.parse(C);g?.email&&e({id:g.id,name:g.displayName||g.name,email:g.email,avatar:g.avatar});}catch{}let W=await fetch(`${Ct}/v1/iam/oauth/userinfo`,{headers:{Authorization:`Bearer ${m}`}});if(W.ok){let g=await W.json(),G={id:g.sub||g.id,name:g.name||g.displayName,email:g.email,avatar:g.picture||g.avatar};e(G),localStorage.setItem(H,JSON.stringify(g));let A=(g.groups||[]).map(st=>{let j=st.toLowerCase().replace(/^\//,""),R=It[j];return R?{id:j,name:R.name,slug:R.slug}:null}).filter(Boolean);A.length===0&&G.email&&A.push({id:"personal",name:"Personal",slug:"personal"}),s(A),r(A[0]?.id);}}catch{}finally{h(false);}},[]);useEffect(()=>{p();},[p]);let i=useCallback(()=>{localStorage.removeItem(Q),localStorage.removeItem(H),localStorage.removeItem(tt),window.location.href="https://hanzo.id";},[]),f=useCallback(m=>{r(m);},[]);return {user:t,organizations:o,currentOrgId:a,token:l,loading:d,signOut:i,switchOrg:f}}n(D,"useHanzoAuth");function At({loginUrl:t,clientId:e,fallback:o,children:s}){let{user:a,loading:r}=D();return useEffect(()=>{!r&&!a&&(t?window.location.href=t:e?z({serverUrl:"https://hanzo.id",clientId:e}):window.location.href="https://hanzo.id");},[r,a,t,e]),r?jsx(Fragment,{children:o??jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):a?jsx(Fragment,{children:s}):null}n(At,"AuthGuard");var _={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",web3:"https://web3.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",web3:"https://web3.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",web3:"https://web3.zoo.ngo",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",web3:"https://web3.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var Lt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function Ot(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(Ot,"hashStr");function k(t,e,o){return t%(e*(o+1))%e}n(k,"getUnit");function Rt(t,e){return k(t,2,e)===0}n(Rt,"getBoolean");function ot(t,e,o){return o[k(t,o.length,e)]}n(ot,"getRandomColor");function Bt(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),s=parseInt(t.slice(5,7),16);return e*.299+o*.587+s*.114>128?"#000":"#fff"}n(Bt,"getContrast");function rt({name:t,size:e=40,colors:o=Lt,className:s,square:a=false}){let r=Ot(t),l=ot(r,0,o),c=Bt(l),d=Rt(r,2),h=k(r,3,7),p=k(r,5,8),i=k(r,10,9),f=i>6?i-10:i,m=k(r,5,10)>3?k(r,5,10)-5:k(r,5,10);return jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:s,style:a?void 0:{borderRadius:"50%"},children:[jsx("mask",{id:`beam-${r}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsx("rect",{width:36,height:36,rx:a?void 0:72,fill:"#fff"})}),jsxs("g",{mask:`url(#beam-${r})`,children:[jsx("rect",{width:36,height:36,fill:l}),jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${f} ${m}) rotate(${i} 18 18)`,fill:ot(r,1,o),rx:6}),jsxs("g",{transform:`translate(${f} ${m}) rotate(${i} 18 18)`,children:[d?jsx("path",{d:`M15 ${19+h}c2 1 4 1 6 0`,stroke:c,fill:"none",strokeLinecap:"round"}):jsx("path",{d:`M13 ${19+h}a1 .75 0 0 0 10 0`,fill:c}),jsx("rect",{x:14-p,y:14,width:1.5,height:2,rx:1,fill:c}),jsx("rect",{x:20+p,y:14,width:1.5,height:2,rx:1,fill:c})]})]})]})}n(rt,"BeamAvatar");async function Et(t){let o=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(s)).map(a=>a.toString(16).padStart(2,"0")).join("")}n(Et,"sha256");function Ht(t,e){let[o,s]=useState(null);return useMemo(()=>{if(!t){s(null);return}let a=t.trim().toLowerCase();Et(a).then(r=>{s(`https://www.gravatar.com/avatar/${r}?s=${e||80}&d=404`);});},[t,e]),o}n(Ht,"useGravatarUrl");function nt({src:t,email:e,name:o,size:s=40,colors:a,className:r}){let[l,c]=useState(false),[d,h]=useState(false),p=Ht(e,s*2),i=`rounded-full object-cover ${r||""}`,f={width:s,height:s};return t&&!l?jsx("img",{src:t,alt:o||e||"avatar",className:i,style:f,onError:()=>c(true)}):p&&!d?jsx("img",{src:p,alt:o||e||"avatar",className:i,style:f,onError:()=>h(true)}):jsx(rt,{name:o||e||"user",size:s,colors:a,className:r})}n(nt,"UserAvatar");function Ft({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:s,onSignOut:a}){let[r,l]=useState(false),c=useRef(null);if(useEffect(()=>{let i=n(f=>{c.current&&!c.current.contains(f.target)&&l(false);},"handler");return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]),!t)return null;let d=e.find(i=>i.id===o),h=d?.slug||"hanzo",p=_[h]||_.hanzo;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>l(i=>!i),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsx(nt,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsx("path",{d:"M6 9l6 6 6-6"})})]}),r&&jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsx("p",{className:"text-[11px] text-white/40",children:t.email}),d&&jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:d.name})]}),e.length>0&&jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(i=>jsxs("button",{type:"button",onClick:()=>{s?.(i.id),l(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[13px] text-white/70",children:i.name}),i.role&&jsx("span",{className:"text-[10px] text-white/25 capitalize",children:i.role})]}),i.id===o&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},i.id))]}),jsxs("div",{className:"p-2",children:[jsx("a",{href:`${p.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>l(false),children:"Account settings"}),jsx("a",{href:p.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>l(false),children:"Billing"}),jsx("button",{type:"button",onClick:()=>{l(false),a?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(Ft,"UserOrgDropdown");
3
+ export{At as AuthGuard,zt as IAMLoginButton,K as IAM_OIDC_PATHS,U as PasswordForm,yt as SignIn,I as SocialButton,Ft as UserOrgDropdown,B as Web3Connect,q as buildIamAuthorizeUrl,V as iamUrl,z as startIamLogin,D as useHanzoAuth};