const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StoriesPage-D2A96ReY.js","assets/query-vendor-CZu0EHPe.js","assets/react-vendor-0bvDbF03.js","assets/StoryDetailModal-VRpQXfVV.js","assets/card-DOeJHod5.js","assets/AnimatedStoryCard-CL0e194u.js","assets/sesl-badge-utils-BvAx6z8X.js","assets/i18n-vendor-Bg2yf_Zw.js","assets/book-check-CUdEsrzo.js","assets/bookmark-BaFYZh0z.js","assets/clock-J8WFLZpc.js","assets/file-text-CsP-cT7k.js","assets/slider-C5pDLAf1.js","assets/chevron-left-Djkau_AO.js","assets/input-BvcnSbjU.js","assets/collapsible-A26nt0JL.js","assets/index-DszAjLYW.js","assets/use-mobile-BN2Z-RJr.js","assets/BreadcrumbNavigation-Cef9wqNX.js","assets/skeleton-CNPuBxPx.js","assets/search-6jxetzcK.js","assets/rotate-ccw-Cdyj-RbO.js","assets/supabase-vendor-CNV44oIa.js","assets/helmet-vendor-NlTFkN97.js","assets/TextCheckerPage-BVrUNDeh.js","assets/story-generation-service-CezzMBW3.js","assets/textarea-C5sy3Esw.js","assets/copy-BYRjN2H0.js","assets/chart-column-CPG5bWJv.js","assets/generateCategoricalChart-BPIeFlsM.js","assets/YAxis-Dvk6JyRZ.js","assets/sesl-client-DUFK2WxD.js","assets/arrow-right-DlSbZZeB.js","assets/ShareCard-D1wh-SEw.js","assets/refresh-ccw-BM0T-_bW.js","assets/ResearchPage-CPtGXeZv.js","assets/table-W6cXerda.js","assets/RelatedLinks-BAECoIH1.js","assets/download-COXotz5v.js","assets/sparkles-DlWNC8s3.js","assets/mail-W8bwaFmP.js","assets/ProfessionalNarrationSection-BEtfUobD.js","assets/SyncedHighlightsSection-5LTrvkcS.js","assets/useIOSAudioContext-DtqQj9l7.js","assets/InteractiveWordsSection-D2aRY-T0.js","assets/VocabularySection-19Kpx33w.js","assets/ChooseYourPaceSection-wraCUKui.js","assets/turtle-DbrNOJkh.js","assets/DyslexiaSection-DPAl78W1.js","assets/CheckTextSection-CjNLkzpc.js","assets/ThemesSection-C7QGC5wN.js","assets/ExploreThemesButton-BKwFP0Hx.js","assets/compass-BJkMS_Bo.js","assets/StoryMakerSection-DLsK9xt2.js","assets/AchievementsSection-ZBmYFp4Z.js","assets/HotAirBalloon-FI3Lv-FM.js","assets/QuillWipe-DYHI3ulT.js","assets/index.es-C3Wz79fL.js","assets/StoryReaderPage-DXKm3pcv.js","assets/arrow-left-CqB5hln-.js","assets/switch-JfLNep2N.js","assets/useStoryData-fM6mjOKu.js","assets/azure-speech-service-JMPfFU1x.js","assets/UpgradeButton-BQy38zBU.js","assets/volume-x-DW5BkSzX.js","assets/play-Dlon1nod.js","assets/volume-2-BrJQYrnr.js","assets/xp-service-C5P83GE3.js","assets/progress-FvbuFNJw.js","assets/refresh-cw-DyDenN9o.js","assets/seo-utils-BEQHlopB.js","assets/AboutPage-D48h5y7O.js","assets/CreateFreeAccountButton-Nk8Nm4N-.js","assets/ContactPage-BSIiCElr.js","assets/accordion-CMFzhq8A.js","assets/SocialIcons-DWGIwkB0.js","assets/circle-check-big-BH8NmxBb.js","assets/ImproveReadingPage-BQ4Ube7X.js","assets/eye-Dsc6-EzU.js","assets/users-DSAmDC4L.js","assets/party-popper-DAVXX1zq.js","assets/calendar-check-ZdvDx083.js","assets/WatchPage-C2yVy1oS.js","assets/VideoCard-r0dHUQVp.js","assets/WatchVideoPage-Cc6AM_Bt.js","assets/AuthPages-Brv_KMOG.js","assets/checkbox-C5MG2fpd.js","assets/AuthScreenLayout-CawMxa-b.js","assets/eye-off-qdVPkEqE.js","assets/ResetPasswordPage-BnVj84s9.js","assets/VerifyEmailPage-Bpwi2I3A.js","assets/NotFound-CtUeyc4F.js","assets/ProgressPage-C0jMi8rv.js","assets/zap-CprKT0bz.js","assets/format-B9FvFmC1.js","assets/calendar-Bp_zi9ky.js","assets/ReadingCartPage-DBHEFKFX.js","assets/VocabularyNotebookPage-IJOod8T9.js","assets/alert-dialog-B2AVC74v.js","assets/trash-2-BPpTA5ug.js","assets/AdminPage-B0qN_X_N.js","assets/separator-BrpKfOwE.js","assets/CurrencySelector-D5Lp4JeD.js","assets/circle-x-C6wo96EB.js","assets/useBlogData-DYQV6Mdu.js","assets/purify.es-D9RiKzGB.js","assets/tabs-Ch7KlUEN.js","assets/alert-Be-91SPt.js","assets/image-C8VGWlOI.js","assets/FontManagementPage-B9uRTjfC.js","assets/TermsPage-CyPyNnTW.js","assets/PrivacyPage-SpoKEhp6.js","assets/RefundPage-RxMqKhEx.js","assets/SubscriptionPage-DyRICx7F.js","assets/PaymentStatusPage-DqpWR37Z.js","assets/ThemeInfoPage-BYu3lgPr.js","assets/BlogPage-BIz5fyXn.js","assets/BlogCard-DxfwFIog.js","assets/BlogPostPage-C5rCVdF6.js","assets/NewsletterPage-DU07ytzO.js","assets/StoryMakerPage-DjF-ruyM.js"])))=>i.map(i=>d[i]);
import{j as o,Q as Lb,a as Nb}from"./query-vendor-CZu0EHPe.js";import{b as fr,R as F,r as h,d as Sm,e as Mb,u as uu,f as os,L as pe,B as Vb,h as Fb,i as v}from"./react-vendor-0bvDbF03.js";import{c as $b,_}from"./supabase-vendor-CNV44oIa.js";import{H as Bb,a as zb}from"./helmet-vendor-NlTFkN97.js";import{i as Rm,a as Ub,u as Se}from"./i18n-vendor-Bg2yf_Zw.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var Am,Jd=fr;Am=Jd.createRoot,Jd.hydrateRoot;class Cm extends F.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n)}render(){return this.state.hasError?this.props.fallback||o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:o.jsxs("div",{className:"text-center p-8",children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Something went wrong"}),o.jsx("p",{className:"text-gray-600 mb-4",children:this.state.error?.message||"An unexpected error occurred"}),o.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:"Reload Page"})]})}):this.props.children}}const Hb=1,Wb=1e6;let Ya=0;function Gb(){return Ya=(Ya+1)%Number.MAX_SAFE_INTEGER,Ya.toString()}const Xa=new Map,Qd=t=>{if(Xa.has(t))return;const e=setTimeout(()=>{Xa.delete(t),Zr({type:"REMOVE_TOAST",toastId:t})},Wb);Xa.set(t,e)},Kb=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Hb)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?Qd(n):t.toasts.forEach(s=>{Qd(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},fi=[];let mi={toasts:[]};function Zr(t){mi=Kb(mi,t),fi.forEach(e=>{e(mi)})}function qb({...t}){const e=Gb(),n=r=>Zr({type:"UPDATE_TOAST",toast:{...r,id:e}}),s=()=>Zr({type:"DISMISS_TOAST",toastId:e});return Zr({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||s()}}}),{id:e,dismiss:s,update:n}}function Im(){const[t,e]=h.useState(mi);return h.useEffect(()=>(fi.push(e),()=>{const n=fi.indexOf(e);n>-1&&fi.splice(n,1)}),[t]),{...t,toast:qb,dismiss:n=>Zr({type:"DISMISS_TOAST",toastId:n})}}function G(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t?.(r),n===!1||!r.defaultPrevented)return e?.(r)}}function Yb(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function da(...t){return e=>t.forEach(n=>Yb(n,e))}function _e(...t){return h.useCallback(da(...t),t)}function Xb(t,e=[]){let n=[];function s(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:g,...y}=p,m=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(m.Provider,{value:x,children:g})}function d(p,f){const g=f?.[t][c]||l,y=h.useContext(g);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const r=()=>{const i=n.map(a=>h.createContext(a));return function(l){const c=l?.[t]||i;return h.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return r.scopeName=t,[s,Zb(r,...e)]}function Zb(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var Jn=h.forwardRef((t,e)=>{const{children:n,...s}=t,r=h.Children.toArray(n),i=r.find(Jb);if(i){const a=i.props.children,l=r.map(c=>c===i?h.Children.count(a)>1?h.Children.only(null):h.isValidElement(a)?a.props.children:null:c);return o.jsx(Hl,{...s,ref:e,children:h.isValidElement(a)?h.cloneElement(a,void 0,l):null})}return o.jsx(Hl,{...s,ref:e,children:n})});Jn.displayName="Slot";var Hl=h.forwardRef((t,e)=>{const{children:n,...s}=t;if(h.isValidElement(n)){const r=ew(n);return h.cloneElement(n,{...Qb(s,n.props),ref:e?da(e,r):r})}return h.Children.count(n)>1?h.Children.only(null):null});Hl.displayName="SlotClone";var Om=({children:t})=>o.jsx(o.Fragment,{children:t});function Jb(t){return h.isValidElement(t)&&t.type===Om}function Qb(t,e){const n={...e};for(const s in e){const r=t[s],i=e[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...l)=>{i(...l),r(...l)}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}function ew(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ha(t){const e=t+"CollectionProvider",[n,s]=Xb(e),[r,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:y,children:m}=g,x=F.useRef(null),b=F.useRef(new Map).current;return o.jsx(r,{scope:y,itemMap:b,collectionRef:x,children:m})};a.displayName=e;const l=t+"CollectionSlot",c=F.forwardRef((g,y)=>{const{scope:m,children:x}=g,b=i(l,m),w=_e(y,b.collectionRef);return o.jsx(Jn,{ref:w,children:x})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",p=F.forwardRef((g,y)=>{const{scope:m,children:x,...b}=g,w=F.useRef(null),E=_e(y,w),T=i(u,m);return F.useEffect(()=>(T.itemMap.set(w,{ref:w,...b}),()=>void T.itemMap.delete(w))),o.jsx(Jn,{[d]:"",ref:E,children:x})});p.displayName=u;function f(g){const y=i(t+"CollectionConsumer",g);return F.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((T,j)=>b.indexOf(T.ref.current)-b.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:c,ItemSlot:p},f,s]}function tw(t,e){const n=h.createContext(e),s=i=>{const{children:a,...l}=i,c=h.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})};s.displayName=t+"Provider";function r(i){const a=h.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[s,r]}function js(t,e=[]){let n=[];function s(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];const u=p=>{const{scope:f,children:g,...y}=p,m=f?.[t]?.[c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(m.Provider,{value:x,children:g})};u.displayName=i+"Provider";function d(p,f){const g=f?.[t]?.[c]||l,y=h.useContext(g);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,d]}const r=()=>{const i=n.map(a=>h.createContext(a));return function(l){const c=l?.[t]||i;return h.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return r.scopeName=t,[s,nw(r,...e)]}function nw(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var sw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],se=sw.reduce((t,e)=>{const n=h.forwardRef((s,r)=>{const{asChild:i,...a}=s,l=i?Jn:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...a,ref:r})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function du(t,e){t&&fr.flushSync(()=>t.dispatchEvent(e))}function Ye(t){const e=h.useRef(t);return h.useEffect(()=>{e.current=t}),h.useMemo(()=>(...n)=>e.current?.(...n),[])}function rw(t,e=globalThis?.document){const n=Ye(t);h.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[n,e])}var ow="DismissableLayer",Wl="dismissableLayer.update",iw="dismissableLayer.pointerDownOutside",aw="dismissableLayer.focusOutside",eh,Dm=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mr=h.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=t,u=h.useContext(Dm),[d,p]=h.useState(null),f=d?.ownerDocument??globalThis?.document,[,g]=h.useState({}),y=_e(e,k=>p(k)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),w=d?m.indexOf(d):-1,E=u.layersWithOutsidePointerEventsDisabled.size>0,T=w>=b,j=cw(k=>{const S=k.target,O=[...u.branches].some(D=>D.contains(S));!T||O||(r?.(k),a?.(k),k.defaultPrevented||l?.())},f),P=uw(k=>{const S=k.target;[...u.branches].some(D=>D.contains(S))||(i?.(k),a?.(k),k.defaultPrevented||l?.())},f);return rw(k=>{w===u.layers.size-1&&(s?.(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},f),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(eh=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),th(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=eh)}},[d,f,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),th())},[d,u]),h.useEffect(()=>{const k=()=>g({});return document.addEventListener(Wl,k),()=>document.removeEventListener(Wl,k)},[]),o.jsx(se.div,{...c,ref:y,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:G(t.onFocusCapture,P.onFocusCapture),onBlurCapture:G(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:G(t.onPointerDownCapture,j.onPointerDownCapture)})});mr.displayName=ow;var lw="DismissableLayerBranch",Lm=h.forwardRef((t,e)=>{const n=h.useContext(Dm),s=h.useRef(null),r=_e(e,s);return h.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),o.jsx(se.div,{...t,ref:r})});Lm.displayName=lw;function cw(t,e=globalThis?.document){const n=Ye(t),s=h.useRef(!1),r=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!s.current){let c=function(){Nm(iw,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=c,e.addEventListener("click",r.current,{once:!0})):c()}else e.removeEventListener("click",r.current);s.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",r.current)}},[e,n]),{onPointerDownCapture:()=>s.current=!0}}function uw(t,e=globalThis?.document){const n=Ye(t),s=h.useRef(!1);return h.useEffect(()=>{const r=i=>{i.target&&!s.current&&Nm(aw,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function th(){const t=new CustomEvent(Wl);document.dispatchEvent(t)}function Nm(t,e,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),s?du(r,i):r.dispatchEvent(i)}var dw=mr,hw=Lm,We=globalThis?.document?h.useLayoutEffect:()=>{},pw="Portal",gr=h.forwardRef((t,e)=>{const{container:n,...s}=t,[r,i]=h.useState(!1);We(()=>i(!0),[]);const a=n||r&&globalThis?.document?.body;return a?Sm.createPortal(o.jsx(se.div,{...s,ref:e}),a):null});gr.displayName=pw;function fw(t,e){return h.useReducer((n,s)=>e[n][s]??n,t)}var nn=t=>{const{present:e,children:n}=t,s=mw(e),r=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),i=_e(s.ref,gw(r));return typeof n=="function"||s.isPresent?h.cloneElement(r,{ref:i}):null};nn.displayName="Presence";function mw(t){const[e,n]=h.useState(),s=h.useRef({}),r=h.useRef(t),i=h.useRef("none"),a=t?"mounted":"unmounted",[l,c]=fw(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=qo(s.current);i.current=l==="mounted"?u:"none"},[l]),We(()=>{const u=s.current,d=r.current;if(d!==t){const f=i.current,g=qo(u);t?c("MOUNT"):g==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&f!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=t}},[t,c]),We(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,p=g=>{const m=qo(s.current).includes(g.animationName);if(g.target===e&&m&&(c("ANIMATION_END"),!r.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},f=g=>{g.target===e&&(i.current=qo(s.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{u&&(s.current=getComputedStyle(u)),n(u)},[])}}function qo(t){return t?.animationName||"none"}function gw(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function _s({prop:t,defaultProp:e,onChange:n=()=>{}}){const[s,r]=vw({defaultProp:e,onChange:n}),i=t!==void 0,a=i?t:s,l=Ye(n),c=h.useCallback(u=>{if(i){const p=typeof u=="function"?u(t):u;p!==t&&l(p)}else r(u)},[i,t,r,l]);return[a,c]}function vw({defaultProp:t,onChange:e}){const n=h.useState(t),[s]=n,r=h.useRef(s),i=Ye(e);return h.useEffect(()=>{r.current!==s&&(i(s),r.current=s)},[s,r,i]),n}var _w="VisuallyHidden",Oo=h.forwardRef((t,e)=>o.jsx(se.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));Oo.displayName=_w;var yw=Oo,hu="ToastProvider",[pu,xw,bw]=ha("Toast"),[Mm,nV]=js("Toast",[bw]),[ww,pa]=Mm(hu),Vm=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:r="right",swipeThreshold:i=50,children:a}=t,[l,c]=h.useState(null),[u,d]=h.useState(0),p=h.useRef(!1),f=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${hu}\`. Expected non-empty \`string\`.`),o.jsx(pu.Provider,{scope:e,children:o.jsx(ww,{scope:e,label:n,duration:s,swipeDirection:r,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>d(g=>g+1),[]),onToastRemove:h.useCallback(()=>d(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:f,children:a})})};Vm.displayName=hu;var Fm="ToastViewport",Ew=["F8"],Gl="toast.viewportPause",Kl="toast.viewportResume",$m=h.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=Ew,label:r="Notifications ({hotkey})",...i}=t,a=pa(Fm,n),l=xw(n),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),p=h.useRef(null),f=_e(e,p,a.onViewportChange),g=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;h.useEffect(()=>{const x=b=>{s.length!==0&&s.every(E=>b[E]||b.code===E)&&p.current?.focus()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]),h.useEffect(()=>{const x=c.current,b=p.current;if(y&&x&&b){const w=()=>{if(!a.isClosePausedRef.current){const P=new CustomEvent(Gl);b.dispatchEvent(P),a.isClosePausedRef.current=!0}},E=()=>{if(a.isClosePausedRef.current){const P=new CustomEvent(Kl);b.dispatchEvent(P),a.isClosePausedRef.current=!1}},T=P=>{!x.contains(P.relatedTarget)&&E()},j=()=>{x.contains(document.activeElement)||E()};return x.addEventListener("focusin",w),x.addEventListener("focusout",T),x.addEventListener("pointermove",w),x.addEventListener("pointerleave",j),window.addEventListener("blur",w),window.addEventListener("focus",E),()=>{x.removeEventListener("focusin",w),x.removeEventListener("focusout",T),x.removeEventListener("pointermove",w),x.removeEventListener("pointerleave",j),window.removeEventListener("blur",w),window.removeEventListener("focus",E)}}},[y,a.isClosePausedRef]);const m=h.useCallback(({tabbingDirection:x})=>{const w=l().map(E=>{const T=E.ref.current,j=[T,...Nw(T)];return x==="forwards"?j:j.reverse()});return(x==="forwards"?w.reverse():w).flat()},[l]);return h.useEffect(()=>{const x=p.current;if(x){const b=w=>{const E=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!E){const j=document.activeElement,P=w.shiftKey;if(w.target===x&&P){u.current?.focus();return}const O=m({tabbingDirection:P?"backwards":"forwards"}),D=O.findIndex(M=>M===j);Za(O.slice(D+1))?w.preventDefault():P?u.current?.focus():d.current?.focus()}};return x.addEventListener("keydown",b),()=>x.removeEventListener("keydown",b)}},[l,m]),o.jsxs(hw,{ref:c,role:"region","aria-label":r.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(ql,{ref:u,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});Za(x)}}),o.jsx(pu.Slot,{scope:n,children:o.jsx(se.ol,{tabIndex:-1,...i,ref:f})}),y&&o.jsx(ql,{ref:d,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});Za(x)}})]})});$m.displayName=Fm;var Bm="ToastFocusProxy",ql=h.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...r}=t,i=pa(Bm,n);return o.jsx(Oo,{"aria-hidden":!0,tabIndex:0,...r,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&s()}})});ql.displayName=Bm;var fa="Toast",jw="toast.swipeStart",Tw="toast.swipeMove",Pw="toast.swipeCancel",kw="toast.swipeEnd",zm=h.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:r,onOpenChange:i,...a}=t,[l=!0,c]=_s({prop:s,defaultProp:r,onChange:i});return o.jsx(nn,{present:n||l,children:o.jsx(Aw,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:Ye(t.onPause),onResume:Ye(t.onResume),onSwipeStart:G(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:G(t.onSwipeMove,u=>{const{x:d,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:G(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:G(t.onSwipeEnd,u=>{const{x:d,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),c(!1)})})})});zm.displayName=fa;var[Sw,Rw]=Mm(fa,{onClose(){}}),Aw=h.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:r,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:p,onSwipeCancel:f,onSwipeEnd:g,...y}=t,m=pa(fa,n),[x,b]=h.useState(null),w=_e(e,I=>b(I)),E=h.useRef(null),T=h.useRef(null),j=r||m.duration,P=h.useRef(0),k=h.useRef(j),S=h.useRef(0),{onToastAdd:O,onToastRemove:D}=m,M=Ye(()=>{x?.contains(document.activeElement)&&m.viewport?.focus(),a()}),L=h.useCallback(I=>{!I||I===1/0||(window.clearTimeout(S.current),P.current=new Date().getTime(),S.current=window.setTimeout(M,I))},[M]);h.useEffect(()=>{const I=m.viewport;if(I){const Y=()=>{L(k.current),u?.()},$=()=>{const H=new Date().getTime()-P.current;k.current=k.current-H,window.clearTimeout(S.current),c?.()};return I.addEventListener(Gl,$),I.addEventListener(Kl,Y),()=>{I.removeEventListener(Gl,$),I.removeEventListener(Kl,Y)}}},[m.viewport,j,c,u,L]),h.useEffect(()=>{i&&!m.isClosePausedRef.current&&L(j)},[i,j,m.isClosePausedRef,L]),h.useEffect(()=>(O(),()=>D()),[O,D]);const X=h.useMemo(()=>x?Ym(x):null,[x]);return m.viewport?o.jsxs(o.Fragment,{children:[X&&o.jsx(Cw,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:X}),o.jsx(Sw,{scope:n,onClose:M,children:fr.createPortal(o.jsx(pu.ItemSlot,{scope:n,children:o.jsx(dw,{asChild:!0,onEscapeKeyDown:G(l,()=>{m.isFocusedToastEscapeKeyDownRef.current||M(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(se.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:w,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:G(t.onKeyDown,I=>{I.key==="Escape"&&(l?.(I.nativeEvent),I.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,M()))}),onPointerDown:G(t.onPointerDown,I=>{I.button===0&&(E.current={x:I.clientX,y:I.clientY})}),onPointerMove:G(t.onPointerMove,I=>{if(!E.current)return;const Y=I.clientX-E.current.x,$=I.clientY-E.current.y,H=!!T.current,A=["left","right"].includes(m.swipeDirection),C=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,V=A?C(0,Y):0,N=A?0:C(0,$),Z=I.pointerType==="touch"?10:2,Q={x:V,y:N},ne={originalEvent:I,delta:Q};H?(T.current=Q,Yo(Tw,p,ne,{discrete:!1})):nh(Q,m.swipeDirection,Z)?(T.current=Q,Yo(jw,d,ne,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(Y)>Z||Math.abs($)>Z)&&(E.current=null)}),onPointerUp:G(t.onPointerUp,I=>{const Y=T.current,$=I.target;if($.hasPointerCapture(I.pointerId)&&$.releasePointerCapture(I.pointerId),T.current=null,E.current=null,Y){const H=I.currentTarget,A={originalEvent:I,delta:Y};nh(Y,m.swipeDirection,m.swipeThreshold)?Yo(kw,g,A,{discrete:!0}):Yo(Pw,f,A,{discrete:!0}),H.addEventListener("click",C=>C.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),Cw=t=>{const{__scopeToast:e,children:n,...s}=t,r=pa(fa,e),[i,a]=h.useState(!1),[l,c]=h.useState(!1);return Dw(()=>a(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:o.jsx(gr,{asChild:!0,children:o.jsx(Oo,{...s,children:i&&o.jsxs(o.Fragment,{children:[r.label," ",n]})})})},Iw="ToastTitle",Um=h.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return o.jsx(se.div,{...s,ref:e})});Um.displayName=Iw;var Ow="ToastDescription",Hm=h.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return o.jsx(se.div,{...s,ref:e})});Hm.displayName=Ow;var Wm="ToastAction",Gm=h.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?o.jsx(qm,{altText:n,asChild:!0,children:o.jsx(fu,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${Wm}\`. Expected non-empty \`string\`.`),null)});Gm.displayName=Wm;var Km="ToastClose",fu=h.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,r=Rw(Km,n);return o.jsx(qm,{asChild:!0,children:o.jsx(se.button,{type:"button",...s,ref:e,onClick:G(t.onClick,r.onClose)})})});fu.displayName=Km;var qm=h.forwardRef((t,e)=>{const{__scopeToast:n,altText:s,...r}=t;return o.jsx(se.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...r,ref:e})});function Ym(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),Lw(s)){const r=s.ariaHidden||s.hidden||s.style.display==="none",i=s.dataset.radixToastAnnounceExclude==="";if(!r)if(i){const a=s.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...Ym(s))}}),e}function Yo(t,e,n,{discrete:s}){const r=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),s?du(r,i):r.dispatchEvent(i)}var nh=(t,e,n=0)=>{const s=Math.abs(t.x),r=Math.abs(t.y),i=s>r;return e==="left"||e==="right"?i&&s>n:!i&&r>n};function Dw(t=()=>{}){const e=Ye(t);We(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function Lw(t){return t.nodeType===t.ELEMENT_NODE}function Nw(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Za(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var Mw=Vm,Xm=$m,Zm=zm,Jm=Um,Qm=Hm,eg=Gm,tg=fu;function ng(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=ng(t[e]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function mu(){for(var t,e,n=0,s="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=ng(t))&&(s&&(s+=" "),s+=e);return s}const sh=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rh=mu,ma=(t,e)=>n=>{var s;if(e?.variants==null)return rh(t,n?.class,n?.className);const{variants:r,defaultVariants:i}=e,a=Object.keys(r).map(u=>{const d=n?.[u],p=i?.[u];if(d===null)return null;const f=sh(d)||sh(p);return r[u][f]}),l=n&&Object.entries(n).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),c=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:p,className:f,...g}=d;return Object.entries(g).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...i,...l}[m]):{...i,...l}[m]===x})?[...u,p,f]:u},[]);return rh(t,a,c,n?.class,n?.className)};/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vw=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fw=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,s)=>s?s.toUpperCase():n.toLowerCase()),oh=t=>{const e=Fw(t);return e.charAt(0).toUpperCase()+e.slice(1)},sg=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim(),$w=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var Bw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zw=h.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:a,...l},c)=>h.createElement("svg",{ref:c,...Bw,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:sg("lucide",r),...!i&&!$w(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>h.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ce=(t,e)=>{const n=h.forwardRef(({className:s,...r},i)=>h.createElement(zw,{ref:i,iconNode:e,className:sg(`lucide-${Vw(oh(t))}`,`lucide-${t}`,s),...r}));return n.displayName=oh(t),n};/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Uw=[["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"11xh7x"}],["path",{d:"M9 12h.01",key:"157uk2"}]],Hw=ce("baby",Uw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ww=[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]],Gw=ce("backpack",Ww);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kw=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],ih=ce("blocks",Kw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qw=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Yw=ce("book-open",qw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xw=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],Zw=ce("brain-circuit",Xw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jw=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],ah=ce("camera",Jw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qw=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ga=ce("check",Qw);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e1=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ii=ce("chevron-down",e1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t1=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],n1=ce("chevron-right",t1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s1=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],r1=ce("chevron-up",s1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o1=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],rg=ce("circle-play",o1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],a1=ce("circle",i1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l1=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Tr=ce("crown",l1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c1=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u1=ce("earth",c1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],h1=ce("file-check",d1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],f1=ce("gauge",p1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],g1=ce("graduation-cap",m1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],og=ce("heart",v1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],y1=ce("info",_1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],lh=ce("key-round",x1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b1=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],w1=ce("languages",b1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E1=[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]],j1=ce("library-big",E1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T1=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],P1=ce("lightbulb",T1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ch=ce("loader-circle",k1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S1=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],ig=ce("log-in",S1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],uh=ce("log-out",R1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const A1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],C1=ce("menu",A1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],O1=ce("message-circle-question-mark",I1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D1=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],L1=ce("notebook-pen",D1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],M1=ce("palette",N1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const V1=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],F1=ce("smartphone",V1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $1=[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]],B1=ce("spell-check",$1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z1=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],U1=ce("trophy",z1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const H1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],dh=ce("upload",H1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const W1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],G1=ce("user",W1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const K1=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ag=ce("wand-sparkles",K1);/**
 * @license lucide-react v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const q1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],va=ce("x",q1),gu="-",Y1=t=>{const e=Z1(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:a=>{const l=a.split(gu);return l[0]===""&&l.length!==1&&l.shift(),lg(l,e)||X1(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&s[a]?[...c,...s[a]]:c}}},lg=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),r=s?lg(t.slice(1),s):void 0;if(r)return r;if(e.validators.length===0)return;const i=t.join(gu);return e.validators.find(({validator:a})=>a(i))?.classGroupId},hh=/^\[(.+)\]$/,X1=t=>{if(hh.test(t)){const e=hh.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Z1=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return Q1(Object.entries(t.classGroups),n).forEach(([i,a])=>{Yl(a,s,i,e)}),s},Yl=(t,e,n,s)=>{t.forEach(r=>{if(typeof r=="string"){const i=r===""?e:ph(e,r);i.classGroupId=n;return}if(typeof r=="function"){if(J1(r)){Yl(r(s),e,n,s);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,a])=>{Yl(a,ph(e,i),n,s)})})},ph=(t,e)=>{let n=t;return e.split(gu).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},J1=t=>t.isThemeGetter,Q1=(t,e)=>e?t.map(([n,s])=>{const r=s.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[e+a,l])):i);return[n,r]}):t,eE=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,s=new Map;const r=(i,a)=>{n.set(i,a),e++,e>t&&(e=0,s=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=s.get(i))!==void 0)return r(i,a),a},set(i,a){n.has(i)?n.set(i,a):r(i,a)}}},cg="!",tE=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,r=e[0],i=e.length,a=l=>{const c=[];let u=0,d=0,p;for(let x=0;x<l.length;x++){let b=l[x];if(u===0){if(b===r&&(s||l.slice(x,x+i)===e)){c.push(l.slice(d,x)),d=x+i;continue}if(b==="/"){p=x;continue}}b==="["?u++:b==="]"&&u--}const f=c.length===0?l:l.substring(d),g=f.startsWith(cg),y=g?f.substring(1):f,m=p&&p>d?p-d:void 0;return{modifiers:c,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:a}):a},nE=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(s=>{s[0]==="["?(e.push(...n.sort(),s),n=[]):n.push(s)}),e.push(...n.sort()),e},sE=t=>({cache:eE(t.cacheSize),parseClassName:tE(t),...Y1(t)}),rE=/\s+/,oE=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r}=e,i=[],a=t.trim().split(rE);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:g}=n(u);let y=!!g,m=s(y?f.substring(0,g):f);if(!m){if(!y){l=u+(l.length>0?" "+l:l);continue}if(m=s(f),!m){l=u+(l.length>0?" "+l:l);continue}y=!1}const x=nE(d).join(":"),b=p?x+cg:x,w=b+m;if(i.includes(w))continue;i.push(w);const E=r(m,y);for(let T=0;T<E.length;++T){const j=E[T];i.push(b+j)}l=u+(l.length>0?" "+l:l)}return l};function iE(){let t=0,e,n,s="";for(;t<arguments.length;)(e=arguments[t++])&&(n=ug(e))&&(s&&(s+=" "),s+=n);return s}const ug=t=>{if(typeof t=="string")return t;let e,n="";for(let s=0;s<t.length;s++)t[s]&&(e=ug(t[s]))&&(n&&(n+=" "),n+=e);return n};function aE(t,...e){let n,s,r,i=a;function a(c){const u=e.reduce((d,p)=>p(d),t());return n=sE(u),s=n.cache.get,r=n.cache.set,i=l,l(c)}function l(c){const u=s(c);if(u)return u;const d=oE(c,n);return r(c,d),d}return function(){return i(iE.apply(null,arguments))}}const Pe=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},dg=/^\[(?:([a-z-]+):)?(.+)\]$/i,lE=/^\d+\/\d+$/,cE=new Set(["px","full","screen"]),uE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,pE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kn=t=>Xs(t)||cE.has(t)||lE.test(t),Bn=t=>vr(t,"length",wE),Xs=t=>!!t&&!Number.isNaN(Number(t)),Ja=t=>vr(t,"number",Xs),Pr=t=>!!t&&Number.isInteger(Number(t)),mE=t=>t.endsWith("%")&&Xs(t.slice(0,-1)),oe=t=>dg.test(t),zn=t=>uE.test(t),gE=new Set(["length","size","percentage"]),vE=t=>vr(t,gE,hg),_E=t=>vr(t,"position",hg),yE=new Set(["image","url"]),xE=t=>vr(t,yE,jE),bE=t=>vr(t,"",EE),kr=()=>!0,vr=(t,e,n)=>{const s=dg.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},wE=t=>dE.test(t)&&!hE.test(t),hg=()=>!1,EE=t=>pE.test(t),jE=t=>fE.test(t),TE=()=>{const t=Pe("colors"),e=Pe("spacing"),n=Pe("blur"),s=Pe("brightness"),r=Pe("borderColor"),i=Pe("borderRadius"),a=Pe("borderSpacing"),l=Pe("borderWidth"),c=Pe("contrast"),u=Pe("grayscale"),d=Pe("hueRotate"),p=Pe("invert"),f=Pe("gap"),g=Pe("gradientColorStops"),y=Pe("gradientColorStopPositions"),m=Pe("inset"),x=Pe("margin"),b=Pe("opacity"),w=Pe("padding"),E=Pe("saturate"),T=Pe("scale"),j=Pe("sepia"),P=Pe("skew"),k=Pe("space"),S=Pe("translate"),O=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",oe,e],L=()=>[oe,e],X=()=>["",kn,Bn],I=()=>["auto",Xs,oe],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],C=()=>["","0",oe],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>[Xs,oe];return{cacheSize:500,separator:":",theme:{colors:[kr],spacing:[kn,Bn],blur:["none","",zn,oe],brightness:N(),borderColor:[t],borderRadius:["none","","full",zn,oe],borderSpacing:L(),borderWidth:X(),contrast:N(),grayscale:C(),hueRotate:N(),invert:C(),gap:L(),gradientColorStops:[t],gradientColorStopPositions:[mE,Bn],inset:M(),margin:M(),opacity:N(),padding:L(),saturate:N(),scale:N(),sepia:C(),skew:N(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",oe]}],container:["container"],columns:[{columns:[zn]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),oe]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Pr,oe]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",oe]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",Pr,oe]}],"grid-cols":[{"grid-cols":[kr]}],"col-start-end":[{col:["auto",{span:["full",Pr,oe]},oe]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[kr]}],"row-start-end":[{row:["auto",{span:[Pr,oe]},oe]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",oe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",oe]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",oe,e]}],"min-w":[{"min-w":[oe,e,"min","max","fit"]}],"max-w":[{"max-w":[oe,e,"none","full","min","max","fit","prose",{screen:[zn]},zn]}],h:[{h:[oe,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[oe,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[oe,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[oe,e,"auto","min","max","fit"]}],"font-size":[{text:["base",zn,Bn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ja]}],"font-family":[{font:[kr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",oe]}],"line-clamp":[{"line-clamp":["none",Xs,Ja]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kn,oe]}],"list-image":[{"list-image":["none",oe]}],"list-style-type":[{list:["none","disc","decimal",oe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kn,Bn]}],"underline-offset":[{"underline-offset":["auto",kn,oe]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),_E]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xE]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:$()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[kn,oe]}],"outline-w":[{outline:[kn,Bn]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[kn,Bn]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",zn,bE]}],"shadow-color":[{shadow:[kr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",zn,oe]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[E]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",oe]}],duration:[{duration:N()}],ease:[{ease:["linear","in","out","in-out",oe]}],delay:[{delay:N()}],animate:[{animate:["none","spin","ping","pulse","bounce",oe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Pr,oe]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",oe]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[kn,Bn,Ja]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},PE=aE(TE);function ie(...t){return PE(mu(t))}const kE=Mw,pg=h.forwardRef(({className:t,...e},n)=>o.jsx(Xm,{ref:n,className:ie("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));pg.displayName=Xm.displayName;const SE=ma("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fg=h.forwardRef(({className:t,variant:e,...n},s)=>o.jsx(Zm,{ref:s,className:ie(SE({variant:e}),t),...n}));fg.displayName=Zm.displayName;const RE=h.forwardRef(({className:t,...e},n)=>o.jsx(eg,{ref:n,className:ie("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));RE.displayName=eg.displayName;const mg=h.forwardRef(({className:t,...e},n)=>o.jsx(tg,{ref:n,className:ie("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:o.jsx(va,{className:"h-4 w-4"})}));mg.displayName=tg.displayName;const gg=h.forwardRef(({className:t,...e},n)=>o.jsx(Jm,{ref:n,className:ie("text-sm font-semibold",t),...e}));gg.displayName=Jm.displayName;const vg=h.forwardRef(({className:t,...e},n)=>o.jsx(Qm,{ref:n,className:ie("text-sm opacity-90",t),...e}));vg.displayName=Qm.displayName;function AE(){const{toasts:t}=Im();return o.jsxs(kE,{children:[t.map(function({id:e,title:n,description:s,action:r,...i}){return o.jsxs(fg,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(gg,{children:n}),s&&o.jsx(vg,{children:s})]}),r,o.jsx(mg,{})]},e)}),o.jsx(pg,{})]})}var fh=["light","dark"],CE="(prefers-color-scheme: dark)",IE=h.createContext(void 0),OE={setTheme:t=>{},themes:[]},DE=()=>{var t;return(t=h.useContext(IE))!=null?t:OE};h.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:r,defaultTheme:i,value:a,attrs:l,nonce:c})=>{let u=i==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(y=>`'${y}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,p=r?fh.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(y,m=!1,x=!0)=>{let b=a?a[y]:y,w=m?y+"|| ''":`'${b}'`,E="";return r&&x&&!m&&fh.includes(y)&&(E+=`d.style.colorScheme = '${y}';`),n==="class"?m||b?E+=`c.add(${w})`:E+="null":b&&(E+=`d[s](n,${w})`),E},g=t?`!function(){${d}${f(t)}}()`:s?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${CE}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}${u?"":"else{"+f(i,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${p}}catch(t){}}();`;return h.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:g}})});var LE=t=>{switch(t){case"success":return VE;case"info":return $E;case"warning":return FE;case"error":return BE;default:return null}},NE=Array(12).fill(0),ME=({visible:t})=>F.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},F.createElement("div",{className:"sonner-spinner"},NE.map((e,n)=>F.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),VE=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),FE=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$E=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),BE=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),zE=()=>{let[t,e]=F.useState(document.hidden);return F.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Xl=1,UE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;let{message:s,...r}=e,i=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Xl++,a=this.toasts.find(c=>c.id===i),l=e.dismissible===void 0?!0:e.dismissible;return a?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...e,id:i,title:s}),{...c,...e,id:i,dismissible:l,title:s}):c):this.addToast({title:s,...r,dismissible:l,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:e,dismiss:!0})),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let r=e instanceof Promise?e:e(),i=s!==void 0;return r.then(async a=>{if(WE(a)&&!a.ok){i=!1;let l=typeof n.error=="function"?await n.error(`HTTP error! status: ${a.status}`):n.error,c=typeof n.description=="function"?await n.description(`HTTP error! status: ${a.status}`):n.description;this.create({id:s,type:"error",message:l,description:c})}else if(n.success!==void 0){i=!1;let l=typeof n.success=="function"?await n.success(a):n.success,c=typeof n.description=="function"?await n.description(a):n.description;this.create({id:s,type:"success",message:l,description:c})}}).catch(async a=>{if(n.error!==void 0){i=!1;let l=typeof n.error=="function"?await n.error(a):n.error,c=typeof n.description=="function"?await n.description(a):n.description;this.create({id:s,type:"error",message:l,description:c})}}).finally(()=>{var a;i&&(this.dismiss(s),s=void 0),(a=n.finally)==null||a.call(n)}),s},this.custom=(e,n)=>{let s=n?.id||Xl++;return this.create({jsx:e(s),id:s,...n}),s},this.subscribers=[],this.toasts=[]}},Vt=new UE,HE=(t,e)=>{let n=e?.id||Xl++;return Vt.addToast({title:t,...e,id:n}),n},WE=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",GE=HE,KE=()=>Vt.toasts,hn=Object.assign(GE,{success:Vt.success,info:Vt.info,warning:Vt.warning,error:Vt.error,custom:Vt.custom,message:Vt.message,promise:Vt.promise,dismiss:Vt.dismiss,loading:Vt.loading},{getHistory:KE});function qE(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",e==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}qE(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function Xo(t){return t.label!==void 0}var YE=3,XE="32px",ZE=4e3,JE=356,QE=14,ej=20,tj=200;function nj(...t){return t.filter(Boolean).join(" ")}var sj=t=>{var e,n,s,r,i,a,l,c,u,d;let{invert:p,toast:f,unstyled:g,interacting:y,setHeights:m,visibleToasts:x,heights:b,index:w,toasts:E,expanded:T,removeToast:j,defaultRichColors:P,closeButton:k,style:S,cancelButtonStyle:O,actionButtonStyle:D,className:M="",descriptionClassName:L="",duration:X,position:I,gap:Y,loadingIcon:$,expandByDefault:H,classNames:A,icons:C,closeButtonAriaLabel:V="Close toast",pauseWhenPageIsHidden:N,cn:Z}=t,[Q,ne]=F.useState(!1),[we,te]=F.useState(!1),[K,he]=F.useState(!1),[Re,ae]=F.useState(!1),[ye,xe]=F.useState(0),[ze,Lt]=F.useState(0),Tn=F.useRef(null),Nt=F.useRef(null),Pn=w===0,kb=w+1<=x,zt=f.type,As=f.dismissible!==!1,Sb=f.className||"",Rb=f.descriptionClassName||"",Go=F.useMemo(()=>b.findIndex(re=>re.toastId===f.id)||0,[b,f.id]),Ab=F.useMemo(()=>{var re;return(re=f.closeButton)!=null?re:k},[f.closeButton,k]),Kd=F.useMemo(()=>f.duration||X||ZE,[f.duration,X]),Ka=F.useRef(0),Cs=F.useRef(0),qd=F.useRef(0),Is=F.useRef(null),[Yd,Cb]=I.split("-"),Xd=F.useMemo(()=>b.reduce((re,Te,Ee)=>Ee>=Go?re:re+Te.height,0),[b,Go]),Zd=zE(),Ib=f.invert||p,qa=zt==="loading";Cs.current=F.useMemo(()=>Go*Y+Xd,[Go,Xd]),F.useEffect(()=>{ne(!0)},[]),F.useLayoutEffect(()=>{if(!Q)return;let re=Nt.current,Te=re.style.height;re.style.height="auto";let Ee=re.getBoundingClientRect().height;re.style.height=Te,Lt(Ee),m(on=>on.find(an=>an.toastId===f.id)?on.map(an=>an.toastId===f.id?{...an,height:Ee}:an):[{toastId:f.id,height:Ee,position:f.position},...on])},[Q,f.title,f.description,m,f.id]);let $n=F.useCallback(()=>{te(!0),xe(Cs.current),m(re=>re.filter(Te=>Te.toastId!==f.id)),setTimeout(()=>{j(f)},tj)},[f,j,m,Cs]);F.useEffect(()=>{if(f.promise&&zt==="loading"||f.duration===1/0||f.type==="loading")return;let re,Te=Kd;return T||y||N&&Zd?(()=>{if(qd.current<Ka.current){let Ee=new Date().getTime()-Ka.current;Te=Te-Ee}qd.current=new Date().getTime()})():Te!==1/0&&(Ka.current=new Date().getTime(),re=setTimeout(()=>{var Ee;(Ee=f.onAutoClose)==null||Ee.call(f,f),$n()},Te)),()=>clearTimeout(re)},[T,y,H,f,Kd,$n,f.promise,zt,N,Zd]),F.useEffect(()=>{let re=Nt.current;if(re){let Te=re.getBoundingClientRect().height;return Lt(Te),m(Ee=>[{toastId:f.id,height:Te,position:f.position},...Ee]),()=>m(Ee=>Ee.filter(on=>on.toastId!==f.id))}},[m,f.id]),F.useEffect(()=>{f.delete&&$n()},[$n,f.delete]);function Ob(){return C!=null&&C.loading?F.createElement("div",{className:"sonner-loader","data-visible":zt==="loading"},C.loading):$?F.createElement("div",{className:"sonner-loader","data-visible":zt==="loading"},$):F.createElement(ME,{visible:zt==="loading"})}return F.createElement("li",{"aria-live":f.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Nt,className:Z(M,Sb,A?.toast,(e=f?.classNames)==null?void 0:e.toast,A?.default,A?.[zt],(n=f?.classNames)==null?void 0:n[zt]),"data-sonner-toast":"","data-rich-colors":(s=f.richColors)!=null?s:P,"data-styled":!(f.jsx||f.unstyled||g),"data-mounted":Q,"data-promise":!!f.promise,"data-removed":we,"data-visible":kb,"data-y-position":Yd,"data-x-position":Cb,"data-index":w,"data-front":Pn,"data-swiping":K,"data-dismissible":As,"data-type":zt,"data-invert":Ib,"data-swipe-out":Re,"data-expanded":!!(T||H&&Q),style:{"--index":w,"--toasts-before":w,"--z-index":E.length-w,"--offset":`${we?ye:Cs.current}px`,"--initial-height":H?"auto":`${ze}px`,...S,...f.style},onPointerDown:re=>{qa||!As||(Tn.current=new Date,xe(Cs.current),re.target.setPointerCapture(re.pointerId),re.target.tagName!=="BUTTON"&&(he(!0),Is.current={x:re.clientX,y:re.clientY}))},onPointerUp:()=>{var re,Te,Ee,on;if(Re||!As)return;Is.current=null;let an=Number(((re=Nt.current)==null?void 0:re.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Ko=new Date().getTime()-((Te=Tn.current)==null?void 0:Te.getTime()),Db=Math.abs(an)/Ko;if(Math.abs(an)>=ej||Db>.11){xe(Cs.current),(Ee=f.onDismiss)==null||Ee.call(f,f),$n(),ae(!0);return}(on=Nt.current)==null||on.style.setProperty("--swipe-amount","0px"),he(!1)},onPointerMove:re=>{var Te;if(!Is.current||!As)return;let Ee=re.clientY-Is.current.y,on=re.clientX-Is.current.x,an=(Yd==="top"?Math.min:Math.max)(0,Ee),Ko=re.pointerType==="touch"?10:2;Math.abs(an)>Ko?(Te=Nt.current)==null||Te.style.setProperty("--swipe-amount",`${Ee}px`):Math.abs(on)>Ko&&(Is.current=null)}},Ab&&!f.jsx?F.createElement("button",{"aria-label":V,"data-disabled":qa,"data-close-button":!0,onClick:qa||!As?()=>{}:()=>{var re;$n(),(re=f.onDismiss)==null||re.call(f,f)},className:Z(A?.closeButton,(r=f?.classNames)==null?void 0:r.closeButton)},F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},F.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),F.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,f.jsx||F.isValidElement(f.title)?f.jsx||f.title:F.createElement(F.Fragment,null,zt||f.icon||f.promise?F.createElement("div",{"data-icon":"",className:Z(A?.icon,(i=f?.classNames)==null?void 0:i.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Ob():null,f.type!=="loading"?f.icon||C?.[zt]||LE(zt):null):null,F.createElement("div",{"data-content":"",className:Z(A?.content,(a=f?.classNames)==null?void 0:a.content)},F.createElement("div",{"data-title":"",className:Z(A?.title,(l=f?.classNames)==null?void 0:l.title)},f.title),f.description?F.createElement("div",{"data-description":"",className:Z(L,Rb,A?.description,(c=f?.classNames)==null?void 0:c.description)},f.description):null),F.isValidElement(f.cancel)?f.cancel:f.cancel&&Xo(f.cancel)?F.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||O,onClick:re=>{var Te,Ee;Xo(f.cancel)&&As&&((Ee=(Te=f.cancel).onClick)==null||Ee.call(Te,re),$n())},className:Z(A?.cancelButton,(u=f?.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,F.isValidElement(f.action)?f.action:f.action&&Xo(f.action)?F.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||D,onClick:re=>{var Te,Ee;Xo(f.action)&&(re.defaultPrevented||((Ee=(Te=f.action).onClick)==null||Ee.call(Te,re),$n()))},className:Z(A?.actionButton,(d=f?.classNames)==null?void 0:d.actionButton)},f.action.label):null))};function mh(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var rj=t=>{let{invert:e,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:r,closeButton:i,className:a,offset:l,theme:c="light",richColors:u,duration:d,style:p,visibleToasts:f=YE,toastOptions:g,dir:y=mh(),gap:m=QE,loadingIcon:x,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:E,cn:T=nj}=t,[j,P]=F.useState([]),k=F.useMemo(()=>Array.from(new Set([n].concat(j.filter(N=>N.position).map(N=>N.position)))),[j,n]),[S,O]=F.useState([]),[D,M]=F.useState(!1),[L,X]=F.useState(!1),[I,Y]=F.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=F.useRef(null),H=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=F.useRef(null),C=F.useRef(!1),V=F.useCallback(N=>{var Z;(Z=j.find(Q=>Q.id===N.id))!=null&&Z.delete||Vt.dismiss(N.id),P(Q=>Q.filter(({id:ne})=>ne!==N.id))},[j]);return F.useEffect(()=>Vt.subscribe(N=>{if(N.dismiss){P(Z=>Z.map(Q=>Q.id===N.id?{...Q,delete:!0}:Q));return}setTimeout(()=>{Sm.flushSync(()=>{P(Z=>{let Q=Z.findIndex(ne=>ne.id===N.id);return Q!==-1?[...Z.slice(0,Q),{...Z[Q],...N},...Z.slice(Q+1)]:[N,...Z]})})})}),[]),F.useEffect(()=>{if(c!=="system"){Y(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:N})=>{Y(N?"dark":"light")})},[c]),F.useEffect(()=>{j.length<=1&&M(!1)},[j]),F.useEffect(()=>{let N=Z=>{var Q,ne;s.every(we=>Z[we]||Z.code===we)&&(M(!0),(Q=$.current)==null||Q.focus()),Z.code==="Escape"&&(document.activeElement===$.current||(ne=$.current)!=null&&ne.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[s]),F.useEffect(()=>{if($.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,C.current=!1)}},[$.current]),j.length?F.createElement("section",{"aria-label":`${w} ${H}`,tabIndex:-1},k.map((N,Z)=>{var Q;let[ne,we]=N.split("-");return F.createElement("ol",{key:N,dir:y==="auto"?mh():y,tabIndex:-1,ref:$,className:a,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":ne,"data-x-position":we,style:{"--front-toast-height":`${((Q=S[0])==null?void 0:Q.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||XE,"--width":`${JE}px`,"--gap":`${m}px`,...p},onBlur:te=>{C.current&&!te.currentTarget.contains(te.relatedTarget)&&(C.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||C.current||(C.current=!0,A.current=te.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{L||M(!1)},onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},j.filter(te=>!te.position&&Z===0||te.position===N).map((te,K)=>{var he,Re;return F.createElement(sj,{key:te.id,icons:b,index:K,toast:te,defaultRichColors:u,duration:(he=g?.duration)!=null?he:d,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:e,visibleToasts:f,closeButton:(Re=g?.closeButton)!=null?Re:i,interacting:L,position:N,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,removeToast:V,toasts:j.filter(ae=>ae.position==te.position),heights:S.filter(ae=>ae.position==te.position),setHeights:O,expandByDefault:r,gap:m,loadingIcon:x,expanded:D,pauseWhenPageIsHidden:E,cn:T})}))})):null};const oj=({...t})=>{const{theme:e="system"}=DE();return o.jsx(rj,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var ij=Mb.useId||(()=>{}),aj=0;function gn(t){const[e,n]=h.useState(ij());return We(()=>{n(s=>s??String(aj++))},[t]),e?`radix-${e}`:""}const lj=["top","right","bottom","left"],Qn=Math.min,Ft=Math.max,Oi=Math.round,Zo=Math.floor,es=t=>({x:t,y:t}),cj={left:"right",right:"left",bottom:"top",top:"bottom"},uj={start:"end",end:"start"};function Zl(t,e,n){return Ft(t,Qn(e,n))}function Nn(t,e){return typeof t=="function"?t(e):t}function Mn(t){return t.split("-")[0]}function _r(t){return t.split("-")[1]}function vu(t){return t==="x"?"y":"x"}function _u(t){return t==="y"?"height":"width"}function ts(t){return["top","bottom"].includes(Mn(t))?"y":"x"}function yu(t){return vu(ts(t))}function dj(t,e,n){n===void 0&&(n=!1);const s=_r(t),r=yu(t),i=_u(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Di(a)),[a,Di(a)]}function hj(t){const e=Di(t);return[Jl(t),e,Jl(e)]}function Jl(t){return t.replace(/start|end/g,e=>uj[e])}function pj(t,e,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:s:e?s:r;case"left":case"right":return e?i:a;default:return[]}}function fj(t,e,n,s){const r=_r(t);let i=pj(Mn(t),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),e&&(i=i.concat(i.map(Jl)))),i}function Di(t){return t.replace(/left|right|bottom|top/g,e=>cj[e])}function mj(t){return{top:0,right:0,bottom:0,left:0,...t}}function _g(t){return typeof t!="number"?mj(t):{top:t,right:t,bottom:t,left:t}}function Li(t){const{x:e,y:n,width:s,height:r}=t;return{width:s,height:r,top:n,left:e,right:e+s,bottom:n+r,x:e,y:n}}function gh(t,e,n){let{reference:s,floating:r}=t;const i=ts(e),a=yu(e),l=_u(a),c=Mn(e),u=i==="y",d=s.x+s.width/2-r.width/2,p=s.y+s.height/2-r.height/2,f=s[l]/2-r[l]/2;let g;switch(c){case"top":g={x:d,y:s.y-r.height};break;case"bottom":g={x:d,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:p};break;case"left":g={x:s.x-r.width,y:p};break;default:g={x:s.x,y:s.y}}switch(_r(e)){case"start":g[a]-=f*(n&&u?-1:1);break;case"end":g[a]+=f*(n&&u?-1:1);break}return g}const gj=async(t,e,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:p}=gh(u,s,c),f=s,g={},y=0;for(let m=0;m<l.length;m++){const{name:x,fn:b}=l[m],{x:w,y:E,data:T,reset:j}=await b({x:d,y:p,initialPlacement:s,placement:f,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:t,floating:e}});d=w??d,p=E??p,g={...g,[x]:{...g[x],...T}},j&&y<=50&&(y++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:r}):j.rects),{x:d,y:p}=gh(u,f,c)),m=-1)}return{x:d,y:p,placement:f,strategy:r,middlewareData:g}};async function po(t,e){var n;e===void 0&&(e={});const{x:s,y:r,platform:i,rects:a,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=!1,padding:g=0}=Nn(e,t),y=_g(g),x=l[f?p==="floating"?"reference":"floating":p],b=Li(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=p==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),T=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},j=Li(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:E,strategy:c}):w);return{top:(b.top-j.top+y.top)/T.y,bottom:(j.bottom-b.bottom+y.bottom)/T.y,left:(b.left-j.left+y.left)/T.x,right:(j.right-b.right+y.right)/T.x}}const vj=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:r,rects:i,platform:a,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Nn(t,e)||{};if(u==null)return{};const p=_g(d),f={x:n,y:s},g=yu(r),y=_u(g),m=await a.getDimensions(u),x=g==="y",b=x?"top":"left",w=x?"bottom":"right",E=x?"clientHeight":"clientWidth",T=i.reference[y]+i.reference[g]-f[g]-i.floating[y],j=f[g]-i.reference[g],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=P?P[E]:0;(!k||!await(a.isElement==null?void 0:a.isElement(P)))&&(k=l.floating[E]||i.floating[y]);const S=T/2-j/2,O=k/2-m[y]/2-1,D=Qn(p[b],O),M=Qn(p[w],O),L=D,X=k-m[y]-M,I=k/2-m[y]/2+S,Y=Zl(L,I,X),$=!c.arrow&&_r(r)!=null&&I!==Y&&i.reference[y]/2-(I<L?D:M)-m[y]/2<0,H=$?I<L?I-L:I-X:0;return{[g]:f[g]+H,data:{[g]:Y,centerOffset:I-Y-H,...$&&{alignmentOffset:H}},reset:$}}}),_j=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...x}=Nn(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Mn(r),w=ts(l),E=Mn(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=f||(E||!m?[Di(l)]:hj(l)),P=y!=="none";!f&&P&&j.push(...fj(l,m,y,T));const k=[l,...j],S=await po(e,x),O=[];let D=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&O.push(S[b]),p){const I=dj(r,a,T);O.push(S[I[0]],S[I[1]])}if(D=[...D,{placement:r,overflows:O}],!O.every(I=>I<=0)){var M,L;const I=(((M=i.flip)==null?void 0:M.index)||0)+1,Y=k[I];if(Y)return{data:{index:I,overflows:D},reset:{placement:Y}};let $=(L=D.filter(H=>H.overflows[0]<=0).sort((H,A)=>H.overflows[1]-A.overflows[1])[0])==null?void 0:L.placement;if(!$)switch(g){case"bestFit":{var X;const H=(X=D.filter(A=>{if(P){const C=ts(A.placement);return C===w||C==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(C=>C>0).reduce((C,V)=>C+V,0)]).sort((A,C)=>A[1]-C[1])[0])==null?void 0:X[0];H&&($=H);break}case"initialPlacement":$=l;break}if(r!==$)return{reset:{placement:$}}}return{}}}};function vh(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _h(t){return lj.some(e=>t[e]>=0)}const yj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...r}=Nn(t,e);switch(s){case"referenceHidden":{const i=await po(e,{...r,elementContext:"reference"}),a=vh(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:_h(a)}}}case"escaped":{const i=await po(e,{...r,altBoundary:!0}),a=vh(i,n.floating);return{data:{escapedOffsets:a,escaped:_h(a)}}}default:return{}}}}};async function xj(t,e){const{placement:n,platform:s,elements:r}=t,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),a=Mn(n),l=_r(n),c=ts(n)==="y",u=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,p=Nn(e,t);let{mainAxis:f,crossAxis:g,alignmentAxis:y}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof y=="number"&&(g=l==="end"?y*-1:y),c?{x:g*d,y:f*u}:{x:f*u,y:g*d}}const bj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:r,y:i,placement:a,middlewareData:l}=e,c=await xj(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:a}}}}},wj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:r}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...c}=Nn(t,e),u={x:n,y:s},d=await po(e,c),p=ts(Mn(r)),f=vu(p);let g=u[f],y=u[p];if(i){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=g+d[x],E=g-d[b];g=Zl(w,g,E)}if(a){const x=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=y+d[x],E=y-d[b];y=Zl(w,y,E)}const m=l.fn({...e,[f]:g,[p]:y});return{...m,data:{x:m.x-n,y:m.y-s,enabled:{[f]:i,[p]:a}}}}}},Ej=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Nn(t,e),d={x:n,y:s},p=ts(r),f=vu(p);let g=d[f],y=d[p];const m=Nn(l,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const E=f==="y"?"height":"width",T=i.reference[f]-i.floating[E]+x.mainAxis,j=i.reference[f]+i.reference[E]-x.mainAxis;g<T?g=T:g>j&&(g=j)}if(u){var b,w;const E=f==="y"?"width":"height",T=["top","left"].includes(Mn(r)),j=i.reference[p]-i.floating[E]+(T&&((b=a.offset)==null?void 0:b[p])||0)+(T?0:x.crossAxis),P=i.reference[p]+i.reference[E]+(T?0:((w=a.offset)==null?void 0:w[p])||0)-(T?x.crossAxis:0);y<j?y=j:y>P&&(y=P)}return{[f]:g,[p]:y}}}},jj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,s;const{placement:r,rects:i,platform:a,elements:l}=e,{apply:c=()=>{},...u}=Nn(t,e),d=await po(e,u),p=Mn(r),f=_r(r),g=ts(r)==="y",{width:y,height:m}=i.floating;let x,b;p==="top"||p==="bottom"?(x=p,b=f===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,x=f==="end"?"top":"bottom");const w=m-d.top-d.bottom,E=y-d.left-d.right,T=Qn(m-d[x],w),j=Qn(y-d[b],E),P=!e.middlewareData.shift;let k=T,S=j;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(S=E),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(k=w),P&&!f){const D=Ft(d.left,0),M=Ft(d.right,0),L=Ft(d.top,0),X=Ft(d.bottom,0);g?S=y-2*(D!==0||M!==0?D+M:Ft(d.left,d.right)):k=m-2*(L!==0||X!==0?L+X:Ft(d.top,d.bottom))}await c({...e,availableWidth:S,availableHeight:k});const O=await a.getDimensions(l.floating);return y!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function _a(){return typeof window<"u"}function yr(t){return yg(t)?(t.nodeName||"").toLowerCase():"#document"}function Bt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function jn(t){var e;return(e=(yg(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function yg(t){return _a()?t instanceof Node||t instanceof Bt(t).Node:!1}function Jt(t){return _a()?t instanceof Element||t instanceof Bt(t).Element:!1}function wn(t){return _a()?t instanceof HTMLElement||t instanceof Bt(t).HTMLElement:!1}function yh(t){return!_a()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Bt(t).ShadowRoot}function Do(t){const{overflow:e,overflowX:n,overflowY:s,display:r}=Qt(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!["inline","contents"].includes(r)}function Tj(t){return["table","td","th"].includes(yr(t))}function ya(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function xu(t){const e=bu(),n=Jt(t)?Qt(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function Pj(t){let e=ns(t);for(;wn(e)&&!sr(e);){if(xu(e))return e;if(ya(e))return null;e=ns(e)}return null}function bu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function sr(t){return["html","body","#document"].includes(yr(t))}function Qt(t){return Bt(t).getComputedStyle(t)}function xa(t){return Jt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ns(t){if(yr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||yh(t)&&t.host||jn(t);return yh(e)?e.host:e}function xg(t){const e=ns(t);return sr(e)?t.ownerDocument?t.ownerDocument.body:t.body:wn(e)&&Do(e)?e:xg(e)}function fo(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=xg(t),i=r===((s=t.ownerDocument)==null?void 0:s.body),a=Bt(r);if(i){const l=Ql(a);return e.concat(a,a.visualViewport||[],Do(r)?r:[],l&&n?fo(l):[])}return e.concat(r,fo(r,[],n))}function Ql(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function bg(t){const e=Qt(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const r=wn(t),i=r?t.offsetWidth:n,a=r?t.offsetHeight:s,l=Oi(n)!==i||Oi(s)!==a;return l&&(n=i,s=a),{width:n,height:s,$:l}}function wu(t){return Jt(t)?t:t.contextElement}function Zs(t){const e=wu(t);if(!wn(e))return es(1);const n=e.getBoundingClientRect(),{width:s,height:r,$:i}=bg(e);let a=(i?Oi(n.width):n.width)/s,l=(i?Oi(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const kj=es(0);function wg(t){const e=Bt(t);return!bu()||!e.visualViewport?kj:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Sj(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Bt(t)?!1:e}function ys(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=wu(t);let a=es(1);e&&(s?Jt(s)&&(a=Zs(s)):a=Zs(t));const l=Sj(i,n,s)?wg(i):es(0);let c=(r.left+l.x)/a.x,u=(r.top+l.y)/a.y,d=r.width/a.x,p=r.height/a.y;if(i){const f=Bt(i),g=s&&Jt(s)?Bt(s):s;let y=f,m=Ql(y);for(;m&&s&&g!==y;){const x=Zs(m),b=m.getBoundingClientRect(),w=Qt(m),E=b.left+(m.clientLeft+parseFloat(w.paddingLeft))*x.x,T=b.top+(m.clientTop+parseFloat(w.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,p*=x.y,c+=E,u+=T,y=Bt(m),m=Ql(y)}}return Li({width:d,height:p,x:c,y:u})}function Rj(t){let{elements:e,rect:n,offsetParent:s,strategy:r}=t;const i=r==="fixed",a=jn(s),l=e?ya(e.floating):!1;if(s===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=es(1);const d=es(0),p=wn(s);if((p||!p&&!i)&&((yr(s)!=="body"||Do(a))&&(c=xa(s)),wn(s))){const f=ys(s);u=Zs(s),d.x=f.x+s.clientLeft,d.y=f.y+s.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function Aj(t){return Array.from(t.getClientRects())}function ec(t,e){const n=xa(t).scrollLeft;return e?e.left+n:ys(jn(t)).left+n}function Cj(t){const e=jn(t),n=xa(t),s=t.ownerDocument.body,r=Ft(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),i=Ft(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ec(t);const l=-n.scrollTop;return Qt(s).direction==="rtl"&&(a+=Ft(e.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:l}}function Ij(t,e){const n=Bt(t),s=jn(t),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,l=0,c=0;if(r){i=r.width,a=r.height;const u=bu();(!u||u&&e==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:i,height:a,x:l,y:c}}function Oj(t,e){const n=ys(t,!0,e==="fixed"),s=n.top+t.clientTop,r=n.left+t.clientLeft,i=wn(t)?Zs(t):es(1),a=t.clientWidth*i.x,l=t.clientHeight*i.y,c=r*i.x,u=s*i.y;return{width:a,height:l,x:c,y:u}}function xh(t,e,n){let s;if(e==="viewport")s=Ij(t,n);else if(e==="document")s=Cj(jn(t));else if(Jt(e))s=Oj(e,n);else{const r=wg(t);s={...e,x:e.x-r.x,y:e.y-r.y}}return Li(s)}function Eg(t,e){const n=ns(t);return n===e||!Jt(n)||sr(n)?!1:Qt(n).position==="fixed"||Eg(n,e)}function Dj(t,e){const n=e.get(t);if(n)return n;let s=fo(t,[],!1).filter(l=>Jt(l)&&yr(l)!=="body"),r=null;const i=Qt(t).position==="fixed";let a=i?ns(t):t;for(;Jt(a)&&!sr(a);){const l=Qt(a),c=xu(a);!c&&l.position==="fixed"&&(r=null),(i?!c&&!r:!c&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Do(a)&&!c&&Eg(t,a))?s=s.filter(d=>d!==a):r=l,a=ns(a)}return e.set(t,s),s}function Lj(t){let{element:e,boundary:n,rootBoundary:s,strategy:r}=t;const a=[...n==="clippingAncestors"?ya(e)?[]:Dj(e,this._c):[].concat(n),s],l=a[0],c=a.reduce((u,d)=>{const p=xh(e,d,r);return u.top=Ft(p.top,u.top),u.right=Qn(p.right,u.right),u.bottom=Qn(p.bottom,u.bottom),u.left=Ft(p.left,u.left),u},xh(e,l,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nj(t){const{width:e,height:n}=bg(t);return{width:e,height:n}}function Mj(t,e,n){const s=wn(e),r=jn(e),i=n==="fixed",a=ys(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=es(0);if(s||!s&&!i)if((yr(e)!=="body"||Do(r))&&(l=xa(e)),s){const g=ys(e,!0,i,e);c.x=g.x+e.clientLeft,c.y=g.y+e.clientTop}else r&&(c.x=ec(r));let u=0,d=0;if(r&&!s&&!i){const g=r.getBoundingClientRect();d=g.top+l.scrollTop,u=g.left+l.scrollLeft-ec(r,g)}const p=a.left+l.scrollLeft-c.x-u,f=a.top+l.scrollTop-c.y-d;return{x:p,y:f,width:a.width,height:a.height}}function Qa(t){return Qt(t).position==="static"}function bh(t,e){if(!wn(t)||Qt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return jn(t)===n&&(n=n.ownerDocument.body),n}function jg(t,e){const n=Bt(t);if(ya(t))return n;if(!wn(t)){let r=ns(t);for(;r&&!sr(r);){if(Jt(r)&&!Qa(r))return r;r=ns(r)}return n}let s=bh(t,e);for(;s&&Tj(s)&&Qa(s);)s=bh(s,e);return s&&sr(s)&&Qa(s)&&!xu(s)?n:s||Pj(t)||n}const Vj=async function(t){const e=this.getOffsetParent||jg,n=this.getDimensions,s=await n(t.floating);return{reference:Mj(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Fj(t){return Qt(t).direction==="rtl"}const $j={convertOffsetParentRelativeRectToViewportRelativeRect:Rj,getDocumentElement:jn,getClippingRect:Lj,getOffsetParent:jg,getElementRects:Vj,getClientRects:Aj,getDimensions:Nj,getScale:Zs,isElement:Jt,isRTL:Fj};function Bj(t,e){let n=null,s;const r=jn(t);function i(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:p,height:f}=t.getBoundingClientRect();if(l||e(),!p||!f)return;const g=Zo(d),y=Zo(r.clientWidth-(u+p)),m=Zo(r.clientHeight-(d+f)),x=Zo(u),w={rootMargin:-g+"px "+-y+"px "+-m+"px "+-x+"px",threshold:Ft(0,Qn(1,c))||1};let E=!0;function T(j){const P=j[0].intersectionRatio;if(P!==c){if(!E)return a();P?a(!1,P):s=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{n=new IntersectionObserver(T,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(T,w)}n.observe(t)}return a(!0),i}function zj(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=wu(t),d=r||i?[...u?fo(u):[],...fo(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const p=u&&l?Bj(u,n):null;let f=-1,g=null;a&&(g=new ResizeObserver(b=>{let[w]=b;w&&w.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=g)==null||E.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,m=c?ys(t):null;c&&x();function x(){const b=ys(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,y=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),p?.(),(b=g)==null||b.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const Uj=bj,Hj=wj,Wj=_j,Gj=jj,Kj=yj,wh=vj,qj=Ej,Yj=(t,e,n)=>{const s=new Map,r={platform:$j,...n},i={...r.platform,_c:s};return gj(t,e,{...r,platform:i})};var gi=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Ni(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!Ni(t[s],e[s]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&t.$$typeof)&&!Ni(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Tg(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Eh(t,e){const n=Tg(t);return Math.round(e*n)/n}function el(t){const e=h.useRef(t);return gi(()=>{e.current=t}),e}function Xj(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,p]=h.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,g]=h.useState(s);Ni(f,s)||g(s);const[y,m]=h.useState(null),[x,b]=h.useState(null),w=h.useCallback(A=>{A!==P.current&&(P.current=A,m(A))},[]),E=h.useCallback(A=>{A!==k.current&&(k.current=A,b(A))},[]),T=i||y,j=a||x,P=h.useRef(null),k=h.useRef(null),S=h.useRef(d),O=c!=null,D=el(c),M=el(r),L=el(u),X=h.useCallback(()=>{if(!P.current||!k.current)return;const A={placement:e,strategy:n,middleware:f};M.current&&(A.platform=M.current),Yj(P.current,k.current,A).then(C=>{const V={...C,isPositioned:L.current!==!1};I.current&&!Ni(S.current,V)&&(S.current=V,fr.flushSync(()=>{p(V)}))})},[f,e,n,M,L]);gi(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,p(A=>({...A,isPositioned:!1})))},[u]);const I=h.useRef(!1);gi(()=>(I.current=!0,()=>{I.current=!1}),[]),gi(()=>{if(T&&(P.current=T),j&&(k.current=j),T&&j){if(D.current)return D.current(T,j,X);X()}},[T,j,X,D,O]);const Y=h.useMemo(()=>({reference:P,floating:k,setReference:w,setFloating:E}),[w,E]),$=h.useMemo(()=>({reference:T,floating:j}),[T,j]),H=h.useMemo(()=>{const A={position:n,left:0,top:0};if(!$.floating)return A;const C=Eh($.floating,d.x),V=Eh($.floating,d.y);return l?{...A,transform:"translate("+C+"px, "+V+"px)",...Tg($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:C,top:V}},[n,l,$.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:X,refs:Y,elements:$,floatingStyles:H}),[d,X,Y,$,H])}const Zj=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:r}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?wh({element:s.current,padding:r}).fn(n):{}:s?wh({element:s,padding:r}).fn(n):{}}}},Jj=(t,e)=>({...Uj(t),options:[t,e]}),Qj=(t,e)=>({...Hj(t),options:[t,e]}),eT=(t,e)=>({...qj(t),options:[t,e]}),tT=(t,e)=>({...Wj(t),options:[t,e]}),nT=(t,e)=>({...Gj(t),options:[t,e]}),sT=(t,e)=>({...Kj(t),options:[t,e]}),rT=(t,e)=>({...Zj(t),options:[t,e]});var oT="Arrow",Pg=h.forwardRef((t,e)=>{const{children:n,width:s=10,height:r=5,...i}=t;return o.jsx(se.svg,{...i,ref:e,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Pg.displayName=oT;var iT=Pg;function aT(t,e=[]){let n=[];function s(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:g,...y}=p,m=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(m.Provider,{value:x,children:g})}function d(p,f){const g=f?.[t][c]||l,y=h.useContext(g);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const r=()=>{const i=n.map(a=>h.createContext(a));return function(l){const c=l?.[t]||i;return h.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return r.scopeName=t,[s,lT(r,...e)]}function lT(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function cT(t){const[e,n]=h.useState(void 0);return We(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let a,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var Eu="Popper",[kg,xr]=aT(Eu),[uT,Sg]=kg(Eu),Rg=t=>{const{__scopePopper:e,children:n}=t,[s,r]=h.useState(null);return o.jsx(uT,{scope:e,anchor:s,onAnchorChange:r,children:n})};Rg.displayName=Eu;var Ag="PopperAnchor",Cg=h.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...r}=t,i=Sg(Ag,n),a=h.useRef(null),l=_e(e,a);return h.useEffect(()=>{i.onAnchorChange(s?.current||a.current)}),s?null:o.jsx(se.div,{...r,ref:l})});Cg.displayName=Ag;var ju="PopperContent",[dT,hT]=kg(ju),Ig=h.forwardRef((t,e)=>{const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:f=!1,updatePositionStrategy:g="optimized",onPlaced:y,...m}=t,x=Sg(ju,n),[b,w]=h.useState(null),E=_e(e,K=>w(K)),[T,j]=h.useState(null),P=cT(T),k=P?.width??0,S=P?.height??0,O=s+(i!=="center"?"-"+i:""),D=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},M=Array.isArray(u)?u:[u],L=M.length>0,X={padding:D,boundary:M.filter(fT),altBoundary:L},{refs:I,floatingStyles:Y,placement:$,isPositioned:H,middlewareData:A}=Xj({strategy:"fixed",placement:O,whileElementsMounted:(...K)=>zj(...K,{animationFrame:g==="always"}),elements:{reference:x.anchor},middleware:[Jj({mainAxis:r+S,alignmentAxis:a}),c&&Qj({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?eT():void 0,...X}),c&&tT({...X}),nT({...X,apply:({elements:K,rects:he,availableWidth:Re,availableHeight:ae})=>{const{width:ye,height:xe}=he.reference,ze=K.floating.style;ze.setProperty("--radix-popper-available-width",`${Re}px`),ze.setProperty("--radix-popper-available-height",`${ae}px`),ze.setProperty("--radix-popper-anchor-width",`${ye}px`),ze.setProperty("--radix-popper-anchor-height",`${xe}px`)}}),T&&rT({element:T,padding:l}),mT({arrowWidth:k,arrowHeight:S}),f&&sT({strategy:"referenceHidden",...X})]}),[C,V]=Lg($),N=Ye(y);We(()=>{H&&N?.()},[H,N]);const Z=A.arrow?.x,Q=A.arrow?.y,ne=A.arrow?.centerOffset!==0,[we,te]=h.useState();return We(()=>{b&&te(window.getComputedStyle(b).zIndex)},[b]),o.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:H?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[A.transformOrigin?.x,A.transformOrigin?.y].join(" "),...A.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(dT,{scope:n,placedSide:C,onArrowChange:j,arrowX:Z,arrowY:Q,shouldHideArrow:ne,children:o.jsx(se.div,{"data-side":C,"data-align":V,...m,ref:E,style:{...m.style,animation:H?void 0:"none"}})})})});Ig.displayName=ju;var Og="PopperArrow",pT={top:"bottom",right:"left",bottom:"top",left:"right"},Dg=h.forwardRef(function(e,n){const{__scopePopper:s,...r}=e,i=hT(Og,s),a=pT[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(iT,{...r,ref:n,style:{...r.style,display:"block"}})})});Dg.displayName=Og;function fT(t){return t!==null}var mT=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:s,middlewareData:r}=e,a=r.arrow?.centerOffset!==0,l=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[u,d]=Lg(n),p={start:"0%",center:"50%",end:"100%"}[d],f=(r.arrow?.x??0)+l/2,g=(r.arrow?.y??0)+c/2;let y="",m="";return u==="bottom"?(y=a?p:`${f}px`,m=`${-c}px`):u==="top"?(y=a?p:`${f}px`,m=`${s.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=a?p:`${g}px`):u==="left"&&(y=`${s.floating.width+c}px`,m=a?p:`${g}px`),{data:{x:y,y:m}}}});function Lg(t){const[e,n="center"]=t.split("-");return[e,n]}var Tu=Rg,Pu=Cg,ku=Ig,Su=Dg,[ba,rV]=js("Tooltip",[xr]),wa=xr(),Ng="TooltipProvider",gT=700,tc="tooltip.open",[vT,Ru]=ba(Ng),Mg=t=>{const{__scopeTooltip:e,delayDuration:n=gT,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:i}=t,[a,l]=h.useState(!0),c=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),o.jsx(vT,{scope:e,isOpenDelayed:a,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),s)},[s]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(d=>{c.current=d},[]),disableHoverableContent:r,children:i})};Mg.displayName=Ng;var Ea="Tooltip",[_T,Lo]=ba(Ea),Vg=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:r=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=Ru(Ea,t.__scopeTooltip),u=wa(e),[d,p]=h.useState(null),f=gn(),g=h.useRef(0),y=a??c.disableHoverableContent,m=l??c.delayDuration,x=h.useRef(!1),[b=!1,w]=_s({prop:s,defaultProp:r,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(tc))):c.onClose(),i?.(k)}}),E=h.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),T=h.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x.current=!1,w(!0)},[w]),j=h.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w(!1)},[w]),P=h.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,w(!0),g.current=0},m)},[m,w]);return h.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),o.jsx(Tu,{...u,children:o.jsx(_T,{scope:e,contentId:f,open:b,stateAttribute:E,trigger:d,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayed?P():T()},[c.isOpenDelayed,P,T]),onTriggerLeave:h.useCallback(()=>{y?j():(window.clearTimeout(g.current),g.current=0)},[j,y]),onOpen:T,onClose:j,disableHoverableContent:y,children:n})})};Vg.displayName=Ea;var nc="TooltipTrigger",Fg=h.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,r=Lo(nc,n),i=Ru(nc,n),a=wa(n),l=h.useRef(null),c=_e(e,l,r.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),p=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Pu,{asChild:!0,...a,children:o.jsx(se.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:c,onPointerMove:G(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:G(t.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:G(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:G(t.onFocus,()=>{u.current||r.onOpen()}),onBlur:G(t.onBlur,r.onClose),onClick:G(t.onClick,r.onClose)})})});Fg.displayName=nc;var Au="TooltipPortal",[yT,xT]=ba(Au,{forceMount:void 0}),$g=t=>{const{__scopeTooltip:e,forceMount:n,children:s,container:r}=t,i=Lo(Au,e);return o.jsx(yT,{scope:e,forceMount:n,children:o.jsx(nn,{present:n||i.open,children:o.jsx(gr,{asChild:!0,container:r,children:s})})})};$g.displayName=Au;var rr="TooltipContent",Bg=h.forwardRef((t,e)=>{const n=xT(rr,t.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...i}=t,a=Lo(rr,t.__scopeTooltip);return o.jsx(nn,{present:s||a.open,children:a.disableHoverableContent?o.jsx(zg,{side:r,...i,ref:e}):o.jsx(bT,{side:r,...i,ref:e})})}),bT=h.forwardRef((t,e)=>{const n=Lo(rr,t.__scopeTooltip),s=Ru(rr,t.__scopeTooltip),r=h.useRef(null),i=_e(e,r),[a,l]=h.useState(null),{trigger:c,onClose:u}=n,d=r.current,{onPointerInTransitChange:p}=s,f=h.useCallback(()=>{l(null),p(!1)},[p]),g=h.useCallback((y,m)=>{const x=y.currentTarget,b={x:y.clientX,y:y.clientY},w=TT(b,x.getBoundingClientRect()),E=PT(b,w),T=kT(m.getBoundingClientRect()),j=RT([...E,...T]);l(j),p(!0)},[p]);return h.useEffect(()=>()=>f(),[f]),h.useEffect(()=>{if(c&&d){const y=x=>g(x,d),m=x=>g(x,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[c,d,g,f]),h.useEffect(()=>{if(a){const y=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},w=c?.contains(x)||d?.contains(x),E=!ST(b,a);w?f():E&&(f(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,a,u,f]),o.jsx(zg,{...t,ref:i})}),[wT,ET]=ba(Ea,{isInside:!1}),zg=h.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Lo(rr,n),u=wa(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(tc,d),()=>document.removeEventListener(tc,d)),[d]),h.useEffect(()=>{if(c.trigger){const p=f=>{f.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,d]),o.jsx(mr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:o.jsxs(ku,{"data-state":c.stateAttribute,...u,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(Om,{children:s}),o.jsx(wT,{scope:n,isInside:!0,children:o.jsx(yw,{id:c.contentId,role:"tooltip",children:r||s})})]})})});Bg.displayName=rr;var Ug="TooltipArrow",jT=h.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,r=wa(n);return ET(Ug,n).isInside?null:o.jsx(Su,{...r,...s,ref:e})});jT.displayName=Ug;function TT(t,e){const n=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),r=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,s,r,i)){case i:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function PT(t,e,n=5){const s=[];switch(e){case"top":s.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":s.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":s.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":s.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return s}function kT(t){const{top:e,right:n,bottom:s,left:r}=t;return[{x:r,y:e},{x:n,y:e},{x:n,y:s},{x:r,y:s}]}function ST(t,e){const{x:n,y:s}=t;let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i].x,c=e[i].y,u=e[a].x,d=e[a].y;c>s!=d>s&&n<(u-l)*(s-c)/(d-c)+l&&(r=!r)}return r}function RT(t){const e=t.slice();return e.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),AT(e)}function AT(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s<t.length;s++){const r=t[s];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(r.y-a.y)>=(i.y-a.y)*(r.x-a.x))e.pop();else break}e.push(r)}e.pop();const n=[];for(let s=t.length-1;s>=0;s--){const r=t[s];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(r.y-a.y)>=(i.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var CT=Mg,IT=Vg,OT=Fg,DT=$g,Hg=Bg;const LT=CT,NT=IT,MT=OT,Wg=h.forwardRef(({className:t,sideOffset:e=4,...n},s)=>o.jsx(DT,{children:o.jsx(Hg,{ref:s,sideOffset:e,className:ie("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Wg.displayName=Hg.displayName;const VT="https://pldrgdplxacehsmcyjnx.supabase.co",FT="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBsZHJnZHBseGFjZWhzbWN5am54Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDM0MzU5MzEsImV4cCI6MjA1OTAxMTkzMX0.YnKo7pfbjg52NF6TL2pNilHkND5ZgkhbDuAtC_-IQL4",q=$b(VT,FT),oV=async()=>{try{const{data:t,error:e}=await q.functions.invoke("get-stripe-prices");if(e)throw console.error("Error fetching Stripe prices:",e),e;return{prices:t?.prices||[],stripeMode:t?.stripeMode||"test"}}catch(t){throw console.error("Error in getActivePricingTiers:",t),t}},iV=async(t,e,n)=>{try{console.log("Creating Stripe subscription for plan:",t,"currency:",n);const{data:s,error:r}=await q.functions.invoke("create-checkout",{body:{planType:t,currentLanguage:e||"en",currency:n||"GBP"}});if(r)throw console.error("Error creating Stripe subscription:",r),new Error(r.message||"Failed to create Stripe subscription");if(!s||!s.url)throw console.error("No URL returned from Stripe subscription:",s),new Error("Invalid response from server");return console.log("Stripe subscription created successfully:",s),s}catch(s){const r=s instanceof Error?s.message:String(s);throw console.error("Error in Stripe subscription service:",r),s}},aV=async()=>{try{console.log("Creating customer portal session");const{data:t,error:e}=await q.functions.invoke("customer-portal");if(e)throw console.error("Error creating customer portal session:",e),new Error(e.message||"Failed to create customer portal session");if(!t||!t.url)throw console.error("No URL returned from customer portal session:",t),new Error("Invalid response from server");return console.log("Customer portal session created successfully:",t),t}catch(t){const e=t instanceof Error?t.message:String(t);throw console.error("Error in subscription service:",e),t}},$T=async(t=!1)=>{try{console.log("Checking subscription status",t?"(force refresh)":"");const{data:e,error:n}=await q.functions.invoke("check-subscription",{body:t?{forceRefresh:!0,timestamp:new Date().getTime()}:void 0});if(n){const s=n.message||"";if(s.includes("401")||s.includes("Invalid user token")||s.includes("Unauthorized"))return console.warn("Session expired during subscription check, returning null"),null;throw console.error("Error checking subscription status:",n),new Error(s||"Failed to check subscription status")}return console.log("Subscription status checked successfully:",e),e}catch(e){const n=e instanceof Error?e.message:String(e);throw console.error("Error in subscription service:",n),e}};var R=typeof window<"u"?window:void 0,qe=typeof globalThis<"u"?globalThis:R;typeof self>"u"&&(qe.self=qe),typeof File>"u"&&(qe.File=function(){});var Gg=Array.prototype,jh=Gg.forEach,Th=Gg.indexOf,$t=qe?.navigator,B=qe?.document,Ke=qe?.location,sc=qe?.fetch,rc=qe!=null&&qe.XMLHttpRequest&&"withCredentials"in new qe.XMLHttpRequest?qe.XMLHttpRequest:void 0,Ph=qe?.AbortController,Ct=$t?.userAgent,J=R??{},An={DEBUG:!1,LIB_VERSION:"1.354.0"};function kh(t,e,n,s,r,i,a){try{var l=t[i](a),c=l.value}catch(u){return void n(u)}l.done?e(c):Promise.resolve(c).then(s,r)}function Cn(t){return function(){var e=this,n=arguments;return new Promise(function(s,r){var i=t.apply(e,n);function a(c){kh(i,s,r,a,l,"next",c)}function l(c){kh(i,s,r,a,l,"throw",c)}a(void 0)})}}function z(){return z=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},z.apply(null,arguments)}function Kg(t,e){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(e.indexOf(s)!==-1)continue;n[s]=t[s]}return n}var BT=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],zT=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Sh=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return zT.concat(e).some(s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1})};function le(t,e){return t.indexOf(e)!==-1}var ja=function(t){return t.trim()},oc=function(t){return t.replace(/^\$/,"")},UT=Array.isArray,qg=Object.prototype,Yg=qg.hasOwnProperty,Ta=qg.toString,ve=UT||function(t){return Ta.call(t)==="[object Array]"},On=t=>typeof t=="function",Be=t=>t===Object(t)&&!ve(t),zs=t=>{if(Be(t)){for(var e in t)if(Yg.call(t,e))return!1;return!0}return!1},U=t=>t===void 0,Ve=t=>Ta.call(t)=="[object String]",ic=t=>Ve(t)&&t.trim().length===0,sn=t=>t===null,ue=t=>U(t)||sn(t),Vn=t=>Ta.call(t)=="[object Number]"&&t==t,Fs=t=>Vn(t)&&t>0,Ln=t=>Ta.call(t)==="[object Boolean]",HT=t=>t instanceof FormData,WT=t=>le(BT,t);function ac(t){return t===null||typeof t!="object"}function Mi(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function Xg(t){return!U(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var GT=[!0,"true",1,"1","yes"],tl=t=>le(GT,t),KT=[!1,"false",0,"0","no"];function pn(t,e,n,s,r){return e>n&&(s.warn("min cannot be greater than max."),e=n),Vn(t)?t>n?(s.warn(" cannot be  greater than max: "+n+". Using max value instead."),n):t<e?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(s.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),pn(r||n,e,n,s))}class qT{constructor(e){this.t={},this.i=e.i,this.o=pn(e.bucketSize,0,100,e.h),this.m=pn(e.refillRate,0,this.o,e.h),this.$=pn(e.refillInterval,0,864e5,e.h)}S(e,n){var s=n-e.lastAccess,r=Math.floor(s/this.$);if(r>0){var i=r*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+r*this.$}}consumeRateLimit(e){var n,s=Date.now(),r=String(e),i=this.t[r];return i?this.S(i,s):(i={tokens:this.o,lastAccess:s},this.t[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.i)==null||n.call(this,e)),i.tokens===0)}stop(){this.t={}}}var Gt="Mobile",Vi="iOS",Dn="Android",mo="Tablet",Zg=Dn+" "+mo,Jg="iPad",Qg="Apple",ev=Qg+" Watch",go="Safari",or="BlackBerry",tv="Samsung",nv=tv+"Browser",sv=tv+" Internet",xs="Chrome",YT=xs+" OS",rv=xs+" "+Vi,Cu="Internet Explorer",ov=Cu+" "+Gt,Iu="Opera",XT=Iu+" Mini",Ou="Edge",iv="Microsoft "+Ou,Js="Firefox",av=Js+" "+Vi,vo="Nintendo",_o="PlayStation",Qs="Xbox",lv=Dn+" "+Gt,cv=Gt+" "+go,Vr="Windows",lc=Vr+" Phone",Rh="Nokia",cc="Ouya",uv="Generic",ZT=uv+" "+Gt.toLowerCase(),dv=uv+" "+mo.toLowerCase(),uc="Konqueror",St="(\\d+(\\.\\d+)?)",nl=new RegExp("Version/"+St),JT=new RegExp(Qs,"i"),QT=new RegExp(_o+" \\w+","i"),eP=new RegExp(vo+" \\w+","i"),Du=new RegExp(or+"|PlayBook|BB10","i"),tP={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Jo,Ah,sl,nP=(t,e)=>e&&le(e,Qg)||function(n){return le(n,go)&&!le(n,xs)&&!le(n,Dn)}(t),hv=function(t,e){return e=e||"",le(t," OPR/")&&le(t,"Mini")?XT:le(t," OPR/")?Iu:Du.test(t)?or:le(t,"IE"+Gt)||le(t,"WPDesktop")?ov:le(t,nv)?sv:le(t,Ou)||le(t,"Edg/")?iv:le(t,"FBIOS")?"Facebook "+Gt:le(t,"UCWEB")||le(t,"UCBrowser")?"UC Browser":le(t,"CriOS")?rv:le(t,"CrMo")||le(t,xs)?xs:le(t,Dn)&&le(t,go)?lv:le(t,"FxiOS")?av:le(t.toLowerCase(),uc.toLowerCase())?uc:nP(t,e)?le(t,Gt)?cv:go:le(t,Js)?Js:le(t,"MSIE")||le(t,"Trident/")?Cu:le(t,"Gecko")?Js:""},sP={[ov]:[new RegExp("rv:"+St)],[iv]:[new RegExp(Ou+"?\\/"+St)],[xs]:[new RegExp("("+xs+"|CrMo)\\/"+St)],[rv]:[new RegExp("CriOS\\/"+St)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+St)],[go]:[nl],[cv]:[nl],[Iu]:[new RegExp("(Opera|OPR)\\/"+St)],[Js]:[new RegExp(Js+"\\/"+St)],[av]:[new RegExp("FxiOS\\/"+St)],[uc]:[new RegExp("Konqueror[:/]?"+St,"i")],[or]:[new RegExp(or+" "+St),nl],[lv]:[new RegExp("android\\s"+St,"i")],[sv]:[new RegExp(nv+"\\/"+St)],[Cu]:[new RegExp("(rv:|MSIE )"+St)],Mozilla:[new RegExp("rv:"+St)]},rP=function(t,e){var n=hv(t,e),s=sP[n];if(U(s))return null;for(var r=0;r<s.length;r++){var i=s[r],a=t.match(i);if(a)return parseFloat(a[a.length-2])}return null},Ch=[[new RegExp(Qs+"; "+Qs+" (.*?)[);]","i"),t=>[Qs,t&&t[1]||""]],[new RegExp(vo,"i"),[vo,""]],[new RegExp(_o,"i"),[_o,""]],[Du,[or,""]],[new RegExp(Vr,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[lc,""];if(new RegExp(Gt).test(e)&&!/IEMobile\b/.test(e))return[Vr+" "+Gt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var s=n[1],r=tP[s]||"";return/arm/i.test(e)&&(r="RT"),[Vr,r]}return[Vr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Vi,e.join(".")]}return[Vi,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=U(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Dn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Dn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Dn,e.join(".")]}return[Dn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[YT,""]],[/Linux|debian/i,["Linux",""]]],Ih=function(t){return eP.test(t)?vo:QT.test(t)?_o:JT.test(t)?Qs:new RegExp(cc,"i").test(t)?cc:new RegExp("("+lc+"|WPDesktop)","i").test(t)?lc:/iPad/.test(t)?Jg:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ev:Du.test(t)?or:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Rh,"i").test(t)?Rh:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Gt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Dn:Zg:new RegExp("(pda|"+Gt+")","i").test(t)?ZT:new RegExp(mo,"i").test(t)&&!new RegExp(mo+" pc","i").test(t)?dv:""},oP=t=>t instanceof Error;function iP(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return sl&&n.length===Ah||(Ah=n.length,sl=n.reduce((s,r)=>{Jo||(Jo={});var i=Jo[r];if(i)s[i[0]]=i[1];else for(var a=t(r),l=a.length-1;l>=0;l--){var c=a[l],u=c?.filename,d=e[r];if(u&&d){s[u]=d,Jo[r]=[u,d];break}}return s},{})),sl}}class aP{constructor(e,n,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=n,this.modifiers=s}buildFromUnknown(e,n){n===void 0&&(n={});var s=n&&n.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,n,0).apply(e),i=this.buildParsingContext(n),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var n=this;return Cn(function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&ve(s.stacktrace.frames)&&(s.stacktrace.frames=yield n.applyModifiers(s.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),z({},e,{cause:s,stack:r})}applyChunkIds(e,n){return e.map(s=>(s.filename&&n&&(s.chunk_id=n[s.filename]),s))}applyCoercers(e,n){for(var s of this.coercers)if(s.match(e))return s.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return Cn(function*(){var s=e;for(var r of n.modifiers)s=yield r(s);return s})()}convertToExceptionList(e,n){var s,r,i,a={type:e.type,value:e.value,mechanism:{type:(s=n.type)!==null&&s!==void 0?s:"generic",handled:(r=n.handled)===null||r===void 0||r,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var l=[a];return e.cause!=null&&l.push(...this.convertToExceptionList(e.cause,z({},n,{handled:!0}))),l}buildParsingContext(e){var n;return{chunkIdMap:iP(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,s){s===void 0&&(s=0);var r=(i,a)=>{if(a<=4){var l=this.buildCoercingContext(e,n,a);return this.applyCoercers(i,l)}};return z({},n,{syntheticException:s==0?n.syntheticException:void 0,mechanism:e,apply:i=>r(i,s),next:i=>r(i,s+1)})}}var ir="?";function dc(t,e,n,s,r){var i={platform:t,filename:e,function:n==="<anonymous>"?ir:n,in_app:!0};return U(s)||(i.lineno=s),U(r)||(i.colno=r),i}var pv=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,s=t.indexOf("safari-web-extension")!==-1;return n||s?[t.indexOf("@")!==-1?t.split("@")[0]:ir,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},lP=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cP=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uP=/\((\S*)(?::(\d+))(?::(\d+))\)/,dP=(t,e)=>{var n=lP.exec(t);if(n){var[,s,r,i]=n;return dc(e,s,ir,+r,+i)}var a=cP.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=uP.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var[c,u]=pv(a[1]||ir,a[2]);return dc(e,u,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},hP=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pP=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fP=(t,e)=>{var n=hP.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var s=pP.exec(n[3]);s&&(n[1]=n[1]||"eval",n[3]=s[1],n[4]=s[2],n[5]="")}var r=n[3],i=n[1]||ir;return[i,r]=pv(i,r),dc(e,r,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Oh=/\(error: (.*)\)/,Dh=50;function mP(){return function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return function(r,i){i===void 0&&(i=0);for(var a=[],l=r.split(`
`),c=i;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var d=Oh.test(u)?u.replace(Oh,"$1"):u;if(!d.match(/\S*Error: /)){for(var p of n){var f=p(d,t);if(f){a.push(f);break}}if(a.length>=Dh)break}}}return function(g){if(!g.length)return[];var y=Array.from(g);return y.reverse(),y.slice(0,Dh).map(m=>{return z({},m,{filename:m.filename||(x=y,x[x.length-1]||{}).filename,function:m.function||ir});var x})}(a)}}("web:javascript",dP,fP)}class gP{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var s=Ve(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return Mi(e,"DOMException")}isDOMError(e){return Mi(e,"DOMError")}}class vP{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var s=e.message;return s.error&&typeof s.error.message=="string"?String(s.error.message):String(s)}getStack(e){return e.stacktrace||e.stack||void 0}}class _P{constructor(){}match(e){return Mi(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var s,r=n.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var yP=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class xP{match(e){return typeof e=="string"}coerce(e,n){var s,[r,i]=this.getInfos(e);return{type:r??"Error",value:i??e,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var n="Error",s=e,r=e.match(yP);return r&&(n=r[1],s=r[2]),[n,s]}}var bP=["fatal","error","warning","log","info","debug"];function fv(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var s=n.length;s>0;s--){var r=n.slice(0,s).join(", ");if(!(r.length>e))return s===n.length||r.length<=e?r:r.slice(0,e)+"..."}return""}class wP{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var s,r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=n.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Xg(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+fv(e)}isSeverityLevel(e){return Ve(e)&&!ic(e)&&bP.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];if(oP(s))return s}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class EP{match(e){return Xg(e)}coerce(e,n){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+fv(e),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class jP{match(e){return ac(e)}coerce(e,n){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class TP{match(e){return Mi(e,"PromiseRejectionEvent")}coerce(e,n){var s,r=this.getUnhandledRejectionReason(e);return ac(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}:n.apply(r)}getUnhandledRejectionReason(e){if(ac(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var mv=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,s={k:function(r){if(R&&(An.DEBUG||J.POSTHOG_DEBUG||n)&&!U(R.console)&&R.console){for(var i=("__rrweb_original__"in R.console[r])?R.console[r].__rrweb_original__:R.console[r],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];i(t,...l)}},info:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];s.k("log",...i)},warn:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];s.k("warn",...i)},error:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];s.k("error",...i)},critical:function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning:r=>{s.error("You must initialize PostHog before calling "+r)},createLogger:(r,i)=>mv(t+" "+r,i)};return s},W=mv("[PostHog.js]"),Ie=W.createLogger,PP=Ie("[ExternalScriptsLoader]"),Lh=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return PP.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var s=B?.querySelectorAll("script");if(s){for(var r,i=function(){if(s[a].src===e){var c=s[a];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",u=>{c.__posthog_loading_callback_fired=!0,n(void 0,u)}),c.onerror=u=>n(u),{v:void 0})}},a=0;a<s.length;a++)if(r=i())return r.v}var l=()=>{if(!B)return n("document not found");var c=B.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=e,c.onload=p=>{c.__posthog_loading_callback_fired=!0,n(void 0,p)},c.onerror=p=>n(p),t.config.prepare_external_dependency_script&&(c=t.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")B.head.appendChild(c);else{var u,d=B.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):B.body.appendChild(c)}};B!=null&&B.body?l():B?.addEventListener("DOMContentLoaded",l)};J.__PosthogExtensions__=J.__PosthogExtensions__||{},J.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var s="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(s="/array/"+t.config.token+"/config.js"),e==="toolbar"){var r=3e5;s=s+"&t="+Math.floor(Date.now()/r)*r}var i=t.requestRouter.endpointFor("assets",s);Lh(t,i,n)},J.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var s=t.requestRouter.endpointFor("api",e);Lh(t,s,n)};var Fi={};function Xn(t,e,n){if(ve(t)){if(jh&&t.forEach===jh)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var s=0,r=t.length;s<r;s++)if(s in t&&e.call(n,t[s],s)===Fi)return}}}function je(t,e,n){if(!ue(t)){if(ve(t))return Xn(t,e,n);if(HT(t)){for(var s of t.entries())if(e.call(n,s[1],s[0])===Fi)return}else for(var r in t)if(Yg.call(t,r)&&e.call(n,t[r],r)===Fi)return}}var Ne=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return Xn(n,function(r){for(var i in r)r[i]!==void 0&&(t[i]=r[i])}),t},ar=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return Xn(n,function(r){Xn(r,function(i){t.push(i)})}),t};function vi(t){for(var e=Object.keys(t),n=e.length,s=new Array(n);n--;)s[n]=[e[n],t[e[n]]];return s}var Nh=function(t){try{return t()}catch{return}},kP=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return t.apply(this,n)}catch(r){W.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),W.critical(r)}}},Lu=function(t){var e={};return je(t,function(n,s){(Ve(n)&&n.length>0||Vn(n))&&(e[s]=n)}),e};function SP(t,e){return n=t,s=i=>Ve(i)&&!sn(e)?i.slice(0,e):i,r=new Set,function i(a,l){return a!==Object(a)?s?s(a,l):a:r.has(a)?void 0:(r.add(a),ve(a)?(c=[],Xn(a,u=>{c.push(i(u))})):(c={},je(a,(u,d)=>{r.has(u)||(c[d]=i(u,d))})),c);var c}(n);var n,s,r}var RP=["herokuapp.com","vercel.app","netlify.app"];function AP(t){var e=t?.hostname;if(!Ve(e))return!1;var n=e.split(".").slice(-2).join(".");for(var s of RP)if(n===s)return!1;return!0}function gv(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Me(t,e,n,s){var{capture:r=!1,passive:i=!0}=s??{};t?.addEventListener(e,n,{capture:r,passive:i})}function vv(t){return t.name==="ph_toolbar_internal"}var _v="$people_distinct_id",Fr="__alias",$r="__timers",Mh="$autocapture_disabled_server_side",hc="$heatmaps_enabled_server_side",Vh="$exception_capture_enabled_server_side",pc="$error_tracking_suppression_rules",Fh="$error_tracking_capture_extension_exceptions",$h="$web_vitals_enabled_server_side",yv="$dead_clicks_enabled_server_side",Bh="$product_tours_enabled_server_side",zh="$web_vitals_allowed_metrics",Qo="$session_recording_remote_config",$i="$sesid",xv="$session_is_sampled",Us="$enabled_feature_flags",Br="$early_access_features",fc="$feature_flag_details",zr="$stored_person_properties",hs="$stored_group_properties",mc="$surveys",Bi="$flag_call_reported",gc="$feature_flag_errors",ln="$user_state",vc="$client_session_props",_c="$capture_rate_limit",yc="$initial_campaign_params",xc="$initial_referrer_info",zi="$initial_person_info",Ui="$epp",bv="__POSTHOG_TOOLBAR__",Sr="$posthog_cookieless",CP=[_v,Fr,"__cmpns",$r,"$session_recording_enabled_server_side",hc,$i,Us,pc,ln,Br,fc,hs,zr,mc,Bi,gc,vc,_c,yc,xc,Ui,zi];Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Vn(t)&&isFinite(t)&&Math.floor(t)===t});var Uh="0123456789abcdef";class Hi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,s,r){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||e<0||n<0||s<0||r<0||e>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new Hi(i)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+Uh.charAt(this.bytes[n]>>>4)+Uh.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Hi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var s=this.bytes[n]-e.bytes[n];if(s!==0)return Math.sign(s)}return 0}}class IP{constructor(){this.P=0,this.T=0,this.I=new OP}generate(){var e=this.generateOrAbort();if(U(e)){this.P=0;var n=this.generateOrAbort();if(U(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.C();else{if(!(e+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.C())}return Hi.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.I.nextUint32())}C(){this.T=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Hh,wv=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};R&&!U(R.crypto)&&crypto.getRandomValues&&(wv=t=>crypto.getRandomValues(t));class OP{constructor(){this.R=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.R.length&&(wv(this.R),this.F=0),this.R[this.F++]}}var Yn=()=>DP().toString(),DP=()=>(Hh||(Hh=new IP)).generate(),Rr="",LP=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function NP(t,e){if(e){var n=function(r,i){if(i===void 0&&(i=B),Rr)return Rr;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),l=Math.min(a.length,8),c="dmn_chk_"+Yn();!Rr&&l--;){var u=a.slice(l).join("."),d=c+"=1;domain=."+u+";path=/";i.cookie=d+";max-age=3",i.cookie.includes(c)&&(i.cookie=d+";max-age=0",Rr=u)}return Rr}(t);if(!n){var s=(r=>{var i=r.match(LP);return i?i[0]:""})(t);s!==n&&W.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var cn={O:()=>!!B,M:function(t){W.error("cookieStore error: "+t)},A:function(t){if(B){try{for(var e=t+"=",n=B.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},j:function(t){var e;try{e=JSON.parse(cn.A(t))||{}}catch{}return e},D:function(t,e,n,s,r){if(B)try{var i="",a="",l=NP(B.location.hostname,s);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),i="; expires="+c.toUTCString()}r&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&W.warn("cookieStore warning: large cookie, len="+u.length),B.cookie=u,u}catch{return}},L:function(t,e){if(B!=null&&B.cookie)try{cn.D(t,"",-1,e)}catch{return}}},rl=null,Ae={O:function(){if(!sn(rl))return rl;var t=!0;if(U(R))t=!1;else try{var e="__mplssupport__";Ae.D(e,"xyz"),Ae.A(e)!=='"xyz"'&&(t=!1),Ae.L(e)}catch{t=!1}return t||W.error("localStorage unsupported; falling back to cookie store"),rl=t,t},M:function(t){W.error("localStorage error: "+t)},A:function(t){try{return R?.localStorage.getItem(t)}catch(e){Ae.M(e)}return null},j:function(t){try{return JSON.parse(Ae.A(t))||{}}catch{}return null},D:function(t,e){try{R?.localStorage.setItem(t,JSON.stringify(e))}catch(n){Ae.M(n)}},L:function(t){try{R?.localStorage.removeItem(t)}catch(e){Ae.M(e)}}},MP=["$device_id","distinct_id",$i,xv,Ui,zi,ln],ei={},VP={O:function(){return!0},M:function(t){W.error("memoryStorage error: "+t)},A:function(t){return ei[t]||null},j:function(t){return ei[t]||null},D:function(t,e){ei[t]=e},L:function(t){delete ei[t]}},cs=null,Ge={O:function(){if(!sn(cs))return cs;if(cs=!0,U(R))cs=!1;else try{var t="__support__";Ge.D(t,"xyz"),Ge.A(t)!=='"xyz"'&&(cs=!1),Ge.L(t)}catch{cs=!1}return cs},M:function(t){W.error("sessionStorage error: ",t)},A:function(t){try{return R?.sessionStorage.getItem(t)}catch(e){Ge.M(e)}return null},j:function(t){try{return JSON.parse(Ge.A(t))||null}catch{}return null},D:function(t,e){try{R?.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){Ge.M(n)}},L:function(t){try{R?.sessionStorage.removeItem(t)}catch(e){Ge.M(e)}}},In=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class FP{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.U()?In.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===In.DENIED||this.consent===In.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===In.DENIED}optInOut(e){this.B.D(this.q,e?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.L(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:s}=this._instance.config;return s||(n?n+e:"__ph_opt_in_out_"+e)}get H(){var e=this.B.A(this.q);return tl(e)?In.GRANTED:le(KT,e)?In.DENIED:In.PENDING}get B(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W=e==="localStorage"?Ae:cn;var n=e==="localStorage"?cn:Ae;n.A(this.q)&&(this.W.A(this.q)||this.optInOut(tl(n.A(this.q))),n.L(this.q,this.N.cross_subdomain_cookie))}return this.W}U(){return!!this.N.respect_dnt&&!!gv([$t?.doNotTrack,$t?.msDoNotTrack,J.doNotTrack],e=>tl(e))}}var ti=Ie("[Dead Clicks]"),$P=()=>!0,BP=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(yv)),s=t.instance.config.capture_dead_clicks;return Ln(s)?s:!!Be(s)||n};class Wh{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(e,n,s){this.instance=e,this.isEnabled=n,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[yv]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.V(()=>{this.J()}):this.stop()}V(e){var n,s;(n=J.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?ti.error("failed to load script",r):e()})}J(){var e;if(B){if(!this.G&&(e=J.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=Be(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.G=J.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.G.start(B),ti.info("starting...")}}else ti.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,ti.info("stopping..."))}}var ol=Ie("[SegmentIntegration]");function zP(t,e){var n=t.config.segment;if(!n)return e();(function(s,r){var i=s.config.segment;if(!i)return r();var a=c=>{var u=()=>c.anonymousId()||Yn();s.config.get_device_id=u,c.id()&&(s.register({distinct_id:c.id(),$device_id:u()}),s.persistence.set_property(ln,"identified")),r()},l=i.user();"then"in l&&On(l.then)?l.then(a):a(l)})(t,()=>{n.register((s=>{Promise&&Promise.resolve||ol.warn("This browser does not have Promise support, and can not use the segment integration");var r=(i,a)=>{if(!a)return i;i.event.userId||i.event.anonymousId===s.get_distinct_id()||(ol.info("No userId set, resetting PostHog"),s.reset()),i.event.userId&&i.event.userId!==s.get_distinct_id()&&(ol.info("UserId set, identifying with PostHog"),s.identify(i.event.userId));var l=s.calculateEventProperties(a,i.event.properties);return i.event.properties=Object.assign({},l,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:i=>r(i,i.event.event),page:i=>r(i,"$pageview"),identify:i=>r(i,"$identify"),screen:i=>r(i,"$screen")}})(t)).then(()=>{e()})})}var Ev="posthog-js";function jv(t,e){var{organization:n,projectId:s,prefix:r,severityAllowList:i=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return l=>{var c,u,d,p,f;if(!(i==="*"||i.includes(l.level))||!t.__loaded)return l;l.tags||(l.tags={});var g=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());l.tags["PostHog Person URL"]=g,t.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var y=((c=l.exception)==null?void 0:c.values)||[],m=y.map(b=>z({},b,{stacktrace:b.stacktrace?z({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map(w=>z({},w,{platform:"web:javascript"}))}):void 0})),x={$exception_message:((u=y[0])==null?void 0:u.value)||l.message,$exception_type:(d=y[0])==null?void 0:d.type,$exception_level:l.level,$exception_list:m,$sentry_event_id:l.event_id,$sentry_exception:l.exception,$sentry_exception_message:((p=y[0])==null?void 0:p.value)||l.message,$sentry_exception_type:(f=y[0])==null?void 0:f.type,$sentry_tags:l.tags};return n&&s&&(x.$sentry_url=(r||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+l.event_id),a&&t.exceptions.sendExceptionEvent(x),l}}class UP{constructor(e,n,s,r,i,a){this.name=Ev,this.setupOnce=function(l){l(jv(e,{organization:n,projectId:s,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}var Wi=t=>{var e=B?.createElement("a");return U(e)?null:(e.href=t,e)},HP=function(t,e){var n,s;e===void 0&&(e="&");var r=[];return je(t,function(i,a){U(i)||U(a)||a==="undefined"||(n=encodeURIComponent((l=>l instanceof File)(i)?i.name:i.toString()),s=encodeURIComponent(a),r[r.length]=s+"="+n)}),r.join(e)},Gi=function(t,e){for(var n,s=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===e){n=i;break}}if(!ve(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{W.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},yo=function(t,e,n){if(!t||!e||!e.length)return t;for(var s=t.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),l=a[1],c=a[0],u=(l||"").split("&"),d=[],p=0;p<u.length;p++){var f=u[p].split("=");ve(f)&&(e.includes(f[0])?d.push(f[0]+"="+n):d.push(u[p]))}var g=c;return l!=null&&(g+="?"+d.join("&")),i!=null&&(g+="#"+i),g},Ki=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},WP=R!=null&&R.location?Ki(R.location.hash,"__posthog")||Ki(location.hash,"state"):null,Gh="_postHogToolbarParams",Kh=Ie("[Toolbar]"),Wn=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Wn||{});class GP{constructor(e){this.instance=e}K(e){J.ph_toolbar_state=e}Y(){var e;return(e=J.ph_toolbar_state)!==null&&e!==void 0?e:Wn.UNINITIALIZED}maybeLoadToolbar(e,n,s){if(e===void 0&&(e=void 0),n===void 0&&(n=void 0),s===void 0&&(s=void 0),vv(this.instance.config)||!R||!B)return!1;e=e??R.location,s=s??R.history;try{if(!n){try{R.localStorage.setItem("test","test"),R.localStorage.removeItem("test")}catch{return!1}n=R?.localStorage}var r,i=WP||Ki(e.hash,"__posthog")||Ki(e.hash,"state"),a=i?Nh(()=>JSON.parse(atob(decodeURIComponent(i))))||Nh(()=>JSON.parse(decodeURIComponent(i))):null;return a&&a.action==="ph_authorize"?((r=a).source="url",r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(n.getItem(Gh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}X(e){var n=J.ph_load_toolbar||J.ph_load_editor;!ue(n)&&On(n)?n(e,this.instance):Kh.warn("No toolbar load function found")}loadToolbar(e){var n=!(B==null||!B.getElementById(bv));if(!R||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=z({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(R.localStorage.setItem(Gh,JSON.stringify(z({},r,{source:void 0}))),this.Y()===Wn.LOADED)this.X(r);else if(this.Y()===Wn.UNINITIALIZED){var i;this.K(Wn.LOADING),(i=J.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return Kh.error("[Toolbar] Failed to load",a),void this.K(Wn.UNINITIALIZED);this.K(Wn.LOADED),this.X(r)}),Me(R,"turbolinks:load",()=>{this.K(Wn.UNINITIALIZED),this.loadToolbar(r)})}return!0}Z(e){return this.loadToolbar(e)}maybeLoadEditor(e,n,s){return e===void 0&&(e=void 0),n===void 0&&(n=void 0),s===void 0&&(s=void 0),this.maybeLoadToolbar(e,n,s)}}class qh{constructor(e){this.tt=(n,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(W.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:r}),this.it=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.et()}et(){var e;this.rt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.tt)}destroy(){var e;(e=this.rt)==null||e.call(this),this.rt=void 0}doPageView(e,n){var s,r=this.st(e,n);return this.it={pathname:(s=R?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var n;return this.st(e,(n=this.it)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.it)==null?void 0:e.pageViewId}}st(e,n){var s=this.it;if(!s)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:s.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:l,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:p}=i;if(!(U(a)||U(l)||U(c)||U(u)||U(d)||U(p))){a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),p=Math.ceil(p);var f=a<=1?1:pn(l/a,0,1,W),g=a<=1?1:pn(c/a,0,1,W),y=u<=1?1:pn(d/u,0,1,W),m=u<=1?1:pn(p/u,0,1,W);r=Ne(r,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:m})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var un=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Kt=Uint8Array,It=Uint16Array,lr=Uint32Array,Nu=new Kt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mu=new Kt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Yh=new Kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tv=function(t,e){for(var n=new It(31),s=0;s<31;++s)n[s]=e+=1<<t[s-1];var r=new lr(n[30]);for(s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return[n,r]},Pv=Tv(Nu,2),KP=Pv[0],bc=Pv[1];KP[28]=258,bc[258]=28;for(var Xh=Tv(Mu,0)[1],kv=new It(32768),ke=0;ke<32768;++ke){var us=(43690&ke)>>>1|(21845&ke)<<1;us=(61680&(us=(52428&us)>>>2|(13107&us)<<2))>>>4|(3855&us)<<4,kv[ke]=((65280&us)>>>8|(255&us)<<8)>>>1}var Jr=function(t,e,n){for(var s=t.length,r=0,i=new It(e);r<s;++r)++i[t[r]-1];var a,l=new It(e);for(r=0;r<e;++r)l[r]=l[r-1]+i[r-1]<<1;for(a=new It(s),r=0;r<s;++r)a[r]=kv[l[t[r]-1]++]>>>15-t[r];return a},bs=new Kt(288);for(ke=0;ke<144;++ke)bs[ke]=8;for(ke=144;ke<256;++ke)bs[ke]=9;for(ke=256;ke<280;++ke)bs[ke]=7;for(ke=280;ke<288;++ke)bs[ke]=8;var qi=new Kt(32);for(ke=0;ke<32;++ke)qi[ke]=5;var qP=Jr(bs,9),YP=Jr(qi,5),Sv=function(t){return(t/8>>0)+(7&t&&1)},Rv=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var s=new(t instanceof It?It:t instanceof lr?lr:Kt)(n-e);return s.set(t.subarray(e,n)),s},Sn=function(t,e,n){n<<=7&e;var s=e/8>>0;t[s]|=n,t[s+1]|=n>>>8},Ar=function(t,e,n){n<<=7&e;var s=e/8>>0;t[s]|=n,t[s+1]|=n>>>8,t[s+2]|=n>>>16},il=function(t,e){for(var n=[],s=0;s<t.length;++s)t[s]&&n.push({s,f:t[s]});var r=n.length,i=n.slice();if(!r)return[new Kt(0),0];if(r==1){var a=new Kt(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(j,P){return j.f-P.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,p=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=r-1;)l=n[n[u].f<n[p].f?u++:p++],c=n[u!=d&&n[u].f<n[p].f?u++:p++],n[d++]={s:-1,f:l.f+c.f,l,r:c};var f=i[0].s;for(s=1;s<r;++s)i[s].s>f&&(f=i[s].s);var g=new It(f+1),y=wc(n[d-1],g,0);if(y>e){s=0;var m=0,x=y-e,b=1<<x;for(i.sort(function(j,P){return g[P.s]-g[j.s]||j.f-P.f});s<r;++s){var w=i[s].s;if(!(g[w]>e))break;m+=b-(1<<y-g[w]),g[w]=e}for(m>>>=x;m>0;){var E=i[s].s;g[E]<e?m-=1<<e-g[E]++-1:++s}for(;s>=0&&m;--s){var T=i[s].s;g[T]==e&&(--g[T],++m)}y=e}return[new Kt(g),y]},wc=function(t,e,n){return t.s==-1?Math.max(wc(t.l,e,n+1),wc(t.r,e,n+1)):e[t.s]=n},Zh=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new It(++e),s=0,r=t[0],i=1,a=function(c){n[s++]=c},l=1;l<=e;++l)if(t[l]==r&&l!=e)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=t[l]}return[n.subarray(0,s),e]},Cr=function(t,e){for(var n=0,s=0;s<e.length;++s)n+=t[s]*e[s];return n},Ec=function(t,e,n){var s=n.length,r=Sv(e+2);t[r]=255&s,t[r+1]=s>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var i=0;i<s;++i)t[r+i+4]=n[i];return 8*(r+4+s)},Jh=function(t,e,n,s,r,i,a,l,c,u,d){Sn(e,d++,n),++r[256];for(var p=il(r,15),f=p[0],g=p[1],y=il(i,15),m=y[0],x=y[1],b=Zh(f),w=b[0],E=b[1],T=Zh(m),j=T[0],P=T[1],k=new It(19),S=0;S<w.length;++S)k[31&w[S]]++;for(S=0;S<j.length;++S)k[31&j[S]]++;for(var O=il(k,7),D=O[0],M=O[1],L=19;L>4&&!D[Yh[L-1]];--L);var X,I,Y,$,H=u+5<<3,A=Cr(r,bs)+Cr(i,qi)+a,C=Cr(r,f)+Cr(i,m)+a+14+3*L+Cr(k,D)+(2*k[16]+3*k[17]+7*k[18]);if(H<=A&&H<=C)return Ec(e,d,t.subarray(c,c+u));if(Sn(e,d,1+(C<A)),d+=2,C<A){X=Jr(f,g),I=f,Y=Jr(m,x),$=m;var V=Jr(D,M);for(Sn(e,d,E-257),Sn(e,d+5,P-1),Sn(e,d+10,L-4),d+=14,S=0;S<L;++S)Sn(e,d+3*S,D[Yh[S]]);d+=3*L;for(var N=[w,j],Z=0;Z<2;++Z){var Q=N[Z];for(S=0;S<Q.length;++S){var ne=31&Q[S];Sn(e,d,V[ne]),d+=D[ne],ne>15&&(Sn(e,d,Q[S]>>>5&127),d+=Q[S]>>>12)}}}else X=qP,I=bs,Y=YP,$=qi;for(S=0;S<l;++S)if(s[S]>255){ne=s[S]>>>18&31,Ar(e,d,X[ne+257]),d+=I[ne+257],ne>7&&(Sn(e,d,s[S]>>>23&31),d+=Nu[ne]);var we=31&s[S];Ar(e,d,Y[we]),d+=$[we],we>3&&(Ar(e,d,s[S]>>>5&8191),d+=Mu[we])}else Ar(e,d,X[s[S]]),d+=I[s[S]];return Ar(e,d,X[256]),d+I[256]},XP=new lr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ZP=function(){for(var t=new lr(256),e=0;e<256;++e){for(var n=e,s=9;--s;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),JP=function(t,e,n,s,r){return function(i,a,l,c,u,d){var p=i.length,f=new Kt(c+p+5*(1+Math.floor(p/7e3))+u),g=f.subarray(c,f.length-u),y=0;if(!a||p<8)for(var m=0;m<=p;m+=65535){var x=m+65535;x<p?y=Ec(g,y,i.subarray(m,x)):(g[m]=d,y=Ec(g,y,i.subarray(m,p)))}else{for(var b=XP[a-1],w=b>>>13,E=8191&b,T=(1<<l)-1,j=new It(32768),P=new It(T+1),k=Math.ceil(l/3),S=2*k,O=function(Pn){return(i[Pn]^i[Pn+1]<<k^i[Pn+2]<<S)&T},D=new lr(25e3),M=new It(288),L=new It(32),X=0,I=0,Y=(m=0,0),$=0,H=0;m<p;++m){var A=O(m),C=32767&m,V=P[A];if(j[C]=V,P[A]=C,$<=m){var N=p-m;if((X>7e3||Y>24576)&&N>423){y=Jh(i,g,0,D,M,L,I,Y,H,m-H,y),Y=X=I=0,H=m;for(var Z=0;Z<286;++Z)M[Z]=0;for(Z=0;Z<30;++Z)L[Z]=0}var Q=2,ne=0,we=E,te=C-V&32767;if(N>2&&A==O(m-te))for(var K=Math.min(w,N)-1,he=Math.min(32767,m),Re=Math.min(258,N);te<=he&&--we&&C!=V;){if(i[m+Q]==i[m+Q-te]){for(var ae=0;ae<Re&&i[m+ae]==i[m+ae-te];++ae);if(ae>Q){if(Q=ae,ne=te,ae>K)break;var ye=Math.min(te,ae-2),xe=0;for(Z=0;Z<ye;++Z){var ze=m-te+Z+32768&32767,Lt=ze-j[ze]+32768&32767;Lt>xe&&(xe=Lt,V=ze)}}}te+=(C=V)-(V=j[C])+32768&32767}if(ne){D[Y++]=268435456|bc[Q]<<18|Xh[ne];var Tn=31&bc[Q],Nt=31&Xh[ne];I+=Nu[Tn]+Mu[Nt],++M[257+Tn],++L[Nt],$=m+Q,++X}else D[Y++]=i[m],++M[i[m]]}}y=Jh(i,g,d,D,M,L,I,Y,H,m-H,y)}return Rv(f,0,c+Sv(y)+u)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,s,!0)},al=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function QP(t,e){e===void 0&&(e={});var n=function(){var l=4294967295;return{p:function(c){for(var u=l,d=0;d<c.length;++d)u=ZP[255&u^c[d]]^u>>>8;l=u},d:function(){return 4294967295^l}}}(),s=t.length;n.p(t);var r,i=JP(t,e,10+((r=e).filename&&r.filename.length+1||0),8),a=i.length;return function(l,c){var u=c.filename;if(l[0]=31,l[1]=139,l[2]=8,l[8]=c.level<2?4:c.level==9?2:0,l[9]=3,c.mtime!=0&&al(l,4,Math.floor(new Date(c.mtime||Date.now())/1e3)),u){l[3]=8;for(var d=0;d<=u.length;++d)l[d+10]=u.charCodeAt(d)}}(i,e),al(i,a-8,n.d()),al(i,a-4,s),i}var ek=function(t){var e,n,s,r,i="";for(e=n=0,s=(t=(t+"").replace(/\r\n/g,`
`).replace(/\r/g,`
`)).length,r=0;r<s;r++){var a=t.charCodeAt(r),l=null;a<128?n++:l=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),sn(l)||(n>e&&(i+=t.substring(e,n)),i+=l,e=n=r+1)}return n>e&&(i+=t.substring(e,t.length)),i},tk=!!rc||!!sc,Qh="text/plain",Yi=function(t,e,n){var s;n===void 0&&(n=!0);var[r,i]=t.split("?"),a=z({},e),l=(s=i?.split("&").map(u=>{var d,[p,f]=u.split("="),g=n&&(d=a[p])!==null&&d!==void 0?d:f;return delete a[p],p+"="+g}))!==null&&s!==void 0?s:[],c=HP(a);return c&&l.push(c),r+"?"+l.join("&")},Ur=(t,e)=>JSON.stringify(t,(n,s)=>typeof s=="bigint"?s.toString():s,e),ll=t=>{var{data:e,compression:n}=t;if(e){if(n===un.GZipJS){var s=QP(function(c,u){var d=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var p=new Kt(c.length+(c.length>>>1)),f=0,g=function(b){p[f++]=b},y=0;y<d;++y){if(f+5>p.length){var m=new Kt(f+8+(d-y<<1));m.set(p),p=m}var x=c.charCodeAt(y);x<128||u?g(x):x<2048?(g(192|x>>>6),g(128|63&x)):x>55295&&x<57344?(g(240|(x=65536+(1047552&x)|1023&c.charCodeAt(++y))>>>18),g(128|x>>>12&63),g(128|x>>>6&63),g(128|63&x)):(g(224|x>>>12),g(128|x>>>6&63),g(128|63&x))}return Rv(p,0,f)}(Ur(e)),{mtime:0}),r=new Blob([s],{type:Qh});return{contentType:Qh,body:r,estimatedSize:r.size}}if(n===un.Base64){var i=function(c){var u,d,p,f,g,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,x=0,b="",w=[];if(!c)return c;c=ek(c);do u=(g=c.charCodeAt(m++)<<16|c.charCodeAt(m++)<<8|c.charCodeAt(m++))>>18&63,d=g>>12&63,p=g>>6&63,f=63&g,w[x++]=y.charAt(u)+y.charAt(d)+y.charAt(p)+y.charAt(f);while(m<c.length);switch(b=w.join(""),c.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(Ur(e)),a=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Ur(c)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=Ur(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},_i=[];sc&&_i.push({transport:"fetch",method:t=>{var e,n,{contentType:s,body:r,estimatedSize:i}=(e=ll(t))!==null&&e!==void 0?e:{},a=new Headers;je(t.headers,function(d,p){a.append(p,d)}),s&&a.append("Content-Type",s);var l=t.url,c=null;if(Ph){var u=new Ph;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}sc(l,z({method:t?.method||"GET",headers:a,keepalive:t.method==="POST"&&(i||0)<52428.8,body:r,signal:(n=c)==null?void 0:n.signal},t.fetchOptions)).then(d=>d.text().then(p=>{var f={statusCode:d.status,text:p};if(d.status===200)try{f.json=JSON.parse(p)}catch(g){W.error(g)}t.callback==null||t.callback(f)})).catch(d=>{W.error(d),t.callback==null||t.callback({statusCode:0,error:d})}).finally(()=>c?clearTimeout(c.timeout):null)}}),rc&&_i.push({transport:"XHR",method:t=>{var e,n=new rc;n.open(t.method||"GET",t.url,!0);var{contentType:s,body:r}=(e=ll(t))!==null&&e!==void 0?e:{};je(t.headers,function(i,a){n.setRequestHeader(a,i)}),s&&n.setRequestHeader("Content-Type",s),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var i={statusCode:n.status,text:n.responseText};if(n.status===200)try{i.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(i)}},n.send(r)}}),$t!=null&&$t.sendBeacon&&_i.push({transport:"sendBeacon",method:t=>{var e=Yi(t.url,{beacon:"1"});try{var n,{contentType:s,body:r}=(n=ll(t))!==null&&n!==void 0?n:{},i=typeof r=="string"?new Blob([r],{type:s}):r;$t.sendBeacon(e,i)}catch{}}});var Xi=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function ep(t,e,n){return Ur({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Av={exact:(t,e)=>e.some(n=>t.some(s=>n===s)),is_not:(t,e)=>e.every(n=>t.every(s=>n!==s)),regex:(t,e)=>e.some(n=>t.some(s=>Xi(n,s))),not_regex:(t,e)=>e.every(n=>t.every(s=>!Xi(n,s))),icontains:(t,e)=>e.map(ni).some(n=>t.map(ni).some(s=>n.includes(s))),not_icontains:(t,e)=>e.map(ni).every(n=>t.map(ni).every(s=>!n.includes(s))),gt:(t,e)=>e.some(n=>{var s=parseFloat(n);return!isNaN(s)&&t.some(r=>s>parseFloat(r))}),lt:(t,e)=>e.some(n=>{var s=parseFloat(n);return!isNaN(s)&&t.some(r=>s<parseFloat(r))})},ni=t=>t.toLowerCase();function Cv(t,e){return!t||Object.entries(t).every(n=>{var[s,r]=n,i=e?.[s];if(U(i)||sn(i))return!1;var a=[String(i)],l=Av[r.operator];return!!l&&l(r.values,a)})}var cl=Ie("[Error tracking]");class nk{constructor(e){var n,s;this.nt=[],this.ot=new aP([new gP,new TP,new _P,new vP,new EP,new wP,new xP,new jP],mP()),this._instance=e,this.nt=(n=(s=this._instance.persistence)==null?void 0:s.get_property(pc))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,s,r;if("errorTracking"in e){var i=(n=(s=e.errorTracking)==null?void 0:s.suppressionRules)!==null&&n!==void 0?n:[],a=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.nt=i,this._instance.persistence&&this._instance.persistence.register({[pc]:this.nt,[Fh]:a})}}get ut(){var e,n=!!this._instance.get_property(Fh),s=this._instance.config.error_tracking.captureExtensionExceptions;return(e=s??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this.ot.buildFromUnknown(e,{syntheticException:n?.syntheticException,mechanism:{handled:n?.handled}})}sendExceptionEvent(e){var n=e.$exception_list;if(this.ht(n)){if(this.dt(n))return void cl.info("Skipping exception capture because a suppression rule matched");if(!this.ut&&this.vt(n))return void cl.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ct(n))return void cl.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",ft:!0})}dt(e){if(e.length===0)return!1;var n=e.reduce((s,r)=>{var{type:i,value:a}=r;return Ve(i)&&i.length>0&&s.$exception_types.push(i),Ve(a)&&a.length>0&&s.$exception_values.push(a),s},{$exception_types:[],$exception_values:[]});return this.nt.some(s=>{var r=s.values.map(i=>{var a,l=Av[i.operator],c=ve(i.value)?i.value:[i.value],u=(a=n[i.key])!==null&&a!==void 0?a:[];return c.length>0&&l(c,u)});return s.type==="OR"?r.some(Boolean):r.every(Boolean)})}vt(e){return e.flatMap(n=>{var s,r;return(s=(r=n.stacktrace)==null?void 0:r.frames)!==null&&s!==void 0?s:[]}).some(n=>n.filename&&n.filename.startsWith("chrome-extension://"))}ct(e){if(e.length>0){var n,s,r,i,a=(n=(s=e[0].stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[],l=a[a.length-1];return(r=l==null||(i=l.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ht(e){return!ue(e)&&ve(e)}}var si="https?://(.*)",cr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],sk=ar(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],cr),xo="<masked>",rk=["li_fat_id"];function Iv(t,e,n){if(!B)return{};var s,r=e?ar([],cr,n||[]):[],i=Ov(yo(B.URL,r,xo),t),a=(s={},je(rk,function(l){var c=cn.A(l);s[l]=c||null}),s);return Ne(a,i)}function Ov(t,e){var n=sk.concat(e||[]),s={};return je(n,function(r){var i=Gi(t,r);s[r]=i||null}),s}function Dv(t){var e=function(i){return i?i.search(si+"google.([^/?]*)")===0?"google":i.search(si+"bing.com")===0?"bing":i.search(si+"yahoo.com")===0?"yahoo":i.search(si+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",s={};if(!sn(e)){s.$search_engine=e;var r=B?Gi(B.referrer,n):"";r.length&&(s.ph_keyword=r)}return s}function tp(){return navigator.language||navigator.userLanguage}function Lv(){return B?.referrer||"$direct"}function Nv(t,e){var n=t?ar([],cr,e||[]):[],s=Ke?.href.substring(0,1e3);return{r:Lv().substring(0,1e3),u:s?yo(s,n,xo):void 0}}function Mv(t){var e,{r:n,u:s}=t,r={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Wi(n))==null?void 0:e.host};if(s){r.$current_url=s;var i=Wi(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=Ov(s);Ne(r,a)}if(n){var l=Dv(n);Ne(r,l)}return r}function Vv(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ok(){try{return new Date().getTimezoneOffset()}catch{return}}function ik(t,e){if(!Ct)return{};var n,s,r,i=t?ar([],cr,e||[]):[],[a,l]=function(c){for(var u=0;u<Ch.length;u++){var[d,p]=Ch[u],f=d.exec(c),g=f&&(On(p)?p(f,c):p);if(g)return g}return["",""]}(Ct);return Ne(Lu({$os:a,$os_version:l,$browser:hv(Ct,navigator.vendor),$device:Ih(Ct),$device_type:(s=Ct,r=Ih(s),r===Jg||r===Zg||r==="Kobo"||r==="Kindle Fire"||r===dv?mo:r===vo||r===Qs||r===_o||r===cc?"Console":r===ev?"Wearable":r?Gt:"Desktop"),$timezone:Vv(),$timezone_offset:ok()}),{$current_url:yo(Ke?.href,i,xo),$host:Ke?.host,$pathname:Ke?.pathname,$raw_user_agent:Ct.length>1e3?Ct.substring(0,997)+"...":Ct,$browser_version:rP(Ct,navigator.vendor),$browser_language:tp(),$browser_language_prefix:(n=tp(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:R?.screen.height,$screen_width:R?.screen.width,$viewport_height:R?.innerHeight,$viewport_width:R?.innerWidth,$lib:"web",$lib_version:An.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Mt=Ie("[FeatureFlags]"),Ir=Ie("[FeatureFlags]",{debugEnabled:!0}),ak="errors_while_computing_flags",lk="flag_missing",ck="quota_limited",uk="timeout",dk="connection_error",hk="unknown_error",pk=t=>"api_error_"+t,ul="$active_feature_flags",Os="$override_feature_flags",np="$feature_flag_payloads",Or="$override_feature_flag_payloads",sp="$feature_flag_request_id",rp="$feature_flag_evaluated_at",op=t=>{var e={};for(var[n,s]of vi(t||{}))s&&(e[n]=s);return e},fk=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var s;return[n,(s=e[n].variant)!==null&&s!==void 0?s:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var s;return(s=e[n].metadata)==null?void 0:s.payload}).map(n=>{var s;return[n,(s=e[n].metadata)==null?void 0:s.payload]}))):Mt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},mk=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class gk{constructor(e){this._t=!1,this.bt=!1,this.yt=!1,this.wt=!1,this.xt=!1,this.$t=!1,this.Et=!1,this._instance=e,this.featureFlagEventHandlers=[]}St(){var e,n=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Et||(Mt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Et=!0),n!=null&&n.length?n.filter(s=>{var r=s&&typeof s=="string"&&s.trim().length>0;return r||Mt.error("Invalid evaluation context found:",s,"Expected non-empty string"),r}):[]}kt(){return this.St().length>0}get hasLoadedFlags(){return this.bt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(fc),n=this._instance.get_property(Os),s=this._instance.get_property(Or);if(!s&&!n)return e||{};var r=Ne({},e||{}),i=[...new Set([...Object.keys(s||{}),...Object.keys(n||{})])];for(var a of i){var l,c,u=r[a],d=n?.[a],p=U(d)?(l=u?.enabled)!==null&&l!==void 0&&l:!!d,f=U(d)?u.variant:typeof d=="string"?d:void 0,g=s?.[a],y=z({},u,{enabled:p,variant:p?f??u?.variant:void 0});p!==u?.enabled&&(y.original_enabled=u?.enabled),f!==u?.variant&&(y.original_variant=u?.variant),g&&(y.metadata=z({},u?.metadata,{payload:g,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),r[a]=y}return this._t||(Mt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._t=!0),r}getFlagVariants(){var e=this._instance.get_property(Us),n=this._instance.get_property(Os);if(!n)return e||{};for(var s=Ne({},e),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._t||(Mt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:s}),this._t=!0),s}getFlagPayloads(){var e=this._instance.get_property(np),n=this._instance.get_property(Or);if(!n)return e||{};for(var s=Ne({},e||{}),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._t||(Mt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:s}),this._t=!0),s}reloadFeatureFlags(){this.wt||this._instance.config.advanced_disable_feature_flags||this.Pt||(this._instance.Tt.emit("featureFlagsReloading",!0),this.Pt=setTimeout(()=>{this.It()},5))}Ct(){clearTimeout(this.Pt),this.Pt=void 0}ensureFlagsLoaded(){this.bt||this.yt||this.Pt||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.wt=e}It(e){var n;if(this.Ct(),!this._instance.Rt())if(this.yt)this.xt=!0;else{var s=this._instance.config.token,r=this._instance.get_property("$device_id"),i={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:z({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(zr)||{}),group_properties:this._instance.get_property(hs),timezone:Vv()};sn(r)||U(r)||(i.$device_id=r),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.kt()&&(i.evaluation_contexts=this.St());var a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+a);this.yt=!0,this._instance._send_request({method:"POST",url:l,data:i,compression:this._instance.config.disable_compression?void 0:un.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var u,d,p,f=!0;if(c.statusCode===200&&(this.xt||(this.$anon_distinct_id=void 0),f=!1),this.yt=!1,!i.disable_flags||this.xt){this.$t=!f;var g=[];c.error?c.error instanceof Error?g.push(c.error.name==="AbortError"?uk:dk):g.push(hk):c.statusCode!==200&&g.push(pk(c.statusCode)),(u=c.json)!=null&&u.errorsWhileComputingFlags&&g.push(ak);var y=!((d=c.json)==null||(d=d.quotaLimited)==null||!d.includes(mk.FeatureFlags));if(y&&g.push(ck),(p=this._instance.persistence)==null||p.register({[gc]:g}),y)Mt.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var m;i.disable_flags||this.receivedFeatureFlags((m=c.json)!==null&&m!==void 0?m:{},f),this.xt&&(this.xt=!1,this.It())}}}})}}getFeatureFlag(e,n){var s;if(n===void 0&&(n={}),!n.fresh||this.$t){if(this.bt||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlagResult(e,n);return(s=r?.variant)!==null&&s!==void 0?s:r?.enabled}Mt.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var n=this.getFeatureFlagResult(e,{send_event:!1});return n?.payload}getFeatureFlagResult(e,n){if(n===void 0&&(n={}),!n.fresh||this.$t)if(this.bt||this.getFlags()&&this.getFlags().length>0){var s=this.getFlagVariants(),r=e in s,i=s[e],a=this.getFlagPayloads()[e],l=String(i),c=this._instance.get_property(sp)||void 0,u=this._instance.get_property(rp)||void 0,d=this._instance.get_property(Bi)||{};if((n.send_event||!("send_event"in n))&&(!(e in d)||!d[e].includes(l))){var p,f,g,y,m,x,b,w,E,T;ve(d[e])?d[e].push(l):d[e]=[l],(p=this._instance.persistence)==null||p.register({[Bi]:d});var j=this.getFeatureFlagDetails(e),P=[...(f=this._instance.get_property(gc))!==null&&f!==void 0?f:[]];U(i)&&P.push(lk);var k={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:c,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this._instance.config.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((y=this._instance.config.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[e])||null,$used_bootstrap_value:!this.$t};U(j==null||(m=j.metadata)==null?void 0:m.version)||(k.$feature_flag_version=j.metadata.version);var S,O=(x=j==null||(b=j.reason)==null?void 0:b.description)!==null&&x!==void 0?x:j==null||(w=j.reason)==null?void 0:w.code;O&&(k.$feature_flag_reason=O),j!=null&&(E=j.metadata)!=null&&E.id&&(k.$feature_flag_id=j.metadata.id),U(j?.original_variant)&&U(j?.original_enabled)||(k.$feature_flag_original_response=U(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(T=j.metadata)!=null&&T.original_payload&&(k.$feature_flag_original_payload=j==null||(S=j.metadata)==null?void 0:S.original_payload),P.length&&(k.$feature_flag_error=P.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var D=a;if(!U(a))try{D=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:D}}}else Mt.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,n){var s=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:s};this.kt()&&(r.evaluation_contexts=this.St()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._instance.config.disable_compression?void 0:un.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var a,l=(a=i.json)==null?void 0:a.featureFlagPayloads;n(l?.[e]||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),!n.fresh||this.$t){if(this.bt||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlag(e,n);return U(s)?void 0:!!s}Mt.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this._instance.persistence){this.bt=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,l,c,u,d){c===void 0&&(c={}),u===void 0&&(u={}),d===void 0&&(d={});var p=fk(a),f=p.flags,g=p.featureFlags,y=p.featureFlagPayloads;if(g){var m=a.requestId,x=a.evaluatedAt;if(ve(g)){Mt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(g)for(var w=0;w<g.length;w++)b[g[w]]=!0;l&&l.register({[ul]:g,[Us]:b})}else{var E=g,T=y,j=f;if(a.errorsWhileComputingFlags)if(f){var P=new Set(Object.keys(f).filter(k=>{var S;return!((S=f[k])!=null&&S.failed)}));E=z({},c,Object.fromEntries(Object.entries(E).filter(k=>{var[S]=k;return P.has(S)}))),T=z({},u,Object.fromEntries(Object.entries(T||{}).filter(k=>{var[S]=k;return P.has(S)}))),j=z({},d,Object.fromEntries(Object.entries(j||{}).filter(k=>{var[S]=k;return P.has(S)})))}else E=z({},c,E),T=z({},u,T),j=z({},d,j);l&&l.register(z({[ul]:Object.keys(op(E)),[Us]:E||{},[np]:T||{},[fc]:j||{}},m?{[sp]:m}:{},x?{[rp]:x}:{}))}}})(e,this._instance.persistence,s,r,i),this.Ft(n)}}override(e,n){n===void 0&&(n=!1),Mt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Mt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Os),this._instance.persistence.unregister(Or),this.Ft(),Ir.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,s=e;if(this._t=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this._instance.persistence.unregister(Os),Ir.info("Flag overrides cleared");else if(s.flags){if(ve(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this._instance.persistence.register({[Os]:r})}else this._instance.persistence.register({[Os]:s.flags});Ir.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this._instance.persistence.unregister(Or),Ir.info("Payload overrides cleared")):s.payloads&&(this._instance.persistence.register({[Or]:s.payloads}),Ir.info("Payload overrides set",{payloads:s.payloads}))),void this.Ft()}this.Ft()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.bt){var{flags:n,flagVariants:s}=this.Ot();e(n,s)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,s){var r,i=(this._instance.get_property(Br)||[]).find(u=>u.flagKey===e),a={["$feature_enrollment/"+e]:n},l={$feature_flag:e,$feature_enrollment:n,$set:a};i&&(l.$early_access_feature_name=i.name),s&&(l.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(a,!1);var c=z({},this.getFlagVariants(),{[e]:n});(r=this._instance.persistence)==null||r.register({[ul]:Object.keys(op(c)),[Us]:c}),this.Ft()}getEarlyAccessFeatures(e,n,s){n===void 0&&(n=!1);var r=this._instance.get_property(Br),i=s?"&"+s.map(a=>"stage="+a).join("&"):"";if(r&&!n)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+i),method:"GET",callback:a=>{var l,c;if(a.json){var u=a.json.earlyAccessFeatures;return(l=this._instance.persistence)==null||l.unregister(Br),(c=this._instance.persistence)==null||c.register({[Br]:u}),e(u)}}})}Ot(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(s=>n[s]),flagVariants:Object.keys(n).filter(s=>n[s]).reduce((s,r)=>(s[r]=n[r],s),{})}}Ft(e){var{flags:n,flagVariants:s}=this.Ot();this.featureFlagEventHandlers.forEach(r=>r(n,s,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var s=this._instance.get_property(zr)||{};this._instance.register({[zr]:z({},s,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(zr)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var s=this._instance.get_property(hs)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=z({},s[r],e[r]),delete e[r]}),this._instance.register({[hs]:z({},s,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(hs)||{};this._instance.register({[hs]:z({},n,{[e]:{}})})}else this._instance.unregister(hs)}reset(){this.bt=!1,this.yt=!1,this.wt=!1,this.xt=!1,this.$t=!1,this.$anon_distinct_id=void 0,this.Ct(),this._t=!1}}var vk=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class dl{constructor(e,n){this.N=e,this.props={},this.Mt=!1,this.At=(s=>{var r="";return s.token&&(r=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+r+"_posthog"})(e),this.B=this.jt(e),this.load(),e.debug&&W.info("Persistence loaded",e.persistence,z({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Dt}jt(e){vk.indexOf(e.persistence.toLowerCase())===-1&&(W.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(r){r===void 0&&(r=[]);var i=[...MP,...r];return z({},Ae,{j:function(a){try{var l={};try{l=cn.j(a)||{}}catch{}var c=Ne(l,JSON.parse(Ae.A(a)||"{}"));return Ae.D(a,c),c}catch{}return null},D:function(a,l,c,u,d,p){try{Ae.D(a,l,void 0,void 0,p);var f={};i.forEach(g=>{l[g]&&(f[g]=l[g])}),Object.keys(f).length&&cn.D(a,f,c,u,d,p)}catch(g){Ae.M(g)}},L:function(a,l){try{R?.localStorage.removeItem(a),cn.L(a,l)}catch(c){Ae.M(c)}}})}(e.cookie_persisted_properties||[]),s=e.persistence.toLowerCase();return s==="localstorage"&&Ae.O()?Ae:s==="localstorage+cookie"&&n.O()?n:s==="sessionstorage"&&Ge.O()?Ge:s==="memory"?VP:s==="cookie"?cn:n.O()?n:cn}properties(){var e={};return je(this.props,function(n,s){if(s===Us&&Be(n))for(var r=Object.keys(n),i=0;i<r.length;i++)e["$feature/"+r[i]]=n[r[i]];else l=s,c=!1,(sn(a=CP)?c:Th&&a.indexOf===Th?a.indexOf(l)!=-1:(je(a,function(u){if(c||(c=u===l))return Fi}),c))||(e[s]=n);var a,l,c}),e}load(){if(!this.Dt){var e=this.B.j(this.At);e&&(this.props=Ne({},e))}}save(){this.Dt||this.B.D(this.At,this.props,this.Lt,this.Nt,this.Ut,this.N.debug)}remove(){this.B.L(this.At,!1),this.B.L(this.At,!0)}clear(){this.remove(),this.props={}}register_once(e,n,s){if(Be(e)){U(n)&&(n="None"),this.Lt=U(s)?this.zt:s;var r=!1;if(je(e,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,r=!0)}),r)return this.save(),!0}return!1}register(e,n){if(Be(e)){this.Lt=U(n)?this.zt:n;var s=!1;if(je(e,(r,i)=>{e.hasOwnProperty(i)&&this.props[i]!==r&&(this.props[i]=r,s=!0)}),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Mt){var e=Iv(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);zs(Lu(e))||this.register(e),this.Mt=!0}}update_search_keyword(){var e;this.register((e=B?.referrer)?Dv(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Lv(),$referring_domain:B!=null&&B.referrer&&((e=Wi(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[yc]||this.props[xc]||this.register_once({[zi]:Nv(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};je([xc,yc],a=>{var l=this.props[a];l&&je(l,function(c,u){e["$initial_"+oc(u)]=c})});var n,s,r=this.props[zi];if(r){var i=(n=Mv(r),s={},je(n,function(a,l){s["$initial_"+oc(l)]=a}),s);Ne(e,i)}return e}safe_merge(e){return je(this.props,function(n,s){s in e||(e[s]=n)}),e}update_config(e,n,s){if(this.zt=this.Lt=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((a,l)=>{if(a.length!==l.length)return!1;var c=[...a].sort(),u=[...l].sort();return c.every((d,p)=>d===u[p])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var r=this.jt(e),i=this.props;this.clear(),this.B=r,this.props=i,this.save()}}set_disabled(e){this.Dt=e,this.Dt?this.remove():this.save()}set_cross_subdomain(e){e!==this.Nt&&(this.Nt=e,this.remove(),this.save())}set_secure(e){e!==this.Ut&&(this.Ut=e,this.remove(),this.save())}set_event_timer(e,n){var s=this.props[$r]||{};s[e]=n,this.props[$r]=s,this.save()}remove_event_timer(e){var n=(this.props[$r]||{})[e];return U(n)||(delete this.props[$r][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}var $s=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({});(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({});(function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t})({});(function(t){return t.Top="top",t.Left="left",t.Right="right",t.Bottom="bottom",t})({});var yi=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({});(function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t})({});(function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t})({});var Hs=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t.ABANDONED="survey abandoned",t}({}),xi=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t.PRODUCT_TOUR_ID="$product_tour_id",t.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",t}({}),Zi=function(t){return t.Popover="popover",t.Inline="inline",t}({}),be=Ie("[Surveys]"),Fv="seenSurvey_",_k=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},ip=t=>((e,n)=>{var s=""+e+n.id;return n.current_iteration&&n.current_iteration>0&&(s=""+e+n.id+"_"+n.current_iteration),s})(Fv,t),yk=[yi.Popover,yi.Widget,yi.API],xk={ignoreConditions:!1,ignoreDelay:!1,displayType:Zi.Popover};class Vu{constructor(){this.Ht={},this.Ht={}}on(e,n){return this.Ht[e]||(this.Ht[e]=[]),this.Ht[e].push(n),()=>{this.Ht[e]=this.Ht[e].filter(s=>s!==n)}}emit(e,n){for(var s of this.Ht[e]||[])s(n);for(var r of this.Ht["*"]||[])r(e,n)}}function Ds(t,e,n){if(ue(t))return!1;switch(n){case"exact":return t===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class bk{constructor(e){this.Bt=new Vu,this.qt=(n,s)=>this.Wt(n,s)&&this.Gt(n,s)&&this.Vt(n,s)&&this.Jt(n,s),this.Wt=(n,s)=>s==null||!s.event||n?.event===s?.event,this._instance=e,this.Kt=new Set,this.Yt=new Set}init(){var e;if(!U((e=this._instance)==null?void 0:e._addCaptureHook)){var n;(n=this._instance)==null||n._addCaptureHook((s,r)=>{this.on(s,r)})}}register(e){var n,s;if(!U((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(a=>{var l,c;(l=this.Yt)==null||l.add(a),(c=a.steps)==null||c.forEach(u=>{var d;(d=this.Kt)==null||d.add(u?.event||"")})}),(s=this._instance)!=null&&s.autocapture)){var r,i=new Set;e.forEach(a=>{var l;(l=a.steps)==null||l.forEach(c=>{c!=null&&c.selector&&i.add(c?.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(i)}}on(e,n){var s;n!=null&&e.length!=0&&(this.Kt.has(e)||this.Kt.has(n?.event))&&this.Yt&&((s=this.Yt)==null?void 0:s.size)>0&&this.Yt.forEach(r=>{this.Xt(n,r)&&this.Bt.emit("actionCaptured",r.name)})}Qt(e){this.onAction("actionCaptured",n=>e(n))}Xt(e,n){if(n?.steps==null)return!1;for(var s of n.steps)if(this.qt(e,s))return!0;return!1}onAction(e,n){return this.Bt.on(e,n)}Gt(e,n){if(n!=null&&n.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!Ds(r,n.url,n.url_matching||"contains"))return!1}return!0}Vt(e,n){return!!this.Zt(e,n)&&!!this.ti(e,n)&&!!this.ii(e,n)}Zt(e,n){var s;if(n==null||!n.href)return!0;var r=this.ei(e);if(r.length>0)return r.some(l=>Ds(l.href,n.href,n.href_matching||"exact"));var i,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&Ds((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}ti(e,n){var s;if(n==null||!n.text)return!0;var r=this.ei(e);if(r.length>0)return r.some(u=>Ds(u.text,n.text,n.text_matching||"exact")||Ds(u.$el_text,n.text,n.text_matching||"exact"));var i,a,l,c=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!c&&(i=function(u){for(var d,p=[],f=/(?::|")text="(.*?)"/g;!ue(d=f.exec(u));)p.includes(d[1])||p.push(d[1]);return p}(c),a=n.text,l=n.text_matching||"exact",i.some(u=>Ds(u,a,l)))}ii(e,n){var s,r;if(n==null||!n.selector)return!0;var i=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(n.selector_regex&&a)try{return new RegExp(n.selector_regex).test(a)}catch{return!1}return!1}ei(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}Jt(e,n){return n==null||!n.properties||n.properties.length===0||Cv(n.properties.reduce((s,r)=>{var i=ve(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:i,operator:r.operator||"exact"},s},{}),e?.properties)}}class wk{constructor(e){this._instance=e,this.ri=new Map,this.si=new Map,this.ni=new Map}oi(e,n){return!!e&&Cv(e.propertyFilters,n?.properties)}ai(e,n){var s=new Map;return e.forEach(r=>{var i;(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach(a=>{if(a!=null&&a.name){var l=s.get(a.name)||[];l.push(r.id),s.set(a.name,l)}})}),s}li(e,n,s){var r=(s===$s.Activation?this.ri:this.si).get(e),i=[];return this.ui(a=>{i=a.filter(l=>r?.includes(l.id))}),i.filter(a=>{var l,c=(l=a.conditions)==null||(l=l[s])==null||(l=l.values)==null?void 0:l.find(u=>u.name===e);return this.oi(c,n)})}register(e){var n;U((n=this._instance)==null?void 0:n._addCaptureHook)||(this.hi(e),this.di(e))}di(e){var n=e.filter(s=>{var r,i;return((r=s.conditions)==null?void 0:r.actions)&&((i=s.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0});n.length!==0&&(this.vi==null&&(this.vi=new bk(this._instance),this.vi.init(),this.vi.Qt(s=>{this.onAction(s)})),n.forEach(s=>{var r,i,a,l,c;s.conditions&&(r=s.conditions)!=null&&r.actions&&(i=s.conditions)!=null&&(i=i.actions)!=null&&i.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((l=this.vi)==null||l.register(s.conditions.actions.values),(c=s.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach(u=>{if(u&&u.name){var d=this.ni.get(u.name);d&&d.push(s.id),this.ni.set(u.name,d||[s.id])}}))}))}hi(e){var n,s=e.filter(i=>{var a,l;return((a=i.conditions)==null?void 0:a.events)&&((l=i.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0}),r=e.filter(i=>{var a,l;return((a=i.conditions)==null?void 0:a.cancelEvents)&&((l=i.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0});(s.length!==0||r.length!==0)&&((n=this._instance)==null||n._addCaptureHook((i,a)=>{this.onEvent(i,a)}),this.ri=this.ai(e,$s.Activation),this.si=this.ai(e,$s.Cancellation))}onEvent(e,n){var s,r=this.ci(),i=this.fi(),a=this.pi(),l=((s=this._instance)==null||(s=s.persistence)==null?void 0:s.props[i])||[];if(a===e&&n&&l.length>0){var c,u;r.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:l});var d=(n==null||(c=n.properties)==null?void 0:c.$survey_id)||(n==null||(u=n.properties)==null?void 0:u.$product_tour_id);if(d){var p=l.indexOf(d);p>=0&&(l.splice(p,1),this.gi(l))}}else{if(this.si.has(e)){var f=this.li(e,n,$s.Cancellation);f.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(y=>y.id)}),f.forEach(y=>{var m=l.indexOf(y.id);m>=0&&l.splice(m,1),this.mi(y.id)}),this.gi(l))}if(this.ri.has(e)){r.info("event name matched",{event:e,eventPayload:n,items:this.ri.get(e)});var g=this.li(e,n,$s.Activation);this.gi(l.concat(g.map(y=>y.id)||[]))}}}onAction(e){var n,s=this.fi(),r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[s])||[];this.ni.has(e)&&this.gi(r.concat(this.ni.get(e)||[]))}gi(e){var n,s=this.ci(),r=this.fi(),i=[...new Set(e)].filter(a=>!this.bi(a));s.info("updating activated items",{activatedItems:i}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[r]:i})}getActivatedIds(){var e,n=this.fi(),s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n];return s||[]}getEventToItemsMap(){return this.ri}yi(){return this.vi}}class Ek extends wk{constructor(e){super(e)}fi(){return"$surveys_activated"}pi(){return Hs.SHOWN}ui(e){var n;(n=this._instance)==null||n.getSurveys(e)}mi(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}ci(){return be}bi(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class jk{constructor(e){this.wi=void 0,this._surveyManager=null,this.xi=!1,this.$i=[],this.Ei=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(ue(n))return be.warn("Flags not loaded yet. Not loading surveys.");var s=ve(n);this.wi=s?n.length>0:n,be.info("flags response received, isSurveysEnabled: "+this.wi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var s=localStorage.key(n);(s!=null&&s.startsWith(Fv)||s!=null&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.xi)be.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)be.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())be.info("Not loading surveys in cookieless mode without consent.");else{var e=J?.__PosthogExtensions__;if(e){if(!U(this.wi)||this._instance.config.advanced_enable_surveys){var n=this.wi||this._instance.config.advanced_enable_surveys;this.xi=!0;try{var s=e.generateSurveys;if(s)return void this.Si(s,n);var r=e.loadExternalDependency;if(!r)return void this.ki("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",i=>{i||!e.generateSurveys?this.ki("Could not load surveys script",i):this.Si(e.generateSurveys,n)})}catch(i){throw this.ki("Error initializing surveys",i),i}finally{this.xi=!1}}}else be.error("PostHog Extensions not found.")}}Si(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new Ek(this._instance),be.info("Surveys loaded successfully"),this.Pi({isLoaded:!0})}ki(e,n){be.error(e,n),this.Pi({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$i.push(e),this._surveyManager&&this.Pi({isLoaded:!0}),()=>{this.$i=this.$i.filter(n=>n!==e)}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return be.info("Disabled. Not loading surveys."),e([]);var s,r=this._instance.get_property(mc);if(r&&!n)return e(r,{isLoaded:!0});typeof Promise<"u"&&this.Ei?this.Ei.then(i=>{var{surveys:a,context:l}=i;return e(a,l)}):(typeof Promise<"u"&&(this.Ei=new Promise(i=>{s=i})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var a;this.Ei=null;var l=i.statusCode;if(l!==200||!i.json){var c="Surveys API could not be loaded, status: "+l;be.error(c);var u={isLoaded:!1,error:c};return e([],u),void(s==null||s({surveys:[],context:u}))}var d,p=i.json.surveys||[],f=p.filter(y=>function(m){return!(!m.start_date||m.end_date)}(y)&&(function(m){var x;return!((x=m.conditions)==null||(x=x.events)==null||(x=x.values)==null||!x.length)}(y)||function(m){var x;return!((x=m.conditions)==null||(x=x.actions)==null||(x=x.values)==null||!x.length)}(y)));f.length>0&&((d=this._surveyEventReceiver)==null||d.register(f)),(a=this._instance.persistence)==null||a.register({[mc]:p});var g={isLoaded:!0};e(p,g),s?.({surveys:p,context:g})}}))}Pi(e){for(var n of this.$i)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(s){be.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);be.warn("init was not called")}Ti(e){var n=null;return this.getSurveys(s=>{var r;n=(r=s.find(i=>i.id===e))!==null&&r!==void 0?r:null}),n}Ii(e){if(ue(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.Ti(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ue(this._surveyManager))return be.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.Ii(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return ue(this._surveyManager)?(be.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(s=>{this.getSurveys(r=>{var i,a=(i=r.find(c=>c.id===e))!==null&&i!==void 0?i:null;if(a){var l=this.Ii(a);s({visible:l.eligible,disabledReason:l.reason})}else s({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,s){var r;if(ue(this._surveyManager))be.warn("init was not called");else{var i=typeof e=="string"?this.Ti(e):e;if(i!=null&&i.id)if(yk.includes(i.type)){var a=B?.querySelector(n);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(be.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var l,c;be.info("Rendering survey "+i.id+" with delay of "+((l=i.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(c=this._surveyManager)==null||c.renderSurvey(i,a,s),be.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,s);be.warn("Survey element not found")}else be.warn("Surveys of type "+i.type+" cannot be rendered in the app");else be.warn("Survey not found")}}displaySurvey(e,n){var s;if(ue(this._surveyManager))be.warn("init was not called");else{var r=this.Ti(e);if(r){var i=r;if((s=r.appearance)!=null&&s.surveyPopupDelaySeconds&&n.ignoreDelay&&(i=z({},r,{appearance:z({},r.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==Zi.Popover&&n.initialResponses&&be.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var a=this.canRenderSurvey(r);if(!a.visible)return void be.warn("Survey is not eligible to be displayed: ",a.disabledReason)}n.displayType!==Zi.Inline?this._surveyManager.handlePopoverSurvey(i,n):this.renderSurvey(i,n.selector,n.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?be.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}var Ut=Ie("[Conversations]");class Tk{constructor(e){this.Ci=void 0,this._conversationsManager=null,this.Ri=!1,this.Fi=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var n=e.conversations;ue(n)||(Ln(n)?this.Ci=n:(this.Ci=n.enabled,this.Fi=n),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ci=void 0,this.Fi=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ri||this._instance.config.disable_conversations||vv(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=J?.__PosthogExtensions__;if(e&&!U(this.Ci)&&this.Ci)if(this.Fi&&this.Fi.token){this.Ri=!0;try{var n=e.initConversations;if(n)return this.Oi(n),void(this.Ri=!1);var s=e.loadExternalDependency;if(!s)return void this.Mi("PostHog loadExternalDependency extension not found.");s(this._instance,"conversations",r=>{r||!e.initConversations?this.Mi("Could not load conversations script",r):this.Oi(e.initConversations),this.Ri=!1})}catch(r){this.Mi("Error initializing conversations",r),this.Ri=!1}}else Ut.error("Conversations enabled but missing token in remote config.")}}Oi(e){if(this.Fi)try{this._conversationsManager=e(this.Fi,this._instance),Ut.info("Conversations loaded successfully")}catch(n){this.Mi("Error completing conversations initialization",n)}else Ut.error("Cannot complete initialization: remote config is null")}Mi(e,n){Ut.error(e,n),this._conversationsManager=null,this.Ri=!1}show(){this._conversationsManager?this._conversationsManager.show():Ut.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ci===!0&&!sn(this._conversationsManager)}isVisible(){var e,n;return(e=(n=this._conversationsManager)==null?void 0:n.isVisible())!==null&&e!==void 0&&e}sendMessage(e,n,s){var r=this;return Cn(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,n,s):(Ut.warn("Conversations not available yet."),null)})()}getMessages(e,n){var s=this;return Cn(function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,n):(Ut.warn("Conversations not available yet."),null)})()}markAsRead(e){var n=this;return Cn(function*(){return n._conversationsManager?n._conversationsManager.markAsRead(e):(Ut.warn("Conversations not available yet."),null)})()}getTickets(e){var n=this;return Cn(function*(){return n._conversationsManager?n._conversationsManager.getTickets(e):(Ut.warn("Conversations not available yet."),null)})()}requestRestoreLink(e){var n=this;return Cn(function*(){return n._conversationsManager?n._conversationsManager.requestRestoreLink(e):(Ut.warn("Conversations not available yet."),null)})()}restoreFromToken(e){var n=this;return Cn(function*(){return n._conversationsManager?n._conversationsManager.restoreFromToken(e):(Ut.warn("Conversations not available yet."),null)})()}restoreFromUrlToken(){var e=this;return Cn(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ut.warn("Conversations not available yet."),null)})()}getCurrentTicketId(){var e,n;return(e=(n=this._conversationsManager)==null?void 0:n.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,n;return(e=(n=this._conversationsManager)==null?void 0:n.getWidgetSessionId())!==null&&e!==void 0?e:null}}class Pk{constructor(e){var n;this.Ai=!1,this.ji=!1,this._instance=e,this._instance&&(n=this._instance.config.logs)!=null&&n.captureConsoleLogs&&(this.Ai=!0)}onRemoteConfig(e){var n,s=(n=e.logs)==null?void 0:n.captureConsoleLogs;!ue(s)&&s&&(this.Ai=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ai&&!this.ji){var e=Ie("[logs]"),n=J?.__PosthogExtensions__;if(n){var s=n.loadExternalDependency;s?s(this._instance,"logs",r=>{var i;r||(i=n.logs)==null||!i.initializeLogs?e.error("Could not load logs script",r):(n.logs.initializeLogs(this._instance),this.ji=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}var ap=Ie("[RateLimiter]");class kk{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(r=>{ap.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4})}catch(r){return void ap.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,l=new Date().getTime(),c=(n=(s=this.instance.persistence)==null?void 0:s.get_property(_c))!==null&&n!==void 0?n:{tokens:i,last:l};c.tokens+=(l-c.last)/1e3*a,c.last=l,c.tokens>i&&(c.tokens=i);var u=c.tokens<1;return u||e||(c.tokens=Math.max(0,c.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(_c,c),{isRateLimited:u,remainingTokens:c.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Dr=Ie("[RemoteConfig]");class $v{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=J._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Di(e){var n,s;(n=J.__PosthogExtensions__)!=null&&n.loadExternalDependency?(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Li(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Dr.info("Using preloaded remote config",this.remoteConfig),this.Ni(this.remoteConfig),void this.Ui();if(this._instance.Rt())return void Dr.warn("Remote config is disabled. Falling back to local config.");this.Di(e=>{if(!e)return Dr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Li(n=>{this.Ni(n),this.Ui()});this.Ni(e),this.Ui()})}catch(e){Dr.error("Error loading remote config",e)}}stop(){this.zi&&(clearInterval(this.zi),this.zi=void 0)}refresh(){this._instance.Rt()||B?.visibilityState==="hidden"||this._instance.featureFlags.reloadFeatureFlags()}Ui(){this.zi||(this.zi=setInterval(()=>{this.refresh()},3e5))}Ni(e){e||Dr.error("Failed to fetch remote config from PostHog."),this._instance.Ni(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}}var jc=3e3;class Sk{constructor(e,n){this.Hi=!0,this.Bi=[],this.qi=pn(n?.flush_interval_ms||jc,250,5e3,W.createLogger("flush interval"),jc),this.Wi=e}enqueue(e){this.Bi.push(e),this.Gi||this.Vi()}unload(){this.Ji();var e=this.Bi.length>0?this.Ki():{},n=Object.values(e);[...n.filter(s=>s.url.indexOf("/e")===0),...n.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.Wi(z({},s,{transport:"sendBeacon"}))})}enable(){this.Hi=!1,this.Vi()}Vi(){var e=this;this.Hi||(this.Gi=setTimeout(()=>{if(this.Ji(),this.Bi.length>0){var n=this.Ki(),s=function(){var i=n[r],a=new Date().getTime();i.data&&ve(i.data)&&je(i.data,l=>{l.offset=Math.abs(l.timestamp-a),delete l.timestamp}),e.Wi(i)};for(var r in n)s()}},this.qi))}Ji(){clearTimeout(this.Gi),this.Gi=void 0}Ki(){var e={};return je(this.Bi,n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;U(e[i])&&(e[i]=z({},r,{data:[]})),(s=e[i].data)==null||s.push(r.data)}),this.Bi=[],e}}var Rk=["retriesPerformedSoFar"];class Ak{constructor(e){this.Yi=!1,this.Xi=3e3,this.Bi=[],this._instance=e,this.Bi=[],this.Qi=!0,!U(R)&&"onLine"in R.navigator&&(this.Qi=R.navigator.onLine,this.Zi=()=>{this.Qi=!0,this.te()},this.ie=()=>{this.Qi=!1},Me(R,"online",this.Zi),Me(R,"offline",this.ie))}get length(){return this.Bi.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,s=Kg(e,Rk);Fs(n)&&(s.url=Yi(s.url,{retry_count:n})),this._instance._send_request(z({},s,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(n??0)<10?this.ee(z({retriesPerformedSoFar:n},s)):s.callback==null||s.callback(r)}}))}ee(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var s=function(a){var l=3e3*Math.pow(2,a),c=l/2,u=Math.min(18e5,l),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)}(n),r=Date.now()+s;this.Bi.push({retryAt:r,requestOptions:e});var i="Enqueued failed request for retry in "+s;navigator.onLine||(i+=" (Browser is offline)"),W.warn(i),this.Yi||(this.Yi=!0,this.re())}re(){if(this.se&&clearTimeout(this.se),this.Bi.length===0)return this.Yi=!1,void(this.se=void 0);this.se=setTimeout(()=>{this.Qi&&this.Bi.length>0&&this.te(),this.re()},this.Xi)}te(){var e=Date.now(),n=[],s=this.Bi.filter(i=>i.retryAt<e||(n.push(i),!1));if(this.Bi=n,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.se&&(clearTimeout(this.se),this.se=void 0),this.Yi=!1,U(R)||(this.Zi&&(R.removeEventListener("online",this.Zi),this.Zi=void 0),this.ie&&(R.removeEventListener("offline",this.ie),this.ie=void 0)),this.Bi))try{this._instance._send_request(z({},e,{transport:"sendBeacon"}))}catch(n){W.error(n)}this.Bi=[]}}class Ck{constructor(e){this.ne=()=>{var n,s,r,i;this.oe||(this.oe={});var a=this.scrollElement(),l=this.scrollY(),c=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=l+(a?.clientHeight||0),d=a?.scrollHeight||0;this.oe.lastScrollY=Math.ceil(l),this.oe.maxScrollY=Math.max(l,(n=this.oe.maxScrollY)!==null&&n!==void 0?n:0),this.oe.maxScrollHeight=Math.max(c,(s=this.oe.maxScrollHeight)!==null&&s!==void 0?s:0),this.oe.lastContentY=u,this.oe.maxContentY=Math.max(u,(r=this.oe.maxContentY)!==null&&r!==void 0?r:0),this.oe.maxContentHeight=Math.max(d,(i=this.oe.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}getContext(){return this.oe}resetContext(){var e=this.oe;return setTimeout(this.ne,0),e}startMeasuringScrollPosition(){Me(R,"scroll",this.ne,{capture:!0}),Me(R,"scrollend",this.ne,{capture:!0}),Me(R,"resize",this.ne)}scrollElement(){if(!this._instance.config.scroll_root_selector)return R?.document.documentElement;var e=ve(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var s=R?.document.querySelector(n);if(s)return s}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return R&&(R.scrollY||R.pageYOffset||R.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return R&&(R.scrollX||R.pageXOffset||R.document.documentElement.scrollLeft)||0}}var Ik=t=>Nv(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties);class lp{constructor(e,n,s,r){this.ae=i=>{var a=this.le();if(!a||a.sessionId!==i){var l={sessionId:i,props:this.ue(this._instance)};this.he.register({[vc]:l})}},this._instance=e,this.de=n,this.he=s,this.ue=r||Ik,this.de.onSessionId(this.ae)}le(){return this.he.props[vc]}getSetOnceProps(){var e,n=(e=this.le())==null?void 0:e.props;return n?"r"in n?Mv(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return je(Lu(this.getSetOnceProps()),(n,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+oc(s)]=n}),e}}var hl=Ie("[SessionId]");class cp{on(e,n){return this.ve.on(e,n)}constructor(e,n,s){var r;if(this.ce=[],this.fe=void 0,this.ve=new Vu,this.pe=(d,p)=>!(!Fs(d)||!Fs(p))&&Math.abs(d-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.he=e.persistence,this._e=void 0,this.ge=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.me=n||Yn,this.be=s||Yn;var i=this.N.persistence_name||this.N.token,a=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pn(a,60,36e3,hl.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ye(),this.we="ph_"+i+"_window_id",this.xe="ph_"+i+"_primary_window_exists",this.$e()){var l=Ge.j(this.we),c=Ge.j(this.xe);l&&!c?this._e=l:Ge.L(this.we),Ge.D(this.xe,!0)}if((r=this.N.bootstrap)!=null&&r.sessionID)try{var u=(d=>{var p=d.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.N.bootstrap.sessionID);this.Ee(this.N.bootstrap.sessionID,new Date().getTime(),u)}catch(d){hl.error("Invalid sessionID in bootstrap",d)}this.Se()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return U(this.ce)&&(this.ce=[]),this.ce.push(e),this.ge&&e(this.ge,this._e),()=>{this.ce=this.ce.filter(n=>n!==e)}}$e(){return this.N.persistence!=="memory"&&!this.he.Dt&&Ge.O()}ke(e){e!==this._e&&(this._e=e,this.$e()&&Ge.D(this.we,e))}Pe(){return this._e?this._e:this.$e()?Ge.j(this.we):null}Ee(e,n,s){e===this.ge&&n===this._sessionActivityTimestamp&&s===this._sessionStartTimestamp||(this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this.ge=e,this.he.register({[$i]:[n,e,s]}))}Te(){var e=this.he.props[$i];return ve(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ee(null,null,null)}destroy(){clearTimeout(this.Ie),this.Ie=void 0,this.fe&&R&&(R.removeEventListener("beforeunload",this.fe,{capture:!1}),this.fe=void 0),this.ce=[]}Se(){this.fe=()=>{this.$e()&&Ge.L(this.xe)},Me(R,"beforeunload",this.fe,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.N.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=n||new Date().getTime(),[r,i,a]=this.Te(),l=this.Pe(),c=Fs(a)&&Math.abs(s-a)>864e5,u=!1,d=!i,p=!d&&!e&&this.pe(s,r);d||p||c?(i=this.me(),l=this.be(),hl.info("new session ID generated",{sessionId:i,windowId:l,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:c}}),a=s,u=!0):l||(l=this.be(),u=!0);var f=Fs(r)&&e&&!c?r:s,g=Fs(a)?a:new Date().getTime();return this.ke(l),this.Ee(i,f,g),e||this.ye(),u&&this.ce.forEach(y=>y(i,l,u?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:c}:void 0)),{sessionId:i,windowId:l,sessionStartTimestamp:g,changeReason:u?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:r}}ye(){clearTimeout(this.Ie),this.Ie=setTimeout(()=>{var[e]=this.Te();if(this.pe(new Date().getTime(),e)){var n=this.ge;this.resetSessionId(),this.ve.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var Bv=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&Sh(n,e))return!0;try{var s=t?.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>Sh(r?.brand,e)))return!0}catch{}return!!t.webdriver},Hr=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),up="i.posthog.com";class Ok{constructor(e){this.Ce={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+up,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Ce[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ce[this.apiHost]=Hr.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ce[this.apiHost]=Hr.EU:this.Ce[this.apiHost]=Hr.CUSTOM),this.Ce[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(this.region===Hr.CUSTOM)return this.apiHost+n;var s=up+n;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var Dk={icontains:(t,e)=>!!R&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!R&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!R&&Xi(e.href,t),not_regex:(t,e)=>!!R&&!Xi(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Pt{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),n.getWebExperiments(r=>{Pt.Re("retrieved web experiments from the server"),n.Fe=new Map,r.forEach(i=>{if(i.feature_flag_key){var a;n.Fe&&(Pt.Re("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n.Fe)==null||a.set(i.feature_flag_key,i));var l=n._instance.getFeatureFlag(i.feature_flag_key);Ve(l)&&i.variants[l]&&n.Oe(i.name,l,i.variants[l].transforms)}else if(i.variants)for(var c in i.variants){var u=i.variants[c];Pt.Me(u)&&n.Oe(i.name,c,u.transforms)}})},s)},this._instance=e,this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}onFeatureFlags(e){if(this._is_bot())Pt.Re("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ue(this.Fe))return this.Fe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Pt.Re("applying feature flags",e),e.forEach(n=>{var s;if(this.Fe&&(s=this.Fe)!=null&&s.has(n)){var r,i=this._instance.getFeatureFlag(n),a=(r=this.Fe)==null?void 0:r.get(n);i&&a!=null&&a.variants[i]&&this.Oe(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var e=Pt.getWindowLocation();if(e!=null&&e.search){var n=Gi(e?.search,"__experiment_id"),s=Gi(e?.search,"__experiment_variant");n&&s&&(Pt.Re("previewing web experiments "+n+" && "+s),this.getWebExperiments(r=>{this.Ae(parseInt(n),s,r)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,s){if(this._instance.config.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!n)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(i.statusCode!==200||!i.json)return e([]);var a=i.json.experiments||[];return e(a)}})}Ae(e,n,s){var r=s.filter(i=>i.id===e);r&&r.length>0&&(Pt.Re("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Oe(r[0].name,n,r[0].variants[n].transforms))}static Me(e){return!ue(e.conditions)&&Pt.je(e)&&Pt.De(e)}static je(e){var n;if(ue(e.conditions)||ue((n=e.conditions)==null?void 0:n.url))return!0;var s,r,i,a=Pt.getWindowLocation();return!!a&&((s=e.conditions)==null||!s.url||Dk[(r=(i=e.conditions)==null?void 0:i.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,a))}static getWindowLocation(){return R?.location}static De(e){var n;if(ue(e.conditions)||ue((n=e.conditions)==null?void 0:n.utm))return!0;var s=Iv();if(s.utm_source){var r,i,a,l,c,u,d,p,f=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==s.utm_campaign,g=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==s.utm_source,y=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,m=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==s.utm_term;return f&&y&&m&&g}return!1}static Re(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];W.info("[WebExperiments] "+e,s)}Oe(e,n,s){this._is_bot()?Pt.Re("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?s.forEach(r=>{if(r.selector){var i;Pt.Re("applying transform of variant "+n+" for experiment "+e+" ",r);var a=(i=document)==null?void 0:i.querySelectorAll(r.selector);a?.forEach(l=>{var c=l;r.html&&(c.innerHTML=r.html),r.css&&c.setAttribute("style",r.css)})}}):Pt.Re("Control variants leave the page unmodified.")}_is_bot(){return $t&&this._instance?Bv($t,this._instance.config.custom_blocked_useragents):void 0}}var Lk=Ie("[PostHog ExternalIntegrations]"),Nk={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Mk{constructor(e){this._instance=e}V(e,n){var s;(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,r=>{if(r)return Lk.error("failed to load script",r);n()})}startIfEnabledOrStop(){var e=this,n=function(a){var l,c,u;!r||(l=J.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]||e.V(Nk[a],()=>{var d;(d=J.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[a])==null||d.start(e._instance)}),!r&&(c=J.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[a]&&((u=J.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[s,r]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(s)}}}var Qr={},pl=0,Tc=()=>{},Bs="posthog",zv=!tk&&Ct?.indexOf("MSIE")===-1&&Ct?.indexOf("Mozilla")===-1,dp=t=>{var e;return z({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:AP(B?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Tc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,debug:Ke&&Ve(Ke?.search)&&Ke.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(R==null||(e=R.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var s="Bad HTTP status: "+n.statusCode+" "+n.text;W.error(s)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:jc},error_tracking:{},_onCapture:Tc,__preview_eager_load_replay:!1},(n=>({rageclick:!(n&&n>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(n&&n>="2025-05-24")||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},hp=t=>{var e={};U(t.process_person)||(e.person_profiles=t.process_person),U(t.xhr_headers)||(e.request_headers=t.xhr_headers),U(t.cookie_name)||(e.persistence_name=t.cookie_name),U(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),U(t.store_google)||(e.save_campaign_params=t.store_google),U(t.verbose)||(e.debug=t.verbose);var n=Ne({},e,t);return ve(t.property_blacklist)&&(U(t.property_denylist)?n.property_denylist=t.property_blacklist:ve(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:W.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class Vk{constructor(){this.__forceAllowLocalhost=!1}get Le(){return this.__forceAllowLocalhost}set Le(e){W.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class fn{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Vk,this.Ne=!1,this.version=An.LIB_VERSION,this.Tt=new Vu,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=dp(),this.SentryIntegration=UP,this.sentryIntegration=e=>function(n,s){var r=jv(n,s);return{name:Ev,processEvent:i=>r(i)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ue=!1,this.ze=null,this.He=null,this.Be=null,this.featureFlags=new gk(this),this.toolbar=new GP(this),this.scrollManager=new Ck(this),this.pageViewManager=new qh(this),this.surveys=new jk(this),this.conversations=new Tk(this),this.logs=new Pk(this),this.experiments=new Pt(this),this.exceptions=new nk(this),this.rateLimiter=new kk(this),this.requestRouter=new Ok(this),this.consent=new FP(this),this.externalIntegrations=new Mk(this),this.people={set:(e,n,s)=>{var r=Ve(e)?{[e]:n}:e;this.setPersonProperties(r),s?.({})},set_once:(e,n,s)=>{var r=Ve(e)?{[e]:n}:e;this.setPersonProperties(void 0,r),s?.({})}},this.on("eventCaptured",e=>W.info('send "'+e?.event+'"',e))}init(e,n,s){if(s&&s!==Bs){var r,i=(r=Qr[s])!==null&&r!==void 0?r:new fn;return i._init(e,n,s),Qr[s]=i,Qr[Bs][s]=i,i}return this._init(e,n,s)}_init(e,n,s){var r;if(n===void 0&&(n={}),U(e)||ic(e))return W.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.qe(n.debug),this.We=n,this.Ge=[],n.person_profiles?this.He=n.person_profiles:n.process_person&&(this.He=n.process_person),this.set_config(Ne({},dp(n.defaults),hp(n),{name:s,token:e})),this.config.on_xhr_error&&W.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:un.GZipJS;var i=this.Ve();this.persistence=new dl(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new dl(z({},this.config,{persistence:"sessionStorage"}),i);var a=z({},this.persistence.props),l=z({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Je=new Sk(w=>this.Ke(w),this.config.request_queue_config),this.Ye=new Ak(this),this.__request_queue=[];var c=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new cp(this),this.sessionPropsManager=new lp(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(W.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Xe(c)},0)):(W.info("Initializing extensions synchronously"),this.Xe(c)),An.DEBUG=An.DEBUG||this.config.debug,An.DEBUG&&W.info("Starting in debug mode",{this:this,config:n,thisC:z({},this.config),p:a,s:l}),((r=n.bootstrap)==null?void 0:r.distinctID)!==void 0){var u,d,p=this.config.get_device_id(Yn()),f=(u=n.bootstrap)!=null&&u.isIdentifiedID?p:n.bootstrap.distinctID;this.persistence.set_property(ln,(d=n.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:f})}if(this.Qe()){var g,y,m=Object.keys(((g=n.bootstrap)==null?void 0:g.featureFlags)||{}).filter(w=>{var E;return!((E=n.bootstrap)==null||(E=E.featureFlags)==null||!E[w])}).reduce((w,E)=>{var T;return w[E]=((T=n.bootstrap)==null||(T=T.featureFlags)==null?void 0:T[E])||!1,w},{}),x=Object.keys(((y=n.bootstrap)==null?void 0:y.featureFlagPayloads)||{}).filter(w=>m[w]).reduce((w,E)=>{var T,j;return(T=n.bootstrap)!=null&&(T=T.featureFlagPayloads)!=null&&T[E]&&(w[E]=(j=n.bootstrap)==null||(j=j.featureFlagPayloads)==null?void 0:j[E]),w},{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:x})}if(c)this.register_once({distinct_id:Sr,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Yn());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(ln,"anonymous")}return Me(R,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?zP(this,()=>this.Ze()):this.Ze(),On(this.config._onCapture)&&this.config._onCapture!==Tc&&(W.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",w=>this.config._onCapture(w.event,w))),this.config.ip&&W.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Xe(e){var n=performance.now(),s=z({},fn.__defaultExtensionClasses,this.config.__extensionClasses);s.historyAutocapture&&(this.historyAutocapture=new s.historyAutocapture(this),this.historyAutocapture.startIfEnabled());var r=[];s.tracingHeaders&&r.push(()=>{new s.tracingHeaders(this).startIfEnabledOrStop()}),s.siteApps&&r.push(()=>{var i;this.siteApps=new s.siteApps(this),(i=this.siteApps)==null||i.init()}),!e&&s.sessionRecording&&r.push(()=>{this.sessionRecording=new s.sessionRecording(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&r.push(()=>{this.autocapture=new s.autocapture(this),this.autocapture.startIfEnabled()}),r.push(()=>{this.surveys.loadIfEnabled()}),r.push(()=>{this.logs.loadIfEnabled()}),r.push(()=>{this.conversations.loadIfEnabled()}),s.productTours&&r.push(()=>{this.productTours=new s.productTours(this),this.productTours.loadIfEnabled()}),s.heatmaps&&r.push(()=>{this.heatmaps=new s.heatmaps(this),this.heatmaps.startIfEnabled()}),s.webVitalsAutocapture&&r.push(()=>{this.webVitalsAutocapture=new s.webVitalsAutocapture(this)}),s.exceptionObserver&&r.push(()=>{this.exceptionObserver=new s.exceptionObserver(this),this.exceptionObserver.startIfEnabledOrStop()}),s.deadClicksAutocapture&&r.push(()=>{this.deadClicksAutocapture=new s.deadClicksAutocapture(this,BP),this.deadClicksAutocapture.startIfEnabledOrStop()}),r.push(()=>{if(this.tr){var i=this.tr;this.tr=void 0,this.Ni(i)}}),this.ir(r,n)}ir(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.ir(e,n)},0);var s=e.shift();if(s)try{s()}catch(i){W.error("Error initializing extension:",i)}}var r=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&W.info("PostHog extensions initialized ("+r+"ms)")}Ni(e){var n,s,r,i,a,l,c,u,d;if(!B||!B.body)return W.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ni(e)},500);this.config.__preview_deferred_init_extensions&&(this.tr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=le(e.supportedCompression,un.GZipJS)?un.GZipJS:le(e.supportedCompression,un.Base64)?un.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.He?this.He:"identified_only"}),(s=this.siteApps)==null||s.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(i=this.autocapture)==null||i.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(l=this.productTours)==null||l.onRemoteConfig(e),(c=this.webVitalsAutocapture)==null||c.onRemoteConfig(e),(u=this.exceptionObserver)==null||u.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(d=this.deadClicksAutocapture)==null||d.onRemoteConfig(e)}Ze(){try{this.config.loaded(this)}catch(s){W.critical("`loaded` function failed",s)}if(this.er(),this.config.internal_or_test_user_hostname&&Ke!=null&&Ke.hostname){var e=Ke.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.rr()},1),this.sr=new $v(this),this.sr.load()}er(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Je)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Xn(this.__request_queue,e=>this.Ke(e)),this.__request_queue=[],this.er()}_handle_unload(){var e,n;this.surveys.handlePageUnload(),this.config.request_batching?(this.nr()&&this.capture("$pageleave"),(e=this.Je)==null||e.unload(),(n=this.Ye)==null||n.unload()):this.nr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(zv?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Yi(e.url,{ip:this.config.ip?1:0}),e.headers=z({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var s,r,i,a=z({},n);a.timeout=a.timeout||6e4,a.url=Yi(a.url,{_:new Date().getTime().toString(),ver:An.LIB_VERSION,compression:a.compression});var l=(s=a.transport)!==null&&s!==void 0?s:"fetch",c=_i.filter(d=>!a.disableTransport||!d.transport||!a.disableTransport.includes(d.transport)),u=(r=(i=gv(c,d=>d.transport===l))==null?void 0:i.method)!==null&&r!==void 0?r:c[0].method;if(!u)throw new Error("No available transport method");u(a)})(z({},e,{callback:n=>{var s,r;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((s=(r=this.config).on_request_error)==null||s.call(r,n)),e.callback==null||e.callback(n)}}))))}Ke(e){this.Ye?this.Ye.retriableRequest(e):this._send_request(e)}_execute_array(e){pl++;try{var n,s=[],r=[],i=[];Xn(e,l=>{l&&(n=l[0],ve(n)?i.push(l):On(l)?l.call(this):ve(l)&&n==="alias"?s.push(l):ve(l)&&n.indexOf("capture")!==-1&&On(this[n])?i.push(l):r.push(l))});var a=function(l,c){Xn(l,function(u){if(ve(u[0])){var d=c;je(u,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};a(s,this),a(r,this),a(i,this)}finally{pl--}}Qe(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){if(pl>0&&ve(e)&&Ve(e[0])){var n=fn.prototype[e[0]];On(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,s){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Je){if(this.is_capturing())if(!U(e)&&Ve(e)){var i=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(i&&!this.config.__preview_capture_bot_pageviews)){var a=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){n!=null&&n.$current_url&&!Ve(n?.$current_url)&&(W.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||s!=null&&s.ft||W.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var l=new Date,c=s?.timestamp||l,u=Yn(),d={uuid:u,event:e,properties:this.calculateEventProperties(e,n||{},c,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&i&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),s?.$set&&(d.$set=s?.$set);var p,f=e!=="$groupidentify",g=this.ar(s?.$set_once,f);if(g&&(d.$set_once=g),(d=SP(d,s!=null&&s._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,U(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),e===Hs.DISMISSED||e===Hs.SENT){var y=n?.[xi.SURVEY_ID],m=n?.[xi.SURVEY_ITERATION];p={id:y,current_iteration:m},localStorage.getItem(ip(p))||localStorage.setItem(ip(p),"true"),d.$set=z({},d.$set,{[_k({id:y,current_iteration:m},e===Hs.SENT?"responded":"dismissed")]:!0})}else e===Hs.SHOWN&&(d.$set=z({},d.$set,{[xi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var x=z({},d.properties.$set,d.$set);if(zs(x)||this.setPersonPropertiesForFlags(x),!ue(this.config.before_send)){var b=this.lr(d);if(!b)return;d=b}this.Tt.emit("eventCaptured",d);var w={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:s?._batchKey};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Ke(w):this.Je.enqueue(w),d}W.critical("This capture call is ignored due to client rate limiting.")}}else W.error("No event name provided to posthog.capture")}else W.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,s,r,i){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var a=i?void 0:this.persistence.remove_event_timer(e),l=z({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),e==="$snapshot"){var c=z({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!Ve(l.distinct_id)&&!Vn(l.distinct_id)||ic(l.distinct_id))&&W.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=ik(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(i,s.getTime());l.$session_id=p,l.$window_id=f}this.sessionPropsManager&&Ne(l,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&Ne(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(g=this.Ye)==null?void 0:g.length}catch(b){l.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Hr.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||i?e!=="$pageleave"||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=Ne(l,u),e==="$pageview"&&B&&(l.title=B.title),!U(a)){var y=s.getTime()-a;l.$duration=parseFloat((y/1e3).toFixed(3))}Ct&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Ne({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),ve(this.config.property_denylist)?je(this.config.property_denylist,function(b){delete l[b]}):W.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(W.error("sanitize_properties is deprecated. Use before_send instead"),l=m(l,e));var x=this.ur();return l.$process_person_profile=x,x&&!i&&this.hr("_calculate_event_properties"),l}ar(e,n){var s;if(n===void 0&&(n=!0),!this.persistence||!this.ur()||this.Ne)return e;var r=this.persistence.get_initial_props(),i=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),a=Ne({},r,i||{},e||{}),l=this.config.sanitize_properties;return l&&(W.error("sanitize_properties is deprecated. Use before_send instead"),a=l(a,"$set_once")),n&&(this.Ne=!0),zs(a)?void 0:a}register(e,n){var s;(s=this.persistence)==null||s.register(e,n)}register_once(e,n,s){var r;(r=this.persistence)==null||r.register_once(e,n,s)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}dr(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){return this.featureFlags.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,n,s){var r=s!=null&&s.merge?this.featureFlags.getFlagVariants():{},i=s!=null&&s.merge?this.featureFlags.getFlagPayloads():{},a=z({},r,e),l=z({},i,n),c={};for(var[u,d]of Object.entries(a)){var p=typeof d=="string";c[u]={key:u,enabled:!!p||!!d,variant:p?d:void 0,reason:void 0,metadata:U(l?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}}}this.featureFlags.receivedFeatureFlags({flags:c})}updateEarlyAccessFeatureEnrollment(e,n,s){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,s)}getEarlyAccessFeatures(e,n,s){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,s)}on(e,n){return this.Tt.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,s;return(n=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=xk),this.surveys.displaySurvey(e,n)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,s){if(!this.__loaded||!this.persistence)return W.uninitializedWarning("posthog.identify");if(Vn(e)&&(e=e.toString(),W.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))W.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Sr){if(this.hr("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(Fr)&&(this.unregister(Fr),this.register({distinct_id:e}));var a=(this.persistence.get_property(ln)||"anonymous")==="anonymous";e!==r&&a?(this.persistence.set_property(ln,"identified"),this.setPersonPropertiesForFlags(z({},s||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:n||{},$set_once:s||{}}),this.Be=ep(e,n,s),this.featureFlags.setAnonymousDistinctId(r)):(n||s)&&this.setPersonProperties(n,s),e!==r&&(this.reloadFeatureFlags(),this.unregister(Bi))}}else W.critical('The string "'+Sr+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else W.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.hr("posthog.setPersonProperties")){var s=ep(this.get_distinct_id(),e,n);this.Be!==s?(this.setPersonPropertiesForFlags(z({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Be=s):W.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,s){if(e&&n){var r=this.getGroups();r[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:z({},r,{[e]:n})}),s&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:s}),this.setGroupPropertiesForFlags({[e]:s})),r[e]===n||s||this.reloadFeatureFlags()}else W.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.hr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,s,r,i,a;if(W.info("reset"),!this.__loaded)return W.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(s=this.sessionPersistence)==null||s.clear(),this.surveys.reset(),(r=this.sr)==null||r.stop(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(ln,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Be=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Sr,$device_id:null},"");else{var c=this.config.get_device_id(Yn());this.register_once({distinct_id:c,$device_id:e?c:l},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&s){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,n){return e===this.get_property(_v)?(W.critical("Attempting to create alias for existing People user - aborting."),-2):this.hr("posthog.alias")?(U(n)&&(n=this.get_distinct_id()),e!==n?(this.dr(Fr,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(W.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=z({},this.config);if(Be(e)){var s,r,i,a,l,c,u,d;Ne(this.config,hp(e));var p=this.Ve();(s=this.persistence)==null||s.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new dl(z({},this.config,{persistence:"sessionStorage"}),p);var f=this.qe(this.config.debug);Ln(f)&&(this.config.debug=f),Ln(this.config.debug)&&(this.config.debug?(An.DEBUG=!0,Ae.O()&&Ae.D("ph_debug","true"),W.info("set_config",{config:e,oldConfig:n,newConfig:z({},this.config)})):(An.DEBUG=!1,Ae.O()&&Ae.L("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.vr(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,s={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(s).some(Boolean)){var r,i,a,l,c;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),s.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),s.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),s.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),s.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(z({},r,n))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Bs;return n!==Bs&&(n=Bs+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(ln))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(ln))==="identified"}ur(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&zs(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Fr])&&((n=this.persistence)==null||(n=n.props)==null||!n[Ui]))}nr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.ur()||this.hr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.hr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}hr(e){return this.config.person_profiles==="never"?(W.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dr(Ui,!0),!0)}Ve(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}vr(){var e,n,s,r,i=this.Ve();return((e=this.persistence)==null?void 0:e.Dt)!==i&&((s=this.persistence)==null||s.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.Dt)!==i&&((r=this.sessionPersistence)==null||r.set_disabled(i)),i}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()){var s,r,i,a,l;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new cp(this),this.pageViewManager=new qh(this),this.persistence&&(this.sessionPropsManager=new lp(this,this.sessionManager,this.persistence));var c=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(l=fn.__defaultExtensionClasses)==null?void 0:l.sessionRecording;c&&(this.sessionRecording=new c(this),this.sessionRecording.startIfEnabledOrStop())}var u;this.consent.optInOut(!0),this.vr(),this.er(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(U(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.rr()}else W.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,n,s;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.vr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Sr,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(s=this.sessionRecording)==null||s.stopRecording(),this.sessionRecording=void 0,this.rr())):W.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===In.GRANTED?"granted":e===In.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.vr()}_is_bot(){return $t?Bv($t,this.config.custom_blocked_useragents):void 0}rr(){B&&(B.visibilityState==="visible"?this.Ue||(this.Ue=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.ze&&(B.removeEventListener("visibilitychange",this.ze),this.ze=null)):this.ze||(this.ze=this.rr.bind(this),Me(B,"visibilitychange",this.ze)))}debug(e){e===!1?(R?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(R?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Rt(){var e,n,s,r,i,a,l,c=this.We||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(W.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(s="advanced_disable_decide",r=!1,i=W,a=(n="advanced_disable_flags")in(e=c)&&!ue(e[n]),l=s in e&&!ue(e[s]),a?e[n]:l?(i&&i.warn("Config field '"+s+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[s]):r)}lr(e){if(ue(this.config.before_send))return e;var n=ve(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var r of n){if(s=r(s),ue(s)){var i="Event '"+e.event+"' was rejected in beforeSend function";return WT(e.event)?W.warn(i+". This can cause unexpected behavior."):W.info(i),null}s.properties&&!zs(s.properties)||W.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return s}getPageViewId(){var e;return(e=this.pageViewManager.it)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(s)})}qe(e){var n=Ln(e)&&!e,s=Ae.O()&&Ae.A("ph_debug")==="true";return!n&&(!!s||e)}}fn.__defaultExtensionClasses={},function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=kP(t.prototype[e[n]])}(fn,["identify"]);function pp(t){return t instanceof Element&&(t.id===bv||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Pa(t){return!!t&&t.nodeType===1}function Zn(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Uv(t){return!!t&&t.nodeType===3}function Hv(t){return!!t&&t.nodeType===11}function Fu(t){return t?ja(t).split(/\s+/):[]}function fp(t){var e=R?.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function Ji(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Fu(e)}function Wv(t){return ue(t)?null:ja(t).split(/(\s+)/).filter(e=>bo(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function No(t){var e="";return Pc(t)&&!Yv(t)&&t.childNodes&&t.childNodes.length&&je(t.childNodes,function(n){var s;Uv(n)&&n.textContent&&(e+=(s=Wv(n.textContent))!==null&&s!==void 0?s:"")}),ja(e)}function mp(t){return U(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var $u=["a","button","form","input","select","textarea","label"];function Gv(t,e){if(U(e))return!0;var n,s=function(i){if(e.some(a=>i.matches(a)))return{v:!0}};for(var r of t)if(n=s(r))return n.v;return!1}function Kv(t){var e=t.parentNode;return!(!e||!Pa(e))&&e}var Fk=["next","previous","prev",">","<"],gp=10,vp=[".ph-no-rageclick",".ph-no-capture"];function $k(t,e){if(!R||Bu(t))return!1;var n,s,r;if(Ln(e)?(n=!!e&&vp,s=void 0):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:vp,s=e?.content_ignorelist),n===!1)return!1;var{targetElementList:i}=qv(t,!1);return!function(a,l){if(a===!1||U(a))return!1;var c;if(a===!0)c=Fk;else{if(!ve(a))return!1;if(a.length>gp)return W.error("[PostHog] content_ignorelist array cannot exceed "+gp+" items. Use css_selector_ignorelist for more complex matching."),!1;c=a.map(u=>u.toLowerCase())}return l.some(u=>{var{safeText:d,ariaLabel:p}=u;return c.some(f=>d.includes(f)||p.includes(f))})}(s,i.map(a=>{var l;return{safeText:No(a).toLowerCase(),ariaLabel:((l=a.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}}))&&!Gv(i,n)}var Bu=t=>!t||Zn(t,"html")||!Pa(t),qv=(t,e)=>{if(!R||Bu(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,s=[t],r=t;r.parentNode&&!Zn(r,"body");)if(Hv(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var i=Kv(r);if(!i)break;if(e||$u.indexOf(i.tagName.toLowerCase())>-1)n=!0;else{var a=R.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(n=!0)}s.push(i),r=i}return{parentIsUsefulElement:n,targetElementList:s}};function Bk(t,e,n,s,r){var i,a,l,c;if(n===void 0&&(n=void 0),!R||Bu(t)||(i=n)!=null&&i.url_allowlist&&!fp(n.url_allowlist)||(a=n)!=null&&a.url_ignorelist&&fp(n.url_ignorelist))return!1;if((l=n)!=null&&l.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(y=>e.type===y))return!1}var{parentIsUsefulElement:d,targetElementList:p}=qv(t,s);if(!function(y,m){var x=m?.element_allowlist;if(U(x))return!0;var b,w=function(T){if(x.some(j=>T.tagName.toLowerCase()===j))return{v:!0}};for(var E of y)if(b=w(E))return b.v;return!1}(p,n)||!Gv(p,(c=n)==null?void 0:c.css_selector_allowlist))return!1;var f=R.getComputedStyle(t);if(f&&f.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var g=t.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(r||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(e.type)>=0;default:return d?(r||["click"]).indexOf(e.type)>=0:(r||["click"]).indexOf(e.type)>=0&&($u.indexOf(g)>-1||t.getAttribute("contenteditable")==="true")}}function Pc(t){for(var e=t;e.parentNode&&!Zn(e,"body");e=e.parentNode){var n=Ji(e);if(le(n,"ph-sensitive")||le(n,"ph-no-capture"))return!1}if(le(Ji(t),"ph-include"))return!0;var s=t.type||"";if(Ve(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=t.name||t.id||"";return!(Ve(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function Yv(t){return!!(Zn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Zn(t,"select")||Zn(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Xv="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",zk=new RegExp("^(?:"+Xv+")$"),Uk=new RegExp(Xv),Zv="\\d{3}-?\\d{2}-?\\d{4}",Hk=new RegExp("^("+Zv+")$"),Wk=new RegExp("("+Zv+")");function bo(t,e){return e===void 0&&(e=!0),!(ue(t)||Ve(t)&&(t=ja(t),(e?zk:Uk).test((t||"").replace(/[- ]/g,""))||(e?Hk:Wk).test(t)))}function Jv(t){var e=No(t);return bo(e=(e+" "+Qv(t)).trim())?e:""}function Qv(t){var e="";return t&&t.childNodes&&t.childNodes.length&&je(t.childNodes,function(n){var s;if(n&&((s=n.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=No(n);e=(e+" "+r).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Qv(n)).trim())}catch(i){W.error("[AutoCapture]",i)}}),e}function Gk(t){return function(e){var n=e.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var l of(s.attr_class.sort(),s.attr_class))a+="."+l.replace(/"/g,"");var c=z({},s.text?{text:s.text}:{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{},s.attr_id?{attr_id:s.attr_id}:{},s.attributes),u={};return vi(c).sort((d,p)=>{var[f]=d,[g]=p;return f.localeCompare(g)}).forEach(d=>{var[p,f]=d;return u[_p(p.toString())]=_p(f.toString())}),a+=":",a+=vi(u).map(d=>{var[p,f]=d;return p+'="'+f+'"'}).join("")});return n.join(";")}(function(e){return e.map(n=>{var s,r,i={text:(s=n.$el_text)==null?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)==null?void 0:r.slice(0,2048),attr_class:Kk(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return vi(n).filter(a=>{var[l]=a;return l.indexOf("attr__")===0}).forEach(a=>{var[l,c]=a;return i.attributes[l]=c}),i})}(t))}function _p(t){return t.replace(/"|\\"/g,'\\"')}function Kk(t){var e=t.attr__class;return e?ve(e)?e:Fu(e):void 0}class yp{constructor(e){this.disabled=e===!1;var n=Be(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(n-r.y)<this.thresholdPx&&s-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:n,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:s}];return!1}}var fl="$copy_autocapture",xp=Ie("[AutoCapture]");function ml(t,e){return e.length>t?e.slice(0,t)+"...":e}function qk(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Pa(e));return e}function Yk(t,e,n,s){var r=t.tagName.toLowerCase(),i={tag_name:r};$u.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=ml(1024,Jv(t)):i.$el_text=ml(1024,No(t)));var a=Ji(t);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),je(t.attributes,function(d){var p;if((!Yv(t)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!e&&bo(d.value)&&(p=d.name,!Ve(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=Fu(f).join(" ")),i["attr__"+d.name]=ml(1024,f)}});for(var l=1,c=1,u=t;u=qk(u);)l++,u.tagName===t.tagName&&c++;return i.nth_child=l,i.nth_of_type=c,i}function Xk(t,e){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=e,u=[t],d=t;d.parentNode&&!Zn(d,"body");)Hv(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var p,f=[],g={},y=!1,m=!1;if(je(u,T=>{var j=Pc(T);T.tagName.toLowerCase()==="a"&&(y=T.getAttribute("href"),y=j&&y&&bo(y)&&y),le(Ji(T),"ph-no-capture")&&(m=!0),f.push(Yk(T,i,a,l));var P=function(k){if(!Pc(k))return{};var S={};return je(k.attributes,function(O){if(O.name&&O.name.indexOf("data-ph-capture-attribute")===0){var D=O.name.replace("data-ph-capture-attribute-",""),M=O.value;D&&M&&bo(M)&&(S[D]=M)}}),S}(T);Ne(g,P)}),m)return{props:{},explicitNoCapture:m};if(a||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?f[0].$el_text=Jv(t):f[0].$el_text=No(t)),y){var x,b;f[0].attr__href=y;var w=(x=Wi(y))==null?void 0:x.host,E=R==null||(b=R.location)==null?void 0:b.host;w&&E&&w!==E&&(p=y)}return{props:Ne({$event_type:r.type,$ce_version:1},c?{}:{$elements:f},{$elements_chain:Gk(f)},(n=f[0])!=null&&n.$el_text?{$el_text:(s=f[0])==null?void 0:s.$el_text}:{},p&&r.type==="click"?{$external_click_url:p}:{},g)}}var Lr=Ie("[ExceptionAutocapture]");function bp(t,e,n){try{if(!(e in t))return()=>{};var s=t[e],r=n(s);return On(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=r,()=>{t[e]=s}}catch{return()=>{}}}var Zk=Ie("[TracingHeaders]"),Un=Ie("[Web Vitals]"),wp=9e5;Ie("[SessionRecording]");var kc="[SessionRecording]",Ls=Ie(kc),Jk=Ie("[Heatmaps]");function Ep(t){return Be(t)&&"clientX"in t&&"clientY"in t&&Vn(t.clientX)&&Vn(t.clientY)}var jp=Ie("[Product Tours]"),gl="ph_product_tours",Qk=["$set_once","$set"],Hn=Ie("[SiteApps]"),eS={sessionRecording:class{get started(){var t;return!((t=this.cr)==null||!t.isStarted)}get status(){return this.cr?this.cr.status:this.pr&&!this._r?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.pr=!1,this.gr=!1,this.mr=void 0,this._instance=t,!this._instance.sessionManager)throw Ls.error("started without valid sessionManager"),new Error(kc+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(kc+' cannot be used with cookieless_mode="always"')}get _r(){var t,e=!((t=this._instance.get_property(Qo))==null||!t.enabled),n=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return R&&e&&n&&!s}startIfEnabledOrStop(t){var e;if(!this._r||(e=this.cr)==null||!e.isStarted){var n=!U(Object.assign)&&!U(Array.from);this._r&&n?(this.br(t),Ls.info("starting")):this.stopRecording()}}br(t){var e,n,s;this._r&&(J!=null&&(e=J.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=J.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yr(t):(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.wr,r=>{if(r)return Ls.error("could not load recorder",r);this.yr(t)}))}stopRecording(){var t,e;(t=this.mr)==null||t.call(this),this.mr=void 0,(e=this.cr)==null||e.stop()}$r(){var t;(t=this._instance.persistence)==null||t.unregister(xv)}Er(t){if(this._instance.persistence){var e,n,s=this._instance.persistence,r=()=>{var i=t.sessionRecording===!1?void 0:t.sessionRecording,a=i?.sampleRate,l=ue(a)?null:parseFloat(a);ue(l)&&this.$r();var c=i?.minimumDurationMilliseconds;s.register({[Qo]:z({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:z({capturePerformance:t.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:U(c)?null:c,endpoint:i?.endpoint,triggerMatchType:i?.triggerMatchType,masking:i?.masking,urlTriggers:i?.urlTriggers})})};r(),(e=this.mr)==null||e.call(this),this.mr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(r)}}onRemoteConfig(t){"sessionRecording"in t?t.sessionRecording!==!1?(this.gr=!1,this.Er(t),this.pr=!0,this.startIfEnabledOrStop()):this.pr=!0:Ls.info("skipping remote config with no sessionRecording",t)}log(t,e){var n;e===void 0&&(e="log"),(n=this.cr)!=null&&n.log?this.cr.log(t,e):Ls.warn("log called before recorder was ready")}get wr(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(Qo);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Sr(){var t,e=this._instance.get_property(Qo);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return Date.now()-n<=3e5}yr(t){var e,n;if((e=J.__PosthogExtensions__)==null||!e.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.cr||(this.cr=(n=J.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.cr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Sr()?this.cr.start(t):this.gr||(this.gr=!0,Ls.info("persisted remote config is stale, requesting fresh config before starting"),new $v(this._instance).load())}onRRwebEmit(t){var e;(e=this.cr)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.cr||(e=this._instance.persistence)==null||e.register({$replay_override_linked_flag:!0}),(t=this.cr)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.cr||(e=this._instance.persistence)==null||e.register({$replay_override_sampling:!0}),(t=this.cr)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.cr||(n=this._instance.persistence)==null||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.cr)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.cr)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.cr)==null||!n.tryAddCustomEvent(t,e))}}},tS={autocapture:class{constructor(t){this.kr=!1,this.Pr=null,this.Tr=!1,this.instance=t,this.rageclicks=new yp(t.config.rageclick),this.Ir=null}get N(){var t,e,n=Be(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(s=>new RegExp(s)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(s=>new RegExp(s)),n}Cr(){if(this.isBrowserSupported()){if(R&&B){var t=n=>{n=n||R?.event;try{this.Rr(n)}catch(s){xp.error("Failed to capture event",s)}};if(Me(B,"submit",t,{capture:!0}),Me(B,"change",t,{capture:!0}),Me(B,"click",t,{capture:!0}),this.N.capture_copied_text){var e=n=>{n=n||R?.event,this.Rr(n,fl)};Me(B,"copy",e,{capture:!0}),Me(B,"cut",e,{capture:!0})}}}else xp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.kr&&(this.Cr(),this.kr=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Tr=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Mh]:!!t.autocapture_opt_out}),this.Pr=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ir=t}getElementSelectors(t){var e,n=[];return(e=this.Ir)==null||e.forEach(s=>{var r=B?.querySelectorAll(s);r?.forEach(i=>{t===i&&n.push(s)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[Mh],s=this.Pr;if(sn(s)&&!Ln(n)&&!this.instance.Rt())return!1;var r=(e=this.Pr)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Rr(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,s=mp(t);Uv(s)&&(s=s.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&$k(s,this.instance.config.rageclick)&&this.Rr(t,"$rageclick");var r=e===fl;if(s&&Bk(s,t,this.N,r,r?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:a}=Xk(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.Tr});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(i.$element_selectors=l),e===fl){var c,u=Wv(R==null||(c=R.getSelection())==null?void 0:c.toString()),d=t.type||"clipboard";if(!u)return!1;i.$selected_content=u,i.$copy_type=d}return this.instance.capture(e,i),!0}}}isBrowserSupported(){return On(B?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Fr=(R==null||(e=R.location)==null?void 0:e.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(W.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Or&&this.Or(),this.Or=void 0,W.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(R&&R.history){var n=this;(t=R.history.pushState)!=null&&t.__posthog_wrapped__||bp(R.history,"pushState",s=>function(r,i,a){s.call(this,r,i,a),n.Mr("pushState")}),(e=R.history.replaceState)!=null&&e.__posthog_wrapped__||bp(R.history,"replaceState",s=>function(r,i,a){s.call(this,r,i,a),n.Mr("replaceState")}),this.Ar()}}Mr(t){try{var e,n=R==null||(e=R.location)==null?void 0:e.pathname;if(!n)return;n!==this.Fr&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.Fr=n}catch(s){W.error("Error capturing "+t+" pageview",s)}}Ar(){if(!this.Or){var t=()=>{this.Mr("popstate")};Me(R,"popstate",t),this.Or=()=>{R&&R.removeEventListener("popstate",t)}}}},heatmaps:class{constructor(t){var e;this.jr=!1,this.kr=!1,this.Dr=null,this.instance=t,this.jr=!((e=this.instance.persistence)==null||!e.props[hc]),this.rageclicks=new yp(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return Be(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return ue(this.instance.config.capture_heatmaps)?ue(this.instance.config.enable_heatmaps)?this.jr:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.kr)return;Jk.info("starting..."),this.Lr(),this.Nr()}else{var t;clearInterval((t=this.Dr)!==null&&t!==void 0?t:void 0),this.Ur(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[hc]:e}),this.jr=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}zr(t){this.Hr(t.originalEvent,"deadclick")}Nr(){this.Dr&&clearInterval(this.Dr),this.Dr=function(t){return t?.visibilityState==="visible"}(B)?setInterval(this.te.bind(this),this.flushIntervalMilliseconds):null}Lr(){R&&B&&(this.Br=this.te.bind(this),Me(R,"beforeunload",this.Br),this.qr=t=>this.Hr(t||R?.event),Me(B,"click",this.qr,{capture:!0}),this.Wr=t=>this.Gr(t||R?.event),Me(B,"mousemove",this.Wr,{capture:!0}),this.Vr=new Wh(this.instance,$P,this.zr.bind(this)),this.Vr.startIfEnabledOrStop(),this.Jr=this.Nr.bind(this),Me(B,"visibilitychange",this.Jr),this.kr=!0)}Ur(){var t;R&&B&&(this.Br&&R.removeEventListener("beforeunload",this.Br),this.qr&&B.removeEventListener("click",this.qr,{capture:!0}),this.Wr&&B.removeEventListener("mousemove",this.Wr,{capture:!0}),this.Jr&&B.removeEventListener("visibilitychange",this.Jr),clearTimeout(this.Kr),(t=this.Vr)==null||t.stop(),this.kr=!1)}Yr(t,e){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),i=function(a,l,c){for(var u=a;u&&Pa(u)&&!Zn(u,"body");){if(u===c)return!1;if(le(l,R?.getComputedStyle(u).position))return!0;u=Kv(u)}return!1}(mp(t),["fixed","sticky"],r);return{x:t.clientX+(i?0:s),y:t.clientY+(i?0:n),target_fixed:i,type:e}}Hr(t,e){var n;if(e===void 0&&(e="click"),!pp(t.target)&&Ep(t)){var s=this.Yr(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Xr(z({},s,{type:"rageclick"})),this.Xr(s)}}Gr(t){!pp(t.target)&&Ep(t)&&(clearTimeout(this.Kr),this.Kr=setTimeout(()=>{this.Xr(this.Yr(t,"mousemove"))},500))}Xr(t){if(R){var e=R.location.href,n=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,r=n?ar([],cr,s||[]):[],i=yo(e,r,xo);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(t)}}te(){this.R&&!zs(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Wh,webVitalsAutocapture:class{constructor(t){var e;this.jr=!1,this.kr=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qr=()=>{clearTimeout(this.Zr),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((n,s)=>z({},n,{["$web_vitals_"+s.name+"_event"]:z({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ts=n=>{var s,r=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(U(r))Un.error("Could not read session ID. Dropping metrics!");else{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.es();U(i)||(ue(n?.name)||ue(n?.value)?Un.error("Invalid metric received",n):this.rs&&n.value>=this.rs?Un.error("Ignoring metric with value >= "+this.rs,n):(this.R.url!==i&&(this.Qr(),this.Zr=setTimeout(this.Qr,this.flushToCaptureTimeoutMs)),U(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=U(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.R.metrics.push(z({},n,{$current_url:i,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.R.metrics.length===this.allowedMetrics.length&&this.Qr()))}},this.ss=()=>{if(!this.kr){var n,s,r,i,a=J.__PosthogExtensions__;U(a)||U(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:r,onINP:i}=a.postHogWebVitalsCallbacks),n&&s&&r&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.ts.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.ts.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.ts.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.ts.bind(this)),this.kr=!0):Un.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.jr=!((e=this._instance.persistence)==null||!e.props[$h]),this.startIfEnabled()}get allowedMetrics(){var t,e,n=Be(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return ue(n)?((e=this._instance.persistence)==null?void 0:e.props[zh])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Be(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Be(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return t!=null&&t}get rs(){var t=Be(this._instance.config.capture_performance)&&Vn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:wp;return 0<t&&t<=6e4?wp:t}get isEnabled(){var t=Ke?.protocol;if(t!=="http:"&&t!=="https:")return Un.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Be(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Ln(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Ln(e)?e:this.jr}startIfEnabled(){this.isEnabled&&!this.kr&&(Un.info("enabled, starting..."),this.V(this.ss))}onRemoteConfig(t){if("capturePerformance"in t){var e=Be(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=Be(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[$h]:e}),this._instance.persistence.register({[zh]:n})),this.jr=e,this.startIfEnabled()}}V(t){var e,n;if((e=J.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks)t();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=J.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,s,r=>{r?Un.error("failed to load script",r):t()})}}es(){var t=R?R.location.href:void 0;if(t){var e=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,s=e?ar([],cr,n||[]):[];return yo(t,s,xo)}Un.error("Could not determine current URL")}}},nS={exceptionObserver:class{constructor(t){var e,n,s;this.ss=()=>{var r;if(R&&this.isEnabled&&(r=J.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var i=J.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=J.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=J.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ns&&this.N.capture_unhandled_errors&&(this.ns=i(this.captureException.bind(this))),!this.os&&this.N.capture_unhandled_rejections&&(this.os=a(this.captureException.bind(this))),!this.ls&&this.N.capture_console_errors&&(this.ls=l(this.captureException.bind(this)))}catch(c){Lr.error("failed to start",c),this.us()}}},this._instance=t,this.hs=!((e=this._instance.persistence)==null||!e.props[Vh]),this.ds=new qT({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:Lr}),this.N=this.vs(),this.startIfEnabledOrStop()}vs(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Be(t)?e=z({},e,t):(U(t)?this.hs:t)&&(e=z({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Lr.info("enabled"),this.us(),this.V(this.ss)):this.us()}V(t){var e,n;(e=J.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=J.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return Lr.error("failed to load script",s);t()})}us(){var t,e,n;(t=this.ns)==null||t.call(this),this.ns=void 0,(e=this.os)==null||e.call(this),this.os=void 0,(n=this.ls)==null||n.call(this),this.ls=void 0}onRemoteConfig(t){if("autocaptureExceptions"in t){var e=t.autocaptureExceptions;this.hs=!!e||!1,this._instance.persistence&&this._instance.persistence.register({[Vh]:this.hs}),this.N=this.vs(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.vs()}captureException(t){var e,n,s=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.ds.consumeRateLimit(s)?Lr.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(t)}}},sS={productTours:class{constructor(t){this.cs=null,this.fs=null,this._instance=t}onRemoteConfig(t){"productTours"in t&&(this._instance.persistence&&this._instance.persistence.register({[Bh]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.cs||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(Bh)||this.V(()=>this.ps())}V(t){var e,n;(e=J.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=J.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",s=>{s?jp.error("Could not load product tours script",s):t()})}ps(){var t;!this.cs&&(t=J.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.cs=J.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!ve(this.fs)||e){var n=this._instance.persistence;if(n){var s=n.props[gl];if(ve(s)&&!e)return this.fs=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{var i=r.statusCode;if(i!==200||!r.json){var a="Product Tours API could not be loaded, status: "+i;return jp.error(a),void t([],{isLoaded:!1,error:a})}var l=ve(r.json.product_tours)?r.json.product_tours:[];this.fs=l,n&&n.register({[gl]:l}),t(l,{isLoaded:!0})}})}else t(this.fs,{isLoaded:!0})}getActiveProductTours(t){ue(this.cs)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.cs.getActiveProductTours(t)}showProductTour(t){var e;(e=this.cs)==null||e.showTourById(t)}previewTour(t){this.cs?this.cs.previewTour(t):this.V(()=>{var e;this.ps(),(e=this.cs)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.cs)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.cs)==null||t.nextStep()}previousStep(){var t;(t=this.cs)==null||t.previousStep()}clearCache(){var t;this.fs=null,(t=this._instance.persistence)==null||t.unregister(gl)}resetTour(t){var e;(e=this.cs)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.cs)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.cs)==null||e.cancelPendingTour(t)}}},rS={siteApps:class{constructor(t){this._instance=t,this._s=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}gs(t,e){if(e){var n=this.globalsForEvent(e);this._s.push(n),this._s.length>1e3&&(this._s=this._s.slice(10))}}get siteAppLoaders(){var t;return(t=J._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.gs.bind(this));this.bs=()=>{t(),this._s=[],this.bs=void 0}}}globalsForEvent(t){var e,n,s,r,i,a,l;if(!t)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[p,f]of Object.entries(d))c[p]={id:u[p],type:p,properties:f};var{$set_once:g,$set:y}=t;return{event:z({},Kg(t,Qk),{properties:z({},t.properties,y?{$set:z({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},y)}:{},g?{$set_once:z({},(s=(r=t.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(i=(a=t.properties)==null?void 0:a.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=t.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var a;!e.errored&&this._s.length&&(Hn.info("Processing "+this._s.length+" events for site app with id "+t.id),this._s.forEach(l=>e.processEvent==null?void 0:e.processEvent(l)),e.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.bs)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Hn.info("Site app with id "+t.id+" "+(a?"loaded":"errored")),s&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback:a=>{r(a)}});i&&(e.processEvent=i),s=!0}catch(a){Hn.error("Error while initializing PostHog app with config id "+t.id,a),r(!1)}if(s&&e.loaded)try{n()}catch(a){Hn.error("Error while processing buffered events PostHog app with config id "+t.id,a),e.errored=!0}}ys(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ws(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(s){Hn.error("Error while processing event "+t.event+" for site app "+n.id,s)}}}onRemoteConfig(t){var e,n,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.ys(),void this._instance.on("eventCaptured",c=>this.ws(c))):void Hn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.bs)==null||n.call(this),(s=t.siteApps)!=null&&s.length)if(this.isEnabled){var i=function(c){var u;J["__$$ph_site_app_"+c]=r._instance,(u=J.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(r._instance,l,d=>{if(d)return Hn.error("Error while initializing PostHog app with config id "+c,d)})};for(var{id:a,url:l}of t.siteApps)i(a)}else Hn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},oS=z({},eS,tS,nS,sS,rS,{tracingHeaders:class{constructor(t){this.xs=void 0,this.$s=void 0,this.ss=()=>{var e,n;U(this.xs)&&((e=J.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),U(this.$s)&&((n=J.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}V(t){var e,n;(e=J.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=J.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return Zk.error("failed to load script",s);t()})}startIfEnabledOrStop(){var t,e;this._instance.config.__add_tracing_headers?this.V(this.ss):((t=this.xs)==null||t.call(this),(e=this.$s)==null||e.call(this),this.xs=void 0,this.$s=void 0)}}});fn.__defaultExtensionClasses=z({},oS);var Tp;(function(t){return t.SHOWN="product tour shown",t.DISMISSED="product tour dismissed",t.COMPLETED="product tour completed",t.STEP_SHOWN="product tour step shown",t.STEP_COMPLETED="product tour step completed",t.BUTTON_CLICKED="product tour button clicked",t.STEP_SELECTOR_FAILED="product tour step selector failed",t.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",t.BANNER_ACTION_CLICKED="product tour banner action clicked",t})({});(function(t){return t.TOUR_ID="$product_tour_id",t.TOUR_NAME="$product_tour_name",t.TOUR_ITERATION="$product_tour_iteration",t.TOUR_RENDER_REASON="$product_tour_render_reason",t.TOUR_STEP_ID="$product_tour_step_id",t.TOUR_STEP_ORDER="$product_tour_step_order",t.TOUR_STEP_TYPE="$product_tour_step_type",t.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",t.TOUR_BUTTON_TEXT="$product_tour_button_text",t.TOUR_BUTTON_ACTION="$product_tour_button_action",t.TOUR_BUTTON_LINK="$product_tour_button_link",t.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",t.TOUR_STEPS_COUNT="$product_tour_steps_count",t.TOUR_STEP_SELECTOR="$product_tour_step_selector",t.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",t.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",t.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",t.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",t.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",t.TOUR_ERROR="$product_tour_error",t.TOUR_MATCHES_COUNT="$product_tour_matches_count",t.TOUR_FAILURE_PHASE="$product_tour_failure_phase",t.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",t.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",t.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",t.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",t.USE_MANUAL_SELECTOR="$use_manual_selector",t.INFERENCE_DATA_PRESENT="$inference_data_present",t})({});var eo=(Tp=Qr[Bs]=new fn,function(){function t(){t.done||(t.done=!0,zv=!1,je(Qr,function(e){e._dom_loaded()}))}B!=null&&B.addEventListener?B.readyState==="complete"?t():Me(B,"DOMContentLoaded",t,{capture:!1}):R&&W.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Tp);const iS=Object.freeze(Object.defineProperty({__proto__:null,Compression:un,DisplaySurveyType:Zi,PostHog:fn,SurveyEventName:Hs,SurveyEventProperties:xi,SurveyEventType:$s,SurveyType:yi,default:eo,posthog:eo},Symbol.toStringTag,{value:"Module"})),vl={trackPageView:(t,e)=>{typeof window<"u"&&window.gtag&&window.gtag("config","G-RKW2321F04",{page_path:t,page_title:e||document.title})},trackEvent:(t,e)=>{typeof window<"u"&&window.gtag&&window.gtag("event",t,e),typeof window<"u"&&eo.capture(t,e)},identifyUser:(t,e)=>{typeof window<"u"&&eo.identify(t,e)},resetUser:()=>{typeof window<"u"&&eo.reset()},initialize:()=>{typeof window<"u"&&window.gtag&&window.gtag("config","G-RKW2321F04",{page_path:window.location.pathname,page_title:document.title})}},aS=(t,e,n)=>{const s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})};var lS=function(e){return{type:"backend",init:function(s,r,i){},read:function(s,r,i){if(typeof e=="function"){if(e.length<3){try{var a=e(s,r);a&&typeof a.then=="function"?a.then(function(l){return i(null,l&&l.default||l)}).catch(i):i(null,a)}catch(l){i(l)}return}e(s,r,i);return}i(null,e&&e[s]&&e[s][r])}}};const en=["en","zh","bn","es","ja","ko","th","vi","hi","pt","fil","ms","id","my","km","lo"],e0=["navbar","footer"],cS={"":["home","landing"],subscription:["subscription"],stories:["stories"],themes:["themes"],watch:["watch"],theme:["themes"],about:["about"],contact:["contact"],"improve-reading":["improve-reading"],"text-checker":["text-checker"],"reading-cart":["reading-cart"],vocabulary:["vocabulary"],progress:["progress"],research:["research"],blog:["blog","newsletter"],"story-maker":["story-maker","generation"],story:["story-reader"],auth:["auth"],login:["auth"],signup:["auth"],"verify-email":["auth"],"reset-password":["auth"],terms:["terms"],privacy:["privacy"],refund:["refund"],newsletter:["newsletter"],"payment-status":["payment-status"],payment:["payment-status"],stripe:["payment-status"]};function er(t){const e=t.split("/").filter(Boolean)[0]?.toLowerCase();return en.includes(e)?e:"en"}function Sc(t){const e=t.split("/").filter(Boolean),n=e[0]?.toLowerCase(),r=((en.includes(n)?e.slice(1):e)[0]||"").toLowerCase(),i=cS[r]??[];return Array.from(new Set([...e0,...i]))}const uS=typeof window<"u"?er(window.location.pathname):"en";Rm.use(lS((t,e)=>aS(Object.assign({"../locales/bn/about.json":()=>_(()=>import("./about-BG64fQ_Y.js"),[]),"../locales/bn/auth.json":()=>_(()=>import("./auth-DaZtUTRr.js"),[]),"../locales/bn/blog.json":()=>_(()=>import("./blog-KPJWYw1V.js"),[]),"../locales/bn/contact.json":()=>_(()=>import("./contact-3LVKK4oT.js"),[]),"../locales/bn/footer.json":()=>_(()=>import("./footer-DKEcOXmI.js"),[]),"../locales/bn/generation.json":()=>_(()=>import("./generation-CAIqBAZl.js"),[]),"../locales/bn/home.json":()=>_(()=>import("./home-KZErKuZH.js"),[]),"../locales/bn/improve-reading.json":()=>_(()=>import("./improve-reading-DixZypLF.js"),[]),"../locales/bn/landing.json":()=>_(()=>import("./landing-D7aa6PYC.js"),[]),"../locales/bn/navbar.json":()=>_(()=>import("./navbar-DDBdlfaa.js"),[]),"../locales/bn/newsletter.json":()=>_(()=>import("./newsletter-1T6UBzkr.js"),[]),"../locales/bn/notfound.json":()=>_(()=>import("./notfound-B7cD9va5.js"),[]),"../locales/bn/payment-status.json":()=>_(()=>import("./payment-status-wgfjMmgM.js"),[]),"../locales/bn/privacy.json":()=>_(()=>import("./privacy-DTLzvZAR.js"),[]),"../locales/bn/progress.json":()=>_(()=>import("./progress-BqdnlXWY.js"),[]),"../locales/bn/reading-cart.json":()=>_(()=>import("./reading-cart-D494vB_1.js"),[]),"../locales/bn/refund.json":()=>_(()=>import("./refund-75w9UWZs.js"),[]),"../locales/bn/research.json":()=>_(()=>import("./research-DVv6BBnz.js"),[]),"../locales/bn/stories.json":()=>_(()=>import("./stories-Dk76aJuS.js"),[]),"../locales/bn/story-maker.json":()=>_(()=>import("./story-maker-RziEAVPr.js"),[]),"../locales/bn/story-reader.json":()=>_(()=>import("./story-reader-BdR7Z5iv.js"),[]),"../locales/bn/subscription.json":()=>_(()=>import("./subscription-BaNreiWB.js"),[]),"../locales/bn/terms.json":()=>_(()=>import("./terms-DKuS4yZL.js"),[]),"../locales/bn/text-checker.json":()=>_(()=>import("./text-checker-BWMKEg7F.js"),[]),"../locales/bn/themes.json":()=>_(()=>import("./themes-CmGQZeiD.js"),[]),"../locales/bn/vocabulary.json":()=>_(()=>import("./vocabulary-wO2ezrz2.js"),[]),"../locales/bn/watch.json":()=>_(()=>import("./watch-DzHr5ozm.js"),[]),"../locales/en/about.json":()=>_(()=>import("./about-DgKnnSNm.js"),[]),"../locales/en/auth.json":()=>_(()=>import("./auth-C5AvdS8j.js"),[]),"../locales/en/blog.json":()=>_(()=>import("./blog-C3rIA2IU.js"),[]),"../locales/en/contact.json":()=>_(()=>import("./contact-B1ewm6S_.js"),[]),"../locales/en/footer.json":()=>_(()=>import("./footer-BbXLuQCS.js"),[]),"../locales/en/generation.json":()=>_(()=>import("./generation-JCArqtyT.js"),[]),"../locales/en/home.json":()=>_(()=>import("./home-BanXnn_p.js"),[]),"../locales/en/improve-reading.json":()=>_(()=>import("./improve-reading-D7vUD39L.js"),[]),"../locales/en/landing.json":()=>_(()=>import("./landing-CcLSFaO6.js"),[]),"../locales/en/navbar.json":()=>_(()=>import("./navbar-ClgAPP39.js"),[]),"../locales/en/newsletter.json":()=>_(()=>import("./newsletter-BaqeoYHu.js"),[]),"../locales/en/notfound.json":()=>_(()=>import("./notfound-B-SFY30Q.js"),[]),"../locales/en/payment-status.json":()=>_(()=>import("./payment-status-C7SHYdC9.js"),[]),"../locales/en/privacy.json":()=>_(()=>import("./privacy-D9qnP2jO.js"),[]),"../locales/en/progress.json":()=>_(()=>import("./progress-DgsNVXKq.js"),[]),"../locales/en/reading-cart.json":()=>_(()=>import("./reading-cart-CkwzX-Nj.js"),[]),"../locales/en/refund.json":()=>_(()=>import("./refund-CC1P1Dku.js"),[]),"../locales/en/research.json":()=>_(()=>import("./research-TCPPhDw2.js"),[]),"../locales/en/stories.json":()=>_(()=>import("./stories-C52kGUJW.js"),[]),"../locales/en/story-maker.json":()=>_(()=>import("./story-maker-BphXyo_N.js"),[]),"../locales/en/story-reader.json":()=>_(()=>import("./story-reader-CZB7hzKs.js"),[]),"../locales/en/subscription.json":()=>_(()=>import("./subscription-ZK2LXc8l.js"),[]),"../locales/en/terms.json":()=>_(()=>import("./terms-NVC40PjG.js"),[]),"../locales/en/text-checker.json":()=>_(()=>import("./text-checker-BF78VDjU.js"),[]),"../locales/en/themes.json":()=>_(()=>import("./themes-B2TyhWSH.js"),[]),"../locales/en/vocabulary.json":()=>_(()=>import("./vocabulary-C67iu2IS.js"),[]),"../locales/en/watch.json":()=>_(()=>import("./watch-BSSr9HGg.js"),[]),"../locales/es/about.json":()=>_(()=>import("./about-CRiaZtZJ.js"),[]),"../locales/es/auth.json":()=>_(()=>import("./auth-B3M4s0kP.js"),[]),"../locales/es/blog.json":()=>_(()=>import("./blog-BkG02Bvo.js"),[]),"../locales/es/contact.json":()=>_(()=>import("./contact-BZPyAx2-.js"),[]),"../locales/es/footer.json":()=>_(()=>import("./footer-CzDtIS-U.js"),[]),"../locales/es/generation.json":()=>_(()=>import("./generation-BGYt0qeX.js"),[]),"../locales/es/home.json":()=>_(()=>import("./home-DE-i9uDr.js"),[]),"../locales/es/improve-reading.json":()=>_(()=>import("./improve-reading-DoQhr0LR.js"),[]),"../locales/es/landing.json":()=>_(()=>import("./landing-D6efA0py.js"),[]),"../locales/es/navbar.json":()=>_(()=>import("./navbar-Ddt3IGZP.js"),[]),"../locales/es/newsletter.json":()=>_(()=>import("./newsletter-C7lJho9h.js"),[]),"../locales/es/notfound.json":()=>_(()=>import("./notfound-nm5EuQDx.js"),[]),"../locales/es/payment-status.json":()=>_(()=>import("./payment-status-B32pY1CE.js"),[]),"../locales/es/privacy.json":()=>_(()=>import("./privacy-CLStpuoK.js"),[]),"../locales/es/progress.json":()=>_(()=>import("./progress-DRD2VZkO.js"),[]),"../locales/es/reading-cart.json":()=>_(()=>import("./reading-cart-DzwyAiKJ.js"),[]),"../locales/es/refund.json":()=>_(()=>import("./refund-CHPr9L0z.js"),[]),"../locales/es/research.json":()=>_(()=>import("./research--Hct03du.js"),[]),"../locales/es/stories.json":()=>_(()=>import("./stories-DgTBOhEj.js"),[]),"../locales/es/story-maker.json":()=>_(()=>import("./story-maker-DXkYKt0-.js"),[]),"../locales/es/story-reader.json":()=>_(()=>import("./story-reader-B4aY0IES.js"),[]),"../locales/es/subscription.json":()=>_(()=>import("./subscription-Bemw-Kch.js"),[]),"../locales/es/terms.json":()=>_(()=>import("./terms-CTcFR6yJ.js"),[]),"../locales/es/text-checker.json":()=>_(()=>import("./text-checker-DQz3jl5F.js"),[]),"../locales/es/themes.json":()=>_(()=>import("./themes-DFXdVEzC.js"),[]),"../locales/es/vocabulary.json":()=>_(()=>import("./vocabulary-D2MvKQCN.js"),[]),"../locales/es/watch.json":()=>_(()=>import("./watch-JdqSvFe9.js"),[]),"../locales/fil/about.json":()=>_(()=>import("./about-CNCmnoiu.js"),[]),"../locales/fil/auth.json":()=>_(()=>import("./auth-Dkt4d2r7.js"),[]),"../locales/fil/blog.json":()=>_(()=>import("./blog-DQX9fxZO.js"),[]),"../locales/fil/contact.json":()=>_(()=>import("./contact-D0vEEtNz.js"),[]),"../locales/fil/footer.json":()=>_(()=>import("./footer-xt50zSpb.js"),[]),"../locales/fil/generation.json":()=>_(()=>import("./generation-0GVMr6iC.js"),[]),"../locales/fil/home.json":()=>_(()=>import("./home-jmsxlHfq.js"),[]),"../locales/fil/improve-reading.json":()=>_(()=>import("./improve-reading-Cze8A-p7.js"),[]),"../locales/fil/landing.json":()=>_(()=>import("./landing-DLiKORUf.js"),[]),"../locales/fil/navbar.json":()=>_(()=>import("./navbar-KtE_32G9.js"),[]),"../locales/fil/newsletter.json":()=>_(()=>import("./newsletter-Bl_GXLZj.js"),[]),"../locales/fil/notfound.json":()=>_(()=>import("./notfound-Cme_XJYk.js"),[]),"../locales/fil/payment-status.json":()=>_(()=>import("./payment-status-DjVuwLiT.js"),[]),"../locales/fil/privacy.json":()=>_(()=>import("./privacy-C45sz_d9.js"),[]),"../locales/fil/progress.json":()=>_(()=>import("./progress-sKZKfjeK.js"),[]),"../locales/fil/reading-cart.json":()=>_(()=>import("./reading-cart-B5Q0CDiU.js"),[]),"../locales/fil/refund.json":()=>_(()=>import("./refund-RPhirmx6.js"),[]),"../locales/fil/research.json":()=>_(()=>import("./research-DZ3J1wgD.js"),[]),"../locales/fil/stories.json":()=>_(()=>import("./stories-CN8JmZ9y.js"),[]),"../locales/fil/story-maker.json":()=>_(()=>import("./story-maker-DnTAAV5w.js"),[]),"../locales/fil/story-reader.json":()=>_(()=>import("./story-reader-CjlPYZSL.js"),[]),"../locales/fil/subscription.json":()=>_(()=>import("./subscription-DXagozb5.js"),[]),"../locales/fil/terms.json":()=>_(()=>import("./terms-enX_CnbE.js"),[]),"../locales/fil/text-checker.json":()=>_(()=>import("./text-checker-D9YyBCg8.js"),[]),"../locales/fil/themes.json":()=>_(()=>import("./themes-CSOYTL9V.js"),[]),"../locales/fil/vocabulary.json":()=>_(()=>import("./vocabulary-B1GTwI_7.js"),[]),"../locales/fil/watch.json":()=>_(()=>import("./watch-GOBO09kq.js"),[]),"../locales/hi/about.json":()=>_(()=>import("./about-CrWm4_vJ.js"),[]),"../locales/hi/auth.json":()=>_(()=>import("./auth-D156QFiK.js"),[]),"../locales/hi/blog.json":()=>_(()=>import("./blog-B7Z_QhW3.js"),[]),"../locales/hi/contact.json":()=>_(()=>import("./contact-DXHOo928.js"),[]),"../locales/hi/footer.json":()=>_(()=>import("./footer-Ca4gJP6p.js"),[]),"../locales/hi/generation.json":()=>_(()=>import("./generation-gufofxMG.js"),[]),"../locales/hi/home.json":()=>_(()=>import("./home-DUkOJjR9.js"),[]),"../locales/hi/improve-reading.json":()=>_(()=>import("./improve-reading-kYPt4zsp.js"),[]),"../locales/hi/landing.json":()=>_(()=>import("./landing-o2X8wm5x.js"),[]),"../locales/hi/navbar.json":()=>_(()=>import("./navbar-DjtHus2y.js"),[]),"../locales/hi/newsletter.json":()=>_(()=>import("./newsletter-CJMi-4CR.js"),[]),"../locales/hi/notfound.json":()=>_(()=>import("./notfound-CN83UgZB.js"),[]),"../locales/hi/payment-status.json":()=>_(()=>import("./payment-status-DB3q3O9v.js"),[]),"../locales/hi/privacy.json":()=>_(()=>import("./privacy-CkC-dwgD.js"),[]),"../locales/hi/progress.json":()=>_(()=>import("./progress-BzmrmPdp.js"),[]),"../locales/hi/reading-cart.json":()=>_(()=>import("./reading-cart-5iDZz8oL.js"),[]),"../locales/hi/refund.json":()=>_(()=>import("./refund-C_HkoAKF.js"),[]),"../locales/hi/research.json":()=>_(()=>import("./research-BF71Bau4.js"),[]),"../locales/hi/stories.json":()=>_(()=>import("./stories-B0CxHMjA.js"),[]),"../locales/hi/story-maker.json":()=>_(()=>import("./story-maker-CWqyFxHN.js"),[]),"../locales/hi/story-reader.json":()=>_(()=>import("./story-reader-C7hSXGGQ.js"),[]),"../locales/hi/subscription.json":()=>_(()=>import("./subscription-nven08Ry.js"),[]),"../locales/hi/terms.json":()=>_(()=>import("./terms-DbkrS4R2.js"),[]),"../locales/hi/text-checker.json":()=>_(()=>import("./text-checker-BZM4Rm6l.js"),[]),"../locales/hi/themes.json":()=>_(()=>import("./themes-CowRO4BH.js"),[]),"../locales/hi/vocabulary.json":()=>_(()=>import("./vocabulary-HA8QZqn1.js"),[]),"../locales/hi/watch.json":()=>_(()=>import("./watch-DLo9w3Hg.js"),[]),"../locales/id/about.json":()=>_(()=>import("./about-DgF5qk-M.js"),[]),"../locales/id/auth.json":()=>_(()=>import("./auth-CE-iSoqM.js"),[]),"../locales/id/blog.json":()=>_(()=>import("./blog-uesbcAo4.js"),[]),"../locales/id/contact.json":()=>_(()=>import("./contact-Dk0rznfa.js"),[]),"../locales/id/footer.json":()=>_(()=>import("./footer-CAGyCnDe.js"),[]),"../locales/id/generation.json":()=>_(()=>import("./generation-BVGWDqPj.js"),[]),"../locales/id/home.json":()=>_(()=>import("./home-DHvV_PLd.js"),[]),"../locales/id/improve-reading.json":()=>_(()=>import("./improve-reading-DzmfjMox.js"),[]),"../locales/id/landing.json":()=>_(()=>import("./landing-BBEEo5li.js"),[]),"../locales/id/navbar.json":()=>_(()=>import("./navbar-CMkWiVXY.js"),[]),"../locales/id/newsletter.json":()=>_(()=>import("./newsletter-AxewWafC.js"),[]),"../locales/id/notfound.json":()=>_(()=>import("./notfound-CEK5dbpt.js"),[]),"../locales/id/payment-status.json":()=>_(()=>import("./payment-status-DCFbo8xj.js"),[]),"../locales/id/privacy.json":()=>_(()=>import("./privacy-e21m_Y_C.js"),[]),"../locales/id/progress.json":()=>_(()=>import("./progress-CuUPPDWw.js"),[]),"../locales/id/reading-cart.json":()=>_(()=>import("./reading-cart-BDxyFwn3.js"),[]),"../locales/id/refund.json":()=>_(()=>import("./refund-CdTSwtl3.js"),[]),"../locales/id/research.json":()=>_(()=>import("./research-CQwR6pdT.js"),[]),"../locales/id/stories.json":()=>_(()=>import("./stories-E45j0Oj-.js"),[]),"../locales/id/story-maker.json":()=>_(()=>import("./story-maker-BIObPAge.js"),[]),"../locales/id/story-reader.json":()=>_(()=>import("./story-reader-BU7kEsXX.js"),[]),"../locales/id/subscription.json":()=>_(()=>import("./subscription-Cwyg_fB-.js"),[]),"../locales/id/terms.json":()=>_(()=>import("./terms-CwoueMBB.js"),[]),"../locales/id/text-checker.json":()=>_(()=>import("./text-checker-Wc6zch0p.js"),[]),"../locales/id/themes.json":()=>_(()=>import("./themes-B9_Drngn.js"),[]),"../locales/id/vocabulary.json":()=>_(()=>import("./vocabulary-DA_G8jTq.js"),[]),"../locales/id/watch.json":()=>_(()=>import("./watch-CjHnf1Fy.js"),[]),"../locales/ja/about.json":()=>_(()=>import("./about-KxFatAIv.js"),[]),"../locales/ja/auth.json":()=>_(()=>import("./auth-WI_ZJly7.js"),[]),"../locales/ja/blog.json":()=>_(()=>import("./blog-Bft55yPZ.js"),[]),"../locales/ja/contact.json":()=>_(()=>import("./contact-BBFLer9D.js"),[]),"../locales/ja/footer.json":()=>_(()=>import("./footer-CBZLBXLF.js"),[]),"../locales/ja/generation.json":()=>_(()=>import("./generation-nqTzHvBx.js"),[]),"../locales/ja/home.json":()=>_(()=>import("./home-s5vXzcyU.js"),[]),"../locales/ja/improve-reading.json":()=>_(()=>import("./improve-reading-CknT9bJm.js"),[]),"../locales/ja/landing.json":()=>_(()=>import("./landing-qQ_tOTMx.js"),[]),"../locales/ja/navbar.json":()=>_(()=>import("./navbar-GZs9gCOb.js"),[]),"../locales/ja/newsletter.json":()=>_(()=>import("./newsletter-DJBHGpWh.js"),[]),"../locales/ja/notfound.json":()=>_(()=>import("./notfound-S7xtzxW2.js"),[]),"../locales/ja/payment-status.json":()=>_(()=>import("./payment-status-BwvT-6IN.js"),[]),"../locales/ja/privacy.json":()=>_(()=>import("./privacy-DI-ylDP2.js"),[]),"../locales/ja/progress.json":()=>_(()=>import("./progress-B1DuFd_g.js"),[]),"../locales/ja/reading-cart.json":()=>_(()=>import("./reading-cart-D55C6fXL.js"),[]),"../locales/ja/refund.json":()=>_(()=>import("./refund-CYHonIjU.js"),[]),"../locales/ja/research.json":()=>_(()=>import("./research-ZgXtg-c2.js"),[]),"../locales/ja/stories.json":()=>_(()=>import("./stories-vm7SPOvs.js"),[]),"../locales/ja/story-maker.json":()=>_(()=>import("./story-maker-DusArRzP.js"),[]),"../locales/ja/story-reader.json":()=>_(()=>import("./story-reader-LAei_Q_Y.js"),[]),"../locales/ja/subscription.json":()=>_(()=>import("./subscription-BOVL9Td9.js"),[]),"../locales/ja/terms.json":()=>_(()=>import("./terms-CssJnV-J.js"),[]),"../locales/ja/text-checker.json":()=>_(()=>import("./text-checker-BV2n52I9.js"),[]),"../locales/ja/themes.json":()=>_(()=>import("./themes-DDgrK7FC.js"),[]),"../locales/ja/vocabulary.json":()=>_(()=>import("./vocabulary-DqvcLIhm.js"),[]),"../locales/ja/watch.json":()=>_(()=>import("./watch-B3-iAHBG.js"),[]),"../locales/km/about.json":()=>_(()=>import("./about-BwMyyRYF.js"),[]),"../locales/km/auth.json":()=>_(()=>import("./auth-CBstbspa.js"),[]),"../locales/km/blog.json":()=>_(()=>import("./blog-B4jeS0WY.js"),[]),"../locales/km/contact.json":()=>_(()=>import("./contact-BaN5uuLi.js"),[]),"../locales/km/footer.json":()=>_(()=>import("./footer-xkaDFZkq.js"),[]),"../locales/km/generation.json":()=>_(()=>import("./generation-DTr6CAZ8.js"),[]),"../locales/km/home.json":()=>_(()=>import("./home-qV0DmD3y.js"),[]),"../locales/km/improve-reading.json":()=>_(()=>import("./improve-reading-Crl05jNO.js"),[]),"../locales/km/landing.json":()=>_(()=>import("./landing-BtJ-ka4Q.js"),[]),"../locales/km/navbar.json":()=>_(()=>import("./navbar-COCjn637.js"),[]),"../locales/km/newsletter.json":()=>_(()=>import("./newsletter-D6cJuhDc.js"),[]),"../locales/km/notfound.json":()=>_(()=>import("./notfound-BoEwv3Ys.js"),[]),"../locales/km/payment-status.json":()=>_(()=>import("./payment-status-CMnm4UE4.js"),[]),"../locales/km/privacy.json":()=>_(()=>import("./privacy-wh-2zf51.js"),[]),"../locales/km/progress.json":()=>_(()=>import("./progress-Bn_lPYQf.js"),[]),"../locales/km/reading-cart.json":()=>_(()=>import("./reading-cart-F82gn_Ww.js"),[]),"../locales/km/refund.json":()=>_(()=>import("./refund-COHlwiX_.js"),[]),"../locales/km/research.json":()=>_(()=>import("./research-Dp7JOHgt.js"),[]),"../locales/km/stories.json":()=>_(()=>import("./stories-CFfmcbYB.js"),[]),"../locales/km/story-maker.json":()=>_(()=>import("./story-maker-CmBDGIKH.js"),[]),"../locales/km/story-reader.json":()=>_(()=>import("./story-reader-bfx3-pkP.js"),[]),"../locales/km/subscription.json":()=>_(()=>import("./subscription-e67C6R0c.js"),[]),"../locales/km/terms.json":()=>_(()=>import("./terms-DLR0eWQ4.js"),[]),"../locales/km/text-checker.json":()=>_(()=>import("./text-checker-DEmC9OVk.js"),[]),"../locales/km/themes.json":()=>_(()=>import("./themes-Cqd0q-0S.js"),[]),"../locales/km/vocabulary.json":()=>_(()=>import("./vocabulary-BBR6udJ7.js"),[]),"../locales/km/watch.json":()=>_(()=>import("./watch-B9aO8MKp.js"),[]),"../locales/ko/about.json":()=>_(()=>import("./about-Dx9gRJ1A.js"),[]),"../locales/ko/auth.json":()=>_(()=>import("./auth-Cnd9BKr5.js"),[]),"../locales/ko/blog.json":()=>_(()=>import("./blog-BvIRadeT.js"),[]),"../locales/ko/contact.json":()=>_(()=>import("./contact-x1ZskxyG.js"),[]),"../locales/ko/footer.json":()=>_(()=>import("./footer-wl99aztY.js"),[]),"../locales/ko/generation.json":()=>_(()=>import("./generation-BYmZNGB-.js"),[]),"../locales/ko/home.json":()=>_(()=>import("./home-BXOsa5X3.js"),[]),"../locales/ko/improve-reading.json":()=>_(()=>import("./improve-reading-mMRLlEH1.js"),[]),"../locales/ko/landing.json":()=>_(()=>import("./landing-8HjZT36F.js"),[]),"../locales/ko/navbar.json":()=>_(()=>import("./navbar-BoAPgMfM.js"),[]),"../locales/ko/newsletter.json":()=>_(()=>import("./newsletter-BksSboPo.js"),[]),"../locales/ko/notfound.json":()=>_(()=>import("./notfound-FYyFdfHR.js"),[]),"../locales/ko/payment-status.json":()=>_(()=>import("./payment-status-ChbkjUSO.js"),[]),"../locales/ko/privacy.json":()=>_(()=>import("./privacy-DcwIjlNa.js"),[]),"../locales/ko/progress.json":()=>_(()=>import("./progress-C54rdmgT.js"),[]),"../locales/ko/reading-cart.json":()=>_(()=>import("./reading-cart-Dr21iIWE.js"),[]),"../locales/ko/refund.json":()=>_(()=>import("./refund-BE8h33fk.js"),[]),"../locales/ko/research.json":()=>_(()=>import("./research-Ck6d7NiD.js"),[]),"../locales/ko/stories.json":()=>_(()=>import("./stories-B2C0hIGN.js"),[]),"../locales/ko/story-maker.json":()=>_(()=>import("./story-maker-1ZlZ1KC_.js"),[]),"../locales/ko/story-reader.json":()=>_(()=>import("./story-reader-DhHY4IAh.js"),[]),"../locales/ko/subscription.json":()=>_(()=>import("./subscription-5EBFLPMs.js"),[]),"../locales/ko/terms.json":()=>_(()=>import("./terms-NUbOcsbC.js"),[]),"../locales/ko/text-checker.json":()=>_(()=>import("./text-checker-_7k69D6l.js"),[]),"../locales/ko/themes.json":()=>_(()=>import("./themes-CdsZfpNB.js"),[]),"../locales/ko/vocabulary.json":()=>_(()=>import("./vocabulary-CEJ-XQHR.js"),[]),"../locales/ko/watch.json":()=>_(()=>import("./watch-CiNlCfsW.js"),[]),"../locales/lo/about.json":()=>_(()=>import("./about-8Nq5Pp8n.js"),[]),"../locales/lo/auth.json":()=>_(()=>import("./auth-CIF8brdW.js"),[]),"../locales/lo/blog.json":()=>_(()=>import("./blog-CKm-tMRl.js"),[]),"../locales/lo/contact.json":()=>_(()=>import("./contact-Dt96ZcUc.js"),[]),"../locales/lo/footer.json":()=>_(()=>import("./footer-DO00Ij1w.js"),[]),"../locales/lo/generation.json":()=>_(()=>import("./generation-D2B1i6GN.js"),[]),"../locales/lo/home.json":()=>_(()=>import("./home-B_iAQWUc.js"),[]),"../locales/lo/improve-reading.json":()=>_(()=>import("./improve-reading-BVonUQXC.js"),[]),"../locales/lo/landing.json":()=>_(()=>import("./landing-SmyvoPq4.js"),[]),"../locales/lo/navbar.json":()=>_(()=>import("./navbar-Cf5b8LMg.js"),[]),"../locales/lo/newsletter.json":()=>_(()=>import("./newsletter-CWQ9n19_.js"),[]),"../locales/lo/notfound.json":()=>_(()=>import("./notfound-BMBZdh8i.js"),[]),"../locales/lo/payment-status.json":()=>_(()=>import("./payment-status-DyjqNuOS.js"),[]),"../locales/lo/privacy.json":()=>_(()=>import("./privacy-CqrL_OAL.js"),[]),"../locales/lo/progress.json":()=>_(()=>import("./progress-CWuK9STw.js"),[]),"../locales/lo/reading-cart.json":()=>_(()=>import("./reading-cart-CxVUFstF.js"),[]),"../locales/lo/refund.json":()=>_(()=>import("./refund-CG5dNc3H.js"),[]),"../locales/lo/research.json":()=>_(()=>import("./research-CIZFtwRA.js"),[]),"../locales/lo/stories.json":()=>_(()=>import("./stories-CpZSXRjt.js"),[]),"../locales/lo/story-maker.json":()=>_(()=>import("./story-maker-CCLeuIFa.js"),[]),"../locales/lo/story-reader.json":()=>_(()=>import("./story-reader-NrbGXawW.js"),[]),"../locales/lo/subscription.json":()=>_(()=>import("./subscription-DMz9BdxR.js"),[]),"../locales/lo/terms.json":()=>_(()=>import("./terms-Br5Uwn39.js"),[]),"../locales/lo/text-checker.json":()=>_(()=>import("./text-checker-DHjklBQ_.js"),[]),"../locales/lo/themes.json":()=>_(()=>import("./themes-DvNgCZs0.js"),[]),"../locales/lo/vocabulary.json":()=>_(()=>import("./vocabulary-Ce4zkuJ6.js"),[]),"../locales/lo/watch.json":()=>_(()=>import("./watch-DrrkezQt.js"),[]),"../locales/ms/about.json":()=>_(()=>import("./about-X-I8QwaJ.js"),[]),"../locales/ms/auth.json":()=>_(()=>import("./auth-BAaOEjAn.js"),[]),"../locales/ms/blog.json":()=>_(()=>import("./blog-DMO8hXvZ.js"),[]),"../locales/ms/contact.json":()=>_(()=>import("./contact-BaYb8eiF.js"),[]),"../locales/ms/footer.json":()=>_(()=>import("./footer-BoE9bLTa.js"),[]),"../locales/ms/generation.json":()=>_(()=>import("./generation-5PaoeXde.js"),[]),"../locales/ms/home.json":()=>_(()=>import("./home-CRRdxIa5.js"),[]),"../locales/ms/improve-reading.json":()=>_(()=>import("./improve-reading-C4izNOPU.js"),[]),"../locales/ms/landing.json":()=>_(()=>import("./landing-CMdFATsx.js"),[]),"../locales/ms/navbar.json":()=>_(()=>import("./navbar-CKWNKby3.js"),[]),"../locales/ms/newsletter.json":()=>_(()=>import("./newsletter-HsqT5F0u.js"),[]),"../locales/ms/notfound.json":()=>_(()=>import("./notfound-BCcddZ6I.js"),[]),"../locales/ms/payment-status.json":()=>_(()=>import("./payment-status-b1mAin25.js"),[]),"../locales/ms/privacy.json":()=>_(()=>import("./privacy-BcQwZpjo.js"),[]),"../locales/ms/progress.json":()=>_(()=>import("./progress-LBrMTRyL.js"),[]),"../locales/ms/reading-cart.json":()=>_(()=>import("./reading-cart-DFjsRt72.js"),[]),"../locales/ms/refund.json":()=>_(()=>import("./refund-CWv5ymuK.js"),[]),"../locales/ms/research.json":()=>_(()=>import("./research-Zk6-1Net.js"),[]),"../locales/ms/stories.json":()=>_(()=>import("./stories-YJn9R9za.js"),[]),"../locales/ms/story-maker.json":()=>_(()=>import("./story-maker-B2s8PWXA.js"),[]),"../locales/ms/story-reader.json":()=>_(()=>import("./story-reader-DRJRYQe1.js"),[]),"../locales/ms/subscription.json":()=>_(()=>import("./subscription-BM0Quvo-.js"),[]),"../locales/ms/terms.json":()=>_(()=>import("./terms-D4-POClR.js"),[]),"../locales/ms/text-checker.json":()=>_(()=>import("./text-checker-BPVXuRsz.js"),[]),"../locales/ms/themes.json":()=>_(()=>import("./themes-BAJQmr8E.js"),[]),"../locales/ms/vocabulary.json":()=>_(()=>import("./vocabulary-D_aIyhqY.js"),[]),"../locales/ms/watch.json":()=>_(()=>import("./watch-CCJMB7rk.js"),[]),"../locales/my/about.json":()=>_(()=>import("./about-DDnv0GHL.js"),[]),"../locales/my/auth.json":()=>_(()=>import("./auth-C_kATPBn.js"),[]),"../locales/my/blog.json":()=>_(()=>import("./blog-CIsbIRX9.js"),[]),"../locales/my/contact.json":()=>_(()=>import("./contact-BccRrC1v.js"),[]),"../locales/my/footer.json":()=>_(()=>import("./footer-VZMTp4al.js"),[]),"../locales/my/generation.json":()=>_(()=>import("./generation-BdwlWHNx.js"),[]),"../locales/my/home.json":()=>_(()=>import("./home-CEceucP5.js"),[]),"../locales/my/improve-reading.json":()=>_(()=>import("./improve-reading-yJaMFEcn.js"),[]),"../locales/my/landing.json":()=>_(()=>import("./landing-Bf1Za6OQ.js"),[]),"../locales/my/navbar.json":()=>_(()=>import("./navbar-EjEToQXI.js"),[]),"../locales/my/newsletter.json":()=>_(()=>import("./newsletter-Bm-EqrXC.js"),[]),"../locales/my/notfound.json":()=>_(()=>import("./notfound-DaB8YmU7.js"),[]),"../locales/my/payment-status.json":()=>_(()=>import("./payment-status-Bnm_j6qm.js"),[]),"../locales/my/privacy.json":()=>_(()=>import("./privacy-BQTfDH9_.js"),[]),"../locales/my/progress.json":()=>_(()=>import("./progress-v-l_7wPs.js"),[]),"../locales/my/reading-cart.json":()=>_(()=>import("./reading-cart-BvU7NU1D.js"),[]),"../locales/my/refund.json":()=>_(()=>import("./refund-CbxSkgZ9.js"),[]),"../locales/my/research.json":()=>_(()=>import("./research-BPjcIBy8.js"),[]),"../locales/my/stories.json":()=>_(()=>import("./stories-FiV_cVvY.js"),[]),"../locales/my/story-maker.json":()=>_(()=>import("./story-maker-CWjYbOSJ.js"),[]),"../locales/my/story-reader.json":()=>_(()=>import("./story-reader-V0fv6Pxw.js"),[]),"../locales/my/subscription.json":()=>_(()=>import("./subscription-B17yqg_z.js"),[]),"../locales/my/terms.json":()=>_(()=>import("./terms-l7e8Rauy.js"),[]),"../locales/my/text-checker.json":()=>_(()=>import("./text-checker-CtXQpRm0.js"),[]),"../locales/my/themes.json":()=>_(()=>import("./themes-9qaCSYb_.js"),[]),"../locales/my/vocabulary.json":()=>_(()=>import("./vocabulary-CeAqYExb.js"),[]),"../locales/my/watch.json":()=>_(()=>import("./watch-D9dIoVFj.js"),[]),"../locales/pt/about.json":()=>_(()=>import("./about-C16MsxtC.js"),[]),"../locales/pt/auth.json":()=>_(()=>import("./auth-nqRnEkBR.js"),[]),"../locales/pt/blog.json":()=>_(()=>import("./blog-CM6YKmSa.js"),[]),"../locales/pt/contact.json":()=>_(()=>import("./contact-tqc8bEI8.js"),[]),"../locales/pt/footer.json":()=>_(()=>import("./footer-CXpKgAOE.js"),[]),"../locales/pt/generation.json":()=>_(()=>import("./generation-DvBxAGFk.js"),[]),"../locales/pt/home.json":()=>_(()=>import("./home-Beot51Nb.js"),[]),"../locales/pt/improve-reading.json":()=>_(()=>import("./improve-reading-2UjOqduY.js"),[]),"../locales/pt/landing.json":()=>_(()=>import("./landing-DUB9FlxZ.js"),[]),"../locales/pt/navbar.json":()=>_(()=>import("./navbar-BpLWqB9f.js"),[]),"../locales/pt/newsletter.json":()=>_(()=>import("./newsletter-ipzVLZbu.js"),[]),"../locales/pt/notfound.json":()=>_(()=>import("./notfound-pyIcecs_.js"),[]),"../locales/pt/payment-status.json":()=>_(()=>import("./payment-status-BcvFPL5g.js"),[]),"../locales/pt/privacy.json":()=>_(()=>import("./privacy-iWy0tBcT.js"),[]),"../locales/pt/progress.json":()=>_(()=>import("./progress-BtO5VQRy.js"),[]),"../locales/pt/reading-cart.json":()=>_(()=>import("./reading-cart-BX_hhi9o.js"),[]),"../locales/pt/refund.json":()=>_(()=>import("./refund-gjmk5GSP.js"),[]),"../locales/pt/research.json":()=>_(()=>import("./research-C66UaJBR.js"),[]),"../locales/pt/stories.json":()=>_(()=>import("./stories-mFPd1WZR.js"),[]),"../locales/pt/story-maker.json":()=>_(()=>import("./story-maker-DhUN8N40.js"),[]),"../locales/pt/story-reader.json":()=>_(()=>import("./story-reader-CsvMVlMI.js"),[]),"../locales/pt/subscription.json":()=>_(()=>import("./subscription-DWcnM2Dm.js"),[]),"../locales/pt/terms.json":()=>_(()=>import("./terms-C0YDX0Wa.js"),[]),"../locales/pt/text-checker.json":()=>_(()=>import("./text-checker-Bxep8kcG.js"),[]),"../locales/pt/themes.json":()=>_(()=>import("./themes-B0cO5PQt.js"),[]),"../locales/pt/vocabulary.json":()=>_(()=>import("./vocabulary-Cn50NpZR.js"),[]),"../locales/pt/watch.json":()=>_(()=>import("./watch-DOsgIn2D.js"),[]),"../locales/th/about.json":()=>_(()=>import("./about-BTnVxcRk.js"),[]),"../locales/th/auth.json":()=>_(()=>import("./auth-Co5bMhwf.js"),[]),"../locales/th/blog.json":()=>_(()=>import("./blog-lq9thkGX.js"),[]),"../locales/th/contact.json":()=>_(()=>import("./contact-Bk_EtW2q.js"),[]),"../locales/th/footer.json":()=>_(()=>import("./footer-CCaIU_DJ.js"),[]),"../locales/th/generation.json":()=>_(()=>import("./generation-C-SkB5Ob.js"),[]),"../locales/th/home.json":()=>_(()=>import("./home-Ug7H7o8K.js"),[]),"../locales/th/improve-reading.json":()=>_(()=>import("./improve-reading-Bzg_GQEI.js"),[]),"../locales/th/landing.json":()=>_(()=>import("./landing-Br1QSPwx.js"),[]),"../locales/th/navbar.json":()=>_(()=>import("./navbar-CEjfz3jM.js"),[]),"../locales/th/newsletter.json":()=>_(()=>import("./newsletter-DR8eALoU.js"),[]),"../locales/th/notfound.json":()=>_(()=>import("./notfound-DzxKM3jh.js"),[]),"../locales/th/payment-status.json":()=>_(()=>import("./payment-status-CKa_MCbe.js"),[]),"../locales/th/privacy.json":()=>_(()=>import("./privacy-Dm6TbjVg.js"),[]),"../locales/th/progress.json":()=>_(()=>import("./progress-BNFydX8n.js"),[]),"../locales/th/reading-cart.json":()=>_(()=>import("./reading-cart-C4fCk-Gh.js"),[]),"../locales/th/refund.json":()=>_(()=>import("./refund-DsnSqAtW.js"),[]),"../locales/th/research.json":()=>_(()=>import("./research-ZqPdhsKi.js"),[]),"../locales/th/stories.json":()=>_(()=>import("./stories-CWYz6ddH.js"),[]),"../locales/th/story-maker.json":()=>_(()=>import("./story-maker-CwQ6QiQo.js"),[]),"../locales/th/story-reader.json":()=>_(()=>import("./story-reader-f9cOkcCc.js"),[]),"../locales/th/subscription.json":()=>_(()=>import("./subscription-BwyUd45e.js"),[]),"../locales/th/terms.json":()=>_(()=>import("./terms-BhE9fxdU.js"),[]),"../locales/th/text-checker.json":()=>_(()=>import("./text-checker-B0KuMEhw.js"),[]),"../locales/th/themes.json":()=>_(()=>import("./themes-Cnl3epmL.js"),[]),"../locales/th/vocabulary.json":()=>_(()=>import("./vocabulary-CPgo2N2F.js"),[]),"../locales/th/watch.json":()=>_(()=>import("./watch-CeYcjk07.js"),[]),"../locales/vi/about.json":()=>_(()=>import("./about-BX5_4xIq.js"),[]),"../locales/vi/auth.json":()=>_(()=>import("./auth-CERlQ-8t.js"),[]),"../locales/vi/blog.json":()=>_(()=>import("./blog-M41NjzXI.js"),[]),"../locales/vi/contact.json":()=>_(()=>import("./contact-BSqzZQuw.js"),[]),"../locales/vi/footer.json":()=>_(()=>import("./footer-C8HJbKGC.js"),[]),"../locales/vi/generation.json":()=>_(()=>import("./generation-CqQMMgqA.js"),[]),"../locales/vi/home.json":()=>_(()=>import("./home-g7xYSPee.js"),[]),"../locales/vi/improve-reading.json":()=>_(()=>import("./improve-reading-DIp-7WE6.js"),[]),"../locales/vi/landing.json":()=>_(()=>import("./landing-D8FDkU-K.js"),[]),"../locales/vi/navbar.json":()=>_(()=>import("./navbar-DmNi05JL.js"),[]),"../locales/vi/newsletter.json":()=>_(()=>import("./newsletter-BHahPilQ.js"),[]),"../locales/vi/notfound.json":()=>_(()=>import("./notfound-BzE0g0SH.js"),[]),"../locales/vi/payment-status.json":()=>_(()=>import("./payment-status-CcSJMXeR.js"),[]),"../locales/vi/privacy.json":()=>_(()=>import("./privacy-CGV1fVVB.js"),[]),"../locales/vi/progress.json":()=>_(()=>import("./progress-Cx2Z2OAA.js"),[]),"../locales/vi/reading-cart.json":()=>_(()=>import("./reading-cart-BIXJh__Z.js"),[]),"../locales/vi/refund.json":()=>_(()=>import("./refund-BxcMDtXh.js"),[]),"../locales/vi/research.json":()=>_(()=>import("./research-DrKboBWn.js"),[]),"../locales/vi/stories.json":()=>_(()=>import("./stories-CFPRQUo5.js"),[]),"../locales/vi/story-maker.json":()=>_(()=>import("./story-maker-JMCydV8V.js"),[]),"../locales/vi/story-reader.json":()=>_(()=>import("./story-reader-CbT6ODZW.js"),[]),"../locales/vi/subscription.json":()=>_(()=>import("./subscription-CJ_0vTHN.js"),[]),"../locales/vi/terms.json":()=>_(()=>import("./terms-BOBUQPx_.js"),[]),"../locales/vi/text-checker.json":()=>_(()=>import("./text-checker-CY2UjX0Z.js"),[]),"../locales/vi/themes.json":()=>_(()=>import("./themes-C2DaOhB6.js"),[]),"../locales/vi/vocabulary.json":()=>_(()=>import("./vocabulary-DJZtk-iW.js"),[]),"../locales/vi/watch.json":()=>_(()=>import("./watch-wgKUAAkz.js"),[]),"../locales/zh/about.json":()=>_(()=>import("./about-Bqbb5iZJ.js"),[]),"../locales/zh/auth.json":()=>_(()=>import("./auth-CK6UpxCf.js"),[]),"../locales/zh/blog.json":()=>_(()=>import("./blog-DFLZJglZ.js"),[]),"../locales/zh/contact.json":()=>_(()=>import("./contact-TRjNzjJw.js"),[]),"../locales/zh/footer.json":()=>_(()=>import("./footer-CEd19WBO.js"),[]),"../locales/zh/generation.json":()=>_(()=>import("./generation-CB5keqUE.js"),[]),"../locales/zh/home.json":()=>_(()=>import("./home-CnsWt0Nb.js"),[]),"../locales/zh/improve-reading.json":()=>_(()=>import("./improve-reading-DOxfe7y7.js"),[]),"../locales/zh/landing.json":()=>_(()=>import("./landing-Cz5v1E14.js"),[]),"../locales/zh/navbar.json":()=>_(()=>import("./navbar-DI7mZvBh.js"),[]),"../locales/zh/newsletter.json":()=>_(()=>import("./newsletter-wGuJRvTc.js"),[]),"../locales/zh/notfound.json":()=>_(()=>import("./notfound-Cqt5gBKM.js"),[]),"../locales/zh/payment-status.json":()=>_(()=>import("./payment-status-ubxHsmFd.js"),[]),"../locales/zh/privacy.json":()=>_(()=>import("./privacy-y1aPYI4v.js"),[]),"../locales/zh/progress.json":()=>_(()=>import("./progress-B6dUu83y.js"),[]),"../locales/zh/reading-cart.json":()=>_(()=>import("./reading-cart-Pmpy_1OF.js"),[]),"../locales/zh/refund.json":()=>_(()=>import("./refund-VHDYVAUj.js"),[]),"../locales/zh/research.json":()=>_(()=>import("./research-BdwiSOrd.js"),[]),"../locales/zh/stories.json":()=>_(()=>import("./stories-DVgriTV9.js"),[]),"../locales/zh/story-maker.json":()=>_(()=>import("./story-maker-QF-WsIM9.js"),[]),"../locales/zh/story-reader.json":()=>_(()=>import("./story-reader-BloK0id8.js"),[]),"../locales/zh/subscription.json":()=>_(()=>import("./subscription-CTIiz4Gz.js"),[]),"../locales/zh/terms.json":()=>_(()=>import("./terms-oJg-2cMy.js"),[]),"../locales/zh/text-checker.json":()=>_(()=>import("./text-checker-Amzh049S.js"),[]),"../locales/zh/themes.json":()=>_(()=>import("./themes-D2mWuh-g.js"),[]),"../locales/zh/vocabulary.json":()=>_(()=>import("./vocabulary-C8ynczMq.js"),[]),"../locales/zh/watch.json":()=>_(()=>import("./watch-psulnrNB.js"),[])}),`../locales/${t}/${e}.json`,4))).use(Ub).init({lng:uS,fallbackLng:"en",defaultNS:"home",ns:[...e0],partialBundledLanguages:!0,load:"languageOnly",supportedLngs:en,nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!0}});const t0=h.createContext(void 0),Pp=(t,e)=>Promise.race([t,new Promise((n,s)=>setTimeout(()=>s(new Error("Timeout")),e))]),dS=()=>{try{const t=e=>{const n=[];for(let s=0;s<e.length;s++){const r=e.key(s);r&&(r.includes("-auth-token")||r.includes("-code-verifier"))&&n.push(r)}n.forEach(s=>e.removeItem(s))};t(localStorage),t(sessionStorage),sessionStorage.removeItem("pendingAuthRedirect")}catch(t){console.warn("Error purging auth storage:",t)}},hS=({children:t})=>{const[e,n]=h.useState(null),[s,r]=h.useState(null),[i,a]=h.useState(!0),l=h.useRef(!1),c=h.useRef(0),{toast:u}=Im(),d=h.useCallback(async E=>{const T=E||e?.id;if(T)try{console.log("[AUTH] Refreshing subscription for:",T),await $T(!0)}catch(j){console.error("[AUTH] Error refreshing subscription:",j),hn.error("Subscription refresh failed",{description:"Could not update your subscription status. Please try again later."})}},[e?.id]);h.useEffect(()=>{const{data:{subscription:E}}=q.auth.onAuthStateChange((T,j)=>{if(console.log("[AUTH] Event:",T),l.current&&T!=="SIGNED_OUT"){console.log("[AUTH] Ignoring event during sign-out:",T);return}if(Date.now()<c.current&&(T==="SIGNED_IN"||T==="TOKEN_REFRESHED")){console.log("[AUTH] Ignoring late rehydration event after sign-out:",T);return}r(j);const P=j?.user?.id??null;n(k=>{const S=k?.id??null;return S===P&&S!==null?k:j?.user??null}),T==="SIGNED_OUT"&&(vl.resetUser(),l.current=!1),a(!1)});return q.auth.getSession().then(({data:{session:T}})=>{r(T),n(T?.user??null),a(!1)}),()=>E.unsubscribe()},[]),h.useEffect(()=>{if(!e||l.current)return;let E=!1;return(async()=>{vl.identifyUser(e.id,{email:e.email,user_type:e.user_metadata?.user_type});try{const j=e.user_metadata,P=j?.avatar_url||j?.picture;if(P){const{data:k}=await q.from("profiles").select("avatar_url").eq("id",e.id).single();!E&&!k?.avatar_url&&await q.from("profiles").update({avatar_url:P}).eq("id",e.id)}}catch(j){console.error("[AUTH] Avatar sync error:",j)}if(!E)try{await d(e.id)}catch(j){console.error("[AUTH] Subscription refresh error on sign-in:",j)}})(),()=>{E=!0}},[e?.id]);const p=async(E,T)=>{try{a(!0);const{data:j,error:P}=await q.auth.signInWithPassword({email:E,password:T});if(P)throw P}catch(j){throw console.error("Error signing in:",j),j}finally{a(!1)}},f=async(E,T,j,P)=>{try{a(!0);const k=er(window.location.pathname),{error:S}=await q.auth.signUp({email:E,password:T,options:{data:{user_type:j||"free",display_name:P,app_language:k}}});if(S)throw u({title:"Sign up failed",description:S.message,variant:"destructive"}),S}catch(k){throw console.error("Error signing up:",k),k}finally{a(!1)}},g=async(E,T)=>{try{a(!0);const j=er(window.location.pathname),P=`${window.location.origin}${j==="en"?"/":`/${j}/`}`,{error:k}=await q.auth.signInWithOAuth({provider:E,options:{redirectTo:P}});if(k)throw u({title:`${T} sign in failed`,description:k.message,variant:"destructive"}),k}catch(j){throw console.error(`Error signing in with ${T}:`,j),j}finally{a(!1)}},y=()=>g("google","Google"),m=()=>g("facebook","Facebook"),x=()=>g("twitter","X"),b=()=>g("azure","Microsoft"),w=async()=>{l.current=!0;try{a(!0),vl.resetUser();try{await Pp(q.auth.signOut(),3e3)}catch(E){console.warn("[AUTH] Global sign-out failed/timed out:",E);try{await Pp(q.auth.signOut({scope:"local"}),2e3)}catch(T){console.warn("[AUTH] Local sign-out also failed:",T)}}}catch(E){console.error("[AUTH] Sign-out error:",E)}finally{dS(),n(null),r(null),a(!1),c.current=Date.now()+2e3,l.current=!1}};return o.jsx(t0.Provider,{value:{user:e,session:s,isLoading:i,signIn:p,signUp:f,signInWithGoogle:y,signInWithFacebook:m,signInWithTwitter:x,signInWithMicrosoft:b,signOut:w,refreshSubscription:d},children:t})},br=()=>{const t=h.useContext(t0);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},n0=h.createContext(void 0),pS=({children:t})=>{const[e,n]=h.useState(0),s=h.useRef(!1),r=h.useCallback(a=>{s.current!==a&&(s.current=a,n(l=>Math.max(0,l+(a?1:-1))))},[]),i=h.useMemo(()=>({isBusy:e>0,setBusy:r}),[e,r]);return o.jsx(n0.Provider,{value:i,children:t})},zu=()=>{const t=h.useContext(n0);return t||{isBusy:!1,setBusy:()=>{}}},s0={"zh-Hans":{name:"Chinese",displayName:"中文"},ja:{name:"Japanese",displayName:"日本語"},ko:{name:"Korean",displayName:"한국어"},hi:{name:"Hindi",displayName:"हिन्दी"},bn:{name:"Bengali",displayName:"বাংলা"},es:{name:"Spanish",displayName:"Español"},pt:{name:"Portuguese",displayName:"Português"},th:{name:"Thai",displayName:"ไทย"},vi:{name:"Vietnamese",displayName:"Tiếng Việt"},fil:{name:"Filipino",displayName:"Filipino"},ms:{name:"Malay",displayName:"Bahasa Melayu"},lo:{name:"Lao",displayName:"ລາວ"},id:{name:"Indonesian",displayName:"Bahasa Indonesia"},km:{name:"Khmer",displayName:"ខ្មែរ"},my:{name:"Burmese",displayName:"မြန်မာ"}},lV=t=>t.toLowerCase().replace(/[^\w\s-']/g,"").trim(),r0="ss_lang",to={en:"English",zh:"中文",bn:"বাংলা",es:"Español",ja:"日本語",ko:"한국어",th:"ไทย",vi:"Tiếng Việt",hi:"हिन्दी",pt:"Português",fil:"Filipino",ms:"Bahasa Melayu",id:"Bahasa Indonesia",my:"မြန်မာ",km:"ខ្មែរ",lo:"ລາວ"},fS=60*60*24*365,kp={tl:"fil",in:"id",cmn:"zh",yue:"zh"};function Fn(t){return!!t&&en.includes(t)}function mS(t){const e=t.trim().toLowerCase().split(/[-_]/)[0];return!e||e==="*"?null:kp[e]?kp[e]:Fn(e)?e:null}function gS(t){for(const e of t){const n=mS(e);if(n)return n}return null}function o0(){if(typeof navigator>"u")return null;const t=navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[];return gS(t)}function vS(){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp(`(?:^|;\\s*)${r0}=([^;]*)`));if(!t)return null;const e=decodeURIComponent(t[1]);return Fn(e)?e:null}function no(t){if(typeof document>"u")return;const{hostname:e,protocol:n}=window.location,s=[`${r0}=${encodeURIComponent(t)}`,"path=/",`max-age=${fS}`,"samesite=lax"];(e==="storysparkle.org"||e.endsWith(".storysparkle.org"))&&s.push("domain=.storysparkle.org"),n==="https:"&&s.push("secure"),document.cookie=s.join("; ")}function Sp(t){return t==="en"?null:t==="zh"?"zh-Hans":t in s0?t:null}function _S(t){const e=Sp(t);if(e)return e;const n=o0();return n&&Sp(n)||"zh-Hans"}const _l={async getTranslationLanguage(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return null;const{data:e,error:n}=await q.from("profiles").select("preferred_translation_language").eq("id",t.id).maybeSingle();return n?(console.error("Error fetching translation language preference:",n),null):e?.preferred_translation_language||null}catch(t){return console.error("Error in getTranslationLanguage:",t),null}},async setTranslationLanguage(t){try{const{data:{user:e}}=await q.auth.getUser();if(!e)return console.error("No authenticated user found"),!1;const{error:n}=await q.from("profiles").update({preferred_translation_language:t}).eq("id",e.id);return n?(console.error("Error updating translation language preference:",n),!1):!0}catch(e){return console.error("Error in setTranslationLanguage:",e),!1}},async getAppLanguage(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return null;const{data:e,error:n}=await q.from("profiles").select("preferred_app_language").eq("id",t.id).maybeSingle();if(n)return console.error("Error fetching app language preference:",n),null;const s=e?.preferred_app_language;return Fn(s)?s:null}catch(t){return console.error("Error in getAppLanguage:",t),null}},async setAppLanguage(t){try{const{data:{user:e}}=await q.auth.getUser();if(!e)return!1;const{error:n}=await q.from("profiles").update({preferred_app_language:t}).eq("id",e.id);return n?(console.error("Error updating app language preference:",n),!1):!0}catch(e){return console.error("Error in setAppLanguage:",e),!1}},async seedAppLanguageIfUnset(t){try{const{data:{user:e}}=await q.auth.getUser();if(!e)return!1;const{error:n}=await q.from("profiles").update({preferred_app_language:t}).eq("id",e.id).is("preferred_app_language",null);return n?(console.error("Error seeding app language preference:",n),!1):!0}catch(e){return console.error("Error in seedAppLanguageIfUnset:",e),!1}},async clearVocabulary(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return console.error("No authenticated user found"),!1;const{error:e}=await q.from("vocabulary_words").delete().eq("user_id",t.id);return e?(console.error("Error clearing vocabulary:",e),!1):!0}catch(t){return console.error("Error in clearVocabulary:",t),!1}}},i0=h.createContext(void 0),Rp=[],yS=({children:t})=>{const{i18n:e}=Se(),n=uu(),s=os(),{isBusy:r}=zu(),{user:i}=br(),[a,l]=h.useState(()=>er(typeof window<"u"?window.location.pathname:"/")),[c,u]=h.useState(!1),d=h.useRef(null),p=h.useRef(null),f={ko:{id:"noto-sans-kr",family:"Noto+Sans+KR:wght@100..900"},th:{id:"noto-sans-thai",family:"Noto+Sans+Thai:wght@100..900"},vi:{id:"noto-sans-vietnamese",family:"Noto+Sans:wght@100..900"},hi:{id:"noto-sans-devanagari",family:"Noto+Sans+Devanagari:wght@100..900"},pt:{id:"noto-sans-latin-ext",family:"Noto+Sans:wght@100..900"},my:{id:"noto-sans-myanmar",family:"Noto+Sans+Myanmar:wght@100..900"},km:{id:"noto-sans-khmer",family:"Noto+Sans+Khmer:wght@100..900"},lo:{id:"noto-sans-lao",family:"Noto+Sans+Lao:wght@100..900"}};h.useEffect(()=>{if(typeof document>"u")return;const m=f[a];if(!m||document.getElementById(m.id))return;const x=document.createElement("link");x.rel="preconnect",x.href="https://fonts.gstatic.com",x.crossOrigin="anonymous",document.head.appendChild(x);const b=document.createElement("link");b.id=m.id,b.rel="stylesheet",b.href=`https://fonts.googleapis.com/css2?family=${m.family}&display=swap`,document.head.appendChild(b)},[a]),h.useEffect(()=>{const m=er(s.pathname),x=Sc(s.pathname);l(m);let b=!1;return e.loadNamespaces(x).finally(()=>{!b&&e.language!==m?e.changeLanguage(m):b||e.changeLanguage(m),b||(u(!1),d.current&&(clearTimeout(d.current),d.current=null))}),()=>{b=!0}},[s.pathname,e]);const g=async m=>{if(m===a||r)return;u(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u(!1)},4e3);const x=en.filter(k=>k!=="en"),b=new RegExp(`^/(${x.join("|")})(?=/|$)`);let w=s.pathname;for(;b.test(w);)w=w.replace(b,"")||"/";w===""&&(w="/");const E=Rp.includes(w);let T=w;!E&&m!=="en"&&(T=w==="/"?`/${m}/`:`/${m}${w}`);const j=Sc(T),P=new Promise(k=>setTimeout(k,400));try{await Promise.all([e.loadNamespaces(j),P])}catch{}l(m),await e.changeLanguage(m),T!==s.pathname&&n(T),u(!1),d.current&&(clearTimeout(d.current),d.current=null),Fn(m)&&(no(m),p.current=i?.id??null,i&&_l.setAppLanguage(m))};h.useEffect(()=>{if(!i||p.current===i.id)return;p.current=i.id;let m=!1;return(async()=>{const x=er(s.pathname),b=x!=="en",w=await _l.getAppLanguage();if(!m){if(!w){Fn(x)&&(no(x),_l.seedAppLanguageIfUnset(x));return}no(w),w!==x&&!b&&g(w)}})(),()=>{m=!0}},[i?.id]);const y=h.useCallback(m=>!Rp.includes(m)&&a!=="en"&&en.includes(a)?m==="/"?`/${a}/`:`/${a}${m}`:m,[a]);return o.jsx(i0.Provider,{value:{currentLanguage:a,changeLanguage:g,getLocalizedPath:y,isSwitchingLanguage:c},children:t})},Dt=()=>{const t=h.useContext(i0);if(t===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return t},a0=h.createContext({targetElement:null,setLumiTarget:()=>{},onTargetReached:void 0,setOnTargetReached:()=>{}}),l0=()=>h.useContext(a0),xS=({children:t})=>{const[e,n]=h.useState(null),s=h.useRef(void 0),[,r]=h.useState(0),i=h.useCallback(l=>{n(l)},[]),a=h.useCallback(l=>{s.current=l,r(c=>c+1)},[]);return o.jsx(a0.Provider,{value:{targetElement:e,setLumiTarget:i,onTargetReached:s.current,setOnTargetReached:a},children:t})},Uu=h.createContext({});function ss(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const Hu=typeof window<"u",Mo=Hu?h.useLayoutEffect:h.useEffect,ka=h.createContext(null),Vo=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class bS extends h.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=n.offsetParent,r=s instanceof HTMLElement&&s.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=r-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function wS({children:t,isPresent:e,anchorX:n}){const s=h.useId(),r=h.useRef(null),i=h.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=h.useContext(Vo);return h.useInsertionEffect(()=>{const{width:l,height:c,top:u,left:d,right:p}=i.current;if(e||!r.current||!l||!c)return;const f=n==="left"?`left: ${d}`:`right: ${p}`;r.current.dataset.motionPopId=s;const g=document.createElement("style");return a&&(g.nonce=a),document.head.appendChild(g),g.sheet&&g.sheet.insertRule(`
          [data-motion-pop-id="${s}"] {
            position: absolute !important;
            width: ${l}px !important;
            height: ${c}px !important;
            ${f}px !important;
            top: ${u}px !important;
          }
        `),()=>{document.head.removeChild(g)}},[e]),o.jsx(bS,{isPresent:e,childRef:r,sizeRef:i,children:h.cloneElement(t,{ref:r})})}const ES=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:a,anchorX:l})=>{const c=ss(jS),u=h.useId(),d=h.useCallback(f=>{c.set(f,!0);for(const g of c.values())if(!g)return;s&&s()},[c,s]),p=h.useMemo(()=>({id:u,initial:e,isPresent:n,custom:r,onExitComplete:d,register:f=>(c.set(f,!1),()=>c.delete(f))}),i?[Math.random(),d]:[n,d]);return h.useMemo(()=>{c.forEach((f,g)=>c.set(g,!1))},[n]),h.useEffect(()=>{!n&&!c.size&&s&&s()},[n]),a==="popLayout"&&(t=o.jsx(wS,{isPresent:n,anchorX:l,children:t})),o.jsx(ka.Provider,{value:p,children:t})};function jS(){return new Map}function c0(t=!0){const e=h.useContext(ka);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=e,i=h.useId();h.useEffect(()=>{if(t)return r(i)},[t]);const a=h.useCallback(()=>t&&s&&s(i),[i,s,t]);return!n&&s?[!1,a]:[!0]}const ri=t=>t.key||"";function Ap(t){const e=[];return h.Children.forEach(t,n=>{h.isValidElement(n)&&e.push(n)}),e}const TS=({children:t,custom:e,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:a=!1,anchorX:l="left"})=>{const[c,u]=c0(a),d=h.useMemo(()=>Ap(t),[t]),p=a&&!c?[]:d.map(ri),f=h.useRef(!0),g=h.useRef(d),y=ss(()=>new Map),[m,x]=h.useState(d),[b,w]=h.useState(d);Mo(()=>{f.current=!1,g.current=d;for(let j=0;j<b.length;j++){const P=ri(b[j]);p.includes(P)?y.delete(P):y.get(P)!==!0&&y.set(P,!1)}},[b,p.length,p.join("-")]);const E=[];if(d!==m){let j=[...d];for(let P=0;P<b.length;P++){const k=b[P],S=ri(k);p.includes(S)||(j.splice(P,0,k),E.push(k))}return i==="wait"&&E.length&&(j=E),w(Ap(j)),x(d),null}const{forceRender:T}=h.useContext(Uu);return o.jsx(o.Fragment,{children:b.map(j=>{const P=ri(j),k=a&&!c?!1:d===b||p.includes(P),S=()=>{if(y.has(P))y.set(P,!0);else return;let O=!0;y.forEach(D=>{D||(O=!1)}),O&&(T?.(),w(g.current),a&&u?.(),s&&s())};return o.jsx(ES,{isPresent:k,initial:!f.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:i,onExitComplete:k?void 0:S,anchorX:l,children:j},P)})})};function Wu(t,e){t.indexOf(e)===-1&&t.push(e)}function Gu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}let PS=()=>{},Rc=()=>{};const kS={skipAnimations:!1,useManualTiming:!1};function Ku(t){let e;return()=>(e===void 0&&(e=t()),e)}const Ot=t=>t,ur=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s};class qu{constructor(){this.subscriptions=[]}add(e){return Wu(this.subscriptions,e),()=>Gu(this.subscriptions,e)}notify(e,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,s);else for(let i=0;i<r;i++){const a=this.subscriptions[i];a&&a(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const vn=t=>t*1e3,_n=t=>t/1e3;function Yu(t,e){return e?t*(1e3/e):0}const u0=Ku(()=>window.ScrollTimeline!==void 0);class SS{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let s=0;s<this.animations.length;s++)this.animations[s][e]=n}attachTimeline(e,n){const s=this.animations.map(r=>{if(u0()&&r.attachTimeline)return r.attachTimeline(e);if(typeof n=="function")return n(r)});return()=>{s.forEach((r,i)=>{r&&r(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class RS extends SS{then(e,n){return this.finished.finally(e).then(()=>{})}}const Cp={value:null,addProjectionMetrics:null},Xu=t=>Array.isArray(t)&&typeof t[0]=="number",AS={};function CS(t,e){const n=Ku(t);return()=>AS[e]??n()}const wo=CS(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),d0=(t,e,n=10)=>{let s="";const r=Math.max(Math.round(e/n),2);for(let i=0;i<r;i++)s+=t(i/(r-1))+", ";return`linear(${s.substring(0,s.length-2)})`},Wr=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Ac={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wr([0,.65,.55,1]),circOut:Wr([.55,0,1,.45]),backIn:Wr([.31,.01,.66,-.59]),backOut:Wr([.33,1.53,.69,.99])};function h0(t,e){if(t)return typeof t=="function"&&wo()?d0(t,e):Xu(t)?Wr(t):Array.isArray(t)?t.map(n=>h0(n,e)||Ac.easeOut):Ac[t]}function IS(t,e,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:a="loop",ease:l="easeInOut",times:c}={},u=void 0){const d={[e]:n};c&&(d.offset=c);const p=h0(l,r);return Array.isArray(p)&&(d.easing=p),t.animate(d,{delay:s,duration:r,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal",pseudoElement:u})}function Zu(t){return typeof t=="function"&&"applyToOptions"in t}function Ju(t,e){return t?.[e]??t?.default??t}const Qi=2e4;function Qu(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<Qi;)e+=n,s=t.next(e);return e>=Qi?1/0:e}function OS(t,e=100,n){const s=n({...t,keyframes:[0,e]}),r=Math.min(Qu(s),Qi);return{type:"keyframes",ease:i=>s.next(r*i).value/e,duration:_n(r)}}function p0(t){return!!(typeof t=="function"&&wo()||!t||typeof t=="string"&&(t in Ac||wo())||Xu(t)||Array.isArray(t)&&t.every(p0))}function Ip(t,e){t.timeline=e,t.onfinish=null}const oi=["read","resolveKeyframes","update","preRender","render","postRender"];function DS(t,e){let n=new Set,s=new Set,r=!1,i=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function u(p){a.has(p)&&(d.schedule(p),t()),c++,p(l)}const d={schedule:(p,f=!1,g=!1)=>{const m=g&&r?n:s;return f&&a.add(p),m.has(p)||m.add(p),p},cancel:p=>{s.delete(p),a.delete(p)},process:p=>{if(l=p,r){i=!0;return}r=!0,[n,s]=[s,n],n.forEach(u),e&&Cp.value&&Cp.value.frameloop[e].push(c),c=0,n.clear(),r=!1,i&&(i=!1,d.process(p))}};return d}const LS=40;function f0(t,e){let n=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=oi.reduce((b,w)=>(b[w]=DS(i,e?w:void 0),b),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:p,postRender:f}=a,g=()=>{const b=performance.now();n=!1,r.delta=s?1e3/60:Math.max(Math.min(b-r.timestamp,LS),1),r.timestamp=b,r.isProcessing=!0,l.process(r),c.process(r),u.process(r),d.process(r),p.process(r),f.process(r),r.isProcessing=!1,n&&e&&(s=!1,t(g))},y=()=>{n=!0,s=!0,r.isProcessing||t(g)};return{schedule:oi.reduce((b,w)=>{const E=a[w];return b[w]=(T,j=!1,P=!1)=>(n||y(),E.schedule(T,j,P)),b},{}),cancel:b=>{for(let w=0;w<oi.length;w++)a[oi[w]].cancel(b)},state:r,steps:a}}const{schedule:fe,cancel:tn,state:Ue,steps:yl}=f0(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),{schedule:ed,cancel:cV}=f0(queueMicrotask,!1);let bi;function NS(){bi=void 0}const yn={now:()=>(bi===void 0&&yn.set(Ue.isProcessing||kS.useManualTiming?Ue.timestamp:performance.now()),bi),set:t=>{bi=t,queueMicrotask(NS)}},Xt={x:!1,y:!1};function m0(){return Xt.x||Xt.y}function MS(t){return t==="x"||t==="y"?Xt[t]?null:(Xt[t]=!0,()=>{Xt[t]=!1}):Xt.x||Xt.y?null:(Xt.x=Xt.y=!0,()=>{Xt.x=Xt.y=!1})}function td(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const r=n?.[t]??s.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}function g0(t,e){const n=td(t),s=new AbortController,r={passive:!0,...e,signal:s.signal};return[n,r,()=>s.abort()]}function Op(t){return!(t.pointerType==="touch"||m0())}function VS(t,e,n={}){const[s,r,i]=g0(t,n),a=l=>{if(!Op(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=p=>{Op(p)&&(u(p),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,r)};return s.forEach(l=>{l.addEventListener("pointerenter",a,r)}),i}const v0=(t,e)=>e?t===e?!0:v0(t,e.parentElement):!1,nd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,FS=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function $S(t){return FS.has(t.tagName)||t.tabIndex!==-1}const Gr=new WeakSet;function Dp(t){return e=>{e.key==="Enter"&&t(e)}}function xl(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const BS=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=Dp(()=>{if(Gr.has(n))return;xl(n,"down");const r=Dp(()=>{xl(n,"up")}),i=()=>xl(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function Lp(t){return nd(t)&&!m0()}function zS(t,e,n={}){const[s,r,i]=g0(t,n),a=l=>{const c=l.currentTarget;if(!Lp(l)||Gr.has(c))return;Gr.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",f),!(!Lp(g)||!Gr.has(c))&&(Gr.delete(c),typeof u=="function"&&u(g,{success:y}))},p=g=>{d(g,c===window||c===document||n.useGlobalTarget||v0(c,g.target))},f=g=>{d(g,!1)};window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",f,r)};return s.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,r),l instanceof HTMLElement&&(l.addEventListener("focus",u=>BS(u,r)),!$S(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}const Np=30,US=t=>!isNaN(parseFloat(t)),so={current:void 0};class HS{constructor(e,n={}){this.version="12.6.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,r=!0)=>{const i=yn.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=yn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=US(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new qu);const s=this.events[e].add(n);return e==="change"?()=>{s(),fe.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return so.current&&so.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=yn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Np)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Np);return Yu(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mn(t,e){return new HS(t,e)}const _0=h.createContext({strict:!1}),Mp={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"]},dr={};for(const t in Mp)dr[t]={isEnabled:e=>Mp[t].some(n=>!!e[n])};function WS(t){for(const e in t)dr[e]={...dr[e],...t[e]}}const GS=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ea(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||GS.has(t)}let y0=t=>!ea(t);function KS(t){t&&(y0=e=>e.startsWith("on")?!ea(e):t(e))}try{KS(require("@emotion/is-prop-valid").default)}catch{}function qS(t,e,n){const s={};for(const r in t)r==="values"&&typeof t.values=="object"||(y0(r)||n===!0&&ea(r)||!e&&!ea(r)||t.draggable&&r.startsWith("onDrag"))&&(s[r]=t[r]);return s}function YS(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...s)=>t(...s);return new Proxy(n,{get:(s,r)=>r==="create"?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Sa=h.createContext({});function Ra(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Eo(t){return typeof t=="string"||Array.isArray(t)}const sd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rd=["initial",...sd];function Aa(t){return Ra(t.animate)||rd.some(e=>Eo(t[e]))}function x0(t){return!!(Aa(t)||t.variants)}function XS(t,e){if(Aa(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Eo(n)?n:void 0,animate:Eo(s)?s:void 0}}return t.inherit!==!1?e:{}}function ZS(t){const{initial:e,animate:n}=XS(t,h.useContext(Sa));return h.useMemo(()=>({initial:e,animate:n}),[Vp(e),Vp(n)])}function Vp(t){return Array.isArray(t)?t.join(" "):t}const JS=Symbol.for("motionComponentSymbol");function Ws(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function QS(t,e,n){return h.useCallback(s=>{s&&t.onMount&&t.onMount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):Ws(n)&&(n.current=s))},[e])}const od=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),eR="framerAppearId",b0="data-"+od(eR),w0=h.createContext({});function tR(t,e,n,s,r){const{visualElement:i}=h.useContext(Sa),a=h.useContext(_0),l=h.useContext(ka),c=h.useContext(Vo).reducedMotion,u=h.useRef(null);s=s||a.renderer,!u.current&&s&&(u.current=s(t,{visualState:e,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,p=h.useContext(w0);d&&!d.projection&&r&&(d.type==="html"||d.type==="svg")&&nR(u.current,n,r,p);const f=h.useRef(!1);h.useInsertionEffect(()=>{d&&f.current&&d.update(n,l)});const g=n[b0],y=h.useRef(!!g&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return Mo(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),ed.render(d.render),y.current&&d.animationState&&d.animationState.animateChanges())}),h.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),y.current=!1))}),d}function nR(t,e,n,s){const{layoutId:r,layout:i,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:E0(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||l&&Ws(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:u})}function E0(t){if(t)return t.options.allowProjection!==!1?t.projection:E0(t.parent)}function sR({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:r}){t&&WS(t);function i(l,c){let u;const d={...h.useContext(Vo),...l,layoutId:rR(l)},{isStatic:p}=d,f=ZS(l),g=s(l,p);if(!p&&Hu){oR();const y=iR(d);u=y.MeasureLayout,f.visualElement=tR(r,g,d,e,y.ProjectionNode)}return o.jsxs(Sa.Provider,{value:f,children:[u&&f.visualElement?o.jsx(u,{visualElement:f.visualElement,...d}):null,n(r,l,QS(g,f.visualElement,c),g,p,f.visualElement)]})}i.displayName=`motion.${typeof r=="string"?r:`create(${r.displayName??r.name??""})`}`;const a=h.forwardRef(i);return a[JS]=r,a}function rR({layoutId:t}){const e=h.useContext(Uu).id;return e&&t!==void 0?e+"-"+t:t}function oR(t,e){h.useContext(_0).strict}function iR(t){const{drag:e,layout:n}=dr;if(!e&&!n)return{};const s={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const j0=t=>e=>typeof e=="string"&&e.startsWith(t),id=j0("--"),aR=j0("var(--"),ad=t=>aR(t)?lR.test(t.split("/*")[0].trim()):!1,lR=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jo={};function cR(t){for(const e in t)jo[e]=t[e],id(e)&&(jo[e].isCSSVariable=!0)}const wr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ts=new Set(wr);function T0(t,{layout:e,layoutId:n}){return Ts.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!jo[t]||t==="opacity")}const He=t=>!!(t&&t.getVelocity),P0=(t,e)=>e&&typeof t=="number"?e.transform(t):t,En=(t,e,n)=>n>e?e:n<t?t:n,Er={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},To={...Er,transform:t=>En(0,1,t)},ii={...Er,default:1},Fo=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Gn=Fo("deg"),xn=Fo("%"),ee=Fo("px"),uR=Fo("vh"),dR=Fo("vw"),Fp={...xn,parse:t=>xn.parse(t)/100,transform:t=>xn.transform(t*100)},hR={borderWidth:ee,borderTopWidth:ee,borderRightWidth:ee,borderBottomWidth:ee,borderLeftWidth:ee,borderRadius:ee,radius:ee,borderTopLeftRadius:ee,borderTopRightRadius:ee,borderBottomRightRadius:ee,borderBottomLeftRadius:ee,width:ee,maxWidth:ee,height:ee,maxHeight:ee,top:ee,right:ee,bottom:ee,left:ee,padding:ee,paddingTop:ee,paddingRight:ee,paddingBottom:ee,paddingLeft:ee,margin:ee,marginTop:ee,marginRight:ee,marginBottom:ee,marginLeft:ee,backgroundPositionX:ee,backgroundPositionY:ee},pR={rotate:Gn,rotateX:Gn,rotateY:Gn,rotateZ:Gn,scale:ii,scaleX:ii,scaleY:ii,scaleZ:ii,skew:Gn,skewX:Gn,skewY:Gn,distance:ee,translateX:ee,translateY:ee,translateZ:ee,x:ee,y:ee,z:ee,perspective:ee,transformPerspective:ee,opacity:To,originX:Fp,originY:Fp,originZ:ee},$p={...Er,transform:Math.round},ld={...hR,...pR,zIndex:$p,size:ee,fillOpacity:To,strokeOpacity:To,numOctaves:$p},fR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mR=wr.length;function gR(t,e,n){let s="",r=!0;for(let i=0;i<mR;i++){const a=wr[i],l=t[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=P0(l,ld[a]);if(!c){r=!1;const d=fR[a]||a;s+=`${d}(${u}) `}n&&(e[a]=u)}}return s=s.trim(),n?s=n(e,r?"":s):r&&(s="none"),s}function cd(t,e,n){const{style:s,vars:r,transformOrigin:i}=t;let a=!1,l=!1;for(const c in e){const u=e[c];if(Ts.has(c)){a=!0;continue}else if(id(c)){r[c]=u;continue}else{const d=P0(u,ld[c]);c.startsWith("origin")?(l=!0,i[c]=d):s[c]=d}}if(e.transform||(a||n?s.transform=gR(e,t.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;s.transformOrigin=`${c} ${u} ${d}`}}const ud=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function k0(t,e,n){for(const s in e)!He(e[s])&&!T0(s,n)&&(t[s]=e[s])}function vR({transformTemplate:t},e){return h.useMemo(()=>{const n=ud();return cd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function _R(t,e){const n=t.style||{},s={};return k0(s,n,t),Object.assign(s,vR(t,e)),s}function yR(t,e){const n={},s=_R(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=s,n}const xR=["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 dd(t){return typeof t!="string"||t.includes("-")?!1:!!(xR.indexOf(t)>-1||/[A-Z]/u.test(t))}const bR={offset:"stroke-dashoffset",array:"stroke-dasharray"},wR={offset:"strokeDashoffset",array:"strokeDasharray"};function ER(t,e,n=1,s=0,r=!0){t.pathLength=1;const i=r?bR:wR;t[i.offset]=ee.transform(-s);const a=ee.transform(e),l=ee.transform(n);t[i.array]=`${a} ${l}`}function Bp(t,e,n){return typeof t=="string"?t:ee.transform(e+n*t)}function jR(t,e,n){const s=Bp(e,t.x,t.width),r=Bp(n,t.y,t.height);return`${s} ${r}`}function hd(t,{attrX:e,attrY:n,attrScale:s,originX:r,originY:i,pathLength:a,pathSpacing:l=1,pathOffset:c=0,...u},d,p){if(cd(t,u,p),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:g,dimensions:y}=t;f.transform&&(y&&(g.transform=f.transform),delete f.transform),y&&(r!==void 0||i!==void 0||g.transform)&&(g.transformOrigin=jR(y,r!==void 0?r:.5,i!==void 0?i:.5)),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),a!==void 0&&ER(f,a,l,c,!1)}const S0=()=>({...ud(),attrs:{}}),pd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function TR(t,e,n,s){const r=h.useMemo(()=>{const i=S0();return hd(i,e,pd(s),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};k0(i,t.style,t),r.style={...i,...r.style}}return r}function PR(t=!1){return(n,s,r,{latestValues:i},a)=>{const c=(dd(n)?TR:yR)(s,i,a,n),u=qS(s,typeof n=="string",t),d=n!==h.Fragment?{...u,...c,ref:r}:{},{children:p}=s,f=h.useMemo(()=>He(p)?p.get():p,[p]);return h.createElement(n,{...d,children:f})}}function zp(t){const e=[{},{}];return t?.values.forEach((n,s)=>{e[0][s]=n.get(),e[1][s]=n.getVelocity()}),e}function fd(t,e,n,s){if(typeof e=="function"){const[r,i]=zp(s);e=e(n!==void 0?n:t.custom,r,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,i]=zp(s);e=e(n!==void 0?n:t.custom,r,i)}return e}const Cc=t=>Array.isArray(t),kR=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),SR=t=>Cc(t)?t[t.length-1]||0:t;function wi(t){const e=He(t)?t.get():t;return kR(e)?e.toValue():e}function RR({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},s,r,i){const a={latestValues:AR(s,r,i,t),renderState:e()};return n&&(a.onMount=l=>n({props:s,current:l,...a}),a.onUpdate=l=>n(l)),a}const R0=t=>(e,n)=>{const s=h.useContext(Sa),r=h.useContext(ka),i=()=>RR(t,e,s,r);return n?i():ss(i)};function AR(t,e,n,s){const r={},i=s(t,{});for(const f in i)r[f]=wi(i[f]);let{initial:a,animate:l}=t;const c=Aa(t),u=x0(t);e&&u&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const p=d?l:a;if(p&&typeof p!="boolean"&&!Ra(p)){const f=Array.isArray(p)?p:[p];for(let g=0;g<f.length;g++){const y=fd(t,f[g]);if(y){const{transitionEnd:m,transition:x,...b}=y;for(const w in b){let E=b[w];if(Array.isArray(E)){const T=d?E.length-1:0;E=E[T]}E!==null&&(r[w]=E)}for(const w in m)r[w]=m[w]}}}return r}function md(t,e,n){const{style:s}=t,r={};for(const i in s)(He(s[i])||e.style&&He(e.style[i])||T0(i,t)||n?.getValue(i)?.liveStyle!==void 0)&&(r[i]=s[i]);return r}const CR={useVisualState:R0({scrapeMotionValuesFromProps:md,createRenderState:ud})};function A0(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}function C0(t,{style:e,vars:n},s,r){Object.assign(t.style,e,r&&r.getProjectionStyles(s));for(const i in n)t.style.setProperty(i,n[i])}const I0=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function O0(t,e,n,s){C0(t,e,void 0,s);for(const r in e.attrs)t.setAttribute(I0.has(r)?r:od(r),e.attrs[r])}function D0(t,e,n){const s=md(t,e,n);for(const r in t)if(He(t[r])||He(e[r])){const i=wr.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[i]=t[r]}return s}const Up=["x","y","width","height","cx","cy","r"],IR={useVisualState:R0({scrapeMotionValuesFromProps:D0,createRenderState:S0,onUpdate:({props:t,prevProps:e,current:n,renderState:s,latestValues:r})=>{if(!n)return;let i=!!t.drag;if(!i){for(const l in r)if(Ts.has(l)){i=!0;break}}if(!i)return;let a=!e;if(e)for(let l=0;l<Up.length;l++){const c=Up[l];t[c]!==e[c]&&(a=!0)}a&&fe.read(()=>{A0(n,s),fe.render(()=>{hd(s,r,pd(n.tagName),t.transformTemplate),O0(n,s)})})}})};function OR(t,e){return function(s,{forwardMotionProps:r}={forwardMotionProps:!1}){const a={...dd(s)?IR:CR,preloadedFeatures:t,useRender:PR(r),createVisualElement:e,Component:s};return sR(a)}}function Po(t,e,n){const s=t.getProps();return fd(s,e,n!==void 0?n:s.custom,t)}const L0=new Set(["width","height","top","left","right","bottom",...wr]);function DR(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,mn(n))}function LR(t,e){const n=Po(t,e);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const a in i){const l=SR(i[a]);DR(t,a,l)}}function NR(t){return!!(He(t)&&t.add)}function Ic(t,e){const n=t.getValue("willChange");if(NR(n))return n.add(e)}function N0(t){return t.props[b0]}const M0=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,MR=1e-7,VR=12;function FR(t,e,n,s,r){let i,a,l=0;do a=e+(n-e)/2,i=M0(a,s,r)-t,i>0?n=a:e=a;while(Math.abs(i)>MR&&++l<VR);return a}function $o(t,e,n,s){if(t===e&&n===s)return Ot;const r=i=>FR(i,0,1,t,n);return i=>i===0||i===1?i:M0(r(i),e,s)}const V0=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,F0=t=>e=>1-t(1-e),$0=$o(.33,1.53,.69,.99),gd=F0($0),B0=V0(gd),z0=t=>(t*=2)<1?.5*gd(t):.5*(2-Math.pow(2,-10*(t-1))),vd=t=>1-Math.sin(Math.acos(t)),U0=F0(vd),H0=V0(vd),W0=t=>/^0[^.\s]+$/u.test(t);function $R(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||W0(t):!0}const ro=t=>Math.round(t*1e5)/1e5,_d=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function BR(t){return t==null}const zR=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yd=(t,e)=>n=>!!(typeof n=="string"&&zR.test(n)&&n.startsWith(t)||e&&!BR(n)&&Object.prototype.hasOwnProperty.call(n,e)),G0=(t,e,n)=>s=>{if(typeof s!="string")return s;const[r,i,a,l]=s.match(_d);return{[t]:parseFloat(r),[e]:parseFloat(i),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},UR=t=>En(0,255,t),bl={...Er,transform:t=>Math.round(UR(t))},fs={test:yd("rgb","red"),parse:G0("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+bl.transform(t)+", "+bl.transform(e)+", "+bl.transform(n)+", "+ro(To.transform(s))+")"};function HR(t){let e="",n="",s="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Oc={test:yd("#"),parse:HR,transform:fs.transform},Gs={test:yd("hsl","hue"),parse:G0("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+xn.transform(ro(e))+", "+xn.transform(ro(n))+", "+ro(To.transform(s))+")"},kt={test:t=>fs.test(t)||Oc.test(t)||Gs.test(t),parse:t=>fs.test(t)?fs.parse(t):Gs.test(t)?Gs.parse(t):Oc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?fs.transform(t):Gs.transform(t)},WR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function GR(t){return isNaN(t)&&typeof t=="string"&&(t.match(_d)?.length||0)+(t.match(WR)?.length||0)>0}const K0="number",q0="color",KR="var",qR="var(",Hp="${}",YR=/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 ko(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const l=e.replace(YR,c=>(kt.test(c)?(s.color.push(i),r.push(q0),n.push(kt.parse(c))):c.startsWith(qR)?(s.var.push(i),r.push(KR),n.push(c)):(s.number.push(i),r.push(K0),n.push(parseFloat(c))),++i,Hp)).split(Hp);return{values:n,split:l,indexes:s,types:r}}function Y0(t){return ko(t).values}function X0(t){const{split:e,types:n}=ko(t),s=e.length;return r=>{let i="";for(let a=0;a<s;a++)if(i+=e[a],r[a]!==void 0){const l=n[a];l===K0?i+=ro(r[a]):l===q0?i+=kt.transform(r[a]):i+=r[a]}return i}}const XR=t=>typeof t=="number"?0:t;function ZR(t){const e=Y0(t);return X0(t)(e.map(XR))}const rs={test:GR,parse:Y0,createTransformer:X0,getAnimatableNone:ZR},JR=new Set(["brightness","contrast","saturate","opacity"]);function QR(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(_d)||[];if(!s)return t;const r=n.replace(s,"");let i=JR.has(e)?1:0;return s!==n&&(i*=100),e+"("+i+r+")"}const eA=/\b([a-z-]*)\(.*?\)/gu,Dc={...rs,getAnimatableNone:t=>{const e=t.match(eA);return e?e.map(QR).join(" "):t}},tA={...ld,color:kt,backgroundColor:kt,outlineColor:kt,fill:kt,stroke:kt,borderColor:kt,borderTopColor:kt,borderRightColor:kt,borderBottomColor:kt,borderLeftColor:kt,filter:Dc,WebkitFilter:Dc},Z0=t=>tA[t];function J0(t,e){let n=Z0(t);return n!==Dc&&(n=rs),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const nA=new Set(["auto","none","0"]);function sA(t,e,n){let s=0,r;for(;s<t.length&&!r;){const i=t[s];typeof i=="string"&&!nA.has(i)&&ko(i).values.length&&(r=t[s]),s++}if(r&&n)for(const i of e)t[i]=J0(n,r)}const ms=t=>t*180/Math.PI,Lc=t=>{const e=ms(Math.atan2(t[1],t[0]));return Nc(e)},rA={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Lc,rotateZ:Lc,skewX:t=>ms(Math.atan(t[1])),skewY:t=>ms(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Nc=t=>(t=t%360,t<0&&(t+=360),t),Wp=Lc,Gp=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Kp=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),oA={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Gp,scaleY:Kp,scale:t=>(Gp(t)+Kp(t))/2,rotateX:t=>Nc(ms(Math.atan2(t[6],t[5]))),rotateY:t=>Nc(ms(Math.atan2(-t[2],t[0]))),rotateZ:Wp,rotate:Wp,skewX:t=>ms(Math.atan(t[4])),skewY:t=>ms(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function qp(t){return t.includes("scale")?1:0}function Mc(t,e){if(!t||t==="none")return qp(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=oA,r=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=rA,r=l}if(!r)return qp(e);const i=s[e],a=r[1].split(",").map(aA);return typeof i=="function"?i(a):a[i]}const iA=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Mc(n,e)};function aA(t){return parseFloat(t.trim())}const Yp=t=>t===Er||t===ee,lA=new Set(["x","y","z"]),cA=wr.filter(t=>!lA.has(t));function uA(t){const e=[];return cA.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}const hr={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Mc(e,"x"),y:(t,{transform:e})=>Mc(e,"y")};hr.translateX=hr.x;hr.translateY=hr.y;const gs=new Set;let Vc=!1,Fc=!1;function Q0(){if(Fc){const t=Array.from(gs).filter(s=>s.needsMeasurement),e=new Set(t.map(s=>s.element)),n=new Map;e.forEach(s=>{const r=uA(s);r.length&&(n.set(s,r),s.render())}),t.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const r=n.get(s);r&&r.forEach(([i,a])=>{s.getValue(i)?.set(a)})}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Fc=!1,Vc=!1,gs.forEach(t=>t.complete()),gs.clear()}function e_(){gs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Fc=!0)})}function dA(){e_(),Q0()}class xd{constructor(e,n,s,r,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=s,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(gs.add(this),Vc||(Vc=!0,fe.read(e_),fe.resolveKeyframes(Q0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:s,motionValue:r}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const a=r?.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(s&&n){const c=s.readValue(n,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),r&&a===void 0&&r.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),gs.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,gs.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const t_=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),hA=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pA(t){const e=hA.exec(t);if(!e)return[,];const[,n,s,r]=e;return[`--${n??s}`,r]}function n_(t,e,n=1){const[s,r]=pA(t);if(!s)return;const i=window.getComputedStyle(e).getPropertyValue(s);if(i){const a=i.trim();return t_(a)?parseFloat(a):a}return ad(r)?n_(r,e,n+1):r}const s_=t=>e=>e.test(t),fA={test:t=>t==="auto",parse:t=>t},r_=[Er,ee,xn,Gn,dR,uR,fA],Xp=t=>r_.find(s_(t));class o_ extends xd{constructor(e,n,s,r,i){super(e,n,s,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),ad(u))){const d=n_(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!L0.has(s)||e.length!==2)return;const[r,i]=e,a=Xp(r),l=Xp(i);if(a!==l)if(Yp(a)&&Yp(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let r=0;r<e.length;r++)$R(e[r])&&s.push(r);s.length&&sA(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hr[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(s,r).jump(r,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=s.length-1,a=s[i];s[i]=hr[n](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}const Zp=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(rs.test(t)||t==="0")&&!t.startsWith("url("));function mA(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function gA(t,e,n,s){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=Zp(r,e),l=Zp(i,e);return!a||!l?!1:mA(t)||(n==="spring"||Zu(n))&&s}const vA=t=>t!==null;function Ca(t,{repeat:e,repeatType:n="loop"},s){const r=t.filter(vA),i=e&&n!=="loop"&&e%2===1?0:r.length-1;return!i||s===void 0?r[i]:s}const _A=40;class i_{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=yn.now(),this.options={autoplay:e,delay:n,type:s,repeat:r,repeatDelay:i,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>_A?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&dA(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=yn.now(),this.hasAttemptedResolve=!0;const{name:s,type:r,velocity:i,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!gA(e,s,r,i))if(a)this.options.duration=0;else{c&&c(Ca(e,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,n);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Ce=(t,e,n)=>t+(e-t)*n;function wl(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function yA({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let r=0,i=0,a=0;if(!e)r=i=a=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;r=wl(c,l,t+1/3),i=wl(c,l,t),a=wl(c,l,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:s}}function ta(t,e){return n=>n>0?e:t}const El=(t,e,n)=>{const s=t*t,r=n*(e*e-s)+s;return r<0?0:Math.sqrt(r)},xA=[Oc,fs,Gs],bA=t=>xA.find(e=>e.test(t));function Jp(t){const e=bA(t);if(!e)return!1;let n=e.parse(t);return e===Gs&&(n=yA(n)),n}const Qp=(t,e)=>{const n=Jp(t),s=Jp(e);if(!n||!s)return ta(t,e);const r={...n};return i=>(r.red=El(n.red,s.red,i),r.green=El(n.green,s.green,i),r.blue=El(n.blue,s.blue,i),r.alpha=Ce(n.alpha,s.alpha,i),fs.transform(r))},wA=(t,e)=>n=>e(t(n)),Bo=(...t)=>t.reduce(wA),$c=new Set(["none","hidden"]);function EA(t,e){return $c.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function jA(t,e){return n=>Ce(t,e,n)}function bd(t){return typeof t=="number"?jA:typeof t=="string"?ad(t)?ta:kt.test(t)?Qp:kA:Array.isArray(t)?a_:typeof t=="object"?kt.test(t)?Qp:TA:ta}function a_(t,e){const n=[...t],s=n.length,r=t.map((i,a)=>bd(i)(i,e[a]));return i=>{for(let a=0;a<s;a++)n[a]=r[a](i);return n}}function TA(t,e){const n={...t,...e},s={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(s[r]=bd(t[r])(t[r],e[r]));return r=>{for(const i in s)n[i]=s[i](r);return n}}function PA(t,e){const n=[],s={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const i=e.types[r],a=t.indexes[i][s[i]],l=t.values[a]??0;n[r]=l,s[i]++}return n}const kA=(t,e)=>{const n=rs.createTransformer(e),s=ko(t),r=ko(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?$c.has(t)&&!r.values.length||$c.has(e)&&!s.values.length?EA(t,e):Bo(a_(PA(s,r),r.values),n):ta(t,e)};function l_(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ce(t,e,n):bd(t)(t,e)}const SA=5;function c_(t,e,n){const s=Math.max(e-SA,0);return Yu(n-t(s),e-s)}const De={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},jl=.001;function RA({duration:t=De.duration,bounce:e=De.bounce,velocity:n=De.velocity,mass:s=De.mass}){let r,i,a=1-e;a=En(De.minDamping,De.maxDamping,a),t=En(De.minDuration,De.maxDuration,_n(t)),a<1?(r=u=>{const d=u*a,p=d*t,f=d-n,g=Bc(u,a),y=Math.exp(-p);return jl-f/g*y},i=u=>{const p=u*a*t,f=p*n+n,g=Math.pow(a,2)*Math.pow(u,2)*t,y=Math.exp(-p),m=Bc(Math.pow(u,2),a);return(-r(u)+jl>0?-1:1)*((f-g)*y)/m}):(r=u=>{const d=Math.exp(-u*t),p=(u-n)*t+1;return-jl+d*p},i=u=>{const d=Math.exp(-u*t),p=(n-u)*(t*t);return d*p});const l=5/t,c=CA(r,i,l);if(t=vn(t),isNaN(c))return{stiffness:De.stiffness,damping:De.damping,duration:t};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:t}}}const AA=12;function CA(t,e,n){let s=n;for(let r=1;r<AA;r++)s=s-t(s)/e(s);return s}function Bc(t,e){return t*Math.sqrt(1-e*e)}const IA=["duration","bounce"],OA=["stiffness","damping","mass"];function ef(t,e){return e.some(n=>t[n]!==void 0)}function DA(t){let e={velocity:De.velocity,stiffness:De.stiffness,damping:De.damping,mass:De.mass,isResolvedFromDuration:!1,...t};if(!ef(t,OA)&&ef(t,IA))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),r=s*s,i=2*En(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:De.mass,stiffness:r,damping:i}}else{const n=RA(t);e={...e,...n,mass:De.mass},e.isResolvedFromDuration=!0}return e}function na(t=De.visualDuration,e=De.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:r}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:p,velocity:f,isResolvedFromDuration:g}=DA({...n,velocity:-_n(n.velocity||0)}),y=f||0,m=u/(2*Math.sqrt(c*d)),x=a-i,b=_n(Math.sqrt(c/d)),w=Math.abs(x)<5;s||(s=w?De.restSpeed.granular:De.restSpeed.default),r||(r=w?De.restDelta.granular:De.restDelta.default);let E;if(m<1){const j=Bc(b,m);E=P=>{const k=Math.exp(-m*b*P);return a-k*((y+m*b*x)/j*Math.sin(j*P)+x*Math.cos(j*P))}}else if(m===1)E=j=>a-Math.exp(-b*j)*(x+(y+b*x)*j);else{const j=b*Math.sqrt(m*m-1);E=P=>{const k=Math.exp(-m*b*P),S=Math.min(j*P,300);return a-k*((y+m*b*x)*Math.sinh(S)+j*x*Math.cosh(S))/j}}const T={calculatedDuration:g&&p||null,next:j=>{const P=E(j);if(g)l.done=j>=p;else{let k=0;m<1&&(k=j===0?vn(y):c_(E,j,P));const S=Math.abs(k)<=s,O=Math.abs(a-P)<=r;l.done=S&&O}return l.value=l.done?a:P,l},toString:()=>{const j=Math.min(Qu(T),Qi),P=d0(k=>T.next(j*k).value,j,30);return j+"ms "+P},toTransition:()=>{}};return T}na.applyToOptions=t=>{const e=OS(t,100,na);return t.ease=wo()?e.ease:"easeOut",t.duration=vn(e.duration),t.type="keyframes",t};function tf({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const p=t[0],f={done:!1,value:p},g=S=>l!==void 0&&S<l||c!==void 0&&S>c,y=S=>l===void 0?c:c===void 0||Math.abs(l-S)<Math.abs(c-S)?l:c;let m=n*e;const x=p+m,b=a===void 0?x:a(x);b!==x&&(m=b-p);const w=S=>-m*Math.exp(-S/s),E=S=>b+w(S),T=S=>{const O=w(S),D=E(S);f.done=Math.abs(O)<=u,f.value=f.done?b:D};let j,P;const k=S=>{g(f.value)&&(j=S,P=na({keyframes:[f.value,y(f.value)],velocity:c_(E,S,f.value),damping:r,stiffness:i,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:S=>{let O=!1;return!P&&j===void 0&&(O=!0,T(S),k(S)),j!==void 0&&S>=j?P.next(S-j):(!O&&T(S),f)}}}const LA=$o(.42,0,1,1),NA=$o(0,0,.58,1),u_=$o(.42,0,.58,1),MA=t=>Array.isArray(t)&&typeof t[0]!="number",nf={linear:Ot,easeIn:LA,easeInOut:u_,easeOut:NA,circIn:vd,circInOut:H0,circOut:U0,backIn:gd,backInOut:B0,backOut:$0,anticipate:z0},sf=t=>{if(Xu(t)){Rc(t.length===4);const[e,n,s,r]=t;return $o(e,n,s,r)}else if(typeof t=="string")return Rc(nf[t]!==void 0),nf[t];return t};function VA(t,e,n){const s=[],r=n||l_,i=t.length-1;for(let a=0;a<i;a++){let l=r(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||Ot:e;l=Bo(c,l)}s.push(l)}return s}function wd(t,e,{clamp:n=!0,ease:s,mixer:r}={}){const i=t.length;if(Rc(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=VA(e,s,r),c=l.length,u=d=>{if(a&&d<t[0])return e[0];let p=0;if(c>1)for(;p<t.length-2&&!(d<t[p+1]);p++);const f=ur(t[p],t[p+1],d);return l[p](f)};return n?d=>u(En(t[0],t[i-1],d)):u}function FA(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=ur(0,e,s);t.push(Ce(n,1,r))}}function d_(t){const e=[0];return FA(e,t.length-1),e}function $A(t,e){return t.map(n=>n*e)}function BA(t,e){return t.map(()=>e||u_).splice(0,t.length-1)}function sa({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const r=MA(s)?s.map(sf):sf(s),i={done:!1,value:e[0]},a=$A(n&&n.length===e.length?n:d_(e),t),l=wd(a,e,{ease:Array.isArray(r)?r:BA(e,r)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const zA=t=>{const e=({timestamp:n})=>t(n);return{start:()=>fe.update(e,!0),stop:()=>tn(e),now:()=>Ue.isProcessing?Ue.timestamp:yn.now()}},UA={decay:tf,inertia:tf,tween:sa,keyframes:sa,spring:na},HA=t=>t/100;class Ia extends i_{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:s,element:r,keyframes:i}=this.options,a=r?.KeyframeResolver||xd,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,l,n,s,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=this.options,l=Zu(n)?n:UA[n]||sa;let c,u;l!==sa&&typeof e[0]!="number"&&(c=Bo(HA,l_(e[0],e[1])),e=[0,100]);const d=l({...this.options,keyframes:e});i==="mirror"&&(u=l({...this.options,keyframes:[...e].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=Qu(d));const{calculatedDuration:p}=d,f=p+r,g=f*(s+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:p,resolvedDuration:f,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:s}=this;if(!s){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:r,generator:i,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:p}=s;if(this.startTime===null)return i.next(0);const{delay:f,repeat:g,repeatType:y,repeatDelay:m,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const b=this.currentTime-f*(this.speed>=0?1:-1),w=this.speed>=0?b<0:b>d;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let E=this.currentTime,T=i;if(g){const S=Math.min(this.currentTime,d)/p;let O=Math.floor(S),D=S%1;!D&&S>=1&&(D=1),D===1&&O--,O=Math.min(O,g+1),!!(O%2)&&(y==="reverse"?(D=1-D,m&&(D-=m/p)):y==="mirror"&&(T=a)),E=En(0,1,D)*p}const j=w?{done:!1,value:c[0]}:T.next(E);l&&(j.value=l(j.value));let{done:P}=j;!w&&u!==null&&(P=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return k&&r!==void 0&&(j.value=Ca(c,this.options,r)),x&&x(j.value),k&&this.finish(),j}get duration(){const{resolved:e}=this;return e?_n(e.calculatedDuration):0}get time(){return _n(this.currentTime)}set time(e){e=vn(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=_n(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=zA,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=this.currentTime??0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}get finished(){return this.currentFinishedPromise}}function WA(t){return new Ia(t)}const GA=new Set(["opacity","clipPath","filter","transform"]),KA=Ku(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ra=10,qA=2e4;function YA(t){return Zu(t.type)||t.type==="spring"||!p0(t.ease)}function XA(t,e){const n=new Ia({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const r=[];let i=0;for(;!s.done&&i<qA;)s=n.sample(i),r.push(s.value),i+=ra;return{times:void 0,keyframes:r,duration:i-ra,ease:"linear"}}const h_={anticipate:z0,backInOut:B0,circInOut:H0};function ZA(t){return t in h_}class rf extends i_{constructor(e){super(e);const{name:n,motionValue:s,element:r,keyframes:i}=this.options;this.resolver=new o_(i,(a,l)=>this.onKeyframesResolved(a,l),n,s,r),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:s=300,times:r,ease:i,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&wo()&&ZA(i)&&(i=h_[i]),YA(this.options)){const{onComplete:p,onUpdate:f,motionValue:g,element:y,...m}=this.options,x=XA(e,m);e=x.keyframes,e.length===1&&(e[1]=e[0]),s=x.duration,r=x.times,i=x.ease,a="keyframes"}const d=IS(l.owner.current,c,e,{...this.options,duration:s,times:r,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Ip(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:p}=this.options;l.set(Ca(e,this.options,n)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:s,times:r,type:a,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return _n(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return _n(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=vn(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}get finished(){return this.resolved.animation.finished}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Ot;const{animation:s}=n;Ip(s,e)}return Ot}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:s,duration:r,type:i,ease:a,times:l}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:p,element:f,...g}=this.options,y=new Ia({...g,keyframes:s,duration:r,type:i,ease:a,times:l,isGenerator:!0}),m=vn(this.time);u.setWithVelocity(y.sample(m-ra).value,y.sample(m).value,ra)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:s,repeatDelay:r,repeatType:i,damping:a,type:l}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return KA()&&s&&GA.has(s)&&(s!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&a!==0&&l!=="inertia"}}const JA={type:"spring",stiffness:500,damping:25,restSpeed:10},QA=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),eC={type:"keyframes",duration:.8},tC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nC=(t,{keyframes:e})=>e.length>2?eC:Ts.has(t)?t.startsWith("scale")?QA(e[1]):JA:tC;function sC({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:i,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Ed=(t,e,n,s={},r,i)=>a=>{const l=Ju(s,t)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-vn(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:r};sC(l)||(d={...d,...nC(t,d)}),d.duration&&(d.duration=vn(d.duration)),d.repeatDelay&&(d.repeatDelay=vn(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(p=!0)),d.allowFlatten=!l.type&&!l.ease,p&&!i&&e.get()!==void 0){const f=Ca(d.keyframes,l);if(f!==void 0)return fe.update(()=>{d.onUpdate(f),d.onComplete()}),new RS([])}return!i&&rf.supports(d)?new rf(d):new Ia(d)};function rC({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function p_(t,e,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:a,...l}=e;s&&(i=s);const c=[],u=r&&t.animationState&&t.animationState.getState()[r];for(const d in l){const p=t.getValue(d,t.latestValues[d]??null),f=l[d];if(f===void 0||u&&rC(u,d))continue;const g={delay:n,...Ju(i||{},d)};let y=!1;if(window.MotionHandoffAnimation){const x=N0(t);if(x){const b=window.MotionHandoffAnimation(x,d,fe);b!==null&&(g.startTime=b,y=!0)}}Ic(t,d),p.start(Ed(d,p,f,t.shouldReduceMotion&&L0.has(d)?{type:!1}:g,t,y));const m=p.animation;m&&c.push(m)}return a&&Promise.all(c).then(()=>{fe.update(()=>{a&&LR(t,a)})}),c}function zc(t,e,n={}){const s=Po(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const i=s?()=>Promise.all(p_(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:p}=r;return oC(t,e,u+c,d,p,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[c,u]=l==="beforeChildren"?[i,a]:[a,i];return c().then(()=>u())}else return Promise.all([i(),a(n.delay)])}function oC(t,e,n=0,s=0,r=1,i){const a=[],l=(t.variantChildren.size-1)*s,c=r===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(t.variantChildren).sort(iC).forEach((u,d)=>{u.notify("AnimationStart",e),a.push(zc(u,e,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(a)}function iC(t,e){return t.sortNodePosition(e)}function aC(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const r=e.map(i=>zc(t,i,n));s=Promise.all(r)}else if(typeof e=="string")s=zc(t,e,n);else{const r=typeof e=="function"?Po(t,e,n.custom):e;s=Promise.all(p_(t,r,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}function f_(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const lC=rd.length;function m_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?m_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<lC;n++){const s=rd[n],r=t.props[s];(Eo(r)||r===!1)&&(e[s]=r)}return e}const cC=[...sd].reverse(),uC=sd.length;function dC(t){return e=>Promise.all(e.map(({animation:n,options:s})=>aC(t,n,s)))}function hC(t){let e=dC(t),n=of(),s=!0;const r=c=>(u,d)=>{const p=Po(t,d,c==="exit"?t.presenceContext?.custom:void 0);if(p){const{transition:f,transitionEnd:g,...y}=p;u={...u,...y,...g}}return u};function i(c){e=c(t)}function a(c){const{props:u}=t,d=m_(t.parent)||{},p=[],f=new Set;let g={},y=1/0;for(let x=0;x<uC;x++){const b=cC[x],w=n[b],E=u[b]!==void 0?u[b]:d[b],T=Eo(E),j=b===c?w.isActive:null;j===!1&&(y=x);let P=E===d[b]&&E!==u[b]&&T;if(P&&s&&t.manuallyAnimateOnMount&&(P=!1),w.protectedKeys={...g},!w.isActive&&j===null||!E&&!w.prevProp||Ra(E)||typeof E=="boolean")continue;const k=pC(w.prevProp,E);let S=k||b===c&&w.isActive&&!P&&T||x>y&&T,O=!1;const D=Array.isArray(E)?E:[E];let M=D.reduce(r(b),{});j===!1&&(M={});const{prevResolvedValues:L={}}=w,X={...L,...M},I=H=>{S=!0,f.has(H)&&(O=!0,f.delete(H)),w.needsAnimating[H]=!0;const A=t.getValue(H);A&&(A.liveStyle=!1)};for(const H in X){const A=M[H],C=L[H];if(g.hasOwnProperty(H))continue;let V=!1;Cc(A)&&Cc(C)?V=!f_(A,C):V=A!==C,V?A!=null?I(H):f.add(H):A!==void 0&&f.has(H)?I(H):w.protectedKeys[H]=!0}w.prevProp=E,w.prevResolvedValues=M,w.isActive&&(g={...g,...M}),s&&t.blockInitialAnimation&&(S=!1),S&&(!(P&&k)||O)&&p.push(...D.map(H=>({animation:H,options:{type:b}})))}if(f.size){const x={};if(typeof u.initial!="boolean"){const b=Po(t,Array.isArray(u.initial)?u.initial[0]:u.initial);b&&b.transition&&(x.transition=b.transition)}f.forEach(b=>{const w=t.getBaseTarget(b),E=t.getValue(b);E&&(E.liveStyle=!0),x[b]=w??null}),p.push({animation:x})}let m=!!p.length;return s&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),s=!1,m?e(p):Promise.resolve()}function l(c,u){if(n[c].isActive===u)return Promise.resolve();t.variantChildren?.forEach(p=>p.animationState?.setActive(c,u)),n[c].isActive=u;const d=a(c);for(const p in n)n[p].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=of(),s=!0}}}function pC(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!f_(e,t):!1}function ds(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function of(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class is{constructor(e){this.isMounted=!1,this.node=e}update(){}}class fC extends is{constructor(e){super(e),e.animationState||(e.animationState=hC(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ra(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let mC=0;class gC extends is{constructor(){super(...arguments),this.id=mC++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const vC={animation:{Feature:fC},exit:{Feature:gC}};function So(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function zo(t){return{point:{x:t.pageX,y:t.pageY}}}const _C=t=>e=>nd(e)&&t(e,zo(e));function oo(t,e,n,s){return So(t,e,_C(n),s)}function g_({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yC({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function xC(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}const v_=1e-4,bC=1-v_,wC=1+v_,__=.01,EC=0-__,jC=0+__;function Rt(t){return t.max-t.min}function TC(t,e,n){return Math.abs(t-e)<=n}function af(t,e,n,s=.5){t.origin=s,t.originPoint=Ce(e.min,e.max,t.origin),t.scale=Rt(n)/Rt(e),t.translate=Ce(n.min,n.max,t.origin)-t.originPoint,(t.scale>=bC&&t.scale<=wC||isNaN(t.scale))&&(t.scale=1),(t.translate>=EC&&t.translate<=jC||isNaN(t.translate))&&(t.translate=0)}function io(t,e,n,s){af(t.x,e.x,n.x,s?s.originX:void 0),af(t.y,e.y,n.y,s?s.originY:void 0)}function lf(t,e,n){t.min=n.min+e.min,t.max=t.min+Rt(e)}function PC(t,e,n){lf(t.x,e.x,n.x),lf(t.y,e.y,n.y)}function cf(t,e,n){t.min=e.min-n.min,t.max=t.min+Rt(e)}function ao(t,e,n){cf(t.x,e.x,n.x),cf(t.y,e.y,n.y)}const uf=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ks=()=>({x:uf(),y:uf()}),df=()=>({min:0,max:0}),Le=()=>({x:df(),y:df()});function Wt(t){return[t("x"),t("y")]}function Tl(t){return t===void 0||t===1}function Uc({scale:t,scaleX:e,scaleY:n}){return!Tl(t)||!Tl(e)||!Tl(n)}function ps(t){return Uc(t)||y_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function y_(t){return hf(t.x)||hf(t.y)}function hf(t){return t&&t!=="0%"}function oa(t,e,n){const s=t-n,r=e*s;return n+r}function pf(t,e,n,s,r){return r!==void 0&&(t=oa(t,r,s)),oa(t,n,s)+e}function Hc(t,e=0,n=1,s,r){t.min=pf(t.min,e,n,s,r),t.max=pf(t.max,e,n,s,r)}function x_(t,{x:e,y:n}){Hc(t.x,e.translate,e.scale,e.originPoint),Hc(t.y,n.translate,n.scale,n.originPoint)}const ff=.999999999999,mf=1.0000000000001;function kC(t,e,n,s=!1){const r=n.length;if(!r)return;e.x=e.y=1;let i,a;for(let l=0;l<r;l++){i=n[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ys(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,x_(t,a)),s&&ps(i.latestValues)&&Ys(t,i.latestValues))}e.x<mf&&e.x>ff&&(e.x=1),e.y<mf&&e.y>ff&&(e.y=1)}function qs(t,e){t.min=t.min+e,t.max=t.max+e}function gf(t,e,n,s,r=.5){const i=Ce(t.min,t.max,r);Hc(t,e,n,i,s)}function Ys(t,e){gf(t.x,e.x,e.scaleX,e.scale,e.originX),gf(t.y,e.y,e.scaleY,e.scale,e.originY)}function b_(t,e){return g_(xC(t.getBoundingClientRect(),e))}function SC(t,e,n){const s=b_(t,n),{scroll:r}=e;return r&&(qs(s.x,r.offset.x),qs(s.y,r.offset.y)),s}const w_=({current:t})=>t?t.ownerDocument.defaultView:null,vf=(t,e)=>Math.abs(t-e);function RC(t,e){const n=vf(t.x,e.x),s=vf(t.y,e.y);return Math.sqrt(n**2+s**2)}class E_{constructor(e,n,{transformPagePoint:s,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=kl(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,g=RC(p.offset,{x:0,y:0})>=3;if(!f&&!g)return;const{point:y}=p,{timestamp:m}=Ue;this.history.push({...y,timestamp:m});const{onStart:x,onMove:b}=this.handlers;f||(x&&x(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,p)},this.handlePointerMove=(p,f)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Pl(f,this.transformPagePoint),fe.update(this.updatePoint,!0)},this.handlePointerUp=(p,f)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=kl(p.type==="pointercancel"?this.lastMoveEventInfo:Pl(f,this.transformPagePoint),this.history);this.startEvent&&g&&g(p,x),y&&y(p,x)},!nd(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=s,this.contextWindow=r||window;const a=zo(e),l=Pl(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Ue;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(e,kl(l,this.history)),this.removeListeners=Bo(oo(this.contextWindow,"pointermove",this.handlePointerMove),oo(this.contextWindow,"pointerup",this.handlePointerUp),oo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),tn(this.updatePoint)}}function Pl(t,e){return e?{point:e(t.point)}:t}function _f(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kl({point:t},e){return{point:t,delta:_f(t,j_(e)),offset:_f(t,AC(e)),velocity:CC(e,.1)}}function AC(t){return t[0]}function j_(t){return t[t.length-1]}function CC(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const r=j_(t);for(;n>=0&&(s=t[n],!(r.timestamp-s.timestamp>vn(e)));)n--;if(!s)return{x:0,y:0};const i=_n(r.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const a={x:(r.x-s.x)/i,y:(r.y-s.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function IC(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?Ce(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?Ce(n,t,s.max):Math.min(t,n)),t}function yf(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function OC(t,{top:e,left:n,bottom:s,right:r}){return{x:yf(t.x,n,r),y:yf(t.y,e,s)}}function xf(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function DC(t,e){return{x:xf(t.x,e.x),y:xf(t.y,e.y)}}function LC(t,e){let n=.5;const s=Rt(t),r=Rt(e);return r>s?n=ur(e.min,e.max-s,t.min):s>r&&(n=ur(t.min,t.max-r,e.min)),En(0,1,n)}function NC(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Wc=.35;function MC(t=Wc){return t===!1?t=0:t===!0&&(t=Wc),{x:bf(t,"left","right"),y:bf(t,"top","bottom")}}function bf(t,e,n){return{min:wf(t,e),max:wf(t,n)}}function wf(t,e){return typeof t=="number"?t:t[e]||0}const VC=new WeakMap;class FC{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=Le(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(zo(d).point)},i=(d,p)=>{const{drag:f,dragPropagation:g,onDragStart:y}=this.getProps();if(f&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=MS(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Wt(x=>{let b=this.getAxisMotionValue(x).get()||0;if(xn.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const E=w.layout.layoutBox[x];E&&(b=Rt(E)*(parseFloat(b)/100))}}this.originPoint[x]=b}),y&&fe.postRender(()=>y(d,p)),Ic(this.visualElement,"transform");const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},a=(d,p)=>{const{dragPropagation:f,dragDirectionLock:g,onDirectionLock:y,onDrag:m}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:x}=p;if(g&&this.currentDirection===null){this.currentDirection=$C(x),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",p.point,x),this.updateAxis("y",p.point,x),this.visualElement.render(),m&&m(d,p)},l=(d,p)=>this.stop(d,p),c=()=>Wt(d=>this.getAnimationState(d)==="paused"&&this.getAxisMotionValue(d).animation?.play()),{dragSnapToOrigin:u}=this.getProps();this.panSession=new E_(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:w_(this.visualElement)})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:i}=this.getProps();i&&fe.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:r}=this.getProps();if(!s||!ai(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=IC(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Ws(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=OC(s.layoutBox,e):this.constraints=!1,this.elastic=MC(n),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Wt(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=NC(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Ws(e))return!1;const s=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=SC(s,r.root,this.visualElement.getTransformPagePoint());let a=DC(r.layout.layoutBox,i);if(n){const l=n(yC(a));this.hasMutatedConstraints=!!l,l&&(a=g_(l))}return a}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Wt(d=>{if(!ai(d,n,this.currentDirection))return;let p=c&&c[d]||{};a&&(p={min:0,max:0});const f=r?200:1e6,g=r?40:1e7,y={type:"inertia",velocity:s?e[d]:0,bounceStiffness:f,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return Ic(this.visualElement,e),s.start(Ed(e,s,0,n,this.visualElement,!1))}stopAnimation(){Wt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Wt(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){Wt(n=>{const{drag:s}=this.getProps();if(!ai(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:l}=r.layout.layoutBox[n];i.set(e[n]-Ce(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Ws(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Wt(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();r[a]=LC({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Wt(a=>{if(!ai(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Ce(c,u,r[a]))})}addListeners(){if(!this.visualElement.current)return;VC.set(this.visualElement,this);const e=this.visualElement.current,n=oo(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Ws(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener("measure",s);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),fe.read(s);const a=So(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Wt(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=c[d].translate,p.set(p.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Wc,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:l}}}function ai(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function $C(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class BC extends is{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new FC(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ot}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ef=t=>(e,n)=>{t&&fe.postRender(()=>t(e,n))};class zC extends is{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new E_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:w_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ef(e),onStart:Ef(n),onMove:s,onEnd:(i,a)=>{delete this.session,r&&fe.postRender(()=>r(i,a))}}}mount(){this.removePointerDownListener=oo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ei={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function jf(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Nr={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ee.test(t))t=parseFloat(t);else return t;const n=jf(t,e.target.x),s=jf(t,e.target.y);return`${n}% ${s}%`}},UC={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,r=rs.parse(t);if(r.length>5)return s;const i=rs.createTransformer(t),a=typeof r[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;r[0+a]/=l,r[1+a]/=c;const u=Ce(l,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),i(r)}};class HC extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:i}=e;cR(WC),i&&(n.group&&n.group.add(i),s&&s.register&&r&&s.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Ei.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:r,isPresent:i}=this.props,a=s.projection;return a&&(a.isPresent=i,r||e.layoutDependency!==n||n===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||fe.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ed.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function T_(t){const[e,n]=c0(),s=h.useContext(Uu);return o.jsx(HC,{...t,layoutGroup:s,switchLayoutGroup:h.useContext(w0),isPresent:e,safeToRemove:n})}const WC={borderRadius:{...Nr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Nr,borderTopRightRadius:Nr,borderBottomLeftRadius:Nr,borderBottomRightRadius:Nr,boxShadow:UC};function GC(t,e,n){const s=He(t)?t:mn(t);return s.start(Ed("",s,e,n)),s.animation}function KC(t){return t instanceof SVGElement&&t.tagName!=="svg"}const qC=(t,e)=>t.depth-e.depth;class YC{constructor(){this.children=[],this.isDirty=!1}add(e){Wu(this.children,e),this.isDirty=!0}remove(e){Gu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(qC),this.isDirty=!1,this.children.forEach(e)}}function XC(t,e){const n=yn.now(),s=({timestamp:r})=>{const i=r-n;i>=e&&(tn(s),t(i-e))};return fe.read(s,!0),()=>tn(s)}const P_=["TopLeft","TopRight","BottomLeft","BottomRight"],ZC=P_.length,Tf=t=>typeof t=="string"?parseFloat(t):t,Pf=t=>typeof t=="number"||ee.test(t);function JC(t,e,n,s,r,i){r?(t.opacity=Ce(0,n.opacity!==void 0?n.opacity:1,QC(s)),t.opacityExit=Ce(e.opacity!==void 0?e.opacity:1,0,eI(s))):i&&(t.opacity=Ce(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let a=0;a<ZC;a++){const l=`border${P_[a]}Radius`;let c=kf(e,l),u=kf(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Pf(c)===Pf(u)?(t[l]=Math.max(Ce(Tf(c),Tf(u),s),0),(xn.test(u)||xn.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Ce(e.rotate||0,n.rotate||0,s))}function kf(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const QC=k_(0,.5,U0),eI=k_(.5,.95,Ot);function k_(t,e,n){return s=>s<t?0:s>e?1:n(ur(t,e,s))}function Sf(t,e){t.min=e.min,t.max=e.max}function Ht(t,e){Sf(t.x,e.x),Sf(t.y,e.y)}function Rf(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Af(t,e,n,s,r){return t-=e,t=oa(t,1/n,s),r!==void 0&&(t=oa(t,1/r,s)),t}function tI(t,e=0,n=1,s=.5,r,i=t,a=t){if(xn.test(e)&&(e=parseFloat(e),e=Ce(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Ce(i.min,i.max,s);t===i&&(l-=e),t.min=Af(t.min,e,n,l,r),t.max=Af(t.max,e,n,l,r)}function Cf(t,e,[n,s,r],i,a){tI(t,e[n],e[s],e[r],e.scale,i,a)}const nI=["x","scaleX","originX"],sI=["y","scaleY","originY"];function If(t,e,n,s){Cf(t.x,e,nI,n?n.x:void 0,s?s.x:void 0),Cf(t.y,e,sI,n?n.y:void 0,s?s.y:void 0)}function Of(t){return t.translate===0&&t.scale===1}function S_(t){return Of(t.x)&&Of(t.y)}function Df(t,e){return t.min===e.min&&t.max===e.max}function rI(t,e){return Df(t.x,e.x)&&Df(t.y,e.y)}function Lf(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function R_(t,e){return Lf(t.x,e.x)&&Lf(t.y,e.y)}function Nf(t){return Rt(t.x)/Rt(t.y)}function Mf(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class oI{constructor(){this.members=[]}add(e){Wu(this.members,e),e.scheduleRender()}remove(e){if(Gu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let s;for(let r=n;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1){s=i;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function iI(t,e,n){let s="";const r=t.x.translate/e.x,i=t.y.translate/e.y,a=n?.z||0;if((r||i||a)&&(s=`translate3d(${r}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:p,rotateY:f,skewX:g,skewY:y}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),p&&(s+=`rotateX(${p}deg) `),f&&(s+=`rotateY(${f}deg) `),g&&(s+=`skewX(${g}deg) `),y&&(s+=`skewY(${y}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Sl=["","X","Y","Z"],aI={visibility:"hidden"},Vf=1e3;let lI=0;function Rl(t,e,n,s){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),s&&(s[t]=0))}function A_(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=N0(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",fe,!(r||i))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&A_(s)}function C_({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(a={},l=e?.()){this.id=lI++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(dI),this.nodes.forEach(gI),this.nodes.forEach(vI),this.nodes.forEach(hI)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new YC)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new qu),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=KC(a),this.instance=a;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),t){let p;const f=()=>this.root.updateBlockedByResize=!1;t(a,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=XC(f,250),Ei.hasAnimatedSinceResize&&(Ei.hasAnimatedSinceResize=!1,this.nodes.forEach($f))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:f,hasRelativeLayoutChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||d.getDefaultTransition()||wI,{onLayoutAnimationStart:x,onLayoutAnimationComplete:b}=d.getProps(),w=!this.targetLayout||!R_(this.targetLayout,y),E=!f&&g;if(this.options.layoutRoot||this.resumeFrom||E||f&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,E);const T={...Ju(m,"layout"),onPlay:x,onComplete:b};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T)}else f||$f(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,tn(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(_I),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&A_(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const p=this.path[d];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ff);return}this.isUpdating||this.nodes.forEach(fI),this.isUpdating=!1,this.nodes.forEach(mI),this.nodes.forEach(cI),this.nodes.forEach(uI),this.clearAllSnapshots();const l=yn.now();Ue.delta=En(0,1e3/60,l-Ue.timestamp),Ue.timestamp=l,Ue.isProcessing=!0,yl.update.process(Ue),yl.preRender.process(Ue),yl.render.process(Ue),Ue.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ed.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pI),this.sharedNodes.forEach(yI)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,fe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){fe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Rt(this.snapshot.measuredBox.x)&&!Rt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Le(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!S_(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;a&&(l||ps(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),EI(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return Le();const l=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(jI))){const{scroll:u}=this.root;u&&(qs(l.x,u.offset.x),qs(l.y,u.offset.y))}return l}removeElementScroll(a){const l=Le();if(Ht(l,a),this.scroll?.wasRoot)return l;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:p}=u;u!==this.root&&d&&p.layoutScroll&&(d.wasRoot&&Ht(l,a),qs(l.x,d.offset.x),qs(l.y,d.offset.y))}return l}applyTransform(a,l=!1){const c=Le();Ht(c,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Ys(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),ps(d.latestValues)&&Ys(c,d.latestValues)}return ps(this.latestValues)&&Ys(c,this.latestValues),c}removeTransform(a){const l=Le();Ht(l,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!ps(u.latestValues))continue;Uc(u.latestValues)&&u.updateSnapshot();const d=Le(),p=u.measurePageBox();Ht(d,p),If(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return ps(this.latestValues)&&If(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ue.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:p}=this.options;if(!(!this.layout||!(d||p))){if(this.resolvedRelativeTargetAt=Ue.timestamp,!this.targetDelta&&!this.relativeTarget){const f=this.getClosestProjectingParent();f&&f.layout&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Le(),this.relativeTargetOrigin=Le(),ao(this.relativeTargetOrigin,this.layout.layoutBox,f.layout.layoutBox),Ht(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Le(),this.targetWithTransforms=Le()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),PC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ht(this.target,this.layout.layoutBox),x_(this.target,this.targetDelta)):Ht(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const f=this.getClosestProjectingParent();f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Le(),this.relativeTargetOrigin=Le(),ao(this.relativeTargetOrigin,this.target,f.target),Ht(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Uc(this.parent.latestValues)||y_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Ue.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Ht(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,f=this.treeScale.y;kC(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Le());const{target:g}=a;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Rf(this.prevProjectionDelta.x,this.projectionDelta.x),Rf(this.prevProjectionDelta.y,this.projectionDelta.y)),io(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==f||!Mf(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mf(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ks(),this.projectionDelta=Ks(),this.projectionDeltaWithTransform=Ks()}setAnimationOrigin(a,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},p=Ks();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Le(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,m=g!==y,x=this.getStack(),b=!x||x.members.length<=1,w=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(bI));this.animationProgress=0;let E;this.mixTargetDelta=T=>{const j=T/1e3;Bf(p.x,a.x,j),Bf(p.y,a.y,j),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ao(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),xI(this.relativeTarget,this.relativeTargetOrigin,f,j),E&&rI(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Le()),Ht(E,this.relativeTarget)),m&&(this.animationValues=d,JC(d,u,this.latestValues,j,w,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(tn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=fe.update(()=>{Ei.hasAnimatedSinceResize=!0,this.currentAnimation=GC(0,Vf,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Vf),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&I_(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Le();const p=Rt(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+p;const f=Rt(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+f}Ht(l,c),Ys(l,d),io(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new oI),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Rl("z",a,u,this.animationValues);for(let d=0;d<Sl.length;d++)Rl(`rotate${Sl[d]}`,a,u,this.animationValues),Rl(`skew${Sl[d]}`,a,u,this.animationValues);a.render();for(const d in u)a.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);a.scheduleRender()}getProjectionStyles(a){if(!this.instance||this.isSVG)return;if(!this.isVisible)return aI;const l={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,l.opacity="",l.pointerEvents=wi(a?.pointerEvents)||"",l.transform=c?c(this.latestValues,""):"none",l;const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){const g={};return this.options.layoutId&&(g.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,g.pointerEvents=wi(a?.pointerEvents)||""),this.hasProjected&&!ps(this.latestValues)&&(g.transform=c?c({},""):"none",this.hasProjected=!1),g}const d=u.animationValues||u.latestValues;this.applyTransformsToTarget(),l.transform=iI(this.projectionDeltaWithTransform,this.treeScale,d),c&&(l.transform=c(d,l.transform));const{x:p,y:f}=this.projectionDelta;l.transformOrigin=`${p.origin*100}% ${f.origin*100}% 0`,u.animationValues?l.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:l.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in jo){if(d[g]===void 0)continue;const{correct:y,applyTo:m,isCSSVariable:x}=jo[g],b=l.transform==="none"?d[g]:y(d[g],u);if(m){const w=m.length;for(let E=0;E<w;E++)l[m[E]]=b}else x?this.options.visualElement.renderState.vars[g]=b:l[g]=b}return this.options.layoutId&&(l.pointerEvents=u===this?wi(a?.pointerEvents)||"":"none"),l}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(Ff),this.root.sharedNodes.clear()}}}function cI(t){t.updateLayout()}function uI(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:r}=t.options,i=e.source!==t.layout.source;r==="size"?Wt(d=>{const p=i?e.measuredBox[d]:e.layoutBox[d],f=Rt(p);p.min=n[d].min,p.max=p.min+f}):I_(r,e.layoutBox,n)&&Wt(d=>{const p=i?e.measuredBox[d]:e.layoutBox[d],f=Rt(n[d]);p.max=p.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[d].max=t.relativeTarget[d].min+f)});const a=Ks();io(a,n,e.layoutBox);const l=Ks();i?io(l,t.applyTransform(s,!0),e.measuredBox):io(l,n,e.layoutBox);const c=!S_(a);let u=!1;if(!t.resumeFrom){const d=t.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:p,layout:f}=d;if(p&&f){const g=Le();ao(g,e.layoutBox,p.layoutBox);const y=Le();ao(y,n,f.layoutBox),R_(g,y)||(u=!0),d.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=g,t.relativeParent=d)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function dI(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function hI(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function pI(t){t.clearSnapshot()}function Ff(t){t.clearMeasurements()}function fI(t){t.isLayoutDirty=!1}function mI(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function $f(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function gI(t){t.resolveTargetDelta()}function vI(t){t.calcProjection()}function _I(t){t.resetSkewAndRotation()}function yI(t){t.removeLeadSnapshot()}function Bf(t,e,n){t.translate=Ce(e.translate,0,n),t.scale=Ce(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function zf(t,e,n,s){t.min=Ce(e.min,n.min,s),t.max=Ce(e.max,n.max,s)}function xI(t,e,n,s){zf(t.x,e.x,n.x,s),zf(t.y,e.y,n.y,s)}function bI(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const wI={duration:.45,ease:[.4,0,.1,1]},Uf=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Hf=Uf("applewebkit/")&&!Uf("chrome/")?Math.round:Ot;function Wf(t){t.min=Hf(t.min),t.max=Hf(t.max)}function EI(t){Wf(t.x),Wf(t.y)}function I_(t,e,n){return t==="position"||t==="preserve-aspect"&&!TC(Nf(e),Nf(n),.2)}function jI(t){return t!==t.root&&t.scroll?.wasRoot}const TI=C_({attachResizeListener:(t,e)=>So(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Al={current:void 0},O_=C_({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Al.current){const t=new TI({});t.mount(window),t.setOptions({layoutScroll:!0}),Al.current=t}return Al.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),PI={pan:{Feature:zC},drag:{Feature:BC,ProjectionNode:O_,MeasureLayout:T_}};function Gf(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&fe.postRender(()=>i(e,zo(e)))}class kI extends is{mount(){const{current:e}=this.node;e&&(this.unmount=VS(e,(n,s)=>(Gf(this.node,s,"Start"),r=>Gf(this.node,r,"End"))))}unmount(){}}class SI extends is{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=Bo(So(this.node.current,"focus",()=>this.onFocus()),So(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Kf(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&fe.postRender(()=>i(e,zo(e)))}class RI extends is{mount(){const{current:e}=this.node;e&&(this.unmount=zS(e,(n,s)=>(Kf(this.node,s,"Start"),(r,{success:i})=>Kf(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Gc=new WeakMap,Cl=new WeakMap,AI=t=>{const e=Gc.get(t.target);e&&e(t)},CI=t=>{t.forEach(AI)};function II({root:t,...e}){const n=t||document;Cl.has(n)||Cl.set(n,{});const s=Cl.get(n),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(CI,{root:t,...e})),s[r]}function OI(t,e,n){const s=II(e);return Gc.set(t,n),s.observe(t),()=>{Gc.delete(t),s.unobserve(t)}}const DI={some:0,all:1};class LI extends is{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:DI[r]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),f=u?d:p;f&&f(c)};return OI(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(NI(e,n))&&this.startObserver()}unmount(){}}function NI({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const MI={inView:{Feature:LI},tap:{Feature:RI},focus:{Feature:SI},hover:{Feature:kI}},VI={layout:{ProjectionNode:O_,MeasureLayout:T_}},Kc={current:null},D_={current:!1};function FI(){if(D_.current=!0,!!Hu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Kc.current=t.matches;t.addListener(e),e()}else Kc.current=!1}const $I=[...r_,kt,rs],BI=t=>$I.find(s_(t)),zI=new WeakMap;function UI(t,e,n){for(const s in e){const r=e[s],i=n[s];if(He(r))t.addValue(s,r);else if(He(i))t.addValue(s,mn(r,{owner:t}));else if(i!==r)if(t.hasValue(s)){const a=t.getValue(s);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=t.getStaticValue(s);t.addValue(s,mn(a!==void 0?a:r,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const qf=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class HI{scrapeMotionValuesFromProps(e,n,s){return{}}constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=xd,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=yn.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,fe.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=a;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Aa(n),this.isVariantNode=x0(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const g in f){const y=f[g];c[g]!==void 0&&He(y)&&y.set(c[g],!1)}}mount(e){this.current=e,zI.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((n,s)=>this.bindToMotionValue(s,n)),D_.current||FI(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Kc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),tn(this.notifyUpdate),tn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const s=Ts.has(e);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&fe.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),i(),a&&a(),n.owner&&n.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 dr){const n=dr[e];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Le()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<qf.length;s++){const r=qf[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,a=e[i];a&&(this.propEventSubscriptions[r]=this.on(r,a))}this.prevMotionValues=UI(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}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){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const s=this.values.get(e);n!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=mn(n===null?void 0:n,{owner:this}),this.addValue(e,s)),s}readValue(e,n){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(t_(s)||W0(s))?s=parseFloat(s):!BI(s)&&rs.test(n)&&(s=J0(e,n)),this.setBaseTarget(e,He(s)?s.get():s)),He(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const i=fd(this.props,n,this.presenceContext?.custom);i&&(s=i[e])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!He(r)?r:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new qu),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class L_ extends HI{constructor(){super(...arguments),this.KeyframeResolver=o_}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;He(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function WI(t){return window.getComputedStyle(t)}class GI extends L_{constructor(){super(...arguments),this.type="html",this.renderInstance=C0}readValueFromInstance(e,n){if(Ts.has(n))return iA(e,n);{const s=WI(e),r=(id(n)?s.getPropertyValue(n):s[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:n}){return b_(e,n)}build(e,n,s){cd(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return md(e,n,s)}}class KI extends L_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Le,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&A0(this.current,this.renderState)}}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Ts.has(n)){const s=Z0(n);return s&&s.default||0}return n=I0.has(n)?n:od(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return D0(e,n,s)}onBindTransform(){this.current&&!this.renderState.dimensions&&fe.postRender(this.updateDimensions)}build(e,n,s){hd(e,n,this.isSVGTag,s.transformTemplate)}renderInstance(e,n,s,r){O0(e,n,s,r)}mount(e){this.isSVGTag=pd(e.tagName),super.mount(e)}}const qI=(t,e)=>dd(t)?new KI(e):new GI(e,{allowProjection:t!==h.Fragment}),YI=OR({...vC,...MI,...PI,...VI},qI),Fe=YS(YI);function N_(t,e){let n;const s=()=>{const{currentTime:r}=e,a=(r===null?0:r.value)/100;n!==a&&t(a),n=a};return fe.update(s,!0),()=>tn(s)}const ji=new WeakMap;let Ti;function XI(t,e){if(e){const{inlineSize:n,blockSize:s}=e[0];return{width:n,height:s}}else return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}function ZI({target:t,contentRect:e,borderBoxSize:n}){ji.get(t)?.forEach(s=>{s({target:t,contentSize:e,get size(){return XI(t,n)}})})}function JI(t){t.forEach(ZI)}function QI(){typeof ResizeObserver>"u"||(Ti=new ResizeObserver(JI))}function e2(t,e){Ti||QI();const n=td(t);return n.forEach(s=>{let r=ji.get(s);r||(r=new Set,ji.set(s,r)),r.add(e),Ti?.observe(s)}),()=>{n.forEach(s=>{const r=ji.get(s);r?.delete(e),r?.size||Ti?.unobserve(s)})}}const Pi=new Set;let lo;function t2(){lo=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Pi.forEach(n=>n(e))},window.addEventListener("resize",lo)}function n2(t){return Pi.add(t),lo||t2(),()=>{Pi.delete(t),!Pi.size&&lo&&(lo=void 0)}}function s2(t,e){return typeof t=="function"?n2(t):e2(t,e)}const r2=50,Yf=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),o2=()=>({time:0,x:Yf(),y:Yf()}),i2={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Xf(t,e,n,s){const r=n[e],{length:i,position:a}=i2[e],l=r.current,c=n.time;r.current=t[`scroll${a}`],r.scrollLength=t[`scroll${i}`]-t[`client${i}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=ur(0,r.scrollLength,r.current);const u=s-c;r.velocity=u>r2?0:Yu(r.current-l,u)}function a2(t,e,n){Xf(t,"x",e,n),Xf(t,"y",e,n),e.time=n}function l2(t,e){const n={x:0,y:0};let s=t;for(;s&&s!==e;)if(s instanceof HTMLElement)n.x+=s.offsetLeft,n.y+=s.offsetTop,s=s.offsetParent;else if(s.tagName==="svg"){const r=s.getBoundingClientRect();s=s.parentElement;const i=s.getBoundingClientRect();n.x+=r.left-i.left,n.y+=r.top-i.top}else if(s instanceof SVGGraphicsElement){const{x:r,y:i}=s.getBBox();n.x+=r,n.y+=i;let a=null,l=s.parentNode;for(;!a;)l.tagName==="svg"&&(a=l),l=s.parentNode;s=a}else break;return n}const qc={start:0,center:.5,end:1};function Zf(t,e,n=0){let s=0;if(t in qc&&(t=qc[t]),typeof t=="string"){const r=parseFloat(t);t.endsWith("px")?s=r:t.endsWith("%")?t=r/100:t.endsWith("vw")?s=r/100*document.documentElement.clientWidth:t.endsWith("vh")?s=r/100*document.documentElement.clientHeight:t=r}return typeof t=="number"&&(s=e*t),n+s}const c2=[0,0];function u2(t,e,n,s){let r=Array.isArray(t)?t:c2,i=0,a=0;return typeof t=="number"?r=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?r=t.split(" "):r=[t,qc[t]?t:"0"]),i=Zf(r[0],n,s),a=Zf(r[1],e),i-a}const d2={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},h2={x:0,y:0};function p2(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function f2(t,e,n){const{offset:s=d2.All}=n,{target:r=t,axis:i="y"}=n,a=i==="y"?"height":"width",l=r!==t?l2(r,t):h2,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:p2(r),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let d=!e[i].interpolate;const p=s.length;for(let f=0;f<p;f++){const g=u2(s[f],u[a],c[a],l[i]);!d&&g!==e[i].interpolatorOffsets[f]&&(d=!0),e[i].offset[f]=g}d&&(e[i].interpolate=wd(e[i].offset,d_(s),{clamp:!1}),e[i].interpolatorOffsets=[...e[i].offset]),e[i].progress=En(0,1,e[i].interpolate(e[i].current))}function m2(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let s=e;for(;s&&s!==t;)n.x.targetOffset+=s.offsetLeft,n.y.targetOffset+=s.offsetTop,s=s.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}function g2(t,e,n,s={}){return{measure:()=>m2(t,s.target,n),update:r=>{a2(t,n,r),(s.offset||s.target)&&f2(t,n,s)},notify:()=>e(n)}}const Mr=new WeakMap,Jf=new WeakMap,Il=new WeakMap,Qf=t=>t===document.documentElement?window:t;function jd(t,{container:e=document.documentElement,...n}={}){let s=Il.get(e);s||(s=new Set,Il.set(e,s));const r=o2(),i=g2(e,t,r,n);if(s.add(i),!Mr.has(e)){const l=()=>{for(const f of s)f.measure()},c=()=>{for(const f of s)f.update(Ue.timestamp)},u=()=>{for(const f of s)f.notify()},d=()=>{fe.read(l,!1,!0),fe.read(c,!1,!0),fe.update(u,!1,!0)};Mr.set(e,d);const p=Qf(e);window.addEventListener("resize",d,{passive:!0}),e!==document.documentElement&&Jf.set(e,s2(e,d)),p.addEventListener("scroll",d,{passive:!0})}const a=Mr.get(e);return fe.read(a,!1,!0),()=>{tn(a);const l=Il.get(e);if(!l||(l.delete(i),l.size))return;const c=Mr.get(e);Mr.delete(e),c&&(Qf(e).removeEventListener("scroll",c),Jf.get(e)?.(),window.removeEventListener("resize",c))}}function v2({source:t,container:e,axis:n="y"}){t&&(e=t);const s={value:0},r=jd(i=>{s.value=i[n].progress*100},{container:e,axis:n});return{currentTime:s,cancel:r}}const Ol=new Map;function M_({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),Ol.has(e)||Ol.set(e,{});const s=Ol.get(e);return s[n]||(s[n]=u0()?new ScrollTimeline({source:e,axis:n}):v2({source:e,axis:n})),s[n]}function _2(t){return t.length===2}function V_(t){return t&&(t.target||t.offset)}function y2(t,e){return _2(t)||V_(e)?jd(n=>{t(n[e.axis].progress,n)},e):N_(t,M_(e))}function x2(t,e){if(t.flatten(),V_(e))return t.pause(),jd(n=>{t.time=t.duration*n[e.axis].progress},e);{const n=M_(e);return t.attachTimeline?t.attachTimeline(n,s=>(s.pause(),N_(r=>{s.time=s.duration*r},n))):Ot}}function b2(t,{axis:e="y",...n}={}){const s={axis:e,...n};return typeof t=="function"?y2(t,s):x2(t,s)}function em(t,e){PS(!!(!e||e.current))}const w2=()=>({scrollX:mn(0),scrollY:mn(0),scrollXProgress:mn(0),scrollYProgress:mn(0)});function E2({container:t,target:e,layoutEffect:n=!0,...s}={}){const r=ss(w2);return(n?Mo:h.useEffect)(()=>(em("target",e),em("container",t),b2((a,{x:l,y:c})=>{r.scrollX.set(l.current),r.scrollXProgress.set(l.progress),r.scrollY.set(c.current),r.scrollYProgress.set(c.progress)},{...s,container:t?.current||void 0,target:e?.current||void 0})),[t,e,JSON.stringify(s.offset)]),r}function F_(t){const e=ss(()=>mn(t)),{isStatic:n}=h.useContext(Vo);if(n){const[,s]=h.useState(t);h.useEffect(()=>e.on("change",s),[])}return e}function $_(t,e){const n=F_(e()),s=()=>n.set(e());return s(),Mo(()=>{const r=()=>fe.preRender(s,!1,!0),i=t.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),tn(s)}}),n}function tm(t,e={}){const{isStatic:n}=h.useContext(Vo),s=h.useRef(null),r=ss(()=>He(t)?t.get():t),i=ss(()=>typeof r=="string"?r.replace(/[\d.-]/g,""):void 0),a=F_(r),l=h.useRef(r),c=h.useRef(Ot),u=()=>{d(),s.current=WA({keyframes:[sm(a.get()),sm(l.current)],velocity:a.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...e,onUpdate:c.current})},d=()=>{s.current&&s.current.stop()};return h.useInsertionEffect(()=>a.attach((p,f)=>n?f(p):(l.current=p,c.current=g=>f(nm(g,i)),fe.postRender(u),a.get()),d),[JSON.stringify(e)]),Mo(()=>{if(He(t))return t.on("change",p=>a.set(nm(p,i)))},[a,i]),a}function nm(t,e){return e?t+e:t}function sm(t){return typeof t=="number"?t:parseFloat(t)}const j2=t=>t&&typeof t=="object"&&t.mix,T2=t=>j2(t)?t.mix:void 0;function P2(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],r=t[1+n],i=t[2+n],a=t[3+n],l=wd(r,i,{mixer:T2(i[0]),...a});return e?l(s):l}function k2(t){so.current=[],t();const e=$_(so.current,t);return so.current=void 0,e}function rm(t,e,n,s){if(typeof t=="function")return k2(t);const r=typeof e=="function"?e:P2(e,n,s);return Array.isArray(t)?om(t,r):om([t],([i])=>r(i))}function om(t,e){const n=ss(()=>[]);return $_(t,()=>{n.length=0;const s=t.length;for(let r=0;r<s;r++)n[r]=t[r].get();return e(n)})}const S2={some:0,all:1};function R2(t,e,{root:n,margin:s,amount:r="some"}={}){const i=td(t),a=new WeakMap,l=u=>{u.forEach(d=>{const p=a.get(d.target);if(d.isIntersecting!==!!p)if(d.isIntersecting){const f=e(d.target,d);typeof f=="function"?a.set(d.target,f):c.unobserve(d.target)}else typeof p=="function"&&(p(d),a.delete(d.target))})},c=new IntersectionObserver(l,{root:n,rootMargin:s,threshold:typeof r=="number"?r:S2[r]});return i.forEach(u=>c.observe(u)),()=>c.disconnect()}function A2(t,{root:e,margin:n,amount:s,once:r=!1,initial:i=!1}={}){const[a,l]=h.useState(i);return h.useEffect(()=>{if(!t.current||r&&a)return;const c=()=>(l(!0),r?void 0:()=>l(!1)),u={root:e&&e.current||void 0,margin:n,amount:s};return R2(t.current,c,u)},[e,t,n,r,s]),a}const B_="/assets/lumi-idle-0POIBpsz.webp",z_="/assets/lumi-flying-BYO-JzK3.webp",C2=({flyingGifSrc:t=z_,idleGifSrc:e=B_,targetElement:n,onTargetReached:s})=>{const[r,i]=h.useState(!1),[a,l]=h.useState(!1),[c,u]=h.useState(!1),[d,p]=h.useState(!1),f=h.useRef({x:0,y:0}),g=h.useRef(!1),y={stiffness:150,damping:15,mass:1},m=tm(0,y),x=tm(0,y);if(h.useEffect(()=>{if(n){p(!0),g.current=!1;const w=n.getBoundingClientRect(),E=w.left+w.width/2+20,T=w.top-30;m.set(E),x.set(T);const j=setTimeout(()=>{g.current||(g.current=!0,s?.())},500);return()=>clearTimeout(j)}else p(!1)},[n,m,x,s]),h.useEffect(()=>{if(d)return;let w=0;const E=T=>{const j=performance.now();if(j-w<16)return;w=j,c||u(!0),m.set(T.clientX+20),x.set(T.clientY-20);const k=T.target.closest("[data-lumi-interactive]")!==null;i(k)};return window.addEventListener("mousemove",E,{passive:!0}),()=>{window.removeEventListener("mousemove",E)}},[c,m,x,d]),h.useEffect(()=>{if(d)return;let w=0;const E=j=>{const P=j.touches[0];if(!P)return;const k=performance.now();if(k-w<16)return;w=k,c||u(!0),m.set(P.clientX+20),x.set(P.clientY-50);const O=j.target.closest("[data-lumi-interactive]")!==null;i(O)},T=j=>{const P=j.touches[0];P&&(c||u(!0),m.set(P.clientX+20),x.set(P.clientY-50))};return window.addEventListener("touchstart",T,{passive:!0}),window.addEventListener("touchmove",E,{passive:!0}),()=>{window.removeEventListener("touchstart",T),window.removeEventListener("touchmove",E)}},[c,m,x,d]),h.useEffect(()=>{const w=setInterval(()=>{const E=m.get(),T=x.get(),j=E-f.current.x,P=T-f.current.y,k=Math.sqrt(j*j+P*P);l(k>1),f.current={x:E,y:T}},50);return()=>clearInterval(w)},[m,x]),!c)return null;const b=a&&!r&&!(d&&g.current);return o.jsxs(Fe.div,{className:"fixed top-0 left-0 pointer-events-none z-[9999]",style:{x:m,y:x,willChange:"transform"},children:[o.jsx(Fe.div,{animate:{scale:r||d?1.3:1,filter:r||d?"drop-shadow(0 0 20px rgba(255, 200, 100, 0.9)) drop-shadow(0 0 40px rgba(255, 180, 50, 0.6))":"drop-shadow(0 0 8px rgba(255, 200, 100, 0.4))"},transition:{duration:.25,ease:"easeOut"},children:o.jsxs("div",{className:"relative w-14 h-14",children:[o.jsx("img",{src:e,alt:"Lumi",className:"absolute inset-0 w-14 h-14 object-contain transition-opacity duration-150",style:{opacity:b?0:1},draggable:!1,decoding:"async"}),o.jsx("img",{src:t,alt:"","aria-hidden":"true",className:"absolute inset-0 w-14 h-14 object-contain transition-opacity duration-150",style:{opacity:b?1:0},draggable:!1,decoding:"async"})]})}),(r||d)&&o.jsx(Fe.div,{className:"absolute inset-0 -z-10 rounded-full",initial:{scale:.8,opacity:0},animate:{scale:1.5,opacity:1},transition:{duration:.3},style:{background:"radial-gradient(circle, rgba(255, 200, 100, 0.4) 0%, transparent 70%)"}})]})};let li=null;function I2(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:4e3}):setTimeout(t,2e3)}function O2(){return li||(li=new Promise(t=>{if(typeof window>"u"){t(null);return}I2(async()=>{const{default:e}=await _(async()=>{const{default:n}=await Promise.resolve().then(()=>iS);return{default:n}},void 0);e.init("phc_5WxlAFQoA7g6daYB1QX9p6OsJMQkzmwgbjaBKG28S5m",{api_host:"https://us.i.posthog.com",loaded:()=>{},capture_pageview:!1,capture_pageleave:!0}),t(e)})}),li)}function D2(){const t=os();return h.useEffect(()=>{O2().then(e=>{e?.capture("$pageview")})},[t.pathname]),null}function L2({children:t}){return o.jsxs(o.Fragment,{children:[o.jsx(D2,{}),t]})}const N2=[{key:"nature-coral",label:"Coral",defaultHex:"#F27E7E",group:"brand",role:"PRIMARY intent — the one action on this screen (Read, Continue, Save, Submit).",tailwind:"bg-nature-coral"},{key:"nature-forest",label:"Forest",defaultHex:"#3F7468",group:"brand",role:"LEARN intent — learning tools (Vocabulary, Themes, Check Text, SESL, Check Progress).",tailwind:"bg-nature-forest"},{key:"nature-purple",label:"Purple",defaultHex:"#9b87f5",group:"brand",role:"CREATE intent — generative actions (Story Maker, Send Message, Start Creating).",tailwind:"bg-nature-purple"},{key:"nature-honey",label:"Honey",defaultHex:"#FEF3C7",group:"brand",role:"PREMIUM surface — soft honey background for premium tags, upgrade CTAs, and paid highlights. Pair with `text-nature-honey-ink` for AA.",tailwind:"bg-nature-honey"},{key:"nature-honey-ink",label:"Honey Ink",defaultHex:"#B45309",group:"brand",role:"Text/icon colour that sits on `nature-honey`.",tailwind:"text-nature-honey-ink"},{key:"nature-red",label:"Red",defaultHex:"#BF0404",group:"brand",role:"DESTRUCTIVE only (delete, cancel subscription). Never a CTA.",tailwind:"bg-nature-red"},{key:"ink",label:"Ink (body text)",defaultHex:"#2B2B2B",group:"neutral",role:"Body copy on light surfaces. Use `text-ink` instead of `text-black`.",tailwind:"bg-ink"},{key:"cream",label:"Cream (warm surface)",defaultHex:"#FFF8E7",group:"neutral",role:"Warm surface tone — matches hero. Use for Claymation-friendly card backgrounds.",tailwind:"bg-cream"},{key:"page-surface",label:"Page surface (canvas)",defaultHex:"#FBF7F0",group:"neutral",role:"Universal page canvas — solid Claymation-friendly cream that replaces per-page gradients. Applied via `bg-page-surface` on every page except Home / 404 / MP4-loader pages.",tailwind:"bg-page-surface"},{key:"accent",label:"Menu highlight",defaultHex:"#FDE8E8",group:"neutral",role:"Hover/focus highlight inside menus and on ghost buttons — dropdowns, selects, the command palette, context menus. A soft wash, never a saturated fill: the pill buttons own the strong colour.",tailwind:"bg-accent"},{key:"accent-foreground",label:"Menu highlight text",defaultHex:"#2B2B2B",group:"neutral",role:"Text/icon colour that sits on `accent`. Keep it dark enough for AA against whatever wash `accent` is set to.",tailwind:"text-accent-foreground"}],M2="design_tokens",V2=N2.reduce((t,e)=>(t[e.key]=e.defaultHex,t),{}),F2=t=>/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t.trim());function $2(t){const e=t.trim().replace("#",""),n=e.length===3?e.split("").map(a=>a+a).join(""):e,s=parseInt(n.slice(0,2),16),r=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`${s} ${r} ${i}`}function im(t,e=document.documentElement){for(const[n,s]of Object.entries(t))F2(s)&&(e.style.setProperty(`--${n}`,s.trim()),(n.startsWith("nature-")||n==="accent")&&e.style.setProperty(`--${n}-rgb`,$2(s)))}const B2=({children:t})=>(h.useEffect(()=>{let e=!1;(async()=>{try{const{data:s}=await q.from("app_settings").select("value").eq("key",M2).maybeSingle();if(e||!s?.value)return;const r=JSON.parse(s.value);im({...V2,...r})}catch{}})();const n=s=>{const r=s.detail;r&&im(r)};return window.addEventListener("design-tokens:apply",n),()=>{e=!0,window.removeEventListener("design-tokens:apply",n)}},[]),o.jsx(o.Fragment,{children:t})),z2=()=>{const{user:t,session:e}=br(),[n,s]=h.useState("guest"),[r,i]=h.useState({status:"none",isExpired:!0,isCancelledAtPeriodEnd:!1,planType:null}),[a,l]=h.useState(null),[c,u]=h.useState(null),[d,p]=h.useState(!0),[f,g]=h.useState(!1),[y,m]=h.useState(null),[x,b]=h.useState(!1),w=h.useRef(null),E=h.useCallback(async(P=!1)=>{if(!t){s("guest"),i({status:"none",isExpired:!0,isCancelledAtPeriodEnd:!1,planType:null}),p(!1),b(!0),w.current=null;return}if(!(x&&w.current===t.id&&!P))try{p(!0),P&&g(!0),m(null);const{data:k,error:S}=await q.from("profiles").select("user_type, avatar_url, display_name").eq("id",t.id).single();if(S)throw console.error("[ACCESS-CONTROL] Profile error:",S),S;const{data:O,error:D}=await q.from("user_payments").select("subscription_status, subscription_start_date, subscription_end_date, cancel_at_period_end, plan_type").eq("user_id",t.id).maybeSingle();if(D&&console.error("[ACCESS-CONTROL] Payment error:",D),k){l(k.avatar_url||null);const M=k.display_name||t.user_metadata?.display_name||t.user_metadata?.name||t.user_metadata?.full_name||null;u(M);const L=k.user_type||"free",X=new Date,I=O?.subscription_end_date?new Date(O.subscription_end_date):void 0,Y=I?X>I:!0;i({status:O?.subscription_status||"none",startDate:O?.subscription_start_date?new Date(O.subscription_start_date):void 0,endDate:I,isExpired:Y,isCancelledAtPeriodEnd:O?.cancel_at_period_end??!1,planType:O?.plan_type??null}),L!=="admin"?O?.subscription_status==="active"&&!Y?s("paid"):k.user_type!=="guest"&&s("free"):s(L)}}catch(k){console.error("[ACCESS-CONTROL] Error:",k);const S=k instanceof Error?k.message:String(k);m(S),P&&hn.error("Failed to refresh profile data",{description:"Please try again later or contact support."})}finally{p(!1),b(!0),w.current=t.id,P&&g(!1)}},[t?.id,x]);h.useEffect(()=>{t?.id!==w.current&&b(!1)},[t?.id]),h.useEffect(()=>{E()},[E]);const T=P=>P==="guest"?!0:P==="free"?n==="free"||n==="paid"||n==="admin":P==="paid"?n==="paid"||n==="admin"||r.status==="active"&&!r.isExpired:!1,j=h.useCallback(async()=>{await E(!0)},[E]);return{userType:n,subscription:r,avatarUrl:a,displayName:c,isLoading:d,isRefreshing:f,lastRefreshError:y,canAccessStory:T,isAuthenticated:!!t,refreshSubscriptionStatus:j}},U_=ma("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:scale-[1.02] active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-nature-red text-white hover:bg-nature-red/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",primary:"bg-nature-coral text-white shadow-md hover:bg-nature-coral/90 hover:shadow-lg",create:"bg-nature-purple text-white shadow-md hover:bg-nature-purple/90 hover:shadow-lg",learn:"bg-nature-forest text-white shadow-md hover:bg-nature-forest/90 hover:shadow-lg",premium:"bg-nature-honey text-nature-honey-ink shadow-md hover:bg-nature-honey/90 hover:shadow-lg"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",pill:"h-11 rounded-full px-6 uppercase tracking-wide text-sm font-bold",pillIcon:"h-9 w-9 rounded-full p-0 gap-0",pillSm:"h-8 rounded-full px-3 text-xs font-semibold"},animated:{true:"animate-pulse-gentle",false:""}},defaultVariants:{variant:"default",size:"default",animated:!1}}),bn=h.forwardRef(({className:t,variant:e,size:n,animated:s,asChild:r=!1,...i},a)=>{const l=r?Jn:"button";return o.jsx(l,{className:ie(U_({variant:e,size:n,animated:s,className:t})),ref:a,...i})});bn.displayName="Button";var U2=h.createContext(void 0);function Td(t){const e=h.useContext(U2);return t||e||"ltr"}var Dl=0;function Pd(){h.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??am()),document.body.insertAdjacentElement("beforeend",t[1]??am()),Dl++,()=>{Dl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Dl--}},[])}function am(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ll="focusScope.autoFocusOnMount",Nl="focusScope.autoFocusOnUnmount",lm={bubbles:!1,cancelable:!0},H2="FocusScope",Oa=h.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...a}=t,[l,c]=h.useState(null),u=Ye(r),d=Ye(i),p=h.useRef(null),f=_e(e,m=>c(m)),g=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let m=function(E){if(g.paused||!l)return;const T=E.target;l.contains(T)?p.current=T:Kn(p.current,{select:!0})},x=function(E){if(g.paused||!l)return;const T=E.relatedTarget;T!==null&&(l.contains(T)||Kn(p.current,{select:!0}))},b=function(E){if(document.activeElement===document.body)for(const j of E)j.removedNodes.length>0&&Kn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),w.disconnect()}}},[s,l,g.paused]),h.useEffect(()=>{if(l){um.add(g);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Ll,lm);l.addEventListener(Ll,u),l.dispatchEvent(b),b.defaultPrevented||(W2(X2(H_(l)),{select:!0}),document.activeElement===m&&Kn(l))}return()=>{l.removeEventListener(Ll,u),setTimeout(()=>{const b=new CustomEvent(Nl,lm);l.addEventListener(Nl,d),l.dispatchEvent(b),b.defaultPrevented||Kn(m??document.body,{select:!0}),l.removeEventListener(Nl,d),um.remove(g)},0)}}},[l,u,d,g]);const y=h.useCallback(m=>{if(!n&&!s||g.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const w=m.currentTarget,[E,T]=G2(w);E&&T?!m.shiftKey&&b===T?(m.preventDefault(),n&&Kn(E,{select:!0})):m.shiftKey&&b===E&&(m.preventDefault(),n&&Kn(T,{select:!0})):b===w&&m.preventDefault()}},[n,s,g.paused]);return o.jsx(se.div,{tabIndex:-1,...a,ref:f,onKeyDown:y})});Oa.displayName=H2;function W2(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(Kn(s,{select:e}),document.activeElement!==n)return}function G2(t){const e=H_(t),n=cm(e,t),s=cm(e.reverse(),t);return[n,s]}function H_(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function cm(t,e){for(const n of t)if(!K2(n,{upTo:e}))return n}function K2(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function q2(t){return t instanceof HTMLInputElement&&"select"in t}function Kn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&q2(t)&&e&&t.select()}}var um=Y2();function Y2(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=dm(t,e),t.unshift(e)},remove(e){t=dm(t,e),t[0]?.resume()}}}function dm(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function X2(t){return t.filter(e=>e.tagName!=="A")}function Z2(t,e=[]){let n=[];function s(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:g,...y}=p,m=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(m.Provider,{value:x,children:g})}function d(p,f){const g=f?.[t][c]||l,y=h.useContext(g);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const r=()=>{const i=n.map(a=>h.createContext(a));return function(l){const c=l?.[t]||i;return h.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return r.scopeName=t,[s,J2(r,...e)]}function J2(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var Ml="rovingFocusGroup.onEntryFocus",Q2={bubbles:!1,cancelable:!0},Da="RovingFocusGroup",[Yc,W_,eO]=ha(Da),[tO,G_]=Z2(Da,[eO]),[nO,sO]=tO(Da),K_=h.forwardRef((t,e)=>o.jsx(Yc.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(Yc.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(rO,{...t,ref:e})})}));K_.displayName=Da;var rO=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=t,f=h.useRef(null),g=_e(e,f),y=Td(i),[m=null,x]=_s({prop:a,defaultProp:l,onChange:c}),[b,w]=h.useState(!1),E=Ye(u),T=W_(n),j=h.useRef(!1),[P,k]=h.useState(0);return h.useEffect(()=>{const S=f.current;if(S)return S.addEventListener(Ml,E),()=>S.removeEventListener(Ml,E)},[E]),o.jsx(nO,{scope:n,orientation:s,dir:y,loop:r,currentTabStopId:m,onItemFocus:h.useCallback(S=>x(S),[x]),onItemShiftTab:h.useCallback(()=>w(!0),[]),onFocusableItemAdd:h.useCallback(()=>k(S=>S+1),[]),onFocusableItemRemove:h.useCallback(()=>k(S=>S-1),[]),children:o.jsx(se.div,{tabIndex:b||P===0?-1:0,"data-orientation":s,...p,ref:g,style:{outline:"none",...t.style},onMouseDown:G(t.onMouseDown,()=>{j.current=!0}),onFocus:G(t.onFocus,S=>{const O=!j.current;if(S.target===S.currentTarget&&O&&!b){const D=new CustomEvent(Ml,Q2);if(S.currentTarget.dispatchEvent(D),!D.defaultPrevented){const M=T().filter($=>$.focusable),L=M.find($=>$.active),X=M.find($=>$.id===m),Y=[L,X,...M].filter(Boolean).map($=>$.ref.current);X_(Y,d)}}j.current=!1}),onBlur:G(t.onBlur,()=>w(!1))})})}),q_="RovingFocusGroupItem",Y_=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:i,...a}=t,l=gn(),c=i||l,u=sO(q_,n),d=u.currentTabStopId===c,p=W_(n),{onFocusableItemAdd:f,onFocusableItemRemove:g}=u;return h.useEffect(()=>{if(s)return f(),()=>g()},[s,f,g]),o.jsx(Yc.ItemSlot,{scope:n,id:c,focusable:s,active:r,children:o.jsx(se.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:G(t.onMouseDown,y=>{s?u.onItemFocus(c):y.preventDefault()}),onFocus:G(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:G(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const m=aO(y,u.orientation,u.dir);if(m!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=p().filter(w=>w.focusable).map(w=>w.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const w=b.indexOf(y.currentTarget);b=u.loop?lO(b,w+1):b.slice(w+1)}setTimeout(()=>X_(b))}})})})});Y_.displayName=q_;var oO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iO(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function aO(t,e,n){const s=iO(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return oO[s]}function X_(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function lO(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var cO=K_,uO=Y_,dO=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ns=new WeakMap,ci=new WeakMap,ui={},Vl=0,Z_=function(t){return t&&(t.host||Z_(t.parentNode))},hO=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=Z_(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},pO=function(t,e,n,s){var r=hO(e,Array.isArray(t)?t:[t]);ui[n]||(ui[n]=new WeakMap);var i=ui[n],a=[],l=new Set,c=new Set(r),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};r.forEach(u);var d=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))d(f);else try{var g=f.getAttribute(s),y=g!==null&&g!=="false",m=(Ns.get(f)||0)+1,x=(i.get(f)||0)+1;Ns.set(f,m),i.set(f,x),a.push(f),m===1&&y&&ci.set(f,!0),x===1&&f.setAttribute(n,"true"),y||f.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return d(e),l.clear(),Vl++,function(){a.forEach(function(p){var f=Ns.get(p)-1,g=i.get(p)-1;Ns.set(p,f),i.set(p,g),f||(ci.has(p)||p.removeAttribute(s),ci.delete(p)),g||p.removeAttribute(n)}),Vl--,Vl||(Ns=new WeakMap,Ns=new WeakMap,ci=new WeakMap,ui={})}},kd=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),r=dO(t);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live]"))),pO(s,r,n,"aria-hidden")):function(){return null}},dn=function(){return dn=Object.assign||function(e){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},dn.apply(this,arguments)};function J_(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]]);return n}function fO(t,e,n){if(n||arguments.length===2)for(var s=0,r=e.length,i;s<r;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}var ki="right-scroll-bar-position",Si="width-before-scroll-bar",mO="with-scroll-bars-hidden",gO="--removed-body-scroll-bar-size";function Fl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function vO(t,e){var n=h.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=e,n.facade}var _O=typeof window<"u"?h.useLayoutEffect:h.useEffect,hm=new WeakMap;function yO(t,e){var n=vO(null,function(s){return t.forEach(function(r){return Fl(r,s)})});return _O(function(){var s=hm.get(n);if(s){var r=new Set(s),i=new Set(t),a=n.current;r.forEach(function(l){i.has(l)||Fl(l,null)}),i.forEach(function(l){r.has(l)||Fl(l,a)})}hm.set(n,t)},[t]),n}function xO(t){return t}function bO(t,e){e===void 0&&(e=xO);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var a=e(i,s);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(s=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var c=function(){var d=a;a=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return r}function wO(t){t===void 0&&(t={});var e=bO(null);return e.options=dn({async:!0,ssr:!1},t),e}var Q_=function(t){var e=t.sideCar,n=J_(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return h.createElement(s,dn({},n))};Q_.isSideCarExport=!0;function EO(t,e){return t.useMedium(e),Q_}var ey=wO(),$l=function(){},La=h.forwardRef(function(t,e){var n=h.useRef(null),s=h.useState({onScrollCapture:$l,onWheelCapture:$l,onTouchMoveCapture:$l}),r=s[0],i=s[1],a=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,p=t.shards,f=t.sideCar,g=t.noIsolation,y=t.inert,m=t.allowPinchZoom,x=t.as,b=x===void 0?"div":x,w=t.gapMode,E=J_(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,j=yO([n,e]),P=dn(dn({},E),r);return h.createElement(h.Fragment,null,d&&h.createElement(T,{sideCar:ey,removeScrollBar:u,shards:p,noIsolation:g,inert:y,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:w}),a?h.cloneElement(h.Children.only(l),dn(dn({},P),{ref:j})):h.createElement(b,dn({},P,{className:c,ref:j}),l))});La.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};La.classNames={fullWidth:Si,zeroRight:ki};var jO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function TO(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=jO();return e&&t.setAttribute("nonce",e),t}function PO(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function kO(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var SO=function(){var t=0,e=null;return{add:function(n){t==0&&(e=TO())&&(PO(e,n),kO(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},RO=function(){var t=SO();return function(e,n){h.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},ty=function(){var t=RO(),e=function(n){var s=n.styles,r=n.dynamic;return t(s,r),null};return e},AO={left:0,top:0,right:0,gap:0},Bl=function(t){return parseInt(t||"",10)||0},CO=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],r=e[t==="padding"?"paddingRight":"marginRight"];return[Bl(n),Bl(s),Bl(r)]},IO=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return AO;var e=CO(t),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-n+e[2]-e[0])}},OO=ty(),tr="data-scroll-locked",DO=function(t,e,n,s){var r=t.left,i=t.top,a=t.right,l=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(mO,` {
   overflow: hidden `).concat(s,`;
   padding-right: `).concat(l,"px ").concat(s,`;
  }
  body[`).concat(tr,`] {
    overflow: hidden `).concat(s,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&`
    padding-left: `.concat(r,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(a,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(s,`;
    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(ki,` {
    right: `).concat(l,"px ").concat(s,`;
  }
  
  .`).concat(Si,` {
    margin-right: `).concat(l,"px ").concat(s,`;
  }
  
  .`).concat(ki," .").concat(ki,` {
    right: 0 `).concat(s,`;
  }
  
  .`).concat(Si," .").concat(Si,` {
    margin-right: 0 `).concat(s,`;
  }
  
  body[`).concat(tr,`] {
    `).concat(gO,": ").concat(l,`px;
  }
`)},pm=function(){var t=parseInt(document.body.getAttribute(tr)||"0",10);return isFinite(t)?t:0},LO=function(){h.useEffect(function(){return document.body.setAttribute(tr,(pm()+1).toString()),function(){var t=pm()-1;t<=0?document.body.removeAttribute(tr):document.body.setAttribute(tr,t.toString())}},[])},NO=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,r=s===void 0?"margin":s;LO();var i=h.useMemo(function(){return IO(r)},[r]);return h.createElement(OO,{styles:DO(i,!e,r,n?"":"!important")})},Xc=!1;if(typeof window<"u")try{var di=Object.defineProperty({},"passive",{get:function(){return Xc=!0,!0}});window.addEventListener("test",di,di),window.removeEventListener("test",di,di)}catch{Xc=!1}var Ms=Xc?{passive:!1}:!1,MO=function(t){return t.tagName==="TEXTAREA"},ny=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!MO(t)&&n[e]==="visible")},VO=function(t){return ny(t,"overflowY")},FO=function(t){return ny(t,"overflowX")},fm=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=sy(t,s);if(r){var i=ry(t,s),a=i[1],l=i[2];if(a>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},$O=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},BO=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},sy=function(t,e){return t==="v"?VO(e):FO(e)},ry=function(t,e){return t==="v"?$O(e):BO(e)},zO=function(t,e){return t==="h"&&e==="rtl"?-1:1},UO=function(t,e,n,s,r){var i=zO(t,window.getComputedStyle(e).direction),a=i*s,l=n.target,c=e.contains(l),u=!1,d=a>0,p=0,f=0;do{var g=ry(t,l),y=g[0],m=g[1],x=g[2],b=m-x-i*y;(y||b)&&sy(t,l)&&(p+=b,f+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(p)<1||!r)||!d&&(Math.abs(f)<1||!r))&&(u=!0),u},hi=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},mm=function(t){return[t.deltaX,t.deltaY]},gm=function(t){return t&&"current"in t?t.current:t},HO=function(t,e){return t[0]===e[0]&&t[1]===e[1]},WO=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},GO=0,Vs=[];function KO(t){var e=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),r=h.useState(GO++)[0],i=h.useState(ty)[0],a=h.useRef(t);h.useEffect(function(){a.current=t},[t]),h.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var m=fO([t.lockRef.current],(t.shards||[]).map(gm),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var l=h.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var b=hi(m),w=n.current,E="deltaX"in m?m.deltaX:w[0]-b[0],T="deltaY"in m?m.deltaY:w[1]-b[1],j,P=m.target,k=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in m&&k==="h"&&P.type==="range")return!1;var S=fm(k,P);if(!S)return!0;if(S?j=k:(j=k==="v"?"h":"v",S=fm(k,P)),!S)return!1;if(!s.current&&"changedTouches"in m&&(E||T)&&(s.current=j),!j)return!0;var O=s.current||j;return UO(O,x,m,O==="h"?E:T,!0)},[]),c=h.useCallback(function(m){var x=m;if(!(!Vs.length||Vs[Vs.length-1]!==i)){var b="deltaY"in x?mm(x):hi(x),w=e.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&HO(j.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var E=(a.current.shards||[]).map(gm).filter(Boolean).filter(function(j){return j.contains(x.target)}),T=E.length>0?l(x,E[0]):!a.current.noIsolation;T&&x.cancelable&&x.preventDefault()}}},[]),u=h.useCallback(function(m,x,b,w){var E={name:m,delta:x,target:b,should:w,shadowParent:qO(b)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),d=h.useCallback(function(m){n.current=hi(m),s.current=void 0},[]),p=h.useCallback(function(m){u(m.type,mm(m),m.target,l(m,t.lockRef.current))},[]),f=h.useCallback(function(m){u(m.type,hi(m),m.target,l(m,t.lockRef.current))},[]);h.useEffect(function(){return Vs.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Ms),document.addEventListener("touchmove",c,Ms),document.addEventListener("touchstart",d,Ms),function(){Vs=Vs.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,Ms),document.removeEventListener("touchmove",c,Ms),document.removeEventListener("touchstart",d,Ms)}},[]);var g=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:WO(r)}):null,g?h.createElement(NO,{gapMode:t.gapMode}):null)}function qO(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const YO=EO(ey,KO);var Na=h.forwardRef(function(t,e){return h.createElement(La,dn({},t,{ref:e,sideCar:YO}))});Na.classNames=La.classNames;var Zc=["Enter"," "],XO=["ArrowDown","PageUp","Home"],oy=["ArrowUp","PageDown","End"],ZO=[...XO,...oy],JO={ltr:[...Zc,"ArrowRight"],rtl:[...Zc,"ArrowLeft"]},QO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Uo="Menu",[Ro,eD,tD]=ha(Uo),[Ps,iy]=js(Uo,[tD,xr,G_]),Ma=xr(),ay=G_(),[nD,ks]=Ps(Uo),[sD,Ho]=Ps(Uo),ly=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:r,onOpenChange:i,modal:a=!0}=t,l=Ma(e),[c,u]=h.useState(null),d=h.useRef(!1),p=Ye(i),f=Td(r);return h.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(Tu,{...l,children:o.jsx(nD,{scope:e,open:n,onOpenChange:p,content:c,onContentChange:u,children:o.jsx(sD,{scope:e,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:f,modal:a,children:s})})})};ly.displayName=Uo;var rD="MenuAnchor",Sd=h.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,r=Ma(n);return o.jsx(Pu,{...r,...s,ref:e})});Sd.displayName=rD;var Rd="MenuPortal",[oD,cy]=Ps(Rd,{forceMount:void 0}),uy=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:r}=t,i=ks(Rd,e);return o.jsx(oD,{scope:e,forceMount:n,children:o.jsx(nn,{present:n||i.open,children:o.jsx(gr,{asChild:!0,container:r,children:s})})})};uy.displayName=Rd;var qt="MenuContent",[iD,Ad]=Ps(qt),dy=h.forwardRef((t,e)=>{const n=cy(qt,t.__scopeMenu),{forceMount:s=n.forceMount,...r}=t,i=ks(qt,t.__scopeMenu),a=Ho(qt,t.__scopeMenu);return o.jsx(Ro.Provider,{scope:t.__scopeMenu,children:o.jsx(nn,{present:s||i.open,children:o.jsx(Ro.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(aD,{...r,ref:e}):o.jsx(lD,{...r,ref:e})})})})}),aD=h.forwardRef((t,e)=>{const n=ks(qt,t.__scopeMenu),s=h.useRef(null),r=_e(e,s);return h.useEffect(()=>{const i=s.current;if(i)return kd(i)},[]),o.jsx(Cd,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lD=h.forwardRef((t,e)=>{const n=ks(qt,t.__scopeMenu);return o.jsx(Cd,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Cd=h.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:g,disableOutsideScroll:y,...m}=t,x=ks(qt,n),b=Ho(qt,n),w=Ma(n),E=ay(n),T=eD(n),[j,P]=h.useState(null),k=h.useRef(null),S=_e(e,k,x.onContentChange),O=h.useRef(0),D=h.useRef(""),M=h.useRef(0),L=h.useRef(null),X=h.useRef("right"),I=h.useRef(0),Y=y?Na:h.Fragment,$=y?{as:Jn,allowPinchZoom:!0}:void 0,H=C=>{const V=D.current+C,N=T().filter(K=>!K.disabled),Z=document.activeElement,Q=N.find(K=>K.ref.current===Z)?.textValue,ne=N.map(K=>K.textValue),we=xD(ne,V,Q),te=N.find(K=>K.textValue===we)?.ref.current;(function K(he){D.current=he,window.clearTimeout(O.current),he!==""&&(O.current=window.setTimeout(()=>K(""),1e3))})(V),te&&setTimeout(()=>te.focus())};h.useEffect(()=>()=>window.clearTimeout(O.current),[]),Pd();const A=h.useCallback(C=>X.current===L.current?.side&&wD(C,L.current?.area),[]);return o.jsx(iD,{scope:n,searchRef:D,onItemEnter:h.useCallback(C=>{A(C)&&C.preventDefault()},[A]),onItemLeave:h.useCallback(C=>{A(C)||(k.current?.focus(),P(null))},[A]),onTriggerLeave:h.useCallback(C=>{A(C)&&C.preventDefault()},[A]),pointerGraceTimerRef:M,onPointerGraceIntentChange:h.useCallback(C=>{L.current=C},[]),children:o.jsx(Y,{...$,children:o.jsx(Oa,{asChild:!0,trapped:r,onMountAutoFocus:G(i,C=>{C.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(mr,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:g,children:o.jsx(cO,{asChild:!0,...E,dir:b.dir,orientation:"vertical",loop:s,currentTabStopId:j,onCurrentTabStopIdChange:P,onEntryFocus:G(c,C=>{b.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(ku,{role:"menu","aria-orientation":"vertical","data-state":ky(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...m,ref:S,style:{outline:"none",...m.style},onKeyDown:G(m.onKeyDown,C=>{const N=C.target.closest("[data-radix-menu-content]")===C.currentTarget,Z=C.ctrlKey||C.altKey||C.metaKey,Q=C.key.length===1;N&&(C.key==="Tab"&&C.preventDefault(),!Z&&Q&&H(C.key));const ne=k.current;if(C.target!==ne||!ZO.includes(C.key))return;C.preventDefault();const te=T().filter(K=>!K.disabled).map(K=>K.ref.current);oy.includes(C.key)&&te.reverse(),_D(te)}),onBlur:G(t.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(O.current),D.current="")}),onPointerMove:G(t.onPointerMove,Ao(C=>{const V=C.target,N=I.current!==C.clientX;if(C.currentTarget.contains(V)&&N){const Z=C.clientX>I.current?"right":"left";X.current=Z,I.current=C.clientX}}))})})})})})})});dy.displayName=qt;var cD="MenuGroup",Id=h.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return o.jsx(se.div,{role:"group",...s,ref:e})});Id.displayName=cD;var uD="MenuLabel",hy=h.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return o.jsx(se.div,{...s,ref:e})});hy.displayName=uD;var ia="MenuItem",vm="menu.itemSelect",Va=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...r}=t,i=h.useRef(null),a=Ho(ia,t.__scopeMenu),l=Ad(ia,t.__scopeMenu),c=_e(e,i),u=h.useRef(!1),d=()=>{const p=i.current;if(!n&&p){const f=new CustomEvent(vm,{bubbles:!0,cancelable:!0});p.addEventListener(vm,g=>s?.(g),{once:!0}),du(p,f),f.defaultPrevented?u.current=!1:a.onClose()}};return o.jsx(py,{...r,ref:c,disabled:n,onClick:G(t.onClick,d),onPointerDown:p=>{t.onPointerDown?.(p),u.current=!0},onPointerUp:G(t.onPointerUp,p=>{u.current||p.currentTarget?.click()}),onKeyDown:G(t.onKeyDown,p=>{const f=l.searchRef.current!=="";n||f&&p.key===" "||Zc.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Va.displayName=ia;var py=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...i}=t,a=Ad(ia,n),l=ay(n),c=h.useRef(null),u=_e(e,c),[d,p]=h.useState(!1),[f,g]=h.useState("");return h.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[i.children]),o.jsx(Ro.ItemSlot,{scope:n,disabled:s,textValue:r??f,children:o.jsx(uO,{asChild:!0,...l,focusable:!s,children:o.jsx(se.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:u,onPointerMove:G(t.onPointerMove,Ao(y=>{s?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(t.onPointerLeave,Ao(y=>a.onItemLeave(y))),onFocus:G(t.onFocus,()=>p(!0)),onBlur:G(t.onBlur,()=>p(!1))})})})}),dD="MenuCheckboxItem",fy=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...r}=t;return o.jsx(yy,{scope:t.__scopeMenu,checked:n,children:o.jsx(Va,{role:"menuitemcheckbox","aria-checked":aa(n)?"mixed":n,...r,ref:e,"data-state":Dd(n),onSelect:G(r.onSelect,()=>s?.(aa(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fy.displayName=dD;var my="MenuRadioGroup",[hD,pD]=Ps(my,{value:void 0,onValueChange:()=>{}}),gy=h.forwardRef((t,e)=>{const{value:n,onValueChange:s,...r}=t,i=Ye(s);return o.jsx(hD,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(Id,{...r,ref:e})})});gy.displayName=my;var vy="MenuRadioItem",_y=h.forwardRef((t,e)=>{const{value:n,...s}=t,r=pD(vy,t.__scopeMenu),i=n===r.value;return o.jsx(yy,{scope:t.__scopeMenu,checked:i,children:o.jsx(Va,{role:"menuitemradio","aria-checked":i,...s,ref:e,"data-state":Dd(i),onSelect:G(s.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});_y.displayName=vy;var Od="MenuItemIndicator",[yy,fD]=Ps(Od,{checked:!1}),xy=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...r}=t,i=fD(Od,n);return o.jsx(nn,{present:s||aa(i.checked)||i.checked===!0,children:o.jsx(se.span,{...r,ref:e,"data-state":Dd(i.checked)})})});xy.displayName=Od;var mD="MenuSeparator",by=h.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return o.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});by.displayName=mD;var gD="MenuArrow",wy=h.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,r=Ma(n);return o.jsx(Su,{...r,...s,ref:e})});wy.displayName=gD;var vD="MenuSub",[dV,Ey]=Ps(vD),Kr="MenuSubTrigger",jy=h.forwardRef((t,e)=>{const n=ks(Kr,t.__scopeMenu),s=Ho(Kr,t.__scopeMenu),r=Ey(Kr,t.__scopeMenu),i=Ad(Kr,t.__scopeMenu),a=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:t.__scopeMenu},d=h.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const p=l.current;return()=>{window.clearTimeout(p),c(null)}},[l,c]),o.jsx(Sd,{asChild:!0,...u,children:o.jsx(py,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":ky(n.open),...t,ref:da(e,r.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(t.onPointerMove,Ao(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:G(t.onPointerLeave,Ao(p=>{d();const f=n.content?.getBoundingClientRect();if(f){const g=n.content?.dataset.side,y=g==="right",m=y?-5:5,x=f[y?"left":"right"],b=f[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+m,y:p.clientY},{x,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x,y:f.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:G(t.onKeyDown,p=>{const f=i.searchRef.current!=="";t.disabled||f&&p.key===" "||JO[s.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});jy.displayName=Kr;var Ty="MenuSubContent",Py=h.forwardRef((t,e)=>{const n=cy(qt,t.__scopeMenu),{forceMount:s=n.forceMount,...r}=t,i=ks(qt,t.__scopeMenu),a=Ho(qt,t.__scopeMenu),l=Ey(Ty,t.__scopeMenu),c=h.useRef(null),u=_e(e,c);return o.jsx(Ro.Provider,{scope:t.__scopeMenu,children:o.jsx(nn,{present:s||i.open,children:o.jsx(Ro.Slot,{scope:t.__scopeMenu,children:o.jsx(Cd,{id:l.contentId,"aria-labelledby":l.triggerId,...r,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{a.isUsingKeyboardRef.current&&c.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:G(t.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:G(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:G(t.onKeyDown,d=>{const p=d.currentTarget.contains(d.target),f=QO[a.dir].includes(d.key);p&&f&&(i.onOpenChange(!1),l.trigger?.focus(),d.preventDefault())})})})})})});Py.displayName=Ty;function ky(t){return t?"open":"closed"}function aa(t){return t==="indeterminate"}function Dd(t){return aa(t)?"indeterminate":t?"checked":"unchecked"}function _D(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function yD(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function xD(t,e,n){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=yD(t,Math.max(i,0));r.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function bD(t,e){const{x:n,y:s}=t;let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i].x,c=e[i].y,u=e[a].x,d=e[a].y;c>s!=d>s&&n<(u-l)*(s-c)/(d-c)+l&&(r=!r)}return r}function wD(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return bD(n,e)}function Ao(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ED=ly,jD=Sd,TD=uy,PD=dy,kD=Id,SD=hy,RD=Va,AD=fy,CD=gy,ID=_y,OD=xy,DD=by,LD=wy,ND=jy,MD=Py,Ld="DropdownMenu",[VD,hV]=js(Ld,[iy]),At=iy(),[FD,Sy]=VD(Ld),Ry=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:r,defaultOpen:i,onOpenChange:a,modal:l=!0}=t,c=At(e),u=h.useRef(null),[d=!1,p]=_s({prop:r,defaultProp:i,onChange:a});return o.jsx(FD,{scope:e,triggerId:gn(),triggerRef:u,contentId:gn(),open:d,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(f=>!f),[p]),modal:l,children:o.jsx(ED,{...c,open:d,onOpenChange:p,dir:s,modal:l,children:n})})};Ry.displayName=Ld;var Ay="DropdownMenuTrigger",Cy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=t,i=Sy(Ay,n),a=At(n);return o.jsx(jD,{asChild:!0,...a,children:o.jsx(se.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...r,ref:da(e,i.triggerRef),onPointerDown:G(t.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:G(t.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Cy.displayName=Ay;var $D="DropdownMenuPortal",Iy=t=>{const{__scopeDropdownMenu:e,...n}=t,s=At(e);return o.jsx(TD,{...s,...n})};Iy.displayName=$D;var Oy="DropdownMenuContent",Dy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=Sy(Oy,n),i=At(n),a=h.useRef(!1);return o.jsx(PD,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...s,ref:e,onCloseAutoFocus:G(t.onCloseAutoFocus,l=>{a.current||r.triggerRef.current?.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:G(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!r.modal||d)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Dy.displayName=Oy;var BD="DropdownMenuGroup",zD=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(kD,{...r,...s,ref:e})});zD.displayName=BD;var UD="DropdownMenuLabel",Ly=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(SD,{...r,...s,ref:e})});Ly.displayName=UD;var HD="DropdownMenuItem",Ny=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(RD,{...r,...s,ref:e})});Ny.displayName=HD;var WD="DropdownMenuCheckboxItem",My=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(AD,{...r,...s,ref:e})});My.displayName=WD;var GD="DropdownMenuRadioGroup",KD=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(CD,{...r,...s,ref:e})});KD.displayName=GD;var qD="DropdownMenuRadioItem",Vy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(ID,{...r,...s,ref:e})});Vy.displayName=qD;var YD="DropdownMenuItemIndicator",Fy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(OD,{...r,...s,ref:e})});Fy.displayName=YD;var XD="DropdownMenuSeparator",$y=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(DD,{...r,...s,ref:e})});$y.displayName=XD;var ZD="DropdownMenuArrow",JD=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(LD,{...r,...s,ref:e})});JD.displayName=ZD;var QD="DropdownMenuSubTrigger",By=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(ND,{...r,...s,ref:e})});By.displayName=QD;var eL="DropdownMenuSubContent",zy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,r=At(n);return o.jsx(MD,{...r,...s,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zy.displayName=eL;var tL=Ry,nL=Cy,sL=Iy,Uy=Dy,Hy=Ly,Wy=Ny,Gy=My,Ky=Vy,qy=Fy,Yy=$y,Xy=By,Zy=zy;const Ri=tL,Ai=nL,rL=h.forwardRef(({className:t,inset:e,children:n,...s},r)=>o.jsxs(Xy,{ref:r,className:ie("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...s,children:[n,o.jsx(n1,{className:"ml-auto h-4 w-4"})]}));rL.displayName=Xy.displayName;const oL=h.forwardRef(({className:t,...e},n)=>o.jsx(Zy,{ref:n,className:ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));oL.displayName=Zy.displayName;const co=h.forwardRef(({className:t,sideOffset:e=4,...n},s)=>o.jsx(sL,{children:o.jsx(Uy,{ref:s,sideOffset:e,className:ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));co.displayName=Uy.displayName;const qn=h.forwardRef(({className:t,inset:e,...n},s)=>o.jsx(Wy,{ref:s,className:ie("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));qn.displayName=Wy.displayName;const iL=h.forwardRef(({className:t,children:e,checked:n,...s},r)=>o.jsxs(Gy,{ref:r,className:ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...s,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(qy,{children:o.jsx(ga,{className:"h-4 w-4"})})}),e]}));iL.displayName=Gy.displayName;const aL=h.forwardRef(({className:t,children:e,...n},s)=>o.jsxs(Ky,{ref:s,className:ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(qy,{children:o.jsx(a1,{className:"h-2 w-2 fill-current"})})}),e]}));aL.displayName=Ky.displayName;const lL=h.forwardRef(({className:t,inset:e,...n},s)=>o.jsx(Hy,{ref:s,className:ie("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));lL.displayName=Hy.displayName;const Ci=h.forwardRef(({className:t,...e},n)=>o.jsx(Yy,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",t),...e}));Ci.displayName=Yy.displayName;var Nd="Dialog",[Jy,pV]=js(Nd),[cL,rn]=Jy(Nd),Qy=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:a=!0}=t,l=h.useRef(null),c=h.useRef(null),[u=!1,d]=_s({prop:s,defaultProp:r,onChange:i});return o.jsx(cL,{scope:e,triggerRef:l,contentRef:c,contentId:gn(),titleId:gn(),descriptionId:gn(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(p=>!p),[d]),modal:a,children:n})};Qy.displayName=Nd;var ex="DialogTrigger",tx=h.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,r=rn(ex,n),i=_e(e,r.triggerRef);return o.jsx(se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Fd(r.open),...s,ref:i,onClick:G(t.onClick,r.onOpenToggle)})});tx.displayName=ex;var Md="DialogPortal",[uL,nx]=Jy(Md,{forceMount:void 0}),sx=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:r}=t,i=rn(Md,e);return o.jsx(uL,{scope:e,forceMount:n,children:h.Children.map(s,a=>o.jsx(nn,{present:n||i.open,children:o.jsx(gr,{asChild:!0,container:r,children:a})}))})};sx.displayName=Md;var la="DialogOverlay",rx=h.forwardRef((t,e)=>{const n=nx(la,t.__scopeDialog),{forceMount:s=n.forceMount,...r}=t,i=rn(la,t.__scopeDialog);return i.modal?o.jsx(nn,{present:s||i.open,children:o.jsx(dL,{...r,ref:e})}):null});rx.displayName=la;var dL=h.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,r=rn(la,n);return o.jsx(Na,{as:Jn,allowPinchZoom:!0,shards:[r.contentRef],children:o.jsx(se.div,{"data-state":Fd(r.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),ws="DialogContent",ox=h.forwardRef((t,e)=>{const n=nx(ws,t.__scopeDialog),{forceMount:s=n.forceMount,...r}=t,i=rn(ws,t.__scopeDialog);return o.jsx(nn,{present:s||i.open,children:i.modal?o.jsx(hL,{...r,ref:e}):o.jsx(pL,{...r,ref:e})})});ox.displayName=ws;var hL=h.forwardRef((t,e)=>{const n=rn(ws,t.__scopeDialog),s=h.useRef(null),r=_e(e,n.contentRef,s);return h.useEffect(()=>{const i=s.current;if(i)return kd(i)},[]),o.jsx(ix,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(t.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:G(t.onFocusOutside,i=>i.preventDefault())})}),pL=h.forwardRef((t,e)=>{const n=rn(ws,t.__scopeDialog),s=h.useRef(!1),r=h.useRef(!1);return o.jsx(ix,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(s.current||n.triggerRef.current?.focus(),i.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),ix=h.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:i,...a}=t,l=rn(ws,n),c=h.useRef(null),u=_e(e,c);return Pd(),o.jsxs(o.Fragment,{children:[o.jsx(Oa,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:i,children:o.jsx(mr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Fd(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(fL,{titleId:l.titleId}),o.jsx(gL,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Vd="DialogTitle",ax=h.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,r=rn(Vd,n);return o.jsx(se.h2,{id:r.titleId,...s,ref:e})});ax.displayName=Vd;var lx="DialogDescription",cx=h.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,r=rn(lx,n);return o.jsx(se.p,{id:r.descriptionId,...s,ref:e})});cx.displayName=lx;var ux="DialogClose",dx=h.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,r=rn(ux,n);return o.jsx(se.button,{type:"button",...s,ref:e,onClick:G(t.onClick,()=>r.onOpenChange(!1))})});dx.displayName=ux;function Fd(t){return t?"open":"closed"}var hx="DialogTitleWarning",[fV,px]=tw(hx,{contentName:ws,titleName:Vd,docsSlug:"dialog"}),fL=({titleId:t})=>{const e=px(hx),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return h.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},mL="DialogDescriptionWarning",gL=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${px(mL).contentName}}.`;return h.useEffect(()=>{const r=t.current?.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},fx=Qy,mx=tx,gx=sx,Fa=rx,$a=ox,Ba=ax,za=cx,vx=dx;const vL=fx,_L=mx,yL=gx,_x=h.forwardRef(({className:t,...e},n)=>o.jsx(Fa,{className:ie("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));_x.displayName=Fa.displayName;const xL=ma("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),yx=h.forwardRef(({side:t="right",className:e,children:n,...s},r)=>o.jsxs(yL,{children:[o.jsx(_x,{}),o.jsxs($a,{ref:r,className:ie(xL({side:t}),e),...s,children:[n,o.jsxs(vx,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[o.jsx(va,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yx.displayName=$a.displayName;const bL=h.forwardRef(({className:t,...e},n)=>o.jsx(Ba,{ref:n,className:ie("text-lg font-semibold text-foreground",t),...e}));bL.displayName=Ba.displayName;const wL=h.forwardRef(({className:t,...e},n)=>o.jsx(za,{ref:n,className:ie("text-sm text-muted-foreground",t),...e}));wL.displayName=za.displayName;var $d="Avatar",[EL,mV]=js($d),[jL,xx]=EL($d),bx=h.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[r,i]=h.useState("idle");return o.jsx(jL,{scope:n,imageLoadingStatus:r,onImageLoadingStatusChange:i,children:o.jsx(se.span,{...s,ref:e})})});bx.displayName=$d;var wx="AvatarImage",Ex=h.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:r=()=>{},...i}=t,a=xx(wx,n),l=TL(s,i.referrerPolicy),c=Ye(u=>{r(u),a.onImageLoadingStatusChange(u)});return We(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(se.img,{...i,ref:e,src:s}):null});Ex.displayName=wx;var jx="AvatarFallback",Tx=h.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...r}=t,i=xx(jx,n),[a,l]=h.useState(s===void 0);return h.useEffect(()=>{if(s!==void 0){const c=window.setTimeout(()=>l(!0),s);return()=>window.clearTimeout(c)}},[s]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(se.span,{...r,ref:e}):null});Tx.displayName=jx;function TL(t,e){const[n,s]=h.useState("idle");return We(()=>{if(!t){s("error");return}let r=!0;const i=new window.Image,a=l=>()=>{r&&s(l)};return s("loading"),i.onload=a("loaded"),i.onerror=a("error"),i.src=t,e&&(i.referrerPolicy=e),()=>{r=!1}},[t,e]),n}var Px=bx,kx=Ex,Sx=Tx;const Jc=h.forwardRef(({className:t,...e},n)=>o.jsx(Px,{ref:n,className:ie("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Jc.displayName=Px.displayName;const Qc=h.forwardRef(({className:t,...e},n)=>o.jsx(kx,{ref:n,className:ie("aspect-square h-full w-full",t),...e}));Qc.displayName=kx.displayName;const eu=h.forwardRef(({className:t,...e},n)=>o.jsx(Sx,{ref:n,className:ie("flex h-full w-full items-center justify-center rounded-full bg-nature-red text-white hover:bg-nature-coral transition-colors",t),...e}));eu.displayName=Sx.displayName;const _m=ma("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-nature-coral text-white hover:bg-nature-coral/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-nature-red text-white hover:bg-nature-red/90",outline:"text-foreground",create:"border-transparent bg-nature-purple text-white hover:bg-nature-purple/90",premium:"border-transparent bg-nature-honey text-nature-honey-ink hover:bg-nature-honey/90"}},defaultVariants:{variant:"default"}});function PL({className:t,variant:e,animated:n=!1,...s}){if(n){const r={className:ie(_m({variant:e}),t),initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:400,damping:10},whileHover:{scale:1.1}};return o.jsx(Fe.div,{...r,children:s.children})}return o.jsx("div",{className:ie(_m({variant:e}),t),...s})}const kL=({Icon:t,className:e="",size:n=24,hoverEffect:s="bounce"})=>{const r=()=>{switch(s){case"bounce":return{scale:[1,1.2,1],y:[0,-4,0],transition:{duration:.3}};case"rotate":return{rotate:[0,15,-15,0],transition:{duration:.4}};case"scale":return{scale:1.15,transition:{duration:.2}};case"wiggle":return{rotate:[0,-3,3,-3,3,0],scale:1.5,transition:{duration:.5}};default:return{}}},i=()=>({scale:1.2,rotate:[0,-2,2,0],transition:{duration:.15}});return o.jsx(Fe.div,{className:`inline-block touch-manipulation ${e}`,whileHover:r(),whileTap:i(),style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation"},children:o.jsx(t,{size:n})})},$e=({bob:t=!1,className:e="",children:n})=>o.jsx(Fe.div,{tabIndex:-1,className:`flex ${e}`,animate:t?{y:[0,-3,0]}:{y:0},transition:t?{duration:2,repeat:1/0,ease:"easeInOut"}:{duration:.2},whileHover:{y:-3,transition:{type:"spring",stiffness:400,damping:20}},whileTap:{y:-1,transition:{duration:.1}},children:n}),nr=({countryCode:t,size:e=20,className:n=""})=>o.jsx("img",{src:`https://flagcdn.com/w40/${t.toLowerCase()}.png`,alt:`${t} flag`,className:`rounded-full object-cover ${n}`,style:{width:e,height:e},loading:"lazy"}),uo={en:"gb",zh:"cn",bn:"in",es:"es",ja:"jp",ko:"kr",th:"th",vi:"vn",hi:"in",pt:"br",fil:"ph",ms:"my",id:"id",my:"mm",km:"kh",lo:"la"},SL={"zh-Hans":"cn",ja:"jp",ko:"kr",hi:"in",bn:"in",es:"es",pt:"br",th:"th",vi:"vn",fil:"ph",ms:"my",lo:"la",id:"id",km:"kh",my:"mm"},RL=()=>{const{currentLanguage:t,changeLanguage:e}=Dt(),{isBusy:n}=zu(),{t:s}=Se("navbar"),r=en.map(a=>({code:a,name:to[a]})),i=r.find(a=>a.code===t)?.name||"English";return n?o.jsxs(NT,{children:[o.jsx(MT,{asChild:!0,children:o.jsx("span",{tabIndex:0,children:o.jsxs(bn,{variant:"ghost",size:"sm",className:"gap-2 opacity-50 cursor-not-allowed",disabled:!0,children:[o.jsx(nr,{countryCode:uo[t]||"gb",size:20}),o.jsx("span",{className:"hidden sm:inline",children:i})]})})}),o.jsx(Wg,{side:"bottom",children:s("languageLockedDuringGeneration",{defaultValue:"Please wait — your story is being generated."})})]}):o.jsxs(Ri,{children:[o.jsx(Ai,{asChild:!0,children:o.jsxs(bn,{variant:"ghost",size:"sm",className:"gap-2",children:[o.jsx(nr,{countryCode:uo[t]||"gb",size:20}),o.jsx("span",{className:"hidden sm:inline",children:i})]})}),o.jsx(co,{align:"end",children:r.map(a=>{const l=t===a.code;return o.jsx(qn,{onClick:()=>e(a.code),className:l?"bg-nature-coral/10 text-nature-coral font-medium":"",children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(nr,{countryCode:uo[a.code]||"gb",size:16}),a.name,l&&o.jsx(ga,{className:"ml-auto h-4 w-4"})]})},a.code)})})]})},Ss=({to:t,href:e,external:n,onClick:s,type:r="button",disabled:i,className:a="",variant:l,size:c="pill",leftIcon:u,children:d,linkProps:p,ariaLabel:f})=>{const g=ie(U_({variant:l,size:c}),"whitespace-nowrap gap-2",a),m=c==="pillIcon"?o.jsxs("span",{className:"inline-flex items-center justify-center [&_svg]:h-4 [&_svg]:w-4",children:[u,d]}):o.jsxs(o.Fragment,{children:[u?o.jsx("span",{className:"inline-flex items-center [&_svg]:h-4 [&_svg]:w-4",children:u}):null,o.jsx("span",{children:d})]});return e?o.jsx(Fe.span,{className:"inline-flex",whileHover:{scale:1.03},whileTap:{scale:.97},transition:{type:"spring",stiffness:400,damping:20},children:o.jsx("a",{href:e,onClick:s,"aria-label":f,className:g,...n?{target:"_blank",rel:"noopener noreferrer"}:{},...p,children:m})}):t?o.jsx(Fe.span,{className:"inline-flex",whileHover:{scale:1.03},whileTap:{scale:.97},transition:{type:"spring",stiffness:400,damping:20},children:o.jsx(pe,{to:t,onClick:s,"aria-label":f,className:g,...p,children:m})}):o.jsx(Fe.button,{type:r,onClick:s,disabled:i,"aria-label":f,className:g,whileHover:i?void 0:{scale:1.03},whileTap:i?void 0:{scale:.97},transition:{type:"spring",stiffness:400,damping:20},children:m})},AL=({className:t="",onClick:e})=>{const{getLocalizedPath:n}=Dt(),{t:s}=Se("subscription");return o.jsx(Ss,{variant:"primary",to:e?void 0:n("/login"),onClick:e,leftIcon:o.jsx(ig,{}),className:t,children:s("currentSubscription.unauthenticated.loginButton")})},ca=({variant:t="inline",className:e="",as:n="span"})=>{let s="",r="";switch(t){case"navbar":s="text-lg",r="font-bold";break;case"footer":s="text-xl",r="font-bold";break;case"auth":s="text-xl",r="font-bold";break;default:s="",r="";break}return o.jsxs(n,{className:mu(e,r,s,"whitespace-nowrap font-noto inline"),children:[o.jsx("span",{className:"text-nature-red",children:"Story"}),o.jsx("span",{className:"text-nature-coral",children:"Sparkle"})]})},ym="https://cdn.storysparkle.org/logo_assets/favicon.webp",CL=()=>{const[t,e]=h.useState(!1),[n,s]=h.useState(!1),{pathname:r}=os(),i=uu(),{user:a,signOut:l}=br(),{userType:c,subscription:u,avatarUrl:d,displayName:p,refreshSubscriptionStatus:f}=z2(),g=h.useRef(null),[y,m]=h.useState(!1),{t:x}=Se("navbar"),{getLocalizedPath:b}=Dt(),w=async V=>{const N=V.target.files?.[0];if(!(!N||!a)){if(N.size>5*1024*1024){hn.error("Image must be under 5MB");return}m(!0),hn.loading("Uploading photo...",{id:"avatar-upload"});try{const Z=N.name.split(".").pop()||"jpg",Q=`${a.id}/avatar.${Z}`,{error:ne}=await q.storage.from("avatars").upload(Q,N,{upsert:!0});if(ne)throw ne;const{data:{publicUrl:we}}=q.storage.from("avatars").getPublicUrl(Q),te=`${we}?t=${Date.now()}`,{error:K}=await q.from("profiles").update({avatar_url:te}).eq("id",a.id);if(K)throw K;hn.success("Profile photo updated!",{id:"avatar-upload"}),f()}catch(Z){console.error("Avatar upload error:",Z),hn.error("Failed to upload photo",{id:"avatar-upload"})}finally{m(!1),g.current&&(g.current.value="")}}},E=V=>{const N=b(V);return r===N||r.startsWith(N+"/")},T=V=>E(V.path)||(V.extra??[]).some(E),j=[{name:x("readStory"),path:"/stories",icon:j1,extra:["/story"]},{name:x("createStory"),path:"/story-maker",icon:ag},{name:x("checkText"),path:"/text-checker",icon:h1}],P=[{name:x("improveReading"),path:"/improve-reading",icon:Hw},{name:x("themes"),path:"/themes",icon:M1},{name:x("seslAlgorithm"),path:"/research",icon:Zw},{name:x("watch"),path:"/watch",icon:rg},{name:x("blog"),path:"/blog",icon:P1},{name:x("about"),path:"/about",icon:y1},{name:x("contact"),path:"/contact",icon:O1}],k=[{name:x("readingCart"),path:"/reading-cart",icon:og},{name:x("vocabulary"),path:"/vocabulary",icon:L1},{name:x("progress"),path:"/progress",icon:U1}],S={name:x("premium"),path:"/subscription",icon:Tr},O=P.some(T),D=k.some(T),M=()=>e(!1),L=async()=>{if(!n){s(!0);try{await l(),i(b("/"))}finally{s(!1)}}},X=(V,N)=>V?V.charAt(0).toUpperCase():N?N.charAt(0).toUpperCase():"U",I=c==="paid"||c==="admin"||u?.status==="active"&&!u?.isExpired,Y=V=>`flex items-center gap-1.5 rounded-md px-2 py-1.5 text-sm font-medium transition-colors hover:text-foreground/80 ${V?"text-nature-coral":"text-foreground/60"}`,$=({link:V})=>{const N=T(V);return o.jsx($e,{bob:N,children:o.jsxs(pe,{to:b(V.path),className:Y(N),"aria-current":N?"page":void 0,children:[o.jsx(V.icon,{size:18}),o.jsx("span",{className:"whitespace-nowrap",children:V.name})]})})},H=({links:V})=>o.jsx(o.Fragment,{children:V.map(N=>o.jsx(qn,{asChild:!0,children:o.jsx(pe,{to:b(N.path),className:T(N)?"text-nature-coral":"",children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(N.icon,{className:"h-4 w-4"}),N.name]})})},N.path))}),A=({link:V})=>{const N=T(V);return o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b(V.path),onClick:M,"aria-current":N?"page":void 0,className:`flex w-full items-center gap-2 touch-manipulation hover:text-foreground ${N?"text-nature-coral font-medium":"text-foreground/60"}`,children:[o.jsx(V.icon,{size:16}),V.name,N&&o.jsx(Fe.div,{className:"ml-auto w-2 h-2 bg-nature-coral rounded-full",animate:{scale:[1,1.2,1]},transition:{duration:1,repeat:1/0}})]})})},C=({title:V})=>o.jsx("p",{className:"mt-4 mb-1 text-xs font-semibold uppercase tracking-wide text-foreground/40",children:V});return o.jsxs("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[o.jsxs("div",{className:"container flex h-14 items-center",children:[o.jsx($e,{className:"mr-4",children:o.jsxs(pe,{to:b("/"),className:"flex items-center gap-2 rounded-md ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[o.jsx("img",{src:ym,alt:"StorySparkle Logo",width:24,height:24,fetchPriority:"high",decoding:"async",className:"h-6 w-6"}),o.jsx(ca,{variant:"navbar",className:"hidden sm:inline-block"})]})}),o.jsxs("nav",{className:"hidden xl:flex items-center gap-1",children:[j.map(V=>o.jsx($,{link:V},V.path)),o.jsxs(Ri,{children:[o.jsx(Ai,{className:`${Y(O)} outline-none`,children:o.jsxs($e,{bob:O,className:"items-center gap-1.5",children:[o.jsx(g1,{size:18}),o.jsx("span",{className:"whitespace-nowrap",children:x("learn")}),o.jsx(Ii,{className:"h-3.5 w-3.5 opacity-60"})]})}),o.jsx(co,{align:"start",children:o.jsx(H,{links:P})})]}),a?o.jsxs(Ri,{children:[o.jsx(Ai,{className:`${Y(D)} outline-none`,children:o.jsxs($e,{bob:D,className:"items-center gap-1.5",children:[o.jsx(Gw,{size:18}),o.jsx("span",{className:"whitespace-nowrap",children:x("myLearning")}),o.jsx(Ii,{className:"h-3.5 w-3.5 opacity-60"})]})}),o.jsx(co,{align:"start",children:o.jsx(H,{links:k})})]}):o.jsx($,{link:S})]}),o.jsxs("div",{className:"flex items-center ml-auto gap-2",children:[o.jsx(RL,{}),a?o.jsxs(Ri,{children:[o.jsx(Ai,{asChild:!0,children:o.jsxs(bn,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:[o.jsxs(Jc,{className:"h-8 w-8",children:[o.jsx(Qc,{src:d||"",alt:a.email||"User"}),o.jsx(eu,{children:X(p,a.email)})]}),I&&o.jsx("span",{className:"absolute -top-1 -right-1",children:o.jsx(PL,{variant:"outline",className:"h-4 w-4 p-0 flex items-center justify-center bg-nature-honey rounded-full",children:o.jsx(Tr,{className:"h-3 w-3 text-nature-honey-ink"})})})]})}),o.jsxs(co,{align:"end",children:[o.jsx("div",{className:"flex items-center justify-start gap-2 p-2",children:o.jsxs("div",{className:"flex flex-col space-y-1 leading-none",children:[p&&o.jsx("p",{className:"text-sm font-medium leading-none",children:p}),I&&o.jsxs("p",{className:"font-medium text-sm flex items-center gap-1",children:[o.jsx(Tr,{className:"h-3 w-3 text-nature-honey-ink"}),"Premium"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:a.email})]})}),o.jsx(Ci,{}),c==="admin"&&o.jsxs(o.Fragment,{children:[o.jsx(qn,{asChild:!0,children:o.jsx(pe,{to:b("/admin"),children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(ih,{className:"h-4 w-4"}),x("adminDashboard")]})})}),o.jsx(Ci,{})]}),o.jsx(qn,{asChild:!0,children:o.jsx(pe,{to:b("/subscription"),children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(Tr,{className:"h-4 w-4"}),x(I?"manageSubscription":"upgradeToPremium")]})})}),o.jsx(qn,{onSelect:()=>g.current?.click(),disabled:y,className:"cursor-pointer",children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(ah,{className:"h-4 w-4"}),x(y?"uploading":"updatePhoto")]})}),o.jsx(qn,{asChild:!0,children:o.jsx(pe,{to:b("/reset-password"),children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(lh,{className:"h-4 w-4"}),x("resetPassword","Reset Password")]})})}),o.jsx(Ci,{}),o.jsx(qn,{className:"cursor-pointer",disabled:n,onSelect:V=>{V.preventDefault(),L()},children:o.jsxs($e,{className:"w-full items-center gap-2",children:[o.jsx(uh,{className:"h-4 w-4"}),o.jsx("span",{children:n?"Signing out...":x("logOut")})]})})]})]}):o.jsx(AL,{}),o.jsxs(vL,{open:t,onOpenChange:e,children:[o.jsx(_L,{asChild:!0,children:o.jsxs(bn,{variant:"outline",size:"icon",className:"xl:hidden",children:[o.jsx(kL,{Icon:C1,size:20,hoverEffect:"wiggle",className:"cursor-pointer"}),o.jsx("span",{className:"sr-only",children:"Toggle menu"})]})}),o.jsxs(yx,{side:"right",className:"bg-white overflow-y-auto",children:[o.jsx($e,{className:"mb-6",children:o.jsxs(pe,{to:b("/"),onClick:M,className:"flex items-center gap-2 rounded-md ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[o.jsx("img",{src:ym,alt:"StorySparkle Logo",width:24,height:24,decoding:"async",className:"h-6 w-6"}),o.jsx(ca,{variant:"navbar"})]})}),o.jsxs("nav",{className:"flex flex-col gap-3 pb-8",children:[j.map(V=>o.jsx(A,{link:V},V.path)),a&&o.jsxs(o.Fragment,{children:[o.jsx(C,{title:x("myLearning")}),k.map(V=>o.jsx(A,{link:V},V.path))]}),o.jsx(C,{title:x("learn")}),P.map(V=>o.jsx(A,{link:V},V.path)),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t my-2 pt-2"}),o.jsx(A,{link:S})]}),o.jsx("div",{className:"border-t my-3"}),a?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Jc,{className:"h-8 w-8",children:[o.jsx(Qc,{src:d||"",alt:a.email||"User"}),o.jsx(eu,{children:X(p,a.email)})]}),o.jsxs("div",{className:"flex flex-col",children:[p&&o.jsx("span",{className:"text-sm font-medium",children:p}),o.jsx("span",{className:"text-xs text-muted-foreground",children:a.email})]})]}),c==="admin"&&o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b("/admin"),className:"hover:text-foreground flex w-full items-center gap-2 text-foreground/60 touch-manipulation",onClick:M,children:[o.jsx(ih,{size:16}),x("adminDashboard")]})}),o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b("/subscription"),className:"hover:text-foreground flex w-full items-center gap-2 text-foreground/60 touch-manipulation",onClick:M,children:[o.jsx(Tr,{size:16}),x(I?"manageSubscription":"upgradeToPremium")]})}),o.jsx($e,{className:"w-full",children:o.jsxs("button",{onClick:()=>g.current?.click(),disabled:y,className:"hover:text-foreground flex w-full items-center gap-2 text-foreground/60 text-left touch-manipulation",children:[o.jsx(ah,{size:16}),x(y?"uploading":"updatePhoto")]})}),o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b("/reset-password"),className:"hover:text-foreground flex w-full items-center gap-2 text-foreground/60 touch-manipulation",onClick:M,children:[o.jsx(lh,{size:16}),x("resetPassword","Reset Password")]})}),o.jsxs(bn,{variant:"outline",className:"mt-2",disabled:n,onClick:async()=>{await L(),M()},children:[o.jsx(uh,{size:16,className:"mr-2"}),n?"Signing out...":x("logOut")]})]}):o.jsxs(o.Fragment,{children:[o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b("/login"),className:"flex w-full items-center gap-2 touch-manipulation",onClick:M,children:[o.jsx(ig,{size:16}),x("signIn")]})}),o.jsx($e,{className:"w-full",children:o.jsxs(pe,{to:b("/signup"),className:"flex w-full items-center gap-2 touch-manipulation",onClick:M,children:[o.jsx(G1,{size:16}),x("createAccount")]})})]})]})]})]})]})]}),a&&o.jsx("input",{type:"file",ref:g,className:"hidden",accept:"image/*",onChange:w})]})},IL="https://cdn.storysparkle.org/logo_assets/favicon.webp",OL=()=>{const{t,i18n:e}=Se("footer"),{getLocalizedPath:n}=Dt(),s=new Date().getFullYear(),{pathname:r}=os(),i=l=>{const c=n(l);return l==="/"?r===c:r===c||r.startsWith(c+"/")||r.startsWith(c+"#")},a=l=>`text-sm transition-colors ${i(l)?"text-nature-coral font-medium":"text-foreground/60 hover:text-nature-coral"}`;return o.jsxs("footer",{className:"text-ink py-12 px-4 md:px-8 bg-page-surface",children:[o.jsxs("div",{className:"max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-4 gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs(pe,{to:n("/"),className:"flex items-center gap-2",children:[o.jsx("img",{src:IL,alt:"StorySparkle Logo",width:32,height:32,loading:"lazy",decoding:"async",className:"h-8 w-8"}),o.jsx(ca,{variant:"footer"})]}),o.jsx("p",{className:"text-foreground/70 text-sm max-w-xs text-left",children:t("companyDescription")})]}),o.jsxs("div",{className:"text-left ",children:[o.jsx("h3",{className:"font-medium text-lg mb-4 text-foreground",children:t("quickLinks")}),o.jsxs("ul",{className:"space-y-2",children:[o.jsx("li",{children:o.jsx(pe,{to:n("/"),className:a("/"),children:t("home")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/stories"),className:a("/stories"),children:t("stories")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/story-maker"),className:a("/story-maker"),children:t("storyMaker")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/about"),className:a("/about"),children:t("about")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/subscription"),className:a("/subscription"),children:t("subscription")})})]})]}),o.jsx("div",{children:o.jsxs("div",{className:"text-left ",children:[o.jsx("h3",{className:"font-medium text-lg mb-4 text-foreground",children:t("resources")}),o.jsxs("ul",{className:"space-y-2",children:[o.jsx("li",{children:o.jsx(pe,{to:n("/text-checker"),className:a("/text-checker"),children:t("textChecker")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/improve-reading"),className:a("/improve-reading"),children:t("improveReading")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/themes"),className:a("/themes"),children:t("themes")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/watch"),className:a("/watch"),children:t("watch")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/research"),className:a("/research"),children:t("seslAlgorithm")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/blog"),className:a("/blog"),children:t("blog")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/blog/newsletter"),className:a("/blog/newsletter"),children:t("newsletter")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/contact#faq-section"),className:a("/contact"),children:t("faq")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/contact"),className:a("/contact"),children:t("contact")})})]})]})}),o.jsxs("div",{className:"text-left ",children:[o.jsx("h3",{className:"font-medium text-lg mb-4 text-foreground",children:t("legal")}),o.jsxs("ul",{className:"space-y-2",children:[o.jsx("li",{children:o.jsx(pe,{to:n("/terms"),className:a("/terms"),children:t("terms")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/refund"),className:a("/refund"),children:t("refund")})}),o.jsx("li",{children:o.jsx(pe,{to:n("/privacy"),className:a("/privacy"),children:t("privacy")})})]})]})]}),o.jsxs("div",{className:"max-w-7xl mx-auto mt-12 pt-6 border-t border-border flex flex-col lg:flex-row justify-between items-center gap-4",children:[o.jsx("p",{className:"text-sm text-foreground/60",children:t("copyright",{year:s})}),o.jsxs("p",{className:"text-sm flex items-center gap-1 text-foreground/60",children:[t("madeWith")," ",o.jsx(og,{className:"h-3 w-3 text-nature-red"})," ",t("forYoungReaders")]})]})]})},DL=()=>{const[t,e]=h.useState({}),[n,s]=h.useState(!0);h.useEffect(()=>{(async()=>{try{const{data:l,error:c}=await q.from("landing_assets").select("*");if(c)throw c;const u={};l?.forEach(d=>{u[d.section_id]||(u[d.section_id]={}),u[d.section_id][d.asset_key]=d.asset_url}),e(u)}catch(l){console.error("Failed to fetch landing assets:",l)}finally{s(!1)}})()},[]);const r=h.useCallback(async(a,l,c,u="image")=>{try{const{error:d}=await q.from("landing_assets").upsert({section_id:a,asset_key:l,asset_url:c,asset_type:u},{onConflict:"section_id,asset_key"});if(d)throw d;return e(p=>({...p,[a]:{...p[a],[l]:c}})),!0}catch(d){return console.error("Failed to save landing asset:",d),!1}},[]),i=h.useCallback((a,l)=>t[a]?.[l],[t]);return{assets:t,isLoading:n,saveAsset:r,getAsset:i}},LL={en:"en_US",bn:"bn_BD",es:"es_ES",zh:"zh_CN",ja:"ja_JP",ko:"ko_KR",th:"th_TH",vi:"vi_VN",hi:"hi_IN",pt:"pt_PT",fil:"fil_PH",ms:"ms_MY",id:"id_ID",my:"my_MM",km:"km_KH",lo:"lo_LA"},Rs=({title:t="StorySparkle - Interactive Reading Experiences for Children",description:e="StorySparkle—reading practice app for kids with interactive leveled stories, adjustable-speed video narration, vocabulary builder, and custom AI story maker.",canonical:n,ogImage:s="https://cdn.storysparkle.org/logo_assets/favicon_512x512.png",ogType:r="website",structuredData:i,noIndex:a=!1,keywords:l})=>{const{currentLanguage:c}=Dt(),u=t.includes("StorySparkle")?t:`${t} | StorySparkle`,p=(n||window.location.pathname).replace(/^https?:\/\/[^/]+/i,"")||"/",f="https://storysparkle.org",g=en.filter(w=>w!=="en"),y=new RegExp(`^/(${g.join("|")})(?=/|$)`);let m=p.replace(y,"");m===""&&(m="/");const x=w=>w==="en"?f+(m==="/"?"/":m):f+"/"+w+(m==="/"?"":m),b=x(c);return o.jsxs(Bb,{defer:!1,children:[o.jsx("title",{children:u}),o.jsx("meta",{name:"description",content:e}),o.jsx("meta",{name:"author",content:"StorySparkle"}),l&&o.jsx("meta",{name:"keywords",content:l}),o.jsx("link",{rel:"icon",href:"/favicon.webp",type:"image/webp"}),o.jsx("link",{rel:"apple-touch-icon",href:"/favicon.webp"}),o.jsx("html",{lang:c}),o.jsx("link",{rel:"canonical",href:b}),en.map(w=>o.jsx("link",{rel:"alternate",href:x(w),hrefLang:w},w)),o.jsx("link",{rel:"alternate",href:x("en"),hrefLang:"x-default"}),o.jsx("meta",{property:"og:title",content:u}),o.jsx("meta",{property:"og:description",content:e}),o.jsx("meta",{property:"og:type",content:r}),o.jsx("meta",{property:"og:url",content:b}),o.jsx("meta",{property:"og:image",content:s}),o.jsx("meta",{property:"og:site_name",content:"StorySparkle"}),o.jsx("meta",{property:"og:locale",content:LL[c]||"en_US"}),o.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),o.jsx("meta",{name:"twitter:title",content:u}),o.jsx("meta",{name:"twitter:description",content:e}),o.jsx("meta",{name:"twitter:image",content:s}),o.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),o.jsx("meta",{name:"robots",content:a?"noindex,nofollow":"index,follow"}),o.jsx("meta",{name:"googlebot",content:a?"noindex,nofollow":"index,follow"}),o.jsx("meta",{name:"language",content:c}),i&&o.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})]})},Co={A1:{label:"A1 (Beginner)",shortLabel:"A1",ageBand:"5-7",classes:"bg-nature-forest/15 text-nature-forest border border-nature-forest/30"},A2:{label:"A2 (Elementary)",shortLabel:"A2",ageBand:"7-9",classes:"bg-nature-forest text-white"},B1:{label:"B1 (Intermediate)",shortLabel:"B1",ageBand:"9-12",classes:"bg-nature-honey/50 text-nature-honey-ink border border-nature-honey-ink/20"},B2:{label:"B2 (Upper-Intermediate)",shortLabel:"B2",ageBand:"12-15",classes:"bg-nature-honey text-nature-honey-ink"},C1:{label:"C1 (Advanced)",shortLabel:"C1",ageBand:"15-18",classes:"bg-nature-coral/20 text-nature-coral border border-nature-coral/40"},C2:{label:"C2 (Proficient)",shortLabel:"C2",ageBand:"18+",classes:"bg-nature-coral text-white"}},gV=["A1","A2","B1","B2","C1","C2"],vV=t=>!t||!(t in Co)?{label:"Unknown",shortLabel:"?",ageBand:"Unknown",classes:"bg-gray-100 text-gray-800"}:Co[t],xm=t=>!t||!(t in Co)?"Unknown":Co[t].ageBand,_V=t=>{if(!t)return null;const e=Object.entries(Co).find(([n,s])=>s.ageBand===t);return e?e[0]:null},yV=t=>t==null?"bg-gray-100 text-gray-800":t<=250?"bg-green-200 text-green-900":t<=400?"bg-green-500 text-green-50":t<=550?"bg-yellow-200 text-yellow-900":t<=700?"bg-yellow-500 text-yellow-50":t<=850?"bg-red-200 text-red-900":"bg-red-600 text-red-50",NL={"@context":"https://schema.org","@type":"Organization","@id":"https://storysparkle.org/#organization",name:"StorySparkle",description:"Interactive reading platform for children aged 5–15 learning English as a second language, with synchronised RP UK narration, CEFR-levelled stories, vocabulary building, and dyslexia-friendly design.",url:"https://storysparkle.org",logo:"https://storysparkle.org/favicon.webp",foundingDate:"2024",slogan:"The Reading App for Kids Learning English",contactPoint:{"@type":"ContactPoint",contactType:"customer service",email:"support@storysparkle.org",availableLanguage:["English","Bengali","Spanish","Chinese","Japanese","Korean","Thai","Vietnamese","Hindi","Portuguese","Filipino","Malay","Indonesian","Burmese","Khmer","Lao"]}},ML={"@context":"https://schema.org","@type":"WebSite","@id":"https://storysparkle.org/#website",name:"StorySparkle",description:"Interactive reading platform for children learning English",url:"https://storysparkle.org",publisher:{"@id":"https://storysparkle.org/#organization"},inLanguage:["en","bn","es","zh","ja","ko","th","vi","hi","pt","fil","ms","id","my","km","lo"],potentialAction:{"@type":"SearchAction",target:"https://storysparkle.org/stories?search={search_term_string}","query-input":"required name=search_term_string"}},VL={"@context":"https://schema.org","@type":"SoftwareApplication","@id":"https://storysparkle.org/#software",name:"StorySparkle",description:"Interactive reading app for children aged 5–15 learning English. Levelled stories, RP UK narration, vocabulary notebook, dyslexia-friendly design and AI Story Maker.",url:"https://storysparkle.org",applicationCategory:"EducationalApplication",applicationSubCategory:"Reading",operatingSystem:"Web, iOS, Android",inLanguage:["en","bn","es","zh","ja","ko","th","vi","hi","pt","fil","ms","id","my","km","lo"],publisher:{"@id":"https://storysparkle.org/#organization"},audience:{"@type":"PeopleAudience",suggestedMinAge:5,suggestedMaxAge:15},featureList:["Professional Received Pronunciation UK English narration","Word-by-word synchronised highlighting","SESL© 100+-parameter difficulty algorithm","CEFR-levelled stories (Pre-A1 to B2)","Tap-to-translate vocabulary in 15 languages","Smart Vocabulary Notebook","Adjustable reading pace","Dyslexia-friendly OpenDyslexic mode","AI Story Maker with printable storybook","Text Suitability Checker","4-dimension reading progress tracking","Talking-head animated narrator videos"],offers:[{"@type":"Offer",name:"Monthly subscription",price:"3.99",priceCurrency:"GBP",category:"subscription",url:"https://storysparkle.org/subscription",availability:"https://schema.org/InStock"},{"@type":"Offer",name:"Annual subscription",price:"29.99",priceCurrency:"GBP",category:"subscription",url:"https://storysparkle.org/subscription",availability:"https://schema.org/InStock"}]},FL={"@context":"https://schema.org","@type":"Course","@id":"https://storysparkle.org/#course",name:"English Reading for Kids — CEFR Pre-A1 to B2",description:"A CEFR-aligned reading pathway for children learning English as a second language. Every story is graded by the SESL© 100+-parameter algorithm and mapped to a CEFR band from Pre-A1 through B2.",provider:{"@id":"https://storysparkle.org/#organization"},educationalLevel:["CEFR Pre-A1","CEFR A1","CEFR A2","CEFR B1","CEFR B2"],educationalCredentialAwarded:"Reading fluency progression across four skill dimensions",inLanguage:"en",audience:{"@type":"EducationalAudience",educationalRole:"student"},hasCourseInstance:[{"@type":"CourseInstance",courseMode:"online",courseWorkload:"PT15M",inLanguage:"en"}],offers:{"@type":"Offer",category:"Free",price:"0",priceCurrency:"GBP",url:"https://storysparkle.org/stories"}},$L={"@context":"https://schema.org","@type":"ItemList","@id":"https://storysparkle.org/#features",name:"StorySparkle landing page features",itemListOrder:"https://schema.org/ItemListOrderAscending",numberOfItems:12,itemListElement:[{"@type":"ListItem",position:1,name:"Interactive stories that help children read fluently and expressively"},{"@type":"ListItem",position:2,name:"Professional Visual Narration"},{"@type":"ListItem",position:3,name:"Synced Word Highlights"},{"@type":"ListItem",position:4,name:"Interactive Words"},{"@type":"ListItem",position:5,name:"Smart Vocabulary Notebook"},{"@type":"ListItem",position:6,name:"Choose your Pace"},{"@type":"ListItem",position:7,name:"Dyslexia Friendly"},{"@type":"ListItem",position:8,name:"Read at the Right Level"},{"@type":"ListItem",position:9,name:"Curated Story Themes"},{"@type":"ListItem",position:10,name:"Intelligent Story Maker"},{"@type":"ListItem",position:11,name:"Smarter Reading Practice. Visible Progress."},{"@type":"ListItem",position:12,name:"Give the Gift of Fluency"}]},xV=t=>({"@context":"https://schema.org","@type":"CreativeWork",name:t.title,description:t.description,author:{"@type":"Organization",name:"StorySparkle"},publisher:{"@type":"Organization",name:"StorySparkle",logo:"https://storysparkle.org/favicon.webp"},audience:(()=>{const e=xm(t.cefrLevel),n=e.includes("+")?parseInt(e):parseInt(e.split("-")[0])||3,s=e.includes("+")?99:parseInt(e.split("-")[1])||12;return{"@type":"Audience",audienceType:"Children",suggestedMinAge:n,suggestedMaxAge:s}})(),educationalAlignment:{"@type":"AlignmentObject",educationalFramework:"CEFR Language Levels",targetDescription:`CEFR ${t.cefrLevel||"Unknown"} reading level`},learningResourceType:"Interactive Story",interactivityType:"active",typicalAgeRange:`${xm(t.cefrLevel)} years`,timeRequired:`PT${Math.floor(t.duration/60)}M${t.duration%60}S`,wordCount:t.wordCount,genre:t.theme,accessibilityFeature:["audioDescription","synchronizedAudioText","dyslexiaSupport"],isAccessibleForFree:!1,hasPart:{"@type":"WebPageElement",isAccessibleForFree:!1,cssSelector:".story-body-gated"}}),bV=t=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:t.map((e,n)=>({"@type":"ListItem",position:n+1,name:e.name,item:`https://storysparkle.org${e.url}`}))}),BL={1:"M0,64 C120,20 240,100 480,64 C720,28 960,96 1200,64 C1320,48 1380,80 1440,64 L1440,120 L0,120 Z",2:"M0,40 C180,100 360,20 540,60 C720,100 900,30 1080,70 C1200,90 1340,40 1440,50 L1440,120 L0,120 Z",3:"M0,80 C160,30 320,90 480,50 C640,10 800,80 960,40 C1120,0 1280,70 1440,30 L1440,120 L0,120 Z",4:"M0,60 C240,110 480,10 720,70 C960,130 1200,20 1440,60 L1440,120 L0,120 Z",5:"M0,50 C100,20 200,80 360,40 C520,0 640,90 800,50 C960,10 1100,85 1260,45 C1360,25 1400,60 1440,55 L1440,120 L0,120 Z",6:"M0,45 C180,36 360,58 540,45 S900,32 1080,45 S1260,54 1440,45 L1440,120 L0,120 Z",7:"M0,30 C180,90 360,10 600,70 C840,130 1020,20 1200,60 C1320,80 1400,40 1440,50 L1440,120 L0,120 Z",8:"M0,70 C80,20 160,100 300,50 C440,0 520,80 660,60 C800,40 880,100 1020,30 C1160,-10 1300,80 1440,55 L1440,120 L0,120 Z",9:"M0,55 C60,90 140,15 260,65 C380,115 440,20 580,55 C720,90 800,10 940,50 C1080,90 1180,25 1300,60 C1380,80 1420,50 1440,60 L1440,120 L0,120 Z",10:"M0,80 C240,20 480,100 720,40 C960,-10 1200,90 1440,35 L1440,120 L0,120 Z",11:"M0,25 C100,70 220,10 380,55 C540,100 660,15 820,65 C980,110 1120,30 1280,70 C1360,90 1420,45 1440,55 L1440,120 L0,120 Z",12:"M0,40 C180,90 360,100 540,30 C720,-20 900,-10 1080,50 C1200,90 1340,80 1440,45 L1440,120 L0,120 Z"},Yt=({topColor:t,bottomColor:e,variant:n=1,flip:s=!1,className:r=""})=>o.jsx("div",{className:`relative w-full overflow-hidden leading-[0] ${r}`,style:{backgroundColor:t},"aria-hidden":"true",children:o.jsx("svg",{viewBox:"0 0 1440 120",preserveAspectRatio:"none",className:"block w-full h-[60px] md:h-[80px] lg:h-[120px]",style:{transform:s?"scaleX(-1)":void 0},children:o.jsx("path",{d:BL[n],fill:e})})});function zL(t,e,n){const s=t(e,{returnObjects:!0});return Array.isArray(s)?s:[]}const UL=({words:t,className:e="",typingSpeed:n=100,deletingSpeed:s=60,pauseAfterWord:r=1500,finalWordMultiplier:i=5})=>{const[a,l]=h.useState(0),[c,u]=h.useState(""),[d,p]=h.useState(!1),[f,g]=h.useState(!1),y=Array.isArray(t)&&t.length>0?t:[];h.useEffect(()=>{l(0),u(""),p(!1),g(!1)},[y.join("|")]);const m=y[a]??"",x=a===y.length-1,b=h.useCallback(()=>{if(!(f||!m))if(d)c.length>0?u(c.slice(0,-1)):(p(!1),l(w=>y.length?(w+1)%y.length:0));else if(c.length<m.length)u(m.slice(0,c.length+1));else{g(!0);const w=x?r*i:r;setTimeout(()=>{g(!1),p(!0)},w)}},[c,d,f,m,x,r,i,y.length]);return h.useEffect(()=>{if(f||!m)return;const E=setTimeout(b,d?s:n);return()=>clearTimeout(E)},[b,d,f,n,s,m]),m?o.jsxs("span",{className:e,children:[c,o.jsx("span",{className:"animate-blink",children:"|"})]}):null};function Bd(t){const e=h.useCallback(()=>{try{t().catch(()=>{})}catch{}},[t]);return{onMouseEnter:e,onFocus:e,onTouchStart:e}}const zd=({className:t="",labelOverride:e})=>{const{getLocalizedPath:n}=Dt(),{t:s}=Se("landing"),r=Bd(()=>_(()=>import("./StoriesPage-D2A96ReY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])));return o.jsx(Ss,{variant:"primary",to:n("/stories"),leftIcon:o.jsx(Yw,{}),className:t,linkProps:r,children:e||s("buttons.readStories")})},HL=({className:t=""})=>{const{t:e}=Se("landing"),{getLocalizedPath:n}=Dt();return o.jsx(Ss,{variant:"create",to:n("/story-maker"),onClick:()=>window.scrollTo({top:0,behavior:"instant"}),leftIcon:o.jsx(ag,{}),className:t,children:e("buttons.startCreating")})},WL=({className:t=""})=>{const{t:e}=Se("landing"),{getLocalizedPath:n}=Dt(),s=Bd(()=>_(()=>import("./TextCheckerPage-BVrUNDeh.js"),__vite__mapDeps([24,1,2,25,26,4,7,27,20,28,29,30,6,19,31,32,18,33,23,34,22])));return o.jsx(Ss,{variant:"learn",to:n("/text-checker"),leftIcon:o.jsx(B1,{}),className:t,linkProps:s,children:e("checkText.buttonText")})},Ud=({slug:t,tone:e="forest",className:n})=>{const{t:s}=Se("navbar"),{getLocalizedPath:r}=Dt();return o.jsxs(pe,{to:r(`/watch/${t}`),className:ie("inline-flex items-center gap-1.5 text-sm font-medium hover:underline",e==="onDark"?"text-white drop-shadow-md":"text-nature-forest hover:text-nature-forest/80",n),children:[o.jsx(rg,{className:"h-4 w-4","aria-hidden":"true"}),s("watchWalkthrough")]})},GL="https://cdn.storysparkle.org/logo_assets/Logo%20Claymation%20Transparent%20Square%20WEBP.webp",KL="https://cdn.storysparkle.org/landing_assets/Claymation%20Wordmark%20Transparent%20WEBP.webp",qL="https://cdn.storysparkle.org/landing_assets/Ethnic%20Circle%20Transparent%20WEBP.webp",YL=()=>{const{t}=Se("landing"),e=zL(t,"hero.typewriterWords");return o.jsx("section",{className:"relative bg-white min-h-[calc(100vh-3.5rem)] flex items-center",children:o.jsx("div",{className:"container mx-auto px-8 py-10 md:py-16",children:o.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-10 md:gap-10",children:[o.jsxs("div",{className:"w-full md:w-[55%] flex flex-col items-center md:items-start text-center md:text-left",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6 md:mb-8",children:[o.jsx("img",{src:GL,alt:t("hero.alt.logo"),className:"h-14 md:h-16 w-auto",width:128,height:128,fetchPriority:"high",decoding:"async"}),o.jsx("img",{src:KL,alt:t("hero.alt.wordmark"),className:"h-8 md:h-10 w-auto",fetchPriority:"high",decoding:"async"})]}),o.jsx("h1",{className:"sr-only",children:t("hero.h1")}),o.jsx("div",{"aria-hidden":"true",className:"font-bold text-muted-foreground text-3xl md:text-4xl lg:text-5xl leading-tight tracking-tight",children:t("hero.headlineTemplate").split(`
`).map((n,s)=>{const r=n.split("{{word}}");return o.jsx("div",{className:"whitespace-nowrap",children:r.map((i,a)=>o.jsxs(F.Fragment,{children:[o.jsx("span",{children:i}),a<r.length-1&&o.jsx(UL,{words:e.length?e:["magical"],typingSpeed:90,deletingSpeed:60,pauseAfterWord:1400,finalWordMultiplier:1,className:"text-nature-coral"})]},a))},s)})}),o.jsx("p",{className:"mt-5 md:mt-6 max-w-xl md:max-w-[34rem] text-base md:text-lg text-muted-foreground font-noto [text-wrap:pretty]",children:t("hero.subtext")}),o.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center md:justify-start gap-4",children:[o.jsx(zd,{}),o.jsx(HL,{}),o.jsx(WL,{})]}),o.jsx("div",{className:"mt-4 flex justify-center md:justify-start",children:o.jsx(Ud,{slug:"what-is-storysparkle"})}),o.jsx("p",{className:"mt-6 text-sm italic text-muted-foreground",children:t("hero.footnote")})]}),o.jsx("div",{className:"w-full md:w-[45%] flex items-center justify-center",children:o.jsx(Fe.img,{src:qL,alt:t("hero.alt.circle"),className:"w-[70vw] md:w-[42vw] max-w-xl h-auto max-h-[45vh] md:max-h-none object-contain",animate:{rotate:360},transition:{repeat:1/0,ease:"linear",duration:10},fetchPriority:"high",decoding:"async"})})]})})})},XL="https://cdn.storysparkle.org/landing_assets/flicker-reading-reduced-size.mp4",ZL=()=>{const t=h.useRef(null),e=A2(t,{amount:.3}),{t:n}=Se("landing");return o.jsx("section",{ref:t,className:"relative min-h-0 py-8 lg:py-0 lg:min-h-screen flex items-center overflow-hidden",style:{background:"#FFF8E7"},children:o.jsx("div",{className:"container mx-auto max-w-6xl px-6",children:o.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-4 lg:gap-12",children:[o.jsxs("div",{className:"max-w-lg text-center lg:text-left flex flex-col",children:[o.jsxs("div",{className:"space-y-2 lg:space-y-4",children:[o.jsx("h2",{className:"section-header text-[22px] lg:text-[32px]",children:n("description.heading")}),o.jsx("h3",{className:"section-subtext text-sm lg:text-xl",children:n("description.subtext")})]}),o.jsx("div",{className:"mt-4 lg:mt-8",children:o.jsx(zd,{})})]}),o.jsx("div",{className:"flex-1 flex justify-center items-center",children:o.jsx(Fe.div,{className:"w-40 md:w-80 lg:w-96",initial:{x:200,opacity:0},animate:{x:e?0:200,opacity:e?1:0},transition:{duration:1.2,ease:[.25,.1,.25,1]},children:o.jsx("video",{src:XL,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"w-full object-contain"})})})]})})})},JL=({className:t=""})=>{const{getLocalizedPath:e}=Dt(),{t:n}=Se("landing"),s=Bd(()=>_(()=>import("./ResearchPage-CPtGXeZv.js"),__vite__mapDeps([35,1,2,18,7,4,36,33,37,32,11,38,39,28,40,22,23])));return o.jsx(Ss,{variant:"learn",to:e("/research"),leftIcon:o.jsx(f1,{}),className:t,linkProps:s,children:n("buttons.seslAlgorithm")})},QL="https://cdn.storysparkle.org/landing_assets/Reading%20Journey_WEBP.webp",eN=({sectionRef:t})=>{const e=h.useRef(null),n=t??e,{t:s}=Se("landing"),[r,i]=h.useState(!1);return h.useEffect(()=>{const a=n.current;if(!a)return;const l=new IntersectionObserver(c=>{c.forEach(u=>i(u.isIntersecting))},{rootMargin:"-50% 0px -50% 0px",threshold:0});return l.observe(a),()=>l.disconnect()},[n]),o.jsx("section",{ref:n,className:"relative h-[150vh]",style:{background:"#ECF4E8"},children:o.jsxs("div",{className:"sticky top-14 h-[calc(100vh-3.5rem)] overflow-hidden flex flex-col justify-start pt-16 md:pt-0 md:justify-center",children:[o.jsxs("div",{className:"relative z-10 px-6 md:absolute md:top-16 md:left-0 md:right-0 md:px-12 lg:px-20",children:[o.jsx("h2",{className:"section-header text-[22px] lg:text-[32px] mb-4",children:s("seslProgress.heading")}),o.jsx("h3",{className:"section-subtext text-sm lg:text-xl max-w-6xl",children:s("seslProgress.subtext")})]}),o.jsxs("div",{className:"relative z-10 mt-6 px-6 flex flex-col items-center gap-3 md:absolute md:top-[30%] md:left-0 md:mt-0 md:items-start md:px-12 lg:px-20",children:[o.jsx(JL,{}),o.jsx(Ud,{slug:"track-reading-progress"})]}),o.jsx(Fe.div,{className:"relative mt-8 w-full px-6 md:absolute md:left-0 md:top-[45%] md:-translate-y-1/2 md:w-[75vw] md:max-w-6xl md:mt-0 md:px-0 md:pl-12 lg:pl-20",initial:{x:"30%",opacity:0},animate:r?{x:"0%",opacity:1}:{x:"30%",opacity:0},transition:{duration:.8,ease:[.22,1,.36,1]},children:o.jsx("img",{src:QL,alt:"Reading Journey progress chart",className:"w-full h-auto rounded-2xl shadow-2xl",width:1666,height:644,loading:"lazy",decoding:"async"})})]})})},tN="https://cdn.storysparkle.org/landing_assets/castle-on-cloud.webp",nN=()=>{const{t}=Se("landing");return o.jsx("section",{className:"relative h-[200vh]",children:o.jsxs("div",{className:"sticky top-14 h-[calc(100vh-3.5rem)] flex flex-col overflow-hidden",style:{background:"#FFF7ED"},children:[o.jsx(Fe.img,{src:tN,alt:"Castle on Cloud",className:"absolute bottom-0 left-0 h-[35vh] md:h-[75vh] max-[1366px]:lg:h-[55vh] ipad-portrait:!h-[42vh] w-auto object-contain animate-bob pl-4 md:pl-8",initial:{opacity:0},whileInView:{opacity:1},viewport:{once:!0},transition:{duration:1.5,ease:"easeOut"}}),o.jsxs("div",{className:"relative flex flex-col items-center justify-start md:justify-center ipad-portrait:!justify-start text-center z-10 px-4 md:px-8 flex-1",children:[o.jsxs("div",{className:"absolute top-[12%] left-0 right-0 px-4 md:relative md:top-auto md:px-0 md:pt-0 ipad-portrait:!absolute ipad-portrait:!top-[12%] ipad-portrait:!px-4",children:[o.jsx(Fe.h2,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"section-header text-[22px] lg:text-[32px] text-center mb-3",children:t("cta.heading")}),o.jsxs(Fe.h3,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6,delay:.2},className:"section-subtext text-sm lg:text-xl text-center max-w-lg ipad-portrait:!max-w-md mx-auto mb-8",children:[t("cta.subtextPart1")," ",o.jsx(ca,{})," ",t("cta.subtextPart2")]})]}),o.jsxs("div",{className:"absolute top-[45%] left-0 right-0 -translate-y-1/2 md:relative md:top-auto md:translate-y-0 ipad-portrait:!absolute ipad-portrait:!top-[45%] ipad-portrait:!-translate-y-1/2",children:[o.jsx(Fe.div,{initial:{y:30,opacity:0},whileInView:{y:0,opacity:1},viewport:{once:!0},transition:{delay:.5},children:o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx(zd,{}),o.jsx(Ud,{slug:"what-is-storysparkle"})]})}),o.jsx(Fe.p,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6,delay:.3},className:"section-footnote mt-3 text-center",children:t("cta.footnote")})]})]})]})})},Rn=()=>o.jsx("div",{style:{minHeight:"100vh"},"aria-hidden":"true"}),tu="https://cdn.storysparkle.org";function zl(t){let n="";for(let s=0;s<t.length;s+=32768){const r=t.subarray(s,s+32768);n+=String.fromCharCode.apply(null,r)}return btoa(n)}async function sN(t,e,n,s){let r,i=s;if(n instanceof File){i=i||n.type;const c=await n.arrayBuffer();r=zl(new Uint8Array(c))}else if(n instanceof Blob){i=i||n.type;const c=await n.arrayBuffer();r=zl(new Uint8Array(c))}else r=zl(n);const{data:a,error:l}=await q.functions.invoke("r2-upload",{body:{bucket:t,path:e,content:r,contentType:i||"application/octet-stream"}});if(l)throw new Error(`R2 upload failed: ${l.message}`);if(a?.error)throw new Error(`R2 upload failed: ${a.error}`);return a.url}async function wV(t,e){const{data:n,error:s}=await q.functions.invoke("r2-delete",{body:{bucket:t,path:e}});if(s)throw new Error(`R2 delete failed: ${s.message}`);if(n?.error)throw new Error(`R2 delete failed: ${n.error}`);return!0}async function EV(t){const{data:e,error:n}=await q.functions.invoke("r2-list",{body:{prefix:t}});if(n)throw new Error(`R2 list failed: ${n.message}`);if(e?.error)throw new Error(`R2 list failed: ${e.error}`);return e.files||[]}function rN(t,e){return`${tu}/${t}/${e}`}function jV(t){if(!t.startsWith(tu))return null;const n=t.replace(`${tu}/`,"").split("/");return n.length<2?null:{bucket:n[0],path:n.slice(1).join("/")}}function oN(t){const e=t.split(".").pop(),n=Date.now(),s=Math.random().toString(36).substring(2,8);return`${n}-${s}.${e}`}const iN=({placeholder:t,description:e,aspectRatio:n="square",className:s="",imageSrc:r,size:i="md",uploadPath:a="landing",onUpload:l})=>{const c=h.useRef(null),[u,d]=h.useState(!1),[p,f]=h.useState(r),g={square:"aspect-square","16:9":"aspect-video","4:3":"aspect-[4/3]",auto:""},y={sm:"w-16 h-16",md:"w-24 h-24",lg:"w-32 h-32",full:"w-full"},m=()=>{c.current?.click()},x=async b=>{const w=b.target.files?.[0];if(!w)return;if(!["image/jpeg","image/png","image/gif","image/webp"].includes(w.type)){hn.error("Please upload an image file (JPEG, PNG, GIF, or WebP)");return}if(w.size>10*1024*1024){hn.error("File size must be less than 10MB");return}d(!0);try{const T=oN(w.name),j=`${a}/${T}`;await sN("landing_assets",j,w,w.type);const P=rN("landing_assets",j);f(P),l?.(P),hn.success("Image uploaded successfully!")}catch(T){console.error("Upload failed:",T),hn.error("Failed to upload image")}finally{d(!1),c.current&&(c.current.value="")}};return p?o.jsxs("div",{className:"relative group",children:[o.jsx("img",{src:p,alt:e,className:`object-cover rounded-xl ${n!=="auto"?g[n]:""} ${i!=="full"?y[i]:"w-full"} ${s}`}),o.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:x,className:"hidden"}),o.jsx(bn,{variant:"secondary",size:"sm",onClick:m,disabled:u,className:"absolute bottom-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:u?o.jsx(ch,{className:"w-4 h-4 animate-spin"}):o.jsx(dh,{className:"w-4 h-4"})})]}):o.jsxs("div",{className:`relative border-2 border-dashed border-muted-foreground/40 rounded-xl bg-muted/20 flex flex-col items-center justify-center p-4 text-center ${n!=="auto"?g[n]:"min-h-[100px]"} ${i!=="full"?y[i]:"w-full"} ${s}`,children:[o.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:x,className:"hidden"}),o.jsx("div",{className:"text-2xl mb-2",children:"🖼️"}),o.jsx(bn,{variant:"outline",size:"sm",onClick:m,disabled:u,className:"text-xs",children:u?o.jsxs(o.Fragment,{children:[o.jsx(ch,{className:"w-3 h-3 mr-1 animate-spin"}),"Uploading..."]}):o.jsxs(o.Fragment,{children:[o.jsx(dh,{className:"w-3 h-3 mr-1"}),"Upload"]})})]})},aN=({isVisible:t,beanstalkImageSrc:e,onBeanstalkUpload:n})=>o.jsx(TS,{children:t&&o.jsx(Fe.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{duration:1.2,ease:[.4,0,.2,1]},className:"fixed bottom-0 right-0 z-30 h-screen ipad-portrait:!h-[45vh] pointer-events-none",children:e?o.jsx("img",{src:e,alt:"Magical beanstalk",className:"h-full w-auto object-contain"}):o.jsx("div",{className:"h-full w-32 pointer-events-auto",children:o.jsx(iN,{placeholder:"BEANSTALK",description:"Claymation beanstalk growing from bottom to top",aspectRatio:"auto",size:"full",className:"h-full",imageSrc:e,onUpload:n})})})}),lN="401989987777-08lbeuo9pch9kt8lfk5lprok19vp4bc0.apps.googleusercontent.com",cN="googleOneTapDismissed",uN=1e3*60*60,dN=async t=>{const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")},hN=()=>{const{user:t,isLoading:e}=br(),n=h.useRef(!1);return h.useEffect(()=>{if(t||e||n.current)return;const s=sessionStorage.getItem(cN);if(s&&Date.now()-Number(s)<uN)return;const r=()=>new Promise(c=>{if(document.querySelector('script[src="https://accounts.google.com/gsi/client"]')){c();return}const u=document.createElement("script");u.src="https://accounts.google.com/gsi/client",u.async=!0,u.onload=()=>c(),u.onerror=()=>c(),document.head.appendChild(u)});let i,a;const l=async()=>{if(!window.google?.accounts?.id)return!1;const c=crypto.randomUUID(),u=await dN(c);return window.google.accounts.id.initialize({client_id:lN,callback:async d=>{try{const{error:p}=await q.auth.signInWithIdToken({provider:"google",token:d.credential,nonce:c});p&&console.error("[OneTap] Supabase signInWithIdToken error:",p)}catch(p){console.error("Google One Tap callback error:",p)}},use_fedcm_for_prompt:!0,auto_select:!1,cancel_on_tap_outside:!0,context:"signup",itp_support:!0,nonce:u,params:{nonce:u}}),window.google.accounts.id.prompt(),n.current=!0,!0};return r().then(()=>{l().then(c=>{c||(i=setInterval(()=>{l().then(u=>{u&&i&&clearInterval(i)})},300),a=setTimeout(()=>{i&&clearInterval(i)},5e3))})}),()=>{i&&clearInterval(i),a&&clearTimeout(a),window.google?.accounts?.id&&window.google.accounts.id.cancel()}},[t,e]),null},pN=h.lazy(()=>_(()=>import("./ProfessionalNarrationSection-BEtfUobD.js"),__vite__mapDeps([41,1,2,7,22,23]))),fN=h.lazy(()=>_(()=>import("./SyncedHighlightsSection-5LTrvkcS.js"),__vite__mapDeps([42,1,2,43,7,22,23]))),mN=h.lazy(()=>_(()=>import("./InteractiveWordsSection-D2aRY-T0.js"),__vite__mapDeps([44,1,2,7,22,23]))),gN=h.lazy(()=>_(()=>import("./VocabularySection-19Kpx33w.js"),__vite__mapDeps([45,1,2,17,7,22,23]))),vN=h.lazy(()=>_(()=>import("./ChooseYourPaceSection-wraCUKui.js"),__vite__mapDeps([46,1,2,17,7,47,22,23]))),_N=h.lazy(()=>_(()=>import("./DyslexiaSection-DPAl78W1.js"),__vite__mapDeps([48,1,2,43,7,22,23]))),yN=h.lazy(()=>_(()=>import("./CheckTextSection-CjNLkzpc.js"),__vite__mapDeps([49,1,2,43,13,17,7,22,23]))),xN=h.lazy(()=>_(()=>import("./ThemesSection-C7QGC5wN.js"),__vite__mapDeps([50,1,2,43,51,7,52,22,23]))),bN=h.lazy(()=>_(()=>import("./StoryMakerSection-DLsK9xt2.js"),__vite__mapDeps([53,1,2,17,7,22,23]))),wN=h.lazy(()=>_(()=>import("./AchievementsSection-ZBmYFp4Z.js"),__vite__mapDeps([54,1,2,17,7,22,23]))),EN=h.lazy(()=>_(()=>import("./HotAirBalloon-FI3Lv-FM.js"),__vite__mapDeps([55,1,2,22,23,7]))),jN=h.lazy(()=>_(()=>import("./QuillWipe-DYHI3ulT.js"),__vite__mapDeps([56,1,2,22,23,7]))),TN="https://cdn.storysparkle.org/landing_assets/flicker-on-beanstalk.webp",Oe={white:"#FFFFFF",buttercream:"#FFF8E7",lavender:"#F3E8FF",sky:"#E0F2FE",lemon:"#FEF9C3",pink:"#FCE7F3",mint:"#F0FDF4",violet:"#EDE9FE",peach:"#FFF7ED",apricot:"#FFECD2",seafoam:"#E0F5F0",rose:"#FFE4E6",sage:"#ECF4E8"},Xe=()=>{const{t}=Se("home"),{getAsset:e,saveAsset:n}=DL(),s={"@context":"https://schema.org","@type":"FAQPage",mainEntity:t("faq.items",{returnObjects:!0,defaultValue:[]}).map(E=>({"@type":"Question",name:E.q,acceptedAnswer:{"@type":"Answer",text:E.a}}))},[r,i]=h.useState(!1),[a,l]=h.useState(!1),[c,u]=h.useState(0),d=h.useRef(null),p=h.useRef(null),{scrollYProgress:f}=E2({target:p,offset:["start start","end end"]}),g=rm(f,[.4,.9],["100%","0%"]),y=rm(f,[.4,.7],[0,1]),{setLumiTarget:m,setOnTargetReached:x}=l0(),[b,w]=h.useState(!1);return h.useEffect(()=>(x(()=>{w(!0),setTimeout(()=>{w(!1),m(null)},1e3)}),()=>x(void 0)),[x,m,w]),h.useEffect(()=>{const E=()=>{const T=window.scrollY,j=window.innerHeight,P=Math.floor(T/j);u(Math.min(P,10))};return window.addEventListener("scroll",E),()=>window.removeEventListener("scroll",E)},[]),o.jsxs(o.Fragment,{children:[o.jsx(hN,{}),o.jsx(Rs,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/",structuredData:[NL,ML,VL,FL,$L,s]}),o.jsxs("div",{className:"min-h-screen overflow-x-clip",style:{background:Oe.white},children:[o.jsx(YL,{}),o.jsx(Yt,{topColor:Oe.white,bottomColor:Oe.buttercream,variant:8,flip:!0}),o.jsx(ZL,{}),o.jsx(Yt,{topColor:Oe.buttercream,bottomColor:Oe.lavender,variant:8}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(pN,{})}),o.jsx(Yt,{topColor:Oe.lavender,bottomColor:Oe.sky,variant:2,flip:!0}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(fN,{})}),o.jsx(Yt,{topColor:Oe.sky,bottomColor:Oe.apricot,variant:9}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(mN,{videoSrc:e("interactive_words","main_video"),onVideoUpload:E=>n("interactive_words","main_video",E,"video"),onLumiTarget:E=>m(E),isWordHovered:b})}),o.jsx(Yt,{topColor:Oe.apricot,bottomColor:Oe.lemon,variant:4,flip:!0}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(gN,{})}),o.jsx(Yt,{topColor:Oe.lemon,bottomColor:Oe.seafoam,variant:10}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(vN,{})}),o.jsx("div",{className:"relative -mt-12 z-20 pointer-events-none",children:o.jsx(Yt,{topColor:"transparent",bottomColor:Oe.pink,variant:6,flip:!0})}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(_N,{})}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(yN,{})}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(xN,{onInteractionComplete:()=>{},hasCarouselInteracted:!0})}),o.jsx(h.Suspense,{fallback:null,children:o.jsx(EN,{isActive:r,onComplete:()=>i(!1)})}),o.jsxs(h.Suspense,{fallback:null,children:[o.jsx(Yt,{topColor:Oe.mint,bottomColor:Oe.rose,variant:11}),o.jsx(bN,{flickerWritingImageSrc:e("story_maker","flicker_writing_image")}),o.jsx(jN,{isActive:a,onComplete:()=>l(!1)})]}),o.jsx(Yt,{topColor:Oe.rose,bottomColor:Oe.violet,variant:3,flip:!0}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(wN,{})}),o.jsx(Yt,{topColor:Oe.violet,bottomColor:Oe.sage,variant:12}),o.jsxs("div",{className:"relative",children:[o.jsx(eN,{sectionRef:p}),o.jsx(Yt,{topColor:Oe.sage,bottomColor:Oe.peach,variant:5,flip:!0}),o.jsx("div",{ref:d,children:o.jsx(nN,{})}),o.jsx("div",{className:"sticky bottom-0 h-0 z-30 pointer-events-none",children:o.jsx("div",{className:"absolute bottom-0 right-[5vw] w-[24vw] sm:w-[40vw] max-w-[250px] sm:max-w-[420px] h-[312px] sm:h-[65vh] ipad-portrait:!w-[30vw] ipad-portrait:!max-w-[280px] ipad-portrait:!h-[45vh] overflow-hidden",children:o.jsx(Fe.img,{src:TN,alt:"Flicker on Beanstalk",className:"absolute inset-0 w-full h-full object-contain object-bottom will-change-transform",width:420,height:650,loading:"lazy",decoding:"async",style:{y:g,opacity:y}})})})]}),o.jsx(aN,{isVisible:!1,beanstalkImageSrc:e("progress","beanstalk_image"),onBeanstalkUpload:E=>n("progress","beanstalk_image",E,"image")})]})]})},Rx="https://cdn.storysparkle.org",Ax=(t,e)=>`${Rx}/${t}/${e}`;async function PN(){try{return[{name:"OpenDyslexic-Regular.woff2",format:"woff2"},{name:"OpenDyslexic-Regular.woff",format:"woff"},{name:"OpenDyslexic-Bold.woff2",format:"woff2"},{name:"OpenDyslexic-Bold.woff",format:"woff"}].map(e=>({name:e.name,url:`${Rx}/fonts/${e.name}`,format:e.format}))}catch(t){return console.error("Failed to load fonts:",t),[]}}function kN(){const[t,e]=h.useState(!1);return h.useEffect(()=>{(async()=>{await new Promise(s=>{"requestIdleCallback"in window?window.requestIdleCallback(()=>s(),{timeout:5e3}):setTimeout(s,3e3)});try{const s=await PN();if(s.length===0){console.log("No fonts found in storage, using fallback"),e(!0);return}const r=s.map(i=>{const a=i.name.includes("Bold");return new FontFace("OpenDyslexic",`url(${i.url}) format('${i.format}')`,{weight:a?"700":"400",style:"normal",display:"swap"}).load().then(c=>(document.fonts.add(c),c))});await Promise.all(r),e(!0),console.log("All fonts loaded from Supabase")}catch(s){console.error("Error loading fonts (using fallback):",s),e(!0)}})()},[]),null}const SN=()=>{const{pathname:t}=os();return h.useEffect(()=>{window.scrollTo(0,0)},[t]),null},RN="Main Scene",AN=0,CN=260.1941560444079,IN=260.1941046463815,ON={g:"@lottiefiles/creator@1.88.0"},DN=[{ty:0,nm:"StorySparkle Logo",sr:1,st:0,op:90,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[92,92]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[130.09706517269734,130.09706517269737]},r:{a:1,k:[{o:{x:.66,y:0},i:{x:.34,y:1},s:[50],t:0},{o:{x:.66,y:0},i:{x:.34,y:1},s:[-50],t:22.63},{o:{x:.66,y:0},i:{x:.34,y:1},s:[50],t:45.25},{o:{x:.66,y:0},i:{x:.34,y:1},s:[-50],t:67.87},{s:[50],t:90}]},sa:{a:0,k:0},o:{a:0,k:100}},w:184,h:184,refId:"precomp_Shape Layer - SVG_ktGbUW1Zv3_b371b8fc-0abe-40ce-b884-13b7441df0ed",ind:1}],LN="5.7.0",NN=30,MN=90,VN=0,FN=[{nm:"StorySparkle Logo",id:"precomp_Shape Layer - SVG_ktGbUW1Zv3_b371b8fc-0abe-40ce-b884-13b7441df0ed",fr:30,layers:[{ty:4,nm:"Shape Layer 1",sr:1,st:0,op:90,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[24.356674043576486,24.364452763262335]},s:{a:0,k:[377.95,377.95]},sk:{a:0,k:0},p:{a:0,k:[92.05604954769733,92.08544921875]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}},shapes:[{ty:"gr",bm:0,hd:!1,nm:"g1893",np:3,it:[{ty:"gr",bm:0,hd:!1,nm:"g1747",np:5,it:[{ty:"gr",bm:0,hd:!1,nm:"g14158-7",np:3,it:[{ty:"gr",bm:0,hd:!1,nm:"path14149-1",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 1",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,-1.61]],o:[[0,1.61],[0,0]],v:[[83.2,135.12],[83.2,139.95]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.949,.8,.0196]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[83.19985747300423,137.5333392562743]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[83.19985747300423,137.5333392562743]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"g14147-7",np:3,it:[{ty:"gr",bm:0,hd:!1,nm:"g13994-6",np:2,it:[{ty:"gr",bm:0,hd:!1,nm:"path13986-2",np:4,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 2",d:1,ks:{a:0,k:{c:!0,i:[[0,0],[0,0],[3.33,1.13],[2.63,.45],[1.99,-1.31],[1.05,-1.31],[0,0],[0,0]],o:[[0,0],[-4.33,-.06],[-3.33,-1.13],[-2.63,-.45],[-1.99,1.31],[0,0],[0,0],[0,0]],v:[[113.56,144.76],[113.56,140.3],[101.56,139.06],[93.25,135.27],[85.7,137.43],[81.61,141.35],[81.64,144.76],[113.56,144.76]]}}},{ty:"sh",bm:0,hd:!1,nm:"Path 3",d:1,ks:{a:0,k:{c:!0,i:[[0,0],[0,0],[-3.33,1.13],[-2.63,.45],[-1.99,-1.31],[-1.05,-1.31],[0,0],[0,0]],o:[[0,0],[4.33,-.06],[3.33,-1.13],[2.63,-.45],[1.99,1.31],[0,0],[0,0],[0,0]],v:[[49.66,144.76],[49.66,140.3],[61.66,139.06],[69.97,135.27],[77.52,137.43],[81.61,141.35],[81.64,144.76],[49.66,144.76]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.949,.8,.0196]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[81.60584766273162,139.893564781624]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[81.60584766273162,139.893564781624]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[81.60584766273162,139.893564781624]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[83.17584766273161,131.313564781624]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"rect13980-5",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 4",d:1,ks:{a:0,k:{c:!0,i:[[0,0],[0,0],[0,-1.33],[0,0],[1.63,0],[0,0],[0,1.33],[0,0],[-1.63,0]],o:[[0,0],[1.63,0],[0,0],[0,1.33],[0,0],[-1.63,0],[0,0],[0,-1.33],[0,0]],v:[[51.44,136.18],[114.92,136.18],[117.87,138.59],[117.87,138.59],[114.92,141],[51.44,141],[48.48,138.59],[48.48,138.59],[51.44,136.18]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.949,.8,.0196]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[83.17104570067707,138.5885372942198]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[83.17104570067707,138.5885372942198]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[83.17104570067707,133.72414973299237]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[83.17104570067707,132.66414973299237]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[83.17104570067707,132.66895169504693]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[83.17104570067707,127.37895169504692]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path16323-5",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 5",d:1,ks:{a:0,k:{c:!0,i:[[0,0],[0,-6.99],[-2.37,-2.37],[-3.36,0],[-2.15,4.28],[.93,0],[0,5.67],[-2.59,1.94],[.81,0]],o:[[-6.99,0],[0,3.36],[2.37,2.37],[4.79,0],[-.89,.25],[-5.67,0],[0,-3.23],[-.8,-.16],[0,0]],v:[[65.73,68.45],[53.07,81.11],[56.78,90.06],[65.73,93.77],[77.04,86.79],[74.31,87.17],[64.04,76.9],[68.15,68.68],[65.73,68.45]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:2,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.349,.749,.6784]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[65.09165856541426,81.10724533770491]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[65.09165856541426,81.10724533770491]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"g4820-5",np:10,it:[{ty:"gr",bm:0,hd:!1,nm:"path4510-1-1-9-9-9",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 6",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[95.63,92.56],[93.06,95.13]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[94.34130335898263,93.83873294507185]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[94.34130335898263,93.83873294507185]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-0-8-6-4",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 7",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[112.32,75.86],[109.75,78.43]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[111.03292346048953,77.14231088151041]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[111.03292346048953,77.14231088151041]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-1-1-9-1",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 8",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[92.7,85.5],[89.07,85.5]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[90.8838906797292,85.49772485637291]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[90.8838906797292,85.49772485637291]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-0-8-1",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 9",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[116.31,85.5],[112.68,85.5]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[114.49033613974304,85.49772485637291]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[114.49033613974304,85.49772485637291]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-1-1-7",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 10",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[95.63,78.43],[93.06,75.86]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[94.34130335898263,77.14231088151041]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[94.34130335898263,77.14231088151041]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-0-2",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 11",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[112.32,95.13],[109.75,92.56]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[111.03292346048953,93.83873294507185]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[111.03292346048953,93.83873294507185]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-1-8",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 12",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[102.69,95.48],[102.69,99.12]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[102.68711340973613,97.29614562432529]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[102.68711340973613,97.29614562432529]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path4510-06",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 13",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[102.69,71.87],[102.69,75.51]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[102.68711340973613,73.68970016431149]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[102.68711340973613,73.68970016431149]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path3766-8",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 14",d:1,ks:{a:0,k:{c:!0,i:[[0,0],[1.21,-1.21],[1.71,0],[1.21,1.21],[0,1.71],[-1.21,1.21],[-1.71,0],[-1.21,-1.21],[0,-1.71]],o:[[0,1.71],[-1.21,1.21],[-1.71,0],[-1.21,-1.21],[0,-1.71],[1.21,-1.21],[1.71,0],[1.21,1.21],[0,0]],v:[[109.13,85.5],[107.25,90.05],[102.69,91.94],[98.13,90.05],[96.24,85.5],[98.13,80.94],[102.69,79.05],[107.25,80.94],[109.13,85.5]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.749,.0196,.0118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[102.67750948562706,85.48812093226385]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[102.67750948562706,85.48812093226385]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[102.68711340973613,85.49292289431838]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[101.93711340973613,85.21292289431838]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"g13931-2",np:4,it:[{ty:"gr",bm:0,hd:!1,nm:"path13914-1",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 15",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,1.71],[-4.96,0],[0,-4.96],[.92,-1.44]],o:[[-.92,-1.44],[0,-4.96],[4.96,0],[0,1.71],[0,0]],v:[[75.31,130.68],[73.9,125.86],[82.88,116.88],[91.86,125.86],[90.45,130.68]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[1,1,1]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[82.87332405329694,123.81589585059405]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[82.87332405329694,123.81589585059405]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path13918-5",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 16",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,1.64],[-8.18,0],[0,-8.18],[.53,-1.55]],o:[[-.53,-1.55],[0,-8.18],[8.18,0],[0,1.64],[0,0]],v:[[68.88,130.68],[68.07,125.86],[82.88,111.05],[97.69,125.86],[96.88,130.68]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.349,.749,.6784]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[82.87332405329694,120.90110488350122]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[82.87332405329694,120.90110488350122]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path13922-0",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 17",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,1.62],[-11.9,0],[0,-11.9],[.36,-1.58]],o:[[-.36,-1.58],[0,-11.9],[11.9,0],[0,1.62],[0,0]],v:[[61.88,130.68],[61.33,125.86],[82.88,104.32],[104.43,125.86],[103.88,130.68]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.4,.651,.2118]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[82.87332405329694,117.53012752122908]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[82.87332405329694,117.53012752122908]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"gr",bm:0,hd:!1,nm:"path5706-9-2-2-4",np:3,it:[{ty:"sh",bm:0,hd:!1,nm:"Path 18",d:1,ks:{a:0,k:{c:!1,i:[[0,0],[0,1.62],[-15.27,0],[0,-15.27],[0,0],[.28,-1.59]],o:[[-.28,-1.59],[0,-15.27],[15.27,0],[0,0],[0,1.62],[0,0]],v:[[55.65,130.68],[55.22,125.86],[82.88,98.2],[110.54,125.86],[110.54,125.86],[110.11,130.68]]}}},{ty:"st",bm:0,hd:!1,nm:"Stroke",lc:2,lj:1,ml:4,o:{a:0,k:100},w:{a:0,k:1.41},c:{a:0,k:[0,0,0]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[.949,.4902,.4902]},r:1,o:{a:0,k:100}},{ty:"tr",a:{a:0,k:[82.87332405329694,114.45206984428263]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[82.87332405329694,114.45206984428263]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[82.87332405329694,114.4760796545552]},s:{a:0,k:[100,100]},sk:{a:0,k:0},p:{a:0,k:[82.87332405329694,114.4760796545552]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[83.17104570067707,101.55399976584549]},s:{a:0,k:[58.42,58.42]},sk:{a:0,k:0},p:{a:0,k:[-193.43147510166446,151.09784666320695]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]},{ty:"tr",a:{a:0,k:[-193.43001765741099,151.09500848229226]},s:{a:0,k:[62.05,62.05]},sk:{a:0,k:0},p:{a:0,k:[24.35667404357649,24.364452763262335]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}}]}],ind:1},{ty:4,nm:"Ellipse 2",sr:1,st:0,op:90,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[0,0]},s:{a:0,k:[110.58860990667239,102.92084485785465]},sk:{a:0,k:0},p:{a:0,k:[91.99999833904434,92.00000410170529]},r:{a:0,k:0},sa:{a:0,k:0},o:{a:0,k:100}},shapes:[{ty:"el",bm:0,hd:!1,nm:"Ellipse Shape 1",d:1,p:{a:0,k:[0,0]},s:{a:0,k:[155.76450914731709,173.36591162188924]}},{ty:"fl",bm:0,hd:!1,nm:"Fill",c:{a:0,k:[1,1,1]},r:1,o:{a:0,k:100}}],ind:2}]}],$N={nm:RN,ddd:AN,h:CN,w:IN,meta:ON,layers:DN,v:LN,fr:NN,op:MN,ip:VN,assets:FN},BN=h.lazy(()=>_(()=>import("./index.es-C3Wz79fL.js"),__vite__mapDeps([57,2]))),Cx=({delay:t=150,label:e="Loading…",overlay:n=!0,minHeight:s="60vh",transparent:r=!1})=>{const[i,a]=h.useState(!1),[l,c]=h.useState(!1);h.useEffect(()=>{const p=window.matchMedia("(prefers-reduced-motion: reduce)");c(p.matches);const f=setTimeout(()=>a(!0),t);return()=>clearTimeout(f)},[t]),h.useEffect(()=>{if(!n)return;const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[n]);const u=r?{}:{background:"radial-gradient(circle at center, white 0%, white 30%, #a5f3fc 100%)"},d=n?`fixed inset-0 z-40 w-screen h-screen flex items-center justify-center${r?" pointer-events-auto":""}`:"w-full flex items-center justify-center";return o.jsxs("div",{role:"status","aria-busy":"true","aria-live":"polite","aria-label":e,className:d,style:n?u:{...u,minHeight:s},children:[i&&o.jsx(h.Suspense,{fallback:o.jsx("span",{className:"sr-only",children:e}),children:o.jsx("div",{className:"w-32 h-32 md:w-40 md:h-40",style:r?{filter:"drop-shadow(0 6px 14px rgba(0,0,0,0.12)) drop-shadow(0 2px 4px rgba(0,0,0,0.08))",willChange:"transform"}:void 0,children:o.jsx(BN,{animationData:$N,loop:!0,autoplay:!l,initialSegment:[0,90],"aria-hidden":"true"})})}),o.jsx("span",{className:"sr-only",children:e})]})},zN=()=>{const{isSwitchingLanguage:t}=Dt();return t?o.jsx(Cx,{overlay:!0,transparent:!0}):null},UN=()=>{const{currentLanguage:t,changeLanguage:e}=Dt(),{isBusy:n}=zu(),{user:s}=br(),{t:r}=Se("navbar"),[i,a]=h.useState(null);if(h.useEffect(()=>{if(s||vS())return;const p=o0();!p||p===t||a(p)},[t,s]),!i||n||s)return null;const l=to[i],c=Fn(t)?to[t]:to.en,u=()=>{Fn(t)&&no(t),a(null)},d=()=>{a(null),e(i)};return o.jsx("div",{className:"border-b border-nature-forest/20 bg-white",children:o.jsxs("div",{className:"container flex flex-wrap items-center gap-x-4 gap-y-2 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[o.jsx(nr,{countryCode:uo[i]||"gb",size:20,className:"shrink-0"}),o.jsx("p",{className:"text-sm text-ink",children:r("languageSuggestion.message",{language:l,defaultValue:"StorySparkle is available in {{language}}."})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ss,{variant:"primary",size:"pillSm",onClick:d,children:r("languageSuggestion.switch",{language:l,defaultValue:"Switch to {{language}}"})}),o.jsx(bn,{variant:"ghost",size:"pillSm",onClick:u,className:"text-nature-forest hover:bg-nature-forest/10",children:r("languageSuggestion.keep",{language:c,defaultValue:"Keep {{language}}"})}),o.jsx(bn,{variant:"ghost",size:"pillIcon",onClick:u,"aria-label":r("languageSuggestion.dismiss",{defaultValue:"Dismiss"}),className:"text-nature-forest hover:bg-nature-forest/10",children:o.jsx(va,{className:"h-4 w-4"})})]})]})})},HN=fx,TV=mx,WN=gx,Ix=h.forwardRef(({className:t,...e},n)=>o.jsx(Fa,{ref:n,className:ie("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));Ix.displayName=Fa.displayName;const Ox=h.forwardRef(({className:t,children:e,...n},s)=>o.jsxs(WN,{children:[o.jsx(Ix,{}),o.jsxs($a,{ref:s,className:ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,o.jsxs(vx,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(va,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ox.displayName=$a.displayName;const Dx=({className:t,...e})=>o.jsx("div",{className:ie("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Dx.displayName="DialogHeader";const Lx=({className:t,...e})=>o.jsx("div",{className:ie("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Lx.displayName="DialogFooter";const Nx=h.forwardRef(({className:t,...e},n)=>o.jsx(Ba,{ref:n,className:ie("text-lg font-semibold leading-none tracking-tight",t),...e}));Nx.displayName=Ba.displayName;const Mx=h.forwardRef(({className:t,...e},n)=>o.jsx(za,{ref:n,className:ie("text-sm text-muted-foreground",t),...e}));Mx.displayName=za.displayName;function bm(t,[e,n]){return Math.min(n,Math.max(e,t))}function GN(t){const e=h.useRef({value:t,previous:t});return h.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var KN=[" ","Enter","ArrowUp","ArrowDown"],qN=[" ","Enter"],Wo="Select",[Ua,Ha,YN]=ha(Wo),[jr,PV]=js(Wo,[YN,xr]),Wa=xr(),[XN,as]=jr(Wo),[ZN,JN]=jr(Wo),Vx=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:r,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:f,required:g,form:y}=t,m=Wa(e),[x,b]=h.useState(null),[w,E]=h.useState(null),[T,j]=h.useState(!1),P=Td(u),[k=!1,S]=_s({prop:s,defaultProp:r,onChange:i}),[O,D]=_s({prop:a,defaultProp:l,onChange:c}),M=h.useRef(null),L=x?y||!!x.closest("form"):!0,[X,I]=h.useState(new Set),Y=Array.from(X).map($=>$.props.value).join(";");return o.jsx(Tu,{...m,children:o.jsxs(XN,{required:g,scope:e,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:j,contentId:gn(),value:O,onValueChange:D,open:k,onOpenChange:S,dir:P,triggerPointerDownPosRef:M,disabled:f,children:[o.jsx(Ua.Provider,{scope:e,children:o.jsx(ZN,{scope:t.__scopeSelect,onNativeOptionAdd:h.useCallback($=>{I(H=>new Set(H).add($))},[]),onNativeOptionRemove:h.useCallback($=>{I(H=>{const A=new Set(H);return A.delete($),A})},[]),children:n})}),L?o.jsxs(cb,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:p,value:O,onChange:$=>D($.target.value),disabled:f,form:y,children:[O===void 0?o.jsx("option",{value:""}):null,Array.from(X)]},Y):null]})})};Vx.displayName=Wo;var Fx="SelectTrigger",$x=h.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...r}=t,i=Wa(n),a=as(Fx,n),l=a.disabled||s,c=_e(e,a.onTriggerChange),u=Ha(n),d=h.useRef("touch"),[p,f,g]=ub(m=>{const x=u().filter(E=>!E.disabled),b=x.find(E=>E.value===a.value),w=db(x,m,b);w!==void 0&&a.onValueChange(w.value)}),y=m=>{l||(a.onOpenChange(!0),g()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return o.jsx(Pu,{asChild:!0,...i,children:o.jsx(se.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":lb(a.value)?"":void 0,...r,ref:c,onClick:G(r.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:G(r.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:G(r.onKeyDown,m=>{const x=p.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(x&&m.key===" ")&&KN.includes(m.key)&&(y(),m.preventDefault())})})})});$x.displayName=Fx;var Bx="SelectValue",zx=h.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:r,children:i,placeholder:a="",...l}=t,c=as(Bx,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,p=_e(e,c.onValueNodeChange);return We(()=>{u(d)},[u,d]),o.jsx(se.span,{...l,ref:p,style:{pointerEvents:"none"},children:lb(c.value)?o.jsx(o.Fragment,{children:a}):i})});zx.displayName=Bx;var QN="SelectIcon",Ux=h.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...r}=t;return o.jsx(se.span,{"aria-hidden":!0,...r,ref:e,children:s||"▼"})});Ux.displayName=QN;var eM="SelectPortal",Hx=t=>o.jsx(gr,{asChild:!0,...t});Hx.displayName=eM;var Es="SelectContent",Wx=h.forwardRef((t,e)=>{const n=as(Es,t.__scopeSelect),[s,r]=h.useState();if(We(()=>{r(new DocumentFragment)},[]),!n.open){const i=s;return i?fr.createPortal(o.jsx(Gx,{scope:t.__scopeSelect,children:o.jsx(Ua.Slot,{scope:t.__scopeSelect,children:o.jsx("div",{children:t.children})})}),i):null}return o.jsx(Kx,{...t,ref:e})});Wx.displayName=Es;var Zt=10,[Gx,ls]=jr(Es),tM="SelectContentImpl",Kx=h.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:g,sticky:y,hideWhenDetached:m,avoidCollisions:x,...b}=t,w=as(Es,n),[E,T]=h.useState(null),[j,P]=h.useState(null),k=_e(e,K=>T(K)),[S,O]=h.useState(null),[D,M]=h.useState(null),L=Ha(n),[X,I]=h.useState(!1),Y=h.useRef(!1);h.useEffect(()=>{if(E)return kd(E)},[E]),Pd();const $=h.useCallback(K=>{const[he,...Re]=L().map(xe=>xe.ref.current),[ae]=Re.slice(-1),ye=document.activeElement;for(const xe of K)if(xe===ye||(xe?.scrollIntoView({block:"nearest"}),xe===he&&j&&(j.scrollTop=0),xe===ae&&j&&(j.scrollTop=j.scrollHeight),xe?.focus(),document.activeElement!==ye))return},[L,j]),H=h.useCallback(()=>$([S,E]),[$,S,E]);h.useEffect(()=>{X&&H()},[X,H]);const{onOpenChange:A,triggerPointerDownPosRef:C}=w;h.useEffect(()=>{if(E){let K={x:0,y:0};const he=ae=>{K={x:Math.abs(Math.round(ae.pageX)-(C.current?.x??0)),y:Math.abs(Math.round(ae.pageY)-(C.current?.y??0))}},Re=ae=>{K.x<=10&&K.y<=10?ae.preventDefault():E.contains(ae.target)||A(!1),document.removeEventListener("pointermove",he),C.current=null};return C.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",Re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",Re,{capture:!0})}}},[E,A,C]),h.useEffect(()=>{const K=()=>A(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[A]);const[V,N]=ub(K=>{const he=L().filter(ye=>!ye.disabled),Re=he.find(ye=>ye.ref.current===document.activeElement),ae=db(he,K,Re);ae&&setTimeout(()=>ae.ref.current.focus())}),Z=h.useCallback((K,he,Re)=>{const ae=!Y.current&&!Re;(w.value!==void 0&&w.value===he||ae)&&(O(K),ae&&(Y.current=!0))},[w.value]),Q=h.useCallback(()=>E?.focus(),[E]),ne=h.useCallback((K,he,Re)=>{const ae=!Y.current&&!Re;(w.value!==void 0&&w.value===he||ae)&&M(K)},[w.value]),we=s==="popper"?nu:qx,te=we===nu?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:g,sticky:y,hideWhenDetached:m,avoidCollisions:x}:{};return o.jsx(Gx,{scope:n,content:E,viewport:j,onViewportChange:P,itemRefCallback:Z,selectedItem:S,onItemLeave:Q,itemTextRefCallback:ne,focusSelectedItem:H,selectedItemText:D,position:s,isPositioned:X,searchRef:V,children:o.jsx(Na,{as:Jn,allowPinchZoom:!0,children:o.jsx(Oa,{asChild:!0,trapped:w.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:G(r,K=>{w.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:o.jsx(mr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(we,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:K=>K.preventDefault(),...b,...te,onPlaced:()=>I(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:G(b.onKeyDown,K=>{const he=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!he&&K.key.length===1&&N(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ae=L().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ye=K.target,xe=ae.indexOf(ye);ae=ae.slice(xe+1)}setTimeout(()=>$(ae)),K.preventDefault()}})})})})})})});Kx.displayName=tM;var nM="SelectItemAlignedPosition",qx=h.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...r}=t,i=as(Es,n),a=ls(Es,n),[l,c]=h.useState(null),[u,d]=h.useState(null),p=_e(e,k=>d(k)),f=Ha(n),g=h.useRef(!1),y=h.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=a,E=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&x&&b){const k=i.trigger.getBoundingClientRect(),S=u.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),D=b.getBoundingClientRect();if(i.dir!=="rtl"){const ye=D.left-S.left,xe=O.left-ye,ze=k.left-xe,Lt=k.width+ze,Tn=Math.max(Lt,S.width),Nt=window.innerWidth-Zt,Pn=bm(xe,[Zt,Math.max(Zt,Nt-Tn)]);l.style.minWidth=Lt+"px",l.style.left=Pn+"px"}else{const ye=S.right-D.right,xe=window.innerWidth-O.right-ye,ze=window.innerWidth-k.right-xe,Lt=k.width+ze,Tn=Math.max(Lt,S.width),Nt=window.innerWidth-Zt,Pn=bm(xe,[Zt,Math.max(Zt,Nt-Tn)]);l.style.minWidth=Lt+"px",l.style.right=Pn+"px"}const M=f(),L=window.innerHeight-Zt*2,X=m.scrollHeight,I=window.getComputedStyle(u),Y=parseInt(I.borderTopWidth,10),$=parseInt(I.paddingTop,10),H=parseInt(I.borderBottomWidth,10),A=parseInt(I.paddingBottom,10),C=Y+$+X+A+H,V=Math.min(x.offsetHeight*5,C),N=window.getComputedStyle(m),Z=parseInt(N.paddingTop,10),Q=parseInt(N.paddingBottom,10),ne=k.top+k.height/2-Zt,we=L-ne,te=x.offsetHeight/2,K=x.offsetTop+te,he=Y+$+K,Re=C-he;if(he<=ne){const ye=M.length>0&&x===M[M.length-1].ref.current;l.style.bottom="0px";const xe=u.clientHeight-m.offsetTop-m.offsetHeight,ze=Math.max(we,te+(ye?Q:0)+xe+H),Lt=he+ze;l.style.height=Lt+"px"}else{const ye=M.length>0&&x===M[0].ref.current;l.style.top="0px";const ze=Math.max(ne,Y+m.offsetTop+(ye?Z:0)+te)+Re;l.style.height=ze+"px",m.scrollTop=he-ne+m.offsetTop}l.style.margin=`${Zt}px 0`,l.style.minHeight=V+"px",l.style.maxHeight=L+"px",s?.(),requestAnimationFrame(()=>g.current=!0)}},[f,i.trigger,i.valueNode,l,u,m,x,b,i.dir,s]);We(()=>E(),[E]);const[T,j]=h.useState();We(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const P=h.useCallback(k=>{k&&y.current===!0&&(E(),w?.(),y.current=!1)},[E,w]);return o.jsx(rM,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:P,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:o.jsx(se.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});qx.displayName=nM;var sM="SelectPopperPosition",nu=h.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:r=Zt,...i}=t,a=Wa(n);return o.jsx(ku,{...a,...i,ref:e,align:s,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nu.displayName=sM;var[rM,Hd]=jr(Es,{}),su="SelectViewport",Yx=h.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...r}=t,i=ls(su,n),a=Hd(su,n),l=_e(e,i.onViewportChange),c=h.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Ua.Slot,{scope:n,children:o.jsx(se.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:G(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=a;if(f?.current&&p){const g=Math.abs(c.current-d.scrollTop);if(g>0){const y=window.innerHeight-Zt*2,m=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),b=Math.max(m,x);if(b<y){const w=b+g,E=Math.min(y,w),T=w-E;p.style.height=E+"px",p.style.bottom==="0px"&&(d.scrollTop=T>0?T:0,p.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Yx.displayName=su;var Xx="SelectGroup",[oM,iM]=jr(Xx),aM=h.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,r=gn();return o.jsx(oM,{scope:n,id:r,children:o.jsx(se.div,{role:"group","aria-labelledby":r,...s,ref:e})})});aM.displayName=Xx;var Zx="SelectLabel",Jx=h.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,r=iM(Zx,n);return o.jsx(se.div,{id:r.id,...s,ref:e})});Jx.displayName=Zx;var ua="SelectItem",[lM,Qx]=jr(ua),eb=h.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:r=!1,textValue:i,...a}=t,l=as(ua,n),c=ls(ua,n),u=l.value===s,[d,p]=h.useState(i??""),[f,g]=h.useState(!1),y=_e(e,w=>c.itemRefCallback?.(w,s,r)),m=gn(),x=h.useRef("touch"),b=()=>{r||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(lM,{scope:n,value:s,disabled:r,textId:m,isSelected:u,onItemTextChange:h.useCallback(w=>{p(E=>E||(w?.textContent??"").trim())},[]),children:o.jsx(Ua.ItemSlot,{scope:n,value:s,disabled:r,textValue:d,children:o.jsx(se.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:y,onFocus:G(a.onFocus,()=>g(!0)),onBlur:G(a.onBlur,()=>g(!1)),onClick:G(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:G(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:G(a.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:G(a.onPointerMove,w=>{x.current=w.pointerType,r?c.onItemLeave?.():x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(a.onPointerLeave,w=>{w.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:G(a.onKeyDown,w=>{c.searchRef?.current!==""&&w.key===" "||(qN.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});eb.displayName=ua;var qr="SelectItemText",tb=h.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:r,...i}=t,a=as(qr,n),l=ls(qr,n),c=Qx(qr,n),u=JN(qr,n),[d,p]=h.useState(null),f=_e(e,b=>p(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),g=d?.textContent,y=h.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return We(()=>(m(y),()=>x(y)),[m,x,y]),o.jsxs(o.Fragment,{children:[o.jsx(se.span,{id:c.textId,...i,ref:f}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?fr.createPortal(i.children,a.valueNode):null]})});tb.displayName=qr;var nb="SelectItemIndicator",sb=h.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return Qx(nb,n).isSelected?o.jsx(se.span,{"aria-hidden":!0,...s,ref:e}):null});sb.displayName=nb;var ru="SelectScrollUpButton",rb=h.forwardRef((t,e)=>{const n=ls(ru,t.__scopeSelect),s=Hd(ru,t.__scopeSelect),[r,i]=h.useState(!1),a=_e(e,s.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),r?o.jsx(ib,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});rb.displayName=ru;var ou="SelectScrollDownButton",ob=h.forwardRef((t,e)=>{const n=ls(ou,t.__scopeSelect),s=Hd(ou,t.__scopeSelect),[r,i]=h.useState(!1),a=_e(e,s.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),r?o.jsx(ib,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});ob.displayName=ou;var ib=h.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...r}=t,i=ls("SelectScrollButton",n),a=h.useRef(null),l=Ha(n),c=h.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),We(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),o.jsx(se.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:G(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:G(r.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:G(r.onPointerLeave,()=>{c()})})}),cM="SelectSeparator",ab=h.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return o.jsx(se.div,{"aria-hidden":!0,...s,ref:e})});ab.displayName=cM;var iu="SelectArrow",uM=h.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,r=Wa(n),i=as(iu,n),a=ls(iu,n);return i.open&&a.position==="popper"?o.jsx(Su,{...r,...s,ref:e}):null});uM.displayName=iu;function lb(t){return t===""||t===void 0}var cb=h.forwardRef((t,e)=>{const{value:n,...s}=t,r=h.useRef(null),i=_e(e,r),a=GN(n);return h.useEffect(()=>{const l=r.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==n&&d){const p=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(p)}},[a,n]),o.jsx(Oo,{asChild:!0,children:o.jsx("select",{...s,ref:i,defaultValue:n})})});cb.displayName="BubbleSelect";function ub(t){const e=Ye(t),n=h.useRef(""),s=h.useRef(0),r=h.useCallback(a=>{const l=n.current+a;e(l),function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=h.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}function db(t,e,n){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=dM(t,Math.max(i,0));r.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function dM(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var hM=Vx,hb=$x,pM=zx,fM=Ux,mM=Hx,pb=Wx,gM=Yx,fb=Jx,mb=eb,vM=tb,_M=sb,gb=rb,vb=ob,_b=ab;const wm=hM,Em=pM,au=h.forwardRef(({className:t,children:e,...n},s)=>o.jsxs(hb,{ref:s,className:ie("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,o.jsx(fM,{asChild:!0,children:o.jsx(Ii,{className:"h-4 w-4 opacity-50"})})]}));au.displayName=hb.displayName;const yb=h.forwardRef(({className:t,...e},n)=>o.jsx(gb,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(r1,{className:"h-4 w-4"})}));yb.displayName=gb.displayName;const xb=h.forwardRef(({className:t,...e},n)=>o.jsx(vb,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Ii,{className:"h-4 w-4"})}));xb.displayName=vb.displayName;const lu=h.forwardRef(({className:t,children:e,position:n="popper",...s},r)=>o.jsx(mM,{children:o.jsxs(pb,{ref:r,className:ie("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:[o.jsx(yb,{}),o.jsx(gM,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(xb,{})]})}));lu.displayName=pb.displayName;const yM=h.forwardRef(({className:t,...e},n)=>o.jsx(fb,{ref:n,className:ie("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));yM.displayName=fb.displayName;const cu=h.forwardRef(({className:t,children:e,...n},s)=>o.jsxs(mb,{ref:s,className:ie("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(_M,{children:o.jsx(ga,{className:"h-4 w-4"})})}),o.jsx(vM,{children:e})]}));cu.displayName=mb.displayName;const xM=h.forwardRef(({className:t,...e},n)=>o.jsx(_b,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",t),...e}));xM.displayName=_b.displayName;const pi=t=>t.replace(/^[^\w]+|[^\w]+$/g,""),jm={async getUniqueWordCount(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return 0;const{count:e,error:n}=await q.from("vocabulary_words").select("id",{count:"exact",head:!0}).eq("user_id",t.id);if(n)throw n;return e??0}catch(t){return console.error("Error getting unique word count:",t),0}},async saveWordWithContext(t,e,n,s,r,i){try{const{data:{user:a}}=await q.auth.getUser();if(!a)throw new Error("User not authenticated");const{data:l,error:c}=await q.functions.invoke("contextual-translate",{body:{word:t,sentence:n,storyId:s,storyTitle:r,targetLanguage:i}});if(c||!l)throw c||new Error("Translation failed");const{contextualMeaning:u,partOfSpeech:d,pronunciation:p}=l,f=pi(t),g=pi(e),y=f.toLowerCase(),{data:m}=await q.from("vocabulary_words").select("id").eq("user_id",a.id).eq("word",y).maybeSingle();let x;if(m)x=m.id;else{const{data:E,error:T}=await q.from("vocabulary_words").insert({user_id:a.id,word:y,original_word:g,pronunciation:p}).select("id").single();if(T||!E)throw T||new Error("Failed to create word");x=E.id}const{data:b}=await q.from("vocabulary_occurrences").select("id").eq("vocabulary_word_id",x).eq("story_id",s).eq("sentence",n).maybeSingle();if(b)return{success:!0,status:"exists",data:{contextualMeaning:u,partOfSpeech:d,pronunciation:p}};const{error:w}=await q.from("vocabulary_occurrences").insert({vocabulary_word_id:x,story_id:s,sentence:n,contextual_meaning:u,part_of_speech:d});if(w)throw w;return{success:!0,status:"saved",data:{contextualMeaning:u,partOfSpeech:d,pronunciation:p}}}catch(a){return console.error("Error saving word with context:",a),{success:!1,error:a instanceof Error?a.message:"Unknown error"}}},async saveWordWithAIData(t,e,n,s,r){try{const{data:{user:i}}=await q.auth.getUser();if(!i)throw new Error("User not authenticated");const{contextualMeaning:a,partOfSpeech:l,pronunciation:c}=r,u=pi(t),d=pi(e),p=u.toLowerCase(),{data:f}=await q.from("vocabulary_words").select("id").eq("user_id",i.id).eq("word",p).maybeSingle();let g,y=!1;if(f)g=f.id;else{y=!0;const{data:b,error:w}=await q.from("vocabulary_words").insert({user_id:i.id,word:p,original_word:d,pronunciation:c}).select("id").single();if(w||!b)throw w||new Error("Failed to create word");g=b.id}const{data:m}=await q.from("vocabulary_occurrences").select("id").eq("vocabulary_word_id",g).eq("story_id",s).eq("sentence",n).maybeSingle();if(m)return{success:!0,status:"exists"};const{error:x}=await q.from("vocabulary_occurrences").insert({vocabulary_word_id:g,story_id:s,sentence:n,contextual_meaning:a,part_of_speech:l});if(x)throw x;return{success:!0,status:"saved"}}catch(i){return console.error("Error saving word with AI data:",i),{success:!1,error:i instanceof Error?i.message:"Unknown error"}}},async getVocabulary(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return[];const{data:e,error:n}=await q.from("vocabulary_words").select(`
          id,
          word,
          original_word,
          pronunciation,
          created_at
        `).eq("user_id",t.id).order("word",{ascending:!0});if(n)throw n;if(!e)return[];const s=e.map(l=>l.id);if(s.length===0)return[];const{data:r,error:i}=await q.from("vocabulary_occurrences").select(`
          id,
          vocabulary_word_id,
          story_id,
          sentence,
          contextual_meaning,
          part_of_speech,
          created_at,
          stories (
            title,
            thumbnail
          )
        `).in("vocabulary_word_id",s).order("created_at",{ascending:!1});if(i)throw i;return e.map(l=>({id:l.id,word:l.word,originalWord:l.original_word,pronunciation:l.pronunciation,createdAt:l.created_at,occurrences:(r||[]).filter(c=>c.vocabulary_word_id===l.id).map(c=>({id:c.id,storyId:c.story_id,storyTitle:c.stories?.title,storyThumbnail:c.stories?.thumbnail,sentence:c.sentence,contextualMeaning:c.contextual_meaning,partOfSpeech:c.part_of_speech||void 0,createdAt:c.created_at}))}))}catch(t){throw console.error("Error fetching vocabulary:",t),t}},async deleteWord(t){try{const{error:e}=await q.from("vocabulary_words").delete().eq("id",t);if(e)throw e;return!0}catch(e){return console.error("Error deleting word:",e),!1}},async clearAllWords(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return;const{error:e}=await q.from("vocabulary_words").delete().eq("user_id",t.id);if(e)throw e}catch(t){throw console.error("Error clearing vocabulary:",t),t}},async wordExists(t){try{const{data:{user:e}}=await q.auth.getUser();if(!e)return!1;const n=t.toLowerCase(),{data:s}=await q.from("vocabulary_words").select("id").eq("user_id",e.id).eq("word",n).maybeSingle();return!!s}catch(e){return console.error("Error checking if word exists:",e),!1}},async pruneForFreeUser(){try{const{data:{user:t}}=await q.auth.getUser();if(!t)return 0;const{data:e}=await q.from("profiles").select("user_type").eq("id",t.id).single();if(e?.user_type==="admin")return 0;const{data:n}=await q.from("user_payments").select("subscription_status, subscription_end_date").eq("user_id",t.id).maybeSingle();if(n?.subscription_status==="active"&&(!n.subscription_end_date||new Date(n.subscription_end_date)>new Date))return 0;const{data:r,error:i}=await q.from("vocabulary_words").select("id, created_at").eq("user_id",t.id).order("created_at",{ascending:!0});if(i||!r||r.length<=20)return 0;const a=r.slice(20).map(c=>c.id);for(const c of a)await q.from("vocabulary_occurrences").delete().eq("vocabulary_word_id",c);const{error:l}=await q.from("vocabulary_words").delete().in("id",a);if(l)throw l;return a.length}catch(t){return console.error("Error pruning vocabulary:",t),0}}},Tm="languagePrefsSnoozed",bM=()=>{const{user:t}=br(),{currentLanguage:e,changeLanguage:n}=Dt(),{t:s,i18n:r}=Se("auth"),[i,a]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState("en"),[p,f]=h.useState("zh-Hans"),[g,y]=h.useState(null),[m,x]=h.useState(!1),b=m&&g!==null&&p!==g,[,w]=h.useReducer(P=>P+1,0);h.useEffect(()=>{if(!i)return;let P=!1;return r.loadLanguages(u).then(()=>{P||w()},()=>{}),()=>{P=!0}},[u,i,r]);const E=(P,k)=>s(P,{lng:u,defaultValue:k});h.useEffect(()=>{if(!t||sessionStorage.getItem(Tm))return;let P=!1;return(async()=>{const{data:k,error:S}=await q.from("profiles").select("language_prefs_confirmed_at, preferred_app_language, preferred_translation_language").eq("id",t.id).maybeSingle();if(P||S||!k||k.language_prefs_confirmed_at)return;const O=Fn(k.preferred_app_language)?k.preferred_app_language:Fn(e)?e:"en",D=k.preferred_translation_language||_S(O);d(O),f(D),y(D);const M=await jm.getUniqueWordCount();P||x(M>0),a(!0)})(),()=>{P=!0}},[t?.id]);const T=async()=>{if(!(!t||l)){c(!0);try{b&&await jm.clearAllWords(),await q.from("profiles").update({preferred_app_language:u,preferred_translation_language:p,language_prefs_confirmed_at:new Date().toISOString()}).eq("id",t.id),no(u),a(!1),u!==e&&n(u)}catch(P){console.error("[LanguagePreferencesDialog] save failed:",P),a(!1)}finally{c(!1)}}},j=()=>{sessionStorage.setItem(Tm,"1"),a(!1)};return i?o.jsx(HN,{open:i,onOpenChange:P=>{P||j()},children:o.jsxs(Ox,{className:"sm:max-w-md",children:[o.jsxs(Dx,{children:[o.jsx(Nx,{className:"text-ink",children:E("languagePreferences.title","Choose your languages")}),o.jsx(Mx,{className:"text-nature-forest",children:E("languagePreferences.subtitle","You can change these any time from the menu.")})]}),o.jsxs("div",{className:"space-y-5 py-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-ink",children:[o.jsx(u1,{className:"h-4 w-4 shrink-0 text-nature-coral"}),E("languagePreferences.appLabel","The language you'll read the site in")]}),o.jsxs(wm,{value:u,onValueChange:P=>d(P),children:[o.jsx(au,{className:"border-nature-forest/30",children:o.jsx(Em,{})}),o.jsx(lu,{className:"bg-white",children:en.map(P=>o.jsx(cu,{value:P,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(nr,{countryCode:uo[P]||"gb",size:16,className:"shrink-0"}),to[P]]})},P))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-ink",children:[o.jsx(w1,{className:"h-4 w-4 shrink-0 text-nature-coral"}),E("languagePreferences.translationLabel","The language new words are explained in")]}),o.jsxs(wm,{value:p,onValueChange:P=>f(P),children:[o.jsx(au,{className:"border-nature-forest/30",children:o.jsx(Em,{})}),o.jsx(lu,{className:"bg-white",children:Object.entries(s0).map(([P,{displayName:k}])=>o.jsx(cu,{value:P,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(nr,{countryCode:SL[P]||"cn",size:16,className:"shrink-0"}),k]})},P))})]}),o.jsx("p",{className:"text-xs text-nature-forest",children:E("languagePreferences.translationHint","This can be different — pick whichever your child understands best.")}),b&&o.jsx("p",{className:"rounded-lg border border-nature-honey-ink/30 bg-nature-honey px-3 py-2 text-xs text-nature-honey-ink",children:E("languagePreferences.clearsVocabulary","Changing this will delete the words already saved in your Vocabulary Notebook.")})]})]}),o.jsx(Lx,{children:o.jsx(Ss,{variant:"primary",onClick:T,disabled:l,leftIcon:o.jsx(ga,{}),children:l?E("languagePreferences.saving","Saving…"):E("languagePreferences.confirm","Looks good")})})]})}):null},wM=()=>{const{t}=Se("landing"),[e,n]=h.useState(!1),[s,r]=h.useState(!1);h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const a=window.matchMedia("(max-width: 767px) and (orientation: landscape)"),l=()=>n(a.matches);return l(),a.addEventListener?.("change",l),()=>a.removeEventListener?.("change",l)},[]),h.useEffect(()=>{const a=()=>r(!!document.fullscreenElement);return a(),document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[]);const i=s;return h.useEffect(()=>{if(i)return;const a=window.screen?.orientation;if(a?.lock)try{a.lock("portrait").catch(()=>{})}catch{}},[e,i]),h.useEffect(()=>{if(!e)return;const a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]),e?o.jsxs("div",{role:"alertdialog","aria-modal":"true",className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center gap-4 bg-background text-foreground px-6 text-center",children:[o.jsx(F1,{className:"h-14 w-14 text-primary",style:{animation:"rotateHint 1.8s ease-in-out infinite"}}),o.jsx("h2",{className:"text-xl font-semibold",children:t("rotate.title")}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs",children:t("rotate.subtitle")}),o.jsx("style",{children:`
        @keyframes rotateHint {
          0%, 100% { transform: rotate(-90deg); }
          50% { transform: rotate(0deg); }
        }
      `})]}):null},bb=t=>!!t&&en.includes(t.toLowerCase()),EM=t=>{const e=t.split("/").filter(Boolean)[0]?.toLowerCase();return bb(e)?e:null},jM=t=>t?`/${t}/subscription`:"/subscription",TM=t=>{const e=t.split("/").filter(Boolean),n=bb(e[0])?e.slice(1):e;return n[0]!=="story"||!n[1]?null:n[1].split(/[?#]/)[0]||null},PM=()=>{const t=uu();h.useEffect(()=>{const{data:{subscription:e}}=q.auth.onAuthStateChange((n,s)=>{if(n!=="SIGNED_IN")return;const r=sessionStorage.getItem("pendingAuthRedirect");if(!r)return;sessionStorage.removeItem("pendingAuthRedirect");const i=TM(r);if(!i||!s?.user){setTimeout(()=>t(r),0);return}(async()=>{try{const a=EM(r),[l,c,u]=await Promise.all([q.from("stories").select("access_level").eq("id",i).maybeSingle(),q.from("profiles").select("user_type").eq("id",s.user.id).maybeSingle(),q.from("user_payments").select("subscription_status, subscription_end_date").eq("user_id",s.user.id).maybeSingle()]),d=l.data?.access_level??"paid",p=c.data?.user_type??"free",f=u.data?.subscription_status,g=u.data?.subscription_end_date?new Date(u.data.subscription_end_date):null,y=f==="active"&&(!g||g>new Date);let m=!1;p==="admin"||d==="guest"||d==="free"?m=!0:d==="paid"&&(m=p==="paid"||y),m?setTimeout(()=>t(r),0):(sessionStorage.setItem("postSubscriptionRedirect",r),setTimeout(()=>t(jM(a)),0))}catch(a){console.error("[useAuthRedirect] story access check failed:",a),setTimeout(()=>t(r),0)}})()});return()=>e.unsubscribe()},[t])},Ze=()=>{const{t}=Se("improve-reading");return o.jsx(Rs,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/improve-reading"})},Je=()=>{const{t}=Se("contact");return o.jsx(Rs,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/contact"})},Qe=()=>{const{t}=Se("subscription");return o.jsx(Rs,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/subscription"})},et=()=>{const{t}=Se("auth");return o.jsx(Rs,{title:t("meta.login.title"),description:t("meta.login.description"),keywords:t("meta.login.keywords",{defaultValue:""})||void 0,canonical:"/login",noIndex:!0})},tt=()=>{const{t}=Se("auth");return o.jsx(Rs,{title:t("meta.signup.title"),description:t("meta.signup.description"),keywords:t("meta.signup.keywords",{defaultValue:""})||void 0,canonical:"/signup"})},wb="watch",Eb=[{slug:"what-is-storysparkle",file:"StorySparkle_Promo_Web.mp4",poster:"StorySparkle_Promo_Poster.jpg",uploadDate:"2026-08-08",seconds:150,kind:"promo",feature:"/",chapters:[{id:"S1",at:1.3},{id:"S2",at:17.17},{id:"S3",at:33.93},{id:"S4",at:48.07},{id:"S5",at:68.87},{id:"S6",at:83.83},{id:"S7",at:92.97},{id:"S8",at:111.67},{id:"S9",at:124.07},{id:"S10",at:134.77}]},{slug:"choose-the-right-reading-level",file:"StoryLibrary_Web.mp4",poster:"StoryLibrary_Poster.jpg",uploadDate:"2026-08-21",seconds:89,kind:"howto",feature:"/stories",chapters:[{id:"c1",at:.8},{id:"c2",at:13.13},{id:"c3",at:25.4},{id:"c4",at:29.67},{id:"c5",at:47.57},{id:"c6",at:54.67},{id:"c7",at:64.1},{id:"c8",at:71.7},{id:"c9",at:77.77}]},{slug:"how-read-along-works",file:"ReadAlong_Web.mp4",poster:"ReadAlong_Poster.jpg",uploadDate:"2026-08-21",seconds:97,kind:"howto",feature:"/stories",chapters:[{id:"b1",at:.8},{id:"b2",at:7.5},{id:"b3",at:16.57},{id:"b4",at:22.6},{id:"b5",at:30.23},{id:"b6",at:37.97},{id:"b7",at:42.37},{id:"b8",at:54.17},{id:"b9",at:58.87},{id:"b10",at:65.8},{id:"b11",at:73.73},{id:"b12",at:80.1},{id:"b13",at:84.27}]},{slug:"make-a-custom-story",file:"StoryMaker_Web.mp4",poster:"StoryMaker_Poster.jpg",uploadDate:"2026-08-21",seconds:88,kind:"howto",feature:"/story-maker",chapters:[{id:"c1",at:.8},{id:"c2",at:6.33},{id:"c3",at:15.43},{id:"c4",at:23.17},{id:"c5",at:30.23},{id:"c6",at:38.93},{id:"c7",at:44.8},{id:"c8",at:51.2},{id:"c9",at:66.57}]},{slug:"check-a-text-level",file:"TextChecker_Web.mp4",poster:"TextChecker_Poster.jpg",uploadDate:"2026-08-21",seconds:93,kind:"howto",feature:"/text-checker",chapters:[{id:"h1",at:.8},{id:"h2",at:7.57},{id:"h3",at:18.1},{id:"h4",at:22.33},{id:"h5",at:27.63},{id:"h6",at:39.03},{id:"h7",at:42.53},{id:"h8",at:48.2},{id:"h9",at:52.27},{id:"h10",at:62.9},{id:"h11",at:71.43},{id:"h12",at:79.97}]},{slug:"track-reading-progress",file:"Progress_Web.mp4",poster:"Progress_Poster.jpg",uploadDate:"2026-08-21",seconds:86,kind:"howto",feature:"/progress",chapters:[{id:"h1",at:1.2},{id:"h2",at:7.6},{id:"h3",at:13.63},{id:"h4",at:21.87},{id:"h5",at:32.37},{id:"h6",at:40.1},{id:"h7",at:47.7},{id:"h8",at:58.13},{id:"h9",at:63.7},{id:"h10",at:72.3}]}],kV=t=>Eb.find(e=>e.slug===t),SV=t=>Ax(wb,t.file),RV=t=>Ax(wb,`posters/${t.poster}`),AV=(t,e)=>`/subtitles/${t.slug}.${e}.vtt`,CV=t=>{const e=Math.floor(t/60),n=Math.round(t%60);return e===0&&n===0?"PT0S":`PT${e>0?`${e}M`:""}${n>0?`${n}S`:""}`},kM=(t,e)=>`https://storysparkle.org${e==="en"?"":`/${e}`}${t}`,IV=t=>{const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${String(n).padStart(2,"0")}`},nt=()=>{const{t}=Se("watch"),{currentLanguage:e}=Dt(),n={"@context":"https://schema.org","@type":"ItemList",name:t("hero.title"),itemListElement:Eb.map((s,r)=>({"@type":"ListItem",position:r+1,name:t(`videos.${s.slug}.title`),url:kM(`/watch/${s.slug}`,e)}))};return o.jsx(Rs,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/watch",structuredData:n})},st=h.lazy(()=>_(()=>import("./StoriesPage-D2A96ReY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),me=h.lazy(()=>_(()=>import("./StoryReaderPage-DXKm3pcv.js"),__vite__mapDeps([58,1,2,59,60,61,12,62,7,47,27,52,63,64,65,66,33,8,17,67,68,69,39,43,70,18,22,23]))),rt=h.lazy(()=>_(()=>import("./AboutPage-D48h5y7O.js"),__vite__mapDeps([71,1,2,18,7,51,52,72,37,32,9,22,23]))),ot=h.lazy(()=>_(()=>import("./ContactPage-BSIiCElr.js"),__vite__mapDeps([73,1,2,14,26,74,16,75,18,7,40,76,22,23]))),it=h.lazy(()=>_(()=>import("./ImproveReadingPage-BQ4Ube7X.js"),__vite__mapDeps([77,1,2,4,18,7,33,37,32,78,79,80,81,22,23]))),at=h.lazy(()=>_(()=>import("./WatchPage-C2yVy1oS.js"),__vite__mapDeps([82,1,2,18,7,83,65,22,23]))),lt=h.lazy(()=>_(()=>import("./WatchVideoPage-Cc6AM_Bt.js"),__vite__mapDeps([84,1,2,18,7,83,65,64,66,22,23]))),ct=h.lazy(()=>_(()=>import("./AuthPages-Brv_KMOG.js"),__vite__mapDeps([85,1,2,14,86,87,7,59,75,40,88,78,22,23])).then(t=>({default:t.LoginPage}))),ut=h.lazy(()=>_(()=>import("./AuthPages-Brv_KMOG.js"),__vite__mapDeps([85,1,2,14,86,87,7,59,75,40,88,78,22,23])).then(t=>({default:t.SignupPage}))),dt=h.lazy(()=>_(()=>import("./ResetPasswordPage-BnVj84s9.js"),__vite__mapDeps([89,1,2,14,87,7,59,40,88,78,22,23]))),ht=h.lazy(()=>_(()=>import("./VerifyEmailPage-Bpwi2I3A.js"),__vite__mapDeps([90,1,2,87,7,59,10,76,22,23]))),SM=h.lazy(()=>_(()=>import("./NotFound-CtUeyc4F.js"),__vite__mapDeps([91,1,2,7,59,22,23]))),pt=h.lazy(()=>_(()=>import("./ProgressPage-C0jMi8rv.js"),__vite__mapDeps([92,1,2,4,67,19,18,7,93,29,30,94,68,6,81,10,95,20,22,23]))),ft=h.lazy(()=>_(()=>import("./ReadingCartPage-DBHEFKFX.js"),__vite__mapDeps([96,1,2,3,4,5,6,7,8,9,10,11,18,63,22,23]))),mt=h.lazy(()=>_(()=>import("./VocabularyNotebookPage-IJOod8T9.js"),__vite__mapDeps([97,1,2,14,98,62,15,16,18,7,63,20,66,99,22,23]))),RM=h.lazy(()=>_(()=>import("./AdminPage-B0qN_X_N.js"),__vite__mapDeps([100,1,2,12,14,4,101,26,15,16,36,98,61,62,7,20,78,74,99,60,102,94,69,34,31,93,27,86,39,11,38,103,10,104,13,105,95,106,17,107,76,22,21,6,88,108,28,68,32,29,40,79,52,23]))),AM=h.lazy(()=>_(()=>import("./FontManagementPage-B9uRTjfC.js"),__vite__mapDeps([109,1,2,4,14,107,69,99,22,23,7]))),gt=h.lazy(()=>_(()=>import("./TermsPage-CyPyNnTW.js"),__vite__mapDeps([110,1,2,101,18,7,22,23]))),vt=h.lazy(()=>_(()=>import("./PrivacyPage-SpoKEhp6.js"),__vite__mapDeps([111,1,2,101,18,7,22,23]))),_t=h.lazy(()=>_(()=>import("./RefundPage-RxMqKhEx.js"),__vite__mapDeps([112,1,2,101,18,7,22,23]))),yt=h.lazy(()=>_(()=>import("./SubscriptionPage-DyRICx7F.js"),__vite__mapDeps([113,1,2,68,25,7,94,102,5,80,18,72,4,70,95,22,23]))),de=h.lazy(()=>_(()=>import("./PaymentStatusPage-DqpWR37Z.js"),__vite__mapDeps([114,1,2,4,7,76,103,22,23]))),xt=h.lazy(()=>_(()=>import("./ThemeInfoPage-BYu3lgPr.js"),__vite__mapDeps([115,1,2,4,101,18,7,33,37,32,9,22,23]))),bt=h.lazy(()=>_(()=>import("./BlogPage-BIz5fyXn.js"),__vite__mapDeps([116,1,2,14,117,4,10,104,7,18,20,22,23]))),ge=h.lazy(()=>_(()=>import("./BlogPostPage-C5rCVdF6.js"),__vite__mapDeps([118,1,2,105,4,19,108,21,33,7,104,18,59,95,10,22,23]))),wt=h.lazy(()=>_(()=>import("./NewsletterPage-DU07ytzO.js"),__vite__mapDeps([119,1,2,14,117,4,10,104,18,7,20,22,23]))),Et=h.lazy(()=>_(()=>import("./StoryMakerPage-DjF-ruyM.js"),__vite__mapDeps([120,1,2,25,18,7,4,98,14,106,60,68,21,39,13,38,34,108,22,23]))),jt=h.lazy(()=>_(()=>import("./ResearchPage-CPtGXeZv.js"),__vite__mapDeps([35,1,2,18,7,4,36,33,37,32,11,38,39,28,40,22,23]))),Tt=h.lazy(()=>_(()=>import("./TextCheckerPage-BVrUNDeh.js"),__vite__mapDeps([24,1,2,25,26,4,7,27,20,28,29,30,6,19,31,32,18,33,23,34,22]))),CM=new Lb({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5*60*1e3}}}),IM=()=>(PM(),null),OM=()=>{const{targetElement:t,onTargetReached:e}=l0();return o.jsx(C2,{targetElement:t,onTargetReached:e})},DM=()=>o.jsx(Cx,{}),jb=/^\/(?:[a-z]{2,3}\/)?(?:login|signup|reset-password|verify-email)\/?$/,LM=()=>{const{pathname:t}=os();return jb.test(t)?null:o.jsx(OL,{})},NM=()=>{const{pathname:t}=os();return jb.test(t)?null:o.jsx(CL,{})},MM=({children:t})=>{const e=os();return o.jsx(Cm,{children:t},e.pathname)};function VM(){return o.jsx(zb,{children:o.jsx(Nb,{client:CM,children:o.jsx(LT,{children:o.jsx(Vb,{children:o.jsx(L2,{children:o.jsx(hS,{children:o.jsx(pS,{children:o.jsx(yS,{children:o.jsxs(xS,{children:[o.jsx(B2,{}),o.jsx(kN,{}),o.jsx(SN,{}),o.jsx(IM,{}),o.jsx(OM,{}),o.jsx(zN,{}),o.jsx(wM,{}),o.jsx(bM,{}),o.jsxs("div",{className:"min-h-dvh flex flex-col",children:[o.jsx(NM,{}),o.jsx(UN,{}),o.jsx("main",{className:"flex-1",children:o.jsx(MM,{children:o.jsx(h.Suspense,{fallback:o.jsx(DM,{}),children:o.jsxs(Fb,{children:[o.jsx(v,{path:"/",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/admin",element:o.jsx(RM,{})}),o.jsx(v,{path:"/admin/fonts",element:o.jsx(AM,{})}),o.jsx(v,{path:"/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/payment/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/payment/cancel",element:o.jsx(de,{})}),o.jsx(v,{path:"/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/es",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/es/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/es/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/es/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/es/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/es/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/es/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/es/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/es/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/es/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/es/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/es/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/es/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/es/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/es/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/es/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/es/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/es/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/es/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/es/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/es/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/es/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/es/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/es/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/es/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/es/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/es/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/es/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/es/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/bn",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/bn/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/bn/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/bn/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/bn/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/bn/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/bn/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/bn/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/bn/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/bn/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/bn/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/bn/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/bn/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/bn/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/bn/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/bn/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/bn/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/bn/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/bn/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/bn/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/bn/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/bn/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/bn/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/bn/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/bn/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/bn/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/bn/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/bn/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/bn/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/zh",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/zh/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/zh/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/zh/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/zh/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/zh/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/zh/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/zh/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/zh/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/zh/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/zh/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/zh/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/zh/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/zh/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/zh/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/zh/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/zh/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/zh/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/zh/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/zh/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/zh/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/zh/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/zh/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/zh/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/zh/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/zh/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/zh/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/zh/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/zh/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/ja",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/ja/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/ja/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/ja/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ja/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ja/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ja/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ja/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/ja/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/ja/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ja/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ja/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/ja/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/ja/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ja/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ja/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ja/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ja/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/ja/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ja/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ja/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ja/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ja/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ja/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ja/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ja/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/ja/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/ja/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/ja/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/ko",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/ko/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/ko/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/ko/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ko/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ko/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ko/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ko/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/ko/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/ko/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ko/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ko/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/ko/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/ko/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ko/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ko/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ko/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ko/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/ko/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ko/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ko/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ko/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ko/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ko/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ko/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ko/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/ko/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/ko/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/ko/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/th",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/th/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/th/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/th/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/th/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/th/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/th/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/th/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/th/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/th/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/th/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/th/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/th/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/th/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/th/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/th/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/th/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/th/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/th/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/th/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/th/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/th/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/th/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/th/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/th/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/th/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/th/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/th/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/th/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/vi",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/vi/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/vi/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/vi/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/vi/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/vi/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/vi/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/vi/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/vi/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/vi/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/vi/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/vi/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/vi/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/vi/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/vi/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/vi/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/vi/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/vi/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/vi/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/vi/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/vi/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/vi/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/vi/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/vi/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/vi/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/vi/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/vi/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/vi/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/vi/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/hi",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/hi/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/hi/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/hi/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/hi/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/hi/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/hi/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/hi/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/hi/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/hi/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/hi/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/hi/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/hi/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/hi/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/hi/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/hi/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/hi/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/hi/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/hi/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/hi/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/hi/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/hi/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/hi/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/hi/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/hi/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/hi/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/hi/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/hi/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/hi/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/pt",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/pt/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/pt/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/pt/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/pt/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/pt/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/pt/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/pt/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/pt/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/pt/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/pt/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/pt/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/pt/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/pt/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/pt/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/pt/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/pt/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/pt/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/pt/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/pt/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/pt/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/pt/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/pt/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/pt/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/pt/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/pt/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/pt/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/pt/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/pt/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/fil",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/fil/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/fil/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/fil/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/fil/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/fil/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/fil/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/fil/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/fil/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/fil/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/fil/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/fil/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/fil/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/fil/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/fil/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/fil/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/fil/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/fil/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/fil/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/fil/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/fil/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/fil/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/fil/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/fil/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/fil/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/fil/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/fil/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/fil/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/fil/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/ms",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/ms/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/ms/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/ms/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ms/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/ms/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ms/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ms/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/ms/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/ms/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ms/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ms/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/ms/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/ms/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ms/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/ms/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ms/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ms/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/ms/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ms/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ms/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ms/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ms/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ms/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ms/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ms/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/ms/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/ms/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/ms/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/id",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/id/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/id/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/id/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/id/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/id/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/id/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/id/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/id/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/id/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/id/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/id/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/id/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/id/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/id/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/id/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/id/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/id/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/id/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/id/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/id/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/id/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/id/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/id/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/id/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/id/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/id/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/id/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/id/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/my",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/my/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/my/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/my/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/my/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/my/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/my/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/my/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/my/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/my/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/my/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/my/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/my/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/my/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/my/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/my/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/my/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/my/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/my/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/my/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/my/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/my/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/my/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/my/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/my/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/my/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/my/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/my/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/my/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/es/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/bn/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/zh/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/ja/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/ko/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/th/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/vi/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/hi/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/pt/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/fil/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/ms/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/id/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/my/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/km",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/km/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/km/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/km/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/km/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/km/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/km/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/km/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/km/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/km/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/km/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/km/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/km/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/km/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/km/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/km/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/km/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/km/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/km/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/km/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/km/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/km/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/km/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/km/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/km/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/km/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/km/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/km/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/km/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/km/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"/lo",element:o.jsx(Xe,{})}),o.jsx(v,{path:"/lo/stories",element:o.jsx(st,{})}),o.jsx(v,{path:"/lo/story-maker",element:o.jsx(Et,{})}),o.jsx(v,{path:"/lo/stories/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/lo/story/:id",element:o.jsx(me,{})}),o.jsx(v,{path:"/lo/improve-reading",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/lo/themes",element:o.jsx(xt,{})}),o.jsx(v,{path:"/lo/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(nt,{}),o.jsx(at,{})]})}),o.jsx(v,{path:"/lo/watch/:slug",element:o.jsx(lt,{})}),o.jsx(v,{path:"/lo/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/lo/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/lo/blog",element:o.jsx(bt,{})}),o.jsx(v,{path:"/lo/blog/newsletter",element:o.jsx(wt,{})}),o.jsx(v,{path:"/lo/blog/newsletter/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/lo/blog/:slug",element:o.jsx(ge,{})}),o.jsx(v,{path:"/lo/research",element:o.jsx(jt,{})}),o.jsx(v,{path:"/lo/login",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/lo/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(ut,{})]})}),o.jsx(v,{path:"/lo/reset-password",element:o.jsx(dt,{})}),o.jsx(v,{path:"/lo/verify-email",element:o.jsx(ht,{})}),o.jsx(v,{path:"/lo/progress",element:o.jsx(pt,{})}),o.jsx(v,{path:"/lo/reading-cart",element:o.jsx(ft,{})}),o.jsx(v,{path:"/lo/vocabulary",element:o.jsx(mt,{})}),o.jsx(v,{path:"/lo/terms",element:o.jsx(gt,{})}),o.jsx(v,{path:"/lo/privacy",element:o.jsx(vt,{})}),o.jsx(v,{path:"/lo/refund",element:o.jsx(_t,{})}),o.jsx(v,{path:"/lo/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(yt,{})]})}),o.jsx(v,{path:"/lo/stripe/success",element:o.jsx(de,{})}),o.jsx(v,{path:"/lo/stripe/failure",element:o.jsx(de,{})}),o.jsx(v,{path:"/lo/text-checker",element:o.jsx(Tt,{})}),o.jsx(v,{path:"*",element:o.jsx(SM,{})})]})})})}),o.jsx(LM,{})]}),o.jsx(AE,{}),o.jsx(oj,{})]})})})})})})})})})}const Pm="ss_build_id",FM=60*1e3,$M=2e3,BM="ss-build";let pr=null,Ul=null,ho=null;const Io=()=>{try{const t=window.location.pathname;return t.includes("/story/")||t.includes("/story-maker")}catch{return!1}},Tb=()=>{try{return"1787916084782-5grkq3"}catch{return"dev"}};async function zM(){try{const t=Tb();if(localStorage.getItem(Pm)===t)return;if("caches"in window){const n=await caches.keys();await Promise.all(n.map(s=>caches.delete(s)))}if("serviceWorker"in navigator){const n=await navigator.serviceWorker.getRegistrations();await Promise.all(n.map(s=>s.update().catch(()=>{})))}localStorage.setItem(Pm,t)}catch{}}function Pb(t,e=!1){if(!(t===Tb()||t===pr)){if(pr=t,console.info("[build-version] new build detected:",t),!e&&ho)try{ho.postMessage({type:"stale",buildId:t})}catch{}typeof document<"u"&&document.visibilityState==="hidden"&&!Io()&&window.location.reload()}}async function Yr(){try{const t=await fetch(`/version.json?t=${Date.now()}`,{cache:"no-store",headers:{"cache-control":"no-cache"}});if(!t.ok)return;const n=(await t.json())?.buildId;if(!n)return;Pb(n)}catch{}}function UM(){if(typeof window>"u")return;const t=window;if(t.__ssNavReloadInstalled)return;t.__ssNavReloadInstalled=!0;const e=l=>{if(!pr||Io())return!1;const c=l?String(l):window.location.pathname+window.location.search;return window.location.href=c,!0},n=history.pushState.bind(history),s=history.replaceState.bind(history);history.pushState=function(l,c,u){if(!e(u))return n(l,c,u??null)},history.replaceState=function(l,c,u){if(!e(u))return s(l,c,u??null)},window.addEventListener("popstate",()=>{pr&&!Io()&&window.location.reload()});const r=()=>{Yr()},i=history.pushState,a=history.replaceState;history.pushState=function(...l){const c=i.apply(this,l);return r(),c},history.replaceState=function(...l){const c=a.apply(this,l);return r(),c}}function HM(){if(!(typeof window>"u")){UM();try{ho=new BroadcastChannel(BM),ho.onmessage=t=>{const e=t?.data?.buildId;typeof e=="string"&&Pb(e,!0)}}catch{ho=null}setTimeout(()=>void Yr(),$M),Ul&&clearInterval(Ul),Ul=setInterval(()=>void Yr(),FM),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(pr&&!Io()){window.location.reload();return}Yr()}}),window.addEventListener("focus",()=>{if(pr&&!Io()){window.location.reload();return}Yr()})}}const vs="storyMakerDraft",Xr="storyMakerDraft",Wd=2,WM=24*60*60*1e3,Ga=()=>typeof window<"u",GM=()=>{if(Ga())try{const t=sessionStorage.getItem(Xr);if(!t)return;if(localStorage.getItem(vs)){sessionStorage.removeItem(Xr);return}let e;try{e=JSON.parse(t)}catch{sessionStorage.removeItem(Xr);return}const n={v:Wd,savedAt:Date.now(),data:e};localStorage.setItem(vs,JSON.stringify(n)),sessionStorage.removeItem(Xr)}catch(t){console.warn("[storyMakerDraft] legacy migration failed:",t)}},OV=t=>{if(Ga())try{const e={v:Wd,savedAt:Date.now(),data:t};localStorage.setItem(vs,JSON.stringify(e))}catch(e){console.warn("[storyMakerDraft] save failed:",e)}},DV=()=>{if(!Ga())return null;try{const t=localStorage.getItem(vs);if(!t)return null;const e=JSON.parse(t);return!e||e.v!==Wd||typeof e.savedAt!="number"||Date.now()-e.savedAt>WM?(localStorage.removeItem(vs),null):e.data||null}catch(t){return console.warn("[storyMakerDraft] load failed:",t),null}},LV=()=>{if(Ga())try{localStorage.removeItem(vs),sessionStorage.removeItem(Xr)}catch{}},Gd=document.getElementById("root");if(!Gd)throw new Error("Root element not found");Gd.innerHTML="";GM();zM().finally(()=>{HM()});const KM=Am(Gd),qM=Sc(window.location.pathname),YM=()=>KM.render(o.jsx(F.StrictMode,{children:o.jsx(Cm,{children:o.jsx(VM,{})})})),XM=new Promise(t=>setTimeout(t,1500));Promise.race([Rm.loadNamespaces(qM),XM]).finally(YM);const km=()=>{[B_,z_].forEach(t=>{const e=new Image;e.decoding="async",e.src=t})};typeof window.requestIdleCallback=="function"?window.requestIdleCallback(km,{timeout:3e3}):setTimeout(km,1500);export{CV as $,TS as A,bn as B,n1 as C,Ri as D,jm as E,nr as F,hN as G,_l as H,ch as I,hn as J,r1 as K,ig as L,xV as M,L1 as N,bV as O,ca as P,zL as Q,zd as R,Rs as S,SL as T,Zw as U,g1 as V,Ud as W,va as X,Eb as Y,IV as Z,RV as _,Im as a,rg as a$,SV as a0,kM as a1,kV as a2,AV as a3,vl as a4,lh as a5,G1 as a6,D_ as a7,FI as a8,Kc as a9,oN as aA,sN as aB,y1 as aC,Jn as aD,qb as aE,en as aF,dh as aG,TV as aH,js as aI,_e as aJ,G as aK,nn as aL,GN as aM,cT as aN,G_ as aO,Td as aP,_s as aQ,cO as aR,uO as aS,a1 as aT,yV as aU,Ye as aV,We as aW,bm as aX,ag as aY,wV as aZ,jV as a_,RL as aa,mu as ab,LT as ac,NT as ad,MT as ae,Wg as af,Yw as ag,og as ah,PL as ai,vV as aj,Tr as ak,Fa as al,$a as am,mx as an,vx as ao,Ba as ap,za as aq,fx as ar,gx as as,se as at,ma as au,wm as av,au as aw,Em as ax,lu as ay,cu as az,ie as b,HL as b$,V2 as b0,M2 as b1,N2 as b2,F2 as b3,im as b4,M1 as b5,xr as b6,Pu as b7,kd as b8,Na as b9,E2 as bA,rm as bB,PN as bC,Yt as bD,WL as bE,iN as bF,MA as bG,td as bH,Ce as bI,Gu as bJ,He as bK,d_ as bL,OS as bM,FA as bN,ur as bO,Zu as bP,vn as bQ,HI as bR,Le as bS,KC as bT,KI as bU,GI as bV,zI as bW,GC as bX,p_ as bY,na as bZ,RS as b_,Pd as ba,Oa as bb,mr as bc,ku as bd,Su as be,gr as bf,Tu as bg,gn as bh,ha as bi,lV as bj,EV as bk,$T as bl,oV as bm,iV as bn,aV as bo,AL as bp,Rx as bq,zu as br,DV as bs,OV as bt,LV as bu,pV as bv,fV as bw,Om as bx,_V as by,A2 as bz,ce as c,F_ as c0,U_ as d,Dt as e,z2 as f,xm as g,Co as h,ga as i,gV as j,Ii as k,Ai as l,Fe as m,s0 as n,co as o,qn as p,HN as q,Ox as r,q as s,Dx as t,br as u,Nx as v,Mx as w,Lx as x,Ss as y,_S as z};