@flowengage/react-chatbot 1.8.11 → 1.8.13
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.
package/dist/flowengage-embed.js
CHANGED
|
@@ -30,7 +30,7 @@ Error generating stack: `+e.message+`
|
|
|
30
30
|
box-shadow: none !important;
|
|
31
31
|
transition: outline-color 0.25s ease, box-shadow 0.25s ease !important;
|
|
32
32
|
}
|
|
33
|
-
`,document.head.appendChild(e)};function Rn(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(mn(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(e.textContent.replace(/\s+/g,` `).toLowerCase().trim()===n)return e;for(let e of i){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.startsWith(n)||t.endsWith(n))return e}let a=[];for(let e of i){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();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=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();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=n.textContent.replace(/\s+/g,` `).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=>!mn(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(mn(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(mn(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(mn(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=>!mn(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(mn(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<800)return e}return null}function zn(e,{speaking:t=!1,scroll:n=!0}={}){if(!e||typeof document>`u`)return;Ln();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 Bn(){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`))}async function Vn(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 Hn(e,{siteId:t,apiBaseUrl:n}){if(!e)return!1;if(!t||!n)return console.warn(`[FlowEngage] shouldProceedWithNavigation: missing siteId or apiBaseUrl`),Vn(e);let r=String(n).replace(/\/$/,``),i=new URLSearchParams({siteId:String(t),url:String(e).trim()});try{let t=await(await fetch(`${r}/api/widget/navigate-allowed?${i.toString()}`)).json().catch(()=>({}));return t.success&&t.allowed?!0:Vn(e)}catch(t){return console.warn(`[FlowEngage] navigate-allowed check failed:`,t?.message),Vn(e)}}async function Un(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}Pn();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 Fn(),!1;let o=await a.text(),s=new DOMParser().parseFromString(o,`text/html`),c=document.getElementById(`flowengage-root`);if(!c)return Fn(),!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()}),Tn();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(wn,`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(wn,`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,hn(`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){hn(`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,hn(`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){hn(`trySpaNavigate: blocked location.assign from replayed script:`,e);return}return d(e)},window.location.replace=e=>{if(p){hn(`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;hn(`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)){hn(`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{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:`)&&(hn(`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`)||``}),hn(`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),hn(`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(xn(),Cn(),n){try{On()}catch{}try{jn()}catch{}}else window.scrollTo(0,0);Fn(),Mn(e);try{sessionStorage.removeItem(gn)}catch{}try{sessionStorage.removeItem(vn)}catch{}try{bn=new URL(e,window.location.origin).pathname}catch{}return hn(`trySpaNavigate: succeeded →`,e),!0}catch{return clearTimeout(i),Fn(),!1}}var Wn=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),M=s(((e,t)=>{t.exports=Wn()}))(),Gn=e=>!e||typeof e!=`string`?e:e.replace(/<human_assistance_request>[\s\S]*?<\/human_assistance_request>/gi,``).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(),Kn=(e=[])=>e.map(e=>({...e,message:Gn(e.message),isPending:!1,id:e.messageId||`${e.sender}-${e.timestamp||Date.now()}-${Math.random()}`})),qn=(e,t)=>e?typeof e==`string`?e:e.message||e.error||e.reason||t:t,Jn=(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}:{}}},Yn=e=>{if(!e)return null;let t=typeof e==`object`?e:{candidate:e};return{hasCandidate:!!t.candidate,sdpMid:t.sdpMid??null,sdpMLineIndex:t.sdpMLineIndex??null,candidatePreview:typeof t.candidate==`string`?t.candidate.slice(0,80):null}},Xn=(e=[],t=`Agent`)=>{for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return t},Zn=(e=[],t,n=6)=>!t?.message||e.slice(-n).some(e=>e.sender===`system`&&e.message===t.message)?e:[...e,t];function Qn({siteId:e,config:t,children:n,language:r=`en`}){let i=(0,b.useMemo)(()=>e?{...t||{},siteId:e}:t||null,[e,t]),[a,o]=(0,b.useState)(`booting`),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)([]),[h,g]=(0,b.useState)(me().isOpen),[_,v]=(0,b.useState)(me().activeScreen),[y,x]=(0,b.useState)(me().isHumanHandled),[S,C]=(0,b.useState)(me().agentName),[te,w]=(0,b.useState)(me().agentHeadshot),[ae,oe]=(0,b.useState)(()=>ge(i?.siteId)),[ue,T]=(0,b.useState)(!1),[E,de]=(0,b.useState)(!1),[ve,ye]=(0,b.useState)(`idle`),[Ce,we]=(0,b.useState)(!1),[Te,Ee]=(0,b.useState)(!1),[De,Oe]=(0,b.useState)(``),[ke,Ae]=(0,b.useState)(!1),[je,Me]=(0,b.useState)(!1),[D,Ne]=(0,b.useState)(null),[Pe,Fe]=(0,b.useState)(null),[Ie,Le]=(0,b.useState)(`idle`),[Re,ze]=(0,b.useState)(null),[Be,Ve]=(0,b.useState)(!1),[He,Ue]=(0,b.useState)(``),We=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(``),Ge=(0,b.useRef)(null),A=(0,b.useRef)(null),Ke=(0,b.useRef)(null),qe=(0,b.useRef)(null),Je=(0,b.useRef)(null),Ye=(0,b.useRef)([]),Xe=(0,b.useRef)(null),Ze=(0,b.useRef)(null),Qe=(0,b.useRef)(!1),$e=(0,b.useRef)(!1),et=(0,b.useRef)(``),tt=(0,b.useRef)(S),nt=(0,b.useRef)([]),rt=(0,b.useRef)(!1),it=(0,b.useRef)({notifyRouteChange:()=>{},cleanup:()=>{}}),at=(0,b.useCallback)((e={})=>{let t=!!e.is_human_handled;return x(t),t?(v(`agent`),e.agent_info?.name&&C(e.agent_info.name),e.agent_info?.headshot&&w(e.agent_info.headshot),t):(v(`ai`),t)},[]),ot=(0,b.useMemo)(()=>{let e=l?.widgetSettings?.call?.maxDurationSeconds??i?.widgetSettings?.call?.maxDurationSeconds??i?.callMaxDurationSeconds,t=Number(e);return Number.isFinite(t)&&t>0?t:re},[i,l]);(0,b.useEffect)(()=>{Ge.current=D},[D]),(0,b.useEffect)(()=>{tt.current=S},[S]);let st=()=>{Ue(``)},ct=e=>{let t=typeof e==`string`?e.trim().toLowerCase():``;return oe(t),_e(t,i?.siteId),t};(0,b.useEffect)(()=>{let e=i?.siteId;e&&oe(ge(e))},[i?.siteId]);let lt=(e=`unspecified`)=>{console.log(`[FlowEngageCall] cleanup:start`,{reason:e,chatId:k.current,activeCallId:Xe.current,acceptingCallId:Ze.current,hasPeerConnection:!!A.current,hasLocalStream:!!Ke.current,hasRemoteAudio:!!qe.current,queuedIceCount:Ye.current.length}),A.current&&=(A.current.close(),null),Ke.current&&=(Ke.current.getTracks().forEach(e=>e.stop()),null),qe.current&&=(qe.current.srcObject=null,qe.current.remove(),null),Je.current=null,Ye.current=[],Xe.current=null,Ze.current=null,Qe.current=!1,Ve(!1),Ne(null),Fe(null),Le(`idle`),ze(null),console.log(`[FlowEngageCall] cleanup:complete`,{reason:e,chatId:k.current})},ut=(e=new Date().toISOString())=>{let t=We.current,n=Xe.current||Je.current?.callId;if(!t?.connected||!n||Qe.current){console.log(`[FlowEngageProvider] skipping call:connected emit`,{callId:n,chatId:k.current,socketConnected:!!t?.connected,alreadyReported:Qe.current});return}console.log(`[FlowEngageProvider] emitting call:connected`,{callId:n,chatId:k.current,connectedAt:e}),Qe.current=!0,t.emit(`call:connected`,{callId:n,chatId:k.current,connectedAt:e})},dt=(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Ge.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(console.log(`[FlowEngageProvider] syncing accepted call state`,{callId:e.callId,chatId:e.chatId||k.current,isAcceptingHere:t,isAlreadyActive:n,isIncomingHere:r}),Ne(null),t||n){Xe.current=e.callId,Fe(e.callId),Le(e=>e===`connected`?e:`connecting`),g(!0);return}Le(`idle`)}},ft=(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Ge.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(console.log(`[FlowEngageProvider] syncing ended incoming call state`,{callId:e.callId,chatId:e.chatId||k.current,isAcceptingHere:t,isAlreadyActive:n,isIncomingHere:r,reason:e.reason||e.status||null}),n){lt();return}Ze.current=null,Je.current=null,Ye.current=[],Ne(null),Le(`idle`)}},pt=async(e={})=>{let t=A.current,n=We.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:k.current,hasPeerConnection:!!t,socketConnected:!!n?.connected,hasOffer:!!r}),Je.current=e;return}if(console.log(`[FlowEngageProvider] applying remote offer`,{callId:e.callId,chatId:k.current,offerLength:r.length,signalingState:t.signalingState,iceConnectionState:t.iceConnectionState,connectionState:t.connectionState}),await t.setRemoteDescription(new RTCSessionDescription({type:`offer`,sdp:r})),Ye.current.length>0){console.log(`[FlowEngageProvider] flushing queued agent ICE candidates after remote offer`,{callId:e.callId,chatId:k.current,queuedCount:Ye.current.length});for(let e of Ye.current)await t.addIceCandidate(new RTCIceCandidate(e));Ye.current=[]}let i=await t.createAnswer();await t.setLocalDescription(i),console.log(`[FlowEngageCall] local-answer:created`,{callId:e.callId,chatId:k.current,answerLength:i.sdp?.length||0,signalingState:t.signalingState,iceConnectionState:t.iceConnectionState,connectionState:t.connectionState}),console.log(`[FlowEngageCall] local-answer:emitting`,{callId:e.callId,chatId:k.current}),n.emit(`call:answer`,{callId:e.callId,sdpAnswer:i.sdp,chatId:k.current})};(0,b.useEffect)(()=>{he({isOpen:h,activeScreen:_,isHumanHandled:y,agentName:S,agentHeadshot:te})},[h,_,y,S,te]),(0,b.useEffect)(()=>{let e=!0;return(async()=>{try{console.log(`[FlowEngageProvider] boot start`,{resolvedConfig:i,language:r});let t=ee(i);console.log(`[FlowEngageProvider] config validated`,t);let n=await xe(t);if(!e)return;let a=t.siteId,s=fe(a),c=``;try{if(c=(await be({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:a,priorChatId:s||se()}))?.data?.chatId,!c)throw Error(`resolve-session returned no chatId`);ce(),pe(a,c)}catch(e){console.warn(`[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id`,e?.message||e),c=s||le(),pe(a,c)}k.current=c;let l=Se({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:t.siteId});O.current=l,u({...n,apiBaseUrl:t.apiBaseUrl}),f(c);let d=n?.widgetSettings?.branding?.fallbackAgentName||`Agent`;console.log(`[FlowEngageProvider] bootstrap resolved`,{bootstrapData:n,resolvedChatId:c});let p=ln({apiBaseUrl:t.apiBaseUrl,userId:n.userId,chatId:c,siteId:t.siteId});We.current=p,p.on(`connect`,()=>{console.log(`[FlowEngageProvider] socket connected`),ye(`connected`)}),p.on(`disconnect`,()=>{console.log(`[FlowEngageProvider] socket disconnected`),ye(`disconnected`)}),p.on(`aiTyping`,()=>{console.log(`[FlowEngageProvider] received aiTyping`,{chatId:k.current}),de(!0)}),p.on(`ai:typing`,()=>{console.log(`[FlowEngageProvider] received ai:typing`,{chatId:k.current}),de(!0)}),p.on(`messageReceived`,e=>{let t=e.message||e,n={...t,message:Gn(t.message)};de(!1),T(!1),m(e=>[...e.filter(e=>!e.isPending),{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}])}),p.on(`conversationStarted`,e=>{console.log(`[FlowEngageProvider] conversationStarted`,e),e?.message&&m(t=>[...t,{id:`system-start-${Date.now()}`,sender:`system`,message:e.message,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`message:new`,e=>{let t=e.message||e,n={...t,message:Gn(t.message)};de(!1),(n.sender===`agent`||n.agent_name||n.sender===`ai`||n.sender===`bot`)&&T(!1),m(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)&&(x(!0),v(`agent`),C(Xn([n.agent_name,n.agentName,n.metadata?.agentName],d)),n.sender_headshot&&w(n.sender_headshot),g(!0))});let h=(e={})=>{let t=Xn([e.agent?.name,e.agentName,e.agent_name,tt.current],d);x(!0),v(`agent`),C(t),w(e.agent?.headshot||null),g(!0),m(e=>Zn(e,{id:`agent-joined-${Date.now()}`,sender:`system`,message:`${t} has joined the chat.`,timestamp:new Date().toISOString(),isPending:!1}))},y=(e={})=>{let t=Xn([e.agent?.name,e.agentName,e.agent_name,tt.current],d);x(!1),v(`ai`),m(e=>Zn(e,{id:`agent-left-${Date.now()}`,sender:`system`,message:`${t} has left the chat.`,timestamp:new Date().toISOString(),isPending:!1}))};p.on(`agent:joined`,h),p.on(`agentJoined`,h),p.on(`agent:left`,y),p.on(`agentLeft`,y),p.on(`conversationEnded`,e=>{Me(!0);let t=e?.message||`This conversation has ended. Thank you for reaching out!`;m(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:t,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`chat:history_update`,e=>{m(Kn(e.chat_history||[]))}),p.on(`typing:start`,e=>{console.log(`[FlowEngageProvider] received typing:start`,{chatId:e?.chatId||k.current,sender:e?.sender}),e.sender===`agent`&&T(!0)}),p.on(`typing:stop`,e=>{console.log(`[FlowEngageProvider] received typing:stop`,{chatId:e?.chatId||k.current,sender:e?.sender}),e.sender===`agent`&&T(!1)}),p.on(`call:incoming`,(e={})=>{let t=Xn([e.agentName,e.ownerName,e.agent?.name,tt.current],`Agent`);console.log(`[FlowEngageProvider] received call:incoming`,{callId:e.callId,chatId:k.current,agentName:t}),st(),Qe.current=!1,Ne({callId:e.callId,from:e.from||`owner`,agentId:e.agentId||null,agentName:t}),C(e=>Xn([t,e],`Agent`)),Le(`incoming`),ze(null),g(!0)}),p.on(`call:offer`,async(e={})=>{console.log(`[FlowEngageProvider] received call:offer`,{callId:e.callId,chatId:e.chatId||k.current,offerLength:(e.sdpOffer||e.offer?.sdp||``).length}),Je.current=e;try{await pt(e)}catch(e){console.error(`[FlowEngageProvider] failed to apply remote offer`,e)}}),p.on(`call:ice-candidate-from-agent`,async(e={})=>{if(!e.candidate){console.log(`[FlowEngageProvider] skipping agent ICE candidate`,{callId:e.callId,chatId:e.chatId||k.current,hasPeerConnection:!!A.current,hasCandidate:!!e.candidate});return}try{let t=Jn(e);if(!t){console.warn(`[FlowEngageProvider] ignoring invalid ICE candidate payload`,e);return}if(console.log(`[FlowEngageProvider] adding agent ICE candidate`,{callId:e.callId,chatId:e.chatId||k.current,candidate:Yn(t),hasRemoteDescription:!!A.current?.remoteDescription}),!A.current||!A.current.remoteDescription){console.log(`[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready`,{callId:e.callId,chatId:e.chatId||k.current,queueSize:Ye.current.length+1}),Ye.current.push(t);return}await A.current.addIceCandidate(new RTCIceCandidate(t))}catch(e){console.error(`[FlowEngageProvider] failed to add ICE candidate`,e)}}),p.on(`call:ended`,()=>{st(),console.log(`[FlowEngageCall] socket:event call:ended`,{chatId:k.current,activeCallId:Xe.current}),lt(`socket:call_ended`)}),p.on(`call:accepted`,(e={})=>{console.log(`[FlowEngageProvider] received call:accepted`,{callId:e.callId,chatId:e.chatId||k.current}),dt(e)}),p.on(`call:accepted_by_other`,(e={})=>{console.log(`[FlowEngageProvider] received call:accepted_by_other`,{callId:e.callId,chatId:e.chatId||k.current}),dt(e)}),p.on(`call:rejected`,(e={})=>{console.log(`[FlowEngageProvider] received call:rejected`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:missed`,(e={})=>{console.log(`[FlowEngageProvider] received call:missed`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:failed`,(e={})=>{console.log(`[FlowEngageProvider] received call:failed`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:connected`,(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Je.current?.callId===e.callId,i=Ge.current?.callId===e.callId;if(console.log(`[FlowEngageProvider] received call:connected`,{callId:e.callId,chatId:e.chatId||k.current,connectedAt:e.connectedAt,status:e.status,isAcceptingHere:t,isAlreadyActive:n,isPendingOfferHere:r,isIncomingHere:i}),!t&&!n&&!r){i&&(Ne(null),Le(`idle`));return}Qe.current=!0,Ze.current=null,Xe.current=e.callId,Fe(e.callId),Ne(null),Le(`connected`),ze(e.connectedAt||new Date().toISOString()),g(!0)}),p.on(`call:unavailable`,(e={})=>{console.warn(`[FlowEngageCall] socket:event call:unavailable`,{chatId:e.chatId||k.current,callId:e.callId,reason:e.reason||e.message||null,raw:e}),lt(`socket:call_unavailable`),Ue(qn(e,`This visitor is not available for a call right now.`)),g(!0)}),p.on(`call:error`,(e={})=>{console.error(`[FlowEngageCall] socket:event call:error`,{chatId:e.chatId||k.current,callId:e.callId,reason:e.reason||e.message||null,raw:e}),lt(`socket:call_error`),Ue(qn(e,`We couldn't connect the call right now.`)),g(!0)}),p.on(`visitor:navigate`,async({url:e,section:t,highlight:n}={})=>{console.log(`[FlowEngageProvider] visitor:navigate DISABLED — ignoring navigation to`,e,{section:t,highlight:n})}),p.on(`visitor:highlight`,({sectionId:e,sectionText:t}={})=>{if(!e&&!t)return;console.log(`[FlowEngageProvider] visitor:highlight`,{sectionId:e,sectionText:t});let n=Rn(e||null,t||null);n&&zn(n)}),p.on(`visitor:clear_highlight`,()=>{Bn()}),it.current=un({socket:p,chatId:c}),console.log(`[FlowEngageProvider] tracking started`,{chatId:c});let b=await l.loadHistory(c,r);if(console.log(`[FlowEngageProvider] history loaded`,b),!e)return;m(Kn(b.chat_history||[])),x(!!b.is_human_handled),v(b.is_human_handled?`agent`:_);let S=b?.visitor_email||b?.visitorEmail;if(S&&String(S).trim()&&ct(String(S).trim()),await new Promise(e=>setTimeout(e,500)),!e)return;o(`ready`),console.log(`[FlowEngageProvider] status ready`)}catch(t){if(!e)return;console.error(`[FlowEngageProvider] boot failed`,t),c(t),o(`error`)}})(),()=>{e=!1,it.current?.cleanup?.(),lt(),We.current?.disconnect()}},[i,r]),(0,b.useEffect)(()=>()=>{if(ke&&!rt.current&&nt.current.length>0){let e=k.current,t=nt.current,n=O.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(()=>{}),rt.current=!0)}},[ke,l]),(0,b.useEffect)(()=>{if(!O.current||!d||a!==`ready`)return;let e=window.setInterval(async()=>{try{let e=await O.current.checkHumanHandled(d);x(!!e.is_human_handled),e.is_human_handled&&(v(`agent`),e.agent_info?.name&&C(Xn([e.agent_info.name],`Agent`)),e.agent_info?.headshot&&w(e.agent_info.headshot)),at(e)}catch{}},1e4);return()=>window.clearInterval(e)},[d,a,at]);let mt=async()=>{if(!(!D?.callId||!O.current||!We.current||!d)){st(),Ze.current=D.callId,console.log(`[FlowEngageProvider] acceptCall started`,{callId:D?.callId,chatId:d,socketConnected:!!We.current?.connected,hasPendingOffer:!!Je.current});try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});console.log(`[FlowEngageProvider] microphone stream acquired`,{callId:D.callId,chatId:d,trackCount:e.getTracks().length}),Ke.current=e;let t=[{urls:`stun:stun.l.google.com:19302`}];try{let e=await O.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});A.current=n,console.log(`[FlowEngageCall] peer-connection:created`,{callId:D.callId,chatId:d,iceServers:1}),n.onconnectionstatechange=()=>{let e=n.connectionState;if(console.log(`[FlowEngageProvider] peer connection state changed`,{callId:D.callId,chatId:d,connectionState:e,iceConnectionState:n.iceConnectionState,signalingState:n.signalingState}),e===`connected`){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),ut(e);return}if(e===`connecting`){Le(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`disconnected`||e===`closed`)&&console.warn(`[FlowEngageCall] peer-connection:terminal-state`,{callId:D.callId,chatId:d,connectionState:e,iceConnectionState:n.iceConnectionState,signalingState:n.signalingState})},n.oniceconnectionstatechange=()=>{let e=n.iceConnectionState;if(console.log(`[FlowEngageProvider] ICE connection state changed`,{callId:D.callId,chatId:d,iceConnectionState:e,connectionState:n.connectionState,signalingState:n.signalingState}),e===`connected`||e===`completed`){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),ut(e);return}if(e===`checking`||e===`new`){Le(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`disconnected`||e===`closed`)&&console.warn(`[FlowEngageCall] ice-connection:terminal-state`,{callId:D.callId,chatId:d,iceConnectionState:e,connectionState:n.connectionState,signalingState:n.signalingState})},n.onsignalingstatechange=()=>{console.log(`[FlowEngageCall] signaling-state:changed`,{callId:D.callId,chatId:d,signalingState:n.signalingState,connectionState:n.connectionState,iceConnectionState:n.iceConnectionState})},n.onicegatheringstatechange=()=>{console.log(`[FlowEngageCall] ice-gathering-state:changed`,{callId:D.callId,chatId:d,iceGatheringState:n.iceGatheringState})},e.getTracks().forEach(t=>{console.log(`[FlowEngageCall] local-track:added`,{callId:D.callId,chatId:d,kind:t.kind,enabled:t.enabled,readyState:t.readyState,muted:t.muted,label:t.label}),n.addTrack(t,e)}),n.onicecandidate=e=>{if(!e.candidate||!We.current?.connected){console.log(`[FlowEngageProvider] local ICE candidate skipped`,{callId:D.callId,chatId:d,hasCandidate:!!e.candidate,socketConnected:!!We.current?.connected});return}let t=e.candidate;console.log(`[FlowEngageProvider] emitting local ICE candidate`,{callId:D.callId,chatId:d,candidate:Yn(t)}),We.current.emit(`call:ice-candidate`,{callId:D.callId,candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,chatId:d,from:`customer`})},n.ontrack=e=>{console.log(`[FlowEngageProvider] remote audio track received`,{callId:D.callId,chatId:d,streamCount:e.streams?.length||0});let[t]=e.streams||[],[n]=t?.getAudioTracks?.()||[];if(console.log(`[FlowEngageCall] remote-track:details`,{callId:D.callId,chatId:d,trackKind:e.track?.kind||null,trackEnabled:e.track?.enabled??null,trackMuted:e.track?.muted??null,trackReadyState:e.track?.readyState??null,streamId:t?.id||null,audioTrackCount:t?.getAudioTracks?.().length||0,firstAudioTrackState:n?{enabled:n.enabled,muted:n.muted,readyState:n.readyState,label:n.label}:null}),!qe.current){let e=document.createElement(`audio`);e.id=`flowengage-remote-audio`,e.autoplay=!0,e.playsInline=!0,e.onplay=()=>{console.log(`[FlowEngageCall] remote-audio:onplay`,{callId:D.callId,chatId:d})},e.onpause=()=>{console.warn(`[FlowEngageCall] remote-audio:onpause`,{callId:D.callId,chatId:d,currentTime:e.currentTime})},e.onended=()=>{console.warn(`[FlowEngageCall] remote-audio:onended`,{callId:D.callId,chatId:d,currentTime:e.currentTime})},e.onerror=t=>{console.error(`[FlowEngageCall] remote-audio:onerror`,{callId:D.callId,chatId:d,error:e.error?{code:e.error.code,message:e.error.message}:null,raw:t})},qe.current=e,document.body.appendChild(e)}qe.current.srcObject=e.streams[0];let r=D?.callId,i=r&&(Ze.current===r||Xe.current===r);if(!Qe.current&&i){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),Xe.current=r,Fe(r),ut(e)}qe.current.srcObject=t||null;let a=qe.current.play?.();a?.catch&&a.catch(e=>{console.error(`[FlowEngageCall] remote-audio:play-failed`,{callId:D.callId,chatId:d,message:e?.message,name:e?.name,raw:e})})};let r=Je.current;r&&(console.log(`[FlowEngageProvider] found pending remote offer during accept`,{callId:r.callId||D.callId,chatId:d}),await pt({...r,callId:r.callId||D.callId})),await O.current.acceptCall(D.callId,d),console.log(`[FlowEngageProvider] acceptCall API succeeded`,{callId:D.callId,chatId:d}),Xe.current=D.callId,Fe(D.callId),Le(e=>e===`connected`||Qe.current?`connected`:`connecting`),Ne(null),g(!0)}catch(e){if(console.error(`[FlowEngageProvider] acceptCall failed`,e),Ze.current=null,lt(`accept_call_failed`),e?.status===404||e?.status===409||e?.status===422){Ue(qn(e,`This visitor call is no longer available.`));return}if(e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`){try{await O.current.rejectCall(D.callId,d)}catch(e){console.error(`[FlowEngageProvider] failed to reject call after microphone denial`,e)}Ue(`Microphone access was denied. Please allow microphone access to accept the call.`);return}Ue(`We couldn't connect the call right now. Please try again.`)}}},ht=async()=>{if(!D?.callId||!O.current||!d){lt(`reject_call_without_server_context`);return}st();try{await O.current.rejectCall(D.callId,d)}catch(e){console.error(`[FlowEngageProvider] rejectCall failed`,e),Ue(qn(e,`We couldn't decline the call cleanly.`))}finally{lt(`reject_call_finally`)}},gt=(0,b.useRef)(ht);gt.current=ht,(0,b.useEffect)(()=>{if(!D?.callId||Pe)return;let e=D.callId,t=window.setTimeout(()=>{Ge.current?.callId===e&>.current()},ie);return()=>window.clearTimeout(t)},[D?.callId,Pe]);let _t=async()=>{if(!Pe||!O.current||!d){lt(`end_call_without_server_context`);return}st();try{await O.current.endWebRTCCall(Pe,d)}catch(e){console.error(`[FlowEngageProvider] endWebRTCCall failed`,e),Ue(qn(e,`The call ended locally, but the server could not be updated.`))}finally{lt(`end_call_finally`)}},vt=()=>{let e=Ke.current?.getAudioTracks?.()||[],t=A.current?.getSenders?.().map(e=>e.track).filter(e=>e?.kind===`audio`)||[],n=[...e,...t].filter(Boolean);if(n.length===0){console.warn(`[FlowEngageProvider] no local audio tracks available for mute`);return}let r=!Be;n.forEach(e=>{e.enabled=!r}),console.log(`[FlowEngageProvider] toggled local mute`,{nextMuted:r,trackCount:n.length}),Ve(r)},yt=async(e={})=>{let t=e.notifyChatInitiated===!0;if(g(!0),!(!t||!O.current||!d||typeof window>`u`)){try{await O.current.trackVisitor({chatId:d,currentPagePath:window.location.pathname||`/`})}catch{}try{await O.current.updateChatStatus(d,`open`)}catch{}}},bt=async e=>{let t=ct(e);if(!t||!O.current||!k.current)return t;try{await O.current.trackVisitor({chatId:k.current,currentPagePath:typeof window<`u`&&window.location.pathname||`/`,email:t})}catch(e){console.error(`[FlowEngageProvider] failed to persist visitor email`,e)}return t},xt=()=>{if(!d||!We.current?.connected||$e.current){console.log(`[FlowEngageProvider] skipped typing:start emit`,{chatId:d,socketConnected:!!We.current?.connected,alreadyTyping:$e.current});return}$e.current=!0,console.log(`[FlowEngageProvider] emitting typing:start`,{chatId:d,sender:`user`}),We.current.emit(`typing:start`,{chatId:d,sender:`user`})},St=()=>{if(!d||!We.current?.connected||!$e.current){console.log(`[FlowEngageProvider] skipped typing:stop emit`,{chatId:d,socketConnected:!!We.current?.connected,wasTyping:$e.current});return}$e.current=!1,console.log(`[FlowEngageProvider] emitting typing:stop`,{chatId:d,sender:`user`}),We.current.emit(`typing:stop`,{chatId:d,sender:`user`})},Ct=(e=``)=>{let t=typeof e==`string`?e:``;if(!d||!We.current?.connected){console.log(`[FlowEngageProvider] skipped typing:update emit`,{chatId:d,socketConnected:!!We.current?.connected,textLength:t.length});return}et.current!==t&&(et.current=t,console.log(`[FlowEngageProvider] emitting typing:update`,{chatId:d,sender:`user`,textLength:t.length}),We.current.emit(`typing:update`,{chatId:d,sender:`user`,text:t}))},wt=async(e,t=``,n=null,i={})=>{if(!(typeof e==`string`&&e.trim())||!O.current||!d||a!==`ready`||je)return;St();let o=`pending-user-${Date.now()}`,s={id:o,sender:`user`,message:e,timestamp:new Date().toISOString(),isPending:!0,type:i?.type||`text`,metadata:i?.metadata||void 0,...n||{}};m(e=>[...e,s]);let l=y;if(l)try{l=at(await O.current.checkHumanHandled(d))}catch{}if(l&&We.current?.connected){We.current.emit(`customer:message`,{chatId:d,content:e,sender:`user`,email:ae||void 0,type:i?.type||`text`,metadata:i?.metadata||{},...n||{}});return}we(!0);try{let a=await O.current.sendAiMessage(d,e,r,t,{...n||{},...ae?{email:ae}:{}},i),o=a.chat_history||[];[...o].reverse().find(e=>e.sender===`bot`||e.sender===`assistant`),m(Kn(o)),x(!!a.is_human_handled),v(a.is_human_handled?`agent`:`ai`),de(!1),await O.current.updateChatStatus(d,`messageSent`)}catch(e){m(e=>e.filter(e=>e.id!==o)),de(!1),e.status===429?(Ee(!0),Oe(e.message),window.setTimeout(()=>{Ee(!1),Oe(``)},ne)):c(e)}finally{we(!1)}},Tt=async e=>{if(!O.current||!e)throw Error(`Upload is unavailable right now.`);return O.current.uploadChatFile(e)},Et=async e=>{if(!(!O.current||!d)){try{let t=e?`voice`:`text`;await O.current.setChatMode(d,t)}catch(e){console.error(`[FlowEngageProvider] setVoiceMode failed`,e)}Ae(e),e&&(rt.current=!1)}},Dt=async e=>{if(rt.current)return;if(rt.current=!0,!O.current||!d||!e?.length){Ae(!1);return}let t=()=>{let t=Kn(e);m(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 O.current.syncVoice(d,e);if(n?.chat_history?.length)m(Kn(n.chat_history));else if(n?.success)try{let e=await O.current.loadHistory(d,r);e?.chat_history?.length?m(Kn(e.chat_history)):t()}catch{t()}else t()}catch{t()}finally{Ae(!1)}},Ot=async()=>{if(!(!O.current||!d)){ke&&!rt.current&&nt.current.length>0&&await Dt(nt.current);try{await O.current.endConversation(d)}catch{try{await O.current.updateChatStatus(d,`ended`)}catch{}}Me(!0),m(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,b.useEffect)(()=>{if(Ie!==`connected`||!Pe||!d||!Re||!ot)return;let e=new Date(Re).getTime(),t=Number.isFinite(e)?Date.now()-e:0,n=Math.max(0,ot*1e3-t),r=window.setTimeout(()=>{Ue(`The call ended because it reached the time limit.`),_t()},n);return()=>window.clearTimeout(r)},[Pe,Re,Ie,d,_t,ot]),(0,b.useEffect)(()=>{let e=()=>{let e=k.current,t=O.current;if(!t||!e)return;if(!rt.current&&nt.current.length>0&&(t.beaconSyncVoice(e,nt.current)||t.syncVoice(e,nt.current).catch(()=>{}),rt.current=!0),Xe.current){t.beaconEndWebRTCCall(Xe.current,e);return}let n=Ze.current||Ge.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 kt=(0,b.useMemo)(()=>({status:a,error:s,runtimeConfig:l,resolvedConfig:i,chatId:d,chatHistory:p,isOpen:h,activeScreen:_,isHumanHandled:y,agentName:S,agentHeadshot:te,visitorEmail:ae,isAgentTyping:ue,isAiTyping:E,connectionStatus:ve,isLoading:Ce,isVoiceMode:ke,isRateLimited:Te,rateLimitMessage:De,isConversationEnded:je,incomingCall:D,activeCallId:Pe,callConnectionState:Ie,callConnectedAt:Re,isCallMuted:Be,webRTCError:He,language:r,historyRef:nt,hasSyncedRef:rt,dismissCallError:st,captureVisitorEmail:bt,startTyping:xt,stopTyping:St,updateTypingDraft:Ct,notifyRouteChange:()=>it.current?.notifyRouteChange?.(),openWidget:yt,closeWidget:()=>g(!1),toggleWidget:()=>{if(h){g(!1);return}yt({notifyChatInitiated:!0})},sendMessage:wt,uploadChatFile:Tt,setVoiceMode:Et,onMessageSync:Dt,endConversation:Ot,acceptCall:mt,rejectCall:ht,endWebRTCCall:_t,toggleCallMute:vt}),[a,s,l,i,d,p,h,_,y,S,te,ae,ue,E,ve,Ce,ke,Te,De,je,D,Pe,Ie,Re,Be,He,r,bt,xt,St,Ct,mt,ht,_t,vt,yt,wt,Tt,Et,Dt,Ot,st]);return(0,M.jsx)(dn.Provider,{value:kt,children:n})}var $n=(0,b.createContext)({});function er(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var tr=typeof window<`u`?b.useLayoutEffect:b.useEffect,nr=(0,b.createContext)(null);function rr(e,t){e.indexOf(t)===-1&&e.push(t)}function ir(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ar=(e,t,n)=>n>t?t:n<e?e:n,or={},sr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function cr(e){return typeof e==`object`&&!!e}var lr=e=>/^0[^.\s]+$/u.test(e);function ur(e){let t;return()=>(t===void 0&&(t=e()),t)}var dr=e=>e,fr=(e,t)=>n=>t(e(n)),pr=(...e)=>e.reduce(fr),mr=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},hr=class{constructor(){this.subscriptions=[]}add(e){return rr(this.subscriptions,e),()=>ir(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}},gr=e=>e*1e3,_r=e=>e/1e3;function vr(e,t){return t?1e3/t*e:0}var yr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,br=1e-7,xr=12;function Sr(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=yr(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>br&&++s<xr);return o}function Cr(e,t,n,r){if(e===t&&n===r)return dr;let i=t=>Sr(t,0,1,e,n);return e=>e===0||e===1?e:yr(i(e),t,r)}var wr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Tr=e=>t=>1-e(1-t),Er=Cr(.33,1.53,.69,.99),Dr=Tr(Er),Or=wr(Dr),kr=e=>e>=1?1:(e*=2)<1?.5*Dr(e):.5*(2-2**(-10*(e-1))),Ar=e=>1-Math.sin(Math.acos(e)),jr=Tr(Ar),Mr=wr(Ar),Nr=Cr(.42,0,1,1),Pr=Cr(0,0,.58,1),Fr=Cr(.42,0,.58,1),Ir=e=>Array.isArray(e)&&typeof e[0]!=`number`,Lr=e=>Array.isArray(e)&&typeof e[0]==`number`,Rr={linear:dr,easeIn:Nr,easeInOut:Fr,easeOut:Pr,circIn:Ar,circInOut:Mr,circOut:jr,backIn:Dr,backInOut:Or,backOut:Er,anticipate:kr},zr=e=>typeof e==`string`,Br=e=>{if(Lr(e)){e.length;let[t,n,r,i]=e;return Cr(t,n,r,i)}else if(zr(e))return Rr[e],`${e}`,Rr[e];return e},Vr=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Hr={value:null,addProjectionMetrics:null};function Ur(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&&Hr.value&&Hr.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Wr=40;function Gr(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Vr.reduce((e,n)=>(e[n]=Ur(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=or.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Wr),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:Vr.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<Vr.length;t++)o[Vr[t]].cancel(e)},state:i,steps:o}}var{schedule:Kr,cancel:qr,state:Jr,steps:Yr}=Gr(typeof requestAnimationFrame<`u`?requestAnimationFrame:dr,!0),Xr;function Zr(){Xr=void 0}var Qr={now:()=>(Xr===void 0&&Qr.set(Jr.isProcessing||or.useManualTiming?Jr.timestamp:performance.now()),Xr),set:e=>{Xr=e,queueMicrotask(Zr)}},$r={layout:0,mainThread:0,waapi:0},ei=e=>t=>typeof t==`string`&&t.startsWith(e),ti=ei(`--`),ni=ei(`var(--`),ri=e=>ni(e)?ii.test(e.split(`/*`)[0].trim()):!1,ii=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ai(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var oi={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},si={...oi,transform:e=>ar(0,1,e)},ci={...oi,default:1},li=e=>Math.round(e*1e5)/1e5,ui=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function di(e){return e==null}var fi=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,pi=(e,t)=>n=>!!(typeof n==`string`&&fi.test(n)&&n.startsWith(e)||t&&!di(n)&&Object.prototype.hasOwnProperty.call(n,t)),mi=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ui);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},hi=e=>ar(0,255,e),gi={...oi,transform:e=>Math.round(hi(e))},_i={test:pi(`rgb`,`red`),parse:mi(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+gi.transform(e)+`, `+gi.transform(t)+`, `+gi.transform(n)+`, `+li(si.transform(r))+`)`};function vi(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 yi={test:pi(`#`),parse:vi,transform:_i.transform},bi=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),xi=bi(`deg`),Si=bi(`%`),N=bi(`px`),Ci=bi(`vh`),wi=bi(`vw`),Ti={...Si,parse:e=>Si.parse(e)/100,transform:e=>Si.transform(e*100)},Ei={test:pi(`hsl`,`hue`),parse:mi(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Si.transform(li(t))+`, `+Si.transform(li(n))+`, `+li(si.transform(r))+`)`},Di={test:e=>_i.test(e)||yi.test(e)||Ei.test(e),parse:e=>_i.test(e)?_i.parse(e):Ei.test(e)?Ei.parse(e):yi.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?_i.transform(e):Ei.transform(e),getAnimatableNone:e=>{let t=Di.parse(e);return t.alpha=0,Di.transform(t)}},Oi=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ki(e){return isNaN(e)&&typeof e==`string`&&(e.match(ui)?.length||0)+(e.match(Oi)?.length||0)>0}var Ai=`number`,ji=`color`,Mi=`var`,Ni=`var(`,Pi="${}",Fi=/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 Ii(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Fi,e=>(Di.test(e)?(r.color.push(a),i.push(ji),n.push(Di.parse(e))):e.startsWith(Ni)?(r.var.push(a),i.push(Mi),n.push(e)):(r.number.push(a),i.push(Ai),n.push(parseFloat(e))),++a,Pi)).split(Pi),indexes:r,types:i}}function Li(e){return Ii(e).values}function Ri({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===Ai?i+=li(r[a]):e===ji?i+=Di.transform(r[a]):i+=r[a]}return i}}function zi(e){return Ri(Ii(e))}var Bi=e=>typeof e==`number`?0:Di.test(e)?Di.getAnimatableNone(e):e,Vi=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Bi(e);function Hi(e){let t=Ii(e);return Ri(t)(t.values.map((e,n)=>Vi(e,t.split[n])))}var Ui={test:ki,parse:Li,createTransformer:zi,getAnimatableNone:Hi};function Wi(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 Gi({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=Wi(s,r,e+1/3),a=Wi(s,r,e),o=Wi(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Ki(e,t){return n=>n>0?t:e}var qi=(e,t,n)=>e+(t-e)*n,Ji=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Yi=[yi,_i,Ei],Xi=e=>Yi.find(t=>t.test(e));function Zi(e){let t=Xi(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Ei&&(n=Gi(n)),n}var Qi=(e,t)=>{let n=Zi(e),r=Zi(t);if(!n||!r)return Ki(e,t);let i={...n};return e=>(i.red=Ji(n.red,r.red,e),i.green=Ji(n.green,r.green,e),i.blue=Ji(n.blue,r.blue,e),i.alpha=qi(n.alpha,r.alpha,e),_i.transform(i))},$i=new Set([`none`,`hidden`]);function ea(e,t){return $i.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ta(e,t){return n=>qi(e,t,n)}function na(e){return typeof e==`number`?ta:typeof e==`string`?ri(e)?Ki:Di.test(e)?Qi:oa:Array.isArray(e)?ra:typeof e==`object`?Di.test(e)?Qi:ia:Ki}function ra(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>na(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function ia(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=na(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function aa(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 oa=(e,t)=>{let n=Ui.createTransformer(t),r=Ii(e),i=Ii(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?$i.has(e)&&!i.values.length||$i.has(t)&&!r.values.length?ea(e,t):pr(ra(aa(r,i),i.values),n):(`${e}${t}`,Ki(e,t))};function sa(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?qi(e,t,n):na(e)(e,t)}var ca=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Kr.update(t,e),stop:()=>qr(t),now:()=>Jr.isProcessing?Jr.timestamp:Qr.now()}},la=(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)})`},ua=2e4;function da(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 fa(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(da(r),ua);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:_r(i)}}var P={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 pa(e,t){return e*Math.sqrt(1-t*t)}var ma=12;function ha(e,t,n){let r=n;for(let n=1;n<ma;n++)r-=e(r)/t(r);return r}var ga=.001;function _a({duration:e=P.duration,bounce:t=P.bounce,velocity:n=P.velocity,mass:r=P.mass}){let i,a;P.maxDuration;let o=1-t;o=ar(P.minDamping,P.maxDamping,o),e=ar(P.minDuration,P.maxDuration,_r(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=pa(t,o),c=Math.exp(-i);return ga-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=pa(t**2,o);return(-i(t)+ga>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-ga+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=ha(i,a,s);if(e=gr(e),isNaN(c))return{stiffness:P.stiffness,damping:P.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var va=[`duration`,`bounce`],ya=[`stiffness`,`damping`,`mass`];function ba(e,t){return t.some(t=>e[t]!==void 0)}function xa(e){let t={velocity:P.velocity,stiffness:P.stiffness,damping:P.damping,mass:P.mass,isResolvedFromDuration:!1,...e};if(!ba(e,ya)&&ba(e,va))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*ar(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:P.mass,stiffness:i,damping:a}}else{let n=_a({...e,velocity:0});t={...t,...n,mass:P.mass},t.isResolvedFromDuration=!0}return t}function Sa(e=P.visualDuration,t=P.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}=xa({...n,velocity:-_r(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=_r(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?P.restSpeed.granular:P.restSpeed.default,i||=v?P.restDelta.granular:P.restDelta.default;let y,b,x,ee,S,C;if(h<1)x=pa(_,h),ee=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(ee*Math.sin(x*e)+g*Math.cos(x*e)),S=h*_*ee+g*x,C=h*_*g-ee*x,b=e=>Math.exp(-h*_*e)*(S*Math.sin(x*e)+C*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 te={calculatedDuration:p&&d||null,velocity:e=>gr(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*(ee*n+g*a),l=gr(t*(S*n+C*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=gr(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(da(te),ua),t=la(t=>te.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return te}Sa.applyToOptions=e=>{let t=fa(e,100,Sa);return e.ease=t.ease,e.duration=gr(t.duration),e.type=`keyframes`,e};var Ca=5;function wa(e,t,n){let r=Math.max(t-Ca,0);return vr(n-e(r),t-r)}function Ta({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,ee,S=e=>{p(f.value)&&(x=e,ee=Sa({keyframes:[f.value,m(f.value)],velocity:wa(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!ee&&x===void 0&&(t=!0,b(e),S(e)),x!==void 0&&e>=x?ee.next(e-x):(!t&&b(e),f)}}}function Ea(e,t,n){let r=[],i=n||or.mix||sa,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pr(Array.isArray(t)?t[n]||dr:t,a)),r.push(a)}return r}function Da(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.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=Ea(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=mr(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ar(e[0],e[a-1],t)):l}function Oa(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=mr(0,t,r);e.push(qi(n,1,i))}}function ka(e){let t=[0];return Oa(t,e.length-1),t}function Aa(e,t){return e.map(e=>e*t)}function ja(e,t){return e.map(()=>t||Fr).splice(0,e.length-1)}function Ma({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ir(r)?r.map(Br):Br(r),a={done:!1,value:t[0]},o=Da(Aa(n&&n.length===t.length?n:ka(t),e),t,{ease:Array.isArray(i)?i:ja(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Na=e=>e!==null;function Pa(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Na),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Fa={decay:Ta,inertia:Ta,tween:Ma,keyframes:Ma,spring:Sa};function Ia(e){typeof e.type==`string`&&(e.type=Fa[e.type])}var La=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)}},Ra=e=>e/100,za=class extends La{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!==Qr.now()&&this.tick(Qr.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},$r.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Ia(e);let{type:t=Ma,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Ma;s!==Ma&&typeof o[0]!=`number`&&(this.mixKeyframes=pr(Ra,sa(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=da(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=ar(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 ee=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return ee&&p!==Ta&&(b.value=Pa(l,this.options,h,this.speed)),m&&m(b.value),ee&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return _r(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+_r(e)}get time(){return _r(this.currentTime)}set time(e){e=gr(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 wa(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(Qr.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=_r(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ca,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(Qr.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,$r.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 Ba(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Va=e=>e*180/Math.PI,Ha=e=>Wa(Va(Math.atan2(e[1],e[0]))),Ua={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ha,rotateZ:Ha,skewX:e=>Va(Math.atan(e[1])),skewY:e=>Va(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Wa=e=>(e%=360,e<0&&(e+=360),e),Ga=Ha,Ka=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),qa=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ja={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ka,scaleY:qa,scale:e=>(Ka(e)+qa(e))/2,rotateX:e=>Wa(Va(Math.atan2(e[6],e[5]))),rotateY:e=>Wa(Va(Math.atan2(-e[2],e[0]))),rotateZ:Ga,rotate:Ga,skewX:e=>Va(Math.atan(e[4])),skewY:e=>Va(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ya(e){return e.includes(`scale`)?1:0}function Xa(e,t){if(!e||e===`none`)return Ya(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ja,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Ua,i=t}if(!i)return Ya(t);let a=r[t],o=i[1].split(`,`).map(Qa);return typeof a==`function`?a(o):o[a]}var Za=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Xa(n,t)};function Qa(e){return parseFloat(e.trim())}var $a=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],eo=new Set($a),to=e=>e===oi||e===N,no=new Set([`x`,`y`,`z`]),ro=$a.filter(e=>!no.has(e));function io(e){let t=[];return ro.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})=>Xa(t,`x`),y:(e,{transform:t})=>Xa(t,`y`)};ao.translateX=ao.x,ao.translateY=ao.y;var oo=new Set,so=!1,co=!1,lo=!1;function uo(){if(co){let e=Array.from(oo).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=io(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)})}co=!1,so=!1,oo.forEach(e=>e.complete(lo)),oo.clear()}function fo(){oo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(co=!0)})}function po(){lo=!0,fo(),uo(),lo=!1}var mo=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?(oo.add(this),so||(so=!0,Kr.read(fo),Kr.resolveKeyframes(uo))):(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])}Ba(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),oo.delete(this)}cancel(){this.state===`scheduled`&&(oo.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},ho=e=>e.startsWith(`--`);function go(e,t,n){ho(t)?e.style.setProperty(t,n):e.style[t]=n}var _o={};function vo(e,t){let n=ur(e);return()=>_o[t]??n()}var F=vo(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),yo=vo(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),bo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,xo={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:bo([0,.65,.55,1]),circOut:bo([.55,0,1,.45]),backIn:bo([.31,.01,.66,-.59]),backOut:bo([.33,1.53,.69,.99])};function So(e,t){if(e)return typeof e==`function`?yo()?la(e,t):`ease-out`:Lr(e)?bo(e):Array.isArray(e)?e.map(e=>So(e,t)||xo.easeOut):xo[e]}function Co(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=So(s,i);Array.isArray(d)&&(u.easing=d),Hr.value&&$r.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 Hr.value&&p.finished.finally(()=>{$r.waapi--}),p}function wo(e){return typeof e==`function`&&`applyToOptions`in e}function To({type:e,...t}){return wo(e)&&yo()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Eo=class extends La{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,e.type;let c=To(e);this.animation=Co(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Pa(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),go(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 _r(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+_r(e)}get time(){return _r(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=gr(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&&F()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),dr):r(this)}},Do={anticipate:kr,backInOut:Or,circInOut:Mr};function Oo(e){return e in Do}function ko(e){typeof e.ease==`string`&&Oo(e.ease)&&(e.ease=Do[e.ease])}var Ao=10,jo=class extends Eo{constructor(e){ko(e),Ia(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 za({...a,autoplay:!1}),s=Math.max(Ao,Qr.now()-this.startTime),c=ar(0,Ao,s-Ao),l=o.sample(s).value,{name:u}=this.options;i&&u&&go(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Mo=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ui.test(e)||e===`0`)&&!e.startsWith(`url(`));function No(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 Po(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=Mo(i,t),s=Mo(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:No(e)||(n===`spring`||wo(n))&&r}function Fo(e){e.duration=0,e.type=`keyframes`}var Io=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Lo=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Ro(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Lo.test(e[t]))return!0;return!1}var zo=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Bo=ur(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Vo(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 Bo()&&n&&(Io.has(n)||zo.has(n)&&Ro(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Ho=40,Uo=class extends La{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=Qr.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||mo)(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=Qr.now();let u=!0;Po(e,i,a,o)||(u=!1,(or.instantAnimations||!s)&&l?.(Pa(e,n,t)),e[0]=e[e.length-1],Fo(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Ho?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Vo(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new jo({...d,element:p})}catch{m=new za(d)}else m=new za(d);m.finished.then(()=>{this.notifyFinished()}).catch(dr),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(),po()),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 Wo(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 Go=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ko(e){let t=Go.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function qo(e,t,n=1){`${e}`;let[r,i]=Ko(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return sr(e)?parseFloat(e):e}return ri(i)?qo(i,t,n+1):i}var Jo={type:`spring`,stiffness:500,damping:25,restSpeed:10},Yo=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Xo={type:`keyframes`,duration:.8},Zo={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Qo=(e,{keyframes:t})=>t.length>2?Xo:eo.has(e)?e.startsWith(`scale`)?Yo(t[1]):Jo:Zo;function $o(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:$o(n,e)}var ts=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function ns(e){for(let t in e)if(!ts.has(t))return!0;return!1}var rs=(e,t,n,r={},i,a)=>o=>{let s=es(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=gr(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};ns(s)||Object.assign(u,Qo(e,u)),u.duration&&=gr(u.duration),u.repeatDelay&&=gr(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Fo(u),u.delay===0&&(d=!0)),(or.instantAnimations||or.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,Fo(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Pa(u.keyframes,s);if(e!==void 0){Kr.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new za(u):new Uo(u)};function is(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function as(e,t,n,r){if(typeof t==`function`){let[i,a]=is(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]=is(r);t=t(n===void 0?e.custom:n,i,a)}return t}function os(e,t,n){let r=e.getProps();return as(r,t,n===void 0?r.custom:n,e)}var ss=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...$a]),cs=30,ls=e=>!isNaN(parseFloat(e)),us={current:void 0},ds=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Qr.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=Qr.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ls(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new hr);let n=this.events[e].add(t);return e===`change`?()=>{n(),Kr.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 us.current&&us.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Qr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>cs)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,cs);return vr(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 fs(e,t){return new ds(e,t)}var ps=e=>Array.isArray(e);function ms(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,fs(n))}function hs(e){return ps(e)?e[e.length-1]||0:e}function gs(e,t){let{transitionEnd:n={},transition:r={},...i}=os(e,t)||{};i={...i,...n};for(let t in i)ms(e,t,hs(i[t]))}var _s=e=>!!(e&&e.getVelocity);function vs(e){return!!(_s(e)&&e.add)}function ys(e,t){let n=e.getValue(`willChange`);if(vs(n))return n.add(t);if(!n&&or.WillChange){let n=new or.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function bs(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var xs=`data-`+bs(`framerAppearId`);function Ss(e){return e.props[xs]}function Cs({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ws(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?$o(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&&Cs(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){Kr.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Ss(e);if(n){let e=window.MotionHandoffAnimation(n,t,Kr);e!==null&&(o.startTime=e,f=!0)}}ys(e,t);let p=l??e.shouldReduceMotion;r.start(rs(t,r,i,p&&ss.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Kr.update(()=>{o&&gs(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Ts(e,t,n={}){let r=os(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(ws(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Es(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 Es(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(Ts(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Wo(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Ds(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ts(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ts(e,t,n);else{let i=typeof t==`function`?os(e,t,n.custom):t;r=Promise.all(ws(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Os={test:e=>e===`auto`,parse:e=>e},ks=e=>t=>t.test(e),As=[oi,N,Si,xi,wi,Ci,Os],js=e=>As.find(ks(e));function Ms(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||lr(e)}var Ns=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Ps(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ui)||[];if(!r)return e;let i=n.replace(r,``),a=Ns.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var Fs=/\b([a-z-]*)\(.*?\)/gu,Is={...Ui,getAnimatableNone:e=>{let t=e.match(Fs);return t?t.map(Ps).join(` `):e}},Ls={...Ui,getAnimatableNone:e=>{let t=Ui.parse(e);return Ui.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Rs={...oi,transform:Math.round},zs={borderWidth:N,borderTopWidth:N,borderRightWidth:N,borderBottomWidth:N,borderLeftWidth:N,borderRadius:N,borderTopLeftRadius:N,borderTopRightRadius:N,borderBottomRightRadius:N,borderBottomLeftRadius:N,width:N,maxWidth:N,height:N,maxHeight:N,top:N,right:N,bottom:N,left:N,inset:N,insetBlock:N,insetBlockStart:N,insetBlockEnd:N,insetInline:N,insetInlineStart:N,insetInlineEnd:N,padding:N,paddingTop:N,paddingRight:N,paddingBottom:N,paddingLeft:N,paddingBlock:N,paddingBlockStart:N,paddingBlockEnd:N,paddingInline:N,paddingInlineStart:N,paddingInlineEnd:N,margin:N,marginTop:N,marginRight:N,marginBottom:N,marginLeft:N,marginBlock:N,marginBlockStart:N,marginBlockEnd:N,marginInline:N,marginInlineStart:N,marginInlineEnd:N,fontSize:N,backgroundPositionX:N,backgroundPositionY:N,rotate:xi,rotateX:xi,rotateY:xi,rotateZ:xi,scale:ci,scaleX:ci,scaleY:ci,scaleZ:ci,skew:xi,skewX:xi,skewY:xi,distance:N,translateX:N,translateY:N,translateZ:N,x:N,y:N,z:N,perspective:N,transformPerspective:N,opacity:si,originX:Ti,originY:Ti,originZ:N,zIndex:Rs,fillOpacity:si,strokeOpacity:si,numOctaves:Rs},Bs={...zs,color:Di,backgroundColor:Di,outlineColor:Di,fill:Di,stroke:Di,borderColor:Di,borderTopColor:Di,borderRightColor:Di,borderBottomColor:Di,borderLeftColor:Di,filter:Is,WebkitFilter:Is,mask:Ls,WebkitMask:Ls},Vs=e=>Bs[e],Hs=new Set([Is,Ls]);function Us(e,t){let n=Vs(e);return Hs.has(n)||(n=Ui),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Ws=new Set([`auto`,`none`,`0`]);function Gs(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Ws.has(t)&&Ii(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Us(n,i)}var Ks=class extends mo{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(),ri(r))){let i=qo(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ss.has(n)||e.length!==2)return;let[r,i]=e,a=js(r),o=js(i);if(ai(r)!==ai(i)&&ao[n]){this.needsMeasurement=!0;return}if(a!==o)if(to(a)&&to(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||Ms(e[t]))&&n.push(t);n.length&&Gs(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 qs(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 Js=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ys(e){return cr(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Xs,cancel:Zs}=Gr(queueMicrotask,!1),Qs={x:!1,y:!1};function $s(){return Qs.x||Qs.y}function ec(e){return e===`x`||e===`y`?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}function tc(e,t){let n=qs(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function nc(e){return!(e.pointerType===`touch`||$s())}function rc(e,t,n={}){let[r,i,a]=tc(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(!nc(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 ic=(e,t)=>t?e===t?!0:ic(e,t.parentElement):!1,ac=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,oc=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function sc(e){return oc.has(e.tagName)||e.isContentEditable===!0}var cc=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function lc(e){return cc.has(e.tagName)||e.isContentEditable===!0}var uc=new WeakSet;function dc(e){return t=>{t.key===`Enter`&&e(t)}}function fc(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var pc=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=dc(()=>{if(uc.has(n))return;fc(n,`down`);let e=dc(()=>{fc(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>fc(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function mc(e){return ac(e)&&!$s()}var hc=new WeakSet;function gc(e,t,n={}){let[r,i,a]=tc(e,n),o=e=>{let r=e.currentTarget;if(!mc(e)||hc.has(e))return;uc.add(r),n.stopPropagation&&hc.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),uc.has(r)&&uc.delete(r),mc(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||ic(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),Ys(e)&&(e.addEventListener(`focus`,e=>pc(e,i)),!sc(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function _c(e){return cr(e)&&`ownerSVGElement`in e}var vc=new WeakMap,yc,bc=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:_c(r)&&`getBBox`in r?r.getBBox()[t]:r[n],xc=bc(`inline`,`width`,`offsetWidth`),Sc=bc(`block`,`height`,`offsetHeight`);function Cc({target:e,borderBoxSize:t}){vc.get(e)?.forEach(n=>{n(e,{get width(){return xc(e,t)},get height(){return Sc(e,t)}})})}function wc(e){e.forEach(Cc)}function Tc(){typeof ResizeObserver>`u`||(yc=new ResizeObserver(wc))}function Ec(e,t){yc||Tc();let n=qs(e);return n.forEach(e=>{let n=vc.get(e);n||(n=new Set,vc.set(e,n)),n.add(t),yc?.observe(e)}),()=>{n.forEach(e=>{let n=vc.get(e);n?.delete(t),n?.size||yc?.unobserve(e)})}}var Dc=new Set,Oc;function kc(){Oc=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Dc.forEach(t=>t(e))},window.addEventListener(`resize`,Oc)}function Ac(e){return Dc.add(e),Oc||kc(),()=>{Dc.delete(e),!Dc.size&&typeof Oc==`function`&&(window.removeEventListener(`resize`,Oc),Oc=void 0)}}function jc(e,t){return typeof e==`function`?Ac(e):Ec(e,t)}function Mc(e){return _c(e)&&e.tagName===`svg`}var Nc=[...As,Di,Ui],Pc=e=>Nc.find(ks(e)),Fc=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ic=()=>({x:Fc(),y:Fc()}),Lc=()=>({min:0,max:0}),Rc=()=>({x:Lc(),y:Lc()}),zc=new WeakMap;function Bc(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Vc(e){return typeof e==`string`||Array.isArray(e)}var Hc=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Uc=[`initial`,...Hc];function Wc(e){return Bc(e.animate)||Uc.some(t=>Vc(e[t]))}function Gc(e){return!!(Wc(e)||e.variants)}function Kc(e,t,n){for(let r in t){let i=t[r],a=n[r];if(_s(i))e.addValue(r,i);else if(_s(a))e.addValue(r,fs(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,fs(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var qc={current:null},Jc={current:!1},Yc=typeof window<`u`;function Xc(){if(Jc.current=!0,Yc)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>qc.current=e.matches;e.addEventListener(`change`,t),t()}else qc.current=!1}var Zc=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Qc={};function $c(e){Qc=e}function el(){return Qc}var tl=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=mo,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=Qr.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Kr.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=Wc(t),this.isVariantNode=Gc(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&&_s(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,zc.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:(Jc.current||Xc(),this.shouldReduceMotion=qc.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),qr(this.notifyUpdate),qr(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&&Io.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Eo({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:gr(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=eo.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Kr.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 Qc){let t=Qc[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):Rc()}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<Zc.length;t++){let n=Zc[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=Kc(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=fs(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`&&(sr(n)||lr(n))?n=parseFloat(n):!Pc(n)&&Ui.test(t)&&(n=Us(e,t)),this.setBaseTarget(e,_s(n)?n.get():n)),_s(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=as(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&&!_s(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 hr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Xs.render(this.render)}},nl=class extends tl{constructor(){super(...arguments),this.KeyframeResolver=Ks}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;_s(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},rl=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function il({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function al({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ol(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 sl(e){return e===void 0||e===1}function cl({scale:e,scaleX:t,scaleY:n}){return!sl(e)||!sl(t)||!sl(n)}function ll(e){return cl(e)||ul(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ul(e){return dl(e.x)||dl(e.y)}function dl(e){return e&&e!==`0%`}function fl(e,t,n){return n+t*(e-n)}function pl(e,t,n,r,i){return i!==void 0&&(e=fl(e,i,r)),fl(e,n,r)+t}function ml(e,t=0,n=1,r,i){e.min=pl(e.min,t,n,r,i),e.max=pl(e.max,t,n,r,i)}function hl(e,{x:t,y:n}){ml(e.x,t.translate,t.scale,t.originPoint),ml(e.y,n.translate,n.scale,n.originPoint)}var gl=.999999999999,_l=1.0000000000001;function vl(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&&(yl(e.x,-a.scroll.offset.x),yl(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,hl(e,o)),r&&ll(a.latestValues)&&Sl(e,a.latestValues,a.layout?.layoutBox))}t.x<_l&&t.x>gl&&(t.x=1),t.y<_l&&t.y>gl&&(t.y=1)}function yl(e,t){e.min+=t,e.max+=t}function bl(e,t,n,r,i=.5){ml(e,t,n,qi(e.min,e.max,i),r)}function xl(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Sl(e,t,n){let r=n??e;bl(e.x,xl(t.x,r.x),t.scaleX,t.scale,t.originX),bl(e.y,xl(t.y,r.y),t.scaleY,t.scale,t.originY)}function Cl(e,t){return il(ol(e.getBoundingClientRect(),t))}function wl(e,t,n){let r=Cl(e,n),{scroll:i}=t;return i&&(yl(r.x,i.offset.x),yl(r.y,i.offset.y)),r}var Tl={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},El=$a.length;function Dl(e,t,n){let r=``,i=!0;for(let a=0;a<El;a++){let o=$a[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=Js(s,zs[o]);if(!c){i=!1;let t=Tl[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Ol(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(eo.has(e)){o=!0;continue}else if(ti(e)){i[e]=n;continue}else{let t=Js(n,zs[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Dl(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 kl(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 Al(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var jl={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(N.test(e))e=parseFloat(e);else return e;return`${Al(e,t.target.x)}% ${Al(e,t.target.y)}%`}},Ml={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ui.parse(e);if(i.length>5)return r;let a=Ui.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=qi(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Nl={borderRadius:{...jl,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:jl,borderTopRightRadius:jl,borderBottomLeftRadius:jl,borderBottomRightRadius:jl,boxShadow:Ml};function Pl(e,{layout:t,layoutId:n}){return eo.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Nl[e]||e===`opacity`)}function Fl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(_s(r[t])||i&&_s(i[t])||Pl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Il(e){return window.getComputedStyle(e)}var Ll=class extends nl{constructor(){super(...arguments),this.type=`html`,this.renderInstance=kl}readValueFromInstance(e,t){if(eo.has(t))return this.projection?.isProjecting?Ya(t):Za(e,t);{let n=Il(e),r=(ti(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Cl(e,t)}build(e,t,n){Ol(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Fl(e,t,n)}},Rl={offset:`stroke-dashoffset`,array:`stroke-dasharray`},zl={offset:`strokeDashoffset`,array:`strokeDasharray`};function Bl(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Rl:zl;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Vl=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Hl(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Ol(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 Vl)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&&Bl(d,i,a,o,!1)}var Ul=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`]),Wl=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Gl(e,t,n,r){kl(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Ul.has(n)?n:bs(n),t.attrs[n])}function Kl(e,t,n){let r=Fl(e,t,n);for(let n in e)if(_s(e[n])||_s(t[n])){let t=$a.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ql=class extends nl{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Rc}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(eo.has(t)){let e=Vs(t);return e&&e.default||0}return t=Ul.has(t)?t:bs(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Kl(e,t,n)}build(e,t,n){Hl(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Gl(e,t,n,r)}mount(e){this.isSVGTag=Wl(e.tagName),super.mount(e)}},Jl=Uc.length;function Yl(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Yl(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Jl;n++){let r=Uc[n],i=e.props[r];(Vc(i)||i===!1)&&(t[r]=i)}return t}function Xl(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 I=[...Hc].reverse(),L=Hc.length;function Zl(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Ds(e,t,n)))}function Ql(e){let t=Zl(e),n=tu(),r=!0,i=!1,a=t=>(n,r)=>{let i=os(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=Yl(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<L;t++){let p=I[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Vc(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||Bc(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=$l(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,ee=Array.isArray(h)?h:[h],S=ee.reduce(a(p),{});_===!1&&(S={});let{prevResolvedValues:C={}}=m,te={...C,...S},w=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 te){let t=S[e],n=C[e];if(d.hasOwnProperty(e))continue;let r=!1;r=ps(t)&&ps(n)?!Xl(t,n):t!==n,r?t==null?u.add(e):w(e):t!==void 0&&u.has(e)?w(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=S,m.isActive&&(d={...d,...S}),(r||i)&&e.blockInitialAnimation&&(b=!1);let ne=v&&y;b&&(!ne||x)&&l.push(...ee.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!ne&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=os(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Wo(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=os(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=tu(),i=!0}}}function $l(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Xl(t,e):!1}function eu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function tu(){return{animate:eu(!0),whileInView:eu(),whileHover:eu(),whileTap:eu(),whileDrag:eu(),whileFocus:eu(),exit:eu()}}function nu(e,t){e.min=t.min,e.max=t.max}function ru(e,t){nu(e.x,t.x),nu(e.y,t.y)}function iu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var au=1e-4,ou=1-au,su=1+au,cu=.01,lu=0-cu,uu=0+cu;function du(e){return e.max-e.min}function fu(e,t,n){return Math.abs(e-t)<=n}function pu(e,t,n,r=.5){e.origin=r,e.originPoint=qi(t.min,t.max,e.origin),e.scale=du(n)/du(t),e.translate=qi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ou&&e.scale<=su||isNaN(e.scale))&&(e.scale=1),(e.translate>=lu&&e.translate<=uu||isNaN(e.translate))&&(e.translate=0)}function mu(e,t,n,r){pu(e.x,t.x,n.x,r?r.originX:void 0),pu(e.y,t.y,n.y,r?r.originY:void 0)}function hu(e,t,n,r=0){e.min=(r?qi(n.min,n.max,r):n.min)+t.min,e.max=e.min+du(t)}function gu(e,t,n,r){hu(e.x,t.x,n.x,r?.x),hu(e.y,t.y,n.y,r?.y)}function _u(e,t,n,r=0){let i=r?qi(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+du(t)}function vu(e,t,n,r){_u(e.x,t.x,n.x,r?.x),_u(e.y,t.y,n.y,r?.y)}function yu(e,t,n,r,i){return e-=t,e=fl(e,1/n,r),i!==void 0&&(e=fl(e,1/i,r)),e}function bu(e,t=0,n=1,r=.5,i,a=e,o=e){if(Si.test(t)&&(t=parseFloat(t),t=qi(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=qi(a.min,a.max,r);e===a&&(s-=t),e.min=yu(e.min,t,n,s,i),e.max=yu(e.max,t,n,s,i)}function xu(e,t,[n,r,i],a,o){bu(e,t[n],t[r],t[i],t.scale,a,o)}var Su=[`x`,`scaleX`,`originX`],Cu=[`y`,`scaleY`,`originY`];function wu(e,t,n,r){xu(e.x,t,Su,n?n.x:void 0,r?r.x:void 0),xu(e.y,t,Cu,n?n.y:void 0,r?r.y:void 0)}function Tu(e){return e.translate===0&&e.scale===1}function Eu(e){return Tu(e.x)&&Tu(e.y)}function Du(e,t){return e.min===t.min&&e.max===t.max}function Ou(e,t){return Du(e.x,t.x)&&Du(e.y,t.y)}function ku(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Au(e,t){return ku(e.x,t.x)&&ku(e.y,t.y)}function ju(e){return du(e.x)/du(e.y)}function Mu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Nu(e){return[e(`x`),e(`y`)]}function Pu(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 Fu=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Iu=Fu.length,Lu=e=>typeof e==`string`?parseFloat(e):e,Ru=e=>typeof e==`number`||N.test(e);function zu(e,t,n,r,i,a){i?(e.opacity=qi(0,n.opacity??1,Vu(r)),e.opacityExit=qi(t.opacity??1,0,Hu(r))):a&&(e.opacity=qi(t.opacity??1,n.opacity??1,r));for(let i=0;i<Iu;i++){let a=Fu[i],o=Bu(t,a),s=Bu(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Ru(o)===Ru(s)?(e[a]=Math.max(qi(Lu(o),Lu(s),r),0),(Si.test(s)||Si.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=qi(t.rotate||0,n.rotate||0,r))}function Bu(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Vu=Uu(0,.5,jr),Hu=Uu(.5,.95,dr);function Uu(e,t,n){return r=>r<e?0:r>t?1:n(mr(e,t,r))}function Wu(e,t,n){let r=_s(e)?e:fs(e);return r.start(rs(``,r,t,n)),r.animation}function Gu(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Ku=(e,t)=>e.depth-t.depth,qu=class{constructor(){this.children=[],this.isDirty=!1}add(e){rr(this.children,e),this.isDirty=!0}remove(e){ir(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Ku),this.isDirty=!1,this.children.forEach(e)}};function Ju(e,t){let n=Qr.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(qr(r),e(a-t))};return Kr.setup(r,!0),()=>qr(r)}function Yu(e){return _s(e)?e.get():e}var Xu=class{constructor(){this.members=[]}add(e){rr(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&&(ir(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(ir(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)}},Zu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qu={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},$u=[``,`X`,`Y`,`Z`],ed=1e3,td=0;function nd(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function rd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Ss(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Kr,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&rd(r)}function id({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=td++,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,Hr.value&&(Qu.nodes=Qu.calculatedTargetDeltas=Qu.calculatedProjections=0),this.nodes.forEach(sd),this.nodes.forEach(gd),this.nodes.forEach(_d),this.nodes.forEach(cd),Hr.addProjectionMetrics&&Hr.addProjectionMetrics(Qu)},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 qu)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new hr),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=_c(t)&&!Mc(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;Kr.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Ju(i,250),Zu.hasAnimatedSinceResize&&(Zu.hasAnimatedSinceResize=!1,this.nodes.forEach(hd)))})}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()||wd,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Au(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||hd(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(),qr(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(vd),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&&rd(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(dd),this.nodes.forEach(ud);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pd),this.nodes.forEach(md),this.nodes.forEach(ad),this.nodes.forEach(od)):this.nodes.forEach(fd),this.clearAllSnapshots();let e=Qr.now();Jr.delta=ar(0,1e3/60,e-Jr.timestamp),Jr.timestamp=e,Jr.isProcessing=!0,Yr.update.process(Jr),Yr.preRender.process(Jr),Yr.render.process(Jr),Jr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xs.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ld),this.sharedNodes.forEach(yd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Kr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Kr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!du(this.snapshot.measuredBox.x)&&!du(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||=Rc(),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&&!Eu(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||ll(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)),Od(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Rc();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Ad))){let{scroll:e}=this.root;e&&(yl(t.x,e.offset.x),yl(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Rc();if(ru(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&&ru(t,e),yl(t.x,i.offset.x),yl(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Rc();ru(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&&(yl(r.x,-n.scroll.offset.x),yl(r.y,-n.scroll.offset.y)),ll(n.latestValues)&&Sl(r,n.latestValues,n.layout?.layoutBox)}return ll(this.latestValues)&&Sl(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Rc();ru(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!ll(n.latestValues))continue;let r;n.instance&&(cl(n.latestValues)&&n.updateSnapshot(),r=Rc(),ru(r,n.measurePageBox())),wu(t,n.latestValues,n.snapshot?.layoutBox,r)}return ll(this.latestValues)&&wu(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!==Jr.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=Jr.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=Rc(),this.targetWithTransforms=Rc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ru(this.target,this.layout.layoutBox),hl(this.target,this.targetDelta)):ru(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),Hr.value&&Qu.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||cl(this.parent.latestValues)||ul(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=Rc(),this.relativeTargetOrigin=Rc(),vu(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ru(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===Jr.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;ru(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;vl(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=Rc());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(iu(this.prevProjectionDelta.x,this.projectionDelta.x),iu(this.prevProjectionDelta.y,this.projectionDelta.y)),mu(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Mu(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Hr.value&&Qu.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=Ic(),this.projectionDelta=Ic(),this.projectionDeltaWithTransform=Ic()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Ic();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Rc(),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(Cd));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;bd(a.x,e.x,n),bd(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vu(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Sd(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Ou(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Rc(),ru(d,this.relativeTarget)),s&&(this.animationValues=i,zu(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&&=(qr(this.pendingAnimation),void 0),this.pendingAnimation=Kr.update(()=>{Zu.hasAnimatedSinceResize=!0,$r.layout++,this.motionValue||=fs(0),this.motionValue.jump(0,!1),this.currentAnimation=Wu(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{$r.layout--},onComplete:()=>{$r.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(ed),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&&kd(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Rc();let t=du(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=du(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ru(t,n),Sl(t,i),mu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Xu),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&&nd(`z`,e,r,this.animationValues);for(let t=0;t<$u.length;t++)nd(`rotate${$u[t]}`,e,r,this.animationValues),nd(`skew${$u[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=Yu(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=Yu(t?.pointerEvents)||``),this.hasProjected&&!ll(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Pu(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 Nl){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Nl[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?Yu(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(ud),this.root.sharedNodes.clear()}}}function ad(e){e.updateLayout()}function od(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`)Nu(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=du(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;nu(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else kd(i,t.layoutBox,n)&&Nu(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=du(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=Ic();mu(o,n,t.layoutBox);let s=Ic();a?mu(s,e.applyTransform(r,!0),t.measuredBox):mu(s,n,t.layoutBox);let c=!Eu(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=Rc();vu(s,t.layoutBox,i.layoutBox,o);let c=Rc();vu(c,n,a.layoutBox,o),Au(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 sd(e){Hr.value&&Qu.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 cd(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ld(e){e.clearSnapshot()}function ud(e){e.clearMeasurements()}function dd(e){e.isLayoutDirty=!0,e.updateLayout()}function fd(e){e.isLayoutDirty=!1}function pd(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function md(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function hd(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function gd(e){e.resolveTargetDelta()}function _d(e){e.calcProjection()}function vd(e){e.resetSkewAndRotation()}function yd(e){e.removeLeadSnapshot()}function bd(e,t,n){e.translate=qi(t.translate,0,n),e.scale=qi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function xd(e,t,n,r){e.min=qi(t.min,n.min,r),e.max=qi(t.max,n.max,r)}function Sd(e,t,n,r){xd(e.x,t.x,n.x,r),xd(e.y,t.y,n.y,r)}function Cd(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var wd={duration:.45,ease:[.4,0,.1,1]},Td=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ed=Td(`applewebkit/`)&&!Td(`chrome/`)?Math.round:dr;function Dd(e){e.min=Ed(e.min),e.max=Ed(e.max)}function Od(e){Dd(e.x),Dd(e.y)}function kd(e,t,n){return e===`position`||e===`preserve-aspect`&&!fu(ju(t),ju(n),.2)}function Ad(e){return e!==e.root&&e.scroll?.wasRoot}var jd=id({attachResizeListener:(e,t)=>Gu(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Md={current:void 0},Nd=id({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Md.current){let e=new jd({});e.mount(window),e.setOptions({layoutScroll:!0}),Md.current=e}return Md.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),R=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Pd(e=!0){let t=(0,b.useContext)(nr);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,b.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Fd=(0,b.createContext)({strict:!1}),Id={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`]},Ld=!1;function Rd(){if(Ld)return;let e={};for(let t in Id)e[t]={isEnabled:e=>Id[t].some(t=>!!e[t])};$c(e),Ld=!0}function zd(){return Rd(),el()}function Bd(e){let t=zd();for(let n in e)t[n]={...t[n],...e[n]};$c(t)}var Vd=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 Hd(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Vd.has(e)}var Ud=c({default:()=>Wd}),Wd,Gd=o((()=>{throw Wd={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Kd=e=>!Hd(e);function qd(e){typeof e==`function`&&(Kd=t=>t.startsWith(`on`)?!Hd(t):e(t))}try{qd((Gd(),d(Ud)).default)}catch{}function Jd(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||_s(e[i])||(Kd(i)||n===!0&&Hd(i)||!t&&!Hd(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var Yd=(0,b.createContext)({});function Xd(e,t){if(Wc(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Vc(t)?t:void 0,animate:Vc(n)?n:void 0}}return e.inherit===!1?{}:t}function Zd(e){let{initial:t,animate:n}=Xd(e,(0,b.useContext)(Yd));return(0,b.useMemo)(()=>({initial:t,animate:n}),[Qd(t),Qd(n)])}function Qd(e){return Array.isArray(e)?e.join(` `):e}var $d=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ef(e,t,n){for(let r in t)!_s(t[r])&&!Pl(r,n)&&(e[r]=t[r])}function tf({transformTemplate:e},t){return(0,b.useMemo)(()=>{let n=$d();return Ol(n,t,e),Object.assign({},n.vars,n.style)},[t])}function nf(e,t){let n=e.style||{},r={};return ef(r,n,e),Object.assign(r,tf(e,t)),r}function rf(e,t){let n={},r=nf(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 af=()=>({...$d(),attrs:{}});function of(e,t,n,r){let i=(0,b.useMemo)(()=>{let n=af();return Hl(n,t,Wl(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};ef(t,e.style,e),i.style={...t,...i.style}}return i}var sf=[`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 cf(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(sf.indexOf(e)>-1||/[A-Z]/u.test(e))}function lf(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??cf(e)?of:rf)(t,r,i,e),c=Jd(t,typeof e==`string`,a),l=e===b.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,b.useMemo)(()=>_s(u)?u.get():u,[u]);return(0,b.createElement)(e,{...l,children:d})}function uf({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:df(n,r,i,e),renderState:t()}}function df(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Yu(a[e]);let{initial:o,animate:s}=e,c=Wc(e),l=Gc(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`&&!Bc(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=as(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 ff=e=>(t,n)=>{let r=(0,b.useContext)(Yd),i=(0,b.useContext)(nr),a=()=>uf(e,t,r,i);return n?a():er(a)},pf=ff({scrapeMotionValuesFromProps:Fl,createRenderState:$d}),mf=ff({scrapeMotionValuesFromProps:Kl,createRenderState:af}),hf=Symbol.for(`motionComponentSymbol`);function gf(e,t,n){let r=(0,b.useRef)(n);(0,b.useInsertionEffect)(()=>{r.current=n});let i=(0,b.useRef)(null);return(0,b.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 _f=(0,b.createContext)({});function vf(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function yf(e,t,n,r,i,a){let{visualElement:o}=(0,b.useContext)(Yd),s=(0,b.useContext)(Fd),c=(0,b.useContext)(nr),l=(0,b.useContext)(R),u=l.reducedMotion,d=l.skipAnimations,f=(0,b.useRef)(null),p=(0,b.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,b.useContext)(_f);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&bf(f.current,n,i,h);let g=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[xs],v=(0,b.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return tr(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,b.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function bf(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&&vf(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 Sf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Bd(r);let a=n?n===`svg`:cf(e),o=a?mf:pf;function s(n,s){let c,l={...(0,b.useContext)(R),...n,layoutId:Cf(n)},{isStatic:u}=l,d=Zd(n),f=o(n,u);if(!u&&typeof window<`u`){wf(l,r);let t=Tf(l);c=t.MeasureLayout,d.visualElement=yf(e,f,l,i,t.ProjectionNode,a)}return(0,M.jsxs)(Yd.Provider,{value:d,children:[c&&d.visualElement?(0,M.jsx)(c,{visualElement:d.visualElement,...l}):null,lf(e,n,gf(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,b.forwardRef)(s);return c[hf]=e,c}function Cf({layoutId:e}){let t=(0,b.useContext)($n).id;return t&&e!==void 0?t+`-`+e:e}function wf(e,t){(0,b.useContext)(Fd).strict}function Tf(e){let{drag:t,layout:n}=zd();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Ef(e,t){if(typeof Proxy>`u`)return Sf;let n=new Map,r=(n,r)=>Sf(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Sf(a,void 0,e,t)),n.get(a))})}var Df=(e,t)=>t.isSVG??cf(e)?new ql(t):new Ll(t,{allowProjection:e!==b.Fragment}),Of=class extends rl{constructor(e){super(e),e.animationState||=Ql(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Bc(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?.()}},kf=0,Af={animation:{Feature:Of},exit:{Feature:class extends rl{constructor(){super(...arguments),this.id=kf++,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=os(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 jf(e){return{point:{x:e.pageX,y:e.pageY}}}var Mf=e=>t=>ac(t)&&e(t,jf(t));function Nf(e,t,n,r){return Gu(e,t,Mf(n),r)}var Pf=({current:e})=>e?e.ownerDocument.defaultView:null,Ff=(e,t)=>Math.abs(e-t);function If(e,t){let n=Ff(e.x,t.x),r=Ff(e.y,t.y);return Math.sqrt(n**2+r**2)}var Lf=new Set([`auto`,`scroll`]),Rf=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=zf(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Vf(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=If(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=Jr;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=zf(t,this.transformPagePoint),Kr.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=Vf(e.type===`pointercancel`?this.lastMoveEventInfo:zf(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!ac(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=zf(jf(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=Jr;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Vf(s,this.history)),this.removeListeners=pr(Nf(this.contextWindow,`pointermove`,this.handlePointerMove),Nf(this.contextWindow,`pointerup`,this.handlePointerUp),Nf(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Lf.has(e.overflowX)||Lf.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),Kr.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),qr(this.updatePoint)}};function zf(e,t){return t?{point:t(e.point)}:e}function Bf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vf({point:e},t){return{point:e,delta:Bf(e,Uf(t)),offset:Bf(e,Hf(t)),velocity:Wf(t,.1)}}function Hf(e){return e[0]}function Uf(e){return e[e.length-1]}function Wf(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Uf(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>gr(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>gr(t)*2&&(r=e[1]);let a=_r(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 Gf(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?qi(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?qi(n,e,r.max):Math.min(e,n)),e}function Kf(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 qf(e,{top:t,left:n,bottom:r,right:i}){return{x:Kf(e.x,n,i),y:Kf(e.y,t,r)}}function Jf(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 Yf(e,t){return{x:Jf(e.x,t.x),y:Jf(e.y,t.y)}}function Xf(e,t){let n=.5,r=du(e),i=du(t);return i>r?n=mr(t.min,t.max-r,e.min):r>i&&(n=mr(e.min,e.max-i,t.min)),ar(0,1,n)}function Zf(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 Qf=.35;function $f(e=Qf){return e===!1?e=0:e===!0&&(e=Qf),{x:ep(e,`left`,`right`),y:ep(e,`top`,`bottom`)}}function ep(e,t,n){return{min:tp(e,t),max:tp(e,n)}}function tp(e,t){return typeof e==`number`?e:e[t]||0}var np=new WeakMap,rp=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=Rc(),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(jf(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),Nu(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Si.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=du(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&Kr.update(()=>i(e,t),!1,!0),ys(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=sp(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&&Kr.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 Rf(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Pf(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&&Kr.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||!op(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Gf(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&&vf(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=qf(n.layoutBox,e):this.constraints=!1,this.elastic=$f(t),r!==this.constraints&&!vf(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Nu(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Zf(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!vf(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=wl(n,r.root,this.visualElement.getTransformPagePoint()),a=Yf(r.layout.layoutBox,i);if(t){let e=t(al(a));this.hasMutatedConstraints=!!e,e&&(a=il(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Nu(o=>{if(!op(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 ys(this.visualElement,e),n.start(rs(e,n,0,t,this.visualElement,!1))}stopAnimation(){Nu(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){Nu(t=>{let{drag:n}=this.getProps();if(!op(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]-qi(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!vf(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};Nu(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Xf({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(),Nu(t=>{if(!op(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(qi(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;np.set(this.visualElement,this);let e=this.visualElement.current,t=Nf(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&lc(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();vf(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=ap(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Kr.read(r);let o=Gu(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Nu(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=Qf,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function ip(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function ap(e,t,n){let r=jc(e,ip(n)),i=jc(t,ip(n));return()=>{r(),i()}}function op(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function sp(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var cp=class extends rl{constructor(e){super(e),this.removeGroupControls=dr,this.removeListeners=dr,this.controls=new rp(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dr}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()}},lp=e=>(t,n)=>{e&&Kr.update(()=>e(t,n),!1,!0)},up=class extends rl{constructor(){super(...arguments),this.removePointerDownListener=dr}onPointerDown(e){this.session=new Rf(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Pf(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:lp(e),onStart:lp(t),onMove:lp(n),onEnd:(e,t)=>{delete this.session,r&&Kr.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Nf(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},dp=!1,fp=class extends b.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),dp&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Zu.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}),dp=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Kr.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(),Xs.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;dp=!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 pp(e){let[t,n]=Pd(),r=(0,b.useContext)($n);return(0,M.jsx)(fp,{...e,layoutGroup:r,switchLayoutGroup:(0,b.useContext)(_f),isPresent:t,safeToRemove:n})}var mp={pan:{Feature:up},drag:{Feature:cp,ProjectionNode:Nd,MeasureLayout:pp}};function hp(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Kr.postRender(()=>i(t,jf(t)))}var gp=class extends rl{mount(){let{current:e}=this.node;e&&(this.unmount=rc(e,(e,t)=>(hp(this.node,t,`Start`),e=>hp(this.node,e,`End`))))}unmount(){}},_p=class extends rl{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=pr(Gu(this.node.current,`focus`,()=>this.onFocus()),Gu(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function vp(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&&Kr.postRender(()=>i(t,jf(t)))}var yp=class extends rl{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=gc(e,(e,t)=>(vp(this.node,t,`Start`),(e,{success:t})=>vp(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},bp=new WeakMap,xp=new WeakMap,Sp=e=>{let t=bp.get(e.target);t&&t(e)},Cp=e=>{e.forEach(Sp)};function wp({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(Cp,{root:e,...t})),r[i]}function Tp(e,t,n){let r=wp(t);return bp.set(e,n),r.observe(e),()=>{bp.delete(e),r.unobserve(e)}}var Ep={some:0,all:1},Dp=class extends rl{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:Ep[r]};this.stopObserver=Tp(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(Op(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Op({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var kp={inView:{Feature:Dp},tap:{Feature:yp},focus:{Feature:_p},hover:{Feature:gp}},Ap={layout:{ProjectionNode:Nd,MeasureLayout:pp}},jp=Ef({...Af,...kp,...mp,...Ap},Df);function Mp(e,t){return t.forEach(function(t){t&&typeof t!=`string`&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!==`default`&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var Np=Object.defineProperty,Pp=(e,t,n)=>t in e?Np(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fp=(e,t,n)=>Pp(e,typeof t==`symbol`?t:t+``,n),Ip=class{constructor(){Fp(this,`_locking`),Fp(this,`_locks`),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e,t=new Promise(t=>e=()=>{--this._locks,t()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function Lp(e,t){if(!e)throw Error(t)}var Rp=34028234663852886e22,zp=-34028234663852886e22,Bp=4294967295,Vp=2147483647,Hp=-2147483648;function Up(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>Vp||e<Hp)throw Error(`invalid int 32: `+e)}function Wp(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>Bp||e<0)throw Error(`invalid uint 32: `+e)}function Gp(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>Rp||e<zp))throw Error(`invalid float 32: `+e)}var Kp=Symbol(`@bufbuild/protobuf/enum-type`);function qp(e){let t=e[Kp];return Lp(t,`missing enum type on enum object`),t}function Jp(e,t,n,r){e[Kp]=Yp(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})))}function Yp(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=Zp(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function Xp(e,t,n){let r={};for(let e of t){let t=Zp(e);r[t.localName]=t.no,r[t.no]=t.localName}return Jp(r,e,t),r}function Zp(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var Qp=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function $p(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new Qp),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function em(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function tm(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}var nm=4294967296;function rm(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=nm&&(i+=r/nm|0,r%=nm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?cm(r,i):sm(r,i)}function im(e,t){let n=sm(e,t),r=n.hi&2147483648;r&&(n=cm(n.lo,n.hi));let i=am(n.lo,n.hi);return r?`-`+i:i}function am(e,t){if({lo:e,hi:t}=om(e,t),t<=2097151)return String(nm*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+lm(o)+lm(a)}function om(e,t){return{lo:e>>>0,hi:t>>>0}}function sm(e,t){return{lo:e|0,hi:t|0}}function cm(e,t){return t=~t,e?e=~e+1:t+=1,sm(e,t)}var lm=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function um(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function dm(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function fm(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`int64 invalid: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}let t=e=>Lp(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Lp(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),t(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),t(e),rm(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),n(e),rm(e)},dec(e,t){return im(e,t)},uDec(e,t){return am(e,t)}}}var pm=fm(),z;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(z||={});var mm;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(mm||={});function hm(e,t,n){if(t===n)return!0;if(e==z.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return t==n}return!1}function gm(e,t){switch(e){case z.BOOL:return!1;case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return t==0?pm.zero:`0`;case z.DOUBLE:case z.FLOAT:return 0;case z.BYTES:return new Uint8Array;case z.STRING:return``;default:return 0}}function _m(e,t){switch(e){case z.BOOL:return t===!1;case z.STRING:return t===``;case z.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var vm;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(vm||={});var ym=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Wp(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return Up(e),um(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Gp(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Wp(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Up(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Up(e),e=(e<<1^e>>31)>>>0,um(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=pm.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=pm.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=pm.enc(e);return tm(t.lo,t.hi,this.buf),this}sint64(e){let t=pm.enc(e),n=t.hi>>31;return tm(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=pm.uEnc(e);return tm(t.lo,t.hi,this.buf),this}},bm=class{constructor(e,t){this.varint64=em,this.uint32=dm,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case vm.Varint:for(;this.buf[this.pos++]&128;);break;case vm.Bit64:this.pos+=4;case vm.Bit32:this.pos+=4;break;case vm.LengthDelimited:let n=this.uint32();this.pos+=n;break;case vm.StartGroup:for(;;){let[e,n]=this.tag();if(n===vm.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return pm.dec(...this.varint64())}uint64(){return pm.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,pm.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return pm.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return pm.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function xm(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function Sm(e){let t=e.field.localName,n=Object.create(null);return n[t]=Cm(e),[n,()=>n[t]]}function Cm(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return gm(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function wm(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}var Tm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Em=[];for(let e=0;e<Tm.length;e++)Em[Tm[e].charCodeAt(0)]=e;Em[45]=Tm.indexOf(`+`),Em[95]=Tm.indexOf(`/`);var Dm={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=Em[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case`
|
|
33
|
+
`,document.head.appendChild(e)};function Rn(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(mn(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(e.textContent.replace(/\s+/g,` `).toLowerCase().trim()===n)return e;for(let e of i){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.startsWith(n)||t.endsWith(n))return e}let a=[];for(let e of i){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();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=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();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=n.textContent.replace(/\s+/g,` `).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=>!mn(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(mn(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(mn(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(mn(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=>!mn(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(mn(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<800)return e}return null}function zn(e,{speaking:t=!1,scroll:n=!0}={}){if(!e||typeof document>`u`)return;Ln();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 Bn(){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`))}async function Vn(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 Hn(e,{siteId:t,apiBaseUrl:n}){if(!e)return!1;if(!t||!n)return console.warn(`[FlowEngage] shouldProceedWithNavigation: missing siteId or apiBaseUrl`),Vn(e);let r=String(n).replace(/\/$/,``),i=new URLSearchParams({siteId:String(t),url:String(e).trim()});try{let t=await(await fetch(`${r}/api/widget/navigate-allowed?${i.toString()}`)).json().catch(()=>({}));return t.success&&t.allowed?!0:Vn(e)}catch(t){return console.warn(`[FlowEngage] navigate-allowed check failed:`,t?.message),Vn(e)}}async function Un(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}Pn();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 Fn(),!1;let o=await a.text(),s=new DOMParser().parseFromString(o,`text/html`),c=document.getElementById(`flowengage-root`);if(!c)return Fn(),!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()}),Tn();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(wn,`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(wn,`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,hn(`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){hn(`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,hn(`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){hn(`trySpaNavigate: blocked location.assign from replayed script:`,e);return}return d(e)},window.location.replace=e=>{if(p){hn(`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;hn(`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)){hn(`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{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:`)&&(hn(`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`)||``}),hn(`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),hn(`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(xn(),Cn(),n){try{On()}catch{}try{jn()}catch{}}else window.scrollTo(0,0);Fn(),Mn(e);try{sessionStorage.removeItem(gn)}catch{}try{sessionStorage.removeItem(vn)}catch{}try{bn=new URL(e,window.location.origin).pathname}catch{}return hn(`trySpaNavigate: succeeded →`,e),!0}catch{return clearTimeout(i),Fn(),!1}}var Wn=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),M=s(((e,t)=>{t.exports=Wn()}))(),Gn=e=>!e||typeof e!=`string`?e:e.replace(/<human_assistance_request>[\s\S]*?<\/human_assistance_request>/gi,``).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(),Kn=(e=[])=>e.map(e=>({...e,message:Gn(e.message),isPending:!1,id:e.messageId||`${e.sender}-${e.timestamp||Date.now()}-${Math.random()}`})),qn=(e,t)=>e?typeof e==`string`?e:e.message||e.error||e.reason||t:t,Jn=(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}:{}}},Yn=e=>{if(!e)return null;let t=typeof e==`object`?e:{candidate:e};return{hasCandidate:!!t.candidate,sdpMid:t.sdpMid??null,sdpMLineIndex:t.sdpMLineIndex??null,candidatePreview:typeof t.candidate==`string`?t.candidate.slice(0,80):null}},Xn=(e=[],t=`Agent`)=>{for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return t},Zn=(e=[],t,n=6)=>!t?.message||e.slice(-n).some(e=>e.sender===`system`&&e.message===t.message)?e:[...e,t];function Qn({siteId:e,config:t,children:n,language:r=`en`}){let i=(0,b.useMemo)(()=>e?{...t||{},siteId:e}:t||null,[e,t]),[a,o]=(0,b.useState)(`booting`),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)([]),[h,g]=(0,b.useState)(me().isOpen),[_,v]=(0,b.useState)(me().activeScreen),[y,x]=(0,b.useState)(me().isHumanHandled),[S,C]=(0,b.useState)(me().agentName),[te,w]=(0,b.useState)(me().agentHeadshot),[ae,oe]=(0,b.useState)(()=>ge(i?.siteId)),[ue,T]=(0,b.useState)(!1),[E,de]=(0,b.useState)(!1),[ve,ye]=(0,b.useState)(`idle`),[Ce,we]=(0,b.useState)(!1),[Te,Ee]=(0,b.useState)(!1),[De,Oe]=(0,b.useState)(``),[ke,Ae]=(0,b.useState)(!1),[je,Me]=(0,b.useState)(!1),[D,Ne]=(0,b.useState)(null),[Pe,Fe]=(0,b.useState)(null),[Ie,Le]=(0,b.useState)(`idle`),[Re,ze]=(0,b.useState)(null),[Be,Ve]=(0,b.useState)(!1),[He,Ue]=(0,b.useState)(``),We=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(``),Ge=(0,b.useRef)(null),A=(0,b.useRef)(null),Ke=(0,b.useRef)(null),qe=(0,b.useRef)(null),Je=(0,b.useRef)(null),Ye=(0,b.useRef)([]),Xe=(0,b.useRef)(null),Ze=(0,b.useRef)(null),Qe=(0,b.useRef)(!1),$e=(0,b.useRef)(!1),et=(0,b.useRef)(``),tt=(0,b.useRef)(S),nt=(0,b.useRef)([]),rt=(0,b.useRef)(!1),it=(0,b.useRef)({notifyRouteChange:()=>{},cleanup:()=>{}}),at=(0,b.useCallback)((e={})=>{let t=!!e.is_human_handled;return x(t),t?(v(`agent`),e.agent_info?.name&&C(e.agent_info.name),e.agent_info?.headshot&&w(e.agent_info.headshot),t):(v(`ai`),t)},[]),ot=(0,b.useMemo)(()=>{let e=l?.widgetSettings?.call?.maxDurationSeconds??i?.widgetSettings?.call?.maxDurationSeconds??i?.callMaxDurationSeconds,t=Number(e);return Number.isFinite(t)&&t>0?t:re},[i,l]);(0,b.useEffect)(()=>{Ge.current=D},[D]),(0,b.useEffect)(()=>{tt.current=S},[S]);let st=()=>{Ue(``)},ct=e=>{let t=typeof e==`string`?e.trim().toLowerCase():``;return oe(t),_e(t,i?.siteId),t};(0,b.useEffect)(()=>{let e=i?.siteId;e&&oe(ge(e))},[i?.siteId]);let lt=(e=`unspecified`)=>{console.log(`[FlowEngageCall] cleanup:start`,{reason:e,chatId:k.current,activeCallId:Xe.current,acceptingCallId:Ze.current,hasPeerConnection:!!A.current,hasLocalStream:!!Ke.current,hasRemoteAudio:!!qe.current,queuedIceCount:Ye.current.length}),A.current&&=(A.current.close(),null),Ke.current&&=(Ke.current.getTracks().forEach(e=>e.stop()),null),qe.current&&=(qe.current.srcObject=null,qe.current.remove(),null),Je.current=null,Ye.current=[],Xe.current=null,Ze.current=null,Qe.current=!1,Ve(!1),Ne(null),Fe(null),Le(`idle`),ze(null),console.log(`[FlowEngageCall] cleanup:complete`,{reason:e,chatId:k.current})},ut=(e=new Date().toISOString())=>{let t=We.current,n=Xe.current||Je.current?.callId;if(!t?.connected||!n||Qe.current){console.log(`[FlowEngageProvider] skipping call:connected emit`,{callId:n,chatId:k.current,socketConnected:!!t?.connected,alreadyReported:Qe.current});return}console.log(`[FlowEngageProvider] emitting call:connected`,{callId:n,chatId:k.current,connectedAt:e}),Qe.current=!0,t.emit(`call:connected`,{callId:n,chatId:k.current,connectedAt:e})},dt=(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Ge.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(console.log(`[FlowEngageProvider] syncing accepted call state`,{callId:e.callId,chatId:e.chatId||k.current,isAcceptingHere:t,isAlreadyActive:n,isIncomingHere:r}),Ne(null),t||n){Xe.current=e.callId,Fe(e.callId),Le(e=>e===`connected`?e:`connecting`),g(!0);return}Le(`idle`)}},ft=(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Ge.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(console.log(`[FlowEngageProvider] syncing ended incoming call state`,{callId:e.callId,chatId:e.chatId||k.current,isAcceptingHere:t,isAlreadyActive:n,isIncomingHere:r,reason:e.reason||e.status||null}),n){lt();return}Ze.current=null,Je.current=null,Ye.current=[],Ne(null),Le(`idle`)}},pt=async(e={})=>{let t=A.current,n=We.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:k.current,hasPeerConnection:!!t,socketConnected:!!n?.connected,hasOffer:!!r}),Je.current=e;return}if(console.log(`[FlowEngageProvider] applying remote offer`,{callId:e.callId,chatId:k.current,offerLength:r.length,signalingState:t.signalingState,iceConnectionState:t.iceConnectionState,connectionState:t.connectionState}),await t.setRemoteDescription(new RTCSessionDescription({type:`offer`,sdp:r})),Ye.current.length>0){console.log(`[FlowEngageProvider] flushing queued agent ICE candidates after remote offer`,{callId:e.callId,chatId:k.current,queuedCount:Ye.current.length});for(let e of Ye.current)await t.addIceCandidate(new RTCIceCandidate(e));Ye.current=[]}let i=await t.createAnswer();await t.setLocalDescription(i),console.log(`[FlowEngageCall] local-answer:created`,{callId:e.callId,chatId:k.current,answerLength:i.sdp?.length||0,signalingState:t.signalingState,iceConnectionState:t.iceConnectionState,connectionState:t.connectionState}),console.log(`[FlowEngageCall] local-answer:emitting`,{callId:e.callId,chatId:k.current}),n.emit(`call:answer`,{callId:e.callId,sdpAnswer:i.sdp,chatId:k.current})};(0,b.useEffect)(()=>{he({isOpen:h,activeScreen:_,isHumanHandled:y,agentName:S,agentHeadshot:te})},[h,_,y,S,te]),(0,b.useEffect)(()=>{let e=!0;return(async()=>{try{console.log(`[FlowEngageProvider] boot start`,{resolvedConfig:i,language:r});let t=ee(i);console.log(`[FlowEngageProvider] config validated`,t);let n=await xe(t);if(!e)return;let a=t.siteId,s=fe(a),c=``;try{if(c=(await be({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:a,priorChatId:s||se()}))?.data?.chatId,!c)throw Error(`resolve-session returned no chatId`);ce(),pe(a,c)}catch(e){console.warn(`[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id`,e?.message||e),c=s||le(),pe(a,c)}k.current=c;let l=Se({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:t.siteId});O.current=l,u({...n,apiBaseUrl:t.apiBaseUrl}),f(c);let d=n?.widgetSettings?.branding?.fallbackAgentName||`Agent`;console.log(`[FlowEngageProvider] bootstrap resolved`,{bootstrapData:n,resolvedChatId:c});let p=ln({apiBaseUrl:t.apiBaseUrl,userId:n.userId,chatId:c,siteId:t.siteId});We.current=p,p.on(`connect`,()=>{console.log(`[FlowEngageProvider] socket connected`),ye(`connected`)}),p.on(`disconnect`,()=>{console.log(`[FlowEngageProvider] socket disconnected`),ye(`disconnected`)}),p.on(`aiTyping`,()=>{console.log(`[FlowEngageProvider] received aiTyping`,{chatId:k.current}),de(!0)}),p.on(`ai:typing`,()=>{console.log(`[FlowEngageProvider] received ai:typing`,{chatId:k.current}),de(!0)}),p.on(`messageReceived`,e=>{let t=e.message||e,n={...t,message:Gn(t.message)};de(!1),T(!1),m(e=>[...e.filter(e=>!e.isPending),{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}])}),p.on(`conversationStarted`,e=>{console.log(`[FlowEngageProvider] conversationStarted`,e),e?.message&&m(t=>[...t,{id:`system-start-${Date.now()}`,sender:`system`,message:e.message,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`message:new`,e=>{let t=e.message||e,n={...t,message:Gn(t.message)};de(!1),(n.sender===`agent`||n.agent_name||n.sender===`ai`||n.sender===`bot`)&&T(!1),m(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)&&(x(!0),v(`agent`),C(Xn([n.agent_name,n.agentName,n.metadata?.agentName],d)),n.sender_headshot&&w(n.sender_headshot),g(!0))});let h=(e={})=>{let t=Xn([e.agent?.name,e.agentName,e.agent_name,tt.current],d);x(!0),v(`agent`),C(t),w(e.agent?.headshot||null),g(!0),m(e=>Zn(e,{id:`agent-joined-${Date.now()}`,sender:`system`,message:`${t} has joined the chat.`,timestamp:new Date().toISOString(),isPending:!1}))},y=(e={})=>{let t=Xn([e.agent?.name,e.agentName,e.agent_name,tt.current],d);x(!1),v(`ai`),m(e=>Zn(e,{id:`agent-left-${Date.now()}`,sender:`system`,message:`${t} has left the chat.`,timestamp:new Date().toISOString(),isPending:!1}))};p.on(`agent:joined`,h),p.on(`agentJoined`,h),p.on(`agent:left`,y),p.on(`agentLeft`,y),p.on(`conversationEnded`,e=>{Me(!0);let t=e?.message||`This conversation has ended. Thank you for reaching out!`;m(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:t,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`chat:history_update`,e=>{m(Kn(e.chat_history||[]))}),p.on(`typing:start`,e=>{console.log(`[FlowEngageProvider] received typing:start`,{chatId:e?.chatId||k.current,sender:e?.sender}),e.sender===`agent`&&T(!0)}),p.on(`typing:stop`,e=>{console.log(`[FlowEngageProvider] received typing:stop`,{chatId:e?.chatId||k.current,sender:e?.sender}),e.sender===`agent`&&T(!1)}),p.on(`call:incoming`,(e={})=>{let t=Xn([e.agentName,e.ownerName,e.agent?.name,tt.current],`Agent`);console.log(`[FlowEngageProvider] received call:incoming`,{callId:e.callId,chatId:k.current,agentName:t}),st(),Qe.current=!1,Ne({callId:e.callId,from:e.from||`owner`,agentId:e.agentId||null,agentName:t}),C(e=>Xn([t,e],`Agent`)),Le(`incoming`),ze(null),g(!0)}),p.on(`call:offer`,async(e={})=>{console.log(`[FlowEngageProvider] received call:offer`,{callId:e.callId,chatId:e.chatId||k.current,offerLength:(e.sdpOffer||e.offer?.sdp||``).length}),Je.current=e;try{await pt(e)}catch(e){console.error(`[FlowEngageProvider] failed to apply remote offer`,e)}}),p.on(`call:ice-candidate-from-agent`,async(e={})=>{if(!e.candidate){console.log(`[FlowEngageProvider] skipping agent ICE candidate`,{callId:e.callId,chatId:e.chatId||k.current,hasPeerConnection:!!A.current,hasCandidate:!!e.candidate});return}try{let t=Jn(e);if(!t){console.warn(`[FlowEngageProvider] ignoring invalid ICE candidate payload`,e);return}if(console.log(`[FlowEngageProvider] adding agent ICE candidate`,{callId:e.callId,chatId:e.chatId||k.current,candidate:Yn(t),hasRemoteDescription:!!A.current?.remoteDescription}),!A.current||!A.current.remoteDescription){console.log(`[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready`,{callId:e.callId,chatId:e.chatId||k.current,queueSize:Ye.current.length+1}),Ye.current.push(t);return}await A.current.addIceCandidate(new RTCIceCandidate(t))}catch(e){console.error(`[FlowEngageProvider] failed to add ICE candidate`,e)}}),p.on(`call:ended`,()=>{st(),console.log(`[FlowEngageCall] socket:event call:ended`,{chatId:k.current,activeCallId:Xe.current}),lt(`socket:call_ended`)}),p.on(`call:accepted`,(e={})=>{console.log(`[FlowEngageProvider] received call:accepted`,{callId:e.callId,chatId:e.chatId||k.current}),dt(e)}),p.on(`call:accepted_by_other`,(e={})=>{console.log(`[FlowEngageProvider] received call:accepted_by_other`,{callId:e.callId,chatId:e.chatId||k.current}),dt(e)}),p.on(`call:rejected`,(e={})=>{console.log(`[FlowEngageProvider] received call:rejected`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:missed`,(e={})=>{console.log(`[FlowEngageProvider] received call:missed`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:failed`,(e={})=>{console.log(`[FlowEngageProvider] received call:failed`,{callId:e.callId,chatId:e.chatId||k.current,reason:e.reason}),ft(e)}),p.on(`call:connected`,(e={})=>{if(!e.callId)return;let t=Ze.current===e.callId,n=Xe.current===e.callId,r=Je.current?.callId===e.callId,i=Ge.current?.callId===e.callId;if(console.log(`[FlowEngageProvider] received call:connected`,{callId:e.callId,chatId:e.chatId||k.current,connectedAt:e.connectedAt,status:e.status,isAcceptingHere:t,isAlreadyActive:n,isPendingOfferHere:r,isIncomingHere:i}),!t&&!n&&!r){i&&(Ne(null),Le(`idle`));return}Qe.current=!0,Ze.current=null,Xe.current=e.callId,Fe(e.callId),Ne(null),Le(`connected`),ze(e.connectedAt||new Date().toISOString()),g(!0)}),p.on(`call:unavailable`,(e={})=>{console.warn(`[FlowEngageCall] socket:event call:unavailable`,{chatId:e.chatId||k.current,callId:e.callId,reason:e.reason||e.message||null,raw:e}),lt(`socket:call_unavailable`),Ue(qn(e,`This visitor is not available for a call right now.`)),g(!0)}),p.on(`call:error`,(e={})=>{console.error(`[FlowEngageCall] socket:event call:error`,{chatId:e.chatId||k.current,callId:e.callId,reason:e.reason||e.message||null,raw:e}),lt(`socket:call_error`),Ue(qn(e,`We couldn't connect the call right now.`)),g(!0)}),p.on(`visitor:navigate`,async({url:e,section:t,highlight:n}={})=>{console.log(`[FlowEngageProvider] visitor:navigate DISABLED — ignoring navigation to`,e,{section:t,highlight:n})}),p.on(`visitor:highlight`,({sectionId:e,sectionText:t}={})=>{if(!e&&!t)return;console.log(`[FlowEngageProvider] visitor:highlight`,{sectionId:e,sectionText:t});let n=Rn(e||null,t||null);n&&zn(n)}),p.on(`visitor:clear_highlight`,()=>{Bn()}),it.current=un({socket:p,chatId:c}),console.log(`[FlowEngageProvider] tracking started`,{chatId:c});let b=await l.loadHistory(c,r);if(console.log(`[FlowEngageProvider] history loaded`,b),!e)return;m(Kn(b.chat_history||[])),x(!!b.is_human_handled),v(b.is_human_handled?`agent`:_);let S=b?.visitor_email||b?.visitorEmail;if(S&&String(S).trim()&&ct(String(S).trim()),await new Promise(e=>setTimeout(e,500)),!e)return;o(`ready`),console.log(`[FlowEngageProvider] status ready`)}catch(t){if(!e)return;console.error(`[FlowEngageProvider] boot failed`,t),c(t),o(`error`)}})(),()=>{e=!1,it.current?.cleanup?.(),lt(),We.current?.disconnect()}},[i,r]),(0,b.useEffect)(()=>()=>{if(ke&&!rt.current&&nt.current.length>0){let e=k.current,t=nt.current,n=O.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(()=>{}),rt.current=!0)}},[ke,l]),(0,b.useEffect)(()=>{if(!O.current||!d||a!==`ready`)return;let e=window.setInterval(async()=>{try{let e=await O.current.checkHumanHandled(d);x(!!e.is_human_handled),e.is_human_handled&&(v(`agent`),e.agent_info?.name&&C(Xn([e.agent_info.name],`Agent`)),e.agent_info?.headshot&&w(e.agent_info.headshot)),at(e)}catch{}},1e4);return()=>window.clearInterval(e)},[d,a,at]);let mt=async()=>{if(!(!D?.callId||!O.current||!We.current||!d)){st(),Ze.current=D.callId,console.log(`[FlowEngageProvider] acceptCall started`,{callId:D?.callId,chatId:d,socketConnected:!!We.current?.connected,hasPendingOffer:!!Je.current});try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});console.log(`[FlowEngageProvider] microphone stream acquired`,{callId:D.callId,chatId:d,trackCount:e.getTracks().length}),Ke.current=e;let t=[{urls:`stun:stun.l.google.com:19302`}];try{let e=await O.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});A.current=n,console.log(`[FlowEngageCall] peer-connection:created`,{callId:D.callId,chatId:d,iceServers:1}),n.onconnectionstatechange=()=>{let e=n.connectionState;if(console.log(`[FlowEngageProvider] peer connection state changed`,{callId:D.callId,chatId:d,connectionState:e,iceConnectionState:n.iceConnectionState,signalingState:n.signalingState}),e===`connected`){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),ut(e);return}if(e===`connecting`){Le(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`disconnected`||e===`closed`)&&console.warn(`[FlowEngageCall] peer-connection:terminal-state`,{callId:D.callId,chatId:d,connectionState:e,iceConnectionState:n.iceConnectionState,signalingState:n.signalingState})},n.oniceconnectionstatechange=()=>{let e=n.iceConnectionState;if(console.log(`[FlowEngageProvider] ICE connection state changed`,{callId:D.callId,chatId:d,iceConnectionState:e,connectionState:n.connectionState,signalingState:n.signalingState}),e===`connected`||e===`completed`){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),ut(e);return}if(e===`checking`||e===`new`){Le(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`disconnected`||e===`closed`)&&console.warn(`[FlowEngageCall] ice-connection:terminal-state`,{callId:D.callId,chatId:d,iceConnectionState:e,connectionState:n.connectionState,signalingState:n.signalingState})},n.onsignalingstatechange=()=>{console.log(`[FlowEngageCall] signaling-state:changed`,{callId:D.callId,chatId:d,signalingState:n.signalingState,connectionState:n.connectionState,iceConnectionState:n.iceConnectionState})},n.onicegatheringstatechange=()=>{console.log(`[FlowEngageCall] ice-gathering-state:changed`,{callId:D.callId,chatId:d,iceGatheringState:n.iceGatheringState})},e.getTracks().forEach(t=>{console.log(`[FlowEngageCall] local-track:added`,{callId:D.callId,chatId:d,kind:t.kind,enabled:t.enabled,readyState:t.readyState,muted:t.muted,label:t.label}),n.addTrack(t,e)}),n.onicecandidate=e=>{if(!e.candidate||!We.current?.connected){console.log(`[FlowEngageProvider] local ICE candidate skipped`,{callId:D.callId,chatId:d,hasCandidate:!!e.candidate,socketConnected:!!We.current?.connected});return}let t=e.candidate;console.log(`[FlowEngageProvider] emitting local ICE candidate`,{callId:D.callId,chatId:d,candidate:Yn(t)}),We.current.emit(`call:ice-candidate`,{callId:D.callId,candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,chatId:d,from:`customer`})},n.ontrack=e=>{console.log(`[FlowEngageProvider] remote audio track received`,{callId:D.callId,chatId:d,streamCount:e.streams?.length||0});let[t]=e.streams||[],[n]=t?.getAudioTracks?.()||[];if(console.log(`[FlowEngageCall] remote-track:details`,{callId:D.callId,chatId:d,trackKind:e.track?.kind||null,trackEnabled:e.track?.enabled??null,trackMuted:e.track?.muted??null,trackReadyState:e.track?.readyState??null,streamId:t?.id||null,audioTrackCount:t?.getAudioTracks?.().length||0,firstAudioTrackState:n?{enabled:n.enabled,muted:n.muted,readyState:n.readyState,label:n.label}:null}),!qe.current){let e=document.createElement(`audio`);e.id=`flowengage-remote-audio`,e.autoplay=!0,e.playsInline=!0,e.onplay=()=>{console.log(`[FlowEngageCall] remote-audio:onplay`,{callId:D.callId,chatId:d})},e.onpause=()=>{console.warn(`[FlowEngageCall] remote-audio:onpause`,{callId:D.callId,chatId:d,currentTime:e.currentTime})},e.onended=()=>{console.warn(`[FlowEngageCall] remote-audio:onended`,{callId:D.callId,chatId:d,currentTime:e.currentTime})},e.onerror=t=>{console.error(`[FlowEngageCall] remote-audio:onerror`,{callId:D.callId,chatId:d,error:e.error?{code:e.error.code,message:e.error.message}:null,raw:t})},qe.current=e,document.body.appendChild(e)}qe.current.srcObject=e.streams[0];let r=D?.callId,i=r&&(Ze.current===r||Xe.current===r);if(!Qe.current&&i){let e=new Date().toISOString();Le(`connected`),ze(t=>t||e),Xe.current=r,Fe(r),ut(e)}qe.current.srcObject=t||null;let a=qe.current.play?.();a?.catch&&a.catch(e=>{console.error(`[FlowEngageCall] remote-audio:play-failed`,{callId:D.callId,chatId:d,message:e?.message,name:e?.name,raw:e})})};let r=Je.current;r&&(console.log(`[FlowEngageProvider] found pending remote offer during accept`,{callId:r.callId||D.callId,chatId:d}),await pt({...r,callId:r.callId||D.callId})),await O.current.acceptCall(D.callId,d),console.log(`[FlowEngageProvider] acceptCall API succeeded`,{callId:D.callId,chatId:d}),Xe.current=D.callId,Fe(D.callId),Le(e=>e===`connected`||Qe.current?`connected`:`connecting`),Ne(null),g(!0)}catch(e){if(console.error(`[FlowEngageProvider] acceptCall failed`,e),Ze.current=null,lt(`accept_call_failed`),e?.status===404||e?.status===409||e?.status===422){Ue(qn(e,`This visitor call is no longer available.`));return}if(e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`){try{await O.current.rejectCall(D.callId,d)}catch(e){console.error(`[FlowEngageProvider] failed to reject call after microphone denial`,e)}Ue(`Microphone access was denied. Please allow microphone access to accept the call.`);return}Ue(`We couldn't connect the call right now. Please try again.`)}}},ht=async()=>{if(!D?.callId||!O.current||!d){lt(`reject_call_without_server_context`);return}st();try{await O.current.rejectCall(D.callId,d)}catch(e){console.error(`[FlowEngageProvider] rejectCall failed`,e),Ue(qn(e,`We couldn't decline the call cleanly.`))}finally{lt(`reject_call_finally`)}},gt=(0,b.useRef)(ht);gt.current=ht,(0,b.useEffect)(()=>{if(!D?.callId||Pe)return;let e=D.callId,t=window.setTimeout(()=>{Ge.current?.callId===e&>.current()},ie);return()=>window.clearTimeout(t)},[D?.callId,Pe]);let _t=async()=>{if(!Pe||!O.current||!d){lt(`end_call_without_server_context`);return}st();try{await O.current.endWebRTCCall(Pe,d)}catch(e){console.error(`[FlowEngageProvider] endWebRTCCall failed`,e),Ue(qn(e,`The call ended locally, but the server could not be updated.`))}finally{lt(`end_call_finally`)}},vt=()=>{let e=Ke.current?.getAudioTracks?.()||[],t=A.current?.getSenders?.().map(e=>e.track).filter(e=>e?.kind===`audio`)||[],n=[...e,...t].filter(Boolean);if(n.length===0){console.warn(`[FlowEngageProvider] no local audio tracks available for mute`);return}let r=!Be;n.forEach(e=>{e.enabled=!r}),console.log(`[FlowEngageProvider] toggled local mute`,{nextMuted:r,trackCount:n.length}),Ve(r)},yt=async(e={})=>{let t=e.notifyChatInitiated===!0;if(g(!0),!(!t||!O.current||!d||typeof window>`u`)){try{await O.current.trackVisitor({chatId:d,currentPagePath:window.location.pathname||`/`})}catch{}try{await O.current.updateChatStatus(d,`open`)}catch{}}},bt=async e=>{let t=ct(e);if(!t||!O.current||!k.current)return t;try{await O.current.trackVisitor({chatId:k.current,currentPagePath:typeof window<`u`&&window.location.pathname||`/`,email:t})}catch(e){console.error(`[FlowEngageProvider] failed to persist visitor email`,e)}return t},xt=()=>{if(!d||!We.current?.connected||$e.current){console.log(`[FlowEngageProvider] skipped typing:start emit`,{chatId:d,socketConnected:!!We.current?.connected,alreadyTyping:$e.current});return}$e.current=!0,console.log(`[FlowEngageProvider] emitting typing:start`,{chatId:d,sender:`user`}),We.current.emit(`typing:start`,{chatId:d,sender:`user`})},St=()=>{if(!d||!We.current?.connected||!$e.current){console.log(`[FlowEngageProvider] skipped typing:stop emit`,{chatId:d,socketConnected:!!We.current?.connected,wasTyping:$e.current});return}$e.current=!1,console.log(`[FlowEngageProvider] emitting typing:stop`,{chatId:d,sender:`user`}),We.current.emit(`typing:stop`,{chatId:d,sender:`user`})},Ct=(e=``)=>{let t=typeof e==`string`?e:``;if(!d||!We.current?.connected){console.log(`[FlowEngageProvider] skipped typing:update emit`,{chatId:d,socketConnected:!!We.current?.connected,textLength:t.length});return}et.current!==t&&(et.current=t,console.log(`[FlowEngageProvider] emitting typing:update`,{chatId:d,sender:`user`,textLength:t.length}),We.current.emit(`typing:update`,{chatId:d,sender:`user`,text:t}))},wt=async(e,t=``,n=null,i={})=>{if(!(typeof e==`string`&&e.trim())||!O.current||!d||a!==`ready`||je)return;St();let o=`pending-user-${Date.now()}`,s={id:o,sender:`user`,message:e,timestamp:new Date().toISOString(),isPending:!0,type:i?.type||`text`,metadata:i?.metadata||void 0,...n||{}};m(e=>[...e,s]);let l=y;if(l)try{l=at(await O.current.checkHumanHandled(d))}catch{}if(l&&We.current?.connected){We.current.emit(`customer:message`,{chatId:d,content:e,sender:`user`,email:ae||void 0,type:i?.type||`text`,metadata:i?.metadata||{},...n||{}});return}we(!0);try{let a=await O.current.sendAiMessage(d,e,r,t,{...n||{},...ae?{email:ae}:{}},i),o=a.chat_history||[];[...o].reverse().find(e=>e.sender===`bot`||e.sender===`assistant`),m(Kn(o)),x(!!a.is_human_handled),v(a.is_human_handled?`agent`:`ai`),de(!1),await O.current.updateChatStatus(d,`messageSent`)}catch(e){m(e=>e.filter(e=>e.id!==o)),de(!1),e.status===429?(Ee(!0),Oe(e.message),window.setTimeout(()=>{Ee(!1),Oe(``)},ne)):c(e)}finally{we(!1)}},Tt=async e=>{if(!O.current||!e)throw Error(`Upload is unavailable right now.`);return O.current.uploadChatFile(e)},Et=async e=>{if(!(!O.current||!d)){try{let t=e?`voice`:`text`;await O.current.setChatMode(d,t)}catch(e){console.error(`[FlowEngageProvider] setVoiceMode failed`,e)}Ae(e),e&&(rt.current=!1)}},Dt=async e=>{if(rt.current)return;if(rt.current=!0,!O.current||!d||!e?.length){Ae(!1);return}let t=()=>{let t=Kn(e);m(e=>{if(!e.length)return t;let n=new Set(e.map(e=>`${e.sender}\0${e.message}`)),r=t.filter(e=>!n.has(`${e.sender}\0${e.message}`));return r.length?[...e,...r]:e})};try{let n=await O.current.syncVoice(d,e);if(n?.chat_history?.length)m(Kn(n.chat_history));else if(n?.success)try{let e=await O.current.loadHistory(d,r);e?.chat_history?.length?m(Kn(e.chat_history)):t()}catch{t()}else t()}catch{t()}finally{Ae(!1)}},Ot=async()=>{if(!(!O.current||!d)){ke&&!rt.current&&nt.current.length>0&&await Dt(nt.current);try{await O.current.endConversation(d)}catch{try{await O.current.updateChatStatus(d,`ended`)}catch{}}Me(!0),m(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,b.useEffect)(()=>{if(Ie!==`connected`||!Pe||!d||!Re||!ot)return;let e=new Date(Re).getTime(),t=Number.isFinite(e)?Date.now()-e:0,n=Math.max(0,ot*1e3-t),r=window.setTimeout(()=>{Ue(`The call ended because it reached the time limit.`),_t()},n);return()=>window.clearTimeout(r)},[Pe,Re,Ie,d,_t,ot]),(0,b.useEffect)(()=>{let e=()=>{let e=k.current,t=O.current;if(!t||!e)return;if(!rt.current&&nt.current.length>0&&(t.beaconSyncVoice(e,nt.current)||t.syncVoice(e,nt.current).catch(()=>{}),rt.current=!0),Xe.current){t.beaconEndWebRTCCall(Xe.current,e);return}let n=Ze.current||Ge.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 kt=(0,b.useMemo)(()=>({status:a,error:s,runtimeConfig:l,resolvedConfig:i,chatId:d,chatHistory:p,isOpen:h,activeScreen:_,isHumanHandled:y,agentName:S,agentHeadshot:te,visitorEmail:ae,isAgentTyping:ue,isAiTyping:E,connectionStatus:ve,isLoading:Ce,isVoiceMode:ke,isRateLimited:Te,rateLimitMessage:De,isConversationEnded:je,incomingCall:D,activeCallId:Pe,callConnectionState:Ie,callConnectedAt:Re,isCallMuted:Be,webRTCError:He,language:r,historyRef:nt,hasSyncedRef:rt,dismissCallError:st,captureVisitorEmail:bt,startTyping:xt,stopTyping:St,updateTypingDraft:Ct,notifyRouteChange:()=>it.current?.notifyRouteChange?.(),openWidget:yt,closeWidget:()=>g(!1),toggleWidget:()=>{if(h){g(!1);return}yt({notifyChatInitiated:!0})},sendMessage:wt,uploadChatFile:Tt,setVoiceMode:Et,onMessageSync:Dt,endConversation:Ot,acceptCall:mt,rejectCall:ht,endWebRTCCall:_t,toggleCallMute:vt}),[a,s,l,i,d,p,h,_,y,S,te,ae,ue,E,ve,Ce,ke,Te,De,je,D,Pe,Ie,Re,Be,He,r,bt,xt,St,Ct,mt,ht,_t,vt,yt,wt,Tt,Et,Dt,Ot,st]);return(0,M.jsx)(dn.Provider,{value:kt,children:n})}var $n=(0,b.createContext)({});function er(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var tr=typeof window<`u`?b.useLayoutEffect:b.useEffect,nr=(0,b.createContext)(null);function rr(e,t){e.indexOf(t)===-1&&e.push(t)}function ir(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ar=(e,t,n)=>n>t?t:n<e?e:n,or={},sr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function cr(e){return typeof e==`object`&&!!e}var lr=e=>/^0[^.\s]+$/u.test(e);function ur(e){let t;return()=>(t===void 0&&(t=e()),t)}var dr=e=>e,fr=(e,t)=>n=>t(e(n)),pr=(...e)=>e.reduce(fr),mr=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},hr=class{constructor(){this.subscriptions=[]}add(e){return rr(this.subscriptions,e),()=>ir(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}},gr=e=>e*1e3,_r=e=>e/1e3;function vr(e,t){return t?1e3/t*e:0}var yr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,br=1e-7,xr=12;function Sr(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=yr(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>br&&++s<xr);return o}function Cr(e,t,n,r){if(e===t&&n===r)return dr;let i=t=>Sr(t,0,1,e,n);return e=>e===0||e===1?e:yr(i(e),t,r)}var wr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Tr=e=>t=>1-e(1-t),Er=Cr(.33,1.53,.69,.99),Dr=Tr(Er),Or=wr(Dr),kr=e=>e>=1?1:(e*=2)<1?.5*Dr(e):.5*(2-2**(-10*(e-1))),Ar=e=>1-Math.sin(Math.acos(e)),jr=Tr(Ar),Mr=wr(Ar),Nr=Cr(.42,0,1,1),Pr=Cr(0,0,.58,1),Fr=Cr(.42,0,.58,1),Ir=e=>Array.isArray(e)&&typeof e[0]!=`number`,Lr=e=>Array.isArray(e)&&typeof e[0]==`number`,Rr={linear:dr,easeIn:Nr,easeInOut:Fr,easeOut:Pr,circIn:Ar,circInOut:Mr,circOut:jr,backIn:Dr,backInOut:Or,backOut:Er,anticipate:kr},zr=e=>typeof e==`string`,Br=e=>{if(Lr(e)){e.length;let[t,n,r,i]=e;return Cr(t,n,r,i)}else if(zr(e))return Rr[e],`${e}`,Rr[e];return e},Vr=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Hr={value:null,addProjectionMetrics:null};function Ur(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&&Hr.value&&Hr.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Wr=40;function Gr(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Vr.reduce((e,n)=>(e[n]=Ur(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=or.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Wr),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:Vr.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<Vr.length;t++)o[Vr[t]].cancel(e)},state:i,steps:o}}var{schedule:Kr,cancel:qr,state:Jr,steps:Yr}=Gr(typeof requestAnimationFrame<`u`?requestAnimationFrame:dr,!0),Xr;function Zr(){Xr=void 0}var Qr={now:()=>(Xr===void 0&&Qr.set(Jr.isProcessing||or.useManualTiming?Jr.timestamp:performance.now()),Xr),set:e=>{Xr=e,queueMicrotask(Zr)}},$r={layout:0,mainThread:0,waapi:0},ei=e=>t=>typeof t==`string`&&t.startsWith(e),ti=ei(`--`),ni=ei(`var(--`),ri=e=>ni(e)?ii.test(e.split(`/*`)[0].trim()):!1,ii=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ai(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var oi={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},si={...oi,transform:e=>ar(0,1,e)},ci={...oi,default:1},li=e=>Math.round(e*1e5)/1e5,ui=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function di(e){return e==null}var fi=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,pi=(e,t)=>n=>!!(typeof n==`string`&&fi.test(n)&&n.startsWith(e)||t&&!di(n)&&Object.prototype.hasOwnProperty.call(n,t)),mi=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ui);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},hi=e=>ar(0,255,e),gi={...oi,transform:e=>Math.round(hi(e))},_i={test:pi(`rgb`,`red`),parse:mi(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+gi.transform(e)+`, `+gi.transform(t)+`, `+gi.transform(n)+`, `+li(si.transform(r))+`)`};function vi(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 yi={test:pi(`#`),parse:vi,transform:_i.transform},bi=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),xi=bi(`deg`),Si=bi(`%`),N=bi(`px`),Ci=bi(`vh`),wi=bi(`vw`),Ti={...Si,parse:e=>Si.parse(e)/100,transform:e=>Si.transform(e*100)},Ei={test:pi(`hsl`,`hue`),parse:mi(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Si.transform(li(t))+`, `+Si.transform(li(n))+`, `+li(si.transform(r))+`)`},Di={test:e=>_i.test(e)||yi.test(e)||Ei.test(e),parse:e=>_i.test(e)?_i.parse(e):Ei.test(e)?Ei.parse(e):yi.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?_i.transform(e):Ei.transform(e),getAnimatableNone:e=>{let t=Di.parse(e);return t.alpha=0,Di.transform(t)}},Oi=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ki(e){return isNaN(e)&&typeof e==`string`&&(e.match(ui)?.length||0)+(e.match(Oi)?.length||0)>0}var Ai=`number`,ji=`color`,Mi=`var`,Ni=`var(`,Pi="${}",Fi=/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 Ii(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Fi,e=>(Di.test(e)?(r.color.push(a),i.push(ji),n.push(Di.parse(e))):e.startsWith(Ni)?(r.var.push(a),i.push(Mi),n.push(e)):(r.number.push(a),i.push(Ai),n.push(parseFloat(e))),++a,Pi)).split(Pi),indexes:r,types:i}}function Li(e){return Ii(e).values}function Ri({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===Ai?i+=li(r[a]):e===ji?i+=Di.transform(r[a]):i+=r[a]}return i}}function zi(e){return Ri(Ii(e))}var Bi=e=>typeof e==`number`?0:Di.test(e)?Di.getAnimatableNone(e):e,Vi=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Bi(e);function Hi(e){let t=Ii(e);return Ri(t)(t.values.map((e,n)=>Vi(e,t.split[n])))}var Ui={test:ki,parse:Li,createTransformer:zi,getAnimatableNone:Hi};function Wi(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 Gi({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=Wi(s,r,e+1/3),a=Wi(s,r,e),o=Wi(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Ki(e,t){return n=>n>0?t:e}var qi=(e,t,n)=>e+(t-e)*n,Ji=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Yi=[yi,_i,Ei],Xi=e=>Yi.find(t=>t.test(e));function Zi(e){let t=Xi(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Ei&&(n=Gi(n)),n}var Qi=(e,t)=>{let n=Zi(e),r=Zi(t);if(!n||!r)return Ki(e,t);let i={...n};return e=>(i.red=Ji(n.red,r.red,e),i.green=Ji(n.green,r.green,e),i.blue=Ji(n.blue,r.blue,e),i.alpha=qi(n.alpha,r.alpha,e),_i.transform(i))},$i=new Set([`none`,`hidden`]);function ea(e,t){return $i.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ta(e,t){return n=>qi(e,t,n)}function na(e){return typeof e==`number`?ta:typeof e==`string`?ri(e)?Ki:Di.test(e)?Qi:oa:Array.isArray(e)?ra:typeof e==`object`?Di.test(e)?Qi:ia:Ki}function ra(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>na(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function ia(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=na(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function aa(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 oa=(e,t)=>{let n=Ui.createTransformer(t),r=Ii(e),i=Ii(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?$i.has(e)&&!i.values.length||$i.has(t)&&!r.values.length?ea(e,t):pr(ra(aa(r,i),i.values),n):(`${e}${t}`,Ki(e,t))};function sa(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?qi(e,t,n):na(e)(e,t)}var ca=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Kr.update(t,e),stop:()=>qr(t),now:()=>Jr.isProcessing?Jr.timestamp:Qr.now()}},la=(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)})`},ua=2e4;function da(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 fa(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(da(r),ua);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:_r(i)}}var P={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 pa(e,t){return e*Math.sqrt(1-t*t)}var ma=12;function ha(e,t,n){let r=n;for(let n=1;n<ma;n++)r-=e(r)/t(r);return r}var ga=.001;function _a({duration:e=P.duration,bounce:t=P.bounce,velocity:n=P.velocity,mass:r=P.mass}){let i,a;P.maxDuration;let o=1-t;o=ar(P.minDamping,P.maxDamping,o),e=ar(P.minDuration,P.maxDuration,_r(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=pa(t,o),c=Math.exp(-i);return ga-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=pa(t**2,o);return(-i(t)+ga>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-ga+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=ha(i,a,s);if(e=gr(e),isNaN(c))return{stiffness:P.stiffness,damping:P.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var va=[`duration`,`bounce`],ya=[`stiffness`,`damping`,`mass`];function ba(e,t){return t.some(t=>e[t]!==void 0)}function xa(e){let t={velocity:P.velocity,stiffness:P.stiffness,damping:P.damping,mass:P.mass,isResolvedFromDuration:!1,...e};if(!ba(e,ya)&&ba(e,va))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*ar(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:P.mass,stiffness:i,damping:a}}else{let n=_a({...e,velocity:0});t={...t,...n,mass:P.mass},t.isResolvedFromDuration=!0}return t}function Sa(e=P.visualDuration,t=P.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}=xa({...n,velocity:-_r(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=_r(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?P.restSpeed.granular:P.restSpeed.default,i||=v?P.restDelta.granular:P.restDelta.default;let y,b,x,ee,S,C;if(h<1)x=pa(_,h),ee=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(ee*Math.sin(x*e)+g*Math.cos(x*e)),S=h*_*ee+g*x,C=h*_*g-ee*x,b=e=>Math.exp(-h*_*e)*(S*Math.sin(x*e)+C*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 te={calculatedDuration:p&&d||null,velocity:e=>gr(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*(ee*n+g*a),l=gr(t*(S*n+C*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=gr(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(da(te),ua),t=la(t=>te.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return te}Sa.applyToOptions=e=>{let t=fa(e,100,Sa);return e.ease=t.ease,e.duration=gr(t.duration),e.type=`keyframes`,e};var Ca=5;function wa(e,t,n){let r=Math.max(t-Ca,0);return vr(n-e(r),t-r)}function Ta({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,ee,S=e=>{p(f.value)&&(x=e,ee=Sa({keyframes:[f.value,m(f.value)],velocity:wa(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!ee&&x===void 0&&(t=!0,b(e),S(e)),x!==void 0&&e>=x?ee.next(e-x):(!t&&b(e),f)}}}function Ea(e,t,n){let r=[],i=n||or.mix||sa,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pr(Array.isArray(t)?t[n]||dr:t,a)),r.push(a)}return r}function Da(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.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=Ea(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=mr(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ar(e[0],e[a-1],t)):l}function Oa(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=mr(0,t,r);e.push(qi(n,1,i))}}function ka(e){let t=[0];return Oa(t,e.length-1),t}function Aa(e,t){return e.map(e=>e*t)}function ja(e,t){return e.map(()=>t||Fr).splice(0,e.length-1)}function Ma({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ir(r)?r.map(Br):Br(r),a={done:!1,value:t[0]},o=Da(Aa(n&&n.length===t.length?n:ka(t),e),t,{ease:Array.isArray(i)?i:ja(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Na=e=>e!==null;function Pa(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Na),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Fa={decay:Ta,inertia:Ta,tween:Ma,keyframes:Ma,spring:Sa};function Ia(e){typeof e.type==`string`&&(e.type=Fa[e.type])}var La=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)}},Ra=e=>e/100,za=class extends La{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!==Qr.now()&&this.tick(Qr.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},$r.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Ia(e);let{type:t=Ma,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Ma;s!==Ma&&typeof o[0]!=`number`&&(this.mixKeyframes=pr(Ra,sa(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=da(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=ar(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 ee=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return ee&&p!==Ta&&(b.value=Pa(l,this.options,h,this.speed)),m&&m(b.value),ee&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return _r(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+_r(e)}get time(){return _r(this.currentTime)}set time(e){e=gr(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 wa(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(Qr.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=_r(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ca,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(Qr.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,$r.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 Ba(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Va=e=>e*180/Math.PI,Ha=e=>Wa(Va(Math.atan2(e[1],e[0]))),Ua={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ha,rotateZ:Ha,skewX:e=>Va(Math.atan(e[1])),skewY:e=>Va(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Wa=e=>(e%=360,e<0&&(e+=360),e),Ga=Ha,Ka=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),qa=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ja={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ka,scaleY:qa,scale:e=>(Ka(e)+qa(e))/2,rotateX:e=>Wa(Va(Math.atan2(e[6],e[5]))),rotateY:e=>Wa(Va(Math.atan2(-e[2],e[0]))),rotateZ:Ga,rotate:Ga,skewX:e=>Va(Math.atan(e[4])),skewY:e=>Va(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ya(e){return e.includes(`scale`)?1:0}function Xa(e,t){if(!e||e===`none`)return Ya(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ja,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Ua,i=t}if(!i)return Ya(t);let a=r[t],o=i[1].split(`,`).map(Qa);return typeof a==`function`?a(o):o[a]}var Za=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Xa(n,t)};function Qa(e){return parseFloat(e.trim())}var $a=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],eo=new Set($a),to=e=>e===oi||e===N,no=new Set([`x`,`y`,`z`]),ro=$a.filter(e=>!no.has(e));function io(e){let t=[];return ro.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})=>Xa(t,`x`),y:(e,{transform:t})=>Xa(t,`y`)};ao.translateX=ao.x,ao.translateY=ao.y;var oo=new Set,so=!1,co=!1,lo=!1;function uo(){if(co){let e=Array.from(oo).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=io(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)})}co=!1,so=!1,oo.forEach(e=>e.complete(lo)),oo.clear()}function fo(){oo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(co=!0)})}function po(){lo=!0,fo(),uo(),lo=!1}var mo=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?(oo.add(this),so||(so=!0,Kr.read(fo),Kr.resolveKeyframes(uo))):(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])}Ba(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),oo.delete(this)}cancel(){this.state===`scheduled`&&(oo.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},ho=e=>e.startsWith(`--`);function go(e,t,n){ho(t)?e.style.setProperty(t,n):e.style[t]=n}var _o={};function vo(e,t){let n=ur(e);return()=>_o[t]??n()}var F=vo(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),yo=vo(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),bo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,xo={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:bo([0,.65,.55,1]),circOut:bo([.55,0,1,.45]),backIn:bo([.31,.01,.66,-.59]),backOut:bo([.33,1.53,.69,.99])};function So(e,t){if(e)return typeof e==`function`?yo()?la(e,t):`ease-out`:Lr(e)?bo(e):Array.isArray(e)?e.map(e=>So(e,t)||xo.easeOut):xo[e]}function Co(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=So(s,i);Array.isArray(d)&&(u.easing=d),Hr.value&&$r.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 Hr.value&&p.finished.finally(()=>{$r.waapi--}),p}function wo(e){return typeof e==`function`&&`applyToOptions`in e}function To({type:e,...t}){return wo(e)&&yo()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Eo=class extends La{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,e.type;let c=To(e);this.animation=Co(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Pa(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),go(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 _r(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+_r(e)}get time(){return _r(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=gr(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&&F()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),dr):r(this)}},Do={anticipate:kr,backInOut:Or,circInOut:Mr};function Oo(e){return e in Do}function ko(e){typeof e.ease==`string`&&Oo(e.ease)&&(e.ease=Do[e.ease])}var Ao=10,jo=class extends Eo{constructor(e){ko(e),Ia(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 za({...a,autoplay:!1}),s=Math.max(Ao,Qr.now()-this.startTime),c=ar(0,Ao,s-Ao),l=o.sample(s).value,{name:u}=this.options;i&&u&&go(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Mo=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ui.test(e)||e===`0`)&&!e.startsWith(`url(`));function No(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 Po(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=Mo(i,t),s=Mo(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:No(e)||(n===`spring`||wo(n))&&r}function Fo(e){e.duration=0,e.type=`keyframes`}var Io=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Lo=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Ro(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Lo.test(e[t]))return!0;return!1}var zo=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Bo=ur(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Vo(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 Bo()&&n&&(Io.has(n)||zo.has(n)&&Ro(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Ho=40,Uo=class extends La{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=Qr.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||mo)(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=Qr.now();let u=!0;Po(e,i,a,o)||(u=!1,(or.instantAnimations||!s)&&l?.(Pa(e,n,t)),e[0]=e[e.length-1],Fo(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Ho?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Vo(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new jo({...d,element:p})}catch{m=new za(d)}else m=new za(d);m.finished.then(()=>{this.notifyFinished()}).catch(dr),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(),po()),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 Wo(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 Go=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ko(e){let t=Go.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function qo(e,t,n=1){`${e}`;let[r,i]=Ko(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return sr(e)?parseFloat(e):e}return ri(i)?qo(i,t,n+1):i}var Jo={type:`spring`,stiffness:500,damping:25,restSpeed:10},Yo=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Xo={type:`keyframes`,duration:.8},Zo={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Qo=(e,{keyframes:t})=>t.length>2?Xo:eo.has(e)?e.startsWith(`scale`)?Yo(t[1]):Jo:Zo;function $o(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:$o(n,e)}var ts=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function ns(e){for(let t in e)if(!ts.has(t))return!0;return!1}var rs=(e,t,n,r={},i,a)=>o=>{let s=es(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=gr(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};ns(s)||Object.assign(u,Qo(e,u)),u.duration&&=gr(u.duration),u.repeatDelay&&=gr(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Fo(u),u.delay===0&&(d=!0)),(or.instantAnimations||or.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,Fo(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Pa(u.keyframes,s);if(e!==void 0){Kr.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new za(u):new Uo(u)};function is(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function as(e,t,n,r){if(typeof t==`function`){let[i,a]=is(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]=is(r);t=t(n===void 0?e.custom:n,i,a)}return t}function os(e,t,n){let r=e.getProps();return as(r,t,n===void 0?r.custom:n,e)}var ss=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...$a]),cs=30,ls=e=>!isNaN(parseFloat(e)),us={current:void 0},ds=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Qr.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=Qr.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ls(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new hr);let n=this.events[e].add(t);return e===`change`?()=>{n(),Kr.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 us.current&&us.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Qr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>cs)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,cs);return vr(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 fs(e,t){return new ds(e,t)}var ps=e=>Array.isArray(e);function ms(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,fs(n))}function hs(e){return ps(e)?e[e.length-1]||0:e}function gs(e,t){let{transitionEnd:n={},transition:r={},...i}=os(e,t)||{};i={...i,...n};for(let t in i)ms(e,t,hs(i[t]))}var _s=e=>!!(e&&e.getVelocity);function vs(e){return!!(_s(e)&&e.add)}function ys(e,t){let n=e.getValue(`willChange`);if(vs(n))return n.add(t);if(!n&&or.WillChange){let n=new or.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function bs(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var xs=`data-`+bs(`framerAppearId`);function Ss(e){return e.props[xs]}function Cs({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ws(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?$o(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&&Cs(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){Kr.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Ss(e);if(n){let e=window.MotionHandoffAnimation(n,t,Kr);e!==null&&(o.startTime=e,f=!0)}}ys(e,t);let p=l??e.shouldReduceMotion;r.start(rs(t,r,i,p&&ss.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Kr.update(()=>{o&&gs(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Ts(e,t,n={}){let r=os(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(ws(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Es(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 Es(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(Ts(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Wo(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Ds(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ts(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ts(e,t,n);else{let i=typeof t==`function`?os(e,t,n.custom):t;r=Promise.all(ws(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Os={test:e=>e===`auto`,parse:e=>e},ks=e=>t=>t.test(e),As=[oi,N,Si,xi,wi,Ci,Os],js=e=>As.find(ks(e));function Ms(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||lr(e)}var Ns=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Ps(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ui)||[];if(!r)return e;let i=n.replace(r,``),a=Ns.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var Fs=/\b([a-z-]*)\(.*?\)/gu,Is={...Ui,getAnimatableNone:e=>{let t=e.match(Fs);return t?t.map(Ps).join(` `):e}},Ls={...Ui,getAnimatableNone:e=>{let t=Ui.parse(e);return Ui.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Rs={...oi,transform:Math.round},zs={borderWidth:N,borderTopWidth:N,borderRightWidth:N,borderBottomWidth:N,borderLeftWidth:N,borderRadius:N,borderTopLeftRadius:N,borderTopRightRadius:N,borderBottomRightRadius:N,borderBottomLeftRadius:N,width:N,maxWidth:N,height:N,maxHeight:N,top:N,right:N,bottom:N,left:N,inset:N,insetBlock:N,insetBlockStart:N,insetBlockEnd:N,insetInline:N,insetInlineStart:N,insetInlineEnd:N,padding:N,paddingTop:N,paddingRight:N,paddingBottom:N,paddingLeft:N,paddingBlock:N,paddingBlockStart:N,paddingBlockEnd:N,paddingInline:N,paddingInlineStart:N,paddingInlineEnd:N,margin:N,marginTop:N,marginRight:N,marginBottom:N,marginLeft:N,marginBlock:N,marginBlockStart:N,marginBlockEnd:N,marginInline:N,marginInlineStart:N,marginInlineEnd:N,fontSize:N,backgroundPositionX:N,backgroundPositionY:N,rotate:xi,rotateX:xi,rotateY:xi,rotateZ:xi,scale:ci,scaleX:ci,scaleY:ci,scaleZ:ci,skew:xi,skewX:xi,skewY:xi,distance:N,translateX:N,translateY:N,translateZ:N,x:N,y:N,z:N,perspective:N,transformPerspective:N,opacity:si,originX:Ti,originY:Ti,originZ:N,zIndex:Rs,fillOpacity:si,strokeOpacity:si,numOctaves:Rs},Bs={...zs,color:Di,backgroundColor:Di,outlineColor:Di,fill:Di,stroke:Di,borderColor:Di,borderTopColor:Di,borderRightColor:Di,borderBottomColor:Di,borderLeftColor:Di,filter:Is,WebkitFilter:Is,mask:Ls,WebkitMask:Ls},Vs=e=>Bs[e],Hs=new Set([Is,Ls]);function Us(e,t){let n=Vs(e);return Hs.has(n)||(n=Ui),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Ws=new Set([`auto`,`none`,`0`]);function Gs(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Ws.has(t)&&Ii(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Us(n,i)}var Ks=class extends mo{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(),ri(r))){let i=qo(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ss.has(n)||e.length!==2)return;let[r,i]=e,a=js(r),o=js(i);if(ai(r)!==ai(i)&&ao[n]){this.needsMeasurement=!0;return}if(a!==o)if(to(a)&&to(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||Ms(e[t]))&&n.push(t);n.length&&Gs(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 qs(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 Js=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ys(e){return cr(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Xs,cancel:Zs}=Gr(queueMicrotask,!1),Qs={x:!1,y:!1};function $s(){return Qs.x||Qs.y}function ec(e){return e===`x`||e===`y`?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}function tc(e,t){let n=qs(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function nc(e){return!(e.pointerType===`touch`||$s())}function rc(e,t,n={}){let[r,i,a]=tc(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(!nc(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 ic=(e,t)=>t?e===t?!0:ic(e,t.parentElement):!1,ac=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,oc=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function sc(e){return oc.has(e.tagName)||e.isContentEditable===!0}var cc=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function lc(e){return cc.has(e.tagName)||e.isContentEditable===!0}var uc=new WeakSet;function dc(e){return t=>{t.key===`Enter`&&e(t)}}function fc(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var pc=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=dc(()=>{if(uc.has(n))return;fc(n,`down`);let e=dc(()=>{fc(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>fc(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function mc(e){return ac(e)&&!$s()}var hc=new WeakSet;function gc(e,t,n={}){let[r,i,a]=tc(e,n),o=e=>{let r=e.currentTarget;if(!mc(e)||hc.has(e))return;uc.add(r),n.stopPropagation&&hc.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),uc.has(r)&&uc.delete(r),mc(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||ic(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),Ys(e)&&(e.addEventListener(`focus`,e=>pc(e,i)),!sc(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function _c(e){return cr(e)&&`ownerSVGElement`in e}var vc=new WeakMap,yc,bc=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:_c(r)&&`getBBox`in r?r.getBBox()[t]:r[n],xc=bc(`inline`,`width`,`offsetWidth`),Sc=bc(`block`,`height`,`offsetHeight`);function Cc({target:e,borderBoxSize:t}){vc.get(e)?.forEach(n=>{n(e,{get width(){return xc(e,t)},get height(){return Sc(e,t)}})})}function wc(e){e.forEach(Cc)}function Tc(){typeof ResizeObserver>`u`||(yc=new ResizeObserver(wc))}function Ec(e,t){yc||Tc();let n=qs(e);return n.forEach(e=>{let n=vc.get(e);n||(n=new Set,vc.set(e,n)),n.add(t),yc?.observe(e)}),()=>{n.forEach(e=>{let n=vc.get(e);n?.delete(t),n?.size||yc?.unobserve(e)})}}var Dc=new Set,Oc;function kc(){Oc=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Dc.forEach(t=>t(e))},window.addEventListener(`resize`,Oc)}function Ac(e){return Dc.add(e),Oc||kc(),()=>{Dc.delete(e),!Dc.size&&typeof Oc==`function`&&(window.removeEventListener(`resize`,Oc),Oc=void 0)}}function jc(e,t){return typeof e==`function`?Ac(e):Ec(e,t)}function Mc(e){return _c(e)&&e.tagName===`svg`}var Nc=[...As,Di,Ui],Pc=e=>Nc.find(ks(e)),Fc=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ic=()=>({x:Fc(),y:Fc()}),Lc=()=>({min:0,max:0}),Rc=()=>({x:Lc(),y:Lc()}),zc=new WeakMap;function Bc(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Vc(e){return typeof e==`string`||Array.isArray(e)}var Hc=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Uc=[`initial`,...Hc];function Wc(e){return Bc(e.animate)||Uc.some(t=>Vc(e[t]))}function Gc(e){return!!(Wc(e)||e.variants)}function Kc(e,t,n){for(let r in t){let i=t[r],a=n[r];if(_s(i))e.addValue(r,i);else if(_s(a))e.addValue(r,fs(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,fs(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var qc={current:null},Jc={current:!1},Yc=typeof window<`u`;function Xc(){if(Jc.current=!0,Yc)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>qc.current=e.matches;e.addEventListener(`change`,t),t()}else qc.current=!1}var Zc=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Qc={};function $c(e){Qc=e}function el(){return Qc}var tl=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=mo,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=Qr.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Kr.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=Wc(t),this.isVariantNode=Gc(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&&_s(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,zc.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:(Jc.current||Xc(),this.shouldReduceMotion=qc.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),qr(this.notifyUpdate),qr(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&&Io.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Eo({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:gr(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=eo.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Kr.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 Qc){let t=Qc[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):Rc()}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<Zc.length;t++){let n=Zc[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=Kc(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=fs(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`&&(sr(n)||lr(n))?n=parseFloat(n):!Pc(n)&&Ui.test(t)&&(n=Us(e,t)),this.setBaseTarget(e,_s(n)?n.get():n)),_s(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=as(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&&!_s(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 hr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Xs.render(this.render)}},nl=class extends tl{constructor(){super(...arguments),this.KeyframeResolver=Ks}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;_s(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},rl=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function il({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function al({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ol(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 sl(e){return e===void 0||e===1}function cl({scale:e,scaleX:t,scaleY:n}){return!sl(e)||!sl(t)||!sl(n)}function ll(e){return cl(e)||ul(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ul(e){return dl(e.x)||dl(e.y)}function dl(e){return e&&e!==`0%`}function fl(e,t,n){return n+t*(e-n)}function pl(e,t,n,r,i){return i!==void 0&&(e=fl(e,i,r)),fl(e,n,r)+t}function ml(e,t=0,n=1,r,i){e.min=pl(e.min,t,n,r,i),e.max=pl(e.max,t,n,r,i)}function hl(e,{x:t,y:n}){ml(e.x,t.translate,t.scale,t.originPoint),ml(e.y,n.translate,n.scale,n.originPoint)}var gl=.999999999999,_l=1.0000000000001;function vl(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&&(yl(e.x,-a.scroll.offset.x),yl(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,hl(e,o)),r&&ll(a.latestValues)&&Sl(e,a.latestValues,a.layout?.layoutBox))}t.x<_l&&t.x>gl&&(t.x=1),t.y<_l&&t.y>gl&&(t.y=1)}function yl(e,t){e.min+=t,e.max+=t}function bl(e,t,n,r,i=.5){ml(e,t,n,qi(e.min,e.max,i),r)}function xl(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Sl(e,t,n){let r=n??e;bl(e.x,xl(t.x,r.x),t.scaleX,t.scale,t.originX),bl(e.y,xl(t.y,r.y),t.scaleY,t.scale,t.originY)}function Cl(e,t){return il(ol(e.getBoundingClientRect(),t))}function wl(e,t,n){let r=Cl(e,n),{scroll:i}=t;return i&&(yl(r.x,i.offset.x),yl(r.y,i.offset.y)),r}var Tl={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},El=$a.length;function Dl(e,t,n){let r=``,i=!0;for(let a=0;a<El;a++){let o=$a[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=Js(s,zs[o]);if(!c){i=!1;let t=Tl[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Ol(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(eo.has(e)){o=!0;continue}else if(ti(e)){i[e]=n;continue}else{let t=Js(n,zs[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Dl(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 kl(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 Al(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var jl={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(N.test(e))e=parseFloat(e);else return e;return`${Al(e,t.target.x)}% ${Al(e,t.target.y)}%`}},Ml={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ui.parse(e);if(i.length>5)return r;let a=Ui.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=qi(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Nl={borderRadius:{...jl,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:jl,borderTopRightRadius:jl,borderBottomLeftRadius:jl,borderBottomRightRadius:jl,boxShadow:Ml};function Pl(e,{layout:t,layoutId:n}){return eo.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Nl[e]||e===`opacity`)}function Fl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(_s(r[t])||i&&_s(i[t])||Pl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Il(e){return window.getComputedStyle(e)}var Ll=class extends nl{constructor(){super(...arguments),this.type=`html`,this.renderInstance=kl}readValueFromInstance(e,t){if(eo.has(t))return this.projection?.isProjecting?Ya(t):Za(e,t);{let n=Il(e),r=(ti(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Cl(e,t)}build(e,t,n){Ol(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Fl(e,t,n)}},Rl={offset:`stroke-dashoffset`,array:`stroke-dasharray`},zl={offset:`strokeDashoffset`,array:`strokeDasharray`};function Bl(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Rl:zl;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Vl=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Hl(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Ol(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 Vl)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&&Bl(d,i,a,o,!1)}var Ul=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`]),Wl=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Gl(e,t,n,r){kl(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Ul.has(n)?n:bs(n),t.attrs[n])}function Kl(e,t,n){let r=Fl(e,t,n);for(let n in e)if(_s(e[n])||_s(t[n])){let t=$a.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ql=class extends nl{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Rc}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(eo.has(t)){let e=Vs(t);return e&&e.default||0}return t=Ul.has(t)?t:bs(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Kl(e,t,n)}build(e,t,n){Hl(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Gl(e,t,n,r)}mount(e){this.isSVGTag=Wl(e.tagName),super.mount(e)}},Jl=Uc.length;function Yl(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Yl(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Jl;n++){let r=Uc[n],i=e.props[r];(Vc(i)||i===!1)&&(t[r]=i)}return t}function Xl(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 I=[...Hc].reverse(),L=Hc.length;function Zl(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Ds(e,t,n)))}function Ql(e){let t=Zl(e),n=tu(),r=!0,i=!1,a=t=>(n,r)=>{let i=os(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=Yl(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<L;t++){let p=I[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Vc(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||Bc(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=$l(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,ee=Array.isArray(h)?h:[h],S=ee.reduce(a(p),{});_===!1&&(S={});let{prevResolvedValues:C={}}=m,te={...C,...S},w=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 te){let t=S[e],n=C[e];if(d.hasOwnProperty(e))continue;let r=!1;r=ps(t)&&ps(n)?!Xl(t,n):t!==n,r?t==null?u.add(e):w(e):t!==void 0&&u.has(e)?w(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=S,m.isActive&&(d={...d,...S}),(r||i)&&e.blockInitialAnimation&&(b=!1);let ne=v&&y;b&&(!ne||x)&&l.push(...ee.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!ne&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=os(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Wo(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=os(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=tu(),i=!0}}}function $l(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Xl(t,e):!1}function eu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function tu(){return{animate:eu(!0),whileInView:eu(),whileHover:eu(),whileTap:eu(),whileDrag:eu(),whileFocus:eu(),exit:eu()}}function nu(e,t){e.min=t.min,e.max=t.max}function ru(e,t){nu(e.x,t.x),nu(e.y,t.y)}function iu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var au=1e-4,ou=1-au,su=1+au,cu=.01,lu=0-cu,uu=0+cu;function du(e){return e.max-e.min}function fu(e,t,n){return Math.abs(e-t)<=n}function pu(e,t,n,r=.5){e.origin=r,e.originPoint=qi(t.min,t.max,e.origin),e.scale=du(n)/du(t),e.translate=qi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ou&&e.scale<=su||isNaN(e.scale))&&(e.scale=1),(e.translate>=lu&&e.translate<=uu||isNaN(e.translate))&&(e.translate=0)}function mu(e,t,n,r){pu(e.x,t.x,n.x,r?r.originX:void 0),pu(e.y,t.y,n.y,r?r.originY:void 0)}function hu(e,t,n,r=0){e.min=(r?qi(n.min,n.max,r):n.min)+t.min,e.max=e.min+du(t)}function gu(e,t,n,r){hu(e.x,t.x,n.x,r?.x),hu(e.y,t.y,n.y,r?.y)}function _u(e,t,n,r=0){let i=r?qi(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+du(t)}function vu(e,t,n,r){_u(e.x,t.x,n.x,r?.x),_u(e.y,t.y,n.y,r?.y)}function yu(e,t,n,r,i){return e-=t,e=fl(e,1/n,r),i!==void 0&&(e=fl(e,1/i,r)),e}function bu(e,t=0,n=1,r=.5,i,a=e,o=e){if(Si.test(t)&&(t=parseFloat(t),t=qi(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=qi(a.min,a.max,r);e===a&&(s-=t),e.min=yu(e.min,t,n,s,i),e.max=yu(e.max,t,n,s,i)}function xu(e,t,[n,r,i],a,o){bu(e,t[n],t[r],t[i],t.scale,a,o)}var Su=[`x`,`scaleX`,`originX`],Cu=[`y`,`scaleY`,`originY`];function wu(e,t,n,r){xu(e.x,t,Su,n?n.x:void 0,r?r.x:void 0),xu(e.y,t,Cu,n?n.y:void 0,r?r.y:void 0)}function Tu(e){return e.translate===0&&e.scale===1}function Eu(e){return Tu(e.x)&&Tu(e.y)}function Du(e,t){return e.min===t.min&&e.max===t.max}function Ou(e,t){return Du(e.x,t.x)&&Du(e.y,t.y)}function ku(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Au(e,t){return ku(e.x,t.x)&&ku(e.y,t.y)}function ju(e){return du(e.x)/du(e.y)}function Mu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Nu(e){return[e(`x`),e(`y`)]}function Pu(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 Fu=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Iu=Fu.length,Lu=e=>typeof e==`string`?parseFloat(e):e,Ru=e=>typeof e==`number`||N.test(e);function zu(e,t,n,r,i,a){i?(e.opacity=qi(0,n.opacity??1,Vu(r)),e.opacityExit=qi(t.opacity??1,0,Hu(r))):a&&(e.opacity=qi(t.opacity??1,n.opacity??1,r));for(let i=0;i<Iu;i++){let a=Fu[i],o=Bu(t,a),s=Bu(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Ru(o)===Ru(s)?(e[a]=Math.max(qi(Lu(o),Lu(s),r),0),(Si.test(s)||Si.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=qi(t.rotate||0,n.rotate||0,r))}function Bu(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Vu=Uu(0,.5,jr),Hu=Uu(.5,.95,dr);function Uu(e,t,n){return r=>r<e?0:r>t?1:n(mr(e,t,r))}function Wu(e,t,n){let r=_s(e)?e:fs(e);return r.start(rs(``,r,t,n)),r.animation}function Gu(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Ku=(e,t)=>e.depth-t.depth,qu=class{constructor(){this.children=[],this.isDirty=!1}add(e){rr(this.children,e),this.isDirty=!0}remove(e){ir(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Ku),this.isDirty=!1,this.children.forEach(e)}};function Ju(e,t){let n=Qr.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(qr(r),e(a-t))};return Kr.setup(r,!0),()=>qr(r)}function Yu(e){return _s(e)?e.get():e}var Xu=class{constructor(){this.members=[]}add(e){rr(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&&(ir(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(ir(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)}},Zu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qu={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},$u=[``,`X`,`Y`,`Z`],ed=1e3,td=0;function nd(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function rd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Ss(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Kr,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&rd(r)}function id({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=td++,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,Hr.value&&(Qu.nodes=Qu.calculatedTargetDeltas=Qu.calculatedProjections=0),this.nodes.forEach(sd),this.nodes.forEach(gd),this.nodes.forEach(_d),this.nodes.forEach(cd),Hr.addProjectionMetrics&&Hr.addProjectionMetrics(Qu)},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 qu)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new hr),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=_c(t)&&!Mc(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;Kr.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Ju(i,250),Zu.hasAnimatedSinceResize&&(Zu.hasAnimatedSinceResize=!1,this.nodes.forEach(hd)))})}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()||wd,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Au(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||hd(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(),qr(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(vd),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&&rd(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(dd),this.nodes.forEach(ud);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pd),this.nodes.forEach(md),this.nodes.forEach(ad),this.nodes.forEach(od)):this.nodes.forEach(fd),this.clearAllSnapshots();let e=Qr.now();Jr.delta=ar(0,1e3/60,e-Jr.timestamp),Jr.timestamp=e,Jr.isProcessing=!0,Yr.update.process(Jr),Yr.preRender.process(Jr),Yr.render.process(Jr),Jr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xs.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ld),this.sharedNodes.forEach(yd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Kr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Kr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!du(this.snapshot.measuredBox.x)&&!du(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||=Rc(),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&&!Eu(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||ll(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)),Od(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Rc();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Ad))){let{scroll:e}=this.root;e&&(yl(t.x,e.offset.x),yl(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Rc();if(ru(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&&ru(t,e),yl(t.x,i.offset.x),yl(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Rc();ru(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&&(yl(r.x,-n.scroll.offset.x),yl(r.y,-n.scroll.offset.y)),ll(n.latestValues)&&Sl(r,n.latestValues,n.layout?.layoutBox)}return ll(this.latestValues)&&Sl(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Rc();ru(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!ll(n.latestValues))continue;let r;n.instance&&(cl(n.latestValues)&&n.updateSnapshot(),r=Rc(),ru(r,n.measurePageBox())),wu(t,n.latestValues,n.snapshot?.layoutBox,r)}return ll(this.latestValues)&&wu(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!==Jr.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=Jr.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=Rc(),this.targetWithTransforms=Rc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ru(this.target,this.layout.layoutBox),hl(this.target,this.targetDelta)):ru(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),Hr.value&&Qu.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||cl(this.parent.latestValues)||ul(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=Rc(),this.relativeTargetOrigin=Rc(),vu(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ru(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===Jr.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;ru(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;vl(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=Rc());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(iu(this.prevProjectionDelta.x,this.projectionDelta.x),iu(this.prevProjectionDelta.y,this.projectionDelta.y)),mu(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Mu(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Hr.value&&Qu.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=Ic(),this.projectionDelta=Ic(),this.projectionDeltaWithTransform=Ic()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Ic();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Rc(),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(Cd));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;bd(a.x,e.x,n),bd(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vu(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Sd(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Ou(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Rc(),ru(d,this.relativeTarget)),s&&(this.animationValues=i,zu(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&&=(qr(this.pendingAnimation),void 0),this.pendingAnimation=Kr.update(()=>{Zu.hasAnimatedSinceResize=!0,$r.layout++,this.motionValue||=fs(0),this.motionValue.jump(0,!1),this.currentAnimation=Wu(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{$r.layout--},onComplete:()=>{$r.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(ed),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&&kd(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Rc();let t=du(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=du(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ru(t,n),Sl(t,i),mu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Xu),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&&nd(`z`,e,r,this.animationValues);for(let t=0;t<$u.length;t++)nd(`rotate${$u[t]}`,e,r,this.animationValues),nd(`skew${$u[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=Yu(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=Yu(t?.pointerEvents)||``),this.hasProjected&&!ll(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Pu(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 Nl){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Nl[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?Yu(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(ud),this.root.sharedNodes.clear()}}}function ad(e){e.updateLayout()}function od(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`)Nu(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=du(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;nu(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else kd(i,t.layoutBox,n)&&Nu(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=du(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=Ic();mu(o,n,t.layoutBox);let s=Ic();a?mu(s,e.applyTransform(r,!0),t.measuredBox):mu(s,n,t.layoutBox);let c=!Eu(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=Rc();vu(s,t.layoutBox,i.layoutBox,o);let c=Rc();vu(c,n,a.layoutBox,o),Au(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 sd(e){Hr.value&&Qu.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 cd(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ld(e){e.clearSnapshot()}function ud(e){e.clearMeasurements()}function dd(e){e.isLayoutDirty=!0,e.updateLayout()}function fd(e){e.isLayoutDirty=!1}function pd(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function md(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function hd(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function gd(e){e.resolveTargetDelta()}function _d(e){e.calcProjection()}function vd(e){e.resetSkewAndRotation()}function yd(e){e.removeLeadSnapshot()}function bd(e,t,n){e.translate=qi(t.translate,0,n),e.scale=qi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function xd(e,t,n,r){e.min=qi(t.min,n.min,r),e.max=qi(t.max,n.max,r)}function Sd(e,t,n,r){xd(e.x,t.x,n.x,r),xd(e.y,t.y,n.y,r)}function Cd(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var wd={duration:.45,ease:[.4,0,.1,1]},Td=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ed=Td(`applewebkit/`)&&!Td(`chrome/`)?Math.round:dr;function Dd(e){e.min=Ed(e.min),e.max=Ed(e.max)}function Od(e){Dd(e.x),Dd(e.y)}function kd(e,t,n){return e===`position`||e===`preserve-aspect`&&!fu(ju(t),ju(n),.2)}function Ad(e){return e!==e.root&&e.scroll?.wasRoot}var jd=id({attachResizeListener:(e,t)=>Gu(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Md={current:void 0},Nd=id({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Md.current){let e=new jd({});e.mount(window),e.setOptions({layoutScroll:!0}),Md.current=e}return Md.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),R=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Pd(e=!0){let t=(0,b.useContext)(nr);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,b.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Fd=(0,b.createContext)({strict:!1}),Id={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`]},Ld=!1;function Rd(){if(Ld)return;let e={};for(let t in Id)e[t]={isEnabled:e=>Id[t].some(t=>!!e[t])};$c(e),Ld=!0}function zd(){return Rd(),el()}function Bd(e){let t=zd();for(let n in e)t[n]={...t[n],...e[n]};$c(t)}var Vd=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 Hd(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Vd.has(e)}var Ud=c({default:()=>Wd}),Wd,Gd=o((()=>{throw Wd={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Kd=e=>!Hd(e);function qd(e){typeof e==`function`&&(Kd=t=>t.startsWith(`on`)?!Hd(t):e(t))}try{qd((Gd(),d(Ud)).default)}catch{}function Jd(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||_s(e[i])||(Kd(i)||n===!0&&Hd(i)||!t&&!Hd(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var Yd=(0,b.createContext)({});function Xd(e,t){if(Wc(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Vc(t)?t:void 0,animate:Vc(n)?n:void 0}}return e.inherit===!1?{}:t}function Zd(e){let{initial:t,animate:n}=Xd(e,(0,b.useContext)(Yd));return(0,b.useMemo)(()=>({initial:t,animate:n}),[Qd(t),Qd(n)])}function Qd(e){return Array.isArray(e)?e.join(` `):e}var $d=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ef(e,t,n){for(let r in t)!_s(t[r])&&!Pl(r,n)&&(e[r]=t[r])}function tf({transformTemplate:e},t){return(0,b.useMemo)(()=>{let n=$d();return Ol(n,t,e),Object.assign({},n.vars,n.style)},[t])}function nf(e,t){let n=e.style||{},r={};return ef(r,n,e),Object.assign(r,tf(e,t)),r}function rf(e,t){let n={},r=nf(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 af=()=>({...$d(),attrs:{}});function of(e,t,n,r){let i=(0,b.useMemo)(()=>{let n=af();return Hl(n,t,Wl(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};ef(t,e.style,e),i.style={...t,...i.style}}return i}var sf=[`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 cf(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(sf.indexOf(e)>-1||/[A-Z]/u.test(e))}function lf(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??cf(e)?of:rf)(t,r,i,e),c=Jd(t,typeof e==`string`,a),l=e===b.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,b.useMemo)(()=>_s(u)?u.get():u,[u]);return(0,b.createElement)(e,{...l,children:d})}function uf({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:df(n,r,i,e),renderState:t()}}function df(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Yu(a[e]);let{initial:o,animate:s}=e,c=Wc(e),l=Gc(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`&&!Bc(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=as(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 ff=e=>(t,n)=>{let r=(0,b.useContext)(Yd),i=(0,b.useContext)(nr),a=()=>uf(e,t,r,i);return n?a():er(a)},pf=ff({scrapeMotionValuesFromProps:Fl,createRenderState:$d}),mf=ff({scrapeMotionValuesFromProps:Kl,createRenderState:af}),hf=Symbol.for(`motionComponentSymbol`);function gf(e,t,n){let r=(0,b.useRef)(n);(0,b.useInsertionEffect)(()=>{r.current=n});let i=(0,b.useRef)(null);return(0,b.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 _f=(0,b.createContext)({});function vf(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function yf(e,t,n,r,i,a){let{visualElement:o}=(0,b.useContext)(Yd),s=(0,b.useContext)(Fd),c=(0,b.useContext)(nr),l=(0,b.useContext)(R),u=l.reducedMotion,d=l.skipAnimations,f=(0,b.useRef)(null),p=(0,b.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,b.useContext)(_f);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&bf(f.current,n,i,h);let g=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[xs],v=(0,b.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return tr(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,b.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function bf(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&&vf(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 Sf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Bd(r);let a=n?n===`svg`:cf(e),o=a?mf:pf;function s(n,s){let c,l={...(0,b.useContext)(R),...n,layoutId:Cf(n)},{isStatic:u}=l,d=Zd(n),f=o(n,u);if(!u&&typeof window<`u`){wf(l,r);let t=Tf(l);c=t.MeasureLayout,d.visualElement=yf(e,f,l,i,t.ProjectionNode,a)}return(0,M.jsxs)(Yd.Provider,{value:d,children:[c&&d.visualElement?(0,M.jsx)(c,{visualElement:d.visualElement,...l}):null,lf(e,n,gf(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,b.forwardRef)(s);return c[hf]=e,c}function Cf({layoutId:e}){let t=(0,b.useContext)($n).id;return t&&e!==void 0?t+`-`+e:e}function wf(e,t){(0,b.useContext)(Fd).strict}function Tf(e){let{drag:t,layout:n}=zd();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Ef(e,t){if(typeof Proxy>`u`)return Sf;let n=new Map,r=(n,r)=>Sf(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Sf(a,void 0,e,t)),n.get(a))})}var Df=(e,t)=>t.isSVG??cf(e)?new ql(t):new Ll(t,{allowProjection:e!==b.Fragment}),Of=class extends rl{constructor(e){super(e),e.animationState||=Ql(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Bc(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?.()}},kf=0,Af={animation:{Feature:Of},exit:{Feature:class extends rl{constructor(){super(...arguments),this.id=kf++,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=os(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 jf(e){return{point:{x:e.pageX,y:e.pageY}}}var Mf=e=>t=>ac(t)&&e(t,jf(t));function Nf(e,t,n,r){return Gu(e,t,Mf(n),r)}var Pf=({current:e})=>e?e.ownerDocument.defaultView:null,Ff=(e,t)=>Math.abs(e-t);function If(e,t){let n=Ff(e.x,t.x),r=Ff(e.y,t.y);return Math.sqrt(n**2+r**2)}var Lf=new Set([`auto`,`scroll`]),Rf=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=zf(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Vf(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=If(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=Jr;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=zf(t,this.transformPagePoint),Kr.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=Vf(e.type===`pointercancel`?this.lastMoveEventInfo:zf(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!ac(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=zf(jf(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=Jr;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Vf(s,this.history)),this.removeListeners=pr(Nf(this.contextWindow,`pointermove`,this.handlePointerMove),Nf(this.contextWindow,`pointerup`,this.handlePointerUp),Nf(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Lf.has(e.overflowX)||Lf.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),Kr.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),qr(this.updatePoint)}};function zf(e,t){return t?{point:t(e.point)}:e}function Bf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vf({point:e},t){return{point:e,delta:Bf(e,Uf(t)),offset:Bf(e,Hf(t)),velocity:Wf(t,.1)}}function Hf(e){return e[0]}function Uf(e){return e[e.length-1]}function Wf(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Uf(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>gr(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>gr(t)*2&&(r=e[1]);let a=_r(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 Gf(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?qi(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?qi(n,e,r.max):Math.min(e,n)),e}function Kf(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 qf(e,{top:t,left:n,bottom:r,right:i}){return{x:Kf(e.x,n,i),y:Kf(e.y,t,r)}}function Jf(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 Yf(e,t){return{x:Jf(e.x,t.x),y:Jf(e.y,t.y)}}function Xf(e,t){let n=.5,r=du(e),i=du(t);return i>r?n=mr(t.min,t.max-r,e.min):r>i&&(n=mr(e.min,e.max-i,t.min)),ar(0,1,n)}function Zf(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 Qf=.35;function $f(e=Qf){return e===!1?e=0:e===!0&&(e=Qf),{x:ep(e,`left`,`right`),y:ep(e,`top`,`bottom`)}}function ep(e,t,n){return{min:tp(e,t),max:tp(e,n)}}function tp(e,t){return typeof e==`number`?e:e[t]||0}var np=new WeakMap,rp=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=Rc(),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(jf(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),Nu(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Si.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=du(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&Kr.update(()=>i(e,t),!1,!0),ys(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=sp(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&&Kr.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 Rf(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Pf(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&&Kr.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||!op(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Gf(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&&vf(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=qf(n.layoutBox,e):this.constraints=!1,this.elastic=$f(t),r!==this.constraints&&!vf(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Nu(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Zf(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!vf(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=wl(n,r.root,this.visualElement.getTransformPagePoint()),a=Yf(r.layout.layoutBox,i);if(t){let e=t(al(a));this.hasMutatedConstraints=!!e,e&&(a=il(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Nu(o=>{if(!op(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 ys(this.visualElement,e),n.start(rs(e,n,0,t,this.visualElement,!1))}stopAnimation(){Nu(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){Nu(t=>{let{drag:n}=this.getProps();if(!op(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]-qi(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!vf(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};Nu(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Xf({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(),Nu(t=>{if(!op(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(qi(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;np.set(this.visualElement,this);let e=this.visualElement.current,t=Nf(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&lc(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();vf(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=ap(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Kr.read(r);let o=Gu(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Nu(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=Qf,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function ip(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function ap(e,t,n){let r=jc(e,ip(n)),i=jc(t,ip(n));return()=>{r(),i()}}function op(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function sp(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var cp=class extends rl{constructor(e){super(e),this.removeGroupControls=dr,this.removeListeners=dr,this.controls=new rp(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dr}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()}},lp=e=>(t,n)=>{e&&Kr.update(()=>e(t,n),!1,!0)},up=class extends rl{constructor(){super(...arguments),this.removePointerDownListener=dr}onPointerDown(e){this.session=new Rf(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Pf(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:lp(e),onStart:lp(t),onMove:lp(n),onEnd:(e,t)=>{delete this.session,r&&Kr.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Nf(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},dp=!1,fp=class extends b.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),dp&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Zu.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}),dp=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Kr.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(),Xs.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;dp=!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 pp(e){let[t,n]=Pd(),r=(0,b.useContext)($n);return(0,M.jsx)(fp,{...e,layoutGroup:r,switchLayoutGroup:(0,b.useContext)(_f),isPresent:t,safeToRemove:n})}var mp={pan:{Feature:up},drag:{Feature:cp,ProjectionNode:Nd,MeasureLayout:pp}};function hp(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Kr.postRender(()=>i(t,jf(t)))}var gp=class extends rl{mount(){let{current:e}=this.node;e&&(this.unmount=rc(e,(e,t)=>(hp(this.node,t,`Start`),e=>hp(this.node,e,`End`))))}unmount(){}},_p=class extends rl{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=pr(Gu(this.node.current,`focus`,()=>this.onFocus()),Gu(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function vp(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&&Kr.postRender(()=>i(t,jf(t)))}var yp=class extends rl{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=gc(e,(e,t)=>(vp(this.node,t,`Start`),(e,{success:t})=>vp(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},bp=new WeakMap,xp=new WeakMap,Sp=e=>{let t=bp.get(e.target);t&&t(e)},Cp=e=>{e.forEach(Sp)};function wp({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(Cp,{root:e,...t})),r[i]}function Tp(e,t,n){let r=wp(t);return bp.set(e,n),r.observe(e),()=>{bp.delete(e),r.unobserve(e)}}var Ep={some:0,all:1},Dp=class extends rl{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:Ep[r]};this.stopObserver=Tp(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(Op(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Op({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var kp={inView:{Feature:Dp},tap:{Feature:yp},focus:{Feature:_p},hover:{Feature:gp}},Ap={layout:{ProjectionNode:Nd,MeasureLayout:pp}},jp=Ef({...Af,...kp,...mp,...Ap},Df);function Mp(e,t){return t.forEach(function(t){t&&typeof t!=`string`&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!==`default`&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var Np=Object.defineProperty,Pp=(e,t,n)=>t in e?Np(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fp=(e,t,n)=>Pp(e,typeof t==`symbol`?t:t+``,n),Ip=class{constructor(){Fp(this,`_locking`),Fp(this,`_locks`),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e,t=new Promise(t=>e=()=>{--this._locks,t()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function Lp(e,t){if(!e)throw Error(t)}var Rp=34028234663852886e22,zp=-34028234663852886e22,Bp=4294967295,Vp=2147483647,Hp=-2147483648;function Up(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>Vp||e<Hp)throw Error(`invalid int 32: `+e)}function Wp(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>Bp||e<0)throw Error(`invalid uint 32: `+e)}function Gp(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>Rp||e<zp))throw Error(`invalid float 32: `+e)}var Kp=Symbol(`@bufbuild/protobuf/enum-type`);function qp(e){let t=e[Kp];return Lp(t,`missing enum type on enum object`),t}function Jp(e,t,n,r){e[Kp]=Yp(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})))}function Yp(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=Zp(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function Xp(e,t,n){let r={};for(let e of t){let t=Zp(e);r[t.localName]=t.no,r[t.no]=t.localName}return Jp(r,e,t),r}function Zp(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var Qp=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function $p(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new Qp),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function em(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function tm(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}var nm=4294967296;function rm(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=nm&&(i+=r/nm|0,r%=nm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?cm(r,i):sm(r,i)}function im(e,t){let n=sm(e,t),r=n.hi&2147483648;r&&(n=cm(n.lo,n.hi));let i=am(n.lo,n.hi);return r?`-`+i:i}function am(e,t){if({lo:e,hi:t}=om(e,t),t<=2097151)return String(nm*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+lm(o)+lm(a)}function om(e,t){return{lo:e>>>0,hi:t>>>0}}function sm(e,t){return{lo:e|0,hi:t|0}}function cm(e,t){return t=~t,e?e=~e+1:t+=1,sm(e,t)}var lm=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function um(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function dm(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function fm(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`int64 invalid: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}let t=e=>Lp(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Lp(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),t(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),t(e),rm(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),n(e),rm(e)},dec(e,t){return im(e,t)},uDec(e,t){return am(e,t)}}}var pm=fm(),z;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(z||={});var mm;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(mm||={});function hm(e,t,n){if(t===n)return!0;if(e==z.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return t==n}return!1}function gm(e,t){switch(e){case z.BOOL:return!1;case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return t==0?pm.zero:`0`;case z.DOUBLE:case z.FLOAT:return 0;case z.BYTES:return new Uint8Array;case z.STRING:return``;default:return 0}}function _m(e,t){switch(e){case z.BOOL:return t===!1;case z.STRING:return t===``;case z.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var vm;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(vm||={});var ym=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Wp(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return Up(e),um(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Gp(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Wp(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Up(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Up(e),e=(e<<1^e>>31)>>>0,um(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=pm.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=pm.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=pm.enc(e);return tm(t.lo,t.hi,this.buf),this}sint64(e){let t=pm.enc(e),n=t.hi>>31;return tm(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=pm.uEnc(e);return tm(t.lo,t.hi,this.buf),this}},bm=class{constructor(e,t){this.varint64=em,this.uint32=dm,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case vm.Varint:for(;this.buf[this.pos++]&128;);break;case vm.Bit64:this.pos+=4;case vm.Bit32:this.pos+=4;break;case vm.LengthDelimited:let n=this.uint32();this.pos+=n;break;case vm.StartGroup:for(;;){let[e,n]=this.tag();if(n===vm.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return pm.dec(...this.varint64())}uint64(){return pm.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,pm.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return pm.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return pm.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function xm(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function Sm(e){let t=e.field.localName,n=Object.create(null);return n[t]=Cm(e),[n,()=>n[t]]}function Cm(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return gm(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function wm(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}var Tm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Em=[];for(let e=0;e<Tm.length;e++)Em[Tm[e].charCodeAt(0)]=e;Em[45]=Tm.indexOf(`+`),Em[95]=Tm.indexOf(`/`);var Dm={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=Em[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case`
|
|
34
34
|
`:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string.`)}switch(i){case 0:o=a,i=1;break;case 1:n[r++]=o<<2|(a&48)>>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0;break}}if(i==1)throw Error(`invalid base64 string.`);return n.subarray(0,r)},enc(e){let t=``,n=0,r,i=0;for(let a=0;a<e.length;a++)switch(r=e[a],n){case 0:t+=Tm[r>>2],i=(r&3)<<4,n=1;break;case 1:t+=Tm[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=Tm[i|r>>6],t+=Tm[r&63],n=0;break}return n&&(t+=Tm[i],t+=`=`,n==1&&(t+=`=`)),t}};function Om(e,t,n){jm(t,e);let r=t.runtime.bin.makeReadOptions(n),i=wm(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,o]=Sm(t);for(let e of i)t.runtime.bin.readField(a,r.readerFactory(e.data),t.field,e.wireType,r);return o()}function km(e,t,n,r){jm(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(Am(e,t)){let n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}let o=a.writerFactory(),s=t.field;!s.opt&&!s.repeated&&(s.kind==`enum`||s.kind==`scalar`)&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,o,a);let c=i.readerFactory(o.finish());for(;c.pos<c.len;){let[t,n]=c.tag(),r=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,r)}}function Am(e,t){let n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function jm(e,t){Lp(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Mm(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case`enum`:case`scalar`:return e.opt||e.req?t[n]!==void 0:e.kind==`enum`?t[n]!==e.T.values[0].no:!_m(e.T,t[n]);case`message`:return t[n]!==void 0;case`map`:return Object.keys(t[n]).length>0}}function Nm(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case`map`:t[n]={};break;case`enum`:t[n]=r?e.T.values[0].no:void 0;break;case`scalar`:t[n]=r?gm(e.T,e.L):void 0;break;case`message`:t[n]=void 0;break}}function Pm(e,t){if(typeof e!=`object`||!e||!Object.getOwnPropertyNames(Qp.prototype).every(t=>t in e&&typeof e[t]==`function`))return!1;let n=e.getType();return n===null||typeof n!=`function`||!(`typeName`in n)||typeof n.typeName!=`string`?!1:t===void 0?!0:n.typeName==t.typeName}function Fm(e,t){return Pm(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}z.DOUBLE,z.FLOAT,z.INT64,z.UINT64,z.INT32,z.UINT32,z.BOOL,z.STRING,z.BYTES;var Im={ignoreUnknownFields:!1},Lm={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Rm(e){return e?Object.assign(Object.assign({},Im),e):Im}function zm(e){return e?Object.assign(Object.assign({},Lm),e):Lm}var Bm=Symbol(),Vm=Symbol();function Hm(){return{makeReadOptions:Rm,makeWriteOptions:zm,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!=`object`)throw Error(`cannot decode message ${e.typeName} from JSON: ${Um(t)}`);r??=new e;let i=new Map,a=n.typeRegistry;for(let[o,s]of Object.entries(t)){let t=e.fields.findJsonName(o);if(t){if(t.oneof){if(s===null&&t.kind==`scalar`)continue;let n=i.get(t.oneof);if(n!==void 0)throw Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${o}"`);i.set(t.oneof,o)}Wm(r,s,t,n,e)}else{let t=!1;if(a?.findExtension&&o.startsWith(`[`)&&o.endsWith(`]`)){let i=a.findExtension(o.substring(1,o.length-1));if(i&&i.extendee.typeName==e.typeName){t=!0;let[e,a]=Sm(i);Wm(e,s,i.field,n,i),km(r,i,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!Mm(i,e)){if(i.req)throw`required field not set`;if(!t.emitDefaultValues||!Jm(i))continue}let n=i.oneof?e[i.oneof.localName].value:e[i.localName],a=Ym(i,n,t);a!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=a)}let a=t.typeRegistry;if(a?.findExtensionFor)for(let i of n.runtime.bin.listUnknownFields(e)){let o=a.findExtensionFor(n.typeName,i.no);if(o&&Am(e,o)){let n=Om(e,o,t),i=Ym(o.field,n,t);i!==void 0&&(r[o.field.jsonName]=i)}}}catch(e){let t=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,r=e instanceof Error?e.message:String(e);throw Error(t+(r.length>0?`: ${r}`:``))}return r},readScalar(e,t,n){return Km(e,t,n??mm.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||_m(e,t)))return Zm(e,t)},debug:Um}}function Um(e){if(e===null)return`null`;switch(typeof e){case`object`:return Array.isArray(e)?`array`:`object`;case`string`:return e.length>100?`string`:`"${e.split(`"`).join(`\\"`)}"`;default:return String(e)}}function Wm(e,t,n,r,i){let a=n.localName;if(n.repeated){if(Lp(n.kind!=`map`),t===null)return;if(!Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${Um(t)}`);let o=e[a];for(let e of t){if(e===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${Um(e)}`);switch(n.kind){case`message`:o.push(n.T.fromJson(e,r));break;case`enum`:let t=qm(n.T,e,r.ignoreUnknownFields,!0);t!==Vm&&o.push(t);break;case`scalar`:try{o.push(Km(n.T,e,n.L,!0))}catch(t){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${Um(e)}`;throw t instanceof Error&&t.message.length>0&&(r+=`: ${t.message}`),Error(r)}break}}}else if(n.kind==`map`){if(t===null)return;if(typeof t!=`object`||Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${Um(t)}`);let o=e[a];for(let[e,a]of Object.entries(t)){if(a===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let s;try{s=Gm(n.K,e)}catch(e){let r=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${Um(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}switch(n.V.kind){case`message`:o[s]=n.V.T.fromJson(a,r);break;case`enum`:let e=qm(n.V.T,a,r.ignoreUnknownFields,!0);e!==Vm&&(o[s]=e);break;case`scalar`:try{o[s]=Km(n.V.T,a,mm.BIGINT,!0)}catch(e){let r=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${Um(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a=`value`),n.kind){case`message`:let o=n.T;if(t===null&&o.typeName!=`google.protobuf.Value`)return;let s=e[a];Pm(s)?s.fromJson(t,r):(e[a]=s=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[a]=o.fieldWrapper.unwrapField(s)));break;case`enum`:let c=qm(n.T,t,r.ignoreUnknownFields,!1);switch(c){case Bm:Nm(n,e);break;case Vm:break;default:e[a]=c;break}break;case`scalar`:try{let r=Km(n.T,t,n.L,!1);switch(r){case Bm:Nm(n,e);break;default:e[a]=r;break}}catch(e){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${Um(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}break}}function Gm(e,t){if(e===z.BOOL)switch(t){case`true`:t=!0;break;case`false`:t=!1;break}return Km(e,t,mm.BIGINT,!0).toString()}function Km(e,t,n,r){if(t===null)return r?gm(e,n):Bm;switch(e){case z.DOUBLE:case z.FLOAT:if(t===`NaN`)return NaN;if(t===`Infinity`)return 1/0;if(t===`-Infinity`)return-1/0;if(t===``||typeof t==`string`&&t.trim().length!==t.length||typeof t!=`string`&&typeof t!=`number`)break;let r=Number(t);if(Number.isNaN(r)||!Number.isFinite(r))break;return e==z.FLOAT&&Gp(r),r;case z.INT32:case z.FIXED32:case z.SFIXED32:case z.SINT32:case z.UINT32:let i;if(typeof t==`number`?i=t:typeof t==`string`&&t.length>0&&t.trim().length===t.length&&(i=Number(t)),i===void 0)break;return e==z.UINT32||e==z.FIXED32?Wp(i):Up(i),i;case z.INT64:case z.SFIXED64:case z.SINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let a=pm.parse(t);return n?a.toString():a;case z.FIXED64:case z.UINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let o=pm.uParse(t);return n?o.toString():o;case z.BOOL:if(typeof t!=`boolean`)break;return t;case z.STRING:if(typeof t!=`string`)break;return t;case z.BYTES:if(t===``)return new Uint8Array;if(typeof t!=`string`)break;return Dm.dec(t)}throw Error()}function qm(e,t,n,r){if(t===null)return e.typeName==`google.protobuf.NullValue`?0:r?e.values[0].no:Bm;switch(typeof t){case`number`:if(Number.isInteger(t))return t;break;case`string`:let r=e.findName(t);if(r!==void 0)return r.no;if(n)return Vm;break}throw Error(`cannot decode enum ${e.typeName} from JSON: ${Um(t)}`)}function Jm(e){return e.repeated||e.kind==`map`?!0:!(e.oneof||e.kind==`message`||e.opt||e.req)}function Ym(e,t,n){if(e.kind==`map`){Lp(typeof t==`object`&&!!t);let r={},i=Object.entries(t);switch(e.V.kind){case`scalar`:for(let[t,n]of i)r[t.toString()]=Zm(e.V.T,n);break;case`message`:for(let[e,t]of i)r[e.toString()]=t.toJson(n);break;case`enum`:let t=e.V.T;for(let[e,a]of i)r[e.toString()]=Xm(t,a,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){Lp(Array.isArray(t));let r=[];switch(e.kind){case`scalar`:for(let n=0;n<t.length;n++)r.push(Zm(e.T,t[n]));break;case`enum`:for(let i=0;i<t.length;i++)r.push(Xm(e.T,t[i],n.enumAsInteger));break;case`message`:for(let e=0;e<t.length;e++)r.push(t[e].toJson(n));break}return n.emitDefaultValues||r.length>0?r:void 0}switch(e.kind){case`scalar`:return Zm(e.T,t);case`enum`:return Xm(e.T,t,n.enumAsInteger);case`message`:return Fm(e.T,t).toJson(n)}}function Xm(e,t,n){return Lp(typeof t==`number`),e.typeName==`google.protobuf.NullValue`?null:n?t:e.findNumber(t)?.name??t}function Zm(e,t){switch(e){case z.INT32:case z.SFIXED32:case z.SINT32:case z.FIXED32:case z.UINT32:return Lp(typeof t==`number`),t;case z.FLOAT:case z.DOUBLE:return Lp(typeof t==`number`),Number.isNaN(t)?`NaN`:t===1/0?`Infinity`:t===-1/0?`-Infinity`:t;case z.STRING:return Lp(typeof t==`string`),t;case z.BOOL:return Lp(typeof t==`boolean`),t;case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return Lp(typeof t==`bigint`||typeof t==`string`||typeof t==`number`),t.toString();case z.BYTES:return Lp(t instanceof Uint8Array),Dm.enc(t)}}var Qm=Symbol(`@bufbuild/protobuf/unknown-fields`),$m={readUnknownFields:!0,readerFactory:e=>new bm(e)},eh={writeUnknownFields:!0,writerFactory:()=>new ym};function th(e){return e?Object.assign(Object.assign({},$m),e):$m}function nh(e){return e?Object.assign(Object.assign({},eh),e):eh}function rh(){return{makeReadOptions:th,makeWriteOptions:nh,listUnknownFields(e){return e[Qm]??[]},discardUnknownFields(e){delete e[Qm]},writeUnknownFields(e,t){let n=e[Qm];if(n)for(let e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[Qm])||(i[Qm]=[]),i[Qm].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,s,c;for(;t.pos<o&&([s,c]=t.tag(),!(i===!0&&c==vm.EndGroup));){let n=a.fields.find(s);if(!n){let n=t.skip(c,s);r.readUnknownFields&&this.onUnknownField(e,s,c,n);continue}ih(e,t,n,c,r)}if(i&&(c!=vm.EndGroup||s!==n))throw Error(`invalid end group tag`)},readField:ih,writeMessage(e,t,n){let r=e.getType();for(let i of r.fields.byNumber()){if(!Mm(i,e)){if(i.req)throw Error(`cannot encode field ${r.typeName}.${i.name} to binary: required field not set`);continue}lh(i,i.oneof?e[i.oneof.localName].value:e[i.localName],t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,r){t!==void 0&&lh(e,t,n,r)}}}function ih(e,t,n,r,i){let{repeated:a,localName:o}=n;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=o&&delete e.value,e.case=o,o=`value`),n.kind){case`scalar`:case`enum`:let s=n.kind==`enum`?z.INT32:n.T,c=ch;if(n.kind==`scalar`&&n.L>0&&(c=sh),a){let n=e[o];if(r==vm.LengthDelimited&&s!=z.STRING&&s!=z.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[o]=c(t,s);break;case`message`:let l=n.T;a?e[o].push(ah(t,new l,i,n)):Pm(e[o])?ah(t,e[o],i,n):(e[o]=ah(t,new l,i,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(e[o]=l.fieldWrapper.unwrapField(e[o])));break;case`map`:let[u,d]=oh(n,t,i);e[o][u]=d;break}}function ah(e,t,n,r){let i=t.getType().runtime.bin,a=r?.delimited;return i.readMessage(t,e,a?r.no:e.uint32(),n,a),t}function oh(e,t,n){let r=t.uint32(),i=t.pos+r,a,o;for(;t.pos<i;){let[r]=t.tag();switch(r){case 1:a=ch(t,e.K);break;case 2:switch(e.V.kind){case`scalar`:o=ch(t,e.V.T);break;case`enum`:o=t.int32();break;case`message`:o=ah(t,new e.V.T,n,void 0);break}break}}if(a===void 0&&(a=gm(e.K,mm.BIGINT)),typeof a!=`string`&&typeof a!=`number`&&(a=a.toString()),o===void 0)switch(e.V.kind){case`scalar`:o=gm(e.V.T,mm.BIGINT);break;case`enum`:o=e.V.T.values[0].no;break;case`message`:o=new e.V.T;break}return[a,o]}function sh(e,t){let n=ch(e,t);return typeof n==`bigint`?n.toString():n}function ch(e,t){switch(t){case z.STRING:return e.string();case z.BOOL:return e.bool();case z.DOUBLE:return e.double();case z.FLOAT:return e.float();case z.INT32:return e.int32();case z.INT64:return e.int64();case z.UINT64:return e.uint64();case z.FIXED64:return e.fixed64();case z.BYTES:return e.bytes();case z.FIXED32:return e.fixed32();case z.SFIXED32:return e.sfixed32();case z.SFIXED64:return e.sfixed64();case z.SINT64:return e.sint64();case z.UINT32:return e.uint32();case z.SINT32:return e.sint32()}}function lh(e,t,n,r){Lp(t!==void 0);let i=e.repeated;switch(e.kind){case`scalar`:case`enum`:let a=e.kind==`enum`?z.INT32:e.T;if(i)if(Lp(Array.isArray(t)),e.packed)ph(n,a,e.no,t);else for(let r of t)fh(n,a,e.no,r);else fh(n,a,e.no,t);break;case`message`:if(i){Lp(Array.isArray(t));for(let i of t)dh(n,r,e,i)}else dh(n,r,e,t);break;case`map`:Lp(typeof t==`object`&&!!t);for(let[i,a]of Object.entries(t))uh(n,r,e,i,a);break}}function uh(e,t,n,r,i){e.tag(n.no,vm.LengthDelimited),e.fork();let a=r;switch(n.K){case z.INT32:case z.FIXED32:case z.UINT32:case z.SFIXED32:case z.SINT32:a=Number.parseInt(r);break;case z.BOOL:Lp(r==`true`||r==`false`),a=r==`true`;break}switch(fh(e,n.K,1,a),n.V.kind){case`scalar`:fh(e,n.V.T,2,i);break;case`enum`:fh(e,z.INT32,2,i);break;case`message`:Lp(i!==void 0),e.tag(2,vm.LengthDelimited).bytes(i.toBinary(t));break}e.join()}function dh(e,t,n,r){let i=Fm(n.T,r);n.delimited?e.tag(n.no,vm.StartGroup).raw(i.toBinary(t)).tag(n.no,vm.EndGroup):e.tag(n.no,vm.LengthDelimited).bytes(i.toBinary(t))}function fh(e,t,n,r){Lp(r!==void 0);let[i,a]=mh(t);e.tag(n,i)[a](r)}function ph(e,t,n,r){if(!r.length)return;e.tag(n,vm.LengthDelimited).fork();let[,i]=mh(t);for(let t=0;t<r.length;t++)e[i](r[t]);e.join()}function mh(e){let t=vm.Varint;switch(e){case z.BYTES:case z.STRING:t=vm.LengthDelimited;break;case z.DOUBLE:case z.FIXED64:case z.SFIXED64:t=vm.Bit64;break;case z.FIXED32:case z.SFIXED32:case z.FLOAT:t=vm.Bit32;break}let n=z[e].toLowerCase();return[t,n]}function hh(){return{setEnumType:Jp,initPartial(e,t){if(e===void 0)return;let n=t.getType();for(let r of n.fields.byMember()){let n=r.localName,i=t,a=e;if(a[n]!=null)switch(r.kind){case`oneof`:let e=a[n].case;if(e===void 0)continue;let t=r.findField(e),o=a[n].value;t&&t.kind==`message`&&!Pm(o,t.T)?o=new t.T(o):t&&t.kind===`scalar`&&t.T===z.BYTES&&(o=_h(o)),i[n]={case:e,value:o};break;case`scalar`:case`enum`:let s=a[n];r.T===z.BYTES&&(s=r.repeated?s.map(_h):_h(s)),i[n]=s;break;case`map`:switch(r.V.kind){case`scalar`:case`enum`:if(r.V.T===z.BYTES)for(let[e,t]of Object.entries(a[n]))i[n][e]=_h(t);else Object.assign(i[n],a[n]);break;case`message`:let e=r.V.T;for(let t of Object.keys(a[n])){let r=a[n][t];e.fieldWrapper||(r=new e(r)),i[n][t]=r}break}break;case`message`:let c=r.T;if(r.repeated)i[n]=a[n].map(e=>Pm(e,c)?e:new c(e));else{let e=a[n];c.fieldWrapper?c.typeName===`google.protobuf.BytesValue`?i[n]=_h(e):i[n]=e:i[n]=Pm(e,c)?e:new c(e)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(e=>{let r=t[e.localName],i=n[e.localName];if(e.repeated){if(r.length!==i.length)return!1;switch(e.kind){case`message`:return r.every((t,n)=>e.T.equals(t,i[n]));case`scalar`:return r.every((t,n)=>hm(e.T,t,i[n]));case`enum`:return r.every((e,t)=>hm(z.INT32,e,i[t]))}throw Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case`message`:let t=r,n=i;return e.T.fieldWrapper&&(t!==void 0&&!Pm(t)&&(t=e.T.fieldWrapper.wrapField(t)),n!==void 0&&!Pm(n)&&(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case`enum`:return hm(z.INT32,r,i);case`scalar`:return hm(e.T,r,i);case`oneof`:if(r.case!==i.case)return!1;let a=e.findField(r.case);if(a===void 0)return!0;switch(a.kind){case`message`:return a.T.equals(r.value,i.value);case`enum`:return hm(z.INT32,r.value,i.value);case`scalar`:return hm(a.T,r.value,i.value)}throw Error(`oneof cannot contain ${a.kind}`);case`map`:let o=Object.keys(r).concat(Object.keys(i));switch(e.V.kind){case`message`:let t=e.V.T;return o.every(e=>t.equals(r[e],i[e]));case`enum`:return o.every(e=>hm(z.INT32,r[e],i[e]));case`scalar`:let n=e.V.T;return o.every(e=>hm(n,r[e],i[e]))}break}})},clone(e){let t=e.getType(),n=new t,r=n;for(let n of t.fields.byMember()){let t=e[n.localName],i;if(n.repeated)i=t.map(gh);else if(n.kind==`map`){i=r[n.localName];for(let[e,n]of Object.entries(t))i[e]=gh(n)}else i=n.kind==`oneof`?n.findField(t.case)?{case:t.case,value:gh(t.value)}:{case:void 0}:gh(t);r[n.localName]=i}for(let n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,n.no,n.wireType,n.data);return n}}}function gh(e){if(e===void 0)return e;if(Pm(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function _h(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function vh(e,t,n){return{syntax:e,json:Hm(),bin:rh(),util:Object.assign(Object.assign({},hh()),{newFieldList:t,initFields:n}),makeMessageType(e,t,n){return $p(this,e,t,n)},makeEnum:Xp,makeEnumType:Yp,getEnumType:qp,makeExtension(e,t,n){return xm(this,e,t,n)}}}var yh=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){let e={};for(let t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){let e={};for(let t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||=this._normalizer(this._fields),this.all}byNumber(){return this.numbersAsc||=this.list().concat().sort((e,t)=>e.no-t.no),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,t;for(let n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function bh(e,t){let n=Ch(e);return t?n:Oh(Dh(n))}function xh(e){return bh(e,!1)}var Sh=Ch;function Ch(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i);break}}return n.join(``)}var wh=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]),Th=new Set([`getType`,`clone`,`equals`,`fromBinary`,`fromJson`,`fromJsonString`,`toBinary`,`toJson`,`toJsonString`,`toObject`]),Eh=e=>`${e}\$`,Dh=e=>Th.has(e)?Eh(e):e,Oh=e=>wh.has(e)?Eh(e):e,kh=class{constructor(e){this.kind=`oneof`,this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=xh(e)}addField(e){Lp(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}};function Ah(e,t){let n=[],r;for(let t of typeof e==`function`?e():e){let e=t;if(e.localName=bh(t.name,t.oneof!==void 0),e.jsonName=t.jsonName??Sh(t.name),e.repeated=t.repeated??!1,t.kind==`scalar`&&(e.L=t.L??mm.BIGINT),e.delimited=t.delimited??!1,e.req=t.req??!1,e.opt=t.opt??!1,t.packed===void 0&&(e.packed=t.kind==`enum`||t.kind==`scalar`&&t.T!=z.BYTES&&t.T!=z.STRING),t.oneof!==void 0){let n=typeof t.oneof==`string`?t.oneof:t.oneof.name;(!r||r.name!=n)&&(r=new kh(n)),e.oneof=r,r.addField(e)}n.push(e)}return n}var B=vh(`proto3`,e=>new yh(e,e=>Ah(e)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case`oneof`:r[n]={case:void 0};break;case`enum`:r[n]=0;break;case`map`:r[n]={};break;case`scalar`:r[n]=gm(t.T,t.L);break}}}),jh=class e extends Qp{constructor(e){super(),this.seconds=pm.zero,this.nanos=0,B.util.initPartial(e,this)}fromJson(e,t){if(typeof e!=`string`)throw Error(`cannot decode google.protobuf.Timestamp from JSON: ${B.json.debug(e)}`);let n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);let r=Date.parse(n[1]+`-`+n[2]+`-`+n[3]+`T`+n[4]+`:`+n[5]+`:`+n[6]+(n[8]?n[8]:`Z`));if(Number.isNaN(r))throw Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);if(r<Date.parse(`0001-01-01T00:00:00Z`)||r>Date.parse(`9999-12-31T23:59:59Z`))throw Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);return this.seconds=pm.parse(r/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt(`1`+n[7]+`0`.repeat(9-n[7].length))-1e9),this}toJson(e){let t=Number(this.seconds)*1e3;if(t<Date.parse(`0001-01-01T00:00:00Z`)||t>Date.parse(`9999-12-31T23:59:59Z`))throw Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);if(this.nanos<0)throw Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);let n=`Z`;if(this.nanos>0){let e=(this.nanos+1e9).toString().substring(1);n=e.substring(3)===`000000`?`.`+e.substring(0,3)+`Z`:e.substring(6)===`000`?`.`+e.substring(0,6)+`Z`:`.`+e+`Z`}return new Date(t).toISOString().replace(`.000Z`,n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return e.fromDate(new Date)}static fromDate(t){let n=t.getTime();return new e({seconds:pm.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return B.util.equals(e,t,n)}};jh.runtime=B,jh.typeName=`google.protobuf.Timestamp`,jh.fields=B.util.newFieldList(()=>[{no:1,name:`seconds`,kind:`scalar`,T:3},{no:2,name:`nanos`,kind:`scalar`,T:5}]);var Mh=B.makeMessageType(`livekit.MetricsBatch`,()=>[{no:1,name:`timestamp_ms`,kind:`scalar`,T:3},{no:2,name:`normalized_timestamp`,kind:`message`,T:jh},{no:3,name:`str_data`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`time_series`,kind:`message`,T:Nh,repeated:!0},{no:5,name:`events`,kind:`message`,T:Fh,repeated:!0}]),Nh=B.makeMessageType(`livekit.TimeSeriesMetric`,()=>[{no:1,name:`label`,kind:`scalar`,T:13},{no:2,name:`participant_identity`,kind:`scalar`,T:13},{no:3,name:`track_sid`,kind:`scalar`,T:13},{no:4,name:`samples`,kind:`message`,T:Ph,repeated:!0},{no:5,name:`rid`,kind:`scalar`,T:13}]),Ph=B.makeMessageType(`livekit.MetricSample`,()=>[{no:1,name:`timestamp_ms`,kind:`scalar`,T:3},{no:2,name:`normalized_timestamp`,kind:`message`,T:jh},{no:3,name:`value`,kind:`scalar`,T:2}]),Fh=B.makeMessageType(`livekit.EventMetric`,()=>[{no:1,name:`label`,kind:`scalar`,T:13},{no:2,name:`participant_identity`,kind:`scalar`,T:13},{no:3,name:`track_sid`,kind:`scalar`,T:13},{no:4,name:`start_timestamp_ms`,kind:`scalar`,T:3},{no:5,name:`end_timestamp_ms`,kind:`scalar`,T:3,opt:!0},{no:6,name:`normalized_start_timestamp`,kind:`message`,T:jh},{no:7,name:`normalized_end_timestamp`,kind:`message`,T:jh,opt:!0},{no:8,name:`metadata`,kind:`scalar`,T:9},{no:9,name:`rid`,kind:`scalar`,T:13}]),Ih=B.makeEnum(`livekit.BackupCodecPolicy`,[{no:0,name:`PREFER_REGRESSION`},{no:1,name:`SIMULCAST`},{no:2,name:`REGRESSION`}]),Lh=B.makeEnum(`livekit.TrackType`,[{no:0,name:`AUDIO`},{no:1,name:`VIDEO`},{no:2,name:`DATA`}]),Rh=B.makeEnum(`livekit.TrackSource`,[{no:0,name:`UNKNOWN`},{no:1,name:`CAMERA`},{no:2,name:`MICROPHONE`},{no:3,name:`SCREEN_SHARE`},{no:4,name:`SCREEN_SHARE_AUDIO`}]),zh=B.makeEnum(`livekit.VideoQuality`,[{no:0,name:`LOW`},{no:1,name:`MEDIUM`},{no:2,name:`HIGH`},{no:3,name:`OFF`}]),Bh=B.makeEnum(`livekit.ConnectionQuality`,[{no:0,name:`POOR`},{no:1,name:`GOOD`},{no:2,name:`EXCELLENT`},{no:3,name:`LOST`}]),Vh=B.makeEnum(`livekit.ClientConfigSetting`,[{no:0,name:`UNSET`},{no:1,name:`DISABLED`},{no:2,name:`ENABLED`}]),Hh=B.makeEnum(`livekit.DisconnectReason`,[{no:0,name:`UNKNOWN_REASON`},{no:1,name:`CLIENT_INITIATED`},{no:2,name:`DUPLICATE_IDENTITY`},{no:3,name:`SERVER_SHUTDOWN`},{no:4,name:`PARTICIPANT_REMOVED`},{no:5,name:`ROOM_DELETED`},{no:6,name:`STATE_MISMATCH`},{no:7,name:`JOIN_FAILURE`},{no:8,name:`MIGRATION`},{no:9,name:`SIGNAL_CLOSE`},{no:10,name:`ROOM_CLOSED`},{no:11,name:`USER_UNAVAILABLE`},{no:12,name:`USER_REJECTED`},{no:13,name:`SIP_TRUNK_FAILURE`},{no:14,name:`CONNECTION_TIMEOUT`},{no:15,name:`MEDIA_FAILURE`}]),Uh=B.makeEnum(`livekit.ReconnectReason`,[{no:0,name:`RR_UNKNOWN`},{no:1,name:`RR_SIGNAL_DISCONNECTED`},{no:2,name:`RR_PUBLISHER_FAILED`},{no:3,name:`RR_SUBSCRIBER_FAILED`},{no:4,name:`RR_SWITCH_CANDIDATE`}]),Wh=B.makeEnum(`livekit.SubscriptionError`,[{no:0,name:`SE_UNKNOWN`},{no:1,name:`SE_CODEC_UNSUPPORTED`},{no:2,name:`SE_TRACK_NOTFOUND`}]),Gh=B.makeEnum(`livekit.AudioTrackFeature`,[{no:0,name:`TF_STEREO`},{no:1,name:`TF_NO_DTX`},{no:2,name:`TF_AUTO_GAIN_CONTROL`},{no:3,name:`TF_ECHO_CANCELLATION`},{no:4,name:`TF_NOISE_SUPPRESSION`},{no:5,name:`TF_ENHANCED_NOISE_CANCELLATION`},{no:6,name:`TF_PRECONNECT_BUFFER`}]),Kh=B.makeMessageType(`livekit.Room`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`empty_timeout`,kind:`scalar`,T:13},{no:14,name:`departure_timeout`,kind:`scalar`,T:13},{no:4,name:`max_participants`,kind:`scalar`,T:13},{no:5,name:`creation_time`,kind:`scalar`,T:3},{no:15,name:`creation_time_ms`,kind:`scalar`,T:3},{no:6,name:`turn_password`,kind:`scalar`,T:9},{no:7,name:`enabled_codecs`,kind:`message`,T:qh,repeated:!0},{no:8,name:`metadata`,kind:`scalar`,T:9},{no:9,name:`num_participants`,kind:`scalar`,T:13},{no:11,name:`num_publishers`,kind:`scalar`,T:13},{no:10,name:`active_recording`,kind:`scalar`,T:8},{no:13,name:`version`,kind:`message`,T:kg}]),qh=B.makeMessageType(`livekit.Codec`,()=>[{no:1,name:`mime`,kind:`scalar`,T:9},{no:2,name:`fmtp_line`,kind:`scalar`,T:9}]),Jh=B.makeMessageType(`livekit.ParticipantPermission`,()=>[{no:1,name:`can_subscribe`,kind:`scalar`,T:8},{no:2,name:`can_publish`,kind:`scalar`,T:8},{no:3,name:`can_publish_data`,kind:`scalar`,T:8},{no:9,name:`can_publish_sources`,kind:`enum`,T:B.getEnumType(Rh),repeated:!0},{no:7,name:`hidden`,kind:`scalar`,T:8},{no:8,name:`recorder`,kind:`scalar`,T:8},{no:10,name:`can_update_metadata`,kind:`scalar`,T:8},{no:11,name:`agent`,kind:`scalar`,T:8},{no:12,name:`can_subscribe_metrics`,kind:`scalar`,T:8}]),Yh=B.makeMessageType(`livekit.ParticipantInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`identity`,kind:`scalar`,T:9},{no:3,name:`state`,kind:`enum`,T:B.getEnumType(Xh)},{no:4,name:`tracks`,kind:`message`,T:tg,repeated:!0},{no:5,name:`metadata`,kind:`scalar`,T:9},{no:6,name:`joined_at`,kind:`scalar`,T:3},{no:17,name:`joined_at_ms`,kind:`scalar`,T:3},{no:9,name:`name`,kind:`scalar`,T:9},{no:10,name:`version`,kind:`scalar`,T:13},{no:11,name:`permission`,kind:`message`,T:Jh},{no:12,name:`region`,kind:`scalar`,T:9},{no:13,name:`is_publisher`,kind:`scalar`,T:8},{no:14,name:`kind`,kind:`enum`,T:B.getEnumType(Zh)},{no:15,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:16,name:`disconnect_reason`,kind:`enum`,T:B.getEnumType(Hh)},{no:18,name:`kind_details`,kind:`enum`,T:B.getEnumType(Qh),repeated:!0},{no:19,name:`data_tracks`,kind:`message`,T:ng,repeated:!0}]),Xh=B.makeEnum(`livekit.ParticipantInfo.State`,[{no:0,name:`JOINING`},{no:1,name:`JOINED`},{no:2,name:`ACTIVE`},{no:3,name:`DISCONNECTED`}]),Zh=B.makeEnum(`livekit.ParticipantInfo.Kind`,[{no:0,name:`STANDARD`},{no:1,name:`INGRESS`},{no:2,name:`EGRESS`},{no:3,name:`SIP`},{no:4,name:`AGENT`},{no:7,name:`CONNECTOR`},{no:8,name:`BRIDGE`}]),Qh=B.makeEnum(`livekit.ParticipantInfo.KindDetail`,[{no:0,name:`CLOUD_AGENT`},{no:1,name:`FORWARDED`},{no:2,name:`CONNECTOR_WHATSAPP`},{no:3,name:`CONNECTOR_TWILIO`},{no:4,name:`BRIDGE_RTSP`}]),$h=B.makeEnum(`livekit.Encryption.Type`,[{no:0,name:`NONE`},{no:1,name:`GCM`},{no:2,name:`CUSTOM`}]),eg=B.makeMessageType(`livekit.SimulcastCodecInfo`,()=>[{no:1,name:`mime_type`,kind:`scalar`,T:9},{no:2,name:`mid`,kind:`scalar`,T:9},{no:3,name:`cid`,kind:`scalar`,T:9},{no:4,name:`layers`,kind:`message`,T:ig,repeated:!0},{no:5,name:`video_layer_mode`,kind:`enum`,T:B.getEnumType(ag)},{no:6,name:`sdp_cid`,kind:`scalar`,T:9}]),tg=B.makeMessageType(`livekit.TrackInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`type`,kind:`enum`,T:B.getEnumType(Lh)},{no:3,name:`name`,kind:`scalar`,T:9},{no:4,name:`muted`,kind:`scalar`,T:8},{no:5,name:`width`,kind:`scalar`,T:13},{no:6,name:`height`,kind:`scalar`,T:13},{no:7,name:`simulcast`,kind:`scalar`,T:8},{no:8,name:`disable_dtx`,kind:`scalar`,T:8},{no:9,name:`source`,kind:`enum`,T:B.getEnumType(Rh)},{no:10,name:`layers`,kind:`message`,T:ig,repeated:!0},{no:11,name:`mime_type`,kind:`scalar`,T:9},{no:12,name:`mid`,kind:`scalar`,T:9},{no:13,name:`codecs`,kind:`message`,T:eg,repeated:!0},{no:14,name:`stereo`,kind:`scalar`,T:8},{no:15,name:`disable_red`,kind:`scalar`,T:8},{no:16,name:`encryption`,kind:`enum`,T:B.getEnumType($h)},{no:17,name:`stream`,kind:`scalar`,T:9},{no:18,name:`version`,kind:`message`,T:kg},{no:19,name:`audio_features`,kind:`enum`,T:B.getEnumType(Gh),repeated:!0},{no:20,name:`backup_codec_policy`,kind:`enum`,T:B.getEnumType(Ih)}]),ng=B.makeMessageType(`livekit.DataTrackInfo`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13},{no:2,name:`sid`,kind:`scalar`,T:9},{no:3,name:`name`,kind:`scalar`,T:9},{no:4,name:`encryption`,kind:`enum`,T:B.getEnumType($h)}]),rg=B.makeMessageType(`livekit.DataTrackSubscriptionOptions`,()=>[{no:1,name:`target_fps`,kind:`scalar`,T:13,opt:!0}]),ig=B.makeMessageType(`livekit.VideoLayer`,()=>[{no:1,name:`quality`,kind:`enum`,T:B.getEnumType(zh)},{no:2,name:`width`,kind:`scalar`,T:13},{no:3,name:`height`,kind:`scalar`,T:13},{no:4,name:`bitrate`,kind:`scalar`,T:13},{no:5,name:`ssrc`,kind:`scalar`,T:13},{no:6,name:`spatial_layer`,kind:`scalar`,T:5},{no:7,name:`rid`,kind:`scalar`,T:9},{no:8,name:`repair_ssrc`,kind:`scalar`,T:13}]),ag=B.makeEnum(`livekit.VideoLayer.Mode`,[{no:0,name:`MODE_UNUSED`},{no:1,name:`ONE_SPATIAL_LAYER_PER_STREAM`},{no:2,name:`MULTIPLE_SPATIAL_LAYERS_PER_STREAM`},{no:3,name:`ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR`}]),og=B.makeMessageType(`livekit.DataPacket`,()=>[{no:1,name:`kind`,kind:`enum`,T:B.getEnumType(sg)},{no:4,name:`participant_identity`,kind:`scalar`,T:9},{no:5,name:`destination_identities`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`user`,kind:`message`,T:fg,oneof:`value`},{no:3,name:`speaker`,kind:`message`,T:ug,oneof:`value`},{no:6,name:`sip_dtmf`,kind:`message`,T:pg,oneof:`value`},{no:7,name:`transcription`,kind:`message`,T:mg,oneof:`value`},{no:8,name:`metrics`,kind:`message`,T:Mh,oneof:`value`},{no:9,name:`chat_message`,kind:`message`,T:gg,oneof:`value`},{no:10,name:`rpc_request`,kind:`message`,T:_g,oneof:`value`},{no:11,name:`rpc_ack`,kind:`message`,T:vg,oneof:`value`},{no:12,name:`rpc_response`,kind:`message`,T:yg,oneof:`value`},{no:13,name:`stream_header`,kind:`message`,T:Ng,oneof:`value`},{no:14,name:`stream_chunk`,kind:`message`,T:Pg,oneof:`value`},{no:15,name:`stream_trailer`,kind:`message`,T:Fg,oneof:`value`},{no:18,name:`encrypted_packet`,kind:`message`,T:cg,oneof:`value`},{no:16,name:`sequence`,kind:`scalar`,T:13},{no:17,name:`participant_sid`,kind:`scalar`,T:9}]),sg=B.makeEnum(`livekit.DataPacket.Kind`,[{no:0,name:`RELIABLE`},{no:1,name:`LOSSY`}]),cg=B.makeMessageType(`livekit.EncryptedPacket`,()=>[{no:1,name:`encryption_type`,kind:`enum`,T:B.getEnumType($h)},{no:2,name:`iv`,kind:`scalar`,T:12},{no:3,name:`key_index`,kind:`scalar`,T:13},{no:4,name:`encrypted_value`,kind:`scalar`,T:12}]),lg=B.makeMessageType(`livekit.EncryptedPacketPayload`,()=>[{no:1,name:`user`,kind:`message`,T:fg,oneof:`value`},{no:3,name:`chat_message`,kind:`message`,T:gg,oneof:`value`},{no:4,name:`rpc_request`,kind:`message`,T:_g,oneof:`value`},{no:5,name:`rpc_ack`,kind:`message`,T:vg,oneof:`value`},{no:6,name:`rpc_response`,kind:`message`,T:yg,oneof:`value`},{no:7,name:`stream_header`,kind:`message`,T:Ng,oneof:`value`},{no:8,name:`stream_chunk`,kind:`message`,T:Pg,oneof:`value`},{no:9,name:`stream_trailer`,kind:`message`,T:Fg,oneof:`value`}]),ug=B.makeMessageType(`livekit.ActiveSpeakerUpdate`,()=>[{no:1,name:`speakers`,kind:`message`,T:dg,repeated:!0}]),dg=B.makeMessageType(`livekit.SpeakerInfo`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`level`,kind:`scalar`,T:2},{no:3,name:`active`,kind:`scalar`,T:8}]),fg=B.makeMessageType(`livekit.UserPacket`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:5,name:`participant_identity`,kind:`scalar`,T:9},{no:2,name:`payload`,kind:`scalar`,T:12},{no:3,name:`destination_sids`,kind:`scalar`,T:9,repeated:!0},{no:6,name:`destination_identities`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`topic`,kind:`scalar`,T:9,opt:!0},{no:8,name:`id`,kind:`scalar`,T:9,opt:!0},{no:9,name:`start_time`,kind:`scalar`,T:4,opt:!0},{no:10,name:`end_time`,kind:`scalar`,T:4,opt:!0},{no:11,name:`nonce`,kind:`scalar`,T:12}]),pg=B.makeMessageType(`livekit.SipDTMF`,()=>[{no:3,name:`code`,kind:`scalar`,T:13},{no:4,name:`digit`,kind:`scalar`,T:9}]),mg=B.makeMessageType(`livekit.Transcription`,()=>[{no:2,name:`transcribed_participant_identity`,kind:`scalar`,T:9},{no:3,name:`track_id`,kind:`scalar`,T:9},{no:4,name:`segments`,kind:`message`,T:hg,repeated:!0}]),hg=B.makeMessageType(`livekit.TranscriptionSegment`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`text`,kind:`scalar`,T:9},{no:3,name:`start_time`,kind:`scalar`,T:4},{no:4,name:`end_time`,kind:`scalar`,T:4},{no:5,name:`final`,kind:`scalar`,T:8},{no:6,name:`language`,kind:`scalar`,T:9}]),gg=B.makeMessageType(`livekit.ChatMessage`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`timestamp`,kind:`scalar`,T:3},{no:3,name:`edit_timestamp`,kind:`scalar`,T:3,opt:!0},{no:4,name:`message`,kind:`scalar`,T:9},{no:5,name:`deleted`,kind:`scalar`,T:8},{no:6,name:`generated`,kind:`scalar`,T:8}]),_g=B.makeMessageType(`livekit.RpcRequest`,()=>[{no:1,name:`id`,kind:`scalar`,T:9},{no:2,name:`method`,kind:`scalar`,T:9},{no:3,name:`payload`,kind:`scalar`,T:9},{no:4,name:`response_timeout_ms`,kind:`scalar`,T:13},{no:5,name:`version`,kind:`scalar`,T:13}]),vg=B.makeMessageType(`livekit.RpcAck`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:9}]),yg=B.makeMessageType(`livekit.RpcResponse`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:9},{no:2,name:`payload`,kind:`scalar`,T:9,oneof:`value`},{no:3,name:`error`,kind:`message`,T:bg,oneof:`value`}]),bg=B.makeMessageType(`livekit.RpcError`,()=>[{no:1,name:`code`,kind:`scalar`,T:13},{no:2,name:`message`,kind:`scalar`,T:9},{no:3,name:`data`,kind:`scalar`,T:9}]),xg=B.makeMessageType(`livekit.ParticipantTracks`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sids`,kind:`scalar`,T:9,repeated:!0}]),Sg=B.makeMessageType(`livekit.ServerInfo`,()=>[{no:1,name:`edition`,kind:`enum`,T:B.getEnumType(Cg)},{no:2,name:`version`,kind:`scalar`,T:9},{no:3,name:`protocol`,kind:`scalar`,T:5},{no:4,name:`region`,kind:`scalar`,T:9},{no:5,name:`node_id`,kind:`scalar`,T:9},{no:6,name:`debug_info`,kind:`scalar`,T:9},{no:7,name:`agent_protocol`,kind:`scalar`,T:5}]),Cg=B.makeEnum(`livekit.ServerInfo.Edition`,[{no:0,name:`Standard`},{no:1,name:`Cloud`}]),wg=B.makeMessageType(`livekit.ClientInfo`,()=>[{no:1,name:`sdk`,kind:`enum`,T:B.getEnumType(Tg)},{no:2,name:`version`,kind:`scalar`,T:9},{no:3,name:`protocol`,kind:`scalar`,T:5},{no:4,name:`os`,kind:`scalar`,T:9},{no:5,name:`os_version`,kind:`scalar`,T:9},{no:6,name:`device_model`,kind:`scalar`,T:9},{no:7,name:`browser`,kind:`scalar`,T:9},{no:8,name:`browser_version`,kind:`scalar`,T:9},{no:9,name:`address`,kind:`scalar`,T:9},{no:10,name:`network`,kind:`scalar`,T:9},{no:11,name:`other_sdks`,kind:`scalar`,T:9}]),Tg=B.makeEnum(`livekit.ClientInfo.SDK`,[{no:0,name:`UNKNOWN`},{no:1,name:`JS`},{no:2,name:`SWIFT`},{no:3,name:`ANDROID`},{no:4,name:`FLUTTER`},{no:5,name:`GO`},{no:6,name:`UNITY`},{no:7,name:`REACT_NATIVE`},{no:8,name:`RUST`},{no:9,name:`PYTHON`},{no:10,name:`CPP`},{no:11,name:`UNITY_WEB`},{no:12,name:`NODE`},{no:13,name:`UNREAL`},{no:14,name:`ESP32`}]),Eg=B.makeMessageType(`livekit.ClientConfiguration`,()=>[{no:1,name:`video`,kind:`message`,T:Dg},{no:2,name:`screen`,kind:`message`,T:Dg},{no:3,name:`resume_connection`,kind:`enum`,T:B.getEnumType(Vh)},{no:4,name:`disabled_codecs`,kind:`message`,T:Og},{no:5,name:`force_relay`,kind:`enum`,T:B.getEnumType(Vh)}]),Dg=B.makeMessageType(`livekit.VideoConfiguration`,()=>[{no:1,name:`hardware_encoder`,kind:`enum`,T:B.getEnumType(Vh)}]),Og=B.makeMessageType(`livekit.DisabledCodecs`,()=>[{no:1,name:`codecs`,kind:`message`,T:qh,repeated:!0},{no:2,name:`publish`,kind:`message`,T:qh,repeated:!0}]),kg=B.makeMessageType(`livekit.TimedVersion`,()=>[{no:1,name:`unix_micro`,kind:`scalar`,T:3},{no:2,name:`ticks`,kind:`scalar`,T:5}]),Ag=B.makeEnum(`livekit.DataStream.OperationType`,[{no:0,name:`CREATE`},{no:1,name:`UPDATE`},{no:2,name:`DELETE`},{no:3,name:`REACTION`}]),jg=B.makeMessageType(`livekit.DataStream.TextHeader`,()=>[{no:1,name:`operation_type`,kind:`enum`,T:B.getEnumType(Ag)},{no:2,name:`version`,kind:`scalar`,T:5},{no:3,name:`reply_to_stream_id`,kind:`scalar`,T:9},{no:4,name:`attached_stream_ids`,kind:`scalar`,T:9,repeated:!0},{no:5,name:`generated`,kind:`scalar`,T:8}],{localName:`DataStream_TextHeader`}),Mg=B.makeMessageType(`livekit.DataStream.ByteHeader`,()=>[{no:1,name:`name`,kind:`scalar`,T:9}],{localName:`DataStream_ByteHeader`}),Ng=B.makeMessageType(`livekit.DataStream.Header`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`timestamp`,kind:`scalar`,T:3},{no:3,name:`topic`,kind:`scalar`,T:9},{no:4,name:`mime_type`,kind:`scalar`,T:9},{no:5,name:`total_length`,kind:`scalar`,T:4,opt:!0},{no:7,name:`encryption_type`,kind:`enum`,T:B.getEnumType($h)},{no:8,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:9,name:`text_header`,kind:`message`,T:jg,oneof:`content_header`},{no:10,name:`byte_header`,kind:`message`,T:Mg,oneof:`content_header`}],{localName:`DataStream_Header`}),Pg=B.makeMessageType(`livekit.DataStream.Chunk`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`chunk_index`,kind:`scalar`,T:4},{no:3,name:`content`,kind:`scalar`,T:12},{no:4,name:`version`,kind:`scalar`,T:5},{no:5,name:`iv`,kind:`scalar`,T:12,opt:!0}],{localName:`DataStream_Chunk`}),Fg=B.makeMessageType(`livekit.DataStream.Trailer`,()=>[{no:1,name:`stream_id`,kind:`scalar`,T:9},{no:2,name:`reason`,kind:`scalar`,T:9},{no:3,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}}],{localName:`DataStream_Trailer`}),Ig=B.makeMessageType(`livekit.SubscribedAudioCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`enabled`,kind:`scalar`,T:8}]),Lg=B.makeEnum(`livekit.SignalTarget`,[{no:0,name:`PUBLISHER`},{no:1,name:`SUBSCRIBER`}]),Rg=B.makeEnum(`livekit.StreamState`,[{no:0,name:`ACTIVE`},{no:1,name:`PAUSED`}]),zg=B.makeEnum(`livekit.CandidateProtocol`,[{no:0,name:`UDP`},{no:1,name:`TCP`},{no:2,name:`TLS`}]),Bg=B.makeMessageType(`livekit.SignalRequest`,()=>[{no:1,name:`offer`,kind:`message`,T:n_,oneof:`message`},{no:2,name:`answer`,kind:`message`,T:n_,oneof:`message`},{no:3,name:`trickle`,kind:`message`,T:Xg,oneof:`message`},{no:4,name:`add_track`,kind:`message`,T:Ug,oneof:`message`},{no:5,name:`mute`,kind:`message`,T:Zg,oneof:`message`},{no:6,name:`subscription`,kind:`message`,T:i_,oneof:`message`},{no:7,name:`track_setting`,kind:`message`,T:s_,oneof:`message`},{no:8,name:`leave`,kind:`message`,T:u_,oneof:`message`},{no:10,name:`update_layers`,kind:`message`,T:f_,oneof:`message`},{no:11,name:`subscription_permission`,kind:`message`,T:E_,oneof:`message`},{no:12,name:`sync_state`,kind:`message`,T:k_,oneof:`message`},{no:13,name:`simulate`,kind:`message`,T:M_,oneof:`message`},{no:14,name:`ping`,kind:`scalar`,T:3,oneof:`message`},{no:15,name:`update_metadata`,kind:`message`,T:p_,oneof:`message`},{no:16,name:`ping_req`,kind:`message`,T:N_,oneof:`message`},{no:17,name:`update_audio_track`,kind:`message`,T:c_,oneof:`message`},{no:18,name:`update_video_track`,kind:`message`,T:l_,oneof:`message`},{no:19,name:`publish_data_track_request`,kind:`message`,T:Wg,oneof:`message`},{no:20,name:`unpublish_data_track_request`,kind:`message`,T:Kg,oneof:`message`},{no:21,name:`update_data_subscription`,kind:`message`,T:a_,oneof:`message`}]),Vg=B.makeMessageType(`livekit.SignalResponse`,()=>[{no:1,name:`join`,kind:`message`,T:Qg,oneof:`message`},{no:2,name:`answer`,kind:`message`,T:n_,oneof:`message`},{no:3,name:`offer`,kind:`message`,T:n_,oneof:`message`},{no:4,name:`trickle`,kind:`message`,T:Xg,oneof:`message`},{no:5,name:`update`,kind:`message`,T:r_,oneof:`message`},{no:6,name:`track_published`,kind:`message`,T:e_,oneof:`message`},{no:8,name:`leave`,kind:`message`,T:u_,oneof:`message`},{no:9,name:`mute`,kind:`message`,T:Zg,oneof:`message`},{no:10,name:`speakers_changed`,kind:`message`,T:h_,oneof:`message`},{no:11,name:`room_update`,kind:`message`,T:g_,oneof:`message`},{no:12,name:`connection_quality`,kind:`message`,T:v_,oneof:`message`},{no:13,name:`stream_state_update`,kind:`message`,T:b_,oneof:`message`},{no:14,name:`subscribed_quality_update`,kind:`message`,T:C_,oneof:`message`},{no:15,name:`subscription_permission_update`,kind:`message`,T:D_,oneof:`message`},{no:16,name:`refresh_token`,kind:`scalar`,T:9,oneof:`message`},{no:17,name:`track_unpublished`,kind:`message`,T:t_,oneof:`message`},{no:18,name:`pong`,kind:`scalar`,T:3,oneof:`message`},{no:19,name:`reconnect`,kind:`message`,T:$g,oneof:`message`},{no:20,name:`pong_resp`,kind:`message`,T:P_,oneof:`message`},{no:21,name:`subscription_response`,kind:`message`,T:L_,oneof:`message`},{no:22,name:`request_response`,kind:`message`,T:R_,oneof:`message`},{no:23,name:`track_subscribed`,kind:`message`,T:B_,oneof:`message`},{no:24,name:`room_moved`,kind:`message`,T:O_,oneof:`message`},{no:25,name:`media_sections_requirement`,kind:`message`,T:G_,oneof:`message`},{no:26,name:`subscribed_audio_codec_update`,kind:`message`,T:w_,oneof:`message`},{no:27,name:`publish_data_track_response`,kind:`message`,T:Gg,oneof:`message`},{no:28,name:`unpublish_data_track_response`,kind:`message`,T:qg,oneof:`message`},{no:29,name:`data_track_subscriber_handles`,kind:`message`,T:Jg,oneof:`message`}]),Hg=B.makeMessageType(`livekit.SimulcastCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`cid`,kind:`scalar`,T:9},{no:4,name:`layers`,kind:`message`,T:ig,repeated:!0},{no:5,name:`video_layer_mode`,kind:`enum`,T:B.getEnumType(ag)}]),Ug=B.makeMessageType(`livekit.AddTrackRequest`,()=>[{no:1,name:`cid`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`type`,kind:`enum`,T:B.getEnumType(Lh)},{no:4,name:`width`,kind:`scalar`,T:13},{no:5,name:`height`,kind:`scalar`,T:13},{no:6,name:`muted`,kind:`scalar`,T:8},{no:7,name:`disable_dtx`,kind:`scalar`,T:8},{no:8,name:`source`,kind:`enum`,T:B.getEnumType(Rh)},{no:9,name:`layers`,kind:`message`,T:ig,repeated:!0},{no:10,name:`simulcast_codecs`,kind:`message`,T:Hg,repeated:!0},{no:11,name:`sid`,kind:`scalar`,T:9},{no:12,name:`stereo`,kind:`scalar`,T:8},{no:13,name:`disable_red`,kind:`scalar`,T:8},{no:14,name:`encryption`,kind:`enum`,T:B.getEnumType($h)},{no:15,name:`stream`,kind:`scalar`,T:9},{no:16,name:`backup_codec_policy`,kind:`enum`,T:B.getEnumType(Ih)},{no:17,name:`audio_features`,kind:`enum`,T:B.getEnumType(Gh),repeated:!0}]),Wg=B.makeMessageType(`livekit.PublishDataTrackRequest`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`encryption`,kind:`enum`,T:B.getEnumType($h)}]),Gg=B.makeMessageType(`livekit.PublishDataTrackResponse`,()=>[{no:1,name:`info`,kind:`message`,T:ng}]),Kg=B.makeMessageType(`livekit.UnpublishDataTrackRequest`,()=>[{no:1,name:`pub_handle`,kind:`scalar`,T:13}]),qg=B.makeMessageType(`livekit.UnpublishDataTrackResponse`,()=>[{no:1,name:`info`,kind:`message`,T:ng}]),Jg=B.makeMessageType(`livekit.DataTrackSubscriberHandles`,()=>[{no:1,name:`sub_handles`,kind:`map`,K:13,V:{kind:`message`,T:Yg}}]),Yg=B.makeMessageType(`livekit.DataTrackSubscriberHandles.PublishedDataTrack`,()=>[{no:1,name:`publisher_identity`,kind:`scalar`,T:9},{no:2,name:`publisher_sid`,kind:`scalar`,T:9},{no:3,name:`track_sid`,kind:`scalar`,T:9}],{localName:`DataTrackSubscriberHandles_PublishedDataTrack`}),Xg=B.makeMessageType(`livekit.TrickleRequest`,()=>[{no:1,name:`candidateInit`,kind:`scalar`,T:9},{no:2,name:`target`,kind:`enum`,T:B.getEnumType(Lg)},{no:3,name:`final`,kind:`scalar`,T:8}]),Zg=B.makeMessageType(`livekit.MuteTrackRequest`,()=>[{no:1,name:`sid`,kind:`scalar`,T:9},{no:2,name:`muted`,kind:`scalar`,T:8}]),Qg=B.makeMessageType(`livekit.JoinResponse`,()=>[{no:1,name:`room`,kind:`message`,T:Kh},{no:2,name:`participant`,kind:`message`,T:Yh},{no:3,name:`other_participants`,kind:`message`,T:Yh,repeated:!0},{no:4,name:`server_version`,kind:`scalar`,T:9},{no:5,name:`ice_servers`,kind:`message`,T:m_,repeated:!0},{no:6,name:`subscriber_primary`,kind:`scalar`,T:8},{no:7,name:`alternative_url`,kind:`scalar`,T:9},{no:8,name:`client_configuration`,kind:`message`,T:Eg},{no:9,name:`server_region`,kind:`scalar`,T:9},{no:10,name:`ping_timeout`,kind:`scalar`,T:5},{no:11,name:`ping_interval`,kind:`scalar`,T:5},{no:12,name:`server_info`,kind:`message`,T:Sg},{no:13,name:`sif_trailer`,kind:`scalar`,T:12},{no:14,name:`enabled_publish_codecs`,kind:`message`,T:qh,repeated:!0},{no:15,name:`fast_publish`,kind:`scalar`,T:8}]),$g=B.makeMessageType(`livekit.ReconnectResponse`,()=>[{no:1,name:`ice_servers`,kind:`message`,T:m_,repeated:!0},{no:2,name:`client_configuration`,kind:`message`,T:Eg},{no:3,name:`server_info`,kind:`message`,T:Sg},{no:4,name:`last_message_seq`,kind:`scalar`,T:13}]),e_=B.makeMessageType(`livekit.TrackPublishedResponse`,()=>[{no:1,name:`cid`,kind:`scalar`,T:9},{no:2,name:`track`,kind:`message`,T:tg}]),t_=B.makeMessageType(`livekit.TrackUnpublishedResponse`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9}]),n_=B.makeMessageType(`livekit.SessionDescription`,()=>[{no:1,name:`type`,kind:`scalar`,T:9},{no:2,name:`sdp`,kind:`scalar`,T:9},{no:3,name:`id`,kind:`scalar`,T:13},{no:4,name:`mid_to_track_id`,kind:`map`,K:9,V:{kind:`scalar`,T:9}}]),r_=B.makeMessageType(`livekit.ParticipantUpdate`,()=>[{no:1,name:`participants`,kind:`message`,T:Yh,repeated:!0}]),i_=B.makeMessageType(`livekit.UpdateSubscription`,()=>[{no:1,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`subscribe`,kind:`scalar`,T:8},{no:3,name:`participant_tracks`,kind:`message`,T:xg,repeated:!0}]),a_=B.makeMessageType(`livekit.UpdateDataSubscription`,()=>[{no:1,name:`updates`,kind:`message`,T:o_,repeated:!0}]),o_=B.makeMessageType(`livekit.UpdateDataSubscription.Update`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribe`,kind:`scalar`,T:8},{no:3,name:`options`,kind:`message`,T:rg}],{localName:`UpdateDataSubscription_Update`}),s_=B.makeMessageType(`livekit.UpdateTrackSettings`,()=>[{no:1,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:3,name:`disabled`,kind:`scalar`,T:8},{no:4,name:`quality`,kind:`enum`,T:B.getEnumType(zh)},{no:5,name:`width`,kind:`scalar`,T:13},{no:6,name:`height`,kind:`scalar`,T:13},{no:7,name:`fps`,kind:`scalar`,T:13},{no:8,name:`priority`,kind:`scalar`,T:13}]),c_=B.makeMessageType(`livekit.UpdateLocalAudioTrack`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`features`,kind:`enum`,T:B.getEnumType(Gh),repeated:!0}]),l_=B.makeMessageType(`livekit.UpdateLocalVideoTrack`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`width`,kind:`scalar`,T:13},{no:3,name:`height`,kind:`scalar`,T:13}]),u_=B.makeMessageType(`livekit.LeaveRequest`,()=>[{no:1,name:`can_reconnect`,kind:`scalar`,T:8},{no:2,name:`reason`,kind:`enum`,T:B.getEnumType(Hh)},{no:3,name:`action`,kind:`enum`,T:B.getEnumType(d_)},{no:4,name:`regions`,kind:`message`,T:F_}]),d_=B.makeEnum(`livekit.LeaveRequest.Action`,[{no:0,name:`DISCONNECT`},{no:1,name:`RESUME`},{no:2,name:`RECONNECT`}]),f_=B.makeMessageType(`livekit.UpdateVideoLayers`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`layers`,kind:`message`,T:ig,repeated:!0}]),p_=B.makeMessageType(`livekit.UpdateParticipantMetadata`,()=>[{no:1,name:`metadata`,kind:`scalar`,T:9},{no:2,name:`name`,kind:`scalar`,T:9},{no:3,name:`attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:4,name:`request_id`,kind:`scalar`,T:13}]),m_=B.makeMessageType(`livekit.ICEServer`,()=>[{no:1,name:`urls`,kind:`scalar`,T:9,repeated:!0},{no:2,name:`username`,kind:`scalar`,T:9},{no:3,name:`credential`,kind:`scalar`,T:9}]),h_=B.makeMessageType(`livekit.SpeakersChanged`,()=>[{no:1,name:`speakers`,kind:`message`,T:dg,repeated:!0}]),g_=B.makeMessageType(`livekit.RoomUpdate`,()=>[{no:1,name:`room`,kind:`message`,T:Kh}]),__=B.makeMessageType(`livekit.ConnectionQualityInfo`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`quality`,kind:`enum`,T:B.getEnumType(Bh)},{no:3,name:`score`,kind:`scalar`,T:2}]),v_=B.makeMessageType(`livekit.ConnectionQualityUpdate`,()=>[{no:1,name:`updates`,kind:`message`,T:__,repeated:!0}]),y_=B.makeMessageType(`livekit.StreamStateInfo`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sid`,kind:`scalar`,T:9},{no:3,name:`state`,kind:`enum`,T:B.getEnumType(Rg)}]),b_=B.makeMessageType(`livekit.StreamStateUpdate`,()=>[{no:1,name:`stream_states`,kind:`message`,T:y_,repeated:!0}]),x_=B.makeMessageType(`livekit.SubscribedQuality`,()=>[{no:1,name:`quality`,kind:`enum`,T:B.getEnumType(zh)},{no:2,name:`enabled`,kind:`scalar`,T:8}]),S_=B.makeMessageType(`livekit.SubscribedCodec`,()=>[{no:1,name:`codec`,kind:`scalar`,T:9},{no:2,name:`qualities`,kind:`message`,T:x_,repeated:!0}]),C_=B.makeMessageType(`livekit.SubscribedQualityUpdate`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribed_qualities`,kind:`message`,T:x_,repeated:!0},{no:3,name:`subscribed_codecs`,kind:`message`,T:S_,repeated:!0}]),w_=B.makeMessageType(`livekit.SubscribedAudioCodecUpdate`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`subscribed_audio_codecs`,kind:`message`,T:Ig,repeated:!0}]),T_=B.makeMessageType(`livekit.TrackPermission`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`all_tracks`,kind:`scalar`,T:8},{no:3,name:`track_sids`,kind:`scalar`,T:9,repeated:!0},{no:4,name:`participant_identity`,kind:`scalar`,T:9}]),E_=B.makeMessageType(`livekit.SubscriptionPermission`,()=>[{no:1,name:`all_participants`,kind:`scalar`,T:8},{no:2,name:`track_permissions`,kind:`message`,T:T_,repeated:!0}]),D_=B.makeMessageType(`livekit.SubscriptionPermissionUpdate`,()=>[{no:1,name:`participant_sid`,kind:`scalar`,T:9},{no:2,name:`track_sid`,kind:`scalar`,T:9},{no:3,name:`allowed`,kind:`scalar`,T:8}]),O_=B.makeMessageType(`livekit.RoomMovedResponse`,()=>[{no:1,name:`room`,kind:`message`,T:Kh},{no:2,name:`token`,kind:`scalar`,T:9},{no:3,name:`participant`,kind:`message`,T:Yh},{no:4,name:`other_participants`,kind:`message`,T:Yh,repeated:!0}]),k_=B.makeMessageType(`livekit.SyncState`,()=>[{no:1,name:`answer`,kind:`message`,T:n_},{no:2,name:`subscription`,kind:`message`,T:i_},{no:3,name:`publish_tracks`,kind:`message`,T:e_,repeated:!0},{no:4,name:`data_channels`,kind:`message`,T:j_,repeated:!0},{no:5,name:`offer`,kind:`message`,T:n_},{no:6,name:`track_sids_disabled`,kind:`scalar`,T:9,repeated:!0},{no:7,name:`datachannel_receive_states`,kind:`message`,T:A_,repeated:!0},{no:8,name:`publish_data_tracks`,kind:`message`,T:Gg,repeated:!0}]),A_=B.makeMessageType(`livekit.DataChannelReceiveState`,()=>[{no:1,name:`publisher_sid`,kind:`scalar`,T:9},{no:2,name:`last_seq`,kind:`scalar`,T:13}]),j_=B.makeMessageType(`livekit.DataChannelInfo`,()=>[{no:1,name:`label`,kind:`scalar`,T:9},{no:2,name:`id`,kind:`scalar`,T:13},{no:3,name:`target`,kind:`enum`,T:B.getEnumType(Lg)}]),M_=B.makeMessageType(`livekit.SimulateScenario`,()=>[{no:1,name:`speaker_update`,kind:`scalar`,T:5,oneof:`scenario`},{no:2,name:`node_failure`,kind:`scalar`,T:8,oneof:`scenario`},{no:3,name:`migration`,kind:`scalar`,T:8,oneof:`scenario`},{no:4,name:`server_leave`,kind:`scalar`,T:8,oneof:`scenario`},{no:5,name:`switch_candidate_protocol`,kind:`enum`,T:B.getEnumType(zg),oneof:`scenario`},{no:6,name:`subscriber_bandwidth`,kind:`scalar`,T:3,oneof:`scenario`},{no:7,name:`disconnect_signal_on_resume`,kind:`scalar`,T:8,oneof:`scenario`},{no:8,name:`disconnect_signal_on_resume_no_messages`,kind:`scalar`,T:8,oneof:`scenario`},{no:9,name:`leave_request_full_reconnect`,kind:`scalar`,T:8,oneof:`scenario`}]),N_=B.makeMessageType(`livekit.Ping`,()=>[{no:1,name:`timestamp`,kind:`scalar`,T:3},{no:2,name:`rtt`,kind:`scalar`,T:3}]),P_=B.makeMessageType(`livekit.Pong`,()=>[{no:1,name:`last_ping_timestamp`,kind:`scalar`,T:3},{no:2,name:`timestamp`,kind:`scalar`,T:3}]),F_=B.makeMessageType(`livekit.RegionSettings`,()=>[{no:1,name:`regions`,kind:`message`,T:I_,repeated:!0}]),I_=B.makeMessageType(`livekit.RegionInfo`,()=>[{no:1,name:`region`,kind:`scalar`,T:9},{no:2,name:`url`,kind:`scalar`,T:9},{no:3,name:`distance`,kind:`scalar`,T:3}]),L_=B.makeMessageType(`livekit.SubscriptionResponse`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9},{no:2,name:`err`,kind:`enum`,T:B.getEnumType(Wh)}]),R_=B.makeMessageType(`livekit.RequestResponse`,()=>[{no:1,name:`request_id`,kind:`scalar`,T:13},{no:2,name:`reason`,kind:`enum`,T:B.getEnumType(z_)},{no:3,name:`message`,kind:`scalar`,T:9},{no:4,name:`trickle`,kind:`message`,T:Xg,oneof:`request`},{no:5,name:`add_track`,kind:`message`,T:Ug,oneof:`request`},{no:6,name:`mute`,kind:`message`,T:Zg,oneof:`request`},{no:7,name:`update_metadata`,kind:`message`,T:p_,oneof:`request`},{no:8,name:`update_audio_track`,kind:`message`,T:c_,oneof:`request`},{no:9,name:`update_video_track`,kind:`message`,T:l_,oneof:`request`},{no:10,name:`publish_data_track`,kind:`message`,T:Wg,oneof:`request`},{no:11,name:`unpublish_data_track`,kind:`message`,T:Kg,oneof:`request`}]),z_=B.makeEnum(`livekit.RequestResponse.Reason`,[{no:0,name:`OK`},{no:1,name:`NOT_FOUND`},{no:2,name:`NOT_ALLOWED`},{no:3,name:`LIMIT_EXCEEDED`},{no:4,name:`QUEUED`},{no:5,name:`UNSUPPORTED_TYPE`},{no:6,name:`UNCLASSIFIED_ERROR`},{no:7,name:`INVALID_HANDLE`},{no:8,name:`INVALID_NAME`},{no:9,name:`DUPLICATE_HANDLE`},{no:10,name:`DUPLICATE_NAME`}]),B_=B.makeMessageType(`livekit.TrackSubscribed`,()=>[{no:1,name:`track_sid`,kind:`scalar`,T:9}]),V_=B.makeMessageType(`livekit.ConnectionSettings`,()=>[{no:1,name:`auto_subscribe`,kind:`scalar`,T:8},{no:2,name:`adaptive_stream`,kind:`scalar`,T:8},{no:3,name:`subscriber_allow_pause`,kind:`scalar`,T:8,opt:!0},{no:4,name:`disable_ice_lite`,kind:`scalar`,T:8},{no:5,name:`auto_subscribe_data_track`,kind:`scalar`,T:8,opt:!0}]),H_=B.makeMessageType(`livekit.JoinRequest`,()=>[{no:1,name:`client_info`,kind:`message`,T:wg},{no:2,name:`connection_settings`,kind:`message`,T:V_},{no:3,name:`metadata`,kind:`scalar`,T:9},{no:4,name:`participant_attributes`,kind:`map`,K:9,V:{kind:`scalar`,T:9}},{no:5,name:`add_track_requests`,kind:`message`,T:Ug,repeated:!0},{no:6,name:`publisher_offer`,kind:`message`,T:n_},{no:7,name:`reconnect`,kind:`scalar`,T:8},{no:8,name:`reconnect_reason`,kind:`enum`,T:B.getEnumType(Uh)},{no:9,name:`participant_sid`,kind:`scalar`,T:9},{no:10,name:`sync_state`,kind:`message`,T:k_}]),U_=B.makeMessageType(`livekit.WrappedJoinRequest`,()=>[{no:1,name:`compression`,kind:`enum`,T:B.getEnumType(W_)},{no:2,name:`join_request`,kind:`scalar`,T:12}]),W_=B.makeEnum(`livekit.WrappedJoinRequest.Compression`,[{no:0,name:`NONE`},{no:1,name:`GZIP`}]),G_=B.makeMessageType(`livekit.MediaSectionsRequirement`,()=>[{no:1,name:`num_audios`,kind:`scalar`,T:13},{no:2,name:`num_videos`,kind:`scalar`,T:13}]);function K_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var q_={exports:{}},J_=q_.exports,Y_;function X_(){return Y_?q_.exports:(Y_=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(J_,function(){var e=function(){},t=`undefined`,n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=[`trace`,`debug`,`info`,`warn`,`error`],i={},a=null;function o(e,t){var n=e[t];if(typeof n.bind==`function`)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(r){return r===`debug`&&(r=`log`),typeof console===t?!1:r===`trace`&&n?s:console[r]===void 0?console.log===void 0?e:o(console,`log`):o(console,r)}function l(){for(var n=this.getLevel(),i=0;i<r.length;i++){var a=r[i];this[a]=i<n?e:this.methodFactory(a,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return`No console available for logging`}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(e,t,n){return c(e)||u.apply(this,arguments)}function f(e,n){var o=this,s,c,u,f=`loglevel`;typeof e==`string`?f+=`:`+e:typeof e==`symbol`&&(f=void 0);function p(e){var n=(r[e]||`silent`).toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=n;return}catch{}try{window.document.cookie=encodeURIComponent(f)+`=`+n+`;`}catch{}}}function m(){var e;if(!(typeof window===t||!f)){try{e=window.localStorage[f]}catch{}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),i=n.indexOf(r+`=`);i!==-1&&(e=/^([^;]+)/.exec(n.slice(i+r.length+1))[1])}catch{}return o.levels[e]===void 0&&(e=void 0),e}}function h(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+`=; expires=Thu, 01 Jan 1970 00:00:00 UTC`}catch{}}}function g(e){var t=e;if(typeof t==`string`&&o.levels[t.toUpperCase()]!==void 0&&(t=o.levels[t.toUpperCase()]),typeof t==`number`&&t>=0&&t<=o.levels.SILENT)return t;throw TypeError(`log.setLevel() called with invalid level: `+e)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||d,o.getLevel=function(){return u??c??s},o.setLevel=function(e,t){return u=g(e),t!==!1&&p(u),l.call(o)},o.setDefaultLevel=function(e){c=g(e),m()||o.setLevel(e,!1)},o.resetLevel=function(){u=null,h(),l.call(o)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)},o.rebuild=function(){if(a!==o&&(s=g(a.getLevel())),l.call(o),a===o)for(var e in i)i[e].rebuild()},s=g(a?a.getLevel():`WARN`);var _=m();_!=null&&(u=g(_)),l.call(o)}a=new f,a.getLogger=function(e){if(typeof e!=`symbol`&&typeof e!=`string`||e===``)throw TypeError(`You must supply a name when creating a logger.`);var t=i[e];return t||=i[e]=new f(e,a.methodFactory),t};var p=typeof window===t?void 0:window.log;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return i},a.default=a,a})})(q_),q_.exports)}var Z_=X_(),Q_;(function(e){e[e.trace=0]=`trace`,e[e.debug=1]=`debug`,e[e.info=2]=`info`,e[e.warn=3]=`warn`,e[e.error=4]=`error`,e[e.silent=5]=`silent`})(Q_||={});var $_;(function(e){e.Default=`livekit`,e.Room=`livekit-room`,e.TokenSource=`livekit-token-source`,e.Participant=`livekit-participant`,e.Track=`livekit-track`,e.Publication=`livekit-track-publication`,e.Engine=`livekit-engine`,e.Signal=`livekit-signal`,e.PCManager=`livekit-pc-manager`,e.PCTransport=`livekit-pc-transport`,e.E2EE=`lk-e2ee`,e.DataTracks=`livekit-data-tracks`})($_||={});var V=Z_.getLogger(`livekit`);Object.values($_).map(e=>Z_.getLogger(e)),V.setDefaultLevel(Q_.info);function ev(e){let t=Z_.getLogger(e);return t.setDefaultLevel(V.getLevel()),t}var tv=Z_.getLogger(`lk-e2ee`),nv=7e3,rv=[0,300,4*300,9*300,16*300,nv,nv,nv,nv,nv],iv=class{constructor(e){this._retryDelays=e===void 0?rv:[...e]}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;let t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+Math.random()*1e3}};function av(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function H(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ov(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function sv(e){return this instanceof sv?(this.v=e,this):new sv(e)}function cv(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof sv?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function lv(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:sv(e[r](t)),done:!1}:i?i(t):t}:i}}function uv(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ov==`function`?ov(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}var dv={exports:{}},fv;function pv(){if(fv)return dv.exports;fv=1;var e=typeof Reflect==`object`?Reflect:null,t=e&&typeof e.apply==`function`?e.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},n=e&&typeof e.ownKeys==`function`?e.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function r(e){console&&console.warn&&console.warn(e)}var i=Number.isNaN||function(e){return e!==e};function a(){a.init.call(this)}dv.exports=a,dv.exports.once=_,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(a,`defaultMaxListeners`,{enumerable:!0,get:function(){return o},set:function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);o=e}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||i(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function c(e){return e._maxListeners===void 0?a.defaultMaxListeners:e._maxListeners}a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(n.length>0&&(o=n[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)t(c,this,n);else for(var l=c.length,u=m(c,l),r=0;r<l;++r)t(u[r],this,n);return!0};function l(e,t,n,i){var a,o,l;if(s(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),l=o[t]),l===void 0)l=o[t]=n,++e._eventsCount;else if(typeof l==`function`?l=o[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),a=c(e),a>0&&l.length>a&&!l.warned){l.warned=!0;var u=Error(`Possible EventEmitter memory leak detected. `+l.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);u.name=`MaxListenersExceededWarning`,u.emitter=e,u.type=t,u.count=l.length,r(u)}return e}a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}a.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,a,o;if(s(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():h(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function f(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?g(i):m(i,i.length)}a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p;function p(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function m(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function h(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function g(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function _(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),t!==`error`&&v(e,i,{once:!0})})}function v(e,t,n){typeof e.on==`function`&&y(e,`error`,t,n)}function y(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}return dv.exports}var mv=pv(),hv=!0,gv=!0;function _v(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function vv(e,t,n){if(!e.RTCPeerConnection)return;let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function yv(e){return typeof e==`boolean`?(hv=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function bv(e){return typeof e==`boolean`?(gv=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function xv(){if(typeof window==`object`){if(hv)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function Sv(e,t){gv&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function Cv(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e)return{browser:`chrome`,version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(_v(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(_v(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(_v(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=_v(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function wv(e){return Object.prototype.toString.call(e)===`[object Object]`}function Tv(e){return wv(e)?Object.keys(e).reduce(function(t,n){let r=wv(e[n]),i=r?Tv(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function Ev(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?Ev(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{Ev(e,e.get(t),n)})}))}function Dv(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&Ev(e,n,i)})}),i}var Ov=xv;function kv(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),Ov(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return Ov(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}function Av(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function jv(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,`ontrack`,{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else vv(e,`track`,e=>(e.transceiver||Object.defineProperty(e,`transceiver`,{value:{receiver:e.receiver}}),e))}function Mv(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,`dtmf`,{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Nv(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>Dv(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),vv(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>Dv(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return t.apply(this,arguments)}}function Pv(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function Fv(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Pv(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,`localDescription`,{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function Iv(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function Lv(e,t){vv(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}var Rv=Object.freeze({__proto__:null,fixNegotiationNeeded:Lv,shimAddTrackRemoveTrack:Fv,shimAddTrackRemoveTrackWithNative:Pv,shimGetSendersWithDtmf:Mv,shimGetUserMedia:kv,shimMediaStream:Av,shimOnTrack:jv,shimPeerConnection:Iv,shimSenderReceiverGetStats:Nv});function zv(e,t){let n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){Sv(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function Bv(e,t){e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function Vv(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function Hv(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Uv(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Wv(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),vv(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Gv(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){Sv(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Kv(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function qv(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let n=e.length>0;n&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=t.apply(this,arguments);if(n){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Jv(e){if(!(typeof e==`object`&&e.RTCRtpSender))return;let t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){let e=t.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Yv(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function Xv(e){if(!(typeof e==`object`&&e.RTCPeerConnection))return;let t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Zv=Object.freeze({__proto__:null,shimAddTransceiver:qv,shimCreateAnswer:Xv,shimCreateOffer:Yv,shimGetDisplayMedia:Bv,shimGetParameters:Jv,shimGetUserMedia:zv,shimOnTrack:Vv,shimPeerConnection:Hv,shimRTCDataChannel:Kv,shimReceiverGetStats:Wv,shimRemoveStream:Gv,shimSenderGetStats:Uv});function Qv(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r&&r.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function $v(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,`onaddstream`,{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function ey(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function ty(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(ny(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function ny(e){return e&&e.video!==void 0?Object.assign({},e,{video:Tv(e.video)}):e}function ry(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];r.urls===void 0&&r.url?(Sv(`RTCIceServer.url`,`RTCIceServer.urls`),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,`generateCertificate`in t&&Object.defineProperty(e.RTCPeerConnection,`generateCertificate`,{get(){return t.generateCertificate}})}function iy(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,`transceiver`,{get(){return{receiver:this.receiver}}})}function ay(e){let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){e.offerToReceiveAudio!==void 0&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(e=>e.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function oy(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var sy=Object.freeze({__proto__:null,shimAudioContext:oy,shimCallbacksAPI:ey,shimConstraints:ny,shimCreateOfferLegacy:ay,shimGetUserMedia:ty,shimLocalStreamsAPI:Qv,shimRTCIceServerUrls:ry,shimRemoteStreamsAPI:$v,shimTrackEventTransceiver:iy}),cy={exports:{}},ly;function uy(){return ly?cy.exports:(ly=1,(function(e){let t={};t.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(`
|
|
35
35
|
`).map(e=>e.trim())},t.splitSections=function(e){return e.split(`
|
|
36
36
|
m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r
|
|
@@ -461,9 +461,9 @@ registerProcessor("scribeAudioProcessor", ScribeAudioProcessor);
|
|
|
461
461
|
|
|
462
462
|
gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
|
|
463
463
|
}
|
|
464
|
-
`;function lD(e,t,n){let r=(t,n)=>{let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(`[AnimatedOrb shader]`,e.getShaderInfoLog(r)),null)},i=r(e.VERTEX_SHADER,t),a=r(e.FRAGMENT_SHADER,n);if(!i||!a)return null;let o=e.createProgram();return e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)?o:(console.error(`[AnimatedOrb link]`,e.getProgramInfoLog(o)),null)}function uD({size:e=94,voiceState:t=`idle`,isMuted:n=!1,colors:r,onClick:i,style:a,className:o}){let[s,c,l]=rD(r),u=t===`speaking`,d=e<=50,f=(0,b.useRef)(null),p=(0,b.useRef)(iD[t]??.35);(0,b.useEffect)(()=>{p.current=iD[t]??.35},[t]),(0,b.useEffect)(()=>{let t=f.current;if(!t)return;let n=Math.min(window.devicePixelRatio||1,2);t.width=e*n,t.height=e*n;let r=t.getContext(`webgl`,{alpha:!0,antialias:!0})||t.getContext(`experimental-webgl`,{alpha:!0,antialias:!0});if(!r){console.warn(`[AnimatedOrb] WebGL unavailable.`);return}let i=lD(r,sD,cD);if(!i){console.error(`[AnimatedOrb] WebGL program failed to compile/link`);return}r.useProgram(i);let a=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),r.STATIC_DRAW);let o=r.getAttribLocation(i,`a_pos`);r.enableVertexAttribArray(o),r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0);let u={time:r.getUniformLocation(i,`u_time`),speed:r.getUniformLocation(i,`u_speed`),c1:r.getUniformLocation(i,`u_c1`),c2:r.getUniformLocation(i,`u_c2`),c3:r.getUniformLocation(i,`u_c3`)};r.uniform3fv(u.c1,aD(s)),r.uniform3fv(u.c2,aD(c)),r.uniform3fv(u.c3,aD(l)),r.viewport(0,0,t.width,t.height);let d=performance.now(),m,h=e=>{r.uniform1f(u.time,(e-d)/1e3),r.uniform1f(u.speed,p.current),r.drawArrays(r.TRIANGLES,0,6),m=requestAnimationFrame(h)};return m=requestAnimationFrame(h),()=>{cancelAnimationFrame(m),r.deleteProgram(i),r.deleteBuffer(a)}},[s,c,l,e]);let m=n?`saturate(0.3) brightness(1.1)`:t===`error`?`saturate(0.4) hue-rotate(28deg)`:`none`;return(0,M.jsxs)(`div`,{style:{position:`relative`,width:e,height:e,flexShrink:0,cursor:i?`pointer`:`default`,...a},className:o,onClick:i,children:[u&&!d&&(0,M.jsx)(jp.div,{style:{position:`absolute`,inset:-10,borderRadius:`50%`,background:`radial-gradient(circle, ${oD(s,.18)} 0%, transparent 70%)`,pointerEvents:`none`},animate:{opacity:[.3,.75]},transition:{duration:1,repeat:1/0,repeatType:`mirror`,ease:`easeInOut`}}),(0,M.jsx)(`div`,{style:{width:e,height:e,borderRadius:`50%`,overflow:`hidden`,WebkitMaskImage:`-webkit-radial-gradient(white, black)`,filter:m,transition:`filter 1.2s ease`},children:(0,M.jsx)(`canvas`,{ref:f,style:{width:`100%`,height:`100%`,display:`block`}})}),u&&(0,M.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,pointerEvents:`none`,zIndex:1},children:(0,M.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`3px`},children:[4,8,12,8,4].map((e,t)=>(0,M.jsx)(jp.div,{style:{width:`3px`,borderRadius:`3px`,background:`rgba(255,255,255,0.85)`},animate:{height:[4,e+8,4]},transition:{duration:.48,delay:t*.08,repeat:1/0,ease:`easeInOut`}},t))})})]})}var dD=`fe_voice_session`,fD=`fe_tab_id`,pD=40,mD=2e3,hD=300*1e3,gD=60*1e3,_D=30*1e3;function vD(){let e=new Uint8Array(16);try{crypto.getRandomValues(e)}catch{for(let t=0;t<16;t++)e[t]=Math.floor(Math.random()*256)}return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function yD(){try{let e=sessionStorage.getItem(fD);return e||(e=vD(),sessionStorage.setItem(fD,e)),e}catch{return vD()}}function bD(e,t){return`${(e||[]).length}:${t%1e5}`}function xD(e,t){return Array.isArray(e)?e.length<=t?e:e.slice(e.length-t):[]}function SD(){if(typeof document>`u`)return{headings:[],activeHighlightText:null,activeHighlightId:null};let e=document.querySelector(`.fe-highlight-section`);return{headings:Array.from(document.querySelectorAll(`h1,h2,h3,h4`)).filter(e=>!e.closest(`#flowengage-root`)).map(e=>({tag:e.tagName,text:e.textContent.trim().slice(0,100),id:e.id||null})).slice(0,25),activeHighlightText:e?.textContent?.trim().slice(0,100)||null,activeHighlightId:e?.id||null}}function CD(e){if(!e)return`Unknown state.`;let{state:t,lastAgentText:n,lastUserText:r,toolName:i,toolParams:a,estimatedSpokenWords:o,agentTextWordCount:s,unspokenSuffix:c}=e,l=[];return t===`speaking`?(l.push(`You were SPEAKING.`),n&&(l.push(`You had spoken approximately ${o??`?`} of ${s??`?`} words.`),l.push(`Your response text: "${n}"`),c&&l.push(`Estimated unspoken remainder: "${c}"`))):t===`listening`?(l.push(`You were LISTENING for the user's response.`),r&&l.push(`Last user message: "${r}"`)):t===`tool_calling`?(l.push(`You were executing tool: ${i||`unknown`}`),a&&l.push(`Tool parameters: ${JSON.stringify(a)}`),n&&l.push(`Your last spoken text before the tool call: "${n}"`)):l.push(`Session state at capture: ${t||`idle`}`),l.join(`
|
|
464
|
+
`;function lD(e,t,n){let r=(t,n)=>{let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(`[AnimatedOrb shader]`,e.getShaderInfoLog(r)),null)},i=r(e.VERTEX_SHADER,t),a=r(e.FRAGMENT_SHADER,n);if(!i||!a)return null;let o=e.createProgram();return e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)?o:(console.error(`[AnimatedOrb link]`,e.getProgramInfoLog(o)),null)}function uD({size:e=94,voiceState:t=`idle`,isMuted:n=!1,colors:r,onClick:i,style:a,className:o}){let[s,c,l]=rD(r),u=t===`speaking`,d=e<=50,f=(0,b.useRef)(null),p=(0,b.useRef)(iD[t]??.35);(0,b.useEffect)(()=>{p.current=iD[t]??.35},[t]),(0,b.useEffect)(()=>{let t=f.current;if(!t)return;let n=Math.min(window.devicePixelRatio||1,2);t.width=e*n,t.height=e*n;let r=t.getContext(`webgl`,{alpha:!0,antialias:!0})||t.getContext(`experimental-webgl`,{alpha:!0,antialias:!0});if(!r){console.warn(`[AnimatedOrb] WebGL unavailable.`);return}let i=lD(r,sD,cD);if(!i){console.error(`[AnimatedOrb] WebGL program failed to compile/link`);return}r.useProgram(i);let a=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),r.STATIC_DRAW);let o=r.getAttribLocation(i,`a_pos`);r.enableVertexAttribArray(o),r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0);let u={time:r.getUniformLocation(i,`u_time`),speed:r.getUniformLocation(i,`u_speed`),c1:r.getUniformLocation(i,`u_c1`),c2:r.getUniformLocation(i,`u_c2`),c3:r.getUniformLocation(i,`u_c3`)};r.uniform3fv(u.c1,aD(s)),r.uniform3fv(u.c2,aD(c)),r.uniform3fv(u.c3,aD(l)),r.viewport(0,0,t.width,t.height);let d=performance.now(),m,h=e=>{r.uniform1f(u.time,(e-d)/1e3),r.uniform1f(u.speed,p.current),r.drawArrays(r.TRIANGLES,0,6),m=requestAnimationFrame(h)};return m=requestAnimationFrame(h),()=>{cancelAnimationFrame(m),r.deleteProgram(i),r.deleteBuffer(a)}},[s,c,l,e]);let m=n?`saturate(0.3) brightness(1.1)`:t===`error`?`saturate(0.4) hue-rotate(28deg)`:`none`;return(0,M.jsxs)(`div`,{style:{position:`relative`,width:e,height:e,flexShrink:0,cursor:i?`pointer`:`default`,...a},className:o,onClick:i,children:[u&&!d&&(0,M.jsx)(jp.div,{style:{position:`absolute`,inset:-10,borderRadius:`50%`,background:`radial-gradient(circle, ${oD(s,.18)} 0%, transparent 70%)`,pointerEvents:`none`},animate:{opacity:[.3,.75]},transition:{duration:1,repeat:1/0,repeatType:`mirror`,ease:`easeInOut`}}),(0,M.jsx)(`div`,{style:{width:e,height:e,borderRadius:`50%`,overflow:`hidden`,WebkitMaskImage:`-webkit-radial-gradient(white, black)`,filter:m,transition:`filter 1.2s ease`},children:(0,M.jsx)(`canvas`,{ref:f,style:{width:`100%`,height:`100%`,display:`block`}})}),u&&(0,M.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,pointerEvents:`none`,zIndex:1},children:(0,M.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`3px`},children:[4,8,12,8,4].map((e,t)=>(0,M.jsx)(jp.div,{style:{width:`3px`,borderRadius:`3px`,background:`rgba(255,255,255,0.85)`},animate:{height:[4,e+8,4]},transition:{duration:.48,delay:t*.08,repeat:1/0,ease:`easeInOut`}},t))})})]})}var dD=`fe_voice_session`,fD=`fe_tab_id`,pD=40,mD=2e3,hD=300*1e3,gD=60*1e3,_D=30*1e3;function vD(){let e=new Uint8Array(16);try{crypto.getRandomValues(e)}catch{for(let t=0;t<16;t++)e[t]=Math.floor(Math.random()*256)}return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function yD(){try{let e=sessionStorage.getItem(fD);return e||(e=vD(),sessionStorage.setItem(fD,e)),e}catch{return vD()}}function bD(e,t){return`${(e||[]).length}:${t%1e5}`}function xD(e,t){return Array.isArray(e)?e.length<=t?e:e.slice(e.length-t):[]}function SD(){if(typeof document>`u`)return{headings:[],activeHighlightText:null,activeHighlightId:null};let e=document.querySelector(`.fe-highlight-section`);return{headings:Array.from(document.querySelectorAll(`h1,h2,h3,h4`)).filter(e=>!e.closest(`#flowengage-root`)).map(e=>({tag:e.tagName,text:e.textContent.trim().slice(0,100),id:e.id||null})).slice(0,25),activeHighlightText:e?.textContent?.trim().slice(0,100)||null,activeHighlightId:e?.id||null}}function CD(e){if(!e)return`Unknown state.`;let{state:t,lastAgentText:n,lastUserText:r,toolName:i,toolParams:a,estimatedSpokenWords:o,agentTextWordCount:s,unspokenSuffix:c}=e,l=[];return t===`speaking`?(l.push(`You were SPEAKING.`),n&&(l.push(`You had spoken approximately ${o??`?`} of ${s??`?`} words.`),l.push(`Your response text: "${n}"`),c&&l.push(`Estimated unspoken remainder: "${c}"`))):t===`listening`?(l.push(`You were LISTENING for the user's response.`),r&&l.push(`Last user message: "${r}"`)):t===`tool_calling`?i===`flowengage_navigate`?(l.push(`Navigation ALREADY COMPLETED — you successfully navigated to this page.`),l.push(`DO NOT call flowengage_navigate again. You are already on the destination.`),n&&l.push(`Before navigating you said: "${n}"`)):(l.push(`You were executing tool: ${i||`unknown`}`),a&&l.push(`Tool parameters: ${JSON.stringify(a)}`),n&&l.push(`Your last spoken text before the tool call: "${n}"`)):l.push(`Session state at capture: ${t||`idle`}`),l.join(`
|
|
465
465
|
`)}function wD(e,t){try{let n={v:2,sid:e.siteId||``,aid:e.agentId||``,ut:(e.interruption?.lastUserText||``).slice(0,50),ts:Math.floor(t/1e3)};return`compact:${btoa(unescape(encodeURIComponent(JSON.stringify(n))))}`}catch{return null}}function TD(e,t){if(!t)return e;try{let n=new URL(e,window.location.href);return n.searchParams.set(`_fe_resume`,t),n.href}catch{return e+(e.includes(`?`)?`&`:`?`)+`_fe_resume=`+t}}function ED(){if(typeof window>`u`)return null;try{let e=new URL(window.location.href),t=e.searchParams.get(`_fe_resume`);if(!t)return null;e.searchParams.delete(`_fe_resume`);let n=e.pathname+(e.search?e.search:``)+(e.hash?e.hash:``);return window.history.replaceState(window.history.state,``,n),t}catch{return null}}var DD={capture(e){let t=vD(),n=Date.now(),r=xD(e.history,pD),i=(e.interruption?.lastAgentText||``).slice(0,mD),a=e.interruption?.estimatedSpokenWords||0,o=e.interruption?.agentTextWordCount||i.split(/\s+/).filter(Boolean).length,s=``;e.interruption?.state===`speaking`&&i&&a>0&&(s=i.split(/\s+/).slice(a).join(` `));let c={version:2,sessionKey:t,tabId:yD(),siteId:e.siteId,chatId:e.chatId||null,agentId:e.agentId,ts:n,expiresAt:n+hD,resumeAttempts:0,consumed:!1,trigger:e.trigger,navigationConfidence:e.navigationConfidence||`medium`,fromUrl:typeof window<`u`?window.location.href:``,targetUrl:e.targetUrl||null,interruption:{...e.interruption,lastAgentText:i,estimatedSpokenWords:a,agentTextWordCount:o,unspokenSuffix:s,micWasGranted:!0,isMuted:e.interruption?.isMuted||!1,hadError:e.interruption?.hadError||!1},fromPageContext:SD(),history:r,historyTotalTurns:(e.history||[]).length,storageChecksum:bD(r,n)};try{return sessionStorage.setItem(dD,JSON.stringify(c)),{ok:!0,sessionKey:t,compact:null}}catch{return{ok:!1,sessionKey:null,compact:wD(e,n)}}},read(e){if(typeof window>`u`)return null;let t=ED();if(t?.startsWith(`compact:`)){try{let n=JSON.parse(decodeURIComponent(escape(atob(t.slice(8))))),r=Date.now()/1e3-(n.ts||0);if(n.v===2&&n.sid===e&&r<300)return{_compact:!0,_resumeMode:`auto`,siteId:n.sid,agentId:n.aid,chatId:null,history:[],historyTotalTurns:0,trigger:`agent_navigate`,navigationConfidence:`medium`,fromUrl:``,interruption:{state:`listening`,lastUserText:n.ut||``,lastAgentText:``},fromPageContext:{headings:[],activeHighlightText:null}}}catch{}return null}let n;try{n=JSON.parse(sessionStorage.getItem(dD)||`null`)}catch{return null}if(!n)return null;if(n.version!==2)return this._discard(`version`);if(n.siteId!==e)return this._discard(`siteId`);if(Date.now()>n.expiresAt)return this._discard(`expired`);if(n.consumed)return this._discard(`consumed`);if(n.resumeAttempts>=2)return this._discard(`loop_guard`);if(bD(n.history,n.ts)!==n.storageChecksum)return this._discard(`checksum`);if(n.trigger===`agent_navigate`&&t&&t!==n.sessionKey)return this._discard(`key_mismatch`);if(n.trigger===`pagehide`){if(Date.now()-n.ts>_D)return this._discard(`pagehide_stale`);n._resumeMode=`banner`}else if(n.trigger===`user_link_click`){if(Date.now()-n.ts>gD)return this._discard(`user_nav_stale`);n._resumeMode=`auto`}else n._resumeMode=`auto`;n.resumeAttempts+=1;try{sessionStorage.setItem(dD,JSON.stringify(n))}catch{}return n},clear(){try{sessionStorage.removeItem(dD)}catch{}},buildResumePrompt(e,t,n){let r=(e.history||[]).map(e=>`[${e.sender===`user`?`User`:`Agent`}]: ${e.message}`).join(`
|
|
466
|
-
`),i=CD(e.interruption),a=(t||[]).map(e=>e.text).join(`, `),o=``,s=``;try{o=new URL(e.fromUrl||``).pathname}catch{o=e.fromUrl||``}try{s=new URL(n||window.location.href).pathname}catch{s=n||``}return[`VOICE SESSION AUTO-RESUMED AFTER PAGE NAVIGATION.`,`Navigation confidence: ${(e.navigationConfidence||`medium`).toUpperCase()}`,`Navigation: ${o} → ${s}`,``,`── Prior Conversation (${e.historyTotalTurns} turns) ──`,r||`(no prior turns)`,``,`── Your State at Interruption ──`,i,``,`── Current Page ──`,`URL: ${n||(typeof window<`u`?window.location.href:``)}`,`Sections: ${a||`none detected`}`,``,`── CRITICAL INSTRUCTIONS ──`,`1. DO NOT re-introduce yourself.`,`2. DO NOT ask the user what they need — you already know from the conversation above.`,`3. Continue the conversation naturally as if the navigation was seamless.`,`4. If you were mid-sentence, complete your thought naturally.`,`5. Only acknowledge the page change if it adds meaningful context.`,`
|
|
466
|
+
`),i=CD(e.interruption),a=(t||[]).map(e=>e.text).join(`, `),o=``,s=``;try{o=new URL(e.fromUrl||``).pathname}catch{o=e.fromUrl||``}try{s=new URL(n||window.location.href).pathname}catch{s=n||``}return[`VOICE SESSION AUTO-RESUMED AFTER PAGE NAVIGATION.`,`Navigation confidence: ${(e.navigationConfidence||`medium`).toUpperCase()}`,`Navigation: ${o} → ${s}`,``,`── Prior Conversation (${e.historyTotalTurns} turns) ──`,r||`(no prior turns)`,``,`── Your State at Interruption ──`,i,``,`── Current Page ──`,`URL: ${n||(typeof window<`u`?window.location.href:``)}`,`Sections: ${a||`none detected`}`,``,`── CRITICAL INSTRUCTIONS ──`,`1. DO NOT re-introduce yourself.`,`2. DO NOT ask the user what they need — you already know from the conversation above.`,`3. Continue the conversation naturally as if the navigation was seamless.`,`4. If you were mid-sentence, complete your thought naturally.`,`5. The navigation has ALREADY COMPLETED — you are now on the destination page. Do NOT call flowengage_navigate again.`,`6. Only acknowledge the page change if it adds meaningful context.`,`7. The user may speak at any time — stop immediately and listen.`,`8. Use the sections listed above to guide what you highlight next.`].join(`
|
|
467
467
|
`)},_discard(e){try{sessionStorage.removeItem(dD)}catch{}return null}};function OD(){try{let e=JSON.parse(sessionStorage.getItem(dD)||`null`);return e?.trigger===`agent_navigate`&&Date.now()-(e.ts||0)<1e4}catch{return!1}}var kD={wordsSoFar:0,speechStartTime:0,isSpeaking:!1,items:[],timers:[],lastHighlightId:null,isVoiceMode:!1};function AD(){return kD.wordsSoFar}function jD(){kD.timers.forEach(clearTimeout),kD.wordsSoFar=0,kD.speechStartTime=0,kD.isSpeaking=!1,kD.items=[],kD.timers=[],kD.lastHighlightId=null}var MD=80;function ND(e){requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=t.top+t.height/2,r=MD,i=r+(window.innerHeight-r)/2,a=window.pageYOffset+n-i;window.scrollTo({top:Math.max(0,a),behavior:`smooth`})})}function PD(e){if(!e||e.hasAttribute(`data-fe-highlighted`))return;FD(),e.classList?.remove(`fe-highlight-section`,`fe-highlight-speaking`,`fe-highlight-exiting`),ND(e);let t=e.style.cssText;e.setAttribute(`data-fe-highlighted`,`true`),e.setAttribute(`data-fe-orig-style`,t),e.style.outline=`3px solid #2563eb`,e.style.outlineOffset=`8px`,e.style.background=`rgba(37, 99, 235, 0.08)`,e.style.borderRadius=`8px`,e.style.padding=`12px 16px`,e.style.transition=`all 0.4s ease`}function FD(){let e=document.querySelector(`[data-fe-highlighted]`);e&&(e.style.cssText=e.getAttribute(`data-fe-orig-style`)||``,e.removeAttribute(`data-fe-highlighted`),e.removeAttribute(`data-fe-orig-style`))}var Q=`fe-vv`;function ID(){if(typeof document>`u`||document.getElementById(`${Q}-styles`))return;let e=`
|
|
468
468
|
/* ── Action toast ───────────────────────────────────────────────────────────── */
|
|
469
469
|
#${Q}-toast {
|
|
@@ -611,8 +611,8 @@ registerProcessor("scribeAudioProcessor", ScribeAudioProcessor);
|
|
|
611
611
|
<path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
|
|
612
612
|
fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
|
|
613
613
|
filter="url(#${Q}-csh)"/>
|
|
614
|
-
</svg>`,ZD=null,QD=!1;function $D(){return(!ZD||!ZD.isConnected)&&(ZD=document.createElement(`div`),ZD.id=`${Q}-cursor`,ZD.innerHTML=XD,document.body.appendChild(ZD),QD=!1),ZD}async function eO(e){if(typeof document>`u`||!e)return;ID();let t;try{t=e.getBoundingClientRect()}catch{return}let n=t.left+Math.min(16,t.width*.2),r=t.top+Math.min(12,t.height*.25),i=$D();QD||=(i.style.transition=`none`,i.style.left=`${window.innerWidth/2}px`,i.style.top=`${window.innerHeight*.4}px`,i.classList.add(`${Q}-cursor-visible`),i.offsetHeight,i.style.transition=`left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease`,!0),i.style.left=`${n}px`,i.style.top=`${r}px`,await iO(360)}function tO(e=!1){ZD&&(e?(ZD.classList.remove(`${Q}-cursor-visible`),QD=!1):(ZD.classList.remove(`${Q}-cursor-visible`),setTimeout(()=>{QD=!1},250)))}async function nO(e){ZD&&(ZD.classList.add(`${Q}-cursor-click`),await iO(280),ZD.classList.remove(`${Q}-cursor-click`))}function rO(e){if(!e||typeof document>`u`)return;ID();let t;try{t=e.getBoundingClientRect()}catch{return}let n=e.style.position,r=e.style.overflow,i=window.getComputedStyle(e).position;[`relative`,`absolute`,`fixed`,`sticky`].includes(i)||(e.style.position=`relative`),e.style.overflow=`hidden`;let a=document.createElement(`span`);a.className=`${Q}-ripple`;let o=Math.max(t.width,t.height)*1.2;Object.assign(a.style,{width:`${o}px`,height:`${o}px`,left:`${t.width/2-o/2}px`,top:`${t.height/2-o/2}px`}),e.appendChild(a),setTimeout(()=>{a.remove(),e.style.position=n,e.style.overflow=r},650)}function iO(e){return new Promise(t=>setTimeout(t,e))}function $(...e){pn()&&console.log(`[FlowEngage:voice-tools]`,...e)}function aO(e){return new Promise(t=>setTimeout(t,e))}var oO=`#flowengage-root, .flowengage-shell, .flowengage-widget-root`;function sO(e){if(!e||typeof e.closest!=`function`)return!1;try{return!!e.closest(oO)}catch{return!1}}function cO(e){try{let t=e.ownerDocument?.defaultView;if(t)return t.getComputedStyle(e)}catch{}return window.getComputedStyle(e)}function lO(e){let t=new Set;function n(r){if(!r||t.has(r))return;t.add(r),e(r);let i=r.querySelectorAll(`iframe`);for(let e of i)if(!sO(e))try{let t=e.contentDocument;t&&n(t)}catch{}}typeof document<`u`&&n(document)}function uO(e){return e==null?null:String(e).replace(/\u00a0/g,` `).replace(/\s*\*+\s*$/u,``).replace(/\s+/g,` `).trim()}function dO(e){let t=e.ownerDocument||document,n=e.getAttribute(`aria-labelledby`);if(n){let e=n.trim().split(/\s+/).filter(Boolean),r=[];for(let n of e)try{let e=t.getElementById(n);e?.textContent&&r.push(e.textContent.trim())}catch{}if(r.length)return uO(r.join(` `))}if(e.labels&&e.labels.length)return uO(e.labels[0].textContent);let r=e.id;if(r)try{let e=t.querySelector(`label[for="${CSS.escape(r)}"]`);if(e)return uO(e.textContent)}catch{let e=t.querySelector(`label[for="${r.replace(/"/g,`\\"`)}"]`);if(e)return uO(e.textContent)}let i=e.previousElementSibling;for(let e=0;e<6&&i;e+=1){if(i.tagName===`LABEL`)return uO(i.textContent);let e=(i.className||``).toString().toLowerCase();if(/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)){let e=uO(i.textContent);if(e)return e}i=i.previousElementSibling}let a=e.parentElement;for(let e=0;e<5&&a;e+=1){if(a.tagName===`LABEL`)return uO(a.textContent);let e=a.querySelector?.(`:scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']`);if(e?.textContent)return uO(e.textContent);a=a.parentElement}let o=e.getAttribute(`aria-label`);return o?uO(o):null}function fO(){let e=[];return lO(t=>{e.push(...Array.from(t.querySelectorAll(`input, select, textarea`)).filter(e=>{if(sO(e))return!1;let t=(e.type||``).toLowerCase();if([`hidden`,`submit`,`button`,`image`].includes(t)||e.disabled||e.readOnly)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e}function pO(){return fO().map((e,t)=>({formIndex:0,fieldIndex:t,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:dO(e),placeholder:e.placeholder||null}))}function mO(){let e=[];return lO(t=>{e.push(...Array.from(t.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"]`)).filter(e=>{if(sO(e)||e.disabled)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e.slice(0,60).map((e,t)=>({index:t,text:(e.textContent||e.value||``).replace(/\s+/g,` `).trim().slice(0,120)||null,ariaLabel:e.getAttribute(`aria-label`),type:e.type||e.tagName}))}function hO(e){return String(e||``).toLowerCase().replace(/\u00a0/g,` `).replace(/\*/g,``).replace(/\s+/g,` `).trim()}function gO(e){let t=hO(e);return t=t.replace(/\s+field\s*$/i,``).trim(),t}function _O(e,t){let n=gO(t);if(!n)return 0;let r=(e.name||``).toLowerCase(),i=(e.id||``).toLowerCase();if(r===`url`&&/url|website|domain|site|audit/.test(n)||(i===`url-input`||i.endsWith(`-url-input`))&&/url|website|domain|site|audit/.test(n))return 100;let a=[e.name,e.id,e.placeholder,dO(e),e.getAttribute(`aria-label`),e.getAttribute(`title`),e.getAttribute(`data-testid`),e.getAttribute(`autocomplete`)].filter(Boolean).map(e=>hO(e)),o=0;for(let e of a){if(!e)continue;if(e.includes(n)||n.includes(e)){o=Math.max(o,100);continue}let t=n.split(/\s+/).filter(e=>e.length>1);if(!t.length)continue;let r=0;for(let n of t)e.includes(n)&&(r+=1);o=Math.max(o,r/t.length*88)}return o}var vO=28;function yO(e,t){let n=null,r=0;for(let i of e){let e=_O(i,t);e>r&&(r=e,n=i)}return!n||r<vO?null:n}function bO(e,t,n){let r=String(t||``).toLowerCase().trim(),i=String(n||``).trim();if(!(/^https?:\/\//i.test(i)||/\.\w{2,}(\/|\s|$)/.test(i)||r.includes(`url`)||r.includes(`website`)||r.includes(`domain`)||r.includes(`site`)))return null;let a=null,o=0;for(let t of e){if(t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`)continue;let e=(t.type||``).toLowerCase();if([`hidden`,`submit`,`button`,`checkbox`,`radio`].includes(e))continue;let n=0;(e===`url`||e===`text`||e===`search`)&&(n+=45);let r=[t.name,t.id,t.placeholder,dO(t),t.getAttribute(`aria-label`),t.getAttribute(`autocomplete`)].filter(Boolean).join(` `).toLowerCase();/(website|url|domain|site\s*url)/.test(r)&&(n+=55),n>o&&(o=n,a=t)}return!a||o<42?null:a}function xO(e){let t=String(e??``).trim();return t?/^https?:\/\//i.test(t)?!0:/\.\w{2,}(\/|\s|$)/.test(t):!1}function SO(e){let t=String(e??``).toLowerCase().trim();return t?!!(t===`url`||t===`website`||t===`website url`||t===`website_url`||t===`enter website url`||t.includes(`website`)||t.includes(`domain`)||/(enter\s+website|site\s*url|page\s*url)/.test(t)):!1}function CO(e){if(!e||e.tagName!==`INPUT`&&e.tagName!==`TEXTAREA`)return!1;let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`checkbox`,`radio`,`file`].includes(t)}function wO(e){if(!CO(e))return!1;let t=(e.name||``).toLowerCase(),n=(e.id||``).toLowerCase(),r=[e.name,e.id,e.placeholder,dO(e),e.getAttribute(`aria-label`)].filter(Boolean).join(` `).toLowerCase();return t===`url`||n===`url-input`||n.endsWith(`-url-input`)||/(website\s*url|enter\s+website|site\s*url)/.test(r)||/(website|domain)/.test(r)&&/(url|site)/.test(r)}function TO(e,t,n){let r=String(t??``),i=String(n??``),a=OO(e,r)||yO(e,r)||bO(e,r,i);if(!a)return[];let o=new Set([a]);if(xO(i)&&SO(r))for(let t of e)t!==a&&wO(t)&&o.add(t);let s=Array.from(o);return s.sort((e,t)=>{if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}),s}function EO(e,t){try{if(!e?.getBoundingClientRect||!t?.getBoundingClientRect)return 1/0;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return Math.hypot(i.x-a.x,i.y-a.y)}catch{return 1/0}}function DO(e){if(!e||typeof e!=`string`)return null;let t=null;return lO(n=>{try{let r=n.getElementById(e);r&&!sO(r)&&r.matches?.(`input, select, textarea`)&&(t=r)}catch{}}),t}function OO(e,t){let n=String(t??``).trim();if(!n)return null;let r=n.match(/^name:\s*([\w.-]+)$/i);if(r){let t=r[1];for(let n of e)if(n.name===t)return n}let i=n.match(/^id:\s*([\w.-]+)$/i);if(i){let e=DO(i[1]);if(e)return e}let a=n.startsWith(`#`)?n.slice(1):n;if(/^[\w-]+$/.test(a)){let e=DO(a);if(e)return e}let o=n.toLowerCase().replace(/\s+/g,` `);if(o===`url`||o===`website`||o===`website url`||o===`website_url`||o===`enter website url`)for(let t of e){let e=(t.name||``).toLowerCase(),n=(t.id||``).toLowerCase();if(e===`url`||n===`url-input`||n.endsWith(`-url-input`))return t}return null}function kO(e,t){let n=String(t||``).toLowerCase().trim();if(!n)return 0;let r=[e.textContent,e.value,e.getAttribute(`aria-label`),e.getAttribute(`title`)].filter(Boolean).join(` `).toLowerCase().replace(/\s+/g,` `);if(r.includes(n))return 100;let i=n.split(/\s+/).filter(e=>e.length>1);if(!i.length)return 0;let a=0;for(let e of i)r.includes(e)&&(a+=1);return a/i.length*92}function AO(e,t){let n=[];lO(e=>{n.push(...Array.from(e.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"]`)).filter(e=>{if(sO(e)||e.disabled)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))});let r=0,i=n.map(t=>({el:t,s:kO(t,e)}));for(let{s:e}of i)e>r&&(r=e);if(r<36)return null;let a=i.filter(({s:e})=>e===r).map(({el:e})=>e);if(a.length===1)return a[0];let o=Array.isArray(t)?t.filter(e=>e&&e.isConnected):[];if(o.length){let e=a[0],t=1/0;for(let n of a)for(let r of o){let i=EO(n,r);i<t&&(t=i,e=n)}return e}return a[0]}function jO(e){if(e==null)return{};if(typeof e==`string`){let t=e.trim();if(!t)return{};try{return JSON.parse(t)}catch{return{url:t}}}return e}function MO(e){let t=jO(e);if(Array.isArray(t)&&t.length>0){let e=t[0];if(e?.field_key!=null||e?.fieldKey!=null)return t.map(e=>({field_key:e.field_key??e.fieldKey,value:e.value}))}if(!t||typeof t!=`object`)return[];let n=t.fields??t.Fields??t.field_list??t.fieldList??t.data?.fields;if(typeof n==`string`)try{n=JSON.parse(n)}catch{n=null}n&&!Array.isArray(n)&&typeof n==`object`&&(n=Object.values(n)),(!n||n.length===0)&&(t.field_key!=null||t.fieldKey!=null)&&t.value!=null&&(n=[{field_key:t.field_key??t.fieldKey,value:t.value}]);let r=t.website_url??t.websiteUrl??t.url??t.website??t.domain??t.site_url??t.siteUrl;return(!n||n.length===0)&&r!=null&&String(r).trim()&&(n=[{field_key:t.field_key??t.fieldKey??`url`,value:String(r).trim()}]),Array.isArray(n)?n.map(e=>({field_key:e?.field_key??e?.fieldKey,value:e?.value??e?.Value})):[]}function NO(e){if(!e||typeof e!=`string`)return[];let t=e.trim();if(!t||/\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t))return[];let n=t.match(/https?:\/\/[^\s<>"']+/i);if(n)return[{field_key:`url`,value:n[0].replace(/[.,;:)]+$/,``)}];let r=t.match(/\b(?:[\w-]+\.)+[a-z]{2,}\b/i);if(r){let e=r[0].replace(/[.,;:)]+$/,``);return/^https?:/i.test(e)||(e=`https://${e}`),[{field_key:`url`,value:e}]}return[]}function PO(e){if(!e||typeof e!=`string`)return[];let t=e.trim();if(!t)return[];let n=[],r=new Set,i=/\b([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\b/i,a=(e,t)=>{let i=String(t??``).trim().replace(/^["']|["']$/g,``);if(!i||i.length>800)return;let a=`${e}\0${i}`;r.has(a)||(r.add(a),n.push({field_key:e,value:i}))},o=t.match(/^\s*([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\s*$/i);if(o)return a(`Email Address`,o[1]),n;let s=t.match(/\b(?:please\s+)?(?:enter|type|put)\s+(.+?)\s+in(?:to)?\s+(?:the\s+)?(?:full\s*name|full\s*name\s*field|name\s*field)\b/i);if(s&&a(`Full Name`,s[1]),s=t.match(/\bfull\s*name,?\s*(?:please\s+)?(?:enter|type|put)\s+(.+?)(?:\.|$|!|\?)/i),s&&a(`Full Name`,s[1]),s=t.match(/\bfull\s*name\s*(?:is|:|please\s+enter|-)\s*(.+?)(?:\.|$|(?=\s+(?:and|my\s+email|email|message))\b)/i),s&&a(`Full Name`,s[1]),s=t.match(/\b(.+?)\s+for\s+(?:the\s+)?full\s*name\b/i),s){let e=s[1].trim();e.length>1&&e.length<120&&!/@/.test(e)&&a(`Full Name`,e)}if(s=t.match(/\b(?:email|e-mail)(?:\s*address)?\s*(?:is|:|please\s+use|enter|-)\s*([^\s@]+@[^\s@]+\.[^\s,]+)/i),s&&a(`Email Address`,s[1]),s=t.match(/\b(?:enter|type|put)\s+([^\s@]+@[^\s@]+\.[^\s,]+)\s+in(?:to)?\s+(?:the\s+)?(?:email|e-mail)/i),s&&a(`Email Address`,s[1]),s=t.match(/\b(?:message|comment)\s*(?:is|:|please\s+enter|-)\s*(.+)$/is),s){let e=s[1].trim();e.length>0&&a(`Message`,e)}if(!n.some(e=>/email/i.test(String(e.field_key)))){let e=t.match(i);if(e){let r=t.replace(e[0],``).trim().replace(/^(please|it's|it is|use|is|my email is|e-?mail is)\s*/i,``).replace(/[.,;:!?]+$/,``).trim();if(t.length<=96&&r.length<=36)return a(`Email Address`,e[1]),n}}if(n.length===0){let e=t.split(/\s+/).filter(Boolean).length,n=/[.!?]/.test(t)||e>=6||t.length>=24&&e>=5||t.length>=42,r=/^[A-Z][a-z]+\s+[A-Z][a-z]+$/.test(t.trim());n&&t.length>=16&&!i.test(t)&&!r&&a(`Message`,t)}return n}function FO(e){if(!e||typeof e!=`object`)return null;let t=e.url??e.target_url??e.page_url??e.pageUrl??e.link??e.href??e.path;return t==null?null:String(t).trim()||null}function IO(e){if(!e||typeof e!=`object`)return null;let t=e.query??e.q??e.search??e.text??e.keywords;return t==null?null:String(t).trim()||null}function LO(e,t,n){if(!n?.skipScroll)try{e.scrollIntoView({block:`center`,inline:`nearest`})}catch{try{e.scrollIntoView(!0)}catch{}}try{e.focus({preventScroll:!0})}catch{try{e.focus()}catch{}}let r=e.tagName,i=(e.type||``).toLowerCase();if(r===`SELECT`)return e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0;if(i===`checkbox`||i===`radio`)return e.checked=[`1`,`true`,`yes`,`on`].includes(String(t).toLowerCase().trim()),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0;let a=String(t);if(r===`INPUT`||r===`TEXTAREA`){let t=e.ownerDocument?.defaultView||window,n=r===`TEXTAREA`?t.HTMLTextAreaElement.prototype:t.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(n,`value`);i?.set?i.set.call(e,a):e.value=a}else e.value=a;let o={bubbles:!0,cancelable:!0,composed:!0};try{e.dispatchEvent(new InputEvent(`input`,{...o,inputType:`insertText`,data:a}))}catch{e.dispatchEvent(new Event(`input`,o))}e.dispatchEvent(new Event(`change`,o));try{queueMicrotask(()=>{try{e.dispatchEvent(new Event(`input`,o)),e.dispatchEvent(new Event(`change`,o))}catch{}})}catch{}return!0}function RO(){let e={};document.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach(t=>{if(t.id)return;let n=t.textContent.trim();if(!n)return;let r=n.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).substring(0,60);if(e[r]){let t=2;for(;e[r+`-`+t];)t++;r=r+`-`+t}e[r]=!0,t.id=r})}function zO(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``),r=typeof e.getLastUserVoiceText==`function`?e.getLastUserVoiceText:null,i=[],a={flowengage_navigate:async n=>{$(`flowengage_navigate ▶ raw parameters:`,n);let r=jO(n),i=FO(r),a=r.section_text??r.sectionText??r.section;if($(`flowengage_navigate · coerced:`,{url:i,sectionText:a}),!i){let e=`Missing url: pass a string url, path like /pricing, or JSON with a url field.`;return $(`flowengage_navigate ✖`,e),e}if(typeof window<`u`)try{let e=new URL(i,window.location.href);e.origin!==window.location.origin&&/^https?:$/i.test(e.protocol)&&(i=e.pathname+e.search+e.hash,$(`flowengage_navigate · normalized cross-origin URL to path:`,i))}catch{}if(!await Hn(i,{siteId:t,apiBaseUrl:e.apiBaseUrl})){let e=`Page "${i}" could not be verified. Call flowengage_search with keywords from the topic to find the correct URL, then navigate to the URL from the search results.`;return $(`flowengage_navigate ✖ blocked`,e),e}try{BD(`Navigating to ${i}...`,{spinner:!0}),GD();let t=typeof e.getSessionCaptureData==`function`?e.getSessionCaptureData():null,n=i;if(t){let{ok:e,sessionKey:r,compact:o}=DD.capture({siteId:t.siteId,chatId:t.chatId,agentId:t.agentId,trigger:`agent_navigate`,navigationConfidence:`high`,targetUrl:i,interruption:{state:`tool_calling`,toolName:`flowengage_navigate`,toolParams:{url:i,section_text:a||null},lastAgentText:t.lastAgentText,lastUserText:t.lastUserText,estimatedSpokenWords:t.estimatedSpokenWords,agentTextWordCount:t.agentTextWordCount,isMuted:t.isMuted||!1},history:t.history});e&&r?n=TD(i,r):o&&(n=TD(i,o)),$(`flowengage_navigate · session captured, resumeUrl:`,n)}return jD(),await aO(300),$(`flowengage_navigate → location.assign`,n),window.location.assign(n),`Navigating...`}catch(e){let t=`Navigation error: ${e?.message||String(e)}`;return $(`flowengage_navigate ✖`,t),BD(`Navigation failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{KD(),VD(900)}},flowengage_highlight:async e=>{$(`flowengage_highlight ▶`,e);let t=jO(e),n=t?.section_id||t?.sectionId,r=t?.section_text||t?.sectionText;RO();let i=Rn(n||null,r||null);return!i&&r&&(await new Promise(e=>setTimeout(e,500)),RO(),i=Rn(null,r)),i?(PD(i),$(`flowengage_highlight ✓`,r||n),`OK_HIGHLIGHT: "${r||n}"`):($(`flowengage_highlight ✖ no element for:`,r||n),`Could not find "${r||n}" on the current page. Try a shorter phrase matching a visible heading.`)},flowengage_read_content:async e=>{$(`flowengage_read_content ▶`,e);let t=jO(e),n=t?.section_text||t?.sectionText||``;try{let e=``;if(n){let t=Rn(null,n);if(!t)return`Could not find section "${n}" on the page.`;let r=[t.textContent.trim()],i=t.nextElementSibling;for(;i&&!/^H[1-3]$/i.test(i.tagName);){let e=i.textContent.trim();e&&r.push(e),i=i.nextElementSibling}e=r.join(`
|
|
615
|
-
`)}else{let t=(document.querySelector(`main`)||document.querySelector(`article`)||document.querySelector(`[role="main"]`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);t.querySelectorAll(`nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar`).forEach(e=>e.remove()),e=t.textContent.replace(/\s+/g,` `).trim()}return e.length>8e3&&(e=e.substring(0,8e3)+`... (truncated)`),$(`flowengage_read_content ✓`,`${e.length} chars`),e||`No readable content found on this page.`}catch(e){return $(`flowengage_read_content ✖`,e.message),`Could not read page content: ${e.message}`}},flowengage_search:async e=>{$(`flowengage_search ▶`,e);let r=IO(jO(e));if($(`flowengage_search · query:`,r,`siteId:`,t,`apiBase:`,n||`(empty)`),!r)return $(`flowengage_search ✖ missing query`),`Missing query parameter.`;if(!t)return $(`flowengage_search ✖ no siteId`),`Site is not configured for search.`;if(!n)return $(`flowengage_search ✖ no api base`),`API base URL is missing; cannot search.`;try{let e=`${n}/api/site-tools/search`;$(`flowengage_search → POST`,e);let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})}),a=await i.json();if($(`flowengage_search · HTTP`,i.status,`success:`,a.success),!a.success){let e=a.error||`Search failed.`;return $(`flowengage_search ✖`,e),e}let o=a.results||[];return $(`flowengage_search ✓`,`${o.length} result(s)`,o.slice(0,3).map(e=>e?.url||e)),JSON.stringify(o)}catch(e){let t=`Search error: ${e.message||`network`}`;return $(`flowengage_search ✖`,t),t}},flowengage_page_content:async e=>{$(`flowengage_page_content ▶`,e);let r=jO(e),i=r?.url||r?.page_url||``;if($(`flowengage_page_content · url:`,i,`siteId:`,t,`apiBase:`,n||`(empty)`),!i)return $(`flowengage_page_content ✖ missing url`),`Missing url parameter.`;if(!t)return $(`flowengage_page_content ✖ no siteId`),`Site is not configured.`;if(!n)return $(`flowengage_page_content ✖ no api base`),`API base URL is missing; cannot fetch page content.`;try{let e=`${n}/api/site-tools/page-content`;$(`flowengage_page_content → POST`,e);let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,url:i})}),a=await r.json();if($(`flowengage_page_content · HTTP`,r.status,`success:`,a.success),!a.success){let e=a.error||`Failed to get page content.`;return $(`flowengage_page_content ✖`,e),e}return $(`flowengage_page_content ✓`,`title: ${a.title}`,`sections: ${(a.sections||[]).length}`,`content: ${(a.content||``).length} chars`),JSON.stringify({title:a.title,url:a.url,sections:a.sections,content:a.content})}catch(e){let t=`Page content error: ${e.message||`network`}`;return $(`flowengage_page_content ✖`,t),t}},flowengage_end_session:async()=>($(`flowengage_end_session ▶`),typeof e.requestEndSession==`function`&&e.requestEndSession(),`Voice session is ending.`),flowengage_list_forms:async()=>{let e=pO(),t=mO();return $(`flowengage_list_forms ✓`,`${e.length} field(s)`,`${t.length} button(s)`),JSON.stringify({fields:e,buttons:t,hint:`field_key: placeholder/label, name (e.g. url), id (e.g. url-input). If the page has two URL boxes, flowengage_fill_form sets all matching URL inputs. flowengage_click_button picks the Conduct Audit nearest the filled field when labels duplicate.`})},flowengage_fill_form:async e=>{try{$(`flowengage_fill_form ▶ raw:`,e),qD();let t=MO(e);if(!t.length&&r){let e=r(),n=NO(e);n.length?$(`flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):`,n):(n=PO(e),n.length&&$(`flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):`,n)),n.length&&(t=n)}if($(`flowengage_fill_form · normalized fields:`,t),!t.length)return`No fields provided. Call flowengage_list_forms for field_key strings, then flowengage_fill_form with { "fields": [ { "field_key": "<label or placeholder from list>", "value": "<user value>" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.`;let n=[];for(let e of t){let t=e?.field_key??e?.fieldKey,r=e?.value;if(t==null||r==null)continue;BD(`Filling ${String(t)}...`,{spinner:!0});let a=fO(),o=TO(a,String(t),r);if(o.length){for(let[e,t]of o.entries())JD(t),await eO(t),LO(t,r,{skipScroll:e>0}),YD(t),await aO(120);i=o,n.push(String(t));continue}let s=OO(a,String(t));s||=yO(a,String(t)),s||=bO(a,String(t),r),s&&(JD(s),await eO(s),LO(s,r),YD(s),await aO(120),i=[s],n.push(String(t)))}if(!n.length)return $(`flowengage_fill_form ✖ no matches`),`Could not match any fields. Call flowengage_list_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.`;let a=`OK_FILLED: ${n.join(`, `)}`;return $(`flowengage_fill_form ✓`,a),BD(`Form filled`,{spinner:!1,icon:`✅`,duration:1100}),a}catch(e){let t=`flowengage_fill_form error: ${e?.message||String(e)}`;return $(`flowengage_fill_form ✖`,t),BD(`Failed to fill form`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{tO(),qD(),VD(700)}},flowengage_click_button:async e=>{let t=jO(e),n=(t.button_text??t.buttonText??t.text??``).trim();if($(`flowengage_click_button ▶`,n),!n)return`Missing button_text: pass the visible label, e.g. Conduct Audit.`;let r=AO(n,i);if(!r)return $(`flowengage_click_button ✖ no match`),`Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;try{BD(`Clicking ${n}...`,{spinner:!0});try{r.scrollIntoView({block:`center`,inline:`nearest`})}catch{r.scrollIntoView(!0)}await eO(r),r.focus?.(),await nO(r),rO(r),r.click();let e=(r.textContent||r.value||r.getAttribute(`aria-label`)||``).trim().slice(0,80)||`button`,t=`OK_CLICK ${e}`;return $(`flowengage_click_button ✓`,t),BD(`Clicked ${e}`,{spinner:!1,icon:`✅`,duration:1200}),t}catch(e){let t=`Click failed: ${e?.message||String(e)}`;return $(`flowengage_click_button ✖`,t),BD(`Click failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{tO(),VD(700)}}};return{...a,navigateToPage:a.flowengage_navigate,highlightOnPage:a.flowengage_highlight,searchSiteContent:a.flowengage_search,getPageContent:a.flowengage_page_content,endVoiceSession:a.flowengage_end_session,listPageForms:a.flowengage_list_forms,fillFormFields:a.flowengage_fill_form,clickPageButton:a.flowengage_click_button}}function BO(e){return!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,async n=>{let r=pn();r?console.log(`[FlowEngage:voice-tool] ▶`,e,n):console.info(`[FlowEngage] voice tool » ${e}`);let i;try{i=await t(n)}catch(t){let n=`Tool error: ${t?.message||String(t)}`;return console.error(`[FlowEngage] voice tool ${e} threw:`,t),n}let a=typeof i==`string`?i.length>220?`${i.slice(0,220)}…`:i:String(i);return r?console.log(`[FlowEngage:voice-tool] ◀`,e,a):console.info(`[FlowEngage] voice tool « ${e}:`,a),i}]))}var VO={blue:`#135bd8`,red:`#ef334b`,yellow:`#ffbd2e`,dark:`#0d1b2a`,highlight:`rgba(255,255,255,0.9)`,green:`#10b981`};function HO(e){if(!Array.isArray(e)||e.length<2)return`linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa`;let[t,n,r]=e;return e.length>=3&&r?[`radial-gradient(ellipse 80% 70% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 70% 80% at 110% 30%, ${n}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 60% at 50% 110%, ${r}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `):[`radial-gradient(ellipse 80% 100% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 100% at 110% 50%, ${n}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `)}function UO(e){if(!e||typeof e!=`string`)return`#1a1a1a`;let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255,o=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;return .2126*o(r)+.7152*o(i)+.0722*o(a)>.179?`#1a1a1a`:`#ffffff`}function WO({logo:e,style:t}){if(!e)return null;if(typeof e==`string`)return(0,M.jsx)(`img`,{src:e,alt:``,style:{objectFit:`contain`,flexShrink:0,display:`block`,...t}});let n=typeof e==`function`?b.createElement(e):b.isValidElement(e)?e:null;return n?(0,M.jsx)(`span`,{className:`fe-logo-slot`,style:{display:`inline-flex`,alignItems:`center`,flexShrink:0,overflow:`hidden`,...t},children:n}):null}function GO({title:e}){return(0,M.jsx)(`div`,{style:{width:`100%`,height:`100%`,borderRadius:`16px`,background:`linear-gradient(135deg, rgba(59,130,246,0.16) 0%, rgba(59,130,246,0.08) 100%)`,color:`#2563eb`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`18px`,fontWeight:700,letterSpacing:`-0.03em`},children:String(e||`FE`).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()||``).join(``)||`FE`})}function KO(e,t){let n=(t||``).trim();return n?!!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\b(hang\s+up|disconnect)\b/i.test(n)||/\b(that'?s all|we'?re done)\b/i.test(n)||e===`bot`&&(/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n)||/\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n)||/\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n)||/\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n)||/\b(wrapping\s+up|signing\s+off)\b/i.test(n))||/^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)):!1}function qO({orbColors:e,...t}){return(0,M.jsx)(uD,{colors:e,...t})}function JO({copy:e,orbColors:t,primaryColor:n,onYes:r,onLater:i,isMobile:a}){let o=n||VO.green,s=UO(o),c=a?72:94,l=(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:a?`14px`:`18px`},children:[(0,M.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,M.jsx)(jp.p,{initial:{x:-16,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.36},style:{margin:`0 0 14px`,fontSize:`14px`,fontWeight:700,color:`white`,lineHeight:1.4,textShadow:`0 1px 4px rgba(0,0,0,0.35)`,maxWidth:a?void 0:`210px`},children:e.entryPrompt}),(0,M.jsxs)(jp.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.54},style:{display:`flex`,gap:`16px`,flexWrap:`nowrap`},children:[(0,M.jsx)(`button`,{onClick:r,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:o,color:s,fontWeight:400,fontSize:`14px`,border:`none`,cursor:`pointer`,whiteSpace:`nowrap`,boxShadow:`0 4px 16px ${o}66`,transition:`transform 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.04)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.yesLabel}),(0,M.jsx)(`button`,{onClick:i,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:`transparent`,color:`white`,fontWeight:400,fontSize:`14px`,border:`2px solid rgba(255,255,255,0.55)`,cursor:`pointer`,whiteSpace:`nowrap`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.9)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.55)`},children:e.laterLabel})]})]}),(0,M.jsx)(jp.div,{initial:{x:120,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:220,damping:22,delay:0},style:{flexShrink:0},children:(0,M.jsx)(qO,{size:c,orbColors:t})})]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(jp.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.4},style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.72)`,zIndex:-1}}),a?(0,M.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,padding:`24px 20px 40px`,overflow:`hidden`},children:l}):l]})}function YO({copy:e,orbColors:t,primaryColor:n,onVoice:r,onText:i,onClose:a,isMobile:o}){let s=n||VO.green,c=UO(s);return(0,M.jsxs)(jp.div,{initial:{scale:50/350,borderRadius:`50%`},animate:{scale:1,borderRadius:`16px`},transition:{type:`spring`,stiffness:260,damping:26},style:{transformOrigin:o?`bottom center`:`bottom right`,background:`white`,width:o?`100%`:`350px`,height:`245px`,padding:`24px 40px 32px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`space-between`,boxShadow:`0 20px 60px rgba(0,0,0,0.2)`,position:`relative`,overflow:`hidden`},children:[(0,M.jsx)(`button`,{onClick:a,style:{position:`absolute`,top:`14px`,right:`14px`,background:`none`,border:`none`,cursor:`pointer`,color:`#9ca3af`,padding:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#374151`},onMouseLeave:e=>{e.currentTarget.style.color=`#9ca3af`},children:(0,M.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,M.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),(0,M.jsx)(qO,{size:72,orbColors:t}),(0,M.jsx)(`p`,{style:{margin:0,fontSize:`16px`,fontWeight:400,color:`#111827`,textAlign:`center`,lineHeight:1.4},children:e.connectionTitle}),(0,M.jsxs)(`div`,{style:{display:`flex`,gap:`16px`,width:`100%`},children:[(0,M.jsx)(`button`,{onClick:r,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:s,color:c,fontWeight:400,fontSize:`16px`,border:`none`,cursor:`pointer`,transition:`transform 0.15s ease`,boxShadow:`0 4px 12px ${s}55`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.03)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.voiceLabel}),(0,M.jsx)(`button`,{onClick:i,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:`transparent`,color:`#111827`,fontWeight:400,fontSize:`16px`,border:`1.5px solid #d1d5db`,cursor:`pointer`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6b7280`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d1d5db`},children:e.textLabel})]})]})}function XO({orbColors:e,onEnterChat:t,onEndChat:n,agentId:r,siteId:i,apiBaseUrl:a,historyRef:o,onMessageSync:s,pendingResume:c,chatId:l}){let[u,d]=(0,b.useState)(`idle`),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(null),_=(0,b.useRef)(``),v=(0,b.useRef)(async()=>{}),y=(0,b.useRef)(!1),x=(0,b.useRef)(!1),ee=(0,b.useRef)(`idle`),S=(0,b.useRef)(!1),C=(0,b.useRef)(!1),te=(0,b.useRef)(`minimized`),w=(0,b.useRef)(null),ne=(0,b.useCallback)((e=`minimized`)=>{te.current=e,C.current=!0,queueMicrotask(()=>{y.current||(y.current=!0,v.current?.())})},[o]),re=(0,b.useCallback)(async e=>{C.current=!0;try{await g.current?.endSession?.()}catch{}g.current=null,d(`idle`),p(!1),y.current=!1,typeof s==`function`&&await s(o.current),e?.()},[o,s]);return v.current=()=>re(te.current===`chat`?t:n),(0,b.useEffect)(()=>{x.current=f},[f]),(0,b.useEffect)(()=>{ee.current=u},[u]),(0,b.useEffect)(()=>{let e=()=>!!g.current,t=()=>{let e=o.current||[];for(let t=e.length-1;t>=0;t--)if(e[t].sender===`bot`)return e[t].message||``;return``},n=e=>{let n=t(),a=n.split(/\s+/).filter(Boolean).length;return{siteId:i,chatId:l||null,agentId:r,trigger:e,navigationConfidence:e===`agent_navigate`?`high`:`medium`,interruption:{state:ee.current,lastAgentText:n,lastUserText:_.current,estimatedSpokenWords:AD(),agentTextWordCount:a,isMuted:x.current},history:o.current||[]}},a=()=>{e()&&(OD()||DD.capture(n(`user_link_click`)))},s=t=>{e()&&(t.persisted||OD()||DD.capture(n(`pagehide`)))};return window.addEventListener(`beforeunload`,a),window.addEventListener(`pagehide`,s),()=>{window.removeEventListener(`beforeunload`,a),window.removeEventListener(`pagehide`,s)}},[i,l,r,o]),(0,b.useEffect)(()=>{let e=!1,n=null;return(async()=>{if(!r){d(`error`);return}try{if((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),e)return;c?c.interruption?.lastUserText&&(_.current=c.interruption.lastUserText):(o.current=[],_.current=``),y.current=!1,S.current=!1,C.current=!1,te.current=`minimized`;let t=BO(zO({siteId:i||null,apiBaseUrl:a||null,getLastUserVoiceText:()=>_.current,requestEndSession:()=>{ne()},getSessionCaptureData:()=>{let e=(()=>{let e=o.current||[];for(let t=e.length-1;t>=0;t--)if(e[t].sender===`bot`)return e[t].message||``;return``})();return{siteId:i,chatId:l||null,agentId:r,history:o.current||[],lastAgentText:e,agentTextWordCount:e.split(/\s+/).filter(Boolean).length,lastUserText:_.current,estimatedSpokenWords:AD(),isMuted:x.current}}})),s=typeof window<`u`?window.location.href:``,u,f=null;if(c&&!c.consumed){let e=typeof document<`u`?Array.from(document.querySelectorAll(`h1,h2,h3,h4`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell`)).map(e=>({tag:e.tagName,text:e.textContent.trim().slice(0,100),id:e.id||null})).filter(e=>e.text.length>0).slice(0,25):[];f=DD.buildResumePrompt(c,e,s);let t=e[0]?.text||``;u={agent:{firstMessage:t?`I'm now on the ${t} page. Let me walk you through it.`:`I've navigated to the new page. Let me continue our conversation.`}}}let m=await EE.startSession({agentId:r,...u?{overrides:u}:{},clientTools:t,onUnhandledClientToolCall:e=>console.error(`[FlowEngage] Unhandled tool:`,e?.tool_name),onModeChange:({mode:t})=>{e||d(t===`speaking`?`speaking`:`listening`)},onMessage:t=>{if(e)return;let n=t.role===`user`?`user`:`bot`,r=t.message||t.text||t.content||``;r&&(n===`user`&&(_.current=r),o.current=[...o.current,{sender:n,message:r,timestamp:new Date().toISOString()}],KO(n,r)&&ne(`minimized`))},onError:t=>{if(!e&&!C.current&&!S.current){S.current=!0,console.error(`[FlowEngageVoiceCall] session:error`,{message:t?.message,name:t?.name,raw:t});try{g.current?.setMicMuted?.(!0)}catch{}p(!0),d(`error`),ne(`chat`)}},onDisconnect:()=>{if(!e&&!C.current&&!S.current){S.current=!0,console.warn(`[FlowEngageVoiceCall] session:disconnected`,{historyCount:o.current?.length||0,lastUserText:_.current||``,wasMuted:x.current});try{g.current?.setMicMuted?.(!0)}catch{}p(!0),ne(`chat`)}}});if(e){m.endSession().catch(()=>{});return}n=m,g.current=m,d(`listening`);try{if(f)m.sendContextualUpdate(f),DD.clear();else{let e=`[]`;try{e=await t.flowengage_list_forms()}catch{}let n=typeof document<`u`?Array.from(document.querySelectorAll(`h1, h2, h3, h4`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell, nav, footer, header`)).map(e=>({tag:e.tagName,text:e.textContent.trim(),id:e.id||null})).filter(e=>e.text.length>0&&e.text.length<200).slice(0,25):[];m.sendContextualUpdate(`Page: ${s}. SiteId: ${i||`unknown`}. Sections on this page: ${JSON.stringify(n)}. IMPORTANT: Call flowengage_highlight with section_text from the list above as you explain each section. Forms: ${e}. Navigation: flowengage_navigate — use for cross-page navigation. End call: flowengage_end_session.`)}}catch{}}catch(n){e||(console.error(`[FlowEngage] startSession failed`,n),d(`error`),te.current=`chat`,window.setTimeout(()=>{e||t?.()},0))}})(),()=>{e=!0,C.current=!0,(n||g.current)?.endSession?.().catch(()=>{})}},[r,i,a,ne]),(0,b.useEffect)(()=>{if(!m)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;w.current&&!w.current.contains(t)&&h(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]),(0,M.jsxs)(`div`,{ref:w,style:{position:`relative`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`14px`,animation:`fe-orb-slide-up 0.42s cubic-bezier(0.16,1,0.3,1)`},children:[(0,M.jsxs)(`div`,{style:{position:`relative`},children:[u===`listening`&&(0,M.jsx)(`span`,{style:{position:`absolute`,right:`100%`,marginRight:`18px`,top:`50%`,transform:`translateY(-50%)`,color:`white`,fontSize:`18px`,fontWeight:600,letterSpacing:`0.01em`,textShadow:`0 2px 4px rgba(0,0,0,0.4)`,whiteSpace:`nowrap`},children:`Listening...`}),(0,M.jsx)(qO,{size:72,voiceState:u,isMuted:f,orbColors:e})]}),u===`error`&&(0,M.jsx)(`span`,{style:{color:`#f87171`,fontSize:`13px`,fontWeight:500},children:`Could not start voice session.`}),(0,M.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,M.jsx)(`button`,{onClick:async()=>{if(g.current)try{f?(await g.current.setMicMuted?.(!1),p(!1)):(await g.current.setMicMuted?.(!0),p(!0))}catch{}},title:f?`Unmute`:`Mute`,style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:f?`#7f1d1d`:`#1f2937`,border:f?`1.5px solid #ef4444`:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:f?`#f87171`:`white`,transition:`all 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:f?(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`line`,{x1:`1`,y1:`1`,x2:`23`,y2:`23`}),(0,M.jsx)(`path`,{d:`M9 9v3a3 3 0 005.12 2.12M15 9.34V4a3 3 0 00-5.94-.6`}),(0,M.jsx)(`path`,{d:`M17 16.95A7 7 0 015 12v-2m14 0v2a7 7 0 01-.11 1.23`}),(0,M.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),(0,M.jsx)(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]}):(0,M.jsx)(DE,{size:16,color:`currentColor`})}),(0,M.jsx)(`button`,{onClick:()=>h(e=>!e),style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:`#1f2937`,border:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`,transition:`background 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:(0,M.jsx)(FE,{size:16,color:`currentColor`})})]}),m&&(0,M.jsxs)(`div`,{style:{position:`absolute`,bottom:0,right:0,width:`230px`,zIndex:9999,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,animation:`fe-orb-fade-in 0.18s ease`,padding:`12px 12px 40px`},children:[(0,M.jsxs)(`button`,{onClick:()=>{h(!1),te.current=`chat`,re(t)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsx)(IE,{}),`Enter Chat Mode`]}),(0,M.jsxs)(`button`,{onClick:()=>{h(!1),te.current=`minimized`,re(n)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`#E30C12`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(227,12,18,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsx)(LE,{}),`End Conversation`]}),(0,M.jsx)(`button`,{onClick:()=>h(!1),style:{position:`absolute`,bottom:`8px`,right:`8px`,width:`24px`,height:`24px`,borderRadius:`50%`,background:`rgba(255,255,255,0.15)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.25)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.15)`},children:(0,M.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,M.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]})}function ZO({orbColors:e}){return(0,M.jsx)(`div`,{style:{flexShrink:0,width:`36px`,height:`36px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,M.jsx)(qO,{size:36,orbColors:e})})}var QO=()=>(0,M.jsx)(`div`,{style:{display:`flex`,marginBottom:`12px`,justifyContent:`flex-start`},children:(0,M.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,padding:`12px 16px`,borderRadius:`18px`,background:`#fff`,boxShadow:`0 2px 6px rgba(0,0,0,0.04)`},children:[0,1,2].map(e=>(0,M.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e))})});function $O({copy:e,orbColors:t,primaryColor:n,chatBgGradient:r,logo:i,quickChatOptions:a,onQuickChatSelect:o,isMobile:s,chatHistory:c,isAiTyping:l,isAgentTyping:u,activeScreen:d,agentName:f,agentHeadshot:p,fallbackAgentName:m,input:h,setInput:g,onSubmit:_,isConversationEnded:v,isLoading:y,isRateLimited:x,rateLimitMessage:ee,selectedFile:S,onFileSelect:C,onRemoveSelectedFile:te,attachmentError:w,isUploadingAttachment:ne,requiresEmail:re,emailInput:ie,setEmailInput:ae,emailError:oe,replyContext:se,setReplyContext:ce,webRTCError:le,micError:ue,setMicError:T,dismissCallError:E,incomingCall:de,rejectCall:fe,acceptCall:pe,activeCallId:me,callConnectionState:he,isCallMuted:ge,toggleCallMute:_e,endWebRTCCall:ve,formatCallDuration:ye,callDurationSeconds:be,onCollapse:xe,onStartVoice:Se,showPoweredBy:Ce}){let we=c.length>0,Te=y||x||v,Ee=!!(de||me),[De,Oe]=(0,b.useState)(!1),ke=(0,b.useRef)(null);return(0,b.useEffect)(()=>{if(!De)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;ke.current&&!ke.current.contains(t)&&Oe(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[De]),(0,M.jsxs)(`div`,{style:s?{"--flowengage-primary":n,"--flowengage-accent":n,position:`fixed`,left:`8px`,right:`8px`,bottom:0,width:`calc(100% - 16px)`,height:`90dvh`,background:r,borderRadius:`16px 16px 0 0`,display:`flex`,flexDirection:`column`,overflow:`hidden`,animation:`fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)`}:{"--flowengage-primary":n,"--flowengage-accent":n,width:`min(350px, calc(100vw - 40px))`,height:`min(640px, calc(100vh - 120px))`,background:r,borderRadius:`22px`,boxShadow:`0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,position:`relative`,animation:`fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)`},children:[(0,M.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`40px minmax(0, 1fr) 40px`,alignItems:`center`,columnGap:`14px`,padding:`16px 10px 14px`,background:`transparent`,flexShrink:0},children:[(0,M.jsx)(`button`,{onClick:xe,style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},children:(0,M.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,M.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),(0,M.jsxs)(`div`,{style:{minWidth:0,maxWidth:s?`100%`:`250px`,width:`100%`,justifySelf:`center`,display:`grid`,gridTemplateColumns:`minmax(72px, 40%) minmax(0, 60%)`,alignItems:`center`},children:[(0,M.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`,justifyContent:`center`,height:`40px`},children:i?(0,M.jsx)(WO,{logo:i,style:{height:`34px`,width:`100%`,maxWidth:`96px`}}):(0,M.jsx)(`div`,{style:{width:`40px`,height:`40px`,flexShrink:0},children:(0,M.jsx)(GO,{title:e.chatTitle})})}),(0,M.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`},children:(0,M.jsx)(`span`,{style:{fontSize:`15px`,fontWeight:600,color:`#111827`,letterSpacing:`-0.01em`,lineHeight:1.2,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.chatTitle,children:e.chatTitle})})]}),(0,M.jsxs)(`div`,{style:{position:`relative`,isolation:`isolate`,zIndex:10},ref:ke,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>Oe(e=>!e),style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},"aria-label":`Chat options`,children:(0,M.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`}),(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,M.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`})]})}),De&&(0,M.jsxs)(`div`,{style:{position:`absolute`,top:`34px`,right:0,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,overflow:`hidden`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,minWidth:`210px`,border:`1px solid rgba(255,255,255,0.07)`,animation:`fe-orb-fade-in 0.18s ease`},children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{Oe(!1),Se?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`}),(0,M.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`})]}),`Enter Voice Mode`]}),(0,M.jsx)(`div`,{style:{height:`1px`,background:`rgba(255,255,255,0.07)`,margin:`0 14px`}}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{Oe(!1),xe?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`#f87171`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(248,113,113,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.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,M.jsx)(`line`,{x1:`23`,y1:`1`,x2:`1`,y2:`23`})]}),`Close Conversation`]})]})]})]}),(0,M.jsx)(tD,{webRTCError:le,micError:ue,setMicError:T,dismissCallError:E,incomingCall:de,rejectCall:fe,acceptCall:pe,activeCallId:me,callConnectionState:he,formatCallDuration:ye,callDurationSeconds:be,endWebRTCCall:ve,isCallMuted:ge,toggleCallMute:_e,isAIVoiceActive:!1,currentCallAgentName:f||m,isRateLimited:x,rateLimitMessage:ee}),(0,M.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,background:`transparent`},children:we?(0,M.jsx)(ZE,{chatHistory:c,isAiTyping:l,isAgentTyping:u,setReplyContext:ce,TypingDots:QO,primaryColor:n,agentHeadshot:p,agentDisplayName:f||m,botAvatarNode:(0,M.jsx)(ZO,{orbColors:t})}):(0,M.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`22px`,padding:`28px 24px`},children:[(0,M.jsx)(qO,{size:94,orbColors:t}),(0,M.jsx)(`p`,{style:{margin:0,textAlign:`center`,fontSize:`16px`,color:`#374151`,lineHeight:1.55,maxWidth:`270px`},children:e.introGreeting}),a.length>0&&(0,M.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`8px`,justifyContent:`center`,width:`100%`,padding:`0 8px`},children:a.map(e=>(0,M.jsx)(`button`,{onClick:()=>o?.(e),style:{padding:`8px 16px`,borderRadius:`999px`,background:`white`,border:`1.5px solid ${n}33`,color:n||`#374151`,fontSize:`13px`,fontWeight:500,cursor:`pointer`,transition:`all 0.15s ease`,boxShadow:`0 1px 4px rgba(0,0,0,0.06)`},onMouseEnter:e=>{e.currentTarget.style.background=`${n}12`,e.currentTarget.style.borderColor=n},onMouseLeave:e=>{e.currentTarget.style.background=`white`,e.currentTarget.style.borderColor=`${n}33`},children:e.label||e.text},e.id))})]})}),(0,M.jsx)(`div`,{style:{background:`transparent`,flexShrink:0,position:`relative`,zIndex:1,padding:re?`6px 0 0`:`12px 0 0`},children:(0,M.jsx)(QE,{input:h,setInput:g,onSubmit:_,isConversationEnded:v,callUiActive:Ee,handleToggleVoice:Se,showVoiceToggle:d===`agent`,activeScreen:d,inputDisabled:Te,replyContext:se,clearReplyContext:()=>ce(null),onFileSelect:C,selectedFile:S,onRemoveSelectedFile:te,attachmentError:w,isUploadingAttachment:ne,requiresEmail:re,emailInput:ie,setEmailInput:ae,emailError:oe,inputPlaceholder:e.inputPlaceholder})}),(0,M.jsx)(`div`,{style:{flexShrink:0,textAlign:`center`,padding:`12px 20px 18px`,pointerEvents:`none`},children:Ce&&(0,M.jsxs)(`span`,{style:{fontSize:`11px`,color:`#9ca3af`,letterSpacing:`0.01em`,userSelect:`none`},children:[`Powered by `,(0,M.jsx)(`strong`,{style:{fontWeight:600,color:`#6b7280`},children:`FlowEngage`})]})})]})}function ek(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatHistory:r,isOpen:i,activeScreen:a,isHumanHandled:o,agentName:s,agentHeadshot:c,visitorEmail:l,isAgentTyping:u,isAiTyping:d,isLoading:f,isRateLimited:p,rateLimitMessage:m,isConversationEnded:h,incomingCall:g,activeCallId:_,callConnectionState:v,callConnectedAt:y,isCallMuted:x,webRTCError:ee,language:S,historyRef:C,onMessageSync:te,sendMessage:w,uploadChatFile:ne,openWidget:re,captureVisitorEmail:ie,setVoiceMode:ae,endConversation:oe,acceptCall:se,rejectCall:ce,endWebRTCCall:le,toggleCallMute:ue,dismissCallError:de,startTyping:pe,stopTyping:me,updateTypingDraft:he}=fn();(0,b.useEffect)(()=>{try{In()}catch{}},[]);let ge=t?.widgetSettings||{},_e=n?.widgetSettings||{},ve={...ge.branding||{},..._e.branding||{}},ye={...ge.theme||{},..._e.theme||{}},be={...ge.features||{},..._e.features||{}},xe=be.voice!==!1,Se=Array.isArray(ye.orbColors)&&ye.orbColors.length>0?ye.orbColors:null,Ce=Se?.[0]||ye.primaryColor||`#3B82F6`,we=ye.position||`bottom-right`,Te=ve.fallbackAgentName||`Agent`,Ee=HO(Se??ye.chatBgColors),De=ve.logo||ve.logoUrl||null,Oe=S||`en`,ke=ge.recommendations?.[Oe]||[],Ae=(_e.recommendations?.[Oe]??ke).filter(e=>String(e?.label??``).trim()).map((e,t)=>({id:e.key||`qr-${t}`,label:e.label,message:e.label,text:e.label})),je=Array.isArray(ve.quickChatOptions)&&ve.quickChatOptions.length>0?ve.quickChatOptions:Ae,Me=ve.hideWatermark===!0?!1:ve.showPoweredBy!==!1,D=ve.chatbotEnabled!==!1&&ye.chatbotEnabled!==!1,Ne=ge.greetings?.[S]||_e.greetings?.[S]||ve.introGreeting||`Hello, I'm here to help you know more about OpenSense Labs.`,Pe={entryPrompt:ve.entryPrompt||`Do you want to explore in a new way?`,yesLabel:ve.yesLabel||`Yes`,laterLabel:ve.laterLabel||`Later`,connectionTitle:ve.connectionTitle||`How would you like to connect?`,voiceLabel:ve.voiceLabel||`Voice`,textLabel:ve.textLabel||`Text`,chatTitle:ve.headerName||`Chat with FlowEngage`,introGreeting:Ne,inputPlaceholder:ve.inputPlaceholder||`Type your message`,analysingLabel:ve.analysingLabel||`analysing...`},Fe=_e.elevenLabsAgentId||t?.elevenLabsAgentId||null,Ie=t?.siteId||n?.siteId||null,Le=t?.apiBaseUrl||``,Re=(0,b.useMemo)(()=>s&&String(s).trim()||t?.ownerName&&String(t.ownerName).trim()||t?.websiteName&&String(t.websiteName).trim()||`Agent`,[s,t?.ownerName,t?.websiteName]),ze=c&&String(c).trim()||t?.ownerProfileImageUrl&&String(t.ownerProfileImageUrl).trim()||null,Be=r.some(e=>e.sender===`user`),Ve=(0,b.useMemo)(()=>{let e=r.findIndex(e=>e.sender===`user`);return e===-1?!1:r.slice(e+1).some(e=>e.sender===`bot`||e.sender===`ai`||e.sender===`agent`)},[r]),He=!l&&Be&&Ve,Ue=!!(_e._dashboardLivePreview||ge._dashboardLivePreview),[We,O]=(0,b.useState)(()=>Ue?`text_chat`:`entry_prompt`),[k,Ge]=(0,b.useState)(``),[A,Ke]=(0,b.useState)(null),[qe,Je]=(0,b.useState)(l||``),[Ye,Xe]=(0,b.useState)(``),[Ze,Qe]=(0,b.useState)(0),[$e,et]=(0,b.useState)(null),[tt,nt]=(0,b.useState)(null),[rt,it]=(0,b.useState)(``),[at,ot]=(0,b.useState)(!1),st=(0,b.useRef)(null),ct=(0,b.useRef)(!1),lt=(0,b.useRef)(null),ut=(0,b.useMemo)(()=>fe(Ie),[Ie]);(0,b.useLayoutEffect)(()=>{if(!(e!==`ready`||ct.current)){ct.current=!0;try{let e=DD.read(Ie);if(e&&e._resumeMode===`auto`){lt.current=e,Array.isArray(e.history)&&e.history.length>0&&(C.current=e.history),re({notifyChatInitiated:!0}),ae?.(!0),O(`voice_mode`);return}}catch{}if(T(Ie)||!xe){O(`minimized_orb`);return}}},[e,r]);let[dt,ft]=(0,b.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 640px)`).matches);(0,b.useEffect)(()=>{let e=window.matchMedia(`(max-width: 640px)`),t=e=>ft(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,b.useEffect)(()=>{Je(l||``),l&&Xe(``)},[l]);let pt=(0,b.useCallback)(()=>{nt(null),it(``)},[]),mt=(0,b.useCallback)(e=>{let t=KE(e);if(t){nt(null),it(t);return}nt(e),it(``)},[]);(0,b.useEffect)(()=>{if(!y||v!==`connected`){Qe(0);return}let e=()=>{let e=new Date(y).getTime();isNaN(e)||Qe(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[y,v]),(0,b.useEffect)(()=>{let e=g?.callId||_||null;if(!e){st.current=null;return}(g?.callId||v===`connecting`||v===`connected`)&&(!(!i||We===`minimized_orb`||We===`voice_mode`)&&st.current===e||(console.log(`[FlowEngageWidget] forcing call UI to front`,{forcedKey:e,isOpen:i,surface:We,hasIncomingCall:!!g?.callId,activeCallId:_,callConnectionState:v}),st.current=e,We===`voice_mode`&&ae?.(!1),re?.(),O(`text_chat`)))},[_,v,g?.callId,i,re,ae,We]),(0,b.useEffect)(()=>{if(!o||h){he?.(``),me?.();return}if(!k.trim()||tt){he?.(``),me?.();return}pe?.();let e=window.setTimeout(()=>he?.(k),120),t=window.setTimeout(()=>me?.(),1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[k,tt,o,h,pe,me,he]);let ht=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,gt=async e=>{if(e.preventDefault(),h)return;if(He){let e=qe.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){Xe(`Please enter a valid email so we can continue helping you.`);return}await ie(e),Xe(``);return}let t=ht(A);if(!k.trim()&&!tt)return;if(tt){try{ot(!0),it(``);let e=await ne(tt),n=e?.data||e,r=k.trim()||`Shared file: ${JE(tt)}`;Ge(``),Ke(null),pt(),await w(r,``,t,{type:`file`,metadata:{fileUrl:n?.fileUrl,fileName:n?.fileName||tt.name,fileType:n?.fileType||tt.type,fileSize:n?.fileSize||tt.size}})}catch(e){it(e?.message||`Failed to upload the selected file.`)}finally{ot(!1)}return}let n=k.trim();Ge(``),Ke(null),await w(n,``,t)},_t=e=>{let t=Math.floor(e/60);return`${String(t).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}`},vt=(0,b.useCallback)(async e=>{if(h||f)return;let t=e.message||e.label||e.text||``;t.trim()&&await w(t.trim(),``)},[h,f,w]),yt=dt&&We===`entry_prompt`?{inset:0}:dt&&We===`text_chat`?{left:0,right:0,bottom:0}:dt&&We===`connection_modal`?{left:`28px`,right:`12px`,bottom:`12px`}:we===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},bt=()=>O(`minimized_orb`),xt=()=>O(`connection_modal`),St=()=>{re({notifyChatInitiated:!0}),ae?.(!0),O(`voice_mode`)},Ct=()=>{re({notifyChatInitiated:!0}),ae?.(!1),O(`text_chat`)},wt=()=>{ae?.(!1),bt()};return e!==`ready`||!D||be.chat===!1?null:(0,M.jsxs)(`div`,{className:`flowengage-widget-root`,style:{position:`fixed`,zIndex:999999,...yt},children:[We===`entry_prompt`&&(0,M.jsx)(JO,{copy:Pe,orbColors:Se,primaryColor:Ce,onYes:()=>{E(Ie),St()},onLater:()=>{E(Ie),bt()},isMobile:dt}),We===`minimized_orb`&&(0,M.jsx)(jp.div,{layoutId:`fe-main-orb`,initial:{scale:94/50},animate:{scale:1},transition:{type:`spring`,stiffness:220,damping:26},style:{transformOrigin:`bottom right`,display:`inline-block`},children:(0,M.jsx)(qO,{size:50,orbColors:Se,onClick:xe?xt:Ct})}),We===`connection_modal`&&(0,M.jsx)(YO,{copy:Pe,orbColors:Se,primaryColor:Ce,onVoice:St,onText:Ct,onClose:bt,isMobile:dt}),We===`voice_mode`&&(0,M.jsx)(XO,{orbColors:Se,onEnterChat:Ct,onEndChat:wt,agentId:Fe,siteId:Ie,apiBaseUrl:Le,historyRef:C,onMessageSync:te,pendingResume:lt.current,chatId:ut},`voice`),We===`text_chat`&&(0,M.jsx)($O,{copy:Pe,orbColors:Se,primaryColor:Ce,chatBgGradient:Ee,logo:De,quickChatOptions:je,onQuickChatSelect:vt,isMobile:dt,chatHistory:r,isAiTyping:d,isAgentTyping:u,activeScreen:a,agentName:Re,agentHeadshot:ze,fallbackAgentName:Te,input:k,setInput:Ge,onSubmit:gt,isConversationEnded:h,isLoading:f,isRateLimited:p,rateLimitMessage:m,selectedFile:tt,onFileSelect:mt,onRemoveSelectedFile:pt,attachmentError:rt,isUploadingAttachment:at,requiresEmail:He,emailInput:qe,setEmailInput:Je,emailError:Ye,replyContext:A,setReplyContext:Ke,webRTCError:ee,micError:$e,setMicError:et,dismissCallError:de,incomingCall:g,rejectCall:ce,acceptCall:se,activeCallId:_,callConnectionState:v,isCallMuted:x,toggleCallMute:ue,endWebRTCCall:le,formatCallDuration:_t,callDurationSeconds:Ze,onCollapse:bt,onStartVoice:St,onEndConversation:oe,showPoweredBy:Me}),(0,M.jsx)(`style`,{children:`
|
|
614
|
+
</svg>`,ZD=null,QD=!1;function $D(){return(!ZD||!ZD.isConnected)&&(ZD=document.createElement(`div`),ZD.id=`${Q}-cursor`,ZD.innerHTML=XD,document.body.appendChild(ZD),QD=!1),ZD}async function eO(e){if(typeof document>`u`||!e)return;ID();let t;try{t=e.getBoundingClientRect()}catch{return}let n=t.left+Math.min(16,t.width*.2),r=t.top+Math.min(12,t.height*.25),i=$D();QD||=(i.style.transition=`none`,i.style.left=`${window.innerWidth/2}px`,i.style.top=`${window.innerHeight*.4}px`,i.classList.add(`${Q}-cursor-visible`),i.offsetHeight,i.style.transition=`left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease`,!0),i.style.left=`${n}px`,i.style.top=`${r}px`,await iO(360)}function tO(e=!1){ZD&&(e?(ZD.classList.remove(`${Q}-cursor-visible`),QD=!1):(ZD.classList.remove(`${Q}-cursor-visible`),setTimeout(()=>{QD=!1},250)))}async function nO(e){ZD&&(ZD.classList.add(`${Q}-cursor-click`),await iO(280),ZD.classList.remove(`${Q}-cursor-click`))}function rO(e){if(!e||typeof document>`u`)return;ID();let t;try{t=e.getBoundingClientRect()}catch{return}let n=e.style.position,r=e.style.overflow,i=window.getComputedStyle(e).position;[`relative`,`absolute`,`fixed`,`sticky`].includes(i)||(e.style.position=`relative`),e.style.overflow=`hidden`;let a=document.createElement(`span`);a.className=`${Q}-ripple`;let o=Math.max(t.width,t.height)*1.2;Object.assign(a.style,{width:`${o}px`,height:`${o}px`,left:`${t.width/2-o/2}px`,top:`${t.height/2-o/2}px`}),e.appendChild(a),setTimeout(()=>{a.remove(),e.style.position=n,e.style.overflow=r},650)}function iO(e){return new Promise(t=>setTimeout(t,e))}function $(...e){pn()&&console.log(`[FlowEngage:voice-tools]`,...e)}function aO(e){return new Promise(t=>setTimeout(t,e))}var oO=`#flowengage-root, .flowengage-shell, .flowengage-widget-root`;function sO(e){if(!e||typeof e.closest!=`function`)return!1;try{return!!e.closest(oO)}catch{return!1}}function cO(e){try{let t=e.ownerDocument?.defaultView;if(t)return t.getComputedStyle(e)}catch{}return window.getComputedStyle(e)}function lO(e){let t=new Set;function n(r){if(!r||t.has(r))return;t.add(r),e(r);let i=r.querySelectorAll(`iframe`);for(let e of i)if(!sO(e))try{let t=e.contentDocument;t&&n(t)}catch{}}typeof document<`u`&&n(document)}function uO(e){return e==null?null:String(e).replace(/\u00a0/g,` `).replace(/\s*\*+\s*$/u,``).replace(/\s+/g,` `).trim()}function dO(e){let t=e.ownerDocument||document,n=e.getAttribute(`aria-labelledby`);if(n){let e=n.trim().split(/\s+/).filter(Boolean),r=[];for(let n of e)try{let e=t.getElementById(n);e?.textContent&&r.push(e.textContent.trim())}catch{}if(r.length)return uO(r.join(` `))}if(e.labels&&e.labels.length)return uO(e.labels[0].textContent);let r=e.id;if(r)try{let e=t.querySelector(`label[for="${CSS.escape(r)}"]`);if(e)return uO(e.textContent)}catch{let e=t.querySelector(`label[for="${r.replace(/"/g,`\\"`)}"]`);if(e)return uO(e.textContent)}let i=e.previousElementSibling;for(let e=0;e<6&&i;e+=1){if(i.tagName===`LABEL`)return uO(i.textContent);let e=(i.className||``).toString().toLowerCase();if(/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)){let e=uO(i.textContent);if(e)return e}i=i.previousElementSibling}let a=e.parentElement;for(let e=0;e<5&&a;e+=1){if(a.tagName===`LABEL`)return uO(a.textContent);let e=a.querySelector?.(`:scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']`);if(e?.textContent)return uO(e.textContent);a=a.parentElement}let o=e.getAttribute(`aria-label`);return o?uO(o):null}function fO(){let e=[];return lO(t=>{e.push(...Array.from(t.querySelectorAll(`input, select, textarea`)).filter(e=>{if(sO(e))return!1;let t=(e.type||``).toLowerCase();if([`hidden`,`submit`,`button`,`image`].includes(t)||e.disabled||e.readOnly)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e}function pO(){return fO().map((e,t)=>({formIndex:0,fieldIndex:t,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:dO(e),placeholder:e.placeholder||null}))}function mO(){let e=[];return lO(t=>{e.push(...Array.from(t.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"]`)).filter(e=>{if(sO(e)||e.disabled)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e.slice(0,60).map((e,t)=>({index:t,text:(e.textContent||e.value||``).replace(/\s+/g,` `).trim().slice(0,120)||null,ariaLabel:e.getAttribute(`aria-label`),type:e.type||e.tagName}))}function hO(e){return String(e||``).toLowerCase().replace(/\u00a0/g,` `).replace(/\*/g,``).replace(/\s+/g,` `).trim()}function gO(e){let t=hO(e);return t=t.replace(/\s+field\s*$/i,``).trim(),t}function _O(e,t){let n=gO(t);if(!n)return 0;let r=(e.name||``).toLowerCase(),i=(e.id||``).toLowerCase();if(r===`url`&&/url|website|domain|site|audit/.test(n)||(i===`url-input`||i.endsWith(`-url-input`))&&/url|website|domain|site|audit/.test(n))return 100;let a=[e.name,e.id,e.placeholder,dO(e),e.getAttribute(`aria-label`),e.getAttribute(`title`),e.getAttribute(`data-testid`),e.getAttribute(`autocomplete`)].filter(Boolean).map(e=>hO(e)),o=0;for(let e of a){if(!e)continue;if(e.includes(n)||n.includes(e)){o=Math.max(o,100);continue}let t=n.split(/\s+/).filter(e=>e.length>1);if(!t.length)continue;let r=0;for(let n of t)e.includes(n)&&(r+=1);o=Math.max(o,r/t.length*88)}return o}var vO=28;function yO(e,t){let n=null,r=0;for(let i of e){let e=_O(i,t);e>r&&(r=e,n=i)}return!n||r<vO?null:n}function bO(e,t,n){let r=String(t||``).toLowerCase().trim(),i=String(n||``).trim();if(!(/^https?:\/\//i.test(i)||/\.\w{2,}(\/|\s|$)/.test(i)||r.includes(`url`)||r.includes(`website`)||r.includes(`domain`)||r.includes(`site`)))return null;let a=null,o=0;for(let t of e){if(t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`)continue;let e=(t.type||``).toLowerCase();if([`hidden`,`submit`,`button`,`checkbox`,`radio`].includes(e))continue;let n=0;(e===`url`||e===`text`||e===`search`)&&(n+=45);let r=[t.name,t.id,t.placeholder,dO(t),t.getAttribute(`aria-label`),t.getAttribute(`autocomplete`)].filter(Boolean).join(` `).toLowerCase();/(website|url|domain|site\s*url)/.test(r)&&(n+=55),n>o&&(o=n,a=t)}return!a||o<42?null:a}function xO(e){let t=String(e??``).trim();return t?/^https?:\/\//i.test(t)?!0:/\.\w{2,}(\/|\s|$)/.test(t):!1}function SO(e){let t=String(e??``).toLowerCase().trim();return t?!!(t===`url`||t===`website`||t===`website url`||t===`website_url`||t===`enter website url`||t.includes(`website`)||t.includes(`domain`)||/(enter\s+website|site\s*url|page\s*url)/.test(t)):!1}function CO(e){if(!e||e.tagName!==`INPUT`&&e.tagName!==`TEXTAREA`)return!1;let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`checkbox`,`radio`,`file`].includes(t)}function wO(e){if(!CO(e))return!1;let t=(e.name||``).toLowerCase(),n=(e.id||``).toLowerCase(),r=[e.name,e.id,e.placeholder,dO(e),e.getAttribute(`aria-label`)].filter(Boolean).join(` `).toLowerCase();return t===`url`||n===`url-input`||n.endsWith(`-url-input`)||/(website\s*url|enter\s+website|site\s*url)/.test(r)||/(website|domain)/.test(r)&&/(url|site)/.test(r)}function TO(e,t,n){let r=String(t??``),i=String(n??``),a=OO(e,r)||yO(e,r)||bO(e,r,i);if(!a)return[];let o=new Set([a]);if(xO(i)&&SO(r))for(let t of e)t!==a&&wO(t)&&o.add(t);let s=Array.from(o);return s.sort((e,t)=>{if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}),s}function EO(e,t){try{if(!e?.getBoundingClientRect||!t?.getBoundingClientRect)return 1/0;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return Math.hypot(i.x-a.x,i.y-a.y)}catch{return 1/0}}function DO(e){if(!e||typeof e!=`string`)return null;let t=null;return lO(n=>{try{let r=n.getElementById(e);r&&!sO(r)&&r.matches?.(`input, select, textarea`)&&(t=r)}catch{}}),t}function OO(e,t){let n=String(t??``).trim();if(!n)return null;let r=n.match(/^name:\s*([\w.-]+)$/i);if(r){let t=r[1];for(let n of e)if(n.name===t)return n}let i=n.match(/^id:\s*([\w.-]+)$/i);if(i){let e=DO(i[1]);if(e)return e}let a=n.startsWith(`#`)?n.slice(1):n;if(/^[\w-]+$/.test(a)){let e=DO(a);if(e)return e}let o=n.toLowerCase().replace(/\s+/g,` `);if(o===`url`||o===`website`||o===`website url`||o===`website_url`||o===`enter website url`)for(let t of e){let e=(t.name||``).toLowerCase(),n=(t.id||``).toLowerCase();if(e===`url`||n===`url-input`||n.endsWith(`-url-input`))return t}return null}function kO(e,t){let n=String(t||``).toLowerCase().trim();if(!n)return 0;let r=[e.textContent,e.value,e.getAttribute(`aria-label`),e.getAttribute(`title`)].filter(Boolean).join(` `).toLowerCase().replace(/\s+/g,` `);if(r.includes(n))return 100;let i=n.split(/\s+/).filter(e=>e.length>1);if(!i.length)return 0;let a=0;for(let e of i)r.includes(e)&&(a+=1);return a/i.length*92}function AO(e,t){let n=[];lO(e=>{n.push(...Array.from(e.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"]`)).filter(e=>{if(sO(e)||e.disabled)return!1;try{let t=cO(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))});let r=0,i=n.map(t=>({el:t,s:kO(t,e)}));for(let{s:e}of i)e>r&&(r=e);if(r<36)return null;let a=i.filter(({s:e})=>e===r).map(({el:e})=>e);if(a.length===1)return a[0];let o=Array.isArray(t)?t.filter(e=>e&&e.isConnected):[];if(o.length){let e=a[0],t=1/0;for(let n of a)for(let r of o){let i=EO(n,r);i<t&&(t=i,e=n)}return e}return a[0]}function jO(e){if(e==null)return{};if(typeof e==`string`){let t=e.trim();if(!t)return{};try{return JSON.parse(t)}catch{return{url:t}}}return e}function MO(e){let t=jO(e);if(Array.isArray(t)&&t.length>0){let e=t[0];if(e?.field_key!=null||e?.fieldKey!=null)return t.map(e=>({field_key:e.field_key??e.fieldKey,value:e.value}))}if(!t||typeof t!=`object`)return[];let n=t.fields??t.Fields??t.field_list??t.fieldList??t.data?.fields;if(typeof n==`string`)try{n=JSON.parse(n)}catch{n=null}n&&!Array.isArray(n)&&typeof n==`object`&&(n=Object.values(n)),(!n||n.length===0)&&(t.field_key!=null||t.fieldKey!=null)&&t.value!=null&&(n=[{field_key:t.field_key??t.fieldKey,value:t.value}]);let r=t.website_url??t.websiteUrl??t.url??t.website??t.domain??t.site_url??t.siteUrl;return(!n||n.length===0)&&r!=null&&String(r).trim()&&(n=[{field_key:t.field_key??t.fieldKey??`url`,value:String(r).trim()}]),Array.isArray(n)?n.map(e=>({field_key:e?.field_key??e?.fieldKey,value:e?.value??e?.Value})):[]}function NO(e){if(!e||typeof e!=`string`)return[];let t=e.trim();if(!t||/\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t))return[];let n=t.match(/https?:\/\/[^\s<>"']+/i);if(n)return[{field_key:`url`,value:n[0].replace(/[.,;:)]+$/,``)}];let r=t.match(/\b(?:[\w-]+\.)+[a-z]{2,}\b/i);if(r){let e=r[0].replace(/[.,;:)]+$/,``);return/^https?:/i.test(e)||(e=`https://${e}`),[{field_key:`url`,value:e}]}return[]}function PO(e){if(!e||typeof e!=`string`)return[];let t=e.trim();if(!t)return[];let n=[],r=new Set,i=/\b([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\b/i,a=(e,t)=>{let i=String(t??``).trim().replace(/^["']|["']$/g,``);if(!i||i.length>800)return;let a=`${e}\0${i}`;r.has(a)||(r.add(a),n.push({field_key:e,value:i}))},o=t.match(/^\s*([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\s*$/i);if(o)return a(`Email Address`,o[1]),n;let s=t.match(/\b(?:please\s+)?(?:enter|type|put)\s+(.+?)\s+in(?:to)?\s+(?:the\s+)?(?:full\s*name|full\s*name\s*field|name\s*field)\b/i);if(s&&a(`Full Name`,s[1]),s=t.match(/\bfull\s*name,?\s*(?:please\s+)?(?:enter|type|put)\s+(.+?)(?:\.|$|!|\?)/i),s&&a(`Full Name`,s[1]),s=t.match(/\bfull\s*name\s*(?:is|:|please\s+enter|-)\s*(.+?)(?:\.|$|(?=\s+(?:and|my\s+email|email|message))\b)/i),s&&a(`Full Name`,s[1]),s=t.match(/\b(.+?)\s+for\s+(?:the\s+)?full\s*name\b/i),s){let e=s[1].trim();e.length>1&&e.length<120&&!/@/.test(e)&&a(`Full Name`,e)}if(s=t.match(/\b(?:email|e-mail)(?:\s*address)?\s*(?:is|:|please\s+use|enter|-)\s*([^\s@]+@[^\s@]+\.[^\s,]+)/i),s&&a(`Email Address`,s[1]),s=t.match(/\b(?:enter|type|put)\s+([^\s@]+@[^\s@]+\.[^\s,]+)\s+in(?:to)?\s+(?:the\s+)?(?:email|e-mail)/i),s&&a(`Email Address`,s[1]),s=t.match(/\b(?:message|comment)\s*(?:is|:|please\s+enter|-)\s*(.+)$/is),s){let e=s[1].trim();e.length>0&&a(`Message`,e)}if(!n.some(e=>/email/i.test(String(e.field_key)))){let e=t.match(i);if(e){let r=t.replace(e[0],``).trim().replace(/^(please|it's|it is|use|is|my email is|e-?mail is)\s*/i,``).replace(/[.,;:!?]+$/,``).trim();if(t.length<=96&&r.length<=36)return a(`Email Address`,e[1]),n}}if(n.length===0){let e=t.split(/\s+/).filter(Boolean).length,n=/[.!?]/.test(t)||e>=6||t.length>=24&&e>=5||t.length>=42,r=/^[A-Z][a-z]+\s+[A-Z][a-z]+$/.test(t.trim());n&&t.length>=16&&!i.test(t)&&!r&&a(`Message`,t)}return n}function FO(e){if(!e||typeof e!=`object`)return null;let t=e.url??e.target_url??e.page_url??e.pageUrl??e.link??e.href??e.path;return t==null?null:String(t).trim()||null}function IO(e){if(!e||typeof e!=`object`)return null;let t=e.query??e.q??e.search??e.text??e.keywords;return t==null?null:String(t).trim()||null}function LO(e,t,n){if(!n?.skipScroll)try{e.scrollIntoView({block:`center`,inline:`nearest`})}catch{try{e.scrollIntoView(!0)}catch{}}try{e.focus({preventScroll:!0})}catch{try{e.focus()}catch{}}let r=e.tagName,i=(e.type||``).toLowerCase();if(r===`SELECT`)return e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0;if(i===`checkbox`||i===`radio`)return e.checked=[`1`,`true`,`yes`,`on`].includes(String(t).toLowerCase().trim()),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0;let a=String(t);if(r===`INPUT`||r===`TEXTAREA`){let t=e.ownerDocument?.defaultView||window,n=r===`TEXTAREA`?t.HTMLTextAreaElement.prototype:t.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(n,`value`);i?.set?i.set.call(e,a):e.value=a}else e.value=a;let o={bubbles:!0,cancelable:!0,composed:!0};try{e.dispatchEvent(new InputEvent(`input`,{...o,inputType:`insertText`,data:a}))}catch{e.dispatchEvent(new Event(`input`,o))}e.dispatchEvent(new Event(`change`,o));try{queueMicrotask(()=>{try{e.dispatchEvent(new Event(`input`,o)),e.dispatchEvent(new Event(`change`,o))}catch{}})}catch{}return!0}function RO(){let e={};document.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach(t=>{if(t.id)return;let n=t.textContent.trim();if(!n)return;let r=n.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).substring(0,60);if(e[r]){let t=2;for(;e[r+`-`+t];)t++;r=r+`-`+t}e[r]=!0,t.id=r})}function zO(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``),r=typeof e.getLastUserVoiceText==`function`?e.getLastUserVoiceText:null,i=[],a={flowengage_navigate:async n=>{$(`flowengage_navigate ▶ raw parameters:`,n);let r=jO(n),i=FO(r),a=r.section_text??r.sectionText??r.section;if($(`flowengage_navigate · coerced:`,{url:i,sectionText:a}),!i){let e=`Missing url: pass a string url, path like /pricing, or JSON with a url field.`;return $(`flowengage_navigate ✖`,e),e}if(typeof window<`u`)try{let e=new URL(i,window.location.href);e.origin!==window.location.origin&&/^https?:$/i.test(e.protocol)&&(i=e.pathname+e.search+e.hash,$(`flowengage_navigate · normalized cross-origin URL to path:`,i))}catch{}if(typeof window<`u`)try{let e=new URL(i,window.location.href),t=window.location;if(e.pathname===t.pathname&&e.search===t.search&&(e.hash===t.hash||!e.hash))return $(`flowengage_navigate · already on target page, skipping navigation`),`Already on that page. Continue the conversation naturally without calling flowengage_navigate again.`}catch{}if(!await Hn(i,{siteId:t,apiBaseUrl:e.apiBaseUrl})){let e=`Page "${i}" could not be verified. Call flowengage_search with keywords from the topic to find the correct URL, then navigate to the URL from the search results.`;return $(`flowengage_navigate ✖ blocked`,e),e}try{BD(`Navigating to ${i}...`,{spinner:!0}),GD();let t=typeof e.getSessionCaptureData==`function`?e.getSessionCaptureData():null,n=i;if(t){let{ok:e,sessionKey:r,compact:o}=DD.capture({siteId:t.siteId,chatId:t.chatId,agentId:t.agentId,trigger:`agent_navigate`,navigationConfidence:`high`,targetUrl:i,interruption:{state:`tool_calling`,toolName:`flowengage_navigate`,toolParams:{url:i,section_text:a||null},lastAgentText:t.lastAgentText,lastUserText:t.lastUserText,estimatedSpokenWords:t.estimatedSpokenWords,agentTextWordCount:t.agentTextWordCount,isMuted:t.isMuted||!1},history:t.history});e&&r?n=TD(i,r):o&&(n=TD(i,o)),$(`flowengage_navigate · session captured, resumeUrl:`,n)}return jD(),await aO(300),$(`flowengage_navigate → location.assign`,n),window.location.assign(n),`Navigating...`}catch(e){let t=`Navigation error: ${e?.message||String(e)}`;return $(`flowengage_navigate ✖`,t),BD(`Navigation failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{KD(),VD(900)}},flowengage_highlight:async e=>{$(`flowengage_highlight ▶`,e);let t=jO(e),n=t?.section_id||t?.sectionId,r=t?.section_text||t?.sectionText;RO();let i=Rn(n||null,r||null);return!i&&r&&(await new Promise(e=>setTimeout(e,500)),RO(),i=Rn(null,r)),i?(PD(i),$(`flowengage_highlight ✓`,r||n),`OK_HIGHLIGHT: "${r||n}"`):($(`flowengage_highlight ✖ no element for:`,r||n),`Could not find "${r||n}" on the current page. Try a shorter phrase matching a visible heading.`)},flowengage_read_content:async e=>{$(`flowengage_read_content ▶`,e);let t=jO(e),n=t?.section_text||t?.sectionText||``;try{let e=``;if(n){let t=Rn(null,n);if(!t)return`Could not find section "${n}" on the page.`;let r=[t.textContent.trim()],i=t.nextElementSibling;for(;i&&!/^H[1-3]$/i.test(i.tagName);){let e=i.textContent.trim();e&&r.push(e),i=i.nextElementSibling}e=r.join(`
|
|
615
|
+
`)}else{let t=(document.querySelector(`main`)||document.querySelector(`article`)||document.querySelector(`[role="main"]`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);t.querySelectorAll(`nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar`).forEach(e=>e.remove()),e=t.textContent.replace(/\s+/g,` `).trim()}return e.length>8e3&&(e=e.substring(0,8e3)+`... (truncated)`),$(`flowengage_read_content ✓`,`${e.length} chars`),e||`No readable content found on this page.`}catch(e){return $(`flowengage_read_content ✖`,e.message),`Could not read page content: ${e.message}`}},flowengage_search:async e=>{$(`flowengage_search ▶`,e);let r=IO(jO(e));if($(`flowengage_search · query:`,r,`siteId:`,t,`apiBase:`,n||`(empty)`),!r)return $(`flowengage_search ✖ missing query`),`Missing query parameter.`;if(!t)return $(`flowengage_search ✖ no siteId`),`Site is not configured for search.`;if(!n)return $(`flowengage_search ✖ no api base`),`API base URL is missing; cannot search.`;try{let e=`${n}/api/site-tools/search`;$(`flowengage_search → POST`,e);let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})}),a=await i.json();if($(`flowengage_search · HTTP`,i.status,`success:`,a.success),!a.success){let e=a.error||`Search failed.`;return $(`flowengage_search ✖`,e),e}let o=a.results||[];return $(`flowengage_search ✓`,`${o.length} result(s)`,o.slice(0,3).map(e=>e?.url||e)),JSON.stringify(o)}catch(e){let t=`Search error: ${e.message||`network`}`;return $(`flowengage_search ✖`,t),t}},flowengage_page_content:async e=>{$(`flowengage_page_content ▶`,e);let r=jO(e),i=r?.url||r?.page_url||``;if($(`flowengage_page_content · url:`,i,`siteId:`,t,`apiBase:`,n||`(empty)`),!i)return $(`flowengage_page_content ✖ missing url`),`Missing url parameter.`;if(!t)return $(`flowengage_page_content ✖ no siteId`),`Site is not configured.`;if(!n)return $(`flowengage_page_content ✖ no api base`),`API base URL is missing; cannot fetch page content.`;try{let e=`${n}/api/site-tools/page-content`;$(`flowengage_page_content → POST`,e);let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,url:i})}),a=await r.json();if($(`flowengage_page_content · HTTP`,r.status,`success:`,a.success),!a.success){let e=a.error||`Failed to get page content.`;return $(`flowengage_page_content ✖`,e),e}return $(`flowengage_page_content ✓`,`title: ${a.title}`,`sections: ${(a.sections||[]).length}`,`content: ${(a.content||``).length} chars`),JSON.stringify({title:a.title,url:a.url,sections:a.sections,content:a.content})}catch(e){let t=`Page content error: ${e.message||`network`}`;return $(`flowengage_page_content ✖`,t),t}},flowengage_end_session:async()=>($(`flowengage_end_session ▶`),typeof e.requestEndSession==`function`&&e.requestEndSession(),`Voice session is ending.`),flowengage_list_forms:async()=>{let e=pO(),t=mO();return $(`flowengage_list_forms ✓`,`${e.length} field(s)`,`${t.length} button(s)`),JSON.stringify({fields:e,buttons:t,hint:`field_key: placeholder/label, name (e.g. url), id (e.g. url-input). If the page has two URL boxes, flowengage_fill_form sets all matching URL inputs. flowengage_click_button picks the Conduct Audit nearest the filled field when labels duplicate.`})},flowengage_fill_form:async e=>{try{$(`flowengage_fill_form ▶ raw:`,e),qD();let t=MO(e);if(!t.length&&r){let e=r(),n=NO(e);n.length?$(`flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):`,n):(n=PO(e),n.length&&$(`flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):`,n)),n.length&&(t=n)}if($(`flowengage_fill_form · normalized fields:`,t),!t.length)return`No fields provided. Call flowengage_list_forms for field_key strings, then flowengage_fill_form with { "fields": [ { "field_key": "<label or placeholder from list>", "value": "<user value>" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.`;let n=[];for(let e of t){let t=e?.field_key??e?.fieldKey,r=e?.value;if(t==null||r==null)continue;BD(`Filling ${String(t)}...`,{spinner:!0});let a=fO(),o=TO(a,String(t),r);if(o.length){for(let[e,t]of o.entries())JD(t),await eO(t),LO(t,r,{skipScroll:e>0}),YD(t),await aO(120);i=o,n.push(String(t));continue}let s=OO(a,String(t));s||=yO(a,String(t)),s||=bO(a,String(t),r),s&&(JD(s),await eO(s),LO(s,r),YD(s),await aO(120),i=[s],n.push(String(t)))}if(!n.length)return $(`flowengage_fill_form ✖ no matches`),`Could not match any fields. Call flowengage_list_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.`;let a=`OK_FILLED: ${n.join(`, `)}`;return $(`flowengage_fill_form ✓`,a),BD(`Form filled`,{spinner:!1,icon:`✅`,duration:1100}),a}catch(e){let t=`flowengage_fill_form error: ${e?.message||String(e)}`;return $(`flowengage_fill_form ✖`,t),BD(`Failed to fill form`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{tO(),qD(),VD(700)}},flowengage_click_button:async e=>{let t=jO(e),n=(t.button_text??t.buttonText??t.text??``).trim();if($(`flowengage_click_button ▶`,n),!n)return`Missing button_text: pass the visible label, e.g. Conduct Audit.`;let r=AO(n,i);if(!r)return $(`flowengage_click_button ✖ no match`),`Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;try{BD(`Clicking ${n}...`,{spinner:!0});try{r.scrollIntoView({block:`center`,inline:`nearest`})}catch{r.scrollIntoView(!0)}await eO(r),r.focus?.(),await nO(r),rO(r),r.click();let e=(r.textContent||r.value||r.getAttribute(`aria-label`)||``).trim().slice(0,80)||`button`,t=`OK_CLICK ${e}`;return $(`flowengage_click_button ✓`,t),BD(`Clicked ${e}`,{spinner:!1,icon:`✅`,duration:1200}),t}catch(e){let t=`Click failed: ${e?.message||String(e)}`;return $(`flowengage_click_button ✖`,t),BD(`Click failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{tO(),VD(700)}}};return{...a,navigateToPage:a.flowengage_navigate,highlightOnPage:a.flowengage_highlight,searchSiteContent:a.flowengage_search,getPageContent:a.flowengage_page_content,endVoiceSession:a.flowengage_end_session,listPageForms:a.flowengage_list_forms,fillFormFields:a.flowengage_fill_form,clickPageButton:a.flowengage_click_button}}function BO(e){return!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,async n=>{let r=pn();r?console.log(`[FlowEngage:voice-tool] ▶`,e,n):console.info(`[FlowEngage] voice tool » ${e}`);let i;try{i=await t(n)}catch(t){let n=`Tool error: ${t?.message||String(t)}`;return console.error(`[FlowEngage] voice tool ${e} threw:`,t),n}let a=typeof i==`string`?i.length>220?`${i.slice(0,220)}…`:i:String(i);return r?console.log(`[FlowEngage:voice-tool] ◀`,e,a):console.info(`[FlowEngage] voice tool « ${e}:`,a),i}]))}var VO={blue:`#135bd8`,red:`#ef334b`,yellow:`#ffbd2e`,dark:`#0d1b2a`,highlight:`rgba(255,255,255,0.9)`,green:`#10b981`};function HO(e){if(!Array.isArray(e)||e.length<2)return`linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa`;let[t,n,r]=e;return e.length>=3&&r?[`radial-gradient(ellipse 80% 70% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 70% 80% at 110% 30%, ${n}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 60% at 50% 110%, ${r}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `):[`radial-gradient(ellipse 80% 100% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 100% at 110% 50%, ${n}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `)}function UO(e){if(!e||typeof e!=`string`)return`#1a1a1a`;let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255,o=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;return .2126*o(r)+.7152*o(i)+.0722*o(a)>.179?`#1a1a1a`:`#ffffff`}function WO({logo:e,style:t}){if(!e)return null;if(typeof e==`string`)return(0,M.jsx)(`img`,{src:e,alt:``,style:{objectFit:`contain`,flexShrink:0,display:`block`,...t}});let n=typeof e==`function`?b.createElement(e):b.isValidElement(e)?e:null;return n?(0,M.jsx)(`span`,{className:`fe-logo-slot`,style:{display:`inline-flex`,alignItems:`center`,flexShrink:0,overflow:`hidden`,...t},children:n}):null}function GO({title:e}){return(0,M.jsx)(`div`,{style:{width:`100%`,height:`100%`,borderRadius:`16px`,background:`linear-gradient(135deg, rgba(59,130,246,0.16) 0%, rgba(59,130,246,0.08) 100%)`,color:`#2563eb`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`18px`,fontWeight:700,letterSpacing:`-0.03em`},children:String(e||`FE`).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()||``).join(``)||`FE`})}function KO(e,t){let n=(t||``).trim();return n?!!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\b(hang\s+up|disconnect)\b/i.test(n)||/\b(that'?s all|we'?re done)\b/i.test(n)||e===`bot`&&(/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n)||/\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n)||/\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n)||/\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n)||/\b(wrapping\s+up|signing\s+off)\b/i.test(n))||/^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)):!1}function qO({orbColors:e,...t}){return(0,M.jsx)(uD,{colors:e,...t})}function JO({copy:e,orbColors:t,primaryColor:n,onYes:r,onLater:i,isMobile:a}){let o=n||VO.green,s=UO(o),c=a?72:94,l=(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:a?`14px`:`18px`},children:[(0,M.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,M.jsx)(jp.p,{initial:{x:-16,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.36},style:{margin:`0 0 14px`,fontSize:`14px`,fontWeight:700,color:`white`,lineHeight:1.4,textShadow:`0 1px 4px rgba(0,0,0,0.35)`,maxWidth:a?void 0:`210px`},children:e.entryPrompt}),(0,M.jsxs)(jp.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.54},style:{display:`flex`,gap:`16px`,flexWrap:`nowrap`},children:[(0,M.jsx)(`button`,{onClick:r,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:o,color:s,fontWeight:400,fontSize:`14px`,border:`none`,cursor:`pointer`,whiteSpace:`nowrap`,boxShadow:`0 4px 16px ${o}66`,transition:`transform 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.04)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.yesLabel}),(0,M.jsx)(`button`,{onClick:i,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:`transparent`,color:`white`,fontWeight:400,fontSize:`14px`,border:`2px solid rgba(255,255,255,0.55)`,cursor:`pointer`,whiteSpace:`nowrap`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.9)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.55)`},children:e.laterLabel})]})]}),(0,M.jsx)(jp.div,{initial:{x:120,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:220,damping:22,delay:0},style:{flexShrink:0},children:(0,M.jsx)(qO,{size:c,orbColors:t})})]});return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(jp.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.4},style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.72)`,zIndex:-1}}),a?(0,M.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,padding:`24px 20px 40px`,overflow:`hidden`},children:l}):l]})}function YO({copy:e,orbColors:t,primaryColor:n,onVoice:r,onText:i,onClose:a,isMobile:o}){let s=n||VO.green,c=UO(s);return(0,M.jsxs)(jp.div,{initial:{scale:50/350,borderRadius:`50%`},animate:{scale:1,borderRadius:`16px`},transition:{type:`spring`,stiffness:260,damping:26},style:{transformOrigin:o?`bottom center`:`bottom right`,background:`white`,width:o?`100%`:`350px`,height:`245px`,padding:`24px 40px 32px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`space-between`,boxShadow:`0 20px 60px rgba(0,0,0,0.2)`,position:`relative`,overflow:`hidden`},children:[(0,M.jsx)(`button`,{onClick:a,style:{position:`absolute`,top:`14px`,right:`14px`,background:`none`,border:`none`,cursor:`pointer`,color:`#9ca3af`,padding:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#374151`},onMouseLeave:e=>{e.currentTarget.style.color=`#9ca3af`},children:(0,M.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,M.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),(0,M.jsx)(qO,{size:72,orbColors:t}),(0,M.jsx)(`p`,{style:{margin:0,fontSize:`16px`,fontWeight:400,color:`#111827`,textAlign:`center`,lineHeight:1.4},children:e.connectionTitle}),(0,M.jsxs)(`div`,{style:{display:`flex`,gap:`16px`,width:`100%`},children:[(0,M.jsx)(`button`,{onClick:r,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:s,color:c,fontWeight:400,fontSize:`16px`,border:`none`,cursor:`pointer`,transition:`transform 0.15s ease`,boxShadow:`0 4px 12px ${s}55`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.03)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.voiceLabel}),(0,M.jsx)(`button`,{onClick:i,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:`transparent`,color:`#111827`,fontWeight:400,fontSize:`16px`,border:`1.5px solid #d1d5db`,cursor:`pointer`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6b7280`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d1d5db`},children:e.textLabel})]})]})}function XO({orbColors:e,onEnterChat:t,onEndChat:n,agentId:r,siteId:i,apiBaseUrl:a,historyRef:o,onMessageSync:s,pendingResume:c,chatId:l}){let[u,d]=(0,b.useState)(`idle`),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(null),_=(0,b.useRef)(``),v=(0,b.useRef)(async()=>{}),y=(0,b.useRef)(!1),x=(0,b.useRef)(!1),ee=(0,b.useRef)(`idle`),S=(0,b.useRef)(!1),C=(0,b.useRef)(!1),te=(0,b.useRef)(`minimized`),w=(0,b.useRef)(0),ne=(0,b.useRef)(null),re=(0,b.useCallback)((e=`minimized`)=>{te.current=e,C.current=!0,queueMicrotask(()=>{y.current||(y.current=!0,v.current?.())})},[o]),ie=(0,b.useCallback)(async e=>{C.current=!0;try{await g.current?.endSession?.()}catch{}if(g.current=null,d(`idle`),p(!1),y.current=!1,typeof s==`function`){let e=w.current;await s(e>0?o.current.slice(e):o.current)}e?.()},[o,s]);return v.current=()=>ie(te.current===`chat`?t:n),(0,b.useEffect)(()=>{x.current=f},[f]),(0,b.useEffect)(()=>{ee.current=u},[u]),(0,b.useEffect)(()=>{let e=()=>!!g.current,t=()=>{let e=o.current||[];for(let t=e.length-1;t>=0;t--)if(e[t].sender===`bot`)return e[t].message||``;return``},n=e=>{let n=t(),a=n.split(/\s+/).filter(Boolean).length;return{siteId:i,chatId:l||null,agentId:r,trigger:e,navigationConfidence:e===`agent_navigate`?`high`:`medium`,interruption:{state:ee.current,lastAgentText:n,lastUserText:_.current,estimatedSpokenWords:AD(),agentTextWordCount:a,isMuted:x.current},history:o.current||[]}},a=()=>{e()&&(OD()||DD.capture(n(`user_link_click`)))},s=t=>{e()&&(t.persisted||OD()||DD.capture(n(`pagehide`)))};return window.addEventListener(`beforeunload`,a),window.addEventListener(`pagehide`,s),()=>{window.removeEventListener(`beforeunload`,a),window.removeEventListener(`pagehide`,s)}},[i,l,r,o]),(0,b.useEffect)(()=>{let e=!1,n=null;return(async()=>{if(!r){d(`error`);return}try{if((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),e)return;c?(o.current=Array.isArray(c.history)?[...c.history]:[],w.current=o.current.length,c.interruption?.lastUserText&&(_.current=c.interruption.lastUserText)):(o.current=[],w.current=0,_.current=``),y.current=!1,S.current=!1,C.current=!1,te.current=`minimized`;let t=BO(zO({siteId:i||null,apiBaseUrl:a||null,getLastUserVoiceText:()=>_.current,requestEndSession:()=>{re()},getSessionCaptureData:()=>{let e=(()=>{let e=o.current||[];for(let t=e.length-1;t>=0;t--)if(e[t].sender===`bot`)return e[t].message||``;return``})();return{siteId:i,chatId:l||null,agentId:r,history:o.current||[],lastAgentText:e,agentTextWordCount:e.split(/\s+/).filter(Boolean).length,lastUserText:_.current,estimatedSpokenWords:AD(),isMuted:x.current}}})),s=typeof window<`u`?window.location.href:``,u,f=null;if(c&&!c.consumed){let e=typeof document<`u`?Array.from(document.querySelectorAll(`h1,h2,h3,h4`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell`)).map(e=>({tag:e.tagName,text:e.textContent.trim().slice(0,100),id:e.id||null})).filter(e=>e.text.length>0).slice(0,25):[];f=DD.buildResumePrompt(c,e,s);let t=e[0]?.text||``;u={agent:{firstMessage:t?`I'm now on the ${t} page. Let me walk you through it.`:`I've navigated to the new page. Let me continue our conversation.`}}}let m=await EE.startSession({agentId:r,...u?{overrides:u}:{},clientTools:t,onUnhandledClientToolCall:e=>console.error(`[FlowEngage] Unhandled tool:`,e?.tool_name),onModeChange:({mode:t})=>{e||d(t===`speaking`?`speaking`:`listening`)},onMessage:t=>{if(e)return;let n=t.role===`user`?`user`:`bot`,r=t.message||t.text||t.content||``;if(!r)return;let i=o.current,a=i.length>0?i[i.length-1]:null;a&&a.sender===n&&a.message===r||(n===`user`&&(_.current=r),o.current=[...i,{sender:n,message:r,timestamp:new Date().toISOString()}],KO(n,r)&&re(`minimized`))},onError:t=>{if(!e&&!C.current&&!S.current){S.current=!0,console.error(`[FlowEngageVoiceCall] session:error`,{message:t?.message,name:t?.name,raw:t});try{g.current?.setMicMuted?.(!0)}catch{}p(!0),d(`error`),re(`minimized`)}},onDisconnect:()=>{if(!e&&!C.current&&!S.current){S.current=!0,console.warn(`[FlowEngageVoiceCall] session:disconnected`,{historyCount:o.current?.length||0,lastUserText:_.current||``,wasMuted:x.current});try{g.current?.setMicMuted?.(!0)}catch{}p(!0),re(`minimized`)}}});if(e){m.endSession().catch(()=>{});return}n=m,g.current=m,d(`listening`);try{if(f)m.sendContextualUpdate(f),DD.clear();else{let e=`[]`;try{e=await t.flowengage_list_forms()}catch{}let n=typeof document<`u`?Array.from(document.querySelectorAll(`h1, h2, h3, h4`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell, nav, footer, header`)).map(e=>({tag:e.tagName,text:e.textContent.trim(),id:e.id||null})).filter(e=>e.text.length>0&&e.text.length<200).slice(0,25):[];m.sendContextualUpdate(`Page: ${s}. SiteId: ${i||`unknown`}. Sections on this page: ${JSON.stringify(n)}. IMPORTANT: Call flowengage_highlight with section_text from the list above as you explain each section. Forms: ${e}. Navigation: flowengage_navigate — use for cross-page navigation. End call: flowengage_end_session.`)}}catch{}}catch(n){e||(console.error(`[FlowEngage] startSession failed`,n),d(`error`),te.current=`chat`,window.setTimeout(()=>{e||t?.()},0))}})(),()=>{e=!0,C.current=!0,(n||g.current)?.endSession?.().catch(()=>{})}},[r,i,a,re]),(0,b.useEffect)(()=>{if(!m)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;ne.current&&!ne.current.contains(t)&&h(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]),(0,M.jsxs)(`div`,{ref:ne,style:{position:`relative`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`14px`,animation:`fe-orb-slide-up 0.42s cubic-bezier(0.16,1,0.3,1)`},children:[(0,M.jsxs)(`div`,{style:{position:`relative`},children:[u===`listening`&&(0,M.jsx)(`span`,{style:{position:`absolute`,right:`100%`,marginRight:`18px`,top:`50%`,transform:`translateY(-50%)`,color:`white`,fontSize:`18px`,fontWeight:600,letterSpacing:`0.01em`,textShadow:`0 2px 4px rgba(0,0,0,0.4)`,whiteSpace:`nowrap`},children:`Listening...`}),(0,M.jsx)(qO,{size:72,voiceState:u,isMuted:f,orbColors:e})]}),u===`error`&&(0,M.jsx)(`span`,{style:{color:`#f87171`,fontSize:`13px`,fontWeight:500},children:`Could not start voice session.`}),(0,M.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,M.jsx)(`button`,{onClick:async()=>{if(g.current)try{f?(await g.current.setMicMuted?.(!1),p(!1)):(await g.current.setMicMuted?.(!0),p(!0))}catch{}},title:f?`Unmute`:`Mute`,style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:f?`#7f1d1d`:`#1f2937`,border:f?`1.5px solid #ef4444`:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:f?`#f87171`:`white`,transition:`all 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:f?(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`line`,{x1:`1`,y1:`1`,x2:`23`,y2:`23`}),(0,M.jsx)(`path`,{d:`M9 9v3a3 3 0 005.12 2.12M15 9.34V4a3 3 0 00-5.94-.6`}),(0,M.jsx)(`path`,{d:`M17 16.95A7 7 0 015 12v-2m14 0v2a7 7 0 01-.11 1.23`}),(0,M.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),(0,M.jsx)(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]}):(0,M.jsx)(DE,{size:16,color:`currentColor`})}),(0,M.jsx)(`button`,{onClick:()=>h(e=>!e),style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:`#1f2937`,border:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`,transition:`background 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:(0,M.jsx)(FE,{size:16,color:`currentColor`})})]}),m&&(0,M.jsxs)(`div`,{style:{position:`absolute`,bottom:0,right:0,width:`230px`,zIndex:9999,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,animation:`fe-orb-fade-in 0.18s ease`,padding:`12px 12px 40px`},children:[(0,M.jsxs)(`button`,{onClick:()=>{h(!1),te.current=`chat`,ie(t)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsx)(IE,{}),`Enter Chat Mode`]}),(0,M.jsxs)(`button`,{onClick:()=>{h(!1),te.current=`minimized`,ie(n)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`#E30C12`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(227,12,18,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsx)(LE,{}),`End Conversation`]}),(0,M.jsx)(`button`,{onClick:()=>h(!1),style:{position:`absolute`,bottom:`8px`,right:`8px`,width:`24px`,height:`24px`,borderRadius:`50%`,background:`rgba(255,255,255,0.15)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.25)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.15)`},children:(0,M.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,M.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]})}function ZO({orbColors:e}){return(0,M.jsx)(`div`,{style:{flexShrink:0,width:`36px`,height:`36px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,M.jsx)(qO,{size:36,orbColors:e})})}var QO=()=>(0,M.jsx)(`div`,{style:{display:`flex`,marginBottom:`12px`,justifyContent:`flex-start`},children:(0,M.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,padding:`12px 16px`,borderRadius:`18px`,background:`#fff`,boxShadow:`0 2px 6px rgba(0,0,0,0.04)`},children:[0,1,2].map(e=>(0,M.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e))})});function $O({copy:e,orbColors:t,primaryColor:n,chatBgGradient:r,logo:i,quickChatOptions:a,onQuickChatSelect:o,isMobile:s,chatHistory:c,isAiTyping:l,isAgentTyping:u,activeScreen:d,agentName:f,agentHeadshot:p,fallbackAgentName:m,input:h,setInput:g,onSubmit:_,isConversationEnded:v,isLoading:y,isRateLimited:x,rateLimitMessage:ee,selectedFile:S,onFileSelect:C,onRemoveSelectedFile:te,attachmentError:w,isUploadingAttachment:ne,requiresEmail:re,emailInput:ie,setEmailInput:ae,emailError:oe,replyContext:se,setReplyContext:ce,webRTCError:le,micError:ue,setMicError:T,dismissCallError:E,incomingCall:de,rejectCall:fe,acceptCall:pe,activeCallId:me,callConnectionState:he,isCallMuted:ge,toggleCallMute:_e,endWebRTCCall:ve,formatCallDuration:ye,callDurationSeconds:be,onCollapse:xe,onStartVoice:Se,showPoweredBy:Ce}){let we=c.length>0,Te=y||x||v,Ee=!!(de||me),[De,Oe]=(0,b.useState)(!1),ke=(0,b.useRef)(null);return(0,b.useEffect)(()=>{if(!De)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;ke.current&&!ke.current.contains(t)&&Oe(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[De]),(0,M.jsxs)(`div`,{style:s?{"--flowengage-primary":n,"--flowengage-accent":n,position:`fixed`,left:`8px`,right:`8px`,bottom:0,width:`calc(100% - 16px)`,height:`90dvh`,background:r,borderRadius:`16px 16px 0 0`,display:`flex`,flexDirection:`column`,overflow:`hidden`,animation:`fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)`}:{"--flowengage-primary":n,"--flowengage-accent":n,width:`min(350px, calc(100vw - 40px))`,height:`min(640px, calc(100vh - 120px))`,background:r,borderRadius:`22px`,boxShadow:`0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,position:`relative`,animation:`fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)`},children:[(0,M.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`40px minmax(0, 1fr) 40px`,alignItems:`center`,columnGap:`14px`,padding:`16px 10px 14px`,background:`transparent`,flexShrink:0},children:[(0,M.jsx)(`button`,{onClick:xe,style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},children:(0,M.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,M.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),(0,M.jsxs)(`div`,{style:{minWidth:0,maxWidth:s?`100%`:`250px`,width:`100%`,justifySelf:`center`,display:`grid`,gridTemplateColumns:`minmax(72px, 40%) minmax(0, 60%)`,alignItems:`center`},children:[(0,M.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`,justifyContent:`center`,height:`40px`},children:i?(0,M.jsx)(WO,{logo:i,style:{height:`34px`,width:`100%`,maxWidth:`96px`}}):(0,M.jsx)(`div`,{style:{width:`40px`,height:`40px`,flexShrink:0},children:(0,M.jsx)(GO,{title:e.chatTitle})})}),(0,M.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`},children:(0,M.jsx)(`span`,{style:{fontSize:`15px`,fontWeight:600,color:`#111827`,letterSpacing:`-0.01em`,lineHeight:1.2,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.chatTitle,children:e.chatTitle})})]}),(0,M.jsxs)(`div`,{style:{position:`relative`,isolation:`isolate`,zIndex:10},ref:ke,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>Oe(e=>!e),style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},"aria-label":`Chat options`,children:(0,M.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`}),(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,M.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`})]})}),De&&(0,M.jsxs)(`div`,{style:{position:`absolute`,top:`34px`,right:0,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,overflow:`hidden`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,minWidth:`210px`,border:`1px solid rgba(255,255,255,0.07)`,animation:`fe-orb-fade-in 0.18s ease`},children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{Oe(!1),Se?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`}),(0,M.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`})]}),`Enter Voice Mode`]}),(0,M.jsx)(`div`,{style:{height:`1px`,background:`rgba(255,255,255,0.07)`,margin:`0 14px`}}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{Oe(!1),xe?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`#f87171`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(248,113,113,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,M.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,M.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,M.jsx)(`line`,{x1:`23`,y1:`1`,x2:`1`,y2:`23`})]}),`Close Conversation`]})]})]})]}),(0,M.jsx)(tD,{webRTCError:le,micError:ue,setMicError:T,dismissCallError:E,incomingCall:de,rejectCall:fe,acceptCall:pe,activeCallId:me,callConnectionState:he,formatCallDuration:ye,callDurationSeconds:be,endWebRTCCall:ve,isCallMuted:ge,toggleCallMute:_e,isAIVoiceActive:!1,currentCallAgentName:f||m,isRateLimited:x,rateLimitMessage:ee}),(0,M.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,background:`transparent`},children:we?(0,M.jsx)(ZE,{chatHistory:c,isAiTyping:l,isAgentTyping:u,setReplyContext:ce,TypingDots:QO,primaryColor:n,agentHeadshot:p,agentDisplayName:f||m,botAvatarNode:(0,M.jsx)(ZO,{orbColors:t})}):(0,M.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`22px`,padding:`28px 24px`},children:[(0,M.jsx)(qO,{size:94,orbColors:t}),(0,M.jsx)(`p`,{style:{margin:0,textAlign:`center`,fontSize:`16px`,color:`#374151`,lineHeight:1.55,maxWidth:`270px`},children:e.introGreeting}),a.length>0&&(0,M.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`8px`,justifyContent:`center`,width:`100%`,padding:`0 8px`},children:a.map(e=>(0,M.jsx)(`button`,{onClick:()=>o?.(e),style:{padding:`8px 16px`,borderRadius:`999px`,background:`white`,border:`1.5px solid ${n}33`,color:n||`#374151`,fontSize:`13px`,fontWeight:500,cursor:`pointer`,transition:`all 0.15s ease`,boxShadow:`0 1px 4px rgba(0,0,0,0.06)`},onMouseEnter:e=>{e.currentTarget.style.background=`${n}12`,e.currentTarget.style.borderColor=n},onMouseLeave:e=>{e.currentTarget.style.background=`white`,e.currentTarget.style.borderColor=`${n}33`},children:e.label||e.text},e.id))})]})}),(0,M.jsx)(`div`,{style:{background:`transparent`,flexShrink:0,position:`relative`,zIndex:1,padding:re?`6px 0 0`:`12px 0 0`},children:(0,M.jsx)(QE,{input:h,setInput:g,onSubmit:_,isConversationEnded:v,callUiActive:Ee,handleToggleVoice:Se,showVoiceToggle:d===`agent`,activeScreen:d,inputDisabled:Te,replyContext:se,clearReplyContext:()=>ce(null),onFileSelect:C,selectedFile:S,onRemoveSelectedFile:te,attachmentError:w,isUploadingAttachment:ne,requiresEmail:re,emailInput:ie,setEmailInput:ae,emailError:oe,inputPlaceholder:e.inputPlaceholder})}),(0,M.jsx)(`div`,{style:{flexShrink:0,textAlign:`center`,padding:`12px 20px 18px`,pointerEvents:`none`},children:Ce&&(0,M.jsxs)(`span`,{style:{fontSize:`11px`,color:`#9ca3af`,letterSpacing:`0.01em`,userSelect:`none`},children:[`Powered by `,(0,M.jsx)(`strong`,{style:{fontWeight:600,color:`#6b7280`},children:`FlowEngage`})]})})]})}function ek(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatHistory:r,isOpen:i,activeScreen:a,isHumanHandled:o,agentName:s,agentHeadshot:c,visitorEmail:l,isAgentTyping:u,isAiTyping:d,isLoading:f,isRateLimited:p,rateLimitMessage:m,isConversationEnded:h,incomingCall:g,activeCallId:_,callConnectionState:v,callConnectedAt:y,isCallMuted:x,webRTCError:ee,language:S,historyRef:C,onMessageSync:te,sendMessage:w,uploadChatFile:ne,openWidget:re,captureVisitorEmail:ie,setVoiceMode:ae,endConversation:oe,acceptCall:se,rejectCall:ce,endWebRTCCall:le,toggleCallMute:ue,dismissCallError:de,startTyping:pe,stopTyping:me,updateTypingDraft:he}=fn();(0,b.useEffect)(()=>{try{In()}catch{}},[]);let ge=t?.widgetSettings||{},_e=n?.widgetSettings||{},ve={...ge.branding||{},..._e.branding||{}},ye={...ge.theme||{},..._e.theme||{}},be={...ge.features||{},..._e.features||{}},xe=be.voice!==!1,Se=Array.isArray(ye.orbColors)&&ye.orbColors.length>0?ye.orbColors:null,Ce=Se?.[0]||ye.primaryColor||`#3B82F6`,we=ye.position||`bottom-right`,Te=ve.fallbackAgentName||`Agent`,Ee=HO(Se??ye.chatBgColors),De=ve.logo||ve.logoUrl||null,Oe=S||`en`,ke=ge.recommendations?.[Oe]||[],Ae=(_e.recommendations?.[Oe]??ke).filter(e=>String(e?.label??``).trim()).map((e,t)=>({id:e.key||`qr-${t}`,label:e.label,message:e.label,text:e.label})),je=Array.isArray(ve.quickChatOptions)&&ve.quickChatOptions.length>0?ve.quickChatOptions:Ae,Me=ve.hideWatermark===!0?!1:ve.showPoweredBy!==!1,D=ve.chatbotEnabled!==!1&&ye.chatbotEnabled!==!1,Ne=ge.greetings?.[S]||_e.greetings?.[S]||ve.introGreeting||`Hello, I'm here to help you know more about OpenSense Labs.`,Pe={entryPrompt:ve.entryPrompt||`Do you want to explore in a new way?`,yesLabel:ve.yesLabel||`Yes`,laterLabel:ve.laterLabel||`Later`,connectionTitle:ve.connectionTitle||`How would you like to connect?`,voiceLabel:ve.voiceLabel||`Voice`,textLabel:ve.textLabel||`Text`,chatTitle:ve.headerName||`Chat with FlowEngage`,introGreeting:Ne,inputPlaceholder:ve.inputPlaceholder||`Type your message`,analysingLabel:ve.analysingLabel||`analysing...`},Fe=_e.elevenLabsAgentId||t?.elevenLabsAgentId||null,Ie=t?.siteId||n?.siteId||null,Le=t?.apiBaseUrl||``,Re=(0,b.useMemo)(()=>s&&String(s).trim()||t?.ownerName&&String(t.ownerName).trim()||t?.websiteName&&String(t.websiteName).trim()||`Agent`,[s,t?.ownerName,t?.websiteName]),ze=c&&String(c).trim()||t?.ownerProfileImageUrl&&String(t.ownerProfileImageUrl).trim()||null,Be=r.some(e=>e.sender===`user`),Ve=(0,b.useMemo)(()=>{let e=r.findIndex(e=>e.sender===`user`);return e===-1?!1:r.slice(e+1).some(e=>e.sender===`bot`||e.sender===`ai`||e.sender===`agent`)},[r]),He=!l&&Be&&Ve,Ue=!!(_e._dashboardLivePreview||ge._dashboardLivePreview),[We,O]=(0,b.useState)(()=>Ue?`text_chat`:`entry_prompt`),[k,Ge]=(0,b.useState)(``),[A,Ke]=(0,b.useState)(null),[qe,Je]=(0,b.useState)(l||``),[Ye,Xe]=(0,b.useState)(``),[Ze,Qe]=(0,b.useState)(0),[$e,et]=(0,b.useState)(null),[tt,nt]=(0,b.useState)(null),[rt,it]=(0,b.useState)(``),[at,ot]=(0,b.useState)(!1),st=(0,b.useRef)(null),ct=(0,b.useRef)(!1),lt=(0,b.useRef)(null),ut=(0,b.useMemo)(()=>fe(Ie),[Ie]);(0,b.useLayoutEffect)(()=>{if(!(e!==`ready`||ct.current)){ct.current=!0;try{let e=DD.read(Ie);if(e&&e._resumeMode===`auto`){lt.current=e,re({notifyChatInitiated:!0}),ae?.(!0),O(`voice_mode`);return}}catch{}if(T(Ie)||!xe){O(`minimized_orb`);return}}},[e,r]);let[dt,ft]=(0,b.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 640px)`).matches);(0,b.useEffect)(()=>{let e=window.matchMedia(`(max-width: 640px)`),t=e=>ft(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,b.useEffect)(()=>{Je(l||``),l&&Xe(``)},[l]);let pt=(0,b.useCallback)(()=>{nt(null),it(``)},[]),mt=(0,b.useCallback)(e=>{let t=KE(e);if(t){nt(null),it(t);return}nt(e),it(``)},[]);(0,b.useEffect)(()=>{if(!y||v!==`connected`){Qe(0);return}let e=()=>{let e=new Date(y).getTime();isNaN(e)||Qe(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[y,v]),(0,b.useEffect)(()=>{let e=g?.callId||_||null;if(!e){st.current=null;return}(g?.callId||v===`connecting`||v===`connected`)&&(!(!i||We===`minimized_orb`||We===`voice_mode`)&&st.current===e||(console.log(`[FlowEngageWidget] forcing call UI to front`,{forcedKey:e,isOpen:i,surface:We,hasIncomingCall:!!g?.callId,activeCallId:_,callConnectionState:v}),st.current=e,We===`voice_mode`&&ae?.(!1),re?.(),O(`text_chat`)))},[_,v,g?.callId,i,re,ae,We]),(0,b.useEffect)(()=>{if(!o||h){he?.(``),me?.();return}if(!k.trim()||tt){he?.(``),me?.();return}pe?.();let e=window.setTimeout(()=>he?.(k),120),t=window.setTimeout(()=>me?.(),1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[k,tt,o,h,pe,me,he]);let ht=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,gt=async e=>{if(e.preventDefault(),h)return;if(He){let e=qe.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){Xe(`Please enter a valid email so we can continue helping you.`);return}await ie(e),Xe(``);return}let t=ht(A);if(!k.trim()&&!tt)return;if(tt){try{ot(!0),it(``);let e=await ne(tt),n=e?.data||e,r=k.trim()||`Shared file: ${JE(tt)}`;Ge(``),Ke(null),pt(),await w(r,``,t,{type:`file`,metadata:{fileUrl:n?.fileUrl,fileName:n?.fileName||tt.name,fileType:n?.fileType||tt.type,fileSize:n?.fileSize||tt.size}})}catch(e){it(e?.message||`Failed to upload the selected file.`)}finally{ot(!1)}return}let n=k.trim();Ge(``),Ke(null),await w(n,``,t)},_t=e=>{let t=Math.floor(e/60);return`${String(t).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}`},vt=(0,b.useCallback)(async e=>{if(h||f)return;let t=e.message||e.label||e.text||``;t.trim()&&await w(t.trim(),``)},[h,f,w]),yt=dt&&We===`entry_prompt`?{inset:0}:dt&&We===`text_chat`?{left:0,right:0,bottom:0}:dt&&We===`connection_modal`?{left:`28px`,right:`12px`,bottom:`12px`}:we===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},bt=()=>O(`minimized_orb`),xt=()=>O(`connection_modal`),St=()=>{re({notifyChatInitiated:!0}),ae?.(!0),O(`voice_mode`)},Ct=()=>{re({notifyChatInitiated:!0}),ae?.(!1),O(`text_chat`)},wt=()=>{ae?.(!1),bt()};return e!==`ready`||!D||be.chat===!1?null:(0,M.jsxs)(`div`,{className:`flowengage-widget-root`,style:{position:`fixed`,zIndex:999999,...yt},children:[We===`entry_prompt`&&(0,M.jsx)(JO,{copy:Pe,orbColors:Se,primaryColor:Ce,onYes:()=>{E(Ie),St()},onLater:()=>{E(Ie),bt()},isMobile:dt}),We===`minimized_orb`&&(0,M.jsx)(jp.div,{layoutId:`fe-main-orb`,initial:{scale:94/50},animate:{scale:1},transition:{type:`spring`,stiffness:220,damping:26},style:{transformOrigin:`bottom right`,display:`inline-block`},children:(0,M.jsx)(qO,{size:50,orbColors:Se,onClick:xe?xt:Ct})}),We===`connection_modal`&&(0,M.jsx)(YO,{copy:Pe,orbColors:Se,primaryColor:Ce,onVoice:St,onText:Ct,onClose:bt,isMobile:dt}),We===`voice_mode`&&(0,M.jsx)(XO,{orbColors:Se,onEnterChat:Ct,onEndChat:wt,agentId:Fe,siteId:Ie,apiBaseUrl:Le,historyRef:C,onMessageSync:te,pendingResume:lt.current,chatId:ut},`voice`),We===`text_chat`&&(0,M.jsx)($O,{copy:Pe,orbColors:Se,primaryColor:Ce,chatBgGradient:Ee,logo:De,quickChatOptions:je,onQuickChatSelect:vt,isMobile:dt,chatHistory:r,isAiTyping:d,isAgentTyping:u,activeScreen:a,agentName:Re,agentHeadshot:ze,fallbackAgentName:Te,input:k,setInput:Ge,onSubmit:gt,isConversationEnded:h,isLoading:f,isRateLimited:p,rateLimitMessage:m,selectedFile:tt,onFileSelect:mt,onRemoveSelectedFile:pt,attachmentError:rt,isUploadingAttachment:at,requiresEmail:He,emailInput:qe,setEmailInput:Je,emailError:Ye,replyContext:A,setReplyContext:Ke,webRTCError:ee,micError:$e,setMicError:et,dismissCallError:de,incomingCall:g,rejectCall:ce,acceptCall:se,activeCallId:_,callConnectionState:v,isCallMuted:x,toggleCallMute:ue,endWebRTCCall:le,formatCallDuration:_t,callDurationSeconds:Ze,onCollapse:bt,onStartVoice:St,onEndConversation:oe,showPoweredBy:Me}),(0,M.jsx)(`style`,{children:`
|
|
616
616
|
/* Force any SVG (or img) inside LogoSlot to fill the container height
|
|
617
617
|
regardless of whether the component forwards its style prop. */
|
|
618
618
|
.fe-logo-slot svg,
|