@voxket-ai/voxket-live 1.0.84 โ†’ 1.0.85

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 (3) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.js +1274 -1274
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@
6
6
  ${g}px !important;
7
7
  top: ${u}px !important;
8
8
  }
9
- `),()=>{m.contains(x)&&m.removeChild(x)}},[t]),l.jsx(Uf,{isPresent:t,childRef:o,sizeRef:i,children:p.cloneElement(e,{ref:o})})}const Wf=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:o,mode:i,anchorX:a,root:c})=>{const d=Lr(Gf),u=C.useId();let f=!0,h=C.useMemo(()=>(f=!1,{id:u,initial:t,isPresent:n,custom:r,onExitComplete:g=>{d.set(g,!0);for(const x of d.values())if(!x)return;s&&s()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,s]);return o&&f&&(h={...h}),C.useMemo(()=>{d.forEach((g,x)=>d.set(x,!1))},[n]),p.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),i==="popLayout"&&(e=l.jsx(Zf,{isPresent:n,anchorX:a,root:c,children:e})),l.jsx(ds.Provider,{value:h,children:e})};function Gf(){return new Map}function _c(e=!0){const t=C.useContext(ds);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,o=C.useId();C.useEffect(()=>{if(e)return r(o)},[e]);const i=C.useCallback(()=>e&&s&&s(o),[o,s,e]);return!n&&s?[!1,i]:[!0]}const Fn=e=>e.key||"";function oi(e){const t=[];return C.Children.forEach(e,n=>{C.isValidElement(n)&&t.push(n)}),t}const Ht=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",root:c})=>{const[d,u]=_c(i),f=C.useMemo(()=>oi(e),[e]),h=i&&!d?[]:f.map(Fn),g=C.useRef(!0),x=C.useRef(f),m=Lr(()=>new Map),[b,k]=C.useState(f),[v,T]=C.useState(f);Ya(()=>{g.current=!1,x.current=f;for(let A=0;A<v.length;A++){const M=Fn(v[A]);h.includes(M)?m.delete(M):m.get(M)!==!0&&m.set(M,!1)}},[v,h.length,h.join("-")]);const w=[];if(f!==b){let A=[...f];for(let M=0;M<v.length;M++){const j=v[M],z=Fn(j);h.includes(z)||(A.splice(M,0,j),w.push(j))}return o==="wait"&&w.length&&(A=w),T(oi(A)),k(f),null}process.env.NODE_ENV!=="production"&&o==="wait"&&v.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:S}=C.useContext(Or);return l.jsx(l.Fragment,{children:v.map(A=>{const M=Fn(A),j=i&&!d?!1:f===v||h.includes(M),z=()=>{if(m.has(M))m.set(M,!0);else return;let y=!0;m.forEach(D=>{D||(y=!1)}),y&&(S==null||S(),T(x.current),i&&(u==null||u()),s&&s())};return l.jsx(Wf,{isPresent:j,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:o,root:c,onExitComplete:j?void 0:z,anchorX:a,children:A},M)})})},Bc=C.createContext({strict:!1}),ii={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Gt={};for(const e in ii)Gt[e]={isEnabled:t=>ii[e].some(n=>!!t[n])};function Kf(e){for(const t in e)Gt[t]={...Gt[t],...e[t]}}const Yf=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ss(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Yf.has(e)}let zc=e=>!ss(e);function qf(e){typeof e=="function"&&(zc=t=>t.startsWith("on")?!ss(t):e(t))}try{qf(require("@emotion/is-prop-valid").default)}catch{}function Xf(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||(zc(r)||n===!0&&ss(r)||!t&&!ss(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const us=C.createContext({});function fs(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function wn(e){return typeof e=="string"||Array.isArray(e)}const lo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],uo=["initial",...lo];function hs(e){return fs(e.animate)||uo.some(t=>wn(e[t]))}function Hc(e){return!!(hs(e)||e.variants)}function Jf(e,t){if(hs(e)){const{initial:n,animate:s}=e;return{initial:n===!1||wn(n)?n:void 0,animate:wn(s)?s:void 0}}return e.inherit!==!1?t:{}}function Qf(e){const{initial:t,animate:n}=Jf(e,C.useContext(us));return C.useMemo(()=>({initial:t,animate:n}),[ai(t),ai(n)])}function ai(e){return Array.isArray(e)?e.join(" "):e}const Sn={};function eh(e){for(const t in e)Sn[t]=e[t],Kr(t)&&(Sn[t].isCSSVariable=!0)}function Uc(e,{layout:t,layoutId:n}){return Qt.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Sn[e]||e==="opacity")}const th={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nh=Jt.length;function sh(e,t,n){let s="",r=!0;for(let o=0;o<nh;o++){const i=Jt[o],a=e[i];if(a===void 0)continue;let c=!0;if(typeof a=="number"?c=a===(i.startsWith("scale")?1:0):c=parseFloat(a)===0,!c||n){const d=Ic(a,oo[i]);if(!c){r=!1;const u=th[i]||i;s+=`${u}(${d}) `}n&&(t[i]=d)}}return s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}function fo(e,t,n){const{style:s,vars:r,transformOrigin:o}=e;let i=!1,a=!1;for(const c in t){const d=t[c];if(Qt.has(c)){i=!0;continue}else if(Kr(c)){r[c]=d;continue}else{const u=Ic(d,oo[c]);c.startsWith("origin")?(a=!0,o[c]=u):s[c]=u}}if(t.transform||(i||n?s.transform=sh(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:c="50%",originY:d="50%",originZ:u=0}=o;s.transformOrigin=`${c} ${d} ${u}`}}const ho=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Zc(e,t,n){for(const s in t)!Re(t[s])&&!Uc(s,n)&&(e[s]=t[s])}function rh({transformTemplate:e},t){return C.useMemo(()=>{const n=ho();return fo(n,t,e),Object.assign({},n.vars,n.style)},[t])}function oh(e,t){const n=e.style||{},s={};return Zc(s,n,e),Object.assign(s,rh(e,t)),s}function ih(e,t){const n={},s=oh(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const ah={offset:"stroke-dashoffset",array:"stroke-dasharray"},ch={offset:"strokeDashoffset",array:"strokeDasharray"};function lh(e,t,n=1,s=0,r=!0){e.pathLength=1;const o=r?ah:ch;e[o.offset]=ee.transform(-s);const i=ee.transform(t),a=ee.transform(n);e[o.array]=`${i} ${a}`}function Wc(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:o=1,pathOffset:i=0,...a},c,d,u){if(fo(e,a,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),r!==void 0&&lh(f,r,o,i,!1)}const Gc=()=>({...ho(),attrs:{}}),Kc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function dh(e,t,n,s){const r=C.useMemo(()=>{const o=Gc();return Wc(o,t,Kc(s),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Zc(o,e.style,e),r.style={...o,...r.style}}return r}const uh=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mo(e){return typeof e!="string"||e.includes("-")?!1:!!(uh.indexOf(e)>-1||/[A-Z]/u.test(e))}function fh(e,t,n,{latestValues:s},r,o=!1){const a=(mo(e)?dh:ih)(t,s,r,e),c=Xf(t,typeof e=="string",o),d=e!==C.Fragment?{...c,...a,ref:n}:{},{children:u}=t,f=C.useMemo(()=>Re(u)?u.get():u,[u]);return C.createElement(e,{...d,children:f})}function ci(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function po(e,t,n,s){if(typeof t=="function"){const[r,o]=ci(s);t=t(n!==void 0?n:e.custom,r,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,o]=ci(s);t=t(n!==void 0?n:e.custom,r,o)}return t}function Yn(e){return Re(e)?e.get():e}function hh({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:mh(n,s,r,e),renderState:t()}}function mh(e,t,n,s){const r={},o=s(e,{});for(const h in o)r[h]=Yn(o[h]);let{initial:i,animate:a}=e;const c=hs(e),d=Hc(e);t&&d&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const f=u?a:i;if(f&&typeof f!="boolean"&&!fs(f)){const h=Array.isArray(f)?f:[f];for(let g=0;g<h.length;g++){const x=po(e,h[g]);if(x){const{transitionEnd:m,transition:b,...k}=x;for(const v in k){let T=k[v];if(Array.isArray(T)){const w=u?T.length-1:0;T=T[w]}T!==null&&(r[v]=T)}for(const v in m)r[v]=m[v]}}}return r}const Yc=e=>(t,n)=>{const s=C.useContext(us),r=C.useContext(ds),o=()=>hh(e,t,s,r);return n?o():Lr(o)};function go(e,t,n){var o;const{style:s}=e,r={};for(const i in s)(Re(s[i])||t.style&&Re(t.style[i])||Uc(i,e)||((o=n==null?void 0:n.getValue(i))==null?void 0:o.liveStyle)!==void 0)&&(r[i]=s[i]);return r}const ph=Yc({scrapeMotionValuesFromProps:go,createRenderState:ho});function qc(e,t,n){const s=go(e,t,n);for(const r in e)if(Re(e[r])||Re(t[r])){const o=Jt.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[o]=e[r]}return s}const gh=Yc({scrapeMotionValuesFromProps:qc,createRenderState:Gc}),yh=Symbol.for("motionComponentSymbol");function Lt(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function xh(e,t,n){return C.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):Lt(n)&&(n.current=s))},[t])}const yo=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bh="framerAppearId",Xc="data-"+yo(bh),Jc=C.createContext({});function vh(e,t,n,s,r){var m,b;const{visualElement:o}=C.useContext(us),i=C.useContext(Bc),a=C.useContext(ds),c=C.useContext(co).reducedMotion,d=C.useRef(null);s=s||i.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:o,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:c}));const u=d.current,f=C.useContext(Jc);u&&!u.projection&&r&&(u.type==="html"||u.type==="svg")&&wh(d.current,n,r,f);const h=C.useRef(!1);C.useInsertionEffect(()=>{u&&h.current&&u.update(n,a)});const g=n[Xc],x=C.useRef(!!g&&!((m=window.MotionHandoffIsComplete)!=null&&m.call(window,g))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,g)));return Ya(()=>{u&&(h.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),x.current&&u.animationState&&u.animationState.animateChanges())}),C.useEffect(()=>{u&&(!x.current&&u.animationState&&u.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)==null||k.call(window,g)}),x.current=!1),u.enteringChildren=void 0)}),u}function wh(e,t,n,s){const{layoutId:r,layout:o,drag:i,dragConstraints:a,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Qc(e.parent)),e.projection.setOptions({layoutId:r,layout:o,alwaysMeasureLayout:!!i||a&&Lt(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:c,layoutRoot:d})}function Qc(e){if(e)return e.options.allowProjection!==!1?e.projection:Qc(e.parent)}function $s(e,{forwardMotionProps:t=!1}={},n,s){n&&Kf(n);const r=mo(e)?gh:ph;function o(a,c){let d;const u={...C.useContext(co),...a,layoutId:Sh(a)},{isStatic:f}=u,h=Qf(a),g=r(a,f);if(!f&&_r){Ch(u,n);const x=kh(u);d=x.MeasureLayout,h.visualElement=vh(e,g,u,s,x.ProjectionNode)}return l.jsxs(us.Provider,{value:h,children:[d&&h.visualElement?l.jsx(d,{visualElement:h.visualElement,...u}):null,fh(e,a,xh(g,h.visualElement,c),g,f,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=C.forwardRef(o);return i[yh]=e,i}function Sh({layoutId:e}){const t=C.useContext(Or).id;return t&&e!==void 0?t+"-"+e:e}function Ch(e,t){const n=C.useContext(Bc).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?qt(!1,s,"lazy-strict-mode"):ot(!1,s,"lazy-strict-mode")}}function kh(e){const{drag:t,layout:n}=Gt;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Th(e,t){if(typeof Proxy>"u")return $s;const n=new Map,s=(o,i)=>$s(o,i,e,t),r=(o,i)=>(process.env.NODE_ENV!=="production"&&Zr(!1,"motion() is deprecated. Use motion.create() instead."),s(o,i));return new Proxy(r,{get:(o,i)=>i==="create"?s:(n.has(i)||n.set(i,$s(i,void 0,e,t)),n.get(i))})}function el({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function Eh({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ah(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Fs(e){return e===void 0||e===1}function vr({scale:e,scaleX:t,scaleY:n}){return!Fs(e)||!Fs(t)||!Fs(n)}function bt(e){return vr(e)||tl(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tl(e){return li(e.x)||li(e.y)}function li(e){return e&&e!=="0%"}function rs(e,t,n){const s=e-n,r=t*s;return n+r}function di(e,t,n,s,r){return r!==void 0&&(e=rs(e,r,s)),rs(e,n,s)+t}function wr(e,t=0,n=1,s,r){e.min=di(e.min,t,n,s,r),e.max=di(e.max,t,n,s,r)}function nl(e,{x:t,y:n}){wr(e.x,t.translate,t.scale,t.originPoint),wr(e.y,n.translate,n.scale,n.originPoint)}const ui=.999999999999,fi=1.0000000000001;function jh(e,t,n,s=!1){const r=n.length;if(!r)return;t.x=t.y=1;let o,i;for(let a=0;a<r;a++){o=n[a],i=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Bt(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,nl(e,i)),s&&bt(o.latestValues)&&Bt(e,o.latestValues))}t.x<fi&&t.x>ui&&(t.x=1),t.y<fi&&t.y>ui&&(t.y=1)}function _t(e,t){e.min=e.min+t,e.max=e.max+t}function hi(e,t,n,s,r=.5){const o=we(e.min,e.max,r);wr(e,t,n,o,s)}function Bt(e,t){hi(e.x,t.x,t.scaleX,t.scale,t.originX),hi(e.y,t.y,t.scaleY,t.scale,t.originY)}function sl(e,t){return el(Ah(e.getBoundingClientRect(),t))}function Mh(e,t,n){const s=sl(e,n),{scroll:r}=t;return r&&(_t(s.x,r.offset.x),_t(s.y,r.offset.y)),s}const mi=()=>({translate:0,scale:1,origin:0,originPoint:0}),zt=()=>({x:mi(),y:mi()}),pi=()=>({min:0,max:0}),Te=()=>({x:pi(),y:pi()}),Sr={current:null},rl={current:!1};function Ph(){if(rl.current=!0,!!_r)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Sr.current=e.matches;e.addEventListener("change",t),t()}else Sr.current=!1}const Vh=new WeakMap;function Nh(e,t,n){for(const s in t){const r=t[s],o=n[s];if(Re(r))e.addValue(s,r);else if(Re(o))e.addValue(s,Wt(r,{owner:e}));else if(o!==r)if(e.hasValue(s)){const i=e.getValue(s);i.liveStyle===!0?i.jump(r):i.hasAnimated||i.set(r)}else{const i=e.getStaticValue(s);e.addValue(s,Wt(i!==void 0?i:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const gi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Rh{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=so,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=Fe.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,xe.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!o,this.isControllingVariants=hs(n),this.isVariantNode=Hc(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const g=f[h];c[h]!==void 0&&Re(g)&&g.set(c[h])}}mount(t){var n;this.current=t,Vh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),rl.current||Ph(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Sr.current,process.env.NODE_ENV!=="production"&&Zr(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),ut(this.notifyUpdate),ut(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Qt.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&xe.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Gt){const n=Gt[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<gi.length;s++){const r=gi[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const o="on"+r,i=t[o];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=Nh(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=Wt(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(qa(s)||Ja(s))?s=parseFloat(s):!Hf(s)&&ft.test(n)&&(s=Rc(t,n)),this.setBaseTarget(t,Re(s)?s.get():s)),Re(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const i=po(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);i&&(s=i[t])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Re(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ur),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){io.render(this.render)}}class ol extends Rh{constructor(){super(...arguments),this.KeyframeResolver=Vf}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Re(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function il(e,{style:t,vars:n},s,r){const o=e.style;let i;for(i in t)o[i]=t[i];r==null||r.applyProjectionStyles(o,s);for(i in n)o.setProperty(i,n[i])}function Ih(e){return window.getComputedStyle(e)}class Dh extends ol{constructor(){super(...arguments),this.type="html",this.renderInstance=il}readValueFromInstance(t,n){var s;if(Qt.has(n))return(s=this.projection)!=null&&s.isProjecting?hr(n):Ku(t,n);{const r=Ih(t),o=(Kr(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return sl(t,n)}build(t,n,s){fo(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return go(t,n,s)}}const al=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function $h(e,t,n,s){il(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(al.has(r)?r:yo(r),t.attrs[r])}class Fh extends ol{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Te}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Qt.has(n)){const s=Nc(n);return s&&s.default||0}return n=al.has(n)?n:yo(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return qc(t,n,s)}build(t,n,s){Wc(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){$h(t,n,s,r)}mount(t){this.isSVGTag=Kc(t.tagName),super.mount(t)}}const Oh=(e,t)=>mo(e)?new Fh(t):new Dh(t,{allowProjection:e!==C.Fragment});function Ut(e,t,n){const s=e.getProps();return po(s,t,n!==void 0?n:s.custom,e)}const Cr=e=>Array.isArray(e);function Lh(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Wt(n))}function _h(e){return Cr(e)?e[e.length-1]||0:e}function Bh(e,t){const n=Ut(e,t);let{transitionEnd:s={},transition:r={},...o}=n||{};o={...o,...s};for(const i in o){const a=_h(o[i]);Lh(e,i,a)}}function zh(e){return!!(Re(e)&&e.add)}function kr(e,t){const n=e.getValue("willChange");if(zh(n))return n.add(t);if(!n&&it.WillChange){const s=new it.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function cl(e){return e.props[Xc]}const Hh=e=>e!==null;function Uh(e,{repeat:t,repeatType:n="loop"},s){const r=e.filter(Hh),o=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[o]}const Zh={type:"spring",stiffness:500,damping:25,restSpeed:10},Wh=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Gh={type:"keyframes",duration:.8},Kh={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Yh=(e,{keyframes:t})=>t.length>2?Gh:Qt.has(e)?e.startsWith("scale")?Wh(t[1]):Zh:Kh;function qh({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:o,repeatType:i,repeatDelay:a,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const xo=(e,t,n,s={},r,o)=>i=>{const a=ro(s,e)||{},c=a.delay||s.delay||0;let{elapsed:d=0}=s;d=d-Ke(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-d,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{i(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:r};qh(a)||Object.assign(u,Yh(e,u)),u.duration&&(u.duration=Ke(u.duration)),u.repeatDelay&&(u.repeatDelay=Ke(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(xr(u),u.delay===0&&(f=!0)),(it.instantAnimations||it.skipAnimations)&&(f=!0,xr(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const h=Uh(u.keyframes,a);if(h!==void 0){xe.update(()=>{u.onUpdate(h),u.onComplete()});return}}return a.isSync?new no(u):new xf(u)};function Xh({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function ll(e,t,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:i,...a}=t;s&&(o=s);const c=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const u in a){const f=e.getValue(u,e.latestValues[u]??null),h=a[u];if(h===void 0||d&&Xh(d,u))continue;const g={delay:n,...ro(o||{},u)},x=f.get();if(x!==void 0&&!f.isAnimating&&!Array.isArray(h)&&h===x&&!g.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const k=cl(e);if(k){const v=window.MotionHandoffAnimation(k,u,xe);v!==null&&(g.startTime=v,m=!0)}}kr(e,u),f.start(xo(u,f,h,e.shouldReduceMotion&&Mc.has(u)?{type:!1}:g,e,m));const b=f.animation;b&&c.push(b)}return i&&Promise.all(c).then(()=>{xe.update(()=>{i&&Bh(e,i)})}),c}function dl(e,t,n,s=0,r=1){const o=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),i=e.size,a=(i-1)*s;return typeof n=="function"?n(o,i):r===1?o*s:a-o*s}function Tr(e,t,n={}){var c;const s=Ut(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(ll(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:h}=r;return Jh(e,t,d,u,f,h,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[d,u]=a==="beforeChildren"?[o,i]:[i,o];return d().then(()=>u())}else return Promise.all([o(),i(n.delay)])}function Jh(e,t,n=0,s=0,r=0,o=1,i){const a=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),a.push(Tr(c,t,{...i,delay:n+(typeof s=="function"?0:s)+dl(e.variantChildren,c,s,r,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(a)}function Qh(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const r=t.map(o=>Tr(e,o,n));s=Promise.all(r)}else if(typeof t=="string")s=Tr(e,t,n);else{const r=typeof t=="function"?Ut(e,t,n.custom):t;s=Promise.all(ll(e,r,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function ul(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const em=uo.length;function fl(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?fl(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<em;n++){const s=uo[n],r=e.props[s];(wn(r)||r===!1)&&(t[s]=r)}return t}const tm=[...lo].reverse(),nm=lo.length;function sm(e){return t=>Promise.all(t.map(({animation:n,options:s})=>Qh(e,n,s)))}function rm(e){let t=sm(e),n=yi(),s=!0;const r=c=>(d,u)=>{var h;const f=Ut(e,u,c==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(f){const{transition:g,transitionEnd:x,...m}=f;d={...d,...m,...x}}return d};function o(c){t=c(e)}function i(c){const{props:d}=e,u=fl(e.parent)||{},f=[],h=new Set;let g={},x=1/0;for(let b=0;b<nm;b++){const k=tm[b],v=n[k],T=d[k]!==void 0?d[k]:u[k],w=wn(T),S=k===c?v.isActive:null;S===!1&&(x=b);let A=T===u[k]&&T!==d[k]&&w;if(A&&s&&e.manuallyAnimateOnMount&&(A=!1),v.protectedKeys={...g},!v.isActive&&S===null||!T&&!v.prevProp||fs(T)||typeof T=="boolean")continue;const M=om(v.prevProp,T);let j=M||k===c&&v.isActive&&!A&&w||b>x&&w,z=!1;const y=Array.isArray(T)?T:[T];let D=y.reduce(r(k),{});S===!1&&(D={});const{prevResolvedValues:_={}}=v,J={..._,...D},ne=K=>{j=!0,h.has(K)&&(z=!0,h.delete(K)),v.needsAnimating[K]=!0;const R=e.getValue(K);R&&(R.liveStyle=!1)};for(const K in J){const R=D[K],X=_[K];if(g.hasOwnProperty(K))continue;let V=!1;Cr(R)&&Cr(X)?V=!ul(R,X):V=R!==X,V?R!=null?ne(K):h.add(K):R!==void 0&&h.has(K)?ne(K):v.protectedKeys[K]=!0}v.prevProp=T,v.prevResolvedValues=D,v.isActive&&(g={...g,...D}),s&&e.blockInitialAnimation&&(j=!1);const Q=A&&M;j&&(!Q||z)&&f.push(...y.map(K=>{const R={type:k};if(typeof K=="string"&&s&&!Q&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,V=Ut(X,K);if(X.enteringChildren&&V){const{delayChildren:U}=V.transition||{};R.delay=dl(X.enteringChildren,e,U)}}return{animation:K,options:R}}))}if(h.size){const b={};if(typeof d.initial!="boolean"){const k=Ut(e,Array.isArray(d.initial)?d.initial[0]:d.initial);k&&k.transition&&(b.transition=k.transition)}h.forEach(k=>{const v=e.getBaseTarget(k),T=e.getValue(k);T&&(T.liveStyle=!0),b[k]=v??null}),f.push({animation:b})}let m=!!f.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(m=!1),s=!1,m?t(f):Promise.resolve()}function a(c,d){var f;if(n[c].isActive===d)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(h=>{var g;return(g=h.animationState)==null?void 0:g.setActive(c,d)}),n[c].isActive=d;const u=i(c);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:i,setActive:a,setAnimateFunction:o,getState:()=>n,reset:()=>{n=yi(),s=!0}}}function om(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!ul(t,e):!1}function yt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yi(){return{animate:yt(!0),whileInView:yt(),whileHover:yt(),whileTap:yt(),whileDrag:yt(),whileFocus:yt(),exit:yt()}}class pt{constructor(t){this.isMounted=!1,this.node=t}update(){}}class im extends pt{constructor(t){super(t),t.animationState||(t.animationState=rm(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fs(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let am=0;class cm extends pt{constructor(){super(...arguments),this.id=am++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const lm={animation:{Feature:im},exit:{Feature:cm}};function Cn(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function jn(e){return{point:{x:e.pageX,y:e.pageY}}}const dm=e=>t=>ao(t)&&e(t,jn(t));function hn(e,t,n,s){return Cn(e,t,dm(n),s)}const hl=1e-4,um=1-hl,fm=1+hl,ml=.01,hm=0-ml,mm=0+ml;function $e(e){return e.max-e.min}function pm(e,t,n){return Math.abs(e-t)<=n}function xi(e,t,n,s=.5){e.origin=s,e.originPoint=we(t.min,t.max,e.origin),e.scale=$e(n)/$e(t),e.translate=we(n.min,n.max,e.origin)-e.originPoint,(e.scale>=um&&e.scale<=fm||isNaN(e.scale))&&(e.scale=1),(e.translate>=hm&&e.translate<=mm||isNaN(e.translate))&&(e.translate=0)}function mn(e,t,n,s){xi(e.x,t.x,n.x,s?s.originX:void 0),xi(e.y,t.y,n.y,s?s.originY:void 0)}function bi(e,t,n){e.min=n.min+t.min,e.max=e.min+$e(t)}function gm(e,t,n){bi(e.x,t.x,n.x),bi(e.y,t.y,n.y)}function vi(e,t,n){e.min=t.min-n.min,e.max=e.min+$e(t)}function pn(e,t,n){vi(e.x,t.x,n.x),vi(e.y,t.y,n.y)}function ze(e){return[e("x"),e("y")]}const pl=({current:e})=>e?e.ownerDocument.defaultView:null,wi=(e,t)=>Math.abs(e-t);function ym(e,t){const n=wi(e.x,t.x),s=wi(e.y,t.y);return Math.sqrt(n**2+s**2)}class gl{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Ls(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=ym(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:m}=h,{timestamp:b}=Pe;this.history.push({...m,timestamp:b});const{onStart:k,onMove:v}=this.handlers;g||(k&&k(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,h)},this.handlePointerMove=(h,g)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Os(g,this.transformPagePoint),xe.update(this.updatePoint,!0)},this.handlePointerUp=(h,g)=>{this.end();const{onEnd:x,onSessionEnd:m,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Ls(h.type==="pointercancel"?this.lastMoveEventInfo:Os(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(h,k),m&&m(h,k)},!ao(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=i,this.contextWindow=r||window;const a=jn(t),c=Os(a,this.transformPagePoint),{point:d}=c,{timestamp:u}=Pe;this.history=[{...d,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Ls(c,this.history)),this.removeListeners=Tn(hn(this.contextWindow,"pointermove",this.handlePointerMove),hn(this.contextWindow,"pointerup",this.handlePointerUp),hn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ut(this.updatePoint)}}function Os(e,t){return t?{point:t(e.point)}:e}function Si(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ls({point:e},t){return{point:e,delta:Si(e,yl(t)),offset:Si(e,xm(t)),velocity:bm(t,.1)}}function xm(e){return e[0]}function yl(e){return e[e.length-1]}function bm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=yl(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>Ke(t)));)n--;if(!s)return{x:0,y:0};const o=Xe(r.timestamp-s.timestamp);if(o===0)return{x:0,y:0};const i={x:(r.x-s.x)/o,y:(r.y-s.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function vm(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?we(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?we(n,e,s.max):Math.min(e,n)),e}function Ci(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function wm(e,{top:t,left:n,bottom:s,right:r}){return{x:Ci(e.x,n,r),y:Ci(e.y,t,s)}}function ki(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function Sm(e,t){return{x:ki(e.x,t.x),y:ki(e.y,t.y)}}function Cm(e,t){let n=.5;const s=$e(e),r=$e(t);return r>s?n=xn(t.min,t.max-s,e.min):s>r&&(n=xn(e.min,e.max-r,t.min)),rt(0,1,n)}function km(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Er=.35;function Tm(e=Er){return e===!1?e=0:e===!0&&(e=Er),{x:Ti(e,"left","right"),y:Ti(e,"top","bottom")}}function Ti(e,t,n){return{min:Ei(e,t),max:Ei(e,n)}}function Ei(e,t){return typeof e=="number"?e:e[t]||0}const Em=new WeakMap;class Am{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Te(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=f=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(jn(f).point)},i=(f,h)=>{const{drag:g,dragPropagation:x,onDragStart:m}=this.getProps();if(g&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Df(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ze(k=>{let v=this.getAxisMotionValue(k).get()||0;if(Je.test(v)){const{projection:T}=this.visualElement;if(T&&T.layout){const w=T.layout.layoutBox[k];w&&(v=$e(w)*(parseFloat(v)/100))}}this.originPoint[k]=v}),m&&xe.postRender(()=>m(f,h)),kr(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:g,dragDirectionLock:x,onDirectionLock:m,onDrag:b}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:k}=h;if(x&&this.currentDirection===null){this.currentDirection=jm(k),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,k),this.updateAxis("y",h.point,k),this.visualElement.render(),b&&b(f,h)},c=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>ze(f=>{var h;return this.getAnimationState(f)==="paused"&&((h=this.getAxisMotionValue(f).animation)==null?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new gl(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:pl(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!s)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&xe.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:r}=this.getProps();if(!s||!On(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(i=vm(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,r=this.constraints;t&&Lt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=wm(s.layoutBox,t):this.constraints=!1,this.elastic=Tm(n),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&ze(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=km(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Lt(t))return!1;const s=t.current;ot(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=Mh(s,r.root,this.visualElement.getTransformPagePoint());let i=Sm(r.layout.layoutBox,o);if(n){const a=n(Eh(i));this.hasMutatedConstraints=!!a,a&&(i=el(a))}return i}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},d=ze(u=>{if(!On(u,n,this.currentDirection))return;let f=c&&c[u]||{};i&&(f={min:0,max:0});const h=r?200:1e6,g=r?40:1e7,x={type:"inertia",velocity:s?t[u]:0,bounceStiffness:h,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(u,x)});return Promise.all(d).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return kr(this.visualElement,t),s.start(xo(t,s,0,n,this.visualElement,!1))}stopAnimation(){ze(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ze(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){ze(n=>{const{drag:s}=this.getProps();if(!On(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(n);if(r&&r.layout){const{min:i,max:a}=r.layout.layoutBox[n];o.set(t[n]-we(i,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Lt(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};ze(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const c=a.get();r[i]=Cm({min:c,max:c},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),ze(i=>{if(!On(i,t,null))return;const a=this.getAxisMotionValue(i),{min:c,max:d}=this.constraints[i];a.set(we(c,d,r[i]))})}addListeners(){if(!this.visualElement.current)return;Em.set(this.visualElement,this);const t=this.visualElement.current,n=hn(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Lt(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,o=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),xe.read(s);const i=Cn(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(ze(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{i(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=Er,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function On(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function jm(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Mm extends pt{constructor(t){super(t),this.removeGroupControls=Ze,this.removeListeners=Ze,this.controls=new Am(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ze}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ai=e=>(t,n)=>{e&&xe.postRender(()=>e(t,n))};class Pm extends pt{constructor(){super(...arguments),this.removePointerDownListener=Ze}onPointerDown(t){this.session=new gl(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:pl(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ai(t),onStart:Ai(n),onMove:s,onEnd:(o,i)=>{delete this.session,r&&xe.postRender(()=>r(o,i))}}}mount(){this.removePointerDownListener=hn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const qn={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ji(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const on={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=ji(e,t.target.x),s=ji(e,t.target.y);return`${n}% ${s}%`}},Vm={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,r=ft.parse(e);if(r.length>5)return s;const o=ft.createTransformer(e),i=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,c=n.y.scale*t.y;r[0+i]/=a,r[1+i]/=c;const d=we(a,c,.5);return typeof r[2+i]=="number"&&(r[2+i]/=d),typeof r[3+i]=="number"&&(r[3+i]/=d),o(r)}};let _s=!1;class Nm extends C.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:o}=t;eh(Rm),o&&(n.group&&n.group.add(o),s&&s.register&&r&&s.register(o),_s&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),qn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:o}=this.props,{projection:i}=s;return i&&(i.isPresent=o,_s=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||xe.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),io.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;_s=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function xl(e){const[t,n]=_c(),s=C.useContext(Or);return l.jsx(Nm,{...e,layoutGroup:s,switchLayoutGroup:C.useContext(Jc),isPresent:t,safeToRemove:n})}const Rm={borderRadius:{...on,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomLeftRadius:on,borderBottomRightRadius:on,boxShadow:Vm};function Im(e,t,n){const s=Re(e)?e:Wt(e);return s.start(xo("",s,t,n)),s.animation}const Dm=(e,t)=>e.depth-t.depth;class $m{constructor(){this.children=[],this.isDirty=!1}add(t){Br(this.children,t),this.isDirty=!0}remove(t){zr(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Dm),this.isDirty=!1,this.children.forEach(t)}}function Fm(e,t){const n=Fe.now(),s=({timestamp:r})=>{const o=r-n;o>=t&&(ut(s),e(o-t))};return xe.setup(s,!0),()=>ut(s)}const bl=["TopLeft","TopRight","BottomLeft","BottomRight"],Om=bl.length,Mi=e=>typeof e=="string"?parseFloat(e):e,Pi=e=>typeof e=="number"||ee.test(e);function Lm(e,t,n,s,r,o){r?(e.opacity=we(0,n.opacity??1,_m(s)),e.opacityExit=we(t.opacity??1,0,Bm(s))):o&&(e.opacity=we(t.opacity??1,n.opacity??1,s));for(let i=0;i<Om;i++){const a=`border${bl[i]}Radius`;let c=Vi(t,a),d=Vi(n,a);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Pi(c)===Pi(d)?(e[a]=Math.max(we(Mi(c),Mi(d),s),0),(Je.test(d)||Je.test(c))&&(e[a]+="%")):e[a]=d}(t.rotate||n.rotate)&&(e.rotate=we(t.rotate||0,n.rotate||0,s))}function Vi(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const _m=vl(0,.5,ic),Bm=vl(.5,.95,Ze);function vl(e,t,n){return s=>s<e?0:s>t?1:n(xn(e,t,s))}function Ni(e,t){e.min=t.min,e.max=t.max}function Be(e,t){Ni(e.x,t.x),Ni(e.y,t.y)}function Ri(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Ii(e,t,n,s,r){return e-=t,e=rs(e,1/n,s),r!==void 0&&(e=rs(e,1/r,s)),e}function zm(e,t=0,n=1,s=.5,r,o=e,i=e){if(Je.test(t)&&(t=parseFloat(t),t=we(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=we(o.min,o.max,s);e===o&&(a-=t),e.min=Ii(e.min,t,n,a,r),e.max=Ii(e.max,t,n,a,r)}function Di(e,t,[n,s,r],o,i){zm(e,t[n],t[s],t[r],t.scale,o,i)}const Hm=["x","scaleX","originX"],Um=["y","scaleY","originY"];function $i(e,t,n,s){Di(e.x,t,Hm,n?n.x:void 0,s?s.x:void 0),Di(e.y,t,Um,n?n.y:void 0,s?s.y:void 0)}function Fi(e){return e.translate===0&&e.scale===1}function wl(e){return Fi(e.x)&&Fi(e.y)}function Oi(e,t){return e.min===t.min&&e.max===t.max}function Zm(e,t){return Oi(e.x,t.x)&&Oi(e.y,t.y)}function Li(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Sl(e,t){return Li(e.x,t.x)&&Li(e.y,t.y)}function _i(e){return $e(e.x)/$e(e.y)}function Bi(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class Wm{constructor(){this.members=[]}add(t){Br(this.members,t),t.scheduleRender()}remove(t){if(zr(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let s;for(let r=n;r>=0;r--){const o=this.members[r];if(o.isPresent!==!1){s=o;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Gm(e,t,n){let s="";const r=e.x.translate/t.x,o=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((r||o||i)&&(s=`translate3d(${r}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:f,rotateY:h,skewX:g,skewY:x}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),g&&(s+=`skewX(${g}deg) `),x&&(s+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,c=e.y.scale*t.y;return(a!==1||c!==1)&&(s+=`scale(${a}, ${c})`),s||"none"}const Bs=["","X","Y","Z"],Km=1e3;let Ym=0;function zs(e,t,n,s){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),s&&(s[e]=0))}function Cl(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cl(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",xe,!(r||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Cl(s)}function kl({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(i={},a=t==null?void 0:t()){this.id=Ym++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Jm),this.nodes.forEach(np),this.nodes.forEach(sp),this.nodes.forEach(Qm)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new $m)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Ur),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const c=this.eventHandlers.get(i);c&&c.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Lc(i)&&!Bf(i),this.instance=i;const{layoutId:a,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),e){let u,f=0;const h=()=>this.root.updateBlockedByResize=!1;xe.read(()=>{f=window.innerWidth}),e(i,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,u&&u(),u=Fm(h,250),qn.hasAnimatedSinceResize&&(qn.hasAnimatedSinceResize=!1,this.nodes.forEach(Ui)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&d&&(a||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||cp,{onLayoutAnimationStart:m,onLayoutAnimationComplete:b}=d.getProps(),k=!this.targetLayout||!Sl(this.targetLayout,g),v=!f&&h;if(this.options.layoutRoot||this.resumeFrom||v||f&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...ro(x,"layout"),onPlay:m,onComplete:b};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(u,v)}else f||Ui(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ut(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rp),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Cl(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(zi);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Hi);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(tp),this.nodes.forEach(qm),this.nodes.forEach(Xm)):this.nodes.forEach(Hi),this.clearAllSnapshots();const a=Fe.now();Pe.delta=rt(0,1e3/60,a-Pe.timestamp),Pe.timestamp=a,Pe.isProcessing=!0,Ps.update.process(Pe),Ps.preRender.process(Pe),Ps.render.process(Pe),Pe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,io.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ep),this.sharedNodes.forEach(op)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$e(this.snapshot.measuredBox.x)&&!$e(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Te(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!wl(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;i&&this.instance&&(a||bt(this.latestValues)||u)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return i&&(c=this.removeTransform(c)),lp(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:i}=this.options;if(!i)return Te();const a=i.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(dp))){const{scroll:u}=this.root;u&&(_t(a.x,u.offset.x),_t(a.y,u.offset.y))}return a}removeElementScroll(i){var c;const a=Te();if(Be(a,i),(c=this.scroll)!=null&&c.wasRoot)return a;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:f,options:h}=u;u!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Be(a,i),_t(a.x,f.offset.x),_t(a.y,f.offset.y))}return a}applyTransform(i,a=!1){const c=Te();Be(c,i);for(let d=0;d<this.path.length;d++){const u=this.path[d];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Bt(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),bt(u.latestValues)&&Bt(c,u.latestValues)}return bt(this.latestValues)&&Bt(c,this.latestValues),c}removeTransform(i){const a=Te();Be(a,i);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!bt(d.latestValues))continue;vr(d.latestValues)&&d.updateSnapshot();const u=Te(),f=d.measurePageBox();Be(u,f),$i(a,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return bt(this.latestValues)&&$i(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var h;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:f}=this.options;if(!(!this.layout||!(u||f))){if(this.resolvedRelativeTargetAt=Pe.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),pn(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Be(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Te(),this.targetWithTransforms=Te()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gm(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Be(this.target,this.layout.layoutBox),nl(this.target,this.targetDelta)):Be(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),pn(this.relativeTargetOrigin,this.target,g.target),Be(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||vr(this.parent.latestValues)||tl(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var x;const i=this.getLead(),a=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Pe.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;Be(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,h=this.treeScale.y;jh(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Te());const{target:g}=i;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ri(this.prevProjectionDelta.x,this.projectionDelta.x),Ri(this.prevProjectionDelta.y,this.projectionDelta.y)),mn(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==h||!Bi(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bi(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=zt(),this.projectionDelta=zt(),this.projectionDeltaWithTransform=zt()}setAnimationOrigin(i,a=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},f=zt();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const h=Te(),g=c?c.source:void 0,x=this.layout?this.layout.source:void 0,m=g!==x,b=this.getStack(),k=!b||b.members.length<=1,v=!!(m&&!k&&this.options.crossfade===!0&&!this.path.some(ap));this.animationProgress=0;let T;this.mixTargetDelta=w=>{const S=w/1e3;Zi(f.x,i.x,S),Zi(f.y,i.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pn(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ip(this.relativeTarget,this.relativeTargetOrigin,h,S),T&&Zm(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Te()),Be(T,this.relativeTarget)),m&&(this.animationValues=u,Lm(u,d,this.latestValues,S,v,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var a,c,d;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(ut(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xe.update(()=>{qn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Wt(0)),this.currentAnimation=Im(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),i.onUpdate&&i.onUpdate(u)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Km),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:c,layout:d,latestValues:u}=i;if(!(!a||!c||!d)){if(this!==i&&this.layout&&d&&Tl(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Te();const f=$e(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+f;const h=$e(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+h}Be(a,c),Bt(a,u),mn(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new Wm),this.sharedNodes.get(i).add(a);const d=a.options.initialPromotionConfig;a.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var a;const{layoutId:i}=this.options;return i?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:i}=this.options;return i?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const d={};c.z&&zs("z",i,d,this.animationValues);for(let u=0;u<Bs.length;u++)zs(`rotate${Bs[u]}`,i,d,this.animationValues),zs(`skew${Bs[u]}`,i,d,this.animationValues);i.render();for(const u in d)i.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=Yn(a==null?void 0:a.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=Yn(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!bt(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=Gm(this.projectionDeltaWithTransform,this.treeScale,u);c&&(f=c(u,f)),i.transform=f;const{x:h,y:g}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${g.origin*100}% 0`,d.animationValues?i.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const x in Sn){if(u[x]===void 0)continue;const{correct:m,applyTo:b,isCSSVariable:k}=Sn[x],v=f==="none"?u[x]:m(u[x],d);if(b){const T=b.length;for(let w=0;w<T;w++)i[b[w]]=v}else k?this.options.visualElement.renderState.vars[x]=v:i[x]=v}this.options.layoutId&&(i.pointerEvents=d===this?Yn(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var a;return(a=i.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(zi),this.root.sharedNodes.clear()}}}function qm(e){e.updateLayout()}function Xm(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:o}=e.options,i=t.source!==e.layout.source;o==="size"?ze(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],g=$e(h);h.min=s[f].min,h.max=h.min+g}):Tl(o,t.layoutBox,s)&&ze(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],g=$e(s[f]);h.max=h.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+g)});const a=zt();mn(a,s,t.layoutBox);const c=zt();i?mn(c,e.applyTransform(r,!0),t.measuredBox):mn(c,s,t.layoutBox);const d=!wl(a);let u=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:g}=f;if(h&&g){const x=Te();pn(x,t.layoutBox,h.layoutBox);const m=Te();pn(m,s,g.layoutBox),Sl(x,m)||(u=!0),f.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=x,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:a,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function Jm(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Qm(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ep(e){e.clearSnapshot()}function zi(e){e.clearMeasurements()}function Hi(e){e.isLayoutDirty=!1}function tp(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ui(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function np(e){e.resolveTargetDelta()}function sp(e){e.calcProjection()}function rp(e){e.resetSkewAndRotation()}function op(e){e.removeLeadSnapshot()}function Zi(e,t,n){e.translate=we(t.translate,0,n),e.scale=we(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Wi(e,t,n,s){e.min=we(t.min,n.min,s),e.max=we(t.max,n.max,s)}function ip(e,t,n,s){Wi(e.x,t.x,n.x,s),Wi(e.y,t.y,n.y,s)}function ap(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const cp={duration:.45,ease:[.4,0,.1,1]},Gi=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ki=Gi("applewebkit/")&&!Gi("chrome/")?Math.round:Ze;function Yi(e){e.min=Ki(e.min),e.max=Ki(e.max)}function lp(e){Yi(e.x),Yi(e.y)}function Tl(e,t,n){return e==="position"||e==="preserve-aspect"&&!pm(_i(t),_i(n),.2)}function dp(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const up=kl({attachResizeListener:(e,t)=>Cn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Hs={current:void 0},El=kl({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Hs.current){const e=new up({});e.mount(window),e.setOptions({layoutScroll:!0}),Hs.current=e}return Hs.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),fp={pan:{Feature:Pm},drag:{Feature:Mm,ProjectionNode:El,MeasureLayout:xl}};function qi(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,o=s[r];o&&xe.postRender(()=>o(t,jn(t)))}class hp extends pt{mount(){const{current:t}=this.node;t&&(this.unmount=$f(t,(n,s)=>(qi(this.node,s,"Start"),r=>qi(this.node,r,"End"))))}unmount(){}}class mp extends pt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Tn(Cn(this.node.current,"focus",()=>this.onFocus()),Cn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Xi(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),o=s[r];o&&xe.postRender(()=>o(t,jn(t)))}class pp extends pt{mount(){const{current:t}=this.node;t&&(this.unmount=_f(t,(n,s)=>(Xi(this.node,s,"Start"),(r,{success:o})=>Xi(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ar=new WeakMap,Us=new WeakMap,gp=e=>{const t=Ar.get(e.target);t&&t(e)},yp=e=>{e.forEach(gp)};function xp({root:e,...t}){const n=e||document;Us.has(n)||Us.set(n,{});const s=Us.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(yp,{root:e,...t})),s[r]}function bp(e,t,n){const s=xp(t);return Ar.set(e,n),s.observe(e),()=>{Ar.delete(e),s.unobserve(e)}}const vp={some:0,all:1};class wp extends pt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:vp[r]},a=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),h=d?u:f;h&&h(c)};return bp(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Sp(t,n))&&this.startObserver()}unmount(){}}function Sp({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Cp={inView:{Feature:wp},tap:{Feature:pp},focus:{Feature:mp},hover:{Feature:hp}},kp={layout:{ProjectionNode:El,MeasureLayout:xl}},Tp={...lm,...Cp,...fp,...kp},ie=Th(Tp,Oh),bo="-",Ep=e=>{const t=jp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const a=i.split(bo);return a[0]===""&&a.length!==1&&a.shift(),Al(a,t)||Ap(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&s[i]?[...c,...s[i]]:c}}},Al=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),r=s?Al(e.slice(1),s):void 0;if(r)return r;if(t.validators.length===0)return;const o=e.join(bo);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Ji=/^\[(.+)\]$/,Ap=e=>{if(Ji.test(e)){const t=Ji.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},jp=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const r in n)jr(n[r],s,r,t);return s},jr=(e,t,n,s)=>{e.forEach(r=>{if(typeof r=="string"){const o=r===""?t:Qi(t,r);o.classGroupId=n;return}if(typeof r=="function"){if(Mp(r)){jr(r(s),t,n,s);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([o,i])=>{jr(i,Qi(t,o),n,s)})})},Qi=(e,t)=>{let n=e;return t.split(bo).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Mp=e=>e.isThemeGetter,Pp=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const r=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,s=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=s.get(o))!==void 0)return r(o,i),i},set(o,i){n.has(o)?n.set(o,i):r(o,i)}}},Mr="!",Pr=":",Vp=Pr.length,Np=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const o=[];let i=0,a=0,c=0,d;for(let x=0;x<r.length;x++){let m=r[x];if(i===0&&a===0){if(m===Pr){o.push(r.slice(c,x)),c=x+Vp;continue}if(m==="/"){d=x;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const u=o.length===0?r:r.substring(c),f=Rp(u),h=f!==u,g=d&&d>c?d-c:void 0;return{modifiers:o,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:g}};if(t){const r=t+Pr,o=s;s=i=>i.startsWith(r)?o(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=s;s=o=>n({className:o,parseClassName:r})}return s},Rp=e=>e.endsWith(Mr)?e.substring(0,e.length-1):e.startsWith(Mr)?e.substring(1):e,Ip=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const r=[];let o=[];return s.forEach(i=>{i[0]==="["||t[i]?(r.push(...o.sort(),i),o=[]):o.push(i)}),r.push(...o.sort()),r}},Dp=e=>({cache:Pp(e.cacheSize),parseClassName:Np(e),sortModifiers:Ip(e),...Ep(e)}),$p=/\s+/,Fp=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:o}=t,i=[],a=e.trim().split($p);let c="";for(let d=a.length-1;d>=0;d-=1){const u=a[d],{isExternal:f,modifiers:h,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:m}=n(u);if(f){c=u+(c.length>0?" "+c:c);continue}let b=!!m,k=s(b?x.substring(0,m):x);if(!k){if(!b){c=u+(c.length>0?" "+c:c);continue}if(k=s(x),!k){c=u+(c.length>0?" "+c:c);continue}b=!1}const v=o(h).join(":"),T=g?v+Mr:v,w=T+k;if(i.includes(w))continue;i.push(w);const S=r(k,b);for(let A=0;A<S.length;++A){const M=S[A];i.push(T+M)}c=u+(c.length>0?" "+c:c)}return c};function Op(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=jl(t))&&(s&&(s+=" "),s+=n);return s}const jl=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=jl(e[s]))&&(n&&(n+=" "),n+=t);return n};function Lp(e,...t){let n,s,r,o=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return n=Dp(d),s=n.cache.get,r=n.cache.set,o=a,a(c)}function a(c){const d=s(c);if(d)return d;const u=Fp(c,n);return r(c,u),u}return function(){return o(Op.apply(null,arguments))}}const Me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ml=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_p=/^\d+\/\d+$/,Bp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Up=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mt=e=>_p.test(e),re=e=>!!e&&!Number.isNaN(Number(e)),ct=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&re(e.slice(0,-1)),et=e=>Bp.test(e),Wp=()=>!0,Gp=e=>zp.test(e)&&!Hp.test(e),Vl=()=>!1,Kp=e=>Up.test(e),Yp=e=>Zp.test(e),qp=e=>!W(e)&&!G(e),Xp=e=>en(e,Il,Vl),W=e=>Ml.test(e),xt=e=>en(e,Dl,Gp),Ws=e=>en(e,ng,re),ea=e=>en(e,Nl,Vl),Jp=e=>en(e,Rl,Yp),Ln=e=>en(e,$l,Kp),G=e=>Pl.test(e),an=e=>tn(e,Dl),Qp=e=>tn(e,sg),ta=e=>tn(e,Nl),eg=e=>tn(e,Il),tg=e=>tn(e,Rl),_n=e=>tn(e,$l,!0),en=(e,t,n)=>{const s=Ml.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},tn=(e,t,n=!1)=>{const s=Pl.exec(e);return s?s[1]?t(s[1]):n:!1},Nl=e=>e==="position"||e==="percentage",Rl=e=>e==="image"||e==="url",Il=e=>e==="length"||e==="size"||e==="bg-size",Dl=e=>e==="length",ng=e=>e==="number",sg=e=>e==="family-name",$l=e=>e==="shadow",rg=()=>{const e=Me("color"),t=Me("font"),n=Me("text"),s=Me("font-weight"),r=Me("tracking"),o=Me("leading"),i=Me("breakpoint"),a=Me("container"),c=Me("spacing"),d=Me("radius"),u=Me("shadow"),f=Me("inset-shadow"),h=Me("text-shadow"),g=Me("drop-shadow"),x=Me("blur"),m=Me("perspective"),b=Me("aspect"),k=Me("ease"),v=Me("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),G,W],A=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],j=()=>[G,W,c],z=()=>[Mt,"full","auto",...j()],y=()=>[ct,"none","subgrid",G,W],D=()=>["auto",{span:["full",ct,G,W]},ct,G,W],_=()=>[ct,"auto",G,W],J=()=>["auto","min","max","fr",G,W],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Q=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...j()],K=()=>[Mt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],R=()=>[e,G,W],X=()=>[...w(),ta,ea,{position:[G,W]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",eg,Xp,{size:[G,W]}],q=()=>[Zs,an,xt],P=()=>["","none","full",d,G,W],E=()=>["",re,an,xt],O=()=>["solid","dashed","dotted","double"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>[re,Zs,ta,ea],I=()=>["","none",x,G,W],H=()=>["none",re,G,W],B=()=>["none",re,G,W],oe=()=>[re,G,W],L=()=>[Mt,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[et],breakpoint:[et],color:[Wp],container:[et],"drop-shadow":[et],ease:["in","out","in-out"],font:[qp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[et],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[et],shadow:[et],spacing:["px",re],text:[et],"text-shadow":[et],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mt,W,G,b]}],container:["container"],columns:[{columns:[re,W,G,a]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[ct,"auto",G,W]}],basis:[{basis:[Mt,"full","auto",a,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[re,Mt,"auto","initial","none",W]}],grow:[{grow:["",re,G,W]}],shrink:[{shrink:["",re,G,W]}],order:[{order:[ct,"first","last","none",G,W]}],"grid-cols":[{"grid-cols":y()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":y()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...Q(),"normal"]}],"justify-self":[{"justify-self":["auto",...Q()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...Q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Q(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...Q(),"baseline"]}],"place-self":[{"place-self":["auto",...Q()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[a,"screen",...K()]}],"min-w":[{"min-w":[a,"screen","none",...K()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,an,xt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,G,Ws]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,W]}],"font-family":[{font:[Qp,W,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,G,W]}],"line-clamp":[{"line-clamp":[re,"none",G,Ws]}],leading:[{leading:[o,...j()]}],"list-image":[{"list-image":["none",G,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",G,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[re,"from-font","auto",G,xt]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[re,"auto",G,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G,W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ct,G,W],radial:["",G,W],conic:[ct,G,W]},tg,Jp]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:E()}],"border-w-x":[{"border-x":E()}],"border-w-y":[{"border-y":E()}],"border-w-s":[{"border-s":E()}],"border-w-e":[{"border-e":E()}],"border-w-t":[{"border-t":E()}],"border-w-r":[{"border-r":E()}],"border-w-b":[{"border-b":E()}],"border-w-l":[{"border-l":E()}],"divide-x":[{"divide-x":E()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":E()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[re,G,W]}],"outline-w":[{outline:["",re,an,xt]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,_n,Ln]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",f,_n,Ln]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[re,xt]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":E()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,_n,Ln]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[re,G,W]}],"mix-blend":[{"mix-blend":[...F(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":F()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[re]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[re]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",G,W]}],filter:[{filter:["","none",G,W]}],blur:[{blur:I()}],brightness:[{brightness:[re,G,W]}],contrast:[{contrast:[re,G,W]}],"drop-shadow":[{"drop-shadow":["","none",g,_n,Ln]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",re,G,W]}],"hue-rotate":[{"hue-rotate":[re,G,W]}],invert:[{invert:["",re,G,W]}],saturate:[{saturate:[re,G,W]}],sepia:[{sepia:["",re,G,W]}],"backdrop-filter":[{"backdrop-filter":["","none",G,W]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[re,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[re,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",re,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[re,G,W]}],"backdrop-invert":[{"backdrop-invert":["",re,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[re,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[re,G,W]}],"backdrop-sepia":[{"backdrop-sepia":["",re,G,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",G,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[re,"initial",G,W]}],ease:[{ease:["linear","initial",k,G,W]}],delay:[{delay:[re,G,W]}],animate:[{animate:["none",v,G,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,G,W]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[G,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G,W]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G,W]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[re,an,xt,Ws]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},og=Lp(rg);function Y(...e){return og($r.clsx(e))}function ig(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const ag=ls.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function cg({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:Y(ag({variant:t}),e),...n})}function lg({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:Y("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function dg({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:Y("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function Pt(e){return Ka.toast.custom(t=>l.jsx(ug,{id:t,title:e.title,description:e.description}),{duration:1e4})}function ug(e){const{title:t,id:n,description:s}=e;return l.jsxs(cg,{onClick:()=>Ka.toast.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[l.jsx(Bd.WarningIcon,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx(lg,{className:"text-base font-semibold text-white mb-1",children:t}),l.jsx(dg,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}const Ye=p.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:r="1em",weight:o="regular",mirrored:i=!1,children:a,weights:c,...d}=e;return p.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...d},!!n&&p.createElement("title",null,n),a,c.get(o))});Ye.displayName="SSRBase";const fg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),p.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),vo=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:fg}));vo.displayName="CaretDownIcon";const hg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),p.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),Fl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:hg}));Fl.displayName="CaretUpIcon";const mg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),Ol=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:mg}));Ol.displayName="ChatTextIcon";const pg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),p.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Ll=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:pg}));Ll.displayName="CheckIcon";const gg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),p.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),_l=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:gg}));_l.displayName="MicrophoneIcon";const yg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),p.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),Bl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:yg}));Bl.displayName="MicrophoneSlashIcon";const xg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),p.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),zl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:xg}));zl.displayName="MonitorArrowUpIcon";const bg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),p.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),wo=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:bg}));wo.displayName="SpinnerIcon";const vg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),Hl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:vg}));Hl.displayName="VideoCameraIcon";const wg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),Ul=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:wg}));Ul.displayName="VideoCameraSlashIcon";function na(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sg(...e){return t=>{let n=!1;const s=e.map(r=>{const o=na(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():na(e[r],null)}}}}function Cg(e){const t=Tg(e),n=p.forwardRef((s,r)=>{const{children:o,...i}=s,a=p.Children.toArray(o),c=a.find(Ag);if(c){const d=c.props.children,u=a.map(f=>f===c?p.Children.count(d)>1?p.Children.only(null):p.isValidElement(d)?d.props.children:null:f);return l.jsx(t,{...i,ref:r,children:p.isValidElement(d)?p.cloneElement(d,void 0,u):null})}return l.jsx(t,{...i,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}var kg=Cg("Slot");function Tg(e){const t=p.forwardRef((n,s)=>{const{children:r,...o}=n;if(p.isValidElement(r)){const i=Mg(r),a=jg(o,r.props);return r.type!==p.Fragment&&(a.ref=s?Sg(s,i):i),p.cloneElement(r,a)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Eg=Symbol("radix.slottable");function Ag(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eg}function jg(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...a)=>{const c=o(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function Mg(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Pg=ls.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Vg({className:e,variant:t,size:n,asChild:s=!1,...r}){const o=s?kg:"button";return l.jsx(o,{"data-slot":"button",className:Y(Pg({variant:t,size:n,className:e})),...r})}function Ng({onSend:e,className:t,disabled:n,...s}){const r=C.useRef(null),[o,i]=C.useState(""),a=d=>{var u,f;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(o),i(""),(f=r.current)==null||f.focus({preventScroll:!0})},c=n||o.trim().length===0;return l.jsxs("form",{...s,onSubmit:a,className:Y("flex items-center rounded-md pl-1 text-sm",t),children:[l.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:o,onChange:d=>i(d.target.value),disabled:n}),l.jsx(Vg,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}const Rg=ls.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Zl({className:e,variant:t,size:n,...s}){return l.jsx(Wd.Root,{"data-slot":"toggle",className:Y(Rg({variant:t,size:n,className:e})),...s})}function Ig(e){const[t,n]=C.useState(()=>e.getPublishPermissions());return C.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},r=()=>{s()};return e.on("connection.connected",r),e.on("connection.disconnected",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r)}},[e]),t}function Wl(e){const[t,n]=C.useState(()=>e.getLocalParticipant()),[s,r]=C.useState(()=>e.getMicrophoneTrack());return C.useEffect(()=>{const o=()=>{const a=e.getLocalParticipant(),c=e.getMicrophoneTrack();console.log("๐ŸŽค useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!c,isMicEnabled:e.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(c)};o(),e.on("connection.connected",o),e.on("connection.disconnected",o),e.on("track.muted",o),e.on("track.unmuted",o);const i=e.getRoom();if(i){const a=()=>{console.log("๐ŸŽค Track published, updating participant state"),o()},c=()=>{console.log("๐ŸŽค Track unpublished, updating participant state"),o()};return i.on("localTrackPublished",a),i.on("localTrackUnpublished",c),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("track.muted",o),e.off("track.unmuted",o),i.off("localTrackPublished",a),i.off("localTrackUnpublished",c)}}else return()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("track.muted",o),e.off("track.unmuted",o)}},[e]),{localParticipant:t,microphoneTrack:s}}function gn(e,t,n){const[s,r]=C.useState(!1),[o,i]=C.useState(!1);return C.useEffect(()=>{const c=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),r(d)};return c(),e.on("track.muted",c),e.on("track.unmuted",c),e.on("connection.connected",c),()=>{e.off("track.muted",c),e.off("track.unmuted",c),e.off("connection.connected",c)}},[e,t]),{enabled:s,pending:o,toggle:async c=>{var d;try{i(!0);const u=c!==void 0?c:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{i(!1)}}}}function Gl(e){const[t,n]=C.useState(()=>e.getRoom()),[s,r]=C.useState(()=>e.getConnectionState());return C.useEffect(()=>{const o=()=>{n(e.getRoom()),r(e.getConnectionState())};return e.on("connection.connected",o),e.on("connection.disconnected",o),e.on("connection.connecting",o),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("connection.connecting",o)}},[e]),t}function Dg(e,t){const[n,s]=C.useState([]),[r,o]=C.useState("");return C.useEffect(()=>{var d;const a=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};a();const c=()=>{a()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",c),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",c)}},[e,t]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{t==="audioinput"?await e.setAudioInputDevice(a):await e.setVideoInputDevice(a),o(a)}catch(c){console.error("Failed to set device:",c)}}}}function $g(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:i=>{t||localStorage.setItem("voxket-audio-input-enabled",i.toString())},saveAudioInputDeviceId:i=>{t||localStorage.setItem("voxket-audio-input-device-id",i)},saveVideoInputEnabled:i=>{t||localStorage.setItem("voxket-video-input-enabled",i.toString())},saveVideoInputDeviceId:i=>{t||localStorage.setItem("voxket-video-input-device-id",i)}}}function Kl(e){const[t,n]=C.useState(()=>e.getIsAgentConnected()),[s,r]=C.useState(()=>e.getCurrentSession()),[o,i]=C.useState(()=>e.getCurrentAgentInfo()),[a,c]=C.useState(()=>e.getAgentState()),[d,u]=C.useState(()=>e.getAgentAudioTrack()),[f,h]=C.useState(()=>e.getAgentVideoTrack());return C.useEffect(()=>{const g=()=>{const T=e.getIsAgentConnected(),w=e.getCurrentSession(),S=e.getCurrentAgentInfo(),A=e.getAgentState(),M=e.getAgentAudioTrack(),j=e.getAgentVideoTrack();console.log("๐Ÿค– useVoxketVoiceAssistant: Updating state:",{isAgentConnected:T,hasSession:!!w,sessionId:w==null?void 0:w.id,hasAgentInfo:!!S,agentState:A,hasAudioTrack:!!M,hasVideoTrack:!!j}),n(T),r(w),i(S),c(A),u(M),h(j)};g();const x=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent connected event"),g()},m=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent disconnected event"),g()},b=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Session changed event"),g()},k=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Connection changed event"),g()},v=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent state changed event"),g()};return e.on("agent.connected",x),e.on("agent.speaking",x),e.on("agent.thinking",x),e.on("agent.state.changed",v),e.on("connection.disconnected",m),e.on("session.created",b),e.on("session.ended",b),e.on("session.state.changed",b),e.on("connection.connected",k),()=>{e.off("agent.connected",x),e.off("agent.speaking",x),e.off("agent.thinking",x),e.off("agent.state.changed",v),e.off("connection.disconnected",m),e.off("session.created",b),e.off("session.ended",b),e.off("session.state.changed",b),e.off("connection.connected",k)}},[e]),{agent:{isActive:t,info:o},session:s,state:a,audioTrack:d,videoTrack:f}}function Fg(e){const[t,n]=C.useState(()=>e.getVideoTrackRefs()),[s,r]=C.useState(()=>e.getCameraTrackRefs()),[o,i]=C.useState(()=>e.getScreenShareTrackRefs());return C.useEffect(()=>{const a=()=>{const d=e.getVideoTrackRefs(),u=e.getCameraTrackRefs(),f=e.getScreenShareTrackRefs();console.log("๐Ÿ“น useVoxketVideoTracks: Updating tracks:",{videoCount:d.length,cameraCount:u.length,screenShareCount:f.length}),n(d),r(u),i(f)};a(),e.on("connection.connected",a),e.on("connection.disconnected",a),e.on("track.muted",a),e.on("track.unmuted",a),e.on("participant.joined",a),e.on("participant.left",a);const c=e.getRoom();if(c){const d=()=>{console.log("๐Ÿ“น Track event, updating video tracks"),a()};return c.on("localTrackPublished",d),c.on("localTrackUnpublished",d),c.on("trackPublished",d),c.on("trackUnpublished",d),c.on("trackSubscribed",d),c.on("trackUnsubscribed",d),()=>{e.off("connection.connected",a),e.off("connection.disconnected",a),e.off("track.muted",a),e.off("track.unmuted",a),e.off("participant.joined",a),e.off("participant.left",a),c.off("localTrackPublished",d),c.off("localTrackUnpublished",d),c.off("trackPublished",d),c.off("trackUnpublished",d),c.off("trackSubscribed",d),c.off("trackUnsubscribed",d)}}else return()=>{e.off("connection.connected",a),e.off("connection.disconnected",a),e.off("track.muted",a),e.off("track.unmuted",a),e.off("participant.joined",a),e.off("participant.left",a)}},[e]),{videoTrackRefs:t,cameraTrackRefs:s,screenShareTrackRefs:o}}function sa({...e}){return l.jsx(Ue.Root,{"data-slot":"select",...e})}function ra({...e}){return l.jsx(Ue.Value,{"data-slot":"select-value",...e})}function oa({className:e,size:t="default",children:n,...s}){return l.jsxs(Ue.Trigger,{"data-slot":"select-trigger","data-size":t,className:Y(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...s,children:[n,l.jsx(Ue.Icon,{asChild:!0,children:l.jsx(vo,{weight:"bold",className:"size-4 transition-colors"})})]})}function ia({className:e,children:t,position:n="popper",...s}){return l.jsx(Ue.Portal,{children:l.jsxs(Ue.Content,{"data-slot":"select-content",className:Y(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[l.jsx(Og,{}),l.jsx(Ue.Viewport,{className:Y("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(Lg,{})]})})}function aa({className:e,children:t,...n}){return l.jsxs(Ue.Item,{"data-slot":"select-item",className:Y(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...n,children:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(Ue.ItemIndicator,{children:l.jsx(Ll,{className:"size-4",weight:"bold"})})}),l.jsx(Ue.ItemText,{children:t})]})}function Og({className:e,...t}){return l.jsx(Ue.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Fl,{className:"size-4",weight:"bold"})})}function Lg({className:e,...t}){return l.jsx(Ue.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(vo,{className:"size-4",weight:"bold"})})}const ca=ls.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function la({kind:e,track:t,requestPermissions:n,onError:s,client:r,...o}){const i=o.size||"default";if(!r)return l.jsxs(sa,{disabled:!0,children:[l.jsx(oa,{className:Y(ca({size:i}),o.className),children:l.jsx(ra,{placeholder:`Select a ${e}`})}),l.jsx(ia,{children:l.jsx(aa,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:c,setActiveMediaDevice:d}=Dg(r,e==="audioinput"?"audioinput":"videoinput");return l.jsxs(sa,{value:c,onValueChange:d,children:[l.jsx(oa,{className:Y(ca({size:i}),o.className,"hover:bg"),children:i!=="sm"&&l.jsx(ra,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),l.jsx(ia,{children:a.map(u=>l.jsx(aa,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function _g(e,t,n=!1){if(n)return wo;switch(e){case Z.Track.Source.Microphone:return t?_l:Bl;case Z.Track.Source.Camera:return t?Hl:Ul;case Z.Track.Source.ScreenShare:return zl;default:return p.Fragment}}function Gs({source:e,pressed:t,pending:n,className:s,...r}){const o=_g(e,t??!1,n),i=e===Z.Track.Source.Microphone&&!(t??!1)&&!n,a=e===Z.Track.Source.Camera&&!(t??!1)&&!n;return p.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),l.jsxs(Zl,{pressed:t,"aria-label":`Toggle ${e}`,className:Y(s),...r,children:[l.jsx(o,{weight:"bold",className:Y(n&&"animate-spin",i||a?"text-red-500":void 0)}),r.children]})}function Bg(e){return e?Ig(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function zg(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,r={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:Z.Track.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:o,localParticipant:i}=Wl(s),a=Bg(s);Gl(s);const c=gn(s,"microphone",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.Microphone,error:A})}}),d=gn(s,"camera",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.Camera,error:A})}}),u=gn(s,"screenShare",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.ScreenShare,error:A})}}),f=p.useMemo(()=>{let A;if(i){for(const[,M]of i.trackPublications)if(M.source===Z.Track.Source.Microphone){A=M;break}}return console.log("๐ŸŽค Creating micTrackRef:",{hasParticipant:!!i,hasPublication:!!A,isTrackSubscribed:A==null?void 0:A.isSubscribed,isMuted:A==null?void 0:A.isMuted,trackSid:A==null?void 0:A.trackSid}),{participant:i??void 0,source:Z.Track.Source.Microphone,publication:A}},[i,o]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:h,saveAudioInputDeviceId:g,saveVideoInputEnabled:x,saveVideoInputDeviceId:m}=$g({preventSave:!n}),b=p.useCallback(()=>{s&&(typeof s.endSession=="function"?(s.endSession(),console.log("โœ… AgentControlBar: Session ended via client.endSession()")):(s.disconnect(),console.log("โš ๏ธ AgentControlBar: Using fallback client.disconnect()")))},[s]),k=p.useCallback(A=>{g(A??"default"),s&&s.setAudioInputDevice(A)},[g,s]),v=p.useCallback(A=>{m(A??"default"),s&&s.setVideoInputDevice(A)},[m,s]),T=p.useCallback(async A=>{u.enabled&&await u.toggle(!1),await d.toggle(A),x(!d.enabled)},[d,x,u]),w=p.useCallback(async A=>{await c.toggle(A),h(!c.enabled)},[c,h]),S=p.useCallback(async A=>{d.enabled&&await d.toggle(!1),await u.toggle(A)},[d,u]);return{micTrackRef:f,visibleControls:r,cameraToggle:{...d,toggle:T},microphoneToggle:{...c,toggle:w},screenShareToggle:{...u,toggle:S},handleDisconnect:b,handleAudioDeviceChange:k,handleVideoDeviceChange:v}}const Hg={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden relative rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Ug={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden relative shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Zg={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden relative",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},da={dark:Hg,light:Ug,vox:Zg};function Ve(e){return da[e]||da.vox}function Wg({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:r,onChatOpenChange:o,onDisconnect:i,onDeviceError:a,theme:c="vox",client:d,...u}){const[f,h]=p.useState(!1),[g,x]=p.useState(!1),m=Ve(c),{micTrackRef:b,visibleControls:k,cameraToggle:v,microphoneToggle:T,screenShareToggle:w,handleAudioDeviceChange:S,handleVideoDeviceChange:A,handleDisconnect:M}=zg({controls:e,saveUserChoices:t,client:d}),j=async z=>{x(!0);try{await(r==null?void 0:r(z))}finally{x(!1)}};return p.useEffect(()=>{o==null||o(f)},[f,o]),p.useEffect(()=>{var z,y,D,_;console.log("๐ŸŽค AgentControlBar: micTrackRef changed:",{hasParticipant:!!b.participant,hasPublication:!!b.publication,source:b.source,isSubscribed:(z=b.publication)==null?void 0:z.isSubscribed,isMuted:(y=b.publication)==null?void 0:y.isMuted,trackSid:(D=b.publication)==null?void 0:D.trackSid,hasTrack:!!((_=b.publication)!=null&&_.track)})},[b]),l.jsxs("div",{"aria-label":"Voice assistant controls",className:Y(m.controlBar,s),...u,children:[n.suportsChatInput&&l.jsxs("div",{inert:!f,className:Y("overflow-hidden transition-[height] relative duration-300 ease-in-out",f?"h-[64px] mb-3":"h-0"),children:[l.jsx("div",{className:"flex h-9 px-4 w-full",children:l.jsx(Ng,{onSend:j,disabled:g,className:Y("w-full",m.chatInput)})}),l.jsx("hr",{className:"border-border my-2 mx-5"})]}),l.jsxs("div",{className:Y("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[l.jsxs("div",{className:"flex gap-y-2 justify-start",children:[k.microphone&&l.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[l.jsx(Gs,{variant:"primary",source:Z.Track.Source.Microphone,pressed:T.enabled,disabled:T.pending,onPressedChange:T.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),l.jsx(Ne.BarVisualizer,{barCount:3,trackRef:b,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:l.jsx("span",{className:Y(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),l.jsx(la,{size:"sm",kind:"audioinput",client:d,onError:a?z=>z instanceof Error?a({source:Z.Track.Source.Microphone,error:z}):void 0:void 0,onActiveDeviceChange:S,className:Y(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&k.camera&&l.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[l.jsx(Gs,{variant:"primary",source:Z.Track.Source.Camera,pressed:v.enabled,pending:v.pending,disabled:v.pending,onPressedChange:v.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),l.jsx(la,{size:"sm",kind:"videoinput",client:d,onError:a?z=>z instanceof Error?a({source:Z.Track.Source.Camera,error:z}):void 0:void 0,onActiveDeviceChange:A,className:Y(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&k.screenShare&&l.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:l.jsx(Gs,{variant:"secondary",source:Z.Track.Source.ScreenShare,pressed:w.enabled,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),k.chat&&l.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:l.jsx(Zl,{variant:"secondary","aria-label":"Toggle chat",pressed:f,onPressedChange:z=>{h(z)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:l.jsx(Ol,{weight:"bold",className:"h-5 w-5"})})})]})]})}const Gg=(e,t)=>{var a,c;const n=p.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,r=new Date(e.timestamp),o=typeof navigator<"u"?navigator.language:"en-US",i=(a=e.from)!=null&&a.name&&e.from.name!==""?e.from.name:(c=e.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:s,time:r,locale:o,name:i}},Kg=({entry:e,messageFormatter:t,className:n,participantName:s,...r})=>{var u,f;const{message:o,time:i,locale:a}=Gg(e,t),c=((u=e.from)==null?void 0:u.isLocal)??!1;Y("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const d=Y("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return l.jsx("li",{title:i.toLocaleTimeString(a,{timeStyle:"full"}),className:Y("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:l.jsxs("div",{className:Y("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[l.jsx("span",{className:d,children:c?((f=s==null?void 0:s[0])==null?void 0:f.toUpperCase())||"U":"A"}),l.jsx("span",{className:Y("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:o})]})})};function Yg(e){C.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const qg=({className:e,children:t,...n})=>{const s=C.useRef(null);return Yg(s),l.jsx("div",{ref:s,className:Y("flex flex-col justify-end",e),...n,children:t})},Xg=({state:e,audioTrack:t,className:n,ref:s})=>l.jsx("div",{ref:s,className:Y("",n),children:t?l.jsx(Ne.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:Y("flex aspect-video w-40 items-center justify-center gap-1"),children:l.jsx("span",{className:Y(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})}):l.jsx("div",{className:Y("flex aspect-video w-40 items-center justify-center"),children:l.jsx("div",{className:"flex flex-col items-center justify-center",children:l.jsx("div",{className:"flex gap-1",children:Array.from({length:5}).map((r,o)=>l.jsx("span",{className:Y(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear",e==="speaking"&&"animate-pulse bg-[#5c64f6]",e==="thinking"&&"animate-pulse bg-yellow-500"])},o))})})})}),Jg=({videoTrack:e,className:t,ref:n})=>{var s,r;return!e||!e.publication||!e.participant?l.jsx("div",{ref:n,className:Y(t),children:l.jsx("div",{className:"w-full h-full bg-gray-200 rounded-md flex items-center justify-center",children:l.jsx("span",{className:"text-gray-500",children:"No video available"})})}):l.jsx("div",{ref:n,className:Y(t),children:l.jsx(Ne.VideoTrack,{trackRef:e,width:((s=e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},Qg=ie.create(Ne.VideoTrack),e0=({trackRef:e,className:t,ref:n})=>{var s,r;return l.jsx("div",{className:Y("bg-muted overflow-hidden rounded-md",t),children:l.jsx(Qg,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:Y("h-full w-auto")})})},ua=ie.create(e0),t0=ie.create(Xg),n0=ie.create(Jg),tt={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Vt={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function s0(e,t){const{localParticipant:n}=Wl(t),s=n==null?void 0:n.getTrackPublication(e);return C.useMemo(()=>s&&n?{source:e,participant:n,publication:s}:void 0,[e,s,n])}function r0({chatOpen:e,client:t}){const{agent:{isActive:n=!1}={},session:s,state:r="idle",audioTrack:o,videoTrack:i}=t?Kl(t):{agent:{isActive:!1},session:null,state:"idle",audioTrack:null,videoTrack:null},[a]=Ne.useTracks([Z.Track.Source.ScreenShare]),c=s0(Z.Track.Source.Camera,t),d=c&&!c.publication.isMuted,u=a&&!a.publication.isMuted,f=d||u,h=n||s&&s.state==="active",g={...tt.transition,delay:e?0:.15},x={...tt.animate,scale:e?1:3,transition:g},m={...tt.animate,transition:g},b=g,k=g,v=i&&i.publication&&i.participant;return l.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:l.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:l.jsxs("div",{className:Y(Vt.grid),children:[h&&l.jsx("div",{className:Y(["grid",!e&&Vt.agentChatClosed,e&&f&&Vt.agentChatOpenWithSecondTile,e&&!f&&Vt.agentChatOpenWithoutSecondTile]),children:l.jsxs("div",{className:"h-full flex items-center justify-center",children:[!v&&l.jsx(t0,{layoutId:"agent",...tt,animate:x,transition:b,state:r,audioTrack:o||void 0,className:Y(e?"h-[90px]":"h-auto w-full")},"agent"),v&&i&&l.jsx(n0,{layoutId:"avatar",...tt,animate:m,transition:k,videoTrack:i,className:Y(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),l.jsx("div",{className:Y(["grid",e&&Vt.secondTileChatOpen,!e&&Vt.secondTileChatClosed]),children:l.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[c&&d&&l.jsx(ua,{layout:"position",layoutId:"camera",...tt,trackRef:c,transition:{...tt.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),u&&l.jsx(ua,{layout:"position",layoutId:"screen",...tt,trackRef:a,transition:{...tt.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function fa({timeout:e}){const[t,n]=C.useState(100),s=C.useRef(null),r=C.useRef(null);return C.useEffect(()=>{if(!e||e<=0)return;n(100),r.current=Date.now();const o=()=>{if(!e||r.current===null)return;const i=Date.now()-r.current,a=Math.max(0,100-i/e*100);n(a),a>0&&(s.current=requestAnimationFrame(o))};return s.current=requestAnimationFrame(o),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:l.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:l.jsx(ie.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function Kt({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:r}){var a;if(!e||!e.isVisible||!e.component)return null;const[o]=p.useState(()=>Date.now()),i=()=>e.component?p.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:r}):l.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return l.jsx(Ht,{children:l.jsxs(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx(fa,{timeout:e.timeout}),l.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[l.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),l.jsx("button",{onClick:n||((a=e.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:l.jsx(je.X,{className:"w-5 h-5"})})]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i()})]})});case"embedded":default:return l.jsx(Ht,{children:l.jsx(ie.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:l.jsxs("div",{children:[l.jsx(fa,{timeout:e.timeout}),i()]})})})}}function o0(){const e=Ne.useTranscriptions(),t=Ne.useChat(),n=Ne.useRoomContext();return{messages:C.useMemo(()=>[...e.map(o=>ig(o,n)),...t.chatMessages].sort((o,i)=>o.timestamp-i.timestamp),[e,t.chatMessages,n]),send:t.send}}const i0=({logLevel:e}={})=>{const t=Ne.useRoomContext();p.useEffect(()=>(Z.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},ha=e=>e,a0=()=>{let e=ha;return{configure(t){e=t},generate(t){return e(t)},reset(){e=ha}}},c0=a0();function ht(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(s=>n.searchParams.append("args[]",s)),`Minified MUI error #${e}; visit ${n} for the full message.`}function At(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":ht(7));return e.charAt(0).toUpperCase()+e.slice(1)}function l0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bn={exports:{}},zn={exports:{}},le={};/** @license React v16.13.1
9
+ `),()=>{m.contains(x)&&m.removeChild(x)}},[t]),l.jsx(Uf,{isPresent:t,childRef:o,sizeRef:i,children:p.cloneElement(e,{ref:o})})}const Wf=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:o,mode:i,anchorX:a,root:c})=>{const d=Lr(Gf),u=C.useId();let f=!0,h=C.useMemo(()=>(f=!1,{id:u,initial:t,isPresent:n,custom:r,onExitComplete:g=>{d.set(g,!0);for(const x of d.values())if(!x)return;s&&s()},register:g=>(d.set(g,!1),()=>d.delete(g))}),[n,d,s]);return o&&f&&(h={...h}),C.useMemo(()=>{d.forEach((g,x)=>d.set(x,!1))},[n]),p.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),i==="popLayout"&&(e=l.jsx(Zf,{isPresent:n,anchorX:a,root:c,children:e})),l.jsx(ds.Provider,{value:h,children:e})};function Gf(){return new Map}function _c(e=!0){const t=C.useContext(ds);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,o=C.useId();C.useEffect(()=>{if(e)return r(o)},[e]);const i=C.useCallback(()=>e&&s&&s(o),[o,s,e]);return!n&&s?[!1,i]:[!0]}const Fn=e=>e.key||"";function oi(e){const t=[];return C.Children.forEach(e,n=>{C.isValidElement(n)&&t.push(n)}),t}const Ht=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",root:c})=>{const[d,u]=_c(i),f=C.useMemo(()=>oi(e),[e]),h=i&&!d?[]:f.map(Fn),g=C.useRef(!0),x=C.useRef(f),m=Lr(()=>new Map),[b,k]=C.useState(f),[v,T]=C.useState(f);Ya(()=>{g.current=!1,x.current=f;for(let A=0;A<v.length;A++){const M=Fn(v[A]);h.includes(M)?m.delete(M):m.get(M)!==!0&&m.set(M,!1)}},[v,h.length,h.join("-")]);const w=[];if(f!==b){let A=[...f];for(let M=0;M<v.length;M++){const j=v[M],z=Fn(j);h.includes(z)||(A.splice(M,0,j),w.push(j))}return o==="wait"&&w.length&&(A=w),T(oi(A)),k(f),null}process.env.NODE_ENV!=="production"&&o==="wait"&&v.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:S}=C.useContext(Or);return l.jsx(l.Fragment,{children:v.map(A=>{const M=Fn(A),j=i&&!d?!1:f===v||h.includes(M),z=()=>{if(m.has(M))m.set(M,!0);else return;let y=!0;m.forEach(D=>{D||(y=!1)}),y&&(S==null||S(),T(x.current),i&&(u==null||u()),s&&s())};return l.jsx(Wf,{isPresent:j,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:o,root:c,onExitComplete:j?void 0:z,anchorX:a,children:A},M)})})},Bc=C.createContext({strict:!1}),ii={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Gt={};for(const e in ii)Gt[e]={isEnabled:t=>ii[e].some(n=>!!t[n])};function Kf(e){for(const t in e)Gt[t]={...Gt[t],...e[t]}}const Yf=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ss(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Yf.has(e)}let zc=e=>!ss(e);function qf(e){typeof e=="function"&&(zc=t=>t.startsWith("on")?!ss(t):e(t))}try{qf(require("@emotion/is-prop-valid").default)}catch{}function Xf(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||(zc(r)||n===!0&&ss(r)||!t&&!ss(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const us=C.createContext({});function fs(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function wn(e){return typeof e=="string"||Array.isArray(e)}const lo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],uo=["initial",...lo];function hs(e){return fs(e.animate)||uo.some(t=>wn(e[t]))}function Hc(e){return!!(hs(e)||e.variants)}function Jf(e,t){if(hs(e)){const{initial:n,animate:s}=e;return{initial:n===!1||wn(n)?n:void 0,animate:wn(s)?s:void 0}}return e.inherit!==!1?t:{}}function Qf(e){const{initial:t,animate:n}=Jf(e,C.useContext(us));return C.useMemo(()=>({initial:t,animate:n}),[ai(t),ai(n)])}function ai(e){return Array.isArray(e)?e.join(" "):e}const Sn={};function eh(e){for(const t in e)Sn[t]=e[t],Kr(t)&&(Sn[t].isCSSVariable=!0)}function Uc(e,{layout:t,layoutId:n}){return Qt.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Sn[e]||e==="opacity")}const th={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nh=Jt.length;function sh(e,t,n){let s="",r=!0;for(let o=0;o<nh;o++){const i=Jt[o],a=e[i];if(a===void 0)continue;let c=!0;if(typeof a=="number"?c=a===(i.startsWith("scale")?1:0):c=parseFloat(a)===0,!c||n){const d=Ic(a,oo[i]);if(!c){r=!1;const u=th[i]||i;s+=`${u}(${d}) `}n&&(t[i]=d)}}return s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}function fo(e,t,n){const{style:s,vars:r,transformOrigin:o}=e;let i=!1,a=!1;for(const c in t){const d=t[c];if(Qt.has(c)){i=!0;continue}else if(Kr(c)){r[c]=d;continue}else{const u=Ic(d,oo[c]);c.startsWith("origin")?(a=!0,o[c]=u):s[c]=u}}if(t.transform||(i||n?s.transform=sh(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:c="50%",originY:d="50%",originZ:u=0}=o;s.transformOrigin=`${c} ${d} ${u}`}}const ho=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Zc(e,t,n){for(const s in t)!Re(t[s])&&!Uc(s,n)&&(e[s]=t[s])}function rh({transformTemplate:e},t){return C.useMemo(()=>{const n=ho();return fo(n,t,e),Object.assign({},n.vars,n.style)},[t])}function oh(e,t){const n=e.style||{},s={};return Zc(s,n,e),Object.assign(s,rh(e,t)),s}function ih(e,t){const n={},s=oh(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const ah={offset:"stroke-dashoffset",array:"stroke-dasharray"},ch={offset:"strokeDashoffset",array:"strokeDasharray"};function lh(e,t,n=1,s=0,r=!0){e.pathLength=1;const o=r?ah:ch;e[o.offset]=ee.transform(-s);const i=ee.transform(t),a=ee.transform(n);e[o.array]=`${i} ${a}`}function Wc(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:o=1,pathOffset:i=0,...a},c,d,u){if(fo(e,a,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),r!==void 0&&lh(f,r,o,i,!1)}const Gc=()=>({...ho(),attrs:{}}),Kc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function dh(e,t,n,s){const r=C.useMemo(()=>{const o=Gc();return Wc(o,t,Kc(s),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Zc(o,e.style,e),r.style={...o,...r.style}}return r}const uh=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mo(e){return typeof e!="string"||e.includes("-")?!1:!!(uh.indexOf(e)>-1||/[A-Z]/u.test(e))}function fh(e,t,n,{latestValues:s},r,o=!1){const a=(mo(e)?dh:ih)(t,s,r,e),c=Xf(t,typeof e=="string",o),d=e!==C.Fragment?{...c,...a,ref:n}:{},{children:u}=t,f=C.useMemo(()=>Re(u)?u.get():u,[u]);return C.createElement(e,{...d,children:f})}function ci(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function po(e,t,n,s){if(typeof t=="function"){const[r,o]=ci(s);t=t(n!==void 0?n:e.custom,r,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,o]=ci(s);t=t(n!==void 0?n:e.custom,r,o)}return t}function Yn(e){return Re(e)?e.get():e}function hh({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:mh(n,s,r,e),renderState:t()}}function mh(e,t,n,s){const r={},o=s(e,{});for(const h in o)r[h]=Yn(o[h]);let{initial:i,animate:a}=e;const c=hs(e),d=Hc(e);t&&d&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const f=u?a:i;if(f&&typeof f!="boolean"&&!fs(f)){const h=Array.isArray(f)?f:[f];for(let g=0;g<h.length;g++){const x=po(e,h[g]);if(x){const{transitionEnd:m,transition:b,...k}=x;for(const v in k){let T=k[v];if(Array.isArray(T)){const w=u?T.length-1:0;T=T[w]}T!==null&&(r[v]=T)}for(const v in m)r[v]=m[v]}}}return r}const Yc=e=>(t,n)=>{const s=C.useContext(us),r=C.useContext(ds),o=()=>hh(e,t,s,r);return n?o():Lr(o)};function go(e,t,n){var o;const{style:s}=e,r={};for(const i in s)(Re(s[i])||t.style&&Re(t.style[i])||Uc(i,e)||((o=n==null?void 0:n.getValue(i))==null?void 0:o.liveStyle)!==void 0)&&(r[i]=s[i]);return r}const ph=Yc({scrapeMotionValuesFromProps:go,createRenderState:ho});function qc(e,t,n){const s=go(e,t,n);for(const r in e)if(Re(e[r])||Re(t[r])){const o=Jt.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[o]=e[r]}return s}const gh=Yc({scrapeMotionValuesFromProps:qc,createRenderState:Gc}),yh=Symbol.for("motionComponentSymbol");function Lt(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function xh(e,t,n){return C.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):Lt(n)&&(n.current=s))},[t])}const yo=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bh="framerAppearId",Xc="data-"+yo(bh),Jc=C.createContext({});function vh(e,t,n,s,r){var m,b;const{visualElement:o}=C.useContext(us),i=C.useContext(Bc),a=C.useContext(ds),c=C.useContext(co).reducedMotion,d=C.useRef(null);s=s||i.renderer,!d.current&&s&&(d.current=s(e,{visualState:t,parent:o,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:c}));const u=d.current,f=C.useContext(Jc);u&&!u.projection&&r&&(u.type==="html"||u.type==="svg")&&wh(d.current,n,r,f);const h=C.useRef(!1);C.useInsertionEffect(()=>{u&&h.current&&u.update(n,a)});const g=n[Xc],x=C.useRef(!!g&&!((m=window.MotionHandoffIsComplete)!=null&&m.call(window,g))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,g)));return Ya(()=>{u&&(h.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),x.current&&u.animationState&&u.animationState.animateChanges())}),C.useEffect(()=>{u&&(!x.current&&u.animationState&&u.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)==null||k.call(window,g)}),x.current=!1),u.enteringChildren=void 0)}),u}function wh(e,t,n,s){const{layoutId:r,layout:o,drag:i,dragConstraints:a,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Qc(e.parent)),e.projection.setOptions({layoutId:r,layout:o,alwaysMeasureLayout:!!i||a&&Lt(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:c,layoutRoot:d})}function Qc(e){if(e)return e.options.allowProjection!==!1?e.projection:Qc(e.parent)}function $s(e,{forwardMotionProps:t=!1}={},n,s){n&&Kf(n);const r=mo(e)?gh:ph;function o(a,c){let d;const u={...C.useContext(co),...a,layoutId:Sh(a)},{isStatic:f}=u,h=Qf(a),g=r(a,f);if(!f&&_r){Ch(u,n);const x=kh(u);d=x.MeasureLayout,h.visualElement=vh(e,g,u,s,x.ProjectionNode)}return l.jsxs(us.Provider,{value:h,children:[d&&h.visualElement?l.jsx(d,{visualElement:h.visualElement,...u}):null,fh(e,a,xh(g,h.visualElement,c),g,f,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=C.forwardRef(o);return i[yh]=e,i}function Sh({layoutId:e}){const t=C.useContext(Or).id;return t&&e!==void 0?t+"-"+e:e}function Ch(e,t){const n=C.useContext(Bc).strict;if(process.env.NODE_ENV!=="production"&&t&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?qt(!1,s,"lazy-strict-mode"):ot(!1,s,"lazy-strict-mode")}}function kh(e){const{drag:t,layout:n}=Gt;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Th(e,t){if(typeof Proxy>"u")return $s;const n=new Map,s=(o,i)=>$s(o,i,e,t),r=(o,i)=>(process.env.NODE_ENV!=="production"&&Zr(!1,"motion() is deprecated. Use motion.create() instead."),s(o,i));return new Proxy(r,{get:(o,i)=>i==="create"?s:(n.has(i)||n.set(i,$s(i,void 0,e,t)),n.get(i))})}function el({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function Eh({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ah(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Fs(e){return e===void 0||e===1}function vr({scale:e,scaleX:t,scaleY:n}){return!Fs(e)||!Fs(t)||!Fs(n)}function bt(e){return vr(e)||tl(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tl(e){return li(e.x)||li(e.y)}function li(e){return e&&e!=="0%"}function rs(e,t,n){const s=e-n,r=t*s;return n+r}function di(e,t,n,s,r){return r!==void 0&&(e=rs(e,r,s)),rs(e,n,s)+t}function wr(e,t=0,n=1,s,r){e.min=di(e.min,t,n,s,r),e.max=di(e.max,t,n,s,r)}function nl(e,{x:t,y:n}){wr(e.x,t.translate,t.scale,t.originPoint),wr(e.y,n.translate,n.scale,n.originPoint)}const ui=.999999999999,fi=1.0000000000001;function jh(e,t,n,s=!1){const r=n.length;if(!r)return;t.x=t.y=1;let o,i;for(let a=0;a<r;a++){o=n[a],i=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Bt(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,nl(e,i)),s&&bt(o.latestValues)&&Bt(e,o.latestValues))}t.x<fi&&t.x>ui&&(t.x=1),t.y<fi&&t.y>ui&&(t.y=1)}function _t(e,t){e.min=e.min+t,e.max=e.max+t}function hi(e,t,n,s,r=.5){const o=we(e.min,e.max,r);wr(e,t,n,o,s)}function Bt(e,t){hi(e.x,t.x,t.scaleX,t.scale,t.originX),hi(e.y,t.y,t.scaleY,t.scale,t.originY)}function sl(e,t){return el(Ah(e.getBoundingClientRect(),t))}function Mh(e,t,n){const s=sl(e,n),{scroll:r}=t;return r&&(_t(s.x,r.offset.x),_t(s.y,r.offset.y)),s}const mi=()=>({translate:0,scale:1,origin:0,originPoint:0}),zt=()=>({x:mi(),y:mi()}),pi=()=>({min:0,max:0}),Te=()=>({x:pi(),y:pi()}),Sr={current:null},rl={current:!1};function Ph(){if(rl.current=!0,!!_r)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Sr.current=e.matches;e.addEventListener("change",t),t()}else Sr.current=!1}const Vh=new WeakMap;function Nh(e,t,n){for(const s in t){const r=t[s],o=n[s];if(Re(r))e.addValue(s,r);else if(Re(o))e.addValue(s,Wt(r,{owner:e}));else if(o!==r)if(e.hasValue(s)){const i=e.getValue(s);i.liveStyle===!0?i.jump(r):i.hasAnimated||i.set(r)}else{const i=e.getStaticValue(s);e.addValue(s,Wt(i!==void 0?i:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const gi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Rh{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=so,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=Fe.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,xe.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!o,this.isControllingVariants=hs(n),this.isVariantNode=Hc(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const g=f[h];c[h]!==void 0&&Re(g)&&g.set(c[h])}}mount(t){var n;this.current=t,Vh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),rl.current||Ph(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Sr.current,process.env.NODE_ENV!=="production"&&Zr(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected.","reduced-motion-disabled"),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),ut(this.notifyUpdate),ut(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Qt.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&xe.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Gt){const n=Gt[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<gi.length;s++){const r=gi[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const o="on"+r,i=t[o];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=Nh(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=Wt(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(qa(s)||Ja(s))?s=parseFloat(s):!Hf(s)&&ft.test(n)&&(s=Rc(t,n)),this.setBaseTarget(t,Re(s)?s.get():s)),Re(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const i=po(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);i&&(s=i[t])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Re(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Ur),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){io.render(this.render)}}class ol extends Rh{constructor(){super(...arguments),this.KeyframeResolver=Vf}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Re(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function il(e,{style:t,vars:n},s,r){const o=e.style;let i;for(i in t)o[i]=t[i];r==null||r.applyProjectionStyles(o,s);for(i in n)o.setProperty(i,n[i])}function Ih(e){return window.getComputedStyle(e)}class Dh extends ol{constructor(){super(...arguments),this.type="html",this.renderInstance=il}readValueFromInstance(t,n){var s;if(Qt.has(n))return(s=this.projection)!=null&&s.isProjecting?hr(n):Ku(t,n);{const r=Ih(t),o=(Kr(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return sl(t,n)}build(t,n,s){fo(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return go(t,n,s)}}const al=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function $h(e,t,n,s){il(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(al.has(r)?r:yo(r),t.attrs[r])}class Fh extends ol{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Te}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Qt.has(n)){const s=Nc(n);return s&&s.default||0}return n=al.has(n)?n:yo(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return qc(t,n,s)}build(t,n,s){Wc(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){$h(t,n,s,r)}mount(t){this.isSVGTag=Kc(t.tagName),super.mount(t)}}const Oh=(e,t)=>mo(e)?new Fh(t):new Dh(t,{allowProjection:e!==C.Fragment});function Ut(e,t,n){const s=e.getProps();return po(s,t,n!==void 0?n:s.custom,e)}const Cr=e=>Array.isArray(e);function Lh(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Wt(n))}function _h(e){return Cr(e)?e[e.length-1]||0:e}function Bh(e,t){const n=Ut(e,t);let{transitionEnd:s={},transition:r={},...o}=n||{};o={...o,...s};for(const i in o){const a=_h(o[i]);Lh(e,i,a)}}function zh(e){return!!(Re(e)&&e.add)}function kr(e,t){const n=e.getValue("willChange");if(zh(n))return n.add(t);if(!n&&it.WillChange){const s=new it.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function cl(e){return e.props[Xc]}const Hh=e=>e!==null;function Uh(e,{repeat:t,repeatType:n="loop"},s){const r=e.filter(Hh),o=t&&n!=="loop"&&t%2===1?0:r.length-1;return r[o]}const Zh={type:"spring",stiffness:500,damping:25,restSpeed:10},Wh=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Gh={type:"keyframes",duration:.8},Kh={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Yh=(e,{keyframes:t})=>t.length>2?Gh:Qt.has(e)?e.startsWith("scale")?Wh(t[1]):Zh:Kh;function qh({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:o,repeatType:i,repeatDelay:a,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const xo=(e,t,n,s={},r,o)=>i=>{const a=ro(s,e)||{},c=a.delay||s.delay||0;let{elapsed:d=0}=s;d=d-Ke(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-d,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{i(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:r};qh(a)||Object.assign(u,Yh(e,u)),u.duration&&(u.duration=Ke(u.duration)),u.repeatDelay&&(u.repeatDelay=Ke(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(xr(u),u.delay===0&&(f=!0)),(it.instantAnimations||it.skipAnimations)&&(f=!0,xr(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const h=Uh(u.keyframes,a);if(h!==void 0){xe.update(()=>{u.onUpdate(h),u.onComplete()});return}}return a.isSync?new no(u):new xf(u)};function Xh({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function ll(e,t,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:i,...a}=t;s&&(o=s);const c=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const u in a){const f=e.getValue(u,e.latestValues[u]??null),h=a[u];if(h===void 0||d&&Xh(d,u))continue;const g={delay:n,...ro(o||{},u)},x=f.get();if(x!==void 0&&!f.isAnimating&&!Array.isArray(h)&&h===x&&!g.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const k=cl(e);if(k){const v=window.MotionHandoffAnimation(k,u,xe);v!==null&&(g.startTime=v,m=!0)}}kr(e,u),f.start(xo(u,f,h,e.shouldReduceMotion&&Mc.has(u)?{type:!1}:g,e,m));const b=f.animation;b&&c.push(b)}return i&&Promise.all(c).then(()=>{xe.update(()=>{i&&Bh(e,i)})}),c}function dl(e,t,n,s=0,r=1){const o=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),i=e.size,a=(i-1)*s;return typeof n=="function"?n(o,i):r===1?o*s:a-o*s}function Tr(e,t,n={}){var c;const s=Ut(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(ll(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:h}=r;return Jh(e,t,d,u,f,h,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[d,u]=a==="beforeChildren"?[o,i]:[i,o];return d().then(()=>u())}else return Promise.all([o(),i(n.delay)])}function Jh(e,t,n=0,s=0,r=0,o=1,i){const a=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),a.push(Tr(c,t,{...i,delay:n+(typeof s=="function"?0:s)+dl(e.variantChildren,c,s,r,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(a)}function Qh(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const r=t.map(o=>Tr(e,o,n));s=Promise.all(r)}else if(typeof t=="string")s=Tr(e,t,n);else{const r=typeof t=="function"?Ut(e,t,n.custom):t;s=Promise.all(ll(e,r,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function ul(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const em=uo.length;function fl(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?fl(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<em;n++){const s=uo[n],r=e.props[s];(wn(r)||r===!1)&&(t[s]=r)}return t}const tm=[...lo].reverse(),nm=lo.length;function sm(e){return t=>Promise.all(t.map(({animation:n,options:s})=>Qh(e,n,s)))}function rm(e){let t=sm(e),n=yi(),s=!0;const r=c=>(d,u)=>{var h;const f=Ut(e,u,c==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(f){const{transition:g,transitionEnd:x,...m}=f;d={...d,...m,...x}}return d};function o(c){t=c(e)}function i(c){const{props:d}=e,u=fl(e.parent)||{},f=[],h=new Set;let g={},x=1/0;for(let b=0;b<nm;b++){const k=tm[b],v=n[k],T=d[k]!==void 0?d[k]:u[k],w=wn(T),S=k===c?v.isActive:null;S===!1&&(x=b);let A=T===u[k]&&T!==d[k]&&w;if(A&&s&&e.manuallyAnimateOnMount&&(A=!1),v.protectedKeys={...g},!v.isActive&&S===null||!T&&!v.prevProp||fs(T)||typeof T=="boolean")continue;const M=om(v.prevProp,T);let j=M||k===c&&v.isActive&&!A&&w||b>x&&w,z=!1;const y=Array.isArray(T)?T:[T];let D=y.reduce(r(k),{});S===!1&&(D={});const{prevResolvedValues:_={}}=v,J={..._,...D},ne=K=>{j=!0,h.has(K)&&(z=!0,h.delete(K)),v.needsAnimating[K]=!0;const R=e.getValue(K);R&&(R.liveStyle=!1)};for(const K in J){const R=D[K],X=_[K];if(g.hasOwnProperty(K))continue;let V=!1;Cr(R)&&Cr(X)?V=!ul(R,X):V=R!==X,V?R!=null?ne(K):h.add(K):R!==void 0&&h.has(K)?ne(K):v.protectedKeys[K]=!0}v.prevProp=T,v.prevResolvedValues=D,v.isActive&&(g={...g,...D}),s&&e.blockInitialAnimation&&(j=!1);const Q=A&&M;j&&(!Q||z)&&f.push(...y.map(K=>{const R={type:k};if(typeof K=="string"&&s&&!Q&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,V=Ut(X,K);if(X.enteringChildren&&V){const{delayChildren:U}=V.transition||{};R.delay=dl(X.enteringChildren,e,U)}}return{animation:K,options:R}}))}if(h.size){const b={};if(typeof d.initial!="boolean"){const k=Ut(e,Array.isArray(d.initial)?d.initial[0]:d.initial);k&&k.transition&&(b.transition=k.transition)}h.forEach(k=>{const v=e.getBaseTarget(k),T=e.getValue(k);T&&(T.liveStyle=!0),b[k]=v??null}),f.push({animation:b})}let m=!!f.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(m=!1),s=!1,m?t(f):Promise.resolve()}function a(c,d){var f;if(n[c].isActive===d)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(h=>{var g;return(g=h.animationState)==null?void 0:g.setActive(c,d)}),n[c].isActive=d;const u=i(c);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:i,setActive:a,setAnimateFunction:o,getState:()=>n,reset:()=>{n=yi(),s=!0}}}function om(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!ul(t,e):!1}function yt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yi(){return{animate:yt(!0),whileInView:yt(),whileHover:yt(),whileTap:yt(),whileDrag:yt(),whileFocus:yt(),exit:yt()}}class pt{constructor(t){this.isMounted=!1,this.node=t}update(){}}class im extends pt{constructor(t){super(t),t.animationState||(t.animationState=rm(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fs(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let am=0;class cm extends pt{constructor(){super(...arguments),this.id=am++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const lm={animation:{Feature:im},exit:{Feature:cm}};function Cn(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function jn(e){return{point:{x:e.pageX,y:e.pageY}}}const dm=e=>t=>ao(t)&&e(t,jn(t));function hn(e,t,n,s){return Cn(e,t,dm(n),s)}const hl=1e-4,um=1-hl,fm=1+hl,ml=.01,hm=0-ml,mm=0+ml;function $e(e){return e.max-e.min}function pm(e,t,n){return Math.abs(e-t)<=n}function xi(e,t,n,s=.5){e.origin=s,e.originPoint=we(t.min,t.max,e.origin),e.scale=$e(n)/$e(t),e.translate=we(n.min,n.max,e.origin)-e.originPoint,(e.scale>=um&&e.scale<=fm||isNaN(e.scale))&&(e.scale=1),(e.translate>=hm&&e.translate<=mm||isNaN(e.translate))&&(e.translate=0)}function mn(e,t,n,s){xi(e.x,t.x,n.x,s?s.originX:void 0),xi(e.y,t.y,n.y,s?s.originY:void 0)}function bi(e,t,n){e.min=n.min+t.min,e.max=e.min+$e(t)}function gm(e,t,n){bi(e.x,t.x,n.x),bi(e.y,t.y,n.y)}function vi(e,t,n){e.min=t.min-n.min,e.max=e.min+$e(t)}function pn(e,t,n){vi(e.x,t.x,n.x),vi(e.y,t.y,n.y)}function ze(e){return[e("x"),e("y")]}const pl=({current:e})=>e?e.ownerDocument.defaultView:null,wi=(e,t)=>Math.abs(e-t);function ym(e,t){const n=wi(e.x,t.x),s=wi(e.y,t.y);return Math.sqrt(n**2+s**2)}class gl{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Ls(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=ym(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:m}=h,{timestamp:b}=Pe;this.history.push({...m,timestamp:b});const{onStart:k,onMove:v}=this.handlers;g||(k&&k(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,h)},this.handlePointerMove=(h,g)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Os(g,this.transformPagePoint),xe.update(this.updatePoint,!0)},this.handlePointerUp=(h,g)=>{this.end();const{onEnd:x,onSessionEnd:m,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Ls(h.type==="pointercancel"?this.lastMoveEventInfo:Os(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(h,k),m&&m(h,k)},!ao(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=i,this.contextWindow=r||window;const a=jn(t),c=Os(a,this.transformPagePoint),{point:d}=c,{timestamp:u}=Pe;this.history=[{...d,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Ls(c,this.history)),this.removeListeners=Tn(hn(this.contextWindow,"pointermove",this.handlePointerMove),hn(this.contextWindow,"pointerup",this.handlePointerUp),hn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ut(this.updatePoint)}}function Os(e,t){return t?{point:t(e.point)}:e}function Si(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ls({point:e},t){return{point:e,delta:Si(e,yl(t)),offset:Si(e,xm(t)),velocity:bm(t,.1)}}function xm(e){return e[0]}function yl(e){return e[e.length-1]}function bm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=yl(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>Ke(t)));)n--;if(!s)return{x:0,y:0};const o=Xe(r.timestamp-s.timestamp);if(o===0)return{x:0,y:0};const i={x:(r.x-s.x)/o,y:(r.y-s.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function vm(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?we(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?we(n,e,s.max):Math.min(e,n)),e}function Ci(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function wm(e,{top:t,left:n,bottom:s,right:r}){return{x:Ci(e.x,n,r),y:Ci(e.y,t,s)}}function ki(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function Sm(e,t){return{x:ki(e.x,t.x),y:ki(e.y,t.y)}}function Cm(e,t){let n=.5;const s=$e(e),r=$e(t);return r>s?n=xn(t.min,t.max-s,e.min):s>r&&(n=xn(e.min,e.max-r,t.min)),rt(0,1,n)}function km(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Er=.35;function Tm(e=Er){return e===!1?e=0:e===!0&&(e=Er),{x:Ti(e,"left","right"),y:Ti(e,"top","bottom")}}function Ti(e,t,n){return{min:Ei(e,t),max:Ei(e,n)}}function Ei(e,t){return typeof e=="number"?e:e[t]||0}const Em=new WeakMap;class Am{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Te(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=f=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(jn(f).point)},i=(f,h)=>{const{drag:g,dragPropagation:x,onDragStart:m}=this.getProps();if(g&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Df(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ze(k=>{let v=this.getAxisMotionValue(k).get()||0;if(Je.test(v)){const{projection:T}=this.visualElement;if(T&&T.layout){const w=T.layout.layoutBox[k];w&&(v=$e(w)*(parseFloat(v)/100))}}this.originPoint[k]=v}),m&&xe.postRender(()=>m(f,h)),kr(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:g,dragDirectionLock:x,onDirectionLock:m,onDrag:b}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:k}=h;if(x&&this.currentDirection===null){this.currentDirection=jm(k),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,k),this.updateAxis("y",h.point,k),this.visualElement.render(),b&&b(f,h)},c=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>ze(f=>{var h;return this.getAnimationState(f)==="paused"&&((h=this.getAxisMotionValue(f).animation)==null?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new gl(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:pl(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!s)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&xe.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:r}=this.getProps();if(!s||!On(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(i=vm(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,r=this.constraints;t&&Lt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=wm(s.layoutBox,t):this.constraints=!1,this.elastic=Tm(n),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&ze(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=km(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Lt(t))return!1;const s=t.current;ot(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=Mh(s,r.root,this.visualElement.getTransformPagePoint());let i=Sm(r.layout.layoutBox,o);if(n){const a=n(Eh(i));this.hasMutatedConstraints=!!a,a&&(i=el(a))}return i}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},d=ze(u=>{if(!On(u,n,this.currentDirection))return;let f=c&&c[u]||{};i&&(f={min:0,max:0});const h=r?200:1e6,g=r?40:1e7,x={type:"inertia",velocity:s?t[u]:0,bounceStiffness:h,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(u,x)});return Promise.all(d).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return kr(this.visualElement,t),s.start(xo(t,s,0,n,this.visualElement,!1))}stopAnimation(){ze(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ze(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){ze(n=>{const{drag:s}=this.getProps();if(!On(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(n);if(r&&r.layout){const{min:i,max:a}=r.layout.layoutBox[n];o.set(t[n]-we(i,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Lt(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};ze(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const c=a.get();r[i]=Cm({min:c,max:c},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),ze(i=>{if(!On(i,t,null))return;const a=this.getAxisMotionValue(i),{min:c,max:d}=this.constraints[i];a.set(we(c,d,r[i]))})}addListeners(){if(!this.visualElement.current)return;Em.set(this.visualElement,this);const t=this.visualElement.current,n=hn(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Lt(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,o=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),xe.read(s);const i=Cn(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(ze(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{i(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=Er,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function On(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function jm(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Mm extends pt{constructor(t){super(t),this.removeGroupControls=Ze,this.removeListeners=Ze,this.controls=new Am(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ze}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ai=e=>(t,n)=>{e&&xe.postRender(()=>e(t,n))};class Pm extends pt{constructor(){super(...arguments),this.removePointerDownListener=Ze}onPointerDown(t){this.session=new gl(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:pl(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ai(t),onStart:Ai(n),onMove:s,onEnd:(o,i)=>{delete this.session,r&&xe.postRender(()=>r(o,i))}}}mount(){this.removePointerDownListener=hn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const qn={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ji(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const on={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=ji(e,t.target.x),s=ji(e,t.target.y);return`${n}% ${s}%`}},Vm={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,r=ft.parse(e);if(r.length>5)return s;const o=ft.createTransformer(e),i=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,c=n.y.scale*t.y;r[0+i]/=a,r[1+i]/=c;const d=we(a,c,.5);return typeof r[2+i]=="number"&&(r[2+i]/=d),typeof r[3+i]=="number"&&(r[3+i]/=d),o(r)}};let _s=!1;class Nm extends C.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:o}=t;eh(Rm),o&&(n.group&&n.group.add(o),s&&s.register&&r&&s.register(o),_s&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),qn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:o}=this.props,{projection:i}=s;return i&&(i.isPresent=o,_s=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||xe.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),io.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;_s=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function xl(e){const[t,n]=_c(),s=C.useContext(Or);return l.jsx(Nm,{...e,layoutGroup:s,switchLayoutGroup:C.useContext(Jc),isPresent:t,safeToRemove:n})}const Rm={borderRadius:{...on,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomLeftRadius:on,borderBottomRightRadius:on,boxShadow:Vm};function Im(e,t,n){const s=Re(e)?e:Wt(e);return s.start(xo("",s,t,n)),s.animation}const Dm=(e,t)=>e.depth-t.depth;class $m{constructor(){this.children=[],this.isDirty=!1}add(t){Br(this.children,t),this.isDirty=!0}remove(t){zr(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Dm),this.isDirty=!1,this.children.forEach(t)}}function Fm(e,t){const n=Fe.now(),s=({timestamp:r})=>{const o=r-n;o>=t&&(ut(s),e(o-t))};return xe.setup(s,!0),()=>ut(s)}const bl=["TopLeft","TopRight","BottomLeft","BottomRight"],Om=bl.length,Mi=e=>typeof e=="string"?parseFloat(e):e,Pi=e=>typeof e=="number"||ee.test(e);function Lm(e,t,n,s,r,o){r?(e.opacity=we(0,n.opacity??1,_m(s)),e.opacityExit=we(t.opacity??1,0,Bm(s))):o&&(e.opacity=we(t.opacity??1,n.opacity??1,s));for(let i=0;i<Om;i++){const a=`border${bl[i]}Radius`;let c=Vi(t,a),d=Vi(n,a);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Pi(c)===Pi(d)?(e[a]=Math.max(we(Mi(c),Mi(d),s),0),(Je.test(d)||Je.test(c))&&(e[a]+="%")):e[a]=d}(t.rotate||n.rotate)&&(e.rotate=we(t.rotate||0,n.rotate||0,s))}function Vi(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const _m=vl(0,.5,ic),Bm=vl(.5,.95,Ze);function vl(e,t,n){return s=>s<e?0:s>t?1:n(xn(e,t,s))}function Ni(e,t){e.min=t.min,e.max=t.max}function Be(e,t){Ni(e.x,t.x),Ni(e.y,t.y)}function Ri(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Ii(e,t,n,s,r){return e-=t,e=rs(e,1/n,s),r!==void 0&&(e=rs(e,1/r,s)),e}function zm(e,t=0,n=1,s=.5,r,o=e,i=e){if(Je.test(t)&&(t=parseFloat(t),t=we(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=we(o.min,o.max,s);e===o&&(a-=t),e.min=Ii(e.min,t,n,a,r),e.max=Ii(e.max,t,n,a,r)}function Di(e,t,[n,s,r],o,i){zm(e,t[n],t[s],t[r],t.scale,o,i)}const Hm=["x","scaleX","originX"],Um=["y","scaleY","originY"];function $i(e,t,n,s){Di(e.x,t,Hm,n?n.x:void 0,s?s.x:void 0),Di(e.y,t,Um,n?n.y:void 0,s?s.y:void 0)}function Fi(e){return e.translate===0&&e.scale===1}function wl(e){return Fi(e.x)&&Fi(e.y)}function Oi(e,t){return e.min===t.min&&e.max===t.max}function Zm(e,t){return Oi(e.x,t.x)&&Oi(e.y,t.y)}function Li(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Sl(e,t){return Li(e.x,t.x)&&Li(e.y,t.y)}function _i(e){return $e(e.x)/$e(e.y)}function Bi(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class Wm{constructor(){this.members=[]}add(t){Br(this.members,t),t.scheduleRender()}remove(t){if(zr(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let s;for(let r=n;r>=0;r--){const o=this.members[r];if(o.isPresent!==!1){s=o;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Gm(e,t,n){let s="";const r=e.x.translate/t.x,o=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((r||o||i)&&(s=`translate3d(${r}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:f,rotateY:h,skewX:g,skewY:x}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),g&&(s+=`skewX(${g}deg) `),x&&(s+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,c=e.y.scale*t.y;return(a!==1||c!==1)&&(s+=`scale(${a}, ${c})`),s||"none"}const Bs=["","X","Y","Z"],Km=1e3;let Ym=0;function zs(e,t,n,s){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),s&&(s[e]=0))}function Cl(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cl(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",xe,!(r||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Cl(s)}function kl({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(i={},a=t==null?void 0:t()){this.id=Ym++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Jm),this.nodes.forEach(np),this.nodes.forEach(sp),this.nodes.forEach(Qm)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new $m)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Ur),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const c=this.eventHandlers.get(i);c&&c.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Lc(i)&&!Bf(i),this.instance=i;const{layoutId:a,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),e){let u,f=0;const h=()=>this.root.updateBlockedByResize=!1;xe.read(()=>{f=window.innerWidth}),e(i,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,u&&u(),u=Fm(h,250),qn.hasAnimatedSinceResize&&(qn.hasAnimatedSinceResize=!1,this.nodes.forEach(Ui)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&d&&(a||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||cp,{onLayoutAnimationStart:m,onLayoutAnimationComplete:b}=d.getProps(),k=!this.targetLayout||!Sl(this.targetLayout,g),v=!f&&h;if(this.options.layoutRoot||this.resumeFrom||v||f&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...ro(x,"layout"),onPlay:m,onComplete:b};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(u,v)}else f||Ui(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ut(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rp),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Cl(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(zi);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Hi);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(tp),this.nodes.forEach(qm),this.nodes.forEach(Xm)):this.nodes.forEach(Hi),this.clearAllSnapshots();const a=Fe.now();Pe.delta=rt(0,1e3/60,a-Pe.timestamp),Pe.timestamp=a,Pe.isProcessing=!0,Ps.update.process(Pe),Ps.preRender.process(Pe),Ps.render.process(Pe),Pe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,io.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ep),this.sharedNodes.forEach(op)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$e(this.snapshot.measuredBox.x)&&!$e(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Te(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!wl(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;i&&this.instance&&(a||bt(this.latestValues)||u)&&(r(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return i&&(c=this.removeTransform(c)),lp(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:i}=this.options;if(!i)return Te();const a=i.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(dp))){const{scroll:u}=this.root;u&&(_t(a.x,u.offset.x),_t(a.y,u.offset.y))}return a}removeElementScroll(i){var c;const a=Te();if(Be(a,i),(c=this.scroll)!=null&&c.wasRoot)return a;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:f,options:h}=u;u!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Be(a,i),_t(a.x,f.offset.x),_t(a.y,f.offset.y))}return a}applyTransform(i,a=!1){const c=Te();Be(c,i);for(let d=0;d<this.path.length;d++){const u=this.path[d];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Bt(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),bt(u.latestValues)&&Bt(c,u.latestValues)}return bt(this.latestValues)&&Bt(c,this.latestValues),c}removeTransform(i){const a=Te();Be(a,i);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!bt(d.latestValues))continue;vr(d.latestValues)&&d.updateSnapshot();const u=Te(),f=d.measurePageBox();Be(u,f),$i(a,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return bt(this.latestValues)&&$i(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var h;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(h=this.parent)!=null&&h.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:f}=this.options;if(!(!this.layout||!(u||f))){if(this.resolvedRelativeTargetAt=Pe.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),pn(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Be(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Te(),this.targetWithTransforms=Te()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gm(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Be(this.target,this.layout.layoutBox),nl(this.target,this.targetDelta)):Be(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),pn(this.relativeTargetOrigin,this.target,g.target),Be(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||vr(this.parent.latestValues)||tl(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var x;const i=this.getLead(),a=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Pe.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;Be(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,h=this.treeScale.y;jh(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Te());const{target:g}=i;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ri(this.prevProjectionDelta.x,this.projectionDelta.x),Ri(this.prevProjectionDelta.y,this.projectionDelta.y)),mn(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==h||!Bi(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bi(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=zt(),this.projectionDelta=zt(),this.projectionDeltaWithTransform=zt()}setAnimationOrigin(i,a=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},f=zt();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const h=Te(),g=c?c.source:void 0,x=this.layout?this.layout.source:void 0,m=g!==x,b=this.getStack(),k=!b||b.members.length<=1,v=!!(m&&!k&&this.options.crossfade===!0&&!this.path.some(ap));this.animationProgress=0;let T;this.mixTargetDelta=w=>{const S=w/1e3;Zi(f.x,i.x,S),Zi(f.y,i.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pn(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ip(this.relativeTarget,this.relativeTargetOrigin,h,S),T&&Zm(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Te()),Be(T,this.relativeTarget)),m&&(this.animationValues=u,Lm(u,d,this.latestValues,S,v,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var a,c,d;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(ut(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xe.update(()=>{qn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Wt(0)),this.currentAnimation=Im(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),i.onUpdate&&i.onUpdate(u)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Km),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:c,layout:d,latestValues:u}=i;if(!(!a||!c||!d)){if(this!==i&&this.layout&&d&&Tl(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Te();const f=$e(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+f;const h=$e(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+h}Be(a,c),Bt(a,u),mn(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new Wm),this.sharedNodes.get(i).add(a);const d=a.options.initialPromotionConfig;a.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var a;const{layoutId:i}=this.options;return i?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:i}=this.options;return i?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const d={};c.z&&zs("z",i,d,this.animationValues);for(let u=0;u<Bs.length;u++)zs(`rotate${Bs[u]}`,i,d,this.animationValues),zs(`skew${Bs[u]}`,i,d,this.animationValues);i.render();for(const u in d)i.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=Yn(a==null?void 0:a.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=Yn(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!bt(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=Gm(this.projectionDeltaWithTransform,this.treeScale,u);c&&(f=c(u,f)),i.transform=f;const{x:h,y:g}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${g.origin*100}% 0`,d.animationValues?i.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const x in Sn){if(u[x]===void 0)continue;const{correct:m,applyTo:b,isCSSVariable:k}=Sn[x],v=f==="none"?u[x]:m(u[x],d);if(b){const T=b.length;for(let w=0;w<T;w++)i[b[w]]=v}else k?this.options.visualElement.renderState.vars[x]=v:i[x]=v}this.options.layoutId&&(i.pointerEvents=d===this?Yn(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var a;return(a=i.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(zi),this.root.sharedNodes.clear()}}}function qm(e){e.updateLayout()}function Xm(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:o}=e.options,i=t.source!==e.layout.source;o==="size"?ze(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],g=$e(h);h.min=s[f].min,h.max=h.min+g}):Tl(o,t.layoutBox,s)&&ze(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],g=$e(s[f]);h.max=h.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+g)});const a=zt();mn(a,s,t.layoutBox);const c=zt();i?mn(c,e.applyTransform(r,!0),t.measuredBox):mn(c,s,t.layoutBox);const d=!wl(a);let u=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:g}=f;if(h&&g){const x=Te();pn(x,t.layoutBox,h.layoutBox);const m=Te();pn(m,s,g.layoutBox),Sl(x,m)||(u=!0),f.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=x,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:a,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function Jm(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Qm(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ep(e){e.clearSnapshot()}function zi(e){e.clearMeasurements()}function Hi(e){e.isLayoutDirty=!1}function tp(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ui(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function np(e){e.resolveTargetDelta()}function sp(e){e.calcProjection()}function rp(e){e.resetSkewAndRotation()}function op(e){e.removeLeadSnapshot()}function Zi(e,t,n){e.translate=we(t.translate,0,n),e.scale=we(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Wi(e,t,n,s){e.min=we(t.min,n.min,s),e.max=we(t.max,n.max,s)}function ip(e,t,n,s){Wi(e.x,t.x,n.x,s),Wi(e.y,t.y,n.y,s)}function ap(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const cp={duration:.45,ease:[.4,0,.1,1]},Gi=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ki=Gi("applewebkit/")&&!Gi("chrome/")?Math.round:Ze;function Yi(e){e.min=Ki(e.min),e.max=Ki(e.max)}function lp(e){Yi(e.x),Yi(e.y)}function Tl(e,t,n){return e==="position"||e==="preserve-aspect"&&!pm(_i(t),_i(n),.2)}function dp(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const up=kl({attachResizeListener:(e,t)=>Cn(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Hs={current:void 0},El=kl({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Hs.current){const e=new up({});e.mount(window),e.setOptions({layoutScroll:!0}),Hs.current=e}return Hs.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),fp={pan:{Feature:Pm},drag:{Feature:Mm,ProjectionNode:El,MeasureLayout:xl}};function qi(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,o=s[r];o&&xe.postRender(()=>o(t,jn(t)))}class hp extends pt{mount(){const{current:t}=this.node;t&&(this.unmount=$f(t,(n,s)=>(qi(this.node,s,"Start"),r=>qi(this.node,r,"End"))))}unmount(){}}class mp extends pt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Tn(Cn(this.node.current,"focus",()=>this.onFocus()),Cn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Xi(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),o=s[r];o&&xe.postRender(()=>o(t,jn(t)))}class pp extends pt{mount(){const{current:t}=this.node;t&&(this.unmount=_f(t,(n,s)=>(Xi(this.node,s,"Start"),(r,{success:o})=>Xi(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ar=new WeakMap,Us=new WeakMap,gp=e=>{const t=Ar.get(e.target);t&&t(e)},yp=e=>{e.forEach(gp)};function xp({root:e,...t}){const n=e||document;Us.has(n)||Us.set(n,{});const s=Us.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(yp,{root:e,...t})),s[r]}function bp(e,t,n){const s=xp(t);return Ar.set(e,n),s.observe(e),()=>{Ar.delete(e),s.unobserve(e)}}const vp={some:0,all:1};class wp extends pt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:vp[r]},a=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),h=d?u:f;h&&h(c)};return bp(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Sp(t,n))&&this.startObserver()}unmount(){}}function Sp({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Cp={inView:{Feature:wp},tap:{Feature:pp},focus:{Feature:mp},hover:{Feature:hp}},kp={layout:{ProjectionNode:El,MeasureLayout:xl}},Tp={...lm,...Cp,...fp,...kp},ie=Th(Tp,Oh),bo="-",Ep=e=>{const t=jp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const a=i.split(bo);return a[0]===""&&a.length!==1&&a.shift(),Al(a,t)||Ap(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&s[i]?[...c,...s[i]]:c}}},Al=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),r=s?Al(e.slice(1),s):void 0;if(r)return r;if(t.validators.length===0)return;const o=e.join(bo);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Ji=/^\[(.+)\]$/,Ap=e=>{if(Ji.test(e)){const t=Ji.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},jp=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const r in n)jr(n[r],s,r,t);return s},jr=(e,t,n,s)=>{e.forEach(r=>{if(typeof r=="string"){const o=r===""?t:Qi(t,r);o.classGroupId=n;return}if(typeof r=="function"){if(Mp(r)){jr(r(s),t,n,s);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([o,i])=>{jr(i,Qi(t,o),n,s)})})},Qi=(e,t)=>{let n=e;return t.split(bo).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Mp=e=>e.isThemeGetter,Pp=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const r=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,s=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=s.get(o))!==void 0)return r(o,i),i},set(o,i){n.has(o)?n.set(o,i):r(o,i)}}},Mr="!",Pr=":",Vp=Pr.length,Np=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const o=[];let i=0,a=0,c=0,d;for(let x=0;x<r.length;x++){let m=r[x];if(i===0&&a===0){if(m===Pr){o.push(r.slice(c,x)),c=x+Vp;continue}if(m==="/"){d=x;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const u=o.length===0?r:r.substring(c),f=Rp(u),h=f!==u,g=d&&d>c?d-c:void 0;return{modifiers:o,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:g}};if(t){const r=t+Pr,o=s;s=i=>i.startsWith(r)?o(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=s;s=o=>n({className:o,parseClassName:r})}return s},Rp=e=>e.endsWith(Mr)?e.substring(0,e.length-1):e.startsWith(Mr)?e.substring(1):e,Ip=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const r=[];let o=[];return s.forEach(i=>{i[0]==="["||t[i]?(r.push(...o.sort(),i),o=[]):o.push(i)}),r.push(...o.sort()),r}},Dp=e=>({cache:Pp(e.cacheSize),parseClassName:Np(e),sortModifiers:Ip(e),...Ep(e)}),$p=/\s+/,Fp=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:o}=t,i=[],a=e.trim().split($p);let c="";for(let d=a.length-1;d>=0;d-=1){const u=a[d],{isExternal:f,modifiers:h,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:m}=n(u);if(f){c=u+(c.length>0?" "+c:c);continue}let b=!!m,k=s(b?x.substring(0,m):x);if(!k){if(!b){c=u+(c.length>0?" "+c:c);continue}if(k=s(x),!k){c=u+(c.length>0?" "+c:c);continue}b=!1}const v=o(h).join(":"),T=g?v+Mr:v,w=T+k;if(i.includes(w))continue;i.push(w);const S=r(k,b);for(let A=0;A<S.length;++A){const M=S[A];i.push(T+M)}c=u+(c.length>0?" "+c:c)}return c};function Op(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=jl(t))&&(s&&(s+=" "),s+=n);return s}const jl=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=jl(e[s]))&&(n&&(n+=" "),n+=t);return n};function Lp(e,...t){let n,s,r,o=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return n=Dp(d),s=n.cache.get,r=n.cache.set,o=a,a(c)}function a(c){const d=s(c);if(d)return d;const u=Fp(c,n);return r(c,u),u}return function(){return o(Op.apply(null,arguments))}}const Me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ml=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_p=/^\d+\/\d+$/,Bp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Up=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mt=e=>_p.test(e),re=e=>!!e&&!Number.isNaN(Number(e)),ct=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&re(e.slice(0,-1)),et=e=>Bp.test(e),Wp=()=>!0,Gp=e=>zp.test(e)&&!Hp.test(e),Vl=()=>!1,Kp=e=>Up.test(e),Yp=e=>Zp.test(e),qp=e=>!W(e)&&!G(e),Xp=e=>en(e,Il,Vl),W=e=>Ml.test(e),xt=e=>en(e,Dl,Gp),Ws=e=>en(e,ng,re),ea=e=>en(e,Nl,Vl),Jp=e=>en(e,Rl,Yp),Ln=e=>en(e,$l,Kp),G=e=>Pl.test(e),an=e=>tn(e,Dl),Qp=e=>tn(e,sg),ta=e=>tn(e,Nl),eg=e=>tn(e,Il),tg=e=>tn(e,Rl),_n=e=>tn(e,$l,!0),en=(e,t,n)=>{const s=Ml.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},tn=(e,t,n=!1)=>{const s=Pl.exec(e);return s?s[1]?t(s[1]):n:!1},Nl=e=>e==="position"||e==="percentage",Rl=e=>e==="image"||e==="url",Il=e=>e==="length"||e==="size"||e==="bg-size",Dl=e=>e==="length",ng=e=>e==="number",sg=e=>e==="family-name",$l=e=>e==="shadow",rg=()=>{const e=Me("color"),t=Me("font"),n=Me("text"),s=Me("font-weight"),r=Me("tracking"),o=Me("leading"),i=Me("breakpoint"),a=Me("container"),c=Me("spacing"),d=Me("radius"),u=Me("shadow"),f=Me("inset-shadow"),h=Me("text-shadow"),g=Me("drop-shadow"),x=Me("blur"),m=Me("perspective"),b=Me("aspect"),k=Me("ease"),v=Me("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),G,W],A=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],j=()=>[G,W,c],z=()=>[Mt,"full","auto",...j()],y=()=>[ct,"none","subgrid",G,W],D=()=>["auto",{span:["full",ct,G,W]},ct,G,W],_=()=>[ct,"auto",G,W],J=()=>["auto","min","max","fr",G,W],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Q=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...j()],K=()=>[Mt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],R=()=>[e,G,W],X=()=>[...w(),ta,ea,{position:[G,W]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",eg,Xp,{size:[G,W]}],q=()=>[Zs,an,xt],P=()=>["","none","full",d,G,W],E=()=>["",re,an,xt],O=()=>["solid","dashed","dotted","double"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>[re,Zs,ta,ea],I=()=>["","none",x,G,W],H=()=>["none",re,G,W],B=()=>["none",re,G,W],oe=()=>[re,G,W],L=()=>[Mt,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[et],breakpoint:[et],color:[Wp],container:[et],"drop-shadow":[et],ease:["in","out","in-out"],font:[qp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[et],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[et],shadow:[et],spacing:["px",re],text:[et],"text-shadow":[et],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mt,W,G,b]}],container:["container"],columns:[{columns:[re,W,G,a]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[ct,"auto",G,W]}],basis:[{basis:[Mt,"full","auto",a,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[re,Mt,"auto","initial","none",W]}],grow:[{grow:["",re,G,W]}],shrink:[{shrink:["",re,G,W]}],order:[{order:[ct,"first","last","none",G,W]}],"grid-cols":[{"grid-cols":y()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":y()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...Q(),"normal"]}],"justify-self":[{"justify-self":["auto",...Q()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...Q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Q(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...Q(),"baseline"]}],"place-self":[{"place-self":["auto",...Q()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[a,"screen",...K()]}],"min-w":[{"min-w":[a,"screen","none",...K()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,an,xt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,G,Ws]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,W]}],"font-family":[{font:[Qp,W,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,G,W]}],"line-clamp":[{"line-clamp":[re,"none",G,Ws]}],leading:[{leading:[o,...j()]}],"list-image":[{"list-image":["none",G,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",G,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[re,"from-font","auto",G,xt]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[re,"auto",G,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G,W]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ct,G,W],radial:["",G,W],conic:[ct,G,W]},tg,Jp]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:E()}],"border-w-x":[{"border-x":E()}],"border-w-y":[{"border-y":E()}],"border-w-s":[{"border-s":E()}],"border-w-e":[{"border-e":E()}],"border-w-t":[{"border-t":E()}],"border-w-r":[{"border-r":E()}],"border-w-b":[{"border-b":E()}],"border-w-l":[{"border-l":E()}],"divide-x":[{"divide-x":E()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":E()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[re,G,W]}],"outline-w":[{outline:["",re,an,xt]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,_n,Ln]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",f,_n,Ln]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[re,xt]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":E()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,_n,Ln]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[re,G,W]}],"mix-blend":[{"mix-blend":[...F(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":F()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[re]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[re]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",G,W]}],filter:[{filter:["","none",G,W]}],blur:[{blur:I()}],brightness:[{brightness:[re,G,W]}],contrast:[{contrast:[re,G,W]}],"drop-shadow":[{"drop-shadow":["","none",g,_n,Ln]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",re,G,W]}],"hue-rotate":[{"hue-rotate":[re,G,W]}],invert:[{invert:["",re,G,W]}],saturate:[{saturate:[re,G,W]}],sepia:[{sepia:["",re,G,W]}],"backdrop-filter":[{"backdrop-filter":["","none",G,W]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[re,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[re,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",re,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[re,G,W]}],"backdrop-invert":[{"backdrop-invert":["",re,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[re,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[re,G,W]}],"backdrop-sepia":[{"backdrop-sepia":["",re,G,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",G,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[re,"initial",G,W]}],ease:[{ease:["linear","initial",k,G,W]}],delay:[{delay:[re,G,W]}],animate:[{animate:["none",v,G,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,G,W]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[G,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G,W]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G,W]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[re,an,xt,Ws]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},og=Lp(rg);function Y(...e){return og($r.clsx(e))}function ig(e,t){return{id:e.streamInfo.id,timestamp:e.streamInfo.timestamp,message:e.text,from:e.participantInfo.identity===t.localParticipant.identity?t.localParticipant:Array.from(t.remoteParticipants.values()).find(n=>n.identity===e.participantInfo.identity)}}const ag=ls.cva(["relative w-full rounded-lg border px-4 py-3 text-sm grid grid-cols-[0_1fr] gap-y-0.5 items-start","has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current"],{variants:{variant:{default:"bg-card text-card-foreground",destructive:["text-destructive-foreground bg-destructive border-destructive-border","[&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/90"]}},defaultVariants:{variant:"default"}});function cg({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:Y(ag({variant:t}),e),...n})}function lg({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:Y("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function dg({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:Y("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function Pt(e){return Ka.toast.custom(t=>l.jsx(ug,{id:t,title:e.title,description:e.description}),{duration:1e4})}function ug(e){const{title:t,id:n,description:s}=e;return l.jsxs(cg,{onClick:()=>Ka.toast.dismiss(n),className:"bg-gradient-to-br from-[#181825] to-[#232336] border border-[#232336] shadow-lg shadow-black/40 rounded-xl px-4 py-3 flex items-start gap-3 hover:shadow-xl transition-all duration-200",style:{color:"#F3F4F6"},children:[l.jsx(Bd.WarningIcon,{weight:"bold",className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx(lg,{className:"text-base font-semibold text-white mb-1",children:t}),l.jsx(dg,{className:"text-sm text-gray-300 leading-snug",children:s})]})]})}const Ye=p.forwardRef((e,t)=>{const{alt:n,color:s="currentColor",size:r="1em",weight:o="regular",mirrored:i=!1,children:a,weights:c,...d}=e;return p.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...d},!!n&&p.createElement("title",null,n),a,c.get(o))});Ye.displayName="SSRBase";const fg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),p.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),vo=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:fg}));vo.displayName="CaretDownIcon";const hg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),p.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),Fl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:hg}));Fl.displayName="CaretUpIcon";const mg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,44H40A20,20,0,0,0,20,64V224A19.82,19.82,0,0,0,31.56,242.1a20.14,20.14,0,0,0,8.49,1.9,19.91,19.91,0,0,0,12.82-4.72l.12-.11L84.47,212H216a20,20,0,0,0,20-20V64A20,20,0,0,0,216,44Zm-4,144H80a11.93,11.93,0,0,0-7.84,2.92L44,215.23V68H212ZM84,108A12,12,0,0,1,96,96h64a12,12,0,1,1,0,24H96A12,12,0,0,1,84,108Zm0,40a12,12,0,0,1,12-12h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,148Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,64V192a8,8,0,0,1-8,8H80L45.15,230.11A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z",opacity:"0.2"}),p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM160,152H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,50H40A14,14,0,0,0,26,64V224a13.88,13.88,0,0,0,8.09,12.69A14.11,14.11,0,0,0,40,238a13.87,13.87,0,0,0,9-3.31l.06-.05L82.23,206H216a14,14,0,0,0,14-14V64A14,14,0,0,0,216,50Zm2,142a2,2,0,0,1-2,2H80a6,6,0,0,0-3.92,1.46L41.26,225.53A2,2,0,0,1,38,224V64a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2Zm-52-80a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,144Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216ZM88,112a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,112Zm0,32a8,8,0,0,1,8-8h64a8,8,0,1,1,0,16H96A8,8,0,0,1,88,144Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,52H40A12,12,0,0,0,28,64V224a11.89,11.89,0,0,0,6.93,10.88A12.17,12.17,0,0,0,40,236a11.89,11.89,0,0,0,7.69-2.83l0,0L81.49,204H216a12,12,0,0,0,12-12V64A12,12,0,0,0,216,52Zm4,140a4,4,0,0,1-4,4H80a4,4,0,0,0-2.62,1L42.56,227.06A4,4,0,0,1,36,224V64a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4Zm-56-80a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,144Z"}))]]),Ol=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:mg}));Ol.displayName="ChatTextIcon";const pg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),p.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Ll=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:pg}));Ll.displayName="CheckIcon";const gg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,180a52.06,52.06,0,0,0,52-52V64A52,52,0,0,0,76,64v64A52.06,52.06,0,0,0,128,180ZM100,64a28,28,0,0,1,56,0v64a28,28,0,0,1-56,0Zm40,155.22V240a12,12,0,0,1-24,0V219.22A92.14,92.14,0,0,1,36,128a12,12,0,0,1,24,0,68,68,0,0,0,136,0,12,12,0,0,1,24,0A92.14,92.14,0,0,1,140,219.22Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),p.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M80,128V64a48,48,0,0,1,96,0v64a48,48,0,0,1-96,0Zm128,0a8,8,0,0,0-16,0,64,64,0,0,1-128,0,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.6A80.11,80.11,0,0,0,208,128Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,174a46.06,46.06,0,0,0,46-46V64a46,46,0,0,0-92,0v64A46.06,46.06,0,0,0,128,174ZM94,64a34,34,0,0,1,68,0v64a34,34,0,0,1-68,0Zm40,141.75V240a6,6,0,0,1-12,0V205.75A78.09,78.09,0,0,1,50,128a6,6,0,0,1,12,0,66,66,0,0,0,132,0,6,6,0,0,1,12,0A78.09,78.09,0,0,1,134,205.75Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,172a44.05,44.05,0,0,0,44-44V64a44,44,0,0,0-88,0v64A44.05,44.05,0,0,0,128,172ZM92,64a36,36,0,0,1,72,0v64a36,36,0,0,1-72,0Zm40,139.89V240a4,4,0,0,1-8,0V203.89A76.09,76.09,0,0,1,52,128a4,4,0,0,1,8,0,68,68,0,0,0,136,0,4,4,0,0,1,8,0A76.09,76.09,0,0,1,132,203.89Z"}))]]),_l=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:gg}));_l.displayName="MicrophoneIcon";const yg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M56.88,39.93A12,12,0,1,0,39.12,56.07L76,96.64V128a52,52,0,0,0,72.11,48l11.26,12.39A67.34,67.34,0,0,1,128,196a68.07,68.07,0,0,1-68-68,12,12,0,0,0-24,0,92.14,92.14,0,0,0,80,91.22V240a12,12,0,0,0,24,0V219.23a90.39,90.39,0,0,0,35.92-12.68l23.2,25.52a12,12,0,0,0,17.76-16.14ZM128,156a28,28,0,0,1-28-28v-5l29.9,32.89C129.27,156,128.64,156,128,156Zm63-2.42A67.63,67.63,0,0,0,196,128a12,12,0,0,1,24,0,91.48,91.48,0,0,1-6.74,34.61,12,12,0,0,1-22.23-9ZM85.7,33.75A52,52,0,0,1,180,64v56.54a12,12,0,0,1-24,0V64a28,28,0,0,0-50.79-16.28,12,12,0,0,1-19.51-14Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,64v64a40,40,0,0,1-40,40h0a40,40,0,0,1-40-40V64a40,40,0,0,1,40-40h0A40,40,0,0,1,168,64Z",opacity:"0.2"}),p.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.38,229.92a8,8,0,0,1-11.3-.54l-30.92-34A78.83,78.83,0,0,1,136,207.59V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64.07,64.07,0,0,0,64,64,63.41,63.41,0,0,0,32.21-8.68l-11.1-12.2A48,48,0,0,1,80,128V95.09L42.08,53.38A8,8,0,0,1,53.92,42.62l160,176A8,8,0,0,1,213.38,229.92Zm-24.19-63.13a7.88,7.88,0,0,0,3.51.82,8,8,0,0,0,7.19-4.49A79.16,79.16,0,0,0,208,128a8,8,0,0,0-16,0,63.32,63.32,0,0,1-6.48,28.09A8,8,0,0,0,189.19,166.79Zm-27.33-29.22A8,8,0,0,0,175.74,133a49.49,49.49,0,0,0,.26-5V64A48,48,0,0,0,84,44.87a8,8,0,0,0,1.41,8.57Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M212.44,220,52.44,44A6,6,0,0,0,43.56,52L82,94.32V128a46,46,0,0,0,67.56,40.64l13.75,15.12A65.26,65.26,0,0,1,128,194a66.08,66.08,0,0,1-66-66,6,6,0,0,0-12,0,78.09,78.09,0,0,0,72,77.75V240a6,6,0,0,0,12,0V205.77a76.93,76.93,0,0,0,37.48-13L203.56,228a6,6,0,0,0,8.88-8.08ZM128,162a34,34,0,0,1-34-34V107.52l47.12,51.84A33.82,33.82,0,0,1,128,162Zm59.32-5A65.38,65.38,0,0,0,194,128a6,6,0,0,1,12,0,77.33,77.33,0,0,1-7.9,34.25A6,6,0,1,1,187.32,157ZM85.8,45.67A46,46,0,0,1,174,64v64a45.17,45.17,0,0,1-.25,4.81,6,6,0,0,1-6,5.38q-.31,0-.63,0a6,6,0,0,1-5.34-6.59A35.41,35.41,0,0,0,162,128V64A34,34,0,0,0,96.8,50.45a6,6,0,0,1-11-4.78Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M211,221.31,51,45.31A4,4,0,0,0,45,50.69L84,93.55V128a44,44,0,0,0,66,38.12l16.38,18A67.21,67.21,0,0,1,128,196a68.07,68.07,0,0,1-68-68,4,4,0,0,0-8,0,76.09,76.09,0,0,0,72,75.89V240a4,4,0,0,0,8,0V203.89a75.1,75.1,0,0,0,39.79-13.77L205,226.69a4,4,0,1,0,5.92-5.38ZM128,164a36,36,0,0,1-36-36V102.35L144.43,160A35.83,35.83,0,0,1,128,164Zm61.12-6.15A67.44,67.44,0,0,0,196,128a4,4,0,0,1,8,0,75.28,75.28,0,0,1-7.7,33.37,4,4,0,0,1-7.18-3.52ZM87.63,46.46A44,44,0,0,1,172,64v64a44.2,44.2,0,0,1-.24,4.61,4,4,0,0,1-4,3.58l-.42,0a4,4,0,0,1-3.57-4.39A36.67,36.67,0,0,0,164,128V64A36,36,0,0,0,95,49.66a4,4,0,0,1-7.34-3.2Z"}))]]),Bl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:yg}));Bl.displayName="MicrophoneSlashIcon";const xg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,36H48A28,28,0,0,0,20,64V176a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V64A28,28,0,0,0,208,36Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40,52a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,228ZM160.49,103.51a12,12,0,0,1-17,17L140,117v35a12,12,0,0,1-24,0V117l-3.51,3.52a12,12,0,0,1-17-17l24-24a12,12,0,0,1,17,0Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,64V176a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V64A16,16,0,0,1,48,48H208A16,16,0,0,1,224,64Z",opacity:"0.2"}),p.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM232,64V176a24,24,0,0,1-24,24H48a24,24,0,0,1-24-24V64A24,24,0,0,1,48,40H208A24,24,0,0,1,232,64Zm-74.34,42.34-24-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,11.32,11.32L120,107.31V152a8,8,0,0,0,16,0V107.31l10.34,10.35a8,8,0,0,0,11.32-11.32Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,42H48A22,22,0,0,0,26,64V176a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V64A22,22,0,0,0,208,42Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V64A10,10,0,0,1,48,54H208a10,10,0,0,1,10,10Zm-52,48a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,224Zm-9.76-116.24a6,6,0,1,1-8.48,8.48L134,102.49V152a6,6,0,0,1-12,0V102.49l-13.76,13.75a6,6,0,0,1-8.48-8.48l24-24a6,6,0,0,1,8.48,0Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8Zm-48,48a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,224ZM157.66,106.34a8,8,0,0,1-11.32,11.32L136,107.31V152a8,8,0,0,1-16,0V107.31l-10.34,10.35a8,8,0,0,1-11.32-11.32l24-24a8,8,0,0,1,11.32,0Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M208,44H48A20,20,0,0,0,28,64V176a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V64A20,20,0,0,0,208,44Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V64A12,12,0,0,1,48,52H208a12,12,0,0,1,12,12Zm-56,48a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm-9.17-114.83a4,4,0,0,1-5.66,5.66L132,97.66V152a4,4,0,0,1-8,0V97.66l-17.17,17.17a4,4,0,0,1-5.66-5.66l24-24a4,4,0,0,1,5.66,0Z"}))]]),zl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:xg}));zl.displayName="MonitorArrowUpIcon";const bg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm33.25,62.75a12,12,0,0,0,8.49-3.52L204.37,68.6a12,12,0,0,0-17-17L164.77,74.26a12,12,0,0,0,8.48,20.49ZM224,116H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),p.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm33.94,58.75,17-17a8,8,0,0,1,11.32,11.32l-17,17a8,8,0,0,1-11.31-11.31ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm39.25,56.75A6,6,0,0,0,177.5,87l22.62-22.63a6,6,0,0,0-8.48-8.48L169,78.5a6,6,0,0,0,4.24,10.25ZM224,122H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm37.25,58.75a8,8,0,0,0,5.66-2.35l22.63-22.62a8,8,0,0,0-11.32-11.32L167.6,77.09a8,8,0,0,0,5.65,13.66ZM224,120H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm41.25,54.75a4,4,0,0,0,2.83-1.18L198.71,63a4,4,0,0,0-5.66-5.66L170.43,79.92a4,4,0,0,0,2.82,6.83ZM224,124H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z"}))]]),wo=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:bg}));wo.displayName="SpinnerIcon";const vg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V167.57l24.94,18.14A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM188,180H36V76H188Zm44-27.57-20-14.54V118.11l20-14.54Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M192,72V184a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V72A16,16,0,0,1,32,56H176A16,16,0,0,1,192,72Zm58,.25a8.23,8.23,0,0,0-6.63,1.22L209.78,95.86A4,4,0,0,0,208,99.19v57.62a4,4,0,0,0,1.78,3.33l33.78,22.52a8,8,0,0,0,8.58.19,8.33,8.33,0,0,0,3.86-7.17V80A8,8,0,0,0,250,72.25Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V155.21L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM194,184a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H192a2,2,0,0,1,2,2Zm48-19.21-36-24V115.21l36-24Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V151.47l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM196,184a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H192a4,4,0,0,1,4,4Zm48-15.47-40-26.67V114.14l40-26.67Z"}))]]),Hl=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:vg}));Hl.displayName="VideoCameraIcon";const wg=new Map([["bold",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.45,69.31a12,12,0,0,0-12.51,1L212,88.43V72a20,20,0,0,0-20-20H123.88a12,12,0,0,0,0,24H188v68a12,12,0,0,0,4.46,9.33c.15.13.31.25.48.38l44,32A12,12,0,0,0,256,176V80A12,12,0,0,0,249.45,69.31ZM232,152.43l-20-14.54V118.11l20-14.54ZM56.88,31.93A12,12,0,1,0,39.12,48.07L42.69,52H32A20,20,0,0,0,12,72V184a20,20,0,0,0,20,20H180.87l18.25,20.07a12,12,0,0,0,17.76-16.14ZM36,180V76H64.51l94.55,104Z"}))],["duotone",p.createElement(p.Fragment,null,p.createElement("path",{d:"M200,72V184a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H192A8,8,0,0,1,200,72Z",opacity:"0.2"}),p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["fill",p.createElement(p.Fragment,null,p.createElement("path",{d:"M256,80.23v95.45a8.33,8.33,0,0,1-3.86,7.17,8,8,0,0,1-8.58-.19l-33.78-22.52a4,4,0,0,1-1.78-3.33V99.19a4,4,0,0,1,1.78-3.32l33.78-22.53a8,8,0,0,1,9.73.66A8.23,8.23,0,0,1,256,80.23ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM185,155.07a4,4,0,0,0,7-2.7V72a16,16,0,0,0-16-16H104a4,4,0,0,0-3,6.69Z"}))],["light",p.createElement(p.Fragment,null,p.createElement("path",{d:"M250.83,74.71a6,6,0,0,0-6.16.3L206,100.79V72a14,14,0,0,0-14-14H113.06a6,6,0,0,0,0,12H192a2,2,0,0,1,2,2v87.63a6,6,0,0,0,12,0v-4.42L244.67,181a6,6,0,0,0,9.33-5V80A6,6,0,0,0,250.83,74.71ZM242,164.79l-36-24V115.21l36-24ZM52.44,36A6,6,0,0,0,43.56,44L56.25,58H32A14,14,0,0,0,18,72V184a14,14,0,0,0,14,14H183.53l20,22a6,6,0,0,0,8.88-8.08ZM32,186a2,2,0,0,1-2-2V72a2,2,0,0,1,2-2H67.16L172.62,186Z"}))],["regular",p.createElement(p.Fragment,null,p.createElement("path",{d:"M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H113.06a8,8,0,0,0,0,16H192v87.63a8,8,0,0,0,16,0V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM240,161.05l-32-21.33V116.28L240,95ZM53.92,34.62A8,8,0,1,0,42.08,45.38L51.73,56H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H182.64l19.44,21.38a8,8,0,1,0,11.84-10.76ZM32,184V72H66.28L168.1,184Z"}))],["thin",p.createElement(p.Fragment,null,p.createElement("path",{d:"M249.89,76.47a4,4,0,0,0-4.11.2L204,104.53V72a12,12,0,0,0-12-12H113.06a4,4,0,0,0,0,8H192a4,4,0,0,1,4,4v87.63a4,4,0,0,0,8,0v-8.16l41.78,27.86A4,4,0,0,0,252,176V80A4,4,0,0,0,249.89,76.47ZM244,168.53l-40-26.67V114.14l40-26.67ZM51,37.31A4,4,0,0,0,45,42.69L60.78,60H32A12,12,0,0,0,20,72V184a12,12,0,0,0,12,12H184.41L205,218.69a4,4,0,1,0,5.92-5.38ZM32,188a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4H68.05L177.14,188Z"}))]]),Ul=p.forwardRef((e,t)=>p.createElement(Ye,{ref:t,...e,weights:wg}));Ul.displayName="VideoCameraSlashIcon";function na(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sg(...e){return t=>{let n=!1;const s=e.map(r=>{const o=na(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():na(e[r],null)}}}}function Cg(e){const t=Tg(e),n=p.forwardRef((s,r)=>{const{children:o,...i}=s,a=p.Children.toArray(o),c=a.find(Ag);if(c){const d=c.props.children,u=a.map(f=>f===c?p.Children.count(d)>1?p.Children.only(null):p.isValidElement(d)?d.props.children:null:f);return l.jsx(t,{...i,ref:r,children:p.isValidElement(d)?p.cloneElement(d,void 0,u):null})}return l.jsx(t,{...i,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}var kg=Cg("Slot");function Tg(e){const t=p.forwardRef((n,s)=>{const{children:r,...o}=n;if(p.isValidElement(r)){const i=Mg(r),a=jg(o,r.props);return r.type!==p.Fragment&&(a.ref=s?Sg(s,i):i),p.cloneElement(r,a)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Eg=Symbol("radix.slottable");function Ag(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eg}function jg(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...a)=>{const c=o(...a);return r(...a),c}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function Mg(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Pg=ls.cva(["text-xs font-bold tracking-wider uppercase whitespace-nowrap","inline-flex items-center justify-center gap-2 shrink-0 rounded-full cursor-pointer outline-none transition-colors duration-300","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","disabled:pointer-events-none disabled:opacity-50","aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:aria-invalid:ring-destructive/40 ","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button text-button-foreground hover:bg-muted focus:bg-muted",destructive:["bg-destructive text-destructive-foreground","hover:bg-destructive-hover focus:bg-destructive-hover focus-visible:ring-destructive-foreground/20","dark:focus-visible:ring-destructive-foreground/40"],outline:["border bg-background","hover:bg-accent hover:text-accent-foreground","dark:bg-input/30 dark:border-input dark:hover:bg-input/50"],primary:"",secondary:"bg-secondary text-secondary-foregroun hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Vg({className:e,variant:t,size:n,asChild:s=!1,...r}){const o=s?kg:"button";return l.jsx(o,{"data-slot":"button",className:Y(Pg({variant:t,size:n,className:e})),...r})}function Ng({onSend:e,className:t,disabled:n,...s}){const r=C.useRef(null),[o,i]=C.useState(""),a=d=>{var u,f;d.preventDefault(),(u=s.onSubmit)==null||u.call(s,d),e==null||e(o),i(""),(f=r.current)==null||f.focus({preventScroll:!0})},c=n||o.trim().length===0;return l.jsxs("form",{...s,onSubmit:a,className:Y("flex items-center rounded-md pl-1 text-sm",t),children:[l.jsx("input",{ref:r,type:"text",className:"flex-1 focus:outline-none",placeholder:"Type something...",value:o,onChange:d=>i(d.target.value),disabled:n}),l.jsx(Vg,{size:"sm",type:"submit",variant:c?"secondary":"primary",disabled:c,className:"font-mono",children:"SEND"})]})}const Rg=ls.cva(["inline-flex items-center justify-center gap-2 rounded-full","text-sm font-medium whitespace-nowrap","cursor-pointer outline-none transition-[color,border,background-color]","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0 aria-invalid:border-0","disabled:pointer-events-none disabled:opacity-50 disabled:not-allowed","data-[state=on]:bg-button-selected data-[state=on]:border-button-border-selected","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"bg-button hover:bg-muted focus:bg-muted hover:text-muted-foreground focus:text-muted-foreground",primary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=off]:bg-button-primary hover:data-[state=off]:bg-button-hover data-[state=off]:text-button-primary-foreground",secondary:"text-fg1 bg-button hover:bg-button-hover focus:bg-button-hover data-[state=on]:bg-button-secondary hover:data-[state=on]:bg-button-secondary data-[state=on]:text-button-secondary-foreground",outline:["border border-button-border bg-button text-button-foreground","hover:bg-background focus:bg-background"]},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function Zl({className:e,variant:t,size:n,...s}){return l.jsx(Wd.Root,{"data-slot":"toggle",className:Y(Rg({variant:t,size:n,className:e})),...s})}function Ig(e){const[t,n]=C.useState(()=>e.getPublishPermissions());return C.useEffect(()=>{const s=()=>{n(e.getPublishPermissions())},r=()=>{s()};return e.on("connection.connected",r),e.on("connection.disconnected",r),()=>{e.off("connection.connected",r),e.off("connection.disconnected",r)}},[e]),t}function Wl(e){const[t,n]=C.useState(()=>e.getLocalParticipant()),[s,r]=C.useState(()=>e.getMicrophoneTrack());return C.useEffect(()=>{const o=()=>{const a=e.getLocalParticipant(),c=e.getMicrophoneTrack();console.log("๐ŸŽค useVoxketLocalParticipant: Updating state:",{hasParticipant:!!a,hasMicTrack:!!c,isMicEnabled:e.isMicrophoneEnabled,trackPublications:a?a.trackPublications.size:0}),n(a),r(c)};o(),e.on("connection.connected",o),e.on("connection.disconnected",o),e.on("track.muted",o),e.on("track.unmuted",o);const i=e.getRoom();if(i){const a=()=>{console.log("๐ŸŽค Track published, updating participant state"),o()},c=()=>{console.log("๐ŸŽค Track unpublished, updating participant state"),o()};return i.on("localTrackPublished",a),i.on("localTrackUnpublished",c),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("track.muted",o),e.off("track.unmuted",o),i.off("localTrackPublished",a),i.off("localTrackUnpublished",c)}}else return()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("track.muted",o),e.off("track.unmuted",o)}},[e]),{localParticipant:t,microphoneTrack:s}}function gn(e,t,n){const[s,r]=C.useState(!1),[o,i]=C.useState(!1);return C.useEffect(()=>{const c=()=>{let d=!1;switch(t){case"microphone":d=e.isMicrophoneEnabled;break;case"camera":d=e.isCameraEnabled;break;case"screenShare":d=e.isScreenShareEnabled;break}console.log(`useVoxketTrackToggle: ${t} enabled state updated to:`,d),r(d)};return c(),e.on("track.muted",c),e.on("track.unmuted",c),e.on("connection.connected",c),()=>{e.off("track.muted",c),e.off("track.unmuted",c),e.off("connection.connected",c)}},[e,t]),{enabled:s,pending:o,toggle:async c=>{var d;try{i(!0);const u=c!==void 0?c:!s;switch(t){case"microphone":await e.toggleMicrophone(u);break;case"camera":await e.toggleCamera(u);break;case"screenShare":u?await e.startScreenShare():await e.stopScreenShare();break}}catch(u){(d=n==null?void 0:n.onDeviceError)==null||d.call(n,u)}finally{i(!1)}}}}function Gl(e){const[t,n]=C.useState(()=>e.getRoom()),[s,r]=C.useState(()=>e.getConnectionState());return C.useEffect(()=>{const o=()=>{n(e.getRoom()),r(e.getConnectionState())};return e.on("connection.connected",o),e.on("connection.disconnected",o),e.on("connection.connecting",o),()=>{e.off("connection.connected",o),e.off("connection.disconnected",o),e.off("connection.connecting",o)}},[e]),t}function Dg(e,t){const[n,s]=C.useState([]),[r,o]=C.useState("");return C.useEffect(()=>{var d;const a=async()=>{try{const u=t==="audioinput"?await e.getAudioInputDevices():await e.getVideoInputDevices();s(u)}catch(u){console.error("Failed to load devices:",u)}};a();const c=()=>{a()};return(d=navigator.mediaDevices)==null||d.addEventListener("devicechange",c),()=>{var u;(u=navigator.mediaDevices)==null||u.removeEventListener("devicechange",c)}},[e,t]),{devices:n,activeDeviceId:r,setActiveMediaDevice:async a=>{try{t==="audioinput"?await e.setAudioInputDevice(a):await e.setVideoInputDevice(a),o(a)}catch(c){console.error("Failed to set device:",c)}}}}function $g(e){const{preventSave:t=!1}=e||{};return{saveAudioInputEnabled:i=>{t||localStorage.setItem("voxket-audio-input-enabled",i.toString())},saveAudioInputDeviceId:i=>{t||localStorage.setItem("voxket-audio-input-device-id",i)},saveVideoInputEnabled:i=>{t||localStorage.setItem("voxket-video-input-enabled",i.toString())},saveVideoInputDeviceId:i=>{t||localStorage.setItem("voxket-video-input-device-id",i)}}}function Kl(e){const[t,n]=C.useState(()=>e.getIsAgentConnected()),[s,r]=C.useState(()=>e.getCurrentSession()),[o,i]=C.useState(()=>e.getCurrentAgentInfo()),[a,c]=C.useState(()=>e.getAgentState()),[d,u]=C.useState(()=>e.getAgentAudioTrack()),[f,h]=C.useState(()=>e.getAgentVideoTrack());return C.useEffect(()=>{const g=()=>{const T=e.getIsAgentConnected(),w=e.getCurrentSession(),S=e.getCurrentAgentInfo(),A=e.getAgentState(),M=e.getAgentAudioTrack(),j=e.getAgentVideoTrack();console.log("๐Ÿค– useVoxketVoiceAssistant: Updating state:",{isAgentConnected:T,hasSession:!!w,sessionId:w==null?void 0:w.id,hasAgentInfo:!!S,agentState:A,hasAudioTrack:!!M,hasVideoTrack:!!j}),n(T),r(w),i(S),c(A),u(M),h(j)};g();const x=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent connected event"),g()},m=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent disconnected event"),g()},b=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Session changed event"),g()},k=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Connection changed event"),g()},v=()=>{console.log("๐Ÿค– useVoxketVoiceAssistant: Agent state changed event"),g()};return e.on("agent.connected",x),e.on("agent.speaking",x),e.on("agent.thinking",x),e.on("agent.state.changed",v),e.on("connection.disconnected",m),e.on("session.created",b),e.on("session.ended",b),e.on("session.state.changed",b),e.on("connection.connected",k),()=>{e.off("agent.connected",x),e.off("agent.speaking",x),e.off("agent.thinking",x),e.off("agent.state.changed",v),e.off("connection.disconnected",m),e.off("session.created",b),e.off("session.ended",b),e.off("session.state.changed",b),e.off("connection.connected",k)}},[e]),{agent:{isActive:t,info:o},session:s,state:a,audioTrack:d,videoTrack:f}}function Fg(e){const[t,n]=C.useState(()=>e.getVideoTrackRefs()),[s,r]=C.useState(()=>e.getCameraTrackRefs()),[o,i]=C.useState(()=>e.getScreenShareTrackRefs());return C.useEffect(()=>{const a=()=>{const d=e.getVideoTrackRefs(),u=e.getCameraTrackRefs(),f=e.getScreenShareTrackRefs();console.log("๐Ÿ“น useVoxketVideoTracks: Updating tracks:",{videoCount:d.length,cameraCount:u.length,screenShareCount:f.length}),n(d),r(u),i(f)};a(),e.on("connection.connected",a),e.on("connection.disconnected",a),e.on("track.muted",a),e.on("track.unmuted",a),e.on("participant.joined",a),e.on("participant.left",a);const c=e.getRoom();if(c){const d=()=>{console.log("๐Ÿ“น Track event, updating video tracks"),a()};return c.on("localTrackPublished",d),c.on("localTrackUnpublished",d),c.on("trackPublished",d),c.on("trackUnpublished",d),c.on("trackSubscribed",d),c.on("trackUnsubscribed",d),()=>{e.off("connection.connected",a),e.off("connection.disconnected",a),e.off("track.muted",a),e.off("track.unmuted",a),e.off("participant.joined",a),e.off("participant.left",a),c.off("localTrackPublished",d),c.off("localTrackUnpublished",d),c.off("trackPublished",d),c.off("trackUnpublished",d),c.off("trackSubscribed",d),c.off("trackUnsubscribed",d)}}else return()=>{e.off("connection.connected",a),e.off("connection.disconnected",a),e.off("track.muted",a),e.off("track.unmuted",a),e.off("participant.joined",a),e.off("participant.left",a)}},[e]),{videoTrackRefs:t,cameraTrackRefs:s,screenShareTrackRefs:o}}function sa({...e}){return l.jsx(Ue.Root,{"data-slot":"select",...e})}function ra({...e}){return l.jsx(Ue.Value,{"data-slot":"select-value",...e})}function oa({className:e,size:t="default",children:n,...s}){return l.jsxs(Ue.Trigger,{"data-slot":"select-trigger","data-size":t,className:Y(["flex w-fit cursor-pointer items-center justify-between gap-2","rounded-full px-3 py-2 text-sm whitespace-nowrap","bg-button transition-[color,border,background-color]","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-muted hover:text-muted-foreground","!focus:ring-0 !focus-visible:ring-0 !focus:border-none !focus-visible:border-none !ring-0 !border-none !outline-none","aria-invalid:ring-0 dark:aria-invalid:ring-0","data-[placeholder]:text-muted-foreground","data-[size=default]:h-9 data-[size=sm]:h-8","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&:not([class*='text-'])_svg:not([class*='text-'])]:text-muted-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...s,children:[n,l.jsx(Ue.Icon,{asChild:!0,children:l.jsx(vo,{weight:"bold",className:"size-4 transition-colors"})})]})}function ia({className:e,children:t,position:n="popper",...s}){return l.jsx(Ue.Portal,{children:l.jsxs(Ue.Content,{"data-slot":"select-content",className:Y(["bg-[#18182a]/90 backdrop-blur-md text-white border border-[#23233a] shadow-2xl","relative z-50 overflow-x-hidden overflow-y-auto rounded-xl","max-h-(--radix-select-content-available-height) min-w-[8rem]","origin-(--radix-select-content-transform-origin)","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=top]:slide-in-from-bottom-2","data-[side=right]:slide-in-from-left-2","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[l.jsx(Og,{}),l.jsx(Ue.Viewport,{className:Y("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(Lg,{})]})})}function aa({className:e,children:t,...n}){return l.jsxs(Ue.Item,{"data-slot":"select-item",className:Y(["relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","cursor-pointer disabled:cursor-not-allowed","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2","[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"],e),...n,children:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(Ue.ItemIndicator,{children:l.jsx(Ll,{className:"size-4",weight:"bold"})})}),l.jsx(Ue.ItemText,{children:t})]})}function Og({className:e,...t}){return l.jsx(Ue.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Fl,{className:"size-4",weight:"bold"})})}function Lg({className:e,...t}){return l.jsx(Ue.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(vo,{className:"size-4",weight:"bold"})})}const ca=ls.cva(["w-full rounded-full px-3 py-2 text-sm cursor-pointer","disabled:not-allowed hover:bg-button-hover focus:bg-button-hover"],{variants:{size:{default:"w-[180px]",sm:"w-auto"}},defaultVariants:{size:"default"}});function la({kind:e,track:t,requestPermissions:n,onError:s,client:r,...o}){const i=o.size||"default";if(!r)return l.jsxs(sa,{disabled:!0,children:[l.jsx(oa,{className:Y(ca({size:i}),o.className),children:l.jsx(ra,{placeholder:`Select a ${e}`})}),l.jsx(ia,{children:l.jsx(aa,{value:"none",children:"No devices available"})})]});const{devices:a,activeDeviceId:c,setActiveMediaDevice:d}=Dg(r,e==="audioinput"?"audioinput":"videoinput");return l.jsxs(sa,{value:c,onValueChange:d,children:[l.jsx(oa,{className:Y(ca({size:i}),o.className,"hover:bg"),children:i!=="sm"&&l.jsx(ra,{className:"font-mono text-sm",placeholder:`Select a ${e}`})}),l.jsx(ia,{children:a.map(u=>l.jsx(aa,{value:u.deviceId,className:"font-mono text-xs",children:u.label},u.deviceId))})]})}function _g(e,t,n=!1){if(n)return wo;switch(e){case Z.Track.Source.Microphone:return t?_l:Bl;case Z.Track.Source.Camera:return t?Hl:Ul;case Z.Track.Source.ScreenShare:return zl;default:return p.Fragment}}function Gs({source:e,pressed:t,pending:n,className:s,...r}){const o=_g(e,t??!1,n),i=e===Z.Track.Source.Microphone&&!(t??!1)&&!n,a=e===Z.Track.Source.Camera&&!(t??!1)&&!n;return p.useEffect(()=>{console.log(`TrackToggle for ${e} changed: pressed=${t}, pending=${n}, actualState=${t?"enabled":"disabled"}`)},[e,t,n]),l.jsxs(Zl,{pressed:t,"aria-label":`Toggle ${e}`,className:Y(s),...r,children:[l.jsx(o,{weight:"bold",className:Y(n&&"animate-spin",i||a?"text-red-500":void 0)}),r.children]})}function Bg(e){return e?Ig(e):{camera:!0,microphone:!0,screenShare:!0,data:!0}}function zg(e={}){const{controls:t,saveUserChoices:n=!0,client:s}=e,r={leave:!0,...t};if(!s)return{micTrackRef:{participant:void 0,source:Z.Track.Source.Microphone,publication:void 0},visibleControls:r,microphoneToggle:{enabled:!1,pending:!1,toggle:async()=>{}},cameraToggle:{enabled:!1,pending:!1,toggle:async()=>{}},screenShareToggle:{enabled:!1,pending:!1,toggle:async()=>{}},handleDisconnect:()=>{},handleAudioDeviceChange:()=>{},handleVideoDeviceChange:()=>{}};const{microphoneTrack:o,localParticipant:i}=Wl(s),a=Bg(s);Gl(s);const c=gn(s,"microphone",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.Microphone,error:A})}}),d=gn(s,"camera",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.Camera,error:A})}}),u=gn(s,"screenShare",{onDeviceError:A=>{var M;return(M=e.onDeviceError)==null?void 0:M.call(e,{source:Z.Track.Source.ScreenShare,error:A})}}),f=p.useMemo(()=>{let A;if(i){for(const[,M]of i.trackPublications)if(M.source===Z.Track.Source.Microphone){A=M;break}}return console.log("๐ŸŽค Creating micTrackRef:",{hasParticipant:!!i,hasPublication:!!A,isTrackSubscribed:A==null?void 0:A.isSubscribed,isMuted:A==null?void 0:A.isMuted,trackSid:A==null?void 0:A.trackSid}),{participant:i??void 0,source:Z.Track.Source.Microphone,publication:A}},[i,o]);r.microphone??(r.microphone=a.microphone),r.screenShare??(r.screenShare=a.screenShare),r.camera??(r.camera=a.camera),r.chat??(r.chat=a.data);const{saveAudioInputEnabled:h,saveAudioInputDeviceId:g,saveVideoInputEnabled:x,saveVideoInputDeviceId:m}=$g({preventSave:!n}),b=p.useCallback(()=>{s&&(typeof s.endSession=="function"?(s.endSession(),console.log("โœ… AgentControlBar: Session ended via client.endSession()")):(s.disconnect(),console.log("โš ๏ธ AgentControlBar: Using fallback client.disconnect()")))},[s]),k=p.useCallback(A=>{g(A??"default"),s&&s.setAudioInputDevice(A)},[g,s]),v=p.useCallback(A=>{m(A??"default"),s&&s.setVideoInputDevice(A)},[m,s]),T=p.useCallback(async A=>{u.enabled&&await u.toggle(!1),await d.toggle(A),x(!d.enabled)},[d,x,u]),w=p.useCallback(async A=>{await c.toggle(A),h(!c.enabled)},[c,h]),S=p.useCallback(async A=>{d.enabled&&await d.toggle(!1),await u.toggle(A)},[d,u]);return{micTrackRef:f,visibleControls:r,cameraToggle:{...d,toggle:T},microphoneToggle:{...c,toggle:w},screenShareToggle:{...u,toggle:S},handleDisconnect:b,handleAudioDeviceChange:k,handleVideoDeviceChange:v}}const Hg={card:" bg-gradient-to-br from-black to-gray-900 border border-gray-900 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto rounded-2xl shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-black/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-gray-800/20 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-gray-600/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-gray-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-gray-400 to-gray-500 rounded-full blur-sm opacity-20 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-gray-500 to-gray-600 rounded-full blur-sm opacity-15 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-black to-gray-900 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-300"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900",promptSlider:"absolute w-full py-3 px-2 bg-gray-900 rounded-xl text-center text-white text-sm transition-opacity duration-700 ease-in-out border border-gray-600",statusIndicator:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-gray-600/30 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-gray-500/20 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-gray-400/15 pulse-ring"},controlBar:"border border-gray-600 rounded-3xl py-4 flex flex-col justify-end h-full bg-gray-900/50 backdrop-blur-sm",chatInput:{container:"bg-gray-900 w-full border-gray-600",textarea:"bg-gray-800 border-none text-white placeholder-gray-400",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-gray-600 text-white",other:"bg-gray-700 text-white"},chatHeader:{container:"bg-gray-900 border-gray-600",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-gray-400 mb-2",suggestedResponse:{container:"bg-gray-800 text-blue-300 border-gray-700 hover:bg-gray-700 hover:text-white"},video:{container:"bg-gradient-to-br from-black to-gray-900 text-white",header:"border-gray-700 bg-gray-900/50",headerButton:"bg-gray-800 hover:bg-gray-700 text-gray-300",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-gray-900/80 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-gray-800 border border-gray-700 shadow-lg",placeholder:"bg-gray-800 text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Ug={card:" bg-gradient-to-br from-white to-gray-50 border border-gray-200 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto shadow-lg",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-white/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-blue-500/5 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-500/10 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-500/8 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full blur-sm opacity-30 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-pink-500 to-purple-500 rounded-full blur-sm opacity-20 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-gray-900",secondary:"text-gray-700",muted:"text-gray-500",accent:"bg-clip-text text-transparent bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600"},micButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute text-white w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-white",promptSlider:"absolute w-full py-3 px-2 bg-gray-100 rounded-xl text-center text-gray-700 text-sm transition-opacity duration-700 ease-in-out border border-gray-200",statusIndicator:"w-2 h-2 bg-green-500 rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-blue-500/20 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-purple-500/15 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-pink-500/10 pulse-ring"},controlBar:"border border-gray-200 rounded-3xl py-4 flex flex-col justify-end h-full bg-white/80 backdrop-blur-sm",chatInput:{container:"bg-white/90 border-gray-200 shadow-sm",textarea:"bg-white border-none text-gray-900 placeholder-gray-500 ",sendButton:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:opacity-50 text-white",attachButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100 bg-blue-50",endButton:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200"},chatMessage:{own:"bg-blue-50 text-gray-900 border border-blue-100",other:"bg-gray-50 text-gray-900 border border-gray-200"},chatHeader:{container:"bg-white border-gray-200",backButton:"text-gray-500 hover:text-gray-700 hover:bg-gray-100"},spinner:"w-10 h-10 animate-spin text-blue-500 mb-2",suggestedResponse:{container:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50 hover:text-blue-900"},video:{container:"bg-gradient-to-br from-white to-gray-50 text-gray-900",header:"border-gray-200 bg-white/80",headerButton:"bg-gray-100 hover:bg-gray-200 text-gray-600",statusDot:"bg-green-500 animate-pulse",controlsBackground:"bg-white/90 backdrop-blur-sm border-t border-gray-200",controlEnabled:"bg-blue-600 hover:bg-blue-700 text-white",controlDisabled:"bg-gray-200 hover:bg-gray-300 text-gray-600",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-white border border-gray-200 shadow-sm",placeholder:"bg-gray-50 text-gray-600",avatar:"bg-gray-200 text-gray-600",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},Zg={card:" text-white bg-gradient-to-br from-[#171727] to-[#12121F] border border-gray-800 w-full h-full flex flex-col justify-between overflow-hidden mx-auto my-auto",cardTopGradient:"pointer-events-none absolute top-0 left-0 w-full h-10 z-10 bg-gradient-to-b from-[#171727]/90 to-transparent",cardRadial:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,_var(--tw-gradient-stops))] from-[#3B82F6]/15 via-transparent to-transparent",cardPurpleBlur:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-[#8B5CF6]/25 to-transparent rounded-full blur-2xl",cardPinkBlur:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-[#EC4899]/20 to-transparent rounded-full blur-xl",cardPulse1:"absolute -top-2 -left-2 w-6 h-6 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full blur-sm opacity-50 animate-pulse",cardPulse2:"absolute -bottom-2 -right-2 w-4 h-4 bg-gradient-to-br from-[#EC4899] to-[#8B5CF6] rounded-full blur-sm opacity-40 animate-pulse",main:"w-full flex flex-col items-center justify-center max-w-md mx-auto bg-gradient-to-br from-[#171727] to-[#12121F] rounded-2xl shadow-xl p-0 overflow-hidden h-full",text:{primary:"text-white",secondary:"text-gray-300",muted:"text-gray-400",accent:"bg-clip-text text-transparent bg-gradient-to-r from-[#3B82F6] via-[#8B5CF6] to-[#EC4899]"},micButton:"absolute w-20 h-20 bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 mic-glow shadow-2xl group",chatButton:"absolute w-20 h-20 bg-gradient-to-br from-[#10B981] to-[#059669] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",videoButton:"absolute w-20 h-20 bg-gradient-to-br from-[#8B5CF6] to-[#EC4899] rounded-full flex items-center justify-center hover:scale-105 transition-all duration-300 shadow-2xl group",popupTrigger:"bg-gradient-to-br from-[#3B82F6] to-[#8B5CF6] text-white font-medium hover:from-[#2563EB] hover:to-[#7C3AED] focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-900 shadow-xl",promptSlider:"absolute w-full py-3 px-2 bg-[#1E1E2E] rounded-xl text-center text-gray-200 text-sm transition-opacity duration-700 ease-in-out border border-gray-700",statusIndicator:"w-2 h-2 bg-[#10B981] rounded-full animate-pulse",pulseRings:{ring1:"w-32 h-32 rounded-full border-2 border-[#3B82F6]/40 pulse-ring",ring2:"absolute w-28 h-28 rounded-full border-2 border-[#8B5CF6]/30 pulse-ring",ring3:"absolute w-24 h-24 rounded-full border-2 border-[#EC4899]/20 pulse-ring"},controlBar:"border border-border rounded-3xl py-4 flex flex-col justify-end h-full",chatInput:{container:"bg-[#1E1E2E] border-gray-700",textarea:"bg-[#1E1E2E] border-none text-white placeholder-gray-400",sendButton:"bg-[#3B82F6] hover:bg-[#2563EB] disabled:bg-gray-600 disabled:opacity-50 text-white",attachButton:"text-gray-400 hover:text-gray-300 hover:bg-gray-700",endButton:"bg-red-900/20 hover:bg-red-800/30 text-red-400 border-red-800"},chatMessage:{own:"bg-[#1E1E2E]/80 text-white",other:"bg-[#1E1E2E] text-white border border-gray-700"},chatHeader:{container:"bg-[#1E1E2E] border-gray-700",backButton:"text-gray-400 hover:text-white hover:bg-gray-700"},spinner:"w-10 h-10 animate-spin text-blue-400 mb-2",suggestedResponse:{container:"bg-[#221f3f] text-white border-none"},video:{container:"bg-gradient-to-br from-[#171727] to-[#12121F] text-white",header:"border-gray-700 bg-[#1E1E2E]/80",headerButton:"bg-[#1E1E2E] hover:bg-gray-700 text-gray-300",statusDot:"bg-[#10B981] animate-pulse",controlsBackground:"bg-[#1E1E2E]/90 backdrop-blur-sm border-t border-gray-700",controlEnabled:"bg-[#3B82F6] hover:bg-[#2563EB] text-white",controlDisabled:"bg-gray-700 hover:bg-gray-600 text-gray-300",endCall:"bg-red-600 hover:bg-red-700 text-white",tile:"bg-[#1E1E2E] border border-gray-700 shadow-xl",placeholder:"bg-[#1E1E2E] text-gray-300",avatar:"bg-gray-700 text-gray-300",nameOverlay:"bg-black/70 text-white",mutedIndicator:"bg-red-600/80 text-white"}},da={dark:Hg,light:Ug,vox:Zg};function Ve(e){return da[e]||da.vox}function Wg({controls:e,saveUserChoices:t=!0,capabilities:n,className:s,onSendMessage:r,onChatOpenChange:o,onDisconnect:i,onDeviceError:a,theme:c="vox",client:d,...u}){const[f,h]=p.useState(!1),[g,x]=p.useState(!1),m=Ve(c),{micTrackRef:b,visibleControls:k,cameraToggle:v,microphoneToggle:T,screenShareToggle:w,handleAudioDeviceChange:S,handleVideoDeviceChange:A,handleDisconnect:M}=zg({controls:e,saveUserChoices:t,client:d}),j=async z=>{x(!0);try{await(r==null?void 0:r(z))}finally{x(!1)}};return p.useEffect(()=>{o==null||o(f)},[f,o]),p.useEffect(()=>{var z,y,D,_;console.log("๐ŸŽค AgentControlBar: micTrackRef changed:",{hasParticipant:!!b.participant,hasPublication:!!b.publication,source:b.source,isSubscribed:(z=b.publication)==null?void 0:z.isSubscribed,isMuted:(y=b.publication)==null?void 0:y.isMuted,trackSid:(D=b.publication)==null?void 0:D.trackSid,hasTrack:!!((_=b.publication)!=null&&_.track)})},[b]),l.jsxs("div",{"aria-label":"Voice assistant controls",className:Y(m.controlBar,s),...u,children:[n.suportsChatInput&&l.jsxs("div",{inert:!f,className:Y("overflow-hidden transition-[height] relative duration-300 ease-in-out",f?"h-[64px] mb-3":"h-0"),children:[l.jsx("div",{className:"flex h-9 px-4 w-full",children:l.jsx(Ng,{onSend:j,disabled:g,className:Y("w-full",m.chatInput)})}),l.jsx("hr",{className:"border-border my-2 mx-5"})]}),l.jsxs("div",{className:Y("flex flex-row items-center gap-2 rounded-2xl mx-auto border-none backdrop-blur-lg px-2 py-2",c==="light"?"bg-white/80":"bg-[#18182a]/80"),children:[l.jsxs("div",{className:"flex gap-y-2 justify-start",children:[k.microphone&&l.jsxs("div",{className:"flex gap-y-2 items-center rounded-full overflow-hidden border-none ",children:[l.jsx(Gs,{variant:"primary",source:Z.Track.Source.Microphone,pressed:T.enabled,disabled:T.pending,onPressedChange:T.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),l.jsx(Ne.BarVisualizer,{barCount:3,trackRef:b,options:{minHeight:5},className:"flex h-full w-auto items-center justify-center gap-x-0.5",children:l.jsx("span",{className:Y(["h-full w-0.5 origin-center rounded-2xl","bg-white","group-data-[state=on]/track:bg-white group-data-[state=off]/track:bg-white","data-lk-muted:bg-muted"])})}),l.jsx(la,{size:"sm",kind:"audioinput",client:d,onError:a?z=>z instanceof Error?a({source:Z.Track.Source.Microphone,error:z}):void 0:void 0,onActiveDeviceChange:S,className:Y(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/30 transition-colors","min-w-[2.5rem]"])})]}),n.suportsVideoInput&&k.camera&&l.jsxs("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:[l.jsx(Gs,{variant:"primary",source:Z.Track.Source.Camera,pressed:v.enabled,pending:v.pending,disabled:v.pending,onPressedChange:v.toggle,className:"w-auto py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"}),l.jsx(la,{size:"sm",kind:"videoinput",client:d,onError:a?z=>z instanceof Error?a({source:Z.Track.Source.Camera,error:z}):void 0:void 0,onActiveDeviceChange:A,className:Y(["h-full py-2 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors","min-w-[2.5rem]"])})]}),n.suportsScreenShare&&k.screenShare&&l.jsx("div",{className:"flex items-center rounded-full overflow-hidden border-none ",children:l.jsx(Gs,{variant:"secondary",source:Z.Track.Source.ScreenShare,pressed:w.enabled,disabled:w.pending,onPressedChange:w.toggle,className:"w-auto py-2 disabled:opacity-70 rounded-none border-none bg-transparent text-inherit focus:bg-primary/80 hover:bg-primary/80 transition-colors"})})]}),k.chat&&l.jsx("div",{className:"flex items-center rounded-full overflow-hidden bg-secondary text-secondary-foreground border-none ",children:l.jsx(Zl,{variant:"secondary","aria-label":"Toggle chat",pressed:f,onPressedChange:z=>{h(z)},className:"aspect-square h-full py-3 rounded-none border-none bg-transparent text-inherit focus:bg-secondary/80 hover:bg-secondary/80 transition-colors flex items-center",children:l.jsx(Ol,{weight:"bold",className:"h-5 w-5"})})})]})]})}const Gg=(e,t)=>{var a,c;const n=p.useMemo(()=>t?t(e.message):e.message,[e.message,t]),s=!!e.editTimestamp,r=new Date(e.timestamp),o=typeof navigator<"u"?navigator.language:"en-US",i=(a=e.from)!=null&&a.name&&e.from.name!==""?e.from.name:(c=e.from)==null?void 0:c.identity;return{message:n,hasBeenEdited:s,time:r,locale:o,name:i}},Kg=({entry:e,messageFormatter:t,className:n,participantName:s,...r})=>{var u,f;const{message:o,time:i,locale:a}=Gg(e,t),c=((u=e.from)==null?void 0:u.isLocal)??!1;Y("w-full px-3 py-2 rounded-2xl text-xs break-words whitespace-pre-line",c?" text-end border border-[#5078F2]/30":"bg-muted text-foreground border border-[#813aa7]/30","text-left");const d=Y("inline-flex items-center justify-center w-6 h-6 rounded-full text-xs font-bold flex-shrink-0",c?"bg-[#5078F2] text-white":"bg-[#813aa7] ml-1 text-white");return l.jsx("li",{title:i.toLocaleTimeString(a,{timeStyle:"full"}),className:Y("group flex mb-2",c?"justify-end":"justify-start",n),...r,children:l.jsxs("div",{className:Y("flex w-fit max-w-full rounded-2xl border",c?"flex-row-reverse items-center border-[#5078F2]/30":"flex-row items-center border-[#813aa7]/30 bg-muted text-foreground"),children:[l.jsx("span",{className:d,children:c?((f=s==null?void 0:s[0])==null?void 0:f.toUpperCase())||"U":"A"}),l.jsx("span",{className:Y("flex items-center text-xs break-words whitespace-pre-line",c?"ml-auto justify-end text-right":"justify-start text-left","px-3 py-2"),children:o})]})})};function Yg(e){C.useEffect(()=>{function t(){const n=e.current;n&&(n.scrollTop=n.scrollHeight)}if(e.current){const n=new ResizeObserver(t);return n.observe(e.current),t(),()=>n.disconnect()}},[e])}const qg=({className:e,children:t,...n})=>{const s=C.useRef(null);return Yg(s),l.jsx("div",{ref:s,className:Y("flex flex-col justify-end",e),...n,children:t})},Xg=({state:e,audioTrack:t,className:n,ref:s})=>l.jsx("div",{ref:s,className:Y("",n),children:t?l.jsx(Ne.BarVisualizer,{barCount:5,state:e,options:{minHeight:5},trackRef:t,className:Y("flex aspect-video w-40 items-center justify-center gap-1"),children:l.jsx("span",{className:Y(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear","data-[lk-highlighted=true]:bg-[#5c64f6]","data-[lk-muted=true]:bg-[#222222]"])})}):l.jsx("div",{className:Y("flex aspect-video w-40 items-center justify-center"),children:l.jsx("div",{className:"flex flex-col items-center justify-center",children:l.jsx("div",{className:"flex gap-1",children:Array.from({length:5}).map((r,o)=>l.jsx("span",{className:Y(["bg-[#6721a4] min-h-2 w-2 rounded-full","origin-center transition-colors duration-250 ease-linear",e==="speaking"&&"animate-pulse bg-[#5c64f6]",e==="thinking"&&"animate-pulse bg-yellow-500"])},o))})})})}),Jg=({videoTrack:e,className:t,ref:n})=>{var s,r;return!e||!e.publication||!e.participant?l.jsx("div",{ref:n,className:Y(t),children:l.jsx("div",{className:"w-full h-full bg-gray-200 rounded-md flex items-center justify-center",children:l.jsx("span",{className:"text-gray-500",children:"No video available"})})}):l.jsx("div",{ref:n,className:Y(t),children:l.jsx(Ne.VideoTrack,{trackRef:e,width:((s=e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e.publication.dimensions)==null?void 0:r.height)??0,className:"rounded-md"})})},Qg=ie.create(Ne.VideoTrack),e0=({trackRef:e,className:t,ref:n})=>{var s,r;return l.jsx("div",{className:Y("bg-muted overflow-hidden rounded-md",t),children:l.jsx(Qg,{ref:n,trackRef:e,width:((s=e==null?void 0:e.publication.dimensions)==null?void 0:s.width)??0,height:((r=e==null?void 0:e.publication.dimensions)==null?void 0:r.height)??0,className:Y("h-full w-auto")})})},ua=ie.create(e0),t0=ie.create(Xg),n0=ie.create(Jg),tt={initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{type:"spring",stiffness:675,damping:75,mass:1}},Vt={grid:["h-full w-full","grid gap-x-2 place-content-center","grid-cols-[1fr_1fr] grid-rows-[90px_1fr_90px]"],agentChatOpenWithSecondTile:["col-start-1 row-start-1","self-center justify-self-end"],agentChatOpenWithoutSecondTile:["col-start-1 row-start-1","col-span-2","place-content-center"],agentChatClosed:["col-start-1 row-start-1","col-span-2 row-span-3","place-content-center"],secondTileChatOpen:["col-start-2 row-start-1","self-center justify-self-start"],secondTileChatClosed:["col-start-2 row-start-3","place-content-end"]};function s0(e,t){const{localParticipant:n}=Wl(t),s=n==null?void 0:n.getTrackPublication(e);return C.useMemo(()=>s&&n?{source:e,participant:n,publication:s}:void 0,[e,s,n])}function r0({chatOpen:e,client:t}){const{agent:{isActive:n=!1}={},session:s,state:r="idle",audioTrack:o,videoTrack:i}=t?Kl(t):{agent:{isActive:!1},session:null,state:"idle",audioTrack:null,videoTrack:null},[a]=Ne.useTracks([Z.Track.Source.ScreenShare]),c=s0(Z.Track.Source.Camera,t),d=c&&!c.publication.isMuted,u=a&&!a.publication.isMuted,f=d||u,h=n||s&&s.state==="active",g={...tt.transition,delay:e?0:.15},x={...tt.animate,scale:e?1:3,transition:g},m={...tt.animate,transition:g},b=g,k=g,v=i&&i.publication&&i.participant;return l.jsx("div",{className:"relative w-full h-full z-10 flex items-center justify-center",children:l.jsx("div",{className:"relative w-full h-full max-w-2xl px-4 md:px-0",children:l.jsxs("div",{className:Y(Vt.grid),children:[h&&l.jsx("div",{className:Y(["grid",!e&&Vt.agentChatClosed,e&&f&&Vt.agentChatOpenWithSecondTile,e&&!f&&Vt.agentChatOpenWithoutSecondTile]),children:l.jsxs("div",{className:"h-full flex items-center justify-center",children:[!v&&l.jsx(t0,{layoutId:"agent",...tt,animate:x,transition:b,state:r,audioTrack:o||void 0,className:Y(e?"h-[90px]":"h-auto w-full")},"agent"),v&&i&&l.jsx(n0,{layoutId:"avatar",...tt,animate:m,transition:k,videoTrack:i,className:Y(e?"h-[90px] [&>video]:h-[90px] [&>video]:w-auto":"h-auto w-full")},"avatar")]})}),l.jsx("div",{className:Y(["grid",e&&Vt.secondTileChatOpen,!e&&Vt.secondTileChatClosed]),children:l.jsxs("div",{className:"w-full px-10 flex items-center shadow-2xl justify-between",children:[c&&d&&l.jsx(ua,{layout:"position",layoutId:"camera",...tt,trackRef:c,transition:{...tt.transition,delay:e?0:.15},className:"h-[60px] order-1"},"camera"),u&&l.jsx(ua,{layout:"position",layoutId:"screen",...tt,trackRef:a,transition:{...tt.transition,delay:e?0:.15},className:"h-[70px] order-2"},"screen")]})})]})})})}function fa({timeout:e}){const[t,n]=C.useState(100),s=C.useRef(null),r=C.useRef(null);return C.useEffect(()=>{if(!e||e<=0)return;n(100),r.current=Date.now();const o=()=>{if(!e||r.current===null)return;const i=Date.now()-r.current,a=Math.max(0,100-i/e*100);n(a),a>0&&(s.current=requestAnimationFrame(o))};return s.current=requestAnimationFrame(o),()=>{s.current&&cancelAnimationFrame(s.current)}},[e]),!e||e<=0?null:l.jsx("div",{className:"w-full h-1 relative top-1 rounded-t-4xl bg-gray-700 overflow-hidden",children:l.jsx(ie.div,{className:"h-1 rounded-t-4xl dark:bg-white bg-blue-200 ",initial:{width:"100%"},animate:{width:`${Math.max(t,2)}%`},transition:{duration:.1,ease:"linear"},style:{minWidth:"2%"}})})}function Kt({interaction:e,theme:t,onDismiss:n,client:s,addLocalMessage:r}){var a;if(!e||!e.isVisible||!e.component)return null;const[o]=p.useState(()=>Date.now()),i=()=>e.component?p.createElement(e.component,{handler:e.handler||void 0,timeout:e.timeout,loadData:async d=>{console.log("InteractiveComponent: Loading data:",d)},presentationMode:e.presentationMode,data:e.data,client:s,addLocalMessage:r}):l.jsx("div",{className:"p-4 text-red-500",children:"Component not found"});switch(e.presentationMode){case"fullscreen":return l.jsx(Ht,{children:l.jsxs(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] bg-black",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx(fa,{timeout:e.timeout}),l.jsxs("div",{className:"flex items-center justify-between p-4 bg-black/80 text-white border-b border-gray-700",children:[l.jsx("h3",{className:"text-lg font-semibold",children:e.methodName.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}),l.jsx("button",{onClick:n||((a=e.handler)==null?void 0:a.dismissView),className:"p-2 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",children:l.jsx(je.X,{className:"w-5 h-5"})})]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i()})]})});case"embedded":default:return l.jsx(Ht,{children:l.jsx(ie.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-fit rounded-lg ",children:l.jsxs("div",{children:[l.jsx(fa,{timeout:e.timeout}),i()]})})})}}function o0(){const e=Ne.useTranscriptions(),t=Ne.useChat(),n=Ne.useRoomContext();return{messages:C.useMemo(()=>[...e.map(o=>ig(o,n)),...t.chatMessages].sort((o,i)=>o.timestamp-i.timestamp),[e,t.chatMessages,n]),send:t.send}}const i0=({logLevel:e}={})=>{const t=Ne.useRoomContext();p.useEffect(()=>(Z.setLogLevel(e??"debug"),window.__lk_room=t,()=>{window.__lk_room=void 0}),[t,e])},ha=e=>e,a0=()=>{let e=ha;return{configure(t){e=t},generate(t){return e(t)},reset(){e=ha}}},c0=a0();function ht(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(s=>n.searchParams.append("args[]",s)),`Minified MUI error #${e}; visit ${n} for the full message.`}function At(e){if(typeof e!="string")throw new Error(process.env.NODE_ENV!=="production"?"MUI: `capitalize(string)` expects a string argument.":ht(7));return e.charAt(0).toUpperCase()+e.slice(1)}function l0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bn={exports:{}},zn={exports:{}},le={};/** @license React v16.13.1
10
10
  * react-is.production.min.js
11
11
  *
12
12
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -249,7 +249,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
249
249
  .voxket-widget-root button {
250
250
  cursor: pointer;
251
251
  }
252
- `;function No(){if(Wa||typeof document>"u")return;const e=document.createElement("style");e.type="text/css",e.id="voxket-widget-styles",e.textContent=ux,document.head.appendChild(e),Wa=!0}No();class he extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class Vn extends Po{constructor(n){super();Se(this,"config");Se(this,"room",null);Se(this,"pluginManager");Se(this,"rpcManager");Se(this,"isConnected",!1);Se(this,"currentSession",null);Se(this,"connectionState",Z.ConnectionState.Disconnected);Se(this,"renderedComponents",new Map);Se(this,"textStreamHandlersRegistered",!1);Se(this,"currentAgentInfo",null);Se(this,"chatMessages",[]);Se(this,"isAgentConnected",!1);Se(this,"agentState","idle");No(),this.config=n,this.pluginManager=new gd(this),this.rpcManager=new dx,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,r;this.isConnected=!1,(r=(s=this.config).onDisconnected)==null||r.call(s,n)}),this.on("connection.error",n=>{var s,r;(r=(s=this.config).onError)==null||r.call(s,n)}),this.on("chat.message.received",n=>{var s,r;this.addChatMessage(n),(r=(s=this.config).onMessageReceived)==null||r.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,r;(r=(s=this.config).onTranscriptionReceived)==null||r.call(s,n)}),this.on("session.state.changed",n=>{var s,r;(r=(s=this.config).onSessionStateChanged)==null||r.call(s,n)}),this.on("session.created",n=>{var s,r;(r=(s=this.config).onSessionStart)==null||r.call(s,n.id)}),this.on("session.ended",(n,s)=>{var r,o;(o=(r=this.config).onSessionEnd)==null||o.call(r,s)}),this.on("participant.joined",n=>{var s,r;(r=(s=this.config).onUserJoined)==null||r.call(s,n.id)}),this.on("participant.left",n=>{var s,r;(r=(s=this.config).onUserLeft)==null||r.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new Z.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(Z.RoomEvent.Connected,()=>{var n,s;this.connectionState=Z.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(o){console.warn("VoxketClient: Failed to enable microphone after room connection:",o)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(Z.RoomEvent.Disconnected,n=>{var s;console.log("๐Ÿ”ด VoxketClient: Room disconnected, reason:",n),this.connectionState=Z.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.isAgentConnected=!1,console.log("๐Ÿค– VoxketClient: Agent marked as disconnected"),n&&console.log("๐Ÿ” VoxketClient: Disconnect reason details:",{reason:n.toString(),currentSession:(s=this.currentSession)==null?void 0:s.id,agentConnected:this.isAgentConnected,connectionState:this.connectionState}),this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(Z.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===Z.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(Z.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(Z.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(!this.room)return;try{this.room.registerTextStreamHandler("lk.chat",async(s,r)=>{try{const o=await s.readAll(),i={id:`msg_${Date.now()}_${r.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:r.identity||"user",name:r.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",i)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(s){console.warn("VoxketClient: lk.chat handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("lk.transcription",async(s,r)=>{var o,i;try{const a=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let c="";const d=((o=this.currentAgentInfo)==null?void 0:o.name)||r.identity||"AI Assistant",u={id:a,content:"",timestamp:new Date,sender:{id:r.identity||"agent",name:d,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",u);for await(const g of s){c+=g;const x=this.convertMarkdownToText(c),m={...u,content:x,metadata:{...u.metadata,streaming:!0}};this.emit("chat.message.updated",m)}const f=this.convertMarkdownToText(c),h={...u,content:f,metadata:{...u.metadata,streaming:!1}};this.emit("chat.message.updated",h)}catch(a){console.error("VoxketClient: Failed to process lk.transcription message:",a);try{const c=await s.readAll(),d=((i=this.currentAgentInfo)==null?void 0:i.name)||r.identity||"AI Assistant",u={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:c,timestamp:new Date,sender:{id:r.identity||"agent",name:d,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",u)}catch(c){console.error("VoxketClient: Fallback failed for lk.transcription:",c)}}})}catch(s){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("suggested_response",async s=>{const r=await s.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(i){console.warn("VoxketClient: Failed to parse suggested_response:",i,r)}this.emit("suggested.response",o)})}catch(s){console.warn("VoxketClient: suggested_response handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("agent_state_changed",async(s,r)=>{const o=await s.readAll();console.log("๐Ÿค– VoxketClient: agent_state_changed stream received:",o);let i={};try{i=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(a){console.warn("VoxketClient: Failed to parse agent_state_changed:",a,o)}this.isAgentConnected||(this.isAgentConnected=!0,console.log("๐Ÿค– VoxketClient: Agent marked as connected (first state change received)"),this.emit("agent.connected",i)),i.new_state==="speaking"?(this.setAgentState("speaking"),this.emit("agent.speaking",i)):i.new_state==="thinking"?(this.setAgentState("thinking"),this.emit("agent.thinking",i)):(i.new_state==="idle"||i.new_state==="listening")&&this.setAgentState("idle")})}catch(s){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("images",async(s,r)=>{try{const o=await s.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(s){console.warn("VoxketClient: images handler already registered, skipping:",s)}try{this.room.registerByteStreamHandler("images",async(s,r)=>{var o,i;try{const a=s.info,c={id:`img_${Date.now()}_${r.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`๏ฟฝ๏ธ ${a.name||"Image"}`,sender:{id:r.identity||"agent",name:r.identity||"Agent",type:r.identity===((i=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:i.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:a.name,fileSize:a.size,mimeType:a.mimeType,streamId:a.id,downloading:!0}};this.emit("chat.message.received",c),s.onProgress&&(s.onProgress=g=>{const x={...c,metadata:{...c.metadata,downloadProgress:g||0}};this.emit("chat.message.updated",x)});const d=[];for await(const g of s)d.push(g);const u=new Blob(d,{type:a.mimeType||"application/octet-stream"}),f=URL.createObjectURL(u),h={...c,metadata:{...c.metadata,downloading:!1,downloadProgress:1,downloadUrl:f,blob:u}};this.emit("chat.message.updated",h)}catch(a){console.error("VoxketClient: Error processing image attachment:",a)}})}catch(s){console.warn("VoxketClient: image handler already registered, skipping:",s)}["error","warning","status","system","debug","info"].forEach(s=>{try{this.room.registerTextStreamHandler(s,async(r,o)=>{try{const i=await r.readAll();if(console.log(`๐Ÿ“ VoxketClient: Received '${s}' stream:`,i),s==="error"){let a={};try{a=typeof i=="string"?JSON.parse(i):i}catch{a={message:i}}console.warn("๏ฟฝ VoxketClient: Agent error:",a),this.emit("agent.error",a)}else this.emit("text.stream.received",{topic:s,data:i,participantInfo:o})}catch(i){console.error(`VoxketClient: Failed to process '${s}' stream:`,i)}})}catch(r){console.warn(`VoxketClient: Handler for '${s}' already registered, skipping:`,r)}});try{this.room.registerTextStreamHandler("*",async(s,r)=>{var o;try{const i=await s.readAll(),a=((o=s.info)==null?void 0:o.topic)||"unknown";console.log(`๐Ÿ“ VoxketClient: Received unhandled text stream for topic '${a}':`,i),this.emit("text.stream.unhandled",{topic:a,data:i,participantInfo:r})}catch(i){console.error("VoxketClient: Failed to process unhandled text stream:",i)}})}catch(s){console.warn("VoxketClient: Generic text stream handler already registered, skipping:",s)}this.textStreamHandlersRegistered=!0}async fetchConnectionDetails(n,s,r){const o=n||this.config.agentId||"default-agent",i=s||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const c={agent_id:o,participant_name:i,participant_metadata:{user_id:""},modality:a[0],modalities:a};console.log("๐Ÿ”— VoxketClient: Creating session with modalities:",a);const d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){let h=`HTTP ${d.status}: Failed to fetch connection details`;try{const g=await d.json();g&&(g.error?h=`API Error: ${g.error}`:g.detail?h=`API Error: ${g.detail}`:g.message&&(h=`API Error: ${g.message}`))}catch{try{const x=await d.text();x&&(h=`API Error: ${x}`)}catch{}}throw new Error(h)}const u=await d.json();let f;return u.agent_info&&(f={id:u.agent_info.id||o,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=f),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:f}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const d=new he(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",d),d}}async connect(n,s,r){var o;try{this.emit("connection.connecting");const i=await this.fetchConnectionDetails(n,s,r);return await((o=this.room)==null?void 0:o.connect(i.serverUrl,i.participantToken)),this.isConnected=!0,i}catch(i){console.error("VoxketClient: Connection failed:",i);const a=new he(`Failed to connect to Voxket services: ${i instanceof Error?i.message:"Unknown error"}`,"CONNECTION_FAILED",i);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new Z.Room,this.setupRoomEventListeners()}catch(s){const r=new he("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",r),r}}async createSession(n){var s,r,o,i;try{const a=await this.connect(n.agentId,n.participantName,n.modalities),c={id:a.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:a.agentInfo||this.currentAgentInfo};if(this.currentSession=c,this.emit("session.created",c),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(d=>setTimeout(d,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(d){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",d)}if((o=n.modalities)!=null&&o.includes("video"))try{await new Promise(d=>setTimeout(d,200)),(i=this.room)!=null&&i.localParticipant&&(console.log("๐ŸŽฅ VoxketClient: Attempting to enable camera for video session"),await this.room.localParticipant.setCameraEnabled(!0),this.emit("track.unmuted",{source:"camera",enabled:!0}),console.log("๐ŸŽฅ VoxketClient: Camera enabled successfully"))}catch(d){console.warn("VoxketClient: Failed to enable camera, but continuing with session:",d)}return setTimeout(()=>{var d;this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state),this.forceAgentConnected(),console.log("๐Ÿค– VoxketClient: Session marked as active:",{sessionId:this.currentSession.id,modalities:this.currentSession.activeModalities,agentConnected:this.isAgentConnected,hasRoom:!!this.room,remoteParticipants:((d=this.room)==null?void 0:d.remoteParticipants.size)||0}))},1e3),c}catch(a){throw console.error("VoxketClient: Failed to create session:",a),a instanceof he?a:a instanceof TypeError&&a.message.includes("fetch")?new he("Network connection failed","CONNECTION_FAILED",a):a instanceof Error&&a.message.includes("Failed to fetch connection details")?new he(`API connection failed: ${a.message}`,"CONNECTION_FAILED",a):new he(`Failed to create session: ${a instanceof Error?a.message:"Unknown error"}`,"SESSION_NOT_FOUND",a)}}async startSession(n,s){const r={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(r)}async endSession(){var n,s;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new he("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getIsAgentConnected(){return this.isAgentConnected}forceAgentConnected(){this.isAgentConnected||(this.isAgentConnected=!0,console.log("๐Ÿค– VoxketClient: Agent manually marked as connected"),this.emit("agent.connected",{forced:!0}))}getAgentState(){return this.agentState}setAgentState(n){this.agentState!==n&&(this.agentState=n,this.emit("agent.state.changed",{state:n}))}getAgentAudioTrack(){const n=this.getRemoteParticipants();for(const s of n){const r=s.getTrackPublication(Z.Track.Source.Microphone);if(r!=null&&r.track)return{source:Z.Track.Source.Microphone,participant:s,publication:r}}return null}getAgentVideoTrack(){const n=this.getRemoteParticipants();for(const s of n){const r=s.getTrackPublication(Z.Track.Source.Camera);if(r!=null&&r.track)return{source:Z.Track.Source.Camera,participant:s,publication:r}}return null}getVideoTrackRefs(){const n=[],s=this.getLocalParticipant();if(s){const o=s.getTrackPublication(Z.Track.Source.Camera);o!=null&&o.track&&n.push({source:Z.Track.Source.Camera,participant:s,publication:o});const i=s.getTrackPublication(Z.Track.Source.ScreenShare);i!=null&&i.track&&n.push({source:Z.Track.Source.ScreenShare,participant:s,publication:i})}const r=this.getRemoteParticipants();for(const o of r){const i=o.getTrackPublication(Z.Track.Source.Camera);i!=null&&i.track&&n.push({source:Z.Track.Source.Camera,participant:o,publication:i});const a=o.getTrackPublication(Z.Track.Source.ScreenShare);a!=null&&a.track&&n.push({source:Z.Track.Source.ScreenShare,participant:o,publication:a})}return n}getCameraTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===Z.Track.Source.Camera)}getScreenShareTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===Z.Track.Source.ScreenShare)}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(r=>r.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,d,u;const s=this.resolveTarget(n.target||"body"),r=this.getTargetKey(s),o=this.renderedComponents.get(r);o&&o.target===s||this.removeUI(s);const i=(o==null?void 0:o.root)||Zd.createRoot(s),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!i||typeof i.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{i.render(C.createElement(xd,{config:this.config,autoConnect:n.autoStart||!1,children:C.createElement(bd,a)}))}catch(f){throw console.error("Error rendering Voxket widget:",f),new Error(`Failed to render Voxket widget: ${f instanceof Error?f.message:"Unknown error"}`)}this.renderedComponents.set(r,{root:i,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const r=this.getTargetKey(s),o=this.renderedComponents.get(r);o&&(o.root.unmount(),this.renderedComponents.delete(r),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(c){console.warn("Failed to remove element:",c)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new he("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new he("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new he("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const o={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},i=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",o)}catch(o){throw console.error("VoxketClient: Failed to send chat message:",o),new he("Failed to send message","NETWORK_ERROR",o)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new he("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new he("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new he("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new he("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(o=>o.type.startsWith("image/"));if(r.length===0)throw new he("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const o=r.map(async(i,a)=>{const d={id:`att_${Date.now()}_${a}`,content:`๐Ÿ“Ž ${i.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(i,{mimeType:i.type,topic:"images",onProgress:h=>{const g={...d,metadata:{...d.metadata,uploadProgress:h}};this.emit("chat.message.updated",g)}});try{const h=new FileReader,g=new Promise((b,k)=>{h.onload=()=>{typeof h.result=="string"?b(h.result):k(new Error("Failed to convert to base64"))},h.onerror=k});h.readAsDataURL(i);const m={type:"image",data:await g,filename:i.name,mimeType:i.type,size:i.size};await this.room.localParticipant.sendText(JSON.stringify(m),{topic:"images",destinationIdentities:[]})}catch(h){console.warn("VoxketClient: Failed to send image data to agent:",h);try{const g=`I've shared an image: ${i.name}`;await this.room.localParticipant.sendText(g,{topic:"lk.chat",destinationIdentities:[]})}catch(g){console.warn("VoxketClient: Failed to send image notification to agent:",g)}}const f={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",f),u});await Promise.all(o)}catch(o){throw console.error("VoxketClient: Failed to send attachments:",o),new he("Failed to send attachments","NETWORK_ERROR",o)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,r;try{const o=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,i=n??!o;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(i)),i?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle microphone:",o),new he("Failed to toggle microphone","PERMISSION_DENIED",o)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,r;try{const o=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,i=n??!o;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(i)),i?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle camera:",o),new he("Failed to toggle camera","PERMISSION_DENIED",o)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new he("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new he("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new he("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new he("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new he("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new he("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=o=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(o));return{camera:r(1),microphone:r(2),screenShare:r(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===Z.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new he("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new he("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,r="embedded"){return this.rpcManager.registerFrontendRPC(n,s,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const o=await r.readAll();s(o)}catch(o){console.error(`Error processing event for topic '${n}':`,o)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}const fx=ie.create(H1),hx=ie.create(Q1),mx=ie.create(nx),px=ie.create(ox);function gx({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},o=Ve(s);return l.jsx(ie.button,{onClick:e,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${o.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Ga({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:r="bottom-right",onExpand:o}){const i=Ve(t);if(n==="fullscreen")return l.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/40 bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&s&&s()},children:l.jsxs("div",{className:"w-full h-full max-w-7xl max-h-[95vh] rounded-2xl relative bg-transparent flex flex-col",onClick:a=>{a.stopPropagation()},children:[s&&l.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[10000] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),l.jsxs("div",{id:"voice-card",className:`${i.card} w-full h-full flex flex-col rounded-xl shadow-2xl relative overflow-hidden`,style:{minHeight:"600px",height:"100%"},children:[l.jsx("div",{className:i.cardTopGradient}),l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),l.jsx("div",{className:"relative z-10 flex flex-col h-full",children:e}),l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return l.jsx("div",{className:"fixed rounded-2xl inset-0 z-[9999] pointer-events-none",children:l.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[s&&l.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"ร—"}),l.jsxs("div",{id:"voice-card",className:`${i.card} rounded-2xl flex flex-col relative overflow-hidden`,style:{width:"350px",height:"500px"},children:[l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),l.jsx("div",{className:"relative z-10 flex flex-col h-full",children:e}),l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return l.jsxs("div",{id:"voice-card",className:`${i.card} relative overflow-hidden`,style:{height:"100%",maxHeight:"100%"},children:[o&&l.jsx("button",{onClick:o,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),l.jsx("div",{className:i.cardTopGradient}),l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),l.jsx("div",{className:"relative z-10 flex flex-col h-full",children:e}),l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})}function bd(e){if(typeof window>"u")return null;console.log("๐ŸŽฏ Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:r,appId:o,prompts:i,statusMessage:a,welcomeTitle:c,welcomeSubTitle:d,className:u,width:f,height:h,loadingText:g,suportsChatInput:x=!0,suportsVideoInput:m=!0,suportsScreenShare:b=!0,theme:k="vox",onSessionStart:v,onSessionEnd:T,enableSessionLogging:w=!0,onSessionLogsUpdate:S,onSessionMetricsUpdate:A,modalities:M=["voice"],displayType:j="widget",popupPosition:z="bottom-right",popupTriggerText:y="Open Chat",onPopupToggle:D,voxketClient:_,onDisplayTypeChange:J}=e,[ne,Q]=p.useState(()=>_?!!_.getCurrentSession():!1),[se,K]=p.useState(!1),[R,X]=p.useState(t||""),[V,U]=p.useState(n||"User"),[q,P]=p.useState(()=>_?_.getCurrentSession():null),[E,O]=p.useState(()=>{var te,Oe,De;if(_){const ge=_.getCurrentSession();if((te=ge==null?void 0:ge.activeModalities)!=null&&te.includes("chat"))return"chat";if((Oe=ge==null?void 0:ge.activeModalities)!=null&&Oe.includes("voice"))return"voice";if((De=ge==null?void 0:ge.activeModalities)!=null&&De.includes("video"))return"video"}return"welcome"}),[F,$]=p.useState(!1);p.useEffect(()=>{console.log("๐ŸŽฏ Widget displayType prop changed to:",j)},[j]),p.useEffect(()=>{console.log("๐Ÿ“Š Session state changed:",{currentMode:E,sessionStarted:ne,loading:se,currentSession:q==null?void 0:q.id,isPopupOpen:F})},[E,ne,se,q,F]);const I=p.useMemo(()=>{if(_)return console.log("๐Ÿ”„ Using passed VoxketClient to preserve session state"),_;console.log("๐Ÿ†• Creating new VoxketClient instance");const te={appId:o,appSecret:r,baseUrl:s,agentId:R,participantName:V||"User",modalities:M};return new Vn(te)},[_,o,r,s,R,V,M]),H=M,B=p.useMemo(()=>I.getRoom()||new Z.Room,[I]),oe={suportsChatInput:x,suportsVideoInput:m,suportsScreenShare:b},{sessionMetrics:L,sessionLogs:ae,logEvent:be}=pd({room:B,onSessionStart:v,onSessionEnd:T,enableConsoleLogging:w,enableLocalStorage:w,voxketSessionId:q==null?void 0:q.id});p.useEffect(()=>{S&&S(ae)},[ae,S]),p.useEffect(()=>{A&&L&&A(L)},[L,A]),p.useEffect(()=>{const te=De=>{console.log("๐Ÿ”ด Room disconnected:",De),K(!1),Q(!1),P(null),O("welcome")},Oe=De=>{console.log("๐Ÿ“น Media devices error:",De),Pt({title:"Allow access to your microphone/camera",description:`${De.name}: ${De.message}`})};return B.on(Z.RoomEvent.MediaDevicesError,Oe),B.on(Z.RoomEvent.Disconnected,te),()=>{B.off(Z.RoomEvent.Disconnected,te),B.off(Z.RoomEvent.MediaDevicesError,Oe)}},[B]),p.useEffect(()=>{const te=(De,ge)=>{console.log("๐Ÿ”š Session ended event received:",De.id,ge),K(!1),Q(!1),P(null),O("welcome")},Oe=De=>{console.log("๐Ÿ”ด VoxketClient connection disconnected:",De),K(!1),Q(!1),P(null),O("welcome")};return I.on("session.ended",te),I.on("connection.disconnected",Oe),()=>{I.off("session.ended",te),I.off("connection.disconnected",Oe)}},[I]);const Ie=async()=>{try{console.log("๐ŸŽค Starting voice session...",{agentId:R,participantName:V}),console.log("๐ŸŽค Pre-start state:",{currentMode:E,sessionStarted:ne,loading:se}),K(!0),Q(!0),O("voice"),console.log("๐ŸŽค State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),be("USER_STARTED_VOICE_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["voice",...m?["video"]:[]]});console.log("โœ… Voice session started successfully:",te.id),P(te),K(!1),v&&v(te.id)}catch(te){console.error("โŒ Failed to start voice session:",te),Pt({title:"Failed to start voice session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},Rn=async()=>{try{K(!0),Q(!0),O("chat"),be("USER_STARTED_CHAT_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["chat"]});P(te),K(!1),v&&v(te.id)}catch(te){console.error("Failed to start chat session:",te),Pt({title:"Failed to start chat session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},Dd=async()=>{try{console.log("๐Ÿ“บ Starting video session...",{agentId:R,participantName:V}),console.log("๐Ÿ“บ Pre-start state:",{currentMode:E,sessionStarted:ne,loading:se}),K(!0),Q(!0),O("video"),console.log("๐Ÿ“บ State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),be("USER_STARTED_VIDEO_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["video","voice"]});console.log("โœ… Video session started successfully:",te.id),P(te),K(!1),v&&v(te.id)}catch(te){console.error("โŒ Failed to start video session:",te),Pt({title:"Failed to start video session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},sn=()=>{O("welcome"),J&&J(e.displayType||"widget"),q&&ne&&(Q(!1),P(null),typeof I.endSession=="function"?(I.endSession(),console.log("โœ… Widget: Session ended via client.endSession()")):(I.disconnect(),console.log("โš ๏ธ Widget: Using fallback client.disconnect()"))),j==="popup"&&!F&&$(!0)},rn=()=>{const te=!F;$(te),D&&D(te),!te&&!(q&&ne)&&(O("welcome"),Q(!1),P(null))},$d=()=>{console.log("๐Ÿ”„ Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("โš ๏ธ No onDisplayTypeChange callback provided")},Fd=()=>{if(console.log("๐Ÿ”„ Expand to fullscreen requested"),e.onDisplayTypeChange)e.onDisplayTypeChange("fullscreen");else{console.warn("โš ๏ธ No onDisplayTypeChange callback provided for expand functionality");const te=document.getElementById("voice-card")||document.querySelector(".voxket-widget-container");te&&te.requestFullscreen?te.requestFullscreen().catch(Oe=>{console.warn("โš ๏ธ Fullscreen API not supported or failed:",Oe),Pt({title:"Expand functionality unavailable",description:"Please implement onDisplayTypeChange callback for expand functionality"})}):Pt({title:"Expand functionality unavailable",description:"Please implement onDisplayTypeChange callback for expand functionality"})}};p.useEffect(()=>{var te,Oe,De;if(_&&I){console.log("๐Ÿ”„ Syncing widget state with existing client session state");const ge=I.getCurrentSession(),Od=I.connected;console.log("๐Ÿ” Existing session state:",{hasSession:!!ge,sessionId:ge==null?void 0:ge.id,isConnected:Od,activeModalities:ge==null?void 0:ge.activeModalities}),ge&&(console.log("โœ… Restoring session state from existing client"),P(ge),Q(!0),K(!1),(te=ge.activeModalities)!=null&&te.includes("chat")?O("chat"):(Oe=ge.activeModalities)!=null&&Oe.includes("voice")?O("voice"):(De=ge.activeModalities)!=null&&De.includes("video")&&O("video"))}},[_,I]),p.useEffect(()=>()=>{console.log("๐Ÿงน Cleaning up widget component"),_?console.log("๐Ÿ”„ Widget cleanup: preserving passed client instance"):(console.log("๐Ÿงน Widget cleanup: disconnecting self-created client"),I.disconnect())},[I,_]);let Es="w-96",As="h-[25rem]",js={};if(f&&(f.startsWith("w-")?Es=f:(js.width=f,Es="")),h&&(h.startsWith("h-")?As=h:(js.height=h,As="")),j==="popup"&&!F)return console.log("๐ŸŸก Showing popup trigger button"),l.jsx(gx,{onClick:rn,text:y,position:z,theme:k});console.log("๐ŸŸข Rendering widget content, displayType:",j,"isPopupOpen:",F,"currentMode:",E,"sessionStarted:",ne,"loading:",se);let Ms=`voxket-widget-root theme-${k}`,In={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};j==="widget"?(Ms+=` flex items-center justify-center min-h-fit ${Es} ${As} ${u}`,In={...In,...js}):(Ms=`${u||""}`,In={});const Fo=l.jsx("div",{className:"h-full flex flex-col overflow-hidden relative z-10",children:l.jsxs(Ht,{mode:"wait",children:[E==="welcome"&&!se&&l.jsx(px,{agentId:R,participantName:V||"",onAgentIdChange:X,onParticipantNameChange:U,onStartCall:Ie,onStartChat:Rn,onStartVideo:Dd,disabled:ne||se,prompts:i,statusMessage:a,title:c,subTitle:d,theme:k,modalities:H,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),E==="voice"&&l.jsxs(Ne.RoomContext.Provider,{value:B,children:[l.jsx(Ne.RoomAudioRenderer,{}),l.jsx(Ne.StartAudio,{label:"Start Audio"}),l.jsx(fx,{loadingText:g,participantName:V||"User",capabilities:oe,sessionStarted:ne,disabled:!ne,theme:k,client:I,displayType:j,onBack:j==="popup"?rn:sn,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),E==="chat"&&l.jsx(hx,{client:I,theme:k,displayType:j,onBack:j==="popup"?rn:sn,onEndChat:sn,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),E==="video"&&l.jsxs(Ne.RoomContext.Provider,{value:B,children:[l.jsx(Ne.RoomAudioRenderer,{}),l.jsx(Ne.StartAudio,{label:"Start Audio"}),l.jsx(mx,{client:I,theme:k,displayType:j,onBack:j==="popup"?rn:sn,onEndCall:sn,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return j==="fullscreen"||j==="popup"?(console.log("๐Ÿ“ฑ Rendering fullscreen/popup mode, displayType:",j),l.jsx(Ga,{theme:k,displayType:j,popupPosition:z,onClose:j==="fullscreen"?$d:rn,children:Fo})):(console.log("๐Ÿ“ฆ Rendering widget mode"),l.jsx("div",{className:Ms,style:In,children:l.jsx(Ga,{theme:k,displayType:j,popupPosition:z,onExpand:Fd,children:Fo})}))}class vd extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return p.createElement(t,{error:this.state.error})}return p.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function yx({logs:e,onClear:t,onExport:n}){const[s,r]=C.useState(!1),[o,i]=C.useState(""),a=e.filter(c=>!o||c.event.toLowerCase().includes(o.toLowerCase()));return s?l.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[l.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",placeholder:"Filter events...",value:o,onChange:c=>i(c.target.value),className:"px-3 py-1 border rounded text-sm"}),l.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),l.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),l.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?l.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):l.jsx("div",{className:"space-y-2",children:a.map((c,d)=>l.jsxs("div",{className:"border rounded p-3 text-sm",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),l.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&l.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&l.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:l.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},d))})})]})}):l.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function xx({metrics:e}){return e?l.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[l.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),l.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Session ID:"}),l.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Start Time:"}),l.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Messages:"}),l.jsx("div",{children:e.totalMessages})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Participants:"}),l.jsx("div",{children:e.participantCount})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),l.jsx("div",{children:e.connectionIssues})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Duration:"}),l.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function jt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:r}=Qe(),o=C.useCallback(async(a,c)=>await s(a,c),[s]),i=C.useCallback(async()=>await r(),[r]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:o,stop:i}}function wd(){const{sessionMetrics:e,currentSession:t}=Qe();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function Sd(){const{setMicrophoneEnabled:e,client:t}=Qe(),[n,s]=C.useState(!1),[r,o]=C.useState(!1),i=C.useCallback(async()=>{if(!r){o(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{o(!1)}}},[n,r,e]),a=C.useCallback(async()=>{if(!(n||r)){o(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{o(!1)}}},[n,r,e]),c=C.useCallback(async()=>{if(!(!n||r)){o(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{o(!1)}}},[n,r,e]);return{isEnabled:n,isLoading:r,toggle:i,enable:a,disable:c}}function Cd(){const{setCameraEnabled:e}=Qe(),[t,n]=C.useState(!1),[s,r]=C.useState(!1),o=C.useCallback(async()=>{if(!s){r(!0);try{const c=!t;await e(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{r(!1)}}},[t,s,e]),i=C.useCallback(async()=>{if(!(t||s)){r(!0);try{await e(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{r(!1)}}},[t,s,e]),a=C.useCallback(async()=>{if(!(!t||s)){r(!0);try{await e(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{r(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:o,enable:i,disable:a}}function kd(){const{startScreenShare:e,stopScreenShare:t}=Qe(),[n,s]=C.useState(!1),[r,o]=C.useState(!1),i=C.useCallback(async()=>{if(!(n||r)){o(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{o(!1)}}},[n,r,e]),a=C.useCallback(async()=>{if(!(!n||r)){o(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{o(!1)}}},[n,r,t]),c=C.useCallback(async()=>{n?await a():await i()},[n,i,a]);return{isSharing:n,isLoading:r,start:i,stop:a,toggle:c}}function bx(){const{client:e}=Qe(),[t,n]=C.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=C.useMemo(()=>t.tracks.find(m=>m.isLocal),[t.tracks]),r=C.useMemo(()=>t.tracks.filter(m=>!m.isLocal),[t.tracks]),o=C.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(m){throw console.error("Failed to toggle camera:",m),m}},[e,s]),i=C.useCallback(async()=>{try{t.tracks.find(b=>b.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(m){throw console.error("Failed to toggle screen share:",m),m}},[e,t.tracks]),a=C.useCallback(m=>{n(b=>({...b,layout:m}))},[]),c=C.useCallback(m=>{n(b=>({...b,pinnedTrack:m}))},[]),d=C.useCallback(()=>{n(m=>({...m,pinnedTrack:void 0}))},[]),u=C.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(m=>({...m,isRecording:!0}))}catch(m){throw console.error("Failed to start recording:",m),m}},[e]),f=C.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(m=>({...m,isRecording:!1}))}catch(m){throw console.error("Failed to stop recording:",m),m}},[e]),h=C.useCallback(m=>t.tracks.find(b=>b.id===m),[t.tracks]),g=C.useCallback(m=>t.tracks.filter(b=>b.participantId===m),[t.tracks]),x=C.useCallback(m=>m.isEnabled&&t.tracks.includes(m),[t.tracks]);return C.useEffect(()=>{if(!e)return;const m=v=>{n(T=>({...T,tracks:[...T.tracks.filter(w=>w.id!==v.id),v]}))},b=v=>{n(T=>{var w;return{...T,tracks:T.tracks.filter(S=>S.id!==v),pinnedTrack:((w=T.pinnedTrack)==null?void 0:w.id)===v?void 0:T.pinnedTrack}})},k=v=>{n(T=>({...T,tracks:T.tracks.map(w=>w.id===v.id?v:w)}))};return e.on("videoTrackAdded",m),e.on("videoTrackRemoved",b),e.on("videoTrackUpdated",k),()=>{e.off("videoTrackAdded",m),e.off("videoTrackRemoved",b),e.off("videoTrackUpdated",k)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:r,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:o,toggleScreenShare:i,setLayout:a,pinTrack:c,unpinTrack:d,startRecording:u,stopRecording:f,getTrackById:h,getTracksByParticipant:g,isTrackActive:x}}function Ts(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=Qe(),[s,r]=C.useState(!1),o=C.useCallback(async d=>{if(!(!d.trim()||s||!n)){r(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{r(!1)}}},[t,s,n]),{userMessages:i,agentMessages:a,allMessages:c}=C.useMemo(()=>{const d=e.filter(f=>f.sender.type==="participant"),u=e.filter(f=>f.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:c,userMessages:i,agentMessages:a,messageCount:c.length,isSending:s,canSend:!!n&&!s,send:o}}function vx(){const{send:e,isSending:t,canSend:n}=Ts(),[s,r]=C.useState(""),o=C.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),r("")}catch(a){throw a}},[s,e,n]),i=C.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())},[o]);return{value:s,setValue:r,send:o,handleKeyPress:i,isSending:t,canSend:n&&s.trim().length>0}}function Ro(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:r}=Qe(),o=C.useCallback(async()=>{if(!(e||t))try{await s()}catch(a){throw console.error("Failed to connect:",a),a}},[s,e,t]),i=C.useCallback(async()=>{if(e)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:o,disconnect:i}}function Td(){const{participants:e}=Qe();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const Ed=C.createContext({}),Nn=()=>C.useContext(Ed);function Ad({children:e,...t}){return l.jsx(Ed.Provider,{value:t,children:e})}function Jn({name:e,children:t,fallback:n,className:s}){return l.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function jd(e,t={}){return Object.assign(e,t)}function Md({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:r,className:o=""}){const i=jt(),a=Sd(),c=Cd(),d=kd(),u=Nn(),f=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,i.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",o].filter(Boolean).join(" ");return!i.isActive&&!s?l.jsx("div",{className:f,children:l.jsx("div",{className:"voxket-controls-inactive",children:l.jsx("p",{children:"Controls available during active session"})})}):l.jsxs("div",{className:f,children:[s&&l.jsx("div",{className:"voxket-session-actions",children:i.isActive?l.jsx("button",{onClick:i.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):l.jsx(wx,{})}),i.isActive&&l.jsxs("div",{className:"voxket-media-controls",children:[e&&l.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[l.jsx("span",{className:"voxket-icon",children:"๐ŸŽค"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&l.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[l.jsx("span",{className:"voxket-icon",children:"๐Ÿ“น"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&l.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[l.jsx("span",{className:"voxket-icon",children:"๐Ÿ–ฅ๏ธ"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),r&&l.jsx("div",{className:"voxket-custom-controls",children:r})]})}function wx(){jt();const[e,t]=C.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return l.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function Io({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const r=jt(),o=Ro(),i=Nn(),a=["voxket-session-header",`voxket-session-header--${i.variant||"default"}`,`voxket-session-header--${i.size||"md"}`,s].filter(Boolean).join(" ");return l.jsxs("div",{className:a,children:[e&&l.jsxs("div",{className:"voxket-connection-status",children:[l.jsx("div",{className:`voxket-status-indicator ${o.isConnected?"connected":"disconnected"}`}),l.jsx("span",{className:"voxket-status-text",children:o.isConnecting?"Connecting...":o.isConnected?"Connected":"Disconnected"})]}),t&&r.session&&l.jsxs("div",{className:"voxket-session-info",children:[l.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),l.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&l.jsxs("div",{className:"voxket-agent-info",children:[l.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),l.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),o.error&&l.jsxs("div",{className:"voxket-error-message",children:["Error: ",o.error.message]})]})}function Do({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const r=jt(),o=Ts(),i=Nn(),a=["voxket-session-content",`voxket-session-content--${i.variant||"default"}`,`voxket-session-content--${i.size||"md"}`,s].filter(Boolean).join(" ");return r.isActive?l.jsx("div",{className:a,children:n||l.jsxs(l.Fragment,{children:[e&&l.jsxs("div",{className:"voxket-chat-container",children:[l.jsxs("div",{className:"voxket-chat-messages",children:[o.messages.map(c=>l.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[l.jsxs("div",{className:"voxket-message-header",children:[l.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),l.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),l.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),o.messages.length===0&&l.jsx("div",{className:"voxket-empty-messages",children:l.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),l.jsx(Sx,{})]}),t&&l.jsx("div",{className:"voxket-transcriptions",children:l.jsx("div",{className:"voxket-transcription-placeholder",children:l.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):l.jsx("div",{className:a,children:l.jsx("div",{className:"voxket-inactive-state",children:l.jsxs("div",{className:"voxket-inactive-message",children:[l.jsx("h3",{children:"Start a conversation"}),l.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function Sx(){const e=Ts(),[t,n]=C.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(o){console.error("Failed to send message:",o)}},r=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),s())};return l.jsxs("div",{className:"voxket-chat-input",children:[l.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),l.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function $o({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:r=""}){const o=jt(),i=wd(),a=Td(),c=Nn(),d=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,r].filter(Boolean).join(" ");return o.isActive?l.jsx("div",{className:d,children:s||l.jsxs(l.Fragment,{children:[n&&l.jsxs("div",{className:"voxket-session-status",children:[l.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),l.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&i.metrics&&l.jsxs("div",{className:"voxket-session-metrics",children:[l.jsxs("div",{className:"voxket-metric",children:[l.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),l.jsx("span",{className:"voxket-metric-value",children:Cx(i.duration||0)})]}),l.jsxs("div",{className:"voxket-metric",children:[l.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),l.jsx("span",{className:"voxket-metric-value",children:i.metrics.messageCount})]})]}),t&&l.jsxs("div",{className:"voxket-participants-info",children:[l.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&l.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>l.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):l.jsx("div",{className:d,children:l.jsx("div",{className:"voxket-footer-inactive",children:l.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function Cx(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function kx({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:r,variant:o="default",size:i="md",theme:a,className:c="",children:d}){var g;const u=jt(),f=Ro();C.useEffect(()=>{n&&e&&f.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,f.isConnected,u.isActive]),C.useEffect(()=>{var x;(x=u.session)!=null&&x.id&&s&&s(u.session.id)},[(g=u.session)==null?void 0:g.id,s]),C.useEffect(()=>()=>{u.isActive&&r&&u.stop().then(r).catch(console.error)},[]);const h=["voxket-session",`voxket-session--${o}`,`voxket-session--${i}`,u.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return l.jsx(Ad,{variant:o,size:i,theme:a,className:c,children:l.jsx("div",{className:h,children:d||l.jsxs(l.Fragment,{children:[l.jsx(Jn,{name:"header",fallback:l.jsx(Io,{})}),l.jsx(Jn,{name:"content",fallback:l.jsx(Do,{})}),l.jsx(Jn,{name:"footer",fallback:l.jsx($o,{})})]})})})}const Pd=jd(kx,{Header:Io,Content:Do,Footer:$o,Controls:Md}),Et={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},Ir={...Et,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},Dr={...Et,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},Vd=C.createContext(null),Nd=()=>{const e=C.useContext(Vd);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function Tx({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:r=""}){const[o,i]=C.useState(()=>{const h={default:Et,dark:Ir,enterprise:Dr,...t};return typeof e=="string"?h[e]||Et:e}),[a,c]=C.useState(()=>({default:Et,dark:Ir,enterprise:Dr,...t})),d=h=>{if(typeof h=="string"){const g=a[h];g&&i(g)}else i(h)},u=h=>{c(g=>({...g,[h.name]:h}))};C.useEffect(()=>{if(s&&typeof document<"u"){const h=document.documentElement;Object.entries(Rd(o)).forEach(([g,x])=>{h.style.setProperty(`--voxket-${g}`,x)})}},[o,s]);const f={theme:o,setTheme:d,themes:a,registerTheme:u};return l.jsx(Vd.Provider,{value:f,children:l.jsx("div",{className:`voxket-theme voxket-theme--${o.name} ${r}`,children:n})})}function Rd(e){const t={},n=(s,r="")=>{for(const[o,i]of Object.entries(s)){const a=r?`${r}-${o}`:o;typeof i=="object"&&i!==null&&!Array.isArray(i)?n(i,a):t[a]=String(i)}};return n(e),t}function Ex(e=Et,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function Ax(e){var n;const{theme:t}=Nd();return((n=t.components)==null?void 0:n[e])||{}}const jx=Vo("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&Mx(e),t.enableVoiceActivation&&Px(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&Vx(e,t)}});function Mx(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function Px(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function Vx(e,t){console.log("Playing audio response:",t.content)}const Nx=Vo("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&Rx(),t.enableFileUpload&&Ix(e),t.enableCustomComponents&&Dx(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?$x(e,t):t.type==="text"&&n.enableRichText&&Fx(e,t)}});function Rx(e){console.log("Rich text support enabled")}function Ix(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function Dx(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",Ox),t.set("form",Lx),t.set("card",_x),t.set("chart",Bx)}function $x(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function Fx(e,t){console.log("Processing rich text message:",t.content)}function Ox(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function Lx(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function _x(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function Bx(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function Qn({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:r=!0,isPinned:o=!1,className:i="",onClick:a,onPin:c,onUnpin:d}){const u=C.useRef(null),[f,h]=C.useState(!1);C.useEffect(()=>{if(!u.current||!e.isEnabled)return;const b=u.current;return b.srcObject=null,()=>{b.srcObject&&(b.srcObject=null)}},[e]);const g=()=>{a==null||a(e)},x=b=>{b.stopPropagation(),o?d==null||d(e):c==null||c(e)},m=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",o?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",f?"voxket-video-tile--hovered":"",i].filter(Boolean).join(" ");return l.jsxs("div",{className:m,onClick:g,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[l.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&l.jsxs("div",{className:"voxket-video-placeholder",children:[l.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"๐Ÿ–ฅ๏ธ":"๐Ÿ“น"}),l.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),l.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&l.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),r&&!e.isEnabled&&l.jsx("div",{className:"voxket-video-mute-indicator",children:"๐Ÿ”‡"}),n&&(f||o)&&l.jsxs("div",{className:"voxket-video-controls",children:[l.jsx("button",{className:`voxket-video-control-btn ${o?"voxket-video-control-btn--active":""}`,onClick:x,title:o?"Unpin video":"Pin video",children:"๐Ÿ“Œ"}),e.isScreenShare&&l.jsx("div",{className:"voxket-video-indicator",children:"๐Ÿ–ฅ๏ธ"}),e.source&&l.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&l.jsx("div",{className:"voxket-video-loading",children:l.jsx("div",{className:"voxket-spinner"})})]})}function zx({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:r,maxVisibleTracks:o=9,showPagination:i=!0}){const[a,c]=C.useState(0),[d,u]=C.useState(null),f=C.useMemo(()=>{let v=[...e];t.type==="speaker"&&d&&(v=[d,...e.filter(S=>S.id!==d.id)]);const T=a*o,w=T+o;return v.slice(T,w)},[e,t,d,a,o]),h=Math.ceil(e.length/o),g=C.useMemo(()=>{const v=f.length;switch(t.type){case"grid":const T=Math.ceil(Math.sqrt(v)),w=Math.ceil(v/T);return{display:"grid",gridTemplateColumns:`repeat(${T}, 1fr)`,gridTemplateRows:`repeat(${w}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,f.length]),x=v=>{u(v)},m=()=>{u(null)},b=v=>{s==null||s({...t,type:v})},k=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${f.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?l.jsx("div",{className:"voxket-video-grid-empty",children:l.jsxs("div",{className:"voxket-video-grid-empty-content",children:[l.jsx("div",{className:"voxket-video-grid-empty-icon",children:"๐Ÿ“น"}),l.jsx("p",{children:"No video tracks available"})]})}):l.jsxs("div",{className:k,children:[l.jsxs("div",{className:"voxket-video-grid-controls",children:[l.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(v=>l.jsx("button",{className:`voxket-layout-btn ${t.type===v?"voxket-layout-btn--active":""}`,onClick:()=>b(v),title:`Switch to ${v} layout`,children:Hx(v)},v))}),l.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),l.jsx("div",{className:"voxket-video-grid-content",style:g,children:t.type==="speaker"&&d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"voxket-video-speaker-main",children:l.jsx(Qn,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:r,onUnpin:m})}),l.jsx("div",{className:"voxket-video-speaker-sidebar",children:f.filter(v=>v.id!==d.id).map(v=>l.jsx(Qn,{track:v,participantName:`Participant ${v.participantId}`,showControls:!1,onClick:r,onPin:x},v.id))})]}):f.map(v=>l.jsx(Qn,{track:v,participantName:`Participant ${v.participantId}`,isPinned:(d==null?void 0:d.id)===v.id,onClick:r,onPin:x,onUnpin:m},v.id))}),i&&h>1&&l.jsxs("div",{className:"voxket-video-pagination",children:[l.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,a-1)),disabled:a===0,children:"โ†"}),l.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",h]}),l.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(h-1,a+1)),disabled:a===h-1,children:"โ†’"})]})]})}function Hx(e){switch(e){case"grid":return"โŠž";case"speaker":return"๐ŸŽค";case"sidebar":return"โซธ";case"gallery":return"โŠก";case"picture-in-picture":return"โง‰";default:return"โŠž"}}function Ux({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:r=!0,showCameraControls:o=!0,showScreenShareControls:i=!0,className:a=""}){const c=["voxket-video-controls",a].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return l.jsxs("div",{className:c,children:[o&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),l.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[l.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"๐Ÿ“น":"๐Ÿ“ท"}),l.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&l.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," ร— ",e.dimensions.height]})]}),i&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),l.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[l.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"๐Ÿ›‘":"๐Ÿ–ฅ๏ธ"}),l.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),l.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"โŠž",label:"Grid"},{type:"speaker",icon:"๐ŸŽค",label:"Speaker"},{type:"sidebar",icon:"โซธ",label:"Sidebar"},{type:"gallery",icon:"โŠก",label:"Gallery"}].map(({type:u,icon:f,label:h})=>l.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${h} layout`,children:[l.jsx("span",{className:"voxket-control-icon",children:f}),l.jsx("span",{className:"voxket-control-label",children:h})]},u))})]}),l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),l.jsxs("div",{className:"voxket-video-settings",children:[l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Quality"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"high",children:"High (720p)"}),l.jsx("option",{value:"medium",children:"Medium (480p)"}),l.jsx("option",{value:"low",children:"Low (240p)"})]})]}),l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"30",children:"30 fps"}),l.jsx("option",{value:"15",children:"15 fps"}),l.jsx("option",{value:"10",children:"10 fps"})]})]}),l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"unlimited",children:"Unlimited"}),l.jsx("option",{value:"1000",children:"1 Mbps"}),l.jsx("option",{value:"500",children:"500 Kbps"}),l.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),l.jsxs("div",{className:"voxket-video-stats",children:[l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),l.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}ร—${e.dimensions.height}`:"N/A"})]}),l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Source:"}),l.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Status:"}),l.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const Id=({handler:e,loadData:t,data:n,client:s,addLocalMessage:r})=>{const[o,i]=p.useState(null),[a,c]=p.useState(!0),[d,u]=p.useState(!1),[f]=p.useState(Date.now());p.useEffect(()=>{(async()=>{try{if(c(!0),console.log("๐Ÿ“‹ AssignmentView: Loading assignment data..."),console.log("๐Ÿ“‹ AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const b={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};i(b),console.log("๐Ÿ“‹ AssignmentView: Assignment loaded from RPC data:",b)}}catch(b){console.error("๐Ÿ“‹ AssignmentView: Error loading assignment:",b),i({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,t]);const h=({message:m,assignment:b})=>{const k=m.toLowerCase().includes("declined"),v=k?"bg-red-50 border-red-200":"bg-green-50 border-green-200",T=k?"text-red-700":"text-green-700",w=k?"โŒ":"๐ŸŽ‰";return l.jsxs("div",{className:`max-w-sm mx-auto ${v} border rounded-lg shadow p-3 flex flex-col items-center`,children:[l.jsx("div",{className:"text-2xl mb-2",children:w}),l.jsx("div",{className:`${T} font-semibold text-sm mb-1`,children:m}),l.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:b.title}),l.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},g=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"accepted"};console.log("๐Ÿ“‹ AssignmentView: Assignment accepted:",m),e.didSuccess(m,l.jsx(h,{message:"Assignment accepted!",assignment:o}))}catch(m){console.error("๐Ÿ“‹ AssignmentView: Error accepting assignment:",m),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},x=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"declined"};console.log("๐Ÿ“‹ AssignmentView: Assignment declined:",m),e.didSuccess(m,l.jsx(h,{message:"Assignment declined",assignment:o}))}catch(m){console.error("๐Ÿ“‹ AssignmentView: Error declining assignment:",m),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?l.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:l.jsxs("div",{className:"flex items-center justify-center py-4",children:[l.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),l.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):o?l.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[l.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:l.jsx("div",{className:"flex items-center justify-between",children:l.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:o.title})})}),l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:l.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:o.description})}),l.jsx("div",{className:"mb-3",children:l.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[l.jsx("span",{className:"text-xs mr-1",children:"๐Ÿ“…"}),l.jsxs("span",{children:["Est: ",o.estimated_time_of_completion]})]})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?l.jsxs("span",{className:"flex items-center justify-center",children:[l.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),l.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),l.jsx("button",{onClick:x,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):l.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:l.jsxs("div",{className:"text-center py-4",children:[l.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"โš ๏ธ Assignment Error"}),l.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function Zx(){const[e,t]=p.useState(null),[n,s]=p.useState([]);p.useEffect(()=>{const a=new Vn({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),a.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{a.disconnect()}},[]);const r=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",Id,"embedded");const a=e.getRegisteredRpcMethods();s(a),console.log("โœ… Assignment RPC registered successfully")}catch(a){console.error("โŒ Failed to register assignment RPC:",a)}},o=async()=>{if(!e)return;const a=({handler:c,timeout:d})=>{const[u,f]=p.useState(""),h=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],g=m=>{f(m)},x=()=>{const m=h.find(b=>b.id===u);c==null||c.didSuccess({selectedProduct:u,productName:m==null?void 0:m.name,price:m==null?void 0:m.price,timestamp:new Date().toISOString()})};return l.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[l.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),l.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),l.jsx("div",{className:"space-y-3 mb-6",children:h.map(m=>l.jsx("div",{onClick:()=>g(m.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===m.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium",children:m.name}),l.jsx("p",{className:"text-gray-600 text-sm",children:m.price})]}),l.jsx("div",{className:`w-4 h-4 rounded-full ${u===m.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},m.id))}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),l.jsx("button",{onClick:x,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&l.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const c=e.getRegisteredRpcMethods();s(c),console.log("โœ… Product Recommendation RPC registered successfully")}catch(c){console.error("โŒ Failed to register product recommendation RPC:",c)}},i=async()=>{if(!e)return;const a=({handler:c})=>{const[d,u]=p.useState(0),[f,h]=p.useState(""),g=()=>{c==null||c.didSuccess({rating:d,comment:f,timestamp:new Date().toISOString()})};return l.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),l.jsxs("div",{className:"mb-4",children:[l.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),l.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(x=>l.jsx("button",{onClick:()=>u(x),className:`text-2xl ${x<=d?"text-yellow-400":"text-gray-300"}`,children:"โญ"},x))})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),l.jsx("textarea",{value:f,onChange:x=>h(x.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),l.jsxs("div",{className:"flex justify-end space-x-2",children:[l.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),l.jsx("button",{onClick:g,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const c=e.getRegisteredRpcMethods();s(c),console.log("โœ… Feedback RPC registered successfully")}catch(c){console.error("โŒ Failed to register feedback RPC:",c)}};return l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),l.jsxs("div",{className:"space-y-4 mb-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),l.jsxs("div",{className:"space-x-2",children:[l.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),l.jsx("button",{onClick:o,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),l.jsx("button",{onClick:i,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?l.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>l.jsx("li",{className:"text-gray-700",children:l.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):l.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),l.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[l.jsxs("li",{children:["Register RPC methods with React components using ",l.jsx("code",{children:"client.registerFrontendRPC()"})]}),l.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),l.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),l.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),l.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),l.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),l.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),l.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
252
+ `;function No(){if(Wa||typeof document>"u")return;const e=document.createElement("style");e.type="text/css",e.id="voxket-widget-styles",e.textContent=ux,document.head.appendChild(e),Wa=!0}No();class he extends Error{constructor(t,n,s){super(t),this.code=n,this.details=s,this.name="VoxketError"}}class Vn extends Po{constructor(n){super();Se(this,"config");Se(this,"room",null);Se(this,"pluginManager");Se(this,"rpcManager");Se(this,"isConnected",!1);Se(this,"currentSession",null);Se(this,"connectionState",Z.ConnectionState.Disconnected);Se(this,"renderedComponents",new Map);Se(this,"textStreamHandlersRegistered",!1);Se(this,"currentAgentInfo",null);Se(this,"chatMessages",[]);Se(this,"isAgentConnected",!1);Se(this,"agentState","idle");No(),this.config=n,this.pluginManager=new gd(this),this.rpcManager=new dx,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,s;this.isConnected=!0,(s=(n=this.config).onConnected)==null||s.call(n)}),this.on("connection.disconnected",n=>{var s,r;this.isConnected=!1,(r=(s=this.config).onDisconnected)==null||r.call(s,n)}),this.on("connection.error",n=>{var s,r;(r=(s=this.config).onError)==null||r.call(s,n)}),this.on("chat.message.received",n=>{var s,r;this.addChatMessage(n),(r=(s=this.config).onMessageReceived)==null||r.call(s,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var s,r;(r=(s=this.config).onTranscriptionReceived)==null||r.call(s,n)}),this.on("session.state.changed",n=>{var s,r;(r=(s=this.config).onSessionStateChanged)==null||r.call(s,n)}),this.on("session.created",n=>{var s,r;(r=(s=this.config).onSessionStart)==null||r.call(s,n.id)}),this.on("session.ended",(n,s)=>{var r,o;(o=(r=this.config).onSessionEnd)==null||o.call(r,s)}),this.on("participant.joined",n=>{var s,r;(r=(s=this.config).onUserJoined)==null||r.call(s,n.id)}),this.on("participant.left",n=>{var s,r;(r=(s=this.config).onUserLeft)==null||r.call(s,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new Z.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(Z.RoomEvent.Connected,()=>{var n,s;this.connectionState=Z.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(s=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&s.includes("voice")&&setTimeout(async()=>{var r;try{(r=this.room)!=null&&r.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(o){console.warn("VoxketClient: Failed to enable microphone after room connection:",o)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(Z.RoomEvent.Disconnected,n=>{var s;console.log("๐Ÿ”ด VoxketClient: Room disconnected, reason:",n),this.connectionState=Z.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.isAgentConnected=!1,console.log("๐Ÿค– VoxketClient: Agent marked as disconnected"),n&&console.log("๐Ÿ” VoxketClient: Disconnect reason details:",{reason:n.toString(),currentSession:(s=this.currentSession)==null?void 0:s.id,agentConnected:this.isAgentConnected,connectionState:this.connectionState}),this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(Z.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===Z.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(Z.RoomEvent.ParticipantConnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",s)}),this.room.on(Z.RoomEvent.ParticipantDisconnected,n=>{const s={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",s)}))}setupTextStreamHandlers(){if(!this.room)return;try{this.room.registerTextStreamHandler("lk.chat",async(s,r)=>{try{const o=await s.readAll(),i={id:`msg_${Date.now()}_${r.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:r.identity||"user",name:r.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",i)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(s){console.warn("VoxketClient: lk.chat handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("lk.transcription",async(s,r)=>{var o,i;try{const a=`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`;let c="";const d=((o=this.currentAgentInfo)==null?void 0:o.name)||r.identity||"AI Assistant",u={id:a,content:"",timestamp:new Date,sender:{id:r.identity||"agent",name:d,type:"agent"},metadata:{topic:"lk.transcription",streaming:!0}};this.emit("chat.message.received",u);for await(const g of s){c+=g;const x=this.convertMarkdownToText(c),m={...u,content:x,metadata:{...u.metadata,streaming:!0}};this.emit("chat.message.updated",m)}const f=this.convertMarkdownToText(c),h={...u,content:f,metadata:{...u.metadata,streaming:!1}};this.emit("chat.message.updated",h)}catch(a){console.error("VoxketClient: Failed to process lk.transcription message:",a);try{const c=await s.readAll(),d=((i=this.currentAgentInfo)==null?void 0:i.name)||r.identity||"AI Assistant",u={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:c,timestamp:new Date,sender:{id:r.identity||"agent",name:d,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",u)}catch(c){console.error("VoxketClient: Fallback failed for lk.transcription:",c)}}})}catch(s){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("suggested_response",async s=>{const r=await s.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(i){console.warn("VoxketClient: Failed to parse suggested_response:",i,r)}this.emit("suggested.response",o)})}catch(s){console.warn("VoxketClient: suggested_response handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("agent_state_changed",async(s,r)=>{const o=await s.readAll();console.log("๐Ÿค– VoxketClient: agent_state_changed stream received:",o);let i={};try{i=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(a){console.warn("VoxketClient: Failed to parse agent_state_changed:",a,o)}this.isAgentConnected||(this.isAgentConnected=!0,console.log("๐Ÿค– VoxketClient: Agent marked as connected (first state change received)"),this.emit("agent.connected",i)),i.new_state==="speaking"?(this.setAgentState("speaking"),this.emit("agent.speaking",i)):i.new_state==="thinking"?(this.setAgentState("thinking"),this.emit("agent.thinking",i)):(i.new_state==="idle"||i.new_state==="listening")&&this.setAgentState("idle")})}catch(s){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",s)}try{this.room.registerTextStreamHandler("images",async(s,r)=>{try{const o=await s.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(s){console.warn("VoxketClient: images handler already registered, skipping:",s)}try{this.room.registerByteStreamHandler("images",async(s,r)=>{var o,i;try{const a=s.info,c={id:`img_${Date.now()}_${r.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`๏ฟฝ๏ธ ${a.name||"Image"}`,sender:{id:r.identity||"agent",name:r.identity||"Agent",type:r.identity===((i=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:i.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:a.name,fileSize:a.size,mimeType:a.mimeType,streamId:a.id,downloading:!0}};this.emit("chat.message.received",c),s.onProgress&&(s.onProgress=g=>{const x={...c,metadata:{...c.metadata,downloadProgress:g||0}};this.emit("chat.message.updated",x)});const d=[];for await(const g of s)d.push(g);const u=new Blob(d,{type:a.mimeType||"application/octet-stream"}),f=URL.createObjectURL(u),h={...c,metadata:{...c.metadata,downloading:!1,downloadProgress:1,downloadUrl:f,blob:u}};this.emit("chat.message.updated",h)}catch(a){console.error("VoxketClient: Error processing image attachment:",a)}})}catch(s){console.warn("VoxketClient: image handler already registered, skipping:",s)}["error","warning","status","system","debug","info"].forEach(s=>{try{this.room.registerTextStreamHandler(s,async(r,o)=>{try{const i=await r.readAll();if(console.log(`๐Ÿ“ VoxketClient: Received '${s}' stream:`,i),s==="error"){let a={};try{a=typeof i=="string"?JSON.parse(i):i}catch{a={message:i}}console.warn("๏ฟฝ VoxketClient: Agent error:",a),this.emit("agent.error",a)}else this.emit("text.stream.received",{topic:s,data:i,participantInfo:o})}catch(i){console.error(`VoxketClient: Failed to process '${s}' stream:`,i)}})}catch(r){console.warn(`VoxketClient: Handler for '${s}' already registered, skipping:`,r)}});try{this.room.registerTextStreamHandler("*",async(s,r)=>{var o;try{const i=await s.readAll(),a=((o=s.info)==null?void 0:o.topic)||"unknown";console.log(`๐Ÿ“ VoxketClient: Received unhandled text stream for topic '${a}':`,i),this.emit("text.stream.unhandled",{topic:a,data:i,participantInfo:r})}catch(i){console.error("VoxketClient: Failed to process unhandled text stream:",i)}})}catch(s){console.warn("VoxketClient: Generic text stream handler already registered, skipping:",s)}this.textStreamHandlersRegistered=!0}async fetchConnectionDetails(n,s,r){const o=n||this.config.agentId||"default-agent",i=s||this.config.participantName||"User",a=r||this.config.modalities||["voice"];try{const c={agent_id:o,participant_name:i,participant_metadata:{user_id:""},modality:a[0],modalities:a};console.log("๐Ÿ”— VoxketClient: Creating session with modalities:",a);const d=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){let h=`HTTP ${d.status}: Failed to fetch connection details`;try{const g=await d.json();g&&(g.error?h=`API Error: ${g.error}`:g.detail?h=`API Error: ${g.detail}`:g.message&&(h=`API Error: ${g.message}`))}catch{try{const x=await d.text();x&&(h=`API Error: ${x}`)}catch{}}throw new Error(h)}const u=await d.json();let f;return u.agent_info&&(f={id:u.agent_info.id||o,name:u.agent_info.name||"AI Assistant",avatar:u.agent_info.avatar,capabilities:u.agent_info.capabilities||["voice_interaction","text_chat"],metadata:u.agent_info.metadata||{}},this.currentAgentInfo=f),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:f}}catch(c){console.error("VoxketClient: fetchConnectionDetails failed:",c);const d=new he(`Failed to fetch connection details: ${c instanceof Error?c.message:"Unknown error"}`,"CONNECTION_FAILED",c);throw this.emit("connection.error",d),d}}async connect(n,s,r){var o;try{this.emit("connection.connecting");const i=await this.fetchConnectionDetails(n,s,r);return await((o=this.room)==null?void 0:o.connect(i.serverUrl,i.participantToken)),this.isConnected=!0,i}catch(i){console.error("VoxketClient: Connection failed:",i);const a=new he(`Failed to connect to Voxket services: ${i instanceof Error?i.message:"Unknown error"}`,"CONNECTION_FAILED",i);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{await((n=this.room)==null?void 0:n.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),this.room=new Z.Room,this.setupRoomEventListeners()}catch(s){const r=new he("Failed to disconnect properly","NETWORK_ERROR",s);throw this.emit("connection.error",r),r}}async createSession(n){var s,r,o,i;try{const a=await this.connect(n.agentId,n.participantName,n.modalities),c={id:a.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:a.agentInfo||this.currentAgentInfo};if(this.currentSession=c,this.emit("session.created",c),(s=n.modalities)!=null&&s.includes("voice"))try{await new Promise(d=>setTimeout(d,500)),(r=this.room)!=null&&r.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(d){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",d)}if((o=n.modalities)!=null&&o.includes("video"))try{await new Promise(d=>setTimeout(d,200)),(i=this.room)!=null&&i.localParticipant&&(console.log("๐ŸŽฅ VoxketClient: Attempting to enable camera for video session"),await this.room.localParticipant.setCameraEnabled(!0),this.emit("track.unmuted",{source:"camera",enabled:!0}),console.log("๐ŸŽฅ VoxketClient: Camera enabled successfully"))}catch(d){console.warn("VoxketClient: Failed to enable camera, but continuing with session:",d)}return setTimeout(()=>{var d;this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state),this.forceAgentConnected(),console.log("๐Ÿค– VoxketClient: Session marked as active:",{sessionId:this.currentSession.id,modalities:this.currentSession.activeModalities,agentConnected:this.isAgentConnected,hasRoom:!!this.room,remoteParticipants:((d=this.room)==null?void 0:d.remoteParticipants.size)||0}))},1e3),c}catch(a){throw console.error("VoxketClient: Failed to create session:",a),a instanceof he?a:a instanceof TypeError&&a.message.includes("fetch")?new he("Network connection failed","CONNECTION_FAILED",a):a instanceof Error&&a.message.includes("Failed to fetch connection details")?new he(`API connection failed: ${a.message}`,"CONNECTION_FAILED",a):new he(`Failed to create session: ${a instanceof Error?a.message:"Unknown error"}`,"SESSION_NOT_FOUND",a)}}async startSession(n,s){const r={agentId:n||this.config.agentId||"default-agent",participantName:(s==null?void 0:s.participantName)||this.config.participantName||"User",modalities:(s==null?void 0:s.modalities)||this.config.modalities||["voice","chat"],metadata:s==null?void 0:s.metadata};return this.createSession(r)}async endSession(){var n,s;if(!this.currentSession)return null;try{const r={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,r),await this.disconnect(),r}catch(r){throw new he("Failed to end session","SESSION_NOT_FOUND",r)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getIsAgentConnected(){return this.isAgentConnected}forceAgentConnected(){this.isAgentConnected||(this.isAgentConnected=!0,console.log("๐Ÿค– VoxketClient: Agent manually marked as connected"),this.emit("agent.connected",{forced:!0}))}getAgentState(){return this.agentState}setAgentState(n){this.agentState!==n&&(this.agentState=n,this.emit("agent.state.changed",{state:n}))}getAgentAudioTrack(){const n=this.getRemoteParticipants();for(const s of n){const r=s.getTrackPublication(Z.Track.Source.Microphone);if(r!=null&&r.track)return{source:Z.Track.Source.Microphone,participant:s,publication:r}}return null}getAgentVideoTrack(){const n=this.getRemoteParticipants();for(const s of n){const r=s.getTrackPublication(Z.Track.Source.Camera);if(r!=null&&r.track)return{source:Z.Track.Source.Camera,participant:s,publication:r}}return null}getVideoTrackRefs(){const n=[],s=this.getLocalParticipant();if(s){const o=s.getTrackPublication(Z.Track.Source.Camera);o!=null&&o.track&&n.push({source:Z.Track.Source.Camera,participant:s,publication:o});const i=s.getTrackPublication(Z.Track.Source.ScreenShare);i!=null&&i.track&&n.push({source:Z.Track.Source.ScreenShare,participant:s,publication:i})}const r=this.getRemoteParticipants();for(const o of r){const i=o.getTrackPublication(Z.Track.Source.Camera);i!=null&&i.track&&n.push({source:Z.Track.Source.Camera,participant:o,publication:i});const a=o.getTrackPublication(Z.Track.Source.ScreenShare);a!=null&&a.track&&n.push({source:Z.Track.Source.ScreenShare,participant:o,publication:a})}return n}getCameraTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===Z.Track.Source.Camera)}getScreenShareTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===Z.Track.Source.ScreenShare)}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(r=>r.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const s=this.chatMessages.findIndex(r=>r.id===n.id);s!==-1&&(this.chatMessages[s]=n)}clearChatMessages(){this.chatMessages=[],this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),this.emit("chat.history.cleared")}renderUI(n={}){var c,d,u;const s=this.resolveTarget(n.target||"body"),r=this.getTargetKey(s),o=this.renderedComponents.get(r);o&&o.target===s||this.removeUI(s);const i=(o==null?void 0:o.root)||Zd.createRoot(s),a={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((d=n.modality)==null?void 0:d.includes("video"))===!0,suportsScreenShare:((u=n.modality)==null?void 0:u.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!i||typeof i.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{i.render(C.createElement(xd,{config:this.config,autoConnect:n.autoStart||!1,children:C.createElement(bd,a)}))}catch(f){throw console.error("Error rendering Voxket widget:",f),new Error(`Failed to render Voxket widget: ${f instanceof Error?f.message:"Unknown error"}`)}this.renderedComponents.set(r,{root:i,target:s})}removeUI(n){const s=n?this.resolveTarget(n):null;if(s){const r=this.getTargetKey(s),o=this.renderedComponents.get(r);o&&(o.root.unmount(),this.renderedComponents.delete(r),s.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(a=>{try{a.remove()}catch(c){console.warn("Failed to remove element:",c)}}),s===document.body&&s.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&c.classList.contains("backdrop-blur-sm"))try{c.remove()}catch(d){console.warn("Failed to remove fixed element:",d)}}))}}removeAllUI(){for(const[n,s]of this.renderedComponents)s.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(s=>{if(s.classList.contains("bg-black")&&(s.classList.contains("backdrop-blur-sm")||s.classList.contains("bg-opacity-30")))try{s.remove()}catch(r){console.warn("Failed to remove overlay:",r)}})}resolveTarget(n){if(typeof n=="string"){const s=document.querySelector(n);if(!s)throw new Error(`Target element not found: ${n}`);return s}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,s){var r;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new he("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new he("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new he("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const o={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:s||{}},i=await((r=this.room)==null?void 0:r.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",o)}catch(o){throw console.error("VoxketClient: Failed to send chat message:",o),new he("Failed to send message","NETWORK_ERROR",o)}}async sendChatMessage(n,s){return this.sendMessage(n,s)}async sendAttachments(n,s){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new he("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new he("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new he("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new he("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const r=n.filter(o=>o.type.startsWith("image/"));if(r.length===0)throw new he("Only image files are allowed","INVALID_PARAMETER");r.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const o=r.map(async(i,a)=>{const d={id:`att_${Date.now()}_${a}`,content:`๐Ÿ“Ž ${i.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...s,type:"attachment",fileName:i.name,fileSize:i.size,mimeType:i.type,uploading:!0}};this.emit("chat.message.sent",d);const u=await this.room.localParticipant.sendFile(i,{mimeType:i.type,topic:"images",onProgress:h=>{const g={...d,metadata:{...d.metadata,uploadProgress:h}};this.emit("chat.message.updated",g)}});try{const h=new FileReader,g=new Promise((b,k)=>{h.onload=()=>{typeof h.result=="string"?b(h.result):k(new Error("Failed to convert to base64"))},h.onerror=k});h.readAsDataURL(i);const m={type:"image",data:await g,filename:i.name,mimeType:i.type,size:i.size};await this.room.localParticipant.sendText(JSON.stringify(m),{topic:"images",destinationIdentities:[]})}catch(h){console.warn("VoxketClient: Failed to send image data to agent:",h);try{const g=`I've shared an image: ${i.name}`;await this.room.localParticipant.sendText(g,{topic:"lk.chat",destinationIdentities:[]})}catch(g){console.warn("VoxketClient: Failed to send image notification to agent:",g)}}const f={...d,metadata:{...d.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",f),u});await Promise.all(o)}catch(o){throw console.error("VoxketClient: Failed to send attachments:",o),new he("Failed to send attachments","NETWORK_ERROR",o)}}async sendAttachment(n,s){return this.sendAttachments([n],s)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var s,r;try{const o=(s=this.room)==null?void 0:s.localParticipant.isMicrophoneEnabled,i=n??!o;await((r=this.room)==null?void 0:r.localParticipant.setMicrophoneEnabled(i)),i?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle microphone:",o),new he("Failed to toggle microphone","PERMISSION_DENIED",o)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var s,r;try{const o=(s=this.room)==null?void 0:s.localParticipant.isCameraEnabled,i=n??!o;await((r=this.room)==null?void 0:r.localParticipant.setCameraEnabled(i)),i?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle camera:",o),new he("Failed to toggle camera","PERMISSION_DENIED",o)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0))}catch(s){throw new he("Failed to start screen share","PERMISSION_DENIED",s)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1))}catch(s){throw new he("Failed to stop screen share","PERMISSION_DENIED",s)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="audioinput")}catch(n){throw new he("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput")}catch(n){throw new he("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new he("Failed to set audio input device","DEVICE_ERROR",r)}}async setVideoInputDevice(n){var s;try{if(!((s=this.room)!=null&&s.localParticipant))throw new Error("Not connected to room")}catch(r){throw new he("Failed to set video input device","DEVICE_ERROR",r)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const s=n.permissions;if(!s)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const r=o=>!!s.canPublish&&(s.canPublishSources.length===0||s.canPublishSources.includes(o));return{camera:r(1),microphone:r(2),screenShare:r(3),data:s.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===Z.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.Microphone)return s.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.Camera)return s.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,s]of n.trackPublications)if(s.source===Z.Track.Source.ScreenShare)return s.track;return null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack();return n?!n.isMuted:!1}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(s=>{n.push({id:s.identity,name:s.name||s.identity,isLocal:!1})}),n}getSessionMetrics(){var n,s;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((s=this.room)==null?void 0:s.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new he("Failed to start recording","RECORDING_ERROR",s)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(s){throw new he("Failed to stop recording","RECORDING_ERROR",s)}}async registerFrontendRPC(n,s,r="embedded"){return this.rpcManager.registerFrontendRPC(n,s,r)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,s){return this.on(n,s)}registerEventEmitter(n,s){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async r=>{try{const o=await r.readAll();s(o)}catch(o){console.error(`Error processing event for topic '${n}':`,o)}})}catch(r){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,r)}}convertMarkdownToText(n){if(!n)return"";let s=n;return s=s.replace(/\*\*(.*?)\*\*/g,"$1"),s=s.replace(/__(.*?)__/g,"$1"),s=s.replace(/\*(.*?)\*/g,"$1"),s=s.replace(/_(.*?)_/g,"$1"),s=s.replace(/~~(.*?)~~/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/```[\s\S]*?```/g,""),s=s.replace(/^#{1,6}\s+/gm,""),s=s.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),s.trim()}}const fx=ie.create(H1),hx=ie.create(Q1),mx=ie.create(nx),px=ie.create(ox);function gx({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:s}){const r={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},o=Ve(s);return l.jsx(ie.button,{onClick:e,className:`fixed ${r[n]} z-50 px-4 py-2 rounded-full shadow-lg ${o.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},children:t})}function Ga({children:e,theme:t,displayType:n="widget",onClose:s,popupPosition:r="bottom-right",onExpand:o}){const i=Ve(t);if(n==="fullscreen")return l.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/40 bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",onClick:a=>{a.target===a.currentTarget&&s&&s()},children:l.jsxs("div",{className:"w-full h-full max-w-6xl max-h-[90vh] rounded-2xl relative bg-transparent",onClick:a=>{a.stopPropagation()},children:[s&&l.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),s()},className:"absolute top-4 cursor-pointer right-4 z-[10000] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),l.jsxs("div",{id:"voice-card",className:`${i.card} w-full h-full flex flex-col rounded-xl shadow-2xl`,style:{minHeight:"600px"},children:[l.jsx("div",{className:i.cardTopGradient}),l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),l.jsx("div",{className:" flex flex-col h-full",children:e}),l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return l.jsx("div",{className:"fixed rounded-2xl inset-0 z-[9999] pointer-events-none",children:l.jsxs("div",{className:`fixed rounded-2xl ${a[r]} pointer-events-auto`,children:[s&&l.jsx("button",{onClick:s,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"ร—"}),l.jsxs("div",{id:"voice-card",className:`${i.card} rounded-2xl flex flex-col`,style:{width:"300px",height:"450px"},children:[l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),l.jsx("div",{className:" flex flex-col h-full",children:e}),l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return l.jsxs("div",{id:"voice-card",className:`${i.card}`,style:{height:"100%",maxHeight:"100%"},children:[o&&l.jsx("button",{onClick:o,className:"absolute top-4 right-4 z-20 w-10 h-10 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Enter Fullscreen",children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),l.jsx("div",{className:i.cardTopGradient}),l.jsx("div",{className:i.cardPurpleBlur}),l.jsx("div",{className:i.cardPinkBlur}),e,l.jsx("div",{className:i.cardPulse1}),l.jsx("div",{className:i.cardPulse2,style:{animationDelay:"1s"}})]})}function bd(e){if(typeof window>"u")return null;console.log("๐ŸŽฏ Widget component rendering with props:",{displayType:e.displayType,popupPosition:e.popupPosition,theme:e.theme});const{agentId:t,participantName:n,baseUrl:s,appSecret:r,appId:o,prompts:i,statusMessage:a,welcomeTitle:c,welcomeSubTitle:d,className:u,width:f,height:h,loadingText:g,suportsChatInput:x=!0,suportsVideoInput:m=!0,suportsScreenShare:b=!0,theme:k="vox",onSessionStart:v,onSessionEnd:T,enableSessionLogging:w=!0,onSessionLogsUpdate:S,onSessionMetricsUpdate:A,modalities:M=["voice"],displayType:j="widget",popupPosition:z="bottom-right",popupTriggerText:y="Open Chat",onPopupToggle:D,voxketClient:_,onDisplayTypeChange:J}=e,[ne,Q]=p.useState(()=>_?!!_.getCurrentSession():!1),[se,K]=p.useState(!1),[R,X]=p.useState(t||""),[V,U]=p.useState(n||"User"),[q,P]=p.useState(()=>_?_.getCurrentSession():null),[E,O]=p.useState(()=>{var te,Oe,De;if(_){const ge=_.getCurrentSession();if((te=ge==null?void 0:ge.activeModalities)!=null&&te.includes("chat"))return"chat";if((Oe=ge==null?void 0:ge.activeModalities)!=null&&Oe.includes("voice"))return"voice";if((De=ge==null?void 0:ge.activeModalities)!=null&&De.includes("video"))return"video"}return"welcome"}),[F,$]=p.useState(!1);p.useEffect(()=>{console.log("๐ŸŽฏ Widget displayType prop changed to:",j)},[j]),p.useEffect(()=>{console.log("๐Ÿ“Š Session state changed:",{currentMode:E,sessionStarted:ne,loading:se,currentSession:q==null?void 0:q.id,isPopupOpen:F})},[E,ne,se,q,F]);const I=p.useMemo(()=>{if(_)return console.log("๐Ÿ”„ Using passed VoxketClient to preserve session state"),_;console.log("๐Ÿ†• Creating new VoxketClient instance");const te={appId:o,appSecret:r,baseUrl:s,agentId:R,participantName:V||"User",modalities:M};return new Vn(te)},[_,o,r,s,R,V,M]),H=M,B=p.useMemo(()=>I.getRoom()||new Z.Room,[I]),oe={suportsChatInput:x,suportsVideoInput:m,suportsScreenShare:b},{sessionMetrics:L,sessionLogs:ae,logEvent:be}=pd({room:B,onSessionStart:v,onSessionEnd:T,enableConsoleLogging:w,enableLocalStorage:w,voxketSessionId:q==null?void 0:q.id});p.useEffect(()=>{S&&S(ae)},[ae,S]),p.useEffect(()=>{A&&L&&A(L)},[L,A]),p.useEffect(()=>{const te=De=>{console.log("๐Ÿ”ด Room disconnected:",De),K(!1),Q(!1),P(null),O("welcome")},Oe=De=>{console.log("๐Ÿ“น Media devices error:",De),Pt({title:"Allow access to your microphone/camera",description:`${De.name}: ${De.message}`})};return B.on(Z.RoomEvent.MediaDevicesError,Oe),B.on(Z.RoomEvent.Disconnected,te),()=>{B.off(Z.RoomEvent.Disconnected,te),B.off(Z.RoomEvent.MediaDevicesError,Oe)}},[B]),p.useEffect(()=>{const te=(De,ge)=>{console.log("๐Ÿ”š Session ended event received:",De.id,ge),K(!1),Q(!1),P(null),O("welcome")},Oe=De=>{console.log("๐Ÿ”ด VoxketClient connection disconnected:",De),K(!1),Q(!1),P(null),O("welcome")};return I.on("session.ended",te),I.on("connection.disconnected",Oe),()=>{I.off("session.ended",te),I.off("connection.disconnected",Oe)}},[I]);const Ie=async()=>{try{console.log("๐ŸŽค Starting voice session...",{agentId:R,participantName:V}),console.log("๐ŸŽค Pre-start state:",{currentMode:E,sessionStarted:ne,loading:se}),K(!0),Q(!0),O("voice"),console.log("๐ŸŽค State after mode change:",{currentMode:"voice",sessionStarted:!0,loading:!0}),be("USER_STARTED_VOICE_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["voice",...m?["video"]:[]]});console.log("โœ… Voice session started successfully:",te.id),P(te),K(!1),v&&v(te.id)}catch(te){console.error("โŒ Failed to start voice session:",te),Pt({title:"Failed to start voice session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},Rn=async()=>{try{K(!0),Q(!0),O("chat"),be("USER_STARTED_CHAT_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["chat"]});P(te),K(!1),v&&v(te.id)}catch(te){console.error("Failed to start chat session:",te),Pt({title:"Failed to start chat session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},Dd=async()=>{try{console.log("๐Ÿ“บ Starting video session...",{agentId:R,participantName:V}),console.log("๐Ÿ“บ Pre-start state:",{currentMode:E,sessionStarted:ne,loading:se}),K(!0),Q(!0),O("video"),console.log("๐Ÿ“บ State after mode change:",{currentMode:"video",sessionStarted:!0,loading:!0}),be("USER_STARTED_VIDEO_SESSION",{agentId:R,participantName:V});const te=await I.startSession(R,{participantName:V||"User",modalities:["video","voice"]});console.log("โœ… Video session started successfully:",te.id),P(te),K(!1),v&&v(te.id)}catch(te){console.error("โŒ Failed to start video session:",te),Pt({title:"Failed to start video session",description:te instanceof Error?te.message:"Unknown error occurred"}),K(!1),Q(!1),O("welcome")}},sn=()=>{O("welcome"),J&&J(e.displayType||"widget"),q&&ne&&(Q(!1),P(null),typeof I.endSession=="function"?(I.endSession(),console.log("โœ… Widget: Session ended via client.endSession()")):(I.disconnect(),console.log("โš ๏ธ Widget: Using fallback client.disconnect()"))),j==="popup"&&!F&&$(!0)},rn=()=>{const te=!F;$(te),D&&D(te),!te&&!(q&&ne)&&(O("welcome"),Q(!1),P(null))},$d=()=>{console.log("๐Ÿ”„ Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("โš ๏ธ No onDisplayTypeChange callback provided")},Fd=()=>{if(console.log("๐Ÿ”„ Expand to fullscreen requested"),e.onDisplayTypeChange)e.onDisplayTypeChange("fullscreen");else{console.warn("โš ๏ธ No onDisplayTypeChange callback provided for expand functionality");const te=document.getElementById("voice-card")||document.querySelector(".voxket-widget-container");te&&te.requestFullscreen?te.requestFullscreen().catch(Oe=>{console.warn("โš ๏ธ Fullscreen API not supported or failed:",Oe),Pt({title:"Expand functionality unavailable",description:"Please implement onDisplayTypeChange callback for expand functionality"})}):Pt({title:"Expand functionality unavailable",description:"Please implement onDisplayTypeChange callback for expand functionality"})}};p.useEffect(()=>{var te,Oe,De;if(_&&I){console.log("๐Ÿ”„ Syncing widget state with existing client session state");const ge=I.getCurrentSession(),Od=I.connected;console.log("๐Ÿ” Existing session state:",{hasSession:!!ge,sessionId:ge==null?void 0:ge.id,isConnected:Od,activeModalities:ge==null?void 0:ge.activeModalities}),ge&&(console.log("โœ… Restoring session state from existing client"),P(ge),Q(!0),K(!1),(te=ge.activeModalities)!=null&&te.includes("chat")?O("chat"):(Oe=ge.activeModalities)!=null&&Oe.includes("voice")?O("voice"):(De=ge.activeModalities)!=null&&De.includes("video")&&O("video"))}},[_,I]),p.useEffect(()=>()=>{console.log("๐Ÿงน Cleaning up widget component"),_?console.log("๐Ÿ”„ Widget cleanup: preserving passed client instance"):(console.log("๐Ÿงน Widget cleanup: disconnecting self-created client"),I.disconnect())},[I,_]);let Es="w-96",As="h-[25rem]",js={};if(f&&(f.startsWith("w-")?Es=f:(js.width=f,Es="")),h&&(h.startsWith("h-")?As=h:(js.height=h,As="")),j==="popup"&&!F)return console.log("๐ŸŸก Showing popup trigger button"),l.jsx(gx,{onClick:rn,text:y,position:z,theme:k});console.log("๐ŸŸข Rendering widget content, displayType:",j,"isPopupOpen:",F,"currentMode:",E,"sessionStarted:",ne,"loading:",se);let Ms=`voxket-widget-root theme-${k}`,In={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};j==="widget"?(Ms+=` flex items-center justify-center min-h-fit ${Es} ${As} ${u}`,In={...In,...js}):(Ms=`${u||""}`,In={});const Fo=l.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:l.jsxs(Ht,{mode:"wait",children:[E==="welcome"&&!se&&l.jsx(px,{agentId:R,participantName:V||"",onAgentIdChange:X,onParticipantNameChange:U,onStartCall:Ie,onStartChat:Rn,onStartVideo:Dd,disabled:ne||se,prompts:i,statusMessage:a,title:c,subTitle:d,theme:k,modalities:H,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),E==="voice"&&l.jsxs(Ne.RoomContext.Provider,{value:B,children:[l.jsx(Ne.RoomAudioRenderer,{}),l.jsx(Ne.StartAudio,{label:"Start Audio"}),l.jsx(fx,{loadingText:g,participantName:V||"User",capabilities:oe,sessionStarted:ne,disabled:!ne,theme:k,client:I,displayType:j,onBack:j==="popup"?rn:sn,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"session-view")]}),E==="chat"&&l.jsx(hx,{client:I,theme:k,displayType:j,onBack:j==="popup"?rn:sn,onEndChat:sn,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),E==="video"&&l.jsxs(Ne.RoomContext.Provider,{value:B,children:[l.jsx(Ne.RoomAudioRenderer,{}),l.jsx(Ne.StartAudio,{label:"Start Audio"}),l.jsx(mx,{client:I,theme:k,displayType:j,onBack:j==="popup"?rn:sn,onEndCall:sn,disabled:!ne,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-view")]})]})});return j==="fullscreen"||j==="popup"?(console.log("๐Ÿ“ฑ Rendering fullscreen/popup mode, displayType:",j),l.jsx(Ga,{theme:k,displayType:j,popupPosition:z,onClose:j==="fullscreen"?$d:rn,children:Fo})):(console.log("๐Ÿ“ฆ Rendering widget mode"),l.jsx("div",{className:Ms,style:In,children:l.jsx(Ga,{theme:k,displayType:j,popupPosition:z,onExpand:Fd,children:Fo})}))}class vd extends p.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return p.createElement(t,{error:this.state.error})}return p.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function yx({logs:e,onClear:t,onExport:n}){const[s,r]=C.useState(!1),[o,i]=C.useState(""),a=e.filter(c=>!o||c.event.toLowerCase().includes(o.toLowerCase()));return s?l.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:l.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[l.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",placeholder:"Filter events...",value:o,onChange:c=>i(c.target.value),className:"px-3 py-1 border rounded text-sm"}),l.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),l.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),l.jsx("button",{onClick:()=>r(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?l.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):l.jsx("div",{className:"space-y-2",children:a.map((c,d)=>l.jsxs("div",{className:"border rounded p-3 text-sm",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"font-semibold text-blue-600",children:c.event}),l.jsx("span",{className:"text-gray-500 text-xs",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.sessionId&&l.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",c.sessionId]}),c.data&&l.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:l.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(c.data,null,2)})})]},d))})})]})}):l.jsxs("button",{onClick:()=>r(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function xx({metrics:e}){return e?l.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[l.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),l.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Session ID:"}),l.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Start Time:"}),l.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Messages:"}),l.jsx("div",{children:e.totalMessages})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Participants:"}),l.jsx("div",{children:e.participantCount})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),l.jsx("div",{children:e.connectionIssues})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-gray-600",children:"Duration:"}),l.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function jt(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:s,endSession:r}=Qe(),o=C.useCallback(async(a,c)=>await s(a,c),[s]),i=C.useCallback(async()=>await r(),[r]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:o,stop:i}}function wd(){const{sessionMetrics:e,currentSession:t}=Qe();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function Sd(){const{setMicrophoneEnabled:e,client:t}=Qe(),[n,s]=C.useState(!1),[r,o]=C.useState(!1),i=C.useCallback(async()=>{if(!r){o(!0);try{const d=!n;await e(d),s(d)}catch(d){console.error("Failed to toggle microphone:",d)}finally{o(!1)}}},[n,r,e]),a=C.useCallback(async()=>{if(!(n||r)){o(!0);try{await e(!0),s(!0)}catch(d){console.error("Failed to enable microphone:",d)}finally{o(!1)}}},[n,r,e]),c=C.useCallback(async()=>{if(!(!n||r)){o(!0);try{await e(!1),s(!1)}catch(d){console.error("Failed to disable microphone:",d)}finally{o(!1)}}},[n,r,e]);return{isEnabled:n,isLoading:r,toggle:i,enable:a,disable:c}}function Cd(){const{setCameraEnabled:e}=Qe(),[t,n]=C.useState(!1),[s,r]=C.useState(!1),o=C.useCallback(async()=>{if(!s){r(!0);try{const c=!t;await e(c),n(c)}catch(c){console.error("Failed to toggle camera:",c)}finally{r(!1)}}},[t,s,e]),i=C.useCallback(async()=>{if(!(t||s)){r(!0);try{await e(!0),n(!0)}catch(c){console.error("Failed to enable camera:",c)}finally{r(!1)}}},[t,s,e]),a=C.useCallback(async()=>{if(!(!t||s)){r(!0);try{await e(!1),n(!1)}catch(c){console.error("Failed to disable camera:",c)}finally{r(!1)}}},[t,s,e]);return{isEnabled:t,isLoading:s,toggle:o,enable:i,disable:a}}function kd(){const{startScreenShare:e,stopScreenShare:t}=Qe(),[n,s]=C.useState(!1),[r,o]=C.useState(!1),i=C.useCallback(async()=>{if(!(n||r)){o(!0);try{await e(),s(!0)}catch(d){console.error("Failed to start screen share:",d)}finally{o(!1)}}},[n,r,e]),a=C.useCallback(async()=>{if(!(!n||r)){o(!0);try{await t(),s(!1)}catch(d){console.error("Failed to stop screen share:",d)}finally{o(!1)}}},[n,r,t]),c=C.useCallback(async()=>{n?await a():await i()},[n,i,a]);return{isSharing:n,isLoading:r,start:i,stop:a,toggle:c}}function bx(){const{client:e}=Qe(),[t,n]=C.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),s=C.useMemo(()=>t.tracks.find(m=>m.isLocal),[t.tracks]),r=C.useMemo(()=>t.tracks.filter(m=>!m.isLocal),[t.tracks]),o=C.useCallback(async()=>{try{s!=null&&s.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(m){throw console.error("Failed to toggle camera:",m),m}},[e,s]),i=C.useCallback(async()=>{try{t.tracks.find(b=>b.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(m){throw console.error("Failed to toggle screen share:",m),m}},[e,t.tracks]),a=C.useCallback(m=>{n(b=>({...b,layout:m}))},[]),c=C.useCallback(m=>{n(b=>({...b,pinnedTrack:m}))},[]),d=C.useCallback(()=>{n(m=>({...m,pinnedTrack:void 0}))},[]),u=C.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(m=>({...m,isRecording:!0}))}catch(m){throw console.error("Failed to start recording:",m),m}},[e]),f=C.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(m=>({...m,isRecording:!1}))}catch(m){throw console.error("Failed to stop recording:",m),m}},[e]),h=C.useCallback(m=>t.tracks.find(b=>b.id===m),[t.tracks]),g=C.useCallback(m=>t.tracks.filter(b=>b.participantId===m),[t.tracks]),x=C.useCallback(m=>m.isEnabled&&t.tracks.includes(m),[t.tracks]);return C.useEffect(()=>{if(!e)return;const m=v=>{n(T=>({...T,tracks:[...T.tracks.filter(w=>w.id!==v.id),v]}))},b=v=>{n(T=>{var w;return{...T,tracks:T.tracks.filter(S=>S.id!==v),pinnedTrack:((w=T.pinnedTrack)==null?void 0:w.id)===v?void 0:T.pinnedTrack}})},k=v=>{n(T=>({...T,tracks:T.tracks.map(w=>w.id===v.id?v:w)}))};return e.on("videoTrackAdded",m),e.on("videoTrackRemoved",b),e.on("videoTrackUpdated",k),()=>{e.off("videoTrackAdded",m),e.off("videoTrackRemoved",b),e.off("videoTrackUpdated",k)}},[e]),{tracks:t.tracks,localTrack:s,remoteTraracks:r,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:o,toggleScreenShare:i,setLayout:a,pinTrack:c,unpinTrack:d,startRecording:u,stopRecording:f,getTrackById:h,getTracksByParticipant:g,isTrackActive:x}}function Ts(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=Qe(),[s,r]=C.useState(!1),o=C.useCallback(async d=>{if(!(!d.trim()||s||!n)){r(!0);try{await t(d.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{r(!1)}}},[t,s,n]),{userMessages:i,agentMessages:a,allMessages:c}=C.useMemo(()=>{const d=e.filter(f=>f.sender.type==="participant"),u=e.filter(f=>f.sender.type==="agent");return{userMessages:d,agentMessages:u,allMessages:e}},[e]);return{messages:c,userMessages:i,agentMessages:a,messageCount:c.length,isSending:s,canSend:!!n&&!s,send:o}}function vx(){const{send:e,isSending:t,canSend:n}=Ts(),[s,r]=C.useState(""),o=C.useCallback(async()=>{if(!(!s.trim()||!n))try{await e(s),r("")}catch(a){throw a}},[s,e,n]),i=C.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())},[o]);return{value:s,setValue:r,send:o,handleKeyPress:i,isSending:t,canSend:n&&s.trim().length>0}}function Ro(){const{isConnected:e,isConnecting:t,connectionError:n,connect:s,disconnect:r}=Qe(),o=C.useCallback(async()=>{if(!(e||t))try{await s()}catch(a){throw console.error("Failed to connect:",a),a}},[s,e,t]),i=C.useCallback(async()=>{if(e)try{await r()}catch(a){throw console.error("Failed to disconnect:",a),a}},[r,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:o,disconnect:i}}function Td(){const{participants:e}=Qe();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const Ed=C.createContext({}),Nn=()=>C.useContext(Ed);function Ad({children:e,...t}){return l.jsx(Ed.Provider,{value:t,children:e})}function Jn({name:e,children:t,fallback:n,className:s}){return l.jsx("div",{className:`voxket-slot voxket-slot--${e} ${s||""}`,children:t||n})}function jd(e,t={}){return Object.assign(e,t)}function Md({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:s=!0,customControls:r,className:o=""}){const i=jt(),a=Sd(),c=Cd(),d=kd(),u=Nn(),f=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,i.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",o].filter(Boolean).join(" ");return!i.isActive&&!s?l.jsx("div",{className:f,children:l.jsx("div",{className:"voxket-controls-inactive",children:l.jsx("p",{children:"Controls available during active session"})})}):l.jsxs("div",{className:f,children:[s&&l.jsx("div",{className:"voxket-session-actions",children:i.isActive?l.jsx("button",{onClick:i.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):l.jsx(wx,{})}),i.isActive&&l.jsxs("div",{className:"voxket-media-controls",children:[e&&l.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[l.jsx("span",{className:"voxket-icon",children:"๐ŸŽค"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&l.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isEnabled?"voxket-button--active":""}`,title:c.isEnabled?"Stop camera":"Start camera",children:[l.jsx("span",{className:"voxket-icon",children:"๐Ÿ“น"}),c.isLoading?"Loading...":c.isEnabled?"Stop Video":"Start Video"]}),n&&l.jsxs("button",{onClick:d.toggle,disabled:d.isLoading,className:`voxket-button voxket-button--media ${d.isSharing?"voxket-button--active":""}`,title:d.isSharing?"Stop screen share":"Start screen share",children:[l.jsx("span",{className:"voxket-icon",children:"๐Ÿ–ฅ๏ธ"}),d.isLoading?"Loading...":d.isSharing?"Stop Share":"Share Screen"]})]}),r&&l.jsx("div",{className:"voxket-custom-controls",children:r})]})}function wx(){jt();const[e,t]=C.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(s){console.error("Failed to start session:",s)}finally{t(!1)}};return l.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function Io({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:s=""}){const r=jt(),o=Ro(),i=Nn(),a=["voxket-session-header",`voxket-session-header--${i.variant||"default"}`,`voxket-session-header--${i.size||"md"}`,s].filter(Boolean).join(" ");return l.jsxs("div",{className:a,children:[e&&l.jsxs("div",{className:"voxket-connection-status",children:[l.jsx("div",{className:`voxket-status-indicator ${o.isConnected?"connected":"disconnected"}`}),l.jsx("span",{className:"voxket-status-text",children:o.isConnecting?"Connecting...":o.isConnected?"Connected":"Disconnected"})]}),t&&r.session&&l.jsxs("div",{className:"voxket-session-info",children:[l.jsxs("div",{className:"voxket-session-id",children:["Session: ",r.session.id.slice(-8)]}),l.jsxs("div",{className:"voxket-session-state",children:["State: ",r.state]})]}),n&&r.session&&l.jsxs("div",{className:"voxket-agent-info",children:[l.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",r.session.agentId]}),l.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",r.session.activeModalities.join(", ")]})]}),o.error&&l.jsxs("div",{className:"voxket-error-message",children:["Error: ",o.error.message]})]})}function Do({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:s=""}){const r=jt(),o=Ts(),i=Nn(),a=["voxket-session-content",`voxket-session-content--${i.variant||"default"}`,`voxket-session-content--${i.size||"md"}`,s].filter(Boolean).join(" ");return r.isActive?l.jsx("div",{className:a,children:n||l.jsxs(l.Fragment,{children:[e&&l.jsxs("div",{className:"voxket-chat-container",children:[l.jsxs("div",{className:"voxket-chat-messages",children:[o.messages.map(c=>l.jsxs("div",{className:`voxket-message voxket-message--${c.sender.type}`,children:[l.jsxs("div",{className:"voxket-message-header",children:[l.jsx("span",{className:"voxket-message-sender",children:c.sender.name}),l.jsx("span",{className:"voxket-message-time",children:c.timestamp.toLocaleTimeString()})]}),l.jsx("div",{className:"voxket-message-content",children:c.content})]},c.id)),o.messages.length===0&&l.jsx("div",{className:"voxket-empty-messages",children:l.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),l.jsx(Sx,{})]}),t&&l.jsx("div",{className:"voxket-transcriptions",children:l.jsx("div",{className:"voxket-transcription-placeholder",children:l.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):l.jsx("div",{className:a,children:l.jsx("div",{className:"voxket-inactive-state",children:l.jsxs("div",{className:"voxket-inactive-message",children:[l.jsx("h3",{children:"Start a conversation"}),l.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function Sx(){const e=Ts(),[t,n]=C.useState(""),s=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(o){console.error("Failed to send message:",o)}},r=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),s())};return l.jsxs("div",{className:"voxket-chat-input",children:[l.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),onKeyPress:r,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),l.jsx("button",{onClick:s,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function $o({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:s,className:r=""}){const o=jt(),i=wd(),a=Td(),c=Nn(),d=["voxket-session-footer",`voxket-session-footer--${c.variant||"default"}`,`voxket-session-footer--${c.size||"md"}`,r].filter(Boolean).join(" ");return o.isActive?l.jsx("div",{className:d,children:s||l.jsxs(l.Fragment,{children:[n&&l.jsxs("div",{className:"voxket-session-status",children:[l.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),l.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&i.metrics&&l.jsxs("div",{className:"voxket-session-metrics",children:[l.jsxs("div",{className:"voxket-metric",children:[l.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),l.jsx("span",{className:"voxket-metric-value",children:Cx(i.duration||0)})]}),l.jsxs("div",{className:"voxket-metric",children:[l.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),l.jsx("span",{className:"voxket-metric-value",children:i.metrics.messageCount})]})]}),t&&l.jsxs("div",{className:"voxket-participants-info",children:[l.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&l.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>l.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):l.jsx("div",{className:d,children:l.jsx("div",{className:"voxket-footer-inactive",children:l.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function Cx(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=Math.floor(n/60);return s>0?`${s}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function kx({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:s,onSessionEnd:r,variant:o="default",size:i="md",theme:a,className:c="",children:d}){var g;const u=jt(),f=Ro();C.useEffect(()=>{n&&e&&f.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,f.isConnected,u.isActive]),C.useEffect(()=>{var x;(x=u.session)!=null&&x.id&&s&&s(u.session.id)},[(g=u.session)==null?void 0:g.id,s]),C.useEffect(()=>()=>{u.isActive&&r&&u.stop().then(r).catch(console.error)},[]);const h=["voxket-session",`voxket-session--${o}`,`voxket-session--${i}`,u.isActive?"voxket-session--active":"voxket-session--inactive",c].filter(Boolean).join(" ");return l.jsx(Ad,{variant:o,size:i,theme:a,className:c,children:l.jsx("div",{className:h,children:d||l.jsxs(l.Fragment,{children:[l.jsx(Jn,{name:"header",fallback:l.jsx(Io,{})}),l.jsx(Jn,{name:"content",fallback:l.jsx(Do,{})}),l.jsx(Jn,{name:"footer",fallback:l.jsx($o,{})})]})})})}const Pd=jd(kx,{Header:Io,Content:Do,Footer:$o,Controls:Md}),Et={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},Ir={...Et,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},Dr={...Et,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},Vd=C.createContext(null),Nd=()=>{const e=C.useContext(Vd);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function Tx({theme:e="default",themes:t={},children:n,cssVariables:s=!0,className:r=""}){const[o,i]=C.useState(()=>{const h={default:Et,dark:Ir,enterprise:Dr,...t};return typeof e=="string"?h[e]||Et:e}),[a,c]=C.useState(()=>({default:Et,dark:Ir,enterprise:Dr,...t})),d=h=>{if(typeof h=="string"){const g=a[h];g&&i(g)}else i(h)},u=h=>{c(g=>({...g,[h.name]:h}))};C.useEffect(()=>{if(s&&typeof document<"u"){const h=document.documentElement;Object.entries(Rd(o)).forEach(([g,x])=>{h.style.setProperty(`--voxket-${g}`,x)})}},[o,s]);const f={theme:o,setTheme:d,themes:a,registerTheme:u};return l.jsx(Vd.Provider,{value:f,children:l.jsx("div",{className:`voxket-theme voxket-theme--${o.name} ${r}`,children:n})})}function Rd(e){const t={},n=(s,r="")=>{for(const[o,i]of Object.entries(s)){const a=r?`${r}-${o}`:o;typeof i=="object"&&i!==null&&!Array.isArray(i)?n(i,a):t[a]=String(i)}};return n(e),t}function Ex(e=Et,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function Ax(e){var n;const{theme:t}=Nd();return((n=t.components)==null?void 0:n[e])||{}}const jx=Vo("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&Mx(e),t.enableVoiceActivation&&Px(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&Vx(e,t)}});function Mx(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function Px(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function Vx(e,t){console.log("Playing audio response:",t.content)}const Nx=Vo("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&Rx(),t.enableFileUpload&&Ix(e),t.enableCustomComponents&&Dx(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?$x(e,t):t.type==="text"&&n.enableRichText&&Fx(e,t)}});function Rx(e){console.log("Rich text support enabled")}function Ix(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function Dx(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",Ox),t.set("form",Lx),t.set("card",_x),t.set("chart",Bx)}function $x(e,t){const{componentType:n,props:s}=t.metadata;console.log("Rendering custom component:",n,s),e.emit("chat.component.render",{type:n,props:s,timestamp:new Date})}function Fx(e,t){console.log("Processing rich text message:",t.content)}function Ox(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function Lx(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function _x(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function Bx(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function Qn({track:e,participantName:t,showControls:n=!0,showName:s=!0,showMuteIndicator:r=!0,isPinned:o=!1,className:i="",onClick:a,onPin:c,onUnpin:d}){const u=C.useRef(null),[f,h]=C.useState(!1);C.useEffect(()=>{if(!u.current||!e.isEnabled)return;const b=u.current;return b.srcObject=null,()=>{b.srcObject&&(b.srcObject=null)}},[e]);const g=()=>{a==null||a(e)},x=b=>{b.stopPropagation(),o?d==null||d(e):c==null||c(e)},m=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",o?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",f?"voxket-video-tile--hovered":"",i].filter(Boolean).join(" ");return l.jsxs("div",{className:m,onClick:g,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[l.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&l.jsxs("div",{className:"voxket-video-placeholder",children:[l.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"๐Ÿ–ฅ๏ธ":"๐Ÿ“น"}),l.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),l.jsxs("div",{className:"voxket-video-overlay",children:[s&&t&&l.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),r&&!e.isEnabled&&l.jsx("div",{className:"voxket-video-mute-indicator",children:"๐Ÿ”‡"}),n&&(f||o)&&l.jsxs("div",{className:"voxket-video-controls",children:[l.jsx("button",{className:`voxket-video-control-btn ${o?"voxket-video-control-btn--active":""}`,onClick:x,title:o?"Unpin video":"Pin video",children:"๐Ÿ“Œ"}),e.isScreenShare&&l.jsx("div",{className:"voxket-video-indicator",children:"๐Ÿ–ฅ๏ธ"}),e.source&&l.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&l.jsx("div",{className:"voxket-video-loading",children:l.jsx("div",{className:"voxket-spinner"})})]})}function zx({tracks:e,layout:t,className:n="",onLayoutChange:s,onTrackClick:r,maxVisibleTracks:o=9,showPagination:i=!0}){const[a,c]=C.useState(0),[d,u]=C.useState(null),f=C.useMemo(()=>{let v=[...e];t.type==="speaker"&&d&&(v=[d,...e.filter(S=>S.id!==d.id)]);const T=a*o,w=T+o;return v.slice(T,w)},[e,t,d,a,o]),h=Math.ceil(e.length/o),g=C.useMemo(()=>{const v=f.length;switch(t.type){case"grid":const T=Math.ceil(Math.sqrt(v)),w=Math.ceil(v/T);return{display:"grid",gridTemplateColumns:`repeat(${T}, 1fr)`,gridTemplateRows:`repeat(${w}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,f.length]),x=v=>{u(v)},m=()=>{u(null)},b=v=>{s==null||s({...t,type:v})},k=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${f.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?l.jsx("div",{className:"voxket-video-grid-empty",children:l.jsxs("div",{className:"voxket-video-grid-empty-content",children:[l.jsx("div",{className:"voxket-video-grid-empty-icon",children:"๐Ÿ“น"}),l.jsx("p",{children:"No video tracks available"})]})}):l.jsxs("div",{className:k,children:[l.jsxs("div",{className:"voxket-video-grid-controls",children:[l.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(v=>l.jsx("button",{className:`voxket-layout-btn ${t.type===v?"voxket-layout-btn--active":""}`,onClick:()=>b(v),title:`Switch to ${v} layout`,children:Hx(v)},v))}),l.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),l.jsx("div",{className:"voxket-video-grid-content",style:g,children:t.type==="speaker"&&d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"voxket-video-speaker-main",children:l.jsx(Qn,{track:d,participantName:`Participant ${d.participantId}`,isPinned:!0,onClick:r,onUnpin:m})}),l.jsx("div",{className:"voxket-video-speaker-sidebar",children:f.filter(v=>v.id!==d.id).map(v=>l.jsx(Qn,{track:v,participantName:`Participant ${v.participantId}`,showControls:!1,onClick:r,onPin:x},v.id))})]}):f.map(v=>l.jsx(Qn,{track:v,participantName:`Participant ${v.participantId}`,isPinned:(d==null?void 0:d.id)===v.id,onClick:r,onPin:x,onUnpin:m},v.id))}),i&&h>1&&l.jsxs("div",{className:"voxket-video-pagination",children:[l.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.max(0,a-1)),disabled:a===0,children:"โ†"}),l.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",h]}),l.jsx("button",{className:"voxket-pagination-btn",onClick:()=>c(Math.min(h-1,a+1)),disabled:a===h-1,children:"โ†’"})]})]})}function Hx(e){switch(e){case"grid":return"โŠž";case"speaker":return"๐ŸŽค";case"sidebar":return"โซธ";case"gallery":return"โŠก";case"picture-in-picture":return"โง‰";default:return"โŠž"}}function Ux({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:s,showLayoutControls:r=!0,showCameraControls:o=!0,showScreenShareControls:i=!0,className:a=""}){const c=["voxket-video-controls",a].filter(Boolean).join(" "),d=u=>{s==null||s({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return l.jsxs("div",{className:c,children:[o&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),l.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[l.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"๐Ÿ“น":"๐Ÿ“ท"}),l.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&l.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," ร— ",e.dimensions.height]})]}),i&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),l.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[l.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"๐Ÿ›‘":"๐Ÿ–ฅ๏ธ"}),l.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),r&&l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),l.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"โŠž",label:"Grid"},{type:"speaker",icon:"๐ŸŽค",label:"Speaker"},{type:"sidebar",icon:"โซธ",label:"Sidebar"},{type:"gallery",icon:"โŠก",label:"Gallery"}].map(({type:u,icon:f,label:h})=>l.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>d(u),title:`Switch to ${h} layout`,children:[l.jsx("span",{className:"voxket-control-icon",children:f}),l.jsx("span",{className:"voxket-control-label",children:h})]},u))})]}),l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),l.jsxs("div",{className:"voxket-video-settings",children:[l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Quality"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"high",children:"High (720p)"}),l.jsx("option",{value:"medium",children:"Medium (480p)"}),l.jsx("option",{value:"low",children:"Low (240p)"})]})]}),l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"30",children:"30 fps"}),l.jsx("option",{value:"15",children:"15 fps"}),l.jsx("option",{value:"10",children:"10 fps"})]})]}),l.jsxs("div",{className:"voxket-setting-group",children:[l.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),l.jsxs("select",{className:"voxket-setting-select",children:[l.jsx("option",{value:"unlimited",children:"Unlimited"}),l.jsx("option",{value:"1000",children:"1 Mbps"}),l.jsx("option",{value:"500",children:"500 Kbps"}),l.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),l.jsxs("div",{className:"voxket-video-controls-section",children:[l.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),l.jsxs("div",{className:"voxket-video-stats",children:[l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),l.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}ร—${e.dimensions.height}`:"N/A"})]}),l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Source:"}),l.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),l.jsxs("div",{className:"voxket-stat-item",children:[l.jsx("span",{className:"voxket-stat-label",children:"Status:"}),l.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const Id=({handler:e,loadData:t,data:n,client:s,addLocalMessage:r})=>{const[o,i]=p.useState(null),[a,c]=p.useState(!0),[d,u]=p.useState(!1),[f]=p.useState(Date.now());p.useEffect(()=>{(async()=>{try{if(c(!0),console.log("๐Ÿ“‹ AssignmentView: Loading assignment data..."),console.log("๐Ÿ“‹ AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const b={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};i(b),console.log("๐Ÿ“‹ AssignmentView: Assignment loaded from RPC data:",b)}}catch(b){console.error("๐Ÿ“‹ AssignmentView: Error loading assignment:",b),i({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{c(!1)}})()},[n,t]);const h=({message:m,assignment:b})=>{const k=m.toLowerCase().includes("declined"),v=k?"bg-red-50 border-red-200":"bg-green-50 border-green-200",T=k?"text-red-700":"text-green-700",w=k?"โŒ":"๐ŸŽ‰";return l.jsxs("div",{className:`max-w-sm mx-auto ${v} border rounded-lg shadow p-3 flex flex-col items-center`,children:[l.jsx("div",{className:"text-2xl mb-2",children:w}),l.jsx("div",{className:`${T} font-semibold text-sm mb-1`,children:m}),l.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:b.title}),l.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},g=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"accepted"};console.log("๐Ÿ“‹ AssignmentView: Assignment accepted:",m),e.didSuccess(m,l.jsx(h,{message:"Assignment accepted!",assignment:o}))}catch(m){console.error("๐Ÿ“‹ AssignmentView: Error accepting assignment:",m),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},x=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"declined"};console.log("๐Ÿ“‹ AssignmentView: Assignment declined:",m),e.didSuccess(m,l.jsx(h,{message:"Assignment declined",assignment:o}))}catch(m){console.error("๐Ÿ“‹ AssignmentView: Error declining assignment:",m),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?l.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:l.jsxs("div",{className:"flex items-center justify-center py-4",children:[l.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),l.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):o?l.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[l.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:l.jsx("div",{className:"flex items-center justify-between",children:l.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:o.title})})}),l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:l.jsx("p",{className:"text-xs text-gray-700 leading-snug",children:o.description})}),l.jsx("div",{className:"mb-3",children:l.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[l.jsx("span",{className:"text-xs mr-1",children:"๐Ÿ“…"}),l.jsxs("span",{children:["Est: ",o.estimated_time_of_completion]})]})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:g,disabled:d,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?l.jsxs("span",{className:"flex items-center justify-center",children:[l.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),l.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),l.jsx("button",{onClick:x,disabled:d,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):l.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:l.jsxs("div",{className:"text-center py-4",children:[l.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"โš ๏ธ Assignment Error"}),l.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function Zx(){const[e,t]=p.useState(null),[n,s]=p.useState([]);p.useEffect(()=>{const a=new Vn({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",c=>{console.log("RPC Method Called:",c)}),a.on("rpc.interaction.completed",c=>{console.log("RPC Interaction Completed:",c)}),()=>{a.disconnect()}},[]);const r=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",Id,"embedded");const a=e.getRegisteredRpcMethods();s(a),console.log("โœ… Assignment RPC registered successfully")}catch(a){console.error("โŒ Failed to register assignment RPC:",a)}},o=async()=>{if(!e)return;const a=({handler:c,timeout:d})=>{const[u,f]=p.useState(""),h=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],g=m=>{f(m)},x=()=>{const m=h.find(b=>b.id===u);c==null||c.didSuccess({selectedProduct:u,productName:m==null?void 0:m.name,price:m==null?void 0:m.price,timestamp:new Date().toISOString()})};return l.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[l.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),l.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),l.jsx("div",{className:"space-y-3 mb-6",children:h.map(m=>l.jsx("div",{onClick:()=>g(m.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===m.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium",children:m.name}),l.jsx("p",{className:"text-gray-600 text-sm",children:m.price})]}),l.jsx("div",{className:`w-4 h-4 rounded-full ${u===m.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},m.id))}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),l.jsx("button",{onClick:x,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),d&&l.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",d," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const c=e.getRegisteredRpcMethods();s(c),console.log("โœ… Product Recommendation RPC registered successfully")}catch(c){console.error("โŒ Failed to register product recommendation RPC:",c)}},i=async()=>{if(!e)return;const a=({handler:c})=>{const[d,u]=p.useState(0),[f,h]=p.useState(""),g=()=>{c==null||c.didSuccess({rating:d,comment:f,timestamp:new Date().toISOString()})};return l.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),l.jsxs("div",{className:"mb-4",children:[l.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),l.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(x=>l.jsx("button",{onClick:()=>u(x),className:`text-2xl ${x<=d?"text-yellow-400":"text-gray-300"}`,children:"โญ"},x))})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),l.jsx("textarea",{value:f,onChange:x=>h(x.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),l.jsxs("div",{className:"flex justify-end space-x-2",children:[l.jsx("button",{onClick:()=>c==null?void 0:c.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),l.jsx("button",{onClick:g,disabled:d===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const c=e.getRegisteredRpcMethods();s(c),console.log("โœ… Feedback RPC registered successfully")}catch(c){console.error("โŒ Failed to register feedback RPC:",c)}};return l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),l.jsxs("div",{className:"space-y-4 mb-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),l.jsxs("div",{className:"space-x-2",children:[l.jsx("button",{onClick:r,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),l.jsx("button",{onClick:o,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),l.jsx("button",{onClick:i,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?l.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>l.jsx("li",{className:"text-gray-700",children:l.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):l.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),l.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[l.jsxs("li",{children:["Register RPC methods with React components using ",l.jsx("code",{children:"client.registerFrontendRPC()"})]}),l.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),l.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),l.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),l.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),l.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[l.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),l.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),l.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
253
253
  const response = await participant.performRpc({
254
254
  method: 'give_assignment',
255
255
  data: JSON.stringify({