shopify-chatbot-widget 0.7.1 → 0.7.3
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.
|
@@ -641,7 +641,7 @@ html body {
|
|
|
641
641
|
<div class="cursor" part="cursor"></div>
|
|
642
642
|
</div>
|
|
643
643
|
</div>
|
|
644
|
-
`,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let V=0;V<=m;V++){const N=Math.round(V*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const L=Math.abs(c[V]||0),B=Math.abs(f[V]||0);L>_&&(_=L),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(Ym.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const V=a.barWidth||.5,N=V+(a.barGap||V/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(V=>{const N=Math.floor(D/p*V.length),L=Math.floor((D+_)/p*V.length);return V.slice(N,L)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>Ym.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return ri(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return ri(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}Ym.MAX_CANVAS_WIDTH=8e3,Ym.MAX_NODES=10;class WZ extends b0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class CO extends b0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return ri(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return ri(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return ri(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const ZZ={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Wm extends YZ{static create(t){return new Wm(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new CO:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},ZZ,t),this.timer=new WZ;const r=a?void 0:this.getMediaElement();this.renderer=new Ym(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=tx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=tx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return ri(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield XZ.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof CO&&(m.duration=f)}if(r)this.decodedData=tx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield tx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return ri(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof CO?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return ri(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return ri(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}Wm.BasePlugin=class extends b0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},Wm.dom=GZ;const KZ=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=RB(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),V=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},L=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",te=new MediaRecorder(U,{mimeType:H});M.current=te,D.current=[],te.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},te.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},te.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=Wm.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return ae.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[ae.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?ae.jsxs("div",{style:{position:"relative"},children:[ae.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),ae.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):ae.jsx(b6,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:V,style:{display:"none",padding:"0"}}),ae.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:L,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(C6,{style:{fontSize:"20px"}}):ae.jsx(p6,{style:{fontSize:"20px"}})})}),ae.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?ae.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[ae.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?ae.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:ae.jsx("span",{children:"Recording"})}):ae.jsx(Yu,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&a()},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(S6,{style:{fontSize:"20px"}})})]})};function QZ({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return ae.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:ae.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>ae.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function JZ(){return ae.jsxs("div",{className:"jawebcss-powered-container",children:[ae.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),ae.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const eK=()=>ae.jsxs("div",{className:"typing-animation",children:[ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."})]}),tK=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>!y||y===0?null:ae.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:ae.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([E,T])=>{const O=t[E]||(T.length>0?T[0].variant_id:""),M=T.find(L=>L.variant_id===O)||T[0];if(!M)return null;const A=r[M.variant_id]||0,D=Array.from(new Set(T.map(L=>L.option?.trim()??"").filter(L=>L&&L.toLowerCase()!=="none"))),_=L=>{const B=T.find(z=>z.option===L);B&&a(z=>({...z,[E]:B.variant_id}))},j=async()=>{o(L=>({...L,[M.variant_id]:(L[M.variant_id]||0)+1})),await c(M.variant_id,M.name,1)},V=async()=>{A!==0&&(o(L=>({...L,[M.variant_id]:Math.max(0,(L[M.variant_id]||0)-1)})),await f(M.variant_id,1))},N=M.option??D[0]??"";return ae.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[ae.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(M.link,"_blank"),children:[ae.jsx("img",{src:M.image,alt:M.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:L=>L.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:M.name,children:g(M.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:M.price})}),D.length>1&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${E}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${E}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:L=>_(L.target.value),children:D.map(L=>ae.jsx("option",{value:L,children:L},L))})]}),!S&&ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:V,"aria-label":"Decrease quantity",disabled:A===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:A}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:j,"aria-label":"Increase quantity",children:"+"})]})]})]},E)})})});var nx={},P6;function nK(){if(P6)return nx;P6=1,Object.defineProperty(nx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,te,Y){U.addListener?U.addListener(te):U.addEventListener(H,te,Y),z.push([U,H,te,Y])},input:function(U,H,te,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],F=W.detail&&W.detail.x?W.detail:null;return Z({id:F?F.identifier?F.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:F?F.identifier?F.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:F&&F.x?F.x:G[0]?G[0].screenX:F?F.x:W.pageX,y:F&&F.y?F.y:G[0]?G[0].screenY:F?F.y:W.pageY})}}(te),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,te){var Y=z&&z[U];return Y==null?H:te&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var te in z)if(!O(z[te],U[te]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,te=arguments.length;H<te;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var te,Y=0,Z=U.length;Y<Z;Y++)!te&&Y in U||(te||(te=Array.prototype.slice.call(U,0,Y)),te[Y]=U[Y]);return z.concat(te||Array.prototype.slice.call(U))}function D(z){var U,H,te,Y,Z,W;function ie(k){W||(W=k),G(!0);var q=k-W;q>te&&(q=te);var J=Y[H];if(J[3]<q)return H++,ie(k);var ne=J[2],oe=J[4],le=J[0],ue=J[1]*(0,J[5])(oe===0?1:(q-ne)/oe);if(ue&&z.track.to(le+ue),q<te)return Q();W=null,G(!1),F(null),z.emit("animationEnded")}function G(k){U.active=k}function F(k){U.targetIdx=k}function Q(){var k;k=ie,Z=window.requestAnimationFrame(k)}function se(){var k;k=Z,window.cancelAnimationFrame(k),G(!1),F(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,J=z.track.details.position;H=0,te=0,Y=k.map(function(ne){var oe,le=Number(J),ue=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ee=ne.easing,ze=ne.distance*Ee(ue/ne.duration)||0;J+=ze;var De=te;return te+=ue,q+=ze,[le,ne.distance,De,te,ne.duration,Ee]}),F(z.track.distToIdx(q)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne=1/0,oe=[],le=null,ue=0;function Ee(Re){ye(ue+Re)}function ze(Re){var Ae=De(ue+Re).abs;return he(Ae)?Ae:null}function De(Re){var Ae=Math.floor(Math.abs(T(Re/H))),we=T((Re%H+H)%H);we===H&&(we=0);var Te=y(Re),Ne=ie.indexOf(A([],ie).reduce(function(Le,it){return Math.abs(it-we)<Math.abs(Le-we)?it:Le})),ke=Ne;return Te<0&&Ae++,Ne===W&&(ke=0,Ae+=Te>0?1:-1),{abs:ke+Ae*W*Te,origin:Ne,rel:ke}}function Fe(Re,Ae,we){var Te;if(Ae||!Ue())return ve(Re,we);if(!he(Re))return null;var Ne=De(we??ue),ke=Ne.abs,Le=Re-Ne.rel,it=ke+Le;Te=ve(it);var ut=ve(it-W*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(Te)||Te===null)&&(Te=ut),T(Te)}function ve(Re,Ae){if(Ae==null&&(Ae=T(ue)),!he(Re)||Re===null)return null;Re=Math.round(Re);var we=De(Ae),Te=we.abs,Ne=we.rel,ke=we.origin,Le=me(Re),it=(Ae%H+H)%H,ut=ie[ke],vt=Math.floor((Re-(Te-Ne))/W)*H;return T(ut-it-ut+ie[Le]+vt+(ke===W?H:0))}function he(Re){return je(Re)===Re}function je(Re){return p(Re,F,Q)}function Ue(){return Y.loop}function me(Re){return(Re%W+W)%W}function ye(Re){var Ae;Ae=Re-ue,oe.push({distance:Ae,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Re);var we=Se().abs;if(we!==le){var Te=le!==null;le=we,Te&&z.emit("slideChanged")}}function Se(Re){var Ae=Re?null:function(){if(W){var we=Ue(),Te=we?(ue%H+H)%H:ue,Ne=(we?ue%H:ue)-Z[0][2],ke=0-(Ne<0&&we?H-Math.abs(Ne):Ne),Le=0,it=De(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(jt,Vt){var _t=ke+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&we?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;we&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&><se&&(_t+=H),k!==null&>>k&&(_t-=H));var at=_t+jt[0]+jt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(jt[0]+_t)/jt[0]):(1-_t)/jt[0],0);return Le+=jt[0]+jt[1],{abs:gt,distance:Y.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=je(ut),vt=me(ut),{abs:je(ut),length:te,max:J,maxIdx:Q,min:q,minIdx:F,position:ue,progress:we?Te/H:ue/te,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Ae,z.emit("detailsChanged"),Ae}return U={absToRel:me,add:Ee,details:null,distToIdx:ze,idxToDist:Fe,init:function(Re){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(Ne){return[E(Ne,"size",1),E(Ne,"spacing",0),E(Ne,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(Ne,ke){return Ne+ke[0]+ke[1]},0));var we,Te=W-1;te=T(H+Z[0][2]-Z[Te][0]-Z[Te][2]-Z[Te][1]),ie=Z.reduce(function(Ne,ke){if(!Ne)return[0];var Le=Z[Ne.length-1],it=Ne[Ne.length-1]+(Le[0]+Le[2])+Le[1];return it-=ke[2],Ne[Ne.length-1]>it&&(it=Ne[Ne.length-1]),it=T(it),Ne.push(it),(!we||we<it)&&(G=Ne.length-1),we=it,Ne},null),te===0&&(G=0),ie.push(T(H))}}(),!W)return Se(!0);var Ae;(function(){var we=z.options.range,Te=z.options.loop;se=F=Te?E(Te,"min",-1/0):0,k=Q=Te?E(Te,"max",ne):G;var Ne=E(we,"min",null),ke=E(we,"max",null);Ne!==null&&(F=Ne),ke!==null&&(Q=ke),q=F===-1/0?F:z.track.idxToDist(F||0,!0,0),J=Q===ne?Q:Fe(Q,!0,0),ke===null&&(k=Q),E(we,"align",!1)&&Q!==ne&&Z[me(Q)][2]===0&&(J-=1-Z[me(Q)][0],Q=ze(J-ue)),q=T(q),J=T(J)})(),Ae=Re,Number(Ae)===Ae?Ee(ve(je(Re))):Se()},to:ye,velocity:function(){var Re=r(),Ae=oe.reduce(function(we,Te){var Ne=Te.distance,ke=Te.timestamp;return Re-ke>200||(y(Ne)!==y(we.distance)&&we.distance&&(we={distance:0,lastTimestamp:0,time:0}),we.time&&(we.distance+=Ne),we.lastTimestamp&&(we.time+=ke-we.lastTimestamp),we.lastTimestamp=ke),we},{distance:0,lastTimestamp:0,time:0});return Ae.distance/Ae.time||0}}}function j(z){var U,H,te,Y,Z,W,ie,G;function F(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function k(){return te?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=k();Y=y(Ee);var ze=z.track.details,De=[];if(Ee||!le){var Fe=J(Ee),ve=Fe.dist,he=Fe.dur;if(he=F(he),ve*=Y,le){var je=ue.idxToDist(ue.distToIdx(ve),!0);je&&(ve=je)}De.push({distance:ve,duration:he,easing:se});var Ue=ze.position,me=Ue+ve;if(me<Z||me>W){var ye=me<Z?Z-Ue:W-Ue,Se=0,Re=Ee;if(y(ye)===Y){var Ae=Math.min(Math.abs(ye)/Math.abs(ve),1),we=function(ke){return 1-Math.pow(1-ke,1/3)}(Ae)*he;De[0].earlyExit=we,Re=Ee*(1-Ae)}else De[0].earlyExit=0,Se+=ye;var Te=J(Re,100),Ne=Te.dist*Y;z.options.rubberband&&(De.push({distance:Ne,duration:F(Te.dur),easing:se}),De.push({distance:-Ne+Se,duration:500,easing:se}))}z.animator.start(De)}else z.moveToIdx(Q(ze.abs),!0,{duration:500,easing:function(ke){return 1+--ke*ke*ke*ke*ke}})}function J(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ne(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){te=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){te=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,ze=Ee.position,De=y(k());(ze>W||ze<Z)&&(De=0);var Fe=U+De;Ee.slides[ue.absToRel(Fe)].portion===0&&(Fe-=De),U!==H&&(Fe=H),y(ue.idxToDist(Fe,!0))!==De&&(Fe+=De),Fe=Q(Fe);var ve=ue.idxToDist(Fe,!0);z.animator.start([{distance:ve,duration:500,easing:function(he){return 1+--he*he*he*he*he}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){H=z.track.details.abs})}function V(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne,oe,le,ue,Ee=g();function ze(Se){if(W&&G===Se.id){var Re=he(Se);if(F){if(!ve(Se))return Fe(Se);Q=Re,F=!1,z.emit("dragChecked")}if(oe)return Q=Re;f(Se);var Ae=function(Te){if(le===-1/0&&ue===1/0)return Te;var Ne=z.track.details,ke=Ne.length,Le=Ne.position,it=p(Te,le-Le,ue-Le);if(ke===0)return 0;if(!z.options.rubberband)return it;if(Le<=ue&&Le>=le||Le<le&&H>0||Le>ue&&H<0)return Te;var ut=(Le<le?Le-le:Le-ue)/ke,vt=Y*ke,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*Te}(ie(Q-Re)/Y*te);H=y(Ae);var we=z.track.details.position;(we>le&&we<ue||we===le&&H>0||we===ue&&H<0)&&m(Se),se+=Ae,!k&&Math.abs(se*Y)>5&&(k=!0),z.track.add(Ae),Q=Re,z.emit("dragged")}}function De(Se){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,k=!1,F=!0,G=Se.id,ve(Se),Q=he(Se),z.emit("dragStarted"))}function Fe(Se){W&&G===Se.idChanged&&(W=!1,z.emit("dragEnded"))}function ve(Se){var Re=je(),Ae=Re?Se.y:Se.x,we=Re?Se.x:Se.y,Te=q!==void 0&&J!==void 0&&Math.abs(J-we)<=Math.abs(q-Ae);return q=Ae,J=we,Te}function he(Se){return je()?Se.y:Se.x}function je(){return z.options.vertical}function Ue(){Y=z.size,Z=je()?window.innerHeight:window.innerWidth;var Se=z.track.details;Se&&(le=Se.min,ue=Se.max)}function me(Se){k&&(m(Se),f(Se))}function ye(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var Se;Se=z.options.dragSpeed||1,ie=typeof Se=="function"?Se:function(Ae){return Ae*Se},te=z.options.rtl?-1:1,Ue(),U=z.container,function(){var Ae="data-keen-slider-clickable";c("[".concat(Ae,"]:not([").concat(Ae,"=false])"),U).map(function(we){Ee.add(we,"dragstart",m),Ee.add(we,"mousedown",m),Ee.add(we,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Ae){f(Ae)}),Ee.add(U,"click",me,{capture:!0}),Ee.input(U,"ksDragStart",De),Ee.input(U,"ksDrag",ze),Ee.input(U,"ksDragEnd",Fe),Ee.input(U,"mousedown",De),Ee.input(U,"mousemove",ze),Ee.input(U,"mouseleave",Fe),Ee.input(U,"mouseup",Fe),Ee.input(U,"touchstart",De,{passive:!0}),Ee.input(U,"touchmove",ze,{passive:!1}),Ee.input(U,"touchend",Fe),Ee.input(U,"touchcancel",Fe),Ee.add(window,"wheel",function(Ae){W&&f(Ae)});var Re="data-keen-slider-scrollable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),z.container).map(function(Ae){return function(we){var Te;Ee.input(we,"touchstart",function(Ne){Te=he(Ne),oe=!0,ne=!0},{passive:!0}),Ee.input(we,"touchmove",function(Ne){var ke=je(),Le=ke?we.scrollHeight-we.clientHeight:we.scrollWidth-we.clientWidth,it=Te-he(Ne),ut=ke?we.scrollTop:we.scrollLeft,vt=ke&&we.style.overflowY==="scroll"||!ke&&we.style.overflowX==="scroll";if(Te=he(Ne),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ne),oe=!1}),Ee.input(we,"touchend",function(){oe=!1})}(Ae)})}}z.on("updated",Ue),z.on("optionsChanged",ye),z.on("created",ye),z.on("destroyed",Ee.purge)}function N(z){var U,H,te=null;function Y(q,J,ne){z.animator.active?W(q,J,ne):requestAnimationFrame(function(){return W(q,J,ne)})}function Z(){Y(!1,!1,H)}function W(q,J,ne){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(ze,De){if(q)!te&&J&&G(ze,null,ne),F(ze,null,ne);else{if(!Ee[De])return;var Fe=Ee[De].size*le;!te&&J&&G(ze,Fe,ne),F(ze,Ee[De].distance*le-oe,ne),oe+=Fe}})}}function ie(q){return z.options.renderMode==="performance"?Math.round(q):q}function G(q,J,ne){var oe=ne?"height":"width";J!==null&&(J=ie(J)+"px"),q.style["min-"+oe]=J,q.style["max-"+oe]=J}function F(q,J,ne){if(J!==null){J=ie(J);var oe=ne?J:0;J="translate3d(".concat(ne?0:J,"px, ").concat(oe,"px, 0)")}q.style.transform=J,q.style["-webkit-transform"]=J}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function k(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(te=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function L(z,U){return function(H){var te,Y,Z,W,ie,G=g();function F(ve){var he;o(H.container,"reverse",(he=H.container,window.getComputedStyle(he,null).getPropertyValue("direction")!=="rtl"||ve?null:"")),o(H.container,"v",H.options.vertical&&!ve?"":null),o(H.container,"disabled",H.options.disabled&&!ve?"":null)}function Q(){se()&&oe()}function se(){var ve=null;if(W.forEach(function(je){je.matches&&(ve=je.__media)}),ve===te)return!1;te||H.emit("beforeOptionsChanged"),te=ve;var he=ve?Z.breakpoints[ve]:Z;return H.options=M(M({},Z),he),F(),De(),Fe(),ue(),!0}function k(ve){var he=S(ve);return(H.options.vertical?he.height:he.width)/H.size||1}function q(){return H.options.trackConfig.length}function J(ve){for(var he in te=!1,Z=M(M({},U),ve),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var je=window.matchMedia(he);je.__media=he,W.push(je),G.add(je,"change",Q)}G.add(window,"orientationchange",ze),G.add(window,"resize",Ee),se()}function ne(ve){H.animator.stop();var he=H.track.details;H.track.init(ve??(he?he.abs:0))}function oe(ve){ne(ve),H.emit("optionsChanged")}function le(ve,he){if(ve)return J(ve),void oe(he);De(),Fe();var je=q();ue(),q()!==je?oe(he):ne(he),H.emit("updated")}function ue(){var ve=H.options.slides;if(typeof ve=="function")return H.options.trackConfig=ve(H.size,H.slides);for(var he=H.slides,je=he.length,Ue=typeof ve=="number"?ve:E(ve,"number",je,!0),me=[],ye=E(ve,"perView",1,!0),Se=E(ve,"spacing",0,!0)/H.size||0,Re=ye==="auto"?Se:Se/ye,Ae=E(ve,"origin","auto"),we=0,Te=0;Te<Ue;Te++){var Ne=ye==="auto"?k(he[Te]):1/ye-Se+Re,ke=Ae==="center"?.5-Ne/2:Ae==="auto"?0:Ae;me.push({origin:ke,size:Ne,spacing:Se}),we+=Ne}if(we+=Se*(Ue-1),Ae==="auto"&&!H.options.loop&&ye!==1){var Le=0;me.map(function(it){var ut=we-Le;return Le+=it.size+Se,ut>=1||(it.origin=1-ut-(we>1?0:1-we)),it})}H.options.trackConfig=me}function Ee(){De();var ve=H.size;H.options.disabled||ve===Y||(Y=ve,le())}function ze(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function De(){var ve=S(H.container);H.size=(H.options.vertical?ve.height:ve.width)||1}function Fe(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),F(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,J(H.options)}}var B=function(z,U,H){try{return function(te,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(F){F(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,F){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(F||se,"duration",500),easing:E(F||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(ie,G,F){F===void 0&&(F=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?F&&delete W[ie][Q]:F||W[ie].push(G)},options:te},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([L(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,V,j],H||[],!0))}catch(te){console.error(te)}};return nx.useKeenSlider=function(z,U){var H=e.useRef(null),te=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),te.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},nx}var EO=nK();const aK=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const V=/(https?:\/\/[^\s]+)/g;return j.split(V).map((N,L)=>V.test(N)?ae.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},L):ae.jsx("span",{children:N},L))},y=j=>{const V=j.trim();if(!V.includes("Name:")||!V.includes("VariantId"))return null;const N=V.match(/Name\s*[:\-]\s*(.+)/i),L=V.match(/Price\s*[:\-]\s*(.+)/i),B=V.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=V.match(/VariantId\s*[:\-]\s*(.+)/i),U=V.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=V.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!N||!L||!B||!z||!U?null:{name:N[1].trim(),price:L[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(L=>L.trim()).filter(Boolean),V=[];let N=null;return j.forEach(L=>{if(L.startsWith("img - ")){const B=L.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...V].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(L.includes("Name:")&&L.includes("VariantId")){const B=y(L);B&&(V.push({type:"product",data:B}),N=B)}else V.push({type:"text",data:L}),N=null}),V},[e]),E=x.useMemo(()=>{const j={};return S.forEach(V=>{if(V.type==="product"){const N=V.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,V=22)=>j.length>V?j.slice(0,V)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,V)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},V)),Object.keys(E).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(E).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(wi,{shape:"circle",icon:ae.jsx(Gm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),ae.jsx(wi,{shape:"circle",icon:ae.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),ae.jsx("div",{ref:D,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},U6=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return ae.jsx("div",{children:ae.jsx("div",{children:t&&ae.jsx("div",{className:"mb-2 bg-transparent text-white ",children:ae.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},rK=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?ae.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):ae.jsx("span",{children:f},m))};return ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:ae.jsx("p",{children:r(a)})})})},iK=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=Wm.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return ae.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[ae.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&ae.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[ae.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&ae.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},oK=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{className:"flex justify-center mb-2",children:ae.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},lK=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?ae.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):ae.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return ae.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",ae.jsx("strong",{children:o})," has been added to your cart."]})}return ae.jsx("p",{style:{color:"white"},children:t(e)})},wO=x.createContext({});function TO(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const OO=typeof window<"u",I6=OO?x.useLayoutEffect:x.useEffect,ax=x.createContext(null);function RO(e,t){e.indexOf(t)===-1&&e.push(t)}function AO(e,t){const a=e.indexOf(t);a>-1&&e.splice(a,1)}const Zu=(e,t,a)=>a>t?t:a<e?e:a;function MO(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var sK={};let Zm=()=>{},Ku=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Ku=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Qu={},k6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function F6(e){return typeof e=="object"&&e!==null}const q6=e=>/^0[^.\s]+$/u.test(e);function _O(e){let t;return()=>(t===void 0&&(t=e()),t)}const Sl=e=>e,uK=(e,t)=>a=>t(e(a)),S0=(...e)=>e.reduce(uK),x0=(e,t,a)=>{const r=t-e;return r===0?1:(a-e)/r};class DO{constructor(){this.subscriptions=[]}add(t){return RO(this.subscriptions,t),()=>AO(this.subscriptions,t)}notify(t,a,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let c=0;c<o;c++){const f=this.subscriptions[c];f&&f(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const is=e=>e*1e3,Js=e=>e/1e3;function G6(e,t){return t?e*(1e3/t):0}const X6=new Set;function NO(e,t,a){e||X6.has(t)||(console.warn(MO(t,a)),X6.add(t))}const Y6=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,cK=1e-7,fK=12;function dK(e,t,a,r,o){let c,f,m=0;do f=t+(a-t)/2,c=Y6(f,r,o)-e,c>0?a=f:t=f;while(Math.abs(c)>cK&&++m<fK);return f}function C0(e,t,a,r){if(e===t&&a===r)return Sl;const o=c=>dK(c,0,1,e,a);return c=>c===0||c===1?c:Y6(o(c),t,r)}const W6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Z6=e=>t=>1-e(1-t),K6=C0(.33,1.53,.69,.99),$O=Z6(K6),Q6=W6($O),J6=e=>(e*=2)<1?.5*$O(e):.5*(2-Math.pow(2,-10*(e-1))),zO=e=>1-Math.sin(Math.acos(e)),ez=Z6(zO),tz=W6(zO),hK=C0(.42,0,1,1),mK=C0(0,0,.58,1),nz=C0(.42,0,.58,1),pK=e=>Array.isArray(e)&&typeof e[0]!="number",az=e=>Array.isArray(e)&&typeof e[0]=="number",rz={linear:Sl,easeIn:hK,easeInOut:nz,easeOut:mK,circIn:zO,circInOut:tz,circOut:ez,backIn:$O,backInOut:Q6,backOut:K6,anticipate:J6},gK=e=>typeof e=="string",iz=e=>{if(az(e)){Ku(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,a,r,o]=e;return C0(t,a,r,o)}else if(gK(e))return Ku(rz[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),rz[e];return e},rx=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function vK(e,t){let a=new Set,r=new Set,o=!1,c=!1;const f=new WeakSet;let m={delta:0,timestamp:0,isProcessing:!1};function g(y){f.has(y)&&(p.schedule(y),e()),y(m)}const p={schedule:(y,S=!1,E=!1)=>{const O=E&&o?a:r;return S&&f.add(y),O.has(y)||O.add(y),y},cancel:y=>{r.delete(y),f.delete(y)},process:y=>{if(m=y,o){c=!0;return}o=!0,[a,r]=[r,a],a.forEach(g),a.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const yK=40;function oz(e,t){let a=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>a=!0,f=rx.reduce((j,V)=>(j[V]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Qu.useManualTiming?o.timestamp:performance.now();a=!1,Qu.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(j-o.timestamp,yK),1)),o.timestamp=j,o.isProcessing=!0,m.process(o),g.process(o),p.process(o),y.process(o),S.process(o),E.process(o),T.process(o),O.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(M))},A=()=>{a=!0,r=!0,o.isProcessing||e(M)};return{schedule:rx.reduce((j,V)=>{const N=f[V];return j[V]=(L,B=!1,z=!1)=>(a||A(),N.schedule(L,B,z)),j},{}),cancel:j=>{for(let V=0;V<rx.length;V++)f[rx[V]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:ii,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(ii.isProcessing||Qu.useManualTiming?ii.timestamp:performance.now()),ix),set:e=>{ix=e,queueMicrotask(bK)}},lz=e=>t=>typeof t=="string"&&t.startsWith(e),LO=lz("--"),SK=lz("var(--"),VO=e=>SK(e)?xK.test(e.split("/*")[0].trim()):!1,xK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Km={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},E0={...Km,transform:e=>Zu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,BO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CK(e){return e==null}const EK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,HO=(e,t)=>a=>!!(typeof a=="string"&&EK.test(a)&&a.startsWith(e)||t&&!CK(a)&&Object.prototype.hasOwnProperty.call(a,t)),sz=(e,t,a)=>r=>{if(typeof r!="string")return r;const[o,c,f,m]=r.match(BO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Zu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Bd={test:HO("rgb","red"),parse:sz("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+PO.transform(e)+", "+PO.transform(t)+", "+PO.transform(a)+", "+w0(E0.transform(r))+")"};function TK(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const UO={test:HO("#"),parse:TK,transform:Bd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),eu=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...eu,parse:e=>eu.parse(e)/100,transform:e=>eu.transform(e*100)},Qm={test:HO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+eu.transform(w0(t))+", "+eu.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Bd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Bd.test(e)?Bd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Bd.transform(e):Qm.transform(e),getAnimatableNone:e=>{const t=xr.parse(e);return t.alpha=0,xr.transform(t)}},AK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function MK(e){return isNaN(e)&&typeof e=="string"&&(e.match(BO)?.length||0)+(e.match(AK)?.length||0)>0}const cz="number",fz="color",_K="var",DK="var(",dz="${}",NK=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function O0(e){const t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[];let c=0;const m=t.replace(NK,g=>(xr.test(g)?(r.color.push(c),o.push(fz),a.push(xr.parse(g))):g.startsWith(DK)?(r.var.push(c),o.push(_K),a.push(g)):(r.number.push(c),o.push(cz),a.push(parseFloat(g))),++c,dz)).split(dz);return{values:a,split:m,indexes:r,types:o}}function hz(e){return O0(e).values}function mz(e){const{split:t,types:a}=O0(e),r=t.length;return o=>{let c="";for(let f=0;f<r;f++)if(c+=t[f],o[f]!==void 0){const m=a[f];m===cz?c+=w0(o[f]):m===fz?c+=xr.transform(o[f]):c+=o[f]}return c}}const $K=e=>typeof e=="number"?0:xr.test(e)?xr.getAnimatableNone(e):e;function zK(e){const t=hz(e);return mz(e)(t.map($K))}const rf={test:MK,parse:hz,createTransformer:mz,getAnimatableNone:zK};function IO(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function jK({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,c=0,f=0;if(!t)o=c=f=a;else{const m=a<.5?a*(1+t):a+t-a*t,g=2*a-m;o=IO(g,m,e+1/3),c=IO(g,m,e),f=IO(g,m,e-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(f*255),alpha:r}}function lx(e,t){return a=>a>0?t:e}const Za=(e,t,a)=>e+(t-e)*a,kO=(e,t,a)=>{const r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},LK=[UO,Bd,Qm],VK=e=>LK.find(t=>t.test(e));function pz(e){const t=VK(e);if(Zm(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let a=t.parse(e);return t===Qm&&(a=jK(a)),a}const gz=(e,t)=>{const a=pz(e),r=pz(t);if(!a||!r)return lx(e,t);const o={...a};return c=>(o.red=kO(a.red,r.red,c),o.green=kO(a.green,r.green,c),o.blue=kO(a.blue,r.blue,c),o.alpha=Za(a.alpha,r.alpha,c),Bd.transform(o))},FO=new Set(["none","hidden"]);function BK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function HK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?HK:typeof e=="string"?VO(e)?lx:xr.test(e)?gz:IK:Array.isArray(e)?vz:typeof e=="object"?xr.test(e)?gz:PK:lx}function vz(e,t){const a=[...e],r=a.length,o=e.map((c,f)=>qO(c)(c,t[f]));return c=>{for(let f=0;f<r;f++)a[f]=o[f](c);return a}}function PK(e,t){const a={...e,...t},r={};for(const o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=qO(e[o])(e[o],t[o]));return o=>{for(const c in r)a[c]=r[c](o);return a}}function UK(e,t){const a=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const c=t.types[o],f=e.indexes[c][r[c]],m=e.values[f]??0;a[o]=m,r[c]++}return a}const IK=(e,t)=>{const a=rf.createTransformer(t),r=O0(e),o=O0(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?FO.has(e)&&!o.values.length||FO.has(t)&&!r.values.length?BK(e,t):S0(vz(UK(r,o),o.values),a):(Zm(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lx(e,t))};function yz(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?Za(e,t,a):qO(e)(e,t)}const kK=e=>{const t=({timestamp:a})=>e(a);return{start:(a=!0)=>Pa.update(t,a),stop:()=>nf(t),now:()=>ii.isProcessing?ii.timestamp:yo.now()}},bz=(e,t,a=10)=>{let r="";const o=Math.max(Math.round(t/a),2);for(let c=0;c<o;c++)r+=Math.round(e(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},sx=2e4;function GO(e){let t=0;const a=50;let r=e.next(t);for(;!r.done&&t<sx;)t+=a,r=e.next(t);return t>=sx?1/0:t}function FK(e,t=100,a){const r=a({...e,keyframes:[0,t]}),o=Math.min(GO(r),sx);return{type:"keyframes",ease:c=>r.next(o*c).value/t,duration:Js(o)}}const qK=5;function Sz(e,t,a){const r=Math.max(t-qK,0);return G6(a-e(r),t-r)}const Ka={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},XO=.001;function GK({duration:e=Ka.duration,bounce:t=Ka.bounce,velocity:a=Ka.velocity,mass:r=Ka.mass}){let o,c;Zm(e<=is(Ka.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let f=1-t;f=Zu(Ka.minDamping,Ka.maxDamping,f),e=Zu(Ka.minDuration,Ka.maxDuration,Js(e)),f<1?(o=p=>{const y=p*f,S=y*e,E=y-a,T=YO(p,f),O=Math.exp(-S);return XO-E/T*O},c=p=>{const S=p*f*e,E=S*a+a,T=Math.pow(f,2)*Math.pow(p,2)*e,O=Math.exp(-S),M=YO(Math.pow(p,2),f);return(-o(p)+XO>0?-1:1)*((E-T)*O)/M}):(o=p=>{const y=Math.exp(-p*e),S=(p-a)*e+1;return-XO+y*S},c=p=>{const y=Math.exp(-p*e),S=(a-p)*(e*e);return y*S});const m=5/e,g=YK(o,c,m);if(e=is(e),isNaN(g))return{stiffness:Ka.stiffness,damping:Ka.damping,duration:e};{const p=Math.pow(g,2)*r;return{stiffness:p,damping:f*2*Math.sqrt(r*p),duration:e}}}const XK=12;function YK(e,t,a){let r=a;for(let o=1;o<XK;o++)r=r-e(r)/t(r);return r}function YO(e,t){return e*Math.sqrt(1-t*t)}const WK=["duration","bounce"],ZK=["stiffness","damping","mass"];function xz(e,t){return t.some(a=>e[a]!==void 0)}function KK(e){let t={velocity:Ka.velocity,stiffness:Ka.stiffness,damping:Ka.damping,mass:Ka.mass,isResolvedFromDuration:!1,...e};if(!xz(e,ZK)&&xz(e,WK))if(e.visualDuration){const a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,c=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Ka.mass,stiffness:o,damping:c}}else{const a=GK(e);t={...t,...a,mass:Ka.mass},t.isResolvedFromDuration=!0}return t}function ux(e=Ka.visualDuration,t=Ka.bounce){const a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=a;const c=a.keyframes[0],f=a.keyframes[a.keyframes.length-1],m={done:!1,value:c},{stiffness:g,damping:p,mass:y,duration:S,velocity:E,isResolvedFromDuration:T}=KK({...a,velocity:-Js(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,D=Js(Math.sqrt(g/y)),_=Math.abs(A)<5;r||(r=_?Ka.restSpeed.granular:Ka.restSpeed.default),o||(o=_?Ka.restDelta.granular:Ka.restDelta.default);let j;if(M<1){const N=YO(D,M);j=L=>{const B=Math.exp(-M*D*L);return f-B*((O+M*D*A)/N*Math.sin(N*L)+A*Math.cos(N*L))}}else if(M===1)j=N=>f-Math.exp(-D*N)*(A+(O+D*A)*N);else{const N=D*Math.sqrt(M*M-1);j=L=>{const B=Math.exp(-M*D*L),z=Math.min(N*L,300);return f-B*((O+M*D*A)*Math.sinh(z)+N*A*Math.cosh(z))/N}}const V={calculatedDuration:T&&S||null,next:N=>{const L=j(N);if(T)m.done=N>=S;else{let B=N===0?O:0;M<1&&(B=N===0?is(O):Sz(j,N,L));const z=Math.abs(B)<=r,U=Math.abs(f-L)<=o;m.done=z&&U}return m.value=m.done?f:L,m},toString:()=>{const N=Math.min(GO(V),sx),L=bz(B=>V.next(N*B).value,N,30);return N+"ms "+L},toTransition:()=>{}};return V}ux.applyToOptions=e=>{const t=FK(e,100,ux);return e.ease=t.ease,e.duration=is(t.duration),e.type="keyframes",e};function WO({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:f,min:m,max:g,restDelta:p=.5,restSpeed:y}){const S=e[0],E={done:!1,value:S},T=z=>m!==void 0&&z<m||g!==void 0&&z>g,O=z=>m===void 0?g:g===void 0||Math.abs(m-z)<Math.abs(g-z)?m:g;let M=a*t;const A=S+M,D=f===void 0?A:f(A);D!==A&&(M=D-S);const _=z=>-M*Math.exp(-z/r),j=z=>D+_(z),V=z=>{const U=_(z),H=j(z);E.done=Math.abs(U)<=p,E.value=E.done?D:H};let N,L;const B=z=>{T(E.value)&&(N=z,L=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return B(0),{calculatedDuration:null,next:z=>{let U=!1;return!L&&N===void 0&&(U=!0,V(z),B(z)),N!==void 0&&z>=N?L.next(z-N):(!U&&V(z),E)}}}function QK(e,t,a){const r=[],o=a||Qu.mix||yz,c=e.length-1;for(let f=0;f<c;f++){let m=o(e[f],e[f+1]);if(t){const g=Array.isArray(t)?t[f]||Sl:t;m=S0(g,m)}r.push(m)}return r}function JK(e,t,{clamp:a=!0,ease:r,mixer:o}={}){const c=e.length;if(Ku(c===t.length,"Both input and output ranges must be the same length","range-length"),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const f=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const m=QK(t,r,o),g=m.length,p=y=>{if(f&&y<e[0])return t[0];let S=0;if(g>1)for(;S<e.length-2&&!(y<e[S+1]);S++);const E=x0(e[S],e[S+1],y);return m[S](E)};return a?y=>p(Zu(e[0],e[c-1],y)):p}function eQ(e,t){const a=e[e.length-1];for(let r=1;r<=t;r++){const o=x0(0,t,r);e.push(Za(a,1,o))}}function tQ(e){const t=[0];return eQ(t,e.length-1),t}function nQ(e,t){return e.map(a=>a*t)}function aQ(e,t){return e.map(()=>t||nz).splice(0,e.length-1)}function Jm({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){const o=pK(r)?r.map(iz):iz(r),c={done:!1,value:t[0]},f=nQ(a&&a.length===t.length?a:tQ(t),e),m=JK(f,t,{ease:Array.isArray(o)?o:aQ(t,o)});return{calculatedDuration:e,next:g=>(c.value=m(g),c.done=g>=e,c)}}const rQ=e=>e!==null;function ZO(e,{repeat:t,repeatType:a="loop"},r,o=1){const c=e.filter(rQ),m=o<0||t&&a!=="loop"&&t%2===1?0:c.length-1;return!m||r===void 0?c[m]:r}const iQ={decay:WO,inertia:WO,tween:Jm,keyframes:Jm,spring:ux};function Cz(e){typeof e.type=="string"&&(e.type=iQ[e.type])}class KO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,a){return this.finished.then(t,a)}}var oQ={};const lQ=e=>e/100;class QO extends KO{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==yo.now()&&this.tick(yo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Cz(t);const{type:a=Jm,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:f=0}=t;let{keyframes:m}=t;const g=a||Jm;oQ.NODE_ENV!=="production"&&g!==Jm&&Ku(m.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${m}`,"spring-two-frames"),g!==Jm&&typeof m[0]!="number"&&(this.mixKeyframes=S0(lQ,yz(m[0],m[1])),m=[0,100]);const p=g({...t,keyframes:m});c==="mirror"&&(this.mirroredGenerator=g({...t,keyframes:[...m].reverse(),velocity:-f})),p.calculatedDuration===null&&(p.calculatedDuration=GO(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}updateTime(t){const a=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(t,a=!1){const{generator:r,totalDuration:o,mixKeyframes:c,mirroredGenerator:f,resolvedDuration:m,calculatedDuration:g}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:S,repeatType:E,repeatDelay:T,type:O,onUpdate:M,finalKeyframe:A}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),a?this.currentTime=t:this.updateTime(t);const D=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?D<0:D>o;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,V=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),H=z%1;!H&&z>=1&&(H=1),H===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(H=1-H,T&&(H-=T/m)):E==="mirror"&&(V=f)),j=Zu(0,1,H)*m}const N=_?{done:!1,value:y[0]}:V.next(j);c&&(N.value=c(N.value));let{done:L}=N;!_&&g!==null&&(L=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return B&&O!==WO&&(N.value=ZO(y,this.options,A,this.speed)),M&&M(N.value),B&&this.finish(),N}then(t,a){return this.finished.then(t,a)}get duration(){return Js(this.calculatedDuration)}get time(){return Js(this.currentTime)}set time(t){t=is(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(yo.now());const a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=Js(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=kK,startTime:a}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=a??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(yo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function sQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hd=e=>e*180/Math.PI,JO=e=>{const t=Hd(Math.atan2(e[1],e[0]));return eR(t)},uQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JO,rotateZ:JO,skewX:e=>Hd(Math.atan(e[1])),skewY:e=>Hd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},eR=e=>(e=e%360,e<0&&(e+=360),e),Ez=JO,wz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Tz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),cQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:wz,scaleY:Tz,scale:e=>(wz(e)+Tz(e))/2,rotateX:e=>eR(Hd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Hd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Hd(Math.atan(e[4])),skewY:e=>Hd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tR(e){return e.includes("scale")?1:0}function nR(e,t){if(!e||e==="none")return tR(t);const a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(a)r=cQ,o=a;else{const m=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=uQ,o=m}if(!o)return tR(t);const c=r[t],f=o[1].split(",").map(dQ);return typeof c=="function"?c(f):f[c]}const fQ=(e,t)=>{const{transform:a="none"}=getComputedStyle(e);return nR(a,t)};function dQ(e){return parseFloat(e.trim())}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],tp=new Set(ep),Oz=e=>e===Km||e===on,hQ=new Set(["x","y","z"]),mQ=ep.filter(e=>!hQ.has(e));function pQ(e){const t=[];return mQ.forEach(a=>{const r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}const Pd={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nR(t,"x"),y:(e,{transform:t})=>nR(t,"y")};Pd.translateX=Pd.x,Pd.translateY=Pd.y;const Ud=new Set;let aR=!1,rR=!1,iR=!1;function Rz(){if(rR){const e=Array.from(Ud).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{const o=pQ(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=a.get(r);o&&o.forEach(([c,f])=>{r.getValue(c)?.set(f)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rR=!1,aR=!1,Ud.forEach(e=>e.complete(iR)),Ud.clear()}function Az(){Ud.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rR=!0)})}function gQ(){iR=!0,Az(),Rz(),iR=!1}class oR{constructor(t,a,r,o,c,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=c,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(Ud.add(this),aR||(aR=!0,Pa.read(Az),Pa.resolveKeyframes(Rz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;if(t[0]===null){const c=o?.get(),f=t[t.length-1];if(c!==void 0)t[0]=c;else if(r&&a){const m=r.readValue(a,f);m!=null&&(t[0]=m)}t[0]===void 0&&(t[0]=f),o&&c===void 0&&o.set(t[0])}sQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ud.delete(this)}cancel(){this.state==="scheduled"&&(Ud.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const vQ=e=>e.startsWith("--");function yQ(e,t,a){vQ(t)?e.style.setProperty(t,a):e.style[t]=a}const bQ=_O(()=>window.ScrollTimeline!==void 0),SQ={};function xQ(e,t){const a=_O(e);return()=>SQ[t]??a()}const Mz=xQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),R0=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,_z={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:R0([0,.65,.55,1]),circOut:R0([.55,0,1,.45]),backIn:R0([.31,.01,.66,-.59]),backOut:R0([.33,1.53,.69,.99])};function Dz(e,t){if(e)return typeof e=="function"?Mz()?bz(e,t):"ease-out":az(e)?R0(e):Array.isArray(e)?e.map(a=>Dz(a,t)||_z.easeOut):_z[e]}function CQ(e,t,a,{delay:r=0,duration:o=300,repeat:c=0,repeatType:f="loop",ease:m="easeOut",times:g}={},p=void 0){const y={[t]:a};g&&(y.offset=g);const S=Dz(m,o);Array.isArray(S)&&(y.easing=S);const E={delay:r,duration:o,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:c+1,direction:f==="reverse"?"alternate":"normal"};return p&&(E.pseudoElement=p),e.animate(y,E)}function Nz(e){return typeof e=="function"&&"applyToOptions"in e}function EQ({type:e,...t}){return Nz(e)&&Mz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class wQ extends KO{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:a,name:r,keyframes:o,pseudoElement:c,allowFlatten:f=!1,finalKeyframe:m,onComplete:g}=t;this.isPseudoElement=!!c,this.allowFlatten=f,this.options=t,Ku(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=EQ(t);this.animation=CQ(a,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=ZO(o,this.options,m,this.speed);this.updateMotionValue?this.updateMotionValue(y):yQ(a,r,y),this.animation.cancel()}g?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Js(Number(t))}get time(){return Js(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=is(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&bQ()?(this.animation.timeline=t,Sl):a(this)}}const $z={anticipate:J6,backInOut:Q6,circInOut:tz};function TQ(e){return e in $z}function OQ(e){typeof e.ease=="string"&&TQ(e.ease)&&(e.ease=$z[e.ease])}const zz=10;class RQ extends wQ{constructor(t){OQ(t),Cz(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:a,onUpdate:r,onComplete:o,element:c,...f}=this.options;if(!a)return;if(t!==void 0){a.set(t);return}const m=new QO({...f,autoplay:!1}),g=is(this.finishedTime??this.time);a.setWithVelocity(m.sample(g-zz).value,m.sample(g).value,zz),m.stop()}}const jz=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rf.test(e)||e==="0")&&!e.startsWith("url("));function AQ(e){const t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function MQ(e,t,a,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],f=jz(o,t),m=jz(c,t);return Zm(f===m,`You are trying to animate ${t} from "${o}" to "${c}". "${f?c:o}" is not an animatable value.`,"value-not-animatable"),!f||!m?!1:AQ(e)||(a==="spring"||Nz(a))&&r}const _Q=new Set(["opacity","clipPath","filter","transform"]),DQ=_O(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function NQ(e){const{motionValue:t,name:a,repeatDelay:r,repeatType:o,damping:c,type:f}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:p}=t.owner.getProps();return DQ()&&a&&_Q.has(a)&&(a!=="transform"||!p)&&!g&&!r&&o!=="mirror"&&c!==0&&f!=="inertia"}const $Q=40;class zQ extends KO{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:f="loop",keyframes:m,name:g,motionValue:p,element:y,...S}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yo.now();const E={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:c,repeatType:f,name:g,motionValue:p,element:y,...S},T=y?.KeyframeResolver||oR;this.keyframeResolver=new T(m,(O,M,A)=>this.onKeyframesResolved(O,M,E,!A),g,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,a,r,o){this.keyframeResolver=void 0;const{name:c,type:f,velocity:m,delay:g,isHandoff:p,onUpdate:y}=r;this.resolvedAt=yo.now(),MQ(t,c,f,m)||((Qu.instantAnimations||!g)&&y?.(ZO(t,r,a)),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const E={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>$Q?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...r,keyframes:t},T=!p&&NQ(E)?new RQ({...E,element:E.motionValue.owner.current}):new QO(E);T.finished.then(()=>this.notifyFinished()).catch(Sl),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,a){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gQ()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const jQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LQ(e){const t=jQ.exec(e);if(!t)return[,];const[,a,r,o]=t;return[`--${a??r}`,o]}const VQ=4;function Lz(e,t,a=1){Ku(a<=VQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,o]=LQ(e);if(!r)return;const c=window.getComputedStyle(t).getPropertyValue(r);if(c){const f=c.trim();return k6(f)?parseFloat(f):f}return VO(o)?Lz(o,t,a+1):o}function lR(e,t){return e?.[t]??e?.default??e}const Vz=new Set(["width","height","top","left","right","bottom",...ep]),BQ={test:e=>e==="auto",parse:e=>e},Bz=e=>t=>t.test(e),Hz=[Km,on,eu,af,RK,OK,BQ],Pz=e=>Hz.find(Bz(e));function HQ(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||q6(e):!0}const PQ=new Set(["brightness","contrast","saturate","opacity"]);function UQ(e){const[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=a.match(BO)||[];if(!r)return e;const o=a.replace(r,"");let c=PQ.has(t)?1:0;return r!==a&&(c*=100),t+"("+c+o+")"}const IQ=/\b([a-z-]*)\(.*?\)/gu,sR={...rf,getAnimatableNone:e=>{const t=e.match(IQ);return t?t.map(UQ).join(" "):e}},Uz={...Km,transform:Math.round},uR={borderWidth:on,borderTopWidth:on,borderRightWidth:on,borderBottomWidth:on,borderLeftWidth:on,borderRadius:on,radius:on,borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomRightRadius:on,borderBottomLeftRadius:on,width:on,maxWidth:on,height:on,maxHeight:on,top:on,right:on,bottom:on,left:on,padding:on,paddingTop:on,paddingRight:on,paddingBottom:on,paddingLeft:on,margin:on,marginTop:on,marginRight:on,marginBottom:on,marginLeft:on,backgroundPositionX:on,backgroundPositionY:on,...{rotate:af,rotateX:af,rotateY:af,rotateZ:af,scale:ox,scaleX:ox,scaleY:ox,scaleZ:ox,skew:af,skewX:af,skewY:af,distance:on,translateX:on,translateY:on,translateZ:on,x:on,y:on,z:on,perspective:on,transformPerspective:on,opacity:E0,originX:uz,originY:uz,originZ:on},zIndex:Uz,fillOpacity:E0,strokeOpacity:E0,numOctaves:Uz},kQ={...uR,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:sR,WebkitFilter:sR},Iz=e=>kQ[e];function kz(e,t){let a=Iz(e);return a!==sR&&(a=rf),a.getAnimatableNone?a.getAnimatableNone(t):void 0}const FQ=new Set(["auto","none","0"]);function qQ(e,t,a){let r=0,o;for(;r<e.length&&!o;){const c=e[r];typeof c=="string"&&!FQ.has(c)&&O0(c).values.length&&(o=e[r]),r++}if(o&&a)for(const c of t)e[c]=kz(a,o)}class GQ extends oR{constructor(t,a,r,o,c){super(t,a,r,o,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),VO(p))){const y=Lz(p,a.current);y!==void 0&&(t[g]=y),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Vz.has(r)||t.length!==2)return;const[o,c]=t,f=Pz(o),m=Pz(c);if(f!==m)if(Oz(f)&&Oz(m))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Pd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||HQ(t[o]))&&r.push(o);r.length&&qQ(t,r,a)}measureInitialState(){const{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pd[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;const o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){const{element:t,name:a,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(a);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,f=r[c];r[c]=Pd[a](t.measureViewportBox(),window.getComputedStyle(t.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([m,g])=>{t.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function XQ(e,t,a){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=a?.[e]??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const Fz=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function qz(e){return F6(e)&&"offsetHeight"in e}var YQ={};const Gz=30,WQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const c=yo.now();if(this.updatedAt!==c&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const f of this.dependents)f.dirty();o&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=yo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=WQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return YQ.NODE_ENV!=="production"&&NO(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new DO);const r=this.events[t].add(a);return t==="change"?()=>{r(),Pa.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=yo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Gz)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,Gz);return G6(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function np(e,t){return new ZQ(e,t)}const{schedule:cR}=oz(queueMicrotask,!1),os={x:!1,y:!1};function Xz(){return os.x||os.y}function KQ(e){return e==="x"||e==="y"?os[e]?null:(os[e]=!0,()=>{os[e]=!1}):os.x||os.y?null:(os.x=os.y=!0,()=>{os.x=os.y=!1})}function Yz(e,t){const a=XQ(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function Wz(e){return!(e.pointerType==="touch"||Xz())}function QQ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{if(!Wz(m))return;const{target:g}=m,p=t(g,m);if(typeof p!="function"||!g)return;const y=S=>{Wz(S)&&(p(S),g.removeEventListener("pointerleave",y))};g.addEventListener("pointerleave",y,o)};return r.forEach(m=>{m.addEventListener("pointerenter",f,o)}),c}const Zz=(e,t)=>t?e===t?!0:Zz(e,t.parentElement):!1,fR=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,JQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eJ(e){return JQ.has(e.tagName)||e.tabIndex!==-1}const cx=new WeakSet;function Kz(e){return t=>{t.key==="Enter"&&e(t)}}function dR(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tJ=(e,t)=>{const a=e.currentTarget;if(!a)return;const r=Kz(()=>{if(cx.has(a))return;dR(a,"down");const o=Kz(()=>{dR(a,"up")}),c=()=>dR(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",c,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function Qz(e){return fR(e)&&!Xz()}function nJ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{const g=m.currentTarget;if(!Qz(m))return;cx.add(g);const p=t(g,m),y=(T,O)=>{window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",E),cx.has(g)&&cx.delete(g),Qz(T)&&typeof p=="function"&&p(T,{success:O})},S=T=>{y(T,g===window||g===document||a.useGlobalTarget||Zz(g,T.target))},E=T=>{y(T,!1)};window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",E,o)};return r.forEach(m=>{(a.useGlobalTarget?window:m).addEventListener("pointerdown",f,o),qz(m)&&(m.addEventListener("focus",p=>tJ(p,o)),!eJ(m)&&!m.hasAttribute("tabindex")&&(m.tabIndex=0))}),c}function Jz(e){return F6(e)&&"ownerSVGElement"in e}function aJ(e){return Jz(e)&&e.tagName==="svg"}const Ti=e=>!!(e&&e.getVelocity),rJ=[...Hz,xr,rf],iJ=e=>rJ.find(Bz(e)),hR=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class oJ extends x.Component{getSnapshotBeforeUpdate(t){const a=this.props.childRef.current;if(a&&t.isPresent&&!this.props.isPresent){const r=a.offsetParent,o=qz(r)&&r.offsetWidth||0,c=this.props.sizeRef.current;c.height=a.offsetHeight||0,c.width=a.offsetWidth||0,c.top=a.offsetTop,c.left=a.offsetLeft,c.right=o-c.width-c.left}return null}componentDidUpdate(){}render(){return this.props.children}}function lJ({children:e,isPresent:t,anchorX:a,root:r}){const o=x.useId(),c=x.useRef(null),f=x.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:m}=x.useContext(hR);return x.useInsertionEffect(()=>{const{width:g,height:p,top:y,left:S,right:E}=f.current;if(t||!c.current||!g||!p)return;const T=a==="left"?`left: ${S}`:`right: ${E}`;c.current.dataset.motionPopId=o;const O=document.createElement("style");m&&(O.nonce=m);const M=r??document.head;return M.appendChild(O),O.sheet&&O.sheet.insertRule(`
|
|
644
|
+
`,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let V=0;V<=m;V++){const N=Math.round(V*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const L=Math.abs(c[V]||0),B=Math.abs(f[V]||0);L>_&&(_=L),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(Ym.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const V=a.barWidth||.5,N=V+(a.barGap||V/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(V=>{const N=Math.floor(D/p*V.length),L=Math.floor((D+_)/p*V.length);return V.slice(N,L)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>Ym.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return ri(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return ri(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}Ym.MAX_CANVAS_WIDTH=8e3,Ym.MAX_NODES=10;class WZ extends b0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class CO extends b0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return ri(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return ri(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return ri(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const ZZ={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Wm extends YZ{static create(t){return new Wm(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new CO:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},ZZ,t),this.timer=new WZ;const r=a?void 0:this.getMediaElement();this.renderer=new Ym(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=tx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=tx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return ri(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield XZ.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof CO&&(m.duration=f)}if(r)this.decodedData=tx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield tx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return ri(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof CO?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return ri(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return ri(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}Wm.BasePlugin=class extends b0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},Wm.dom=GZ;const KZ=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=RB(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),V=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},L=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",te=new MediaRecorder(U,{mimeType:H});M.current=te,D.current=[],te.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},te.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},te.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=Wm.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return ae.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[ae.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?ae.jsxs("div",{style:{position:"relative"},children:[ae.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),ae.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):ae.jsx(b6,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:V,style:{display:"none",padding:"0"}}),ae.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:L,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(C6,{style:{fontSize:"20px"}}):ae.jsx(p6,{style:{fontSize:"20px"}})})}),ae.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?ae.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[ae.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?ae.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:ae.jsx("span",{children:"Recording"})}):ae.jsx(Yu,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&(a(),t(""))},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(S6,{style:{fontSize:"20px"}})})]})};function QZ({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return ae.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:ae.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>ae.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function JZ(){return ae.jsxs("div",{className:"jawebcss-powered-container",children:[ae.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),ae.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const eK=()=>ae.jsxs("div",{className:"typing-animation",children:[ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."})]}),tK=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>!y||y===0?null:ae.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:ae.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([E,T])=>{const O=t[E]||(T.length>0?T[0].variant_id:""),M=T.find(L=>L.variant_id===O)||T[0];if(!M)return null;const A=r[M.variant_id]||0,D=Array.from(new Set(T.map(L=>L.option?.trim()??"").filter(L=>L&&L.toLowerCase()!=="none"))),_=L=>{const B=T.find(z=>z.option===L);B&&a(z=>({...z,[E]:B.variant_id}))},j=async()=>{o(L=>({...L,[M.variant_id]:(L[M.variant_id]||0)+1})),await c(M.variant_id,M.name,1)},V=async()=>{A!==0&&(o(L=>({...L,[M.variant_id]:Math.max(0,(L[M.variant_id]||0)-1)})),await f(M.variant_id,1))},N=M.option??D[0]??"";return ae.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[ae.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(M.link,"_blank"),children:[ae.jsx("img",{src:M.image,alt:M.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:L=>L.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:M.name,children:g(M.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:M.price})}),D.length>1&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${E}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${E}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:L=>_(L.target.value),children:D.map(L=>ae.jsx("option",{value:L,children:L},L))})]}),!S&&ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:V,"aria-label":"Decrease quantity",disabled:A===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:A}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:j,"aria-label":"Increase quantity",children:"+"})]})]})]},E)})})});var nx={},P6;function nK(){if(P6)return nx;P6=1,Object.defineProperty(nx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,te,Y){U.addListener?U.addListener(te):U.addEventListener(H,te,Y),z.push([U,H,te,Y])},input:function(U,H,te,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],F=W.detail&&W.detail.x?W.detail:null;return Z({id:F?F.identifier?F.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:F?F.identifier?F.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:F&&F.x?F.x:G[0]?G[0].screenX:F?F.x:W.pageX,y:F&&F.y?F.y:G[0]?G[0].screenY:F?F.y:W.pageY})}}(te),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,te){var Y=z&&z[U];return Y==null?H:te&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var te in z)if(!O(z[te],U[te]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,te=arguments.length;H<te;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var te,Y=0,Z=U.length;Y<Z;Y++)!te&&Y in U||(te||(te=Array.prototype.slice.call(U,0,Y)),te[Y]=U[Y]);return z.concat(te||Array.prototype.slice.call(U))}function D(z){var U,H,te,Y,Z,W;function ie(k){W||(W=k),G(!0);var q=k-W;q>te&&(q=te);var J=Y[H];if(J[3]<q)return H++,ie(k);var ne=J[2],oe=J[4],le=J[0],ue=J[1]*(0,J[5])(oe===0?1:(q-ne)/oe);if(ue&&z.track.to(le+ue),q<te)return Q();W=null,G(!1),F(null),z.emit("animationEnded")}function G(k){U.active=k}function F(k){U.targetIdx=k}function Q(){var k;k=ie,Z=window.requestAnimationFrame(k)}function se(){var k;k=Z,window.cancelAnimationFrame(k),G(!1),F(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,J=z.track.details.position;H=0,te=0,Y=k.map(function(ne){var oe,le=Number(J),ue=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ee=ne.easing,ze=ne.distance*Ee(ue/ne.duration)||0;J+=ze;var De=te;return te+=ue,q+=ze,[le,ne.distance,De,te,ne.duration,Ee]}),F(z.track.distToIdx(q)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne=1/0,oe=[],le=null,ue=0;function Ee(Re){ye(ue+Re)}function ze(Re){var Ae=De(ue+Re).abs;return he(Ae)?Ae:null}function De(Re){var Ae=Math.floor(Math.abs(T(Re/H))),we=T((Re%H+H)%H);we===H&&(we=0);var Te=y(Re),Ne=ie.indexOf(A([],ie).reduce(function(Le,it){return Math.abs(it-we)<Math.abs(Le-we)?it:Le})),ke=Ne;return Te<0&&Ae++,Ne===W&&(ke=0,Ae+=Te>0?1:-1),{abs:ke+Ae*W*Te,origin:Ne,rel:ke}}function Fe(Re,Ae,we){var Te;if(Ae||!Ue())return ve(Re,we);if(!he(Re))return null;var Ne=De(we??ue),ke=Ne.abs,Le=Re-Ne.rel,it=ke+Le;Te=ve(it);var ut=ve(it-W*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(Te)||Te===null)&&(Te=ut),T(Te)}function ve(Re,Ae){if(Ae==null&&(Ae=T(ue)),!he(Re)||Re===null)return null;Re=Math.round(Re);var we=De(Ae),Te=we.abs,Ne=we.rel,ke=we.origin,Le=me(Re),it=(Ae%H+H)%H,ut=ie[ke],vt=Math.floor((Re-(Te-Ne))/W)*H;return T(ut-it-ut+ie[Le]+vt+(ke===W?H:0))}function he(Re){return je(Re)===Re}function je(Re){return p(Re,F,Q)}function Ue(){return Y.loop}function me(Re){return(Re%W+W)%W}function ye(Re){var Ae;Ae=Re-ue,oe.push({distance:Ae,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Re);var we=Se().abs;if(we!==le){var Te=le!==null;le=we,Te&&z.emit("slideChanged")}}function Se(Re){var Ae=Re?null:function(){if(W){var we=Ue(),Te=we?(ue%H+H)%H:ue,Ne=(we?ue%H:ue)-Z[0][2],ke=0-(Ne<0&&we?H-Math.abs(Ne):Ne),Le=0,it=De(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(jt,Vt){var _t=ke+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&we?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;we&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&><se&&(_t+=H),k!==null&>>k&&(_t-=H));var at=_t+jt[0]+jt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(jt[0]+_t)/jt[0]):(1-_t)/jt[0],0);return Le+=jt[0]+jt[1],{abs:gt,distance:Y.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=je(ut),vt=me(ut),{abs:je(ut),length:te,max:J,maxIdx:Q,min:q,minIdx:F,position:ue,progress:we?Te/H:ue/te,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Ae,z.emit("detailsChanged"),Ae}return U={absToRel:me,add:Ee,details:null,distToIdx:ze,idxToDist:Fe,init:function(Re){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(Ne){return[E(Ne,"size",1),E(Ne,"spacing",0),E(Ne,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(Ne,ke){return Ne+ke[0]+ke[1]},0));var we,Te=W-1;te=T(H+Z[0][2]-Z[Te][0]-Z[Te][2]-Z[Te][1]),ie=Z.reduce(function(Ne,ke){if(!Ne)return[0];var Le=Z[Ne.length-1],it=Ne[Ne.length-1]+(Le[0]+Le[2])+Le[1];return it-=ke[2],Ne[Ne.length-1]>it&&(it=Ne[Ne.length-1]),it=T(it),Ne.push(it),(!we||we<it)&&(G=Ne.length-1),we=it,Ne},null),te===0&&(G=0),ie.push(T(H))}}(),!W)return Se(!0);var Ae;(function(){var we=z.options.range,Te=z.options.loop;se=F=Te?E(Te,"min",-1/0):0,k=Q=Te?E(Te,"max",ne):G;var Ne=E(we,"min",null),ke=E(we,"max",null);Ne!==null&&(F=Ne),ke!==null&&(Q=ke),q=F===-1/0?F:z.track.idxToDist(F||0,!0,0),J=Q===ne?Q:Fe(Q,!0,0),ke===null&&(k=Q),E(we,"align",!1)&&Q!==ne&&Z[me(Q)][2]===0&&(J-=1-Z[me(Q)][0],Q=ze(J-ue)),q=T(q),J=T(J)})(),Ae=Re,Number(Ae)===Ae?Ee(ve(je(Re))):Se()},to:ye,velocity:function(){var Re=r(),Ae=oe.reduce(function(we,Te){var Ne=Te.distance,ke=Te.timestamp;return Re-ke>200||(y(Ne)!==y(we.distance)&&we.distance&&(we={distance:0,lastTimestamp:0,time:0}),we.time&&(we.distance+=Ne),we.lastTimestamp&&(we.time+=ke-we.lastTimestamp),we.lastTimestamp=ke),we},{distance:0,lastTimestamp:0,time:0});return Ae.distance/Ae.time||0}}}function j(z){var U,H,te,Y,Z,W,ie,G;function F(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function k(){return te?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=k();Y=y(Ee);var ze=z.track.details,De=[];if(Ee||!le){var Fe=J(Ee),ve=Fe.dist,he=Fe.dur;if(he=F(he),ve*=Y,le){var je=ue.idxToDist(ue.distToIdx(ve),!0);je&&(ve=je)}De.push({distance:ve,duration:he,easing:se});var Ue=ze.position,me=Ue+ve;if(me<Z||me>W){var ye=me<Z?Z-Ue:W-Ue,Se=0,Re=Ee;if(y(ye)===Y){var Ae=Math.min(Math.abs(ye)/Math.abs(ve),1),we=function(ke){return 1-Math.pow(1-ke,1/3)}(Ae)*he;De[0].earlyExit=we,Re=Ee*(1-Ae)}else De[0].earlyExit=0,Se+=ye;var Te=J(Re,100),Ne=Te.dist*Y;z.options.rubberband&&(De.push({distance:Ne,duration:F(Te.dur),easing:se}),De.push({distance:-Ne+Se,duration:500,easing:se}))}z.animator.start(De)}else z.moveToIdx(Q(ze.abs),!0,{duration:500,easing:function(ke){return 1+--ke*ke*ke*ke*ke}})}function J(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ne(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){te=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){te=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,ze=Ee.position,De=y(k());(ze>W||ze<Z)&&(De=0);var Fe=U+De;Ee.slides[ue.absToRel(Fe)].portion===0&&(Fe-=De),U!==H&&(Fe=H),y(ue.idxToDist(Fe,!0))!==De&&(Fe+=De),Fe=Q(Fe);var ve=ue.idxToDist(Fe,!0);z.animator.start([{distance:ve,duration:500,easing:function(he){return 1+--he*he*he*he*he}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){H=z.track.details.abs})}function V(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne,oe,le,ue,Ee=g();function ze(Se){if(W&&G===Se.id){var Re=he(Se);if(F){if(!ve(Se))return Fe(Se);Q=Re,F=!1,z.emit("dragChecked")}if(oe)return Q=Re;f(Se);var Ae=function(Te){if(le===-1/0&&ue===1/0)return Te;var Ne=z.track.details,ke=Ne.length,Le=Ne.position,it=p(Te,le-Le,ue-Le);if(ke===0)return 0;if(!z.options.rubberband)return it;if(Le<=ue&&Le>=le||Le<le&&H>0||Le>ue&&H<0)return Te;var ut=(Le<le?Le-le:Le-ue)/ke,vt=Y*ke,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*Te}(ie(Q-Re)/Y*te);H=y(Ae);var we=z.track.details.position;(we>le&&we<ue||we===le&&H>0||we===ue&&H<0)&&m(Se),se+=Ae,!k&&Math.abs(se*Y)>5&&(k=!0),z.track.add(Ae),Q=Re,z.emit("dragged")}}function De(Se){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,k=!1,F=!0,G=Se.id,ve(Se),Q=he(Se),z.emit("dragStarted"))}function Fe(Se){W&&G===Se.idChanged&&(W=!1,z.emit("dragEnded"))}function ve(Se){var Re=je(),Ae=Re?Se.y:Se.x,we=Re?Se.x:Se.y,Te=q!==void 0&&J!==void 0&&Math.abs(J-we)<=Math.abs(q-Ae);return q=Ae,J=we,Te}function he(Se){return je()?Se.y:Se.x}function je(){return z.options.vertical}function Ue(){Y=z.size,Z=je()?window.innerHeight:window.innerWidth;var Se=z.track.details;Se&&(le=Se.min,ue=Se.max)}function me(Se){k&&(m(Se),f(Se))}function ye(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var Se;Se=z.options.dragSpeed||1,ie=typeof Se=="function"?Se:function(Ae){return Ae*Se},te=z.options.rtl?-1:1,Ue(),U=z.container,function(){var Ae="data-keen-slider-clickable";c("[".concat(Ae,"]:not([").concat(Ae,"=false])"),U).map(function(we){Ee.add(we,"dragstart",m),Ee.add(we,"mousedown",m),Ee.add(we,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Ae){f(Ae)}),Ee.add(U,"click",me,{capture:!0}),Ee.input(U,"ksDragStart",De),Ee.input(U,"ksDrag",ze),Ee.input(U,"ksDragEnd",Fe),Ee.input(U,"mousedown",De),Ee.input(U,"mousemove",ze),Ee.input(U,"mouseleave",Fe),Ee.input(U,"mouseup",Fe),Ee.input(U,"touchstart",De,{passive:!0}),Ee.input(U,"touchmove",ze,{passive:!1}),Ee.input(U,"touchend",Fe),Ee.input(U,"touchcancel",Fe),Ee.add(window,"wheel",function(Ae){W&&f(Ae)});var Re="data-keen-slider-scrollable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),z.container).map(function(Ae){return function(we){var Te;Ee.input(we,"touchstart",function(Ne){Te=he(Ne),oe=!0,ne=!0},{passive:!0}),Ee.input(we,"touchmove",function(Ne){var ke=je(),Le=ke?we.scrollHeight-we.clientHeight:we.scrollWidth-we.clientWidth,it=Te-he(Ne),ut=ke?we.scrollTop:we.scrollLeft,vt=ke&&we.style.overflowY==="scroll"||!ke&&we.style.overflowX==="scroll";if(Te=he(Ne),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ne),oe=!1}),Ee.input(we,"touchend",function(){oe=!1})}(Ae)})}}z.on("updated",Ue),z.on("optionsChanged",ye),z.on("created",ye),z.on("destroyed",Ee.purge)}function N(z){var U,H,te=null;function Y(q,J,ne){z.animator.active?W(q,J,ne):requestAnimationFrame(function(){return W(q,J,ne)})}function Z(){Y(!1,!1,H)}function W(q,J,ne){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(ze,De){if(q)!te&&J&&G(ze,null,ne),F(ze,null,ne);else{if(!Ee[De])return;var Fe=Ee[De].size*le;!te&&J&&G(ze,Fe,ne),F(ze,Ee[De].distance*le-oe,ne),oe+=Fe}})}}function ie(q){return z.options.renderMode==="performance"?Math.round(q):q}function G(q,J,ne){var oe=ne?"height":"width";J!==null&&(J=ie(J)+"px"),q.style["min-"+oe]=J,q.style["max-"+oe]=J}function F(q,J,ne){if(J!==null){J=ie(J);var oe=ne?J:0;J="translate3d(".concat(ne?0:J,"px, ").concat(oe,"px, 0)")}q.style.transform=J,q.style["-webkit-transform"]=J}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function k(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(te=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function L(z,U){return function(H){var te,Y,Z,W,ie,G=g();function F(ve){var he;o(H.container,"reverse",(he=H.container,window.getComputedStyle(he,null).getPropertyValue("direction")!=="rtl"||ve?null:"")),o(H.container,"v",H.options.vertical&&!ve?"":null),o(H.container,"disabled",H.options.disabled&&!ve?"":null)}function Q(){se()&&oe()}function se(){var ve=null;if(W.forEach(function(je){je.matches&&(ve=je.__media)}),ve===te)return!1;te||H.emit("beforeOptionsChanged"),te=ve;var he=ve?Z.breakpoints[ve]:Z;return H.options=M(M({},Z),he),F(),De(),Fe(),ue(),!0}function k(ve){var he=S(ve);return(H.options.vertical?he.height:he.width)/H.size||1}function q(){return H.options.trackConfig.length}function J(ve){for(var he in te=!1,Z=M(M({},U),ve),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var je=window.matchMedia(he);je.__media=he,W.push(je),G.add(je,"change",Q)}G.add(window,"orientationchange",ze),G.add(window,"resize",Ee),se()}function ne(ve){H.animator.stop();var he=H.track.details;H.track.init(ve??(he?he.abs:0))}function oe(ve){ne(ve),H.emit("optionsChanged")}function le(ve,he){if(ve)return J(ve),void oe(he);De(),Fe();var je=q();ue(),q()!==je?oe(he):ne(he),H.emit("updated")}function ue(){var ve=H.options.slides;if(typeof ve=="function")return H.options.trackConfig=ve(H.size,H.slides);for(var he=H.slides,je=he.length,Ue=typeof ve=="number"?ve:E(ve,"number",je,!0),me=[],ye=E(ve,"perView",1,!0),Se=E(ve,"spacing",0,!0)/H.size||0,Re=ye==="auto"?Se:Se/ye,Ae=E(ve,"origin","auto"),we=0,Te=0;Te<Ue;Te++){var Ne=ye==="auto"?k(he[Te]):1/ye-Se+Re,ke=Ae==="center"?.5-Ne/2:Ae==="auto"?0:Ae;me.push({origin:ke,size:Ne,spacing:Se}),we+=Ne}if(we+=Se*(Ue-1),Ae==="auto"&&!H.options.loop&&ye!==1){var Le=0;me.map(function(it){var ut=we-Le;return Le+=it.size+Se,ut>=1||(it.origin=1-ut-(we>1?0:1-we)),it})}H.options.trackConfig=me}function Ee(){De();var ve=H.size;H.options.disabled||ve===Y||(Y=ve,le())}function ze(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function De(){var ve=S(H.container);H.size=(H.options.vertical?ve.height:ve.width)||1}function Fe(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),F(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,J(H.options)}}var B=function(z,U,H){try{return function(te,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(F){F(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,F){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(F||se,"duration",500),easing:E(F||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(ie,G,F){F===void 0&&(F=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?F&&delete W[ie][Q]:F||W[ie].push(G)},options:te},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([L(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,V,j],H||[],!0))}catch(te){console.error(te)}};return nx.useKeenSlider=function(z,U){var H=e.useRef(null),te=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),te.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},nx}var EO=nK();const aK=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const V=/(https?:\/\/[^\s]+)/g;return j.split(V).map((N,L)=>V.test(N)?ae.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},L):ae.jsx("span",{children:N},L))},y=j=>{const V=j.trim();if(!V.includes("Name:")||!V.includes("VariantId"))return null;const N=V.match(/Name\s*[:\-]\s*(.+)/i),L=V.match(/Price\s*[:\-]\s*(.+)/i),B=V.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=V.match(/VariantId\s*[:\-]\s*(.+)/i),U=V.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=V.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!N||!L||!B||!z||!U?null:{name:N[1].trim(),price:L[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(L=>L.trim()).filter(Boolean),V=[];let N=null;return j.forEach(L=>{if(L.startsWith("img - ")){const B=L.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...V].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(L.includes("Name:")&&L.includes("VariantId")){const B=y(L);B&&(V.push({type:"product",data:B}),N=B)}else V.push({type:"text",data:L}),N=null}),V},[e]),E=x.useMemo(()=>{const j={};return S.forEach(V=>{if(V.type==="product"){const N=V.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,V=22)=>j.length>V?j.slice(0,V)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,V)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},V)),Object.keys(E).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(E).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(wi,{shape:"circle",icon:ae.jsx(Gm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),ae.jsx(wi,{shape:"circle",icon:ae.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),ae.jsx("div",{ref:D,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},U6=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return ae.jsx("div",{children:ae.jsx("div",{children:t&&ae.jsx("div",{className:"mb-2 bg-transparent text-white ",children:ae.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},rK=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?ae.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):ae.jsx("span",{children:f},m))};return ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:ae.jsx("p",{children:r(a)})})})},iK=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=Wm.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return ae.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[ae.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&ae.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[ae.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&ae.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},oK=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{className:"flex justify-center mb-2",children:ae.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},lK=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?ae.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):ae.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return ae.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",ae.jsx("strong",{children:o})," has been added to your cart."]})}return ae.jsx("p",{style:{color:"white"},children:t(e)})},wO=x.createContext({});function TO(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const OO=typeof window<"u",I6=OO?x.useLayoutEffect:x.useEffect,ax=x.createContext(null);function RO(e,t){e.indexOf(t)===-1&&e.push(t)}function AO(e,t){const a=e.indexOf(t);a>-1&&e.splice(a,1)}const Zu=(e,t,a)=>a>t?t:a<e?e:a;function MO(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var sK={};let Zm=()=>{},Ku=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Ku=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Qu={},k6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function F6(e){return typeof e=="object"&&e!==null}const q6=e=>/^0[^.\s]+$/u.test(e);function _O(e){let t;return()=>(t===void 0&&(t=e()),t)}const Sl=e=>e,uK=(e,t)=>a=>t(e(a)),S0=(...e)=>e.reduce(uK),x0=(e,t,a)=>{const r=t-e;return r===0?1:(a-e)/r};class DO{constructor(){this.subscriptions=[]}add(t){return RO(this.subscriptions,t),()=>AO(this.subscriptions,t)}notify(t,a,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let c=0;c<o;c++){const f=this.subscriptions[c];f&&f(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const is=e=>e*1e3,Js=e=>e/1e3;function G6(e,t){return t?e*(1e3/t):0}const X6=new Set;function NO(e,t,a){e||X6.has(t)||(console.warn(MO(t,a)),X6.add(t))}const Y6=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,cK=1e-7,fK=12;function dK(e,t,a,r,o){let c,f,m=0;do f=t+(a-t)/2,c=Y6(f,r,o)-e,c>0?a=f:t=f;while(Math.abs(c)>cK&&++m<fK);return f}function C0(e,t,a,r){if(e===t&&a===r)return Sl;const o=c=>dK(c,0,1,e,a);return c=>c===0||c===1?c:Y6(o(c),t,r)}const W6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Z6=e=>t=>1-e(1-t),K6=C0(.33,1.53,.69,.99),$O=Z6(K6),Q6=W6($O),J6=e=>(e*=2)<1?.5*$O(e):.5*(2-Math.pow(2,-10*(e-1))),zO=e=>1-Math.sin(Math.acos(e)),ez=Z6(zO),tz=W6(zO),hK=C0(.42,0,1,1),mK=C0(0,0,.58,1),nz=C0(.42,0,.58,1),pK=e=>Array.isArray(e)&&typeof e[0]!="number",az=e=>Array.isArray(e)&&typeof e[0]=="number",rz={linear:Sl,easeIn:hK,easeInOut:nz,easeOut:mK,circIn:zO,circInOut:tz,circOut:ez,backIn:$O,backInOut:Q6,backOut:K6,anticipate:J6},gK=e=>typeof e=="string",iz=e=>{if(az(e)){Ku(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,a,r,o]=e;return C0(t,a,r,o)}else if(gK(e))return Ku(rz[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),rz[e];return e},rx=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function vK(e,t){let a=new Set,r=new Set,o=!1,c=!1;const f=new WeakSet;let m={delta:0,timestamp:0,isProcessing:!1};function g(y){f.has(y)&&(p.schedule(y),e()),y(m)}const p={schedule:(y,S=!1,E=!1)=>{const O=E&&o?a:r;return S&&f.add(y),O.has(y)||O.add(y),y},cancel:y=>{r.delete(y),f.delete(y)},process:y=>{if(m=y,o){c=!0;return}o=!0,[a,r]=[r,a],a.forEach(g),a.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const yK=40;function oz(e,t){let a=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>a=!0,f=rx.reduce((j,V)=>(j[V]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Qu.useManualTiming?o.timestamp:performance.now();a=!1,Qu.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(j-o.timestamp,yK),1)),o.timestamp=j,o.isProcessing=!0,m.process(o),g.process(o),p.process(o),y.process(o),S.process(o),E.process(o),T.process(o),O.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(M))},A=()=>{a=!0,r=!0,o.isProcessing||e(M)};return{schedule:rx.reduce((j,V)=>{const N=f[V];return j[V]=(L,B=!1,z=!1)=>(a||A(),N.schedule(L,B,z)),j},{}),cancel:j=>{for(let V=0;V<rx.length;V++)f[rx[V]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:ii,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(ii.isProcessing||Qu.useManualTiming?ii.timestamp:performance.now()),ix),set:e=>{ix=e,queueMicrotask(bK)}},lz=e=>t=>typeof t=="string"&&t.startsWith(e),LO=lz("--"),SK=lz("var(--"),VO=e=>SK(e)?xK.test(e.split("/*")[0].trim()):!1,xK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Km={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},E0={...Km,transform:e=>Zu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,BO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CK(e){return e==null}const EK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,HO=(e,t)=>a=>!!(typeof a=="string"&&EK.test(a)&&a.startsWith(e)||t&&!CK(a)&&Object.prototype.hasOwnProperty.call(a,t)),sz=(e,t,a)=>r=>{if(typeof r!="string")return r;const[o,c,f,m]=r.match(BO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Zu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Bd={test:HO("rgb","red"),parse:sz("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+PO.transform(e)+", "+PO.transform(t)+", "+PO.transform(a)+", "+w0(E0.transform(r))+")"};function TK(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const UO={test:HO("#"),parse:TK,transform:Bd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),eu=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...eu,parse:e=>eu.parse(e)/100,transform:e=>eu.transform(e*100)},Qm={test:HO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+eu.transform(w0(t))+", "+eu.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Bd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Bd.test(e)?Bd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Bd.transform(e):Qm.transform(e),getAnimatableNone:e=>{const t=xr.parse(e);return t.alpha=0,xr.transform(t)}},AK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function MK(e){return isNaN(e)&&typeof e=="string"&&(e.match(BO)?.length||0)+(e.match(AK)?.length||0)>0}const cz="number",fz="color",_K="var",DK="var(",dz="${}",NK=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function O0(e){const t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[];let c=0;const m=t.replace(NK,g=>(xr.test(g)?(r.color.push(c),o.push(fz),a.push(xr.parse(g))):g.startsWith(DK)?(r.var.push(c),o.push(_K),a.push(g)):(r.number.push(c),o.push(cz),a.push(parseFloat(g))),++c,dz)).split(dz);return{values:a,split:m,indexes:r,types:o}}function hz(e){return O0(e).values}function mz(e){const{split:t,types:a}=O0(e),r=t.length;return o=>{let c="";for(let f=0;f<r;f++)if(c+=t[f],o[f]!==void 0){const m=a[f];m===cz?c+=w0(o[f]):m===fz?c+=xr.transform(o[f]):c+=o[f]}return c}}const $K=e=>typeof e=="number"?0:xr.test(e)?xr.getAnimatableNone(e):e;function zK(e){const t=hz(e);return mz(e)(t.map($K))}const rf={test:MK,parse:hz,createTransformer:mz,getAnimatableNone:zK};function IO(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function jK({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,c=0,f=0;if(!t)o=c=f=a;else{const m=a<.5?a*(1+t):a+t-a*t,g=2*a-m;o=IO(g,m,e+1/3),c=IO(g,m,e),f=IO(g,m,e-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(f*255),alpha:r}}function lx(e,t){return a=>a>0?t:e}const Za=(e,t,a)=>e+(t-e)*a,kO=(e,t,a)=>{const r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},LK=[UO,Bd,Qm],VK=e=>LK.find(t=>t.test(e));function pz(e){const t=VK(e);if(Zm(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let a=t.parse(e);return t===Qm&&(a=jK(a)),a}const gz=(e,t)=>{const a=pz(e),r=pz(t);if(!a||!r)return lx(e,t);const o={...a};return c=>(o.red=kO(a.red,r.red,c),o.green=kO(a.green,r.green,c),o.blue=kO(a.blue,r.blue,c),o.alpha=Za(a.alpha,r.alpha,c),Bd.transform(o))},FO=new Set(["none","hidden"]);function BK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function HK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?HK:typeof e=="string"?VO(e)?lx:xr.test(e)?gz:IK:Array.isArray(e)?vz:typeof e=="object"?xr.test(e)?gz:PK:lx}function vz(e,t){const a=[...e],r=a.length,o=e.map((c,f)=>qO(c)(c,t[f]));return c=>{for(let f=0;f<r;f++)a[f]=o[f](c);return a}}function PK(e,t){const a={...e,...t},r={};for(const o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=qO(e[o])(e[o],t[o]));return o=>{for(const c in r)a[c]=r[c](o);return a}}function UK(e,t){const a=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const c=t.types[o],f=e.indexes[c][r[c]],m=e.values[f]??0;a[o]=m,r[c]++}return a}const IK=(e,t)=>{const a=rf.createTransformer(t),r=O0(e),o=O0(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?FO.has(e)&&!o.values.length||FO.has(t)&&!r.values.length?BK(e,t):S0(vz(UK(r,o),o.values),a):(Zm(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lx(e,t))};function yz(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?Za(e,t,a):qO(e)(e,t)}const kK=e=>{const t=({timestamp:a})=>e(a);return{start:(a=!0)=>Pa.update(t,a),stop:()=>nf(t),now:()=>ii.isProcessing?ii.timestamp:yo.now()}},bz=(e,t,a=10)=>{let r="";const o=Math.max(Math.round(t/a),2);for(let c=0;c<o;c++)r+=Math.round(e(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},sx=2e4;function GO(e){let t=0;const a=50;let r=e.next(t);for(;!r.done&&t<sx;)t+=a,r=e.next(t);return t>=sx?1/0:t}function FK(e,t=100,a){const r=a({...e,keyframes:[0,t]}),o=Math.min(GO(r),sx);return{type:"keyframes",ease:c=>r.next(o*c).value/t,duration:Js(o)}}const qK=5;function Sz(e,t,a){const r=Math.max(t-qK,0);return G6(a-e(r),t-r)}const Ka={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},XO=.001;function GK({duration:e=Ka.duration,bounce:t=Ka.bounce,velocity:a=Ka.velocity,mass:r=Ka.mass}){let o,c;Zm(e<=is(Ka.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let f=1-t;f=Zu(Ka.minDamping,Ka.maxDamping,f),e=Zu(Ka.minDuration,Ka.maxDuration,Js(e)),f<1?(o=p=>{const y=p*f,S=y*e,E=y-a,T=YO(p,f),O=Math.exp(-S);return XO-E/T*O},c=p=>{const S=p*f*e,E=S*a+a,T=Math.pow(f,2)*Math.pow(p,2)*e,O=Math.exp(-S),M=YO(Math.pow(p,2),f);return(-o(p)+XO>0?-1:1)*((E-T)*O)/M}):(o=p=>{const y=Math.exp(-p*e),S=(p-a)*e+1;return-XO+y*S},c=p=>{const y=Math.exp(-p*e),S=(a-p)*(e*e);return y*S});const m=5/e,g=YK(o,c,m);if(e=is(e),isNaN(g))return{stiffness:Ka.stiffness,damping:Ka.damping,duration:e};{const p=Math.pow(g,2)*r;return{stiffness:p,damping:f*2*Math.sqrt(r*p),duration:e}}}const XK=12;function YK(e,t,a){let r=a;for(let o=1;o<XK;o++)r=r-e(r)/t(r);return r}function YO(e,t){return e*Math.sqrt(1-t*t)}const WK=["duration","bounce"],ZK=["stiffness","damping","mass"];function xz(e,t){return t.some(a=>e[a]!==void 0)}function KK(e){let t={velocity:Ka.velocity,stiffness:Ka.stiffness,damping:Ka.damping,mass:Ka.mass,isResolvedFromDuration:!1,...e};if(!xz(e,ZK)&&xz(e,WK))if(e.visualDuration){const a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,c=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Ka.mass,stiffness:o,damping:c}}else{const a=GK(e);t={...t,...a,mass:Ka.mass},t.isResolvedFromDuration=!0}return t}function ux(e=Ka.visualDuration,t=Ka.bounce){const a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=a;const c=a.keyframes[0],f=a.keyframes[a.keyframes.length-1],m={done:!1,value:c},{stiffness:g,damping:p,mass:y,duration:S,velocity:E,isResolvedFromDuration:T}=KK({...a,velocity:-Js(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,D=Js(Math.sqrt(g/y)),_=Math.abs(A)<5;r||(r=_?Ka.restSpeed.granular:Ka.restSpeed.default),o||(o=_?Ka.restDelta.granular:Ka.restDelta.default);let j;if(M<1){const N=YO(D,M);j=L=>{const B=Math.exp(-M*D*L);return f-B*((O+M*D*A)/N*Math.sin(N*L)+A*Math.cos(N*L))}}else if(M===1)j=N=>f-Math.exp(-D*N)*(A+(O+D*A)*N);else{const N=D*Math.sqrt(M*M-1);j=L=>{const B=Math.exp(-M*D*L),z=Math.min(N*L,300);return f-B*((O+M*D*A)*Math.sinh(z)+N*A*Math.cosh(z))/N}}const V={calculatedDuration:T&&S||null,next:N=>{const L=j(N);if(T)m.done=N>=S;else{let B=N===0?O:0;M<1&&(B=N===0?is(O):Sz(j,N,L));const z=Math.abs(B)<=r,U=Math.abs(f-L)<=o;m.done=z&&U}return m.value=m.done?f:L,m},toString:()=>{const N=Math.min(GO(V),sx),L=bz(B=>V.next(N*B).value,N,30);return N+"ms "+L},toTransition:()=>{}};return V}ux.applyToOptions=e=>{const t=FK(e,100,ux);return e.ease=t.ease,e.duration=is(t.duration),e.type="keyframes",e};function WO({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:f,min:m,max:g,restDelta:p=.5,restSpeed:y}){const S=e[0],E={done:!1,value:S},T=z=>m!==void 0&&z<m||g!==void 0&&z>g,O=z=>m===void 0?g:g===void 0||Math.abs(m-z)<Math.abs(g-z)?m:g;let M=a*t;const A=S+M,D=f===void 0?A:f(A);D!==A&&(M=D-S);const _=z=>-M*Math.exp(-z/r),j=z=>D+_(z),V=z=>{const U=_(z),H=j(z);E.done=Math.abs(U)<=p,E.value=E.done?D:H};let N,L;const B=z=>{T(E.value)&&(N=z,L=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return B(0),{calculatedDuration:null,next:z=>{let U=!1;return!L&&N===void 0&&(U=!0,V(z),B(z)),N!==void 0&&z>=N?L.next(z-N):(!U&&V(z),E)}}}function QK(e,t,a){const r=[],o=a||Qu.mix||yz,c=e.length-1;for(let f=0;f<c;f++){let m=o(e[f],e[f+1]);if(t){const g=Array.isArray(t)?t[f]||Sl:t;m=S0(g,m)}r.push(m)}return r}function JK(e,t,{clamp:a=!0,ease:r,mixer:o}={}){const c=e.length;if(Ku(c===t.length,"Both input and output ranges must be the same length","range-length"),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const f=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const m=QK(t,r,o),g=m.length,p=y=>{if(f&&y<e[0])return t[0];let S=0;if(g>1)for(;S<e.length-2&&!(y<e[S+1]);S++);const E=x0(e[S],e[S+1],y);return m[S](E)};return a?y=>p(Zu(e[0],e[c-1],y)):p}function eQ(e,t){const a=e[e.length-1];for(let r=1;r<=t;r++){const o=x0(0,t,r);e.push(Za(a,1,o))}}function tQ(e){const t=[0];return eQ(t,e.length-1),t}function nQ(e,t){return e.map(a=>a*t)}function aQ(e,t){return e.map(()=>t||nz).splice(0,e.length-1)}function Jm({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){const o=pK(r)?r.map(iz):iz(r),c={done:!1,value:t[0]},f=nQ(a&&a.length===t.length?a:tQ(t),e),m=JK(f,t,{ease:Array.isArray(o)?o:aQ(t,o)});return{calculatedDuration:e,next:g=>(c.value=m(g),c.done=g>=e,c)}}const rQ=e=>e!==null;function ZO(e,{repeat:t,repeatType:a="loop"},r,o=1){const c=e.filter(rQ),m=o<0||t&&a!=="loop"&&t%2===1?0:c.length-1;return!m||r===void 0?c[m]:r}const iQ={decay:WO,inertia:WO,tween:Jm,keyframes:Jm,spring:ux};function Cz(e){typeof e.type=="string"&&(e.type=iQ[e.type])}class KO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,a){return this.finished.then(t,a)}}var oQ={};const lQ=e=>e/100;class QO extends KO{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==yo.now()&&this.tick(yo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Cz(t);const{type:a=Jm,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:f=0}=t;let{keyframes:m}=t;const g=a||Jm;oQ.NODE_ENV!=="production"&&g!==Jm&&Ku(m.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${m}`,"spring-two-frames"),g!==Jm&&typeof m[0]!="number"&&(this.mixKeyframes=S0(lQ,yz(m[0],m[1])),m=[0,100]);const p=g({...t,keyframes:m});c==="mirror"&&(this.mirroredGenerator=g({...t,keyframes:[...m].reverse(),velocity:-f})),p.calculatedDuration===null&&(p.calculatedDuration=GO(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}updateTime(t){const a=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(t,a=!1){const{generator:r,totalDuration:o,mixKeyframes:c,mirroredGenerator:f,resolvedDuration:m,calculatedDuration:g}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:S,repeatType:E,repeatDelay:T,type:O,onUpdate:M,finalKeyframe:A}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),a?this.currentTime=t:this.updateTime(t);const D=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?D<0:D>o;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,V=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),H=z%1;!H&&z>=1&&(H=1),H===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(H=1-H,T&&(H-=T/m)):E==="mirror"&&(V=f)),j=Zu(0,1,H)*m}const N=_?{done:!1,value:y[0]}:V.next(j);c&&(N.value=c(N.value));let{done:L}=N;!_&&g!==null&&(L=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return B&&O!==WO&&(N.value=ZO(y,this.options,A,this.speed)),M&&M(N.value),B&&this.finish(),N}then(t,a){return this.finished.then(t,a)}get duration(){return Js(this.calculatedDuration)}get time(){return Js(this.currentTime)}set time(t){t=is(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(yo.now());const a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=Js(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=kK,startTime:a}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=a??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(yo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function sQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hd=e=>e*180/Math.PI,JO=e=>{const t=Hd(Math.atan2(e[1],e[0]));return eR(t)},uQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JO,rotateZ:JO,skewX:e=>Hd(Math.atan(e[1])),skewY:e=>Hd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},eR=e=>(e=e%360,e<0&&(e+=360),e),Ez=JO,wz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Tz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),cQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:wz,scaleY:Tz,scale:e=>(wz(e)+Tz(e))/2,rotateX:e=>eR(Hd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Hd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Hd(Math.atan(e[4])),skewY:e=>Hd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tR(e){return e.includes("scale")?1:0}function nR(e,t){if(!e||e==="none")return tR(t);const a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(a)r=cQ,o=a;else{const m=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=uQ,o=m}if(!o)return tR(t);const c=r[t],f=o[1].split(",").map(dQ);return typeof c=="function"?c(f):f[c]}const fQ=(e,t)=>{const{transform:a="none"}=getComputedStyle(e);return nR(a,t)};function dQ(e){return parseFloat(e.trim())}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],tp=new Set(ep),Oz=e=>e===Km||e===on,hQ=new Set(["x","y","z"]),mQ=ep.filter(e=>!hQ.has(e));function pQ(e){const t=[];return mQ.forEach(a=>{const r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}const Pd={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nR(t,"x"),y:(e,{transform:t})=>nR(t,"y")};Pd.translateX=Pd.x,Pd.translateY=Pd.y;const Ud=new Set;let aR=!1,rR=!1,iR=!1;function Rz(){if(rR){const e=Array.from(Ud).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{const o=pQ(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=a.get(r);o&&o.forEach(([c,f])=>{r.getValue(c)?.set(f)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rR=!1,aR=!1,Ud.forEach(e=>e.complete(iR)),Ud.clear()}function Az(){Ud.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rR=!0)})}function gQ(){iR=!0,Az(),Rz(),iR=!1}class oR{constructor(t,a,r,o,c,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=c,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(Ud.add(this),aR||(aR=!0,Pa.read(Az),Pa.resolveKeyframes(Rz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;if(t[0]===null){const c=o?.get(),f=t[t.length-1];if(c!==void 0)t[0]=c;else if(r&&a){const m=r.readValue(a,f);m!=null&&(t[0]=m)}t[0]===void 0&&(t[0]=f),o&&c===void 0&&o.set(t[0])}sQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ud.delete(this)}cancel(){this.state==="scheduled"&&(Ud.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const vQ=e=>e.startsWith("--");function yQ(e,t,a){vQ(t)?e.style.setProperty(t,a):e.style[t]=a}const bQ=_O(()=>window.ScrollTimeline!==void 0),SQ={};function xQ(e,t){const a=_O(e);return()=>SQ[t]??a()}const Mz=xQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),R0=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,_z={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:R0([0,.65,.55,1]),circOut:R0([.55,0,1,.45]),backIn:R0([.31,.01,.66,-.59]),backOut:R0([.33,1.53,.69,.99])};function Dz(e,t){if(e)return typeof e=="function"?Mz()?bz(e,t):"ease-out":az(e)?R0(e):Array.isArray(e)?e.map(a=>Dz(a,t)||_z.easeOut):_z[e]}function CQ(e,t,a,{delay:r=0,duration:o=300,repeat:c=0,repeatType:f="loop",ease:m="easeOut",times:g}={},p=void 0){const y={[t]:a};g&&(y.offset=g);const S=Dz(m,o);Array.isArray(S)&&(y.easing=S);const E={delay:r,duration:o,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:c+1,direction:f==="reverse"?"alternate":"normal"};return p&&(E.pseudoElement=p),e.animate(y,E)}function Nz(e){return typeof e=="function"&&"applyToOptions"in e}function EQ({type:e,...t}){return Nz(e)&&Mz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class wQ extends KO{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:a,name:r,keyframes:o,pseudoElement:c,allowFlatten:f=!1,finalKeyframe:m,onComplete:g}=t;this.isPseudoElement=!!c,this.allowFlatten=f,this.options=t,Ku(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=EQ(t);this.animation=CQ(a,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=ZO(o,this.options,m,this.speed);this.updateMotionValue?this.updateMotionValue(y):yQ(a,r,y),this.animation.cancel()}g?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Js(Number(t))}get time(){return Js(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=is(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&bQ()?(this.animation.timeline=t,Sl):a(this)}}const $z={anticipate:J6,backInOut:Q6,circInOut:tz};function TQ(e){return e in $z}function OQ(e){typeof e.ease=="string"&&TQ(e.ease)&&(e.ease=$z[e.ease])}const zz=10;class RQ extends wQ{constructor(t){OQ(t),Cz(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:a,onUpdate:r,onComplete:o,element:c,...f}=this.options;if(!a)return;if(t!==void 0){a.set(t);return}const m=new QO({...f,autoplay:!1}),g=is(this.finishedTime??this.time);a.setWithVelocity(m.sample(g-zz).value,m.sample(g).value,zz),m.stop()}}const jz=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rf.test(e)||e==="0")&&!e.startsWith("url("));function AQ(e){const t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function MQ(e,t,a,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],f=jz(o,t),m=jz(c,t);return Zm(f===m,`You are trying to animate ${t} from "${o}" to "${c}". "${f?c:o}" is not an animatable value.`,"value-not-animatable"),!f||!m?!1:AQ(e)||(a==="spring"||Nz(a))&&r}const _Q=new Set(["opacity","clipPath","filter","transform"]),DQ=_O(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function NQ(e){const{motionValue:t,name:a,repeatDelay:r,repeatType:o,damping:c,type:f}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:p}=t.owner.getProps();return DQ()&&a&&_Q.has(a)&&(a!=="transform"||!p)&&!g&&!r&&o!=="mirror"&&c!==0&&f!=="inertia"}const $Q=40;class zQ extends KO{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:f="loop",keyframes:m,name:g,motionValue:p,element:y,...S}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yo.now();const E={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:c,repeatType:f,name:g,motionValue:p,element:y,...S},T=y?.KeyframeResolver||oR;this.keyframeResolver=new T(m,(O,M,A)=>this.onKeyframesResolved(O,M,E,!A),g,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,a,r,o){this.keyframeResolver=void 0;const{name:c,type:f,velocity:m,delay:g,isHandoff:p,onUpdate:y}=r;this.resolvedAt=yo.now(),MQ(t,c,f,m)||((Qu.instantAnimations||!g)&&y?.(ZO(t,r,a)),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const E={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>$Q?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...r,keyframes:t},T=!p&&NQ(E)?new RQ({...E,element:E.motionValue.owner.current}):new QO(E);T.finished.then(()=>this.notifyFinished()).catch(Sl),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,a){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gQ()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const jQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LQ(e){const t=jQ.exec(e);if(!t)return[,];const[,a,r,o]=t;return[`--${a??r}`,o]}const VQ=4;function Lz(e,t,a=1){Ku(a<=VQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,o]=LQ(e);if(!r)return;const c=window.getComputedStyle(t).getPropertyValue(r);if(c){const f=c.trim();return k6(f)?parseFloat(f):f}return VO(o)?Lz(o,t,a+1):o}function lR(e,t){return e?.[t]??e?.default??e}const Vz=new Set(["width","height","top","left","right","bottom",...ep]),BQ={test:e=>e==="auto",parse:e=>e},Bz=e=>t=>t.test(e),Hz=[Km,on,eu,af,RK,OK,BQ],Pz=e=>Hz.find(Bz(e));function HQ(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||q6(e):!0}const PQ=new Set(["brightness","contrast","saturate","opacity"]);function UQ(e){const[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=a.match(BO)||[];if(!r)return e;const o=a.replace(r,"");let c=PQ.has(t)?1:0;return r!==a&&(c*=100),t+"("+c+o+")"}const IQ=/\b([a-z-]*)\(.*?\)/gu,sR={...rf,getAnimatableNone:e=>{const t=e.match(IQ);return t?t.map(UQ).join(" "):e}},Uz={...Km,transform:Math.round},uR={borderWidth:on,borderTopWidth:on,borderRightWidth:on,borderBottomWidth:on,borderLeftWidth:on,borderRadius:on,radius:on,borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomRightRadius:on,borderBottomLeftRadius:on,width:on,maxWidth:on,height:on,maxHeight:on,top:on,right:on,bottom:on,left:on,padding:on,paddingTop:on,paddingRight:on,paddingBottom:on,paddingLeft:on,margin:on,marginTop:on,marginRight:on,marginBottom:on,marginLeft:on,backgroundPositionX:on,backgroundPositionY:on,...{rotate:af,rotateX:af,rotateY:af,rotateZ:af,scale:ox,scaleX:ox,scaleY:ox,scaleZ:ox,skew:af,skewX:af,skewY:af,distance:on,translateX:on,translateY:on,translateZ:on,x:on,y:on,z:on,perspective:on,transformPerspective:on,opacity:E0,originX:uz,originY:uz,originZ:on},zIndex:Uz,fillOpacity:E0,strokeOpacity:E0,numOctaves:Uz},kQ={...uR,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:sR,WebkitFilter:sR},Iz=e=>kQ[e];function kz(e,t){let a=Iz(e);return a!==sR&&(a=rf),a.getAnimatableNone?a.getAnimatableNone(t):void 0}const FQ=new Set(["auto","none","0"]);function qQ(e,t,a){let r=0,o;for(;r<e.length&&!o;){const c=e[r];typeof c=="string"&&!FQ.has(c)&&O0(c).values.length&&(o=e[r]),r++}if(o&&a)for(const c of t)e[c]=kz(a,o)}class GQ extends oR{constructor(t,a,r,o,c){super(t,a,r,o,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),VO(p))){const y=Lz(p,a.current);y!==void 0&&(t[g]=y),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Vz.has(r)||t.length!==2)return;const[o,c]=t,f=Pz(o),m=Pz(c);if(f!==m)if(Oz(f)&&Oz(m))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Pd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||HQ(t[o]))&&r.push(o);r.length&&qQ(t,r,a)}measureInitialState(){const{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pd[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;const o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){const{element:t,name:a,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(a);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,f=r[c];r[c]=Pd[a](t.measureViewportBox(),window.getComputedStyle(t.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([m,g])=>{t.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function XQ(e,t,a){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=a?.[e]??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const Fz=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function qz(e){return F6(e)&&"offsetHeight"in e}var YQ={};const Gz=30,WQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const c=yo.now();if(this.updatedAt!==c&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const f of this.dependents)f.dirty();o&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=yo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=WQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return YQ.NODE_ENV!=="production"&&NO(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new DO);const r=this.events[t].add(a);return t==="change"?()=>{r(),Pa.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=yo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Gz)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,Gz);return G6(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function np(e,t){return new ZQ(e,t)}const{schedule:cR}=oz(queueMicrotask,!1),os={x:!1,y:!1};function Xz(){return os.x||os.y}function KQ(e){return e==="x"||e==="y"?os[e]?null:(os[e]=!0,()=>{os[e]=!1}):os.x||os.y?null:(os.x=os.y=!0,()=>{os.x=os.y=!1})}function Yz(e,t){const a=XQ(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function Wz(e){return!(e.pointerType==="touch"||Xz())}function QQ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{if(!Wz(m))return;const{target:g}=m,p=t(g,m);if(typeof p!="function"||!g)return;const y=S=>{Wz(S)&&(p(S),g.removeEventListener("pointerleave",y))};g.addEventListener("pointerleave",y,o)};return r.forEach(m=>{m.addEventListener("pointerenter",f,o)}),c}const Zz=(e,t)=>t?e===t?!0:Zz(e,t.parentElement):!1,fR=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,JQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eJ(e){return JQ.has(e.tagName)||e.tabIndex!==-1}const cx=new WeakSet;function Kz(e){return t=>{t.key==="Enter"&&e(t)}}function dR(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tJ=(e,t)=>{const a=e.currentTarget;if(!a)return;const r=Kz(()=>{if(cx.has(a))return;dR(a,"down");const o=Kz(()=>{dR(a,"up")}),c=()=>dR(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",c,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function Qz(e){return fR(e)&&!Xz()}function nJ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{const g=m.currentTarget;if(!Qz(m))return;cx.add(g);const p=t(g,m),y=(T,O)=>{window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",E),cx.has(g)&&cx.delete(g),Qz(T)&&typeof p=="function"&&p(T,{success:O})},S=T=>{y(T,g===window||g===document||a.useGlobalTarget||Zz(g,T.target))},E=T=>{y(T,!1)};window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",E,o)};return r.forEach(m=>{(a.useGlobalTarget?window:m).addEventListener("pointerdown",f,o),qz(m)&&(m.addEventListener("focus",p=>tJ(p,o)),!eJ(m)&&!m.hasAttribute("tabindex")&&(m.tabIndex=0))}),c}function Jz(e){return F6(e)&&"ownerSVGElement"in e}function aJ(e){return Jz(e)&&e.tagName==="svg"}const Ti=e=>!!(e&&e.getVelocity),rJ=[...Hz,xr,rf],iJ=e=>rJ.find(Bz(e)),hR=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class oJ extends x.Component{getSnapshotBeforeUpdate(t){const a=this.props.childRef.current;if(a&&t.isPresent&&!this.props.isPresent){const r=a.offsetParent,o=qz(r)&&r.offsetWidth||0,c=this.props.sizeRef.current;c.height=a.offsetHeight||0,c.width=a.offsetWidth||0,c.top=a.offsetTop,c.left=a.offsetLeft,c.right=o-c.width-c.left}return null}componentDidUpdate(){}render(){return this.props.children}}function lJ({children:e,isPresent:t,anchorX:a,root:r}){const o=x.useId(),c=x.useRef(null),f=x.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:m}=x.useContext(hR);return x.useInsertionEffect(()=>{const{width:g,height:p,top:y,left:S,right:E}=f.current;if(t||!c.current||!g||!p)return;const T=a==="left"?`left: ${S}`:`right: ${E}`;c.current.dataset.motionPopId=o;const O=document.createElement("style");m&&(O.nonce=m);const M=r??document.head;return M.appendChild(O),O.sheet&&O.sheet.insertRule(`
|
|
645
645
|
[data-motion-pop-id="${o}"] {
|
|
646
646
|
position: absolute !important;
|
|
647
647
|
width: ${g}px !important;
|