@flowengage/react-chatbot 8.0.84 → 8.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@
22
22
  box-shadow: none !important;
23
23
  transition: outline-color 0.25s ease, box-shadow 0.25s ease !important;
24
24
  }
25
- `,document.head.appendChild(e)};function Yn(e,t){if(typeof document>`u`)return null;if(e){let n=document.getElementById(e)||document.querySelector(`[data-section="${e}"]`);if(n)return n;t||=e.replace(/[-_]+/g,` `).trim()}if(!t)return null;let n=t.toLowerCase().trim(),r=n.split(/\s+/).filter(e=>e.length>2),i=Array.from(document.querySelectorAll(`h1.h2.h3.h4.h5.h6.[data-section].section[id].[id].main li.article li.[role='main'] li.[class*='card'].[class*='Card'].[class*='feature'].[class*='Feature'].[class*='tier'].[class*='Tier'].[class*='plan'].[class*='Plan'].[class*='pricing'].[class*='Pricing'].[class*='testimonial'].[class*='Testimonial'].[class*='team'].[class*='Team'].[class*='service'].[class*='Service'].[class*='block'].[role='listitem'].[role='article'].[role='region'].dt.dd`.split(`.`).join(`, `))).filter(e=>{if(_n(e))return!1;let t=e.textContent.trim();return!(t.length<3||t.length>5e3||e.closest(`nav, footer, header, aside, .nav, .footer, .header`))});for(let e of i)if(vn(e).toLowerCase()===n)return e;for(let e of i){let t=vn(e).toLowerCase();if(t.startsWith(n)||t.endsWith(n))return e}let a=[];for(let e of i){let t=vn(e).toLowerCase();t.includes(n)&&a.push({el:e,len:t.length})}if(a.length)return a.sort((e,t)=>e.len-t.len),a[0].el;for(let e of i){let t=vn(e).toLowerCase();if(t.length>3&&n.includes(t))return e}if(r.length>0){let e=null,t=0;for(let n of i){let i=vn(n).toLowerCase(),a=0;for(let e of r)i.includes(e)&&a++;let o=a/r.length;o>t&&o>=.6&&(t=o,e=n)}if(e)return e}let o=Array.from(document.querySelectorAll(`main [role='group']`)).filter(e=>!_n(e)),s=[];for(let e of o){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();t.length<15||t.length>8e3||t.includes(n)&&s.push({el:e,len:t.length})}if(s.length)return s.sort((e,t)=>e.len-t.len),s[0].el;if(r.length>0){let e=Array.from(document.querySelectorAll(`main a[href], article a[href], .views-row a[href], h2 a[href], h3 a[href], .card a[href], [class*='teaser'] a[href]`)).filter(e=>{if(_n(e))return!1;try{let t=e.getAttribute(`href`)||``;if(!t||t===`#`||t.startsWith(`javascript:`))return!1}catch{return!1}let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>=3&&t.length<=220}),t=null,n=0;for(let i of e){let e=i.textContent.replace(/\s+/g,` `).toLowerCase(),a=0;for(let t of r)e.includes(t)&&a++;let o=a/r.length;o>n&&o>=.5&&(n=o,t=i)}if(t)return t.closest(`article`)||t.closest(`.views-row`)||t}let c=document.querySelectorAll(`section, article, .card, [class*='feature'], [class*='service']`);for(let e of c){if(_n(e))continue;let t=e.querySelector(`h1, h2, h3, h4, h5, h6`);if(t){let r=t.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(r.includes(n)||n.includes(r))return e}}let l=document.querySelectorAll(`li, strong, blockquote, dt`);for(let e of l){if(_n(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e.tagName===`STRONG`&&e.parentElement?.tagName===`LI`?e.parentElement:e}let u=Array.from(document.querySelectorAll(`a[href]`)).filter(e=>!_n(e));u.sort((e,t)=>(e.textContent||``).trim().length-(t.textContent||``).trim().length);for(let e of u){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e}let d=document.querySelectorAll(`p`);for(let e of d){if(_n(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<800)return e}return null}function Xn(e,{speaking:t=!1,scroll:n=!0}={}){if(!e||typeof document>`u`)return;Jn();let r=document.querySelectorAll(`.fe-highlight-section`);for(let t of r)t!==e&&(t.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`),t.classList.add(`fe-highlight-exiting`),setTimeout(()=>t.classList.remove(`fe-highlight-exiting`),300));if(e.classList.remove(`fe-highlight-exiting`),e.classList.add(`fe-highlight-section`),t?e.classList.add(`fe-highlight-speaking`):e.classList.remove(`fe-highlight-speaking`),n)try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{try{e.scrollIntoView(!0)}catch{}}}function Zn(){typeof document>`u`||(document.querySelectorAll(`.fe-highlight-section, .fe-highlight-exiting`).forEach(e=>e.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`,`fe-highlight-exiting`)),hn())}function Qn(e){if(typeof window>`u`)return e;try{let t=new URL(String(e).trim(),window.location.href);return!/^https?:$/i.test(t.protocol)||t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href}catch{return e}}async function $n(e){if(typeof window>`u`)return!1;try{let t=new URL(String(e).trim(),window.location.href),n=t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href;return(await fetch(n,{method:`HEAD`,mode:`same-origin`,cache:`no-store`})).ok}catch{return!1}}async function er(e,{siteId:t,apiBaseUrl:n}){if(!e)return{allowed:!1,correctedUrl:null};let r=!1;try{r=!!Pn()}catch{r=!1}let i=async()=>({allowed:r?!1:await $n(e),correctedUrl:null});if(!t||!n)return console.warn(`[FlowEngage] shouldProceedWithNavigation: missing siteId or apiBaseUrl`),i();let a=String(n).replace(/\/$/,``),o=new URLSearchParams({siteId:String(t),url:String(e).trim()});try{let e=await(await fetch(`${a}/api/widget/navigate-allowed?${o.toString()}`)).json().catch(()=>({}));return e.success&&e.allowed?{allowed:!0,correctedUrl:e.correctedUrl||null}:i()}catch(e){return console.warn(`[FlowEngage] navigate-allowed check failed:`,e?.message),i()}}function tr(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(yn,JSON.stringify({sectionText:e,ts:Date.now()}))}catch{}}async function nr(e,{skipPushState:t=!1,isBack:n=!1}={}){if(typeof window>`u`||typeof document>`u`)return!1;try{if(new URL(e,window.location.href).origin!==window.location.origin)return!1}catch{return!1}Gn();let r=new AbortController,i=setTimeout(()=>r.abort(),8e3);try{let a=await fetch(e,{credentials:`same-origin`,cache:`no-store`,signal:r.signal});if(clearTimeout(i),!a.ok)return Kn(),!1;let o=await a.text(),s=new DOMParser().parseFromString(o,`text/html`),c=document.getElementById(`flowengage-root`);if(!c)return Kn(),!1;try{typeof window.Drupal?.detachBehaviors==`function`&&window.Drupal.detachBehaviors(document.body,window.drupalSettings)}catch{}document.querySelectorAll(`script`).forEach(e=>{e.setAttribute(`data-fe-original`,`true`)}),Array.from(document.body.children).forEach(e=>{if(e===c)return;let t=e.tagName?.toUpperCase();t===`AUDIO`||t===`VIDEO`||e.remove()}),In();let l=new Set(Array.from(document.querySelectorAll(`link[rel='stylesheet']`)).map(e=>{try{return new URL(e.getAttribute(`href`)||``,window.location.href).href}catch{return``}}));for(let t of Array.from(s.head.querySelectorAll(`link[rel='stylesheet']`))){let n=t.getAttribute(`href`);if(!n)continue;let r;try{r=new URL(n,e).href}catch{continue}if(l.has(r))continue;let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=r,i.setAttribute(Fn,`true`),t.media&&(i.media=t.media),document.head.appendChild(i)}for(let e of Array.from(s.head.querySelectorAll(`style`))){if(!e.textContent.trim())continue;let t=e.textContent.trim().slice(0,120);if(Array.from(document.head.querySelectorAll(`style:not([data-fe-swap-css])`)).some(e=>e.textContent.trim().slice(0,120)===t))continue;let n=document.createElement(`style`);n.textContent=e.textContent,n.setAttribute(Fn,`true`),document.head.appendChild(n)}Array.from(s.body.children).forEach(e=>{e.tagName?.toUpperCase()!==`SCRIPT`&&document.body.insertBefore(document.importNode(e,!0),c)});let u=document.querySelectorAll(`script:not([data-fe-replayed])`);for(let e of u){if(e.closest(`#flowengage-root, .flowengage-shell`)||e.hasAttribute(`data-fe-original`)||e.hasAttribute(`data-fe-replayed`))continue;let t=e.getAttribute(`src`),n=e.getAttribute(`type`)||``;if(!(n&&n!==`text/javascript`&&n!==``&&!n.includes(`drupal-ajax`))){if(n.includes(`drupal-ajax`)){e.setAttribute(`data-fe-replayed`,`true`);try{let t=JSON.parse(e.textContent);if(Array.isArray(t))for(let e of t){if((e.command===`insert`||e.command===`insert_new_content`)&&e.selector&&e.data){let t=document.querySelector(e.selector);t&&(e.method===`replaceWith`?t.outerHTML=e.data:e.method===`html`||e.method===`replace`?t.innerHTML=e.data:e.method===`append`?t.insertAdjacentHTML(`beforeend`,e.data):e.method===`prepend`?t.insertAdjacentHTML(`afterbegin`,e.data):t.innerHTML=e.data,q(`trySpaNavigate: BigPipe replacement →`,e.selector))}if(e.command===`settings`&&e.settings)try{window.drupalSettings&&typeof window.drupalSettings==`object`&&Object.assign(window.drupalSettings,e.settings)}catch{}}}catch(e){q(`trySpaNavigate: BigPipe parse error:`,e.message)}continue}if(!t&&e.textContent.trim()){let t=e.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(t)){e.setAttribute(`data-fe-replayed`,`true`);continue}let n=document.createElement(`script`);n.textContent=t,n.setAttribute(`data-fe-replayed`,`true`),e.parentNode.replaceChild(n,e)}}}try{for(let e of Array.from(s.querySelectorAll(`script`))){let t=(e.textContent||``).match(/drupalSettings\s*[,=]\s*(\{[\s\S]*?\})\s*[;)]/);if(t){try{let e=JSON.parse(t[1]);window.drupalSettings&&typeof window.drupalSettings==`object`?Object.assign(window.drupalSettings,e):window.drupalSettings=e,q(`trySpaNavigate: updated drupalSettings from new page`)}catch{}break}}}catch{}let d=window.location.assign.bind(window.location),f=window.location.replace.bind(window.location),p=!0;window.location.assign=e=>{if(p){q(`trySpaNavigate: blocked location.assign from replayed script:`,e);return}return d(e)},window.location.replace=e=>{if(p){q(`trySpaNavigate: blocked location.replace from replayed script:`,e);return}return f(e)};function m(e){let t=e.toLowerCase();return!!(/\/jquery[.\-\/]/.test(t)||/\/jquery\.min\.js/.test(t)||/\/jquery-once/.test(t)||/\/jquery\.once/.test(t)||/\/jquery\.ui[\./]/.test(t)||/\/jqueryui/.test(t)||/\/core\/misc\//.test(t)||/\/core\/modules\//.test(t)||/\/misc\/drupal\.js/.test(t)||/\/lodash[.\-\/]/.test(t)||/\/underscore[.\-\/]/.test(t)||/\/backbone[.\-\/]/.test(t)||/\/modernizr[.\-\/]/.test(t)||/\/popper[.\-\/]/.test(t)||/\/bootstrap\.min\.js/.test(t)||/\/bootstrap\.bundle/.test(t))}let h=new Set(Array.from(document.querySelectorAll(`script[src]`)).map(e=>{try{return new URL(e.getAttribute(`src`)||``,window.location.href).href}catch{return``}}));function g(t,n){let r=t.getAttribute(`src`)||``;if(r.includes(`flowengage`))return;let i=document.createElement(`script`);if(r){let n;try{n=new URL(r,e).href}catch{return}if(h.has(n)){if(m(n))return;q(`trySpaNavigate: re-running theme/custom script:`,n)}h.add(n),i.src=n,i.async=t.async,i.defer=t.defer}else if(t.textContent.trim()){let e=t.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(e)){q(`trySpaNavigate: skipping inline script with navigation:`,e.slice(0,120));return}if(/^\s*\(?\s*(?:window\.)?drupalSettings\s*[,=]/.test(e))return;i.textContent=e}else return;let a=t.getAttribute(`type`);a&&a!==`text/javascript`&&a!==``&&(i.type=a),n.parentNode.insertBefore(i,n)}for(let e of Array.from(s.head.querySelectorAll(`script`)))g(e,c);for(let e of Array.from(s.body.querySelectorAll(`script`)))g(e,c);try{typeof window.Drupal?.attachBehaviors==`function`&&window.Drupal.attachBehaviors(document.body,window.drupalSettings)}catch{}try{typeof window.jQuery==`function`&&(window.jQuery(document).trigger(`ready`),window.dispatchEvent(new Event(`resize`)))}catch{}try{document.dispatchEvent(new Event(`DOMContentLoaded`,{bubbles:!0,cancelable:!1}))}catch{}try{window.dispatchEvent(new Event(`load`))}catch{}try{let e=document.querySelectorAll(`iframe:not([data-fe-skip-reload])`);for(let t of e){if(t.closest(`#flowengage-root, .flowengage-shell`))continue;let e=t.getAttribute(`src`)||t.src;e&&e!==`about:blank`&&!e.startsWith(`javascript:`)&&(q(`trySpaNavigate: reloading iframe:`,e),t.src=e)}}catch{}try{let e=document.querySelectorAll(`.g-recaptcha, [data-sitekey]`);if(e.length>0){if(typeof window.grecaptcha?.render==`function`){for(let t of e)if(!t.closest(`#flowengage-root`)){t.innerHTML=``;try{window.grecaptcha.render(t,{sitekey:t.getAttribute(`data-sitekey`)||``}),q(`trySpaNavigate: re-rendered reCAPTCHA`)}catch{}}}else if(!document.querySelector(`script[src*='recaptcha']`)){let e=document.createElement(`script`);e.src=`https://www.google.com/recaptcha/api.js?render=explicit`,e.async=!0,document.head.appendChild(e),q(`trySpaNavigate: injected reCAPTCHA script`)}}}catch{}if(setTimeout(()=>{p=!1,window.location.assign=d,window.location.replace=f},2e3),s.title&&(document.title=s.title),!t)try{history.pushState({flowengageSpa:!0},``,e)}catch{}if(kn(),jn(),n){try{zn()}catch{}try{Hn()}catch{}}else window.scrollTo(0,0);Kn(),Un(e);try{sessionStorage.removeItem(yn)}catch{}try{sessionStorage.removeItem(xn)}catch{}try{On=new URL(e,window.location.origin).pathname}catch{}return q(`trySpaNavigate: succeeded →`,e),!0}catch{return clearTimeout(i),Kn(),!1}}function rr(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(xn,JSON.stringify({voiceWasActive:!0,targetUrl:String(e),ts:Date.now()}))}catch{}}function ir(){if(!(typeof sessionStorage>`u`))try{sessionStorage.removeItem(xn)}catch{}}function ar(){if(typeof window>`u`||typeof sessionStorage>`u`)return{shouldResumeVoice:!1,targetUrl:null};let e;try{e=JSON.parse(sessionStorage.getItem(xn)||`null`)}catch{return{shouldResumeVoice:!1,targetUrl:null}}if(!e)return{shouldResumeVoice:!1,targetUrl:null};try{sessionStorage.removeItem(xn)}catch{}return e.voiceWasActive?Date.now()-e.ts>Sn?(q(`initVoiceNavResume: state expired, skipping`),{shouldResumeVoice:!1,targetUrl:null}):(q(`initVoiceNavResume: voice was active during navigation to`,e.targetUrl),{shouldResumeVoice:!0,targetUrl:e.targetUrl||null}):{shouldResumeVoice:!1,targetUrl:null}}function or(){if(typeof document>`u`)return!1;let e=/(^|\W)(404|page not found|not found|page (?:doesn'?t|does not) exist|no longer exists|couldn'?t find (?:this|that|the) page|error 404|oops[!,. ].*(?:not found|doesn'?t exist))(\W|$)/i,t=(document.title||``).trim();if(t&&e.test(t))return!0;let n=document.querySelector(`main, [role="main"], #content, .content`)||document.body;if(n){let t=n.querySelectorAll(`h1, h2`);for(let n of t){let t=(n.textContent||``).replace(/\s+/g,` `).trim();if(t&&t.length<80&&e.test(t))return!0}}return!1}async function sr(e,t={}){if(typeof window>`u`)return{navigated:!1};let{sectionText:n,voiceActive:r=!1}=t;try{let t=Qn(e),i=new URL(t,window.location.origin);if(i.hash&&i.pathname===window.location.pathname){let e=document.getElementById(i.hash.slice(1));if(e)return e.scrollIntoView({behavior:`smooth`,block:`start`}),{navigated:!0}}if(i.pathname===window.location.pathname&&i.search===window.location.search&&!i.hash)return{navigated:!1,reason:`already-on-page`};let a=i.pathname+i.search+i.hash,o=window.next?.router;if(o?.push)return new Promise(e=>{let t=()=>{o.events?.off(`routeChangeComplete`,t),e({navigated:!0})};o.events?.on(`routeChangeComplete`,t),o.push(a),setTimeout(t,5e3)});if(window.__NEXT_ROUTER__?.push)return window.__NEXT_ROUTER__.push(a),{navigated:!0};if(Pn()){n&&tr(n);let e=window.location.href;try{window.history.pushState({},``,i.href),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}if(await new Promise(e=>setTimeout(e,400)),or()){try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}return n&&tr(n),r||_e(),window.location.assign(i.href),{navigated:!0}}return{navigated:!0}}return n&&tr(n),r||_e(),window.location.assign(i.href),{navigated:!0}}catch(t){console.warn(`[FlowEngage] shadowNavigate error:`,t),n&&tr(n);try{window.location.href=Qn(e)}catch{window.location.href=e}return{navigated:!0}}}var cr=!1,lr=null;function ur(e){lr=e,typeof window<`u`&&(window.__fe_triggerVoiceNavHooks=()=>{try{e.onBeforeNavigate()}catch{}}),!cr&&(cr=!0,!(typeof document>`u`)&&(document.addEventListener(`click`,e=>{if(!lr)return;let t=e.target.closest?.(`a[href]`);if(!t||t.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`))return;let n=t.getAttribute(`href`)||``;if(!n||n===`#`||n.startsWith(`javascript:`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||t.hasAttribute(`download`)||t.target===`_blank`||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let r;try{if(r=new URL(n,window.location.href),r.origin!==window.location.origin)return}catch{return}if(!(r.pathname===window.location.pathname&&r.hash)&&!(r.pathname===window.location.pathname&&r.search===window.location.search&&!r.hash)){q(`voice-link-hook: saving state before navigation →`,r.href);try{lr.onBeforeNavigate()}catch{}}},!0),document.addEventListener(`submit`,e=>{if(lr&&!e.target?.closest?.(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`)){q(`voice-form-hook: saving state before form submit`);try{lr.onBeforeNavigate()}catch{}}},!0)))}function dr(){lr=null,q(`voice-nav-hooks: deactivated`)}var fr=e=>!e||typeof e!=`string`?e:e.replace(/<human_assistance_request[^>]*>/gi,``).replace(/<\/human_assistance_request>/gi,``).replace(/<navigate[^>]*\/>/gi,``).replace(/<navigate[^>]*>[\s\S]*?<\/navigate>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*>[\s\S]*?<\/[a-z]+(?:_[a-z]+)+>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*\/>/gi,``).trim(),pr=(e=[])=>e.filter(e=>e.type!==`call_recording`&&!(typeof e.message==`string`&&e.message.includes(`AI chat recording`))).map(e=>({...e,message:fr(e.message),isPending:!1,id:e.messageId||`${e.sender}-${e.timestamp||Date.now()}-${Math.random()}`}));function mr(e){if(!e||typeof e!=`string`)return null;let t=e.match(/<navigate([^>]*?)(?:\/>|>[\s\S]*?<\/navigate>)/i);if(!t)return null;let n=t[1],r=n.match(/url=["']([^"']+)["']/i);if(!r)return null;let i=n.match(/section=["']([^"']+)["']/i)||n.match(/highlight=["']([^"']+)["']/i);return{url:r[1].trim(),section:i?.[1]?.trim()||null}}var hr=(e,t)=>e?typeof e==`string`?e:e.message||e.error||e.reason||t:t,gr=(e={})=>{if(!e?.candidate)return null;if(typeof e.candidate==`object`)return e.candidate;let t=e.sdpMid!==void 0&&e.sdpMid!==null&&e.sdpMid!==``,n=e.sdpMLineIndex!==void 0&&e.sdpMLineIndex!==null;return!t&&!n?null:{candidate:e.candidate,...t?{sdpMid:e.sdpMid}:{},...n?{sdpMLineIndex:e.sdpMLineIndex}:{}}},_r=(e=[],t=`Agent`)=>{for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return t},vr=(e=[],t,n=6)=>!t?.message||e.slice(-n).some(e=>e.sender===`system`&&e.message===t.message)?e:[...e,t];function yr({siteId:e,config:t,children:n,language:r=`en`}){let i=(0,d.useMemo)(()=>e?{...t||{},siteId:e}:t||null,[e,t]),[a,o]=(0,d.useState)(0),[s,c]=(0,d.useState)(`booting`),[l,u]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(``),[x,S]=(0,d.useState)([]),E=(0,d.useCallback)(()=>{S(e=>[...e,{id:`nav-fail-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`I couldn't find that page on our site — could you tell me more about what you're looking for?`,timestamp:new Date().toISOString()}])},[]),ee=(0,d.useCallback)(()=>{S(e=>e.slice(-3).some(e=>(e.sender===`bot`||e.sender===`assistant`)&&/already on (that|this|the)\b/i.test(String(e.message||``)))?e:[...e,{id:`nav-already-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`Looks like you're already on this page!`,timestamp:new Date().toISOString()}])},[]),[te,D]=(0,d.useState)(ie().isOpen),[se,A]=(0,d.useState)(ie().activeScreen),[j,M]=(0,d.useState)(ie().isHumanHandled),[le,N]=(0,d.useState)(ie().agentName),[ue,de]=(0,d.useState)(ie().agentHeadshot),[fe,pe]=(0,d.useState)(()=>ae(i?.siteId)),[me,ge]=(0,d.useState)(!1),[P,_e]=(0,d.useState)(!1),[ve,ye]=(0,d.useState)(`idle`),[be,F]=(0,d.useState)(!1),[xe,Se]=(0,d.useState)(!1),[Ce,I]=(0,d.useState)(``),[L,De]=(0,d.useState)(!1),[R,z]=(0,d.useState)(0),[Oe,ke]=(0,d.useState)(0),[Ae,je]=(0,d.useState)(!1),[B,Me]=(0,d.useState)(null),[Ne,Pe]=(0,d.useState)(null),[Fe,Ie]=(0,d.useState)(`idle`),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(!1),[Ve,He]=(0,d.useState)(``),[Ue,We]=(0,d.useState)(!1),V=(0,d.useRef)(null),H=(0,d.useRef)(null),Ge=(0,d.useRef)(``),U=(0,d.useRef)(!1),Ke=(0,d.useRef)(null),W=(0,d.useRef)(null),G=(0,d.useRef)(null),qe=(0,d.useRef)(null),Je=(0,d.useRef)(null),Ye=(0,d.useRef)(null),Xe=(0,d.useRef)(null),Ze=(0,d.useRef)(!1),Qe=(0,d.useRef)({url:null,at:0}),$e=(0,d.useCallback)((e,t)=>{let n=e;try{n=new URL(e,window.location.origin).href}catch{}let r=Qe.current;return r.url===n&&Date.now()-r.at<4e3?Promise.resolve({navigated:!0,deduped:!0}):(Qe.current={url:n,at:Date.now()},sr(e,t))},[]),et=(0,d.useRef)([]),tt=(0,d.useRef)(null),nt=(0,d.useRef)(null),rt=(0,d.useRef)(null),it=(0,d.useRef)(!1),at=(0,d.useRef)(!1),ot=(0,d.useRef)(``),st=(0,d.useRef)(null),ct=(0,d.useRef)(null),lt=(0,d.useRef)([]),ut=(0,d.useRef)(0),dt=(0,d.useRef)(le),ft=(0,d.useRef)([]),pt=(0,d.useRef)(!1),mt=(0,d.useRef)(!1),ht=(0,d.useRef)(i),gt=(0,d.useRef)({notifyRouteChange:()=>{},cleanup:()=>{}}),_t=(0,d.useCallback)((e={})=>{let t=!!e.is_human_handled;return M(t),t?(A(`agent`),e.agent_info?.name&&N(e.agent_info.name),e.agent_info?.headshot&&de(e.agent_info.headshot),t):(A(`ai`),t)},[]),vt=(0,d.useMemo)(()=>{let e=m?.widgetSettings?.call?.maxDurationSeconds??i?.widgetSettings?.call?.maxDurationSeconds??i?.callMaxDurationSeconds,t=Number(e);return Number.isFinite(t)&&t>0?t:y},[i,m]);(0,d.useEffect)(()=>{W.current=B},[B]),(0,d.useEffect)(()=>{dt.current=le},[le]),(0,d.useEffect)(()=>{mt.current=L},[L]),(0,d.useEffect)(()=>{ht.current=i},[i]);let yt=()=>{He(``)},bt=(0,d.useCallback)(()=>{rt.current&&=(window.clearTimeout(rt.current),null)},[]),xt=e=>{let t=typeof e==`string`?e.trim().toLowerCase():``;return pe(t),oe(t,i?.siteId),t};(0,d.useEffect)(()=>{let e=i?.siteId;if(!e)return;let t=ae(e);if(t){pe(t);return}pe(t=>(t&&oe(t,e),t))},[i?.siteId]);let St=(e=`unspecified`)=>{let t=tt.current||Ye.current?.callId,n=ut.current,r=st.current;if(st.current=null,ut.current=0,r&&r.state!==`inactive`){r.onstop=()=>{let e=lt.current;if(lt.current=[],e.length>0&&t&&H.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;H.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}};try{r.stop()}catch{r.onstop=null,lt.current=[]}}else if(r&&r.state===`inactive`){let e=lt.current;if(lt.current=[],e.length>0&&t&&H.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;H.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}}else lt.current=[];if(ct.current){try{ct.current.close()}catch{}ct.current=null}G.current&&=(G.current.close(),null),qe.current&&=(qe.current.getTracks().forEach(e=>e.stop()),null),Je.current&&=(Je.current.srcObject=null,Je.current.remove(),null),bt(),Ye.current=null,et.current=[],tt.current=null,nt.current=null,it.current=!1,Be(!1),Me(null),Pe(null),Ie(`idle`),Re(null)},Ct=(e=new Date().toISOString())=>{let t=V.current,n=tt.current||Ye.current?.callId;if(!(!t?.connected||!n||it.current)){it.current=!0,t.emit(`call:connected`,{callId:n,chatId:Ge.current,connectedAt:e});try{let e=qe.current,t=Je.current?.srcObject;if(e&&t&&!st.current){lt.current=[];let n=new(window.AudioContext||window.webkitAudioContext);ct.current=n;let r=n.createMediaStreamDestination();n.createMediaStreamSource(e).connect(r),n.createMediaStreamSource(t).connect(r);let i=window.MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:`audio/mp4`,a=new window.MediaRecorder(r.stream,{mimeType:i});a.ondataavailable=e=>{e.data&&e.data.size>0&&lt.current.push(e.data)},st.current=a,ut.current=Date.now(),a.start(1e3),setTimeout(()=>{try{if(!window.speechSynthesis)return;let e=new SpeechSynthesisUtterance(`This call is being recorded for quality and training purposes.`);if(e.rate=.95,e.pitch=1,e.volume=1,window.MediaStreamTrackGenerator||window.AudioContext)try{let t=n.createMediaStreamDestination();e.onstart=()=>{try{let i=document.createElement(`audio`);i.style.display=`none`,i.srcObject=t.stream,document.body.appendChild(i),i.play().catch(()=>{});let a=n.createMediaStreamSource(t.stream);a.connect(r),e.onend=()=>{try{a.disconnect()}catch{}try{i.remove()}catch{}}}catch{}}}catch{}window.speechSynthesis.speak(e)}catch{}},200)}}catch{}}},wt=(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=W.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(bt(),Me(null),t||n){tt.current=e.callId,Pe(e.callId),Ie(e=>e===`connected`?e:`connecting`),D(!0);return}Ie(`idle`)}},Tt=(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=W.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(bt(),n){St();return}nt.current=null,Ye.current=null,et.current=[],Me(null),Ie(`idle`)}},Et=async(e={})=>{let t=G.current,n=V.current,r=e.sdpOffer||e.offer?.sdp;if(!t||!n?.connected||!r||!e.callId){console.log(`[FlowEngageProvider] deferring remote offer until peer/socket ready`,{callId:e.callId,chatId:Ge.current,hasPeerConnection:!!t,socketConnected:!!n?.connected,hasOffer:!!r}),Ye.current=e;return}if(await t.setRemoteDescription(new RTCSessionDescription({type:`offer`,sdp:r})),et.current.length>0){console.log(`[FlowEngageProvider] flushing queued agent ICE candidates after remote offer`,{callId:e.callId,chatId:Ge.current,queuedCount:et.current.length});for(let e of et.current)await t.addIceCandidate(new RTCIceCandidate(e));et.current=[]}let i=await t.createAnswer();await t.setLocalDescription(i),n.emit(`call:answer`,{callId:e.callId,sdpAnswer:i.sdp,chatId:Ge.current})};(0,d.useEffect)(()=>{k({isOpen:te,activeScreen:se,isHumanHandled:j,agentName:le,agentHeadshot:ue})},[te,se,j,le,ue]),(0,d.useEffect)(()=>{let e=!0;return(async()=>{We(!0);try{let t=p(i),n=await Te(t);if(!e)return;let a=t.siteId,o=ne(a),s=ce(a),l=``;try{let e=U.current,r=Ke.current;if(U.current=!1,Ke.current=null,l=(await we({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:a,priorChatId:e||r?null:o||C(),forceNew:e,resumeChatId:r,visitorId:s}))?.data?.chatId,!l)throw Error(`resolve-session returned no chatId`);w(),O(a,l)}catch(e){console.warn(`[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id`,e?.message||e),l=o||T(),O(a,l)}Ge.current=l;let u=Ee({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:t.siteId,visitorId:s});H.current=u,h({...n,apiBaseUrl:t.apiBaseUrl}),_(l);let d=n?.widgetSettings?.branding?.fallbackAgentName||`Agent`,f=sn({apiBaseUrl:t.apiBaseUrl,userId:n.userId,chatId:l,siteId:t.siteId});V.current=f,f.on(`connect`,async()=>{ye(`connected`);let e=Ge.current;if(e&&H.current)try{_t(await H.current.checkHumanHandled(e))}catch{}}),f.on(`disconnect`,()=>{ye(`disconnected`)}),f.on(`aiTyping`,()=>{_e(!0)}),f.on(`ai:typing`,()=>{_e(!0)}),f.on(`messageReceived`,e=>{let t=e.message||e,n={...t,message:fr(t.message)};_e(!1),ge(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&S(e=>[...e.filter(e=>!e.isPending),{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}])}),f.on(`conversationStarted`,e=>{e?.message&&S(t=>[...t,{id:`system-start-${Date.now()}`,sender:`system`,message:e.message,timestamp:new Date().toISOString(),isPending:!1}])}),f.on(`message:new`,e=>{let t=e.message||e,n={...t,message:fr(t.message)};_e(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&((n.sender===`agent`||n.agent_name||n.sender===`ai`||n.sender===`bot`)&&ge(!1),S(e=>n.sender===`bot`||n.sender===`ai`?[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]:e.some(e=>e.id===n.messageId||e.sender===n.sender&&e.message===n.message&&e.isPending)?e.map(e=>e.sender===n.sender&&e.message===n.message&&e.isPending?{...n,isPending:!1,id:n.messageId||e.id}:e):[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]),(n.sender===`agent`||n.agent_name)&&(M(!0),A(`agent`),N(_r([n.agent_name,n.agentName,n.metadata?.agentName],d)),n.sender_headshot&&de(n.sender_headshot),D(!0),z(e=>e+1)))});let m=(e={})=>{let t=_r([e.agent?.name,e.agentName,e.agent_name,dt.current],d);M(!0),A(`agent`),N(t),de(e.agent?.headshot||null),D(!0),z(e=>e+1),S(e=>vr(e,{id:`agent-joined-${Date.now()}`,sender:`system`,message:`${t} has joined the chat.`,timestamp:new Date().toISOString(),isPending:!1}))},g=(e={})=>{let t=_r([e.agent?.name,e.agentName,e.agent_name,dt.current],d);M(!1),A(`ai`),S(e=>vr(e,{id:`agent-left-${Date.now()}`,sender:`system`,message:`${t} has left the chat.`,timestamp:new Date().toISOString(),isPending:!1}))};f.on(`agent:joined`,m),f.on(`agentJoined`,m),f.on(`agent:left`,g),f.on(`agentLeft`,g),f.on(`conversationEnded`,e=>{je(!0);let t=e?.message||`This conversation has ended. Thank you for reaching out!`;S(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:t,timestamp:new Date().toISOString(),isPending:!1}])}),f.on(`chat:history_update`,e=>{let t=pr(e.chat_history||[]);S(t),t.length===0&&(je(!1),M(!1),A(`ai`),_e(!1),ge(!1))}),f.on(`conversation:reset`,()=>{S([]),je(!1),M(!1),A(`ai`),_e(!1),ge(!1)}),f.on(`voice:end_session`,(e={})=>{console.log(`[FlowEngageProvider] voice:end_session received — ending voice session`),ke(e=>e+1),D(!0),z(e=>e+1)}),f.on(`typing:start`,e=>{e.sender===`agent`&&ge(!0)}),f.on(`typing:stop`,e=>{e.sender===`agent`&&ge(!1)}),f.on(`call:incoming`,(e={})=>{let t=_r([e.agentName,e.ownerName,e.agent?.name,dt.current],`Agent`);yt(),bt(),it.current=!1,Me({callId:e.callId,from:e.from||`owner`,agentId:e.agentId||null,agentName:t}),N(e=>_r([t,e],`Agent`)),Ie(`incoming`),Re(null),D(!0)}),f.on(`call:offer`,async(e={})=>{Ye.current=e;try{await Et(e)}catch(e){console.error(`[FlowEngageProvider] failed to apply remote offer`,e)}}),f.on(`call:ice-candidate-from-agent`,async(e={})=>{if(e.candidate)try{let t=gr(e);if(!t){console.warn(`[FlowEngageProvider] ignoring invalid ICE candidate payload`,e);return}if(!G.current||!G.current.remoteDescription){console.log(`[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready`,{callId:e.callId,chatId:e.chatId||Ge.current,queueSize:et.current.length+1}),et.current.push(t);return}await G.current.addIceCandidate(new RTCIceCandidate(t))}catch(e){console.error(`[FlowEngageProvider] failed to add ICE candidate`,e)}}),f.on(`call:ended`,()=>{yt(),St(`socket:call_ended`)}),f.on(`call:accepted`,(e={})=>{wt(e)}),f.on(`call:accepted_by_other`,(e={})=>{wt(e)}),f.on(`call:rejected`,(e={})=>{Tt(e)}),f.on(`call:missed`,(e={})=>{Tt(e)}),f.on(`call:failed`,(e={})=>{Tt(e)}),f.on(`call:connected`,(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=Ye.current?.callId===e.callId,i=W.current?.callId===e.callId;if(!t&&!n&&!r){i&&(Me(null),Ie(`idle`));return}it.current=!0,nt.current=null,tt.current=e.callId,Pe(e.callId),Me(null),Ie(`connected`),Re(e.connectedAt||new Date().toISOString()),D(!0)}),f.on(`call:unavailable`,(e={})=>{St(`socket:call_unavailable`),He(hr(e,`This visitor is not available for a call right now.`)),D(!0)}),f.on(`call:error`,(e={})=>{St(`socket:call_error`),He(hr(e,`We couldn't connect the call right now.`)),D(!0)}),f.on(`visitor:navigate`,async({url:e,section:t,highlight:n}={})=>{e&&$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:r})=>{if(!e){r===`not-found`?E():r===`already-on-page`&&ee();return}let i=t||n;i&&setTimeout(()=>{let e=Yn(null,i);e&&Xn(e)},300)})}),f.on(`visitor:highlight`,({sectionId:e,sectionText:t}={})=>{if(!e&&!t)return;let n=Yn(e||null,t||null);n&&Xn(n)}),f.on(`visitor:clear_highlight`,()=>{Zn()}),gt.current=cn({socket:f,chatId:l});let v=await u.loadHistory(l,r);if(!e)return;S(pr(v.chat_history||[])),M(!!v.is_human_handled),A(v.is_human_handled?`agent`:se);let y=v?.visitor_email||v?.visitorEmail;if(y&&String(y).trim()&&xt(String(y).trim()),await new Promise(e=>setTimeout(e,500)),!e)return;c(`ready`)}catch(t){if(!e)return;u(t),c(`error`)}finally{e&&We(!1)}})(),()=>{e=!1,gt.current?.cleanup?.(),St(),V.current?.disconnect()}},[i,r,a]),(0,d.useEffect)(()=>()=>{if(L&&!pt.current&&ft.current.length>0){let e=Ge.current,t=ft.current,n=H.current;n&&e&&t.length>0&&(console.log(`[FlowEngageProvider] safety-net: syncing voice transcript on unmount`),n.beaconSyncVoice(e,t)||n.syncVoice(e,t).catch(()=>{}),pt.current=!0)}},[L,m]);let Dt=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=H.current;!e||!g||Dt.current!==te&&(te&&Dt.current!==null?e.updateChatStatus(g,`open`).catch(()=>{}):Dt.current===!0&&e.updateChatStatus(g,`widget_closed`).catch(()=>{}),Dt.current=te)},[te,g]),(0,d.useEffect)(()=>{let e=()=>{let e=Ge.current,t=H.current;!e||!t||typeof navigator>`u`||t.beaconWidgetClosed?.(e)||t.updateChatStatus(e,`widget_closed`).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>window.removeEventListener(`pagehide`,e)},[]);let Ot=async()=>{if(!(!B?.callId||!H.current||!V.current||!g)){yt(),nt.current=B.callId,bt();try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});qe.current=e;let t=[{urls:`stun:stun.l.google.com:19302`}];try{let e=await H.current.getIceServersConfig();e?.data?.iceServers?.length&&(t=e.data.iceServers)}catch(e){console.warn(`[FlowEngageProvider] ice-config fetch failed, using STUN default`,e)}let n=new RTCPeerConnection({iceServers:t});G.current=n,n.onconnectionstatechange=()=>{let e=n.connectionState;if(e===`connected`){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),Ct(e);return}if(e===`connecting`){Ie(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&St(`peer:connection_${e}`)},n.oniceconnectionstatechange=()=>{let e=n.iceConnectionState;if(e===`connected`||e===`completed`){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),Ct(e);return}if(e===`checking`||e===`new`){Ie(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&St(`peer:ice_${e}`)},n.onsignalingstatechange=()=>{},n.onicegatheringstatechange=()=>{},e.getTracks().forEach(t=>{n.addTrack(t,e)}),n.onicecandidate=e=>{if(!e.candidate||!V.current?.connected)return;let t=e.candidate;V.current.emit(`call:ice-candidate`,{callId:B.callId,candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,chatId:g,from:`customer`})},n.ontrack=e=>{let[t]=e.streams||[],[n]=t?.getAudioTracks?.()||[];if(!Je.current){let e=document.createElement(`audio`);e.id=`flowengage-remote-audio`,e.autoplay=!0,e.playsInline=!0,e.onplay=()=>{},e.onpause=()=>{},e.onended=()=>{},e.onerror=e=>{},Je.current=e,document.body.appendChild(e)}Je.current.srcObject=e.streams[0];let r=B?.callId,i=r&&(nt.current===r||tt.current===r);if(!it.current&&i){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),tt.current=r,Pe(r),Ct(e)}Je.current.srcObject=t||null;let a=Je.current.play?.();a?.catch&&a.catch(e=>{})};let r=Ye.current;r&&(console.log(`[FlowEngageProvider] found pending remote offer during accept`,{callId:r.callId||B.callId,chatId:g}),await Et({...r,callId:r.callId||B.callId})),await H.current.acceptCall(B.callId,g),V.current?.emit(`call:accepted`,{callId:B.callId,chatId:g}),tt.current=B.callId,Pe(B.callId),Ie(e=>e===`connected`||it.current?`connected`:`connecting`),Me(null),D(!0)}catch(e){if(nt.current=null,St(`accept_call_failed`),e?.status===404||e?.status===409||e?.status===422){He(hr(e,`This visitor call is no longer available.`));return}if(e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`){try{await H.current.rejectCall(B.callId,g)}catch(e){console.error(`[FlowEngageProvider] failed to reject call after microphone denial`,e)}He(`Microphone access was denied. Please allow microphone access to accept the call.`);return}He(`We couldn't connect the call right now. Please try again.`)}}},kt=async()=>{if(!B?.callId||!H.current||!g){St(`reject_call_without_server_context`);return}let e=B.callId;bt(),yt(),V.current?.emit(`call:rejected`,{callId:e,chatId:g,reason:`visitor_declined`});try{await H.current.rejectCall(e,g)}catch(e){He(hr(e,`We couldn't decline the call cleanly.`))}finally{St(`reject_call_finally`)}},At=(0,d.useRef)(kt);At.current=kt,(0,d.useEffect)(()=>{if(!B?.callId||Ne){bt();return}let e=B.callId;return bt(),rt.current=window.setTimeout(()=>{W.current?.callId===e&&nt.current!==e&&tt.current!==e&&At.current()},b),()=>{rt.current&&=(window.clearTimeout(rt.current),null)}},[Ne,bt,B?.callId]);let jt=async()=>{if(!Ne||!H.current||!g){St(`end_call_without_server_context`);return}yt();try{await H.current.endWebRTCCall(Ne,g)}catch(e){He(hr(e,`The call ended locally, but the server could not be updated.`))}finally{St(`end_call_finally`)}},Mt=()=>{let e=qe.current?.getAudioTracks?.()||[],t=G.current?.getSenders?.().map(e=>e.track).filter(e=>e?.kind===`audio`)||[],n=[...e,...t].filter(Boolean);if(n.length===0)return;let r=!ze;n.forEach(e=>{e.enabled=!r}),Be(r)},Nt=async(e={})=>{let t=e.notifyChatInitiated===!0;if(D(!0),!(!t||!H.current||!g||typeof window>`u`)){try{await H.current.trackVisitor({chatId:g,currentPagePath:window.location.pathname||`/`})}catch{}try{await H.current.updateChatStatus(g,`open`)}catch{}}},Pt=async e=>{let t=xt(e);if(!t||!H.current||!Ge.current)return t;try{await H.current.trackVisitor({chatId:Ge.current,currentPagePath:typeof window<`u`&&window.location.pathname||`/`,email:t})}catch(e){console.error(`[FlowEngageProvider] failed to persist visitor email`,e)}return t},Ft=()=>{!g||!V.current?.connected||at.current||(at.current=!0,V.current.emit(`typing:start`,{chatId:g,sender:`user`}))},It=()=>{!g||!V.current?.connected||!at.current||(at.current=!1,V.current.emit(`typing:stop`,{chatId:g,sender:`user`}))},Lt=(e=``)=>{let t=typeof e==`string`?e:``;!g||!V.current?.connected||t!==``&&ot.current===t||(ot.current=t,V.current.emit(`typing:update`,{chatId:g,sender:`user`,text:t}))};function Rt(){if(typeof document>`u`)return null;try{let e=(document.querySelector(`main`)||document.querySelector(`[role='main']`)||document.querySelector(`article`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);e.querySelectorAll(`nav, footer, header, aside, script, style, noscript, #flowengage-root, .flowengage-shell, .flowengage-widget-root, [id*='flowengage'], [class*='flowengage']`).forEach(e=>e.remove());let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>0?t.substring(0,3e3):null}catch{return null}}let zt=async(e,t=``,n=null,i={})=>{let a=typeof e==`string`?e.trim():``;if(!a||!H.current||!g||s!==`ready`||Ae)return;It(),Ze.current=!1;let o=/^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i,c=/^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i,l=/\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;if(Xe.current&&o.test(a)&&!c.test(a)){let{url:e,section:t}=Xe.current;Xe.current=null,Ze.current=!0,console.log(`[FWH Nav] Client-side nav firing →`,e),$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}!t||!mt.current||setTimeout(()=>{let e=Yn(null,t);e&&Xn(e)},300)})}else o.test(a)||(Xe.current=null);let d=`pending-user-${Date.now()}`,f={id:d,sender:`user`,message:e,timestamp:new Date().toISOString(),isPending:!0,type:i?.type||`text`,metadata:i?.metadata||void 0,...n||{}};S(e=>[...e,f]);let p=j;if(p)try{p=_t(await H.current.checkHumanHandled(g))}catch{}if(p&&V.current?.connected){V.current.emit(`customer:message`,{chatId:g,content:e,sender:`user`,email:fe||void 0,type:i?.type||`text`,metadata:i?.metadata||{},...n||{}});return}F(!0);try{let o=await H.current.sendAiMessage(g,e,r,t,{...n||{},...fe?{email:fe}:{}},{...i,currentPageUrl:typeof window<`u`?window.location.href:void 0,currentPageTitle:typeof window<`u`?document.title:void 0,currentPagePath:typeof window<`u`?window.location.pathname:void 0,currentPageContent:Rt()||void 0}),s=o.chat_history||[];if(console.log(`[FWH Nav Debug] API response fields:`,{has_navigate:!!o.navigate,navigate:o.navigate,has_pending_navigate:!!o.pending_navigate,pending_navigate:o.pending_navigate,last_bot_msg:[...s].reverse().find(e=>e.sender===`bot`)?.message?.substring(0,80)}),o.pending_navigate?.url){let e={url:o.pending_navigate.url,section:o.pending_navigate.section||null};l.test(a)?(console.log(`[FWH Nav] Auto-navigating (intent detected) →`,e.url),$e(e.url,{voiceActive:mt.current}).then(({navigated:t,reason:n})=>{if(!t){n===`not-found`?E():n===`already-on-page`&&ee();return}e.section&&setTimeout(()=>{let t=Yn(null,e.section);t&&Xn(t)},300)})):(Xe.current=e,console.log(`[FWH Nav] Stored pending nav →`,Xe.current))}if(o.navigate?.url)if(Ze.current)Ze.current=!1;else{let{url:e,section:t}=o.navigate;$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}t&&setTimeout(()=>{let e=Yn(null,t);e&&Xn(e)},300)})}else if(o.highlight?.section){let e=o.highlight.section;setTimeout(()=>{let t=Yn(null,e);t&&Xn(t)},150)}else{let e=[...s].reverse().find(e=>e.sender===`bot`||e.sender===`assistant`);if(e?.message){let t=mr(e.message);t&&er(t.url,{siteId:ht.current?.siteId,apiBaseUrl:ht.current?.apiBaseUrl}).then(({allowed:e,correctedUrl:n})=>{if(!e){E();return}$e(n||t.url,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}!t.section||!mt.current||setTimeout(()=>{let e=Yn(null,t.section);e&&Xn(e)},300)})})}}S(pr(s)),M(!!o.is_human_handled),A(o.is_human_handled?`agent`:`ai`),_e(!1),F(!1),await H.current.updateChatStatus(g,`messageSent`)}catch(e){S(e=>e.filter(e=>e.id!==d)),_e(!1),F(!1),e.status===429?(Se(!0),I(e.message),window.setTimeout(()=>{Se(!1),I(``)},v)):u(e)}},Bt=async e=>{if(!H.current||!e)throw Error(`Upload is unavailable right now.`);return H.current.uploadChatFile(e)},Vt=async e=>{if(!(!H.current||!g)){try{let t=e?`voice`:`text`;await H.current.setChatMode(g,t)}catch{}De(e),e&&(pt.current=!1)}},Ht=async e=>{if(pt.current)return;if(pt.current=!0,!H.current||!g||!e?.length){De(!1);return}let t=()=>{let t=pr(e);S(e=>{if(!e.length)return t;let n=e[e.length-1],r=t[0];return n&&r&&n.sender===r.sender&&n.message===r.message?e:[...e,...t]})};try{let n=await H.current.syncVoice(g,e);if(n?.chat_history?.length)S(pr(n.chat_history));else if(n?.success)try{let e=await H.current.loadHistory(g,r);e?.chat_history?.length?S(pr(e.chat_history)):t()}catch{t()}else t()}catch{t()}finally{De(!1)}},Ut=async()=>{if(!(!H.current||!g)){L&&!pt.current&&ft.current.length>0&&await Ht(ft.current);try{await H.current.endConversation(g)}catch{try{await H.current.updateChatStatus(g,`ended`)}catch{}}je(!0),S(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:`This conversation has ended. Thank you for reaching out!`,timestamp:new Date().toISOString(),isPending:!1}])}};(0,d.useEffect)(()=>{if(Fe!==`connected`||!Ne||!g||!Le||!vt)return;let e=new Date(Le).getTime(),t=Number.isFinite(e)?Date.now()-e:0,n=Math.max(0,vt*1e3-t),r=window.setTimeout(()=>{He(`The call ended because it reached the time limit.`),jt()},n);return()=>window.clearTimeout(r)},[Ne,Le,Fe,g,jt,vt]),(0,d.useEffect)(()=>{let e=()=>{let e=Ge.current,t=H.current;if(!t||!e)return;if(mt.current&&ft.current.length>0&&he(),!pt.current&&ft.current.length>0&&(t.beaconSyncVoice(e,ft.current)||t.syncVoice(e,ft.current).catch(()=>{}),pt.current=!0),tt.current){t.beaconEndWebRTCCall(tt.current,e);return}let n=nt.current||W.current?.callId;n&&t.beaconCustomerUnavailable(n,e)};return window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,e)}},[]);let K=(0,d.useCallback)(()=>{let e=i?.siteId;re(e),U.current=!0,Ke.current=null,V.current?.disconnect(),S([]),_(``),Ge.current=``,je(!1),M(!1),N(null),de(null),We(!0),o(e=>e+1)},[i?.siteId]),Wt=(0,d.useCallback)(e=>{i?.siteId,U.current=!1,Ke.current=e,V.current?.disconnect(),S([]),_(``),Ge.current=``,je(!1),M(!1),N(null),de(null),We(!0),o(e=>e+1)},[i?.siteId]),Gt=(0,d.useMemo)(()=>({status:s,error:l,runtimeConfig:m,resolvedConfig:i,chatId:g,chatHistory:x,isOpen:te,activeScreen:se,isHumanHandled:j,agentName:le,agentHeadshot:ue,visitorEmail:fe,isAgentTyping:me,isAiTyping:P,connectionStatus:ve,isLoading:be,isVoiceMode:L,isRateLimited:xe,rateLimitMessage:Ce,isConversationEnded:Ae,isSessionRestoring:Ue,openToChatCounter:R,voiceEndCounter:Oe,incomingCall:B,activeCallId:Ne,callConnectionState:Fe,callConnectedAt:Le,isCallMuted:ze,webRTCError:Ve,language:r,historyRef:ft,hasSyncedRef:pt,dismissCallError:yt,captureVisitorEmail:Pt,startTyping:Ft,stopTyping:It,updateTypingDraft:Lt,notifyRouteChange:()=>gt.current?.notifyRouteChange?.(),openWidget:Nt,closeWidget:()=>D(!1),toggleWidget:()=>{if(te){D(!1);return}Nt({notifyChatInitiated:!0})},sendMessage:zt,uploadChatFile:Bt,setVoiceMode:Vt,onMessageSync:Ht,endConversation:Ut,startNewChat:K,resumeChat:Wt,getVisitorChatHistory:()=>H.current?.getVisitorChatHistory?.(),getVisitorChatThread:e=>H.current?.getVisitorChatThread?.(e),acceptCall:Ot,rejectCall:kt,endWebRTCCall:jt,toggleCallMute:Mt}),[s,l,m,i,g,x,te,se,j,le,ue,fe,me,P,ve,be,L,xe,Ce,Ae,Ue,R,Oe,B,Ne,Fe,Le,ze,Ve,r,Pt,Ft,It,Lt,Ot,kt,jt,Mt,Nt,zt,Bt,Vt,Ht,Ut,K,yt]);return(0,f.jsx)(ln.Provider,{value:Gt,children:n})}var br=(0,d.createContext)({});function xr(e){let t=(0,d.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Sr=typeof window<`u`?d.useLayoutEffect:d.useEffect,Cr=(0,d.createContext)(null);function wr(e,t){e.indexOf(t)===-1&&e.push(t)}function Tr(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Er=(e,t,n)=>n>t?t:n<e?e:n;function Dr(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var Or=()=>{},kr=()=>{};typeof process<`u`&&process.env.NODE_ENV!==`production`&&(Or=(e,t,n)=>{!e&&typeof console<`u`&&console.warn(Dr(t,n))},kr=(e,t,n)=>{if(!e)throw Error(Dr(t,n))});var Ar={},jr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Mr(e){return typeof e==`object`&&!!e}var Nr=e=>/^0[^.\s]+$/u.test(e);function Pr(e){let t;return()=>(t===void 0&&(t=e()),t)}var Fr=e=>e,Ir=(e,t)=>n=>t(e(n)),Lr=(...e)=>e.reduce(Ir),Rr=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},zr=class{constructor(){this.subscriptions=[]}add(e){return wr(this.subscriptions,e),()=>Tr(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Br=e=>e*1e3,Vr=e=>e/1e3;function Hr(e,t){return t?1e3/t*e:0}var Ur=new Set;function Wr(e,t,n){e||Ur.has(t)||(console.warn(Dr(t,n)),Ur.add(t))}var Gr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Kr=1e-7,qr=12;function Jr(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Gr(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Kr&&++s<qr);return o}function Yr(e,t,n,r){if(e===t&&n===r)return Fr;let i=t=>Jr(t,0,1,e,n);return e=>e===0||e===1?e:Gr(i(e),t,r)}var Xr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Zr=e=>t=>1-e(1-t),Qr=Yr(.33,1.53,.69,.99),$r=Zr(Qr),ei=Xr($r),ti=e=>e>=1?1:(e*=2)<1?.5*$r(e):.5*(2-2**(-10*(e-1))),ni=e=>1-Math.sin(Math.acos(e)),ri=Zr(ni),ii=Xr(ni),ai=Yr(.42,0,1,1),oi=Yr(0,0,.58,1),si=Yr(.42,0,.58,1),ci=e=>Array.isArray(e)&&typeof e[0]!=`number`,li=e=>Array.isArray(e)&&typeof e[0]==`number`,ui={linear:Fr,easeIn:ai,easeInOut:si,easeOut:oi,circIn:ni,circInOut:ii,circOut:ri,backIn:$r,backInOut:ei,backOut:Qr,anticipate:ti},di=e=>typeof e==`string`,fi=e=>{if(li(e)){kr(e.length===4,`Cubic bezier arrays must contain four numerical values.`,`cubic-bezier-length`);let[t,n,r,i]=e;return Yr(t,n,r,i)}else if(di(e))return kr(ui[e]!==void 0,`Invalid easing type '${e}'`,`invalid-easing-type`),ui[e];return e},pi=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],mi={value:null,addProjectionMetrics:null};function hi(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&mi.value&&mi.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var gi=40;function _i(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=pi.reduce((e,n)=>(e[n]=hi(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Ar.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,gi),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:pi.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<pi.length;t++)o[pi[t]].cancel(e)},state:i,steps:o}}var{schedule:J,cancel:vi,state:yi,steps:bi}=_i(typeof requestAnimationFrame<`u`?requestAnimationFrame:Fr,!0),xi;function Si(){xi=void 0}var Ci={now:()=>(xi===void 0&&Ci.set(yi.isProcessing||Ar.useManualTiming?yi.timestamp:performance.now()),xi),set:e=>{xi=e,queueMicrotask(Si)}},wi={layout:0,mainThread:0,waapi:0},Ti=e=>t=>typeof t==`string`&&t.startsWith(e),Ei=Ti(`--`),Di=Ti(`var(--`),Oi=e=>Di(e)?ki.test(e.split(`/*`)[0].trim()):!1,ki=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ai(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var ji={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mi={...ji,transform:e=>Er(0,1,e)},Ni={...ji,default:1},Pi=e=>Math.round(e*1e5)/1e5,Fi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ii(e){return e==null}var Li=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ri=(e,t)=>n=>!!(typeof n==`string`&&Li.test(n)&&n.startsWith(e)||t&&!Ii(n)&&Object.prototype.hasOwnProperty.call(n,t)),zi=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Fi);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bi=e=>Er(0,255,e),Vi={...ji,transform:e=>Math.round(Bi(e))},Hi={test:Ri(`rgb`,`red`),parse:zi(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vi.transform(e)+`, `+Vi.transform(t)+`, `+Vi.transform(n)+`, `+Pi(Mi.transform(r))+`)`};function Ui(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wi={test:Ri(`#`),parse:Ui,transform:Hi.transform},Gi=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ki=Gi(`deg`),qi=Gi(`%`),Y=Gi(`px`),Ji=Gi(`vh`),Yi=Gi(`vw`),Xi={...qi,parse:e=>qi.parse(e)/100,transform:e=>qi.transform(e*100)},Zi={test:Ri(`hsl`,`hue`),parse:zi(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qi.transform(Pi(t))+`, `+qi.transform(Pi(n))+`, `+Pi(Mi.transform(r))+`)`},Qi={test:e=>Hi.test(e)||Wi.test(e)||Zi.test(e),parse:e=>Hi.test(e)?Hi.parse(e):Zi.test(e)?Zi.parse(e):Wi.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Hi.transform(e):Zi.transform(e),getAnimatableNone:e=>{let t=Qi.parse(e);return t.alpha=0,Qi.transform(t)}},$i=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ea(e){return isNaN(e)&&typeof e==`string`&&(e.match(Fi)?.length||0)+(e.match($i)?.length||0)>0}var ta=`number`,na=`color`,ra=`var`,ia=`var(`,aa="${}",oa=/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 sa(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(oa,e=>(Qi.test(e)?(r.color.push(a),i.push(na),n.push(Qi.parse(e))):e.startsWith(ia)?(r.var.push(a),i.push(ra),n.push(e)):(r.number.push(a),i.push(ta),n.push(parseFloat(e))),++a,aa)).split(aa),indexes:r,types:i}}function ca(e){return sa(e).values}function la({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===ta?i+=Pi(r[a]):e===na?i+=Qi.transform(r[a]):i+=r[a]}return i}}function ua(e){return la(sa(e))}var da=e=>typeof e==`number`?0:Qi.test(e)?Qi.getAnimatableNone(e):e,fa=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:da(e);function pa(e){let t=sa(e);return la(t)(t.values.map((e,n)=>fa(e,t.split[n])))}var ma={test:ea,parse:ca,createTransformer:ua,getAnimatableNone:pa};function ha(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ga({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=ha(s,r,e+1/3),a=ha(s,r,e),o=ha(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function _a(e,t){return n=>n>0?t:e}var X=(e,t,n)=>e+(t-e)*n,va=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},ya=[Wi,Hi,Zi],ba=e=>ya.find(t=>t.test(e));function xa(e){let t=ba(e);if(Or(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,`color-not-animatable`),!t)return!1;let n=t.parse(e);return t===Zi&&(n=ga(n)),n}var Sa=(e,t)=>{let n=xa(e),r=xa(t);if(!n||!r)return _a(e,t);let i={...n};return e=>(i.red=va(n.red,r.red,e),i.green=va(n.green,r.green,e),i.blue=va(n.blue,r.blue,e),i.alpha=X(n.alpha,r.alpha,e),Hi.transform(i))},Ca=new Set([`none`,`hidden`]);function wa(e,t){return Ca.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Ta(e,t){return n=>X(e,t,n)}function Ea(e){return typeof e==`number`?Ta:typeof e==`string`?Oi(e)?_a:Qi.test(e)?Sa:Aa:Array.isArray(e)?Da:typeof e==`object`?Qi.test(e)?Sa:Oa:_a}function Da(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Ea(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Oa(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ea(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function ka(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Aa=(e,t)=>{let n=ma.createTransformer(t),r=sa(e),i=sa(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ca.has(e)&&!i.values.length||Ca.has(t)&&!r.values.length?wa(e,t):Lr(Da(ka(r,i),i.values),n):(Or(!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`),_a(e,t))};function ja(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?X(e,t,n):Ea(e)(e,t)}var Ma=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>J.update(t,e),stop:()=>vi(t),now:()=>yi.isProcessing?yi.timestamp:Ci.now()}},Na=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Pa=2e4;function Fa(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Ia(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Fa(r),Pa);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Vr(i)}}var Z={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};function La(e,t){return e*Math.sqrt(1-t*t)}var Ra=12;function za(e,t,n){let r=n;for(let n=1;n<Ra;n++)r-=e(r)/t(r);return r}var Ba=.001;function Va({duration:e=Z.duration,bounce:t=Z.bounce,velocity:n=Z.velocity,mass:r=Z.mass}){let i,a;Or(e<=Br(Z.maxDuration),`Spring duration must be 10 seconds or less`,`spring-duration-limit`);let o=1-t;o=Er(Z.minDamping,Z.maxDamping,o),e=Er(Z.minDuration,Z.maxDuration,Vr(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=La(t,o),c=Math.exp(-i);return Ba-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=La(t**2,o);return(-i(t)+Ba>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ba+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=za(i,a,s);if(e=Br(e),isNaN(c))return{stiffness:Z.stiffness,damping:Z.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Ha=[`duration`,`bounce`],Ua=[`stiffness`,`damping`,`mass`];function Wa(e,t){return t.some(t=>e[t]!==void 0)}function Ga(e){let t={velocity:Z.velocity,stiffness:Z.stiffness,damping:Z.damping,mass:Z.mass,isResolvedFromDuration:!1,...e};if(!Wa(e,Ua)&&Wa(e,Ha))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Er(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Z.mass,stiffness:i,damping:a}}else{let n=Va({...e,velocity:0});t={...t,...n,mass:Z.mass},t.isResolvedFromDuration=!0}return t}function Ka(e=Z.visualDuration,t=Z.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Ga({...n,velocity:-Vr(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Vr(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Z.restSpeed.granular:Z.restSpeed.default,i||=v?Z.restDelta.granular:Z.restDelta.default;let y,b,x,S,C,w;if(h<1)x=La(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>Br(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=Br(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=Br(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Fa(T),Pa),t=Na(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Ka.applyToOptions=e=>{let t=Ia(e,100,Ka);return e.ease=t.ease,e.duration=Br(t.duration),e.type=`keyframes`,e};var qa=5;function Ja(e,t,n){let r=Math.max(t-qa,0);return Hr(n-e(r),t-r)}function Ya({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Ka({keyframes:[f.value,m(f.value)],velocity:Ja(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Xa(e,t,n){let r=[],i=n||Ar.mix||ja,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Lr(Array.isArray(t)?t[n]||Fr:t,a)),r.push(a)}return r}function Za(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(kr(a===t.length,`Both input and output ranges must be the same length`,`range-length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Xa(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Rr(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Er(e[0],e[a-1],t)):l}function Qa(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Rr(0,t,r);e.push(X(n,1,i))}}function $a(e){let t=[0];return Qa(t,e.length-1),t}function eo(e,t){return e.map(e=>e*t)}function to(e,t){return e.map(()=>t||si).splice(0,e.length-1)}function no({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ci(r)?r.map(fi):fi(r),a={done:!1,value:t[0]},o=Za(eo(n&&n.length===t.length?n:$a(t),e),t,{ease:Array.isArray(i)?i:to(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var ro=e=>e!==null;function io(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ro),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ao={decay:Ya,inertia:Ya,tween:no,keyframes:no,spring:Ka};function oo(e){typeof e.type==`string`&&(e.type=ao[e.type])}var so=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},co=e=>e/100,lo=class extends so{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Ci.now()&&this.tick(Ci.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},wi.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;oo(e);let{type:t=no,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||no;process.env.NODE_ENV!==`production`&&s!==no&&kr(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,`spring-two-frames`),s!==no&&typeof o[0]!=`number`&&(this.mixKeyframes=Lr(co,ja(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Fa(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Er(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Ya&&(b.value=io(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Vr(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Vr(e)}get time(){return Vr(this.currentTime)}set time(e){e=Br(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Ja(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Ci.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Vr(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Ma,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,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(Ci.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,wi.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function uo(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var fo=e=>e*180/Math.PI,po=e=>ho(fo(Math.atan2(e[1],e[0]))),mo={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:po,rotateZ:po,skewX:e=>fo(Math.atan(e[1])),skewY:e=>fo(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ho=e=>(e%=360,e<0&&(e+=360),e),go=po,_o=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vo=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),yo={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:_o,scaleY:vo,scale:e=>(_o(e)+vo(e))/2,rotateX:e=>ho(fo(Math.atan2(e[6],e[5]))),rotateY:e=>ho(fo(Math.atan2(-e[2],e[0]))),rotateZ:go,rotate:go,skewX:e=>fo(Math.atan(e[4])),skewY:e=>fo(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function bo(e){return e.includes(`scale`)?1:0}function xo(e,t){if(!e||e===`none`)return bo(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=yo,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mo,i=t}if(!i)return bo(t);let a=r[t],o=i[1].split(`,`).map(Co);return typeof a==`function`?a(o):o[a]}var So=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return xo(n,t)};function Co(e){return parseFloat(e.trim())}var wo=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],To=new Set(wo),Eo=e=>e===ji||e===Y,Do=new Set([`x`,`y`,`z`]),Oo=wo.filter(e=>!Do.has(e));function ko(e){let t=[];return Oo.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Ao={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},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})=>xo(t,`x`),y:(e,{transform:t})=>xo(t,`y`)};Ao.translateX=Ao.x,Ao.translateY=Ao.y;var jo=new Set,Mo=!1,No=!1,Po=!1;function Fo(){if(No){let e=Array.from(jo).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ko(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}No=!1,Mo=!1,jo.forEach(e=>e.complete(Po)),jo.clear()}function Io(){jo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(No=!0)})}function Lo(){Po=!0,Io(),Fo(),Po=!1}var Ro=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(jo.add(this),Mo||(Mo=!0,J.read(Io),J.resolveKeyframes(Fo))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}uo(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),jo.delete(this)}cancel(){this.state===`scheduled`&&(jo.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},zo=e=>e.startsWith(`--`);function Bo(e,t,n){zo(t)?e.style.setProperty(t,n):e.style[t]=n}var Vo={};function Ho(e,t){let n=Pr(e);return()=>Vo[t]??n()}var Uo=Ho(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Wo=Ho(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Go=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ko={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Go([0,.65,.55,1]),circOut:Go([.55,0,1,.45]),backIn:Go([.31,.01,.66,-.59]),backOut:Go([.33,1.53,.69,.99])};function qo(e,t){if(e)return typeof e==`function`?Wo()?Na(e,t):`ease-out`:li(e)?Go(e):Array.isArray(e)?e.map(e=>qo(e,t)||Ko.easeOut):Ko[e]}function Jo(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=qo(s,i);Array.isArray(d)&&(u.easing=d),mi.value&&wi.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return mi.value&&p.finished.finally(()=>{wi.waapi--}),p}function Yo(e){return typeof e==`function`&&`applyToOptions`in e}function Xo({type:e,...t}){return Yo(e)&&Wo()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Zo=class extends so{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,kr(typeof e.type!=`string`,`Mini animate() doesn't support "type" as a string.`,`mini-spring`);let c=Xo(e);this.animation=Jo(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=io(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Bo(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,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;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Vr(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Vr(e)}get time(){return Vr(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Br(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Uo()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Fr):r(this)}},Qo={anticipate:ti,backInOut:ei,circInOut:ii};function $o(e){return e in Qo}function es(e){typeof e.ease==`string`&&$o(e.ease)&&(e.ease=Qo[e.ease])}var ts=10,ns=class extends Zo{constructor(e){es(e),oo(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new lo({...a,autoplay:!1}),s=Math.max(ts,Ci.now()-this.startTime),c=Er(0,ts,s-ts),l=o.sample(s).value,{name:u}=this.options;i&&u&&Bo(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},rs=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(ma.test(e)||e===`0`)&&!e.startsWith(`url(`));function is(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function as(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=rs(i,t),s=rs(a,t);return Or(o===s,`You are trying to animate ${t} from "${i}" to "${a}". "${o?a:i}" is not an animatable value.`,`value-not-animatable`),!o||!s?!1:is(e)||(n===`spring`||Yo(n))&&r}function os(e){e.duration=0,e.type=`keyframes`}var ss=new Set([`opacity`,`clipPath`,`filter`,`transform`]),cs=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function ls(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&cs.test(e[t]))return!0;return!1}var us=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),ds=Pr(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function fs(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return ds()&&n&&(ss.has(n)||us.has(n)&&ls(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ps=40,ms=class extends so{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ci.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Ro)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Ci.now();let u=!0;as(e,i,a,o)||(u=!1,(Ar.instantAnimations||!s)&&l?.(io(e,n,t)),e[0]=e[e.length-1],os(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ps?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&fs(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new ns({...d,element:p})}catch{m=new lo(d)}else m=new lo(d);m.finished.then(()=>{this.notifyFinished()}).catch(Fr),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Lo()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function hs(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var gs=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _s(e){let t=gs.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var vs=4;function ys(e,t,n=1){kr(n<=vs,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,`max-css-var-depth`);let[r,i]=_s(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return jr(e)?parseFloat(e):e}return Oi(i)?ys(i,t,n+1):i}var bs={type:`spring`,stiffness:500,damping:25,restSpeed:10},xs=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Ss={type:`keyframes`,duration:.8},Cs={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},ws=(e,{keyframes:t})=>t.length>2?Ss:To.has(e)?e.startsWith(`scale`)?xs(t[1]):bs:Cs;function Ts(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Es(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ts(n,e)}var Ds=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Os(e){for(let t in e)if(!Ds.has(t))return!0;return!1}var ks=(e,t,n,r={},i,a)=>o=>{let s=Es(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Br(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Os(s)||Object.assign(u,ws(e,u)),u.duration&&=Br(u.duration),u.repeatDelay&&=Br(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(os(u),u.delay===0&&(d=!0)),(Ar.instantAnimations||Ar.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,os(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=io(u.keyframes,s);if(e!==void 0){J.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new lo(u):new ms(u)};function As(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function js(e,t,n,r){if(typeof t==`function`){let[i,a]=As(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=As(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Ms(e,t,n){let r=e.getProps();return js(r,t,n===void 0?r.custom:n,e)}var Ns=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...wo]),Ps=30,Fs=e=>!isNaN(parseFloat(e)),Is={current:void 0},Ls=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Ci.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ci.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fs(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!==`production`&&Wr(!1,`value.onChange(callback) is deprecated. Switch to value.on("change", callback).`),this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new zr);let n=this.events[e].add(t);return e===`change`?()=>{n(),J.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Is.current&&Is.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Ci.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Ps)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Ps);return Hr(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 Rs(e,t){return new Ls(e,t)}var zs=e=>Array.isArray(e);function Bs(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rs(n))}function Vs(e){return zs(e)?e[e.length-1]||0:e}function Hs(e,t){let{transitionEnd:n={},transition:r={},...i}=Ms(e,t)||{};i={...i,...n};for(let t in i)Bs(e,t,Vs(i[t]))}var Us=e=>!!(e&&e.getVelocity);function Ws(e){return!!(Us(e)&&e.add)}function Gs(e,t){let n=e.getValue(`willChange`);if(Ws(n))return n.add(t);if(!n&&Ar.WillChange){let n=new Ar.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Ks(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var qs=`data-`+Ks(`framerAppearId`);function Js(e){return e.props[qs]}function Ys({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Xs(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ts(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Ys(d,t))continue;let o={delay:n,...Es(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){J.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Js(e);if(n){let e=window.MotionHandoffAnimation(n,t,J);e!==null&&(o.startTime=e,f=!0)}}Gs(e,t);let p=l??e.shouldReduceMotion;r.start(ks(t,r,i,p&&Ns.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>J.update(()=>{o&&Hs(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Zs(e,t,n={}){let r=Ms(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Xs(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Qs(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Qs(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Zs(c,t,{...o,delay:n+(typeof r==`function`?0:r)+hs(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function $s(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Zs(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Zs(e,t,n);else{let i=typeof t==`function`?Ms(e,t,n.custom):t;r=Promise.all(Xs(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var ec={test:e=>e===`auto`,parse:e=>e},tc=e=>t=>t.test(e),nc=[ji,Y,qi,Ki,Yi,Ji,ec],rc=e=>nc.find(tc(e));function ic(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Nr(e)}var ac=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function oc(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Fi)||[];if(!r)return e;let i=n.replace(r,``),a=ac.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var sc=/\b([a-z-]*)\(.*?\)/gu,cc={...ma,getAnimatableNone:e=>{let t=e.match(sc);return t?t.map(oc).join(` `):e}},lc={...ma,getAnimatableNone:e=>{let t=ma.parse(e);return ma.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},uc={...ji,transform:Math.round},dc={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:Ki,rotateX:Ki,rotateY:Ki,rotateZ:Ki,scale:Ni,scaleX:Ni,scaleY:Ni,scaleZ:Ni,skew:Ki,skewX:Ki,skewY:Ki,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:Mi,originX:Xi,originY:Xi,originZ:Y,zIndex:uc,fillOpacity:Mi,strokeOpacity:Mi,numOctaves:uc},fc={...dc,color:Qi,backgroundColor:Qi,outlineColor:Qi,fill:Qi,stroke:Qi,borderColor:Qi,borderTopColor:Qi,borderRightColor:Qi,borderBottomColor:Qi,borderLeftColor:Qi,filter:cc,WebkitFilter:cc,mask:lc,WebkitMask:lc},pc=e=>fc[e],mc=new Set([cc,lc]);function hc(e,t){let n=pc(e);return mc.has(n)||(n=ma),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var gc=new Set([`auto`,`none`,`0`]);function _c(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!gc.has(t)&&sa(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=hc(n,i)}var vc=class extends Ro{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Oi(r))){let i=ys(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Ns.has(n)||e.length!==2)return;let[r,i]=e,a=rc(r),o=rc(i);if(Ai(r)!==Ai(i)&&Ao[n]){this.needsMeasurement=!0;return}if(a!==o)if(Eo(a)&&Eo(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Ao[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||ic(e[t]))&&n.push(t);n.length&&_c(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ao[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Ao[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function yc(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var bc=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function xc(e){return Mr(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Sc,cancel:Cc}=_i(queueMicrotask,!1),wc={x:!1,y:!1};function Tc(){return wc.x||wc.y}function Ec(e){return e===`x`||e===`y`?wc[e]?null:(wc[e]=!0,()=>{wc[e]=!1}):wc.x||wc.y?null:(wc.x=wc.y=!0,()=>{wc.x=wc.y=!1})}function Dc(e,t){let n=yc(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Oc(e){return!(e.pointerType===`touch`||Tc())}function kc(e,t,n={}){let[r,i,a]=Dc(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Oc(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Ac=(e,t)=>t?e===t?!0:Ac(e,t.parentElement):!1,jc=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Mc=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Nc(e){return Mc.has(e.tagName)||e.isContentEditable===!0}var Pc=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Fc(e){return Pc.has(e.tagName)||e.isContentEditable===!0}var Ic=new WeakSet;function Lc(e){return t=>{t.key===`Enter`&&e(t)}}function Rc(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var zc=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Lc(()=>{if(Ic.has(n))return;Rc(n,`down`);let e=Lc(()=>{Rc(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Rc(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Bc(e){return jc(e)&&!Tc()}var Vc=new WeakSet;function Hc(e,t,n={}){let[r,i,a]=Dc(e,n),o=e=>{let r=e.currentTarget;if(!Bc(e)||Vc.has(e))return;Ic.add(r),n.stopPropagation&&Vc.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ic.has(r)&&Ic.delete(r),Bc(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Ac(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),xc(e)&&(e.addEventListener(`focus`,e=>zc(e,i)),!Nc(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Uc(e){return Mr(e)&&`ownerSVGElement`in e}var Wc=new WeakMap,Gc,Kc=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Uc(r)&&`getBBox`in r?r.getBBox()[t]:r[n],qc=Kc(`inline`,`width`,`offsetWidth`),Jc=Kc(`block`,`height`,`offsetHeight`);function Yc({target:e,borderBoxSize:t}){Wc.get(e)?.forEach(n=>{n(e,{get width(){return qc(e,t)},get height(){return Jc(e,t)}})})}function Xc(e){e.forEach(Yc)}function Zc(){typeof ResizeObserver>`u`||(Gc=new ResizeObserver(Xc))}function Qc(e,t){Gc||Zc();let n=yc(e);return n.forEach(e=>{let n=Wc.get(e);n||(n=new Set,Wc.set(e,n)),n.add(t),Gc?.observe(e)}),()=>{n.forEach(e=>{let n=Wc.get(e);n?.delete(t),n?.size||Gc?.unobserve(e)})}}var $c=new Set,el;function tl(){el=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};$c.forEach(t=>t(e))},window.addEventListener(`resize`,el)}function nl(e){return $c.add(e),el||tl(),()=>{$c.delete(e),!$c.size&&typeof el==`function`&&(window.removeEventListener(`resize`,el),el=void 0)}}function rl(e,t){return typeof e==`function`?nl(e):Qc(e,t)}function il(e){return Uc(e)&&e.tagName===`svg`}var al=[...nc,Qi,ma],ol=e=>al.find(tc(e)),sl=()=>({translate:0,scale:1,origin:0,originPoint:0}),cl=()=>({x:sl(),y:sl()}),ll=()=>({min:0,max:0}),ul=()=>({x:ll(),y:ll()}),dl=new WeakMap;function fl(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function pl(e){return typeof e==`string`||Array.isArray(e)}var ml=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],hl=[`initial`,...ml];function gl(e){return fl(e.animate)||hl.some(t=>pl(e[t]))}function _l(e){return!!(gl(e)||e.variants)}function vl(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Us(i))e.addValue(r,i);else if(Us(a))e.addValue(r,Rs(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Rs(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var yl={current:null},bl={current:!1},xl=typeof window<`u`;function Sl(){if(bl.current=!0,xl)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>yl.current=e.matches;e.addEventListener(`change`,t),t()}else yl.current=!1}var Cl=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],wl={};function Tl(e){wl=e}function El(){return wl}var Dl=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ro,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Ci.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,J.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=gl(t),this.isVariantNode=_l(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Us(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,dl.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(bl.current||Sl(),this.shouldReduceMotion=yl.current),process.env.NODE_ENV!==`production`&&Wr(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),vi(this.notifyUpdate),vi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ss.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Zo({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Br(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=To.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&J.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in wl){let t=wl[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ul()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Cl.length;t++){let n=Cl[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=vl(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Rs(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(jr(n)||Nr(n))?n=parseFloat(n):!ol(n)&&ma.test(t)&&(n=hc(e,t)),this.setBaseTarget(e,Us(n)?n.get():n)),Us(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=js(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Us(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new zr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Sc.render(this.render)}},Ol=class extends Dl{constructor(){super(...arguments),this.KeyframeResolver=vc}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Us(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},kl=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Al({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function jl({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ml(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Nl(e){return e===void 0||e===1}function Pl({scale:e,scaleX:t,scaleY:n}){return!Nl(e)||!Nl(t)||!Nl(n)}function Fl(e){return Pl(e)||Il(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Il(e){return Ll(e.x)||Ll(e.y)}function Ll(e){return e&&e!==`0%`}function Rl(e,t,n){return n+t*(e-n)}function zl(e,t,n,r,i){return i!==void 0&&(e=Rl(e,i,r)),Rl(e,n,r)+t}function Bl(e,t=0,n=1,r,i){e.min=zl(e.min,t,n,r,i),e.max=zl(e.max,t,n,r,i)}function Vl(e,{x:t,y:n}){Bl(e.x,t.translate,t.scale,t.originPoint),Bl(e.y,n.translate,n.scale,n.originPoint)}var Hl=.999999999999,Ul=1.0000000000001;function Wl(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Gl(e.x,-a.scroll.offset.x),Gl(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Vl(e,o)),r&&Fl(a.latestValues)&&Jl(e,a.latestValues,a.layout?.layoutBox))}t.x<Ul&&t.x>Hl&&(t.x=1),t.y<Ul&&t.y>Hl&&(t.y=1)}function Gl(e,t){e.min+=t,e.max+=t}function Kl(e,t,n,r,i=.5){Bl(e,t,n,X(e.min,e.max,i),r)}function ql(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Jl(e,t,n){let r=n??e;Kl(e.x,ql(t.x,r.x),t.scaleX,t.scale,t.originX),Kl(e.y,ql(t.y,r.y),t.scaleY,t.scale,t.originY)}function Yl(e,t){return Al(Ml(e.getBoundingClientRect(),t))}function Xl(e,t,n){let r=Yl(e,n),{scroll:i}=t;return i&&(Gl(r.x,i.offset.x),Gl(r.y,i.offset.y)),r}var Zl={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Ql=wo.length;function $l(e,t,n){let r=``,i=!0;for(let a=0;a<Ql;a++){let o=wo[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===(o.startsWith(`scale`)?1:0);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=bc(s,dc[o]);if(!c){i=!1;let t=Zl[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function eu(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(To.has(e)){o=!0;continue}else if(Ei(e)){i[e]=n;continue}else{let t=bc(n,dc[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=$l(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function tu(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function nu(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var ru={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Y.test(e))e=parseFloat(e);else return e;return`${nu(e,t.target.x)}% ${nu(e,t.target.y)}%`}},iu={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=ma.parse(e);if(i.length>5)return r;let a=ma.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=X(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},au={borderRadius:{...ru,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:ru,borderTopRightRadius:ru,borderBottomLeftRadius:ru,borderBottomRightRadius:ru,boxShadow:iu};function ou(e,{layout:t,layoutId:n}){return To.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!au[e]||e===`opacity`)}function su(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Us(r[t])||i&&Us(i[t])||ou(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function cu(e){return window.getComputedStyle(e)}var lu=class extends Ol{constructor(){super(...arguments),this.type=`html`,this.renderInstance=tu}readValueFromInstance(e,t){if(To.has(t))return this.projection?.isProjecting?bo(t):So(e,t);{let n=cu(e),r=(Ei(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Yl(e,t)}build(e,t,n){eu(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return su(e,t,n)}},uu={offset:`stroke-dashoffset`,array:`stroke-dasharray`},du={offset:`strokeDashoffset`,array:`strokeDasharray`};function fu(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?uu:du;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var pu=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function mu(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(eu(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of pu)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&fu(d,i,a,o,!1)}var hu=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),gu=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function _u(e,t,n,r){tu(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(hu.has(n)?n:Ks(n),t.attrs[n])}function vu(e,t,n){let r=su(e,t,n);for(let n in e)if(Us(e[n])||Us(t[n])){let t=wo.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var yu=class extends Ol{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=ul}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(To.has(t)){let e=pc(t);return e&&e.default||0}return t=hu.has(t)?t:Ks(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return vu(e,t,n)}build(e,t,n){mu(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){_u(e,t,n,r)}mount(e){this.isSVGTag=gu(e.tagName),super.mount(e)}},bu=hl.length;function xu(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&xu(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<bu;n++){let r=hl[n],i=e.props[r];(pl(i)||i===!1)&&(t[r]=i)}return t}function Su(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Cu=[...ml].reverse(),wu=ml.length;function Tu(e){return t=>Promise.all(t.map(({animation:t,options:n})=>$s(e,t,n)))}function Eu(e){let t=Tu(e),n=ku(),r=!0,i=!1,a=t=>(n,r)=>{let i=Ms(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=xu(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<wu;t++){let p=Cu[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=pl(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||fl(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Du(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=zs(t)&&zs(n)?!Su(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let ee=v&&y;b&&(!ee||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!ee&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Ms(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=hs(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Ms(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=ku(),i=!0}}}function Du(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Su(t,e):!1}function Ou(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ku(){return{animate:Ou(!0),whileInView:Ou(),whileHover:Ou(),whileTap:Ou(),whileDrag:Ou(),whileFocus:Ou(),exit:Ou()}}function Au(e,t){e.min=t.min,e.max=t.max}function ju(e,t){Au(e.x,t.x),Au(e.y,t.y)}function Mu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Nu=1e-4,Pu=1-Nu,Fu=1+Nu,Iu=.01,Lu=0-Iu,Ru=0+Iu;function zu(e){return e.max-e.min}function Bu(e,t,n){return Math.abs(e-t)<=n}function Vu(e,t,n,r=.5){e.origin=r,e.originPoint=X(t.min,t.max,e.origin),e.scale=zu(n)/zu(t),e.translate=X(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Pu&&e.scale<=Fu||isNaN(e.scale))&&(e.scale=1),(e.translate>=Lu&&e.translate<=Ru||isNaN(e.translate))&&(e.translate=0)}function Hu(e,t,n,r){Vu(e.x,t.x,n.x,r?r.originX:void 0),Vu(e.y,t.y,n.y,r?r.originY:void 0)}function Uu(e,t,n,r=0){e.min=(r?X(n.min,n.max,r):n.min)+t.min,e.max=e.min+zu(t)}function Wu(e,t,n,r){Uu(e.x,t.x,n.x,r?.x),Uu(e.y,t.y,n.y,r?.y)}function Gu(e,t,n,r=0){let i=r?X(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+zu(t)}function Ku(e,t,n,r){Gu(e.x,t.x,n.x,r?.x),Gu(e.y,t.y,n.y,r?.y)}function qu(e,t,n,r,i){return e-=t,e=Rl(e,1/n,r),i!==void 0&&(e=Rl(e,1/i,r)),e}function Ju(e,t=0,n=1,r=.5,i,a=e,o=e){if(qi.test(t)&&(t=parseFloat(t),t=X(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=X(a.min,a.max,r);e===a&&(s-=t),e.min=qu(e.min,t,n,s,i),e.max=qu(e.max,t,n,s,i)}function Yu(e,t,[n,r,i],a,o){Ju(e,t[n],t[r],t[i],t.scale,a,o)}var Xu=[`x`,`scaleX`,`originX`],Zu=[`y`,`scaleY`,`originY`];function Qu(e,t,n,r){Yu(e.x,t,Xu,n?n.x:void 0,r?r.x:void 0),Yu(e.y,t,Zu,n?n.y:void 0,r?r.y:void 0)}function $u(e){return e.translate===0&&e.scale===1}function ed(e){return $u(e.x)&&$u(e.y)}function td(e,t){return e.min===t.min&&e.max===t.max}function nd(e,t){return td(e.x,t.x)&&td(e.y,t.y)}function rd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function id(e,t){return rd(e.x,t.x)&&rd(e.y,t.y)}function ad(e){return zu(e.x)/zu(e.y)}function od(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function sd(e){return[e(`x`),e(`y`)]}function cd(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var ld=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],ud=ld.length,dd=e=>typeof e==`string`?parseFloat(e):e,fd=e=>typeof e==`number`||Y.test(e);function pd(e,t,n,r,i,a){i?(e.opacity=X(0,n.opacity??1,hd(r)),e.opacityExit=X(t.opacity??1,0,gd(r))):a&&(e.opacity=X(t.opacity??1,n.opacity??1,r));for(let i=0;i<ud;i++){let a=ld[i],o=md(t,a),s=md(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||fd(o)===fd(s)?(e[a]=Math.max(X(dd(o),dd(s),r),0),(qi.test(s)||qi.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=X(t.rotate||0,n.rotate||0,r))}function md(e,t){return e[t]===void 0?e.borderRadius:e[t]}var hd=_d(0,.5,ri),gd=_d(.5,.95,Fr);function _d(e,t,n){return r=>r<e?0:r>t?1:n(Rr(e,t,r))}function vd(e,t,n){let r=Us(e)?e:Rs(e);return r.start(ks(``,r,t,n)),r.animation}function yd(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var bd=(e,t)=>e.depth-t.depth,xd=class{constructor(){this.children=[],this.isDirty=!1}add(e){wr(this.children,e),this.isDirty=!0}remove(e){Tr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(bd),this.isDirty=!1,this.children.forEach(e)}};function Sd(e,t){let n=Ci.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(vi(r),e(a-t))};return J.setup(r,!0),()=>vi(r)}function Cd(e){return Us(e)?e.get():e}var wd=class{constructor(){this.members=[]}add(e){wr(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Tr(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Tr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Td={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ed={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Dd=[``,`X`,`Y`,`Z`],Od=1e3,kd=0;function Ad(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function jd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Js(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,J,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&jd(r)}function Md({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=kd++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mi.value&&(Ed.nodes=Ed.calculatedTargetDeltas=Ed.calculatedProjections=0),this.nodes.forEach(Fd),this.nodes.forEach(Wd),this.nodes.forEach(Gd),this.nodes.forEach(Id),mi.addProjectionMetrics&&mi.addProjectionMetrics(Ed)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new xd)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new zr),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=Uc(t)&&!il(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;J.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Sd(i,250),Td.hasAnimatedSinceResize&&(Td.hasAnimatedSinceResize=!1,this.nodes.forEach(Ud)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Qd,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!id(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Es(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||Ud(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),vi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Kd),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&jd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(zd),this.nodes.forEach(Rd);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Bd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Vd),this.nodes.forEach(Hd),this.nodes.forEach(Nd),this.nodes.forEach(Pd)):this.nodes.forEach(Bd),this.clearAllSnapshots();let e=Ci.now();yi.delta=Er(0,1e3/60,e-yi.timestamp),yi.timestamp=e,yi.isProcessing=!0,bi.update.process(yi),bi.preRender.process(yi),bi.render.process(yi),yi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Sc.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ld),this.sharedNodes.forEach(qd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,J.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){J.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!zu(this.snapshot.measuredBox.x)&&!zu(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=ul(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!ed(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||Fl(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),nf(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return ul();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(af))){let{scroll:e}=this.root;e&&(Gl(t.x,e.offset.x),Gl(t.y,e.offset.y))}return t}removeElementScroll(e){let t=ul();if(ju(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ju(t,e),Gl(t.x,i.offset.x),Gl(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||ul();ju(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Gl(r.x,-n.scroll.offset.x),Gl(r.y,-n.scroll.offset.y)),Fl(n.latestValues)&&Jl(r,n.latestValues,n.layout?.layoutBox)}return Fl(this.latestValues)&&Jl(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=ul();ju(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!Fl(n.latestValues))continue;let r;n.instance&&(Pl(n.latestValues)&&n.updateSnapshot(),r=ul(),ju(r,n.measurePageBox())),Qu(t,n.latestValues,n.snapshot?.layoutBox,r)}return Fl(this.latestValues)&&Qu(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==yi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=yi.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ul(),this.targetWithTransforms=ul()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Wu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ju(this.target,this.layout.layoutBox),Vl(this.target,this.targetDelta)):ju(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),mi.value&&Ed.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Pl(this.parent.latestValues)||Il(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ul(),this.relativeTargetOrigin=ul(),Ku(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ju(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===yi.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ju(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Wl(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=ul());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Mu(this.prevProjectionDelta.x,this.projectionDelta.x),Mu(this.prevProjectionDelta.y,this.projectionDelta.y)),Hu(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!od(this.projectionDelta.x,this.prevProjectionDelta.x)||!od(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),mi.value&&Ed.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cl(),this.projectionDelta=cl(),this.projectionDeltaWithTransform=cl()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=cl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=ul(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Zd));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;Jd(a.x,e.x,n),Jd(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ku(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Xd(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&nd(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=ul(),ju(d,this.relativeTarget)),s&&(this.animationValues=i,pd(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(vi(this.pendingAnimation),void 0),this.pendingAnimation=J.update(()=>{Td.hasAnimatedSinceResize=!0,wi.layout++,this.motionValue||=Rs(0),this.motionValue.jump(0,!1),this.currentAnimation=vd(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{wi.layout--},onComplete:()=>{wi.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Od),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&rf(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||ul();let t=zu(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=zu(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ju(t,n),Jl(t,i),Hu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new wd),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Ad(`z`,e,r,this.animationValues);for(let t=0;t<Dd.length;t++)Ad(`rotate${Dd[t]}`,e,r,this.animationValues),Ad(`skew${Dd[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Cd(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Cd(t?.pointerEvents)||``),this.hasProjected&&!Fl(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=cd(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in au){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=au[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Cd(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Rd),this.root.sharedNodes.clear()}}}function Nd(e){e.updateLayout()}function Pd(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)sd(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=zu(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Au(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else rf(i,t.layoutBox,n)&&sd(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=zu(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=cl();Hu(o,n,t.layoutBox);let s=cl();a?Hu(s,e.applyTransform(r,!0),t.measuredBox):Hu(s,n,t.layoutBox);let c=!ed(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=ul();Ku(s,t.layoutBox,i.layoutBox,o);let c=ul();Ku(c,n,a.layoutBox,o),id(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Fd(e){mi.value&&Ed.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Id(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ld(e){e.clearSnapshot()}function Rd(e){e.clearMeasurements()}function zd(e){e.isLayoutDirty=!0,e.updateLayout()}function Bd(e){e.isLayoutDirty=!1}function Vd(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Hd(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Ud(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Wd(e){e.resolveTargetDelta()}function Gd(e){e.calcProjection()}function Kd(e){e.resetSkewAndRotation()}function qd(e){e.removeLeadSnapshot()}function Jd(e,t,n){e.translate=X(t.translate,0,n),e.scale=X(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Yd(e,t,n,r){e.min=X(t.min,n.min,r),e.max=X(t.max,n.max,r)}function Xd(e,t,n,r){Yd(e.x,t.x,n.x,r),Yd(e.y,t.y,n.y,r)}function Zd(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var Qd={duration:.45,ease:[.4,0,.1,1]},$d=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ef=$d(`applewebkit/`)&&!$d(`chrome/`)?Math.round:Fr;function tf(e){e.min=ef(e.min),e.max=ef(e.max)}function nf(e){tf(e.x),tf(e.y)}function rf(e,t,n){return e===`position`||e===`preserve-aspect`&&!Bu(ad(t),ad(n),.2)}function af(e){return e!==e.root&&e.scroll?.wasRoot}var of=Md({attachResizeListener:(e,t)=>yd(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),sf={current:void 0},cf=Md({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!sf.current){let e=new of({});e.mount(window),e.setOptions({layoutScroll:!0}),sf.current=e}return sf.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),lf=(0,d.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function uf(e=!0){let t=(0,d.useContext)(Cr);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,d.useId)();(0,d.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,d.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var df=(0,d.createContext)({strict:!1}),ff={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},pf=!1;function mf(){if(pf)return;let e={};for(let t in ff)e[t]={isEnabled:e=>ff[t].some(t=>!!e[t])};Tl(e),pf=!0}function hf(){return mf(),El()}function gf(e){let t=hf();for(let n in e)t[n]={...t[n],...e[n]};Tl(t)}var _f=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function vf(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||_f.has(e)}var yf=s({default:()=>bf}),bf,xf=o((()=>{throw bf={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Sf=e=>!vf(e);function Cf(e){typeof e==`function`&&(Sf=t=>t.startsWith(`on`)?!vf(t):e(t))}try{Cf((xf(),u(yf)).default)}catch{}function wf(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Us(e[i])||(Sf(i)||n===!0&&vf(i)||!t&&!vf(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var Tf=(0,d.createContext)({});function Ef(e,t){if(gl(e)){let{initial:t,animate:n}=e;return{initial:t===!1||pl(t)?t:void 0,animate:pl(n)?n:void 0}}return e.inherit===!1?{}:t}function Df(e){let{initial:t,animate:n}=Ef(e,(0,d.useContext)(Tf));return(0,d.useMemo)(()=>({initial:t,animate:n}),[Of(t),Of(n)])}function Of(e){return Array.isArray(e)?e.join(` `):e}var kf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Af(e,t,n){for(let r in t)!Us(t[r])&&!ou(r,n)&&(e[r]=t[r])}function jf({transformTemplate:e},t){return(0,d.useMemo)(()=>{let n=kf();return eu(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Mf(e,t){let n=e.style||{},r={};return Af(r,n,e),Object.assign(r,jf(e,t)),r}function Nf(e,t){let n={},r=Mf(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Pf=()=>({...kf(),attrs:{}});function Ff(e,t,n,r){let i=(0,d.useMemo)(()=>{let n=Pf();return mu(n,t,gu(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Af(t,e.style,e),i.style={...t,...i.style}}return i}var If=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Lf(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(If.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rf(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??Lf(e)?Ff:Nf)(t,r,i,e),c=wf(t,typeof e==`string`,a),l=e===d.Fragment?{}:{...c,...s,ref:n},{children:u}=t,f=(0,d.useMemo)(()=>Us(u)?u.get():u,[u]);return(0,d.createElement)(e,{...l,children:f})}function zf({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Bf(n,r,i,e),renderState:t()}}function Bf(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Cd(a[e]);let{initial:o,animate:s}=e,c=gl(e),l=_l(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!fl(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=js(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Vf=e=>(t,n)=>{let r=(0,d.useContext)(Tf),i=(0,d.useContext)(Cr),a=()=>zf(e,t,r,i);return n?a():xr(a)},Hf=Vf({scrapeMotionValuesFromProps:su,createRenderState:kf}),Uf=Vf({scrapeMotionValuesFromProps:vu,createRenderState:Pf}),Wf=Symbol.for(`motionComponentSymbol`);function Gf(e,t,n){let r=(0,d.useRef)(n);(0,d.useInsertionEffect)(()=>{r.current=n});let i=(0,d.useRef)(null);return(0,d.useCallback)(n=>{n&&e.onMount?.(n);let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n);t&&(n?t.mount(n):t.unmount())},[t])}var Kf=(0,d.createContext)({});function qf(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Jf(e,t,n,r,i,a){let{visualElement:o}=(0,d.useContext)(Tf),s=(0,d.useContext)(df),c=(0,d.useContext)(Cr),l=(0,d.useContext)(lf),u=l.reducedMotion,f=l.skipAnimations,p=(0,d.useRef)(null),m=(0,d.useRef)(!1);r||=s.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:f,isSVG:a}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));let h=p.current,g=(0,d.useContext)(Kf);h&&!h.projection&&i&&(h.type===`html`||h.type===`svg`)&&Yf(p.current,n,i,g);let _=(0,d.useRef)(!1);(0,d.useInsertionEffect)(()=>{h&&_.current&&h.update(n,c)});let v=n[qs],y=(0,d.useRef)(!!v&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Sr(()=>{m.current=!0,h&&(_.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),y.current&&h.animationState&&h.animationState.animateChanges())}),(0,d.useEffect)(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),!1),h.enteringChildren=void 0)}),h}function Yf(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Xf(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&qf(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Xf(e){if(e)return e.options.allowProjection===!1?Xf(e.parent):e.projection}function Zf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&gf(r);let a=n?n===`svg`:Lf(e),o=a?Uf:Hf;function s(n,s){let c,l={...(0,d.useContext)(lf),...n,layoutId:Qf(n)},{isStatic:u}=l,p=Df(n),m=o(n,u);if(!u&&typeof window<`u`){$f(l,r);let t=ep(l);c=t.MeasureLayout,p.visualElement=Jf(e,m,l,i,t.ProjectionNode,a)}return(0,f.jsxs)(Tf.Provider,{value:p,children:[c&&p.visualElement?(0,f.jsx)(c,{visualElement:p.visualElement,...l}):null,Rf(e,n,Gf(m,p.visualElement,s),m,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,d.forwardRef)(s);return c[Wf]=e,c}function Qf({layoutId:e}){let t=(0,d.useContext)(br).id;return t&&e!==void 0?t+`-`+e:e}function $f(e,t){let n=(0,d.useContext)(df).strict;if(process.env.NODE_ENV!==`production`&&t&&n){let t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Or(!1,t,`lazy-strict-mode`):kr(!1,t,`lazy-strict-mode`)}}function ep(e){let{drag:t,layout:n}=hf();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function tp(e,t){if(typeof Proxy>`u`)return Zf;let n=new Map,r=(n,r)=>Zf(n,r,e,t);return new Proxy((e,t)=>(process.env.NODE_ENV!==`production`&&Wr(!1,`motion() is deprecated. Use motion.create() instead.`),r(e,t)),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Zf(a,void 0,e,t)),n.get(a))})}var np=(e,t)=>t.isSVG??Lf(e)?new yu(t):new lu(t,{allowProjection:e!==d.Fragment}),rp=class extends kl{constructor(e){super(e),e.animationState||=Eu(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();fl(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},ip=0,ap={animation:{Feature:rp},exit:{Feature:class extends kl{constructor(){super(...arguments),this.id=ip++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`){let n=Ms(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function op(e){return{point:{x:e.pageX,y:e.pageY}}}var sp=e=>t=>jc(t)&&e(t,op(t));function cp(e,t,n,r){return yd(e,t,sp(n),r)}var lp=({current:e})=>e?e.ownerDocument.defaultView:null,up=(e,t)=>Math.abs(e-t);function dp(e,t){let n=up(e.x,t.x),r=up(e.y,t.y);return Math.sqrt(n**2+r**2)}var fp=new Set([`auto`,`scroll`]),pp=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=mp(this.lastRawMoveEventInfo,this.transformPagePoint));let e=gp(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=dp(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=yi;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=mp(t,this.transformPagePoint),J.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=gp(e.type===`pointercancel`?this.lastMoveEventInfo:mp(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!jc(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=mp(op(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=yi;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,gp(s,this.history)),this.removeListeners=Lr(cp(this.contextWindow,`pointermove`,this.handlePointerMove),cp(this.contextWindow,`pointerup`,this.handlePointerUp),cp(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(fp.has(e.overflowX)||fp.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),J.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),vi(this.updatePoint)}};function mp(e,t){return t?{point:t(e.point)}:e}function hp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gp({point:e},t){return{point:e,delta:hp(e,vp(t)),offset:hp(e,_p(t)),velocity:yp(t,.1)}}function _p(e){return e[0]}function vp(e){return e[e.length-1]}function yp(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=vp(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Br(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Br(t)*2&&(r=e[1]);let a=Vr(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function bp(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?X(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?X(n,e,r.max):Math.min(e,n)),e}function xp(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Sp(e,{top:t,left:n,bottom:r,right:i}){return{x:xp(e.x,n,i),y:xp(e.y,t,r)}}function Cp(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function wp(e,t){return{x:Cp(e.x,t.x),y:Cp(e.y,t.y)}}function Tp(e,t){let n=.5,r=zu(e),i=zu(t);return i>r?n=Rr(t.min,t.max-r,e.min):r>i&&(n=Rr(e.min,e.max-i,t.min)),Er(0,1,n)}function Ep(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Dp=.35;function Op(e=Dp){return e===!1?e=0:e===!0&&(e=Dp),{x:kp(e,`left`,`right`),y:kp(e,`top`,`bottom`)}}function kp(e,t,n){return{min:Ap(e,t),max:Ap(e,n)}}function Ap(e,t){return typeof e==`number`?e:e[t]||0}var jp=new WeakMap,Mp=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ul(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(op(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ec(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),sd(e=>{let t=this.getAxisMotionValue(e).get()||0;if(qi.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=zu(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&J.update(()=>i(e,t),!1,!0),Gs(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Ip(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&J.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new pp(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:lp(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&J.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Fp(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=bp(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&qf(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Sp(n.layoutBox,e):this.constraints=!1,this.elastic=Op(t),r!==this.constraints&&!qf(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&sd(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Ep(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!qf(e))return!1;let n=e.current;kr(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",`drag-constraints-ref`);let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Xl(n,r.root,this.visualElement.getTransformPagePoint()),a=wp(r.layout.layoutBox,i);if(t){let e=t(jl(a));this.hasMutatedConstraints=!!e,e&&(a=Al(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=sd(o=>{if(!Fp(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Gs(this.visualElement,e),n.start(ks(e,n,0,t,this.visualElement,!1))}stopAnimation(){sd(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){sd(t=>{let{drag:n}=this.getProps();if(!Fp(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-X(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!qf(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};sd(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Tp({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),sd(t=>{if(!Fp(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(X(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;jp.set(this.visualElement,this);let e=this.visualElement.current,t=cp(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&Fc(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();qf(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=Pp(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),J.read(r);let o=yd(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(sd(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Dp,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Np(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Pp(e,t,n){let r=rl(e,Np(n)),i=rl(t,Np(n));return()=>{r(),i()}}function Fp(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Ip(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Lp=class extends kl{constructor(e){super(e),this.removeGroupControls=Fr,this.removeListeners=Fr,this.controls=new Mp(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Fr}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Rp=e=>(t,n)=>{e&&J.update(()=>e(t,n),!1,!0)},zp=class extends kl{constructor(){super(...arguments),this.removePointerDownListener=Fr}onPointerDown(e){this.session=new pp(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lp(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Rp(e),onStart:Rp(t),onMove:Rp(n),onEnd:(e,t)=>{delete this.session,r&&J.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=cp(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Bp=!1,Vp=class extends d.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Bp&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Td.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Bp=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||J.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Sc.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Bp=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Hp(e){let[t,n]=uf(),r=(0,d.useContext)(br);return(0,f.jsx)(Vp,{...e,layoutGroup:r,switchLayoutGroup:(0,d.useContext)(Kf),isPresent:t,safeToRemove:n})}var Up={pan:{Feature:zp},drag:{Feature:Lp,ProjectionNode:cf,MeasureLayout:Hp}};function Wp(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&J.postRender(()=>i(t,op(t)))}var Gp=class extends kl{mount(){let{current:e}=this.node;e&&(this.unmount=kc(e,(e,t)=>(Wp(this.node,t,`Start`),e=>Wp(this.node,e,`End`))))}unmount(){}},Kp=class extends kl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Lr(yd(this.node.current,`focus`,()=>this.onFocus()),yd(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function qp(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&J.postRender(()=>i(t,op(t)))}var Jp=class extends kl{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Hc(e,(e,t)=>(qp(this.node,t,`Start`),(e,{success:t})=>qp(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Yp=new WeakMap,Xp=new WeakMap,Zp=e=>{let t=Yp.get(e.target);t&&t(e)},Qp=e=>{e.forEach(Zp)};function $p({root:e,...t}){let n=e||document;Xp.has(n)||Xp.set(n,{});let r=Xp.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Qp,{root:e,...t})),r[i]}function em(e,t,n){let r=$p(t);return Yp.set(e,n),r.observe(e),()=>{Yp.delete(e),r.unobserve(e)}}var tm={some:0,all:1},nm=class extends kl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:tm[r]};this.stopObserver=em(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(rm(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function rm({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var im={inView:{Feature:nm},tap:{Feature:Jp},focus:{Feature:Kp},hover:{Feature:Gp}},am={layout:{ProjectionNode:cf,MeasureLayout:Hp}},om=tp({...ap,...im,...Up,...am},np),sm=24e3,cm=2048,lm=1200,um=.05,dm=4,fm=.03,pm=2,mm=11;function hm(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t/e.length)}function gm(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n++){let r=Math.max(-1,Math.min(1,e[n]));t[n]=r<0?r*32768:r*32767}return t}function _m(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]/32768;return t}var vm=.09,ym=[`audio/webm`,`audio/mp4`];function bm(){return typeof window>`u`||window.MediaRecorder===void 0?null:ym.find(e=>window.MediaRecorder.isTypeSupported(e))||null}function xm(e,t,n,r,i){if(!r.length||!n||!e)return;let a=new Blob(r,{type:i}),o=new FormData;o.append(`audio`,a,`aichat-${n}.webm`),o.append(`voiceSessionId`,n),o.append(`siteId`,t||``),fetch(`${e}/api/voice/upload-chat-recording`,{method:`POST`,body:o}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(e=>console.warn(`[FlowEngage] voice recording upload failed:`,e.message))}function Sm(e,t,n){let r=0,i=0,a=[],o=()=>{a.forEach(e=>{try{e.stop()}catch{}}),a=[],r=0},s=()=>r>e.currentTime;return{enqueue:o=>{let c=_m(o),l=e.createBuffer(1,c.length,sm);l.copyToChannel(c,0);let u=e.createBufferSource();u.buffer=l,u.connect(e.destination),n&&u.connect(n);let d=!s(),f=d?e.currentTime+vm:r;d&&(i=f),u.start(f),r=f+l.duration,a.push(u),u.onended=()=>{a=a.filter(e=>e!==u),!a.length&&!s()&&t?.()}},stop:o,isPlaying:s,playedMs:()=>Math.max(0,(e.currentTime-i)*1e3)}}async function Cm(e,t,n){let r=new URLSearchParams({siteId:t||``});n&&r.set(`chatId`,n);let i=await fetch(`${e}/api/voice/session?${r.toString()}`,{method:`GET`,headers:{"Content-Type":`application/json`}});if(i.status===429){let e=await i.json().catch(()=>({}));throw Error(e.message||`Too many voice sessions started. Please wait a minute before trying again.`)}if(!i.ok)throw Error(`Could not start a voice session.`);let a=await i.json();if(!a?.success||!a.wsUrl)throw Error(a?.error||`Voice session was refused.`);return a}async function wm(e){let{apiBaseUrl:t,siteId:n,chatId:r,clientTools:i={},onConnect:a,onDisconnect:o,onMessage:s,onModeChange:c,onError:l,onUnhandledClientToolCall:u,onAgentTurnEnd:d,onSessionInfo:f,onSessionEnding:p}=e,m=await Cm(t,n,r);f?.({emailOnFile:!!m.emailOnFile});let h={type:`Start`};e.greeting!==void 0&&(h.greeting=e.greeting||null);let g=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),_=new(window.AudioContext||window.webkitAudioContext)({sampleRate:sm});_.state===`suspended`&&await _.resume();let v=_.createMediaStreamDestination(),y=bm(),b=[],x=null,S=r||n||null;y&&(x=new window.MediaRecorder(v.stream,{mimeType:y}),x.ondataavailable=e=>{e.data&&e.data.size>0&&b.push(e.data)},x.start());let C=new WebSocket(m.wsUrl);C.binaryType=`arraybuffer`;let w=new Set,T={role:null,text:``,timer:null,debug:null},E=``,ee=()=>{T.timer&&=(clearTimeout(T.timer),null);let e=T.text.trim(),t=T.role,n=T.debug;if(T.text=``,T.role=null,T.debug=null,!(!e||!t)){if(t===`agent`){if(e===E){console.debug(`[FlowEngage] duplicate agent turn suppressed`);return}E=e}s?.({role:t,message:e,debug:n})}},te=(e,t,n)=>{t&&(T.role&&T.role!==e&&ee(),T.role=e,T.text=T.text?`${T.text} ${t}`.replace(/\s+/g,` `):t,n&&(T.debug=n),T.timer&&clearTimeout(T.timer),T.timer=setTimeout(ee,lm))},D=!1,ne=!1,re=!1,O=!1,ie=!0,k=0,ae=!1,oe=!1,se=um,A=dm,j=null,ce=!1,M=!1,le=()=>{j&&clearTimeout(j);let e=()=>{if(!D){if(N.isPlaying()){j=setTimeout(e,150);return}if(j=null,ce){p?.();return}!D&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`PlaybackDrained`})),M&&(M=!1,d?.())}};j=setTimeout(e,150)},N=Sm(_,()=>{O&&(O=!1,c?.({mode:`listening`}))},v),ue=_.createMediaStreamSource(g);ue.connect(v);let de=_.createScriptProcessor(cm,1,1),fe=!1,pe=0,me=0;de.onaudioprocess=e=>{if(D||C.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),n=()=>C.send(new Int16Array(t.length).buffer);if(ne){re||(re=!0,console.debug(`[FlowEngage] mic held — streaming silence to keep socket alive`)),fe=!1,pe=0,me=0,n();return}let r=hm(t);if(N.isPlaying()||oe?(fe=!1,pe=0,me=0):r>=fm?(me=0,pe+=1,!fe&&pe>=pm&&(fe=!0,c?.({mode:`user-speaking`}))):(pe=0,fe&&++me>=mm&&(fe=!1,me=0,c?.({mode:`thinking`,tentative:!0}))),(N.isPlaying()||oe)&&!ae){if(r<se){k=0,n();return}if(k+=1,k<A){n();return}ae=!0,k=0;let e=N.playedMs();N.stop(),ie=!1,oe=!1,j&&!ce&&(clearTimeout(j),j=null),M=!1,C.send(JSON.stringify({type:`VisitorInterrupted`,played_ms:Math.round(e)})),console.debug(`[FlowEngage] barge-in — visitor spoke over the agent`)}C.send(gm(t).buffer)},ue.connect(de),de.connect(_.destination);let he=()=>{if(!D){D=!0,j&&=(clearTimeout(j),null),ee(),N.stop();try{de.disconnect(),ue.disconnect()}catch{}if(g.getTracks().forEach(e=>e.stop()),x&&x.state!==`inactive`){x.onstop=()=>xm(t,n,S,b,y);try{x.stop()}catch{x.onstop=null}}else b.length&&xm(t,n,S,b,y);_.close().catch(()=>{}),(C.readyState===WebSocket.OPEN||C.readyState===WebSocket.CONNECTING)&&C.close()}},ge=async e=>{let t=i[e.name];if(!t)return u?.({tool_name:e.name}),{error:`Unknown tool ${e.name}`};let n={};try{n=JSON.parse(e.arguments||`{}`)}catch{}try{return await t(n)}catch(e){return{error:e?.message||`Tool execution failed`}}},P=async e=>{for(let t of e.functions||[]){if(!t.client_side)continue;let e=await ge(t);if(D||C.readyState!==WebSocket.OPEN)return;C.send(JSON.stringify({type:`FunctionCallResponse`,id:t.id,name:t.name,content:typeof e==`string`?e:JSON.stringify(e??{})}))}},_e=e=>{switch(e.type){case`Welcome`:Number.isFinite(e.barge_in_rms)&&e.barge_in_rms>0&&(se=e.barge_in_rms),Number.isFinite(e.barge_in_frames)&&e.barge_in_frames>0&&(A=e.barge_in_frames),S=e.session_id||r||n||null,a?.({conversationId:S});break;case`ConversationText`:{let t=String(e.content||``);if(e.role===`user`){let e=t.trim();if(w.has(e)){w.delete(e);break}if(/^\[SYSTEM:/i.test(e)||/^Continue (now )?to the next section/i.test(e)||/^That was the last section/i.test(e)){console.debug(`[FlowEngage] widget instruction hidden from transcript`);break}}te(e.role===`user`?`user`:`agent`,t,e.debug);break}case`UserStartedSpeaking`:ee(),N.stop(),oe=!1,ie=!1,O=!1,j&&!ce&&(clearTimeout(j),j=null),M=!1,c?.({mode:`listening`});break;case`AgentStartedSpeaking`:ie=!0,O=!0,ae=!1,k=0,c?.({mode:`speaking`});break;case`AgentAudioDone`:oe=!1,ee(),e.turnComplete===!0&&(M=!0),le(),N.isPlaying()||(O=!1,c?.({mode:`listening`}));break;case`FunctionCallRequest`:P(e);break;case`AgentPreparing`:oe=!0;break;case`AgentTurnComplete`:M=!0,le();break;case`SessionEnding`:console.debug(`[FlowEngage] server is ending the session:`,e.reason||`unspecified`),ce=!0;break;case`AgentThinking`:c?.({mode:`thinking`});break;case`PromptUpdated`:break;case`Error`:console.error(`[FlowEngage:Voice]`,e.code||``,e.description||e),l?.(Error(e.description||`Voice service error`));break;case`Warning`:console.warn(`[FlowEngage:Voice]`,e.code||``,e.description||``);break;default:break}};return C.onopen=()=>C.send(JSON.stringify(h)),C.onmessage=e=>{if(e.data instanceof ArrayBuffer){ie&&N.enqueue(new Int16Array(e.data));return}try{_e(JSON.parse(e.data))}catch{}},C.onerror=()=>l?.(Error(`Voice connection failed`)),C.onclose=()=>{he(),o?.()},{endSession:async()=>he(),sendContextualUpdate:e=>{D||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`UpdatePrompt`,prompt:e}))},sendUserMessage:(e,{silent:t=!0,suppressQuestion:n=!1}={})=>{D||C.readyState!==WebSocket.OPEN||!e||(t&&w.add(e.trim()),C.send(JSON.stringify({type:`InjectUserMessage`,content:e,suppress_question:n})))},injectAgentSpeech:(e,t=`interrupt`)=>{D||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`InjectAgentMessage`,message:e,behavior:t}))},setWalkthroughActive:e=>{D||C.readyState!==WebSocket.OPEN||C.send(JSON.stringify({type:`WalkthroughActive`,active:!!e}))},setMicMuted:e=>{ne=!!e,!D&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`MicHeld`,held:ne}))},get status(){return D?`disconnected`:`connected`}}}var Tm={startSession:wm},Em=({size:e=18,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`,fill:t}),(0,f.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),Dm=({size:e=20})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M10.68 13.31a16 16 0 003.41 2.6l1.27-1.27a2 2 0 012.11-.45 12.84 12.84 0 002.81.7 2 2 0 011.72 2v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07A19.42 19.42 0 013.07 8.62 19.79 19.79 0 01.1 2 2 2 0 012.11 0h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L6.18 7.84`}),(0,f.jsx)(`line`,{x1:`23`,y1:`1`,x2:`1`,y2:`23`})]}),Om=({size:e=18})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`5`}),(0,f.jsx)(`polyline`,{points:`5 12 12 5 19 12`})]}),km=()=>(0,f.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`polyline`,{points:`9 17 4 12 9 7`}),(0,f.jsx)(`path`,{d:`M20 18v-2a4 4 0 00-4-4H4`})]}),Am=()=>(0,f.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z`})}),jm=({className:e=``})=>(0,f.jsxs)(`svg`,{className:e,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,f.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,f.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),Mm=({size:e=14})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M12 8V4H8`}),(0,f.jsx)(`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}),(0,f.jsx)(`path`,{d:`M2 14h2`}),(0,f.jsx)(`path`,{d:`M20 14h2`}),(0,f.jsx)(`path`,{d:`M15 13v2`}),(0,f.jsx)(`path`,{d:`M9 13v2`})]}),Nm=({size:e=20,strokeWidth:t=2,color:n=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:n,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,f.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),Pm=({size:e=20,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`,fill:t}),(0,f.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`,fill:t}),(0,f.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`,fill:t})]}),Fm=({size:e=20,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`path`,{d:`M22 11.5667C22 16.8499 17.5222 21.1334 12 21.1334C11.3507 21.1343 10.7032 21.0742 10.0654 20.9545C9.60633 20.8682 9.37678 20.8251 9.21653 20.8496C9.05627 20.8741 8.82918 20.9948 8.37499 21.2364C7.09014 21.9197 5.59195 22.161 4.15111 21.893C4.69874 21.2194 5.07275 20.4112 5.23778 19.5448C5.33778 19.0148 5.09 18.5 4.71889 18.1231C3.03333 16.4115 2 14.1051 2 11.5667C2 6.28357 6.47778 2 12 2C17.5222 2 22 6.28357 22 11.5667Z`,stroke:`white`,"stroke-width":`1.5`,"stroke-linejoin":`round`}),(0,f.jsx)(`path`,{d:`M11.9955 12H12.0045M15.991 12H16M8 12H8.00897`,stroke:`white`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]}),Im=()=>(0,f.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,f.jsx)(`path`,{d:`M16.7133 8.59374C18.1939 8.98463 19.2229 9.47922 20.1589 10.0848C21.5432 10.9804 22.1367 12.5944 21.9737 14.1517C21.9049 14.8099 21.3744 15.1246 20.7592 14.9544L19.3705 14.57C18.2697 14.2653 17.7193 14.1129 17.3837 13.71C17.0481 13.307 17.0086 12.751 16.9296 11.6391L16.7133 8.59374ZM16.7133 8.59374C13.7164 7.80255 10.2871 7.80163 7.28669 8.59374M7.28669 8.59374C5.80606 8.98463 4.77711 9.47923 3.84113 10.0848C2.45683 10.9804 1.86334 12.5944 2.02628 14.1517C2.09514 14.8099 2.62563 15.1246 3.24078 14.9544L4.62954 14.57C5.73032 14.2653 6.28071 14.1129 6.61631 13.71C6.95191 13.307 6.9914 12.751 7.07038 11.6391L7.28669 8.59374Z`,stroke:`#E30C12`,"stroke-width":`1.5`,"stroke-linejoin":`round`})}),Lm=({size:e=24})=>(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M12 19v3`}),(0,f.jsx)(`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`}),(0,f.jsx)(`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`}),(0,f.jsx)(`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`}),(0,f.jsx)(`path`,{d:`m2 2 20 20`}),(0,f.jsx)(`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`})]}),Rm=(e=``)=>String(e).replace(/<[^>]+>/g,``).replace(/\s+/g,` `).trim(),zm=(e=``)=>String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),Bm=new Set([`p`,`br`,`ul`,`ol`,`li`,`strong`,`em`,`b`,`i`,`a`]),Vm=/^https?:\/\//i;function Hm(e){let t=Array.from(e.childNodes);for(let n of t)if(n.nodeType===Node.ELEMENT_NODE){let t=n.tagName.toLowerCase();if(!Bm.has(t)){e.replaceChild(document.createTextNode(n.textContent),n);continue}let r={};if(t===`a`){let e=n.getAttribute(`href`)||``;Vm.test(e)&&(r.href=e),r.target=`_blank`,r.rel=`noopener noreferrer`}for(;n.attributes.length>0;)n.removeAttribute(n.attributes[0].name);for(let[e,t]of Object.entries(r))n.setAttribute(e,t);Hm(n)}else n.nodeType!==Node.TEXT_NODE&&e.removeChild(n)}function Um(e){let t=document.createElement(`div`);return t.innerHTML=e,Hm(t),t.innerHTML}function Wm(e){let t=String(e||``).trim();if(!t)return t;let n=/^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);if(n&&!/<\/?strong\b/i.test(n[1]))return`<p>${n[1]}</p>`;let r=/^<strong>([\s\S]*?)<\/strong>$/i.exec(t);if(r&&!/<\/?strong\b/i.test(r[1])){let e=r[1].trim();return/^<(?:p|ul|ol)\b/i.test(e)?e:`<p>${e}</p>`}return e}var Gm=(e=``)=>{let t=String(e||``).trim();if(!t)return``;if(/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t))return Wm(Um(t));let n=t.replace(/\r\n/g,`
25
+ `,document.head.appendChild(e)};function Yn(e,t){if(typeof document>`u`)return null;if(e){let n=document.getElementById(e)||document.querySelector(`[data-section="${e}"]`);if(n)return n;t||=e.replace(/[-_]+/g,` `).trim()}if(!t)return null;let n=t.toLowerCase().trim(),r=n.split(/\s+/).filter(e=>e.length>2),i=Array.from(document.querySelectorAll(`h1.h2.h3.h4.h5.h6.[data-section].section[id].[id].main li.article li.[role='main'] li.[class*='card'].[class*='Card'].[class*='feature'].[class*='Feature'].[class*='tier'].[class*='Tier'].[class*='plan'].[class*='Plan'].[class*='pricing'].[class*='Pricing'].[class*='testimonial'].[class*='Testimonial'].[class*='team'].[class*='Team'].[class*='service'].[class*='Service'].[class*='block'].[role='listitem'].[role='article'].[role='region'].dt.dd`.split(`.`).join(`, `))).filter(e=>{if(_n(e))return!1;let t=e.textContent.trim();return!(t.length<3||t.length>5e3||e.closest(`nav, footer, header, aside, .nav, .footer, .header`))});for(let e of i)if(vn(e).toLowerCase()===n)return e;for(let e of i){let t=vn(e).toLowerCase();if(t.startsWith(n)||t.endsWith(n))return e}let a=[];for(let e of i){let t=vn(e).toLowerCase();t.includes(n)&&a.push({el:e,len:t.length})}if(a.length)return a.sort((e,t)=>e.len-t.len),a[0].el;for(let e of i){let t=vn(e).toLowerCase();if(t.length>3&&n.includes(t))return e}if(r.length>0){let e=null,t=0;for(let n of i){let i=vn(n).toLowerCase(),a=0;for(let e of r)i.includes(e)&&a++;let o=a/r.length;o>t&&o>=.6&&(t=o,e=n)}if(e)return e}let o=Array.from(document.querySelectorAll(`main [role='group']`)).filter(e=>!_n(e)),s=[];for(let e of o){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();t.length<15||t.length>8e3||t.includes(n)&&s.push({el:e,len:t.length})}if(s.length)return s.sort((e,t)=>e.len-t.len),s[0].el;if(r.length>0){let e=Array.from(document.querySelectorAll(`main a[href], article a[href], .views-row a[href], h2 a[href], h3 a[href], .card a[href], [class*='teaser'] a[href]`)).filter(e=>{if(_n(e))return!1;try{let t=e.getAttribute(`href`)||``;if(!t||t===`#`||t.startsWith(`javascript:`))return!1}catch{return!1}let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>=3&&t.length<=220}),t=null,n=0;for(let i of e){let e=i.textContent.replace(/\s+/g,` `).toLowerCase(),a=0;for(let t of r)e.includes(t)&&a++;let o=a/r.length;o>n&&o>=.5&&(n=o,t=i)}if(t)return t.closest(`article`)||t.closest(`.views-row`)||t}let c=document.querySelectorAll(`section, article, .card, [class*='feature'], [class*='service']`);for(let e of c){if(_n(e))continue;let t=e.querySelector(`h1, h2, h3, h4, h5, h6`);if(t){let r=t.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(r.includes(n)||n.includes(r))return e}}let l=document.querySelectorAll(`li, strong, blockquote, dt`);for(let e of l){if(_n(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e.tagName===`STRONG`&&e.parentElement?.tagName===`LI`?e.parentElement:e}let u=Array.from(document.querySelectorAll(`a[href]`)).filter(e=>!_n(e));u.sort((e,t)=>(e.textContent||``).trim().length-(t.textContent||``).trim().length);for(let e of u){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e}let d=document.querySelectorAll(`p`);for(let e of d){if(_n(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<800)return e}return null}function Xn(e,{speaking:t=!1,scroll:n=!0}={}){if(!e||typeof document>`u`)return;Jn();let r=document.querySelectorAll(`.fe-highlight-section`);for(let t of r)t!==e&&(t.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`),t.classList.add(`fe-highlight-exiting`),setTimeout(()=>t.classList.remove(`fe-highlight-exiting`),300));if(e.classList.remove(`fe-highlight-exiting`),e.classList.add(`fe-highlight-section`),t?e.classList.add(`fe-highlight-speaking`):e.classList.remove(`fe-highlight-speaking`),n)try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{try{e.scrollIntoView(!0)}catch{}}}function Zn(){typeof document>`u`||(document.querySelectorAll(`.fe-highlight-section, .fe-highlight-exiting`).forEach(e=>e.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`,`fe-highlight-exiting`)),hn())}function Qn(e){if(typeof window>`u`)return e;try{let t=new URL(String(e).trim(),window.location.href);return!/^https?:$/i.test(t.protocol)||t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href}catch{return e}}async function $n(e){if(typeof window>`u`)return!1;try{let t=new URL(String(e).trim(),window.location.href),n=t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href;return(await fetch(n,{method:`HEAD`,mode:`same-origin`,cache:`no-store`})).ok}catch{return!1}}async function er(e,{siteId:t,apiBaseUrl:n}){if(!e)return{allowed:!1,correctedUrl:null};let r=!1;try{r=!!Pn()}catch{r=!1}let i=async()=>({allowed:r?!1:await $n(e),correctedUrl:null});if(!t||!n)return console.warn(`[FlowEngage] shouldProceedWithNavigation: missing siteId or apiBaseUrl`),i();let a=String(n).replace(/\/$/,``),o=new URLSearchParams({siteId:String(t),url:String(e).trim()});try{let e=await(await fetch(`${a}/api/widget/navigate-allowed?${o.toString()}`)).json().catch(()=>({}));return e.success&&e.allowed?{allowed:!0,correctedUrl:e.correctedUrl||null}:i()}catch(e){return console.warn(`[FlowEngage] navigate-allowed check failed:`,e?.message),i()}}function tr(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(yn,JSON.stringify({sectionText:e,ts:Date.now()}))}catch{}}async function nr(e,{skipPushState:t=!1,isBack:n=!1}={}){if(typeof window>`u`||typeof document>`u`)return!1;try{if(new URL(e,window.location.href).origin!==window.location.origin)return!1}catch{return!1}Gn();let r=new AbortController,i=setTimeout(()=>r.abort(),8e3);try{let a=await fetch(e,{credentials:`same-origin`,cache:`no-store`,signal:r.signal});if(clearTimeout(i),!a.ok)return Kn(),!1;let o=await a.text(),s=new DOMParser().parseFromString(o,`text/html`),c=document.getElementById(`flowengage-root`);if(!c)return Kn(),!1;try{typeof window.Drupal?.detachBehaviors==`function`&&window.Drupal.detachBehaviors(document.body,window.drupalSettings)}catch{}document.querySelectorAll(`script`).forEach(e=>{e.setAttribute(`data-fe-original`,`true`)}),Array.from(document.body.children).forEach(e=>{if(e===c)return;let t=e.tagName?.toUpperCase();t===`AUDIO`||t===`VIDEO`||e.remove()}),In();let l=new Set(Array.from(document.querySelectorAll(`link[rel='stylesheet']`)).map(e=>{try{return new URL(e.getAttribute(`href`)||``,window.location.href).href}catch{return``}}));for(let t of Array.from(s.head.querySelectorAll(`link[rel='stylesheet']`))){let n=t.getAttribute(`href`);if(!n)continue;let r;try{r=new URL(n,e).href}catch{continue}if(l.has(r))continue;let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=r,i.setAttribute(Fn,`true`),t.media&&(i.media=t.media),document.head.appendChild(i)}for(let e of Array.from(s.head.querySelectorAll(`style`))){if(!e.textContent.trim())continue;let t=e.textContent.trim().slice(0,120);if(Array.from(document.head.querySelectorAll(`style:not([data-fe-swap-css])`)).some(e=>e.textContent.trim().slice(0,120)===t))continue;let n=document.createElement(`style`);n.textContent=e.textContent,n.setAttribute(Fn,`true`),document.head.appendChild(n)}Array.from(s.body.children).forEach(e=>{e.tagName?.toUpperCase()!==`SCRIPT`&&document.body.insertBefore(document.importNode(e,!0),c)});let u=document.querySelectorAll(`script:not([data-fe-replayed])`);for(let e of u){if(e.closest(`#flowengage-root, .flowengage-shell`)||e.hasAttribute(`data-fe-original`)||e.hasAttribute(`data-fe-replayed`))continue;let t=e.getAttribute(`src`),n=e.getAttribute(`type`)||``;if(!(n&&n!==`text/javascript`&&n!==``&&!n.includes(`drupal-ajax`))){if(n.includes(`drupal-ajax`)){e.setAttribute(`data-fe-replayed`,`true`);try{let t=JSON.parse(e.textContent);if(Array.isArray(t))for(let e of t){if((e.command===`insert`||e.command===`insert_new_content`)&&e.selector&&e.data){let t=document.querySelector(e.selector);t&&(e.method===`replaceWith`?t.outerHTML=e.data:e.method===`html`||e.method===`replace`?t.innerHTML=e.data:e.method===`append`?t.insertAdjacentHTML(`beforeend`,e.data):e.method===`prepend`?t.insertAdjacentHTML(`afterbegin`,e.data):t.innerHTML=e.data,q(`trySpaNavigate: BigPipe replacement →`,e.selector))}if(e.command===`settings`&&e.settings)try{window.drupalSettings&&typeof window.drupalSettings==`object`&&Object.assign(window.drupalSettings,e.settings)}catch{}}}catch(e){q(`trySpaNavigate: BigPipe parse error:`,e.message)}continue}if(!t&&e.textContent.trim()){let t=e.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(t)){e.setAttribute(`data-fe-replayed`,`true`);continue}let n=document.createElement(`script`);n.textContent=t,n.setAttribute(`data-fe-replayed`,`true`),e.parentNode.replaceChild(n,e)}}}try{for(let e of Array.from(s.querySelectorAll(`script`))){let t=(e.textContent||``).match(/drupalSettings\s*[,=]\s*(\{[\s\S]*?\})\s*[;)]/);if(t){try{let e=JSON.parse(t[1]);window.drupalSettings&&typeof window.drupalSettings==`object`?Object.assign(window.drupalSettings,e):window.drupalSettings=e,q(`trySpaNavigate: updated drupalSettings from new page`)}catch{}break}}}catch{}let d=window.location.assign.bind(window.location),f=window.location.replace.bind(window.location),p=!0;window.location.assign=e=>{if(p){q(`trySpaNavigate: blocked location.assign from replayed script:`,e);return}return d(e)},window.location.replace=e=>{if(p){q(`trySpaNavigate: blocked location.replace from replayed script:`,e);return}return f(e)};function m(e){let t=e.toLowerCase();return!!(/\/jquery[.\-\/]/.test(t)||/\/jquery\.min\.js/.test(t)||/\/jquery-once/.test(t)||/\/jquery\.once/.test(t)||/\/jquery\.ui[\./]/.test(t)||/\/jqueryui/.test(t)||/\/core\/misc\//.test(t)||/\/core\/modules\//.test(t)||/\/misc\/drupal\.js/.test(t)||/\/lodash[.\-\/]/.test(t)||/\/underscore[.\-\/]/.test(t)||/\/backbone[.\-\/]/.test(t)||/\/modernizr[.\-\/]/.test(t)||/\/popper[.\-\/]/.test(t)||/\/bootstrap\.min\.js/.test(t)||/\/bootstrap\.bundle/.test(t))}let h=new Set(Array.from(document.querySelectorAll(`script[src]`)).map(e=>{try{return new URL(e.getAttribute(`src`)||``,window.location.href).href}catch{return``}}));function g(t,n){let r=t.getAttribute(`src`)||``;if(r.includes(`flowengage`))return;let i=document.createElement(`script`);if(r){let n;try{n=new URL(r,e).href}catch{return}if(h.has(n)){if(m(n))return;q(`trySpaNavigate: re-running theme/custom script:`,n)}h.add(n),i.src=n,i.async=t.async,i.defer=t.defer}else if(t.textContent.trim()){let e=t.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(e)){q(`trySpaNavigate: skipping inline script with navigation:`,e.slice(0,120));return}if(/^\s*\(?\s*(?:window\.)?drupalSettings\s*[,=]/.test(e))return;i.textContent=e}else return;let a=t.getAttribute(`type`);a&&a!==`text/javascript`&&a!==``&&(i.type=a),n.parentNode.insertBefore(i,n)}for(let e of Array.from(s.head.querySelectorAll(`script`)))g(e,c);for(let e of Array.from(s.body.querySelectorAll(`script`)))g(e,c);try{typeof window.Drupal?.attachBehaviors==`function`&&window.Drupal.attachBehaviors(document.body,window.drupalSettings)}catch{}try{typeof window.jQuery==`function`&&(window.jQuery(document).trigger(`ready`),window.dispatchEvent(new Event(`resize`)))}catch{}try{document.dispatchEvent(new Event(`DOMContentLoaded`,{bubbles:!0,cancelable:!1}))}catch{}try{window.dispatchEvent(new Event(`load`))}catch{}try{let e=document.querySelectorAll(`iframe:not([data-fe-skip-reload])`);for(let t of e){if(t.closest(`#flowengage-root, .flowengage-shell`))continue;let e=t.getAttribute(`src`)||t.src;e&&e!==`about:blank`&&!e.startsWith(`javascript:`)&&(q(`trySpaNavigate: reloading iframe:`,e),t.src=e)}}catch{}try{let e=document.querySelectorAll(`.g-recaptcha, [data-sitekey]`);if(e.length>0){if(typeof window.grecaptcha?.render==`function`){for(let t of e)if(!t.closest(`#flowengage-root`)){t.innerHTML=``;try{window.grecaptcha.render(t,{sitekey:t.getAttribute(`data-sitekey`)||``}),q(`trySpaNavigate: re-rendered reCAPTCHA`)}catch{}}}else if(!document.querySelector(`script[src*='recaptcha']`)){let e=document.createElement(`script`);e.src=`https://www.google.com/recaptcha/api.js?render=explicit`,e.async=!0,document.head.appendChild(e),q(`trySpaNavigate: injected reCAPTCHA script`)}}}catch{}if(setTimeout(()=>{p=!1,window.location.assign=d,window.location.replace=f},2e3),s.title&&(document.title=s.title),!t)try{history.pushState({flowengageSpa:!0},``,e)}catch{}if(kn(),jn(),n){try{zn()}catch{}try{Hn()}catch{}}else window.scrollTo(0,0);Kn(),Un(e);try{sessionStorage.removeItem(yn)}catch{}try{sessionStorage.removeItem(xn)}catch{}try{On=new URL(e,window.location.origin).pathname}catch{}return q(`trySpaNavigate: succeeded →`,e),!0}catch{return clearTimeout(i),Kn(),!1}}function rr(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(xn,JSON.stringify({voiceWasActive:!0,targetUrl:String(e),ts:Date.now()}))}catch{}}function ir(){if(!(typeof sessionStorage>`u`))try{sessionStorage.removeItem(xn)}catch{}}function ar(){if(typeof window>`u`||typeof sessionStorage>`u`)return{shouldResumeVoice:!1,targetUrl:null};let e;try{e=JSON.parse(sessionStorage.getItem(xn)||`null`)}catch{return{shouldResumeVoice:!1,targetUrl:null}}if(!e)return{shouldResumeVoice:!1,targetUrl:null};try{sessionStorage.removeItem(xn)}catch{}return e.voiceWasActive?Date.now()-e.ts>Sn?(q(`initVoiceNavResume: state expired, skipping`),{shouldResumeVoice:!1,targetUrl:null}):(q(`initVoiceNavResume: voice was active during navigation to`,e.targetUrl),{shouldResumeVoice:!0,targetUrl:e.targetUrl||null}):{shouldResumeVoice:!1,targetUrl:null}}function or(){if(typeof document>`u`)return!1;let e=/(^|\W)(404|page not found|not found|page (?:doesn'?t|does not) exist|no longer exists|couldn'?t find (?:this|that|the) page|error 404|oops[!,. ].*(?:not found|doesn'?t exist))(\W|$)/i,t=(document.title||``).trim();if(t&&e.test(t))return!0;let n=document.querySelector(`main, [role="main"], #content, .content`)||document.body;if(n){let t=n.querySelectorAll(`h1, h2`);for(let n of t){let t=(n.textContent||``).replace(/\s+/g,` `).trim();if(t&&t.length<80&&e.test(t))return!0}}return!1}async function sr(e,t={}){if(typeof window>`u`)return{navigated:!1};let{sectionText:n,voiceActive:r=!1}=t;try{let t=Qn(e),i=new URL(t,window.location.origin);if(i.hash&&i.pathname===window.location.pathname){let e=document.getElementById(i.hash.slice(1));if(e)return e.scrollIntoView({behavior:`smooth`,block:`start`}),{navigated:!0}}if(i.pathname===window.location.pathname&&i.search===window.location.search&&!i.hash)return{navigated:!1,reason:`already-on-page`};let a=i.pathname+i.search+i.hash,o=window.next?.router;if(o?.push)return new Promise(e=>{let t=()=>{o.events?.off(`routeChangeComplete`,t),e({navigated:!0})};o.events?.on(`routeChangeComplete`,t),o.push(a),setTimeout(t,5e3)});if(window.__NEXT_ROUTER__?.push)return window.__NEXT_ROUTER__.push(a),{navigated:!0};if(Pn()){n&&tr(n);let e=window.location.href;try{window.history.pushState({},``,i.href),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}if(await new Promise(e=>setTimeout(e,400)),or()){try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}return n&&tr(n),r||_e(),window.location.assign(i.href),{navigated:!0}}return{navigated:!0}}return n&&tr(n),r||_e(),window.location.assign(i.href),{navigated:!0}}catch(t){console.warn(`[FlowEngage] shadowNavigate error:`,t),n&&tr(n);try{window.location.href=Qn(e)}catch{window.location.href=e}return{navigated:!0}}}var cr=!1,lr=null;function ur(e){lr=e,typeof window<`u`&&(window.__fe_triggerVoiceNavHooks=()=>{try{e.onBeforeNavigate()}catch{}}),!cr&&(cr=!0,!(typeof document>`u`)&&(document.addEventListener(`click`,e=>{if(!lr)return;let t=e.target.closest?.(`a[href]`);if(!t||t.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`))return;let n=t.getAttribute(`href`)||``;if(!n||n===`#`||n.startsWith(`javascript:`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||t.hasAttribute(`download`)||t.target===`_blank`||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let r;try{if(r=new URL(n,window.location.href),r.origin!==window.location.origin)return}catch{return}if(!(r.pathname===window.location.pathname&&r.hash)&&!(r.pathname===window.location.pathname&&r.search===window.location.search&&!r.hash)){q(`voice-link-hook: saving state before navigation →`,r.href);try{lr.onBeforeNavigate()}catch{}}},!0),document.addEventListener(`submit`,e=>{if(lr&&!e.target?.closest?.(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`)){q(`voice-form-hook: saving state before form submit`);try{lr.onBeforeNavigate()}catch{}}},!0)))}function dr(){lr=null,q(`voice-nav-hooks: deactivated`)}var fr=e=>!e||typeof e!=`string`?e:e.replace(/<human_assistance_request[^>]*>/gi,``).replace(/<\/human_assistance_request>/gi,``).replace(/<navigate[^>]*\/>/gi,``).replace(/<navigate[^>]*>[\s\S]*?<\/navigate>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*>[\s\S]*?<\/[a-z]+(?:_[a-z]+)+>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*\/>/gi,``).trim(),pr=(e=[])=>e.filter(e=>e.type!==`call_recording`&&!(typeof e.message==`string`&&e.message.includes(`AI chat recording`))).map(e=>({...e,message:fr(e.message),isPending:!1,id:e.messageId||`${e.sender}-${e.timestamp||Date.now()}-${Math.random()}`}));function mr(e){if(!e||typeof e!=`string`)return null;let t=e.match(/<navigate([^>]*?)(?:\/>|>[\s\S]*?<\/navigate>)/i);if(!t)return null;let n=t[1],r=n.match(/url=["']([^"']+)["']/i);if(!r)return null;let i=n.match(/section=["']([^"']+)["']/i)||n.match(/highlight=["']([^"']+)["']/i);return{url:r[1].trim(),section:i?.[1]?.trim()||null}}var hr=(e,t)=>e?typeof e==`string`?e:e.message||e.error||e.reason||t:t,gr=(e={})=>{if(!e?.candidate)return null;if(typeof e.candidate==`object`)return e.candidate;let t=e.sdpMid!==void 0&&e.sdpMid!==null&&e.sdpMid!==``,n=e.sdpMLineIndex!==void 0&&e.sdpMLineIndex!==null;return!t&&!n?null:{candidate:e.candidate,...t?{sdpMid:e.sdpMid}:{},...n?{sdpMLineIndex:e.sdpMLineIndex}:{}}},_r=(e=[],t=`Agent`)=>{for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return t},vr=(e=[],t,n=6)=>!t?.message||e.slice(-n).some(e=>e.sender===`system`&&e.message===t.message)?e:[...e,t];function yr({siteId:e,config:t,children:n,language:r=`en`}){let i=(0,d.useMemo)(()=>e?{...t||{},siteId:e}:t||null,[e,t]),[a,o]=(0,d.useState)(0),[s,c]=(0,d.useState)(`booting`),[l,u]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),[g,_]=(0,d.useState)(``),[x,S]=(0,d.useState)([]),E=(0,d.useCallback)(()=>{S(e=>[...e,{id:`nav-fail-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`I couldn't find that page on our site — could you tell me more about what you're looking for?`,timestamp:new Date().toISOString()}])},[]),ee=(0,d.useCallback)(()=>{S(e=>e.slice(-3).some(e=>(e.sender===`bot`||e.sender===`assistant`)&&/already on (that|this|the)\b/i.test(String(e.message||``)))?e:[...e,{id:`nav-already-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`Looks like you're already on this page!`,timestamp:new Date().toISOString()}])},[]),[te,D]=(0,d.useState)(ie().isOpen),[se,A]=(0,d.useState)(ie().activeScreen),[j,M]=(0,d.useState)(ie().isHumanHandled),[le,N]=(0,d.useState)(ie().agentName),[ue,de]=(0,d.useState)(ie().agentHeadshot),[fe,pe]=(0,d.useState)(()=>ae(i?.siteId)),[me,ge]=(0,d.useState)(!1),[P,_e]=(0,d.useState)(!1),[ve,ye]=(0,d.useState)(`idle`),[be,F]=(0,d.useState)(!1),[xe,Se]=(0,d.useState)(!1),[Ce,I]=(0,d.useState)(``),[L,De]=(0,d.useState)(!1),[R,z]=(0,d.useState)(0),[Oe,ke]=(0,d.useState)(0),[Ae,je]=(0,d.useState)(!1),[B,Me]=(0,d.useState)(null),[Ne,Pe]=(0,d.useState)(null),[Fe,Ie]=(0,d.useState)(`idle`),[Le,Re]=(0,d.useState)(null),[ze,Be]=(0,d.useState)(!1),[Ve,He]=(0,d.useState)(``),[Ue,We]=(0,d.useState)(!1),V=(0,d.useRef)(null),H=(0,d.useRef)(null),Ge=(0,d.useRef)(``),U=(0,d.useRef)(!1),Ke=(0,d.useRef)(null),W=(0,d.useRef)(null),G=(0,d.useRef)(null),qe=(0,d.useRef)(null),Je=(0,d.useRef)(null),Ye=(0,d.useRef)(null),Xe=(0,d.useRef)(null),Ze=(0,d.useRef)(!1),Qe=(0,d.useRef)({url:null,at:0}),$e=(0,d.useCallback)((e,t)=>{let n=e;try{n=new URL(e,window.location.origin).href}catch{}let r=Qe.current;return r.url===n&&Date.now()-r.at<4e3?Promise.resolve({navigated:!0,deduped:!0}):(Qe.current={url:n,at:Date.now()},sr(e,t))},[]),et=(0,d.useRef)([]),tt=(0,d.useRef)(null),nt=(0,d.useRef)(null),rt=(0,d.useRef)(null),it=(0,d.useRef)(!1),at=(0,d.useRef)(!1),ot=(0,d.useRef)(``),st=(0,d.useRef)(null),ct=(0,d.useRef)(null),lt=(0,d.useRef)([]),ut=(0,d.useRef)(0),dt=(0,d.useRef)(le),ft=(0,d.useRef)([]),pt=(0,d.useRef)(!1),mt=(0,d.useRef)(!1),ht=(0,d.useRef)(i),gt=(0,d.useRef)({notifyRouteChange:()=>{},cleanup:()=>{}}),_t=(0,d.useCallback)((e={})=>{let t=!!e.is_human_handled;return M(t),t?(A(`agent`),e.agent_info?.name&&N(e.agent_info.name),e.agent_info?.headshot&&de(e.agent_info.headshot),t):(A(`ai`),t)},[]),vt=(0,d.useMemo)(()=>{let e=m?.widgetSettings?.call?.maxDurationSeconds??i?.widgetSettings?.call?.maxDurationSeconds??i?.callMaxDurationSeconds,t=Number(e);return Number.isFinite(t)&&t>0?t:y},[i,m]);(0,d.useEffect)(()=>{W.current=B},[B]),(0,d.useEffect)(()=>{dt.current=le},[le]),(0,d.useEffect)(()=>{mt.current=L},[L]),(0,d.useEffect)(()=>{ht.current=i},[i]);let yt=()=>{He(``)},bt=(0,d.useCallback)(()=>{rt.current&&=(window.clearTimeout(rt.current),null)},[]),xt=e=>{let t=typeof e==`string`?e.trim().toLowerCase():``;return pe(t),oe(t,i?.siteId),t};(0,d.useEffect)(()=>{let e=i?.siteId;if(!e)return;let t=ae(e);if(t){pe(t);return}pe(t=>(t&&oe(t,e),t))},[i?.siteId]);let St=(e=`unspecified`)=>{let t=tt.current||Ye.current?.callId,n=ut.current,r=st.current;if(st.current=null,ut.current=0,r&&r.state!==`inactive`){r.onstop=()=>{let e=lt.current;if(lt.current=[],e.length>0&&t&&H.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;H.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}};try{r.stop()}catch{r.onstop=null,lt.current=[]}}else if(r&&r.state===`inactive`){let e=lt.current;if(lt.current=[],e.length>0&&t&&H.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;H.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}}else lt.current=[];if(ct.current){try{ct.current.close()}catch{}ct.current=null}G.current&&=(G.current.close(),null),qe.current&&=(qe.current.getTracks().forEach(e=>e.stop()),null),Je.current&&=(Je.current.srcObject=null,Je.current.remove(),null),bt(),Ye.current=null,et.current=[],tt.current=null,nt.current=null,it.current=!1,Be(!1),Me(null),Pe(null),Ie(`idle`),Re(null)},Ct=(e=new Date().toISOString())=>{let t=V.current,n=tt.current||Ye.current?.callId;if(!(!t?.connected||!n||it.current)){it.current=!0,t.emit(`call:connected`,{callId:n,chatId:Ge.current,connectedAt:e});try{let e=qe.current,t=Je.current?.srcObject;if(e&&t&&!st.current){lt.current=[];let n=new(window.AudioContext||window.webkitAudioContext);ct.current=n;let r=n.createMediaStreamDestination();n.createMediaStreamSource(e).connect(r),n.createMediaStreamSource(t).connect(r);let i=window.MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:`audio/mp4`,a=new window.MediaRecorder(r.stream,{mimeType:i});a.ondataavailable=e=>{e.data&&e.data.size>0&&lt.current.push(e.data)},st.current=a,ut.current=Date.now(),a.start(1e3),setTimeout(()=>{try{if(!window.speechSynthesis)return;let e=new SpeechSynthesisUtterance(`This call is being recorded for quality and training purposes.`);if(e.rate=.95,e.pitch=1,e.volume=1,window.MediaStreamTrackGenerator||window.AudioContext)try{let t=n.createMediaStreamDestination();e.onstart=()=>{try{let i=document.createElement(`audio`);i.style.display=`none`,i.srcObject=t.stream,document.body.appendChild(i),i.play().catch(()=>{});let a=n.createMediaStreamSource(t.stream);a.connect(r),e.onend=()=>{try{a.disconnect()}catch{}try{i.remove()}catch{}}}catch{}}}catch{}window.speechSynthesis.speak(e)}catch{}},200)}}catch{}}},wt=(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=W.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(bt(),Me(null),t||n){tt.current=e.callId,Pe(e.callId),Ie(e=>e===`connected`?e:`connecting`),D(!0);return}Ie(`idle`)}},Tt=(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=W.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(bt(),n){St();return}nt.current=null,Ye.current=null,et.current=[],Me(null),Ie(`idle`)}},Et=async(e={})=>{let t=G.current,n=V.current,r=e.sdpOffer||e.offer?.sdp;if(!t||!n?.connected||!r||!e.callId){console.log(`[FlowEngageProvider] deferring remote offer until peer/socket ready`,{callId:e.callId,chatId:Ge.current,hasPeerConnection:!!t,socketConnected:!!n?.connected,hasOffer:!!r}),Ye.current=e;return}if(await t.setRemoteDescription(new RTCSessionDescription({type:`offer`,sdp:r})),et.current.length>0){console.log(`[FlowEngageProvider] flushing queued agent ICE candidates after remote offer`,{callId:e.callId,chatId:Ge.current,queuedCount:et.current.length});for(let e of et.current)await t.addIceCandidate(new RTCIceCandidate(e));et.current=[]}let i=await t.createAnswer();await t.setLocalDescription(i),n.emit(`call:answer`,{callId:e.callId,sdpAnswer:i.sdp,chatId:Ge.current})};(0,d.useEffect)(()=>{k({isOpen:te,activeScreen:se,isHumanHandled:j,agentName:le,agentHeadshot:ue})},[te,se,j,le,ue]),(0,d.useEffect)(()=>{let e=!0;return(async()=>{We(!0);try{let t=p(i),n=await Te(t);if(!e)return;let a=t.siteId,o=ne(a),s=ce(a),l=``;try{let e=U.current,r=Ke.current;if(U.current=!1,Ke.current=null,l=(await we({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:a,priorChatId:e||r?null:o||C(),forceNew:e,resumeChatId:r,visitorId:s}))?.data?.chatId,!l)throw Error(`resolve-session returned no chatId`);w(),O(a,l)}catch(e){console.warn(`[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id`,e?.message||e),l=o||T(),O(a,l)}Ge.current=l;let u=Ee({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:t.siteId,visitorId:s});H.current=u,h({...n,apiBaseUrl:t.apiBaseUrl}),_(l);let d=n?.widgetSettings?.branding?.fallbackAgentName||`Agent`,f=sn({apiBaseUrl:t.apiBaseUrl,userId:n.userId,chatId:l,siteId:t.siteId});V.current=f,f.on(`connect`,async()=>{ye(`connected`);let e=Ge.current;if(e&&H.current)try{_t(await H.current.checkHumanHandled(e))}catch{}}),f.on(`disconnect`,()=>{ye(`disconnected`)}),f.on(`aiTyping`,()=>{_e(!0)}),f.on(`ai:typing`,()=>{_e(!0)}),f.on(`messageReceived`,e=>{let t=e.message||e,n={...t,message:fr(t.message)};_e(!1),ge(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&S(e=>[...e.filter(e=>!e.isPending),{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}])}),f.on(`conversationStarted`,e=>{e?.message&&S(t=>[...t,{id:`system-start-${Date.now()}`,sender:`system`,message:e.message,timestamp:new Date().toISOString(),isPending:!1}])}),f.on(`message:new`,e=>{let t=e.message||e,n={...t,message:fr(t.message)};_e(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&((n.sender===`agent`||n.agent_name||n.sender===`ai`||n.sender===`bot`)&&ge(!1),S(e=>n.sender===`bot`||n.sender===`ai`?[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]:e.some(e=>e.id===n.messageId||e.sender===n.sender&&e.message===n.message&&e.isPending)?e.map(e=>e.sender===n.sender&&e.message===n.message&&e.isPending?{...n,isPending:!1,id:n.messageId||e.id}:e):[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]),(n.sender===`agent`||n.agent_name)&&(M(!0),A(`agent`),N(_r([n.agent_name,n.agentName,n.metadata?.agentName],d)),n.sender_headshot&&de(n.sender_headshot),D(!0),z(e=>e+1)))});let m=(e={})=>{let t=_r([e.agent?.name,e.agentName,e.agent_name,dt.current],d);M(!0),A(`agent`),N(t),de(e.agent?.headshot||null),D(!0),z(e=>e+1),S(e=>vr(e,{id:`agent-joined-${Date.now()}`,sender:`system`,message:`${t} has joined the chat.`,timestamp:new Date().toISOString(),isPending:!1}))},g=(e={})=>{let t=_r([e.agent?.name,e.agentName,e.agent_name,dt.current],d);M(!1),A(`ai`),S(e=>vr(e,{id:`agent-left-${Date.now()}`,sender:`system`,message:`${t} has left the chat.`,timestamp:new Date().toISOString(),isPending:!1}))};f.on(`agent:joined`,m),f.on(`agentJoined`,m),f.on(`agent:left`,g),f.on(`agentLeft`,g),f.on(`conversationEnded`,e=>{je(!0);let t=e?.message||`This conversation has ended. Thank you for reaching out!`;S(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:t,timestamp:new Date().toISOString(),isPending:!1}])}),f.on(`chat:history_update`,e=>{let t=pr(e.chat_history||[]);S(t),t.length===0&&(je(!1),M(!1),A(`ai`),_e(!1),ge(!1))}),f.on(`conversation:reset`,()=>{S([]),je(!1),M(!1),A(`ai`),_e(!1),ge(!1)}),f.on(`voice:end_session`,(e={})=>{console.log(`[FlowEngageProvider] voice:end_session received — ending voice session`),ke(e=>e+1),D(!0),z(e=>e+1)}),f.on(`typing:start`,e=>{e.sender===`agent`&&ge(!0)}),f.on(`typing:stop`,e=>{e.sender===`agent`&&ge(!1)}),f.on(`call:incoming`,(e={})=>{let t=_r([e.agentName,e.ownerName,e.agent?.name,dt.current],`Agent`);yt(),bt(),it.current=!1,Me({callId:e.callId,from:e.from||`owner`,agentId:e.agentId||null,agentName:t}),N(e=>_r([t,e],`Agent`)),Ie(`incoming`),Re(null),D(!0)}),f.on(`call:offer`,async(e={})=>{Ye.current=e;try{await Et(e)}catch(e){console.error(`[FlowEngageProvider] failed to apply remote offer`,e)}}),f.on(`call:ice-candidate-from-agent`,async(e={})=>{if(e.candidate)try{let t=gr(e);if(!t){console.warn(`[FlowEngageProvider] ignoring invalid ICE candidate payload`,e);return}if(!G.current||!G.current.remoteDescription){console.log(`[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready`,{callId:e.callId,chatId:e.chatId||Ge.current,queueSize:et.current.length+1}),et.current.push(t);return}await G.current.addIceCandidate(new RTCIceCandidate(t))}catch(e){console.error(`[FlowEngageProvider] failed to add ICE candidate`,e)}}),f.on(`call:ended`,()=>{yt(),St(`socket:call_ended`)}),f.on(`call:accepted`,(e={})=>{wt(e)}),f.on(`call:accepted_by_other`,(e={})=>{wt(e)}),f.on(`call:rejected`,(e={})=>{Tt(e)}),f.on(`call:missed`,(e={})=>{Tt(e)}),f.on(`call:failed`,(e={})=>{Tt(e)}),f.on(`call:connected`,(e={})=>{if(!e.callId)return;let t=nt.current===e.callId,n=tt.current===e.callId,r=Ye.current?.callId===e.callId,i=W.current?.callId===e.callId;if(!t&&!n&&!r){i&&(Me(null),Ie(`idle`));return}it.current=!0,nt.current=null,tt.current=e.callId,Pe(e.callId),Me(null),Ie(`connected`),Re(e.connectedAt||new Date().toISOString()),D(!0)}),f.on(`call:unavailable`,(e={})=>{St(`socket:call_unavailable`),He(hr(e,`This visitor is not available for a call right now.`)),D(!0)}),f.on(`call:error`,(e={})=>{St(`socket:call_error`),He(hr(e,`We couldn't connect the call right now.`)),D(!0)}),f.on(`visitor:navigate`,async({url:e,section:t,highlight:n}={})=>{e&&$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:r})=>{if(!e){r===`not-found`?E():r===`already-on-page`&&ee();return}let i=t||n;i&&setTimeout(()=>{let e=Yn(null,i);e&&Xn(e)},300)})}),f.on(`visitor:highlight`,({sectionId:e,sectionText:t}={})=>{if(!e&&!t)return;let n=Yn(e||null,t||null);n&&Xn(n)}),f.on(`visitor:clear_highlight`,()=>{Zn()}),gt.current=cn({socket:f,chatId:l});let v=await u.loadHistory(l,r);if(!e)return;S(pr(v.chat_history||[])),M(!!v.is_human_handled),A(v.is_human_handled?`agent`:se);let y=v?.visitor_email||v?.visitorEmail;if(y&&String(y).trim()&&xt(String(y).trim()),await new Promise(e=>setTimeout(e,500)),!e)return;c(`ready`)}catch(t){if(!e)return;u(t),c(`error`)}finally{e&&We(!1)}})(),()=>{e=!1,gt.current?.cleanup?.(),St(),V.current?.disconnect()}},[i,r,a]),(0,d.useEffect)(()=>()=>{if(L&&!pt.current&&ft.current.length>0){let e=Ge.current,t=ft.current,n=H.current;n&&e&&t.length>0&&(console.log(`[FlowEngageProvider] safety-net: syncing voice transcript on unmount`),n.beaconSyncVoice(e,t)||n.syncVoice(e,t).catch(()=>{}),pt.current=!0)}},[L,m]);let Dt=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=H.current;!e||!g||Dt.current!==te&&(te&&Dt.current!==null?e.updateChatStatus(g,`open`).catch(()=>{}):Dt.current===!0&&e.updateChatStatus(g,`widget_closed`).catch(()=>{}),Dt.current=te)},[te,g]),(0,d.useEffect)(()=>{let e=()=>{let e=Ge.current,t=H.current;!e||!t||typeof navigator>`u`||t.beaconWidgetClosed?.(e)||t.updateChatStatus(e,`widget_closed`).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>window.removeEventListener(`pagehide`,e)},[]);let Ot=async()=>{if(!(!B?.callId||!H.current||!V.current||!g)){yt(),nt.current=B.callId,bt();try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});qe.current=e;let t=[{urls:`stun:stun.l.google.com:19302`}];try{let e=await H.current.getIceServersConfig();e?.data?.iceServers?.length&&(t=e.data.iceServers)}catch(e){console.warn(`[FlowEngageProvider] ice-config fetch failed, using STUN default`,e)}let n=new RTCPeerConnection({iceServers:t});G.current=n,n.onconnectionstatechange=()=>{let e=n.connectionState;if(e===`connected`){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),Ct(e);return}if(e===`connecting`){Ie(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&St(`peer:connection_${e}`)},n.oniceconnectionstatechange=()=>{let e=n.iceConnectionState;if(e===`connected`||e===`completed`){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),Ct(e);return}if(e===`checking`||e===`new`){Ie(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&St(`peer:ice_${e}`)},n.onsignalingstatechange=()=>{},n.onicegatheringstatechange=()=>{},e.getTracks().forEach(t=>{n.addTrack(t,e)}),n.onicecandidate=e=>{if(!e.candidate||!V.current?.connected)return;let t=e.candidate;V.current.emit(`call:ice-candidate`,{callId:B.callId,candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,chatId:g,from:`customer`})},n.ontrack=e=>{let[t]=e.streams||[],[n]=t?.getAudioTracks?.()||[];if(!Je.current){let e=document.createElement(`audio`);e.id=`flowengage-remote-audio`,e.autoplay=!0,e.playsInline=!0,e.onplay=()=>{},e.onpause=()=>{},e.onended=()=>{},e.onerror=e=>{},Je.current=e,document.body.appendChild(e)}Je.current.srcObject=e.streams[0];let r=B?.callId,i=r&&(nt.current===r||tt.current===r);if(!it.current&&i){let e=new Date().toISOString();Ie(`connected`),Re(t=>t||e),tt.current=r,Pe(r),Ct(e)}Je.current.srcObject=t||null;let a=Je.current.play?.();a?.catch&&a.catch(e=>{})};let r=Ye.current;r&&(console.log(`[FlowEngageProvider] found pending remote offer during accept`,{callId:r.callId||B.callId,chatId:g}),await Et({...r,callId:r.callId||B.callId})),await H.current.acceptCall(B.callId,g),V.current?.emit(`call:accepted`,{callId:B.callId,chatId:g}),tt.current=B.callId,Pe(B.callId),Ie(e=>e===`connected`||it.current?`connected`:`connecting`),Me(null),D(!0)}catch(e){if(nt.current=null,St(`accept_call_failed`),e?.status===404||e?.status===409||e?.status===422){He(hr(e,`This visitor call is no longer available.`));return}if(e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`){try{await H.current.rejectCall(B.callId,g)}catch(e){console.error(`[FlowEngageProvider] failed to reject call after microphone denial`,e)}He(`Microphone access was denied. Please allow microphone access to accept the call.`);return}He(`We couldn't connect the call right now. Please try again.`)}}},kt=async()=>{if(!B?.callId||!H.current||!g){St(`reject_call_without_server_context`);return}let e=B.callId;bt(),yt(),V.current?.emit(`call:rejected`,{callId:e,chatId:g,reason:`visitor_declined`});try{await H.current.rejectCall(e,g)}catch(e){He(hr(e,`We couldn't decline the call cleanly.`))}finally{St(`reject_call_finally`)}},At=(0,d.useRef)(kt);At.current=kt,(0,d.useEffect)(()=>{if(!B?.callId||Ne){bt();return}let e=B.callId;return bt(),rt.current=window.setTimeout(()=>{W.current?.callId===e&&nt.current!==e&&tt.current!==e&&At.current()},b),()=>{rt.current&&=(window.clearTimeout(rt.current),null)}},[Ne,bt,B?.callId]);let jt=async()=>{if(!Ne||!H.current||!g){St(`end_call_without_server_context`);return}yt();try{await H.current.endWebRTCCall(Ne,g)}catch(e){He(hr(e,`The call ended locally, but the server could not be updated.`))}finally{St(`end_call_finally`)}},Mt=()=>{let e=qe.current?.getAudioTracks?.()||[],t=G.current?.getSenders?.().map(e=>e.track).filter(e=>e?.kind===`audio`)||[],n=[...e,...t].filter(Boolean);if(n.length===0)return;let r=!ze;n.forEach(e=>{e.enabled=!r}),Be(r)},Nt=async(e={})=>{let t=e.notifyChatInitiated===!0;if(D(!0),!(!t||!H.current||!g||typeof window>`u`)){try{await H.current.trackVisitor({chatId:g,currentPagePath:window.location.pathname||`/`})}catch{}try{await H.current.updateChatStatus(g,`open`)}catch{}}},Pt=async e=>{let t=xt(e);if(!t||!H.current||!Ge.current)return t;try{await H.current.trackVisitor({chatId:Ge.current,currentPagePath:typeof window<`u`&&window.location.pathname||`/`,email:t})}catch(e){console.error(`[FlowEngageProvider] failed to persist visitor email`,e)}return t},Ft=()=>{!g||!V.current?.connected||at.current||(at.current=!0,V.current.emit(`typing:start`,{chatId:g,sender:`user`}))},It=()=>{!g||!V.current?.connected||!at.current||(at.current=!1,V.current.emit(`typing:stop`,{chatId:g,sender:`user`}))},Lt=(e=``)=>{let t=typeof e==`string`?e:``;!g||!V.current?.connected||t!==``&&ot.current===t||(ot.current=t,V.current.emit(`typing:update`,{chatId:g,sender:`user`,text:t}))};function Rt(){if(typeof document>`u`)return null;try{let e=(document.querySelector(`main`)||document.querySelector(`[role='main']`)||document.querySelector(`article`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);e.querySelectorAll(`nav, footer, header, aside, script, style, noscript, #flowengage-root, .flowengage-shell, .flowengage-widget-root, [id*='flowengage'], [class*='flowengage']`).forEach(e=>e.remove());let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>0?t.substring(0,3e3):null}catch{return null}}let zt=async(e,t=``,n=null,i={})=>{let a=typeof e==`string`?e.trim():``;if(!a||!H.current||!g||s!==`ready`||Ae)return;It(),Ze.current=!1;let o=/^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i,c=/^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i,l=/\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;if(Xe.current&&o.test(a)&&!c.test(a)){let{url:e,section:t}=Xe.current;Xe.current=null,Ze.current=!0,console.log(`[FWH Nav] Client-side nav firing →`,e),$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}!t||!mt.current||setTimeout(()=>{let e=Yn(null,t);e&&Xn(e)},300)})}else o.test(a)||(Xe.current=null);let d=`pending-user-${Date.now()}`,f={id:d,sender:`user`,message:e,timestamp:new Date().toISOString(),isPending:!0,type:i?.type||`text`,metadata:i?.metadata||void 0,...n||{}};S(e=>[...e,f]);let p=j;if(p)try{p=_t(await H.current.checkHumanHandled(g))}catch{}if(p&&V.current?.connected){V.current.emit(`customer:message`,{chatId:g,content:e,sender:`user`,email:fe||void 0,type:i?.type||`text`,metadata:i?.metadata||{},...n||{}});return}F(!0);try{let o=await H.current.sendAiMessage(g,e,r,t,{...n||{},...fe?{email:fe}:{}},{...i,currentPageUrl:typeof window<`u`?window.location.href:void 0,currentPageTitle:typeof window<`u`?document.title:void 0,currentPagePath:typeof window<`u`?window.location.pathname:void 0,currentPageContent:Rt()||void 0}),s=o.chat_history||[];if(console.log(`[FWH Nav Debug] API response fields:`,{has_navigate:!!o.navigate,navigate:o.navigate,has_pending_navigate:!!o.pending_navigate,pending_navigate:o.pending_navigate,last_bot_msg:[...s].reverse().find(e=>e.sender===`bot`)?.message?.substring(0,80)}),o.pending_navigate?.url){let e={url:o.pending_navigate.url,section:o.pending_navigate.section||null};l.test(a)?(console.log(`[FWH Nav] Auto-navigating (intent detected) →`,e.url),$e(e.url,{voiceActive:mt.current}).then(({navigated:t,reason:n})=>{if(!t){n===`not-found`?E():n===`already-on-page`&&ee();return}e.section&&setTimeout(()=>{let t=Yn(null,e.section);t&&Xn(t)},300)})):(Xe.current=e,console.log(`[FWH Nav] Stored pending nav →`,Xe.current))}if(o.navigate?.url)if(Ze.current)Ze.current=!1;else{let{url:e,section:t}=o.navigate;$e(e,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}t&&setTimeout(()=>{let e=Yn(null,t);e&&Xn(e)},300)})}else if(o.highlight?.section){let e=o.highlight.section;setTimeout(()=>{let t=Yn(null,e);t&&Xn(t)},150)}else{let e=[...s].reverse().find(e=>e.sender===`bot`||e.sender===`assistant`);if(e?.message){let t=mr(e.message);t&&er(t.url,{siteId:ht.current?.siteId,apiBaseUrl:ht.current?.apiBaseUrl}).then(({allowed:e,correctedUrl:n})=>{if(!e){E();return}$e(n||t.url,{voiceActive:mt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?E():n===`already-on-page`&&ee();return}!t.section||!mt.current||setTimeout(()=>{let e=Yn(null,t.section);e&&Xn(e)},300)})})}}S(pr(s)),M(!!o.is_human_handled),A(o.is_human_handled?`agent`:`ai`),_e(!1),F(!1),await H.current.updateChatStatus(g,`messageSent`)}catch(e){S(e=>e.filter(e=>e.id!==d)),_e(!1),F(!1),e.status===429?(Se(!0),I(e.message),window.setTimeout(()=>{Se(!1),I(``)},v)):u(e)}},Bt=async e=>{if(!H.current||!e)throw Error(`Upload is unavailable right now.`);return H.current.uploadChatFile(e)},Vt=async e=>{if(!(!H.current||!g)){try{let t=e?`voice`:`text`;await H.current.setChatMode(g,t)}catch{}De(e),e&&(pt.current=!1)}},Ht=async e=>{if(pt.current)return;if(pt.current=!0,!H.current||!g||!e?.length){De(!1);return}let t=()=>{let t=pr(e);S(e=>{if(!e.length)return t;let n=e[e.length-1],r=t[0];return n&&r&&n.sender===r.sender&&n.message===r.message?e:[...e,...t]})};try{let n=await H.current.syncVoice(g,e);if(n?.chat_history?.length)S(pr(n.chat_history));else if(n?.success)try{let e=await H.current.loadHistory(g,r);e?.chat_history?.length?S(pr(e.chat_history)):t()}catch{t()}else t()}catch{t()}finally{De(!1)}},Ut=async()=>{if(!(!H.current||!g)){L&&!pt.current&&ft.current.length>0&&await Ht(ft.current);try{await H.current.endConversation(g)}catch{try{await H.current.updateChatStatus(g,`ended`)}catch{}}je(!0),S(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:`This conversation has ended. Thank you for reaching out!`,timestamp:new Date().toISOString(),isPending:!1}])}};(0,d.useEffect)(()=>{if(Fe!==`connected`||!Ne||!g||!Le||!vt)return;let e=new Date(Le).getTime(),t=Number.isFinite(e)?Date.now()-e:0,n=Math.max(0,vt*1e3-t),r=window.setTimeout(()=>{He(`The call ended because it reached the time limit.`),jt()},n);return()=>window.clearTimeout(r)},[Ne,Le,Fe,g,jt,vt]),(0,d.useEffect)(()=>{let e=()=>{let e=Ge.current,t=H.current;if(!t||!e)return;if(mt.current&&ft.current.length>0&&he(),!pt.current&&ft.current.length>0&&(t.beaconSyncVoice(e,ft.current)||t.syncVoice(e,ft.current).catch(()=>{}),pt.current=!0),tt.current){t.beaconEndWebRTCCall(tt.current,e);return}let n=nt.current||W.current?.callId;n&&t.beaconCustomerUnavailable(n,e)};return window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,e)}},[]);let K=(0,d.useCallback)(()=>{let e=i?.siteId;re(e),U.current=!0,Ke.current=null,V.current?.disconnect(),S([]),_(``),Ge.current=``,je(!1),M(!1),N(null),de(null),We(!0),o(e=>e+1)},[i?.siteId]),Wt=(0,d.useCallback)(e=>{i?.siteId,U.current=!1,Ke.current=e,V.current?.disconnect(),S([]),_(``),Ge.current=``,je(!1),M(!1),N(null),de(null),We(!0),o(e=>e+1)},[i?.siteId]),Gt=(0,d.useMemo)(()=>({status:s,error:l,runtimeConfig:m,resolvedConfig:i,chatId:g,chatHistory:x,isOpen:te,activeScreen:se,isHumanHandled:j,agentName:le,agentHeadshot:ue,visitorEmail:fe,isAgentTyping:me,isAiTyping:P,connectionStatus:ve,isLoading:be,isVoiceMode:L,isRateLimited:xe,rateLimitMessage:Ce,isConversationEnded:Ae,isSessionRestoring:Ue,openToChatCounter:R,voiceEndCounter:Oe,incomingCall:B,activeCallId:Ne,callConnectionState:Fe,callConnectedAt:Le,isCallMuted:ze,webRTCError:Ve,language:r,historyRef:ft,hasSyncedRef:pt,dismissCallError:yt,captureVisitorEmail:Pt,startTyping:Ft,stopTyping:It,updateTypingDraft:Lt,notifyRouteChange:()=>gt.current?.notifyRouteChange?.(),openWidget:Nt,closeWidget:()=>D(!1),toggleWidget:()=>{if(te){D(!1);return}Nt({notifyChatInitiated:!0})},sendMessage:zt,uploadChatFile:Bt,setVoiceMode:Vt,onMessageSync:Ht,endConversation:Ut,startNewChat:K,resumeChat:Wt,getVisitorChatHistory:()=>H.current?.getVisitorChatHistory?.(),getVisitorChatThread:e=>H.current?.getVisitorChatThread?.(e),acceptCall:Ot,rejectCall:kt,endWebRTCCall:jt,toggleCallMute:Mt}),[s,l,m,i,g,x,te,se,j,le,ue,fe,me,P,ve,be,L,xe,Ce,Ae,Ue,R,Oe,B,Ne,Fe,Le,ze,Ve,r,Pt,Ft,It,Lt,Ot,kt,jt,Mt,Nt,zt,Bt,Vt,Ht,Ut,K,yt]);return(0,f.jsx)(ln.Provider,{value:Gt,children:n})}var br=(0,d.createContext)({});function xr(e){let t=(0,d.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Sr=typeof window<`u`?d.useLayoutEffect:d.useEffect,Cr=(0,d.createContext)(null);function wr(e,t){e.indexOf(t)===-1&&e.push(t)}function Tr(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Er=(e,t,n)=>n>t?t:n<e?e:n;function Dr(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var Or=()=>{},kr=()=>{};typeof process<`u`&&process.env.NODE_ENV!==`production`&&(Or=(e,t,n)=>{!e&&typeof console<`u`&&console.warn(Dr(t,n))},kr=(e,t,n)=>{if(!e)throw Error(Dr(t,n))});var Ar={},jr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Mr(e){return typeof e==`object`&&!!e}var Nr=e=>/^0[^.\s]+$/u.test(e);function Pr(e){let t;return()=>(t===void 0&&(t=e()),t)}var Fr=e=>e,Ir=(e,t)=>n=>t(e(n)),Lr=(...e)=>e.reduce(Ir),Rr=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},zr=class{constructor(){this.subscriptions=[]}add(e){return wr(this.subscriptions,e),()=>Tr(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Br=e=>e*1e3,Vr=e=>e/1e3;function Hr(e,t){return t?1e3/t*e:0}var Ur=new Set;function Wr(e,t,n){e||Ur.has(t)||(console.warn(Dr(t,n)),Ur.add(t))}var Gr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Kr=1e-7,qr=12;function Jr(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Gr(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Kr&&++s<qr);return o}function Yr(e,t,n,r){if(e===t&&n===r)return Fr;let i=t=>Jr(t,0,1,e,n);return e=>e===0||e===1?e:Gr(i(e),t,r)}var Xr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Zr=e=>t=>1-e(1-t),Qr=Yr(.33,1.53,.69,.99),$r=Zr(Qr),ei=Xr($r),ti=e=>e>=1?1:(e*=2)<1?.5*$r(e):.5*(2-2**(-10*(e-1))),ni=e=>1-Math.sin(Math.acos(e)),ri=Zr(ni),ii=Xr(ni),ai=Yr(.42,0,1,1),oi=Yr(0,0,.58,1),si=Yr(.42,0,.58,1),ci=e=>Array.isArray(e)&&typeof e[0]!=`number`,li=e=>Array.isArray(e)&&typeof e[0]==`number`,ui={linear:Fr,easeIn:ai,easeInOut:si,easeOut:oi,circIn:ni,circInOut:ii,circOut:ri,backIn:$r,backInOut:ei,backOut:Qr,anticipate:ti},di=e=>typeof e==`string`,fi=e=>{if(li(e)){kr(e.length===4,`Cubic bezier arrays must contain four numerical values.`,`cubic-bezier-length`);let[t,n,r,i]=e;return Yr(t,n,r,i)}else if(di(e))return kr(ui[e]!==void 0,`Invalid easing type '${e}'`,`invalid-easing-type`),ui[e];return e},pi=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],mi={value:null,addProjectionMetrics:null};function hi(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&mi.value&&mi.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var gi=40;function _i(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=pi.reduce((e,n)=>(e[n]=hi(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Ar.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,gi),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:pi.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<pi.length;t++)o[pi[t]].cancel(e)},state:i,steps:o}}var{schedule:J,cancel:vi,state:yi,steps:bi}=_i(typeof requestAnimationFrame<`u`?requestAnimationFrame:Fr,!0),xi;function Si(){xi=void 0}var Ci={now:()=>(xi===void 0&&Ci.set(yi.isProcessing||Ar.useManualTiming?yi.timestamp:performance.now()),xi),set:e=>{xi=e,queueMicrotask(Si)}},wi={layout:0,mainThread:0,waapi:0},Ti=e=>t=>typeof t==`string`&&t.startsWith(e),Ei=Ti(`--`),Di=Ti(`var(--`),Oi=e=>Di(e)?ki.test(e.split(`/*`)[0].trim()):!1,ki=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ai(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var ji={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Mi={...ji,transform:e=>Er(0,1,e)},Ni={...ji,default:1},Pi=e=>Math.round(e*1e5)/1e5,Fi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ii(e){return e==null}var Li=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ri=(e,t)=>n=>!!(typeof n==`string`&&Li.test(n)&&n.startsWith(e)||t&&!Ii(n)&&Object.prototype.hasOwnProperty.call(n,t)),zi=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Fi);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Bi=e=>Er(0,255,e),Vi={...ji,transform:e=>Math.round(Bi(e))},Hi={test:Ri(`rgb`,`red`),parse:zi(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Vi.transform(e)+`, `+Vi.transform(t)+`, `+Vi.transform(n)+`, `+Pi(Mi.transform(r))+`)`};function Ui(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Wi={test:Ri(`#`),parse:Ui,transform:Hi.transform},Gi=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ki=Gi(`deg`),qi=Gi(`%`),Y=Gi(`px`),Ji=Gi(`vh`),Yi=Gi(`vw`),Xi={...qi,parse:e=>qi.parse(e)/100,transform:e=>qi.transform(e*100)},Zi={test:Ri(`hsl`,`hue`),parse:zi(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+qi.transform(Pi(t))+`, `+qi.transform(Pi(n))+`, `+Pi(Mi.transform(r))+`)`},Qi={test:e=>Hi.test(e)||Wi.test(e)||Zi.test(e),parse:e=>Hi.test(e)?Hi.parse(e):Zi.test(e)?Zi.parse(e):Wi.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Hi.transform(e):Zi.transform(e),getAnimatableNone:e=>{let t=Qi.parse(e);return t.alpha=0,Qi.transform(t)}},$i=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ea(e){return isNaN(e)&&typeof e==`string`&&(e.match(Fi)?.length||0)+(e.match($i)?.length||0)>0}var ta=`number`,na=`color`,ra=`var`,ia=`var(`,aa="${}",oa=/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 sa(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(oa,e=>(Qi.test(e)?(r.color.push(a),i.push(na),n.push(Qi.parse(e))):e.startsWith(ia)?(r.var.push(a),i.push(ra),n.push(e)):(r.number.push(a),i.push(ta),n.push(parseFloat(e))),++a,aa)).split(aa),indexes:r,types:i}}function ca(e){return sa(e).values}function la({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===ta?i+=Pi(r[a]):e===na?i+=Qi.transform(r[a]):i+=r[a]}return i}}function ua(e){return la(sa(e))}var da=e=>typeof e==`number`?0:Qi.test(e)?Qi.getAnimatableNone(e):e,fa=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:da(e);function pa(e){let t=sa(e);return la(t)(t.values.map((e,n)=>fa(e,t.split[n])))}var ma={test:ea,parse:ca,createTransformer:ua,getAnimatableNone:pa};function ha(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function ga({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=ha(s,r,e+1/3),a=ha(s,r,e),o=ha(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function _a(e,t){return n=>n>0?t:e}var X=(e,t,n)=>e+(t-e)*n,va=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},ya=[Wi,Hi,Zi],ba=e=>ya.find(t=>t.test(e));function xa(e){let t=ba(e);if(Or(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,`color-not-animatable`),!t)return!1;let n=t.parse(e);return t===Zi&&(n=ga(n)),n}var Sa=(e,t)=>{let n=xa(e),r=xa(t);if(!n||!r)return _a(e,t);let i={...n};return e=>(i.red=va(n.red,r.red,e),i.green=va(n.green,r.green,e),i.blue=va(n.blue,r.blue,e),i.alpha=X(n.alpha,r.alpha,e),Hi.transform(i))},Ca=new Set([`none`,`hidden`]);function wa(e,t){return Ca.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Ta(e,t){return n=>X(e,t,n)}function Ea(e){return typeof e==`number`?Ta:typeof e==`string`?Oi(e)?_a:Qi.test(e)?Sa:Aa:Array.isArray(e)?Da:typeof e==`object`?Qi.test(e)?Sa:Oa:_a}function Da(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Ea(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Oa(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ea(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function ka(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Aa=(e,t)=>{let n=ma.createTransformer(t),r=sa(e),i=sa(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ca.has(e)&&!i.values.length||Ca.has(t)&&!r.values.length?wa(e,t):Lr(Da(ka(r,i),i.values),n):(Or(!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`),_a(e,t))};function ja(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?X(e,t,n):Ea(e)(e,t)}var Ma=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>J.update(t,e),stop:()=>vi(t),now:()=>yi.isProcessing?yi.timestamp:Ci.now()}},Na=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Pa=2e4;function Fa(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Ia(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Fa(r),Pa);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Vr(i)}}var Z={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};function La(e,t){return e*Math.sqrt(1-t*t)}var Ra=12;function za(e,t,n){let r=n;for(let n=1;n<Ra;n++)r-=e(r)/t(r);return r}var Ba=.001;function Va({duration:e=Z.duration,bounce:t=Z.bounce,velocity:n=Z.velocity,mass:r=Z.mass}){let i,a;Or(e<=Br(Z.maxDuration),`Spring duration must be 10 seconds or less`,`spring-duration-limit`);let o=1-t;o=Er(Z.minDamping,Z.maxDamping,o),e=Er(Z.minDuration,Z.maxDuration,Vr(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=La(t,o),c=Math.exp(-i);return Ba-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=La(t**2,o);return(-i(t)+Ba>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ba+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=za(i,a,s);if(e=Br(e),isNaN(c))return{stiffness:Z.stiffness,damping:Z.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Ha=[`duration`,`bounce`],Ua=[`stiffness`,`damping`,`mass`];function Wa(e,t){return t.some(t=>e[t]!==void 0)}function Ga(e){let t={velocity:Z.velocity,stiffness:Z.stiffness,damping:Z.damping,mass:Z.mass,isResolvedFromDuration:!1,...e};if(!Wa(e,Ua)&&Wa(e,Ha))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Er(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Z.mass,stiffness:i,damping:a}}else{let n=Va({...e,velocity:0});t={...t,...n,mass:Z.mass},t.isResolvedFromDuration=!0}return t}function Ka(e=Z.visualDuration,t=Z.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Ga({...n,velocity:-Vr(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Vr(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Z.restSpeed.granular:Z.restSpeed.default,i||=v?Z.restDelta.granular:Z.restDelta.default;let y,b,x,S,C,w;if(h<1)x=La(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>Br(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=Br(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=Br(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Fa(T),Pa),t=Na(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Ka.applyToOptions=e=>{let t=Ia(e,100,Ka);return e.ease=t.ease,e.duration=Br(t.duration),e.type=`keyframes`,e};var qa=5;function Ja(e,t,n){let r=Math.max(t-qa,0);return Hr(n-e(r),t-r)}function Ya({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Ka({keyframes:[f.value,m(f.value)],velocity:Ja(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Xa(e,t,n){let r=[],i=n||Ar.mix||ja,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Lr(Array.isArray(t)?t[n]||Fr:t,a)),r.push(a)}return r}function Za(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(kr(a===t.length,`Both input and output ranges must be the same length`,`range-length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Xa(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Rr(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Er(e[0],e[a-1],t)):l}function Qa(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Rr(0,t,r);e.push(X(n,1,i))}}function $a(e){let t=[0];return Qa(t,e.length-1),t}function eo(e,t){return e.map(e=>e*t)}function to(e,t){return e.map(()=>t||si).splice(0,e.length-1)}function no({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ci(r)?r.map(fi):fi(r),a={done:!1,value:t[0]},o=Za(eo(n&&n.length===t.length?n:$a(t),e),t,{ease:Array.isArray(i)?i:to(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var ro=e=>e!==null;function io(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ro),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ao={decay:Ya,inertia:Ya,tween:no,keyframes:no,spring:Ka};function oo(e){typeof e.type==`string`&&(e.type=ao[e.type])}var so=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},co=e=>e/100,lo=class extends so{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Ci.now()&&this.tick(Ci.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},wi.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;oo(e);let{type:t=no,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||no;process.env.NODE_ENV!==`production`&&s!==no&&kr(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,`spring-two-frames`),s!==no&&typeof o[0]!=`number`&&(this.mixKeyframes=Lr(co,ja(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Fa(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Er(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Ya&&(b.value=io(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Vr(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Vr(e)}get time(){return Vr(this.currentTime)}set time(e){e=Br(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Ja(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Ci.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Vr(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Ma,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,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(Ci.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,wi.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function uo(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var fo=e=>e*180/Math.PI,po=e=>ho(fo(Math.atan2(e[1],e[0]))),mo={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:po,rotateZ:po,skewX:e=>fo(Math.atan(e[1])),skewY:e=>fo(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ho=e=>(e%=360,e<0&&(e+=360),e),go=po,_o=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vo=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),yo={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:_o,scaleY:vo,scale:e=>(_o(e)+vo(e))/2,rotateX:e=>ho(fo(Math.atan2(e[6],e[5]))),rotateY:e=>ho(fo(Math.atan2(-e[2],e[0]))),rotateZ:go,rotate:go,skewX:e=>fo(Math.atan(e[4])),skewY:e=>fo(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function bo(e){return e.includes(`scale`)?1:0}function xo(e,t){if(!e||e===`none`)return bo(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=yo,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mo,i=t}if(!i)return bo(t);let a=r[t],o=i[1].split(`,`).map(Co);return typeof a==`function`?a(o):o[a]}var So=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return xo(n,t)};function Co(e){return parseFloat(e.trim())}var wo=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],To=new Set(wo),Eo=e=>e===ji||e===Y,Do=new Set([`x`,`y`,`z`]),Oo=wo.filter(e=>!Do.has(e));function ko(e){let t=[];return Oo.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Ao={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},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})=>xo(t,`x`),y:(e,{transform:t})=>xo(t,`y`)};Ao.translateX=Ao.x,Ao.translateY=Ao.y;var jo=new Set,Mo=!1,No=!1,Po=!1;function Fo(){if(No){let e=Array.from(jo).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ko(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}No=!1,Mo=!1,jo.forEach(e=>e.complete(Po)),jo.clear()}function Io(){jo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(No=!0)})}function Lo(){Po=!0,Io(),Fo(),Po=!1}var Ro=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(jo.add(this),Mo||(Mo=!0,J.read(Io),J.resolveKeyframes(Fo))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}uo(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),jo.delete(this)}cancel(){this.state===`scheduled`&&(jo.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},zo=e=>e.startsWith(`--`);function Bo(e,t,n){zo(t)?e.style.setProperty(t,n):e.style[t]=n}var Vo={};function Ho(e,t){let n=Pr(e);return()=>Vo[t]??n()}var Uo=Ho(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Wo=Ho(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Go=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Ko={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Go([0,.65,.55,1]),circOut:Go([.55,0,1,.45]),backIn:Go([.31,.01,.66,-.59]),backOut:Go([.33,1.53,.69,.99])};function qo(e,t){if(e)return typeof e==`function`?Wo()?Na(e,t):`ease-out`:li(e)?Go(e):Array.isArray(e)?e.map(e=>qo(e,t)||Ko.easeOut):Ko[e]}function Jo(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=qo(s,i);Array.isArray(d)&&(u.easing=d),mi.value&&wi.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return mi.value&&p.finished.finally(()=>{wi.waapi--}),p}function Yo(e){return typeof e==`function`&&`applyToOptions`in e}function Xo({type:e,...t}){return Yo(e)&&Wo()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Zo=class extends so{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,kr(typeof e.type!=`string`,`Mini animate() doesn't support "type" as a string.`,`mini-spring`);let c=Xo(e);this.animation=Jo(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=io(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Bo(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,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;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Vr(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Vr(e)}get time(){return Vr(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Br(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Uo()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Fr):r(this)}},Qo={anticipate:ti,backInOut:ei,circInOut:ii};function $o(e){return e in Qo}function es(e){typeof e.ease==`string`&&$o(e.ease)&&(e.ease=Qo[e.ease])}var ts=10,ns=class extends Zo{constructor(e){es(e),oo(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new lo({...a,autoplay:!1}),s=Math.max(ts,Ci.now()-this.startTime),c=Er(0,ts,s-ts),l=o.sample(s).value,{name:u}=this.options;i&&u&&Bo(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},rs=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(ma.test(e)||e===`0`)&&!e.startsWith(`url(`));function is(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function as(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=rs(i,t),s=rs(a,t);return Or(o===s,`You are trying to animate ${t} from "${i}" to "${a}". "${o?a:i}" is not an animatable value.`,`value-not-animatable`),!o||!s?!1:is(e)||(n===`spring`||Yo(n))&&r}function os(e){e.duration=0,e.type=`keyframes`}var ss=new Set([`opacity`,`clipPath`,`filter`,`transform`]),cs=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function ls(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&cs.test(e[t]))return!0;return!1}var us=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),ds=Pr(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function fs(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return ds()&&n&&(ss.has(n)||us.has(n)&&ls(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ps=40,ms=class extends so{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ci.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Ro)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Ci.now();let u=!0;as(e,i,a,o)||(u=!1,(Ar.instantAnimations||!s)&&l?.(io(e,n,t)),e[0]=e[e.length-1],os(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ps?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&fs(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new ns({...d,element:p})}catch{m=new lo(d)}else m=new lo(d);m.finished.then(()=>{this.notifyFinished()}).catch(Fr),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Lo()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function hs(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var gs=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _s(e){let t=gs.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var vs=4;function ys(e,t,n=1){kr(n<=vs,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,`max-css-var-depth`);let[r,i]=_s(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return jr(e)?parseFloat(e):e}return Oi(i)?ys(i,t,n+1):i}var bs={type:`spring`,stiffness:500,damping:25,restSpeed:10},xs=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Ss={type:`keyframes`,duration:.8},Cs={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},ws=(e,{keyframes:t})=>t.length>2?Ss:To.has(e)?e.startsWith(`scale`)?xs(t[1]):bs:Cs;function Ts(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Es(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ts(n,e)}var Ds=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Os(e){for(let t in e)if(!Ds.has(t))return!0;return!1}var ks=(e,t,n,r={},i,a)=>o=>{let s=Es(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Br(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Os(s)||Object.assign(u,ws(e,u)),u.duration&&=Br(u.duration),u.repeatDelay&&=Br(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(os(u),u.delay===0&&(d=!0)),(Ar.instantAnimations||Ar.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,os(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=io(u.keyframes,s);if(e!==void 0){J.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new lo(u):new ms(u)};function As(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function js(e,t,n,r){if(typeof t==`function`){let[i,a]=As(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=As(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Ms(e,t,n){let r=e.getProps();return js(r,t,n===void 0?r.custom:n,e)}var Ns=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...wo]),Ps=30,Fs=e=>!isNaN(parseFloat(e)),Is={current:void 0},Ls=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Ci.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ci.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fs(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!==`production`&&Wr(!1,`value.onChange(callback) is deprecated. Switch to value.on("change", callback).`),this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new zr);let n=this.events[e].add(t);return e===`change`?()=>{n(),J.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Is.current&&Is.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Ci.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Ps)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Ps);return Hr(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 Rs(e,t){return new Ls(e,t)}var zs=e=>Array.isArray(e);function Bs(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rs(n))}function Vs(e){return zs(e)?e[e.length-1]||0:e}function Hs(e,t){let{transitionEnd:n={},transition:r={},...i}=Ms(e,t)||{};i={...i,...n};for(let t in i)Bs(e,t,Vs(i[t]))}var Us=e=>!!(e&&e.getVelocity);function Ws(e){return!!(Us(e)&&e.add)}function Gs(e,t){let n=e.getValue(`willChange`);if(Ws(n))return n.add(t);if(!n&&Ar.WillChange){let n=new Ar.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Ks(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var qs=`data-`+Ks(`framerAppearId`);function Js(e){return e.props[qs]}function Ys({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Xs(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ts(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Ys(d,t))continue;let o={delay:n,...Es(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){J.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Js(e);if(n){let e=window.MotionHandoffAnimation(n,t,J);e!==null&&(o.startTime=e,f=!0)}}Gs(e,t);let p=l??e.shouldReduceMotion;r.start(ks(t,r,i,p&&Ns.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>J.update(()=>{o&&Hs(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Zs(e,t,n={}){let r=Ms(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Xs(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Qs(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Qs(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Zs(c,t,{...o,delay:n+(typeof r==`function`?0:r)+hs(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function $s(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Zs(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Zs(e,t,n);else{let i=typeof t==`function`?Ms(e,t,n.custom):t;r=Promise.all(Xs(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var ec={test:e=>e===`auto`,parse:e=>e},tc=e=>t=>t.test(e),nc=[ji,Y,qi,Ki,Yi,Ji,ec],rc=e=>nc.find(tc(e));function ic(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Nr(e)}var ac=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function oc(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Fi)||[];if(!r)return e;let i=n.replace(r,``),a=ac.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var sc=/\b([a-z-]*)\(.*?\)/gu,cc={...ma,getAnimatableNone:e=>{let t=e.match(sc);return t?t.map(oc).join(` `):e}},lc={...ma,getAnimatableNone:e=>{let t=ma.parse(e);return ma.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},uc={...ji,transform:Math.round},dc={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:Ki,rotateX:Ki,rotateY:Ki,rotateZ:Ki,scale:Ni,scaleX:Ni,scaleY:Ni,scaleZ:Ni,skew:Ki,skewX:Ki,skewY:Ki,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:Mi,originX:Xi,originY:Xi,originZ:Y,zIndex:uc,fillOpacity:Mi,strokeOpacity:Mi,numOctaves:uc},fc={...dc,color:Qi,backgroundColor:Qi,outlineColor:Qi,fill:Qi,stroke:Qi,borderColor:Qi,borderTopColor:Qi,borderRightColor:Qi,borderBottomColor:Qi,borderLeftColor:Qi,filter:cc,WebkitFilter:cc,mask:lc,WebkitMask:lc},pc=e=>fc[e],mc=new Set([cc,lc]);function hc(e,t){let n=pc(e);return mc.has(n)||(n=ma),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var gc=new Set([`auto`,`none`,`0`]);function _c(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!gc.has(t)&&sa(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=hc(n,i)}var vc=class extends Ro{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Oi(r))){let i=ys(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Ns.has(n)||e.length!==2)return;let[r,i]=e,a=rc(r),o=rc(i);if(Ai(r)!==Ai(i)&&Ao[n]){this.needsMeasurement=!0;return}if(a!==o)if(Eo(a)&&Eo(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Ao[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||ic(e[t]))&&n.push(t);n.length&&_c(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ao[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Ao[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function yc(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var bc=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function xc(e){return Mr(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Sc,cancel:Cc}=_i(queueMicrotask,!1),wc={x:!1,y:!1};function Tc(){return wc.x||wc.y}function Ec(e){return e===`x`||e===`y`?wc[e]?null:(wc[e]=!0,()=>{wc[e]=!1}):wc.x||wc.y?null:(wc.x=wc.y=!0,()=>{wc.x=wc.y=!1})}function Dc(e,t){let n=yc(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Oc(e){return!(e.pointerType===`touch`||Tc())}function kc(e,t,n={}){let[r,i,a]=Dc(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Oc(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Ac=(e,t)=>t?e===t?!0:Ac(e,t.parentElement):!1,jc=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Mc=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Nc(e){return Mc.has(e.tagName)||e.isContentEditable===!0}var Pc=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Fc(e){return Pc.has(e.tagName)||e.isContentEditable===!0}var Ic=new WeakSet;function Lc(e){return t=>{t.key===`Enter`&&e(t)}}function Rc(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var zc=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Lc(()=>{if(Ic.has(n))return;Rc(n,`down`);let e=Lc(()=>{Rc(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Rc(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Bc(e){return jc(e)&&!Tc()}var Vc=new WeakSet;function Hc(e,t,n={}){let[r,i,a]=Dc(e,n),o=e=>{let r=e.currentTarget;if(!Bc(e)||Vc.has(e))return;Ic.add(r),n.stopPropagation&&Vc.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ic.has(r)&&Ic.delete(r),Bc(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Ac(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),xc(e)&&(e.addEventListener(`focus`,e=>zc(e,i)),!Nc(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Uc(e){return Mr(e)&&`ownerSVGElement`in e}var Wc=new WeakMap,Gc,Kc=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Uc(r)&&`getBBox`in r?r.getBBox()[t]:r[n],qc=Kc(`inline`,`width`,`offsetWidth`),Jc=Kc(`block`,`height`,`offsetHeight`);function Yc({target:e,borderBoxSize:t}){Wc.get(e)?.forEach(n=>{n(e,{get width(){return qc(e,t)},get height(){return Jc(e,t)}})})}function Xc(e){e.forEach(Yc)}function Zc(){typeof ResizeObserver>`u`||(Gc=new ResizeObserver(Xc))}function Qc(e,t){Gc||Zc();let n=yc(e);return n.forEach(e=>{let n=Wc.get(e);n||(n=new Set,Wc.set(e,n)),n.add(t),Gc?.observe(e)}),()=>{n.forEach(e=>{let n=Wc.get(e);n?.delete(t),n?.size||Gc?.unobserve(e)})}}var $c=new Set,el;function tl(){el=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};$c.forEach(t=>t(e))},window.addEventListener(`resize`,el)}function nl(e){return $c.add(e),el||tl(),()=>{$c.delete(e),!$c.size&&typeof el==`function`&&(window.removeEventListener(`resize`,el),el=void 0)}}function rl(e,t){return typeof e==`function`?nl(e):Qc(e,t)}function il(e){return Uc(e)&&e.tagName===`svg`}var al=[...nc,Qi,ma],ol=e=>al.find(tc(e)),sl=()=>({translate:0,scale:1,origin:0,originPoint:0}),cl=()=>({x:sl(),y:sl()}),ll=()=>({min:0,max:0}),ul=()=>({x:ll(),y:ll()}),dl=new WeakMap;function fl(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function pl(e){return typeof e==`string`||Array.isArray(e)}var ml=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],hl=[`initial`,...ml];function gl(e){return fl(e.animate)||hl.some(t=>pl(e[t]))}function _l(e){return!!(gl(e)||e.variants)}function vl(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Us(i))e.addValue(r,i);else if(Us(a))e.addValue(r,Rs(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Rs(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var yl={current:null},bl={current:!1},xl=typeof window<`u`;function Sl(){if(bl.current=!0,xl)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>yl.current=e.matches;e.addEventListener(`change`,t),t()}else yl.current=!1}var Cl=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],wl={};function Tl(e){wl=e}function El(){return wl}var Dl=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ro,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Ci.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,J.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=gl(t),this.isVariantNode=_l(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Us(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,dl.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(bl.current||Sl(),this.shouldReduceMotion=yl.current),process.env.NODE_ENV!==`production`&&Wr(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),vi(this.notifyUpdate),vi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ss.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Zo({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Br(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=To.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&J.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in wl){let t=wl[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ul()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Cl.length;t++){let n=Cl[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=vl(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Rs(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(jr(n)||Nr(n))?n=parseFloat(n):!ol(n)&&ma.test(t)&&(n=hc(e,t)),this.setBaseTarget(e,Us(n)?n.get():n)),Us(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=js(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Us(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new zr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Sc.render(this.render)}},Ol=class extends Dl{constructor(){super(...arguments),this.KeyframeResolver=vc}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Us(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},kl=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Al({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function jl({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ml(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Nl(e){return e===void 0||e===1}function Pl({scale:e,scaleX:t,scaleY:n}){return!Nl(e)||!Nl(t)||!Nl(n)}function Fl(e){return Pl(e)||Il(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Il(e){return Ll(e.x)||Ll(e.y)}function Ll(e){return e&&e!==`0%`}function Rl(e,t,n){return n+t*(e-n)}function zl(e,t,n,r,i){return i!==void 0&&(e=Rl(e,i,r)),Rl(e,n,r)+t}function Bl(e,t=0,n=1,r,i){e.min=zl(e.min,t,n,r,i),e.max=zl(e.max,t,n,r,i)}function Vl(e,{x:t,y:n}){Bl(e.x,t.translate,t.scale,t.originPoint),Bl(e.y,n.translate,n.scale,n.originPoint)}var Hl=.999999999999,Ul=1.0000000000001;function Wl(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Gl(e.x,-a.scroll.offset.x),Gl(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Vl(e,o)),r&&Fl(a.latestValues)&&Jl(e,a.latestValues,a.layout?.layoutBox))}t.x<Ul&&t.x>Hl&&(t.x=1),t.y<Ul&&t.y>Hl&&(t.y=1)}function Gl(e,t){e.min+=t,e.max+=t}function Kl(e,t,n,r,i=.5){Bl(e,t,n,X(e.min,e.max,i),r)}function ql(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Jl(e,t,n){let r=n??e;Kl(e.x,ql(t.x,r.x),t.scaleX,t.scale,t.originX),Kl(e.y,ql(t.y,r.y),t.scaleY,t.scale,t.originY)}function Yl(e,t){return Al(Ml(e.getBoundingClientRect(),t))}function Xl(e,t,n){let r=Yl(e,n),{scroll:i}=t;return i&&(Gl(r.x,i.offset.x),Gl(r.y,i.offset.y)),r}var Zl={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Ql=wo.length;function $l(e,t,n){let r=``,i=!0;for(let a=0;a<Ql;a++){let o=wo[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===(o.startsWith(`scale`)?1:0);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=bc(s,dc[o]);if(!c){i=!1;let t=Zl[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function eu(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(To.has(e)){o=!0;continue}else if(Ei(e)){i[e]=n;continue}else{let t=bc(n,dc[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=$l(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function tu(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function nu(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var ru={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Y.test(e))e=parseFloat(e);else return e;return`${nu(e,t.target.x)}% ${nu(e,t.target.y)}%`}},iu={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=ma.parse(e);if(i.length>5)return r;let a=ma.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=X(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},au={borderRadius:{...ru,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:ru,borderTopRightRadius:ru,borderBottomLeftRadius:ru,borderBottomRightRadius:ru,boxShadow:iu};function ou(e,{layout:t,layoutId:n}){return To.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!au[e]||e===`opacity`)}function su(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Us(r[t])||i&&Us(i[t])||ou(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function cu(e){return window.getComputedStyle(e)}var lu=class extends Ol{constructor(){super(...arguments),this.type=`html`,this.renderInstance=tu}readValueFromInstance(e,t){if(To.has(t))return this.projection?.isProjecting?bo(t):So(e,t);{let n=cu(e),r=(Ei(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Yl(e,t)}build(e,t,n){eu(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return su(e,t,n)}},uu={offset:`stroke-dashoffset`,array:`stroke-dasharray`},du={offset:`strokeDashoffset`,array:`strokeDasharray`};function fu(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?uu:du;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var pu=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function mu(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(eu(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of pu)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&fu(d,i,a,o,!1)}var hu=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),gu=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function _u(e,t,n,r){tu(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(hu.has(n)?n:Ks(n),t.attrs[n])}function vu(e,t,n){let r=su(e,t,n);for(let n in e)if(Us(e[n])||Us(t[n])){let t=wo.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var yu=class extends Ol{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=ul}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(To.has(t)){let e=pc(t);return e&&e.default||0}return t=hu.has(t)?t:Ks(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return vu(e,t,n)}build(e,t,n){mu(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){_u(e,t,n,r)}mount(e){this.isSVGTag=gu(e.tagName),super.mount(e)}},bu=hl.length;function xu(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&xu(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<bu;n++){let r=hl[n],i=e.props[r];(pl(i)||i===!1)&&(t[r]=i)}return t}function Su(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Cu=[...ml].reverse(),wu=ml.length;function Tu(e){return t=>Promise.all(t.map(({animation:t,options:n})=>$s(e,t,n)))}function Eu(e){let t=Tu(e),n=ku(),r=!0,i=!1,a=t=>(n,r)=>{let i=Ms(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=xu(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<wu;t++){let p=Cu[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=pl(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||fl(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Du(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=zs(t)&&zs(n)?!Su(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let ee=v&&y;b&&(!ee||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!ee&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Ms(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=hs(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Ms(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=ku(),i=!0}}}function Du(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Su(t,e):!1}function Ou(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ku(){return{animate:Ou(!0),whileInView:Ou(),whileHover:Ou(),whileTap:Ou(),whileDrag:Ou(),whileFocus:Ou(),exit:Ou()}}function Au(e,t){e.min=t.min,e.max=t.max}function ju(e,t){Au(e.x,t.x),Au(e.y,t.y)}function Mu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Nu=1e-4,Pu=1-Nu,Fu=1+Nu,Iu=.01,Lu=0-Iu,Ru=0+Iu;function zu(e){return e.max-e.min}function Bu(e,t,n){return Math.abs(e-t)<=n}function Vu(e,t,n,r=.5){e.origin=r,e.originPoint=X(t.min,t.max,e.origin),e.scale=zu(n)/zu(t),e.translate=X(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Pu&&e.scale<=Fu||isNaN(e.scale))&&(e.scale=1),(e.translate>=Lu&&e.translate<=Ru||isNaN(e.translate))&&(e.translate=0)}function Hu(e,t,n,r){Vu(e.x,t.x,n.x,r?r.originX:void 0),Vu(e.y,t.y,n.y,r?r.originY:void 0)}function Uu(e,t,n,r=0){e.min=(r?X(n.min,n.max,r):n.min)+t.min,e.max=e.min+zu(t)}function Wu(e,t,n,r){Uu(e.x,t.x,n.x,r?.x),Uu(e.y,t.y,n.y,r?.y)}function Gu(e,t,n,r=0){let i=r?X(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+zu(t)}function Ku(e,t,n,r){Gu(e.x,t.x,n.x,r?.x),Gu(e.y,t.y,n.y,r?.y)}function qu(e,t,n,r,i){return e-=t,e=Rl(e,1/n,r),i!==void 0&&(e=Rl(e,1/i,r)),e}function Ju(e,t=0,n=1,r=.5,i,a=e,o=e){if(qi.test(t)&&(t=parseFloat(t),t=X(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=X(a.min,a.max,r);e===a&&(s-=t),e.min=qu(e.min,t,n,s,i),e.max=qu(e.max,t,n,s,i)}function Yu(e,t,[n,r,i],a,o){Ju(e,t[n],t[r],t[i],t.scale,a,o)}var Xu=[`x`,`scaleX`,`originX`],Zu=[`y`,`scaleY`,`originY`];function Qu(e,t,n,r){Yu(e.x,t,Xu,n?n.x:void 0,r?r.x:void 0),Yu(e.y,t,Zu,n?n.y:void 0,r?r.y:void 0)}function $u(e){return e.translate===0&&e.scale===1}function ed(e){return $u(e.x)&&$u(e.y)}function td(e,t){return e.min===t.min&&e.max===t.max}function nd(e,t){return td(e.x,t.x)&&td(e.y,t.y)}function rd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function id(e,t){return rd(e.x,t.x)&&rd(e.y,t.y)}function ad(e){return zu(e.x)/zu(e.y)}function od(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function sd(e){return[e(`x`),e(`y`)]}function cd(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var ld=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],ud=ld.length,dd=e=>typeof e==`string`?parseFloat(e):e,fd=e=>typeof e==`number`||Y.test(e);function pd(e,t,n,r,i,a){i?(e.opacity=X(0,n.opacity??1,hd(r)),e.opacityExit=X(t.opacity??1,0,gd(r))):a&&(e.opacity=X(t.opacity??1,n.opacity??1,r));for(let i=0;i<ud;i++){let a=ld[i],o=md(t,a),s=md(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||fd(o)===fd(s)?(e[a]=Math.max(X(dd(o),dd(s),r),0),(qi.test(s)||qi.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=X(t.rotate||0,n.rotate||0,r))}function md(e,t){return e[t]===void 0?e.borderRadius:e[t]}var hd=_d(0,.5,ri),gd=_d(.5,.95,Fr);function _d(e,t,n){return r=>r<e?0:r>t?1:n(Rr(e,t,r))}function vd(e,t,n){let r=Us(e)?e:Rs(e);return r.start(ks(``,r,t,n)),r.animation}function yd(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var bd=(e,t)=>e.depth-t.depth,xd=class{constructor(){this.children=[],this.isDirty=!1}add(e){wr(this.children,e),this.isDirty=!0}remove(e){Tr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(bd),this.isDirty=!1,this.children.forEach(e)}};function Sd(e,t){let n=Ci.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(vi(r),e(a-t))};return J.setup(r,!0),()=>vi(r)}function Cd(e){return Us(e)?e.get():e}var wd=class{constructor(){this.members=[]}add(e){wr(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Tr(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Tr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Td={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ed={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Dd=[``,`X`,`Y`,`Z`],Od=1e3,kd=0;function Ad(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function jd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Js(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,J,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&jd(r)}function Md({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=kd++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mi.value&&(Ed.nodes=Ed.calculatedTargetDeltas=Ed.calculatedProjections=0),this.nodes.forEach(Fd),this.nodes.forEach(Wd),this.nodes.forEach(Gd),this.nodes.forEach(Id),mi.addProjectionMetrics&&mi.addProjectionMetrics(Ed)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new xd)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new zr),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=Uc(t)&&!il(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;J.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Sd(i,250),Td.hasAnimatedSinceResize&&(Td.hasAnimatedSinceResize=!1,this.nodes.forEach(Ud)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Qd,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!id(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Es(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||Ud(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),vi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Kd),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&jd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(zd),this.nodes.forEach(Rd);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Bd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Vd),this.nodes.forEach(Hd),this.nodes.forEach(Nd),this.nodes.forEach(Pd)):this.nodes.forEach(Bd),this.clearAllSnapshots();let e=Ci.now();yi.delta=Er(0,1e3/60,e-yi.timestamp),yi.timestamp=e,yi.isProcessing=!0,bi.update.process(yi),bi.preRender.process(yi),bi.render.process(yi),yi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Sc.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ld),this.sharedNodes.forEach(qd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,J.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){J.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!zu(this.snapshot.measuredBox.x)&&!zu(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=ul(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!ed(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||Fl(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),nf(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return ul();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(af))){let{scroll:e}=this.root;e&&(Gl(t.x,e.offset.x),Gl(t.y,e.offset.y))}return t}removeElementScroll(e){let t=ul();if(ju(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ju(t,e),Gl(t.x,i.offset.x),Gl(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||ul();ju(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Gl(r.x,-n.scroll.offset.x),Gl(r.y,-n.scroll.offset.y)),Fl(n.latestValues)&&Jl(r,n.latestValues,n.layout?.layoutBox)}return Fl(this.latestValues)&&Jl(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=ul();ju(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!Fl(n.latestValues))continue;let r;n.instance&&(Pl(n.latestValues)&&n.updateSnapshot(),r=ul(),ju(r,n.measurePageBox())),Qu(t,n.latestValues,n.snapshot?.layoutBox,r)}return Fl(this.latestValues)&&Qu(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==yi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=yi.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ul(),this.targetWithTransforms=ul()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Wu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ju(this.target,this.layout.layoutBox),Vl(this.target,this.targetDelta)):ju(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),mi.value&&Ed.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Pl(this.parent.latestValues)||Il(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ul(),this.relativeTargetOrigin=ul(),Ku(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ju(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===yi.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ju(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Wl(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=ul());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Mu(this.prevProjectionDelta.x,this.projectionDelta.x),Mu(this.prevProjectionDelta.y,this.projectionDelta.y)),Hu(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!od(this.projectionDelta.x,this.prevProjectionDelta.x)||!od(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),mi.value&&Ed.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=cl(),this.projectionDelta=cl(),this.projectionDeltaWithTransform=cl()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=cl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=ul(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Zd));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;Jd(a.x,e.x,n),Jd(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ku(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Xd(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&nd(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=ul(),ju(d,this.relativeTarget)),s&&(this.animationValues=i,pd(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(vi(this.pendingAnimation),void 0),this.pendingAnimation=J.update(()=>{Td.hasAnimatedSinceResize=!0,wi.layout++,this.motionValue||=Rs(0),this.motionValue.jump(0,!1),this.currentAnimation=vd(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{wi.layout--},onComplete:()=>{wi.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Od),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&rf(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||ul();let t=zu(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=zu(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ju(t,n),Jl(t,i),Hu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new wd),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Ad(`z`,e,r,this.animationValues);for(let t=0;t<Dd.length;t++)Ad(`rotate${Dd[t]}`,e,r,this.animationValues),Ad(`skew${Dd[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Cd(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Cd(t?.pointerEvents)||``),this.hasProjected&&!Fl(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=cd(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in au){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=au[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Cd(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Rd),this.root.sharedNodes.clear()}}}function Nd(e){e.updateLayout()}function Pd(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)sd(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=zu(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Au(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else rf(i,t.layoutBox,n)&&sd(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=zu(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=cl();Hu(o,n,t.layoutBox);let s=cl();a?Hu(s,e.applyTransform(r,!0),t.measuredBox):Hu(s,n,t.layoutBox);let c=!ed(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=ul();Ku(s,t.layoutBox,i.layoutBox,o);let c=ul();Ku(c,n,a.layoutBox,o),id(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Fd(e){mi.value&&Ed.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Id(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ld(e){e.clearSnapshot()}function Rd(e){e.clearMeasurements()}function zd(e){e.isLayoutDirty=!0,e.updateLayout()}function Bd(e){e.isLayoutDirty=!1}function Vd(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Hd(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Ud(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Wd(e){e.resolveTargetDelta()}function Gd(e){e.calcProjection()}function Kd(e){e.resetSkewAndRotation()}function qd(e){e.removeLeadSnapshot()}function Jd(e,t,n){e.translate=X(t.translate,0,n),e.scale=X(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Yd(e,t,n,r){e.min=X(t.min,n.min,r),e.max=X(t.max,n.max,r)}function Xd(e,t,n,r){Yd(e.x,t.x,n.x,r),Yd(e.y,t.y,n.y,r)}function Zd(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var Qd={duration:.45,ease:[.4,0,.1,1]},$d=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ef=$d(`applewebkit/`)&&!$d(`chrome/`)?Math.round:Fr;function tf(e){e.min=ef(e.min),e.max=ef(e.max)}function nf(e){tf(e.x),tf(e.y)}function rf(e,t,n){return e===`position`||e===`preserve-aspect`&&!Bu(ad(t),ad(n),.2)}function af(e){return e!==e.root&&e.scroll?.wasRoot}var of=Md({attachResizeListener:(e,t)=>yd(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),sf={current:void 0},cf=Md({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!sf.current){let e=new of({});e.mount(window),e.setOptions({layoutScroll:!0}),sf.current=e}return sf.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),lf=(0,d.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function uf(e=!0){let t=(0,d.useContext)(Cr);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,d.useId)();(0,d.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,d.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var df=(0,d.createContext)({strict:!1}),ff={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},pf=!1;function mf(){if(pf)return;let e={};for(let t in ff)e[t]={isEnabled:e=>ff[t].some(t=>!!e[t])};Tl(e),pf=!0}function hf(){return mf(),El()}function gf(e){let t=hf();for(let n in e)t[n]={...t[n],...e[n]};Tl(t)}var _f=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function vf(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||_f.has(e)}var yf=s({default:()=>bf}),bf,xf=o((()=>{throw bf={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Sf=e=>!vf(e);function Cf(e){typeof e==`function`&&(Sf=t=>t.startsWith(`on`)?!vf(t):e(t))}try{Cf((xf(),u(yf)).default)}catch{}function wf(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Us(e[i])||(Sf(i)||n===!0&&vf(i)||!t&&!vf(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var Tf=(0,d.createContext)({});function Ef(e,t){if(gl(e)){let{initial:t,animate:n}=e;return{initial:t===!1||pl(t)?t:void 0,animate:pl(n)?n:void 0}}return e.inherit===!1?{}:t}function Df(e){let{initial:t,animate:n}=Ef(e,(0,d.useContext)(Tf));return(0,d.useMemo)(()=>({initial:t,animate:n}),[Of(t),Of(n)])}function Of(e){return Array.isArray(e)?e.join(` `):e}var kf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Af(e,t,n){for(let r in t)!Us(t[r])&&!ou(r,n)&&(e[r]=t[r])}function jf({transformTemplate:e},t){return(0,d.useMemo)(()=>{let n=kf();return eu(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Mf(e,t){let n=e.style||{},r={};return Af(r,n,e),Object.assign(r,jf(e,t)),r}function Nf(e,t){let n={},r=Mf(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Pf=()=>({...kf(),attrs:{}});function Ff(e,t,n,r){let i=(0,d.useMemo)(()=>{let n=Pf();return mu(n,t,gu(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Af(t,e.style,e),i.style={...t,...i.style}}return i}var If=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Lf(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(If.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rf(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??Lf(e)?Ff:Nf)(t,r,i,e),c=wf(t,typeof e==`string`,a),l=e===d.Fragment?{}:{...c,...s,ref:n},{children:u}=t,f=(0,d.useMemo)(()=>Us(u)?u.get():u,[u]);return(0,d.createElement)(e,{...l,children:f})}function zf({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Bf(n,r,i,e),renderState:t()}}function Bf(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Cd(a[e]);let{initial:o,animate:s}=e,c=gl(e),l=_l(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!fl(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=js(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Vf=e=>(t,n)=>{let r=(0,d.useContext)(Tf),i=(0,d.useContext)(Cr),a=()=>zf(e,t,r,i);return n?a():xr(a)},Hf=Vf({scrapeMotionValuesFromProps:su,createRenderState:kf}),Uf=Vf({scrapeMotionValuesFromProps:vu,createRenderState:Pf}),Wf=Symbol.for(`motionComponentSymbol`);function Gf(e,t,n){let r=(0,d.useRef)(n);(0,d.useInsertionEffect)(()=>{r.current=n});let i=(0,d.useRef)(null);return(0,d.useCallback)(n=>{n&&e.onMount?.(n);let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n);t&&(n?t.mount(n):t.unmount())},[t])}var Kf=(0,d.createContext)({});function qf(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Jf(e,t,n,r,i,a){let{visualElement:o}=(0,d.useContext)(Tf),s=(0,d.useContext)(df),c=(0,d.useContext)(Cr),l=(0,d.useContext)(lf),u=l.reducedMotion,f=l.skipAnimations,p=(0,d.useRef)(null),m=(0,d.useRef)(!1);r||=s.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:f,isSVG:a}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));let h=p.current,g=(0,d.useContext)(Kf);h&&!h.projection&&i&&(h.type===`html`||h.type===`svg`)&&Yf(p.current,n,i,g);let _=(0,d.useRef)(!1);(0,d.useInsertionEffect)(()=>{h&&_.current&&h.update(n,c)});let v=n[qs],y=(0,d.useRef)(!!v&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Sr(()=>{m.current=!0,h&&(_.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),y.current&&h.animationState&&h.animationState.animateChanges())}),(0,d.useEffect)(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),!1),h.enteringChildren=void 0)}),h}function Yf(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Xf(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&qf(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Xf(e){if(e)return e.options.allowProjection===!1?Xf(e.parent):e.projection}function Zf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&gf(r);let a=n?n===`svg`:Lf(e),o=a?Uf:Hf;function s(n,s){let c,l={...(0,d.useContext)(lf),...n,layoutId:Qf(n)},{isStatic:u}=l,p=Df(n),m=o(n,u);if(!u&&typeof window<`u`){$f(l,r);let t=ep(l);c=t.MeasureLayout,p.visualElement=Jf(e,m,l,i,t.ProjectionNode,a)}return(0,f.jsxs)(Tf.Provider,{value:p,children:[c&&p.visualElement?(0,f.jsx)(c,{visualElement:p.visualElement,...l}):null,Rf(e,n,Gf(m,p.visualElement,s),m,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,d.forwardRef)(s);return c[Wf]=e,c}function Qf({layoutId:e}){let t=(0,d.useContext)(br).id;return t&&e!==void 0?t+`-`+e:e}function $f(e,t){let n=(0,d.useContext)(df).strict;if(process.env.NODE_ENV!==`production`&&t&&n){let t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?Or(!1,t,`lazy-strict-mode`):kr(!1,t,`lazy-strict-mode`)}}function ep(e){let{drag:t,layout:n}=hf();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function tp(e,t){if(typeof Proxy>`u`)return Zf;let n=new Map,r=(n,r)=>Zf(n,r,e,t);return new Proxy((e,t)=>(process.env.NODE_ENV!==`production`&&Wr(!1,`motion() is deprecated. Use motion.create() instead.`),r(e,t)),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Zf(a,void 0,e,t)),n.get(a))})}var np=(e,t)=>t.isSVG??Lf(e)?new yu(t):new lu(t,{allowProjection:e!==d.Fragment}),rp=class extends kl{constructor(e){super(e),e.animationState||=Eu(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();fl(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},ip=0,ap={animation:{Feature:rp},exit:{Feature:class extends kl{constructor(){super(...arguments),this.id=ip++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`){let n=Ms(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function op(e){return{point:{x:e.pageX,y:e.pageY}}}var sp=e=>t=>jc(t)&&e(t,op(t));function cp(e,t,n,r){return yd(e,t,sp(n),r)}var lp=({current:e})=>e?e.ownerDocument.defaultView:null,up=(e,t)=>Math.abs(e-t);function dp(e,t){let n=up(e.x,t.x),r=up(e.y,t.y);return Math.sqrt(n**2+r**2)}var fp=new Set([`auto`,`scroll`]),pp=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=mp(this.lastRawMoveEventInfo,this.transformPagePoint));let e=gp(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=dp(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=yi;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=mp(t,this.transformPagePoint),J.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=gp(e.type===`pointercancel`?this.lastMoveEventInfo:mp(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!jc(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=mp(op(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=yi;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,gp(s,this.history)),this.removeListeners=Lr(cp(this.contextWindow,`pointermove`,this.handlePointerMove),cp(this.contextWindow,`pointerup`,this.handlePointerUp),cp(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(fp.has(e.overflowX)||fp.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),J.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),vi(this.updatePoint)}};function mp(e,t){return t?{point:t(e.point)}:e}function hp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gp({point:e},t){return{point:e,delta:hp(e,vp(t)),offset:hp(e,_p(t)),velocity:yp(t,.1)}}function _p(e){return e[0]}function vp(e){return e[e.length-1]}function yp(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=vp(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Br(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Br(t)*2&&(r=e[1]);let a=Vr(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function bp(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?X(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?X(n,e,r.max):Math.min(e,n)),e}function xp(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Sp(e,{top:t,left:n,bottom:r,right:i}){return{x:xp(e.x,n,i),y:xp(e.y,t,r)}}function Cp(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function wp(e,t){return{x:Cp(e.x,t.x),y:Cp(e.y,t.y)}}function Tp(e,t){let n=.5,r=zu(e),i=zu(t);return i>r?n=Rr(t.min,t.max-r,e.min):r>i&&(n=Rr(e.min,e.max-i,t.min)),Er(0,1,n)}function Ep(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Dp=.35;function Op(e=Dp){return e===!1?e=0:e===!0&&(e=Dp),{x:kp(e,`left`,`right`),y:kp(e,`top`,`bottom`)}}function kp(e,t,n){return{min:Ap(e,t),max:Ap(e,n)}}function Ap(e,t){return typeof e==`number`?e:e[t]||0}var jp=new WeakMap,Mp=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ul(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(op(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ec(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),sd(e=>{let t=this.getAxisMotionValue(e).get()||0;if(qi.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=zu(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&J.update(()=>i(e,t),!1,!0),Gs(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Ip(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&J.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new pp(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:lp(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&J.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Fp(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=bp(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&qf(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Sp(n.layoutBox,e):this.constraints=!1,this.elastic=Op(t),r!==this.constraints&&!qf(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&sd(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Ep(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!qf(e))return!1;let n=e.current;kr(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",`drag-constraints-ref`);let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Xl(n,r.root,this.visualElement.getTransformPagePoint()),a=wp(r.layout.layoutBox,i);if(t){let e=t(jl(a));this.hasMutatedConstraints=!!e,e&&(a=Al(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=sd(o=>{if(!Fp(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Gs(this.visualElement,e),n.start(ks(e,n,0,t,this.visualElement,!1))}stopAnimation(){sd(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){sd(t=>{let{drag:n}=this.getProps();if(!Fp(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-X(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!qf(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};sd(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Tp({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),sd(t=>{if(!Fp(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(X(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;jp.set(this.visualElement,this);let e=this.visualElement.current,t=cp(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&Fc(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();qf(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=Pp(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),J.read(r);let o=yd(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(sd(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Dp,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Np(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Pp(e,t,n){let r=rl(e,Np(n)),i=rl(t,Np(n));return()=>{r(),i()}}function Fp(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Ip(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Lp=class extends kl{constructor(e){super(e),this.removeGroupControls=Fr,this.removeListeners=Fr,this.controls=new Mp(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Fr}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Rp=e=>(t,n)=>{e&&J.update(()=>e(t,n),!1,!0)},zp=class extends kl{constructor(){super(...arguments),this.removePointerDownListener=Fr}onPointerDown(e){this.session=new pp(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lp(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Rp(e),onStart:Rp(t),onMove:Rp(n),onEnd:(e,t)=>{delete this.session,r&&J.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=cp(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Bp=!1,Vp=class extends d.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Bp&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Td.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Bp=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||J.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Sc.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Bp=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Hp(e){let[t,n]=uf(),r=(0,d.useContext)(br);return(0,f.jsx)(Vp,{...e,layoutGroup:r,switchLayoutGroup:(0,d.useContext)(Kf),isPresent:t,safeToRemove:n})}var Up={pan:{Feature:zp},drag:{Feature:Lp,ProjectionNode:cf,MeasureLayout:Hp}};function Wp(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&J.postRender(()=>i(t,op(t)))}var Gp=class extends kl{mount(){let{current:e}=this.node;e&&(this.unmount=kc(e,(e,t)=>(Wp(this.node,t,`Start`),e=>Wp(this.node,e,`End`))))}unmount(){}},Kp=class extends kl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Lr(yd(this.node.current,`focus`,()=>this.onFocus()),yd(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function qp(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&J.postRender(()=>i(t,op(t)))}var Jp=class extends kl{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Hc(e,(e,t)=>(qp(this.node,t,`Start`),(e,{success:t})=>qp(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Yp=new WeakMap,Xp=new WeakMap,Zp=e=>{let t=Yp.get(e.target);t&&t(e)},Qp=e=>{e.forEach(Zp)};function $p({root:e,...t}){let n=e||document;Xp.has(n)||Xp.set(n,{});let r=Xp.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Qp,{root:e,...t})),r[i]}function em(e,t,n){let r=$p(t);return Yp.set(e,n),r.observe(e),()=>{Yp.delete(e),r.unobserve(e)}}var tm={some:0,all:1},nm=class extends kl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:tm[r]};this.stopObserver=em(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(rm(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function rm({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var im={inView:{Feature:nm},tap:{Feature:Jp},focus:{Feature:Kp},hover:{Feature:Gp}},am={layout:{ProjectionNode:cf,MeasureLayout:Hp}},om=tp({...ap,...im,...Up,...am},np),sm=24e3,cm=2048,lm=1200,um=.05,dm=4,fm=.03,pm=2,mm=11;function hm(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t/e.length)}function gm(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n++){let r=Math.max(-1,Math.min(1,e[n]));t[n]=r<0?r*32768:r*32767}return t}function _m(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]/32768;return t}var vm=.09,ym=[`audio/webm`,`audio/mp4`];function bm(){return typeof window>`u`||window.MediaRecorder===void 0?null:ym.find(e=>window.MediaRecorder.isTypeSupported(e))||null}function xm(e,t,n,r,i){if(!r.length||!n||!e)return;let a=new Blob(r,{type:i}),o=new FormData;o.append(`audio`,a,`aichat-${n}.webm`),o.append(`voiceSessionId`,n),o.append(`siteId`,t||``),fetch(`${e}/api/voice/upload-chat-recording`,{method:`POST`,body:o}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(e=>console.warn(`[FlowEngage] voice recording upload failed:`,e.message))}function Sm(e,t,n){let r=0,i=0,a=[],o=()=>{a.forEach(e=>{try{e.stop()}catch{}}),a=[],r=0},s=()=>r>e.currentTime;return{enqueue:o=>{let c=_m(o),l=e.createBuffer(1,c.length,sm);l.copyToChannel(c,0);let u=e.createBufferSource();u.buffer=l,u.connect(e.destination),n&&u.connect(n);let d=!s(),f=d?e.currentTime+vm:r;d&&(i=f),u.start(f),r=f+l.duration,a.push(u),u.onended=()=>{a=a.filter(e=>e!==u),!a.length&&!s()&&t?.()}},stop:o,isPlaying:s,playedMs:()=>Math.max(0,(e.currentTime-i)*1e3)}}async function Cm(e,t,n){let r=new URLSearchParams({siteId:t||``});n&&r.set(`chatId`,n);let i=await fetch(`${e}/api/voice/session?${r.toString()}`,{method:`GET`,headers:{"Content-Type":`application/json`}});if(i.status===429){let e=await i.json().catch(()=>({}));throw Error(e.message||`Too many voice sessions started. Please wait a minute before trying again.`)}if(!i.ok)throw Error(`Could not start a voice session.`);let a=await i.json();if(!a?.success||!a.wsUrl)throw Error(a?.error||`Voice session was refused.`);return a}async function wm(e){let{apiBaseUrl:t,siteId:n,chatId:r,clientTools:i={},onConnect:a,onDisconnect:o,onMessage:s,onModeChange:c,onError:l,onUnhandledClientToolCall:u,onAgentTurnEnd:d,onSessionInfo:f,onSessionEnding:p}=e,m=await Cm(t,n,r);f?.({emailOnFile:!!m.emailOnFile});let h={type:`Start`};e.greeting!==void 0&&(h.greeting=e.greeting||null);let g=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),_=new(window.AudioContext||window.webkitAudioContext)({sampleRate:sm});_.state===`suspended`&&await _.resume();let v=_.createMediaStreamDestination(),y=bm(),b=[],x=null,S=r||n||null;y&&(x=new window.MediaRecorder(v.stream,{mimeType:y}),x.ondataavailable=e=>{e.data&&e.data.size>0&&b.push(e.data)},x.start());let C=new WebSocket(m.wsUrl);C.binaryType=`arraybuffer`;let w=new Set,T={role:null,text:``,timer:null,debug:null},E=``,ee=()=>{T.timer&&=(clearTimeout(T.timer),null);let e=T.text.trim(),t=T.role,n=T.debug;if(T.text=``,T.role=null,T.debug=null,!(!e||!t)){if(t===`agent`){if(e===E){console.debug(`[FlowEngage] duplicate agent turn suppressed`);return}E=e}s?.({role:t,message:e,debug:n})}},te=(e,t,n)=>{t&&(T.role&&T.role!==e&&ee(),T.role=e,T.text=T.text?`${T.text} ${t}`.replace(/\s+/g,` `):t,n&&(T.debug=n),T.timer&&clearTimeout(T.timer),T.timer=setTimeout(ee,lm))},D=!1,ne=!1,re=!1,O=!1,ie=!0,k=0,ae=!1,oe=!1,se=um,A=dm,j=null,ce=!1,M=!1,le=()=>{j&&clearTimeout(j);let e=()=>{if(!D){if(N.isPlaying()){j=setTimeout(e,150);return}if(j=null,ce){p?.();return}!D&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`PlaybackDrained`})),M&&(M=!1,d?.())}};j=setTimeout(e,150)},N=Sm(_,()=>{O&&(O=!1,c?.({mode:`listening`}))},v),ue=_.createMediaStreamSource(g);ue.connect(v);let de=_.createScriptProcessor(cm,1,1),fe=!1,pe=0,me=0;de.onaudioprocess=e=>{if(D||C.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),n=()=>C.send(new Int16Array(t.length).buffer);if(ne){re||(re=!0,console.debug(`[FlowEngage] mic held — streaming silence to keep socket alive`)),fe=!1,pe=0,me=0,n();return}let r=hm(t);if(N.isPlaying()||oe?(fe=!1,pe=0,me=0):r>=fm?(me=0,pe+=1,!fe&&pe>=pm&&(fe=!0,c?.({mode:`user-speaking`}))):(pe=0,fe&&++me>=mm&&(fe=!1,me=0,c?.({mode:`thinking`,tentative:!0}))),(N.isPlaying()||oe)&&!ae){if(r<se){k=0,n();return}if(k+=1,k<A){n();return}ae=!0,k=0;let e=N.playedMs();N.stop(),ie=!1,oe=!1,j&&!ce&&(clearTimeout(j),j=null),M=!1,C.send(JSON.stringify({type:`VisitorInterrupted`,played_ms:Math.round(e)})),console.debug(`[FlowEngage] barge-in — visitor spoke over the agent`)}C.send(gm(t).buffer)},ue.connect(de),de.connect(_.destination);let he=()=>{if(!D){D=!0,j&&=(clearTimeout(j),null),ee(),N.stop();try{de.disconnect(),ue.disconnect()}catch{}if(g.getTracks().forEach(e=>e.stop()),x&&x.state!==`inactive`){x.onstop=()=>xm(t,n,S,b,y);try{x.stop()}catch{x.onstop=null}}else b.length&&xm(t,n,S,b,y);_.close().catch(()=>{}),(C.readyState===WebSocket.OPEN||C.readyState===WebSocket.CONNECTING)&&C.close()}},ge=async e=>{let t=i[e.name];if(!t)return u?.({tool_name:e.name}),{error:`Unknown tool ${e.name}`};let n={};try{n=JSON.parse(e.arguments||`{}`)}catch{}try{return await t(n)}catch(e){return{error:e?.message||`Tool execution failed`}}},P=async e=>{for(let t of e.functions||[]){if(!t.client_side)continue;let e=await ge(t);if(D||C.readyState!==WebSocket.OPEN)return;C.send(JSON.stringify({type:`FunctionCallResponse`,id:t.id,name:t.name,content:typeof e==`string`?e:JSON.stringify(e??{})}))}},_e=e=>{switch(e.type){case`Welcome`:Number.isFinite(e.barge_in_rms)&&e.barge_in_rms>0&&(se=e.barge_in_rms),Number.isFinite(e.barge_in_frames)&&e.barge_in_frames>0&&(A=e.barge_in_frames),S=e.session_id||r||n||null,a?.({conversationId:S});break;case`ConversationText`:{let t=String(e.content||``);if(e.role===`user`){let e=t.trim();if(w.has(e)){w.delete(e);break}if(/^\[SYSTEM:/i.test(e)||/^Continue (now )?to the next section/i.test(e)||/^That was the last section/i.test(e)){console.debug(`[FlowEngage] widget instruction hidden from transcript`);break}}te(e.role===`user`?`user`:`agent`,t,e.debug);break}case`UserStartedSpeaking`:ee(),N.stop(),oe=!1,ie=!1,O=!1,j&&!ce&&(clearTimeout(j),j=null),M=!1,c?.({mode:`listening`});break;case`AgentStartedSpeaking`:ie=!0,O=!0,ae=!1,k=0,c?.({mode:`speaking`});break;case`AgentAudioDone`:oe=!1,ee(),le(),N.isPlaying()||(O=!1,c?.({mode:`listening`}));break;case`FunctionCallRequest`:P(e);break;case`AgentPreparing`:oe=!0;break;case`AgentTurnComplete`:M=!0,le();break;case`SessionEnding`:console.debug(`[FlowEngage] server is ending the session:`,e.reason||`unspecified`),ce=!0;break;case`AgentThinking`:c?.({mode:`thinking`});break;case`PromptUpdated`:break;case`Error`:console.error(`[FlowEngage:Voice]`,e.code||``,e.description||e),l?.(Error(e.description||`Voice service error`));break;case`Warning`:console.warn(`[FlowEngage:Voice]`,e.code||``,e.description||``);break;default:break}};return C.onopen=()=>C.send(JSON.stringify(h)),C.onmessage=e=>{if(e.data instanceof ArrayBuffer){ie&&N.enqueue(new Int16Array(e.data));return}try{_e(JSON.parse(e.data))}catch{}},C.onerror=()=>l?.(Error(`Voice connection failed`)),C.onclose=()=>{he(),o?.()},{endSession:async()=>he(),sendContextualUpdate:e=>{D||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`UpdatePrompt`,prompt:e}))},sendUserMessage:(e,{silent:t=!0,suppressQuestion:n=!1}={})=>{D||C.readyState!==WebSocket.OPEN||!e||(t&&w.add(e.trim()),C.send(JSON.stringify({type:`InjectUserMessage`,content:e,suppress_question:n})))},injectAgentSpeech:(e,t=`interrupt`)=>{D||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`InjectAgentMessage`,message:e,behavior:t}))},setWalkthroughActive:e=>{D||C.readyState!==WebSocket.OPEN||C.send(JSON.stringify({type:`WalkthroughActive`,active:!!e}))},setMicMuted:e=>{ne=!!e,!D&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`MicHeld`,held:ne}))},get status(){return D?`disconnected`:`connected`}}}var Tm={startSession:wm},Em=({size:e=18,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`,fill:t}),(0,f.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),Dm=({size:e=20})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M10.68 13.31a16 16 0 003.41 2.6l1.27-1.27a2 2 0 012.11-.45 12.84 12.84 0 002.81.7 2 2 0 011.72 2v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07A19.42 19.42 0 013.07 8.62 19.79 19.79 0 01.1 2 2 2 0 012.11 0h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L6.18 7.84`}),(0,f.jsx)(`line`,{x1:`23`,y1:`1`,x2:`1`,y2:`23`})]}),Om=({size:e=18})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`5`}),(0,f.jsx)(`polyline`,{points:`5 12 12 5 19 12`})]}),km=()=>(0,f.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`polyline`,{points:`9 17 4 12 9 7`}),(0,f.jsx)(`path`,{d:`M20 18v-2a4 4 0 00-4-4H4`})]}),Am=()=>(0,f.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z`})}),jm=({className:e=``})=>(0,f.jsxs)(`svg`,{className:e,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,f.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,f.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),Mm=({size:e=14})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M12 8V4H8`}),(0,f.jsx)(`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}),(0,f.jsx)(`path`,{d:`M2 14h2`}),(0,f.jsx)(`path`,{d:`M20 14h2`}),(0,f.jsx)(`path`,{d:`M15 13v2`}),(0,f.jsx)(`path`,{d:`M9 13v2`})]}),Nm=({size:e=20,strokeWidth:t=2,color:n=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:n,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,f.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),Pm=({size:e=20,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`,fill:t}),(0,f.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`,fill:t}),(0,f.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`,fill:t})]}),Fm=({size:e=20,color:t=`currentColor`})=>(0,f.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,f.jsx)(`path`,{d:`M22 11.5667C22 16.8499 17.5222 21.1334 12 21.1334C11.3507 21.1343 10.7032 21.0742 10.0654 20.9545C9.60633 20.8682 9.37678 20.8251 9.21653 20.8496C9.05627 20.8741 8.82918 20.9948 8.37499 21.2364C7.09014 21.9197 5.59195 22.161 4.15111 21.893C4.69874 21.2194 5.07275 20.4112 5.23778 19.5448C5.33778 19.0148 5.09 18.5 4.71889 18.1231C3.03333 16.4115 2 14.1051 2 11.5667C2 6.28357 6.47778 2 12 2C17.5222 2 22 6.28357 22 11.5667Z`,stroke:`white`,"stroke-width":`1.5`,"stroke-linejoin":`round`}),(0,f.jsx)(`path`,{d:`M11.9955 12H12.0045M15.991 12H16M8 12H8.00897`,stroke:`white`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]}),Im=()=>(0,f.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,f.jsx)(`path`,{d:`M16.7133 8.59374C18.1939 8.98463 19.2229 9.47922 20.1589 10.0848C21.5432 10.9804 22.1367 12.5944 21.9737 14.1517C21.9049 14.8099 21.3744 15.1246 20.7592 14.9544L19.3705 14.57C18.2697 14.2653 17.7193 14.1129 17.3837 13.71C17.0481 13.307 17.0086 12.751 16.9296 11.6391L16.7133 8.59374ZM16.7133 8.59374C13.7164 7.80255 10.2871 7.80163 7.28669 8.59374M7.28669 8.59374C5.80606 8.98463 4.77711 9.47923 3.84113 10.0848C2.45683 10.9804 1.86334 12.5944 2.02628 14.1517C2.09514 14.8099 2.62563 15.1246 3.24078 14.9544L4.62954 14.57C5.73032 14.2653 6.28071 14.1129 6.61631 13.71C6.95191 13.307 6.9914 12.751 7.07038 11.6391L7.28669 8.59374Z`,stroke:`#E30C12`,"stroke-width":`1.5`,"stroke-linejoin":`round`})}),Lm=({size:e=24})=>(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M12 19v3`}),(0,f.jsx)(`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`}),(0,f.jsx)(`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`}),(0,f.jsx)(`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`}),(0,f.jsx)(`path`,{d:`m2 2 20 20`}),(0,f.jsx)(`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`})]}),Rm=(e=``)=>String(e).replace(/<[^>]+>/g,``).replace(/\s+/g,` `).trim(),zm=(e=``)=>String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),Bm=new Set([`p`,`br`,`ul`,`ol`,`li`,`strong`,`em`,`b`,`i`,`a`]),Vm=/^https?:\/\//i;function Hm(e){let t=Array.from(e.childNodes);for(let n of t)if(n.nodeType===Node.ELEMENT_NODE){let t=n.tagName.toLowerCase();if(!Bm.has(t)){e.replaceChild(document.createTextNode(n.textContent),n);continue}let r={};if(t===`a`){let e=n.getAttribute(`href`)||``;Vm.test(e)&&(r.href=e),r.target=`_blank`,r.rel=`noopener noreferrer`}for(;n.attributes.length>0;)n.removeAttribute(n.attributes[0].name);for(let[e,t]of Object.entries(r))n.setAttribute(e,t);Hm(n)}else n.nodeType!==Node.TEXT_NODE&&e.removeChild(n)}function Um(e){let t=document.createElement(`div`);return t.innerHTML=e,Hm(t),t.innerHTML}function Wm(e){let t=String(e||``).trim();if(!t)return t;let n=/^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);if(n&&!/<\/?strong\b/i.test(n[1]))return`<p>${n[1]}</p>`;let r=/^<strong>([\s\S]*?)<\/strong>$/i.exec(t);if(r&&!/<\/?strong\b/i.test(r[1])){let e=r[1].trim();return/^<(?:p|ul|ol)\b/i.test(e)?e:`<p>${e}</p>`}return e}var Gm=(e=``)=>{let t=String(e||``).trim();if(!t)return``;if(/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t))return Wm(Um(t));let n=t.replace(/\r\n/g,`
26
26
  `).replace(/\n{3,}/g,`
27
27
 
28
28
  `).split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean),r=e=>zm(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\*([^*\n]+)\*/g,`<em>$1</em>`);return Wm(n.map(e=>{let t=e.split(`