const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StoriesPage-Bl2OFTVW.js","assets/query-vendor-CZu0EHPe.js","assets/react-vendor-0bvDbF03.js","assets/StoryDetailModal-CB9i7458.js","assets/card-D40LNz3V.js","assets/AnimatedStoryCard-DsLjlIt3.js","assets/sesl-badge-utils-BvAx6z8X.js","assets/i18n-vendor-Bg2yf_Zw.js","assets/book-check-D02-ja-B.js","assets/bookmark-BnIfQKxi.js","assets/clock-B05Dt00p.js","assets/file-text-D_DFRGbz.js","assets/slider-BQh8dOK0.js","assets/chevron-left-CKAz3TZR.js","assets/input-QrEzZ2Kj.js","assets/collapsible-DwZ3Qc3c.js","assets/index-agfYBZow.js","assets/use-mobile-BN2Z-RJr.js","assets/BreadcrumbNavigation-BWgeUPuQ.js","assets/skeleton-C-n3jjwO.js","assets/search-egzyNwuL.js","assets/rotate-ccw-DpNqx_Ne.js","assets/supabase-vendor-CNV44oIa.js","assets/helmet-vendor-NlTFkN97.js","assets/TextCheckerPage-DTst4tjt.js","assets/story-generation-service-BI9lcRJV.js","assets/textarea-BNpbRKEE.js","assets/copy-D4l60pd5.js","assets/chart-column-DajYvaE2.js","assets/generateCategoricalChart-CpCwWfm1.js","assets/YAxis-CpBzICtw.js","assets/sesl-algorithm-BAniGVfW.js","assets/ShareCard-BH6yxY14.js","assets/refresh-ccw-BXxmeoiR.js","assets/ResearchPage-CXdmJRbk.js","assets/table-PX3WxLTH.js","assets/download-DlI21y6i.js","assets/sparkles-DrWq7S2X.js","assets/mail-WVGmmO9a.js","assets/ProfessionalNarrationSection-C9KLvgrM.js","assets/SyncedHighlightsSection-DPfTITbN.js","assets/useIOSAudioContext-DtqQj9l7.js","assets/InteractiveWordsSection-MYk7FUnj.js","assets/VocabularySection-B_VpZKXP.js","assets/ChooseYourPaceSection-BA6wn0SF.js","assets/turtle-DiLWGoxE.js","assets/DyslexiaSection-_0NCSwbW.js","assets/CheckTextSection-BfVMRdRH.js","assets/ThemesSection-CyXLRbEh.js","assets/ExploreThemesButton-Ce2ciB_3.js","assets/compass-CObRFO3L.js","assets/StoryMakerSection-IQRMtbAz.js","assets/AchievementsSection-CtV1RtRJ.js","assets/HotAirBalloon-BCdkKMX_.js","assets/QuillWipe-CM9YxekO.js","assets/index.es-C3Wz79fL.js","assets/StoryReaderPage-xKb8AAzg.js","assets/arrow-left-CqikjySp.js","assets/switch-CdG2LuDq.js","assets/useStoryData-Cq-JNTYZ.js","assets/azure-speech-service-CbujlT-D.js","assets/UpgradeButton-C58S1Mjq.js","assets/volume-x-uaS21utv.js","assets/play-CAP8wOw6.js","assets/volume-2-Lvy141rI.js","assets/xp-service-Bdmwe2B2.js","assets/progress-C-pPFIfy.js","assets/refresh-cw-CbXZtBWI.js","assets/seo-utils-BPWtL0tc.js","assets/AboutPage-IIa2tQhY.js","assets/CreateFreeAccountButton-DDeD32Gf.js","assets/ContactPage-CF2T9cVb.js","assets/accordion-C8B9Ouqe.js","assets/SocialIcons-DWGIwkB0.js","assets/circle-check-big-CNaQZIgz.js","assets/ImproveReadingPage-Bs8XtpV5.js","assets/eye-CWs3Ztse.js","assets/users-7CAO4wI2.js","assets/party-popper-nHrF1E8N.js","assets/calendar-check-DVkl9YLP.js","assets/WatchPage-B2GZ_nfn.js","assets/VideoCard-dRVafy1j.js","assets/WatchVideoPage-3Qx8t1c_.js","assets/AuthPages-ClsAgOTy.js","assets/checkbox-JwCy9tpr.js","assets/eye-off-CiBl2Wgd.js","assets/ResetPasswordPage-BcaaU7fA.js","assets/VerifyEmailPage-DCeIMZg8.js","assets/NotFound-CvervQqV.js","assets/ProgressPage-DXTYNW2S.js","assets/zap-9qyrjmc7.js","assets/format-B9FvFmC1.js","assets/calendar-CHVL32l6.js","assets/ReadingCartPage-FszXtRwj.js","assets/VocabularyNotebookPage-l-UoG4yM.js","assets/alert-dialog-CHgEzbEF.js","assets/trash-2-C65F78hW.js","assets/AdminPage-B3C3vkF2.js","assets/separator-CQq2C-Cm.js","assets/CurrencySelector-BA9NmGPG.js","assets/circle-x-fh5a3uJe.js","assets/useBlogData-DbZ9rvby.js","assets/purify.es-D9RiKzGB.js","assets/tabs-0uryOBIJ.js","assets/alert-RF_yG2s6.js","assets/image-B4kH4s5_.js","assets/FontManagementPage-C2dhMGHX.js","assets/TermsPage-8nrethF0.js","assets/PrivacyPage-CQ6Tn2c7.js","assets/RefundPage-C0JKVm67.js","assets/SubscriptionPage-bndbxa7b.js","assets/PaymentStatusPage-DEL3Zgy6.js","assets/ThemeInfoPage-BtlvTJ5n.js","assets/BlogPage-ChcoLkOR.js","assets/BlogCard-cZrxXzCE.js","assets/BlogPostPage-BNdcwXiL.js","assets/NewsletterPage-BPr1yFI1.js","assets/StoryMakerPage-DXtjuGzk.js"])))=>i.map(i=>d[i]);
import{j as o,Q as Rb,a as Ab}from"./query-vendor-CZu0EHPe.js";import{b as hs,R as M,r as h,d as bm,e as Cb,u as su,f as ps,L as de,B as Ib,h as Ob,i as v}from"./react-vendor-0bvDbF03.js";import{c as Db,_}from"./supabase-vendor-CNV44oIa.js";import{H as Lb,a as Nb}from"./helmet-vendor-NlTFkN97.js";import{i as wm,a as Mb,u as Ce}from"./i18n-vendor-Bg2yf_Zw.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Em,Kd=hs;Em=Kd.createRoot,Kd.hydrateRoot;class jm extends M.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 Vb=1,Fb=1e6;let za=0;function $b(){return za=(za+1)%Number.MAX_SAFE_INTEGER,za.toString()}const Ha=new Map,qd=t=>{if(Ha.has(t))return;const e=setTimeout(()=>{Ha.delete(t),Zs({type:"REMOVE_TOAST",toastId:t})},Fb);Ha.set(t,e)},Bb=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Vb)};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(r=>{qd(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}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 Zs(t){mi=Bb(mi,t),fi.forEach(e=>{e(mi)})}function Ub({...t}){const e=$b(),n=s=>Zs({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Zs({type:"DISMISS_TOAST",toastId:e});return Zs({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Tm(){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:Ub,dismiss:n=>Zs({type:"DISMISS_TOAST",toastId:n})}}function H(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}function zb(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function ia(...t){return e=>t.forEach(n=>zb(n,e))}function _e(...t){return h.useCallback(ia(...t),t)}function Hb(t,e=[]){let n=[];function r(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:m,...y}=p,g=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(g.Provider,{value:x,children:m})}function d(p,f){const m=f?.[t][c]||l,y=h.useContext(m);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 s=()=>{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 s.scopeName=t,[r,Wb(s,...e)]}function Wb(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.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,...r}=t,s=h.Children.toArray(n),i=s.find(Gb);if(i){const a=i.props.children,l=s.map(c=>c===i?h.Children.count(a)>1?h.Children.only(null):h.isValidElement(a)?a.props.children:null:c);return o.jsx(Vl,{...r,ref:e,children:h.isValidElement(a)?h.cloneElement(a,void 0,l):null})}return o.jsx(Vl,{...r,ref:e,children:n})});Jn.displayName="Slot";var Vl=h.forwardRef((t,e)=>{const{children:n,...r}=t;if(h.isValidElement(n)){const s=qb(n);return h.cloneElement(n,{...Kb(r,n.props),ref:e?ia(e,s):s})}return h.Children.count(n)>1?h.Children.only(null):null});Vl.displayName="SlotClone";var Pm=({children:t})=>o.jsx(o.Fragment,{children:t});function Gb(t){return h.isValidElement(t)&&t.type===Pm}function Kb(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{i(...l),s(...l)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function qb(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 aa(t){const e=t+"CollectionProvider",[n,r]=Hb(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:y,children:g}=m,x=M.useRef(null),b=M.useRef(new Map).current;return o.jsx(s,{scope:y,itemMap:b,collectionRef:x,children:g})};a.displayName=e;const l=t+"CollectionSlot",c=M.forwardRef((m,y)=>{const{scope:g,children:x}=m,b=i(l,g),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=M.forwardRef((m,y)=>{const{scope:g,children:x,...b}=m,w=M.useRef(null),E=_e(y,w),T=i(u,g);return M.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(m){const y=i(t+"CollectionConsumer",m);return M.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,r]}function Yb(t,e){const n=h.createContext(e),r=i=>{const{children:a,...l}=i,c=h.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})};r.displayName=t+"Provider";function s(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[r,s]}function Er(t,e=[]){let n=[];function r(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];const u=p=>{const{scope:f,children:m,...y}=p,g=f?.[t]?.[c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(g.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(p,f){const m=f?.[t]?.[c]||l,y=h.useContext(m);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{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 s.scopeName=t,[r,Xb(s,...e)]}function Xb(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.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 Zb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],te=Zb.reduce((t,e)=>{const n=h.forwardRef((r,s)=>{const{asChild:i,...a}=r,l=i?Jn:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function ou(t,e){t&&hs.flushSync(()=>t.dispatchEvent(e))}function qe(t){const e=h.useRef(t);return h.useEffect(()=>{e.current=t}),h.useMemo(()=>(...n)=>e.current?.(...n),[])}function Jb(t,e=globalThis?.document){const n=qe(t);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Qb="DismissableLayer",Fl="dismissableLayer.update",ew="dismissableLayer.pointerDownOutside",tw="dismissableLayer.focusOutside",Yd,Sm=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fs=h.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=t,u=h.useContext(Sm),[d,p]=h.useState(null),f=d?.ownerDocument??globalThis?.document,[,m]=h.useState({}),y=_e(e,S=>p(S)),g=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(x),w=d?g.indexOf(d):-1,E=u.layersWithOutsidePointerEventsDisabled.size>0,T=w>=b,j=rw(S=>{const k=S.target,O=[...u.branches].some(R=>R.contains(k));!T||O||(s?.(S),a?.(S),S.defaultPrevented||l?.())},f),P=sw(S=>{const k=S.target;[...u.branches].some(R=>R.contains(k))||(i?.(S),a?.(S),S.defaultPrevented||l?.())},f);return Jb(S=>{w===u.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yd=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Xd(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Yd)}},[d,f,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Xd())},[d,u]),h.useEffect(()=>{const S=()=>m({});return document.addEventListener(Fl,S),()=>document.removeEventListener(Fl,S)},[]),o.jsx(te.div,{...c,ref:y,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:H(t.onFocusCapture,P.onFocusCapture),onBlurCapture:H(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:H(t.onPointerDownCapture,j.onPointerDownCapture)})});fs.displayName=Qb;var nw="DismissableLayerBranch",km=h.forwardRef((t,e)=>{const n=h.useContext(Sm),r=h.useRef(null),s=_e(e,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),o.jsx(te.div,{...t,ref:s})});km.displayName=nw;function rw(t,e=globalThis?.document){const n=qe(t),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){Rm(ew,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function sw(t,e=globalThis?.document){const n=qe(t),r=h.useRef(!1);return h.useEffect(()=>{const s=i=>{i.target&&!r.current&&Rm(tw,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Xd(){const t=new CustomEvent(Fl);document.dispatchEvent(t)}function Rm(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?ou(s,i):s.dispatchEvent(i)}var ow=fs,iw=km,He=globalThis?.document?h.useLayoutEffect:()=>{},aw="Portal",ms=h.forwardRef((t,e)=>{const{container:n,...r}=t,[s,i]=h.useState(!1);He(()=>i(!0),[]);const a=n||s&&globalThis?.document?.body;return a?bm.createPortal(o.jsx(te.div,{...r,ref:e}),a):null});ms.displayName=aw;function lw(t,e){return h.useReducer((n,r)=>e[n][r]??n,t)}var tn=t=>{const{present:e,children:n}=t,r=cw(e),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=_e(r.ref,uw(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:i}):null};tn.displayName="Presence";function cw(t){const[e,n]=h.useState(),r=h.useRef({}),s=h.useRef(t),i=h.useRef("none"),a=t?"mounted":"unmounted",[l,c]=lw(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=qo(r.current);i.current=l==="mounted"?u:"none"},[l]),He(()=>{const u=r.current,d=s.current;if(d!==t){const f=i.current,m=qo(u);t?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),He(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,p=m=>{const g=qo(r.current).includes(m.animationName);if(m.target===e&&g&&(c("ANIMATION_END"),!s.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},f=m=>{m.target===e&&(i.current=qo(r.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&&(r.current=getComputedStyle(u)),n(u)},[])}}function qo(t){return t?.animationName||"none"}function uw(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 vr({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,s]=dw({defaultProp:e,onChange:n}),i=t!==void 0,a=i?t:r,l=qe(n),c=h.useCallback(u=>{if(i){const p=typeof u=="function"?u(t):u;p!==t&&l(p)}else s(u)},[i,t,s,l]);return[a,c]}function dw({defaultProp:t,onChange:e}){const n=h.useState(t),[r]=n,s=h.useRef(r),i=qe(e);return h.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}var hw="VisuallyHidden",Oo=h.forwardRef((t,e)=>o.jsx(te.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=hw;var pw=Oo,iu="ToastProvider",[au,fw,mw]=aa("Toast"),[Am,HM]=Er("Toast",[mw]),[gw,la]=Am(iu),Cm=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="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 \`${iu}\`. Expected non-empty \`string\`.`),o.jsx(au.Provider,{scope:e,children:o.jsx(gw,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>d(m=>m+1),[]),onToastRemove:h.useCallback(()=>d(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:f,children:a})})};Cm.displayName=iu;var Im="ToastViewport",vw=["F8"],$l="toast.viewportPause",Bl="toast.viewportResume",Om=h.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=vw,label:s="Notifications ({hotkey})",...i}=t,a=la(Im,n),l=fw(n),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),p=h.useRef(null),f=_e(e,p,a.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;h.useEffect(()=>{const x=b=>{r.length!==0&&r.every(E=>b[E]||b.code===E)&&p.current?.focus()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),h.useEffect(()=>{const x=c.current,b=p.current;if(y&&x&&b){const w=()=>{if(!a.isClosePausedRef.current){const P=new CustomEvent($l);b.dispatchEvent(P),a.isClosePausedRef.current=!0}},E=()=>{if(a.isClosePausedRef.current){const P=new CustomEvent(Bl);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 g=h.useCallback(({tabbingDirection:x})=>{const w=l().map(E=>{const T=E.ref.current,j=[T,...Aw(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=g({tabbingDirection:P?"backwards":"forwards"}),R=O.findIndex(N=>N===j);Wa(O.slice(R+1))?w.preventDefault():P?u.current?.focus():d.current?.focus()}};return x.addEventListener("keydown",b),()=>x.removeEventListener("keydown",b)}},[l,g]),o.jsxs(iw,{ref:c,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(Ul,{ref:u,onFocusFromOutsideViewport:()=>{const x=g({tabbingDirection:"forwards"});Wa(x)}}),o.jsx(au.Slot,{scope:n,children:o.jsx(te.ol,{tabIndex:-1,...i,ref:f})}),y&&o.jsx(Ul,{ref:d,onFocusFromOutsideViewport:()=>{const x=g({tabbingDirection:"backwards"});Wa(x)}})]})});Om.displayName=Im;var Dm="ToastFocusProxy",Ul=h.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=la(Dm,n);return o.jsx(Oo,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});Ul.displayName=Dm;var ca="Toast",_w="toast.swipeStart",yw="toast.swipeMove",xw="toast.swipeCancel",bw="toast.swipeEnd",Lm=h.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l=!0,c]=vr({prop:r,defaultProp:s,onChange:i});return o.jsx(tn,{present:n||l,children:o.jsx(jw,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:qe(t.onPause),onResume:qe(t.onResume),onSwipeStart:H(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:H(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:H(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:H(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)})})})});Lm.displayName=ca;var[ww,Ew]=Am(ca,{onClose(){}}),jw=h.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:p,onSwipeCancel:f,onSwipeEnd:m,...y}=t,g=la(ca,n),[x,b]=h.useState(null),w=_e(e,D=>b(D)),E=h.useRef(null),T=h.useRef(null),j=s||g.duration,P=h.useRef(0),S=h.useRef(j),k=h.useRef(0),{onToastAdd:O,onToastRemove:R}=g,N=qe(()=>{x?.contains(document.activeElement)&&g.viewport?.focus(),a()}),L=h.useCallback(D=>{!D||D===1/0||(window.clearTimeout(k.current),P.current=new Date().getTime(),k.current=window.setTimeout(N,D))},[N]);h.useEffect(()=>{const D=g.viewport;if(D){const K=()=>{L(S.current),u?.()},V=()=>{const U=new Date().getTime()-P.current;S.current=S.current-U,window.clearTimeout(k.current),c?.()};return D.addEventListener($l,V),D.addEventListener(Bl,K),()=>{D.removeEventListener($l,V),D.removeEventListener(Bl,K)}}},[g.viewport,j,c,u,L]),h.useEffect(()=>{i&&!g.isClosePausedRef.current&&L(j)},[i,j,g.isClosePausedRef,L]),h.useEffect(()=>(O(),()=>R()),[O,R]);const q=h.useMemo(()=>x?Um(x):null,[x]);return g.viewport?o.jsxs(o.Fragment,{children:[q&&o.jsx(Tw,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:q}),o.jsx(ww,{scope:n,onClose:N,children:hs.createPortal(o.jsx(au.ItemSlot,{scope:n,children:o.jsx(ow,{asChild:!0,onEscapeKeyDown:H(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||N(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(te.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection,...y,ref:w,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:H(t.onKeyDown,D=>{D.key==="Escape"&&(l?.(D.nativeEvent),D.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:H(t.onPointerDown,D=>{D.button===0&&(E.current={x:D.clientX,y:D.clientY})}),onPointerMove:H(t.onPointerMove,D=>{if(!E.current)return;const K=D.clientX-E.current.x,V=D.clientY-E.current.y,U=!!T.current,C=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,ee=C?I(0,K):0,Y=C?0:I(0,V),X=D.pointerType==="touch"?10:2,J={x:ee,y:Y},oe={originalEvent:D,delta:J};U?(T.current=J,Yo(yw,p,oe,{discrete:!1})):Zd(J,g.swipeDirection,X)?(T.current=J,Yo(_w,d,oe,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(K)>X||Math.abs(V)>X)&&(E.current=null)}),onPointerUp:H(t.onPointerUp,D=>{const K=T.current,V=D.target;if(V.hasPointerCapture(D.pointerId)&&V.releasePointerCapture(D.pointerId),T.current=null,E.current=null,K){const U=D.currentTarget,C={originalEvent:D,delta:K};Zd(K,g.swipeDirection,g.swipeThreshold)?Yo(bw,m,C,{discrete:!0}):Yo(xw,f,C,{discrete:!0}),U.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),Tw=t=>{const{__scopeToast:e,children:n,...r}=t,s=la(ca,e),[i,a]=h.useState(!1),[l,c]=h.useState(!1);return kw(()=>a(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:o.jsx(ms,{asChild:!0,children:o.jsx(Oo,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},Pw="ToastTitle",Nm=h.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(te.div,{...r,ref:e})});Nm.displayName=Pw;var Sw="ToastDescription",Mm=h.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(te.div,{...r,ref:e})});Mm.displayName=Sw;var Vm="ToastAction",Fm=h.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(Bm,{altText:n,asChild:!0,children:o.jsx(lu,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${Vm}\`. Expected non-empty \`string\`.`),null)});Fm.displayName=Vm;var $m="ToastClose",lu=h.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=Ew($m,n);return o.jsx(Bm,{asChild:!0,children:o.jsx(te.button,{type:"button",...r,ref:e,onClick:H(t.onClick,s.onClose)})})});lu.displayName=$m;var Bm=h.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(te.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function Um(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),Rw(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...Um(r))}}),e}function Yo(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?ou(s,i):s.dispatchEvent(i)}var Zd=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function kw(t=()=>{}){const e=qe(t);He(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function Rw(t){return t.nodeType===t.ELEMENT_NODE}function Aw(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Wa(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var Cw=Cm,zm=Om,Hm=Lm,Wm=Nm,Gm=Mm,Km=Fm,qm=lu;function Ym(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=Ym(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function cu(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Ym(t))&&(r&&(r+=" "),r+=e);return r}const Jd=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qd=cu,ua=(t,e)=>n=>{var r;if(e?.variants==null)return Qd(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(u=>{const d=n?.[u],p=i?.[u];if(d===null)return null;const f=Jd(d)||Jd(p);return s[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||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:p,className:f,...m}=d;return Object.entries(m).every(y=>{let[g,x]=y;return Array.isArray(x)?x.includes({...i,...l}[g]):{...i,...l}[g]===x})?[...u,p,f]:u},[]);return Qd(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 Iw=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ow=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),eh=t=>{const e=Ow(t);return e.charAt(0).toUpperCase()+e.slice(1)},Xm=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),Dw=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 Lw={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 Nw=h.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...l},c)=>h.createElement("svg",{ref:c,...Lw,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Xm("lucide",s),...!i&&!Dw(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 he=(t,e)=>{const n=h.forwardRef(({className:r,...s},i)=>h.createElement(Nw,{ref:i,iconNode:e,className:Xm(`lucide-${Iw(eh(t))}`,`lucide-${t}`,r),...s}));return n.displayName=eh(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 Mw=[["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"}]],Vw=he("baby",Mw);/**
* @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 Fw=[["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"}]],$w=he("blocks",Fw);/**
* @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 Bw=[["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"}]],Uw=he("book-open",Bw);/**
* @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=[["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"}]],th=he("camera",zw);/**
* @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 Hw=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],uu=he("check",Hw);/**
* @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:"m6 9 6 6 6-6",key:"qrunsl"}]],Zm=he("chevron-down",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 Gw=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Kw=he("chevron-right",Gw);/**
* @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:"m18 15-6-6-6 6",key:"153udz"}]],Yw=he("chevron-up",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Zw=he("circle",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:"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"}]],js=he("crown",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:"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"}]],e1=he("earth",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 t1=[["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"}]],n1=he("file-check",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 r1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],s1=he("gauge",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 o1=[["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"}]],Jm=he("heart",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=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],a1=he("house",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],c1=he("info",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 u1=[["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"}]],nh=he("key-round",u1);/**
* @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:"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"}]],h1=he("languages",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=[["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"}]],f1=he("library-big",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:"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"}]],g1=he("lightbulb",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:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],rh=he("loader-circle",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:"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"}]],Qm=he("log-in",_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 y1=[["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"}]],sh=he("log-out",y1);/**
* @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:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],b1=he("menu",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 w1=[["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"}]],E1=he("message-circle-question-mark",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 j1=[["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"}]],T1=he("notebook-pen",j1);/**
* @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 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"}]],S1=he("palette",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 k1=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],R1=he("smartphone",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 A1=[["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"}]],C1=he("spell-check",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:"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"}]],O1=he("trophy",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:"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"}]],oh=he("upload",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 L1=[["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"}]],N1=he("user",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 M1=[["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"}]],eg=he("wand-sparkles",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:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],da=he("x",V1),du="-",F1=t=>{const e=B1(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const l=a.split(du);return l[0]===""&&l.length!==1&&l.shift(),tg(l,e)||$1(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&r[a]?[...c,...r[a]]:c}}},tg=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?tg(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(du);return e.validators.find(({validator:a})=>a(i))?.classGroupId},ih=/^\[(.+)\]$/,$1=t=>{if(ih.test(t)){const e=ih.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},B1=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return z1(Object.entries(t.classGroups),n).forEach(([i,a])=>{zl(a,r,i,e)}),r},zl=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:ah(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(U1(s)){zl(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,a])=>{zl(a,ah(e,i),n,r)})})},ah=(t,e)=>{let n=t;return e.split(du).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},U1=t=>t.isThemeGetter,z1=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[e+a,l])):i);return[n,s]}):t,H1=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,a)=>{n.set(i,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return s(i,a),a},set(i,a){n.has(i)?n.set(i,a):s(i,a)}}},ng="!",W1=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=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===s&&(r||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),m=f.startsWith(ng),y=m?f.substring(1):f,g=p&&p>d?p-d:void 0;return{modifiers:c,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:a}):a},G1=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},K1=t=>({cache:H1(t.cacheSize),parseClassName:W1(t),...F1(t)}),q1=/\s+/,Y1=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],a=t.trim().split(q1);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:m}=n(u);let y=!!m,g=r(y?f.substring(0,m):f);if(!g){if(!y){l=u+(l.length>0?" "+l:l);continue}if(g=r(f),!g){l=u+(l.length>0?" "+l:l);continue}y=!1}const x=G1(d).join(":"),b=p?x+ng:x,w=b+g;if(i.includes(w))continue;i.push(w);const E=s(g,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 X1(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=rg(e))&&(r&&(r+=" "),r+=n);return r}const rg=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=rg(t[r]))&&(n&&(n+=" "),n+=e);return n};function Z1(t,...e){let n,r,s,i=a;function a(c){const u=e.reduce((d,p)=>p(d),t());return n=K1(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=Y1(c,n);return s(c,d),d}return function(){return i(X1.apply(null,arguments))}}const Te=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},sg=/^\[(?:([a-z-]+):)?(.+)\]$/i,J1=/^\d+\/\d+$/,Q1=new Set(["px","full","screen"]),eE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tE=/\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$/,nE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,rE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sn=t=>Yr(t)||Q1.has(t)||J1.test(t),Bn=t=>gs(t,"length",hE),Yr=t=>!!t&&!Number.isNaN(Number(t)),Ga=t=>gs(t,"number",Yr),Ts=t=>!!t&&Number.isInteger(Number(t)),oE=t=>t.endsWith("%")&&Yr(t.slice(0,-1)),se=t=>sg.test(t),Un=t=>eE.test(t),iE=new Set(["length","size","percentage"]),aE=t=>gs(t,iE,og),lE=t=>gs(t,"position",og),cE=new Set(["image","url"]),uE=t=>gs(t,cE,fE),dE=t=>gs(t,"",pE),Ps=()=>!0,gs=(t,e,n)=>{const r=sg.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},hE=t=>tE.test(t)&&!nE.test(t),og=()=>!1,pE=t=>rE.test(t),fE=t=>sE.test(t),mE=()=>{const t=Te("colors"),e=Te("spacing"),n=Te("blur"),r=Te("brightness"),s=Te("borderColor"),i=Te("borderRadius"),a=Te("borderSpacing"),l=Te("borderWidth"),c=Te("contrast"),u=Te("grayscale"),d=Te("hueRotate"),p=Te("invert"),f=Te("gap"),m=Te("gradientColorStops"),y=Te("gradientColorStopPositions"),g=Te("inset"),x=Te("margin"),b=Te("opacity"),w=Te("padding"),E=Te("saturate"),T=Te("scale"),j=Te("sepia"),P=Te("skew"),S=Te("space"),k=Te("translate"),O=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",se,e],L=()=>[se,e],q=()=>["",Sn,Bn],D=()=>["auto",Yr,se],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],C=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",se],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[Yr,se];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[Sn,Bn],blur:["none","",Un,se],brightness:Y(),borderColor:[t],borderRadius:["none","","full",Un,se],borderSpacing:L(),borderWidth:q(),contrast:Y(),grayscale:I(),hueRotate:Y(),invert:I(),gap:L(),gradientColorStops:[t],gradientColorStopPositions:[oE,Bn],inset:N(),margin:N(),opacity:Y(),padding:L(),saturate:Y(),scale:Y(),sepia:I(),skew:Y(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",se]}],container:["container"],columns:[{columns:[Un]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"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:[...K(),se]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ts,se]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",se]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Ts,se]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Ts,se]},se]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Ts,se]},se]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",se]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",se]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...C()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...C(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...C(),"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":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",se,e]}],"min-w":[{"min-w":[se,e,"min","max","fit"]}],"max-w":[{"max-w":[se,e,"none","full","min","max","fit","prose",{screen:[Un]},Un]}],h:[{h:[se,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[se,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[se,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[se,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Un,Bn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ga]}],"font-family":[{font:[Ps]}],"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",se]}],"line-clamp":[{"line-clamp":["none",Yr,Ga]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sn,se]}],"list-image":[{"list-image":["none",se]}],"list-style-type":[{list:["none","disc","decimal",se]}],"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:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sn,Bn]}],"underline-offset":[{"underline-offset":["auto",Sn,se]}],"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",se]}],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",se]}],"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:[...K(),lE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",aE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},uE]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],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:[...V(),"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:V()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Sn,se]}],"outline-w":[{outline:[Sn,Bn]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Sn,Bn]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Un,dE]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Un,se]}],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":[r]}],"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",se]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",se]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",se]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ts,se]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"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",se]}],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",se]}],"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",se]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sn,Bn,Ga]}],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"]}}},gE=Z1(mE);function ae(...t){return gE(cu(t))}const vE=Cw,ig=h.forwardRef(({className:t,...e},n)=>o.jsx(zm,{ref:n,className:ae("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}));ig.displayName=zm.displayName;const _E=ua("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"}}),ag=h.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(Hm,{ref:r,className:ae(_E({variant:e}),t),...n}));ag.displayName=Hm.displayName;const yE=h.forwardRef(({className:t,...e},n)=>o.jsx(Km,{ref:n,className:ae("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}));yE.displayName=Km.displayName;const lg=h.forwardRef(({className:t,...e},n)=>o.jsx(qm,{ref:n,className:ae("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(da,{className:"h-4 w-4"})}));lg.displayName=qm.displayName;const cg=h.forwardRef(({className:t,...e},n)=>o.jsx(Wm,{ref:n,className:ae("text-sm font-semibold",t),...e}));cg.displayName=Wm.displayName;const ug=h.forwardRef(({className:t,...e},n)=>o.jsx(Gm,{ref:n,className:ae("text-sm opacity-90",t),...e}));ug.displayName=Gm.displayName;function xE(){const{toasts:t}=Tm();return o.jsxs(vE,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(ag,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(cg,{children:n}),r&&o.jsx(ug,{children:r})]}),s,o.jsx(lg,{})]},e)}),o.jsx(ig,{})]})}var lh=["light","dark"],bE="(prefers-color-scheme: dark)",wE=h.createContext(void 0),EE={setTheme:t=>{},themes:[]},jE=()=>{var t;return(t=h.useContext(wE))!=null?t:EE};h.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,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=s?lh.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,g=!1,x=!0)=>{let b=a?a[y]:y,w=g?y+"|| ''":`'${b}'`,E="";return s&&x&&!g&&lh.includes(y)&&(E+=`d.style.colorScheme = '${y}';`),n==="class"?g||b?E+=`c.add(${w})`:E+="null":b&&(E+=`d[s](n,${w})`),E},m=t?`!function(){${d}${f(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${bE}',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:m}})});var TE=t=>{switch(t){case"success":return kE;case"info":return AE;case"warning":return RE;case"error":return CE;default:return null}},PE=Array(12).fill(0),SE=({visible:t})=>M.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},M.createElement("div",{className:"sonner-spinner"},PE.map((e,n)=>M.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),kE=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.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"})),RE=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},M.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"})),AE=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.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"})),CE=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.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"})),IE=()=>{let[t,e]=M.useState(document.hidden);return M.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Hl=1,OE=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:r,...s}=e,i=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Hl++,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:r}),{...c,...e,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({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 r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let s=e instanceof Promise?e:e(),i=r!==void 0;return s.then(async a=>{if(LE(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:r,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:r,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:r,type:"error",message:l,description:c})}}).finally(()=>{var a;i&&(this.dismiss(r),r=void 0),(a=n.finally)==null||a.call(n)}),r},this.custom=(e,n)=>{let r=n?.id||Hl++;return this.create({jsx:e(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Nt=new OE,DE=(t,e)=>{let n=e?.id||Hl++;return Nt.addToast({title:t,...e,id:n}),n},LE=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",NE=DE,ME=()=>Nt.toasts,dn=Object.assign(NE,{success:Nt.success,info:Nt.info,warning:Nt.warning,error:Nt.error,custom:Nt.custom,message:Nt.message,promise:Nt.promise,dismiss:Nt.dismiss,loading:Nt.loading},{getHistory:ME});function VE(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}VE(`: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 FE=3,$E="32px",BE=4e3,UE=356,zE=14,HE=20,WE=200;function GE(...t){return t.filter(Boolean).join(" ")}var KE=t=>{var e,n,r,s,i,a,l,c,u,d;let{invert:p,toast:f,unstyled:m,interacting:y,setHeights:g,visibleToasts:x,heights:b,index:w,toasts:E,expanded:T,removeToast:j,defaultRichColors:P,closeButton:S,style:k,cancelButtonStyle:O,actionButtonStyle:R,className:N="",descriptionClassName:L="",duration:q,position:D,gap:K,loadingIcon:V,expandByDefault:U,classNames:C,icons:I,closeButtonAriaLabel:ee="Close toast",pauseWhenPageIsHidden:Y,cn:X}=t,[J,oe]=M.useState(!1),[Se,ne]=M.useState(!1),[G,pe]=M.useState(!1),[ke,ie]=M.useState(!1),[ye,xe]=M.useState(0),[Be,Ot]=M.useState(0),Tn=M.useRef(null),Dt=M.useRef(null),Pn=w===0,bb=w+1<=x,Bt=f.type,Rr=f.dismissible!==!1,wb=f.className||"",Eb=f.descriptionClassName||"",Go=M.useMemo(()=>b.findIndex(re=>re.toastId===f.id)||0,[b,f.id]),jb=M.useMemo(()=>{var re;return(re=f.closeButton)!=null?re:S},[f.closeButton,S]),Ud=M.useMemo(()=>f.duration||q||BE,[f.duration,q]),Ba=M.useRef(0),Ar=M.useRef(0),zd=M.useRef(0),Cr=M.useRef(null),[Hd,Tb]=D.split("-"),Wd=M.useMemo(()=>b.reduce((re,je,we)=>we>=Go?re:re+je.height,0),[b,Go]),Gd=IE(),Pb=f.invert||p,Ua=Bt==="loading";Ar.current=M.useMemo(()=>Go*K+Wd,[Go,Wd]),M.useEffect(()=>{oe(!0)},[]),M.useLayoutEffect(()=>{if(!J)return;let re=Dt.current,je=re.style.height;re.style.height="auto";let we=re.getBoundingClientRect().height;re.style.height=je,Ot(we),g(sn=>sn.find(on=>on.toastId===f.id)?sn.map(on=>on.toastId===f.id?{...on,height:we}:on):[{toastId:f.id,height:we,position:f.position},...sn])},[J,f.title,f.description,g,f.id]);let $n=M.useCallback(()=>{ne(!0),xe(Ar.current),g(re=>re.filter(je=>je.toastId!==f.id)),setTimeout(()=>{j(f)},WE)},[f,j,g,Ar]);M.useEffect(()=>{if(f.promise&&Bt==="loading"||f.duration===1/0||f.type==="loading")return;let re,je=Ud;return T||y||Y&&Gd?(()=>{if(zd.current<Ba.current){let we=new Date().getTime()-Ba.current;je=je-we}zd.current=new Date().getTime()})():je!==1/0&&(Ba.current=new Date().getTime(),re=setTimeout(()=>{var we;(we=f.onAutoClose)==null||we.call(f,f),$n()},je)),()=>clearTimeout(re)},[T,y,U,f,Ud,$n,f.promise,Bt,Y,Gd]),M.useEffect(()=>{let re=Dt.current;if(re){let je=re.getBoundingClientRect().height;return Ot(je),g(we=>[{toastId:f.id,height:je,position:f.position},...we]),()=>g(we=>we.filter(sn=>sn.toastId!==f.id))}},[g,f.id]),M.useEffect(()=>{f.delete&&$n()},[$n,f.delete]);function Sb(){return I!=null&&I.loading?M.createElement("div",{className:"sonner-loader","data-visible":Bt==="loading"},I.loading):V?M.createElement("div",{className:"sonner-loader","data-visible":Bt==="loading"},V):M.createElement(SE,{visible:Bt==="loading"})}return M.createElement("li",{"aria-live":f.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Dt,className:X(N,wb,C?.toast,(e=f?.classNames)==null?void 0:e.toast,C?.default,C?.[Bt],(n=f?.classNames)==null?void 0:n[Bt]),"data-sonner-toast":"","data-rich-colors":(r=f.richColors)!=null?r:P,"data-styled":!(f.jsx||f.unstyled||m),"data-mounted":J,"data-promise":!!f.promise,"data-removed":Se,"data-visible":bb,"data-y-position":Hd,"data-x-position":Tb,"data-index":w,"data-front":Pn,"data-swiping":G,"data-dismissible":Rr,"data-type":Bt,"data-invert":Pb,"data-swipe-out":ke,"data-expanded":!!(T||U&&J),style:{"--index":w,"--toasts-before":w,"--z-index":E.length-w,"--offset":`${Se?ye:Ar.current}px`,"--initial-height":U?"auto":`${Be}px`,...k,...f.style},onPointerDown:re=>{Ua||!Rr||(Tn.current=new Date,xe(Ar.current),re.target.setPointerCapture(re.pointerId),re.target.tagName!=="BUTTON"&&(pe(!0),Cr.current={x:re.clientX,y:re.clientY}))},onPointerUp:()=>{var re,je,we,sn;if(ke||!Rr)return;Cr.current=null;let on=Number(((re=Dt.current)==null?void 0:re.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Ko=new Date().getTime()-((je=Tn.current)==null?void 0:je.getTime()),kb=Math.abs(on)/Ko;if(Math.abs(on)>=HE||kb>.11){xe(Ar.current),(we=f.onDismiss)==null||we.call(f,f),$n(),ie(!0);return}(sn=Dt.current)==null||sn.style.setProperty("--swipe-amount","0px"),pe(!1)},onPointerMove:re=>{var je;if(!Cr.current||!Rr)return;let we=re.clientY-Cr.current.y,sn=re.clientX-Cr.current.x,on=(Hd==="top"?Math.min:Math.max)(0,we),Ko=re.pointerType==="touch"?10:2;Math.abs(on)>Ko?(je=Dt.current)==null||je.style.setProperty("--swipe-amount",`${we}px`):Math.abs(sn)>Ko&&(Cr.current=null)}},jb&&!f.jsx?M.createElement("button",{"aria-label":ee,"data-disabled":Ua,"data-close-button":!0,onClick:Ua||!Rr?()=>{}:()=>{var re;$n(),(re=f.onDismiss)==null||re.call(f,f)},className:X(C?.closeButton,(s=f?.classNames)==null?void 0:s.closeButton)},M.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"},M.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),M.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,f.jsx||M.isValidElement(f.title)?f.jsx||f.title:M.createElement(M.Fragment,null,Bt||f.icon||f.promise?M.createElement("div",{"data-icon":"",className:X(C?.icon,(i=f?.classNames)==null?void 0:i.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Sb():null,f.type!=="loading"?f.icon||I?.[Bt]||TE(Bt):null):null,M.createElement("div",{"data-content":"",className:X(C?.content,(a=f?.classNames)==null?void 0:a.content)},M.createElement("div",{"data-title":"",className:X(C?.title,(l=f?.classNames)==null?void 0:l.title)},f.title),f.description?M.createElement("div",{"data-description":"",className:X(L,Eb,C?.description,(c=f?.classNames)==null?void 0:c.description)},f.description):null),M.isValidElement(f.cancel)?f.cancel:f.cancel&&Xo(f.cancel)?M.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||O,onClick:re=>{var je,we;Xo(f.cancel)&&Rr&&((we=(je=f.cancel).onClick)==null||we.call(je,re),$n())},className:X(C?.cancelButton,(u=f?.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,M.isValidElement(f.action)?f.action:f.action&&Xo(f.action)?M.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||R,onClick:re=>{var je,we;Xo(f.action)&&(re.defaultPrevented||((we=(je=f.action).onClick)==null||we.call(je,re),$n()))},className:X(C?.actionButton,(d=f?.classNames)==null?void 0:d.actionButton)},f.action.label):null))};function ch(){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 qE=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:i,className:a,offset:l,theme:c="light",richColors:u,duration:d,style:p,visibleToasts:f=FE,toastOptions:m,dir:y=ch(),gap:g=zE,loadingIcon:x,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:E,cn:T=GE}=t,[j,P]=M.useState([]),S=M.useMemo(()=>Array.from(new Set([n].concat(j.filter(Y=>Y.position).map(Y=>Y.position)))),[j,n]),[k,O]=M.useState([]),[R,N]=M.useState(!1),[L,q]=M.useState(!1),[D,K]=M.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=M.useRef(null),U=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=M.useRef(null),I=M.useRef(!1),ee=M.useCallback(Y=>{var X;(X=j.find(J=>J.id===Y.id))!=null&&X.delete||Nt.dismiss(Y.id),P(J=>J.filter(({id:oe})=>oe!==Y.id))},[j]);return M.useEffect(()=>Nt.subscribe(Y=>{if(Y.dismiss){P(X=>X.map(J=>J.id===Y.id?{...J,delete:!0}:J));return}setTimeout(()=>{bm.flushSync(()=>{P(X=>{let J=X.findIndex(oe=>oe.id===Y.id);return J!==-1?[...X.slice(0,J),{...X[J],...Y},...X.slice(J+1)]:[Y,...X]})})})}),[]),M.useEffect(()=>{if(c!=="system"){K(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Y})=>{K(Y?"dark":"light")})},[c]),M.useEffect(()=>{j.length<=1&&N(!1)},[j]),M.useEffect(()=>{let Y=X=>{var J,oe;r.every(Se=>X[Se]||X.code===Se)&&(N(!0),(J=V.current)==null||J.focus()),X.code==="Escape"&&(document.activeElement===V.current||(oe=V.current)!=null&&oe.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[r]),M.useEffect(()=>{if(V.current)return()=>{C.current&&(C.current.focus({preventScroll:!0}),C.current=null,I.current=!1)}},[V.current]),j.length?M.createElement("section",{"aria-label":`${w} ${U}`,tabIndex:-1},S.map((Y,X)=>{var J;let[oe,Se]=Y.split("-");return M.createElement("ol",{key:Y,dir:y==="auto"?ch():y,tabIndex:-1,ref:V,className:a,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":oe,"data-x-position":Se,style:{"--front-toast-height":`${((J=k[0])==null?void 0:J.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||$E,"--width":`${UE}px`,"--gap":`${g}px`,...p},onBlur:ne=>{I.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(I.current=!1,C.current&&(C.current.focus({preventScroll:!0}),C.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||I.current||(I.current=!0,C.current=ne.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{L||N(!1)},onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},j.filter(ne=>!ne.position&&X===0||ne.position===Y).map((ne,G)=>{var pe,ke;return M.createElement(KE,{key:ne.id,icons:b,index:G,toast:ne,defaultRichColors:u,duration:(pe=m?.duration)!=null?pe:d,className:m?.className,descriptionClassName:m?.descriptionClassName,invert:e,visibleToasts:f,closeButton:(ke=m?.closeButton)!=null?ke:i,interacting:L,position:Y,style:m?.style,unstyled:m?.unstyled,classNames:m?.classNames,cancelButtonStyle:m?.cancelButtonStyle,actionButtonStyle:m?.actionButtonStyle,removeToast:ee,toasts:j.filter(ie=>ie.position==ne.position),heights:k.filter(ie=>ie.position==ne.position),setHeights:O,expandByDefault:s,gap:g,loadingIcon:x,expanded:R,pauseWhenPageIsHidden:E,cn:T})}))})):null};const YE=({...t})=>{const{theme:e="system"}=jE();return o.jsx(qE,{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 XE=Cb.useId||(()=>{}),ZE=0;function mn(t){const[e,n]=h.useState(XE());return He(()=>{n(r=>r??String(ZE++))},[t]),e?`radix-${e}`:""}const JE=["top","right","bottom","left"],Qn=Math.min,Mt=Math.max,Ri=Math.round,Zo=Math.floor,er=t=>({x:t,y:t}),QE={left:"right",right:"left",bottom:"top",top:"bottom"},ej={start:"end",end:"start"};function Wl(t,e,n){return Mt(t,Qn(e,n))}function Nn(t,e){return typeof t=="function"?t(e):t}function Mn(t){return t.split("-")[0]}function vs(t){return t.split("-")[1]}function hu(t){return t==="x"?"y":"x"}function pu(t){return t==="y"?"height":"width"}function tr(t){return["top","bottom"].includes(Mn(t))?"y":"x"}function fu(t){return hu(tr(t))}function tj(t,e,n){n===void 0&&(n=!1);const r=vs(t),s=fu(t),i=pu(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Ai(a)),[a,Ai(a)]}function nj(t){const e=Ai(t);return[Gl(t),e,Gl(e)]}function Gl(t){return t.replace(/start|end/g,e=>ej[e])}function rj(t,e,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:r:e?r:s;case"left":case"right":return e?i:a;default:return[]}}function sj(t,e,n,r){const s=vs(t);let i=rj(Mn(t),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(Gl)))),i}function Ai(t){return t.replace(/left|right|bottom|top/g,e=>QE[e])}function oj(t){return{top:0,right:0,bottom:0,left:0,...t}}function dg(t){return typeof t!="number"?oj(t):{top:t,right:t,bottom:t,left:t}}function Ci(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function uh(t,e,n){let{reference:r,floating:s}=t;const i=tr(e),a=fu(e),l=pu(a),c=Mn(e),u=i==="y",d=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-s.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:p};break;case"left":m={x:r.x-s.width,y:p};break;default:m={x:r.x,y:r.y}}switch(vs(e)){case"start":m[a]-=f*(n&&u?-1:1);break;case"end":m[a]+=f*(n&&u?-1:1);break}return m}const ij=async(t,e,n)=>{const{placement:r="bottom",strategy:s="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:s}),{x:d,y:p}=uh(u,r,c),f=r,m={},y=0;for(let g=0;g<l.length;g++){const{name:x,fn:b}=l[g],{x:w,y:E,data:T,reset:j}=await b({x:d,y:p,initialPlacement:r,placement:f,strategy:s,middlewareData:m,rects:u,platform:a,elements:{reference:t,floating:e}});d=w??d,p=E??p,m={...m,[x]:{...m[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:s}):j.rects),{x:d,y:p}=uh(u,f,c)),g=-1)}return{x:d,y:p,placement:f,strategy:s,middlewareData:m}};async function po(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Nn(e,t),y=dg(m),x=l[f?p==="floating"?"reference":"floating":p],b=Ci(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:r,y:s,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=Ci(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 aj=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=Nn(t,e)||{};if(u==null)return{};const p=dg(d),f={x:n,y:r},m=fu(s),y=pu(m),g=await a.getDimensions(u),x=m==="y",b=x?"top":"left",w=x?"bottom":"right",E=x?"clientHeight":"clientWidth",T=i.reference[y]+i.reference[m]-f[m]-i.floating[y],j=f[m]-i.reference[m],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let S=P?P[E]:0;(!S||!await(a.isElement==null?void 0:a.isElement(P)))&&(S=l.floating[E]||i.floating[y]);const k=T/2-j/2,O=S/2-g[y]/2-1,R=Qn(p[b],O),N=Qn(p[w],O),L=R,q=S-g[y]-N,D=S/2-g[y]/2+k,K=Wl(L,D,q),V=!c.arrow&&vs(s)!=null&&D!==K&&i.reference[y]/2-(D<L?R:N)-g[y]/2<0,U=V?D<L?D-L:D-q:0;return{[m]:f[m]+U,data:{[m]:K,centerOffset:D-K-U,...V&&{alignmentOffset:U}},reset:V}}}),lj=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...x}=Nn(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Mn(s),w=tr(l),E=Mn(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=f||(E||!g?[Ai(l)]:nj(l)),P=y!=="none";!f&&P&&j.push(...sj(l,g,y,T));const S=[l,...j],k=await po(e,x),O=[];let R=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&O.push(k[b]),p){const D=tj(s,a,T);O.push(k[D[0]],k[D[1]])}if(R=[...R,{placement:s,overflows:O}],!O.every(D=>D<=0)){var N,L;const D=(((N=i.flip)==null?void 0:N.index)||0)+1,K=S[D];if(K)return{data:{index:D,overflows:R},reset:{placement:K}};let V=(L=R.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:L.placement;if(!V)switch(m){case"bestFit":{var q;const U=(q=R.filter(C=>{if(P){const I=tr(C.placement);return I===w||I==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(I=>I>0).reduce((I,ee)=>I+ee,0)]).sort((C,I)=>C[1]-I[1])[0])==null?void 0:q[0];U&&(V=U);break}case"initialPlacement":V=l;break}if(s!==V)return{reset:{placement:V}}}return{}}}};function dh(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function hh(t){return JE.some(e=>t[e]>=0)}const cj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=Nn(t,e);switch(r){case"referenceHidden":{const i=await po(e,{...s,elementContext:"reference"}),a=dh(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:hh(a)}}}case"escaped":{const i=await po(e,{...s,altBoundary:!0}),a=dh(i,n.floating);return{data:{escapedOffsets:a,escaped:hh(a)}}}default:return{}}}}};async function uj(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Mn(n),l=vs(n),c=tr(n)==="y",u=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,p=Nn(e,t);let{mainAxis:f,crossAxis:m,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"&&(m=l==="end"?y*-1:y),c?{x:m*d,y:f*u}:{x:f*u,y:m*d}}const dj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=e,c=await uj(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},hj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=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:r},d=await po(e,c),p=tr(Mn(s)),f=hu(p);let m=u[f],y=u[p];if(i){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+d[x],E=m-d[b];m=Wl(w,m,E)}if(a){const x=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=y+d[x],E=y-d[b];y=Wl(w,y,E)}const g=l.fn({...e,[f]:m,[p]:y});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:i,[p]:a}}}}}},pj=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:a}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Nn(t,e),d={x:n,y:r},p=tr(s),f=hu(p);let m=d[f],y=d[p];const g=Nn(l,e),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};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;m<T?m=T:m>j&&(m=j)}if(u){var b,w;const E=f==="y"?"width":"height",T=["top","left"].includes(Mn(s)),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]:m,[p]:y}}}},fj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:a,elements:l}=e,{apply:c=()=>{},...u}=Nn(t,e),d=await po(e,u),p=Mn(s),f=vs(s),m=tr(s)==="y",{width:y,height:g}=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=g-d.top-d.bottom,E=y-d.left-d.right,T=Qn(g-d[x],w),j=Qn(y-d[b],E),P=!e.middlewareData.shift;let S=T,k=j;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=w),P&&!f){const R=Mt(d.left,0),N=Mt(d.right,0),L=Mt(d.top,0),q=Mt(d.bottom,0);m?k=y-2*(R!==0||N!==0?R+N:Mt(d.left,d.right)):S=g-2*(L!==0||q!==0?L+q:Mt(d.top,d.bottom))}await c({...e,availableWidth:k,availableHeight:S});const O=await a.getDimensions(l.floating);return y!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function ha(){return typeof window<"u"}function _s(t){return hg(t)?(t.nodeName||"").toLowerCase():"#document"}function Ft(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function jn(t){var e;return(e=(hg(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hg(t){return ha()?t instanceof Node||t instanceof Ft(t).Node:!1}function Jt(t){return ha()?t instanceof Element||t instanceof Ft(t).Element:!1}function bn(t){return ha()?t instanceof HTMLElement||t instanceof Ft(t).HTMLElement:!1}function ph(t){return!ha()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ft(t).ShadowRoot}function Do(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Qt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function mj(t){return["table","td","th"].includes(_s(t))}function pa(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function mu(t){const e=gu(),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(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function gj(t){let e=nr(t);for(;bn(e)&&!ts(e);){if(mu(e))return e;if(pa(e))return null;e=nr(e)}return null}function gu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ts(t){return["html","body","#document"].includes(_s(t))}function Qt(t){return Ft(t).getComputedStyle(t)}function fa(t){return Jt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nr(t){if(_s(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ph(t)&&t.host||jn(t);return ph(e)?e.host:e}function pg(t){const e=nr(t);return ts(e)?t.ownerDocument?t.ownerDocument.body:t.body:bn(e)&&Do(e)?e:pg(e)}function fo(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=pg(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),a=Ft(s);if(i){const l=Kl(a);return e.concat(a,a.visualViewport||[],Do(s)?s:[],l&&n?fo(l):[])}return e.concat(s,fo(s,[],n))}function Kl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function fg(t){const e=Qt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=bn(t),i=s?t.offsetWidth:n,a=s?t.offsetHeight:r,l=Ri(n)!==i||Ri(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function vu(t){return Jt(t)?t:t.contextElement}function Xr(t){const e=vu(t);if(!bn(e))return er(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=fg(e);let a=(i?Ri(n.width):n.width)/r,l=(i?Ri(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const vj=er(0);function mg(t){const e=Ft(t);return!gu()||!e.visualViewport?vj:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _j(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ft(t)?!1:e}function _r(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=vu(t);let a=er(1);e&&(r?Jt(r)&&(a=Xr(r)):a=Xr(t));const l=_j(i,n,r)?mg(i):er(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,d=s.width/a.x,p=s.height/a.y;if(i){const f=Ft(i),m=r&&Jt(r)?Ft(r):r;let y=f,g=Kl(y);for(;g&&r&&m!==y;){const x=Xr(g),b=g.getBoundingClientRect(),w=Qt(g),E=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*x.x,T=b.top+(g.clientTop+parseFloat(w.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,p*=x.y,c+=E,u+=T,y=Ft(g),g=Kl(y)}}return Ci({width:d,height:p,x:c,y:u})}function yj(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",a=jn(r),l=e?pa(e.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=er(1);const d=er(0),p=bn(r);if((p||!p&&!i)&&((_s(r)!=="body"||Do(a))&&(c=fa(r)),bn(r))){const f=_r(r);u=Xr(r),d.x=f.x+r.clientLeft,d.y=f.y+r.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 xj(t){return Array.from(t.getClientRects())}function ql(t,e){const n=fa(t).scrollLeft;return e?e.left+n:_r(jn(t)).left+n}function bj(t){const e=jn(t),n=fa(t),r=t.ownerDocument.body,s=Mt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Mt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ql(t);const l=-n.scrollTop;return Qt(r).direction==="rtl"&&(a+=Mt(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}function wj(t,e){const n=Ft(t),r=jn(t),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const u=gu();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:a,x:l,y:c}}function Ej(t,e){const n=_r(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=bn(t)?Xr(t):er(1),a=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:a,height:l,x:c,y:u}}function fh(t,e,n){let r;if(e==="viewport")r=wj(t,n);else if(e==="document")r=bj(jn(t));else if(Jt(e))r=Ej(e,n);else{const s=mg(t);r={...e,x:e.x-s.x,y:e.y-s.y}}return Ci(r)}function gg(t,e){const n=nr(t);return n===e||!Jt(n)||ts(n)?!1:Qt(n).position==="fixed"||gg(n,e)}function jj(t,e){const n=e.get(t);if(n)return n;let r=fo(t,[],!1).filter(l=>Jt(l)&&_s(l)!=="body"),s=null;const i=Qt(t).position==="fixed";let a=i?nr(t):t;for(;Jt(a)&&!ts(a);){const l=Qt(a),c=mu(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Do(a)&&!c&&gg(t,a))?r=r.filter(d=>d!==a):s=l,a=nr(a)}return e.set(t,r),r}function Tj(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const a=[...n==="clippingAncestors"?pa(e)?[]:jj(e,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const p=fh(e,d,s);return u.top=Mt(p.top,u.top),u.right=Qn(p.right,u.right),u.bottom=Qn(p.bottom,u.bottom),u.left=Mt(p.left,u.left),u},fh(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Pj(t){const{width:e,height:n}=fg(t);return{width:e,height:n}}function Sj(t,e,n){const r=bn(e),s=jn(e),i=n==="fixed",a=_r(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=er(0);if(r||!r&&!i)if((_s(e)!=="body"||Do(s))&&(l=fa(e)),r){const m=_r(e,!0,i,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else s&&(c.x=ql(s));let u=0,d=0;if(s&&!r&&!i){const m=s.getBoundingClientRect();d=m.top+l.scrollTop,u=m.left+l.scrollLeft-ql(s,m)}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 Ka(t){return Qt(t).position==="static"}function mh(t,e){if(!bn(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 vg(t,e){const n=Ft(t);if(pa(t))return n;if(!bn(t)){let s=nr(t);for(;s&&!ts(s);){if(Jt(s)&&!Ka(s))return s;s=nr(s)}return n}let r=mh(t,e);for(;r&&mj(r)&&Ka(r);)r=mh(r,e);return r&&ts(r)&&Ka(r)&&!mu(r)?n:r||gj(t)||n}const kj=async function(t){const e=this.getOffsetParent||vg,n=this.getDimensions,r=await n(t.floating);return{reference:Sj(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rj(t){return Qt(t).direction==="rtl"}const Aj={convertOffsetParentRelativeRectToViewportRelativeRect:yj,getDocumentElement:jn,getClippingRect:Tj,getOffsetParent:vg,getElementRects:kj,getClientRects:xj,getDimensions:Pj,getScale:Xr,isElement:Jt,isRTL:Rj};function Cj(t,e){let n=null,r;const s=jn(t);function i(){var l;clearTimeout(r),(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 m=Zo(d),y=Zo(s.clientWidth-(u+p)),g=Zo(s.clientHeight-(d+f)),x=Zo(u),w={rootMargin:-m+"px "+-y+"px "+-g+"px "+-x+"px",threshold:Mt(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):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{n=new IntersectionObserver(T,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(T,w)}n.observe(t)}return a(!0),i}function Ij(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=vu(t),d=s||i?[...u?fo(u):[],...fo(e)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const p=u&&l?Cj(u,n):null;let f=-1,m=null;a&&(m=new ResizeObserver(b=>{let[w]=b;w&&w.target===u&&m&&(m.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(e)})),n()}),u&&!c&&m.observe(u),m.observe(e));let y,g=c?_r(t):null;c&&x();function x(){const b=_r(t);g&&(b.x!==g.x||b.y!==g.y||b.width!==g.width||b.height!==g.height)&&n(),g=b,y=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),p?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const Oj=dj,Dj=hj,Lj=lj,Nj=fj,Mj=cj,gh=aj,Vj=pj,Fj=(t,e,n)=>{const r=new Map,s={platform:Aj,...n},i={...s.platform,_c:r};return ij(t,e,{...s,platform:i})};var gi=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Ii(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,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Ii(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Ii(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function _g(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function vh(t,e){const n=_g(t);return Math.round(e*n)/n}function qa(t){const e=h.useRef(t);return gi(()=>{e.current=t}),e}function $j(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,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,m]=h.useState(r);Ii(f,r)||m(r);const[y,g]=h.useState(null),[x,b]=h.useState(null),w=h.useCallback(C=>{C!==P.current&&(P.current=C,g(C))},[]),E=h.useCallback(C=>{C!==S.current&&(S.current=C,b(C))},[]),T=i||y,j=a||x,P=h.useRef(null),S=h.useRef(null),k=h.useRef(d),O=c!=null,R=qa(c),N=qa(s),L=qa(u),q=h.useCallback(()=>{if(!P.current||!S.current)return;const C={placement:e,strategy:n,middleware:f};N.current&&(C.platform=N.current),Fj(P.current,S.current,C).then(I=>{const ee={...I,isPositioned:L.current!==!1};D.current&&!Ii(k.current,ee)&&(k.current=ee,hs.flushSync(()=>{p(ee)}))})},[f,e,n,N,L]);gi(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,p(C=>({...C,isPositioned:!1})))},[u]);const D=h.useRef(!1);gi(()=>(D.current=!0,()=>{D.current=!1}),[]),gi(()=>{if(T&&(P.current=T),j&&(S.current=j),T&&j){if(R.current)return R.current(T,j,q);q()}},[T,j,q,R,O]);const K=h.useMemo(()=>({reference:P,floating:S,setReference:w,setFloating:E}),[w,E]),V=h.useMemo(()=>({reference:T,floating:j}),[T,j]),U=h.useMemo(()=>{const C={position:n,left:0,top:0};if(!V.floating)return C;const I=vh(V.floating,d.x),ee=vh(V.floating,d.y);return l?{...C,transform:"translate("+I+"px, "+ee+"px)",..._g(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:ee}},[n,l,V.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:q,refs:K,elements:V,floatingStyles:U}),[d,q,K,V,U])}const Bj=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?gh({element:r.current,padding:s}).fn(n):{}:r?gh({element:r,padding:s}).fn(n):{}}}},Uj=(t,e)=>({...Oj(t),options:[t,e]}),zj=(t,e)=>({...Dj(t),options:[t,e]}),Hj=(t,e)=>({...Vj(t),options:[t,e]}),Wj=(t,e)=>({...Lj(t),options:[t,e]}),Gj=(t,e)=>({...Nj(t),options:[t,e]}),Kj=(t,e)=>({...Mj(t),options:[t,e]}),qj=(t,e)=>({...Bj(t),options:[t,e]});var Yj="Arrow",yg=h.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return o.jsx(te.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});yg.displayName=Yj;var Xj=yg;function Zj(t,e=[]){let n=[];function r(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:m,...y}=p,g=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(g.Provider,{value:x,children:m})}function d(p,f){const m=f?.[t][c]||l,y=h.useContext(m);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 s=()=>{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 s.scopeName=t,[r,Jj(s,...e)]}function Jj(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.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 Qj(t){const[e,n]=h.useState(void 0);return He(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[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 r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var _u="Popper",[xg,ys]=Zj(_u),[eT,bg]=xg(_u),wg=t=>{const{__scopePopper:e,children:n}=t,[r,s]=h.useState(null);return o.jsx(eT,{scope:e,anchor:r,onAnchorChange:s,children:n})};wg.displayName=_u;var Eg="PopperAnchor",jg=h.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=bg(Eg,n),a=h.useRef(null),l=_e(e,a);return h.useEffect(()=>{i.onAnchorChange(r?.current||a.current)}),r?null:o.jsx(te.div,{...s,ref:l})});jg.displayName=Eg;var yu="PopperContent",[tT,nT]=xg(yu),Tg=h.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=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:m="optimized",onPlaced:y,...g}=t,x=bg(yu,n),[b,w]=h.useState(null),E=_e(e,G=>w(G)),[T,j]=h.useState(null),P=Qj(T),S=P?.width??0,k=P?.height??0,O=r+(i!=="center"?"-"+i:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},N=Array.isArray(u)?u:[u],L=N.length>0,q={padding:R,boundary:N.filter(sT),altBoundary:L},{refs:D,floatingStyles:K,placement:V,isPositioned:U,middlewareData:C}=$j({strategy:"fixed",placement:O,whileElementsMounted:(...G)=>Ij(...G,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[Uj({mainAxis:s+k,alignmentAxis:a}),c&&zj({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Hj():void 0,...q}),c&&Wj({...q}),Gj({...q,apply:({elements:G,rects:pe,availableWidth:ke,availableHeight:ie})=>{const{width:ye,height:xe}=pe.reference,Be=G.floating.style;Be.setProperty("--radix-popper-available-width",`${ke}px`),Be.setProperty("--radix-popper-available-height",`${ie}px`),Be.setProperty("--radix-popper-anchor-width",`${ye}px`),Be.setProperty("--radix-popper-anchor-height",`${xe}px`)}}),T&&qj({element:T,padding:l}),oT({arrowWidth:S,arrowHeight:k}),f&&Kj({strategy:"referenceHidden",...q})]}),[I,ee]=kg(V),Y=qe(y);He(()=>{U&&Y?.()},[U,Y]);const X=C.arrow?.x,J=C.arrow?.y,oe=C.arrow?.centerOffset!==0,[Se,ne]=h.useState();return He(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),o.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:U?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Se,"--radix-popper-transform-origin":[C.transformOrigin?.x,C.transformOrigin?.y].join(" "),...C.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(tT,{scope:n,placedSide:I,onArrowChange:j,arrowX:X,arrowY:J,shouldHideArrow:oe,children:o.jsx(te.div,{"data-side":I,"data-align":ee,...g,ref:E,style:{...g.style,animation:U?void 0:"none"}})})})});Tg.displayName=yu;var Pg="PopperArrow",rT={top:"bottom",right:"left",bottom:"top",left:"right"},Sg=h.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=nT(Pg,r),a=rT[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(Xj,{...s,ref:n,style:{...s.style,display:"block"}})})});Sg.displayName=Pg;function sT(t){return t!==null}var oT=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:s}=e,a=s.arrow?.centerOffset!==0,l=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[u,d]=kg(n),p={start:"0%",center:"50%",end:"100%"}[d],f=(s.arrow?.x??0)+l/2,m=(s.arrow?.y??0)+c/2;let y="",g="";return u==="bottom"?(y=a?p:`${f}px`,g=`${-c}px`):u==="top"?(y=a?p:`${f}px`,g=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,g=a?p:`${m}px`):u==="left"&&(y=`${r.floating.width+c}px`,g=a?p:`${m}px`),{data:{x:y,y:g}}}});function kg(t){const[e,n="center"]=t.split("-");return[e,n]}var xu=wg,bu=jg,wu=Tg,Eu=Sg,[ma,GM]=Er("Tooltip",[ys]),ga=ys(),Rg="TooltipProvider",iT=700,Yl="tooltip.open",[aT,ju]=ma(Rg),Ag=t=>{const{__scopeTooltip:e,delayDuration:n=iT,skipDelayDuration:r=300,disableHoverableContent:s=!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(aT,{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),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:i})};Ag.displayName=Rg;var va="Tooltip",[lT,Lo]=ma(va),Cg=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=ju(va,t.__scopeTooltip),u=ga(e),[d,p]=h.useState(null),f=mn(),m=h.useRef(0),y=a??c.disableHoverableContent,g=l??c.delayDuration,x=h.useRef(!1),[b=!1,w]=vr({prop:r,defaultProp:s,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(Yl))):c.onClose(),i?.(S)}}),E=h.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),T=h.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x.current=!1,w(!0)},[w]),j=h.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),P=h.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,w(!0),m.current=0},g)},[g,w]);return h.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),o.jsx(xu,{...u,children:o.jsx(lT,{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(m.current),m.current=0)},[j,y]),onOpen:T,onClose:j,disableHoverableContent:y,children:n})})};Cg.displayName=va;var Xl="TooltipTrigger",Ig=h.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Lo(Xl,n),i=ju(Xl,n),a=ga(n),l=h.useRef(null),c=_e(e,l,s.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(bu,{asChild:!0,...a,children:o.jsx(te.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:H(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:H(t.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:H(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:H(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:H(t.onBlur,s.onClose),onClick:H(t.onClick,s.onClose)})})});Ig.displayName=Xl;var Tu="TooltipPortal",[cT,uT]=ma(Tu,{forceMount:void 0}),Og=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Lo(Tu,e);return o.jsx(cT,{scope:e,forceMount:n,children:o.jsx(tn,{present:n||i.open,children:o.jsx(ms,{asChild:!0,container:s,children:r})})})};Og.displayName=Tu;var ns="TooltipContent",Dg=h.forwardRef((t,e)=>{const n=uT(ns,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Lo(ns,t.__scopeTooltip);return o.jsx(tn,{present:r||a.open,children:a.disableHoverableContent?o.jsx(Lg,{side:s,...i,ref:e}):o.jsx(dT,{side:s,...i,ref:e})})}),dT=h.forwardRef((t,e)=>{const n=Lo(ns,t.__scopeTooltip),r=ju(ns,t.__scopeTooltip),s=h.useRef(null),i=_e(e,s),[a,l]=h.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:p}=r,f=h.useCallback(()=>{l(null),p(!1)},[p]),m=h.useCallback((y,g)=>{const x=y.currentTarget,b={x:y.clientX,y:y.clientY},w=mT(b,x.getBoundingClientRect()),E=gT(b,w),T=vT(g.getBoundingClientRect()),j=yT([...E,...T]);l(j),p(!0)},[p]);return h.useEffect(()=>()=>f(),[f]),h.useEffect(()=>{if(c&&d){const y=x=>m(x,d),g=x=>m(x,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",g)}}},[c,d,m,f]),h.useEffect(()=>{if(a){const y=g=>{const x=g.target,b={x:g.clientX,y:g.clientY},w=c?.contains(x)||d?.contains(x),E=!_T(b,a);w?f():E&&(f(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,a,u,f]),o.jsx(Lg,{...t,ref:i})}),[hT,pT]=ma(va,{isInside:!1}),Lg=h.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Lo(ns,n),u=ga(n),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(Yl,d),()=>document.removeEventListener(Yl,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(fs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:o.jsxs(wu,{"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(Pm,{children:r}),o.jsx(hT,{scope:n,isInside:!0,children:o.jsx(pw,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Dg.displayName=ns;var Ng="TooltipArrow",fT=h.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=ga(n);return pT(Ng,n).isInside?null:o.jsx(Eu,{...s,...r,ref:e})});fT.displayName=Ng;function mT(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function gT(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function vT(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function _T(t,e){const{x:n,y:r}=t;let s=!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>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function yT(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xT(e)}function xT(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}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 bT=Ag,wT=Cg,ET=Ig,jT=Og,Mg=Dg;const TT=bT,PT=wT,ST=ET,Vg=h.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(jT,{children:o.jsx(Mg,{ref:r,sideOffset:e,className:ae("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})}));Vg.displayName=Mg.displayName;const kT="https://pldrgdplxacehsmcyjnx.supabase.co",RT="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBsZHJnZHBseGFjZWhzbWN5am54Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDM0MzU5MzEsImV4cCI6MjA1OTAxMTkzMX0.YnKo7pfbjg52NF6TL2pNilHkND5ZgkhbDuAtC_-IQL4",W=Db(kT,RT),KM=async()=>{try{const{data:t,error:e}=await W.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}},qM=async(t,e,n)=>{try{console.log("Creating Stripe subscription for plan:",t,"currency:",n);const{data:r,error:s}=await W.functions.invoke("create-checkout",{body:{planType:t,currentLanguage:e||"en",currency:n||"GBP"}});if(s)throw console.error("Error creating Stripe subscription:",s),new Error(s.message||"Failed to create Stripe subscription");if(!r||!r.url)throw console.error("No URL returned from Stripe subscription:",r),new Error("Invalid response from server");return console.log("Stripe subscription created successfully:",r),r}catch(r){const s=r instanceof Error?r.message:String(r);throw console.error("Error in Stripe subscription service:",s),r}},YM=async()=>{try{console.log("Creating customer portal session");const{data:t,error:e}=await W.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}},AT=async(t=!1)=>{try{console.log("Checking subscription status",t?"(force refresh)":"");const{data:e,error:n}=await W.functions.invoke("check-subscription",{body:t?{forceRefresh:!0,timestamp:new Date().getTime()}:void 0});if(n){const r=n.message||"";if(r.includes("401")||r.includes("Invalid user token")||r.includes("Unauthorized"))return console.warn("Session expired during subscription check, returning null"),null;throw console.error("Error checking subscription status:",n),new Error(r||"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 A=typeof window<"u"?window:void 0,Ke=typeof globalThis<"u"?globalThis:A;typeof self>"u"&&(Ke.self=Ke),typeof File>"u"&&(Ke.File=function(){});var Fg=Array.prototype,_h=Fg.forEach,yh=Fg.indexOf,Vt=Ke?.navigator,F=Ke?.document,Ge=Ke?.location,Zl=Ke?.fetch,Jl=Ke!=null&&Ke.XMLHttpRequest&&"withCredentials"in new Ke.XMLHttpRequest?Ke.XMLHttpRequest:void 0,xh=Ke?.AbortController,At=Vt?.userAgent,Z=A??{},An={DEBUG:!1,LIB_VERSION:"1.354.0"};function bh(t,e,n,r,s,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(r,s)}function Cn(t){return function(){var e=this,n=arguments;return new Promise(function(r,s){var i=t.apply(e,n);function a(c){bh(i,r,s,a,l,"next",c)}function l(c){bh(i,r,s,a,l,"throw",c)}a(void 0)})}}function $(){return $=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$.apply(null,arguments)}function $g(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var CT=["$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"],IT=["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"],wh=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return IT.concat(e).some(r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1})};function le(t,e){return t.indexOf(e)!==-1}var _a=function(t){return t.trim()},Ql=function(t){return t.replace(/^\$/,"")},OT=Array.isArray,Bg=Object.prototype,Ug=Bg.hasOwnProperty,ya=Bg.toString,ve=OT||function(t){return ya.call(t)==="[object Array]"},On=t=>typeof t=="function",$e=t=>t===Object(t)&&!ve(t),Br=t=>{if($e(t)){for(var e in t)if(Ug.call(t,e))return!1;return!0}return!1},B=t=>t===void 0,Fe=t=>ya.call(t)=="[object String]",ec=t=>Fe(t)&&t.trim().length===0,nn=t=>t===null,ce=t=>B(t)||nn(t),Vn=t=>ya.call(t)=="[object Number]"&&t==t,Vr=t=>Vn(t)&&t>0,Ln=t=>ya.call(t)==="[object Boolean]",DT=t=>t instanceof FormData,LT=t=>le(CT,t);function tc(t){return t===null||typeof t!="object"}function Oi(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function zg(t){return!B(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var NT=[!0,"true",1,"1","yes"],Ya=t=>le(NT,t),MT=[!1,"false",0,"0","no"];function hn(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),Vn(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),hn(s||n,e,n,r))}class VT{constructor(e){this.t={},this.i=e.i,this.o=hn(e.bucketSize,0,100,e.h),this.m=hn(e.refillRate,0,this.o,e.h),this.$=hn(e.refillInterval,0,864e5,e.h)}S(e,n){var r=n-e.lastAccess,s=Math.floor(r/this.$);if(s>0){var i=s*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var n,r=Date.now(),s=String(e),i=this.t[s];return i?this.S(i,r):(i={tokens:this.o,lastAccess:r},this.t[s]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.i)==null||n.call(this,e)),i.tokens===0)}stop(){this.t={}}}var Wt="Mobile",Di="iOS",Dn="Android",mo="Tablet",Hg=Dn+" "+mo,Wg="iPad",Gg="Apple",Kg=Gg+" Watch",go="Safari",rs="BlackBerry",qg="Samsung",Yg=qg+"Browser",Xg=qg+" Internet",yr="Chrome",FT=yr+" OS",Zg=yr+" "+Di,Pu="Internet Explorer",Jg=Pu+" "+Wt,Su="Opera",$T=Su+" Mini",ku="Edge",Qg="Microsoft "+ku,Zr="Firefox",ev=Zr+" "+Di,vo="Nintendo",_o="PlayStation",Jr="Xbox",tv=Dn+" "+Wt,nv=Wt+" "+go,Ms="Windows",nc=Ms+" Phone",Eh="Nokia",rc="Ouya",rv="Generic",BT=rv+" "+Wt.toLowerCase(),sv=rv+" "+mo.toLowerCase(),sc="Konqueror",St="(\\d+(\\.\\d+)?)",Xa=new RegExp("Version/"+St),UT=new RegExp(Jr,"i"),zT=new RegExp(_o+" \\w+","i"),HT=new RegExp(vo+" \\w+","i"),Ru=new RegExp(rs+"|PlayBook|BB10","i"),WT={"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,jh,Za,GT=(t,e)=>e&&le(e,Gg)||function(n){return le(n,go)&&!le(n,yr)&&!le(n,Dn)}(t),ov=function(t,e){return e=e||"",le(t," OPR/")&&le(t,"Mini")?$T:le(t," OPR/")?Su:Ru.test(t)?rs:le(t,"IE"+Wt)||le(t,"WPDesktop")?Jg:le(t,Yg)?Xg:le(t,ku)||le(t,"Edg/")?Qg:le(t,"FBIOS")?"Facebook "+Wt:le(t,"UCWEB")||le(t,"UCBrowser")?"UC Browser":le(t,"CriOS")?Zg:le(t,"CrMo")||le(t,yr)?yr:le(t,Dn)&&le(t,go)?tv:le(t,"FxiOS")?ev:le(t.toLowerCase(),sc.toLowerCase())?sc:GT(t,e)?le(t,Wt)?nv:go:le(t,Zr)?Zr:le(t,"MSIE")||le(t,"Trident/")?Pu:le(t,"Gecko")?Zr:""},KT={[Jg]:[new RegExp("rv:"+St)],[Qg]:[new RegExp(ku+"?\\/"+St)],[yr]:[new RegExp("("+yr+"|CrMo)\\/"+St)],[Zg]:[new RegExp("CriOS\\/"+St)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+St)],[go]:[Xa],[nv]:[Xa],[Su]:[new RegExp("(Opera|OPR)\\/"+St)],[Zr]:[new RegExp(Zr+"\\/"+St)],[ev]:[new RegExp("FxiOS\\/"+St)],[sc]:[new RegExp("Konqueror[:/]?"+St,"i")],[rs]:[new RegExp(rs+" "+St),Xa],[tv]:[new RegExp("android\\s"+St,"i")],[Xg]:[new RegExp(Yg+"\\/"+St)],[Pu]:[new RegExp("(rv:|MSIE )"+St)],Mozilla:[new RegExp("rv:"+St)]},qT=function(t,e){var n=ov(t,e),r=KT[n];if(B(r))return null;for(var s=0;s<r.length;s++){var i=r[s],a=t.match(i);if(a)return parseFloat(a[a.length-2])}return null},Th=[[new RegExp(Jr+"; "+Jr+" (.*?)[);]","i"),t=>[Jr,t&&t[1]||""]],[new RegExp(vo,"i"),[vo,""]],[new RegExp(_o,"i"),[_o,""]],[Ru,[rs,""]],[new RegExp(Ms,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[nc,""];if(new RegExp(Wt).test(e)&&!/IEMobile\b/.test(e))return[Ms+" "+Wt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],s=WT[r]||"";return/arm/i.test(e)&&(s="RT"),[Ms,s]}return[Ms,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Di,e.join(".")]}return[Di,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=B(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/,[FT,""]],[/Linux|debian/i,["Linux",""]]],Ph=function(t){return HT.test(t)?vo:zT.test(t)?_o:UT.test(t)?Jr:new RegExp(rc,"i").test(t)?rc:new RegExp("("+nc+"|WPDesktop)","i").test(t)?nc:/iPad/.test(t)?Wg:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Kg:Ru.test(t)?rs:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Eh,"i").test(t)?Eh:/(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(Wt).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:Hg:new RegExp("(pda|"+Wt+")","i").test(t)?BT:new RegExp(mo,"i").test(t)&&!new RegExp(mo+" pc","i").test(t)?sv:""},YT=t=>t instanceof Error;function XT(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Za&&n.length===jh||(jh=n.length,Za=n.reduce((r,s)=>{Jo||(Jo={});var i=Jo[s];if(i)r[i[0]]=i[1];else for(var a=t(s),l=a.length-1;l>=0;l--){var c=a[l],u=c?.filename,d=e[s];if(u&&d){r[u]=d,Jo[s]=[u,d];break}}return r},{})),Za}}class ZT{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),i=this.buildParsingContext(n),a=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}modifyFrames(e){var n=this;return Cn(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&ve(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.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 r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),$({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return Cn(function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r})()}convertToExceptionList(e,n){var r,s,i,a={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,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,$({},n,{handled:!0}))),l}buildParsingContext(e){var n;return{chunkIdMap:XT(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(i,a)=>{if(a<=4){var l=this.buildCoercingContext(e,n,a);return this.applyCoercers(i,l)}};return $({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:i=>s(i,r),next:i=>s(i,r+1)})}}var ss="?";function oc(t,e,n,r,s){var i={platform:t,filename:e,function:n==="<anonymous>"?ss:n,in_app:!0};return B(r)||(i.lineno=r),B(s)||(i.colno=s),i}var iv=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:ss,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},JT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,QT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eP=/\((\S*)(?::(\d+))(?::(\d+))\)/,tP=(t,e)=>{var n=JT.exec(t);if(n){var[,r,s,i]=n;return oc(e,r,ss,+s,+i)}var a=QT.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=eP.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var[c,u]=iv(a[1]||ss,a[2]);return oc(e,u,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},nP=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rP=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,sP=(t,e)=>{var n=nP.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=rP.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],i=n[1]||ss;return[i,s]=iv(i,s),oc(e,s,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Sh=/\(error: (.*)\)/,kh=50;function oP(){return function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(s,i){i===void 0&&(i=0);for(var a=[],l=s.split(`
`),c=i;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var d=Sh.test(u)?u.replace(Sh,"$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>=kh)break}}}return function(m){if(!m.length)return[];var y=Array.from(m);return y.reverse(),y.slice(0,kh).map(g=>{return $({},g,{filename:g.filename||(x=y,x[x.length-1]||{}).filename,function:g.function||ss});var x})}(a)}}("web:javascript",tP,sP)}class iP{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=Fe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?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 Oi(e,"DOMException")}isDOMError(e){return Oi(e,"DOMError")}}class aP{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 r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}class lP{constructor(){}match(e){return Oi(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r,s=n.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var cP=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class uP{match(e){return typeof e=="string"}coerce(e,n){var r,[s,i]=this.getInfos(e);return{type:s??"Error",value:i??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(cP);return s&&(n=s[1],r=s[2]),[n,r]}}var dP=["fatal","error","warning","log","info","debug"];function av(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(!(s.length>e))return r===n.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class hP{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return zg(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 r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+av(e)}isSeverityLevel(e){return Fe(e)&&!ec(e)&&dP.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(YT(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class pP{match(e){return zg(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+av(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class fP{match(e){return tc(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class mP{match(e){return Oi(e,"PromiseRejectionEvent")}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return tc(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}getUnhandledRejectionReason(e){if(tc(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 lv=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={k:function(s){if(A&&(An.DEBUG||Z.POSTHOG_DEBUG||n)&&!B(A.console)&&A.console){for(var i=("__rrweb_original__"in A.console[s])?A.console[s].__rrweb_original__:A.console[s],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 s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];r.k("log",...i)},warn:function(){for(var s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];r.k("warn",...i)},error:function(){for(var s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];r.k("error",...i)},critical:function(){for(var s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning:s=>{r.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>lv(t+" "+s,i)};return r},z=lv("[PostHog.js]"),Ie=z.createLogger,gP=Ie("[ExternalScriptsLoader]"),Rh=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return gP.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=F?.querySelectorAll("script");if(r){for(var s,i=function(){if(r[a].src===e){var c=r[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<r.length;a++)if(s=i())return s.v}var l=()=>{if(!F)return n("document not found");var c=F.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")F.head.appendChild(c);else{var u,d=F.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):F.body.appendChild(c)}};F!=null&&F.body?l():F?.addEventListener("DOMContentLoaded",l)};Z.__PosthogExtensions__=Z.__PosthogExtensions__||{},Z.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var i=t.requestRouter.endpointFor("assets",r);Rh(t,i,n)},Z.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);Rh(t,r,n)};var Li={};function Xn(t,e,n){if(ve(t)){if(_h&&t.forEach===_h)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var r=0,s=t.length;r<s;r++)if(r in t&&e.call(n,t[r],r)===Li)return}}}function Ee(t,e,n){if(!ce(t)){if(ve(t))return Xn(t,e,n);if(DT(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===Li)return}else for(var s in t)if(Ug.call(t,s)&&e.call(n,t[s],s)===Li)return}}var Me=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Xn(n,function(s){for(var i in s)s[i]!==void 0&&(t[i]=s[i])}),t},os=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Xn(n,function(s){Xn(s,function(i){t.push(i)})}),t};function vi(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var Ah=function(t){try{return t()}catch{return}},vP=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){z.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),z.critical(s)}}},Au=function(t){var e={};return Ee(t,function(n,r){(Fe(n)&&n.length>0||Vn(n))&&(e[r]=n)}),e};function _P(t,e){return n=t,r=i=>Fe(i)&&!nn(e)?i.slice(0,e):i,s=new Set,function i(a,l){return a!==Object(a)?r?r(a,l):a:s.has(a)?void 0:(s.add(a),ve(a)?(c=[],Xn(a,u=>{c.push(i(u))})):(c={},Ee(a,(u,d)=>{s.has(u)||(c[d]=i(u,d))})),c);var c}(n);var n,r,s}var yP=["herokuapp.com","vercel.app","netlify.app"];function xP(t){var e=t?.hostname;if(!Fe(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of yP)if(n===r)return!1;return!0}function cv(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Ve(t,e,n,r){var{capture:s=!1,passive:i=!0}=r??{};t?.addEventListener(e,n,{capture:s,passive:i})}function uv(t){return t.name==="ph_toolbar_internal"}var dv="$people_distinct_id",Vs="__alias",Fs="__timers",Ch="$autocapture_disabled_server_side",ic="$heatmaps_enabled_server_side",Ih="$exception_capture_enabled_server_side",ac="$error_tracking_suppression_rules",Oh="$error_tracking_capture_extension_exceptions",Dh="$web_vitals_enabled_server_side",hv="$dead_clicks_enabled_server_side",Lh="$product_tours_enabled_server_side",Nh="$web_vitals_allowed_metrics",Qo="$session_recording_remote_config",Ni="$sesid",pv="$session_is_sampled",Ur="$enabled_feature_flags",$s="$early_access_features",lc="$feature_flag_details",Bs="$stored_person_properties",dr="$stored_group_properties",cc="$surveys",Mi="$flag_call_reported",uc="$feature_flag_errors",an="$user_state",dc="$client_session_props",hc="$capture_rate_limit",pc="$initial_campaign_params",fc="$initial_referrer_info",Vi="$initial_person_info",Fi="$epp",fv="__POSTHOG_TOOLBAR__",Ss="$posthog_cookieless",bP=[dv,Vs,"__cmpns",Fs,"$session_recording_enabled_server_side",ic,Ni,Ur,ac,an,$s,lc,dr,Bs,cc,Mi,uc,dc,hc,pc,fc,Fi,Vi];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 Mh="0123456789abcdef";class $i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||n<0||r<0||s<0||e>0xffffffffffff||n>4095||r>1073741823||s>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|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new $i(i)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+Mh.charAt(this.bytes[n]>>>4)+Mh.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 $i(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class wP{constructor(){this.P=0,this.T=0,this.I=new EP}generate(){var e=this.generateOrAbort();if(B(e)){this.P=0;var n=this.generateOrAbort();if(B(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 $i.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 Vh,mv=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};A&&!B(A.crypto)&&crypto.getRandomValues&&(mv=t=>crypto.getRandomValues(t));class EP{constructor(){this.R=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.R.length&&(mv(this.R),this.F=0),this.R[this.F++]}}var Yn=()=>jP().toString(),jP=()=>(Vh||(Vh=new wP)).generate(),ks="",TP=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function PP(t,e){if(e){var n=function(s,i){if(i===void 0&&(i=F),ks)return ks;if(!i||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),l=Math.min(a.length,8),c="dmn_chk_"+Yn();!ks&&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",ks=u)}return ks}(t);if(!n){var r=(s=>{var i=s.match(TP);return i?i[0]:""})(t);r!==n&&z.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var ln={O:()=>!!F,M:function(t){z.error("cookieStore error: "+t)},A:function(t){if(F){try{for(var e=t+"=",n=F.cookie.split(";").filter(i=>i.length),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},j:function(t){var e;try{e=JSON.parse(ln.A(t))||{}}catch{}return e},D:function(t,e,n,r,s){if(F)try{var i="",a="",l=PP(F.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),i="; expires="+c.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&z.warn("cookieStore warning: large cookie, len="+u.length),F.cookie=u,u}catch{return}},L:function(t,e){if(F!=null&&F.cookie)try{ln.D(t,"",-1,e)}catch{return}}},Ja=null,Re={O:function(){if(!nn(Ja))return Ja;var t=!0;if(B(A))t=!1;else try{var e="__mplssupport__";Re.D(e,"xyz"),Re.A(e)!=='"xyz"'&&(t=!1),Re.L(e)}catch{t=!1}return t||z.error("localStorage unsupported; falling back to cookie store"),Ja=t,t},M:function(t){z.error("localStorage error: "+t)},A:function(t){try{return A?.localStorage.getItem(t)}catch(e){Re.M(e)}return null},j:function(t){try{return JSON.parse(Re.A(t))||{}}catch{}return null},D:function(t,e){try{A?.localStorage.setItem(t,JSON.stringify(e))}catch(n){Re.M(n)}},L:function(t){try{A?.localStorage.removeItem(t)}catch(e){Re.M(e)}}},SP=["$device_id","distinct_id",Ni,pv,Fi,Vi,an],ei={},kP={O:function(){return!0},M:function(t){z.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]}},lr=null,We={O:function(){if(!nn(lr))return lr;if(lr=!0,B(A))lr=!1;else try{var t="__support__";We.D(t,"xyz"),We.A(t)!=='"xyz"'&&(lr=!1),We.L(t)}catch{lr=!1}return lr},M:function(t){z.error("sessionStorage error: ",t)},A:function(t){try{return A?.sessionStorage.getItem(t)}catch(e){We.M(e)}return null},j:function(t){try{return JSON.parse(We.A(t))||null}catch{}return null},D:function(t,e){try{A?.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){We.M(n)}},L:function(t){try{A?.sessionStorage.removeItem(t)}catch(e){We.M(e)}}},In=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class RP{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:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get H(){var e=this.B.A(this.q);return Ya(e)?In.GRANTED:le(MT,e)?In.DENIED:In.PENDING}get B(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W=e==="localStorage"?Re:ln;var n=e==="localStorage"?ln:Re;n.A(this.q)&&(this.W.A(this.q)||this.optInOut(Ya(n.A(this.q))),n.L(this.q,this.N.cross_subdomain_cookie))}return this.W}U(){return!!this.N.respect_dnt&&!!cv([Vt?.doNotTrack,Vt?.msDoNotTrack,Z.doNotTrack],e=>Ya(e))}}var ti=Ie("[Dead Clicks]"),AP=()=>!0,CP=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(hv)),r=t.instance.config.capture_dead_clicks;return Ln(r)?r:!!$e(r)||n};class Fh{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[hv]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.V(()=>{this.J()}):this.stop()}V(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?ti.error("failed to load script",s):e()})}J(){var e;if(F){if(!this.G&&(e=Z.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=$e(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.G=Z.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.G.start(F),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 Qa=Ie("[SegmentIntegration]");function IP(t,e){var n=t.config.segment;if(!n)return e();(function(r,s){var i=r.config.segment;if(!i)return s();var a=c=>{var u=()=>c.anonymousId()||Yn();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(an,"identified")),s()},l=i.user();"then"in l&&On(l.then)?l.then(a):a(l)})(t,()=>{n.register((r=>{Promise&&Promise.resolve||Qa.warn("This browser does not have Promise support, and can not use the segment integration");var s=(i,a)=>{if(!a)return i;i.event.userId||i.event.anonymousId===r.get_distinct_id()||(Qa.info("No userId set, resetting PostHog"),r.reset()),i.event.userId&&i.event.userId!==r.get_distinct_id()&&(Qa.info("UserId set, identifying with PostHog"),r.identify(i.event.userId));var l=r.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=>s(i,i.event.event),page:i=>s(i,"$pageview"),identify:i=>s(i,"$identify"),screen:i=>s(i,"$screen")}})(t)).then(()=>{e()})})}var gv="posthog-js";function vv(t,e){var{organization:n,projectId:r,prefix:s,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 m=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());l.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var y=((c=l.exception)==null?void 0:c.values)||[],g=y.map(b=>$({},b,{stacktrace:b.stacktrace?$({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map(w=>$({},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:g,$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&&r&&(x.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+l.event_id),a&&t.exceptions.sendExceptionEvent(x),l}}class OP{constructor(e,n,r,s,i,a){this.name=gv,this.setupOnce=function(l){l(vv(e,{organization:n,projectId:r,prefix:s,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}var Bi=t=>{var e=F?.createElement("a");return B(e)?null:(e.href=t,e)},DP=function(t,e){var n,r;e===void 0&&(e="&");var s=[];return Ee(t,function(i,a){B(i)||B(a)||a==="undefined"||(n=encodeURIComponent((l=>l instanceof File)(i)?i.name:i.toString()),r=encodeURIComponent(a),s[s.length]=r+"="+n)}),s.join(e)},Ui=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var i=r[s].split("=");if(i[0]===e){n=i;break}}if(!ve(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{z.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 r=t.split("#"),s=r[0]||"",i=r[1],a=s.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 m=c;return l!=null&&(m+="?"+d.join("&")),i!=null&&(m+="#"+i),m},zi=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},LP=A!=null&&A.location?zi(A.location.hash,"__posthog")||zi(location.hash,"state"):null,$h="_postHogToolbarParams",Bh=Ie("[Toolbar]"),Wn=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Wn||{});class NP{constructor(e){this.instance=e}K(e){Z.ph_toolbar_state=e}Y(){var e;return(e=Z.ph_toolbar_state)!==null&&e!==void 0?e:Wn.UNINITIALIZED}maybeLoadToolbar(e,n,r){if(e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),uv(this.instance.config)||!A||!F)return!1;e=e??A.location,r=r??A.history;try{if(!n){try{A.localStorage.setItem("test","test"),A.localStorage.removeItem("test")}catch{return!1}n=A?.localStorage}var s,i=LP||zi(e.hash,"__posthog")||zi(e.hash,"state"),a=i?Ah(()=>JSON.parse(atob(decodeURIComponent(i))))||Ah(()=>JSON.parse(decodeURIComponent(i))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(n.getItem($h)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}X(e){var n=Z.ph_load_toolbar||Z.ph_load_editor;!ce(n)&&On(n)?n(e,this.instance):Bh.warn("No toolbar load function found")}loadToolbar(e){var n=!(F==null||!F.getElementById(fv));if(!A||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=$({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(A.localStorage.setItem($h,JSON.stringify($({},s,{source:void 0}))),this.Y()===Wn.LOADED)this.X(s);else if(this.Y()===Wn.UNINITIALIZED){var i;this.K(Wn.LOADING),(i=Z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return Bh.error("[Toolbar] Failed to load",a),void this.K(Wn.UNINITIALIZED);this.K(Wn.LOADED),this.X(s)}),Ve(A,"turbolinks:load",()=>{this.K(Wn.UNINITIALIZED),this.loadToolbar(s)})}return!0}Z(e){return this.loadToolbar(e)}maybeLoadEditor(e,n,r){return e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,n,r)}}class Uh{constructor(e){this.tt=(n,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(z.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:s}),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 r,s=this.st(e,n);return this.it={pathname:(r=A?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}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 r=this.it;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.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(!(B(a)||B(l)||B(c)||B(u)||B(d)||B(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:hn(l/a,0,1,z),m=a<=1?1:hn(c/a,0,1,z),y=u<=1?1:hn(d/u,0,1,z),g=u<=1?1:hn(p/u,0,1,z);s=Me(s,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var cn=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Gt=Uint8Array,Ct=Uint16Array,is=Uint32Array,Cu=new Gt([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]),Iu=new Gt([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]),zh=new Gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_v=function(t,e){for(var n=new Ct(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var s=new is(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return[n,s]},yv=_v(Cu,2),MP=yv[0],mc=yv[1];MP[28]=258,mc[258]=28;for(var Hh=_v(Iu,0)[1],xv=new Ct(32768),Pe=0;Pe<32768;++Pe){var cr=(43690&Pe)>>>1|(21845&Pe)<<1;cr=(61680&(cr=(52428&cr)>>>2|(13107&cr)<<2))>>>4|(3855&cr)<<4,xv[Pe]=((65280&cr)>>>8|(255&cr)<<8)>>>1}var Js=function(t,e,n){for(var r=t.length,s=0,i=new Ct(e);s<r;++s)++i[t[s]-1];var a,l=new Ct(e);for(s=0;s<e;++s)l[s]=l[s-1]+i[s-1]<<1;for(a=new Ct(r),s=0;s<r;++s)a[s]=xv[l[t[s]-1]++]>>>15-t[s];return a},xr=new Gt(288);for(Pe=0;Pe<144;++Pe)xr[Pe]=8;for(Pe=144;Pe<256;++Pe)xr[Pe]=9;for(Pe=256;Pe<280;++Pe)xr[Pe]=7;for(Pe=280;Pe<288;++Pe)xr[Pe]=8;var Hi=new Gt(32);for(Pe=0;Pe<32;++Pe)Hi[Pe]=5;var VP=Js(xr,9),FP=Js(Hi,5),bv=function(t){return(t/8>>0)+(7&t&&1)},wv=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Ct?Ct:t instanceof is?is:Gt)(n-e);return r.set(t.subarray(e,n)),r},kn=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},Rs=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},el=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return[new Gt(0),0];if(s==1){var a=new Gt(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!=s-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(r=1;r<s;++r)i[r].s>f&&(f=i[r].s);var m=new Ct(f+1),y=gc(n[d-1],m,0);if(y>e){r=0;var g=0,x=y-e,b=1<<x;for(i.sort(function(j,P){return m[P.s]-m[j.s]||j.f-P.f});r<s;++r){var w=i[r].s;if(!(m[w]>e))break;g+=b-(1<<y-m[w]),m[w]=e}for(g>>>=x;g>0;){var E=i[r].s;m[E]<e?g-=1<<e-m[E]++-1:++r}for(;r>=0&&g;--r){var T=i[r].s;m[T]==e&&(--m[T],++g)}y=e}return[new Gt(m),y]},gc=function(t,e,n){return t.s==-1?Math.max(gc(t.l,e,n+1),gc(t.r,e,n+1)):e[t.s]=n},Wh=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Ct(++e),r=0,s=t[0],i=1,a=function(c){n[r++]=c},l=1;l<=e;++l)if(t[l]==s&&l!=e)++i;else{if(!s&&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(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=t[l]}return[n.subarray(0,r),e]},As=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},vc=function(t,e,n){var r=n.length,s=bv(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;i<r;++i)t[s+i+4]=n[i];return 8*(s+4+r)},Gh=function(t,e,n,r,s,i,a,l,c,u,d){kn(e,d++,n),++s[256];for(var p=el(s,15),f=p[0],m=p[1],y=el(i,15),g=y[0],x=y[1],b=Wh(f),w=b[0],E=b[1],T=Wh(g),j=T[0],P=T[1],S=new Ct(19),k=0;k<w.length;++k)S[31&w[k]]++;for(k=0;k<j.length;++k)S[31&j[k]]++;for(var O=el(S,7),R=O[0],N=O[1],L=19;L>4&&!R[zh[L-1]];--L);var q,D,K,V,U=u+5<<3,C=As(s,xr)+As(i,Hi)+a,I=As(s,f)+As(i,g)+a+14+3*L+As(S,R)+(2*S[16]+3*S[17]+7*S[18]);if(U<=C&&U<=I)return vc(e,d,t.subarray(c,c+u));if(kn(e,d,1+(I<C)),d+=2,I<C){q=Js(f,m),D=f,K=Js(g,x),V=g;var ee=Js(R,N);for(kn(e,d,E-257),kn(e,d+5,P-1),kn(e,d+10,L-4),d+=14,k=0;k<L;++k)kn(e,d+3*k,R[zh[k]]);d+=3*L;for(var Y=[w,j],X=0;X<2;++X){var J=Y[X];for(k=0;k<J.length;++k){var oe=31&J[k];kn(e,d,ee[oe]),d+=R[oe],oe>15&&(kn(e,d,J[k]>>>5&127),d+=J[k]>>>12)}}}else q=VP,D=xr,K=FP,V=Hi;for(k=0;k<l;++k)if(r[k]>255){oe=r[k]>>>18&31,Rs(e,d,q[oe+257]),d+=D[oe+257],oe>7&&(kn(e,d,r[k]>>>23&31),d+=Cu[oe]);var Se=31&r[k];Rs(e,d,K[Se]),d+=V[Se],Se>3&&(Rs(e,d,r[k]>>>5&8191),d+=Iu[Se])}else Rs(e,d,q[r[k]]),d+=D[r[k]];return Rs(e,d,q[256]),d+D[256]},$P=new is([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),BP=function(){for(var t=new is(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),UP=function(t,e,n,r,s){return function(i,a,l,c,u,d){var p=i.length,f=new Gt(c+p+5*(1+Math.floor(p/7e3))+u),m=f.subarray(c,f.length-u),y=0;if(!a||p<8)for(var g=0;g<=p;g+=65535){var x=g+65535;x<p?y=vc(m,y,i.subarray(g,x)):(m[g]=d,y=vc(m,y,i.subarray(g,p)))}else{for(var b=$P[a-1],w=b>>>13,E=8191&b,T=(1<<l)-1,j=new Ct(32768),P=new Ct(T+1),S=Math.ceil(l/3),k=2*S,O=function(Pn){return(i[Pn]^i[Pn+1]<<S^i[Pn+2]<<k)&T},R=new is(25e3),N=new Ct(288),L=new Ct(32),q=0,D=0,K=(g=0,0),V=0,U=0;g<p;++g){var C=O(g),I=32767&g,ee=P[C];if(j[I]=ee,P[C]=I,V<=g){var Y=p-g;if((q>7e3||K>24576)&&Y>423){y=Gh(i,m,0,R,N,L,D,K,U,g-U,y),K=q=D=0,U=g;for(var X=0;X<286;++X)N[X]=0;for(X=0;X<30;++X)L[X]=0}var J=2,oe=0,Se=E,ne=I-ee&32767;if(Y>2&&C==O(g-ne))for(var G=Math.min(w,Y)-1,pe=Math.min(32767,g),ke=Math.min(258,Y);ne<=pe&&--Se&&I!=ee;){if(i[g+J]==i[g+J-ne]){for(var ie=0;ie<ke&&i[g+ie]==i[g+ie-ne];++ie);if(ie>J){if(J=ie,oe=ne,ie>G)break;var ye=Math.min(ne,ie-2),xe=0;for(X=0;X<ye;++X){var Be=g-ne+X+32768&32767,Ot=Be-j[Be]+32768&32767;Ot>xe&&(xe=Ot,ee=Be)}}}ne+=(I=ee)-(ee=j[I])+32768&32767}if(oe){R[K++]=268435456|mc[J]<<18|Hh[oe];var Tn=31&mc[J],Dt=31&Hh[oe];D+=Cu[Tn]+Iu[Dt],++N[257+Tn],++L[Dt],V=g+J,++q}else R[K++]=i[g],++N[i[g]]}}y=Gh(i,m,d,R,N,L,D,K,U,g-U,y)}return wv(f,0,c+bv(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,r,!0)},tl=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function zP(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=BP[255&u^c[d]]^u>>>8;l=u},d:function(){return 4294967295^l}}}(),r=t.length;n.p(t);var s,i=UP(t,e,10+((s=e).filename&&s.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&&tl(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),tl(i,a-8,n.d()),tl(i,a-4,r),i}var HP=function(t){var e,n,r,s,i="";for(e=n=0,r=(t=(t+"").replace(/\r\n/g,`
`).replace(/\r/g,`
`)).length,s=0;s<r;s++){var a=t.charCodeAt(s),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),nn(l)||(n>e&&(i+=t.substring(e,n)),i+=l,e=n=s+1)}return n>e&&(i+=t.substring(e,t.length)),i},WP=!!Jl||!!Zl,Kh="text/plain",Wi=function(t,e,n){var r;n===void 0&&(n=!0);var[s,i]=t.split("?"),a=$({},e),l=(r=i?.split("&").map(u=>{var d,[p,f]=u.split("="),m=n&&(d=a[p])!==null&&d!==void 0?d:f;return delete a[p],p+"="+m}))!==null&&r!==void 0?r:[],c=DP(a);return c&&l.push(c),s+"?"+l.join("&")},Us=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),nl=t=>{var{data:e,compression:n}=t;if(e){if(n===cn.GZipJS){var r=zP(function(c,u){var d=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var p=new Gt(c.length+(c.length>>>1)),f=0,m=function(b){p[f++]=b},y=0;y<d;++y){if(f+5>p.length){var g=new Gt(f+8+(d-y<<1));g.set(p),p=g}var x=c.charCodeAt(y);x<128||u?m(x):x<2048?(m(192|x>>>6),m(128|63&x)):x>55295&&x<57344?(m(240|(x=65536+(1047552&x)|1023&c.charCodeAt(++y))>>>18),m(128|x>>>12&63),m(128|x>>>6&63),m(128|63&x)):(m(224|x>>>12),m(128|x>>>6&63),m(128|63&x))}return wv(p,0,f)}(Us(e)),{mtime:0}),s=new Blob([r],{type:Kh});return{contentType:Kh,body:s,estimatedSize:s.size}}if(n===cn.Base64){var i=function(c){var u,d,p,f,m,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,x=0,b="",w=[];if(!c)return c;c=HP(c);do u=(m=c.charCodeAt(g++)<<16|c.charCodeAt(g++)<<8|c.charCodeAt(g++))>>18&63,d=m>>12&63,p=m>>6&63,f=63&m,w[x++]=y.charAt(u)+y.charAt(d)+y.charAt(p)+y.charAt(f);while(g<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}(Us(e)),a=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Us(c)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=Us(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},_i=[];Zl&&_i.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:s,estimatedSize:i}=(e=nl(t))!==null&&e!==void 0?e:{},a=new Headers;Ee(t.headers,function(d,p){a.append(p,d)}),r&&a.append("Content-Type",r);var l=t.url,c=null;if(xh){var u=new xh;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Zl(l,$({method:t?.method||"GET",headers:a,keepalive:t.method==="POST"&&(i||0)<52428.8,body:s,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(m){z.error(m)}t.callback==null||t.callback(f)})).catch(d=>{z.error(d),t.callback==null||t.callback({statusCode:0,error:d})}).finally(()=>c?clearTimeout(c.timeout):null)}}),Jl&&_i.push({transport:"XHR",method:t=>{var e,n=new Jl;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=(e=nl(t))!==null&&e!==void 0?e:{};Ee(t.headers,function(i,a){n.setRequestHeader(a,i)}),r&&n.setRequestHeader("Content-Type",r),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(s)}}),Vt!=null&&Vt.sendBeacon&&_i.push({transport:"sendBeacon",method:t=>{var e=Wi(t.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=nl(t))!==null&&n!==void 0?n:{},i=typeof s=="string"?new Blob([s],{type:r}):s;Vt.sendBeacon(e,i)}catch{}}});var Gi=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 qh(t,e,n){return Us({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Ev={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Gi(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Gi(n,r))),icontains:(t,e)=>e.map(ni).some(n=>t.map(ni).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(ni).every(n=>t.map(ni).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r>parseFloat(s))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r<parseFloat(s))})},ni=t=>t.toLowerCase();function jv(t,e){return!t||Object.entries(t).every(n=>{var[r,s]=n,i=e?.[r];if(B(i)||nn(i))return!1;var a=[String(i)],l=Ev[s.operator];return!!l&&l(s.values,a)})}var rl=Ie("[Error tracking]");class GP{constructor(e){var n,r;this.nt=[],this.ot=new ZT([new iP,new mP,new lP,new aP,new pP,new hP,new uP,new fP],oP()),this._instance=e,this.nt=(n=(r=this._instance.persistence)==null?void 0:r.get_property(ac))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,s;if("errorTracking"in e){var i=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.nt=i,this._instance.persistence&&this._instance.persistence.register({[ac]:this.nt,[Oh]:a})}}get ut(){var e,n=!!this._instance.get_property(Oh),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??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 rl.info("Skipping exception capture because a suppression rule matched");if(!this.ut&&this.vt(n))return void rl.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ct(n))return void rl.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((r,s)=>{var{type:i,value:a}=s;return Fe(i)&&i.length>0&&r.$exception_types.push(i),Fe(a)&&a.length>0&&r.$exception_values.push(a),r},{$exception_types:[],$exception_values:[]});return this.nt.some(r=>{var s=r.values.map(i=>{var a,l=Ev[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 r.type==="OR"?s.some(Boolean):s.every(Boolean)})}vt(e){return e.flatMap(n=>{var r,s;return(r=(s=n.stacktrace)==null?void 0:s.frames)!==null&&r!==void 0?r:[]}).some(n=>n.filename&&n.filename.startsWith("chrome-extension://"))}ct(e){if(e.length>0){var n,r,s,i,a=(n=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[],l=a[a.length-1];return(s=l==null||(i=l.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ht(e){return!ce(e)&&ve(e)}}var ri="https?://(.*)",as=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],KP=os(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],as),xo="<masked>",qP=["li_fat_id"];function Tv(t,e,n){if(!F)return{};var r,s=e?os([],as,n||[]):[],i=Pv(yo(F.URL,s,xo),t),a=(r={},Ee(qP,function(l){var c=ln.A(l);r[l]=c||null}),r);return Me(a,i)}function Pv(t,e){var n=KP.concat(e||[]),r={};return Ee(n,function(s){var i=Ui(t,s);r[s]=i||null}),r}function Sv(t){var e=function(i){return i?i.search(ri+"google.([^/?]*)")===0?"google":i.search(ri+"bing.com")===0?"bing":i.search(ri+"yahoo.com")===0?"yahoo":i.search(ri+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!nn(e)){r.$search_engine=e;var s=F?Ui(F.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function Yh(){return navigator.language||navigator.userLanguage}function kv(){return F?.referrer||"$direct"}function Rv(t,e){var n=t?os([],as,e||[]):[],r=Ge?.href.substring(0,1e3);return{r:kv().substring(0,1e3),u:r?yo(r,n,xo):void 0}}function Av(t){var e,{r:n,u:r}=t,s={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Bi(n))==null?void 0:e.host};if(r){s.$current_url=r;var i=Bi(r);s.$host=i?.host,s.$pathname=i?.pathname;var a=Pv(r);Me(s,a)}if(n){var l=Sv(n);Me(s,l)}return s}function Cv(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function YP(){try{return new Date().getTimezoneOffset()}catch{return}}function XP(t,e){if(!At)return{};var n,r,s,i=t?os([],as,e||[]):[],[a,l]=function(c){for(var u=0;u<Th.length;u++){var[d,p]=Th[u],f=d.exec(c),m=f&&(On(p)?p(f,c):p);if(m)return m}return["",""]}(At);return Me(Au({$os:a,$os_version:l,$browser:ov(At,navigator.vendor),$device:Ph(At),$device_type:(r=At,s=Ph(r),s===Wg||s===Hg||s==="Kobo"||s==="Kindle Fire"||s===sv?mo:s===vo||s===Jr||s===_o||s===rc?"Console":s===Kg?"Wearable":s?Wt:"Desktop"),$timezone:Cv(),$timezone_offset:YP()}),{$current_url:yo(Ge?.href,i,xo),$host:Ge?.host,$pathname:Ge?.pathname,$raw_user_agent:At.length>1e3?At.substring(0,997)+"...":At,$browser_version:qT(At,navigator.vendor),$browser_language:Yh(),$browser_language_prefix:(n=Yh(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:A?.screen.height,$screen_width:A?.screen.width,$viewport_height:A?.innerHeight,$viewport_width:A?.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 Lt=Ie("[FeatureFlags]"),Cs=Ie("[FeatureFlags]",{debugEnabled:!0}),ZP="errors_while_computing_flags",JP="flag_missing",QP="quota_limited",eS="timeout",tS="connection_error",nS="unknown_error",rS=t=>"api_error_"+t,sl="$active_feature_flags",Ir="$override_feature_flags",Xh="$feature_flag_payloads",Is="$override_feature_flag_payloads",Zh="$feature_flag_request_id",Jh="$feature_flag_evaluated_at",Qh=t=>{var e={};for(var[n,r]of vi(t||{}))r&&(e[n]=r);return e},sS=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]}))):Lt.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},oS=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class iS{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||(Lt.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(r=>{var s=r&&typeof r=="string"&&r.trim().length>0;return s||Lt.error("Invalid evaluation context found:",r,"Expected non-empty string"),s}):[]}kt(){return this.St().length>0}get hasLoadedFlags(){return this.bt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(lc),n=this._instance.get_property(Ir),r=this._instance.get_property(Is);if(!r&&!n)return e||{};var s=Me({},e||{}),i=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var a of i){var l,c,u=s[a],d=n?.[a],p=B(d)?(l=u?.enabled)!==null&&l!==void 0&&l:!!d,f=B(d)?u.variant:typeof d=="string"?d:void 0,m=r?.[a],y=$({},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),m&&(y.metadata=$({},u?.metadata,{payload:m,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),s[a]=y}return this._t||(Lt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._t=!0),s}getFlagVariants(){var e=this._instance.get_property(Ur),n=this._instance.get_property(Ir);if(!n)return e||{};for(var r=Me({},e),s=Object.keys(n),i=0;i<s.length;i++)r[s[i]]=n[s[i]];return this._t||(Lt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this._t=!0),r}getFlagPayloads(){var e=this._instance.get_property(Xh),n=this._instance.get_property(Is);if(!n)return e||{};for(var r=Me({},e||{}),s=Object.keys(n),i=0;i<s.length;i++)r[s[i]]=n[s[i]];return this._t||(Lt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this._t=!0),r}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 r=this._instance.config.token,s=this._instance.get_property("$device_id"),i={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:$({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(Bs)||{}),group_properties:this._instance.get_property(dr),timezone:Cv()};nn(s)||B(s)||(i.$device_id=s),(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:cn.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 m=[];c.error?c.error instanceof Error?m.push(c.error.name==="AbortError"?eS:tS):m.push(nS):c.statusCode!==200&&m.push(rS(c.statusCode)),(u=c.json)!=null&&u.errorsWhileComputingFlags&&m.push(ZP);var y=!((d=c.json)==null||(d=d.quotaLimited)==null||!d.includes(oS.FeatureFlags));if(y&&m.push(QP),(p=this._instance.persistence)==null||p.register({[uc]:m}),y)Lt.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 g;i.disable_flags||this.receivedFeatureFlags((g=c.json)!==null&&g!==void 0?g:{},f),this.xt&&(this.xt=!1,this.It())}}}})}}getFeatureFlag(e,n){var r;if(n===void 0&&(n={}),!n.fresh||this.$t){if(this.bt||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlagResult(e,n);return(r=s?.variant)!==null&&r!==void 0?r:s?.enabled}Lt.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 r=this.getFlagVariants(),s=e in r,i=r[e],a=this.getFlagPayloads()[e],l=String(i),c=this._instance.get_property(Zh)||void 0,u=this._instance.get_property(Jh)||void 0,d=this._instance.get_property(Mi)||{};if((n.send_event||!("send_event"in n))&&(!(e in d)||!d[e].includes(l))){var p,f,m,y,g,x,b,w,E,T;ve(d[e])?d[e].push(l):d[e]=[l],(p=this._instance.persistence)==null||p.register({[Mi]:d});var j=this.getFeatureFlagDetails(e),P=[...(f=this._instance.get_property(uc))!==null&&f!==void 0?f:[]];B(i)&&P.push(JP);var S={$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:((m=this._instance.config.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[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};B(j==null||(g=j.metadata)==null?void 0:g.version)||(S.$feature_flag_version=j.metadata.version);var k,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&&(S.$feature_flag_reason=O),j!=null&&(E=j.metadata)!=null&&E.id&&(S.$feature_flag_id=j.metadata.id),B(j?.original_variant)&&B(j?.original_enabled)||(S.$feature_flag_original_response=B(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(T=j.metadata)!=null&&T.original_payload&&(S.$feature_flag_original_payload=j==null||(k=j.metadata)==null?void 0:k.original_payload),P.length&&(S.$feature_flag_error=P.join(",")),this._instance.capture("$feature_flag_called",S)}if(s){var R=a;if(!B(a))try{R=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:R}}}else Lt.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,n){var r=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:r};this.kt()&&(s.evaluation_contexts=this.St()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._instance.config.disable_compression?void 0:cn.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 r=this.getFeatureFlag(e,n);return B(r)?void 0:!!r}Lt.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 r=this.getFlagVariants(),s=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=sS(a),f=p.flags,m=p.featureFlags,y=p.featureFlagPayloads;if(m){var g=a.requestId,x=a.evaluatedAt;if(ve(m)){Lt.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(m)for(var w=0;w<m.length;w++)b[m[w]]=!0;l&&l.register({[sl]:m,[Ur]:b})}else{var E=m,T=y,j=f;if(a.errorsWhileComputingFlags)if(f){var P=new Set(Object.keys(f).filter(S=>{var k;return!((k=f[S])!=null&&k.failed)}));E=$({},c,Object.fromEntries(Object.entries(E).filter(S=>{var[k]=S;return P.has(k)}))),T=$({},u,Object.fromEntries(Object.entries(T||{}).filter(S=>{var[k]=S;return P.has(k)}))),j=$({},d,Object.fromEntries(Object.entries(j||{}).filter(S=>{var[k]=S;return P.has(k)})))}else E=$({},c,E),T=$({},u,T),j=$({},d,j);l&&l.register($({[sl]:Object.keys(Qh(E)),[Ur]:E||{},[Xh]:T||{},[lc]:j||{}},g?{[Zh]:g}:{},x?{[Jh]:x}:{}))}}})(e,this._instance.persistence,r,s,i),this.Ft(n)}}override(e,n){n===void 0&&(n=!1),Lt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Lt.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ir),this._instance.persistence.unregister(Is),this.Ft(),Cs.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this._t=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Ir),Cs.info("Flag overrides cleared");else if(r.flags){if(ve(r.flags)){for(var s={},i=0;i<r.flags.length;i++)s[r.flags[i]]=!0;this._instance.persistence.register({[Ir]:s})}else this._instance.persistence.register({[Ir]:r.flags});Cs.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(Is),Cs.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[Is]:r.payloads}),Cs.info("Payload overrides set",{payloads:r.payloads}))),void this.Ft()}this.Ft()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.bt){var{flags:n,flagVariants:r}=this.Ot();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var s,i=(this._instance.get_property($s)||[]).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),r&&(l.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(a,!1);var c=$({},this.getFlagVariants(),{[e]:n});(s=this._instance.persistence)==null||s.register({[sl]:Object.keys(Qh(c)),[Ur]:c}),this.Ft()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var s=this._instance.get_property($s),i=r?"&"+r.map(a=>"stage="+a).join("&"):"";if(s&&!n)return e(s);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($s),(c=this._instance.persistence)==null||c.register({[$s]:u}),e(u)}}})}Ot(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,s)=>(r[s]=n[s],r),{})}}Ft(e){var{flags:n,flagVariants:r}=this.Ot();this.featureFlagEventHandlers.forEach(s=>s(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Bs)||{};this._instance.register({[Bs]:$({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Bs)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(dr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(s=>{r[s]=$({},r[s],e[s]),delete e[s]}),this._instance.register({[dr]:$({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(dr)||{};this._instance.register({[dr]:$({},n,{[e]:{}})})}else this._instance.unregister(dr)}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 aS=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ol{constructor(e,n){this.N=e,this.props={},this.Mt=!1,this.At=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.B=this.jt(e),this.load(),e.debug&&z.info("Persistence loaded",e.persistence,$({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Dt}jt(e){aS.indexOf(e.persistence.toLowerCase())===-1&&(z.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(s){s===void 0&&(s=[]);var i=[...SP,...s];return $({},Re,{j:function(a){try{var l={};try{l=ln.j(a)||{}}catch{}var c=Me(l,JSON.parse(Re.A(a)||"{}"));return Re.D(a,c),c}catch{}return null},D:function(a,l,c,u,d,p){try{Re.D(a,l,void 0,void 0,p);var f={};i.forEach(m=>{l[m]&&(f[m]=l[m])}),Object.keys(f).length&&ln.D(a,f,c,u,d,p)}catch(m){Re.M(m)}},L:function(a,l){try{A?.localStorage.removeItem(a),ln.L(a,l)}catch(c){Re.M(c)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&Re.O()?Re:r==="localstorage+cookie"&&n.O()?n:r==="sessionstorage"&&We.O()?We:r==="memory"?kP:r==="cookie"?ln:n.O()?n:ln}properties(){var e={};return Ee(this.props,function(n,r){if(r===Ur&&$e(n))for(var s=Object.keys(n),i=0;i<s.length;i++)e["$feature/"+s[i]]=n[s[i]];else l=r,c=!1,(nn(a=bP)?c:yh&&a.indexOf===yh?a.indexOf(l)!=-1:(Ee(a,function(u){if(c||(c=u===l))return Li}),c))||(e[r]=n);var a,l,c}),e}load(){if(!this.Dt){var e=this.B.j(this.At);e&&(this.props=Me({},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,r){if($e(e)){B(n)&&(n="None"),this.Lt=B(r)?this.zt:r;var s=!1;if(Ee(e,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,s=!0)}),s)return this.save(),!0}return!1}register(e,n){if($e(e)){this.Lt=B(n)?this.zt:n;var r=!1;if(Ee(e,(s,i)=>{e.hasOwnProperty(i)&&this.props[i]!==s&&(this.props[i]=s,r=!0)}),r)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=Tv(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);Br(Au(e))||this.register(e),this.Mt=!0}}update_search_keyword(){var e;this.register((e=F?.referrer)?Sv(e):{})}update_referrer_info(){var e;this.register_once({$referrer:kv(),$referring_domain:F!=null&&F.referrer&&((e=Bi(F.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[pc]||this.props[fc]||this.register_once({[Vi]:Rv(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ee([fc,pc],a=>{var l=this.props[a];l&&Ee(l,function(c,u){e["$initial_"+Ql(u)]=c})});var n,r,s=this.props[Vi];if(s){var i=(n=Av(s),r={},Ee(n,function(a,l){r["$initial_"+Ql(l)]=a}),r);Me(e,i)}return e}safe_merge(e){return Ee(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.zt=this.Lt=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),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 s=this.jt(e),i=this.props;this.clear(),this.B=s,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 r=this.props[Fs]||{};r[e]=n,this.props[Fs]=r,this.save()}remove_event_timer(e){var n=(this.props[Fs]||{})[e];return B(n)||(delete this.props[Fs][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}var Fr=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 zr=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}({}),Ki=function(t){return t.Popover="popover",t.Inline="inline",t}({}),be=Ie("[Surveys]"),Iv="seenSurvey_",lS=(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},ep=t=>((e,n)=>{var r=""+e+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+e+n.id+"_"+n.current_iteration),r})(Iv,t),cS=[yi.Popover,yi.Widget,yi.API],uS={ignoreConditions:!1,ignoreDelay:!1,displayType:Ki.Popover};class Ou{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(r=>r!==n)}}emit(e,n){for(var r of this.Ht[e]||[])r(n);for(var s of this.Ht["*"]||[])s(e,n)}}function Or(t,e,n){if(ce(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class dS{constructor(e){this.Bt=new Ou,this.qt=(n,r)=>this.Wt(n,r)&&this.Gt(n,r)&&this.Vt(n,r)&&this.Jt(n,r),this.Wt=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=e,this.Kt=new Set,this.Yt=new Set}init(){var e;if(!B((e=this._instance)==null?void 0:e._addCaptureHook)){var n;(n=this._instance)==null||n._addCaptureHook((r,s)=>{this.on(r,s)})}}register(e){var n,r;if(!B((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||"")})}),(r=this._instance)!=null&&r.autocapture)){var s,i=new Set;e.forEach(a=>{var l;(l=a.steps)==null||l.forEach(c=>{c!=null&&c.selector&&i.add(c?.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Kt.has(e)||this.Kt.has(n?.event))&&this.Yt&&((r=this.Yt)==null?void 0:r.size)>0&&this.Yt.forEach(s=>{this.Xt(n,s)&&this.Bt.emit("actionCaptured",s.name)})}Qt(e){this.onAction("actionCaptured",n=>e(n))}Xt(e,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.qt(e,r))return!0;return!1}onAction(e,n){return this.Bt.on(e,n)}Gt(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Or(s,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 r;if(n==null||!n.href)return!0;var s=this.ei(e);if(s.length>0)return s.some(l=>Or(l.href,n.href,n.href_matching||"exact"));var i,a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!a&&Or((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}ti(e,n){var r;if(n==null||!n.text)return!0;var s=this.ei(e);if(s.length>0)return s.some(u=>Or(u.text,n.text,n.text_matching||"exact")||Or(u.$el_text,n.text,n.text_matching||"exact"));var i,a,l,c=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(i=function(u){for(var d,p=[],f=/(?::|")text="(.*?)"/g;!ce(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=>Or(u,a,l)))}ii(e,n){var r,s;if(n==null||!n.selector)return!0;var i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$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||jv(n.properties.reduce((r,s)=>{var i=ve(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:i,operator:s.operator||"exact"},r},{}),e?.properties)}}class hS{constructor(e){this._instance=e,this.ri=new Map,this.si=new Map,this.ni=new Map}oi(e,n){return!!e&&jv(e.propertyFilters,n?.properties)}ai(e,n){var r=new Map;return e.forEach(s=>{var i;(i=s.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach(a=>{if(a!=null&&a.name){var l=r.get(a.name)||[];l.push(s.id),r.set(a.name,l)}})}),r}li(e,n,r){var s=(r===Fr.Activation?this.ri:this.si).get(e),i=[];return this.ui(a=>{i=a.filter(l=>s?.includes(l.id))}),i.filter(a=>{var l,c=(l=a.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find(u=>u.name===e);return this.oi(c,n)})}register(e){var n;B((n=this._instance)==null?void 0:n._addCaptureHook)||(this.hi(e),this.di(e))}di(e){var n=e.filter(r=>{var s,i;return((s=r.conditions)==null?void 0:s.actions)&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0});n.length!==0&&(this.vi==null&&(this.vi=new dS(this._instance),this.vi.init(),this.vi.Qt(r=>{this.onAction(r)})),n.forEach(r=>{var s,i,a,l,c;r.conditions&&(s=r.conditions)!=null&&s.actions&&(i=r.conditions)!=null&&(i=i.actions)!=null&&i.values&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((l=this.vi)==null||l.register(r.conditions.actions.values),(c=r.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(r.id),this.ni.set(u.name,d||[r.id])}}))}))}hi(e){var n,r=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}),s=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});(r.length!==0||s.length!==0)&&((n=this._instance)==null||n._addCaptureHook((i,a)=>{this.onEvent(i,a)}),this.ri=this.ai(e,Fr.Activation),this.si=this.ai(e,Fr.Cancellation))}onEvent(e,n){var r,s=this.ci(),i=this.fi(),a=this.pi(),l=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[i])||[];if(a===e&&n&&l.length>0){var c,u;s.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,Fr.Cancellation);f.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(y=>y.id)}),f.forEach(y=>{var g=l.indexOf(y.id);g>=0&&l.splice(g,1),this.mi(y.id)}),this.gi(l))}if(this.ri.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.ri.get(e)});var m=this.li(e,n,Fr.Activation);this.gi(l.concat(m.map(y=>y.id)||[]))}}}onAction(e){var n,r=this.fi(),s=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.ni.has(e)&&this.gi(s.concat(this.ni.get(e)||[]))}gi(e){var n,r=this.ci(),s=this.fi(),i=[...new Set(e)].filter(a=>!this.bi(a));r.info("updating activated items",{activatedItems:i}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[s]:i})}getActivatedIds(){var e,n=this.fi(),r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n];return r||[]}getEventToItemsMap(){return this.ri}yi(){return this.vi}}class pS extends hS{constructor(e){super(e)}fi(){return"$surveys_activated"}pi(){return zr.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 fS{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(ce(n))return be.warn("Flags not loaded yet. Not loading surveys.");var r=ve(n);this.wi=r?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 r=localStorage.key(n);(r!=null&&r.startsWith(Iv)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(s=>localStorage.removeItem(s))}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=Z?.__PosthogExtensions__;if(e){if(!B(this.wi)||this._instance.config.advanced_enable_surveys){var n=this.wi||this._instance.config.advanced_enable_surveys;this.xi=!0;try{var r=e.generateSurveys;if(r)return void this.Si(r,n);var s=e.loadExternalDependency;if(!s)return void this.ki("PostHog loadExternalDependency extension not found.");s(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 pS(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 r,s=this._instance.get_property(cc);if(s&&!n)return e(s,{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=>{r=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(r==null||r({surveys:[],context:u}))}var d,p=i.json.surveys||[],f=p.filter(y=>function(g){return!(!g.start_date||g.end_date)}(y)&&(function(g){var x;return!((x=g.conditions)==null||(x=x.events)==null||(x=x.values)==null||!x.length)}(y)||function(g){var x;return!((x=g.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({[cc]:p});var m={isLoaded:!0};e(p,m),r?.({surveys:p,context:m})}}))}Pi(e){for(var n of this.$i)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){be.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!ce(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);be.warn("init was not called")}Ti(e){var n=null;return this.getSurveys(r=>{var s;n=(s=r.find(i=>i.id===e))!==null&&s!==void 0?s:null}),n}Ii(e){if(ce(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(ce(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 ce(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(r=>{this.getSurveys(s=>{var i,a=(i=s.find(c=>c.id===e))!==null&&i!==void 0?i:null;if(a){var l=this.Ii(a);r({visible:l.eligible,disabledReason:l.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,r){var s;if(ce(this._surveyManager))be.warn("init was not called");else{var i=typeof e=="string"?this.Ti(e):e;if(i!=null&&i.id)if(cS.includes(i.type)){var a=F?.querySelector(n);if(a)return(s=i.appearance)!=null&&s.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,r),be.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,r);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 r;if(ce(this._surveyManager))be.warn("init was not called");else{var s=this.Ti(e);if(s){var i=s;if((r=s.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(i=$({},s,{appearance:$({},s.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==Ki.Popover&&n.initialResponses&&be.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void be.warn("Survey is not eligible to be displayed: ",a.disabledReason)}n.displayType!==Ki.Inline?this._surveyManager.handlePopoverSurvey(i,n):this.renderSurvey(i,n.selector,n.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ce(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 mS{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;ce(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||uv(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Z?.__PosthogExtensions__;if(e&&!B(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 r=e.loadExternalDependency;if(!r)return void this.Mi("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",s=>{s||!e.initConversations?this.Mi("Could not load conversations script",s):this.Oi(e.initConversations),this.Ri=!1})}catch(s){this.Mi("Error initializing conversations",s),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&&!nn(this._conversationsManager)}isVisible(){var e,n;return(e=(n=this._conversationsManager)==null?void 0:n.isVisible())!==null&&e!==void 0&&e}sendMessage(e,n,r){var s=this;return Cn(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,n,r):(Ut.warn("Conversations not available yet."),null)})()}getMessages(e,n){var r=this;return Cn(function*(){return r._conversationsManager?r._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 gS{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,r=(n=e.logs)==null?void 0:n.captureConsoleLogs;!ce(r)&&r&&(this.Ai=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ai&&!this.ji){var e=Ie("[logs]"),n=Z?.__PosthogExtensions__;if(n){var r=n.loadExternalDependency;r?r(this._instance,"logs",s=>{var i;s||(i=n.logs)==null||!i.initializeLogs?e.error("Could not load logs script",s):(n.logs.initializeLogs(this._instance),this.ji=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}var tp=Ie("[RateLimiter]");class vS{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(s=>{tp.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void tp.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:r})}},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,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,l=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(hc))!==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,(s=this.instance.persistence)==null||s.set_property(hc,c),{isRateLimited:u,remainingTokens:c.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Os=Ie("[RemoteConfig]");class Ov{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Di(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.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 Os.info("Using preloaded remote config",this.remoteConfig),this.Ni(this.remoteConfig),void this.Ui();if(this._instance.Rt())return void Os.warn("Remote config is disabled. Falling back to local config.");this.Di(e=>{if(!e)return Os.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){Os.error("Error loading remote config",e)}}stop(){this.zi&&(clearInterval(this.zi),this.zi=void 0)}refresh(){this._instance.Rt()||F?.visibilityState==="hidden"||this._instance.featureFlags.reloadFeatureFlags()}Ui(){this.zi||(this.zi=setInterval(()=>{this.refresh()},3e5))}Ni(e){e||Os.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 _c=3e3;class _S{constructor(e,n){this.Hi=!0,this.Bi=[],this.qi=hn(n?.flush_interval_ms||_c,250,5e3,z.createLogger("flush interval"),_c),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(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Wi($({},r,{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(),r=function(){var i=n[s],a=new Date().getTime();i.data&&ve(i.data)&&Ee(i.data,l=>{l.offset=Math.abs(l.timestamp-a),delete l.timestamp}),e.Wi(i)};for(var s in n)r()}},this.qi))}Ji(){clearTimeout(this.Gi),this.Gi=void 0}Ki(){var e={};return Ee(this.Bi,n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;B(e[i])&&(e[i]=$({},s,{data:[]})),(r=e[i].data)==null||r.push(s.data)}),this.Bi=[],e}}var yS=["retriesPerformedSoFar"];class xS{constructor(e){this.Yi=!1,this.Xi=3e3,this.Bi=[],this._instance=e,this.Bi=[],this.Qi=!0,!B(A)&&"onLine"in A.navigator&&(this.Qi=A.navigator.onLine,this.Zi=()=>{this.Qi=!0,this.te()},this.ie=()=>{this.Qi=!1},Ve(A,"online",this.Zi),Ve(A,"offline",this.ie))}get length(){return this.Bi.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=$g(e,yS);Vr(n)&&(r.url=Wi(r.url,{retry_count:n})),this._instance._send_request($({},r,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(n??0)<10?this.ee($({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(s)}}))}ee(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=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),s=Date.now()+r;this.Bi.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),z.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=[],r=this.Bi.filter(i=>i.retryAt<e||(n.push(i),!1));if(this.Bi=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.se&&(clearTimeout(this.se),this.se=void 0),this.Yi=!1,B(A)||(this.Zi&&(A.removeEventListener("online",this.Zi),this.Zi=void 0),this.ie&&(A.removeEventListener("offline",this.ie),this.ie=void 0)),this.Bi))try{this._instance._send_request($({},e,{transport:"sendBeacon"}))}catch(n){z.error(n)}this.Bi=[]}}class bS{constructor(e){this.ne=()=>{var n,r,s,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,(r=this.oe.maxScrollHeight)!==null&&r!==void 0?r:0),this.oe.lastContentY=u,this.oe.maxContentY=Math.max(u,(s=this.oe.maxContentY)!==null&&s!==void 0?s: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(){Ve(A,"scroll",this.ne,{capture:!0}),Ve(A,"scrollend",this.ne,{capture:!0}),Ve(A,"resize",this.ne)}scrollElement(){if(!this._instance.config.scroll_root_selector)return A?.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 r=A?.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return A&&(A.scrollY||A.pageYOffset||A.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return A&&(A.scrollX||A.pageXOffset||A.document.documentElement.scrollLeft)||0}}var wS=t=>Rv(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties);class np{constructor(e,n,r,s){this.ae=i=>{var a=this.le();if(!a||a.sessionId!==i){var l={sessionId:i,props:this.ue(this._instance)};this.he.register({[dc]:l})}},this._instance=e,this.de=n,this.he=r,this.ue=s||wS,this.de.onSessionId(this.ae)}le(){return this.he.props[dc]}getSetOnceProps(){var e,n=(e=this.le())==null?void 0:e.props;return n?"r"in n?Av(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 Ee(Au(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Ql(r)]=n}),e}}var il=Ie("[SessionId]");class rp{on(e,n){return this.ve.on(e,n)}constructor(e,n,r){var s;if(this.ce=[],this.fe=void 0,this.ve=new Ou,this.pe=(d,p)=>!(!Vr(d)||!Vr(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=r||Yn;var i=this.N.persistence_name||this.N.token,a=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*hn(a,60,36e3,il.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=We.j(this.we),c=We.j(this.xe);l&&!c?this._e=l:We.L(this.we),We.D(this.xe,!0)}if((s=this.N.bootstrap)!=null&&s.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){il.error("Invalid sessionID in bootstrap",d)}this.Se()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return B(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&&We.O()}ke(e){e!==this._e&&(this._e=e,this.$e()&&We.D(this.we,e))}Pe(){return this._e?this._e:this.$e()?We.j(this.we):null}Ee(e,n,r){e===this.ge&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.ge=e,this.he.register({[Ni]:[n,e,r]}))}Te(){var e=this.he.props[Ni];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&&A&&(A.removeEventListener("beforeunload",this.fe,{capture:!1}),this.fe=void 0),this.ce=[]}Se(){this.fe=()=>{this.$e()&&We.L(this.xe)},Ve(A,"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 r=n||new Date().getTime(),[s,i,a]=this.Te(),l=this.Pe(),c=Vr(a)&&Math.abs(r-a)>864e5,u=!1,d=!i,p=!d&&!e&&this.pe(r,s);d||p||c?(i=this.me(),l=this.be(),il.info("new session ID generated",{sessionId:i,windowId:l,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:c}}),a=r,u=!0):l||(l=this.be(),u=!0);var f=Vr(s)&&e&&!c?s:r,m=Vr(a)?a:new Date().getTime();return this.ke(l),this.Ee(i,f,m),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:m,changeReason:u?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:s}}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 Dv=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&wh(n,e))return!0;try{var r=t?.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>wh(s?.brand,e)))return!0}catch{}return!!t.webdriver},zs=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),sp="i.posthog.com";class ES{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("."+sp,".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]=zs.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ce[this.apiHost]=zs.EU:this.Ce[this.apiHost]=zs.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===zs.CUSTOM)return this.apiHost+n;var r=sp+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var jS={icontains:(t,e)=>!!A&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!A&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!A&&Gi(e.href,t),not_regex:(t,e)=>!!A&&!Gi(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Tt{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(s=>{Tt.Re("retrieved web experiments from the server"),n.Fe=new Map,s.forEach(i=>{if(i.feature_flag_key){var a;n.Fe&&(Tt.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);Fe(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];Tt.Me(u)&&n.Oe(i.name,c,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())Tt.Re("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ce(this.Fe))return this.Fe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Tt.Re("applying feature flags",e),e.forEach(n=>{var r;if(this.Fe&&(r=this.Fe)!=null&&r.has(n)){var s,i=this._instance.getFeatureFlag(n),a=(s=this.Fe)==null?void 0:s.get(n);i&&a!=null&&a.variants[i]&&this.Oe(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var e=Tt.getWindowLocation();if(e!=null&&e.search){var n=Ui(e?.search,"__experiment_id"),r=Ui(e?.search,"__experiment_variant");n&&r&&(Tt.Re("previewing web experiments "+n+" && "+r),this.getWebExperiments(s=>{this.Ae(parseInt(n),r,s)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);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,r){var s=r.filter(i=>i.id===e);s&&s.length>0&&(Tt.Re("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.Oe(s[0].name,n,s[0].variants[n].transforms))}static Me(e){return!ce(e.conditions)&&Tt.je(e)&&Tt.De(e)}static je(e){var n;if(ce(e.conditions)||ce((n=e.conditions)==null?void 0:n.url))return!0;var r,s,i,a=Tt.getWindowLocation();return!!a&&((r=e.conditions)==null||!r.url||jS[(s=(i=e.conditions)==null?void 0:i.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return A?.location}static De(e){var n;if(ce(e.conditions)||ce((n=e.conditions)==null?void 0:n.utm))return!0;var r=Tv();if(r.utm_source){var s,i,a,l,c,u,d,p,f=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,m=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.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)==r.utm_medium,g=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return f&&y&&g&&m}return!1}static Re(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];z.info("[WebExperiments] "+e,r)}Oe(e,n,r){this._is_bot()?Tt.Re("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(s=>{if(s.selector){var i;Tt.Re("applying transform of variant "+n+" for experiment "+e+" ",s);var a=(i=document)==null?void 0:i.querySelectorAll(s.selector);a?.forEach(l=>{var c=l;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)})}}):Tt.Re("Control variants leave the page unmodified.")}_is_bot(){return Vt&&this._instance?Dv(Vt,this._instance.config.custom_blocked_useragents):void 0}}var TS=Ie("[PostHog ExternalIntegrations]"),PS={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class SS{constructor(e){this._instance=e}V(e,n){var r;(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,s=>{if(s)return TS.error("failed to load script",s);n()})}startIfEnabledOrStop(){var e=this,n=function(a){var l,c,u;!s||(l=Z.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]||e.V(PS[a],()=>{var d;(d=Z.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[a])==null||d.start(e._instance)}),!s&&(c=Z.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[a]&&((u=Z.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[r,s]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(r)}}}var Qs={},al=0,yc=()=>{},$r="posthog",Lv=!WP&&At?.indexOf("MSIE")===-1&&At?.indexOf("Mozilla")===-1,op=t=>{var e;return $({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xP(F?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:yc,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:Ge&&Fe(Ge?.search)&&Ge.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:(A==null||(e=A.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 r="Bad HTTP status: "+n.statusCode+" "+n.text;z.error(r)},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:_c},error_tracking:{},_onCapture:yc,__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))},ip=t=>{var e={};B(t.process_person)||(e.person_profiles=t.process_person),B(t.xhr_headers)||(e.request_headers=t.xhr_headers),B(t.cookie_name)||(e.persistence_name=t.cookie_name),B(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),B(t.store_google)||(e.save_campaign_params=t.store_google),B(t.verbose)||(e.debug=t.verbose);var n=Me({},e,t);return ve(t.property_blacklist)&&(B(t.property_denylist)?n.property_denylist=t.property_blacklist:ve(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:z.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class kS{constructor(){this.__forceAllowLocalhost=!1}get Le(){return this.__forceAllowLocalhost}set Le(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class pn{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 kS,this.Ne=!1,this.version=An.LIB_VERSION,this.Tt=new Ou,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=op(),this.SentryIntegration=OP,this.sentryIntegration=e=>function(n,r){var s=vv(n,r);return{name:gv,processEvent:i=>s(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 iS(this),this.toolbar=new NP(this),this.scrollManager=new bS(this),this.pageViewManager=new Uh(this),this.surveys=new fS(this),this.conversations=new mS(this),this.logs=new gS(this),this.experiments=new Tt(this),this.exceptions=new GP(this),this.rateLimiter=new vS(this),this.requestRouter=new ES(this),this.consent=new RP(this),this.externalIntegrations=new SS(this),this.people={set:(e,n,r)=>{var s=Fe(e)?{[e]:n}:e;this.setPersonProperties(s),r?.({})},set_once:(e,n,r)=>{var s=Fe(e)?{[e]:n}:e;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",e=>z.info('send "'+e?.event+'"',e))}init(e,n,r){if(r&&r!==$r){var s,i=(s=Qs[r])!==null&&s!==void 0?s:new pn;return i._init(e,n,r),Qs[r]=i,Qs[$r][r]=i,i}return this._init(e,n,r)}_init(e,n,r){var s;if(n===void 0&&(n={}),B(e)||ec(e))return z.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(Me({},op(n.defaults),ip(n),{name:r,token:e})),this.config.on_xhr_error&&z.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:cn.GZipJS;var i=this.Ve();this.persistence=new ol(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ol($({},this.config,{persistence:"sessionStorage"}),i);var a=$({},this.persistence.props),l=$({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Je=new _S(w=>this.Ke(w),this.config.request_queue_config),this.Ye=new xS(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 rp(this),this.sessionPropsManager=new np(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(z.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Xe(c)},0)):(z.info("Initializing extensions synchronously"),this.Xe(c)),An.DEBUG=An.DEBUG||this.config.debug,An.DEBUG&&z.info("Starting in debug mode",{this:this,config:n,thisC:$({},this.config),p:a,s:l}),((s=n.bootstrap)==null?void 0:s.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(an,(d=n.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:f})}if(this.Qe()){var m,y,g=Object.keys(((m=n.bootstrap)==null?void 0:m.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=>g[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:g,featureFlagPayloads:x})}if(c)this.register_once({distinct_id:Ss,$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(an,"anonymous")}return Ve(A,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?IP(this,()=>this.Ze()):this.Ze(),On(this.config._onCapture)&&this.config._onCapture!==yc&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",w=>this.config._onCapture(w.event,w))),this.config.ip&&z.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(),r=$({},pn.__defaultExtensionClasses,this.config.__extensionClasses);r.historyAutocapture&&(this.historyAutocapture=new r.historyAutocapture(this),this.historyAutocapture.startIfEnabled());var s=[];r.tracingHeaders&&s.push(()=>{new r.tracingHeaders(this).startIfEnabledOrStop()}),r.siteApps&&s.push(()=>{var i;this.siteApps=new r.siteApps(this),(i=this.siteApps)==null||i.init()}),!e&&r.sessionRecording&&s.push(()=>{this.sessionRecording=new r.sessionRecording(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),r.autocapture&&s.push(()=>{this.autocapture=new r.autocapture(this),this.autocapture.startIfEnabled()}),s.push(()=>{this.surveys.loadIfEnabled()}),s.push(()=>{this.logs.loadIfEnabled()}),s.push(()=>{this.conversations.loadIfEnabled()}),r.productTours&&s.push(()=>{this.productTours=new r.productTours(this),this.productTours.loadIfEnabled()}),r.heatmaps&&s.push(()=>{this.heatmaps=new r.heatmaps(this),this.heatmaps.startIfEnabled()}),r.webVitalsAutocapture&&s.push(()=>{this.webVitalsAutocapture=new r.webVitalsAutocapture(this)}),r.exceptionObserver&&s.push(()=>{this.exceptionObserver=new r.exceptionObserver(this),this.exceptionObserver.startIfEnabledOrStop()}),r.deadClicksAutocapture&&s.push(()=>{this.deadClicksAutocapture=new r.deadClicksAutocapture(this,CP),this.deadClicksAutocapture.startIfEnabledOrStop()}),s.push(()=>{if(this.tr){var i=this.tr;this.tr=void 0,this.Ni(i)}}),this.ir(s,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 r=e.shift();if(r)try{r()}catch(i){z.error("Error initializing extension:",i)}}var s=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:s}),this.config.__preview_deferred_init_extensions&&z.info("PostHog extensions initialized ("+s+"ms)")}Ni(e){var n,r,s,i,a,l,c,u,d;if(!F||!F.body)return z.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,cn.GZipJS)?cn.GZipJS:le(e.supportedCompression,cn.Base64)?cn.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"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(s=this.sessionRecording)==null||s.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(r){z.critical("`loaded` function failed",r)}if(this.er(),this.config.internal_or_test_user_hostname&&Ge!=null&&Ge.hostname){var e=Ge.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 Ov(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&&(Lv?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wi(e.url,{ip:this.config.ip?1:0}),e.headers=$({},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 r,s,i,a=$({},n);a.timeout=a.timeout||6e4,a.url=Wi(a.url,{_:new Date().getTime().toString(),ver:An.LIB_VERSION,compression:a.compression});var l=(r=a.transport)!==null&&r!==void 0?r:"fetch",c=_i.filter(d=>!a.disableTransport||!d.transport||!a.disableTransport.includes(d.transport)),u=(s=(i=cv(c,d=>d.transport===l))==null?void 0:i.method)!==null&&s!==void 0?s:c[0].method;if(!u)throw new Error("No available transport method");u(a)})($({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(s=this.config).on_request_error)==null||r.call(s,n)),e.callback==null||e.callback(n)}}))))}Ke(e){this.Ye?this.Ye.retriableRequest(e):this._send_request(e)}_execute_array(e){al++;try{var n,r=[],s=[],i=[];Xn(e,l=>{l&&(n=l[0],ve(n)?i.push(l):On(l)?l.call(this):ve(l)&&n==="alias"?r.push(l):ve(l)&&n.indexOf("capture")!==-1&&On(this[n])?i.push(l):s.push(l))});var a=function(l,c){Xn(l,function(u){if(ve(u[0])){var d=c;Ee(u,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};a(r,this),a(s,this),a(i,this)}finally{al--}}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(al>0&&ve(e)&&Fe(e[0])){var n=pn.prototype[e[0]];On(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Je){if(this.is_capturing())if(!B(e)&&Fe(e)){var i=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(i&&!this.config.__preview_capture_bot_pageviews)){var a=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){n!=null&&n.$current_url&&!Fe(n?.$current_url)&&(z.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"||r!=null&&r.ft||z.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=r?.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),r?.$set&&(d.$set=r?.$set);var p,f=e!=="$groupidentify",m=this.ar(r?.$set_once,f);if(m&&(d.$set_once=m),(d=_P(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,B(r?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),e===zr.DISMISSED||e===zr.SENT){var y=n?.[xi.SURVEY_ID],g=n?.[xi.SURVEY_ITERATION];p={id:y,current_iteration:g},localStorage.getItem(ep(p))||localStorage.setItem(ep(p),"true"),d.$set=$({},d.$set,{[lS({id:y,current_iteration:g},e===zr.SENT?"responded":"dismissed")]:!0})}else e===zr.SHOWN&&(d.$set=$({},d.$set,{[xi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var x=$({},d.properties.$set,d.$set);if(Br(x)||this.setPersonPropertiesForFlags(x),!ce(this.config.before_send)){var b=this.lr(d);if(!b)return;d=b}this.Tt.emit("eventCaptured",d);var w={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ke(w):this.Je.enqueue(w),d}z.critical("This capture call is ignored due to client rate limiting.")}}else z.error("No event name provided to posthog.capture")}else z.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var a=i?void 0:this.persistence.remove_event_timer(e),l=$({},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=$({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!Fe(l.distinct_id)&&!Vn(l.distinct_id)||ec(l.distinct_id))&&z.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=XP(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime());l.$session_id=p,l.$window_id=f}this.sessionPropsManager&&Me(l,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Me(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(m=this.Ye)==null?void 0:m.length}catch(b){l.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===zs.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||i?e!=="$pageleave"||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Me(l,u),e==="$pageview"&&F&&(l.title=F.title),!B(a)){var y=r.getTime()-a;l.$duration=parseFloat((y/1e3).toFixed(3))}At&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Me({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),ve(this.config.property_denylist)?Ee(this.config.property_denylist,function(b){delete l[b]}):z.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(z.error("sanitize_properties is deprecated. Use before_send instead"),l=g(l,e));var x=this.ur();return l.$process_person_profile=x,x&&!i&&this.hr("_calculate_event_properties"),l}ar(e,n){var r;if(n===void 0&&(n=!0),!this.persistence||!this.ur()||this.Ne)return e;var s=this.persistence.get_initial_props(),i=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),a=Me({},s,i||{},e||{}),l=this.config.sanitize_properties;return l&&(z.error("sanitize_properties is deprecated. Use before_send instead"),a=l(a,"$set_once")),n&&(this.Ne=!0),Br(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}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,r){var s=r!=null&&r.merge?this.featureFlags.getFlagVariants():{},i=r!=null&&r.merge?this.featureFlags.getFlagPayloads():{},a=$({},s,e),l=$({},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:B(l?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}}}this.featureFlags.receivedFeatureFlags({flags:c})}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}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,r;return(n=(r=this.sessionManager)==null?void 0:r.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=uS),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,r){if(!this.__loaded||!this.persistence)return z.uninitializedWarning("posthog.identify");if(Vn(e)&&(e=e.toString(),z.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()))z.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!==Ss){if(this.hr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==s&&e!==this.get_property(Vs)&&(this.unregister(Vs),this.register({distinct_id:e}));var a=(this.persistence.get_property(an)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(an,"identified"),this.setPersonPropertiesForFlags($({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Be=qh(e,n,r),this.featureFlags.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Mi))}}else z.critical('The string "'+Ss+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else z.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.hr("posthog.setPersonProperties")){var r=qh(this.get_distinct_id(),e,n);this.Be!==r?(this.setPersonPropertiesForFlags($({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Be=r):z.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var s=this.getGroups();s[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:$({},s,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===n||r||this.reloadFeatureFlags()}else z.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,r,s,i,a;if(z.info("reset"),!this.__loaded)return z.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),(s=this.sr)==null||s.stop(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(an,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Be=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Ss,$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:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(e,n){return e===this.get_property(dv)?(z.critical("Attempting to create alias for existing People user - aborting."),-2):this.hr("posthog.alias")?(B(n)&&(n=this.get_distinct_id()),e!==n?(this.dr(Vs,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(z.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=$({},this.config);if($e(e)){var r,s,i,a,l,c,u,d;Me(this.config,ip(e));var p=this.Ve();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ol($({},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,Re.O()&&Re.D("ph_debug","true"),z.info("set_config",{config:e,oldConfig:n,newConfig:$({},this.config)})):(An.DEBUG=!1,Re.O()&&Re.L("ph_debug"))),(s=this.exceptionObserver)==null||s.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,r={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(r).some(Boolean)){var s,i,a,l,c;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),r.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),r.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),r.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),r.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 r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent($({},s,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:$r;return n!==$r&&(n=$r+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(an))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(an))==="identified"}ur(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Br(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Vs])&&((n=this.persistence)==null||(n=n.props)==null||!n[Fi]))}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"?(z.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dr(Fi,!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,r,s,i=this.Ve();return((e=this.persistence)==null?void 0:e.Dt)!==i&&((r=this.persistence)==null||r.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.Dt)!==i&&((s=this.sessionPersistence)==null||s.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 r,s,i,a,l;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new rp(this),this.pageViewManager=new Uh(this),this.persistence&&(this.sessionPropsManager=new np(this,this.sessionManager,this.persistence));var c=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(l=pn.__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(),(B(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 z.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,n,r;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:Ss,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.rr())):z.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 Vt?Dv(Vt,this.config.custom_blocked_useragents):void 0}rr(){F&&(F.visibilityState==="visible"?this.Ue||(this.Ue=!0,this.capture("$pageview",{title:F.title},{send_instantly:!0}),this.ze&&(F.removeEventListener("visibilitychange",this.ze),this.ze=null)):this.ze||(this.ze=this.rr.bind(this),Ve(F,"visibilitychange",this.ze)))}debug(e){e===!1?(A?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(A?.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,r,s,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?(z.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):(r="advanced_disable_decide",s=!1,i=z,a=(n="advanced_disable_flags")in(e=c)&&!ce(e[n]),l=r in e&&!ce(e[r]),a?e[n]:l?(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):s)}lr(e){if(ce(this.config.before_send))return e;var n=ve(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of n){if(r=s(r),ce(r)){var i="Event '"+e.event+"' was rejected in beforeSend function";return LT(e.event)?z.warn(i+". This can cause unexpected behavior."):z.info(i),null}r.properties&&!Br(r.properties)||z.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}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,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}qe(e){var n=Ln(e)&&!e,r=Re.O()&&Re.A("ph_debug")==="true";return!n&&(!!r||e)}}pn.__defaultExtensionClasses={},function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=vP(t.prototype[e[n]])}(pn,["identify"]);function ap(t){return t instanceof Element&&(t.id===fv||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function xa(t){return!!t&&t.nodeType===1}function Zn(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Nv(t){return!!t&&t.nodeType===3}function Mv(t){return!!t&&t.nodeType===11}function Du(t){return t?_a(t).split(/\s+/):[]}function lp(t){var e=A?.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function qi(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 Du(e)}function Vv(t){return ce(t)?null:_a(t).split(/(\s+)/).filter(e=>bo(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function No(t){var e="";return xc(t)&&!Uv(t)&&t.childNodes&&t.childNodes.length&&Ee(t.childNodes,function(n){var r;Nv(n)&&n.textContent&&(e+=(r=Vv(n.textContent))!==null&&r!==void 0?r:"")}),_a(e)}function cp(t){return B(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Lu=["a","button","form","input","select","textarea","label"];function Fv(t,e){if(B(e))return!0;var n,r=function(i){if(e.some(a=>i.matches(a)))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function $v(t){var e=t.parentNode;return!(!e||!xa(e))&&e}var RS=["next","previous","prev",">","<"],up=10,dp=[".ph-no-rageclick",".ph-no-capture"];function AS(t,e){if(!A||Nu(t))return!1;var n,r,s;if(Ln(e)?(n=!!e&&dp,r=void 0):(n=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:dp,r=e?.content_ignorelist),n===!1)return!1;var{targetElementList:i}=Bv(t,!1);return!function(a,l){if(a===!1||B(a))return!1;var c;if(a===!0)c=RS;else{if(!ve(a))return!1;if(a.length>up)return z.error("[PostHog] content_ignorelist array cannot exceed "+up+" 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))})}(r,i.map(a=>{var l;return{safeText:No(a).toLowerCase(),ariaLabel:((l=a.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}}))&&!Fv(i,n)}var Nu=t=>!t||Zn(t,"html")||!xa(t),Bv=(t,e)=>{if(!A||Nu(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!Zn(s,"body");)if(Mv(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var i=$v(s);if(!i)break;if(e||Lu.indexOf(i.tagName.toLowerCase())>-1)n=!0;else{var a=A.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function CS(t,e,n,r,s){var i,a,l,c;if(n===void 0&&(n=void 0),!A||Nu(t)||(i=n)!=null&&i.url_allowlist&&!lp(n.url_allowlist)||(a=n)!=null&&a.url_ignorelist&&lp(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}=Bv(t,r);if(!function(y,g){var x=g?.element_allowlist;if(B(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)||!Fv(p,(c=n)==null?void 0:c.css_selector_allowlist))return!1;var f=A.getComputedStyle(t);if(f&&f.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var m=t.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return d?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Lu.indexOf(m)>-1||t.getAttribute("contenteditable")==="true")}}function xc(t){for(var e=t;e.parentNode&&!Zn(e,"body");e=e.parentNode){var n=qi(e);if(le(n,"ph-sensitive")||le(n,"ph-no-capture"))return!1}if(le(qi(t),"ph-include"))return!0;var r=t.type||"";if(Fe(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!(Fe(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Uv(t){return!!(Zn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Zn(t,"select")||Zn(t,"textarea")||t.getAttribute("contenteditable")==="true")}var zv="(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})",IS=new RegExp("^(?:"+zv+")$"),OS=new RegExp(zv),Hv="\\d{3}-?\\d{2}-?\\d{4}",DS=new RegExp("^("+Hv+")$"),LS=new RegExp("("+Hv+")");function bo(t,e){return e===void 0&&(e=!0),!(ce(t)||Fe(t)&&(t=_a(t),(e?IS:OS).test((t||"").replace(/[- ]/g,""))||(e?DS:LS).test(t)))}function Wv(t){var e=No(t);return bo(e=(e+" "+Gv(t)).trim())?e:""}function Gv(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Ee(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=No(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Gv(n)).trim())}catch(i){z.error("[AutoCapture]",i)}}),e}function NS(t){return function(e){var n=e.map(r=>{var s,i,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var l of(r.attr_class.sort(),r.attr_class))a+="."+l.replace(/"/g,"");var c=$({},r.text?{text:r.text}:{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(i=r.nth_of_type)!==null&&i!==void 0?i:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return vi(c).sort((d,p)=>{var[f]=d,[m]=p;return f.localeCompare(m)}).forEach(d=>{var[p,f]=d;return u[hp(p.toString())]=hp(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 r,s,i={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(s=n.attr__href)==null?void 0:s.slice(0,2048),attr_class:MS(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 hp(t){return t.replace(/"|\\"/g,'\\"')}function MS(t){var e=t.attr__class;return e?ve(e)?e:Du(e):void 0}class pp{constructor(e){this.disabled=e===!1;var n=$e(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,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<this.thresholdPx&&r-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var ll="$copy_autocapture",fp=Ie("[AutoCapture]");function cl(t,e){return e.length>t?e.slice(0,t)+"...":e}function VS(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!xa(e));return e}function FS(t,e,n,r){var s=t.tagName.toLowerCase(),i={tag_name:s};Lu.indexOf(s)>-1&&!n&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?i.$el_text=cl(1024,Wv(t)):i.$el_text=cl(1024,No(t)));var a=qi(t);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Ee(t.attributes,function(d){var p;if((!Uv(t)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!e&&bo(d.value)&&(p=d.name,!Fe(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=Du(f).join(" ")),i["attr__"+d.name]=cl(1024,f)}});for(var l=1,c=1,u=t;u=VS(u);)l++,u.tagName===t.tagName&&c++;return i.nth_child=l,i.nth_of_type=c,i}function $S(t,e){for(var n,r,{e:s,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=e,u=[t],d=t;d.parentNode&&!Zn(d,"body");)Mv(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var p,f=[],m={},y=!1,g=!1;if(Ee(u,T=>{var j=xc(T);T.tagName.toLowerCase()==="a"&&(y=T.getAttribute("href"),y=j&&y&&bo(y)&&y),le(qi(T),"ph-no-capture")&&(g=!0),f.push(FS(T,i,a,l));var P=function(S){if(!xc(S))return{};var k={};return Ee(S.attributes,function(O){if(O.name&&O.name.indexOf("data-ph-capture-attribute")===0){var R=O.name.replace("data-ph-capture-attribute-",""),N=O.value;R&&N&&bo(N)&&(k[R]=N)}}),k}(T);Me(m,P)}),g)return{props:{},explicitNoCapture:g};if(a||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?f[0].$el_text=Wv(t):f[0].$el_text=No(t)),y){var x,b;f[0].attr__href=y;var w=(x=Bi(y))==null?void 0:x.host,E=A==null||(b=A.location)==null?void 0:b.host;w&&E&&w!==E&&(p=y)}return{props:Me({$event_type:s.type,$ce_version:1},c?{}:{$elements:f},{$elements_chain:NS(f)},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},p&&s.type==="click"?{$external_click_url:p}:{},m)}}var Ds=Ie("[ExceptionAutocapture]");function mp(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],s=n(r);return On(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}var BS=Ie("[TracingHeaders]"),zn=Ie("[Web Vitals]"),gp=9e5;Ie("[SessionRecording]");var bc="[SessionRecording]",Dr=Ie(bc),US=Ie("[Heatmaps]");function vp(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Vn(t.clientX)&&Vn(t.clientY)}var _p=Ie("[Product Tours]"),ul="ph_product_tours",zS=["$set_once","$set"],Hn=Ie("[SiteApps]"),HS={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 Dr.error("started without valid sessionManager"),new Error(bc+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(bc+' 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,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return A&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this._r||(e=this.cr)==null||!e.isStarted){var n=!B(Object.assign)&&!B(Array.from);this._r&&n?(this.br(t),Dr.info("starting")):this.stopRecording()}}br(t){var e,n,r;this._r&&(Z!=null&&(e=Z.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=Z.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yr(t):(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.wr,s=>{if(s)return Dr.error("could not load recorder",s);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(pv)}Er(t){if(this._instance.persistence){var e,n,r=this._instance.persistence,s=()=>{var i=t.sessionRecording===!1?void 0:t.sessionRecording,a=i?.sampleRate,l=ce(a)?null:parseFloat(a);ce(l)&&this.$r();var c=i?.minimumDurationMilliseconds;r.register({[Qo]:$({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:$({capturePerformance:t.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:B(c)?null:c,endpoint:i?.endpoint,triggerMatchType:i?.triggerMatchType,masking:i?.masking,urlTriggers:i?.urlTriggers})})};s(),(e=this.mr)==null||e.call(this),this.mr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?t.sessionRecording!==!1?(this.gr=!1,this.Er(t),this.pr=!0,this.startIfEnabledOrStop()):this.pr=!0:Dr.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):Dr.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=Z.__PosthogExtensions__)==null||!e.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.cr||(this.cr=(n=Z.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.cr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Sr()?this.cr.start(t):this.gr||(this.gr=!0,Dr.info("persisted remote config is stale, requesting fresh config before starting"),new Ov(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))}}},WS={autocapture:class{constructor(t){this.kr=!1,this.Pr=null,this.Tr=!1,this.instance=t,this.rageclicks=new pp(t.config.rageclick),this.Ir=null}get N(){var t,e,n=$e(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}Cr(){if(this.isBrowserSupported()){if(A&&F){var t=n=>{n=n||A?.event;try{this.Rr(n)}catch(r){fp.error("Failed to capture event",r)}};if(Ve(F,"submit",t,{capture:!0}),Ve(F,"change",t,{capture:!0}),Ve(F,"click",t,{capture:!0}),this.N.capture_copied_text){var e=n=>{n=n||A?.event,this.Rr(n,ll)};Ve(F,"copy",e,{capture:!0}),Ve(F,"cut",e,{capture:!0})}}}else fp.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({[Ch]:!!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(r=>{var s=F?.querySelectorAll(r);s?.forEach(i=>{t===i&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[Ch],r=this.Pr;if(nn(r)&&!Ln(n)&&!this.instance.Rt())return!1;var s=(e=this.Pr)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!s}Rr(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=cp(t);Nv(r)&&(r=r.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())&&AS(r,this.instance.config.rageclick)&&this.Rr(t,"$rageclick");var s=e===ll;if(r&&CS(r,t,this.N,s,s?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:a}=$S(r,{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(r);if(l&&l.length>0&&(i.$element_selectors=l),e===ll){var c,u=Vv(A==null||(c=A.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(F?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Fr=(A==null||(e=A.location)==null?void 0:e.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(z.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Or&&this.Or(),this.Or=void 0,z.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(A&&A.history){var n=this;(t=A.history.pushState)!=null&&t.__posthog_wrapped__||mp(A.history,"pushState",r=>function(s,i,a){r.call(this,s,i,a),n.Mr("pushState")}),(e=A.history.replaceState)!=null&&e.__posthog_wrapped__||mp(A.history,"replaceState",r=>function(s,i,a){r.call(this,s,i,a),n.Mr("replaceState")}),this.Ar()}}Mr(t){try{var e,n=A==null||(e=A.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(r){z.error("Error capturing "+t+" pageview",r)}}Ar(){if(!this.Or){var t=()=>{this.Mr("popstate")};Ve(A,"popstate",t),this.Or=()=>{A&&A.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[ic]),this.rageclicks=new pp(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return $e(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 ce(this.instance.config.capture_heatmaps)?ce(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;US.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({[ic]: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"}(F)?setInterval(this.te.bind(this),this.flushIntervalMilliseconds):null}Lr(){A&&F&&(this.Br=this.te.bind(this),Ve(A,"beforeunload",this.Br),this.qr=t=>this.Hr(t||A?.event),Ve(F,"click",this.qr,{capture:!0}),this.Wr=t=>this.Gr(t||A?.event),Ve(F,"mousemove",this.Wr,{capture:!0}),this.Vr=new Fh(this.instance,AP,this.zr.bind(this)),this.Vr.startIfEnabledOrStop(),this.Jr=this.Nr.bind(this),Ve(F,"visibilitychange",this.Jr),this.kr=!0)}Ur(){var t;A&&F&&(this.Br&&A.removeEventListener("beforeunload",this.Br),this.qr&&F.removeEventListener("click",this.qr,{capture:!0}),this.Wr&&F.removeEventListener("mousemove",this.Wr,{capture:!0}),this.Jr&&F.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(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(a,l,c){for(var u=a;u&&xa(u)&&!Zn(u,"body");){if(u===c)return!1;if(le(l,A?.getComputedStyle(u).position))return!0;u=$v(u)}return!1}(cp(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:r),y:t.clientY+(i?0:n),target_fixed:i,type:e}}Hr(t,e){var n;if(e===void 0&&(e="click"),!ap(t.target)&&vp(t)){var r=this.Yr(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Xr($({},r,{type:"rageclick"})),this.Xr(r)}}Gr(t){!ap(t.target)&&vp(t)&&(clearTimeout(this.Kr),this.Kr=setTimeout(()=>{this.Xr(this.Yr(t,"mousemove"))},500))}Xr(t){if(A){var e=A.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,s=n?os([],as,r||[]):[],i=yo(e,s,xo);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(t)}}te(){this.R&&!Br(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Fh,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,r)=>$({},n,{["$web_vitals_"+r.name+"_event"]:$({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ts=n=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(B(s))zn.error("Could not read session ID. Dropping metrics!");else{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.es();B(i)||(ce(n?.name)||ce(n?.value)?zn.error("Invalid metric received",n):this.rs&&n.value>=this.rs?zn.error("Ignoring metric with value >= "+this.rs,n):(this.R.url!==i&&(this.Qr(),this.Zr=setTimeout(this.Qr,this.flushToCaptureTimeoutMs)),B(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=B(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.R.metrics.push($({},n,{$current_url:i,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.R.metrics.length===this.allowedMetrics.length&&this.Qr()))}},this.ss=()=>{if(!this.kr){var n,r,s,i,a=Z.__PosthogExtensions__;B(a)||B(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:s,onINP:i}=a.postHogWebVitalsCallbacks),n&&r&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.ts.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ts.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ts.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.ts.bind(this)),this.kr=!0):zn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.jr=!((e=this._instance.persistence)==null||!e.props[Dh]),this.startIfEnabled()}get allowedMetrics(){var t,e,n=$e(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return ce(n)?((e=this._instance.persistence)==null?void 0:e.props[Nh])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return($e(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=$e(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return t!=null&&t}get rs(){var t=$e(this._instance.config.capture_performance)&&Vn(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:gp;return 0<t&&t<=6e4?gp:t}get isEnabled(){var t=Ge?.protocol;if(t!=="http:"&&t!=="https:")return zn.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=$e(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&&(zn.info("enabled, starting..."),this.V(this.ss))}onRemoteConfig(t){if("capturePerformance"in t){var e=$e(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=$e(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Dh]:e}),this._instance.persistence.register({[Nh]:n})),this.jr=e,this.startIfEnabled()}}V(t){var e,n;if((e=Z.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks)t();else{var r=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=Z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,s=>{s?zn.error("failed to load script",s):t()})}}es(){var t=A?A.location.href:void 0;if(t){var e=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,r=e?os([],as,n||[]):[];return yo(t,r,xo)}zn.error("Could not determine current URL")}}},GS={exceptionObserver:class{constructor(t){var e,n,r;this.ss=()=>{var s;if(A&&this.isEnabled&&(s=Z.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=Z.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Z.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=Z.__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){Ds.error("failed to start",c),this.us()}}},this._instance=t,this.hs=!((e=this._instance.persistence)==null||!e.props[Ih]),this.ds=new VT({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:Ds}),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 $e(t)?e=$({},e,t):(B(t)?this.hs:t)&&(e=$({},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?(Ds.info("enabled"),this.us(),this.V(this.ss)):this.us()}V(t){var e,n;(e=Z.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=Z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return Ds.error("failed to load script",r);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({[Ih]:this.hs}),this.N=this.vs(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.vs()}captureException(t){var e,n,r=(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(r)?Ds.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}},KS={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({[Lh]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.cs||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(Lh)||this.V(()=>this.ps())}V(t){var e,n;(e=Z.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=Z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?_p.error("Could not load product tours script",r):t()})}ps(){var t;!this.cs&&(t=Z.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.cs=Z.__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 r=n.props[ul];if(ve(r)&&!e)return this.fs=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var i=s.statusCode;if(i!==200||!s.json){var a="Product Tours API could not be loaded, status: "+i;return _p.error(a),void t([],{isLoaded:!1,error:a})}var l=ve(s.json.product_tours)?s.json.product_tours:[];this.fs=l,n&&n.register({[ul]:l}),t(l,{isLoaded:!0})}})}else t(this.fs,{isLoaded:!0})}getActiveProductTours(t){ce(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(ul)}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)}}},qS={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=Z._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,r,s,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:m,$set:y}=t;return{event:$({},$g(t,zS),{properties:$({},t.properties,y?{$set:$({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},y)}:{},m?{$set_once:$({},(r=(s=t.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},m)}:{}),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))},r=!1,s=a=>{e.errored=!a,e.loaded=!0,Hn.info("Site app with id "+t.id+" "+(a?"loaded":"errored")),r&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback:a=>{s(a)}});i&&(e.processEvent=i),r=!0}catch(a){Hn.error("Error while initializing PostHog app with config id "+t.id,a),s(!1)}if(r&&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(r){Hn.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,s=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),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var i=function(c){var u;Z["__$$ph_site_app_"+c]=s._instance,(u=Z.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._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.')}}},YS=$({},HS,WS,GS,KS,qS,{tracingHeaders:class{constructor(t){this.xs=void 0,this.$s=void 0,this.ss=()=>{var e,n;B(this.xs)&&((e=Z.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),B(this.$s)&&((n=Z.__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=Z.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=Z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return BS.error("failed to load script",r);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)}}});pn.__defaultExtensionClasses=$({},YS);var yp;(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=(yp=Qs[$r]=new pn,function(){function t(){t.done||(t.done=!0,Lv=!1,Ee(Qs,function(e){e._dom_loaded()}))}F!=null&&F.addEventListener?F.readyState==="complete"?t():Ve(F,"DOMContentLoaded",t,{capture:!1}):A&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),yp);const XS=Object.freeze(Object.defineProperty({__proto__:null,Compression:cn,DisplaySurveyType:Ki,PostHog:pn,SurveyEventName:zr,SurveyEventProperties:xi,SurveyEventType:Fr,SurveyType:yi,default:eo,posthog:eo},Symbol.toStringTag,{value:"Module"})),dl={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})}},ZS=(t,e,n)=>{const r=t[e];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((s,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 JS=function(e){return{type:"backend",init:function(r,s,i){},read:function(r,s,i){if(typeof e=="function"){if(e.length<3){try{var a=e(r,s);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(r,s,i);return}i(null,e&&e[r]&&e[r][s])}}};const wn=["en","zh","bn","es","ja","ko","th","vi","hi","pt","fil","ms","id","my","km","lo"],Kv=["navbar","footer"],QS={"":["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 to(t){const e=t.split("/").filter(Boolean)[0]?.toLowerCase();return wn.includes(e)?e:"en"}function wc(t){const e=t.split("/").filter(Boolean),n=e[0]?.toLowerCase(),s=((wn.includes(n)?e.slice(1):e)[0]||"").toLowerCase(),i=QS[s]??[];return Array.from(new Set([...Kv,...i]))}const ek=typeof window<"u"?to(window.location.pathname):"en";wm.use(JS((t,e)=>ZS(Object.assign({"../locales/bn/about.json":()=>_(()=>import("./about-Bahok3B1.js"),[]),"../locales/bn/auth.json":()=>_(()=>import("./auth-Ba6mm7iV.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-DsWRNyhF.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-BYySRPSC.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-CePz6kk4.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-CfkbwEWS.js"),[]),"../locales/en/about.json":()=>_(()=>import("./about-J97YaPfh.js"),[]),"../locales/en/auth.json":()=>_(()=>import("./auth-BrUPVaFL.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-DMV0mI9M.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-FRh1mpSG.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-DWBjNZym.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-DAz1-7AC.js"),[]),"../locales/es/about.json":()=>_(()=>import("./about-_5B24CX4.js"),[]),"../locales/es/auth.json":()=>_(()=>import("./auth-D7FGXPYQ.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-Ctw8bWwS.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-BmAeoz-G.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-DKCqupPI.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-DnUr7xqA.js"),[]),"../locales/fil/about.json":()=>_(()=>import("./about-Dx72XNnD.js"),[]),"../locales/fil/auth.json":()=>_(()=>import("./auth-3MqGcFXI.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-8dHN0CA6.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-DOFhZdNw.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-PYG8l9Dc.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-BIKOn2iq.js"),[]),"../locales/hi/about.json":()=>_(()=>import("./about-Cp3HBjTC.js"),[]),"../locales/hi/auth.json":()=>_(()=>import("./auth-YkmsIekA.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-4Bo4-B7H.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-TWUxwkBq.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-D3SCaEm1.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-BDDwLQXB.js"),[]),"../locales/id/about.json":()=>_(()=>import("./about-BpI0MEU4.js"),[]),"../locales/id/auth.json":()=>_(()=>import("./auth-Dtht8U3P.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-D2qYPseY.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-Bi_9QKN0.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-2Z2UZjGf.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-Di46BWE2.js"),[]),"../locales/ja/about.json":()=>_(()=>import("./about-9H-iambc.js"),[]),"../locales/ja/auth.json":()=>_(()=>import("./auth-C_MetWNh.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-Cj5cDrB0.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-DYAoCxkn.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-nR-vV99c.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-BXm6XRxc.js"),[]),"../locales/km/about.json":()=>_(()=>import("./about-r7hn2DmP.js"),[]),"../locales/km/auth.json":()=>_(()=>import("./auth--TeEcmqh.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-Dsl0AoIQ.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-uc47QpCa.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-Cs5hK48D.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-D_6t2EkY.js"),[]),"../locales/ko/about.json":()=>_(()=>import("./about-DiF1LEP_.js"),[]),"../locales/ko/auth.json":()=>_(()=>import("./auth-BnHn-Wr2.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-B53NCSOc.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-1KJPb7Xr.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-C8EGXK12.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-Cn4uInsa.js"),[]),"../locales/lo/about.json":()=>_(()=>import("./about-BF0PL3cx.js"),[]),"../locales/lo/auth.json":()=>_(()=>import("./auth-DN8vM0Ll.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-wJar71_x.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-DVf-51wl.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-GO5Oxb1I.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-BPFzOKVO.js"),[]),"../locales/ms/about.json":()=>_(()=>import("./about-CXgQLHH4.js"),[]),"../locales/ms/auth.json":()=>_(()=>import("./auth-C0VEOGdZ.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-CiL76YQC.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-DE0x0EQl.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-DOiqZ20L.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-BQSrlm7h.js"),[]),"../locales/my/about.json":()=>_(()=>import("./about-fk3vED2W.js"),[]),"../locales/my/auth.json":()=>_(()=>import("./auth-DRAv4oEE.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-BvdV-yBF.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-CUZicqy3.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-BVgxvf-o.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-D0MPCU-c.js"),[]),"../locales/pt/about.json":()=>_(()=>import("./about-BSGurmEM.js"),[]),"../locales/pt/auth.json":()=>_(()=>import("./auth-Mvbkii9x.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-l5UjQtqX.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-BQpP8Acp.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-ChjGH43i.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-DL8X7L1A.js"),[]),"../locales/th/about.json":()=>_(()=>import("./about-CPD7D8UI.js"),[]),"../locales/th/auth.json":()=>_(()=>import("./auth-9Um5A5XU.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-C8gefMaD.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-3-pSKUcb.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-KA8l28-C.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-CQIoJAHi.js"),[]),"../locales/vi/about.json":()=>_(()=>import("./about-BnqsduhT.js"),[]),"../locales/vi/auth.json":()=>_(()=>import("./auth-Dkr0aHu0.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-BVGO2y4x.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-CDCO4MtE.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-B44LG7pc.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-BqYBUO0s.js"),[]),"../locales/zh/about.json":()=>_(()=>import("./about-D3eT9WaA.js"),[]),"../locales/zh/auth.json":()=>_(()=>import("./auth-BH4eM53k.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-DOWCMOhT.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-B-YX0dPz.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-BQ1EfpTv.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-CUPWzCAQ.js"),[])}),`../locales/${t}/${e}.json`,4))).use(Mb).init({lng:ek,fallbackLng:"en",defaultNS:"home",ns:[...Kv],partialBundledLanguages:!0,load:"languageOnly",supportedLngs:wn,nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!0}});const qv=h.createContext(void 0),xp=(t,e)=>Promise.race([t,new Promise((n,r)=>setTimeout(()=>r(new Error("Timeout")),e))]),tk=()=>{try{const t=e=>{const n=[];for(let r=0;r<e.length;r++){const s=e.key(r);s&&(s.includes("-auth-token")||s.includes("-code-verifier"))&&n.push(s)}n.forEach(r=>e.removeItem(r))};t(localStorage),t(sessionStorage),sessionStorage.removeItem("pendingAuthRedirect")}catch(t){console.warn("Error purging auth storage:",t)}},nk=({children:t})=>{const[e,n]=h.useState(null),[r,s]=h.useState(null),[i,a]=h.useState(!0),l=h.useRef(!1),c=h.useRef(0),{toast:u}=Tm(),d=h.useCallback(async E=>{const T=E||e?.id;if(T)try{console.log("[AUTH] Refreshing subscription for:",T),await AT(!0)}catch(j){console.error("[AUTH] Error refreshing subscription:",j),dn.error("Subscription refresh failed",{description:"Could not update your subscription status. Please try again later."})}},[e?.id]);h.useEffect(()=>{const{data:{subscription:E}}=W.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}s(j);const P=j?.user?.id??null;n(S=>{const k=S?.id??null;return k===P&&k!==null?S:j?.user??null}),T==="SIGNED_OUT"&&(dl.resetUser(),l.current=!1),a(!1)});return W.auth.getSession().then(({data:{session:T}})=>{s(T),n(T?.user??null),a(!1)}),()=>E.unsubscribe()},[]),h.useEffect(()=>{if(!e||l.current)return;let E=!1;return(async()=>{dl.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:S}=await W.from("profiles").select("avatar_url").eq("id",e.id).single();!E&&!S?.avatar_url&&await W.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 W.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 S=to(window.location.pathname),{error:k}=await W.auth.signUp({email:E,password:T,options:{data:{user_type:j||"free",display_name:P,app_language:S}}});if(k)throw u({title:"Sign up failed",description:k.message,variant:"destructive"}),k}catch(S){throw console.error("Error signing up:",S),S}finally{a(!1)}},m=async(E,T)=>{try{a(!0);const{error:j}=await W.auth.signInWithOAuth({provider:E});if(j)throw u({title:`${T} sign in failed`,description:j.message,variant:"destructive"}),j}catch(j){throw console.error(`Error signing in with ${T}:`,j),j}finally{a(!1)}},y=()=>m("google","Google"),g=()=>m("facebook","Facebook"),x=()=>m("twitter","X"),b=()=>m("azure","Microsoft"),w=async()=>{l.current=!0;try{a(!0),dl.resetUser();try{await xp(W.auth.signOut(),3e3)}catch(E){console.warn("[AUTH] Global sign-out failed/timed out:",E);try{await xp(W.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{tk(),n(null),s(null),a(!1),c.current=Date.now()+2e3,l.current=!1}};return o.jsx(qv.Provider,{value:{user:e,session:r,isLoading:i,signIn:p,signUp:f,signInWithGoogle:y,signInWithFacebook:g,signInWithTwitter:x,signInWithMicrosoft:b,signOut:w,refreshSubscription:d},children:t})},xs=()=>{const t=h.useContext(qv);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},Yv=h.createContext(void 0),rk=({children:t})=>{const[e,n]=h.useState(0),r=h.useRef(!1),s=h.useCallback(a=>{r.current!==a&&(r.current=a,n(l=>Math.max(0,l+(a?1:-1))))},[]),i=h.useMemo(()=>({isBusy:e>0,setBusy:s}),[e,s]);return o.jsx(Yv.Provider,{value:i,children:t})},Mu=()=>{const t=h.useContext(Yv);return t||{isBusy:!1,setBusy:()=>{}}},Xv={"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:"မြန်မာ"}},XM=t=>t.toLowerCase().replace(/[^\w\s-']/g,"").trim(),Zv="ss_lang",no={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:"ລາວ"},sk=60*60*24*365,bp={tl:"fil",in:"id",cmn:"zh",yue:"zh"};function Fn(t){return!!t&&wn.includes(t)}function ok(t){const e=t.trim().toLowerCase().split(/[-_]/)[0];return!e||e==="*"?null:bp[e]?bp[e]:Fn(e)?e:null}function ik(t){for(const e of t){const n=ok(e);if(n)return n}return null}function Jv(){if(typeof navigator>"u")return null;const t=navigator.languages?.length?navigator.languages:navigator.language?[navigator.language]:[];return ik(t)}function ak(){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp(`(?:^|;\\s*)${Zv}=([^;]*)`));if(!t)return null;const e=decodeURIComponent(t[1]);return Fn(e)?e:null}function ro(t){if(typeof document>"u")return;const{hostname:e,protocol:n}=window.location,r=[`${Zv}=${encodeURIComponent(t)}`,"path=/",`max-age=${sk}`,"samesite=lax"];(e==="storysparkle.org"||e.endsWith(".storysparkle.org"))&&r.push("domain=.storysparkle.org"),n==="https:"&&r.push("secure"),document.cookie=r.join("; ")}function wp(t){return t==="en"?null:t==="zh"?"zh-Hans":t in Xv?t:null}function lk(t){const e=wp(t);if(e)return e;const n=Jv();return n&&wp(n)||"zh-Hans"}const hl={async getTranslationLanguage(){try{const{data:{user:t}}=await W.auth.getUser();if(!t)return null;const{data:e,error:n}=await W.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 W.auth.getUser();if(!e)return console.error("No authenticated user found"),!1;const{error:n}=await W.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 W.auth.getUser();if(!t)return null;const{data:e,error:n}=await W.from("profiles").select("preferred_app_language").eq("id",t.id).maybeSingle();if(n)return console.error("Error fetching app language preference:",n),null;const r=e?.preferred_app_language;return Fn(r)?r:null}catch(t){return console.error("Error in getAppLanguage:",t),null}},async setAppLanguage(t){try{const{data:{user:e}}=await W.auth.getUser();if(!e)return!1;const{error:n}=await W.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 W.auth.getUser();if(!e)return!1;const{error:n}=await W.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 W.auth.getUser();if(!t)return console.error("No authenticated user found"),!1;const{error:e}=await W.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}}},Qv=h.createContext(void 0),ck=({children:t})=>{const{i18n:e}=Ce(),n=su(),r=ps(),{isBusy:s}=Mu(),{user:i}=xs(),[a,l]=h.useState(()=>to(typeof window<"u"?window.location.pathname:"/")),[c,u]=h.useState(!1),d=h.useRef(null),p=h.useRef(null),f=[],m={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 x=m[a];if(!x||document.getElementById(x.id))return;const b=document.createElement("link");b.rel="preconnect",b.href="https://fonts.gstatic.com",b.crossOrigin="anonymous",document.head.appendChild(b);const w=document.createElement("link");w.id=x.id,w.rel="stylesheet",w.href=`https://fonts.googleapis.com/css2?family=${x.family}&display=swap`,document.head.appendChild(w)},[a]),h.useEffect(()=>{const x=to(r.pathname),b=wc(r.pathname);l(x);let w=!1;return e.loadNamespaces(b).finally(()=>{!w&&e.language!==x?e.changeLanguage(x):w||e.changeLanguage(x),w||(u(!1),d.current&&(clearTimeout(d.current),d.current=null))}),()=>{w=!0}},[r.pathname,e]);const y=async x=>{if(x===a||s)return;u(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u(!1)},4e3);const b=wn.filter(k=>k!=="en"),w=new RegExp(`^/(${b.join("|")})(?=/|$)`);let E=r.pathname;for(;w.test(E);)E=E.replace(w,"")||"/";E===""&&(E="/");const T=f.includes(E);let j=E;!T&&x!=="en"&&(j=E==="/"?`/${x}/`:`/${x}${E}`);const P=wc(j),S=new Promise(k=>setTimeout(k,400));try{await Promise.all([e.loadNamespaces(P),S])}catch{}l(x),await e.changeLanguage(x),j!==r.pathname&&n(j),u(!1),d.current&&(clearTimeout(d.current),d.current=null),Fn(x)&&(ro(x),p.current=i?.id??null,i&&hl.setAppLanguage(x))};h.useEffect(()=>{if(!i||p.current===i.id)return;p.current=i.id;let x=!1;return(async()=>{const b=to(r.pathname),w=b!=="en",E=await hl.getAppLanguage();if(!x){if(!E){Fn(b)&&(ro(b),hl.seedAppLanguageIfUnset(b));return}ro(E),E!==b&&!w&&y(E)}})(),()=>{x=!0}},[i?.id]);const g=x=>!f.includes(x)&&a!=="en"&&wn.includes(a)?x==="/"?`/${a}/`:`/${a}${x}`:x;return o.jsx(Qv.Provider,{value:{currentLanguage:a,changeLanguage:y,getLocalizedPath:g,isSwitchingLanguage:c},children:t})},$t=()=>{const t=h.useContext(Qv);if(t===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return t},e_=h.createContext({targetElement:null,setLumiTarget:()=>{},onTargetReached:void 0,setOnTargetReached:()=>{}}),t_=()=>h.useContext(e_),uk=({children:t})=>{const[e,n]=h.useState(null),r=h.useRef(void 0),[,s]=h.useState(0),i=h.useCallback(l=>{n(l)},[]),a=h.useCallback(l=>{r.current=l,s(c=>c+1)},[]);return o.jsx(e_.Provider,{value:{targetElement:e,setLumiTarget:i,onTargetReached:r.current,setOnTargetReached:a},children:t})},Vu=h.createContext({});function rr(t){const e=h.useRef(null);return e.current===null&&(e.current=t()),e.current}const Fu=typeof window<"u",Mo=Fu?h.useLayoutEffect:h.useEffect,ba=h.createContext(null),Vo=h.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class dk extends h.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=r instanceof HTMLElement&&r.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=s-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function hk({children:t,isPresent:e,anchorX:n}){const r=h.useId(),s=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||!s.current||!l||!c)return;const f=n==="left"?`left: ${d}`:`right: ${p}`;s.current.dataset.motionPopId=r;const m=document.createElement("style");return a&&(m.nonce=a),document.head.appendChild(m),m.sheet&&m.sheet.insertRule(`
[data-motion-pop-id="${r}"] {
position: absolute !important;
width: ${l}px !important;
height: ${c}px !important;
${f}px !important;
top: ${u}px !important;
}
`),()=>{document.head.removeChild(m)}},[e]),o.jsx(dk,{isPresent:e,childRef:s,sizeRef:i,children:h.cloneElement(t,{ref:s})})}const pk=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a,anchorX:l})=>{const c=rr(fk),u=h.useId(),d=h.useCallback(f=>{c.set(f,!0);for(const m of c.values())if(!m)return;r&&r()},[c,r]),p=h.useMemo(()=>({id:u,initial:e,isPresent:n,custom:s,onExitComplete:d,register:f=>(c.set(f,!1),()=>c.delete(f))}),i?[Math.random(),d]:[n,d]);return h.useMemo(()=>{c.forEach((f,m)=>c.set(m,!1))},[n]),h.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),a==="popLayout"&&(t=o.jsx(hk,{isPresent:n,anchorX:l,children:t})),o.jsx(ba.Provider,{value:p,children:t})};function fk(){return new Map}function n_(t=!0){const e=h.useContext(ba);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=h.useId();h.useEffect(()=>{if(t)return s(i)},[t]);const a=h.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,a]:[!0]}const si=t=>t.key||"";function Ep(t){const e=[];return h.Children.forEach(t,n=>{h.isValidElement(n)&&e.push(n)}),e}const mk=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1,anchorX:l="left"})=>{const[c,u]=n_(a),d=h.useMemo(()=>Ep(t),[t]),p=a&&!c?[]:d.map(si),f=h.useRef(!0),m=h.useRef(d),y=rr(()=>new Map),[g,x]=h.useState(d),[b,w]=h.useState(d);Mo(()=>{f.current=!1,m.current=d;for(let j=0;j<b.length;j++){const P=si(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!==g){let j=[...d];for(let P=0;P<b.length;P++){const S=b[P],k=si(S);p.includes(k)||(j.splice(P,0,S),E.push(S))}return i==="wait"&&E.length&&(j=E),w(Ep(j)),x(d),null}const{forceRender:T}=h.useContext(Vu);return o.jsx(o.Fragment,{children:b.map(j=>{const P=si(j),S=a&&!c?!1:d===b||p.includes(P),k=()=>{if(y.has(P))y.set(P,!0);else return;let O=!0;y.forEach(R=>{R||(O=!1)}),O&&(T?.(),w(m.current),a&&u?.(),r&&r())};return o.jsx(pk,{isPresent:S,initial:!f.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,onExitComplete:S?void 0:k,anchorX:l,children:j},P)})})};function $u(t,e){t.indexOf(e)===-1&&t.push(e)}function Bu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}let gk=()=>{},Ec=()=>{};const vk={skipAnimations:!1,useManualTiming:!1};function Uu(t){let e;return()=>(e===void 0&&(e=t()),e)}const It=t=>t,ls=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class zu{constructor(){this.subscriptions=[]}add(e){return $u(this.subscriptions,e),()=>Bu(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const gn=t=>t*1e3,vn=t=>t/1e3;function Hu(t,e){return e?t*(1e3/e):0}const r_=Uu(()=>window.ScrollTimeline!==void 0);class _k{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 r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e,n){const r=this.animations.map(s=>{if(r_()&&s.attachTimeline)return s.attachTimeline(e);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),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 yk extends _k{then(e,n){return this.finished.finally(e).then(()=>{})}}const jp={value:null,addProjectionMetrics:null},Wu=t=>Array.isArray(t)&&typeof t[0]=="number",xk={};function bk(t,e){const n=Uu(t);return()=>xk[e]??n()}const wo=bk(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),s_=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=t(i/(s-1))+", ";return`linear(${r.substring(0,r.length-2)})`},Hs=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,jc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hs([0,.65,.55,1]),circOut:Hs([.55,0,1,.45]),backIn:Hs([.31,.01,.66,-.59]),backOut:Hs([.33,1.53,.69,.99])};function o_(t,e){if(t)return typeof t=="function"&&wo()?s_(t,e):Wu(t)?Hs(t):Array.isArray(t)?t.map(n=>o_(n,e)||jc.easeOut):jc[t]}function wk(t,e,n,{delay:r=0,duration:s=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=o_(l,s);return Array.isArray(p)&&(d.easing=p),t.animate(d,{delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal",pseudoElement:u})}function Gu(t){return typeof t=="function"&&"applyToOptions"in t}function Ku(t,e){return t?.[e]??t?.default??t}const Yi=2e4;function qu(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Yi;)e+=n,r=t.next(e);return e>=Yi?1/0:e}function Ek(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(qu(r),Yi);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:vn(s)}}function i_(t){return!!(typeof t=="function"&&wo()||!t||typeof t=="string"&&(t in jc||wo())||Wu(t)||Array.isArray(t)&&t.every(i_))}function Tp(t,e){t.timeline=e,t.onfinish=null}const oi=["read","resolveKeyframes","update","preRender","render","postRender"];function jk(t,e){let n=new Set,r=new Set,s=!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,m=!1)=>{const g=m&&s?n:r;return f&&a.add(p),g.has(p)||g.add(p),p},cancel:p=>{r.delete(p),a.delete(p)},process:p=>{if(l=p,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(u),e&&jp.value&&jp.value.frameloop[e].push(c),c=0,n.clear(),s=!1,i&&(i=!1,d.process(p))}};return d}const Tk=40;function a_(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=oi.reduce((b,w)=>(b[w]=jk(i,e?w:void 0),b),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:p,postRender:f}=a,m=()=>{const b=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(b-s.timestamp,Tk),1),s.timestamp=b,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),p.process(s),f.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(m))},y=()=>{n=!0,r=!0,s.isProcessing||t(m)};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:s,steps:a}}const{schedule:fe,cancel:en,state:Ue,steps:pl}=a_(typeof requestAnimationFrame<"u"?requestAnimationFrame:It,!0),{schedule:Yu,cancel:ZM}=a_(queueMicrotask,!1);let bi;function Pk(){bi=void 0}const _n={now:()=>(bi===void 0&&_n.set(Ue.isProcessing||vk.useManualTiming?Ue.timestamp:performance.now()),bi),set:t=>{bi=t,queueMicrotask(Pk)}},Xt={x:!1,y:!1};function l_(){return Xt.x||Xt.y}function Sk(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 Xu(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const s=n?.[t]??r.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}function c_(t,e){const n=Xu(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function Pp(t){return!(t.pointerType==="touch"||l_())}function kk(t,e,n={}){const[r,s,i]=c_(t,n),a=l=>{if(!Pp(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=p=>{Pp(p)&&(u(p),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",a,s)}),i}const u_=(t,e)=>e?t===e?!0:u_(t,e.parentElement):!1,Zu=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Rk=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ak(t){return Rk.has(t.tagName)||t.tabIndex!==-1}const Ws=new WeakSet;function Sp(t){return e=>{e.key==="Enter"&&t(e)}}function fl(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Ck=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Sp(()=>{if(Ws.has(n))return;fl(n,"down");const s=Sp(()=>{fl(n,"up")}),i=()=>fl(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function kp(t){return Zu(t)&&!l_()}function Ik(t,e,n={}){const[r,s,i]=c_(t,n),a=l=>{const c=l.currentTarget;if(!kp(l)||Ws.has(c))return;Ws.add(c);const u=e(c,l),d=(m,y)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",f),!(!kp(m)||!Ws.has(c))&&(Ws.delete(c),typeof u=="function"&&u(m,{success:y}))},p=m=>{d(m,c===window||c===document||n.useGlobalTarget||u_(c,m.target))},f=m=>{d(m,!1)};window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",f,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),l instanceof HTMLElement&&(l.addEventListener("focus",u=>Ck(u,s)),!Ak(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}const Rp=30,Ok=t=>!isNaN(parseFloat(t)),so={current:void 0};class Dk{constructor(e,n={}){this.version="12.6.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=_n.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&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=_n.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ok(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 zu);const r=this.events[e].add(n);return e==="change"?()=>{r(),fe.read(()=>{this.events.change.getSize()||this.stop()})}:r}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,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}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=_n.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Rp)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Rp);return Hu(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 fn(t,e){return new Dk(t,e)}const d_=h.createContext({strict:!1}),Ap={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"]},cs={};for(const t in Ap)cs[t]={isEnabled:e=>Ap[t].some(n=>!!e[n])};function Lk(t){for(const e in t)cs[e]={...cs[e],...t[e]}}const Nk=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 Xi(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Nk.has(t)}let h_=t=>!Xi(t);function Mk(t){t&&(h_=e=>e.startsWith("on")?!Xi(e):t(e))}try{Mk(require("@emotion/is-prop-valid").default)}catch{}function Vk(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(h_(s)||n===!0&&Xi(s)||!e&&!Xi(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function Fk(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const wa=h.createContext({});function Ea(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Eo(t){return typeof t=="string"||Array.isArray(t)}const Ju=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Qu=["initial",...Ju];function ja(t){return Ea(t.animate)||Qu.some(e=>Eo(t[e]))}function p_(t){return!!(ja(t)||t.variants)}function $k(t,e){if(ja(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Eo(n)?n:void 0,animate:Eo(r)?r:void 0}}return t.inherit!==!1?e:{}}function Bk(t){const{initial:e,animate:n}=$k(t,h.useContext(wa));return h.useMemo(()=>({initial:e,animate:n}),[Cp(e),Cp(n)])}function Cp(t){return Array.isArray(t)?t.join(" "):t}const Uk=Symbol.for("motionComponentSymbol");function Hr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function zk(t,e,n){return h.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Hr(n)&&(n.current=r))},[e])}const ed=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Hk="framerAppearId",f_="data-"+ed(Hk),m_=h.createContext({});function Wk(t,e,n,r,s){const{visualElement:i}=h.useContext(wa),a=h.useContext(d_),l=h.useContext(ba),c=h.useContext(Vo).reducedMotion,u=h.useRef(null);r=r||a.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,p=h.useContext(m_);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&Gk(u.current,n,s,p);const f=h.useRef(!1);h.useInsertionEffect(()=>{d&&f.current&&d.update(n,l)});const m=n[f_],y=h.useRef(!!m&&!window.MotionHandoffIsComplete?.(m)&&window.MotionHasOptimisedAnimation?.(m));return Mo(()=>{d&&(f.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),Yu.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?.(m)}),y.current=!1))}),d}function Gk(t,e,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:g_(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||l&&Hr(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function g_(t){if(t)return t.options.allowProjection!==!1?t.projection:g_(t.parent)}function Kk({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){t&&Lk(t);function i(l,c){let u;const d={...h.useContext(Vo),...l,layoutId:qk(l)},{isStatic:p}=d,f=Bk(l),m=r(l,p);if(!p&&Fu){Yk();const y=Xk(d);u=y.MeasureLayout,f.visualElement=Wk(s,m,d,e,y.ProjectionNode)}return o.jsxs(wa.Provider,{value:f,children:[u&&f.visualElement?o.jsx(u,{visualElement:f.visualElement,...d}):null,n(s,l,zk(m,f.visualElement,c),m,p,f.visualElement)]})}i.displayName=`motion.${typeof s=="string"?s:`create(${s.displayName??s.name??""})`}`;const a=h.forwardRef(i);return a[Uk]=s,a}function qk({layoutId:t}){const e=h.useContext(Vu).id;return e&&t!==void 0?e+"-"+t:t}function Yk(t,e){h.useContext(d_).strict}function Xk(t){const{drag:e,layout:n}=cs;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const v_=t=>e=>typeof e=="string"&&e.startsWith(t),td=v_("--"),Zk=v_("var(--"),nd=t=>Zk(t)?Jk.test(t.split("/*")[0].trim()):!1,Jk=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jo={};function Qk(t){for(const e in t)jo[e]=t[e],td(e)&&(jo[e].isCSSVariable=!0)}const bs=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],jr=new Set(bs);function __(t,{layout:e,layoutId:n}){return jr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!jo[t]||t==="opacity")}const ze=t=>!!(t&&t.getVelocity),y_=(t,e)=>e&&typeof t=="number"?e.transform(t):t,En=(t,e,n)=>n>e?e:n<t?t:n,ws={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},To={...ws,transform:t=>En(0,1,t)},ii={...ws,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"),yn=Fo("%"),Q=Fo("px"),eR=Fo("vh"),tR=Fo("vw"),Ip={...yn,parse:t=>yn.parse(t)/100,transform:t=>yn.transform(t*100)},nR={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,radius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,backgroundPositionX:Q,backgroundPositionY:Q},rR={rotate:Gn,rotateX:Gn,rotateY:Gn,rotateZ:Gn,scale:ii,scaleX:ii,scaleY:ii,scaleZ:ii,skew:Gn,skewX:Gn,skewY:Gn,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:To,originX:Ip,originY:Ip,originZ:Q},Op={...ws,transform:Math.round},rd={...nR,...rR,zIndex:Op,size:Q,fillOpacity:To,strokeOpacity:To,numOctaves:Op},sR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oR=bs.length;function iR(t,e,n){let r="",s=!0;for(let i=0;i<oR;i++){const a=bs[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=y_(l,rd[a]);if(!c){s=!1;const d=sR[a]||a;r+=`${d}(${u}) `}n&&(e[a]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function sd(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let a=!1,l=!1;for(const c in e){const u=e[c];if(jr.has(c)){a=!0;continue}else if(td(c)){s[c]=u;continue}else{const d=y_(u,rd[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(e.transform||(a||n?r.transform=iR(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const od=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function x_(t,e,n){for(const r in e)!ze(e[r])&&!__(r,n)&&(t[r]=e[r])}function aR({transformTemplate:t},e){return h.useMemo(()=>{const n=od();return sd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function lR(t,e){const n=t.style||{},r={};return x_(r,n,t),Object.assign(r,aR(t,e)),r}function cR(t,e){const n={},r=lR(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.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=r,n}const uR=["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 id(t){return typeof t!="string"||t.includes("-")?!1:!!(uR.indexOf(t)>-1||/[A-Z]/u.test(t))}const dR={offset:"stroke-dashoffset",array:"stroke-dasharray"},hR={offset:"strokeDashoffset",array:"strokeDasharray"};function pR(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?dR:hR;t[i.offset]=Q.transform(-r);const a=Q.transform(e),l=Q.transform(n);t[i.array]=`${a} ${l}`}function Dp(t,e,n){return typeof t=="string"?t:Q.transform(e+n*t)}function fR(t,e,n){const r=Dp(e,t.x,t.width),s=Dp(n,t.y,t.height);return`${r} ${s}`}function ad(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:a,pathSpacing:l=1,pathOffset:c=0,...u},d,p){if(sd(t,u,p),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:m,dimensions:y}=t;f.transform&&(y&&(m.transform=f.transform),delete f.transform),y&&(s!==void 0||i!==void 0||m.transform)&&(m.transformOrigin=fR(y,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),a!==void 0&&pR(f,a,l,c,!1)}const b_=()=>({...od(),attrs:{}}),ld=t=>typeof t=="string"&&t.toLowerCase()==="svg";function mR(t,e,n,r){const s=h.useMemo(()=>{const i=b_();return ad(i,e,ld(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};x_(i,t.style,t),s.style={...i,...s.style}}return s}function gR(t=!1){return(n,r,s,{latestValues:i},a)=>{const c=(id(n)?mR:cR)(r,i,a,n),u=Vk(r,typeof n=="string",t),d=n!==h.Fragment?{...u,...c,ref:s}:{},{children:p}=r,f=h.useMemo(()=>ze(p)?p.get():p,[p]);return h.createElement(n,{...d,children:f})}}function Lp(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function cd(t,e,n,r){if(typeof e=="function"){const[s,i]=Lp(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=Lp(r);e=e(n!==void 0?n:t.custom,s,i)}return e}const Tc=t=>Array.isArray(t),vR=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),_R=t=>Tc(t)?t[t.length-1]||0:t;function wi(t){const e=ze(t)?t.get():t;return vR(e)?e.toValue():e}function yR({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},r,s,i){const a={latestValues:xR(r,s,i,t),renderState:e()};return n&&(a.onMount=l=>n({props:r,current:l,...a}),a.onUpdate=l=>n(l)),a}const w_=t=>(e,n)=>{const r=h.useContext(wa),s=h.useContext(ba),i=()=>yR(t,e,r,s);return n?i():rr(i)};function xR(t,e,n,r){const s={},i=r(t,{});for(const f in i)s[f]=wi(i[f]);let{initial:a,animate:l}=t;const c=ja(t),u=p_(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"&&!Ea(p)){const f=Array.isArray(p)?p:[p];for(let m=0;m<f.length;m++){const y=cd(t,f[m]);if(y){const{transitionEnd:g,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&&(s[w]=E)}for(const w in g)s[w]=g[w]}}}return s}function ud(t,e,n){const{style:r}=t,s={};for(const i in r)(ze(r[i])||e.style&&ze(e.style[i])||__(i,t)||n?.getValue(i)?.liveStyle!==void 0)&&(s[i]=r[i]);return s}const bR={useVisualState:w_({scrapeMotionValuesFromProps:ud,createRenderState:od})};function E_(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 j_(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const T_=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 P_(t,e,n,r){j_(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(T_.has(s)?s:ed(s),e.attrs[s])}function S_(t,e,n){const r=ud(t,e,n);for(const s in t)if(ze(t[s])||ze(e[s])){const i=bs.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}const Np=["x","y","width","height","cx","cy","r"],wR={useVisualState:w_({scrapeMotionValuesFromProps:S_,createRenderState:b_,onUpdate:({props:t,prevProps:e,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!t.drag;if(!i){for(const l in s)if(jr.has(l)){i=!0;break}}if(!i)return;let a=!e;if(e)for(let l=0;l<Np.length;l++){const c=Np[l];t[c]!==e[c]&&(a=!0)}a&&fe.read(()=>{E_(n,r),fe.render(()=>{ad(r,s,ld(n.tagName),t.transformTemplate),P_(n,r)})})}})};function ER(t,e){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...id(r)?wR:bR,preloadedFeatures:t,useRender:gR(s),createVisualElement:e,Component:r};return Kk(a)}}function Po(t,e,n){const r=t.getProps();return cd(r,e,n!==void 0?n:r.custom,t)}const k_=new Set(["width","height","top","left","right","bottom",...bs]);function jR(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,fn(n))}function TR(t,e){const n=Po(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const l=_R(i[a]);jR(t,a,l)}}function PR(t){return!!(ze(t)&&t.add)}function Pc(t,e){const n=t.getValue("willChange");if(PR(n))return n.add(e)}function R_(t){return t.props[f_]}const A_=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,SR=1e-7,kR=12;function RR(t,e,n,r,s){let i,a,l=0;do a=e+(n-e)/2,i=A_(a,r,s)-t,i>0?n=a:e=a;while(Math.abs(i)>SR&&++l<kR);return a}function $o(t,e,n,r){if(t===e&&n===r)return It;const s=i=>RR(i,0,1,t,n);return i=>i===0||i===1?i:A_(s(i),e,r)}const C_=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,I_=t=>e=>1-t(1-e),O_=$o(.33,1.53,.69,.99),dd=I_(O_),D_=C_(dd),L_=t=>(t*=2)<1?.5*dd(t):.5*(2-Math.pow(2,-10*(t-1))),hd=t=>1-Math.sin(Math.acos(t)),N_=I_(hd),M_=C_(hd),V_=t=>/^0[^.\s]+$/u.test(t);function AR(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||V_(t):!0}const oo=t=>Math.round(t*1e5)/1e5,pd=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CR(t){return t==null}const IR=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fd=(t,e)=>n=>!!(typeof n=="string"&&IR.test(n)&&n.startsWith(t)||e&&!CR(n)&&Object.prototype.hasOwnProperty.call(n,e)),F_=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,l]=r.match(pd);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},OR=t=>En(0,255,t),ml={...ws,transform:t=>Math.round(OR(t))},pr={test:fd("rgb","red"),parse:F_("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ml.transform(t)+", "+ml.transform(e)+", "+ml.transform(n)+", "+oo(To.transform(r))+")"};function DR(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Sc={test:fd("#"),parse:DR,transform:pr.transform},Wr={test:fd("hsl","hue"),parse:F_("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+yn.transform(oo(e))+", "+yn.transform(oo(n))+", "+oo(To.transform(r))+")"},Pt={test:t=>pr.test(t)||Sc.test(t)||Wr.test(t),parse:t=>pr.test(t)?pr.parse(t):Wr.test(t)?Wr.parse(t):Sc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?pr.transform(t):Wr.transform(t)},LR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NR(t){return isNaN(t)&&typeof t=="string"&&(t.match(pd)?.length||0)+(t.match(LR)?.length||0)>0}const $_="number",B_="color",MR="var",VR="var(",Mp="${}",FR=/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 So(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(FR,c=>(Pt.test(c)?(r.color.push(i),s.push(B_),n.push(Pt.parse(c))):c.startsWith(VR)?(r.var.push(i),s.push(MR),n.push(c)):(r.number.push(i),s.push($_),n.push(parseFloat(c))),++i,Mp)).split(Mp);return{values:n,split:l,indexes:r,types:s}}function U_(t){return So(t).values}function z_(t){const{split:e,types:n}=So(t),r=e.length;return s=>{let i="";for(let a=0;a<r;a++)if(i+=e[a],s[a]!==void 0){const l=n[a];l===$_?i+=oo(s[a]):l===B_?i+=Pt.transform(s[a]):i+=s[a]}return i}}const $R=t=>typeof t=="number"?0:t;function BR(t){const e=U_(t);return z_(t)(e.map($R))}const sr={test:NR,parse:U_,createTransformer:z_,getAnimatableNone:BR},UR=new Set(["brightness","contrast","saturate","opacity"]);function zR(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(pd)||[];if(!r)return t;const s=n.replace(r,"");let i=UR.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const HR=/\b([a-z-]*)\(.*?\)/gu,kc={...sr,getAnimatableNone:t=>{const e=t.match(HR);return e?e.map(zR).join(" "):t}},WR={...rd,color:Pt,backgroundColor:Pt,outlineColor:Pt,fill:Pt,stroke:Pt,borderColor:Pt,borderTopColor:Pt,borderRightColor:Pt,borderBottomColor:Pt,borderLeftColor:Pt,filter:kc,WebkitFilter:kc},H_=t=>WR[t];function W_(t,e){let n=H_(t);return n!==kc&&(n=sr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const GR=new Set(["auto","none","0"]);function KR(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!GR.has(i)&&So(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=W_(n,s)}const fr=t=>t*180/Math.PI,Rc=t=>{const e=fr(Math.atan2(t[1],t[0]));return Ac(e)},qR={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Rc,rotateZ:Rc,skewX:t=>fr(Math.atan(t[1])),skewY:t=>fr(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ac=t=>(t=t%360,t<0&&(t+=360),t),Vp=Rc,Fp=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),$p=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),YR={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fp,scaleY:$p,scale:t=>(Fp(t)+$p(t))/2,rotateX:t=>Ac(fr(Math.atan2(t[6],t[5]))),rotateY:t=>Ac(fr(Math.atan2(-t[2],t[0]))),rotateZ:Vp,rotate:Vp,skewX:t=>fr(Math.atan(t[4])),skewY:t=>fr(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Bp(t){return t.includes("scale")?1:0}function Cc(t,e){if(!t||t==="none")return Bp(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=YR,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=qR,s=l}if(!s)return Bp(e);const i=r[e],a=s[1].split(",").map(ZR);return typeof i=="function"?i(a):a[i]}const XR=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Cc(n,e)};function ZR(t){return parseFloat(t.trim())}const Up=t=>t===ws||t===Q,JR=new Set(["x","y","z"]),QR=bs.filter(t=>!JR.has(t));function eA(t){const e=[];return QR.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const us={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})=>Cc(e,"x"),y:(t,{transform:e})=>Cc(e,"y")};us.translateX=us.x;us.translateY=us.y;const mr=new Set;let Ic=!1,Oc=!1;function G_(){if(Oc){const t=Array.from(mr).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=eA(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{r.getValue(i)?.set(a)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Oc=!1,Ic=!1,mr.forEach(t=>t.complete()),mr.clear()}function K_(){mr.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Oc=!0)})}function tA(){K_(),G_()}class md{constructor(e,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(mr.add(this),Ic||(Ic=!0,fe.read(K_),fe.resolveKeyframes(G_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const a=s?.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const c=r.readValue(n,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),s&&a===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),mr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,mr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const q_=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),nA=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function rA(t){const e=nA.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function Y_(t,e,n=1){const[r,s]=rA(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const a=i.trim();return q_(a)?parseFloat(a):a}return nd(s)?Y_(s,e,n+1):s}const X_=t=>e=>e.test(t),sA={test:t=>t==="auto",parse:t=>t},Z_=[ws,Q,yn,Gn,tR,eR,sA],zp=t=>Z_.find(X_(t));class J_ extends md{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=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(),nd(u))){const d=Y_(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!k_.has(r)||e.length!==2)return;const[s,i]=e,a=zp(s),l=zp(i);if(a!==l)if(Up(a)&&Up(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,r=[];for(let s=0;s<e.length;s++)AR(e[s])&&r.push(s);r.length&&KR(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=us[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=us[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 Hp=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(sr.test(t)||t==="0")&&!t.startsWith("url("));function oA(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 iA(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=Hp(s,e),l=Hp(i,e);return!a||!l?!1:oA(t)||(n==="spring"||Gu(n))&&r}const aA=t=>t!==null;function Ta(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(aA),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const lA=40;class Q_{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=_n.now(),this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>lA?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&tA(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=_n.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!iA(e,r,s,i))if(a)this.options.duration=0;else{c&&c(Ta(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 Ae=(t,e,n)=>t+(e-t)*n;function gl(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 cA({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,a=0;if(!e)s=i=a=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=gl(c,l,t+1/3),i=gl(c,l,t),a=gl(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function Zi(t,e){return n=>n>0?e:t}const vl=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},uA=[Sc,pr,Wr],dA=t=>uA.find(e=>e.test(t));function Wp(t){const e=dA(t);if(!e)return!1;let n=e.parse(t);return e===Wr&&(n=cA(n)),n}const Gp=(t,e)=>{const n=Wp(t),r=Wp(e);if(!n||!r)return Zi(t,e);const s={...n};return i=>(s.red=vl(n.red,r.red,i),s.green=vl(n.green,r.green,i),s.blue=vl(n.blue,r.blue,i),s.alpha=Ae(n.alpha,r.alpha,i),pr.transform(s))},hA=(t,e)=>n=>e(t(n)),Bo=(...t)=>t.reduce(hA),Dc=new Set(["none","hidden"]);function pA(t,e){return Dc.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function fA(t,e){return n=>Ae(t,e,n)}function gd(t){return typeof t=="number"?fA:typeof t=="string"?nd(t)?Zi:Pt.test(t)?Gp:vA:Array.isArray(t)?e0:typeof t=="object"?Pt.test(t)?Gp:mA:Zi}function e0(t,e){const n=[...t],r=n.length,s=t.map((i,a)=>gd(i)(i,e[a]));return i=>{for(let a=0;a<r;a++)n[a]=s[a](i);return n}}function mA(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=gd(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function gA(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],a=t.indexes[i][r[i]],l=t.values[a]??0;n[s]=l,r[i]++}return n}const vA=(t,e)=>{const n=sr.createTransformer(e),r=So(t),s=So(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Dc.has(t)&&!s.values.length||Dc.has(e)&&!r.values.length?pA(t,e):Bo(e0(gA(r,s),s.values),n):Zi(t,e)};function t0(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ae(t,e,n):gd(t)(t,e)}const _A=5;function n0(t,e,n){const r=Math.max(e-_A,0);return Hu(n-t(r),e-r)}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},_l=.001;function yA({duration:t=De.duration,bounce:e=De.bounce,velocity:n=De.velocity,mass:r=De.mass}){let s,i,a=1-e;a=En(De.minDamping,De.maxDamping,a),t=En(De.minDuration,De.maxDuration,vn(t)),a<1?(s=u=>{const d=u*a,p=d*t,f=d-n,m=Lc(u,a),y=Math.exp(-p);return _l-f/m*y},i=u=>{const p=u*a*t,f=p*n+n,m=Math.pow(a,2)*Math.pow(u,2)*t,y=Math.exp(-p),g=Lc(Math.pow(u,2),a);return(-s(u)+_l>0?-1:1)*((f-m)*y)/g}):(s=u=>{const d=Math.exp(-u*t),p=(u-n)*t+1;return-_l+d*p},i=u=>{const d=Math.exp(-u*t),p=(n-u)*(t*t);return d*p});const l=5/t,c=bA(s,i,l);if(t=gn(t),isNaN(c))return{stiffness:De.stiffness,damping:De.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:t}}}const xA=12;function bA(t,e,n){let r=n;for(let s=1;s<xA;s++)r=r-t(r)/e(r);return r}function Lc(t,e){return t*Math.sqrt(1-e*e)}const wA=["duration","bounce"],EA=["stiffness","damping","mass"];function Kp(t,e){return e.some(n=>t[n]!==void 0)}function jA(t){let e={velocity:De.velocity,stiffness:De.stiffness,damping:De.damping,mass:De.mass,isResolvedFromDuration:!1,...t};if(!Kp(t,EA)&&Kp(t,wA))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*En(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:De.mass,stiffness:s,damping:i}}else{const n=yA(t);e={...e,...n,mass:De.mass},e.isResolvedFromDuration=!0}return e}function Ji(t=De.visualDuration,e=De.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=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:m}=jA({...n,velocity:-vn(n.velocity||0)}),y=f||0,g=u/(2*Math.sqrt(c*d)),x=a-i,b=vn(Math.sqrt(c/d)),w=Math.abs(x)<5;r||(r=w?De.restSpeed.granular:De.restSpeed.default),s||(s=w?De.restDelta.granular:De.restDelta.default);let E;if(g<1){const j=Lc(b,g);E=P=>{const S=Math.exp(-g*b*P);return a-S*((y+g*b*x)/j*Math.sin(j*P)+x*Math.cos(j*P))}}else if(g===1)E=j=>a-Math.exp(-b*j)*(x+(y+b*x)*j);else{const j=b*Math.sqrt(g*g-1);E=P=>{const S=Math.exp(-g*b*P),k=Math.min(j*P,300);return a-S*((y+g*b*x)*Math.sinh(k)+j*x*Math.cosh(k))/j}}const T={calculatedDuration:m&&p||null,next:j=>{const P=E(j);if(m)l.done=j>=p;else{let S=0;g<1&&(S=j===0?gn(y):n0(E,j,P));const k=Math.abs(S)<=r,O=Math.abs(a-P)<=s;l.done=k&&O}return l.value=l.done?a:P,l},toString:()=>{const j=Math.min(qu(T),Yi),P=s_(S=>T.next(j*S).value,j,30);return j+"ms "+P},toTransition:()=>{}};return T}Ji.applyToOptions=t=>{const e=Ek(t,100,Ji);return t.ease=wo()?e.ease:"easeOut",t.duration=gn(e.duration),t.type="keyframes",t};function qp({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const p=t[0],f={done:!1,value:p},m=k=>l!==void 0&&k<l||c!==void 0&&k>c,y=k=>l===void 0?c:c===void 0||Math.abs(l-k)<Math.abs(c-k)?l:c;let g=n*e;const x=p+g,b=a===void 0?x:a(x);b!==x&&(g=b-p);const w=k=>-g*Math.exp(-k/r),E=k=>b+w(k),T=k=>{const O=w(k),R=E(k);f.done=Math.abs(O)<=u,f.value=f.done?b:R};let j,P;const S=k=>{m(f.value)&&(j=k,P=Ji({keyframes:[f.value,y(f.value)],velocity:n0(E,k,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return S(0),{calculatedDuration:null,next:k=>{let O=!1;return!P&&j===void 0&&(O=!0,T(k),S(k)),j!==void 0&&k>=j?P.next(k-j):(!O&&T(k),f)}}}const TA=$o(.42,0,1,1),PA=$o(0,0,.58,1),r0=$o(.42,0,.58,1),SA=t=>Array.isArray(t)&&typeof t[0]!="number",Yp={linear:It,easeIn:TA,easeInOut:r0,easeOut:PA,circIn:hd,circInOut:M_,circOut:N_,backIn:dd,backInOut:D_,backOut:O_,anticipate:L_},Xp=t=>{if(Wu(t)){Ec(t.length===4);const[e,n,r,s]=t;return $o(e,n,r,s)}else if(typeof t=="string")return Ec(Yp[t]!==void 0),Yp[t];return t};function kA(t,e,n){const r=[],s=n||t0,i=t.length-1;for(let a=0;a<i;a++){let l=s(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||It:e;l=Bo(c,l)}r.push(l)}return r}function vd(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(Ec(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=kA(e,r,s),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=ls(t[p],t[p+1],d);return l[p](f)};return n?d=>u(En(t[0],t[i-1],d)):u}function RA(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ls(0,e,r);t.push(Ae(n,1,s))}}function s0(t){const e=[0];return RA(e,t.length-1),e}function AA(t,e){return t.map(n=>n*e)}function CA(t,e){return t.map(()=>e||r0).splice(0,t.length-1)}function Qi({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=SA(r)?r.map(Xp):Xp(r),i={done:!1,value:e[0]},a=AA(n&&n.length===e.length?n:s0(e),t),l=vd(a,e,{ease:Array.isArray(s)?s:CA(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const IA=t=>{const e=({timestamp:n})=>t(n);return{start:()=>fe.update(e,!0),stop:()=>en(e),now:()=>Ue.isProcessing?Ue.timestamp:_n.now()}},OA={decay:qp,inertia:qp,tween:Qi,keyframes:Qi,spring:Ji},DA=t=>t/100;class Pa extends Q_{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:r,element:s,keyframes:i}=this.options,a=s?.KeyframeResolver||md,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,l=Gu(n)?n:OA[n]||Qi;let c,u;l!==Qi&&typeof e[0]!="number"&&(c=Bo(DA,t0(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+s,m=f*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:p,resolvedDuration:f,totalDuration:m}}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:r}=this;if(!r){const{keyframes:k}=this.options;return{done:!0,value:k[k.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:p}=r;if(this.startTime===null)return i.next(0);const{delay:f,repeat:m,repeatType:y,repeatDelay:g,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(m){const k=Math.min(this.currentTime,d)/p;let O=Math.floor(k),R=k%1;!R&&k>=1&&(R=1),R===1&&O--,O=Math.min(O,m+1),!!(O%2)&&(y==="reverse"?(R=1-R,g&&(R-=g/p)):y==="mirror"&&(T=a)),E=En(0,1,R)*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 S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return S&&s!==void 0&&(j.value=Ta(c,this.options,s)),x&&x(j.value),S&&this.finish(),j}get duration(){const{resolved:e}=this;return e?vn(e.calculatedDuration):0}get time(){return vn(this.currentTime)}set time(e){e=gn(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=vn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=IA,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??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 LA(t){return new Pa(t)}const NA=new Set(["opacity","clipPath","filter","transform"]),MA=Uu(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ea=10,VA=2e4;function FA(t){return Gu(t.type)||t.type==="spring"||!i_(t.ease)}function $A(t,e){const n=new Pa({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<VA;)r=n.sample(i),s.push(r.value),i+=ea;return{times:void 0,keyframes:s,duration:i-ea,ease:"linear"}}const o0={anticipate:L_,backInOut:D_,circInOut:M_};function BA(t){return t in o0}class Zp extends Q_{constructor(e){super(e);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new J_(i,(a,l)=>this.onKeyframesResolved(a,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:r=300,times:s,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()&&BA(i)&&(i=o0[i]),FA(this.options)){const{onComplete:p,onUpdate:f,motionValue:m,element:y,...g}=this.options,x=$A(e,g);e=x.keyframes,e.length===1&&(e[1]=e[0]),r=x.duration,s=x.times,i=x.ease,a="keyframes"}const d=wk(l.owner.current,c,e,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Tp(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:p}=this.options;l.set(Ta(e,this.options,n)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return vn(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return vn(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=gn(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:r}=n;r.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 It;const{animation:r}=n;Tp(r,e)}return It}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:r,duration:s,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,...m}=this.options,y=new Pa({...m,keyframes:r,duration:s,type:i,ease:a,times:l,isGenerator:!0}),g=gn(this.time);u.setWithVelocity(y.sample(g-ea).value,y.sample(g).value,ea)}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:r,repeatDelay:s,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 MA()&&r&&NA.has(r)&&(r!=="transform"||!u)&&!c&&!s&&i!=="mirror"&&a!==0&&l!=="inertia"}}const UA={type:"spring",stiffness:500,damping:25,restSpeed:10},zA=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HA={type:"keyframes",duration:.8},WA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},GA=(t,{keyframes:e})=>e.length>2?HA:jr.has(t)?t.startsWith("scale")?zA(e[1]):UA:WA;function KA({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const _d=(t,e,n,r={},s,i)=>a=>{const l=Ku(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-gn(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:s};KA(l)||(d={...d,...GA(t,d)}),d.duration&&(d.duration=gn(d.duration)),d.repeatDelay&&(d.repeatDelay=gn(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=Ta(d.keyframes,l);if(f!==void 0)return fe.update(()=>{d.onUpdate(f),d.onComplete()}),new yk([])}return!i&&Zp.supports(d)?new Zp(d):new Pa(d)};function qA({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function i0(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:a,...l}=e;r&&(i=r);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const p=t.getValue(d,t.latestValues[d]??null),f=l[d];if(f===void 0||u&&qA(u,d))continue;const m={delay:n,...Ku(i||{},d)};let y=!1;if(window.MotionHandoffAnimation){const x=R_(t);if(x){const b=window.MotionHandoffAnimation(x,d,fe);b!==null&&(m.startTime=b,y=!0)}}Pc(t,d),p.start(_d(d,p,f,t.shouldReduceMotion&&k_.has(d)?{type:!1}:m,t,y));const g=p.animation;g&&c.push(g)}return a&&Promise.all(c).then(()=>{fe.update(()=>{a&&TR(t,a)})}),c}function Nc(t,e,n={}){const r=Po(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(i0(t,r,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:p}=s;return YA(t,e,u+c,d,p,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,u]=l==="beforeChildren"?[i,a]:[a,i];return c().then(()=>u())}else return Promise.all([i(),a(n.delay)])}function YA(t,e,n=0,r=0,s=1,i){const a=[],l=(t.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(t.variantChildren).sort(XA).forEach((u,d)=>{u.notify("AnimationStart",e),a.push(Nc(u,e,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(a)}function XA(t,e){return t.sortNodePosition(e)}function ZA(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Nc(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Nc(t,e,n);else{const s=typeof e=="function"?Po(t,e,n.custom):e;r=Promise.all(i0(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function a0(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const JA=Qu.length;function l0(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?l0(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<JA;n++){const r=Qu[n],s=t.props[r];(Eo(s)||s===!1)&&(e[r]=s)}return e}const QA=[...Ju].reverse(),eC=Ju.length;function tC(t){return e=>Promise.all(e.map(({animation:n,options:r})=>ZA(t,n,r)))}function nC(t){let e=tC(t),n=Jp(),r=!0;const s=c=>(u,d)=>{const p=Po(t,d,c==="exit"?t.presenceContext?.custom:void 0);if(p){const{transition:f,transitionEnd:m,...y}=p;u={...u,...y,...m}}return u};function i(c){e=c(t)}function a(c){const{props:u}=t,d=l0(t.parent)||{},p=[],f=new Set;let m={},y=1/0;for(let x=0;x<eC;x++){const b=QA[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&&r&&t.manuallyAnimateOnMount&&(P=!1),w.protectedKeys={...m},!w.isActive&&j===null||!E&&!w.prevProp||Ea(E)||typeof E=="boolean")continue;const S=rC(w.prevProp,E);let k=S||b===c&&w.isActive&&!P&&T||x>y&&T,O=!1;const R=Array.isArray(E)?E:[E];let N=R.reduce(s(b),{});j===!1&&(N={});const{prevResolvedValues:L={}}=w,q={...L,...N},D=U=>{k=!0,f.has(U)&&(O=!0,f.delete(U)),w.needsAnimating[U]=!0;const C=t.getValue(U);C&&(C.liveStyle=!1)};for(const U in q){const C=N[U],I=L[U];if(m.hasOwnProperty(U))continue;let ee=!1;Tc(C)&&Tc(I)?ee=!a0(C,I):ee=C!==I,ee?C!=null?D(U):f.add(U):C!==void 0&&f.has(U)?D(U):w.protectedKeys[U]=!0}w.prevProp=E,w.prevResolvedValues=N,w.isActive&&(m={...m,...N}),r&&t.blockInitialAnimation&&(k=!1),k&&(!(P&&S)||O)&&p.push(...R.map(U=>({animation:U,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 g=!!p.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(g=!1),r=!1,g?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=Jp(),r=!0}}}function rC(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!a0(e,t):!1}function ur(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Jp(){return{animate:ur(!0),whileInView:ur(),whileHover:ur(),whileTap:ur(),whileDrag:ur(),whileFocus:ur(),exit:ur()}}class or{constructor(e){this.isMounted=!1,this.node=e}update(){}}class sC extends or{constructor(e){super(e),e.animationState||(e.animationState=nC(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ea(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 oC=0;class iC extends or{constructor(){super(...arguments),this.id=oC++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.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 aC={animation:{Feature:sC},exit:{Feature:iC}};function ko(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Uo(t){return{point:{x:t.pageX,y:t.pageY}}}const lC=t=>e=>Zu(e)&&t(e,Uo(e));function io(t,e,n,r){return ko(t,e,lC(n),r)}function c0({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function cC({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function uC(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}const u0=1e-4,dC=1-u0,hC=1+u0,d0=.01,pC=0-d0,fC=0+d0;function kt(t){return t.max-t.min}function mC(t,e,n){return Math.abs(t-e)<=n}function Qp(t,e,n,r=.5){t.origin=r,t.originPoint=Ae(e.min,e.max,t.origin),t.scale=kt(n)/kt(e),t.translate=Ae(n.min,n.max,t.origin)-t.originPoint,(t.scale>=dC&&t.scale<=hC||isNaN(t.scale))&&(t.scale=1),(t.translate>=pC&&t.translate<=fC||isNaN(t.translate))&&(t.translate=0)}function ao(t,e,n,r){Qp(t.x,e.x,n.x,r?r.originX:void 0),Qp(t.y,e.y,n.y,r?r.originY:void 0)}function ef(t,e,n){t.min=n.min+e.min,t.max=t.min+kt(e)}function gC(t,e,n){ef(t.x,e.x,n.x),ef(t.y,e.y,n.y)}function tf(t,e,n){t.min=e.min-n.min,t.max=t.min+kt(e)}function lo(t,e,n){tf(t.x,e.x,n.x),tf(t.y,e.y,n.y)}const nf=()=>({translate:0,scale:1,origin:0,originPoint:0}),Gr=()=>({x:nf(),y:nf()}),rf=()=>({min:0,max:0}),Ne=()=>({x:rf(),y:rf()});function Ht(t){return[t("x"),t("y")]}function yl(t){return t===void 0||t===1}function Mc({scale:t,scaleX:e,scaleY:n}){return!yl(t)||!yl(e)||!yl(n)}function hr(t){return Mc(t)||h0(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function h0(t){return sf(t.x)||sf(t.y)}function sf(t){return t&&t!=="0%"}function ta(t,e,n){const r=t-n,s=e*r;return n+s}function of(t,e,n,r,s){return s!==void 0&&(t=ta(t,s,r)),ta(t,n,r)+e}function Vc(t,e=0,n=1,r,s){t.min=of(t.min,e,n,r,s),t.max=of(t.max,e,n,r,s)}function p0(t,{x:e,y:n}){Vc(t.x,e.translate,e.scale,e.originPoint),Vc(t.y,n.translate,n.scale,n.originPoint)}const af=.999999999999,lf=1.0000000000001;function vC(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,a;for(let l=0;l<s;l++){i=n[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&qr(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,p0(t,a)),r&&hr(i.latestValues)&&qr(t,i.latestValues))}e.x<lf&&e.x>af&&(e.x=1),e.y<lf&&e.y>af&&(e.y=1)}function Kr(t,e){t.min=t.min+e,t.max=t.max+e}function cf(t,e,n,r,s=.5){const i=Ae(t.min,t.max,s);Vc(t,e,n,i,r)}function qr(t,e){cf(t.x,e.x,e.scaleX,e.scale,e.originX),cf(t.y,e.y,e.scaleY,e.scale,e.originY)}function f0(t,e){return c0(uC(t.getBoundingClientRect(),e))}function _C(t,e,n){const r=f0(t,n),{scroll:s}=e;return s&&(Kr(r.x,s.offset.x),Kr(r.y,s.offset.y)),r}const m0=({current:t})=>t?t.ownerDocument.defaultView:null,uf=(t,e)=>Math.abs(t-e);function yC(t,e){const n=uf(t.x,e.x),r=uf(t.y,e.y);return Math.sqrt(n**2+r**2)}class g0{constructor(e,n,{transformPagePoint:r,contextWindow:s,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=bl(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,m=yC(p.offset,{x:0,y:0})>=3;if(!f&&!m)return;const{point:y}=p,{timestamp:g}=Ue;this.history.push({...y,timestamp:g});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=xl(f,this.transformPagePoint),fe.update(this.updatePoint,!0)},this.handlePointerUp=(p,f)=>{this.end();const{onEnd:m,onSessionEnd:y,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=bl(p.type==="pointercancel"?this.lastMoveEventInfo:xl(f,this.transformPagePoint),this.history);this.startEvent&&m&&m(p,x),y&&y(p,x)},!Zu(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Uo(e),l=xl(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Ue;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(e,bl(l,this.history)),this.removeListeners=Bo(io(this.contextWindow,"pointermove",this.handlePointerMove),io(this.contextWindow,"pointerup",this.handlePointerUp),io(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),en(this.updatePoint)}}function xl(t,e){return e?{point:e(t.point)}:t}function df(t,e){return{x:t.x-e.x,y:t.y-e.y}}function bl({point:t},e){return{point:t,delta:df(t,v0(e)),offset:df(t,xC(e)),velocity:bC(e,.1)}}function xC(t){return t[0]}function v0(t){return t[t.length-1]}function bC(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=v0(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>gn(e)));)n--;if(!r)return{x:0,y:0};const i=vn(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function wC(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Ae(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Ae(n,t,r.max):Math.min(t,n)),t}function hf(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 EC(t,{top:e,left:n,bottom:r,right:s}){return{x:hf(t.x,n,s),y:hf(t.y,e,r)}}function pf(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function jC(t,e){return{x:pf(t.x,e.x),y:pf(t.y,e.y)}}function TC(t,e){let n=.5;const r=kt(t),s=kt(e);return s>r?n=ls(e.min,e.max-r,t.min):r>s&&(n=ls(t.min,t.max-s,e.min)),En(0,1,n)}function PC(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 Fc=.35;function SC(t=Fc){return t===!1?t=0:t===!0&&(t=Fc),{x:ff(t,"left","right"),y:ff(t,"top","bottom")}}function ff(t,e,n){return{min:mf(t,e),max:mf(t,n)}}function mf(t,e){return typeof t=="number"?t:t[e]||0}const kC=new WeakMap;class RC{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=Ne(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Uo(d).point)},i=(d,p)=>{const{drag:f,dragPropagation:m,onDragStart:y}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Sk(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),Ht(x=>{let b=this.getAxisMotionValue(x).get()||0;if(yn.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const E=w.layout.layoutBox[x];E&&(b=kt(E)*(parseFloat(b)/100))}}this.originPoint[x]=b}),y&&fe.postRender(()=>y(d,p)),Pc(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,p)=>{const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:y,onDrag:g}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:x}=p;if(m&&this.currentDirection===null){this.currentDirection=AC(x),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",p.point,x),this.updateAxis("y",p.point,x),this.visualElement.render(),g&&g(d,p)},l=(d,p)=>this.stop(d,p),c=()=>Ht(d=>this.getAnimationState(d)==="paused"&&this.getAxisMotionValue(d).animation?.play()),{dragSnapToOrigin:u}=this.getProps();this.panSession=new g0(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:m0(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);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:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!ai(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=wC(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&Hr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=EC(r.layoutBox,e):this.constraints=!1,this.elastic=SC(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ht(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=PC(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Hr(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=_C(r,s.root,this.visualElement.getTransformPagePoint());let a=jC(s.layout.layoutBox,i);if(n){const l=n(cC(a));this.hasMutatedConstraints=!!l,l&&(a=c0(l))}return a}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ht(d=>{if(!ai(d,n,this.currentDirection))return;let p=c&&c[d]||{};a&&(p={min:0,max:0});const f=s?200:1e6,m=s?40:1e7,y={type:"inertia",velocity:r?e[d]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Pc(this.visualElement,e),r.start(_d(e,r,0,n,this.visualElement,!1))}stopAnimation(){Ht(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Ht(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Ht(n=>{const{drag:r}=this.getProps();if(!ai(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[n];i.set(e[n]-Ae(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Hr(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ht(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=TC({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ht(a=>{if(!ai(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Ae(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;kC.set(this.visualElement,this);const e=this.visualElement.current,n=io(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Hr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),fe.read(r);const a=ko(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ht(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:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=Fc,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:l}}}function ai(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function AC(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class CC extends or{constructor(e){super(e),this.removeGroupControls=It,this.removeListeners=It,this.controls=new RC(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||It}unmount(){this.removeGroupControls(),this.removeListeners()}}const gf=t=>(e,n)=>{t&&fe.postRender(()=>t(e,n))};class IC extends or{constructor(){super(...arguments),this.removePointerDownListener=It}onPointerDown(e){this.session=new g0(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:m0(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:gf(e),onStart:gf(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&fe.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=io(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 vf(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ls={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Q.test(t))t=parseFloat(t);else return t;const n=vf(t,e.target.x),r=vf(t,e.target.y);return`${n}% ${r}%`}},OC={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=sr.parse(t);if(s.length>5)return r;const i=sr.createTransformer(t),a=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+a]/=l,s[1+a]/=c;const u=Ae(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class DC extends h.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Qk(LC),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.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:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||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(),Yu.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function _0(t){const[e,n]=n_(),r=h.useContext(Vu);return o.jsx(DC,{...t,layoutGroup:r,switchLayoutGroup:h.useContext(m_),isPresent:e,safeToRemove:n})}const LC={borderRadius:{...Ls,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ls,borderTopRightRadius:Ls,borderBottomLeftRadius:Ls,borderBottomRightRadius:Ls,boxShadow:OC};function NC(t,e,n){const r=ze(t)?t:fn(t);return r.start(_d("",r,e,n)),r.animation}function MC(t){return t instanceof SVGElement&&t.tagName!=="svg"}const VC=(t,e)=>t.depth-e.depth;class FC{constructor(){this.children=[],this.isDirty=!1}add(e){$u(this.children,e),this.isDirty=!0}remove(e){Bu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(VC),this.isDirty=!1,this.children.forEach(e)}}function $C(t,e){const n=_n.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(en(r),t(i-e))};return fe.read(r,!0),()=>en(r)}const y0=["TopLeft","TopRight","BottomLeft","BottomRight"],BC=y0.length,_f=t=>typeof t=="string"?parseFloat(t):t,yf=t=>typeof t=="number"||Q.test(t);function UC(t,e,n,r,s,i){s?(t.opacity=Ae(0,n.opacity!==void 0?n.opacity:1,zC(r)),t.opacityExit=Ae(e.opacity!==void 0?e.opacity:1,0,HC(r))):i&&(t.opacity=Ae(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<BC;a++){const l=`border${y0[a]}Radius`;let c=xf(e,l),u=xf(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||yf(c)===yf(u)?(t[l]=Math.max(Ae(_f(c),_f(u),r),0),(yn.test(u)||yn.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Ae(e.rotate||0,n.rotate||0,r))}function xf(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const zC=x0(0,.5,N_),HC=x0(.5,.95,It);function x0(t,e,n){return r=>r<t?0:r>e?1:n(ls(t,e,r))}function bf(t,e){t.min=e.min,t.max=e.max}function zt(t,e){bf(t.x,e.x),bf(t.y,e.y)}function wf(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Ef(t,e,n,r,s){return t-=e,t=ta(t,1/n,r),s!==void 0&&(t=ta(t,1/s,r)),t}function WC(t,e=0,n=1,r=.5,s,i=t,a=t){if(yn.test(e)&&(e=parseFloat(e),e=Ae(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Ae(i.min,i.max,r);t===i&&(l-=e),t.min=Ef(t.min,e,n,l,s),t.max=Ef(t.max,e,n,l,s)}function jf(t,e,[n,r,s],i,a){WC(t,e[n],e[r],e[s],e.scale,i,a)}const GC=["x","scaleX","originX"],KC=["y","scaleY","originY"];function Tf(t,e,n,r){jf(t.x,e,GC,n?n.x:void 0,r?r.x:void 0),jf(t.y,e,KC,n?n.y:void 0,r?r.y:void 0)}function Pf(t){return t.translate===0&&t.scale===1}function b0(t){return Pf(t.x)&&Pf(t.y)}function Sf(t,e){return t.min===e.min&&t.max===e.max}function qC(t,e){return Sf(t.x,e.x)&&Sf(t.y,e.y)}function kf(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function w0(t,e){return kf(t.x,e.x)&&kf(t.y,e.y)}function Rf(t){return kt(t.x)/kt(t.y)}function Af(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class YC{constructor(){this.members=[]}add(e){$u(this.members,e),e.scheduleRender()}remove(e){if(Bu(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(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function XC(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,a=n?.z||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:p,rotateY:f,skewX:m,skewY:y}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),p&&(r+=`rotateX(${p}deg) `),f&&(r+=`rotateY(${f}deg) `),m&&(r+=`skewX(${m}deg) `),y&&(r+=`skewY(${y}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const wl=["","X","Y","Z"],ZC={visibility:"hidden"},Cf=1e3;let JC=0;function El(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function E0(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=R_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",fe,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&E0(r)}function j0({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},l=e?.()){this.id=JC++,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(tI),this.nodes.forEach(iI),this.nodes.forEach(aI),this.nodes.forEach(nI)},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 FC)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new zu),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=MC(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=$C(f,250),Ei.hasAnimatedSinceResize&&(Ei.hasAnimatedSinceResize=!1,this.nodes.forEach(Of))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||hI,{onLayoutAnimationStart:x,onLayoutAnimationComplete:b}=d.getProps(),w=!this.targetLayout||!w0(this.targetLayout,y),E=!f&&m;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={...Ku(g,"layout"),onPlay:x,onComplete:b};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T)}else f||Of(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,en(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(lI),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&&E0(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(If);return}this.isUpdating||this.nodes.forEach(sI),this.isUpdating=!1,this.nodes.forEach(oI),this.nodes.forEach(QC),this.nodes.forEach(eI),this.clearAllSnapshots();const l=_n.now();Ue.delta=En(0,1e3/60,l-Ue.timestamp),Ue.timestamp=l,Ue.isProcessing=!0,pl.update.process(Ue),pl.preRender.process(Ue),pl.render.process(Ue),Ue.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yu.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rI),this.sharedNodes.forEach(cI)}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&&!kt(this.snapshot.measuredBox.x)&&!kt(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=Ne(),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=r(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(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!b0(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;a&&(l||hr(this.latestValues)||d)&&(s(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)),pI(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return Ne();const l=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(fI))){const{scroll:u}=this.root;u&&(Kr(l.x,u.offset.x),Kr(l.y,u.offset.y))}return l}removeElementScroll(a){const l=Ne();if(zt(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&&zt(l,a),Kr(l.x,d.offset.x),Kr(l.y,d.offset.y))}return l}applyTransform(a,l=!1){const c=Ne();zt(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&&qr(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),hr(d.latestValues)&&qr(c,d.latestValues)}return hr(this.latestValues)&&qr(c,this.latestValues),c}removeTransform(a){const l=Ne();zt(l,a);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!hr(u.latestValues))continue;Mc(u.latestValues)&&u.updateSnapshot();const d=Ne(),p=u.measurePageBox();zt(d,p),Tf(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return hr(this.latestValues)&&Tf(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=Ne(),this.relativeTargetOrigin=Ne(),lo(this.relativeTargetOrigin,this.layout.layoutBox,f.layout.layoutBox),zt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ne(),this.targetWithTransforms=Ne()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):zt(this.target,this.layout.layoutBox),p0(this.target,this.targetDelta)):zt(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=Ne(),this.relativeTargetOrigin=Ne(),lo(this.relativeTargetOrigin,this.target,f.target),zt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Mc(this.parent.latestValues)||h0(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;zt(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,f=this.treeScale.y;vC(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=Ne());const{target:m}=a;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(wf(this.prevProjectionDelta.x,this.projectionDelta.x),wf(this.prevProjectionDelta.y,this.projectionDelta.y)),ao(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==f||!Af(this.projectionDelta.x,this.prevProjectionDelta.x)||!Af(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}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=Gr(),this.projectionDelta=Gr(),this.projectionDeltaWithTransform=Gr()}setAnimationOrigin(a,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},p=Gr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Ne(),m=c?c.source:void 0,y=this.layout?this.layout.source:void 0,g=m!==y,x=this.getStack(),b=!x||x.members.length<=1,w=!!(g&&!b&&this.options.crossfade===!0&&!this.path.some(dI));this.animationProgress=0;let E;this.mixTargetDelta=T=>{const j=T/1e3;Df(p.x,a.x,j),Df(p.y,a.y,j),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(lo(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),uI(this.relativeTarget,this.relativeTargetOrigin,f,j),E&&qC(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Ne()),zt(E,this.relativeTarget)),g&&(this.animationValues=d,UC(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&&(en(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=fe.update(()=>{Ei.hasAnimatedSinceResize=!0,this.currentAnimation=NC(0,Cf,{...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(Cf),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&&T0(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ne();const p=kt(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+p;const f=kt(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+f}zt(l,c),qr(l,d),ao(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new YC),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&&El("z",a,u,this.animationValues);for(let d=0;d<wl.length;d++)El(`rotate${wl[d]}`,a,u,this.animationValues),El(`skew${wl[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 ZC;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 m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=wi(a?.pointerEvents)||""),this.hasProjected&&!hr(this.latestValues)&&(m.transform=c?c({},""):"none",this.hasProjected=!1),m}const d=u.animationValues||u.latestValues;this.applyTransformsToTarget(),l.transform=XC(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 m in jo){if(d[m]===void 0)continue;const{correct:y,applyTo:g,isCSSVariable:x}=jo[m],b=l.transform==="none"?d[m]:y(d[m],u);if(g){const w=g.length;for(let E=0;E<w;E++)l[g[E]]=b}else x?this.options.visualElement.renderState.vars[m]=b:l[m]=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(If),this.root.sharedNodes.clear()}}}function QC(t){t.updateLayout()}function eI(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:s}=t.options,i=e.source!==t.layout.source;s==="size"?Ht(d=>{const p=i?e.measuredBox[d]:e.layoutBox[d],f=kt(p);p.min=n[d].min,p.max=p.min+f}):T0(s,e.layoutBox,n)&&Ht(d=>{const p=i?e.measuredBox[d]:e.layoutBox[d],f=kt(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=Gr();ao(a,n,e.layoutBox);const l=Gr();i?ao(l,t.applyTransform(r,!0),e.measuredBox):ao(l,n,e.layoutBox);const c=!b0(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 m=Ne();lo(m,e.layoutBox,p.layoutBox);const y=Ne();lo(y,n,f.layoutBox),w0(m,y)||(u=!0),d.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=m,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 tI(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 nI(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function rI(t){t.clearSnapshot()}function If(t){t.clearMeasurements()}function sI(t){t.isLayoutDirty=!1}function oI(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Of(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function iI(t){t.resolveTargetDelta()}function aI(t){t.calcProjection()}function lI(t){t.resetSkewAndRotation()}function cI(t){t.removeLeadSnapshot()}function Df(t,e,n){t.translate=Ae(e.translate,0,n),t.scale=Ae(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Lf(t,e,n,r){t.min=Ae(e.min,n.min,r),t.max=Ae(e.max,n.max,r)}function uI(t,e,n,r){Lf(t.x,e.x,n.x,r),Lf(t.y,e.y,n.y,r)}function dI(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const hI={duration:.45,ease:[.4,0,.1,1]},Nf=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Mf=Nf("applewebkit/")&&!Nf("chrome/")?Math.round:It;function Vf(t){t.min=Mf(t.min),t.max=Mf(t.max)}function pI(t){Vf(t.x),Vf(t.y)}function T0(t,e,n){return t==="position"||t==="preserve-aspect"&&!mC(Rf(e),Rf(n),.2)}function fI(t){return t!==t.root&&t.scroll?.wasRoot}const mI=j0({attachResizeListener:(t,e)=>ko(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),jl={current:void 0},P0=j0({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!jl.current){const t=new mI({});t.mount(window),t.setOptions({layoutScroll:!0}),jl.current=t}return jl.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),gI={pan:{Feature:IC},drag:{Feature:CC,ProjectionNode:P0,MeasureLayout:_0}};function Ff(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&fe.postRender(()=>i(e,Uo(e)))}class vI extends or{mount(){const{current:e}=this.node;e&&(this.unmount=kk(e,(n,r)=>(Ff(this.node,r,"Start"),s=>Ff(this.node,s,"End"))))}unmount(){}}class _I extends or{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(ko(this.node.current,"focus",()=>this.onFocus()),ko(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $f(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&fe.postRender(()=>i(e,Uo(e)))}class yI extends or{mount(){const{current:e}=this.node;e&&(this.unmount=Ik(e,(n,r)=>($f(this.node,r,"Start"),(s,{success:i})=>$f(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const $c=new WeakMap,Tl=new WeakMap,xI=t=>{const e=$c.get(t.target);e&&e(t)},bI=t=>{t.forEach(xI)};function wI({root:t,...e}){const n=t||document;Tl.has(n)||Tl.set(n,{});const r=Tl.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(bI,{root:t,...e})),r[s]}function EI(t,e,n){const r=wI(e);return $c.set(t,n),r.observe(t),()=>{$c.delete(t),r.unobserve(t)}}const jI={some:0,all:1};class TI extends or{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:jI[s]},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 EI(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(PI(e,n))&&this.startObserver()}unmount(){}}function PI({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const SI={inView:{Feature:TI},tap:{Feature:yI},focus:{Feature:_I},hover:{Feature:vI}},kI={layout:{ProjectionNode:P0,MeasureLayout:_0}},Bc={current:null},S0={current:!1};function RI(){if(S0.current=!0,!!Fu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bc.current=t.matches;t.addListener(e),e()}else Bc.current=!1}const AI=[...Z_,Pt,sr],CI=t=>AI.find(X_(t)),II=new WeakMap;function OI(t,e,n){for(const r in e){const s=e[r],i=n[r];if(ze(s))t.addValue(r,s);else if(ze(i))t.addValue(r,fn(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const a=t.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(r);t.addValue(r,fn(a!==void 0?a:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Bf=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class DI{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,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=md,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 m=_n.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,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=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=ja(n),this.isVariantNode=p_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const y=f[m];c[m]!==void 0&&ze(y)&&y.set(c[m],!1)}}mount(e){this.current=e,II.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,r)=>this.bindToMotionValue(r,n)),S0.current||RI(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Bc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),en(this.notifyUpdate),en(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 r=jr.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&fe.preRender(this.notifyUpdate),r&&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,()=>{s(),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 cs){const n=cs[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(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):Ne()}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 r=0;r<Bf.length;r++){const s=Bf[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=OI(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 r=this.values.get(e);n!==r&&(r&&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 r=this.values.get(e);return r===void 0&&n!==void 0&&(r=fn(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(q_(r)||V_(r))?r=parseFloat(r):!CI(r)&&sr.test(n)&&(r=W_(e,n)),this.setBaseTarget(e,ze(r)?r.get():r)),ze(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=cd(this.props,n,this.presenceContext?.custom);i&&(r=i[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!ze(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new zu),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class k0 extends DI{constructor(){super(...arguments),this.KeyframeResolver=J_}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:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ze(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function LI(t){return window.getComputedStyle(t)}class NI extends k0{constructor(){super(...arguments),this.type="html",this.renderInstance=j_}readValueFromInstance(e,n){if(jr.has(n))return XR(e,n);{const r=LI(e),s=(td(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return f0(e,n)}build(e,n,r){sd(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return ud(e,n,r)}}class MI extends k0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ne,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&E_(this.current,this.renderState)}}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(jr.has(n)){const r=H_(n);return r&&r.default||0}return n=T_.has(n)?n:ed(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return S_(e,n,r)}onBindTransform(){this.current&&!this.renderState.dimensions&&fe.postRender(this.updateDimensions)}build(e,n,r){ad(e,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,n,r,s){P_(e,n,r,s)}mount(e){this.isSVGTag=ld(e.tagName),super.mount(e)}}const VI=(t,e)=>id(t)?new MI(e):new NI(e,{allowProjection:t!==h.Fragment}),FI=ER({...aC,...SI,...gI,...kI},VI),Le=Fk(FI);function R0(t,e){let n;const r=()=>{const{currentTime:s}=e,a=(s===null?0:s.value)/100;n!==a&&t(a),n=a};return fe.update(r,!0),()=>en(r)}const ji=new WeakMap;let Ti;function $I(t,e){if(e){const{inlineSize:n,blockSize:r}=e[0];return{width:n,height:r}}else return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}function BI({target:t,contentRect:e,borderBoxSize:n}){ji.get(t)?.forEach(r=>{r({target:t,contentSize:e,get size(){return $I(t,n)}})})}function UI(t){t.forEach(BI)}function zI(){typeof ResizeObserver>"u"||(Ti=new ResizeObserver(UI))}function HI(t,e){Ti||zI();const n=Xu(t);return n.forEach(r=>{let s=ji.get(r);s||(s=new Set,ji.set(r,s)),s.add(e),Ti?.observe(r)}),()=>{n.forEach(r=>{const s=ji.get(r);s?.delete(e),s?.size||Ti?.unobserve(r)})}}const Pi=new Set;let co;function WI(){co=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Pi.forEach(n=>n(e))},window.addEventListener("resize",co)}function GI(t){return Pi.add(t),co||WI(),()=>{Pi.delete(t),!Pi.size&&co&&(co=void 0)}}function KI(t,e){return typeof t=="function"?GI(t):HI(t,e)}const qI=50,Uf=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),YI=()=>({time:0,x:Uf(),y:Uf()}),XI={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function zf(t,e,n,r){const s=n[e],{length:i,position:a}=XI[e],l=s.current,c=n.time;s.current=t[`scroll${a}`],s.scrollLength=t[`scroll${i}`]-t[`client${i}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=ls(0,s.scrollLength,s.current);const u=r-c;s.velocity=u>qI?0:Hu(s.current-l,u)}function ZI(t,e,n){zf(t,"x",e,n),zf(t,"y",e,n),e.time=n}function JI(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(r instanceof HTMLElement)n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const s=r.getBoundingClientRect();r=r.parentElement;const i=r.getBoundingClientRect();n.x+=s.left-i.left,n.y+=s.top-i.top}else if(r instanceof SVGGraphicsElement){const{x:s,y:i}=r.getBBox();n.x+=s,n.y+=i;let a=null,l=r.parentNode;for(;!a;)l.tagName==="svg"&&(a=l),l=r.parentNode;r=a}else break;return n}const Uc={start:0,center:.5,end:1};function Hf(t,e,n=0){let r=0;if(t in Uc&&(t=Uc[t]),typeof t=="string"){const s=parseFloat(t);t.endsWith("px")?r=s:t.endsWith("%")?t=s/100:t.endsWith("vw")?r=s/100*document.documentElement.clientWidth:t.endsWith("vh")?r=s/100*document.documentElement.clientHeight:t=s}return typeof t=="number"&&(r=e*t),n+r}const QI=[0,0];function e2(t,e,n,r){let s=Array.isArray(t)?t:QI,i=0,a=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,Uc[t]?t:"0"]),i=Hf(s[0],n,r),a=Hf(s[1],e),i-a}const t2={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},n2={x:0,y:0};function r2(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function s2(t,e,n){const{offset:r=t2.All}=n,{target:s=t,axis:i="y"}=n,a=i==="y"?"height":"width",l=s!==t?JI(s,t):n2,c=s===t?{width:t.scrollWidth,height:t.scrollHeight}:r2(s),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let d=!e[i].interpolate;const p=r.length;for(let f=0;f<p;f++){const m=e2(r[f],u[a],c[a],l[i]);!d&&m!==e[i].interpolatorOffsets[f]&&(d=!0),e[i].offset[f]=m}d&&(e[i].interpolate=vd(e[i].offset,s0(r),{clamp:!1}),e[i].interpolatorOffsets=[...e[i].offset]),e[i].progress=En(0,1,e[i].interpolate(e[i].current))}function o2(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let r=e;for(;r&&r!==t;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.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 i2(t,e,n,r={}){return{measure:()=>o2(t,r.target,n),update:s=>{ZI(t,n,s),(r.offset||r.target)&&s2(t,n,r)},notify:()=>e(n)}}const Ns=new WeakMap,Wf=new WeakMap,Pl=new WeakMap,Gf=t=>t===document.documentElement?window:t;function yd(t,{container:e=document.documentElement,...n}={}){let r=Pl.get(e);r||(r=new Set,Pl.set(e,r));const s=YI(),i=i2(e,t,s,n);if(r.add(i),!Ns.has(e)){const l=()=>{for(const f of r)f.measure()},c=()=>{for(const f of r)f.update(Ue.timestamp)},u=()=>{for(const f of r)f.notify()},d=()=>{fe.read(l,!1,!0),fe.read(c,!1,!0),fe.update(u,!1,!0)};Ns.set(e,d);const p=Gf(e);window.addEventListener("resize",d,{passive:!0}),e!==document.documentElement&&Wf.set(e,KI(e,d)),p.addEventListener("scroll",d,{passive:!0})}const a=Ns.get(e);return fe.read(a,!1,!0),()=>{en(a);const l=Pl.get(e);if(!l||(l.delete(i),l.size))return;const c=Ns.get(e);Ns.delete(e),c&&(Gf(e).removeEventListener("scroll",c),Wf.get(e)?.(),window.removeEventListener("resize",c))}}function a2({source:t,container:e,axis:n="y"}){t&&(e=t);const r={value:0},s=yd(i=>{r.value=i[n].progress*100},{container:e,axis:n});return{currentTime:r,cancel:s}}const Sl=new Map;function A0({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),Sl.has(e)||Sl.set(e,{});const r=Sl.get(e);return r[n]||(r[n]=r_()?new ScrollTimeline({source:e,axis:n}):a2({source:e,axis:n})),r[n]}function l2(t){return t.length===2}function C0(t){return t&&(t.target||t.offset)}function c2(t,e){return l2(t)||C0(e)?yd(n=>{t(n[e.axis].progress,n)},e):R0(t,A0(e))}function u2(t,e){if(t.flatten(),C0(e))return t.pause(),yd(n=>{t.time=t.duration*n[e.axis].progress},e);{const n=A0(e);return t.attachTimeline?t.attachTimeline(n,r=>(r.pause(),R0(s=>{r.time=r.duration*s},n))):It}}function d2(t,{axis:e="y",...n}={}){const r={axis:e,...n};return typeof t=="function"?c2(t,r):u2(t,r)}function Kf(t,e){gk(!!(!e||e.current))}const h2=()=>({scrollX:fn(0),scrollY:fn(0),scrollXProgress:fn(0),scrollYProgress:fn(0)});function p2({container:t,target:e,layoutEffect:n=!0,...r}={}){const s=rr(h2);return(n?Mo:h.useEffect)(()=>(Kf("target",e),Kf("container",t),d2((a,{x:l,y:c})=>{s.scrollX.set(l.current),s.scrollXProgress.set(l.progress),s.scrollY.set(c.current),s.scrollYProgress.set(c.progress)},{...r,container:t?.current||void 0,target:e?.current||void 0})),[t,e,JSON.stringify(r.offset)]),s}function I0(t){const e=rr(()=>fn(t)),{isStatic:n}=h.useContext(Vo);if(n){const[,r]=h.useState(t);h.useEffect(()=>e.on("change",r),[])}return e}function O0(t,e){const n=I0(e()),r=()=>n.set(e());return r(),Mo(()=>{const s=()=>fe.preRender(r,!1,!0),i=t.map(a=>a.on("change",s));return()=>{i.forEach(a=>a()),en(r)}}),n}function qf(t,e={}){const{isStatic:n}=h.useContext(Vo),r=h.useRef(null),s=rr(()=>ze(t)?t.get():t),i=rr(()=>typeof s=="string"?s.replace(/[\d.-]/g,""):void 0),a=I0(s),l=h.useRef(s),c=h.useRef(It),u=()=>{d(),r.current=LA({keyframes:[Xf(a.get()),Xf(l.current)],velocity:a.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...e,onUpdate:c.current})},d=()=>{r.current&&r.current.stop()};return h.useInsertionEffect(()=>a.attach((p,f)=>n?f(p):(l.current=p,c.current=m=>f(Yf(m,i)),fe.postRender(u),a.get()),d),[JSON.stringify(e)]),Mo(()=>{if(ze(t))return t.on("change",p=>a.set(Yf(p,i)))},[a,i]),a}function Yf(t,e){return e?t+e:t}function Xf(t){return typeof t=="number"?t:parseFloat(t)}const f2=t=>t&&typeof t=="object"&&t.mix,m2=t=>f2(t)?t.mix:void 0;function g2(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],s=t[1+n],i=t[2+n],a=t[3+n],l=vd(s,i,{mixer:m2(i[0]),...a});return e?l(r):l}function v2(t){so.current=[],t();const e=O0(so.current,t);return so.current=void 0,e}function Zf(t,e,n,r){if(typeof t=="function")return v2(t);const s=typeof e=="function"?e:g2(e,n,r);return Array.isArray(t)?Jf(t,s):Jf([t],([i])=>s(i))}function Jf(t,e){const n=rr(()=>[]);return O0(t,()=>{n.length=0;const r=t.length;for(let s=0;s<r;s++)n[s]=t[s].get();return e(n)})}const _2={some:0,all:1};function y2(t,e,{root:n,margin:r,amount:s="some"}={}){const i=Xu(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:r,threshold:typeof s=="number"?s:_2[s]});return i.forEach(u=>c.observe(u)),()=>c.disconnect()}function x2(t,{root:e,margin:n,amount:r,once:s=!1,initial:i=!1}={}){const[a,l]=h.useState(i);return h.useEffect(()=>{if(!t.current||s&&a)return;const c=()=>(l(!0),s?void 0:()=>l(!1)),u={root:e&&e.current||void 0,margin:n,amount:r};return y2(t.current,c,u)},[e,t,n,s,r]),a}const D0="/assets/lumi-idle-0POIBpsz.webp",L0="/assets/lumi-flying-BYO-JzK3.webp",b2=({flyingGifSrc:t=L0,idleGifSrc:e=D0,targetElement:n,onTargetReached:r})=>{const[s,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}),m=h.useRef(!1),y={stiffness:150,damping:15,mass:1},g=qf(0,y),x=qf(0,y);if(h.useEffect(()=>{if(n){p(!0),m.current=!1;const w=n.getBoundingClientRect(),E=w.left+w.width/2+20,T=w.top-30;g.set(E),x.set(T);const j=setTimeout(()=>{m.current||(m.current=!0,r?.())},500);return()=>clearTimeout(j)}else p(!1)},[n,g,x,r]),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),g.set(T.clientX+20),x.set(T.clientY-20);const S=T.target.closest("[data-lumi-interactive]")!==null;i(S)};return window.addEventListener("mousemove",E,{passive:!0}),()=>{window.removeEventListener("mousemove",E)}},[c,g,x,d]),h.useEffect(()=>{if(d)return;let w=0;const E=j=>{const P=j.touches[0];if(!P)return;const S=performance.now();if(S-w<16)return;w=S,c||u(!0),g.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),g.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,g,x,d]),h.useEffect(()=>{const w=setInterval(()=>{const E=g.get(),T=x.get(),j=E-f.current.x,P=T-f.current.y,S=Math.sqrt(j*j+P*P);l(S>1),f.current={x:E,y:T}},50);return()=>clearInterval(w)},[g,x]),!c)return null;const b=a&&!s&&!(d&&m.current);return o.jsxs(Le.div,{className:"fixed top-0 left-0 pointer-events-none z-[9999]",style:{x:g,y:x,willChange:"transform"},children:[o.jsx(Le.div,{animate:{scale:s||d?1.3:1,filter:s||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"})]})}),(s||d)&&o.jsx(Le.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 w2(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:4e3}):setTimeout(t,2e3)}function E2(){return li||(li=new Promise(t=>{if(typeof window>"u"){t(null);return}w2(async()=>{const{default:e}=await _(async()=>{const{default:n}=await Promise.resolve().then(()=>XS);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 j2(){const t=ps();return h.useEffect(()=>{E2().then(e=>{e?.capture("$pageview")})},[t.pathname]),null}function T2({children:t}){return o.jsxs(o.Fragment,{children:[o.jsx(j2,{}),t]})}const P2=[{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"}],S2="design_tokens",k2=P2.reduce((t,e)=>(t[e.key]=e.defaultHex,t),{}),R2=t=>/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t.trim());function A2(t){const e=t.trim().replace("#",""),n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`${r} ${s} ${i}`}function Qf(t,e=document.documentElement){for(const[n,r]of Object.entries(t))R2(r)&&(e.style.setProperty(`--${n}`,r.trim()),n.startsWith("nature-")&&e.style.setProperty(`--${n}-rgb`,A2(r)))}const C2=({children:t})=>(h.useEffect(()=>{let e=!1;(async()=>{try{const{data:r}=await W.from("app_settings").select("value").eq("key",S2).maybeSingle();if(e||!r?.value)return;const s=JSON.parse(r.value);Qf({...k2,...s})}catch{}})();const n=r=>{const s=r.detail;s&&Qf(s)};return window.addEventListener("design-tokens:apply",n),()=>{e=!0,window.removeEventListener("design-tokens:apply",n)}},[]),o.jsx(o.Fragment,{children:t})),I2=()=>{const{user:t,session:e}=xs(),[n,r]=h.useState("guest"),[s,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,m]=h.useState(!1),[y,g]=h.useState(null),[x,b]=h.useState(!1),w=h.useRef(null),E=h.useCallback(async(P=!1)=>{if(!t){r("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&&m(!0),g(null);const{data:S,error:k}=await W.from("profiles").select("user_type, avatar_url, display_name").eq("id",t.id).single();if(k)throw console.error("[ACCESS-CONTROL] Profile error:",k),k;const{data:O,error:R}=await W.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(R&&console.error("[ACCESS-CONTROL] Payment error:",R),S){l(S.avatar_url||null);const N=S.display_name||t.user_metadata?.display_name||t.user_metadata?.name||t.user_metadata?.full_name||null;u(N);const L=S.user_type||"free",q=new Date,D=O?.subscription_end_date?new Date(O.subscription_end_date):void 0,K=D?q>D:!0;i({status:O?.subscription_status||"none",startDate:O?.subscription_start_date?new Date(O.subscription_start_date):void 0,endDate:D,isExpired:K,isCancelledAtPeriodEnd:O?.cancel_at_period_end??!1,planType:O?.plan_type??null}),L!=="admin"?O?.subscription_status==="active"&&!K?r("paid"):S.user_type!=="guest"&&r("free"):r(L)}}catch(S){console.error("[ACCESS-CONTROL] Error:",S);const k=S instanceof Error?S.message:String(S);g(k),P&&dn.error("Failed to refresh profile data",{description:"Please try again later or contact support."})}finally{p(!1),b(!0),w.current=t.id,P&&m(!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"||s.status==="active"&&!s.isExpired:!1,j=h.useCallback(async()=>{await E(!0)},[E]);return{userType:n,subscription:s,avatarUrl:a,displayName:c,isLoading:d,isRefreshing:f,lastRefreshError:y,canAccessStory:T,isAuthenticated:!!t,refreshSubscriptionStatus:j}},N0=ua("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}}),xn=h.forwardRef(({className:t,variant:e,size:n,animated:r,asChild:s=!1,...i},a)=>{const l=s?Jn:"button";return o.jsx(l,{className:ae(N0({variant:e,size:n,animated:r,className:t})),ref:a,...i})});xn.displayName="Button";var O2=h.createContext(void 0);function xd(t){const e=h.useContext(O2);return t||e||"ltr"}var kl=0;function bd(){h.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??em()),document.body.insertAdjacentElement("beforeend",t[1]??em()),kl++,()=>{kl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),kl--}},[])}function em(){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 Rl="focusScope.autoFocusOnMount",Al="focusScope.autoFocusOnUnmount",tm={bubbles:!1,cancelable:!0},D2="FocusScope",Sa=h.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=t,[l,c]=h.useState(null),u=qe(s),d=qe(i),p=h.useRef(null),f=_e(e,g=>c(g)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let g=function(E){if(m.paused||!l)return;const T=E.target;l.contains(T)?p.current=T:Kn(p.current,{select:!0})},x=function(E){if(m.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",g),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",x),w.disconnect()}}},[r,l,m.paused]),h.useEffect(()=>{if(l){rm.add(m);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(Rl,tm);l.addEventListener(Rl,u),l.dispatchEvent(b),b.defaultPrevented||(L2($2(M0(l)),{select:!0}),document.activeElement===g&&Kn(l))}return()=>{l.removeEventListener(Rl,u),setTimeout(()=>{const b=new CustomEvent(Al,tm);l.addEventListener(Al,d),l.dispatchEvent(b),b.defaultPrevented||Kn(g??document.body,{select:!0}),l.removeEventListener(Al,d),rm.remove(m)},0)}}},[l,u,d,m]);const y=h.useCallback(g=>{if(!n&&!r||m.paused)return;const x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(x&&b){const w=g.currentTarget,[E,T]=N2(w);E&&T?!g.shiftKey&&b===T?(g.preventDefault(),n&&Kn(E,{select:!0})):g.shiftKey&&b===E&&(g.preventDefault(),n&&Kn(T,{select:!0})):b===w&&g.preventDefault()}},[n,r,m.paused]);return o.jsx(te.div,{tabIndex:-1,...a,ref:f,onKeyDown:y})});Sa.displayName=D2;function L2(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Kn(r,{select:e}),document.activeElement!==n)return}function N2(t){const e=M0(t),n=nm(e,t),r=nm(e.reverse(),t);return[n,r]}function M0(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function nm(t,e){for(const n of t)if(!M2(n,{upTo:e}))return n}function M2(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 V2(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&&V2(t)&&e&&t.select()}}var rm=F2();function F2(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=sm(t,e),t.unshift(e)},remove(e){t=sm(t,e),t[0]?.resume()}}}function sm(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function $2(t){return t.filter(e=>e.tagName!=="A")}function B2(t,e=[]){let n=[];function r(i,a){const l=h.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:m,...y}=p,g=f?.[t][c]||l,x=h.useMemo(()=>y,Object.values(y));return o.jsx(g.Provider,{value:x,children:m})}function d(p,f){const m=f?.[t][c]||l,y=h.useContext(m);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 s=()=>{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 s.scopeName=t,[r,U2(s,...e)]}function U2(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.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 Cl="rovingFocusGroup.onEntryFocus",z2={bubbles:!1,cancelable:!0},ka="RovingFocusGroup",[zc,V0,H2]=aa(ka),[W2,F0]=B2(ka,[H2]),[G2,K2]=W2(ka),$0=h.forwardRef((t,e)=>o.jsx(zc.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(zc.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(q2,{...t,ref:e})})}));$0.displayName=ka;var q2=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=t,f=h.useRef(null),m=_e(e,f),y=xd(i),[g=null,x]=vr({prop:a,defaultProp:l,onChange:c}),[b,w]=h.useState(!1),E=qe(u),T=V0(n),j=h.useRef(!1),[P,S]=h.useState(0);return h.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(Cl,E),()=>k.removeEventListener(Cl,E)},[E]),o.jsx(G2,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:g,onItemFocus:h.useCallback(k=>x(k),[x]),onItemShiftTab:h.useCallback(()=>w(!0),[]),onFocusableItemAdd:h.useCallback(()=>S(k=>k+1),[]),onFocusableItemRemove:h.useCallback(()=>S(k=>k-1),[]),children:o.jsx(te.div,{tabIndex:b||P===0?-1:0,"data-orientation":r,...p,ref:m,style:{outline:"none",...t.style},onMouseDown:H(t.onMouseDown,()=>{j.current=!0}),onFocus:H(t.onFocus,k=>{const O=!j.current;if(k.target===k.currentTarget&&O&&!b){const R=new CustomEvent(Cl,z2);if(k.currentTarget.dispatchEvent(R),!R.defaultPrevented){const N=T().filter(V=>V.focusable),L=N.find(V=>V.active),q=N.find(V=>V.id===g),K=[L,q,...N].filter(Boolean).map(V=>V.ref.current);z0(K,d)}}j.current=!1}),onBlur:H(t.onBlur,()=>w(!1))})})}),B0="RovingFocusGroupItem",U0=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,...a}=t,l=mn(),c=i||l,u=K2(B0,n),d=u.currentTabStopId===c,p=V0(n),{onFocusableItemAdd:f,onFocusableItemRemove:m}=u;return h.useEffect(()=>{if(r)return f(),()=>m()},[r,f,m]),o.jsx(zc.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:o.jsx(te.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:H(t.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:H(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:H(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=Z2(y,u.orientation,u.dir);if(g!==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(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const w=b.indexOf(y.currentTarget);b=u.loop?J2(b,w+1):b.slice(w+1)}setTimeout(()=>z0(b))}})})})});U0.displayName=B0;var Y2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function X2(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Z2(t,e,n){const r=X2(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Y2[r]}function z0(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function J2(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Q2=$0,eO=U0,tO=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Lr=new WeakMap,ci=new WeakMap,ui={},Il=0,H0=function(t){return t&&(t.host||H0(t.parentNode))},nO=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=H0(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},rO=function(t,e,n,r){var s=nO(e,Array.isArray(t)?t:[t]);ui[n]||(ui[n]=new WeakMap);var i=ui[n],a=[],l=new Set,c=new Set(s),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};s.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 m=f.getAttribute(r),y=m!==null&&m!=="false",g=(Lr.get(f)||0)+1,x=(i.get(f)||0)+1;Lr.set(f,g),i.set(f,x),a.push(f),g===1&&y&&ci.set(f,!0),x===1&&f.setAttribute(n,"true"),y||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return d(e),l.clear(),Il++,function(){a.forEach(function(p){var f=Lr.get(p)-1,m=i.get(p)-1;Lr.set(p,f),i.set(p,m),f||(ci.has(p)||p.removeAttribute(r),ci.delete(p)),m||p.removeAttribute(n)}),Il--,Il||(Lr=new WeakMap,Lr=new WeakMap,ci=new WeakMap,ui={})}},wd=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=tO(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),rO(r,s,n,"aria-hidden")):function(){return null}},un=function(){return un=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},un.apply(this,arguments)};function W0(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function sO(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Si="right-scroll-bar-position",ki="width-before-scroll-bar",oO="with-scroll-bars-hidden",iO="--removed-body-scroll-bar-size";function Ol(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function aO(t,e){var n=h.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var lO=typeof window<"u"?h.useLayoutEffect:h.useEffect,om=new WeakMap;function cO(t,e){var n=aO(null,function(r){return t.forEach(function(s){return Ol(s,r)})});return lO(function(){var r=om.get(n);if(r){var s=new Set(r),i=new Set(t),a=n.current;s.forEach(function(l){i.has(l)||Ol(l,null)}),i.forEach(function(l){s.has(l)||Ol(l,a)})}om.set(n,t)},[t]),n}function uO(t){return t}function dO(t,e){e===void 0&&(e=uO);var n=[],r=!1,s={read:function(){if(r)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,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!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 s}function hO(t){t===void 0&&(t={});var e=dO(null);return e.options=un({async:!0,ssr:!1},t),e}var G0=function(t){var e=t.sideCar,n=W0(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,un({},n))};G0.isSideCarExport=!0;function pO(t,e){return t.useMedium(e),G0}var K0=hO(),Dl=function(){},Ra=h.forwardRef(function(t,e){var n=h.useRef(null),r=h.useState({onScrollCapture:Dl,onWheelCapture:Dl,onTouchMoveCapture:Dl}),s=r[0],i=r[1],a=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,p=t.shards,f=t.sideCar,m=t.noIsolation,y=t.inert,g=t.allowPinchZoom,x=t.as,b=x===void 0?"div":x,w=t.gapMode,E=W0(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,j=cO([n,e]),P=un(un({},E),s);return h.createElement(h.Fragment,null,d&&h.createElement(T,{sideCar:K0,removeScrollBar:u,shards:p,noIsolation:m,inert:y,setCallbacks:i,allowPinchZoom:!!g,lockRef:n,gapMode:w}),a?h.cloneElement(h.Children.only(l),un(un({},P),{ref:j})):h.createElement(b,un({},P,{className:c,ref:j}),l))});Ra.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ra.classNames={fullWidth:ki,zeroRight:Si};var fO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mO(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=fO();return e&&t.setAttribute("nonce",e),t}function gO(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function vO(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var _O=function(){var t=0,e=null;return{add:function(n){t==0&&(e=mO())&&(gO(e,n),vO(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},yO=function(){var t=_O();return function(e,n){h.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},q0=function(){var t=yO(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},xO={left:0,top:0,right:0,gap:0},Ll=function(t){return parseInt(t||"",10)||0},bO=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Ll(n),Ll(r),Ll(s)]},wO=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return xO;var e=bO(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},EO=q0(),Qr="data-scroll-locked",jO=function(t,e,n,r){var s=t.left,i=t.top,a=t.right,l=t.gap;return n===void 0&&(n="margin"),`
.`.concat(oO,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(l,"px ").concat(r,`;
}
body[`).concat(Qr,`] {
overflow: hidden `).concat(r,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
padding-left: `.concat(s,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(a,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(r,`;
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
}
.`).concat(Si,` {
right: `).concat(l,"px ").concat(r,`;
}
.`).concat(ki,` {
margin-right: `).concat(l,"px ").concat(r,`;
}
.`).concat(Si," .").concat(Si,` {
right: 0 `).concat(r,`;
}
.`).concat(ki," .").concat(ki,` {
margin-right: 0 `).concat(r,`;
}
body[`).concat(Qr,`] {
`).concat(iO,": ").concat(l,`px;
}
`)},im=function(){var t=parseInt(document.body.getAttribute(Qr)||"0",10);return isFinite(t)?t:0},TO=function(){h.useEffect(function(){return document.body.setAttribute(Qr,(im()+1).toString()),function(){var t=im()-1;t<=0?document.body.removeAttribute(Qr):document.body.setAttribute(Qr,t.toString())}},[])},PO=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;TO();var i=h.useMemo(function(){return wO(s)},[s]);return h.createElement(EO,{styles:jO(i,!e,s,n?"":"!important")})},Hc=!1;if(typeof window<"u")try{var di=Object.defineProperty({},"passive",{get:function(){return Hc=!0,!0}});window.addEventListener("test",di,di),window.removeEventListener("test",di,di)}catch{Hc=!1}var Nr=Hc?{passive:!1}:!1,SO=function(t){return t.tagName==="TEXTAREA"},Y0=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!SO(t)&&n[e]==="visible")},kO=function(t){return Y0(t,"overflowY")},RO=function(t){return Y0(t,"overflowX")},am=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=X0(t,r);if(s){var i=Z0(t,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},AO=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},CO=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},X0=function(t,e){return t==="v"?kO(e):RO(e)},Z0=function(t,e){return t==="v"?AO(e):CO(e)},IO=function(t,e){return t==="h"&&e==="rtl"?-1:1},OO=function(t,e,n,r,s){var i=IO(t,window.getComputedStyle(e).direction),a=i*r,l=n.target,c=e.contains(l),u=!1,d=a>0,p=0,f=0;do{var m=Z0(t,l),y=m[0],g=m[1],x=m[2],b=g-x-i*y;(y||b)&&X0(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||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},hi=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},lm=function(t){return[t.deltaX,t.deltaY]},cm=function(t){return t&&"current"in t?t.current:t},DO=function(t,e){return t[0]===e[0]&&t[1]===e[1]},LO=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},NO=0,Mr=[];function MO(t){var e=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(NO++)[0],i=h.useState(q0)[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(s));var g=sO([t.lockRef.current],(t.shards||[]).map(cm),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=h.useCallback(function(g,x){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var b=hi(g),w=n.current,E="deltaX"in g?g.deltaX:w[0]-b[0],T="deltaY"in g?g.deltaY:w[1]-b[1],j,P=g.target,S=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in g&&S==="h"&&P.type==="range")return!1;var k=am(S,P);if(!k)return!0;if(k?j=S:(j=S==="v"?"h":"v",k=am(S,P)),!k)return!1;if(!r.current&&"changedTouches"in g&&(E||T)&&(r.current=j),!j)return!0;var O=r.current||j;return OO(O,x,g,O==="h"?E:T,!0)},[]),c=h.useCallback(function(g){var x=g;if(!(!Mr.length||Mr[Mr.length-1]!==i)){var b="deltaY"in x?lm(x):hi(x),w=e.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&DO(j.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var E=(a.current.shards||[]).map(cm).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(g,x,b,w){var E={name:g,delta:x,target:b,should:w,shadowParent:VO(b)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),d=h.useCallback(function(g){n.current=hi(g),r.current=void 0},[]),p=h.useCallback(function(g){u(g.type,lm(g),g.target,l(g,t.lockRef.current))},[]),f=h.useCallback(function(g){u(g.type,hi(g),g.target,l(g,t.lockRef.current))},[]);h.useEffect(function(){return Mr.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Nr),document.addEventListener("touchmove",c,Nr),document.addEventListener("touchstart",d,Nr),function(){Mr=Mr.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,Nr),document.removeEventListener("touchmove",c,Nr),document.removeEventListener("touchstart",d,Nr)}},[]);var m=t.removeScrollBar,y=t.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:LO(s)}):null,m?h.createElement(PO,{gapMode:t.gapMode}):null)}function VO(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const FO=pO(K0,MO);var Aa=h.forwardRef(function(t,e){return h.createElement(Ra,un({},t,{ref:e,sideCar:FO}))});Aa.classNames=Ra.classNames;var Wc=["Enter"," "],$O=["ArrowDown","PageUp","Home"],J0=["ArrowUp","PageDown","End"],BO=[...$O,...J0],UO={ltr:[...Wc,"ArrowRight"],rtl:[...Wc,"ArrowLeft"]},zO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zo="Menu",[Ro,HO,WO]=aa(zo),[Tr,Q0]=Er(zo,[WO,ys,F0]),Ca=ys(),ey=F0(),[GO,Pr]=Tr(zo),[KO,Ho]=Tr(zo),ty=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=Ca(e),[c,u]=h.useState(null),d=h.useRef(!1),p=qe(i),f=xd(s);return h.useEffect(()=>{const m=()=>{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",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(xu,{...l,children:o.jsx(GO,{scope:e,open:n,onOpenChange:p,content:c,onContentChange:u,children:o.jsx(KO,{scope:e,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:f,modal:a,children:r})})})};ty.displayName=zo;var qO="MenuAnchor",Ed=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Ca(n);return o.jsx(bu,{...s,...r,ref:e})});Ed.displayName=qO;var jd="MenuPortal",[YO,ny]=Tr(jd,{forceMount:void 0}),ry=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Pr(jd,e);return o.jsx(YO,{scope:e,forceMount:n,children:o.jsx(tn,{present:n||i.open,children:o.jsx(ms,{asChild:!0,container:s,children:r})})})};ry.displayName=jd;var Kt="MenuContent",[XO,Td]=Tr(Kt),sy=h.forwardRef((t,e)=>{const n=ny(Kt,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pr(Kt,t.__scopeMenu),a=Ho(Kt,t.__scopeMenu);return o.jsx(Ro.Provider,{scope:t.__scopeMenu,children:o.jsx(tn,{present:r||i.open,children:o.jsx(Ro.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(ZO,{...s,ref:e}):o.jsx(JO,{...s,ref:e})})})})}),ZO=h.forwardRef((t,e)=>{const n=Pr(Kt,t.__scopeMenu),r=h.useRef(null),s=_e(e,r);return h.useEffect(()=>{const i=r.current;if(i)return wd(i)},[]),o.jsx(Pd,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),JO=h.forwardRef((t,e)=>{const n=Pr(Kt,t.__scopeMenu);return o.jsx(Pd,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Pd=h.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:m,disableOutsideScroll:y,...g}=t,x=Pr(Kt,n),b=Ho(Kt,n),w=Ca(n),E=ey(n),T=HO(n),[j,P]=h.useState(null),S=h.useRef(null),k=_e(e,S,x.onContentChange),O=h.useRef(0),R=h.useRef(""),N=h.useRef(0),L=h.useRef(null),q=h.useRef("right"),D=h.useRef(0),K=y?Aa:h.Fragment,V=y?{as:Jn,allowPinchZoom:!0}:void 0,U=I=>{const ee=R.current+I,Y=T().filter(G=>!G.disabled),X=document.activeElement,J=Y.find(G=>G.ref.current===X)?.textValue,oe=Y.map(G=>G.textValue),Se=uD(oe,ee,J),ne=Y.find(G=>G.textValue===Se)?.ref.current;(function G(pe){R.current=pe,window.clearTimeout(O.current),pe!==""&&(O.current=window.setTimeout(()=>G(""),1e3))})(ee),ne&&setTimeout(()=>ne.focus())};h.useEffect(()=>()=>window.clearTimeout(O.current),[]),bd();const C=h.useCallback(I=>q.current===L.current?.side&&hD(I,L.current?.area),[]);return o.jsx(XO,{scope:n,searchRef:R,onItemEnter:h.useCallback(I=>{C(I)&&I.preventDefault()},[C]),onItemLeave:h.useCallback(I=>{C(I)||(S.current?.focus(),P(null))},[C]),onTriggerLeave:h.useCallback(I=>{C(I)&&I.preventDefault()},[C]),pointerGraceTimerRef:N,onPointerGraceIntentChange:h.useCallback(I=>{L.current=I},[]),children:o.jsx(K,{...V,children:o.jsx(Sa,{asChild:!0,trapped:s,onMountAutoFocus:H(i,I=>{I.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(fs,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:m,children:o.jsx(Q2,{asChild:!0,...E,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:P,onEntryFocus:H(c,I=>{b.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(wu,{role:"menu","aria-orientation":"vertical","data-state":xy(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...g,ref:k,style:{outline:"none",...g.style},onKeyDown:H(g.onKeyDown,I=>{const Y=I.target.closest("[data-radix-menu-content]")===I.currentTarget,X=I.ctrlKey||I.altKey||I.metaKey,J=I.key.length===1;Y&&(I.key==="Tab"&&I.preventDefault(),!X&&J&&U(I.key));const oe=S.current;if(I.target!==oe||!BO.includes(I.key))return;I.preventDefault();const ne=T().filter(G=>!G.disabled).map(G=>G.ref.current);J0.includes(I.key)&&ne.reverse(),lD(ne)}),onBlur:H(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(O.current),R.current="")}),onPointerMove:H(t.onPointerMove,Ao(I=>{const ee=I.target,Y=D.current!==I.clientX;if(I.currentTarget.contains(ee)&&Y){const X=I.clientX>D.current?"right":"left";q.current=X,D.current=I.clientX}}))})})})})})})});sy.displayName=Kt;var QO="MenuGroup",Sd=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(te.div,{role:"group",...r,ref:e})});Sd.displayName=QO;var eD="MenuLabel",oy=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(te.div,{...r,ref:e})});oy.displayName=eD;var na="MenuItem",um="menu.itemSelect",Ia=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=h.useRef(null),a=Ho(na,t.__scopeMenu),l=Td(na,t.__scopeMenu),c=_e(e,i),u=h.useRef(!1),d=()=>{const p=i.current;if(!n&&p){const f=new CustomEvent(um,{bubbles:!0,cancelable:!0});p.addEventListener(um,m=>r?.(m),{once:!0}),ou(p,f),f.defaultPrevented?u.current=!1:a.onClose()}};return o.jsx(iy,{...s,ref:c,disabled:n,onClick:H(t.onClick,d),onPointerDown:p=>{t.onPointerDown?.(p),u.current=!0},onPointerUp:H(t.onPointerUp,p=>{u.current||p.currentTarget?.click()}),onKeyDown:H(t.onKeyDown,p=>{const f=l.searchRef.current!=="";n||f&&p.key===" "||Wc.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Ia.displayName=na;var iy=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=Td(na,n),l=ey(n),c=h.useRef(null),u=_e(e,c),[d,p]=h.useState(!1),[f,m]=h.useState("");return h.useEffect(()=>{const y=c.current;y&&m((y.textContent??"").trim())},[i.children]),o.jsx(Ro.ItemSlot,{scope:n,disabled:r,textValue:s??f,children:o.jsx(eO,{asChild:!0,...l,focusable:!r,children:o.jsx(te.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:H(t.onPointerMove,Ao(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(t.onPointerLeave,Ao(y=>a.onItemLeave(y))),onFocus:H(t.onFocus,()=>p(!0)),onBlur:H(t.onBlur,()=>p(!1))})})})}),tD="MenuCheckboxItem",ay=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(hy,{scope:t.__scopeMenu,checked:n,children:o.jsx(Ia,{role:"menuitemcheckbox","aria-checked":ra(n)?"mixed":n,...s,ref:e,"data-state":Rd(n),onSelect:H(s.onSelect,()=>r?.(ra(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ay.displayName=tD;var ly="MenuRadioGroup",[nD,rD]=Tr(ly,{value:void 0,onValueChange:()=>{}}),cy=h.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=qe(r);return o.jsx(nD,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(Sd,{...s,ref:e})})});cy.displayName=ly;var uy="MenuRadioItem",dy=h.forwardRef((t,e)=>{const{value:n,...r}=t,s=rD(uy,t.__scopeMenu),i=n===s.value;return o.jsx(hy,{scope:t.__scopeMenu,checked:i,children:o.jsx(Ia,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Rd(i),onSelect:H(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});dy.displayName=uy;var kd="MenuItemIndicator",[hy,sD]=Tr(kd,{checked:!1}),py=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=sD(kd,n);return o.jsx(tn,{present:r||ra(i.checked)||i.checked===!0,children:o.jsx(te.span,{...s,ref:e,"data-state":Rd(i.checked)})})});py.displayName=kd;var oD="MenuSeparator",fy=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});fy.displayName=oD;var iD="MenuArrow",my=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Ca(n);return o.jsx(Eu,{...s,...r,ref:e})});my.displayName=iD;var aD="MenuSub",[QM,gy]=Tr(aD),Gs="MenuSubTrigger",vy=h.forwardRef((t,e)=>{const n=Pr(Gs,t.__scopeMenu),r=Ho(Gs,t.__scopeMenu),s=gy(Gs,t.__scopeMenu),i=Td(Gs,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(Ed,{asChild:!0,...u,children:o.jsx(iy,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":xy(n.open),...t,ref:ia(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(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:H(t.onPointerLeave,Ao(p=>{d();const f=n.content?.getBoundingClientRect();if(f){const m=n.content?.dataset.side,y=m==="right",g=y?-5:5,x=f[y?"left":"right"],b=f[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+g,y:p.clientY},{x,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x,y:f.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:H(t.onKeyDown,p=>{const f=i.searchRef.current!=="";t.disabled||f&&p.key===" "||UO[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});vy.displayName=Gs;var _y="MenuSubContent",yy=h.forwardRef((t,e)=>{const n=ny(Kt,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pr(Kt,t.__scopeMenu),a=Ho(Kt,t.__scopeMenu),l=gy(_y,t.__scopeMenu),c=h.useRef(null),u=_e(e,c);return o.jsx(Ro.Provider,{scope:t.__scopeMenu,children:o.jsx(tn,{present:r||i.open,children:o.jsx(Ro.Slot,{scope:t.__scopeMenu,children:o.jsx(Pd,{id:l.contentId,"aria-labelledby":l.triggerId,...s,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:H(t.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:H(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:H(t.onKeyDown,d=>{const p=d.currentTarget.contains(d.target),f=zO[a.dir].includes(d.key);p&&f&&(i.onOpenChange(!1),l.trigger?.focus(),d.preventDefault())})})})})})});yy.displayName=_y;function xy(t){return t?"open":"closed"}function ra(t){return t==="indeterminate"}function Rd(t){return ra(t)?"indeterminate":t?"checked":"unchecked"}function lD(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function cD(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function uD(t,e,n){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=cD(t,Math.max(i,0));s.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function dD(t,e){const{x:n,y:r}=t;let s=!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>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function hD(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return dD(n,e)}function Ao(t){return e=>e.pointerType==="mouse"?t(e):void 0}var pD=ty,fD=Ed,mD=ry,gD=sy,vD=Sd,_D=oy,yD=Ia,xD=ay,bD=cy,wD=dy,ED=py,jD=fy,TD=my,PD=vy,SD=yy,Ad="DropdownMenu",[kD,eV]=Er(Ad,[Q0]),Rt=Q0(),[RD,by]=kD(Ad),wy=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:a,modal:l=!0}=t,c=Rt(e),u=h.useRef(null),[d=!1,p]=vr({prop:s,defaultProp:i,onChange:a});return o.jsx(RD,{scope:e,triggerId:mn(),triggerRef:u,contentId:mn(),open:d,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(f=>!f),[p]),modal:l,children:o.jsx(pD,{...c,open:d,onOpenChange:p,dir:r,modal:l,children:n})})};wy.displayName=Ad;var Ey="DropdownMenuTrigger",jy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,i=by(Ey,n),a=Rt(n);return o.jsx(fD,{asChild:!0,...a,children:o.jsx(te.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":r?"":void 0,disabled:r,...s,ref:ia(e,i.triggerRef),onPointerDown:H(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:H(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});jy.displayName=Ey;var AD="DropdownMenuPortal",Ty=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Rt(e);return o.jsx(mD,{...r,...n})};Ty.displayName=AD;var Py="DropdownMenuContent",Sy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=by(Py,n),i=Rt(n),a=h.useRef(!1);return o.jsx(gD,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:H(t.onCloseAutoFocus,l=>{a.current||s.triggerRef.current?.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:H(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.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)"}})});Sy.displayName=Py;var CD="DropdownMenuGroup",ID=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(vD,{...s,...r,ref:e})});ID.displayName=CD;var OD="DropdownMenuLabel",ky=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(_D,{...s,...r,ref:e})});ky.displayName=OD;var DD="DropdownMenuItem",Ry=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(yD,{...s,...r,ref:e})});Ry.displayName=DD;var LD="DropdownMenuCheckboxItem",Ay=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(xD,{...s,...r,ref:e})});Ay.displayName=LD;var ND="DropdownMenuRadioGroup",MD=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(bD,{...s,...r,ref:e})});MD.displayName=ND;var VD="DropdownMenuRadioItem",Cy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(wD,{...s,...r,ref:e})});Cy.displayName=VD;var FD="DropdownMenuItemIndicator",Iy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(ED,{...s,...r,ref:e})});Iy.displayName=FD;var $D="DropdownMenuSeparator",Oy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(jD,{...s,...r,ref:e})});Oy.displayName=$D;var BD="DropdownMenuArrow",UD=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(TD,{...s,...r,ref:e})});UD.displayName=BD;var zD="DropdownMenuSubTrigger",Dy=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(PD,{...s,...r,ref:e})});Dy.displayName=zD;var HD="DropdownMenuSubContent",Ly=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Rt(n);return o.jsx(SD,{...s,...r,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)"}})});Ly.displayName=HD;var WD=wy,GD=jy,KD=Ty,Ny=Sy,My=ky,Vy=Ry,Fy=Ay,$y=Cy,By=Iy,Uy=Oy,zy=Dy,Hy=Ly;const Wy=WD,Gy=GD,qD=h.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(zy,{ref:s,className:ae("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),...r,children:[n,o.jsx(Kw,{className:"ml-auto h-4 w-4"})]}));qD.displayName=zy.displayName;const YD=h.forwardRef(({className:t,...e},n)=>o.jsx(Hy,{ref:n,className:ae("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}));YD.displayName=Hy.displayName;const Cd=h.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(KD,{children:o.jsx(Ny,{ref:r,sideOffset:e,className:ae("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})}));Cd.displayName=Ny.displayName;const qn=h.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(Vy,{ref:r,className:ae("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=Vy.displayName;const XD=h.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(Fy,{ref:s,className:ae("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,...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(By,{children:o.jsx(uu,{className:"h-4 w-4"})})}),e]}));XD.displayName=Fy.displayName;const ZD=h.forwardRef(({className:t,children:e,...n},r)=>o.jsxs($y,{ref:r,className:ae("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(By,{children:o.jsx(Zw,{className:"h-2 w-2 fill-current"})})}),e]}));ZD.displayName=$y.displayName;const JD=h.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(My,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));JD.displayName=My.displayName;const Ks=h.forwardRef(({className:t,...e},n)=>o.jsx(Uy,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",t),...e}));Ks.displayName=Uy.displayName;var Id="Dialog",[Ky,tV]=Er(Id),[QD,rn]=Ky(Id),qy=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,l=h.useRef(null),c=h.useRef(null),[u=!1,d]=vr({prop:r,defaultProp:s,onChange:i});return o.jsx(QD,{scope:e,triggerRef:l,contentRef:c,contentId:mn(),titleId:mn(),descriptionId:mn(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(p=>!p),[d]),modal:a,children:n})};qy.displayName=Id;var Yy="DialogTrigger",Xy=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=rn(Yy,n),i=_e(e,s.triggerRef);return o.jsx(te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ld(s.open),...r,ref:i,onClick:H(t.onClick,s.onOpenToggle)})});Xy.displayName=Yy;var Od="DialogPortal",[eL,Zy]=Ky(Od,{forceMount:void 0}),Jy=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=rn(Od,e);return o.jsx(eL,{scope:e,forceMount:n,children:h.Children.map(r,a=>o.jsx(tn,{present:n||i.open,children:o.jsx(ms,{asChild:!0,container:s,children:a})}))})};Jy.displayName=Od;var sa="DialogOverlay",Qy=h.forwardRef((t,e)=>{const n=Zy(sa,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=rn(sa,t.__scopeDialog);return i.modal?o.jsx(tn,{present:r||i.open,children:o.jsx(tL,{...s,ref:e})}):null});Qy.displayName=sa;var tL=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=rn(sa,n);return o.jsx(Aa,{as:Jn,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(te.div,{"data-state":Ld(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),br="DialogContent",ex=h.forwardRef((t,e)=>{const n=Zy(br,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=rn(br,t.__scopeDialog);return o.jsx(tn,{present:r||i.open,children:i.modal?o.jsx(nL,{...s,ref:e}):o.jsx(rL,{...s,ref:e})})});ex.displayName=br;var nL=h.forwardRef((t,e)=>{const n=rn(br,t.__scopeDialog),r=h.useRef(null),s=_e(e,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return wd(i)},[]),o.jsx(tx,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(t.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:H(t.onFocusOutside,i=>i.preventDefault())})}),rL=h.forwardRef((t,e)=>{const n=rn(br,t.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return o.jsx(tx,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),tx=h.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...a}=t,l=rn(br,n),c=h.useRef(null),u=_e(e,c);return bd(),o.jsxs(o.Fragment,{children:[o.jsx(Sa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(fs,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ld(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(sL,{titleId:l.titleId}),o.jsx(iL,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Dd="DialogTitle",nx=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=rn(Dd,n);return o.jsx(te.h2,{id:s.titleId,...r,ref:e})});nx.displayName=Dd;var rx="DialogDescription",sx=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=rn(rx,n);return o.jsx(te.p,{id:s.descriptionId,...r,ref:e})});sx.displayName=rx;var ox="DialogClose",ix=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=rn(ox,n);return o.jsx(te.button,{type:"button",...r,ref:e,onClick:H(t.onClick,()=>s.onOpenChange(!1))})});ix.displayName=ox;function Ld(t){return t?"open":"closed"}var ax="DialogTitleWarning",[nV,lx]=Yb(ax,{contentName:br,titleName:Dd,docsSlug:"dialog"}),sL=({titleId:t})=>{const e=lx(ax),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},oL="DialogDescriptionWarning",iL=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lx(oL).contentName}}.`;return h.useEffect(()=>{const s=t.current?.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},cx=qy,ux=Xy,dx=Jy,Oa=Qy,Da=ex,La=nx,Na=sx,hx=ix;const aL=cx,lL=ux,cL=dx,px=h.forwardRef(({className:t,...e},n)=>o.jsx(Oa,{className:ae("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}));px.displayName=Oa.displayName;const uL=ua("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"}}),fx=h.forwardRef(({side:t="right",className:e,children:n,...r},s)=>o.jsxs(cL,{children:[o.jsx(px,{}),o.jsxs(Da,{ref:s,className:ae(uL({side:t}),e),...r,children:[n,o.jsxs(hx,{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(da,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fx.displayName=Da.displayName;const dL=h.forwardRef(({className:t,...e},n)=>o.jsx(La,{ref:n,className:ae("text-lg font-semibold text-foreground",t),...e}));dL.displayName=La.displayName;const hL=h.forwardRef(({className:t,...e},n)=>o.jsx(Na,{ref:n,className:ae("text-sm text-muted-foreground",t),...e}));hL.displayName=Na.displayName;var Nd="Avatar",[pL,rV]=Er(Nd),[fL,mx]=pL(Nd),gx=h.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=h.useState("idle");return o.jsx(fL,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:o.jsx(te.span,{...r,ref:e})})});gx.displayName=Nd;var vx="AvatarImage",_x=h.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,a=mx(vx,n),l=mL(r,i.referrerPolicy),c=qe(u=>{s(u),a.onImageLoadingStatusChange(u)});return He(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(te.img,{...i,ref:e,src:r}):null});_x.displayName=vx;var yx="AvatarFallback",xx=h.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=mx(yx,n),[a,l]=h.useState(r===void 0);return h.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(te.span,{...s,ref:e}):null});xx.displayName=yx;function mL(t,e){const[n,r]=h.useState("idle");return He(()=>{if(!t){r("error");return}let s=!0;const i=new window.Image,a=l=>()=>{s&&r(l)};return r("loading"),i.onload=a("loaded"),i.onerror=a("error"),i.src=t,e&&(i.referrerPolicy=e),()=>{s=!1}},[t,e]),n}var bx=gx,wx=_x,Ex=xx;const Gc=h.forwardRef(({className:t,...e},n)=>o.jsx(bx,{ref:n,className:ae("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Gc.displayName=bx.displayName;const Kc=h.forwardRef(({className:t,...e},n)=>o.jsx(wx,{ref:n,className:ae("aspect-square h-full w-full",t),...e}));Kc.displayName=wx.displayName;const qc=h.forwardRef(({className:t,...e},n)=>o.jsx(Ex,{ref:n,className:ae("flex h-full w-full items-center justify-center rounded-full bg-nature-red text-white hover:bg-nature-coral transition-colors",t),...e}));qc.displayName=Ex.displayName;const dm=ua("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 gL({className:t,variant:e,animated:n=!1,...r}){if(n){const s={className:ae(dm({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(Le.div,{...s,children:r.children})}return o.jsx("div",{className:ae(dm({variant:e}),t),...r})}const qt=({Icon:t,className:e="",size:n=24,hoverEffect:r="bounce"})=>{const s=()=>{switch(r){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(Le.div,{className:`inline-block touch-manipulation ${e}`,whileHover:s(),whileTap:i(),style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation"},children:o.jsx(t,{size:n})})},es=({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"},vL={"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"},_L=()=>{const{currentLanguage:t,changeLanguage:e}=$t(),{isBusy:n}=Mu(),{t:r}=Ce("navbar"),s=wn.map(a=>({code:a,name:no[a]})),i=s.find(a=>a.code===t)?.name||"English";return n?o.jsxs(PT,{children:[o.jsx(ST,{asChild:!0,children:o.jsx("span",{tabIndex:0,children:o.jsxs(xn,{variant:"ghost",size:"sm",className:"gap-2 opacity-50 cursor-not-allowed",disabled:!0,children:[o.jsx(es,{countryCode:uo[t]||"gb",size:20}),o.jsx("span",{className:"hidden sm:inline",children:i})]})})}),o.jsx(Vg,{side:"bottom",children:r("languageLockedDuringGeneration",{defaultValue:"Please wait — your story is being generated."})})]}):o.jsxs(Wy,{children:[o.jsx(Gy,{asChild:!0,children:o.jsxs(xn,{variant:"ghost",size:"sm",className:"gap-2",children:[o.jsx(es,{countryCode:uo[t]||"gb",size:20}),o.jsx("span",{className:"hidden sm:inline",children:i})]})}),o.jsx(Cd,{align:"end",className:"bg-white",children:s.map(a=>o.jsxs(qn,{onClick:()=>e(a.code),className:`flex items-center gap-2 ${t===a.code?"bg-gray-100":""}`,children:[o.jsx(es,{countryCode:uo[a.code]||"gb",size:16}),a.name]},a.code))})]})},Sr=({to:t,href:e,external:n,onClick:r,type:s="button",disabled:i,className:a="",variant:l,size:c="pill",leftIcon:u,children:d,linkProps:p,ariaLabel:f})=>{const m=ae(N0({variant:l,size:c}),"whitespace-nowrap gap-2",a),g=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(Le.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:r,"aria-label":f,className:m,...n?{target:"_blank",rel:"noopener noreferrer"}:{},...p,children:g})}):t?o.jsx(Le.span,{className:"inline-flex",whileHover:{scale:1.03},whileTap:{scale:.97},transition:{type:"spring",stiffness:400,damping:20},children:o.jsx(de,{to:t,onClick:r,"aria-label":f,className:m,...p,children:g})}):o.jsx(Le.button,{type:s,onClick:r,disabled:i,"aria-label":f,className:m,whileHover:i?void 0:{scale:1.03},whileTap:i?void 0:{scale:.97},transition:{type:"spring",stiffness:400,damping:20},children:g})},yL=({className:t="",onClick:e})=>{const{getLocalizedPath:n}=$t(),{t:r}=Ce("subscription");return o.jsx(Sr,{variant:"primary",to:e?void 0:n("/login"),onClick:e,leftIcon:o.jsx(Qm,{}),className:t,children:r("currentSubscription.unauthenticated.loginButton")})},hm="https://cdn.storysparkle.org/logo_assets/favicon.webp",xL=()=>{const[t,e]=h.useState(!1),[n,r]=h.useState(!1),s=ps(),i=su(),{user:a,signOut:l}=xs(),{userType:c,subscription:u,avatarUrl:d,displayName:p,refreshSubscriptionStatus:f}=I2(),m=h.useRef(null),[y,g]=h.useState(!1),x=async R=>{const N=R.target.files?.[0];if(!(!N||!a)){if(N.size>5*1024*1024){dn.error("Image must be under 5MB");return}g(!0),dn.loading("Uploading photo...",{id:"avatar-upload"});try{const L=N.name.split(".").pop()||"jpg",q=`${a.id}/avatar.${L}`,{error:D}=await W.storage.from("avatars").upload(q,N,{upsert:!0});if(D)throw D;const{data:{publicUrl:K}}=W.storage.from("avatars").getPublicUrl(q),V=`${K}?t=${Date.now()}`,{error:U}=await W.from("profiles").update({avatar_url:V}).eq("id",a.id);if(U)throw U;dn.success("Profile photo updated!",{id:"avatar-upload"}),f()}catch(L){console.error("Avatar upload error:",L),dn.error("Failed to upload photo",{id:"avatar-upload"})}finally{g(!1),m.current&&(m.current.value="")}}},{t:b}=Ce("navbar"),{getLocalizedPath:w}=$t(),E=R=>s.pathname===R,T=[{name:b("home"),path:"/",icon:a1},{name:b("stories"),path:"/stories",icon:f1},{name:b("improveReading"),path:"/improve-reading",icon:Vw},{name:b("themes"),path:"/themes",icon:S1},{name:b("blog"),path:"/blog",icon:g1},{name:b("about"),path:"/about",icon:c1},{name:b("contact"),path:"/contact",icon:E1},{name:b("premiumPlans"),path:"/subscription",icon:js}];T.splice(2,0,{name:b("storyMaker"),path:"/story-maker",icon:eg}),T.splice(3,0,{name:b("textChecker"),path:"/text-checker",icon:n1});const j=[{name:b("readingCart"),path:"/reading-cart",icon:Jm},{name:b("vocabulary"),path:"/vocabulary",icon:T1},{name:b("progress"),path:"/progress",icon:O1}],P=()=>e(!1),S=async()=>{if(!n){r(!0);try{await l(),i("/")}finally{r(!1)}}},k=(R,N)=>R?R.charAt(0).toUpperCase():N?N.charAt(0).toUpperCase():"U",O=c==="paid"||c==="admin"||u?.status==="active"&&!u?.isExpired;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.jsxs(de,{to:w("/"),className:"flex items-center gap-2 mr-6",children:[o.jsx("img",{src:hm,alt:"StorySparkle Logo",width:24,height:24,fetchPriority:"high",decoding:"async",className:"h-6 w-6"}),o.jsxs("span",{className:"font-bold text-lg hidden sm:inline-block",children:[o.jsx("span",{className:"text-nature-red",children:"Story"}),o.jsx("span",{className:"text-nature-coral",children:"Sparkle"})]})]}),o.jsxs("nav",{className:"hidden xl:flex items-center space-x-4 xl:space-x-6 mx-6",children:[T.map(R=>o.jsx(de,{to:w(R.path),className:`text-sm font-medium transition-colors hover:text-foreground/80 flex items-center justify-center p-2 ${E(R.path)?"text-nature-coral":"text-foreground/60"}`,title:R.name,children:E(R.path)?o.jsx(Le.div,{animate:{y:[0,-3,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:o.jsx(qt,{Icon:R.icon,size:20,hoverEffect:"wiggle",className:"cursor-pointer text-nature-coral"})}):o.jsx(qt,{Icon:R.icon,size:20,hoverEffect:"wiggle",className:"cursor-pointer"})},R.path)),a&&o.jsx(o.Fragment,{children:j.map(R=>o.jsx(de,{to:w(R.path),className:`text-sm font-medium transition-colors hover:text-foreground/80 flex items-center justify-center p-2 ${E(R.path)?"text-nature-coral":"text-foreground/60"}`,title:R.name,children:E(R.path)?o.jsx(Le.div,{animate:{y:[0,-3,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:o.jsx(qt,{Icon:R.icon,size:20,hoverEffect:"wiggle",className:"cursor-pointer text-nature-coral"})}):o.jsx(qt,{Icon:R.icon,size:20,hoverEffect:"wiggle",className:"cursor-pointer"})},R.path))})]}),o.jsxs("div",{className:"flex items-center ml-auto gap-2",children:[o.jsx(_L,{}),a?o.jsxs(Wy,{children:[o.jsx(Gy,{asChild:!0,children:o.jsxs(xn,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:[o.jsxs(Gc,{className:"h-8 w-8",children:[o.jsx(Kc,{src:d||"",alt:a.email||"User"}),o.jsx(qc,{children:k(p,a.email)})]}),O&&o.jsx("span",{className:"absolute -top-1 -right-1",children:o.jsx(gL,{variant:"outline",className:"h-4 w-4 p-0 flex items-center justify-center bg-nature-honey rounded-full",children:o.jsx(js,{className:"h-3 w-3 text-nature-honey-ink"})})})]})}),o.jsxs(Cd,{align:"end",className:"bg-background border border-border shadow-lg",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}),O&&o.jsxs("p",{className:"font-medium text-sm flex items-center gap-1",children:[o.jsx(js,{className:"h-3 w-3 text-nature-honey-ink"}),"Premium"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:a.email})]})}),o.jsx(Ks,{}),c==="admin"&&o.jsx(qn,{asChild:!0,children:o.jsx(de,{to:"/admin",children:"Admin Dashboard"})}),c==="admin"&&o.jsx(Ks,{}),j.map(R=>o.jsx(qn,{asChild:!0,children:o.jsxs(de,{to:R.path,className:"flex items-center gap-2",children:[R.icon&&o.jsx(R.icon,{className:"h-4 w-4"}),R.name]})},R.path)),o.jsx(Ks,{}),o.jsxs(qn,{onSelect:()=>m.current?.click(),disabled:y,className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(th,{className:"h-4 w-4"}),b(y?"uploading":"updatePhoto")]}),o.jsx(qn,{asChild:!0,children:o.jsxs(de,{to:w("/subscription"),className:"flex items-center gap-2",children:[o.jsx(js,{className:"h-4 w-4"}),b(O?"manageSubscription":"upgradeToPremium")]})}),o.jsx(qn,{asChild:!0,children:o.jsxs(de,{to:w("/reset-password"),className:"flex items-center gap-2",children:[o.jsx(nh,{className:"h-4 w-4"}),b("resetPassword","Reset Password")]})}),o.jsx(Ks,{}),o.jsxs(qn,{className:"cursor-pointer",disabled:n,onSelect:R=>{R.preventDefault(),S()},children:[o.jsx(sh,{className:"mr-2 h-4 w-4"}),o.jsx("span",{children:n?"Signing out...":b("logOut")})]})]})]}):o.jsx(yL,{}),o.jsxs(aL,{open:t,onOpenChange:e,children:[o.jsx(lL,{asChild:!0,children:o.jsxs(xn,{variant:"outline",size:"icon",className:"xl:hidden",children:[o.jsx(qt,{Icon:b1,size:20,hoverEffect:"wiggle",className:"cursor-pointer"}),o.jsx("span",{className:"sr-only",children:"Toggle menu"})]})}),o.jsxs(fx,{side:"right",className:"bg-white",children:[o.jsxs(de,{to:w("/"),className:"flex items-center gap-2 mb-8",onClick:P,children:[o.jsx("img",{src:hm,alt:"StorySparkle Logo",width:24,height:24,decoding:"async",className:"h-6 w-6"}),o.jsxs("span",{className:"font-bold text-lg",children:[o.jsx("span",{className:"text-nature-red",children:"Story"}),o.jsx("span",{className:"text-nature-coral",children:"Sparkle"})]})]}),o.jsxs("nav",{className:"flex flex-col gap-4",children:[T.map(R=>o.jsxs(de,{to:w(R.path),className:`hover:text-foreground flex items-center gap-2 ${E(R.path)?"text-nature-coral font-medium":"text-foreground/60"}`,onClick:P,children:[o.jsx(qt,{Icon:R.icon,size:16,hoverEffect:"wiggle",className:`cursor-pointer touch-manipulation ${E(R.path)?"text-nature-coral":""}`}),R.name,E(R.path)&&o.jsx(Le.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}})]},R.path)),o.jsx("div",{className:"border-t my-2 pt-2"}),a?o.jsxs(o.Fragment,{children:[j.map(R=>o.jsxs(de,{to:w(R.path),className:`hover:text-foreground flex items-center gap-2 ${E(R.path)?"text-nature-coral font-medium":"text-foreground/60"}`,onClick:P,children:[o.jsx(qt,{Icon:R.icon,size:16,hoverEffect:"wiggle",className:`cursor-pointer touch-manipulation ${E(R.path)?"text-nature-coral":""}`}),R.name,E(R.path)&&o.jsx(Le.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}})]},R.path)),o.jsx("div",{className:"border-t my-2 pt-2"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Gc,{className:"h-8 w-8",children:[o.jsx(Kc,{src:d||"",alt:a.email||"User"}),o.jsx(qc,{children:k(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.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t my-2 pt-2"}),o.jsxs(de,{to:"/admin",className:"hover:text-foreground flex items-center gap-2 text-foreground/60",onClick:P,children:[o.jsx(qt,{Icon:$w,size:16,hoverEffect:"wiggle",className:"cursor-pointer touch-manipulation"}),b("adminDashboard")]})]}),o.jsx("div",{className:"border-t my-2 pt-2"}),o.jsxs("button",{onClick:()=>m.current?.click(),disabled:y,className:"hover:text-foreground flex items-center gap-2 text-foreground/60 text-left",children:[o.jsx(th,{className:"h-4 w-4"}),b(y?"uploading":"updatePhoto")]}),o.jsxs(de,{to:w("/subscription"),className:"hover:text-foreground flex items-center gap-2 text-foreground/60",onClick:P,children:[o.jsx(js,{className:"h-4 w-4"}),b(O?"manageSubscription":"upgradeToPremium")]}),o.jsxs(de,{to:w("/reset-password"),className:"hover:text-foreground flex items-center gap-2 text-foreground/60",onClick:P,children:[o.jsx(nh,{className:"h-4 w-4"}),b("resetPassword","Reset Password")]}),o.jsx("div",{className:"border-t my-2 pt-2"}),o.jsxs(xn,{variant:"outline",disabled:n,onClick:async()=>{await S(),P()},children:[o.jsx(qt,{Icon:sh,size:16,hoverEffect:"scale",className:"cursor-pointer mr-2 touch-manipulation"}),n?"Signing out...":b("logOut")]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(de,{to:w("/login"),className:"flex items-center gap-2",onClick:P,children:[o.jsx(qt,{Icon:Qm,size:16,hoverEffect:"scale",className:"cursor-pointer touch-manipulation"}),b("signIn")]}),o.jsxs(de,{to:w("/signup"),className:"flex items-center gap-2",onClick:P,children:[o.jsx(qt,{Icon:N1,size:16,hoverEffect:"wiggle",className:"cursor-pointer touch-manipulation"}),b("createAccount")]})]})]})]})]})]})]}),a&&o.jsx("input",{type:"file",ref:m,className:"hidden",accept:"image/*",onChange:x})]})},jx=({variant:t="inline",className:e="",as:n="span"})=>{let r="",s="";switch(t){case"navbar":r="text-lg",s="font-bold";break;case"footer":r="text-xl",s="font-bold";break;case"auth":r="text-xl",s="font-bold";break;default:r="",s="";break}return o.jsxs(n,{className:cu(e,s,r,"whitespace-nowrap font-noto inline"),children:[o.jsx("span",{className:"text-nature-red",children:"Story"}),o.jsx("span",{className:"text-nature-coral",children:"Sparkle"})]})},bL="https://cdn.storysparkle.org/logo_assets/favicon.webp",wL=()=>{const{t,i18n:e}=Ce("footer"),{getLocalizedPath:n}=$t(),r=new Date().getFullYear(),{pathname:s}=ps(),i=l=>{const c=n(l);return l==="/"?s===c:s===c||s.startsWith(c+"/")||s.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(de,{to:n("/"),className:"flex items-center gap-2",children:[o.jsx("img",{src:bL,alt:"StorySparkle Logo",width:32,height:32,loading:"lazy",decoding:"async",className:"h-8 w-8"}),o.jsx(jx,{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(de,{to:n("/"),className:a("/"),children:t("home")})}),o.jsx("li",{children:o.jsx(de,{to:n("/stories"),className:a("/stories"),children:t("stories")})}),o.jsx("li",{children:o.jsx(de,{to:n("/story-maker"),className:a("/story-maker"),children:t("storyMaker")})}),o.jsx("li",{children:o.jsx(de,{to:n("/about"),className:a("/about"),children:t("about")})}),o.jsx("li",{children:o.jsx(de,{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(de,{to:n("/text-checker"),className:a("/text-checker"),children:t("textChecker")})}),o.jsx("li",{children:o.jsx(de,{to:n("/improve-reading"),className:a("/improve-reading"),children:t("improveReading")})}),o.jsx("li",{children:o.jsx(de,{to:n("/themes"),className:a("/themes"),children:t("themes")})}),o.jsx("li",{children:o.jsx(de,{to:n("/watch"),className:a("/watch"),children:t("watch")})}),o.jsx("li",{children:o.jsx(de,{to:n("/research"),className:a("/research"),children:t("seslAlgorithm")})}),o.jsx("li",{children:o.jsx(de,{to:n("/blog"),className:a("/blog"),children:t("blog")})}),o.jsx("li",{children:o.jsx(de,{to:n("/blog/newsletter"),className:a("/blog/newsletter"),children:t("newsletter")})}),o.jsx("li",{children:o.jsx(de,{to:n("/contact#faq-section"),className:a("/contact"),children:t("faq")})}),o.jsx("li",{children:o.jsx(de,{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(de,{to:n("/terms"),className:a("/terms"),children:t("terms")})}),o.jsx("li",{children:o.jsx(de,{to:n("/refund"),className:a("/refund"),children:t("refund")})}),o.jsx("li",{children:o.jsx(de,{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:r})}),o.jsxs("p",{className:"text-sm flex items-center gap-1 text-foreground/60",children:[t("madeWith")," ",o.jsx(Jm,{className:"h-3 w-3 text-nature-red"})," ",t("forYoungReaders")]})]})]})},EL=()=>{const[t,e]=h.useState({}),[n,r]=h.useState(!0);h.useEffect(()=>{(async()=>{try{const{data:l,error:c}=await W.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{r(!1)}})()},[]);const s=h.useCallback(async(a,l,c,u="image")=>{try{const{error:d}=await W.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:s,getAsset:i}},jL={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"},kr=({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:r="https://cdn.storysparkle.org/logo_assets/favicon_512x512.png",ogType:s="website",structuredData:i,noIndex:a=!1,keywords:l})=>{const{currentLanguage:c}=$t(),u=t.includes("StorySparkle")?t:`${t} | StorySparkle`,p=(n||window.location.pathname).replace(/^https?:\/\/[^/]+/i,"")||"/",f="https://storysparkle.org",m=wn.filter(w=>w!=="en"),y=new RegExp(`^/(${m.join("|")})(?=/|$)`);let g=p.replace(y,"");g===""&&(g="/");const x=w=>w==="en"?f+(g==="/"?"/":g):f+"/"+w+(g==="/"?"":g),b=x(c);return o.jsxs(Lb,{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}),wn.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:s}),o.jsx("meta",{property:"og:url",content:b}),o.jsx("meta",{property:"og:image",content:r}),o.jsx("meta",{property:"og:site_name",content:"StorySparkle"}),o.jsx("meta",{property:"og:locale",content:jL[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:r}),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"}},sV=["A1","A2","B1","B2","C1","C2"],oV=t=>!t||!(t in Co)?{label:"Unknown",shortLabel:"?",ageBand:"Unknown",classes:"bg-gray-100 text-gray-800"}:Co[t],pm=t=>!t||!(t in Co)?"Unknown":Co[t].ageBand,iV=t=>{if(!t)return null;const e=Object.entries(Co).find(([n,r])=>r.ageBand===t);return e?e[0]:null},aV=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",TL={"@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"]}},PL={"@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"}},SL={"@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© 109-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"}]},kL={"@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© 109-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"}},RL={"@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"}]},lV=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=pm(t.cefrLevel),n=e.includes("+")?parseInt(e):parseInt(e.split("-")[0])||3,r=e.includes("+")?99:parseInt(e.split("-")[1])||12;return{"@type":"Audience",audienceType:"Children",suggestedMinAge:n,suggestedMaxAge:r}})(),educationalAlignment:{"@type":"AlignmentObject",educationalFramework:"CEFR Language Levels",targetDescription:`CEFR ${t.cefrLevel||"Unknown"} reading level`},learningResourceType:"Interactive Story",interactivityType:"active",typicalAgeRange:`${pm(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"}}),cV=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}`}))}),AL={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:r=!1,className:s=""})=>o.jsx("div",{className:`relative w-full overflow-hidden leading-[0] ${s}`,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:r?"scaleX(-1)":void 0},children:o.jsx("path",{d:AL[n],fill:e})})});function CL(t,e,n){const r=t(e,{returnObjects:!0});return Array.isArray(r)?r:[]}const IL=({words:t,className:e="",typingSpeed:n=100,deletingSpeed:r=60,pauseAfterWord:s=1500,finalWordMultiplier:i=5})=>{const[a,l]=h.useState(0),[c,u]=h.useState(""),[d,p]=h.useState(!1),[f,m]=h.useState(!1),y=Array.isArray(t)&&t.length>0?t:[];h.useEffect(()=>{l(0),u(""),p(!1),m(!1)},[y.join("|")]);const g=y[a]??"",x=a===y.length-1,b=h.useCallback(()=>{if(!(f||!g))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<g.length)u(g.slice(0,c.length+1));else{m(!0);const w=x?s*i:s;setTimeout(()=>{m(!1),p(!0)},w)}},[c,d,f,g,x,s,i,y.length]);return h.useEffect(()=>{if(f||!g)return;const E=setTimeout(b,d?r:n);return()=>clearTimeout(E)},[b,d,f,n,r,g]),g?o.jsxs("span",{className:e,children:[c,o.jsx("span",{className:"animate-blink",children:"|"})]}):null};function Md(t){const e=h.useCallback(()=>{try{t().catch(()=>{})}catch{}},[t]);return{onMouseEnter:e,onFocus:e,onTouchStart:e}}const Vd=({className:t="",labelOverride:e})=>{const{getLocalizedPath:n}=$t(),{t:r}=Ce("landing"),s=Md(()=>_(()=>import("./StoriesPage-Bl2OFTVW.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(Sr,{variant:"primary",to:n("/stories"),leftIcon:o.jsx(Uw,{}),className:t,linkProps:s,children:e||r("buttons.readStories")})},OL=({className:t=""})=>{const{t:e}=Ce("landing"),{getLocalizedPath:n}=$t();return o.jsx(Sr,{variant:"create",to:n("/story-maker"),onClick:()=>window.scrollTo({top:0,behavior:"instant"}),leftIcon:o.jsx(eg,{}),className:t,children:e("buttons.startCreating")})},DL=({className:t=""})=>{const{t:e}=Ce("landing"),{getLocalizedPath:n}=$t(),r=Md(()=>_(()=>import("./TextCheckerPage-DTst4tjt.js"),__vite__mapDeps([24,1,2,25,26,4,7,27,20,28,29,30,6,19,31,18,32,23,33,22])));return o.jsx(Sr,{variant:"learn",to:n("/text-checker"),leftIcon:o.jsx(C1,{}),className:t,linkProps:r,children:e("checkText.buttonText")})},LL="https://cdn.storysparkle.org/logo_assets/Logo%20Claymation%20Transparent%20Square%20WEBP.webp",NL="https://cdn.storysparkle.org/landing_assets/Claymation%20Wordmark%20Transparent%20WEBP.webp",ML="https://cdn.storysparkle.org/landing_assets/Ethnic%20Circle%20Transparent%20WEBP.webp",VL=()=>{const{t}=Ce("landing"),e=CL(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:LL,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:NL,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,r)=>{const s=n.split("{{word}}");return o.jsx("div",{className:"whitespace-nowrap",children:s.map((i,a)=>o.jsxs(M.Fragment,{children:[o.jsx("span",{children:i}),a<s.length-1&&o.jsx(IL,{words:e.length?e:["magical"],typingSpeed:90,deletingSpeed:60,pauseAfterWord:1400,finalWordMultiplier:1,className:"text-nature-coral"})]},a))},r)})}),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(Vd,{}),o.jsx(OL,{}),o.jsx(DL,{})]}),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(Le.img,{src:ML,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"})})]})})})},FL="https://cdn.storysparkle.org/landing_assets/flicker-reading-reduced-size.mp4",$L=()=>{const t=h.useRef(null),e=x2(t,{amount:.3}),{t:n}=Ce("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(Vd,{})})]}),o.jsx("div",{className:"flex-1 flex justify-center items-center",children:o.jsx(Le.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:FL,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"w-full object-contain"})})})]})})})},BL=({className:t=""})=>{const{getLocalizedPath:e}=$t(),{t:n}=Ce("landing"),r=Md(()=>_(()=>import("./ResearchPage-CXdmJRbk.js"),__vite__mapDeps([34,1,2,18,7,4,35,32,11,36,37,28,38,22,23])));return o.jsx(Sr,{variant:"learn",to:e("/research"),leftIcon:o.jsx(s1,{}),className:t,linkProps:r,children:n("buttons.seslAlgorithm")})},UL="https://cdn.storysparkle.org/landing_assets/xp-chart-card.webp",zL=({sectionRef:t})=>{const e=h.useRef(null),n=t??e,{t:r}=Ce("landing"),[s,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:r("seslProgress.heading")}),o.jsx("h3",{className:"section-subtext text-sm lg:text-xl max-w-6xl",children:r("seslProgress.subtext")})]}),o.jsx("div",{className:"relative z-10 mt-6 px-6 flex justify-center md:block md:absolute md:top-[30%] md:left-0 md:mt-0 md:px-12 lg:px-20",children:o.jsx(BL,{})}),o.jsx(Le.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:s?{x:"0%",opacity:1}:{x:"30%",opacity:0},transition:{duration:.8,ease:[.22,1,.36,1]},children:o.jsx("img",{src:UL,alt:"XP Points Progress Chart",className:"w-full h-auto rounded-2xl shadow-2xl",width:1600,height:1e3,loading:"lazy",decoding:"async"})})]})})},HL="https://cdn.storysparkle.org/landing_assets/castle-on-cloud.webp",WL=()=>{const{t}=Ce("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(Le.img,{src:HL,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(Le.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(Le.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(jx,{})," ",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(Le.div,{initial:{y:30,opacity:0},whileInView:{y:0,opacity:1},viewport:{once:!0},transition:{delay:.5},children:o.jsx(Vd,{})}),o.jsx(Le.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"}),Yc="https://cdn.storysparkle.org";function Nl(t){let n="";for(let r=0;r<t.length;r+=32768){const s=t.subarray(r,r+32768);n+=String.fromCharCode.apply(null,s)}return btoa(n)}async function GL(t,e,n,r){let s,i=r;if(n instanceof File){i=i||n.type;const c=await n.arrayBuffer();s=Nl(new Uint8Array(c))}else if(n instanceof Blob){i=i||n.type;const c=await n.arrayBuffer();s=Nl(new Uint8Array(c))}else s=Nl(n);const{data:a,error:l}=await W.functions.invoke("r2-upload",{body:{bucket:t,path:e,content:s,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 uV(t,e){const{data:n,error:r}=await W.functions.invoke("r2-delete",{body:{bucket:t,path:e}});if(r)throw new Error(`R2 delete failed: ${r.message}`);if(n?.error)throw new Error(`R2 delete failed: ${n.error}`);return!0}async function dV(t){const{data:e,error:n}=await W.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 KL(t,e){return`${Yc}/${t}/${e}`}function hV(t){if(!t.startsWith(Yc))return null;const n=t.replace(`${Yc}/`,"").split("/");return n.length<2?null:{bucket:n[0],path:n.slice(1).join("/")}}function qL(t){const e=t.split(".").pop(),n=Date.now(),r=Math.random().toString(36).substring(2,8);return`${n}-${r}.${e}`}const YL=({placeholder:t,description:e,aspectRatio:n="square",className:r="",imageSrc:s,size:i="md",uploadPath:a="landing",onUpload:l})=>{const c=h.useRef(null),[u,d]=h.useState(!1),[p,f]=h.useState(s),m={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"},g=()=>{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)){dn.error("Please upload an image file (JPEG, PNG, GIF, or WebP)");return}if(w.size>10*1024*1024){dn.error("File size must be less than 10MB");return}d(!0);try{const T=qL(w.name),j=`${a}/${T}`;await GL("landing_assets",j,w,w.type);const P=KL("landing_assets",j);f(P),l?.(P),dn.success("Image uploaded successfully!")}catch(T){console.error("Upload failed:",T),dn.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"?m[n]:""} ${i!=="full"?y[i]:"w-full"} ${r}`}),o.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:x,className:"hidden"}),o.jsx(xn,{variant:"secondary",size:"sm",onClick:g,disabled:u,className:"absolute bottom-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:u?o.jsx(rh,{className:"w-4 h-4 animate-spin"}):o.jsx(oh,{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"?m[n]:"min-h-[100px]"} ${i!=="full"?y[i]:"w-full"} ${r}`,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(xn,{variant:"outline",size:"sm",onClick:g,disabled:u,className:"text-xs",children:u?o.jsxs(o.Fragment,{children:[o.jsx(rh,{className:"w-3 h-3 mr-1 animate-spin"}),"Uploading..."]}):o.jsxs(o.Fragment,{children:[o.jsx(oh,{className:"w-3 h-3 mr-1"}),"Upload"]})})]})},XL=({isVisible:t,beanstalkImageSrc:e,onBeanstalkUpload:n})=>o.jsx(mk,{children:t&&o.jsx(Le.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(YL,{placeholder:"BEANSTALK",description:"Claymation beanstalk growing from bottom to top",aspectRatio:"auto",size:"full",className:"h-full",imageSrc:e,onUpload:n})})})}),ZL="401989987777-08lbeuo9pch9kt8lfk5lprok19vp4bc0.apps.googleusercontent.com",JL="googleOneTapDismissed",QL=1e3*60*60,eN=async t=>{const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")},tN=()=>{const{user:t,isLoading:e}=xs(),n=h.useRef(!1);return h.useEffect(()=>{if(t||e||n.current)return;const r=sessionStorage.getItem(JL);if(r&&Date.now()-Number(r)<QL)return;const s=()=>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 eN(c);return window.google.accounts.id.initialize({client_id:ZL,callback:async d=>{try{const{error:p}=await W.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 s().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},nN=h.lazy(()=>_(()=>import("./ProfessionalNarrationSection-C9KLvgrM.js"),__vite__mapDeps([39,1,2,7,22,23]))),rN=h.lazy(()=>_(()=>import("./SyncedHighlightsSection-DPfTITbN.js"),__vite__mapDeps([40,1,2,41,7,22,23]))),sN=h.lazy(()=>_(()=>import("./InteractiveWordsSection-MYk7FUnj.js"),__vite__mapDeps([42,1,2,7,22,23]))),oN=h.lazy(()=>_(()=>import("./VocabularySection-B_VpZKXP.js"),__vite__mapDeps([43,1,2,17,7,22,23]))),iN=h.lazy(()=>_(()=>import("./ChooseYourPaceSection-BA6wn0SF.js"),__vite__mapDeps([44,1,2,17,7,45,22,23]))),aN=h.lazy(()=>_(()=>import("./DyslexiaSection-_0NCSwbW.js"),__vite__mapDeps([46,1,2,41,7,22,23]))),lN=h.lazy(()=>_(()=>import("./CheckTextSection-BfVMRdRH.js"),__vite__mapDeps([47,1,2,41,13,17,7,22,23]))),cN=h.lazy(()=>_(()=>import("./ThemesSection-CyXLRbEh.js"),__vite__mapDeps([48,1,2,41,49,7,50,22,23]))),uN=h.lazy(()=>_(()=>import("./StoryMakerSection-IQRMtbAz.js"),__vite__mapDeps([51,1,2,17,7,22,23]))),dN=h.lazy(()=>_(()=>import("./AchievementsSection-CtV1RtRJ.js"),__vite__mapDeps([52,1,2,17,7,22,23]))),hN=h.lazy(()=>_(()=>import("./HotAirBalloon-BCdkKMX_.js"),__vite__mapDeps([53,1,2,22,23,7]))),pN=h.lazy(()=>_(()=>import("./QuillWipe-CM9YxekO.js"),__vite__mapDeps([54,1,2,22,23,7]))),fN="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"},Ye=()=>{const{t}=Ce("home"),{getAsset:e,saveAsset:n}=EL(),r={"@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}}))},[s,i]=h.useState(!1),[a,l]=h.useState(!1),[c,u]=h.useState(0),d=h.useRef(null),p=h.useRef(null),{scrollYProgress:f}=p2({target:p,offset:["start start","end end"]}),m=Zf(f,[.4,.9],["100%","0%"]),y=Zf(f,[.4,.7],[0,1]),{setLumiTarget:g,setOnTargetReached:x}=t_(),[b,w]=h.useState(!1);return h.useEffect(()=>(x(()=>{w(!0),setTimeout(()=>{w(!1),g(null)},1e3)}),()=>x(void 0)),[x,g,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(tN,{}),o.jsx(kr,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/",structuredData:[TL,PL,SL,kL,RL,r]}),o.jsxs("div",{className:"min-h-screen overflow-x-clip",style:{background:Oe.white},children:[o.jsx(VL,{}),o.jsx(Yt,{topColor:Oe.white,bottomColor:Oe.buttercream,variant:8,flip:!0}),o.jsx($L,{}),o.jsx(Yt,{topColor:Oe.buttercream,bottomColor:Oe.lavender,variant:8}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(nN,{})}),o.jsx(Yt,{topColor:Oe.lavender,bottomColor:Oe.sky,variant:2,flip:!0}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(rN,{})}),o.jsx(Yt,{topColor:Oe.sky,bottomColor:Oe.apricot,variant:9}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(sN,{videoSrc:e("interactive_words","main_video"),onVideoUpload:E=>n("interactive_words","main_video",E,"video"),onLumiTarget:E=>g(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(oN,{})}),o.jsx(Yt,{topColor:Oe.lemon,bottomColor:Oe.seafoam,variant:10}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(iN,{})}),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(aN,{})}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(lN,{})}),o.jsx(h.Suspense,{fallback:o.jsx(Rn,{}),children:o.jsx(cN,{onInteractionComplete:()=>{},hasCarouselInteracted:!0})}),o.jsx(h.Suspense,{fallback:null,children:o.jsx(hN,{isActive:s,onComplete:()=>i(!1)})}),o.jsxs(h.Suspense,{fallback:null,children:[o.jsx(Yt,{topColor:Oe.mint,bottomColor:Oe.rose,variant:11}),o.jsx(uN,{flickerWritingImageSrc:e("story_maker","flicker_writing_image")}),o.jsx(pN,{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(dN,{})}),o.jsx(Yt,{topColor:Oe.violet,bottomColor:Oe.sage,variant:12}),o.jsxs("div",{className:"relative",children:[o.jsx(zL,{sectionRef:p}),o.jsx(Yt,{topColor:Oe.sage,bottomColor:Oe.peach,variant:5,flip:!0}),o.jsx("div",{ref:d,children:o.jsx(WL,{})}),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(Le.img,{src:fN,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:m,opacity:y}})})})]}),o.jsx(XL,{isVisible:!1,beanstalkImageSrc:e("progress","beanstalk_image"),onBeanstalkUpload:E=>n("progress","beanstalk_image",E,"image")})]})]})},Tx="https://cdn.storysparkle.org",Px=(t,e)=>`${Tx}/${t}/${e}`;async function mN(){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:`${Tx}/fonts/${e.name}`,format:e.format}))}catch(t){return console.error("Failed to load fonts:",t),[]}}function gN(){const[t,e]=h.useState(!1);return h.useEffect(()=>{(async()=>{await new Promise(r=>{"requestIdleCallback"in window?window.requestIdleCallback(()=>r(),{timeout:5e3}):setTimeout(r,3e3)});try{const r=await mN();if(r.length===0){console.log("No fonts found in storage, using fallback"),e(!0);return}const s=r.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(s),e(!0),console.log("All fonts loaded from Supabase")}catch(r){console.error("Error loading fonts (using fallback):",r),e(!0)}})()},[]),null}const vN=()=>{const{pathname:t}=ps();return h.useEffect(()=>{window.scrollTo(0,0)},[t]),null},_N="Main Scene",yN=0,xN=260.1941560444079,bN=260.1941046463815,wN={g:"@lottiefiles/creator@1.88.0"},EN=[{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}],jN="5.7.0",TN=30,PN=90,SN=0,kN=[{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}]}],RN={nm:_N,ddd:yN,h:xN,w:bN,meta:wN,layers:EN,v:jN,fr:TN,op:PN,ip:SN,assets:kN},AN=h.lazy(()=>_(()=>import("./index.es-C3Wz79fL.js"),__vite__mapDeps([55,2]))),Sx=({delay:t=150,label:e="Loading…",overlay:n=!0,minHeight:r="60vh",transparent:s=!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=s?{}:{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${s?" 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:r},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:s?{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(AN,{animationData:RN,loop:!0,autoplay:!l,initialSegment:[0,90],"aria-hidden":"true"})})}),o.jsx("span",{className:"sr-only",children:e})]})},CN=()=>{const{isSwitchingLanguage:t}=$t();return t?o.jsx(Sx,{overlay:!0,transparent:!0}):null},IN=()=>{const{currentLanguage:t,changeLanguage:e}=$t(),{isBusy:n}=Mu(),{user:r}=xs(),{t:s}=Ce("navbar"),[i,a]=h.useState(null);if(h.useEffect(()=>{if(r||ak())return;const p=Jv();!p||p===t||a(p)},[t,r]),!i||n||r)return null;const l=no[i],c=Fn(t)?no[t]:no.en,u=()=>{Fn(t)&&ro(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(es,{countryCode:uo[i]||"gb",size:20,className:"shrink-0"}),o.jsx("p",{className:"text-sm text-ink",children:s("languageSuggestion.message",{language:l,defaultValue:"StorySparkle is available in {{language}}."})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Sr,{variant:"primary",size:"pillSm",onClick:d,children:s("languageSuggestion.switch",{language:l,defaultValue:"Switch to {{language}}"})}),o.jsx(xn,{variant:"ghost",size:"pillSm",onClick:u,className:"text-nature-forest hover:bg-nature-forest/10",children:s("languageSuggestion.keep",{language:c,defaultValue:"Keep {{language}}"})}),o.jsx(xn,{variant:"ghost",size:"pillIcon",onClick:u,"aria-label":s("languageSuggestion.dismiss",{defaultValue:"Dismiss"}),className:"text-nature-forest hover:bg-nature-forest/10",children:o.jsx(da,{className:"h-4 w-4"})})]})]})})},ON=cx,pV=ux,DN=dx,kx=h.forwardRef(({className:t,...e},n)=>o.jsx(Oa,{ref:n,className:ae("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}));kx.displayName=Oa.displayName;const Rx=h.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(DN,{children:[o.jsx(kx,{}),o.jsxs(Da,{ref:r,className:ae("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(hx,{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(da,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rx.displayName=Da.displayName;const Ax=({className:t,...e})=>o.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Ax.displayName="DialogHeader";const Cx=({className:t,...e})=>o.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Cx.displayName="DialogFooter";const Ix=h.forwardRef(({className:t,...e},n)=>o.jsx(La,{ref:n,className:ae("text-lg font-semibold leading-none tracking-tight",t),...e}));Ix.displayName=La.displayName;const Ox=h.forwardRef(({className:t,...e},n)=>o.jsx(Na,{ref:n,className:ae("text-sm text-muted-foreground",t),...e}));Ox.displayName=Na.displayName;function fm(t,[e,n]){return Math.min(n,Math.max(e,t))}function LN(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 NN=[" ","Enter","ArrowUp","ArrowDown"],MN=[" ","Enter"],Wo="Select",[Ma,Va,VN]=aa(Wo),[Es,fV]=Er(Wo,[VN,ys]),Fa=ys(),[FN,ir]=Es(Wo),[$N,BN]=Es(Wo),Dx=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:f,required:m,form:y}=t,g=Fa(e),[x,b]=h.useState(null),[w,E]=h.useState(null),[T,j]=h.useState(!1),P=xd(u),[S=!1,k]=vr({prop:r,defaultProp:s,onChange:i}),[O,R]=vr({prop:a,defaultProp:l,onChange:c}),N=h.useRef(null),L=x?y||!!x.closest("form"):!0,[q,D]=h.useState(new Set),K=Array.from(q).map(V=>V.props.value).join(";");return o.jsx(xu,{...g,children:o.jsxs(FN,{required:m,scope:e,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:j,contentId:mn(),value:O,onValueChange:R,open:S,onOpenChange:k,dir:P,triggerPointerDownPosRef:N,disabled:f,children:[o.jsx(Ma.Provider,{scope:e,children:o.jsx($N,{scope:t.__scopeSelect,onNativeOptionAdd:h.useCallback(V=>{D(U=>new Set(U).add(V))},[]),onNativeOptionRemove:h.useCallback(V=>{D(U=>{const C=new Set(U);return C.delete(V),C})},[]),children:n})}),L?o.jsxs(ob,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:p,value:O,onChange:V=>R(V.target.value),disabled:f,form:y,children:[O===void 0?o.jsx("option",{value:""}):null,Array.from(q)]},K):null]})})};Dx.displayName=Wo;var Lx="SelectTrigger",Nx=h.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=Fa(n),a=ir(Lx,n),l=a.disabled||r,c=_e(e,a.onTriggerChange),u=Va(n),d=h.useRef("touch"),[p,f,m]=ib(g=>{const x=u().filter(E=>!E.disabled),b=x.find(E=>E.value===a.value),w=ab(x,g,b);w!==void 0&&a.onValueChange(w.value)}),y=g=>{l||(a.onOpenChange(!0),m()),g&&(a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return o.jsx(bu,{asChild:!0,...i,children:o.jsx(te.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":sb(a.value)?"":void 0,...s,ref:c,onClick:H(s.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&y(g)}),onPointerDown:H(s.onPointerDown,g=>{d.current=g.pointerType;const x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(y(g),g.preventDefault())}),onKeyDown:H(s.onKeyDown,g=>{const x=p.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(x&&g.key===" ")&&NN.includes(g.key)&&(y(),g.preventDefault())})})})});Nx.displayName=Lx;var Mx="SelectValue",Vx=h.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:a="",...l}=t,c=ir(Mx,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,p=_e(e,c.onValueNodeChange);return He(()=>{u(d)},[u,d]),o.jsx(te.span,{...l,ref:p,style:{pointerEvents:"none"},children:sb(c.value)?o.jsx(o.Fragment,{children:a}):i})});Vx.displayName=Mx;var UN="SelectIcon",Fx=h.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return o.jsx(te.span,{"aria-hidden":!0,...s,ref:e,children:r||"â–¼"})});Fx.displayName=UN;var zN="SelectPortal",$x=t=>o.jsx(ms,{asChild:!0,...t});$x.displayName=zN;var wr="SelectContent",Bx=h.forwardRef((t,e)=>{const n=ir(wr,t.__scopeSelect),[r,s]=h.useState();if(He(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?hs.createPortal(o.jsx(Ux,{scope:t.__scopeSelect,children:o.jsx(Ma.Slot,{scope:t.__scopeSelect,children:o.jsx("div",{children:t.children})})}),i):null}return o.jsx(zx,{...t,ref:e})});Bx.displayName=wr;var Zt=10,[Ux,ar]=Es(wr),HN="SelectContentImpl",zx=h.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:y,hideWhenDetached:g,avoidCollisions:x,...b}=t,w=ir(wr,n),[E,T]=h.useState(null),[j,P]=h.useState(null),S=_e(e,G=>T(G)),[k,O]=h.useState(null),[R,N]=h.useState(null),L=Va(n),[q,D]=h.useState(!1),K=h.useRef(!1);h.useEffect(()=>{if(E)return wd(E)},[E]),bd();const V=h.useCallback(G=>{const[pe,...ke]=L().map(xe=>xe.ref.current),[ie]=ke.slice(-1),ye=document.activeElement;for(const xe of G)if(xe===ye||(xe?.scrollIntoView({block:"nearest"}),xe===pe&&j&&(j.scrollTop=0),xe===ie&&j&&(j.scrollTop=j.scrollHeight),xe?.focus(),document.activeElement!==ye))return},[L,j]),U=h.useCallback(()=>V([k,E]),[V,k,E]);h.useEffect(()=>{q&&U()},[q,U]);const{onOpenChange:C,triggerPointerDownPosRef:I}=w;h.useEffect(()=>{if(E){let G={x:0,y:0};const pe=ie=>{G={x:Math.abs(Math.round(ie.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(ie.pageY)-(I.current?.y??0))}},ke=ie=>{G.x<=10&&G.y<=10?ie.preventDefault():E.contains(ie.target)||C(!1),document.removeEventListener("pointermove",pe),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",ke,{capture:!0})}}},[E,C,I]),h.useEffect(()=>{const G=()=>C(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[C]);const[ee,Y]=ib(G=>{const pe=L().filter(ye=>!ye.disabled),ke=pe.find(ye=>ye.ref.current===document.activeElement),ie=ab(pe,G,ke);ie&&setTimeout(()=>ie.ref.current.focus())}),X=h.useCallback((G,pe,ke)=>{const ie=!K.current&&!ke;(w.value!==void 0&&w.value===pe||ie)&&(O(G),ie&&(K.current=!0))},[w.value]),J=h.useCallback(()=>E?.focus(),[E]),oe=h.useCallback((G,pe,ke)=>{const ie=!K.current&&!ke;(w.value!==void 0&&w.value===pe||ie)&&N(G)},[w.value]),Se=r==="popper"?Xc:Hx,ne=Se===Xc?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:y,hideWhenDetached:g,avoidCollisions:x}:{};return o.jsx(Ux,{scope:n,content:E,viewport:j,onViewportChange:P,itemRefCallback:X,selectedItem:k,onItemLeave:J,itemTextRefCallback:oe,focusSelectedItem:U,selectedItemText:R,position:r,isPositioned:q,searchRef:ee,children:o.jsx(Aa,{as:Jn,allowPinchZoom:!0,children:o.jsx(Sa,{asChild:!0,trapped:w.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:H(s,G=>{w.trigger?.focus({preventScroll:!0}),G.preventDefault()}),children:o.jsx(fs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(Se,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:G=>G.preventDefault(),...b,...ne,onPlaced:()=>D(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:H(b.onKeyDown,G=>{const pe=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!pe&&G.key.length===1&&Y(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let ie=L().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(G.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ye=G.target,xe=ie.indexOf(ye);ie=ie.slice(xe+1)}setTimeout(()=>V(ie)),G.preventDefault()}})})})})})})});zx.displayName=HN;var WN="SelectItemAlignedPosition",Hx=h.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=ir(wr,n),a=ar(wr,n),[l,c]=h.useState(null),[u,d]=h.useState(null),p=_e(e,S=>d(S)),f=Va(n),m=h.useRef(!1),y=h.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=a,E=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&g&&x&&b){const S=i.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),R=b.getBoundingClientRect();if(i.dir!=="rtl"){const ye=R.left-k.left,xe=O.left-ye,Be=S.left-xe,Ot=S.width+Be,Tn=Math.max(Ot,k.width),Dt=window.innerWidth-Zt,Pn=fm(xe,[Zt,Math.max(Zt,Dt-Tn)]);l.style.minWidth=Ot+"px",l.style.left=Pn+"px"}else{const ye=k.right-R.right,xe=window.innerWidth-O.right-ye,Be=window.innerWidth-S.right-xe,Ot=S.width+Be,Tn=Math.max(Ot,k.width),Dt=window.innerWidth-Zt,Pn=fm(xe,[Zt,Math.max(Zt,Dt-Tn)]);l.style.minWidth=Ot+"px",l.style.right=Pn+"px"}const N=f(),L=window.innerHeight-Zt*2,q=g.scrollHeight,D=window.getComputedStyle(u),K=parseInt(D.borderTopWidth,10),V=parseInt(D.paddingTop,10),U=parseInt(D.borderBottomWidth,10),C=parseInt(D.paddingBottom,10),I=K+V+q+C+U,ee=Math.min(x.offsetHeight*5,I),Y=window.getComputedStyle(g),X=parseInt(Y.paddingTop,10),J=parseInt(Y.paddingBottom,10),oe=S.top+S.height/2-Zt,Se=L-oe,ne=x.offsetHeight/2,G=x.offsetTop+ne,pe=K+V+G,ke=I-pe;if(pe<=oe){const ye=N.length>0&&x===N[N.length-1].ref.current;l.style.bottom="0px";const xe=u.clientHeight-g.offsetTop-g.offsetHeight,Be=Math.max(Se,ne+(ye?J:0)+xe+U),Ot=pe+Be;l.style.height=Ot+"px"}else{const ye=N.length>0&&x===N[0].ref.current;l.style.top="0px";const Be=Math.max(oe,K+g.offsetTop+(ye?X:0)+ne)+ke;l.style.height=Be+"px",g.scrollTop=pe-oe+g.offsetTop}l.style.margin=`${Zt}px 0`,l.style.minHeight=ee+"px",l.style.maxHeight=L+"px",r?.(),requestAnimationFrame(()=>m.current=!0)}},[f,i.trigger,i.valueNode,l,u,g,x,b,i.dir,r]);He(()=>E(),[E]);const[T,j]=h.useState();He(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const P=h.useCallback(S=>{S&&y.current===!0&&(E(),w?.(),y.current=!1)},[E,w]);return o.jsx(KN,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:P,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:o.jsx(te.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Hx.displayName=WN;var GN="SelectPopperPosition",Xc=h.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Zt,...i}=t,a=Fa(n);return o.jsx(wu,{...a,...i,ref:e,align:r,collisionPadding:s,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)"}})});Xc.displayName=GN;var[KN,Fd]=Es(wr,{}),Zc="SelectViewport",Wx=h.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=ar(Zc,n),a=Fd(Zc,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:r}),o.jsx(Ma.Slot,{scope:n,children:o.jsx(te.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:H(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=a;if(f?.current&&p){const m=Math.abs(c.current-d.scrollTop);if(m>0){const y=window.innerHeight-Zt*2,g=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),b=Math.max(g,x);if(b<y){const w=b+m,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})})})]})});Wx.displayName=Zc;var Gx="SelectGroup",[qN,YN]=Es(Gx),XN=h.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=mn();return o.jsx(qN,{scope:n,id:s,children:o.jsx(te.div,{role:"group","aria-labelledby":s,...r,ref:e})})});XN.displayName=Gx;var Kx="SelectLabel",qx=h.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=YN(Kx,n);return o.jsx(te.div,{id:s.id,...r,ref:e})});qx.displayName=Kx;var oa="SelectItem",[ZN,Yx]=Es(oa),Xx=h.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...a}=t,l=ir(oa,n),c=ar(oa,n),u=l.value===r,[d,p]=h.useState(i??""),[f,m]=h.useState(!1),y=_e(e,w=>c.itemRefCallback?.(w,r,s)),g=mn(),x=h.useRef("touch"),b=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")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(ZN,{scope:n,value:r,disabled:s,textId:g,isSelected:u,onItemTextChange:h.useCallback(w=>{p(E=>E||(w?.textContent??"").trim())},[]),children:o.jsx(Ma.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:o.jsx(te.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:y,onFocus:H(a.onFocus,()=>m(!0)),onBlur:H(a.onBlur,()=>m(!1)),onClick:H(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:H(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:H(a.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:H(a.onPointerMove,w=>{x.current=w.pointerType,s?c.onItemLeave?.():x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(a.onPointerLeave,w=>{w.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(a.onKeyDown,w=>{c.searchRef?.current!==""&&w.key===" "||(MN.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Xx.displayName=oa;var qs="SelectItemText",Zx=h.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,a=ir(qs,n),l=ar(qs,n),c=Yx(qs,n),u=BN(qs,n),[d,p]=h.useState(null),f=_e(e,b=>p(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),m=d?.textContent,y=h.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=u;return He(()=>(g(y),()=>x(y)),[g,x,y]),o.jsxs(o.Fragment,{children:[o.jsx(te.span,{id:c.textId,...i,ref:f}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?hs.createPortal(i.children,a.valueNode):null]})});Zx.displayName=qs;var Jx="SelectItemIndicator",Qx=h.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return Yx(Jx,n).isSelected?o.jsx(te.span,{"aria-hidden":!0,...r,ref:e}):null});Qx.displayName=Jx;var Jc="SelectScrollUpButton",eb=h.forwardRef((t,e)=>{const n=ar(Jc,t.__scopeSelect),r=Fd(Jc,t.__scopeSelect),[s,i]=h.useState(!1),a=_e(e,r.onScrollButtonChange);return He(()=>{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]),s?o.jsx(nb,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});eb.displayName=Jc;var Qc="SelectScrollDownButton",tb=h.forwardRef((t,e)=>{const n=ar(Qc,t.__scopeSelect),r=Fd(Qc,t.__scopeSelect),[s,i]=h.useState(!1),a=_e(e,r.onScrollButtonChange);return He(()=>{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]),s?o.jsx(nb,{...t,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});tb.displayName=Qc;var nb=h.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=ar("SelectScrollButton",n),a=h.useRef(null),l=Va(n),c=h.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),He(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),o.jsx(te.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:H(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:H(s.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:H(s.onPointerLeave,()=>{c()})})}),JN="SelectSeparator",rb=h.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return o.jsx(te.div,{"aria-hidden":!0,...r,ref:e})});rb.displayName=JN;var eu="SelectArrow",QN=h.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Fa(n),i=ir(eu,n),a=ar(eu,n);return i.open&&a.position==="popper"?o.jsx(Eu,{...s,...r,ref:e}):null});QN.displayName=eu;function sb(t){return t===""||t===void 0}var ob=h.forwardRef((t,e)=>{const{value:n,...r}=t,s=h.useRef(null),i=_e(e,s),a=LN(n);return h.useEffect(()=>{const l=s.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",{...r,ref:i,defaultValue:n})})});ob.displayName="BubbleSelect";function ib(t){const e=qe(t),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(a=>{const l=n.current+a;e(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function ab(t,e,n){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=eM(t,Math.max(i,0));s.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function eM(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var tM=Dx,lb=Nx,nM=Vx,rM=Fx,sM=$x,cb=Bx,oM=Wx,ub=qx,db=Xx,iM=Zx,aM=Qx,hb=eb,pb=tb,fb=rb;const mm=tM,gm=nM,tu=h.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(lb,{ref:r,className:ae("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(rM,{asChild:!0,children:o.jsx(Zm,{className:"h-4 w-4 opacity-50"})})]}));tu.displayName=lb.displayName;const mb=h.forwardRef(({className:t,...e},n)=>o.jsx(hb,{ref:n,className:ae("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Yw,{className:"h-4 w-4"})}));mb.displayName=hb.displayName;const gb=h.forwardRef(({className:t,...e},n)=>o.jsx(pb,{ref:n,className:ae("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Zm,{className:"h-4 w-4"})}));gb.displayName=pb.displayName;const nu=h.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(sM,{children:o.jsxs(cb,{ref:s,className:ae("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,...r,children:[o.jsx(mb,{}),o.jsx(oM,{className:ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(gb,{})]})}));nu.displayName=cb.displayName;const lM=h.forwardRef(({className:t,...e},n)=>o.jsx(ub,{ref:n,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));lM.displayName=ub.displayName;const ru=h.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(db,{ref:r,className:ae("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(aM,{children:o.jsx(uu,{className:"h-4 w-4"})})}),o.jsx(iM,{children:e})]}));ru.displayName=db.displayName;const cM=h.forwardRef(({className:t,...e},n)=>o.jsx(fb,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",t),...e}));cM.displayName=fb.displayName;const pi=t=>t.replace(/^[^\w]+|[^\w]+$/g,""),vm={async getUniqueWordCount(){try{const{data:{user:t}}=await W.auth.getUser();if(!t)return 0;const{count:e,error:n}=await W.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,r,s,i){try{const{data:{user:a}}=await W.auth.getUser();if(!a)throw new Error("User not authenticated");const{data:l,error:c}=await W.functions.invoke("contextual-translate",{body:{word:t,sentence:n,storyId:r,storyTitle:s,targetLanguage:i}});if(c||!l)throw c||new Error("Translation failed");const{contextualMeaning:u,partOfSpeech:d,pronunciation:p}=l,f=pi(t),m=pi(e),y=f.toLowerCase(),{data:g}=await W.from("vocabulary_words").select("id").eq("user_id",a.id).eq("word",y).maybeSingle();let x;if(g)x=g.id;else{const{data:E,error:T}=await W.from("vocabulary_words").insert({user_id:a.id,word:y,original_word:m,pronunciation:p}).select("id").single();if(T||!E)throw T||new Error("Failed to create word");x=E.id}const{data:b}=await W.from("vocabulary_occurrences").select("id").eq("vocabulary_word_id",x).eq("story_id",r).eq("sentence",n).maybeSingle();if(b)return{success:!0,status:"exists",data:{contextualMeaning:u,partOfSpeech:d,pronunciation:p}};const{error:w}=await W.from("vocabulary_occurrences").insert({vocabulary_word_id:x,story_id:r,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,r,s){try{const{data:{user:i}}=await W.auth.getUser();if(!i)throw new Error("User not authenticated");const{contextualMeaning:a,partOfSpeech:l,pronunciation:c}=s,u=pi(t),d=pi(e),p=u.toLowerCase(),{data:f}=await W.from("vocabulary_words").select("id").eq("user_id",i.id).eq("word",p).maybeSingle();let m,y=!1;if(f)m=f.id;else{y=!0;const{data:b,error:w}=await W.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");m=b.id}const{data:g}=await W.from("vocabulary_occurrences").select("id").eq("vocabulary_word_id",m).eq("story_id",r).eq("sentence",n).maybeSingle();if(g)return{success:!0,status:"exists"};const{error:x}=await W.from("vocabulary_occurrences").insert({vocabulary_word_id:m,story_id:r,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 W.auth.getUser();if(!t)return[];const{data:e,error:n}=await W.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 r=e.map(l=>l.id);if(r.length===0)return[];const{data:s,error:i}=await W.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",r).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:(s||[]).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 W.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 W.auth.getUser();if(!t)return;const{error:e}=await W.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 W.auth.getUser();if(!e)return!1;const n=t.toLowerCase(),{data:r}=await W.from("vocabulary_words").select("id").eq("user_id",e.id).eq("word",n).maybeSingle();return!!r}catch(e){return console.error("Error checking if word exists:",e),!1}},async pruneForFreeUser(){try{const{data:{user:t}}=await W.auth.getUser();if(!t)return 0;const{data:e}=await W.from("profiles").select("user_type").eq("id",t.id).single();if(e?.user_type==="admin")return 0;const{data:n}=await W.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:s,error:i}=await W.from("vocabulary_words").select("id, created_at").eq("user_id",t.id).order("created_at",{ascending:!0});if(i||!s||s.length<=20)return 0;const a=s.slice(20).map(c=>c.id);for(const c of a)await W.from("vocabulary_occurrences").delete().eq("vocabulary_word_id",c);const{error:l}=await W.from("vocabulary_words").delete().in("id",a);if(l)throw l;return a.length}catch(t){return console.error("Error pruning vocabulary:",t),0}}},_m="languagePrefsSnoozed",uM=()=>{const{user:t}=xs(),{currentLanguage:e,changeLanguage:n}=$t(),{t:r,i18n:s}=Ce("auth"),[i,a]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState("en"),[p,f]=h.useState("zh-Hans"),[m,y]=h.useState(null),[g,x]=h.useState(!1),b=g&&m!==null&&p!==m,[,w]=h.useReducer(P=>P+1,0);h.useEffect(()=>{if(!i)return;let P=!1;return s.loadLanguages(u).then(()=>{P||w()},()=>{}),()=>{P=!0}},[u,i,s]);const E=(P,S)=>r(P,{lng:u,defaultValue:S});h.useEffect(()=>{if(!t||sessionStorage.getItem(_m))return;let P=!1;return(async()=>{const{data:S,error:k}=await W.from("profiles").select("language_prefs_confirmed_at, preferred_app_language, preferred_translation_language").eq("id",t.id).maybeSingle();if(P||k||!S||S.language_prefs_confirmed_at)return;const O=Fn(S.preferred_app_language)?S.preferred_app_language:Fn(e)?e:"en",R=S.preferred_translation_language||lk(O);d(O),f(R),y(R);const N=await vm.getUniqueWordCount();P||x(N>0),a(!0)})(),()=>{P=!0}},[t?.id]);const T=async()=>{if(!(!t||l)){c(!0);try{b&&await vm.clearAllWords(),await W.from("profiles").update({preferred_app_language:u,preferred_translation_language:p,language_prefs_confirmed_at:new Date().toISOString()}).eq("id",t.id),ro(u),a(!1),u!==e&&n(u)}catch(P){console.error("[LanguagePreferencesDialog] save failed:",P),a(!1)}finally{c(!1)}}},j=()=>{sessionStorage.setItem(_m,"1"),a(!1)};return i?o.jsx(ON,{open:i,onOpenChange:P=>{P||j()},children:o.jsxs(Rx,{className:"sm:max-w-md",children:[o.jsxs(Ax,{children:[o.jsx(Ix,{className:"text-ink",children:E("languagePreferences.title","Choose your languages")}),o.jsx(Ox,{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(e1,{className:"h-4 w-4 shrink-0 text-nature-coral"}),E("languagePreferences.appLabel","The language you'll read the site in")]}),o.jsxs(mm,{value:u,onValueChange:P=>d(P),children:[o.jsx(tu,{className:"border-nature-forest/30",children:o.jsx(gm,{})}),o.jsx(nu,{className:"bg-white",children:wn.map(P=>o.jsx(ru,{value:P,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(es,{countryCode:uo[P]||"gb",size:16,className:"shrink-0"}),no[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(h1,{className:"h-4 w-4 shrink-0 text-nature-coral"}),E("languagePreferences.translationLabel","The language new words are explained in")]}),o.jsxs(mm,{value:p,onValueChange:P=>f(P),children:[o.jsx(tu,{className:"border-nature-forest/30",children:o.jsx(gm,{})}),o.jsx(nu,{className:"bg-white",children:Object.entries(Xv).map(([P,{displayName:S}])=>o.jsx(ru,{value:P,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(es,{countryCode:vL[P]||"cn",size:16,className:"shrink-0"}),S]})},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(Cx,{children:o.jsx(Sr,{variant:"primary",onClick:T,disabled:l,leftIcon:o.jsx(uu,{}),children:l?E("languagePreferences.saving","Saving…"):E("languagePreferences.confirm","Looks good")})})]})}):null},dM=()=>{const{t}=Ce("landing"),[e,n]=h.useState(!1),[r,s]=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=()=>s(!!document.fullscreenElement);return a(),document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[]);const i=r;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(R1,{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},hM=["en","es","bn","zh","ja","ko","th","vi","hi","pt","fil","ms","id","my","km","lo"],pM=t=>{const e=t.match(/^\/([a-z]{2})(\/|$)/);return e&&hM.includes(e[1])?e[1]:null},fM=t=>t?`/${t}/subscription`:"/subscription",mM=t=>{const e=t.match(/^(?:\/[a-z]{2})?\/story\/([^/?#]+)/);return e?e[1]:null},gM=()=>{const t=su();h.useEffect(()=>{const{data:{subscription:e}}=W.auth.onAuthStateChange((n,r)=>{if(n!=="SIGNED_IN")return;const s=sessionStorage.getItem("pendingAuthRedirect");if(!s)return;sessionStorage.removeItem("pendingAuthRedirect");const i=mM(s);if(!i||!r?.user){setTimeout(()=>t(s),0);return}(async()=>{try{const a=pM(s),[l,c,u]=await Promise.all([W.from("stories").select("access_level").eq("id",i).maybeSingle(),W.from("profiles").select("user_type").eq("id",r.user.id).maybeSingle(),W.from("user_payments").select("subscription_status, subscription_end_date").eq("user_id",r.user.id).maybeSingle()]),d=l.data?.access_level??"paid",p=c.data?.user_type??"free",f=u.data?.subscription_status,m=u.data?.subscription_end_date?new Date(u.data.subscription_end_date):null,y=f==="active"&&(!m||m>new Date);let g=!1;p==="admin"||d==="guest"||d==="free"?g=!0:d==="paid"&&(g=p==="paid"||y),g?setTimeout(()=>t(s),0):(sessionStorage.setItem("postSubscriptionRedirect",s),setTimeout(()=>t(fM(a)),0))}catch(a){console.error("[useAuthRedirect] story access check failed:",a),setTimeout(()=>t(s),0)}})()});return()=>e.unsubscribe()},[t])},Xe=()=>{const{t}=Ce("improve-reading");return o.jsx(kr,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/improve-reading"})},Ze=()=>{const{t}=Ce("contact");return o.jsx(kr,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/contact"})},Je=()=>{const{t}=Ce("subscription");return o.jsx(kr,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/subscription"})},Qe=()=>{const{t}=Ce("auth");return o.jsx(kr,{title:t("meta.login.title"),description:t("meta.login.description"),keywords:t("meta.login.keywords",{defaultValue:""})||void 0,canonical:"/login",noIndex:!0})},et=()=>{const{t}=Ce("auth");return o.jsx(kr,{title:t("meta.signup.title"),description:t("meta.signup.description"),keywords:t("meta.signup.keywords",{defaultValue:""})||void 0,canonical:"/signup"})},vb="watch",_b=[{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}]}],mV=t=>_b.find(e=>e.slug===t),gV=t=>Px(vb,t.file),vV=t=>Px(vb,`posters/${t.poster}`),_V=(t,e)=>`/subtitles/${t.slug}.${e}.vtt`,yV=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`:""}`},vM=(t,e)=>`https://storysparkle.org${e==="en"?"":`/${e}`}${t}`,xV=t=>{const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${String(n).padStart(2,"0")}`},tt=()=>{const{t}=Ce("watch"),{currentLanguage:e}=$t(),n={"@context":"https://schema.org","@type":"ItemList",name:t("hero.title"),itemListElement:_b.map((r,s)=>({"@type":"ListItem",position:s+1,name:t(`videos.${r.slug}.title`),url:vM(`/watch/${r.slug}`,e)}))};return o.jsx(kr,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/watch",structuredData:n})},nt=h.lazy(()=>_(()=>import("./StoriesPage-Bl2OFTVW.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-xKb8AAzg.js"),__vite__mapDeps([56,1,2,57,58,59,12,60,7,45,27,50,61,62,63,64,32,8,17,65,4,66,67,37,41,68,18,22,23]))),rt=h.lazy(()=>_(()=>import("./AboutPage-IIa2tQhY.js"),__vite__mapDeps([69,1,2,18,7,49,50,70,9,22,23]))),st=h.lazy(()=>_(()=>import("./ContactPage-CF2T9cVb.js"),__vite__mapDeps([71,1,2,14,26,72,16,73,18,7,38,74,22,23]))),ot=h.lazy(()=>_(()=>import("./ImproveReadingPage-Bs8XtpV5.js"),__vite__mapDeps([75,1,2,4,18,7,32,76,77,78,79,22,23]))),it=h.lazy(()=>_(()=>import("./WatchPage-B2GZ_nfn.js"),__vite__mapDeps([80,1,2,18,7,81,63,22,23]))),at=h.lazy(()=>_(()=>import("./WatchVideoPage-3Qx8t1c_.js"),__vite__mapDeps([82,1,2,18,7,81,63,62,64,22,23]))),lt=h.lazy(()=>_(()=>import("./AuthPages-ClsAgOTy.js"),__vite__mapDeps([83,1,2,14,84,73,7,38,85,76,22,23])).then(t=>({default:t.LoginPage}))),ct=h.lazy(()=>_(()=>import("./AuthPages-ClsAgOTy.js"),__vite__mapDeps([83,1,2,14,84,73,7,38,85,76,22,23])).then(t=>({default:t.SignupPage}))),ut=h.lazy(()=>_(()=>import("./ResetPasswordPage-BcaaU7fA.js"),__vite__mapDeps([86,1,2,14,7,38,57,74,85,76,22,23]))),dt=h.lazy(()=>_(()=>import("./VerifyEmailPage-DCeIMZg8.js"),__vite__mapDeps([87,1,2,4,7,38,10,74,57,22,23]))),_M=h.lazy(()=>_(()=>import("./NotFound-CvervQqV.js"),__vite__mapDeps([88,1,2,7,57,22,23]))),ht=h.lazy(()=>_(()=>import("./ProgressPage-DXTYNW2S.js"),__vite__mapDeps([89,1,2,4,65,19,18,7,90,29,30,91,66,6,79,10,92,20,22,23]))),pt=h.lazy(()=>_(()=>import("./ReadingCartPage-FszXtRwj.js"),__vite__mapDeps([93,1,2,3,4,5,6,7,8,9,10,11,18,61,22,23]))),ft=h.lazy(()=>_(()=>import("./VocabularyNotebookPage-l-UoG4yM.js"),__vite__mapDeps([94,1,2,14,95,60,15,16,18,7,61,20,64,96,22,23]))),yM=h.lazy(()=>_(()=>import("./AdminPage-B3C3vkF2.js"),__vite__mapDeps([97,1,2,12,14,4,98,26,15,16,35,95,59,60,7,20,76,72,96,58,99,91,67,33,31,90,27,84,37,11,36,100,10,101,13,102,92,103,17,104,74,22,21,6,85,105,28,66,29,38,77,50,23]))),xM=h.lazy(()=>_(()=>import("./FontManagementPage-C2dhMGHX.js"),__vite__mapDeps([106,1,2,4,14,104,67,96,22,23,7]))),mt=h.lazy(()=>_(()=>import("./TermsPage-8nrethF0.js"),__vite__mapDeps([107,1,2,98,18,7,22,23]))),gt=h.lazy(()=>_(()=>import("./PrivacyPage-CQ6Tn2c7.js"),__vite__mapDeps([108,1,2,98,18,7,22,23]))),vt=h.lazy(()=>_(()=>import("./RefundPage-C0JKVm67.js"),__vite__mapDeps([109,1,2,98,18,7,22,23]))),_t=h.lazy(()=>_(()=>import("./SubscriptionPage-bndbxa7b.js"),__vite__mapDeps([110,1,2,66,25,7,91,99,5,78,18,70,4,68,92,22,23]))),ue=h.lazy(()=>_(()=>import("./PaymentStatusPage-DEL3Zgy6.js"),__vite__mapDeps([111,1,2,4,7,74,100,22,23]))),yt=h.lazy(()=>_(()=>import("./ThemeInfoPage-BtlvTJ5n.js"),__vite__mapDeps([112,1,2,4,98,18,7,32,9,22,23]))),xt=h.lazy(()=>_(()=>import("./BlogPage-ChcoLkOR.js"),__vite__mapDeps([113,1,2,14,114,4,10,101,7,18,20,22,23]))),ge=h.lazy(()=>_(()=>import("./BlogPostPage-BNdcwXiL.js"),__vite__mapDeps([115,1,2,102,4,19,105,21,32,7,101,18,57,92,10,22,23]))),bt=h.lazy(()=>_(()=>import("./NewsletterPage-BPr1yFI1.js"),__vite__mapDeps([116,1,2,14,114,4,10,101,18,7,20,22,23]))),wt=h.lazy(()=>_(()=>import("./StoryMakerPage-DXtjuGzk.js"),__vite__mapDeps([117,1,2,25,18,7,4,95,14,103,58,66,21,37,13,36,33,105,22,23]))),Et=h.lazy(()=>_(()=>import("./ResearchPage-CXdmJRbk.js"),__vite__mapDeps([34,1,2,18,7,4,35,32,11,36,37,28,38,22,23]))),jt=h.lazy(()=>_(()=>import("./TextCheckerPage-DTst4tjt.js"),__vite__mapDeps([24,1,2,25,26,4,7,27,20,28,29,30,6,19,31,18,32,23,33,22]))),bM=new Rb({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5*60*1e3}}}),wM=()=>(gM(),null),EM=()=>{const{targetElement:t,onTargetReached:e}=t_();return o.jsx(b2,{targetElement:t,onTargetReached:e})},jM=()=>o.jsx(Sx,{}),TM=({children:t})=>{const e=ps();return o.jsx(jm,{children:t},e.pathname)};function PM(){return o.jsx(Nb,{children:o.jsx(Ab,{client:bM,children:o.jsx(TT,{children:o.jsx(Ib,{children:o.jsx(T2,{children:o.jsx(nk,{children:o.jsx(rk,{children:o.jsx(ck,{children:o.jsxs(uk,{children:[o.jsx(C2,{}),o.jsx(gN,{}),o.jsx(vN,{}),o.jsx(wM,{}),o.jsx(EM,{}),o.jsx(CN,{}),o.jsx(dM,{}),o.jsx(uM,{}),o.jsxs("div",{className:"min-h-screen flex flex-col",children:[o.jsx(xL,{}),o.jsx(IN,{}),o.jsx("main",{className:"flex-1",children:o.jsx(TM,{children:o.jsx(h.Suspense,{fallback:o.jsx(jM,{}),children:o.jsxs(Ob,{children:[o.jsx(v,{path:"/",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/admin",element:o.jsx(yM,{})}),o.jsx(v,{path:"/admin/fonts",element:o.jsx(xM,{})}),o.jsx(v,{path:"/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/payment/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/payment/cancel",element:o.jsx(ue,{})}),o.jsx(v,{path:"/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/es",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/es/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/es/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/es/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/es/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/es/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/es/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/es/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/es/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/es/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/es/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/es/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/es/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/es/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/es/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/es/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/es/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/es/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/es/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/es/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/es/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/es/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/es/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/bn",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/bn/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/bn/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/bn/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/bn/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/bn/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/bn/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/bn/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/bn/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/bn/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/bn/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/bn/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/bn/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/bn/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/bn/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/bn/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/bn/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/bn/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/bn/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/bn/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/bn/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/bn/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/bn/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/zh",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/zh/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/zh/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/zh/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/zh/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/zh/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/zh/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/zh/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/zh/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/zh/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/zh/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/zh/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/zh/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/zh/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/zh/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/zh/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/zh/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/zh/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/zh/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/zh/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/zh/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/zh/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/zh/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ja",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/ja/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/ja/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ja/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/ja/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ja/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/ja/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ja/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/ja/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ja/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/ja/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/ja/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ja/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/ja/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ja/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ja/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ja/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ja/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ja/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ja/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ja/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/ja/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ja/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ko",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/ko/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/ko/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ko/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/ko/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ko/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/ko/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ko/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/ko/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ko/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/ko/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/ko/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ko/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/ko/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ko/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ko/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ko/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ko/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ko/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ko/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ko/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/ko/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ko/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/th",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/th/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/th/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/th/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/th/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/th/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/th/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/th/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/th/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/th/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/th/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/th/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/th/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/th/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/th/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/th/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/th/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/th/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/th/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/th/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/th/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/th/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/th/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/vi",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/vi/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/vi/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/vi/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/vi/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/vi/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/vi/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/vi/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/vi/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/vi/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/vi/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/vi/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/vi/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/vi/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/vi/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/vi/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/vi/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/vi/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/vi/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/vi/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/vi/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/vi/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/vi/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/hi",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/hi/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/hi/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/hi/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/hi/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/hi/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/hi/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/hi/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/hi/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/hi/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/hi/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/hi/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/hi/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/hi/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/hi/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/hi/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/hi/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/hi/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/hi/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/hi/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/hi/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/hi/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/hi/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/pt",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/pt/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/pt/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/pt/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/pt/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/pt/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/pt/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/pt/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/pt/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/pt/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/pt/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/pt/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/pt/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/pt/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/pt/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/pt/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/pt/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/pt/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/pt/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/pt/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/pt/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/pt/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/pt/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/fil",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/fil/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/fil/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/fil/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/fil/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/fil/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/fil/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/fil/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/fil/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/fil/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/fil/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/fil/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/fil/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/fil/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/fil/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/fil/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/fil/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/fil/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/fil/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/fil/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/fil/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/fil/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/fil/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ms",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/ms/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/ms/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/ms/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/ms/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/ms/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/ms/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/ms/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/ms/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/ms/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/ms/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/ms/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/ms/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/ms/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/ms/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/ms/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/ms/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/ms/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/ms/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/ms/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/ms/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/ms/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/ms/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/id",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/id/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/id/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/id/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/id/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/id/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/id/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/id/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/id/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/id/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/id/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/id/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/id/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/id/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/id/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/id/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/id/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/id/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/id/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/id/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/id/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/id/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/id/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/my",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/my/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/my/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/my/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/my/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/my/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/my/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/my/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/my/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/my/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/my/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/my/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/my/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/my/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/my/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/my/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/my/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/my/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/my/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/my/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/my/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/my/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/my/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/es/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/bn/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/zh/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ja/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ko/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/th/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/vi/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/hi/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/pt/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/fil/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/ms/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/id/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/my/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/km",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/km/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/km/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/km/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/km/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/km/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/km/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/km/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/km/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/km/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/km/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/km/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/km/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/km/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/km/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/km/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/km/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/km/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/km/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/km/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/km/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/km/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/km/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/km/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"/lo",element:o.jsx(Ye,{})}),o.jsx(v,{path:"/lo/stories",element:o.jsx(nt,{})}),o.jsx(v,{path:"/lo/story-maker",element:o.jsx(wt,{})}),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(Xe,{}),o.jsx(ot,{})]})}),o.jsx(v,{path:"/lo/themes",element:o.jsx(yt,{})}),o.jsx(v,{path:"/lo/watch",element:o.jsxs(o.Fragment,{children:[o.jsx(tt,{}),o.jsx(it,{})]})}),o.jsx(v,{path:"/lo/watch/:slug",element:o.jsx(at,{})}),o.jsx(v,{path:"/lo/about",element:o.jsx(rt,{})}),o.jsx(v,{path:"/lo/contact",element:o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsx(st,{})]})}),o.jsx(v,{path:"/lo/blog",element:o.jsx(xt,{})}),o.jsx(v,{path:"/lo/blog/newsletter",element:o.jsx(bt,{})}),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(Et,{})}),o.jsx(v,{path:"/lo/login",element:o.jsxs(o.Fragment,{children:[o.jsx(Qe,{}),o.jsx(lt,{})]})}),o.jsx(v,{path:"/lo/signup",element:o.jsxs(o.Fragment,{children:[o.jsx(et,{}),o.jsx(ct,{})]})}),o.jsx(v,{path:"/lo/reset-password",element:o.jsx(ut,{})}),o.jsx(v,{path:"/lo/verify-email",element:o.jsx(dt,{})}),o.jsx(v,{path:"/lo/progress",element:o.jsx(ht,{})}),o.jsx(v,{path:"/lo/reading-cart",element:o.jsx(pt,{})}),o.jsx(v,{path:"/lo/vocabulary",element:o.jsx(ft,{})}),o.jsx(v,{path:"/lo/terms",element:o.jsx(mt,{})}),o.jsx(v,{path:"/lo/privacy",element:o.jsx(gt,{})}),o.jsx(v,{path:"/lo/refund",element:o.jsx(vt,{})}),o.jsx(v,{path:"/lo/subscription",element:o.jsxs(o.Fragment,{children:[o.jsx(Je,{}),o.jsx(_t,{})]})}),o.jsx(v,{path:"/lo/stripe/success",element:o.jsx(ue,{})}),o.jsx(v,{path:"/lo/stripe/failure",element:o.jsx(ue,{})}),o.jsx(v,{path:"/lo/text-checker",element:o.jsx(jt,{})}),o.jsx(v,{path:"*",element:o.jsx(_M,{})})]})})})}),o.jsx(wL,{})]}),o.jsx(xE,{}),o.jsx(YE,{})]})})})})})})})})})}const ym="ss_build_id",SM=60*1e3,kM=2e3,RM="ss-build";let ds=null,Ml=null,ho=null;const Io=()=>{try{const t=window.location.pathname;return t.includes("/story/")||t.includes("/story-maker")}catch{return!1}},yb=()=>{try{return"1787341506625-aatc73"}catch{return"dev"}};async function AM(){try{const t=yb();if(localStorage.getItem(ym)===t)return;if("caches"in window){const n=await caches.keys();await Promise.all(n.map(r=>caches.delete(r)))}if("serviceWorker"in navigator){const n=await navigator.serviceWorker.getRegistrations();await Promise.all(n.map(r=>r.update().catch(()=>{})))}localStorage.setItem(ym,t)}catch{}}function xb(t,e=!1){if(!(t===yb()||t===ds)){if(ds=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 Ys(){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;xb(n)}catch{}}function CM(){if(typeof window>"u")return;const t=window;if(t.__ssNavReloadInstalled)return;t.__ssNavReloadInstalled=!0;const e=l=>{if(!ds||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),r=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 r(l,c,u??null)},window.addEventListener("popstate",()=>{ds&&!Io()&&window.location.reload()});const s=()=>{Ys()},i=history.pushState,a=history.replaceState;history.pushState=function(...l){const c=i.apply(this,l);return s(),c},history.replaceState=function(...l){const c=a.apply(this,l);return s(),c}}function IM(){if(!(typeof window>"u")){CM();try{ho=new BroadcastChannel(RM),ho.onmessage=t=>{const e=t?.data?.buildId;typeof e=="string"&&xb(e,!0)}}catch{ho=null}setTimeout(()=>void Ys(),kM),Ml&&clearInterval(Ml),Ml=setInterval(()=>void Ys(),SM),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(ds&&!Io()){window.location.reload();return}Ys()}}),window.addEventListener("focus",()=>{if(ds&&!Io()){window.location.reload();return}Ys()})}}const gr="storyMakerDraft",Xs="storyMakerDraft",$d=2,OM=24*60*60*1e3,$a=()=>typeof window<"u",DM=()=>{if($a())try{const t=sessionStorage.getItem(Xs);if(!t)return;if(localStorage.getItem(gr)){sessionStorage.removeItem(Xs);return}let e;try{e=JSON.parse(t)}catch{sessionStorage.removeItem(Xs);return}const n={v:$d,savedAt:Date.now(),data:e};localStorage.setItem(gr,JSON.stringify(n)),sessionStorage.removeItem(Xs)}catch(t){console.warn("[storyMakerDraft] legacy migration failed:",t)}},bV=t=>{if($a())try{const e={v:$d,savedAt:Date.now(),data:t};localStorage.setItem(gr,JSON.stringify(e))}catch(e){console.warn("[storyMakerDraft] save failed:",e)}},wV=()=>{if(!$a())return null;try{const t=localStorage.getItem(gr);if(!t)return null;const e=JSON.parse(t);return!e||e.v!==$d||typeof e.savedAt!="number"||Date.now()-e.savedAt>OM?(localStorage.removeItem(gr),null):e.data||null}catch(t){return console.warn("[storyMakerDraft] load failed:",t),null}},EV=()=>{if($a())try{localStorage.removeItem(gr),sessionStorage.removeItem(Xs)}catch{}},Bd=document.getElementById("root");if(!Bd)throw new Error("Root element not found");Bd.innerHTML="";DM();AM().finally(()=>{IM()});const LM=Em(Bd),NM=wc(window.location.pathname),MM=()=>LM.render(o.jsx(M.StrictMode,{children:o.jsx(jm,{children:o.jsx(PM,{})})})),VM=new Promise(t=>setTimeout(t,1500));Promise.race([wm.loadNamespaces(NM),VM]).finally(MM);const xm=()=>{[D0,L0].forEach(t=>{const e=new Image;e.decoding="async",e.src=t})};typeof window.requestIdleCallback=="function"?window.requestIdleCallback(xm,{timeout:3e3}):setTimeout(xm,1500);export{mV as $,mk as A,xn as B,Kw as C,Wy as D,vm as E,es as F,tN as G,hl as H,rh as I,dn as J,Yw as K,Qm as L,lV as M,T1 as N,cV as O,jx as P,CL as Q,Vd as R,kr as S,vL as T,xV as U,vV as V,_b as W,da as X,yV as Y,gV as Z,vM as _,Tm as a,bu as a$,_V as a0,dl as a1,nh as a2,N1 as a3,cu as a4,TT as a5,PT as a6,ST as a7,Vg as a8,Uw as a9,pV as aA,Er as aB,_e as aC,H as aD,tn as aE,LN as aF,Qj as aG,F0 as aH,xd as aI,vr as aJ,Q2 as aK,eO as aL,Zw as aM,aV as aN,qe as aO,He as aP,fm as aQ,eg as aR,uV as aS,hV as aT,k2 as aU,S2 as aV,P2 as aW,R2 as aX,Qf as aY,S1 as aZ,ys as a_,Jm as aa,gL as ab,oV as ac,js as ad,Oa as ae,Da as af,ux as ag,hx as ah,La as ai,Na as aj,cx as ak,dx as al,te as am,ua as an,mm as ao,tu as ap,gm as aq,nu as ar,ru as as,qL as at,GL as au,c1 as av,Jn as aw,Ub as ax,wn as ay,oh as az,ae as b,wd as b0,Aa as b1,bd as b2,Sa as b3,fs as b4,wu as b5,Eu as b6,ms as b7,xu as b8,mn as b9,Xu as bA,Ae as bB,Bu as bC,ze as bD,s0 as bE,Ek as bF,RA as bG,ls as bH,Gu as bI,gn as bJ,DI as bK,Ne as bL,MC as bM,MI as bN,NI as bO,II as bP,NC as bQ,i0 as bR,Ji as bS,yk as bT,OL as bU,I0 as bV,aa as ba,XM as bb,dV as bc,AT as bd,KM as be,qM as bf,YM as bg,yL as bh,Tx as bi,Mu as bj,wV as bk,bV as bl,EV as bm,tV as bn,nV as bo,Pm as bp,iV as bq,a1 as br,x2 as bs,p2 as bt,Zf as bu,mN as bv,Yt as bw,DL as bx,YL as by,SA as bz,he as c,N0 as d,$t as e,I2 as f,pm as g,Co as h,uu as i,sV as j,Zm as k,Gy as l,Le as m,Xv as n,Cd as o,qn as p,ON as q,Rx as r,W as s,Ax as t,xs as u,Ix as v,Ox as w,Cx as x,Sr as y,lk as z};
//# sourceMappingURL=index-BOAODM_z.js.map