1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42092,e=>{"use strict";var t=e.i(48897),r=(e,t,r,i,s,n,o,a)=>{let l=document.documentElement,u=["light","dark"];function c(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,i=r&&n?s.map(e=>n[e]||e):s;r?(l.classList.remove(...i),l.classList.add(n&&n[t]?n[t]:t)):l.setAttribute(e,t)}),r=t,a&&u.includes(r)&&(l.style.colorScheme=r)}if(i)c(i);else try{let e=localStorage.getItem(t)||r,i=o&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(i)}catch(e){}},i=["light","dark"],s="(prefers-color-scheme: dark)",n="undefined"==typeof window,o=t.createContext(void 0),a={setTheme:e=>{},themes:[]},l=()=>{var e;return null!=(e=t.useContext(o))?e:a},u=e=>t.useContext(o)?t.createElement(t.Fragment,null,e.children):t.createElement(d,{...e}),c=["light","dark"],d=({forcedTheme:e,disableTransitionOnChange:r=!1,enableSystem:n=!0,enableColorScheme:a=!0,storageKey:l="theme",themes:u=c,defaultTheme:d=n?"system":"light",attribute:f="data-theme",value:_,children:m,nonce:y,scriptProps:b})=>{let[x,w]=t.useState(()=>p(l,d)),[E,k]=t.useState(()=>"system"===x?g():x),S=_?Object.values(_):u,P=t.useCallback(e=>{let t=e;if(!t)return;"system"===e&&n&&(t=g());let s=_?_[t]:t,o=r?v(y):null,l=document.documentElement,u=e=>{"class"===e?(l.classList.remove(...S),s&&l.classList.add(s)):e.startsWith("data-")&&(s?l.setAttribute(e,s):l.removeAttribute(e))};if(Array.isArray(f)?f.forEach(u):u(f),a){let e=i.includes(d)?d:null,r=i.includes(t)?t:e;l.style.colorScheme=r}null==o||o()},[y]),R=t.useCallback(e=>{let t="function"==typeof e?e(x):e;w(t);try{localStorage.setItem(l,t)}catch(e){}},[x]),C=t.useCallback(t=>{k(g(t)),"system"===x&&n&&!e&&P("system")},[x,e]);t.useEffect(()=>{let e=window.matchMedia(s);return e.addListener(C),C(e),()=>e.removeListener(C)},[C]),t.useEffect(()=>{let e=e=>{e.key===l&&(e.newValue?w(e.newValue):R(d))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[R]),t.useEffect(()=>{P(null!=e?e:x)},[e,x]);let F=t.useMemo(()=>({theme:x,setTheme:R,forcedTheme:e,resolvedTheme:"system"===x?E:x,themes:n?[...u,"system"]:u,systemTheme:n?E:void 0}),[x,R,e,E,n,u]);return t.createElement(o.Provider,{value:F},t.createElement(h,{forcedTheme:e,storageKey:l,attribute:f,enableSystem:n,enableColorScheme:a,defaultTheme:d,value:_,themes:u,nonce:y,scriptProps:b}),m)},h=t.memo(({forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:o,defaultTheme:a,value:l,themes:u,nonce:c,scriptProps:d})=>{let h=JSON.stringify([s,i,a,e,u,l,n,o]).slice(1,-1);return t.createElement("script",{...d,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${r.toString()})(${h}
1)`}})}),p=(e,t)=>{let r;if(!n){try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t}},v=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||(e=window.matchMedia(s)),e.matches?"dark":"light");e.s(["ThemeProvider",()=>u,"useTheme",()=>l])},28677,e=>{"use strict";var t=e.i(43171),r=e.i(91716),i=e.i(77240),s=e.i(67881),n=e.i(98631);let o=(0,n.default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),a=(0,n.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var l=e.i(48897),u=e.i(47163),c=e.i(20755),d=e.i(42092);function h(){let[e,n]=(0,l.useState)(null),{theme:h,setTheme:p}=(0,d.useTheme)(),v=(0,r.usePathname)();(0,l.useEffect)(()=>{let e=(0,c.createClient)();e.auth.getUser().then(({data:{user:e}})=>{n(e)});let{data:{subscription:t}}=e.auth.onAuthStateChange((e,t)=>{n(t?.user??null)});return()=>t.unsubscribe()},[]);let g=e=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth",block:"center"})};return(0,t.jsx)("nav",{className:"fixed top-0 left-0 right-0 z-50 py-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto",children:(0,t.jsxs)("div",{className:(0,u.cn)("flex items-center justify-between px-6 py-4 bg-background/80 backdrop-blur-lg border border-border rounded-full shadow-lg"),children:[(0,t.jsxs)(i.default,{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"RankSite Logo",className:"w-8 h-8"}),(0,t.jsx)("span",{className:"text-xl font-bold text-foreground",children:"RankSite"})]}),"/"===v&&(0,t.jsxs)("div",{className:"hidden md:flex items-center gap-6",children:[(0,t.jsx)("button",{onClick:()=>g("benefits"),className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"Features"}),(0,t.jsx)("button",{onClick:()=>g("pricing"),className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"Pricing"}),(0,t.jsx)("button",{onClick:()=>g("faq"),className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"FAQ"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(s.Button,{variant:"ghost",size:"sm",className:"w-9 px-0 cursor-pointer",onClick:()=>p("dark"===h?"light":"dark"),children:[(0,t.jsx)(a,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,t.jsx)(o,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,t.jsx)("span",{className:"sr-only",children:"Toggle theme"})]}),e?(0,t.jsx)(i.default,{href:"/dashboard",children:(0,t.jsx)(s.Button,{size:"sm",variant:"outline",className:"cursor-pointer",children:"Dashboard"})}):(0,t.jsx)(i.default,{href:"/sign-in",children:(0,t.jsx)(s.Button,{size:"sm",className:"bg-gray-900 hover:bg-gray-800 text-white dark:bg-white dark:hover:bg-gray-100 dark:text-gray-900 cursor-pointer",children:"Sign In"})})]})]})})})}var p=e.i(94179),v=e.i(91967),g=e.i(26099),f=e.i(80600),_=e.i(54856),m=e.i(83812),y=e.i(82430),b=e.i(62799),x=e.i(3070),w=e.i(99593),E=e.i(78223),k=e.i(50021),S=e.i(39043),P=e.i(7530),R=e.i(38716),C=e.i(66738),F=e.i(65323),T=e.i(10499),I=e.i(73772),M=e.i(29494),O=["Enter"," "],$=["ArrowUp","PageDown","End"],j=["ArrowDown","PageUp","Home",...$],A={ltr:[...O,"ArrowRight"],rtl:[...O,"ArrowLeft"]},L={ltr:["ArrowLeft"],rtl:["ArrowRight"]},N="Menu",[D,H,U]=(0,y.createCollection)(N),[z,q]=(0,f.createContextScope)(N,[U,S.createPopperScope,C.createRovingFocusGroupScope]),W=(0,S.createPopperScope)(),B=(0,C.createRovingFocusGroupScope)(),[K,V]=z(N),[G,Y]=z(N),X=e=>{let{__scopeMenu:r,open:i=!1,children:s,dir:n,onOpenChange:o,modal:a=!0}=e,u=W(r),[c,d]=l.useState(null),h=l.useRef(!1),p=(0,T.useCallbackRef)(o),v=(0,b.useDirection)(n);return l.useEffect(()=>{let e=()=>{h.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>h.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,t.jsx)(S.Root,{...u,children:(0,t.jsx)(K,{scope:r,open:i,onOpenChange:p,content:c,onContentChange:d,children:(0,t.jsx)(G,{scope:r,onClose:l.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:h,dir:v,modal:a,children:s})})})};X.displayName=N;var J=l.forwardRef((e,r)=>{let{__scopeMenu:i,...s}=e,n=W(i);return(0,t.jsx)(S.Anchor,{...n,...s,ref:r})});J.displayName="MenuAnchor";var Z="MenuPortal",[Q,ee]=z(Z,{forceMount:void 0}),et=e=>{let{__scopeMenu:r,forceMount:i,children:s,container:n}=e,o=V(Z,r);return(0,t.jsx)(Q,{scope:r,forceMount:i,children:(0,t.jsx)(R.Presence,{present:i||o.open,children:(0,t.jsx)(P.Portal,{asChild:!0,container:n,children:s})})})};et.displayName=Z;var er="MenuContent",[ei,es]=z(er),en=l.forwardRef((e,r)=>{let i=ee(er,e.__scopeMenu),{forceMount:s=i.forceMount,...n}=e,o=V(er,e.__scopeMenu),a=Y(er,e.__scopeMenu);return(0,t.jsx)(D.Provider,{scope:e.__scopeMenu,children:(0,t.jsx)(R.Presence,{present:s||o.open,children:(0,t.jsx)(D.Slot,{scope:e.__scopeMenu,children:a.modal?(0,t.jsx)(eo,{...n,ref:r}):(0,t.jsx)(ea,{...n,ref:r})})})})}),eo=l.forwardRef((e,r)=>{let i=V(er,e.__scopeMenu),s=l.useRef(null),n=(0,g.useComposedRefs)(r,s);return l.useEffect(()=>{let e=s.current;if(e)return(0,I.hideOthers)(e)},[]),(0,t.jsx)(eu,{...e,ref:n,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:(0,v.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),ea=l.forwardRef((e,r)=>{let i=V(er,e.__scopeMenu);return(0,t.jsx)(eu,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),el=(0,F.createSlot)("MenuContent.ScrollLock"),eu=l.forwardRef((e,r)=>{let{__scopeMenu:i,loop:s=!1,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:f,onDismiss:_,disableOutsideScroll:m,...y}=e,b=V(er,i),k=Y(er,i),P=W(i),R=B(i),F=H(i),[T,I]=l.useState(null),O=l.useRef(null),A=(0,g.useComposedRefs)(r,O,b.onContentChange),L=l.useRef(0),N=l.useRef(""),D=l.useRef(0),U=l.useRef(null),z=l.useRef("right"),q=l.useRef(0),K=m?M.RemoveScroll:l.Fragment;l.useEffect(()=>()=>window.clearTimeout(L.current),[]),(0,w.useFocusGuards)();let G=l.useCallback(e=>{var t,r;return z.current===U.current?.side&&(t=e,!!(r=U.current?.area)&&function(e,t){let{x:r,y:i}=e,s=!1;for(let e=0,n=t.length-1;e<t.length;n=e++){let o=t[e],a=t[n],l=o.x,u=o.y,c=a.x,d=a.y;u>i!=d>i&&r<(c-l)*(i-u)/(d-u)+l&&(s=!s)}return s}({x:t.clientX,y:t.clientY},r))},[]);return(0,t.jsx)(ei,{scope:i,searchRef:N,onItemEnter:l.useCallback(e=>{G(e)&&e.preventDefault()},[G]),onItemLeave:l.useCallback(e=>{G(e)||(O.current?.focus(),I(null))},[G]),onTriggerLeave:l.useCallback(e=>{G(e)&&e.preventDefault()},[G]),pointerGraceTimerRef:D,onPointerGraceIntentChange:l.useCallback(e=>{U.current=e},[]),children:(0,t.jsx)(K,{...m?{as:el,allowPinchZoom:!0}:void 0,children:(0,t.jsx)(E.FocusScope,{asChild:!0,trapped:n,onMountAutoFocus:(0,v.composeEventHandlers)(o,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,t.jsx)(x.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:f,onDismiss:_,children:(0,t.jsx)(C.Root,{asChild:!0,...R,dir:k.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:I,onEntryFocus:(0,v.composeEventHandlers)(c,e=>{k.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,t.jsx)(S.Content,{role:"menu","aria-orientation":"vertical","data-state":ej(b.open),"data-radix-menu-content":"",dir:k.dir,...P,...y,ref:A,style:{outline:"none",...y.style},onKeyDown:(0,v.composeEventHandlers)(y.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,i=1===e.ke
1y.length;if(t){var s;let t,n,o,a,l,u;"Tab"===e.key&&e.preventDefault(),!r&&i&&(s=e.key,t=N.current+s,n=F().filter(e=>!e.disabled),o=document.activeElement,a=n.find(e=>e.ref.current===o)?.textValue,l=function(e,t,r){var i;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,n=r?e.indexOf(r):-1,o=(i=Math.max(n,0),e.map((t,r)=>e[(i+r)%e.length]));1===s.length&&(o=o.filter(e=>e!==r));let a=o.find(e=>e.toLowerCase().startsWith(s.toLowerCase()));return a!==r?a:void 0}(n.map(e=>e.textValue),t,a),u=n.find(e=>e.textValue===l)?.ref.current,function e(t){N.current=t,window.clearTimeout(L.current),""!==t&&(L.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let n=O.current;if(e.target!==n||!j.includes(e.key))return;e.preventDefault();let o=F().filter(e=>!e.disabled).map(e=>e.ref.current);$.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,v.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(L.current),N.current="")}),onPointerMove:(0,v.composeEventHandlers)(e.onPointerMove,eN(e=>{let t=e.target,r=q.current!==e.clientX;e.currentTarget.contains(t)&&r&&(z.current=e.clientX>q.current?"right":"left",q.current=e.clientX)}))})})})})})})});en.displayName=er;var ec=l.forwardRef((e,r)=>{let{__scopeMenu:i,...s}=e;return(0,t.jsx)(m.Primitive.div,{role:"group",...s,ref:r})});ec.displayName="MenuGroup";var ed=l.forwardRef((e,r)=>{let{__scopeMenu:i,...s}=e;return(0,t.jsx)(m.Primitive.div,{...s,ref:r})});ed.displayName="MenuLabel";var eh="MenuItem",ep="menu.itemSelect",ev=l.forwardRef((e,r)=>{let{disabled:i=!1,onSelect:s,...n}=e,o=l.useRef(null),a=Y(eh,e.__scopeMenu),u=es(eh,e.__scopeMenu),c=(0,g.useComposedRefs)(r,o),d=l.useRef(!1);return(0,t.jsx)(eg,{...n,ref:c,disabled:i,onClick:(0,v.composeEventHandlers)(e.onClick,()=>{let e=o.current;if(!i&&e){let t=new CustomEvent(ep,{bubbles:!0,cancelable:!0});e.addEventListener(ep,e=>s?.(e),{once:!0}),(0,m.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?d.current=!1:a.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:(0,v.composeEventHandlers)(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:(0,v.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==u.searchRef.current;i||t&&" "===e.key||O.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ev.displayName=eh;var eg=l.forwardRef((e,r)=>{let{__scopeMenu:i,disabled:s=!1,textValue:n,...o}=e,a=es(eh,i),u=B(i),c=l.useRef(null),d=(0,g.useComposedRefs)(r,c),[h,p]=l.useState(!1),[f,_]=l.useState("");return l.useEffect(()=>{let e=c.current;e&&_((e.textContent??"").trim())},[o.children]),(0,t.jsx)(D.ItemSlot,{scope:i,disabled:s,textValue:n??f,children:(0,t.jsx)(C.Item,{asChild:!0,...u,focusable:!s,children:(0,t.jsx)(m.Primitive.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:d,onPointerMove:(0,v.composeEventHandlers)(e.onPointerMove,eN(e=>{s?a.onItemLeave(e):(a.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,v.composeEventHandlers)(e.onPointerLeave,eN(e=>a.onItemLeave(e))),onFocus:(0,v.composeEventHandlers)(e.onFocus,()=>p(!0)),onBlur:(0,v.composeEventHandlers)(e.onBlur,()=>p(!1))})})})}),ef=l.forwardRef((e,r)=>{let{checked:i=!1,onCheckedChange:s,...n}=e;return(0,t.jsx)(ek,{scope:e.__scopeMenu,checked:i,children:(0,t.jsx)(ev,{role:"menuitemcheckbox","aria-checked":eA(i)?"mixed":i,...n,ref:r,"data-state":eL(i),onSelect:(0,v.composeEventHandlers)(n.onSelect,()=>s?.(!!eA(i)||!i),{checkForDefaultPrevented:!1})})})});ef.displayName="MenuCheckboxItem";var e_="MenuRadioGroup",[em,ey]=z(e_,{value:void 0,onValueChange:()=>{}}),eb=l.forwardRef((e,r)=>{let{value:i,onValueChange:s,...n}=e,o=(0,T.useCallbackRef)(s);return(0,t.jsx)(em,{scope:e.__scopeMenu,value:i,onValueChange:o,children:(0,t.jsx)(ec,{...n,ref:r})})});eb.displayName=e_;var ex="MenuRadioItem",ew=l.forwardRef((e,r)=>{let{value:i,...s}=e,n=ey(ex,e.__scopeMenu),o=i===n.value;return(0,t.jsx)(ek,{scope:e.__scopeMenu,checked:o,children:(0,t.jsx)(ev,{role:"menuitemradio","aria-checked":o,...s,ref:r,"data-state":eL(o),onSelect:(0,v.composeEventHandlers)(s.onSelect,()=>n.onValueChange?.(i),{checkForDefaultPrevented:!1})})})});ew.displayName=ex;
1var eE="MenuItemIndicator",[ek,eS]=z(eE,{checked:!1}),eP=l.forwardRef((e,r)=>{let{__scopeMenu:i,forceMount:s,...n}=e,o=eS(eE,i);return(0,t.jsx)(R.Presence,{present:s||eA(o.checked)||!0===o.checked,children:(0,t.jsx)(m.Primitive.span,{...n,ref:r,"data-state":eL(o.checked)})})});eP.displayName=eE;var eR=l.forwardRef((e,r)=>{let{__scopeMenu:i,...s}=e;return(0,t.jsx)(m.Primitive.div,{role:"separator","aria-orientation":"horizontal",...s,ref:r})});eR.displayName="MenuSeparator";var eC=l.forwardRef((e,r)=>{let{__scopeMenu:i,...s}=e,n=W(i);return(0,t.jsx)(S.Arrow,{...n,...s,ref:r})});eC.displayName="MenuArrow";var[eF,eT]=z("MenuSub"),eI="MenuSubTrigger",eM=l.forwardRef((e,r)=>{let i=V(eI,e.__scopeMenu),s=Y(eI,e.__scopeMenu),n=eT(eI,e.__scopeMenu),o=es(eI,e.__scopeMenu),a=l.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:c}=o,d={__scopeMenu:e.__scopeMenu},h=l.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return l.useEffect(()=>h,[h]),l.useEffect(()=>{let e=u.current;return()=>{window.clearTimeout(e),c(null)}},[u,c]),(0,t.jsx)(J,{asChild:!0,...d,children:(0,t.jsx)(eg,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":n.contentId,"data-state":ej(i.open),...e,ref:(0,g.composeRefs)(r,n.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:(0,v.composeEventHandlers)(e.onPointerMove,eN(t=>{o.onItemEnter(t),!t.defaultPrevented&&(e.disabled||i.open||a.current||(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{i.onOpenChange(!0),h()},100)))})),onPointerLeave:(0,v.composeEventHandlers)(e.onPointerLeave,eN(e=>{h();let t=i.content?.getBoundingClientRect();if(t){let r=i.content?.dataset.side,s="right"===r,n=t[s?"left":"right"],a=t[s?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+(s?-5:5),y:e.clientY},{x:n,y:t.top},{x:a,y:t.top},{x:a,y:t.bottom},{x:n,y:t.bottom}],side:r}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:(0,v.composeEventHandlers)(e.onKeyDown,t=>{let r=""!==o.searchRef.current;e.disabled||r&&" "===t.key||A[s.dir].includes(t.key)&&(i.onOpenChange(!0),i.content?.focus(),t.preventDefault())})})})});eM.displayName=eI;var eO="MenuSubContent",e$=l.forwardRef((e,r)=>{let i=ee(er,e.__scopeMenu),{forceMount:s=i.forceMount,...n}=e,o=V(er,e.__scopeMenu),a=Y(er,e.__scopeMenu),u=eT(eO,e.__scopeMenu),c=l.useRef(null),d=(0,g.useComposedRefs)(r,c);return(0,t.jsx)(D.Provider,{scope:e.__scopeMenu,children:(0,t.jsx)(R.Presence,{present:s||o.open,children:(0,t.jsx)(D.Slot,{scope:e.__scopeMenu,children:(0,t.jsx)(eu,{id:u.contentId,"aria-labelledby":u.triggerId,...n,ref:d,align:"start",side:"rtl"===a.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{a.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,v.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==u.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:(0,v.composeEventHandlers)(e.onEscapeKeyDown,e=>{a.onClose(),e.preventDefault()}),onKeyDown:(0,v.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=L[a.dir].includes(e.key);t&&r&&(o.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())})})})})})});function ej(e){return e?"open":"closed"}function eA(e){return"indeterminate"===e}function eL(e){return eA(e)?"indeterminate":e?"checked":"unchecked"}function eN(e){return t=>"mouse"===t.pointerType?e(t):void 0}e$.displayName=eO;var eD="DropdownMenu",[eH,eU]=(0,f.createContextScope)(eD,[q]),ez=q(),[eq,eW]=eH(eD),eB=e=>{let{__scopeDropdownMenu:r,children:i,dir:s,open:n,defaultOpen:o,onOpenChange:a,modal:u=!0}=e,c=ez(r),d=l.useRef(null),[h,p]=(0,_.useControllableState)({prop:n,defaultProp:o??!1,onChange:a,caller:eD});return(0,t.jsx)(eq,{scope:r,triggerId:(0,k.useId)(),triggerRef:d,contentId:(0,k.useId)(),open:h,onOpenChange:p,onOpenToggle:l.useCallback(()=>p(e=>!e),[p]),modal:u,children:(0,t.jsx)(X,{...c,open:h,onOpenChange:p,dir:s,modal:u,children:i})})};eB.displayName=eD;var eK="DropdownMenuTrigger",eV=l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,disabled:s=!1,...n}=e,o=eW(eK,i),a=ez(i);return(0,t.jsx)(J,{asChild:!0,...a,children:(0,t.jsx)(m.Primitive.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...n,ref:(0,g.composeRefs)(r,o.triggerRef),onPointerDown:(0,v.composeEventHandlers)(e.onPointerDown,e=>{!s&&0===e.button&&!1===e.ctrlKey&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,v.composeEventHandlers)(e.onKeyDown,e=>
1{!s&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});eV.displayName=eK;var eG=e=>{let{__scopeDropdownMenu:r,...i}=e,s=ez(r);return(0,t.jsx)(et,{...s,...i})};eG.displayName="DropdownMenuPortal";var eY="DropdownMenuContent",eX=l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=eW(eY,i),o=ez(i),a=l.useRef(!1);return(0,t.jsx)(en,{id:n.contentId,"aria-labelledby":n.triggerId,...o,...s,ref:r,onCloseAutoFocus:(0,v.composeEventHandlers)(e.onCloseAutoFocus,e=>{a.current||n.triggerRef.current?.focus(),a.current=!1,e.preventDefault()}),onInteractOutside:(0,v.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,i=2===t.button||r;(!n.modal||i)&&(a.current=!0)}),style:{...e.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)"}})});eX.displayName=eY,l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(ec,{...n,...s,ref:r})}).displayName="DropdownMenuGroup";var eJ=l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(ed,{...n,...s,ref:r})});eJ.displayName="DropdownMenuLabel";var eZ=l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(ev,{...n,...s,ref:r})});eZ.displayName="DropdownMenuItem",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(ef,{...n,...s,ref:r})}).displayName="DropdownMenuCheckboxItem",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(eb,{...n,...s,ref:r})}).displayName="DropdownMenuRadioGroup",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(ew,{...n,...s,ref:r})}).displayName="DropdownMenuRadioItem",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(eP,{...n,...s,ref:r})}).displayName="DropdownMenuItemIndicator";var eQ=l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(eR,{...n,...s,ref:r})});function e0({...e}){return(0,t.jsx)(eB,{"data-slot":"dropdown-menu",...e})}function e1({...e}){return(0,t.jsx)(eV,{"data-slot":"dropdown-menu-trigger",...e})}function e2({className:e,sideOffset:r=4,...i}){return(0,t.jsx)(eG,{children:(0,t.jsx)(eX,{"data-slot":"dropdown-menu-content",sideOffset:r,className:(0,u.cn)("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...i})})}function e3({className:e,inset:r,variant:i="default",...s}){return(0,t.jsx)(eZ,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":i,className:(0,u.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s})}function e4({className:e,inset:r,...i}){return(0,t.jsx)(eJ,{"data-slot":"dropdown-menu-label","data-inset":r,className:(0,u.cn)("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...i})}function e5({className:e,...r}){return(0,t.jsx)(eQ,{"data-slot":"dropdown-menu-separator",className:(0,u.cn)("bg-border -mx-1 my-1 h-px",e),...r})}eQ.displayName="DropdownMenuSeparator",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(eC,{...n,...s,ref:r})}).displayName="DropdownMenuArrow",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);return(0,t.jsx)(eM,{...n,...s,ref:r})}).displayName="DropdownMenuSubTrigger",l.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...s}=e,n=ez(i);
1return(0,t.jsx)(e$,{...n,...s,ref:r,style:{...e.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)"}})}).displayName="DropdownMenuSubContent",e.i(58592),e.i(67239),(0,n.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);let e8=(0,n.default)("log-out",[["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"}]]),e6=(0,n.default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);var e9=e.i(23007);let e7=(0,n.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var te=e.i(63676);function tt(){let[e,n]=(0,l.useState)(null),[h,v]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!0),[_,m]=(0,l.useState)(!1),y=(0,r.useRouter)(),b=(0,r.usePathname)(),{theme:x,setTheme:w}=(0,d.useTheme)();b.startsWith("/dashboard"),(0,l.useEffect)(()=>{let e=(0,c.createClient)();e.auth.getUser().then(({data:{user:e}})=>{n(e),f(!1),e&&E()});let{data:{subscription:t}}=e.auth.onAuthStateChange((e,t)=>{n(t?.user??null),f(!1),t?.user&&E()});return()=>t.unsubscribe()},[]);let E=async()=>{try{let e=await fetch("/api/usage"),t=await e.json();v(t.isPro)}catch(e){console.error("Failed to check pro status:",e)}},k=async()=>{let e=(0,c.createClient)();await e.auth.signOut(),y.push("/")},S=e?.user_metadata?.full_name||e?.email?.split("@")[0]||"User";return(0,t.jsxs)("nav",{className:"fixed top-0 left-0 right-0 z-50 py-4",children:[(0,t.jsx)("div",{className:"max-w-7xl mx-auto",children:(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 bg-background/80 backdrop-blur-lg border border-border rounded-full shadow-lg",children:[(0,t.jsxs)(i.default,{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"RankSite Logo",className:"w-7 h-7 sm:w-8 sm:h-8"}),(0,t.jsx)("span",{className:"text-lg sm:text-xl font-bold text-foreground",children:"RankSite"})]}),(0,t.jsx)("div",{className:"hidden md:flex items-center gap-6",children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.default,{href:"/dashboard",className:(0,u.cn)("text-sm font-medium transition-colors cursor-pointer","/dashboard"===b?"text-foreground":"text-muted-foreground hover:text-foreground"),children:"Dashboard"}),(0,t.jsx)(i.default,{href:"/serp-preview",className:(0,u.cn)("text-sm font-medium transition-colors cursor-pointer","/serp-preview"===b?"text-foreground":"text-muted-foreground hover:text-foreground"),children:"SERP"}),(0,t.jsx)(i.default,{href:"/schema-generator",className:(0,u.cn)("text-sm font-medium transition-colors cursor-pointer","/schema-generator"===b?"text-foreground":"text-muted-foreground hover:text-foreground"),children:"Schema"}),(0,t.jsx)(i.default,{href:"/core-web-vitals",className:(0,u.cn)("text-sm font-medium transition-colors cursor-pointer","/core-web-vitals"===b?"text-foreground":"text-muted-foreground hover:text-foreground"),children:"Core Vitals"})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,t.jsxs)(s.Button,{variant:"ghost",size:"sm",className:"w-9 px-0 cursor-pointer",onClick:()=>w("dark"===x?"light":"dark"),children:[(0,t.jsx)(a,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,t.jsx)(o,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,t.jsx)("span",{className:"sr-only",children:"Toggle theme"})]}),g?(0,t.jsx)("div",{className:"w-24 h-9 bg-muted rounded-full animate-pulse"}):e?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(e0,{modal:!1,children:[(0,t.jsx)(e1,{asChild:!0,children:(0,t.jsxs)(s.Button,{variant:"ghost",size:"sm",className:"gap-2 cursor-pointer",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-[#0CCE6B] flex items-center justify-center text-white text-sm font-medium",children:e.email?.[0].toUpperCase()}),(0,t.jsx)("span",{className:"hidden md:inline text-sm",children:S})]})}),(0,t.jsxs)(e2,{align:"end",className:"w-56",children:[(0,t.jsx)(e4,{children:(0,t.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:S}),h&&(0,t.jsx)(p.Badge,{className:"bg-[#0CCE6B] text-white text-xs",children:"Pro"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.email})]})}),(0,t.jsx)(e5,{className:"md:hidden"}),(0,t.jsx)(e3,{asChild:!0,className:"md:hidden",children:(0,t.jsxs)(i.default,{href:"/dashboard",className:"cursor-pointer",children:[(0,t.jsx)(e6,{className:"mr-2 h-4 w-4"}),"Dashboard"]})}),(0,t.jsx)(e3,{asChild:!0,className:"md:hidden",children:(0,t.jsxs)(i.default,{href:"/serp-preview",className:"cursor-pointer",children:[(0,t.jsx)("span",{className:"mr-2 h-4 w-4",children:"ð"}),"SERP Preview"]})}),(0,t.jsx)(e3,{asChild:!0,className:"md:hidden",children:(0,t.jsxs)(i.default,{href:"/schema-generator",className:"cursor-pointer",children:[(0,t.jsx)("span",{className:"mr-2 h-4 w-4",children:"ð"}),"Schema Generator"]})}),(0,t.jsx)(e3,{asChild:!0,className:"md:hidden",children:(0,t.jsxs)(i.default,{href:"/core-web-vitals",className:"cursor-pointer",children:[(0,t.jsx)("span",{className:"mr-2 h-4 w-4",children:"â¡"}),"Core Web Vitals"]})}),(0,t.jsx)(e5,{}),!h&&(0,t.jsxs)(e3,{onClick:()=>m(!0),className:"cursor-pointer text-[#0CCE6B]",children:[(0,t.jsx)(e9.Crown,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]}),(0,t.jsx)(e3,{asChild:!0,children:(0,t.jsxs)(i.default,{href:"/settings",className:"cursor-pointer",children:[(0,t.jsx)(e7,{className:"mr-2 h-4 w-4"}),"Settings"]})}),(0,t.jsx)(e5,{}),(0,t.jsxs)(e3,{onClick:k,className:"cursor-pointer text-[#FF4E42]",children:[(0,t.jsx)(e8,{className:"mr-2 h-4 w-4"}),"Sign Out"]})]})]})}):(0,t.jsx)(i.default,{href:"/sign-in",children:(0,t.jsx)(s.Button,{size:"sm",className:"bg-gray-900 hover:bg-gray-800 text-white dark:bg-white dark:hover:bg-gray-100 dark:text-gray-900 cursor-pointer",children:"Sign In"})})]})]})}),(0,t.jsx)(te.UpgradeModal,{isOpen:_,onClose:()=>m(!1),feature:"upgrade"})]})}function tr(){let e=(0,r.usePathname)();return"/"===e||"/terms"===e||"/privacy"===e?(0,t.jsx)(h,{}):(0,t.jsx)(tt,{})}e.s(["ConditionalNavbar",()=>tr],28677)},89554,e=>{"use strict";var t=e.i(43171),r=e.i(42092);function i({children:e,...i}){return(0,t.jsx)(r.ThemeProvider,{...i,children:e})}e.s(["ThemeProvider",()=>i])},3484,e=>{"use strict";var t=e.i(43171),r=e.i(85559),r=r,i=e.i(98631);let s=(0,i.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var n=e.i(54995),n=n;let o=(0,i.default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var a=e.i(61574),a=a,l=e.i(42092),u=e.i(54219);let c=({...e})=>{let{theme:i="system"}=(0,l.useTheme)();return(0,t.jsx)(u.Toaster,{theme:i,className:"toaster group",icons:{success:(0,t.jsx)(r.default,{className:"size-4"}),info:(0,t.jsx)(s,{className:"size-4"}),warning:(0,t.jsx)(a.default,{className:"size-4"}),error:(0,t.jsx)(o,{className:"size-4"}),loading:(0,t.jsx)(n.default,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...e})};e.s(["Toaster",()=>c],3484)},2115,69150,e=>{"use strict";var t,r="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:r;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var s=null==i?void 0:i.navigator,n=null==i?void 0:i.document,o=null==i?void 0:i.location,a=null==i?void 0:i.fetch,l=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,u=null==i?void 0:i.AbortController,c=null==i?void 0:i.CompressionStream,d=null==s?void 0:s.userAgent,h=null!=r?r:{}
1,p="1.367.0",v={DEBUG:!1,LIB_VERSION:p,LIB_NAME:"web",JS_SDK_VERSION:p};function g(e,t,r,i,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,s)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(i,s){var n=e.apply(t,r);function o(e){g(n,i,s,o,a,"next",e)}function a(e){g(n,i,s,o,a,"throw",e)}o(void 0)})}}function _(){return(_=Object.assign.bind()).apply(null,arguments)}function m(e,t){if(null==e)return{};var r={};for(var i in e)if(({}).hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}function y(){return(y=f(function*(e,t){void 0===t&&(t=!0);try{var r=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(r).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var b=["$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"],x=["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"],w=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return x.concat(t).some(e=>{var t=e.toLowerCase();return -1!==r.indexOf(t)})};function E(e,t){return -1!==e.indexOf(t)}var k=function(e){return e.trim()},S=function(e){return e.replace(/^\$/,"")},P=Object.prototype,R=P.hasOwnProperty,C=P.toString,F=Array.isArray||function(e){return"[object Array]"===C.call(e)},T=e=>"function"==typeof e,I=e=>e===Object(e)&&!F(e),M=e=>{if(I(e)){for(var t in e)if(R.call(e,t))return!1;return!0}return!1},O=e=>void 0===e,$=e=>"[object String]"==C.call(e),j=e=>$(e)&&0===e.trim().length,A=e=>O(e)||null===e,L=e=>"[object Number]"==C.call(e)&&e==e,N=e=>L(e)&&e>0,D=e=>"[object Boolean]"===C.call(e),H=e=>E(b,e);function U(e){return null===e||"object"!=typeof e}function z(e,t){return({}).toString.call(e)==="[object "+t+"]"}function q(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var W=[!0,"true",1,"1","yes"],B=[!1,"false",0,"0","no"];function K(e,t,r,i,s){return t>r&&(i.warn("min cannot be greater than max."),t=r),L(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),K(s||r,t,r,i))}class V{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=K(e.bucketSize,0,100,e.qt),this.$t=K(e.refillRate,0,this.jt,e.qt),this.Ht=K(e.refillInterval,0,864e5,e.qt)}Vt(e,t){var r=Math.floor((t-e.lastAccess)/this.Ht);r>0&&(e.tokens=Math.min(e.tokens+r*this.$t,this.jt),e.lastAccess=e.lastAccess+r*this.Ht)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),s=this.Pt[i];return s?this.Vt(s,r):this.Pt[i]=s={tokens:this.jt,lastAccess:r},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===s.tokens)}stop(){this.Pt={}}}var G,Y,X,J="Mobile",Z="Android",Q="Tablet",ee=Z+" "+Q,et="iPad",er="Apple",ei=er+" Watch",es="Safari",en="BlackBerry",eo="Samsung",ea=eo+"Browser",el=eo+" Internet",eu="Chrome",ec=eu+" OS",ed=eu+" iOS",eh="Internet Explorer",ep=eh+" "+J,ev="Opera",eg=ev+" Mini",ef="Edge",e_="Microsoft "+ef,em="Firefox",ey=em+" iOS",eb="Nintendo",ex="PlayStation",ew="Xbox",eE=Z+" "+J,ek=J+" "+es,eS="Windows",eP=eS+" Phone",eR="Nokia",eC="Ouya",eF="Generic",eT=eF+" "+J.toLowerCase(),eI=eF+" "+Q.toLowerCase(),eM="Konqueror",eO="(\\d+(\\.\\d+)?)",e$=RegExp("Version/"+eO),ej=RegExp(ew,"i"),eA=RegExp(ex+" \\w+","i"),eL=RegExp(eb+" \\w+","i"),eN=RegExp(en+"|PlayBook|BB10","i"),eD={"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"},eH=function(e,t){var r;return t=t||"",E(e," OPR/")&&E(e,"Mini")?eg:E(e," OPR/")?ev:eN.test(e)?en:E(e,"IE"+J)||E(e,"WPDesktop")?ep:E(e,ea)?el:E(e,ef)||E(e,"Edg/")?e_:E(e,"FBIOS")?"Facebook "+J:E(e,"UCWEB")||E(e,"UCBrowser")?"UC Browser":E(e,"CriOS")?ed:E(e,"CrMo")||E(e,eu)?eu:E(e,Z)&&E(e,es)?eE:E(e,"FxiOS")?ey:E(e.toLowerCase(),eM.toLowerCase())?eM:(r=t)&&E(r,er)||E(e,es)&&!E(e,eu)&&!E(e,Z)?E(e,J)?ek:es:E(e,em)?em:E(e,"MSIE")||E(e,"Trident/")?eh:E(e,"Gecko")?em:""},eU={[ep]:[RegExp("rv:"+eO)],[e_]:[RegExp(ef+"?\\/"+eO)],[eu]:[RegExp("("+eu+"|CrMo)\\/"+eO)],[ed]:[RegExp("CriOS\\/"+eO)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eO)],[es]:[e$],[ek]:[e$],[ev]:[RegExp("(Opera|OPR)\\/"+eO)],[em]:[RegExp(em+"\\/"+eO)],[ey]:[RegExp("FxiOS\\/"+eO)],[eM]:[RegExp("Konqueror[:/]?"+eO,"i")],[en]:[RegExp(en+" "+eO),e$],[eE]:[RegExp("android\\s"+eO,"i")],[el]:[RegExp(ea+"\\/"+eO)],[eh]:[RegExp("(rv:|MSIE )"+eO)],Mozilla:[RegExp("rv:"+eO)]},ez=function(e,t){var r=eU[eH(e,t)];if(O(r))return null;for(var i=0;r.length>i;i++){var s=e.match(r[i]);if(s)return parseFloat(s[s.length-2])}return null},eq=[[RegExp(ew+"; "+ew+" (.*?)[);]","i"),e=>[ew,e&&e[1]||""]],[RegExp(eb,"i"),[eb,""]],[RegExp(ex,"i"),[ex,""]],[eN,[en,""]],[RegExp(eS,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eP,""];if(new RegExp(J).test(t)&&!/IEMobile\b/.test(t))return[eS+" "+J,""];
1var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=eD[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[eS,i]}return[eS,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=O(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+Z+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Z+")","i"),e=>e&&e[2]?[Z,[e[2],e[3],e[4]||"0"].join(".")]:[Z,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ec,""]],[/Linux|debian/i,["Linux",""]]],eW=function(e){return eL.test(e)?eb:eA.test(e)?ex:ej.test(e)?ew:RegExp(eC,"i").test(e)?eC:RegExp("("+eP+"|WPDesktop)","i").test(e)?eP:/iPad/.test(e)?et:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ei:eN.test(e)?en:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eR,"i").test(e)?eR:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(J).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Z:ee:RegExp("(pda|"+J+")","i").test(e)?eT:RegExp(Q,"i").test(e)&&!RegExp(Q+" pc","i").test(e)?eI:""},eB=e=>e instanceof Error;class eK{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}modifyFrames(e){var t=this;return f(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&F(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),_({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return f(function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,t){var r,i,s,n={type:e.type,value:e.value,mechanism:{type:null!=(r=t.type)?r:"generic",handled:null==(i=t.handled)||i,synthetic:null!=(s=e.synthetic)&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return X&&r.length===Y||(Y=r.length,X=r.reduce((r,i)=>{G||(G={});var s=G[i];if(s)r[s[0]]=s[1];else for(var n=e(i),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,G[i]=[l,u];break}}return r},{})),X}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return _({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}function eV(e,t,r,i,s){var n={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return O(i)||(n.lineno=i),O(s)||(n.colno=s),n}var eG=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eX=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eJ=/\((\S*)(?::(\d+))(?::(\d+))\)/,eZ=(e,t)=>{var r=eY.exec(e);if(r){var[,i,s,n]=r;return eV(t,i,"?",+s,+n)}var o=eX.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=eJ.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=eG(o[1]||"?",o[2]);return eV(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},eQ=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,e0=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,e1=(e,t)=>{var r=eQ.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=e0.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var s=r[3],n=r[1]||"?";return[n,s]=eG(n,s),eV(t,s,n,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},e2=/\(error: (.*)\)/;class e3{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=$(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class e4{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class e5{match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}var e8=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class e6{match(e){return"string"==typeof e}coerce(e,t){var r,[i,s]=this.getInfos(e);return{type:null!=i?i:"Error",value:null!=s?s:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(e8);return i&&(t=i[1],r=i[2]),[t,r]}}var e9=["fatal","error","warning","log","info","debug"];function e7(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var s=r.slice(0,i).join(", ");
1if(t>=s.length)return i===r.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class te{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(r=t.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return q(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+e7(e)}isSeverityLevel(e){return $(e)&&!j(e)&&e9.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var r=e[t];if(eB(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tt{match(e){return q(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+e7(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class tr{match(e){return U(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class ti{match(e){return z(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!q(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return U(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var ts=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={C(t){if(r&&(v.DEBUG||h.POSTHOG_DEBUG||i)&&!O(r.console)&&r.console){for(var s=("__rrweb_original__"in r.console[t])?r.console[t].__rrweb_original__:r.console[t],n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];s.C("log",...t)},warn(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];s.C("warn",...t)},error(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];s.C("error",...t)},critical(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>ts(e+" "+t,r)};return s},tn=ts("[PostHog.js]"),to=tn.createLogger,ta=to("[ExternalScriptsLoader]"),tl=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return ta.warn(t+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var i=null==n?void 0:n.querySelectorAll("script");if(i){for(var s,o=0;i.length>o;o++)if(s=function(){if(i[o].src===t){var e=i[o];return e.__posthog_loading_callback_fired?{v:r()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,r(void 0,t)}),e.onerror=e=>r(e),{v:void 0})}}())return s.v}var a=()=>{if(!n)return r("document not found");var i=n.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=e=>{i.__posthog_loading_callback_fired=!0,r(void 0,e)},i.onerror=e=>r(e),e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return r("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)n.head.appendChild(i);else{var s,o=n.querySelectorAll("body > script");o.length>0?null==(s=o[0].parentNode)||s.insertBefore(i,o[0]):n.body.appendChild(i)}};null!=n&&n.body?a():null==n||n.addEventListener("DOMContentLoaded",a)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if("remote-config"!==t)if(e._resolvedSdkVersion){var i=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");tl(e,i,r)}else{var s="/static/"+t+".js?v="+e.version;"toolbar"===t&&(s=s+"&t="+3e5*Math.floor(Date.now()/3e5));var n=e.requestRouter.endpointFor("assets",s);
1tl(e,n,r)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");tl(e,o,r)}},h.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{var i=e.requestRouter.endpointFor("api",t);tl(e,i,r)};var tu="$people_distinct_id",tc="$device_id",td="__alias",th="__timers",tp="$autocapture_disabled_server_side",tv="$heatmaps_enabled_server_side",tg="$exception_capture_enabled_server_side",tf="$error_tracking_suppression_rules",t_="$error_tracking_capture_extension_exceptions",tm="$web_vitals_enabled_server_side",ty="$dead_clicks_enabled_server_side",tb="$product_tours_enabled_server_side",tx="$web_vitals_allowed_metrics",tw="$session_recording_remote_config",tE="$sesid",tk="$session_is_sampled",tS="$enabled_feature_flags",tP="$early_access_features",tR="$feature_flag_details",tC="$stored_person_properties",tF="$stored_group_properties",tT="$surveys",tI="$flag_call_reported",tM="$flag_call_reported_session_id",tO="$feature_flag_errors",t$="$feature_flag_evaluated_at",tj="$user_state",tA="$client_session_props",tL="$capture_rate_limit",tN="$initial_campaign_params",tD="$initial_referrer_info",tH="$initial_person_info",tU="$epp",tz="__POSTHOG_TOOLBAR__",tq="$posthog_cookieless",tW=[tu,td,"__cmpns",th,"$session_recording_enabled_server_side",tv,tE,tS,tf,tj,tP,tR,tF,tC,tT,tI,tM,tO,t$,tA,tL,tN,tD,tU,tH],tB="PostHog loadExternalDependency extension not found.",tK="on_reject",tV="always",tG="anonymous",tY="identified",tX="identified_only",tJ="visibilitychange",tZ="beforeunload",tQ="$pageview",t0="$pageleave",t1="$identify",t2="$groupidentify";function t3(e,t){F(e)&&e.forEach(t)}function t4(e,t){if(!A(e))if(F(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,r)=>t(e,r));else for(var r in e)R.call(e,r)&&t(e[r],r)}var t5=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var s of r)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function t8(e){for(var t=Object.keys(e),r=t.length,i=Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var t6=function(e){try{return e()}catch(e){return}},t9=function(e){return function(){try{for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){tn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tn.critical(e)}}},t7=function(e){var t={};return t4(e,function(e,r){($(e)&&e.length>0||L(e))&&(t[r]=e)}),t},re=["herokuapp.com","vercel.app","netlify.app"];function rt(e,t,r,i){var{capture:s=!1,passive:n=!0}=null!=i?i:{};null==e||e.addEventListener(t,r,{capture:s,passive:n})}function rr(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return L(e)&&isFinite(e)&&Math.floor(e)===e});class ri{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/0x10000000000,s[1]=e/0x100000000,s[2]=e/0x1000000,s[3]=e/65536,s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new ri(s)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new ri(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class rs{constructor(){this.I=0,this.S=0,this.k=new ra}generate(){var e=this.generateOrAbort();if(O(e)){this.I=0;var t=this.generateOrAbort();if(O(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>0x3ffffffffff&&(this.I++,this.A())}return ri.fromFieldsV7(this.I,Math.trunc(this.S/0x40000000),0x3fffffff&this.S,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var rn,ro=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};r&&!O(r.crypto)&&crypto.getRandomValues&&(ro=e=>crypto.getRandomValues(e));class ra{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ro(this.T),this.N=0),this.T[this.N++]}}var rl=()=>ru().toString(),ru=()=>(rn||(rn=new rs)).generate(),rc="",rd=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,rh={Yt:()=>!!n,Ut(e){tn.error("cookieStore error: "+e)},Wt(e){if(n){try{for(var t=e+"=",r=n.cookie.split(";").filter(e=>e.length),i=0;r.length>i;i++){for(var s=r[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},Gt(e){var t;try{t=JSON.parse(rh.Wt(e))||{}}catch(e){}return t},Xt(e,t,r,i,s){if(n)try{var o="",a="",l=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=n),rc)return rc;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),s="dmn_chk_"+rl();!rc&&i--;){var o=r.slice(i).join("."),a=s+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(s)&&(t.cookie=a+";max-age=0",rc=o)}return rc}(e);if(!r){var i,s=(i=e.match(rd))?i[0]:"";s!==r&&tn.info("Warning: cookie subdomain discovery mismatch",s,r),r=s}return r?"; domain=."+r:""}return""}(n.location.hostname,i);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),o="; expires="+u.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&tn.warn("cookieStore warning: large cookie, len="+c.length),n.cookie=c,c}catch(e){return}},Jt(e,t){if(null!=n&&n.cookie)try{rh.Xt(e,"",-1,t)}catch(e){return}}},rp=null,rv={Yt(){if(null!==rp)return rp;var e=!0;if(O(r))e=!1;
1else try{var t="__mplssupport__";rv.Xt(t,"xyz"),'"xyz"'!==rv.Wt(t)&&(e=!1),rv.Jt(t)}catch(t){e=!1}return e||tn.error("localStorage unsupported; falling back to cookie store"),rp=e,e},Ut(e){tn.error("localStorage error: "+e)},Wt(e){try{return null==r?void 0:r.localStorage.getItem(e)}catch(e){rv.Ut(e)}return null},Gt(e){try{return JSON.parse(rv.Wt(e))||{}}catch(e){}return null},Xt(e,t){try{null==r||r.localStorage.setItem(e,JSON.stringify(t))}catch(e){rv.Ut(e)}},Jt(e){try{null==r||r.localStorage.removeItem(e)}catch(e){rv.Ut(e)}}},rg=[tc,"distinct_id",tE,tk,tU,tH,tj],rf={},r_={Yt:()=>!0,Ut(e){tn.error("memoryStorage error: "+e)},Wt:e=>rf[e]||null,Gt:e=>rf[e]||null,Xt(e,t){rf[e]=t},Jt(e){delete rf[e]}},rm=null,ry={Yt(){if(null!==rm)return rm;if(rm=!0,O(r))rm=!1;else try{var e="__support__";ry.Xt(e,"xyz"),'"xyz"'!==ry.Wt(e)&&(rm=!1),ry.Jt(e)}catch(e){rm=!1}return rm},Ut(e){tn.error("sessionStorage error: ",e)},Wt(e){try{return null==r?void 0:r.sessionStorage.getItem(e)}catch(e){ry.Ut(e)}return null},Gt(e){try{return JSON.parse(ry.Wt(e))||null}catch(e){}return null},Xt(e,t){try{null==r||r.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ry.Ut(e)}},Jt(e){try{null==r||r.sessionStorage.removeItem(e)}catch(e){ry.Ut(e)}}};class rb{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===tV||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===tK)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this.tr.Xt(this.er,+!!e,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}get er(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.tr.Wt(this.er);return E(W,e)?1:E(B,e)?0:-1}get tr(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?rv:rh;if(!this.rr||this.rr!==t){this.rr=t;var r="localStorage"===e?rh:rv;r.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(E(W,r.Wt(this.er))),r.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}Kt(){return!!this.Rt.respect_dnt&&[null==s?void 0:s.doNotTrack,null==s?void 0:s.msDoNotTrack,h.doNotTrack].some(e=>E(W,e))}}var rx=to("[Dead Clicks]"),rw=()=>!0,rE=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(ty)),i=e.instance.config.capture_dead_clicks;return D(i)?i:!!I(i)||r};class rk{get lazyLoadedDeadClicksAutocapture(){return this.ir}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[ty]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.nr(()=>{this.sr()}):this.stop()}nr(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?rx.error("failed to load script",t):e()})}sr(){var e;if(n){if(!this.ir&&null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=I(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ir=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ir.start(n),rx.info("starting...")}}else rx.error("`document` not found. Cannot start.")}stop(){this.ir&&(this.ir.stop(),this.ir=void 0,rx.info("stopping..."))}}var rS=to("[SegmentIntegration]"),rP="posthog-js";function rR(e,t){var{organization:r,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,d,h,p,v=(null==(l=t.exception)?void 0:l.values)||[],g=v.map(e=>_({},e,{stacktrace:e.stacktrace?_({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>_({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(u=v[0])?void 0:u.value)||t.message,$exception_type:null==(c=v[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=v[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return r&&i&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class rC{constructor(e,t,r,i,s,n){this.name=rP,this.setupOnce=function(o){o(rR(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class rF{constructor(e){this.ar=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(tn.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this.lr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ur()}ur(){var e;this.hr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ar)}destroy(){var e;null==(e=this.hr)||e.call(this),this.hr=void 0}doPageView(e,t){var i,s=this.cr(e,t);return this.lr={pathname:null!=(i=null==r?void 0:r.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.cr(e,null==(t=this.lr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.lr)?void 0:e.pageViewId}}cr(e,t){var r=this.lr;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(O(n)||O(o)||O(a)||O(l)||O(u)||O(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?K(o/n,0,1,tn):1,h=n>1?K(a/n,0,1,tn):1,p=l>1?K(u/l,0,1,tn):1,v=l>1?K(c/l,0,1,tn):1;i=t5(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var rT=e=>{var t=null==n?void 0:n.createElement("a");return O(t)?null:(t.href=e,t)},rI=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var n=i[s].split("=");if(n[0]===t){r=n;break}}if(!F(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){tn.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rM=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");F(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},rO=function(e,t){var r=e.match(RegExp(t+"=([^&]*)"));return r?r[1]:null},r$="https?://(.*)",rj=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...rj],rL="<masked>",rN=["li_fat_id"];function rD(e,t,r){if(!n)return{};var i,s=t?[...rj,...r||[]]:[],o=rH(rM(n.URL,s,rL),e);return t5((i={},t4(rN,function(e){var t=rh.Wt(e);i[e]=t||null}),i),o)}function rH(e,t){var r=rA.concat(t||[]),i={};return t4(r,function(t){var r=rI(e,t);i[t]=r||null}),i}function rU(e){var t=e?0===e.search(r$+"google.([^/?]*)")?"google":0===e.search(r$+"bing.com")?"bing":0===e.search(r$+"yahoo.com")?"yahoo":0===e.search(r$+"duckduckgo.com")?"duckduckgo":null:null,r={};if(null!==t){r.$search_engine=t;var i=n?rI(n.referrer,"yahoo"!=t?"q":"p"):"";i.length&&(r.ph_keyword=i)}return r}function rz(){return navigator.language||navigator.userLanguage}var rq="$direct";function rW(){return(null==n?void 0:n.referrer)||rq}function rB(e,t){var r=e?[...rj,...t||[]]:[],i=null==o?void 0:o.href.substring(0,1e3);return{r:rW().substring(0,1e3),u:i?rM(i,r,rL):void 0}}function rK(e){var t,{r:r,u:i}=e,s={$referrer:r,$referring_domain:null==r?void 0:r==rq?rq:null==(t=rT(r))?void 0:t.host};
1if(i){s.$current_url=i;var n=rT(i);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname,t5(s,rH(i))}return r&&t5(s,rU(r)),s}function rV(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var rG=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class rY{constructor(e,t){this.Rt=e,this.props={},this.dr=!1,this.vr=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.tr=this.pr(e),this.load(),e.debug&&tn.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gr}pr(e){-1===rG.indexOf(e.persistence.toLowerCase())&&(tn.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,s=(void 0===(t=e.cookie_persisted_properties||[])&&(t=[]),i=[...rg,...t],_({},rv,{Gt(e){try{var t={};try{t=rh.Gt(e)||{}}catch(e){}var r=t5(t,JSON.parse(rv.Wt(e)||"{}"));return rv.Xt(e,r),r}catch(e){}return null},Xt(e,t,r,s,n,o){try{rv.Xt(e,t,void 0,void 0,o);var a={};i.forEach(e=>{t[e]&&(a[e]=t[e])}),Object.keys(a).length&&rh.Xt(e,a,r,s,n,o)}catch(e){rv.Ut(e)}},Jt(e,t){try{null==r||r.localStorage.removeItem(e),rh.Jt(e,t)}catch(e){rv.Ut(e)}}})),n=e.persistence.toLowerCase();return"localstorage"===n&&rv.Yt()?rv:"localstorage+cookie"===n&&s.Yt()?s:"sessionstorage"===n&&ry.Yt()?ry:"memory"===n?r_:"cookie"===n?rh:s.Yt()?s:rh}mr(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[t$];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return t4(this.props,(t,r)=>{if(r===tS&&I(t)){if(!this.mr())for(var i=Object.keys(t),s=0;i.length>s;s++)e["$feature/"+i[s]]=t[i[s]]}else -1===tW.indexOf(r)&&(e[r]=t)}),e}load(){if(!this.gr){var e=this.tr.Gt(this.vr);e&&(this.props=t5({},e))}}save(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}remove(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(I(e)){O(t)&&(t="None"),this.yr=O(r)?this._r:r;var i=!1;if(t4(e,(e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.props[r]=e,i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(I(e)){this.yr=O(t)?this._r:t;var r=!1;if(t4(e,(t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this.props[i]=t,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.dr){var e=rD(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);M(t7(e))||this.register(e),this.dr=!0}}update_search_keyword(){var e;this.register((e=null==n?void 0:n.referrer)?rU(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rW(),$referring_domain:null!=n&&n.referrer&&(null==(e=rT(n.referrer))?void 0:e.host)||rq},void 0)}set_initial_person_info(){this.props[tN]||this.props[tD]||this.register_once({[tH]:rB(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};t4([tD,tN],t=>{var r=this.props[t];r&&t4(r,function(t,r){e["$initial_"+S(r)]=t})});var t,r,i=this.props[tH];return i&&t5(e,(t=rK(i),r={},t4(t,function(e,t){r["$initial_"+S(t)]=e}),r)),e}safe_merge(e){return t4(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){if(this._r=this.yr=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!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every((e,t)=>e===i[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var i=this.pr(e),s=this.props;this.clear(),this.tr=i,this.props=s,this.save()}}set_disabled(e){this.gr=e,this.gr?this.remove():this.save()}set_cross_subdomain(e){e!==this.br&&(this.br=e,this.remove(),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[th]||{};r[e]=t,this.props[th]=r,this.save()}remove_event_timer(e){var t=(this.props[th]||{})[e];return O(t)||(delete this.props[th][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var rX="events",rJ="cancelEvents",rZ="survey shown",rQ="survey sent",r0="popover",r1=to("[RateLimiter]");class r2{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
1if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{r1.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void r1.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,r,i,{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(r=this.instance.persistence)?void 0:r.get_property(tL))?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(tL,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var r3=to("[RemoteConfig]");class r4{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Ir(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Cr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return r3.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void r3.warn("Remote config is disabled. Falling back to local config.");this.Ir(e=>{e?(this.Sr(e),this.kr()):(r3.info("No config found after loading remote JS config. Falling back to JSON."),this.Cr(e=>{this.Sr(e),this.kr()}))})}catch(e){r3.error("Error loading remote config",e)}}stop(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}refresh(){this._instance.Tr()||"hidden"===(null==n?void 0:n.visibilityState)||this._instance.reloadFeatureFlags()}kr(){var e;if(!this.Ar){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.Ar=setInterval(()=>{this.refresh()},t))}}Sr(e){var t;e||r3.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var r5="gzip-js",r8="base64",r6=Uint8Array,r9=Uint16Array,r7=Uint32Array,ie=new r6([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]),it=new r6([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]),ir=new r6([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ii=function(e,t){for(var r=new r9(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var s=new r7(r[30]);for(i=1;30>i;++i)for(var n=r[i];r[i+1]>n;++n)s[n]=n-r[i]<<5|i;return[r,s]},is=ii(ie,2),io=is[1];is[0][28]=258,io[258]=28;for(var ia=ii(it,0)[1],il=new r9(32768),iu=0;32768>iu;++iu){var ic=(43690&iu)>>>1|(21845&iu)<<1;il[iu]=((65280&(ic=(61680&(ic=(52428&ic)>>>2|(13107&ic)<<2))>>>4|(3855&ic)<<4))>>>8|(255&ic)<<8)>>>1}var id=function(e,t,r){for(var i=e.length,s=0,n=new r9(t);i>s;++s)++n[e[s]-1];var o,a=new r9(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(r){o=new r9(1<<t);var l=15-t;for(s=0;i>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[il[d]>>>l]=u}else for(o=new r9(i),s=0;i>s;++s)o[s]=il[a[e[s]-1]++]>>>15-e[s];return o},ih=new r6(288);for(iu=0;144>iu;++iu)ih[iu]=8;for(iu=144;256>iu;++iu)ih[iu]=9;for(iu=256;280>iu;++iu)ih[iu]=7;for(iu=280;288>iu;++iu)ih[iu]=8;var ip=new r6(32);for(iu=0;32>iu;++iu)ip[iu]=5;var iv=id(ih,9,0),ig=id(ip,5,0),i_=function(e){return(e/8|0)+(7&e&&1)},im=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof r9?r9:e instanceof r7?r7:r6)(r-t);return i.set(e.subarray(t,r)),i},iy=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},ib=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},ix=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var s=r.length,n=r.slice();if(!s)return[new r6(0),0];if(1==s){var o=new r6(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(i=1;s>i;++i)n[i].s>h&&(h=n[i].s);var p=new r9(h+1),v=iw(r[c-1],p,0);if(v>t){i=0;var g=0,f=v-t,_=1<<f;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>i;++i){var m=n[i].s;if(t>=p[m])break;g+=_-(1<<v-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=n[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=n[i].s;p[b]==t&&(--p[b],++g)}v=t}return[new r6(p),v]},iw=function(e,t,r){return -1==e.s?Math.max(iw(e.l,t,r+1),iw(e.r,t,r+1)):t[e.s]=r},iE=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new r9(++t),i=0,s=e[0],n=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[r.subarray(0,i),t]},ik=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},iS=function(e,t,r){var i=r.length,s=i_(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;i>n;++n)e[s+n+4]=r[n];return 8*(s+4+i)},iP=function(e,t,r,i,s,n,o,a,l,u,c){iy(t,c++,r),++s[256];for(var d=ix(s,15),h=d[0],p=d[1],v=ix(n,15),g=v[0],f=v[1],_=iE(h),m=_[0],y=_[1],b=iE(g),x=b[0],w=b[1],E=new r9(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;x.length>k;++k)E[31&x[k]]++;for(var S=ix(E,7),P=S[0],R=S[1],C=19;C>4&&!P[ir[C-1]];--C);var F,T,I,M,O=u+5<<3,$=ik(s,ih)+ik(n,ip)+o,j=ik(s,h)+ik(n,g)+o+14+3*C+ik(E,P)+(2*E[16]+3*E[17]+7*E[18]);if($>=O&&j>=O)return iS(t,c,e.subarray(l,l+u));if(iy(t,c,1+($>j)),c+=2,$>j){F=id(h,p,0),T=h,I=id(g,f,0),M=g;var A=id(P,R,0);for(iy(t,c,y-257),iy(t,c+5,w-1),iy(t,c+10,C-4),c+=14,k=0;C>k;++k)iy(t,c+3*k,P[ir[k]]);c+=3*C;for(var L=[m,x],N=0;2>N;++N){var D=L[N];for(k=0;D.length>k;++k)iy(t,c,A[H=31&D[k]]),c+=P[H],H>15&&(iy(t,c,D[k]>>>5&127),c+=D[k]>>>12)}}else F=iv,T=ih,I=ig,M=ip;for(k=0;a>k;++k)if(i[k]>255){ib(t,c,F[257+(H=i[k]>>>18&31)]),c+=T[H+257],H>7&&(iy(t,c,i[k]>>>23&31),c+=ie[H]);var H,U=31&i[k];ib(t,c,I[U]),c+=M[U],U>3&&(ib(t,c,i[k]>>>5&8191),c+=it[U])}else ib(t,c,F[i[k]]),c+=T[i[k]];return ib(t,c,F[256]),c+T[256]},iR=new r7([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),iC=function(){for(var e=new r7(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&0xedb88320)^r>>>1;e[t]=r}return e}(),iF=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},iT=!!l||!!a,iI="text/plain",iM=function(e,t,r){void 0===r&&(r=!0);var i,s,n,o,a,[l,u]=e.split("?"),c=_({},t),d=null!=(a=null==u?void 0:u.split("&").map(e=>{var t,[i,s]=e.split("="),n=r&&null!=(t=c[i])?t:s;return delete c[i],i+"="+n}))?a:[],h=(void 0===i&&(i="&"),o=[],t4(c,function(e,t){O(e)||O(t)||"undefined"===t||(s=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),o[o.length]=n+"="+s)}),o.join(i));return h&&d.push(h),l+"?"+d.join("&")},iO=(e,t)=>
1JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),i$=e=>{if(e.zt)return e.zt;var{data:t,compression:r}=e;if(t){if(r===r5){var i,s,n,o,a,l,u,c,d=(i=function(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new r6(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},o=0;r>o;++o){if(s+5>i.length){var a=new r6(s+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l?n(l):(2048>l?n(192|l>>>6):(l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return im(i,0,s)}(iO(t)),s={mtime:0},n=0xffffffff,o={p(e){for(var t=n,r=0;e.length>r;++r)t=iC[255&t^e[r]]^t>>>8;n=t},d:()=>0xffffffff^n},a=i.length,o.p(i),c=(l=10+(s.filename&&s.filename.length+1||0),u=function(e,t,r,i,s,n){var o=e.length,a=new r6(i+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(i,a.length-8),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=iS(l,u,e.subarray(c,d)):(l[c]=!0,u=iS(l,u,e.subarray(c,o)))}else{for(var h=iR[t-1],p=h>>>13,v=8191&h,g=(1<<r)-1,f=new r9(32768),_=new r9(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},x=new r7(25e3),w=new r9(288),E=new r9(32),k=0,S=0,P=(c=0,0),R=0,C=0;o>c;++c){var F=b(c),T=32767&c,I=_[F];if(f[T]=I,_[F]=T,c>=R){var M=o-c;if((k>7e3||P>24576)&&M>423){u=iP(e,l,0,x,w,E,S,P,C,c-C,u),P=k=S=0,C=c;for(var O=0;286>O;++O)w[O]=0;for(O=0;30>O;++O)E[O]=0}var $=2,j=0,A=v,L=T-I&32767;if(M>2&&F==b(c-L))for(var N=Math.min(p,M)-1,D=Math.min(32767,c),H=Math.min(258,M);D>=L&&--A&&T!=I;){if(e[c+$]==e[c+$-L]){for(var U=0;H>U&&e[c+U]==e[c+U-L];++U);if(U>$){if($=U,j=L,U>N)break;var z=Math.min(L,U-2),q=0;for(O=0;z>O;++O){var W=c-L+O+32768&32767,B=W-f[W]+32768&32767;B>q&&(q=B,I=W)}}}L+=(T=I)-(I=f[T])+32768&32767}if(j){x[P++]=0x10000000|io[$]<<18|ia[j];var K=31&io[$],V=31&ia[j];S+=ie[K]+it[V],++w[257+K],++E[V],R=c+$,++k}else x[P++]=e[c],++w[e[c]]}}u=iP(e,l,!0,x,w,E,S,P,C,c-C,u)}return im(a,0,i+i_(u)+8)}(i,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+s.mem,l,0)).length,function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&iF(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}}(u,s),iF(u,c-8,o.d()),iF(u,c-4,a),u);return{contentType:iI,body:d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength),estimatedSize:d.byteLength}}if(r===r8){let e;var h,p="data="+encodeURIComponent("string"==typeof(e=(h=iO(t))?btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):h)?e:iO(e));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var v=iO(t);return{contentType:"application/json",body:v,estimatedSize:new Blob([v]).size}}},ij=(nT=f(function*(e){var t=iO(e.data),r=yield function(e,t){return y.apply(this,arguments)}(t,v.DEBUG);if(!r)return e;var i=yield r.arrayBuffer();return _({},e,{zt:{contentType:iI,body:i,estimatedSize:i.byteLength}})}),function(e){return nT.apply(this,arguments)}),iA=[];a&&iA.push({transport:"fetch",method(e){var t,r,{contentType:i,body:s,estimatedSize:n}=null!=(t=i$(e))?t:{},o=new Headers;t4(e.headers,function(e,t){o.append(t,e)}),i&&o.append("Content-Type",i);var l=e.url,c=null;if(u){var d=new u;c={signal:d.signal,timeout:setTimeout(()=>d.abort(),e.timeout)}}a(l,_({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:s,signal:null==(r=c)?void 0:r.signal},e.fetchOptions)).then(t=>t.text().then(r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){tn.error(e)}null==e.callback||e.callback(i)})).catch(t=>{tn.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>c?clearTimeout(c.timeout):null)}}),l&&iA.push({transport:"XHR",method(e){var t,r=new l;r.open(e.method||"GET",e.url,!0);var{contentType:i,body:s}=null!=(t=i$(e))?t:{};t4(e.headers,function(e,t){r.setRequestHeader(t,e)}),i&&r.setRequestHeader("Content-Type",i),e.timeout&&(r.timeout=e.timeout),e.disableXHRCredentials||(r.withCredentials=!0),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};
1if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(s)}}),null!=s&&s.sendBeacon&&iA.push({transport:"sendBeacon",method(e){var t=iM(e.url,{beacon:"1"});try{var r,{contentType:i,body:n}=null!=(r=i$(e))?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:i});s.sendBeacon(t,o)}catch(e){}}});class iL{constructor(e,t){this.Er=!0,this.Rr=[],this.Nr=K((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tn.createLogger("flush interval"),3e3),this.Mr=e}enqueue(e){this.Rr.push(e),this.Fr||this.Or()}unload(){this.Pr();var e=Object.values(this.Rr.length>0?this.Lr():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Mr(_({},e,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Or()}Or(){var e=this;this.Er||(this.Fr=setTimeout(()=>{if(this.Pr(),this.Rr.length>0){var t=this.Lr();for(var r in t)!function(){var i=t[r],s=(new Date).getTime();i.data&&F(i.data)&&t4(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.Mr(i)}()}},this.Nr))}Pr(){clearTimeout(this.Fr),this.Fr=void 0}Lr(){var e={};return t4(this.Rr,t=>{var r,i=(t?t.batchKey:null)||t.url;O(e[i])&&(e[i]=_({},t,{data:[]})),null==(r=e[i].data)||r.push(t.data)}),this.Rr=[],e}}var iN=["retriesPerformedSoFar"];class iD{constructor(e){this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.jr=!0,!O(r)&&"onLine"in r.navigator&&(this.jr=r.navigator.onLine,this.qr=()=>{this.jr=!0,this.Zr()},this.$r=()=>{this.jr=!1},rt(r,"online",this.qr),rt(r,"offline",this.$r))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=m(e,iN);N(t)&&(r.url=iM(r.url,{retry_count:t})),this._instance._send_request(_({},r,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==r.callback||r.callback(e):this.Hr(_({retriesPerformedSoFar:t},r))}}))}Hr(e){var t,r,i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var s=Math.ceil((r=Math.min(18e5,t=3e3*Math.pow(2,i)))+(Math.random()-.5)*(r-t/2)),n=Date.now()+s;this.Rr.push({retryAt:n,requestOptions:e});var o="Enqueued failed request for retry in "+s;navigator.onLine||(o+=" (Browser is offline)"),tn.warn(o),this.Dr||(this.Dr=!0,this.Vr())}Vr(){(this.zr&&clearTimeout(this.zr),0===this.Rr.length)?(this.Dr=!1,this.zr=void 0):this.zr=setTimeout(()=>{this.jr&&this.Rr.length>0&&this.Zr(),this.Vr()},this.Br)}Zr(){var e=Date.now(),t=[],r=this.Rr.filter(r=>e>r.retryAt||(t.push(r),!1));if(this.Rr=t,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,O(r)||(this.qr&&(r.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(r.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr))try{this._instance._send_request(_({},e,{transport:"sendBeacon"}))}catch(e){tn.error(e)}this.Rr=[]}}class iH{constructor(e){this.Yr=()=>{this.Ur||(this.Ur={});var e,t,r,i,s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ur.lastScrollY=Math.ceil(n),this.Ur.maxScrollY=Math.max(n,null!=(e=this.Ur.maxScrollY)?e:0),this.Ur.maxScrollHeight=Math.max(o,null!=(t=this.Ur.maxScrollHeight)?t:0),this.Ur.lastContentY=a,this.Ur.maxContentY=Math.max(a,null!=(r=this.Ur.maxContentY)?r:0),this.Ur.maxContentHeight=Math.max(l,null!=(i=this.Ur.maxContentHeight)?i:0)},this._instance=e}get Wr(){return this._instance.config.scroll_root_selector}getContext(){return this.Ur}resetContext(){var e=this.Ur;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){rt(r,"scroll",this.Yr,{capture:!0}),rt(r,"scrollend",this.Yr,{capture:!0}),rt(r,"resize",this.Yr)}scrollElement(){if(!this.Wr)return null==r?void 0:r.document.documentElement;for(var e of F(this.Wr)?this.Wr:[this.Wr]){var t=null==r?void 0:r.document.querySelector(e);if(t)return t}}scrollY(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollTop||0}return r&&(r.scrollY||r.pageYOffset||r.document.documentElement.scrollTop)||0}scrollX(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollLeft||0}return r&&(r.scrollX||r.pageXOffset||r.document.documentElement.scrollLeft)||0}}var iU=e=>rB(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);
1class iz{constructor(e,t,r,i){this.Gr=e=>{var t=this.Xr();if(!t||t.sessionId!==e){var r={sessionId:e,props:this.Jr(this._instance)};this.Kr.register({[tA]:r})}},this._instance=e,this.Qr=t,this.Kr=r,this.Jr=i||iU,this.Qr.onSessionId(this.Gr)}Xr(){return this.Kr.props[tA]}getSetOnceProps(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?rK(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return t4(t7(this.getSetOnceProps()),(t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+S(r)]=t}),e}}class iq{constructor(){this.ti={}}on(e,t){return this.ti[e]||(this.ti[e]=[]),this.ti[e].push(t),()=>{this.ti[e]=this.ti[e].filter(e=>e!==t)}}emit(e,t){for(var r of this.ti[e]||[])r(t);for(var i of this.ti["*"]||[])i(e,t)}}var iW=to("[SessionId]");class iB{on(e,t){return this.ei.on(e,t)}constructor(e,t,r){if(this.ri=[],this.ii=void 0,this.ei=new iq,this.ni=(e,t)=>!(!N(e)||!N(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===tV)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Kr=e.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=t||rl,this.li=r||rl;var i,s=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*K(this.Rt.session_idle_timeout_seconds||1800,60,36e3,iW.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+s+"_window_id",this.ci="ph_"+s+"_primary_window_exists",this.di()){var n=ry.Gt(this.hi),o=ry.Gt(this.ci);n&&!o?this.si=n:ry.Jt(this.hi),ry.Xt(this.ci,!0)}if(null!=(i=this.Rt.bootstrap)&&i.sessionID)try{var a=(e=>{var t=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){iW.error("Invalid sessionID in bootstrap",e)}this.fi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return O(this.ri)&&(this.ri=[]),this.ri.push(e),this.oi&&e(this.oi,this.si),()=>{this.ri=this.ri.filter(t=>t!==e)}}di(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&ry.Yt()}pi(e){e!==this.si&&(this.si=e,this.di()&&ry.Xt(this.hi,e))}gi(){return this.si?this.si:this.di()?ry.Gt(this.hi):null}vi(e,t,r){e===this.oi&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.oi=e,this.Kr.register({[tE]:[t,e,r]}))}mi(){var e=this.Kr.props[tE];return F(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vi(null,null,null)}destroy(){clearTimeout(this.yi),this.yi=void 0,this.ii&&r&&(r.removeEventListener(tZ,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}fi(){this.ii=()=>{this.di()&&ry.Jt(this.ci)},rt(r,tZ,this.ii,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===tV)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),[i,s,n]=this.mi(),o=this.gi(),a=N(n)&&Math.abs(r-n)>864e5,l=!1,u=!s,c=!u&&!e&&this.ni(r,i);u||c||a?(s=this.ai(),o=this.li(),iW.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=r,l=!0):o||(o=this.li(),l=!0);var d=N(i)&&e&&!a?i:r,h=N(n)?n:(new Date).getTime();return this.pi(o),this.vi(s,d,h),e||this.ui(),l&&this.ri.forEach(e=>e(s,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:h,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:i}}ui(){clearTimeout(this.yi),this.yi=setTimeout(()=>{var[e]=this.mi();if(this.ni((new Date).getTime(),e)){var t=this.oi;this.resetSessionId(),this.ei.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var iK=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&w(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(e=>w(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},iV=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function iG(e,t,r){return iO({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var iY={exact:(e,t)=>
1t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>iV(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!iV(t,e))),icontains:(e,t)=>t.map(iX).some(t=>e.map(iX).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(iX).every(t=>e.map(iX).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})},iX=e=>e.toLowerCase();function iJ(e,t){return!e||Object.entries(e).every(e=>{var[r,i]=e,s=null==t?void 0:t[r];if(O(s)||null===s)return!1;var n=[String(s)],o=iY[i.operator];return!!o&&o(i.values,n)})}var iZ="custom",iQ="i.posthog.com";class i0{constructor(e){this.bi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+iQ,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.bi[this.apiHost]||(this.bi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":iZ),this.bi[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===iZ)return this.apiHost+t;var r=iQ+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var i1=to("[Surveys]"),i2="seenSurvey_",i3=e=>{var t;return t=""+i2+e.id,e.current_iteration&&e.current_iteration>0&&(t=""+i2+e.id+"_"+e.current_iteration),t},i4=["popover","widget","api"],i5={ignoreConditions:!1,ignoreDelay:!1,displayType:r0},i8=to("[PostHog ExternalIntegrations]"),i6={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class i9{constructor(e){this._instance=e}nr(e,t){var r;null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,e=>{if(e)return i8.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,r=function(e){var r,i,n;!s||null!=(r=h.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[e]||t.nr(i6[e],()=>{var r;null==(r=h.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[e])||r.start(t._instance)}),!s&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,s]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))r(i)}}var i7={},se=0,st=()=>{},sr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',si="Surveys module not available",ss="sanitize_properties is deprecated. Use before_send instead",sn="Invalid value for property_denylist config: ",so=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,sa="posthog",sl=!iT&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),su=e=>{var t;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!$(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of re)if(r===i)return!1;return!0}(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:st,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:o&&$(null==o?void 0:o.search)&&-1!==o.search.indexOf("__posthog_debug=true")||!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:"https:"===(null==r||null==(t=r.location)?void 0:t.protocol),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_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){tn.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:tX,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:st,__preview_eager_load_replay:!1},{rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0})},sc=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],sd=e=>{var t={};for(var[r,i]of sc)O(e[r])||(t[i]=e[r]);var s=t5({},t,e);return F(e.property_blacklist)&&(O(e.property_denylist)?s.property_denylist=e.property_blacklist:F(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:tn.error(sn+e.property_denylist)),s};class sh{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(e){tn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class sp{Ii(e,t){if(e){var r=this.Ci.indexOf(e);-1!==r&&this.Ci.splice(r,1)}return this.Ci.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new sh,this.Si=!1,this.version=v.LIB_VERSION,this.ki=new iq,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=su(),this.SentryIntegration=rC,this.sentryIntegration=e=>{var t;return t=rR(this,e),{name:rP,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new iH(this),this.pageViewM
1anager=new rF(this),this.rateLimiter=new r2(this),this.requestRouter=new i0(this),this.consent=new rb(this),this.externalIntegrations=new i9(this);var e,t=null!=(e=sp.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=$(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=$(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",e=>tn.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,r){if(r&&r!==sa){var i,s=null!=(i=i7[r])?i:new sp;return s._init(e,t,r),i7[r]=s,i7[sa][r]=s,s}return this._init(e,t,r)}_init(e,t,i){if(void 0===t&&(t={}),O(e)||j(e))return tn.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={},t.debug=this.Ri(t.debug),this.Ni=t,this.Mi=[],t.person_profiles?this.Ai=t.person_profiles:t.process_person&&(this.Ai=t.process_person),this.set_config(t5({},su(t.defaults),sd(t),{name:i,token:e})),this.config.on_xhr_error&&tn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:r5;var s,n,o,a,l=this.Fi();this.persistence=new rY(this.config,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rY(_({},this.config,{persistence:"sessionStorage"}),l);var u=_({},this.persistence.props),c=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new iL(e=>this.Pi(e),this.config.request_queue_config),this.Li=new iD(this),this.__request_queue=[];var d=this.config.cookieless_mode===tV||this.config.cookieless_mode===tK&&this.consent.isExplicitlyOptedOut();d||(this.sessionManager=new iB(this),this.sessionPropsManager=new iz(this,this.sessionManager,this.persistence));var p=null==(s=h._POSTHOG_REMOTE_CONFIG)||null==(s=s[this.config.token])?void 0:s.config,g=null==p||null==(n=p.sdkVersion)?void 0:n.resolved;if(g&&(so.test(g)?this._resolvedSdkVersion=g:tn.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+g)),this.config.__preview_deferred_init_extensions?(tn.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Di(d)},0)):(tn.info("Initializing extensions synchronously"),this.Di(d)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&tn.info("Starting in debug mode",{this:this,config:t,thisC:_({},this.config),p:u,s:c}),!this.config.identity_distinct_id||null!=(o=t.bootstrap)&&o.distinctID||(t.bootstrap=_({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(a=t.bootstrap)?void 0:a.distinctID)){var f=t.bootstrap.distinctID,m=this.get_distinct_id(),y=this.persistence.get_property(tj);if(t.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===tG)this.identify(f);else if(t.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===tY)tn.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(rl()),x=t.bootstrap.isIdentifiedID?b:f;this.persistence.set_property(tj,t.bootstrap.isIdentifiedID?tY:tG),this.register({distinct_id:f,$device_id:x})}}if(d)this.register_once({distinct_id:tq,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(rl());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(tj,tG)}return rt(r,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||rl();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(tj,tY)),t()},s=r.user();"then"in s&&T(s.then)?s.then(i):i(s)}(e,()=>{var i;r.register((Promise&&Promise.resolve||rS.warn("This browser does not have Promise support, and can not use the segment integration"),i=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(rS.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(rS.info("UserId set, identifying with PostHog"),e.identify(t.event.userId)
1);var i=e.calculateEventProperties(r,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>i(e,e.event.event),page:e=>i(e,tQ),identify:e=>i(e,t1),screen:e=>i(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Bi()):this.Bi(),T(this.config._onCapture)&&this.config._onCapture!==st&&(tn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tn.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}Di(e){var t,r,i,s,n,o,a,l=performance.now(),u=_({},sp.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.Ci.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.Ci.push(this.exceptions=null!=(r=this.exceptions)?r:new u.exceptions(this)),u.historyAutocapture&&this.Ci.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ci.push(new u.tracingHeaders(this)),u.siteApps&&this.Ci.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Ci.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.Ci.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ci.push(this.surveys=null!=(i=this.surveys)?i:new u.surveys(this)),u.logs&&this.Ci.push(this.logs=null!=(s=this.logs)?s:new u.logs(this)),u.conversations&&this.Ci.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.Ci.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ci.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ci.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,rE)),u.toolbar&&this.Ci.push(this.toolbar=null!=(o=this.toolbar)?o:new u.toolbar(this)),u.experiments&&this.Ci.push(this.experiments=null!=(a=this.experiments)?a:new u.experiments(this)),this.Ci.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.ji){var e=this.ji;this.ji=void 0,this.Sr(e)}}),this.qi(c,l)}qi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.qi(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){tn.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:i}),this.config.__preview_deferred_init_extensions&&tn.info("PostHog extensions initialized ("+i+"ms)")}Sr(e){var t;n&&n.body?(this.config.__preview_deferred_init_extensions&&(this.ji=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=E(e.supportedCompression,r5)?r5:E(e.supportedCompression,r8)?r8:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:tX}),this.Ci.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))):(tn.info("document not ready yet, trying again in 500 milliseconds..."),setTimeout(()=>{this.Sr(e)},500))}Bi(){try{this.config.loaded(this)}catch(e){tn.critical("`loaded` function failed",e)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=o&&o.hostname){var e=o.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===tV)&&this.$i()},1),this.Hi=new r4(this),this.Hi.load()}Zi(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Oi)||e.enable())}_dom_loaded(){this.is_capturing()&&t3(this.__request_queue,e=>this.Pi(e)),this.__request_queue=[],this.Zi()}_handle_unload(){var e,t,r;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(t0),null==(t=this.Oi)||t.unload(),null==(r=this.Li)||r.unload()):this.Vi()&&this.capture(t0,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(sl?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=iM(e.url,{ip:+!!this.config.ip}),e.headers=_({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?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,
1(e=>{var t,r,i,s=_({},e);s.timeout=s.timeout||6e4,s.url=iM(s.url,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:s.compression});var n=null!=(t=s.transport)?t:"fetch",o=iA.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!=(r=null==(i=function(e,t){for(var r=0;e.length>r;r++)if(e[r].transport===n)return e[r]}(o))?void 0:i.method)?r:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===r5&&c?ij(s).then(e=>{a(e)}).catch(()=>{a(s)}):a(s)})(_({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))))}Pi(e){this.Li?this.Li.retriableRequest(e):this._send_request(e)}_execute_array(e){se++;try{var t,r=[],i=[],s=[];t3(e,e=>{e&&(F(t=e[0])?s.push(e):T(e)?e.call(this):F(e)&&"alias"===t?r.push(e):F(e)&&-1!==t.indexOf("capture")&&T(this[t])?s.push(e):i.push(e))});var n=function(e,t){t3(e,function(e){if(F(e[0])){var r=t;t4(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};n(r,this),n(i,this),n(s,this)}finally{se--}}push(e){if(se>0&&F(e)&&$(e[0])){var t=sp.prototype[e[0]];T(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!O(e)&&$(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!$(null==t?void 0:t.$current_url)&&(tn.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=r&&r.zi||tn.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 c=new Date,d=(null==r?void 0:r.timestamp)||c,h=rl(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===tQ&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var v,g=this.Yi(null==r?void 0:r.$set_once,e!==t2,e===t1);if(g&&(p.$set_once=g),null!=r&&r._noTruncate||(s=this.config.properties_string_max_length,n=p,o=e=>$(e)?e.slice(0,s):e,a=new Set,p=function e(t,r){var i;return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),F(t)?(i=[],t3(t,t=>{i.push(e(t))})):(i={},t4(t,(t,r)=>{a.has(t)||(i[r]=e(t,r))})),i)}(n)),p.timestamp=d,O(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),"survey dismissed"===e||e===rQ){var f,m,y,b=null==t?void 0:t.$survey_id,x=null==t?void 0:t.$survey_iteration;v={id:b,current_iteration:x},localStorage.getItem(i3(v))||localStorage.setItem(i3(v),"true"),p.$set=_({},p.$set,{[(f={id:b,current_iteration:x},y="$survey_"+(m=e===rQ?"responded":"dismissed")+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(y="$survey_"+m+"/"+f.id+"/"+f.current_iteration),y)]:!0})}else e===rZ&&(p.$set=_({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var w=null==t?void 0:t.$product_tour_type;w&&(p.$set=_({},p.$set,{["$product_tour_last_seen_date/"+w]:(new Date).toISOString()}))}var E=_({},p.properties.$set,p.$set);if(M(E)||this.setPersonPropertiesForFlags(E),!A(this.config.before_send)){var k=this.Ui(p);if(!k)return;p=k}this.ki.emit("eventCaptured",p);var S={method:"POST",url:null!=(i=null==r?void 0:r._url)?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Pi(S):this.Oi.enqueue(S),p}tn.critical("This capture call is ignored due to client rate limiting.")}}else tn.error("No event name provided to posthog.capture")}else tn.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,s,a){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var l,u=a?void 0:this.persistence.remove_event_timer(e),c=_({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,(this.config.cookieless_mode==tV||this.config.cookieless_mode==tK&&this.consent.isExplicitlyOptedOut())&&(c.$cookieless_mode=!0),"$snapshot"===e){var h=_({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!$(c.distinct_id)&&!L(c.distinct_id)||j(c.distinct_id))&&tn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,g=function(e,t){if(!d)return{};var i,s,n,a,l,u,c,h,p,g,f,_=e?[...rj,...t||[]]:[],[m,y]=function(e){for(var t=0;eq.length>t;t++){var[r,i]=eq[t],s=r.exec(e),n=s&&(T(i)?i(s,e):i);if(n)return n}return["",""]}(d);return t5(t7({$os:m,$os_version:y,$browser:eH(d,navigator.vendor),$device:eW(d),$device_type:(u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==r||null==(n=r.screen)?void 0:n.width,screenHeight:null==r||null==(a=r.screen)?void 0:a.height,devicePixelRatio:null==r?void 0:r.devicePixelRatio},(f=eW(d))===et||f===ee||"Kobo"===f||"Kindle Fire"===f||f===eI?Q:f===eb||f===ew||f===ex||f===eC?"Console":f===ei?"Wearable":f?J:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!=(c=null==u?void 0:u.maxTouchPoints)?c:0)>0?600>Math.min(null!=(h=null==u?void 0:u.screenWidth)?h:0,null!=(p=null==u?void 0:u.screenHeight)?p:0)/(null!=(g=null==u?void 0:u.devicePixelRatio)?g:1)?J:Q:"Desktop"),$timezone:rV(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:rM(null==o?void 0:o.href,_,rL),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:ez(d,navigator.vendor),$browser_language:rz(),$browser_language_prefix:"string"==typeof(l=rz())?l.split("-")[0]:void 0,$screen_height:null==r?void 0:r.screen.height,$screen_width:null==r?void 0:r.screen.width,$viewport_height:null==r?void 0:r.innerHe
1ight,$viewport_width:null==r?void 0:r.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId(a,i.getTime());c.$session_id=f,c.$window_id=m}this.sessionPropsManager&&t5(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&t5(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(l=this.Li)?void 0:l.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===iZ&&(c.$lib_custom_api_host=this.config.api_host),p=e!==tQ||a?e!==t0||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),c=t5(c,p),e===tQ&&n&&(c.title=n.title),!O(u)){var y=i.getTime()-u;c.$duration=parseFloat((y/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=t5({},g,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?t4(this.config.property_denylist,function(e){delete c[e]}):tn.error(sn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(tn.error(ss),c=b(c,e));var x=this.Wi();return c.$process_person_profile=x,x&&!a&&this.Gi("_calculate_event_properties"),c}Yi(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this.Wi()||this.Si&&!r)return e;var i,s=t5({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(tn.error(ss),s=n(s,"$set_once")),t&&(this.Si=!0),M(s)?void 0:s}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Xi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var r;return null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.ki.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:si}),()=>{})}onSessionId(e){var t,r;return null!=(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:si})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:si})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=i5),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!=(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))?t:{visible:!1,disabledReason:si}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!=(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))?r:Promise.resolve({visible:!1,disabledReason:si})}Ji(e){return!e||j(e)?(tn.critical("Unique user id has not been set in posthog.identify"),!1):e===tq?(tn.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(tn.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return tn.uninitializedWarning("posthog.identify");if(L(e)&&(e=e.toString(),tn.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(e)&&this.Gi("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(tc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(td)&&(this.unregister(td),this.register({distinct_id:e}));var s,n=(this.persistence.get_property(tj)||tG)===tG;e!==i&&n?(this.persistence.set_property(tj,tY),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(t1,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Ei=iG(e,t,r),null==(s=this.featureFlags)||s.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(tI))}}setPersonProperties(e,t){if((e||t)&&this.Gi("posthog.setPersonProperties")){var r=iG(this.get_distinct_id(),e,t);this.Ei!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=r):tn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var i=this.getGroups(),s=i[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},i,{[e]:t})}),s||r){var n={$group_type:e,$group_key:t};r&&(n.$group_set=r),this.capture(t2,n)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else tn.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(tn.info("reset"),!this.__loaded)return tn.uninitializedWarning("posthog.reset");var t,r,i,s,n,o,a,l,u=this.get_property(tc);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),null==(i=this.surveys)||i.reset(),null==(s=this.Hi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(tj,tG),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===tV)this.register_once({distinct_id:tq,$device_id:null},"");else{var c=this.config.get_device_id(rl());this.register_once({distinct_id:c,$device_id:e?c:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r.Ki()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qi()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&r){var s,n=null!=(s=e.timestampLookBack)?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-n,0)}return i}alias(e,t){return e===this.get_property(tu)?(tn.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(O(t)&&(t=this.get_distinct_id()),e!==t?(this.Xi(td,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);
1if(I(e)){t5(this.config,sd(e));var r,i,s,n,o,a,l,u,c,d=this.Fi();null==(r=this.persistence)||r.update_config(this.config,t,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rY(_({},this.config,{persistence:"sessionStorage"}),d);var h=this.Ri(this.config.debug);D(h)&&(this.config.debug=h),D(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,rv.Yt()&&rv.Xt("ph_debug",!0),tn.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(v.DEBUG=!1,rv.Yt()&&rv.Jt("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){v.LIB_NAME=e,v.LIB_VERSION=t}startSessionRecording(e){var t,r,i,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(_({},i,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!=(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:sa;return t!==sa&&(t=sa+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(tj))===tY||(null==(t=this.sessionPersistence)?void 0:t.get_property(tj))===tY}Wi(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===tX&&!this._isIdentified()&&M(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[td])&&(null==(t=this.persistence)||null==(t=t.props)||!t[tU]))}Vi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gi(e){return"never"===this.config.person_profiles?(tn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(tU,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==tK)}tn(){var e,t,r,i,s=this.Fi();return(null==(e=this.persistence)?void 0:e.gr)!==s&&(null==(r=this.persistence)||r.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.gr)!==s&&(null==(i=this.sessionPersistence)||i.set_disabled(s)),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==tV){if(this.config.cookieless_mode===tK&&this.consent.isExplicitlyOptedOut()){this.reset(!0),null==(s=this.sessionManager)||s.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new iB(this),this.pageViewManager=new rF(this),this.persistence&&(this.sessionPropsManager=new iz(this,this.sessionManager,this.persistence));var r,i,s,n,o,a,l,u=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=sp.__defaultExtensionClasses)?void 0:l.sessionRecording;u&&(this.sessionRecording=this.Ii(this.sessionRecording,new u(this)))}this.consent.optInOut(!0),this.tn(),this.Zi(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==tK&&(null==(r=this.surveys)||r.loadIfEnabled()),(O(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(i=null==e?void 0:e.captureEventName)?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else tn.warn(sr)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==tV?(this.config.cookieless_mode===tK&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===tK&&(this.register({distinct_id:tq,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(r=this.sessionRecording)||r.stopRecording(),this.sessionRecording=void 0,this.$i())):tn.warn(sr)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===tV||(this.config.cookieless_mode===tK?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return s?iK(s,this.config.custom_blocked_useragents):void 0}$i(){n&&("visible"===n.visibilityState?this.xi||(this.xi=!0,this.capture(tQ,{title:n.title},{send_instantly:!0}),this.Ti&&(n.removeEventListener(tJ,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),rt(n,tJ,this.Ti)))}debug(e){!1===e?(null==r||r.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==r||r.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Tr(){var e,t,r,i,s=this.Ni||{};return"advanced_disable_flags"in s?!!s.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tn.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):(t="advanced_disable_decide",r=(e="advanced_disable_flags")in s&&!A(s[e]),i=t in s&&!A(s[t]),r?s[e]:!!i&&(tn&&tn.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),s[t]))}Ui(e){if(A(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of t){if(A(r=i(r))){var s="Event '"+e.event+"' was rejected in beforeSend function";return H(e.event)?tn.warn(s+". This can cause unexpected behavior."):tn.info(s),null}r.properties&&!M(r.properties)||tn.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return null==(e=this.pageViewManager.lr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Ri(e){var t=D(e)&&!e,r=rv.Yt()&&"true"===rv.Wt("ph_debug");return!t&&(!!r||e)}}function sv(e){return e instanceof Element&&(e.id===tz||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sg(e){return!!e&&1===e.nodeType}function sf(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}
1function s_(e){return!!e&&3===e.nodeType}function sm(e){return!!e&&11===e.nodeType}function sy(e){return e?k(e).split(/\s+/):[]}function sb(e){var t=null==r?void 0:r.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function sx(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return sy(t)}function sw(e){return A(e)?null:k(e).split(/(\s+)/).filter(e=>sH(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sE(e){var t="";return sM(e)&&!sO(e)&&e.childNodes&&e.childNodes.length&&t4(e.childNodes,function(e){var r;s_(e)&&e.textContent&&(t+=null!=(r=sw(e.textContent))?r:"")}),k(t)}function sk(e){var t;return O(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}sp.__defaultExtensionClasses={},function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=t9(e.prototype[t[r]])}(sp,["identify"]);var sS=["a","button","form","input","select","textarea","label"];function sP(e,t){if(O(t))return!0;var r,i=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(r=i(s))return r.v;return!1}function sR(e){var t=e.parentNode;return!(!t||!sg(t))&&t}var sC=["next","previous","prev",">","<"],sF=[".ph-no-rageclick",".ph-no-capture"],sT=e=>!e||sf(e,"html")||!sg(e),sI=(e,t)=>{if(!r||sT(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],n=e;n.parentNode&&!sf(n,"body");)if(sm(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=sR(n);if(!o)break;if(t||sS.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=r.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}s.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:s}};function sM(e){for(var t=e;t.parentNode&&!sf(t,"body");t=t.parentNode){var r=sx(t);if(E(r,"ph-sensitive")||E(r,"ph-no-capture"))return!1}if(E(sx(e),"ph-include"))return!0;var i=e.type||"";if($(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!$(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 sO(e){return!!(sf(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sf(e,"select")||sf(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var s$="(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})",sj=RegExp("^(?:"+s$+")$"),sA=new RegExp(s$),sL="\\d{3}-?\\d{2}-?\\d{4}",sN=RegExp("^("+sL+")$"),sD=RegExp("("+sL+")");function sH(e,t){return void 0===t&&(t=!0),!(A(e)||$(e)&&(e=k(e),(t?sj:sA).test((e||"").replace(/[- ]/g,""))||(t?sN:sD).test(e)))&&!0}function sU(e){var t=sE(e);return sH(t=(t+" "+function e(t){var r="";return t&&t.childNodes&&t.childNodes.length&&t4(t.childNodes,function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var s=sE(t);r=(r+" "+s).trim(),t.childNodes&&t.childNodes.length&&(r=(r+" "+e(t)).trim())}catch(e){tn.error("[AutoCapture]",e)}}),r}(e)).trim())?t:""}function sz(e){return e.replace(/"|\\"/g,'\\"')}class sq{constructor(e){this.disabled=!1===e;var t=I(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var sW="$copy_autocapture",sB=to("[AutoCapture]");function sK(e,t){return t.length>e?t.slice(0,e)+"...":t}var sV=to("[ExceptionAutocapture]");function sG(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],s=r(i);return T(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=i}}catch(e){return()=>{}}}var sY=to("[TracingHeaders]"),sX=to("[Web Vitals]"),sJ="disabled",sZ="lazy_loading",sQ="awaiting_config",s0="missing_config";to("[SessionRecording]");var s1="[SessionRecording]",s2=to(s1),s3=to("[Heatmaps]");function s4(e){return I(e)&&"clientX"in e&&"clientY"in e&&L(e.clientX)&&L(e.clientY)}var s5=to("[Product Tours]"),s8="ph_product_tours",s6=["$set_once","$set"],s9=to("[SiteApps]"),s7="Error while initializing PostHog app with config id ";function ne(e,t,r){if(A(e))return!1;switch(r){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class nt{constructor(e){this.en=new iq,this.rn=(e,t)=>this.nn(e,t)&&this.sn(e,t)&&this.an(e,t)&&this.ln(e,t),this.nn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.un=new Set,this.hn=new Set}init(){var e,t;O(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,r;if(!O(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
1=>{var t,r;null==(t=this.hn)||t.add(e),null==(r=e.steps)||r.forEach(e=>{var t;null==(t=this.un)||t.add((null==e?void 0:e.event)||"")})}),null!=(r=this._instance)&&r.autocapture)){var i,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(i=this._instance)||i.autocapture.setElementSelectors(s)}}on(e,t){var r;null!=t&&0!=e.length&&(this.un.has(e)||this.un.has(null==t?void 0:t.event))&&this.hn&&(null==(r=this.hn)?void 0:r.size)>0&&this.hn.forEach(e=>{this.cn(t,e)&&this.en.emit("actionCaptured",e.name)})}dn(e){this.onAction("actionCaptured",t=>e(t))}cn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this.rn(e,r))return!0;return!1}onAction(e,t){return this.en.on(e,t)}sn(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i||!ne(i,t.url,t.url_matching||"contains"))return!1}return!0}an(e,t){return!!this.vn(e,t)&&!!this.fn(e,t)&&!!this.pn(e,t)}vn(e,t){if(null==t||!t.href)return!0;var r=this.gn(e);if(r.length>0)return r.some(e=>ne(e.href,t.href,t.href_matching||"exact"));var i,s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&ne((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}fn(e,t){if(null==t||!t.text)return!0;var r=this.gn(e);if(r.length>0)return r.some(e=>ne(e.text,t.text,t.text_matching||"exact")||ne(e.$el_text,t.text,t.text_matching||"exact"));var i,s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!A(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>ne(e,n,o)))}pn(e,t){if(null==t||!t.selector)return!0;var r,i,s=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}gn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}ln(e,t){return null==t||!t.properties||0===t.properties.length||iJ(t.properties.reduce((e,t)=>{var r=F(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class nr{constructor(e){this._instance=e,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(e,t){return!!e&&iJ(e.propertyFilters,null==t?void 0:t.properties)}_n(e,t){var r=new Map;return e.forEach(e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}})}),r}In(e,t,r){var i=(r===rX?this.mn:this.yn).get(e),s=[];return this.Cn(e=>{s=e.filter(e=>null==i?void 0:i.includes(e.id))}),s.filter(i=>{var s,n=null==(s=i.conditions)||null==(s=s[r])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this.wn(n,t)})}register(e){var t;O(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Sn(e),this.kn(e))}kn(e){var t=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0});0!==t.length&&(null==this.xn&&(this.xn=new nt(this._instance),this.xn.init(),this.xn.dn(e=>{this.onAction(e)})),t.forEach(e=>{var t,r,i,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(r=e.conditions)&&null!=(r=r.actions)&&r.values&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0&&(null==(s=this.xn)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var r=this.bn.get(t.name);r&&r.push(e.id),this.bn.set(t.name,r||[e.id])}}))}))}Sn(e){var t,r=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0}),i=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0});0===r.length&&0===i.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.mn=this._n(e,rX),this.yn=this._n(e,rJ))}onEvent(e,t){var r,i=this.re(),s=this.Tn(),n=this.An(),o=(null==(r=this._instance)||null==(r=r.persistence)?void 0:r.props[s])||[];if(n===e&&t&&o.length>0){i.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var a,l,u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.En(o))}}else{if(this.yn.has(e)){var d=this.In(e,t,rJ);d.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(e=>e.id)}
1),d.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.Rn(e.id)}),this.En(o))}if(this.mn.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this.mn.get(e)});var h=this.In(e,t,rX);this.En(o.concat(h.map(e=>e.id)||[]))}}}onAction(e){var t,r=this.Tn(),i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[r])||[];this.bn.has(e)&&this.En(i.concat(this.bn.get(e)||[]))}En(e){var t,r=this.re(),i=this.Tn(),s=[...new Set(e)].filter(e=>!this.Nn(e));r.info("updating activated items",{activatedItems:s}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[i]:s})}getActivatedIds(){var e,t=this.Tn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}}class ni extends nr{constructor(e){super(e)}Tn(){return"$surveys_activated"}An(){return rZ}Cn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Rn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}re(){return i1}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ns="SDK is not enabled or survey functionality is not yet loaded",nn="Disabled. Not loading surveys.",no=null!=r&&r.location?rO(r.location.hash,"__posthog")||rO(location.hash,"state"):null,na="_postHogToolbarParams",nl=to("[Toolbar]"),nu=to("[FeatureFlags]"),nc=to("[FeatureFlags]",{debugEnabled:!0}),nd="\" failed. Feature flags didn't load in time.",nh="$active_feature_flags",np="$override_feature_flags",nv="$feature_flag_payloads",ng="$override_feature_flag_payloads",nf="$feature_flag_request_id",n_=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},nm=e=>{var t={};for(var[r,i]of t8(e||{}))i&&(t[r]=i);return t},ny=to("[Error tracking]"),nb="Refusing to render web experiment since the viewer is a likely bot",nx={icontains:(e,t)=>!!r&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!r&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!r&&iV(t.href,e),not_regex:(e,t)=>!!r&&!iV(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nw{get Rt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{nw.Fn("retrieved web experiments from the server"),t.On=new Map,e.forEach(e=>{if(e.feature_flag_key){t.On&&(nw.Fn("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t.On)||r.set(e.feature_flag_key,e));var r,i=t._instance.getFeatureFlag(e.feature_flag_key);$(i)&&e.variants[i]&&t.Pn(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];nw.Ln(n)&&t.Pn(e.name,s,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())nw.Fn(nb);else if(!this.Rt.disable_web_experiments){if(A(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nw.Fn("applying feature flags",e),e.forEach(e=>{var t;if(this.On&&null!=(t=this.On)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),s=null==(r=this.On)?void 0:r.get(e);i&&null!=s&&s.variants[i]&&this.Pn(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){var e=nw.getWindowLocation();if(null!=e&&e.search){var t=rI(null==e?void 0:e.search,"__experiment_id"),r=rI(null==e?void 0:e.search,"__experiment_variant");t&&r&&(nw.Fn("previewing web experiments "+t+" && "+r),this.getWebExperiments(e=>{this.Dn(parseInt(t),r,e)},!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.Rt.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Dn(e,t,r){var i=r.filter(t=>t.id===e);i&&i.length>0&&(nw.Fn("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.Pn(i[0].name,t,i[0].variants[t].transforms))}static Ln(e){return!A(e.conditions)&&nw.Bn(e)&&nw.jn(e)}static Bn(e){if(A(e.conditions)||A(null==(t=e.conditions)?void 0:t.url))return!0;var t,r,i,s,n=nw.getWindowLocation();return!!n&&(null==(r=e.conditions)||!r.url||nx[null!=(i=null==(s=e.conditions)?void 0:s.urlMatchType)?i:"icontains"](e.conditions.url,n))}
1static getWindowLocation(){return null==r?void 0:r.location}static jn(e){if(A(e.conditions)||A(null==(r=e.conditions)?void 0:r.utm))return!0;var t=rD();if(t.utm_source){var r,i,s,n,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==t.utm_campaign,h=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return d&&p&&v&&h}return!1}static Fn(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];tn.info("[WebExperiments] "+e,r)}Pn(e,t,r){this._is_bot()?nw.Fn(nb):"control"!==t?r.forEach(r=>{if(r.selector){nw.Fn("applying transform of variant "+t+" for experiment "+e+" ",r);var i,s=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==s||s.forEach(e=>{r.html&&(e.innerHTML=r.html),r.css&&e.setAttribute("style",r.css)})}}):nw.Fn("Control variants leave the page unmodified.")}_is_bot(){return s&&this._instance?iK(s,this.Rt.custom_blocked_useragents):void 0}}var nE=to("[Conversations]"),nk="Conversations not available yet.",nS={featureFlags:class{constructor(e){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}Wn(e){return this._instance.get_property(e)}Gn(){var e,t;return null!=(e=null==(t=this.Kr)?void 0:t.mr(this.Rt.feature_flag_cache_ttl_ms))&&e}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,nu.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var e,t=null!=(e=this.Rt.evaluation_contexts)?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(nu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||nu.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Kn(){return this.Jn().length>0}initialize(){var e,t,{config:r}=this._instance,i=null!=(e=null==(t=r.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(i).length){var s,n,o=null!=(s=null==(n=r.bootstrap)?void 0:n.featureFlagPayloads)?s:{},a=Object.keys(i).filter(e=>!!i[e]).reduce((e,t)=>(e[t]=i[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,r){var i=null!=r&&r.merge?this.getFlagVariants():{},s=null!=r&&r.merge?this.getFlagPayloads():{},n=_({},i,e),o=_({},s,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:O(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Wn(tR),t=this.Wn(np),r=this.Wn(ng);if(!r&&!t)return e||{};var i=t5({},e||{});for(var s of[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])]){var n,o,a=i[s],l=null==t?void 0:t[s],u=O(l)?null!=(n=null==a?void 0:a.enabled)&&n:!!l,c=O(l)?a.variant:"string"==typeof l?l:void 0,d=null==r?void 0:r[s],h=_({},a,{enabled:u,variant:u?null!=c?c:null==a?void 0:a.variant:void 0});u!==(null==a?void 0:a.enabled)&&(h.original_enabled=null==a?void 0:a.enabled),c!==(null==a?void 0:a.variant)&&(h.original_variant=null==a?void 0:a.variant),d&&(h.metadata=_({},null==a?void 0:a.metadata,{payload:d,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),i[s]=h}return this.qn||(nu.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}
1),this.qn=!0),i}getFlagVariants(){var e=this.Wn(tS),t=this.Wn(np);if(!t)return e||{};for(var r=t5({},e),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this.qn||(nu.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.qn=!0),r}getFlagPayloads(){var e=this.Wn(nv),t=this.Wn(ng);if(!t)return e||{};for(var r=t5({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this.qn||(nu.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.qn=!0),r}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout(()=>{this.ts()},5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Hn=e}ts(e){var t;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var r=this.Rt.token,i=this.Wn(tc),s={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},(null==(t=this.Kr)?void 0:t.get_initial_props())||{},this.Wn(tC)||{}),group_properties:this.Wn(tF),timezone:rV()};null===i||O(i)||(s.$device_id=i),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Kn()&&(s.evaluation_contexts=this.Jn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Rt.disable_compression?void 0:r8,timeout:this.Rt.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,n=!0;if(200===e.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),n=!1),this.$n=!1,!s.disable_flags||this.Vn){this.zn=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(r=e.json)||null==(r=r.quotaLimited)||!r.includes("feature_flags"));(l&&o.push("quota_limited"),null==(i=this.Kr)||i.register({[tO]:o}),l)?nu.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."):(s.disable_flags||this.receivedFeatureFlags(null!=(a=e.json)?a:{},n),this.Vn&&(this.Vn=!1,this.ts()))}}})}}getFeatureFlag(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var i=this.getFeatureFlagResult(e,t);return null!=(r=null==i?void 0:i.variant)?r:null==i?void 0:i.enabled}}else nu.warn('getFeatureFlag for key "'+e+nd)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var r=this.getFlagVariants(),i=e in r,s=r[e],n=this.getFlagPayloads()[e],o=String(s),a=this.Wn(nf)||void 0,l=this.Wn(t$)||void 0,u=this.Wn(tI)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this.Wn(tM);d&&d!==h&&(u={},null==(c=this.Kr)||c.register({[tI]:u,[tM]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){F(u[e])?u[e].push(o):u[e]=[o],null==(f=this.Kr)||f.register({[tI]:u});var p=this.getFeatureFlagDetails(e),v=[...null!=(_=this.Wn(tO))?_:[]];O(s)&&v.push("flag_missing");var g={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(m=this.Rt.bootstrap)||null==(m
1=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.Rt.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.zn};O(null==p||null==(b=p.metadata)?void 0:b.version)||(g.$feature_flag_version=p.metadata.version);var f,_,m,y,b,x,w,E,k,S,P,R=null!=(x=null==p||null==(w=p.reason)?void 0:w.description)?x:null==p||null==(E=p.reason)?void 0:E.code;R&&(g.$feature_flag_reason=R),null!=p&&null!=(k=p.metadata)&&k.id&&(g.$feature_flag_id=p.metadata.id),O(null==p?void 0:p.original_variant)&&O(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=O(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(S=p.metadata)&&S.original_payload&&(g.$feature_flag_original_payload=null==p||null==(P=p.metadata)?void 0:P.original_payload),v.length&&(g.$feature_flag_error=v.join(",")),this._instance.capture("$feature_flag_called",g)}if(i){var C=n;if(!O(n))try{C=JSON.parse(n)}catch(e){}return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:C}}}}else nu.warn('getFeatureFlagResult for key "'+e+nd)}getRemoteConfigPayload(e,t){var r=this.Rt.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Kn()&&(i.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Rt.disable_compression?void 0:r8,timeout:this.Rt.feature_flag_request_timeout_ms,callback(r){var i,s=null==(i=r.json)?void 0:i.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return O(r)?void 0:!!r}nu.warn('isFeatureEnabled for key "'+e+nd)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.Kr){this.Zn=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,r,i,s){void 0===r&&(r={}),void 0===i&&(i={}),void 0===s&&(s={});var n,o=((n=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(n).map(e=>{var t;return[e,null!=(t=n[e].variant)?t:n[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>{var t;return null==(t=n[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=n[e].metadata)?void 0:t.payload]}))):nu.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(F(l)){nu.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(l)for(var p=0;l.length>p;p++)h[l[p]]=!0;t&&t.register({[nh]:l,[tS]:h})}else{var v=l,g=u,f=a;if(e.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter(e=>{var t;return!(null!=(t=a[e])&&t.failed)}));v=_({},r,Object.fromEntries(Object.entries(v).filter(e=>{var[t]=e;return m.has(t)}))),g=_({},i,Object.fromEntries(Object.entries(g||{}).filter(e=>{var[t]=e;return m.has(t)}))),f=_({},s,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return m.has(t)})))}else v=_({},r,v),g=_({},i,g),f=_({},s,f);t&&t.register(_({[nh]:Object.keys(nm(v)),[tS]:v||{},[nv]:g||{},[tR]:f||{}},c?{[nf]:c}:{},d?{[t$]:d}:{}))}}}(e,this.Kr,r,i,s),t||(this.Un=!1),this.rs(t)}}override(e,t){void 0===t&&(t=!1),nu.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Kr)return nu.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Kr.unregister(np),this.Kr.unregister(ng),this.rs(),nc.info("All overrides cleared");if(F(e)){var t,r=n_(e);return this.Kr.register({[np]:r}),this.rs(),nc.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.qn=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Kr.unregister(np),nc.info("Flag overrides cleared");else if(e.flags){if(F(e.flags)){var i=n_(e.flags);this.Kr.register({[np]:i})}else this.Kr.register({[np]:e.flags});nc.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Kr.unregister(ng),nc.info("Payload overrides cleared")):e.payloads&&(this.Kr.register({[ng]:e.payloads}),nc.info("Payload overrides set",{payloads:e.payloads}))),void this.rs()}if(e&&"object"==typeof e)return this.Kr.register({[np]:e}),this.rs(),nc.info("Flag overrides set",{flags:e});nu.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Zn){var{flags:t,flagVariants:r}=this.ns();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,s=(this.Wn(tP)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=_({},this.getFlagVariants(),{[e]:t});null==(i=this.Kr)||i.register({[nh]:Object.keys(nm(a)),[tS]:a}),this.rs()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this.Wn(tP),s=r?"&"+r.map(e=>"stage="+e).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:t=>{var r,i;if(t.json){var s=t.json.earlyAccessFeatures;return null==(r=this.Kr)||r.unregister(tP),null==(i=this.Kr)||i.register({[tP]:s}),e(s)}}})}ns(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,r)=>(e[r]=t[r],e),{})}}rs(e){var{flags:t,flagVariants:r}=this.ns();
1this.featureFlagEventHandlers.forEach(i=>i(t,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.Wn(tC)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in r||(n[o]=s[o]));this._instance.register({[tC]:_({},r,n,i)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(tC)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.Wn(tF)||{};0!==Object.keys(r).length&&Object.keys(r).forEach(t=>{r[t]=_({},r[t],e[t]),delete e[t]}),this._instance.register({[tF]:_({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Wn(tF)||{};this._instance.register({[tF]:_({},t,{[e]:{}})})}else this._instance.unregister(tF)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},nP=_({productTours:class{get Kr(){return this._instance.persistence}constructor(e){this.ho=null,this.co=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Kr&&this.Kr.register({[tb]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.ho||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(tb)||this.nr(()=>this.do())}nr(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",t=>{t?s5.error("Could not load product tours script",t):e()})}do(){var e;!this.ho&&null!=(e=h.__PosthogExtensions__)&&e.generateProductTours&&(this.ho=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!F(this.co)||t){var r=this.Kr;if(r){var i=r.props[s8];if(F(i)&&!t)return this.co=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return s5.error(s),void e([],{isLoaded:!1,error:s})}var n=F(t.json.product_tours)?t.json.product_tours:[];this.co=n,r&&r.register({[s8]:n}),e(n,{isLoaded:!0})}})}else e(this.co,{isLoaded:!0})}getActiveProductTours(e){A(this.ho)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.ho)||t.showTourById(e)}previewTour(e){this.ho?this.ho.previewTour(e):this.nr(()=>{var t;this.do(),null==(t=this.ho)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.ho)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.ho)||e.nextStep()}previousStep(){var e;null==(e=this.ho)||e.previousStep()}clearCache(){var e;this.co=null,null==(e=this.Kr)||e.unregister(s8)}resetTour(e){var t;null==(t=this.ho)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.ho)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.ho)||t.cancelPendingTour(e)}}},nS),nR=_({surveys:class{get Rt(){return this._instance.config}constructor(e){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(A(t))return i1.warn("Flags not loaded yet. Not loading surveys.");var r=F(t);this._o=r?t.length>0:t,i1.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);(null!=r&&r.startsWith(i2)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)i1.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)i1.info(nn);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())i1.info("Not loading surveys in cookieless mode without consent.");else{var e=null==h?void 0:h.__PosthogExtensions__;if(e){if(!O(this._o)||this.Rt.advanced_enable_surveys){var t=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var r=e.generateSurveys;if(r)return void this.ko(r,t);var i=e.loadExternalDependency;if(!i)return void this.xo(tB);i(this._instance,"surveys",r=>{r||!e.generateSurveys?this.xo("Could not load surveys script",r):this.ko(e.generateSurveys,t)})}catch(e){throw this.xo("Error initializing surveys",e),e}finally{this.Io=!1}}}else i1.error("PostHog Extensions not found.")}}ko(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new ni(this._instance),i1.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(e,t){i1.error(e,t),this.To({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Co.push(e),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Rt.disable_surveys)return i1.info(nn),e([]);var r,i=this._instance.get_property(tT);if(i&&!t)return e(i,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then(t=>{var{surveys:r,context:i}=t;return e(r,i)}):("undefined"!=typeof Promise&&(this.So=new Promise(e=>{r=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:t=>{this.So=null;var i=t.statusCode;if(200!==i||!t.json){var s="Surveys API could not be loaded, status: "+i;i1.error(s);var n={isLoaded:!1,error:s};return e([],n),void(null==r||r({surveys:[],context:n}))}var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,r;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)||!r.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[tT]:l});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}
1To(e){for(var t of this.Co)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){i1.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);i1.warn("init was not called")}Ao(e){var t=null;return this.getSurveys(r=>{var i;t=null!=(i=r.find(t=>t.id===e))?i:null}),t}Eo(e){if(A(this._surveyManager))return{eligible:!1,reason:ns};var t="string"==typeof e?this.Ao(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(A(this._surveyManager))return i1.warn("init was not called"),{visible:!1,disabledReason:ns};var t=this.Eo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return A(this._surveyManager)?(i1.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ns})):new Promise(r=>{this.getSurveys(t=>{var i,s=null!=(i=t.find(t=>t.id===e))?i:null;if(s){var n=this.Eo(s);r({visible:n.eligible,disabledReason:n.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var i;if(A(this._surveyManager))i1.warn("init was not called");else{var s="string"==typeof e?this.Ao(e):e;if(null!=s&&s.id)if(i4.includes(s.type)){var o=null==n?void 0:n.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(i1.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;i1.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,o,r),i1.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,r);i1.warn("Survey element not found")}else i1.warn("Surveys of type "+s.type+" cannot be rendered in the app");else i1.warn("Survey not found")}}displaySurvey(e,t){var r;if(A(this._surveyManager))i1.warn("init was not called");else{var i=this.Ao(e);if(i){var s=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=_({},i,{appearance:_({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==r0&&t.initialResponses&&i1.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(i);if(!n.visible)return void i1.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else i1.warn("Survey not found")}}cancelPendingSurvey(e){A(this._surveyManager)?i1.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},nS),nC=_({experiments:nw},nS),nF=_({},nS,{sessionRecording:class{get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}get started(){var e;return!(null==(e=this.ss)||!e.isStarted)}get status(){var e,t;return this.os===sQ||this.os===s0?this.os:null!=(e=null==(t=this.ss)?void 0:t.status)?e:this.os}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=sJ,this.ls=void 0,this._instance=e,!this._instance.sessionManager)throw s2.error("started without valid sessionManager"),Error(s1+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===tV)throw Error(s1+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var e,t=!(null==(e=this._instance.get_property(tw))||!e.enabled),i=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return r&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.us||null==(t=this.ss)||!t.isStarted){var r=!O(Object.assign)&&!O(Array.from);this.us&&r?(this.hs(e),s2.info("starting")):(this.os=sJ,this.stopRecording())}}hs(e){var t,r,i;this.us&&(this.os!==sQ&&this.os!==s0&&(this.os=sZ),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=h.__PosthogExtensions__)&&r.initSessionRecording?this.cs(e):null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.ds,t=>{if(t)return s2.error("could not load recorder",t);this.cs(e)}))}stopRecording(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.stop()}vs(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.discard()}fs(){var e;
1null==(e=this.Kr)||e.unregister(tk)}ps(e,t){if(A(e))return null;var r=L(e)?e:parseFloat(e);return"number"!=typeof r||!Number.isFinite(r)||0>r||r>1?(s2.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}gs(e){if(this.Kr){var t,r,i=this.Kr,s=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,s=this.ps(null==(t=this.Rt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.ps(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=s?s:n;A(o)&&this.fs();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[tw]:_({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:_({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:O(a)?null:a,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers})})};s(),null==(t=this.ls)||t.call(this),this.ls=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(s)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.gs(e),void this.vs()):(this.gs(e),void this.startIfEnabledOrStop()):(this.os===sQ&&(this.os=s0,s2.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this.ss)&&r.log?this.ss.log(e,t):s2.warn("log called before recorder was ready")}get ds(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tw);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}ys(){var e,t=this._instance.get_property(tw);if(!t)return!1;var r=null!=(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)?e:Date.now();return 36e5>=Date.now()-r}cs(e){var t,r;if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return s2.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ss||(this.ss=null==(r=h.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===s0||this.os===sQ)return;return this.os=sQ,s2.info("persisted remote config is stale, requesting fresh config before starting"),void new r4(this._instance).load()}this.os=sZ,this.ss.start(e)}onRRwebEmit(e){var t;null==(t=this.ss)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_linked_flag:!0}),null==(e=this.ss)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_sampling:!0}),null==(e=this.ss)||e.overrideSampling()}overrideTrigger(e){var t,r;this.ss||null==(r=this.Kr)||r.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.ss)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.ss)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this.ss)||!r.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.bs=!1,this.ws=null,this._s=!1,this.instance=e,this.rageclicks=new sq(e.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,r=I(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=null==(e=r.url_allowlist)?void 0:e.map(e=>new RegExp(e)),r.url_ignorelist=null==(t=r.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),r}Cs(){if(this.isBrowserSupported()){if(r&&n){var e=e=>{e=e||(null==r?void 0:r.event);try{this.Ss(e)}catch(e){sB.error("Failed to capture event",e)}};if(rt(n,"submit",e,{capture:!0}),rt(n,"change",e,{capture:!0}),rt(n,"click",e,{capture:!0}),this.Rt.capture_copied_text){var t=e=>{this.Ss(e=e||(null==r?void 0:r.event),sW)};rt(n,"copy",t,{capture:!0}),rt(n,"cut",t,{capture:!0})}}}else sB.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}
1onRemoteConfig(e){e.elementsChainAsString&&(this._s=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[tp]:!!e.autocapture_opt_out}),this.ws=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Is=e}getElementSelectors(e){var t,r=[];return null==(t=this.Is)||t.forEach(t=>{var i=null==n?void 0:n.querySelectorAll(t);null==i||i.forEach(i=>{e===i&&r.push(t)})}),r}get isEnabled(){var e,t,r=null==(e=this.instance.persistence)?void 0:e.props[tp];if(null===this.ws&&!D(r)&&!this.instance.Tr())return!1;var i=null!=(t=this.ws)?t:!!r;return!!this.instance.config.autocapture&&!i}Ss(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=sk(e);s_(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!r||sT(e)||(D(t)?(i=!!t&&sF,s=void 0):(i=null!=(n=null==t?void 0:t.css_selector_ignorelist)?n:sF,s=null==t?void 0:t.content_ignorelist),!1===i))return!1;var i,s,n,{targetElementList:o}=sI(e,!1);return!function(e,t){var r;if(!1===e||O(e))return!1;if(!0===e)r=sC;else{if(!F(e))return!1;if(e.length>10)return tn.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:i}=e;return r.some(e=>t.includes(e)||i.includes(e))})}(s,o.map(e=>{var t;return{safeText:sE(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!sP(o,i)}(s,this.instance.config.rageclick)&&this.Ss(e,"$rageclick");var n=t===sW;if(s&&function(e,t,i,s,n){if(void 0===i&&(i=void 0),!r||sT(e)||null!=(o=i)&&o.url_allowlist&&!sb(i.url_allowlist)||null!=(a=i)&&a.url_ignorelist&&sb(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var o,a,l,u,c=i.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:d,targetElementList:h}=sI(e,s);if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(O(r))return!0;var i,s=function(e){if(r.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(i=s(n))return i.v;return!1}(h,i)||!sP(h,null==(u=i)?void 0:u.css_selector_allowlist))return!1;var p=r.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return d?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(sS.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Rt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],d=e;d.parentNode&&!sf(d,"body");)sm(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,p=[],v={},g=!1,f=!1;if(t4(c,e=>{var t=sM(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&sH(g)&&g),E(sx(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,r,i){var s=e.tagName.toLowerCase(),n={tag_name:s};sS.indexOf(s)>-1&&!r&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?sK(1024,sU(e)):sK(1024,sE(e)));var o=sx(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),t4(e.attributes,function(r){var s;if((!sO(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&sH(r.value)&&(!$(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=r.value;"class"===r.name&&(o=sy(o).join(" ")),n["attr__"+r.name]=sK(1024,o)}});for(var a=1,l=1,u=e;u=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!sg(t))return t}(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),t5(v,function(e){if(!sM(e))return{};var t={};return t4(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&sH(i)&&(t[r]=i)}}),t}(e))}),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?sU(e):sE(e)),g){p[0].attr__href=g;var m,y,b=null==(m=rT(g))?void 0:m.host,x=null==r||null==(y=r.location)?void 0:y.host;b&&x&&b!==x&&(h=g)}return{props:t5({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,r,i,s={text:null==(r=e.$el_text)?void 0:r.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:(t=e.attr__class)?F(t)?t:sy(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return t8(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}
1).forEach(e=>{var[t,r]=e;return s.attributes[t]=r}),s}).map(e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var n=_({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(r=e.nth_of_type)?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return t8(n).sort((e,t)=>{var[r]=e,[i]=t;return r.localeCompare(i)}).forEach(e=>{var[t,r]=e;return o[sz(t.toString())]=sz(r.toString())}),(i+=":")+t8(o).map(e=>{var[t,r]=e;return t+'="'+r+'"'}).join("")}).join(";")},null!=(i=p[0])&&i.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},v)}}(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===sW){var u,c=sw(null==r||null==(u=r.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return T(null==n?void 0:n.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ks=(null==r||null==(t=r.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tn.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,tn.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(r&&r.history){var i=this;null!=(e=r.history.pushState)&&e.__posthog_wrapped__||sG(r.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i.Ts("pushState")}),null!=(t=r.history.replaceState)&&t.__posthog_wrapped__||sG(r.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i.Ts("replaceState")}),this.As()}}Ts(e){try{var t,i=null==r||null==(t=r.location)?void 0:t.pathname;if(!i)return;i!==this.ks&&this.isEnabled&&this._instance.capture(tQ,{navigation_type:e}),this.ks=i}catch(t){tn.error("Error capturing "+e+" pageview",t)}}As(){if(!this.xs){var e=()=>{this.Ts("popstate")};rt(r,"popstate",e),this.xs=()=>{r&&r.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=e,this.Es=!(null==(t=this.instance.persistence)||!t.props[tv]),this.rageclicks=new sq(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return I(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return A(this.Rt.capture_heatmaps)?A(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.bs||(s3.info("starting..."),this.Ns(),this.Tt());else{var e;clearInterval(null!=(e=this.Rs)?e:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tv]:t}),this.Es=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Fs(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Ns(){r&&n&&(this.Os=this.Zr.bind(this),rt(r,tZ,this.Os),this.Ps=e=>this.wt(e||(null==r?void 0:r.event)),rt(n,"click",this.Ps,{capture:!0}),this.Ls=e=>this.Ds(e||(null==r?void 0:r.event)),rt(n,"mousemove",this.Ls,{capture:!0}),this.Bs=new rk(this.instance,rw,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),rt(n,tJ,this.js),this.bs=!0)}Ms(){var e;r&&n&&(this.Os&&r.removeEventListener(tZ,this.Os),this.Ps&&n.removeEventListener("click",this.Ps,{
1capture:!0}),this.Ls&&n.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&n.removeEventListener(tJ,this.js),clearTimeout(this.qs),null==(e=this.Bs)||e.stop(),this.bs=!1)}Zs(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var s=e;s&&sg(s)&&!sf(s,"body")&&s!==i;){if(E(t,null==r?void 0:r.getComputedStyle(s).position))return!0;s=sR(s)}return!1}(sk(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}wt(e,t){var r;if(void 0===t&&(t="click"),!sv(e.target)&&s4(e)){var i=this.Zs(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.$s(_({},i,{type:"rageclick"})),this.$s(i)}}Ds(e){!sv(e.target)&&s4(e)&&(clearTimeout(this.qs),this.qs=setTimeout(()=>{this.$s(this.Zs(e,"mousemove"))},500))}$s(e){if(r){var t=r.location.href,i=this.Rt.custom_personal_data_properties,s=rM(t,this.Rt.mask_personal_data_properties?[...rj,...i||[]]:[],rL);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(e)}}Zr(){this.T&&!M(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rk,webVitalsAutocapture:class{constructor(e){var t;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((e,t)=>_({},e,{["$web_vitals_"+t.name+"_event"]:_({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=e=>{var t,r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(O(r))sX.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.zs();O(i)||(A(null==e?void 0:e.name)||A(null==e?void 0:e.value)?sX.error("Invalid metric received",e):!this.Ys||this.Ys>e.value?(this.T.url!==i&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),O(this.T.url)&&(this.T.url=i),this.T.firstMetricTimestamp=O(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(_({},e,{$current_url:i,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):sX.error("Ignoring metric with value >= "+this.Ys,e))}},this.Us=()=>{if(!this.bs){var e,t,r,i,s=h.__PosthogExtensions__;O(s)||O(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:r,onINP:i}=s.postHogWebVitalsCallbacks),e&&t&&r&&i?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.nt.bind(this)),this.bs=!0):sX.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Es=!(null==(t=this._instance.persistence)||!t.props[tm]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=I(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return A(r)?(null==(t=this._instance.persistence)?void 0:t.props[tx])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(I(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=I(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}get Ys(){var e=I(this.Ws)&&L(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==o?void 0:o.protocol;if("http:"!==e&&"https:"!==e)return sX.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=I(this.Ws)?this.Ws.web_vitals:D(this.Ws)?this.Ws:void 0;return D(t)?t:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(sX.info("enabled, starting..."),this.nr(this.Us))}onRemoteConfig(e){if("capturePerformance"in e){var t=I(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=I(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tm]:t}),this._instance.persistence.register({[tx]:r})),this.Es=t,this.startIfEnabled()}}nr(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?sX.error("failed to load script",t):e()})}zs(){var e=r?r.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return rM(e,this._instance.config.mask_personal_data_properties?[...rj,...t||[]]:[],rL)}sX.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,i,s;this.Us=()=>{var e;if(r&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=t(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=i(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=s(this.captureException.bind(this)))}catch(e){sV.error("failed to start",e),this.Ks()}}},this._instance=e,this.Qs=!(null==(t=this._instance.persistence)||!t.props[tg]),this.eo=new V({refillRate:null!=(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?i:1,bucketSize:null!=(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?s:10,refillInterval:1e4,qt:sV}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return I(e)?t=_({},t,e):(O(e)?this.Qs:e)&&(t=_({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(sV.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}nr(e){var t,r;
1null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return sV.error("failed to load script",t);e()})}Ks(){var e,t,r;null==(e=this.Gs)||e.call(this),this.Gs=void 0,null==(t=this.Xs)||t.call(this),this.Xs=void 0,null==(r=this.Js)||r.call(this),this.Js=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Qs=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tg]:this.Qs}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(e){var t,r,i,s=null!=(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)?t:"Exception";this.eo.consumeRateLimit(s)?sV.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this.io=[],this.no=new eK([new e3,new ti,new e5,new e4,new tt,new te,new e6,new tr],function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var s=[],n=t.split("\n"),o=i;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=e2.test(a)?a.replace(e2,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){s.push(c);break}}if(s.length>=50)break}}}if(!s.length)return[];var d=Array.from(s);return d.reverse(),d.slice(0,50).map(e=>_({},e,{filename:e.filename||(d[d.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",eZ,e1)),this._instance=e,this.io=null!=(t=null==(r=this._instance.persistence)?void 0:r.get_property(tf))?t:[]}onRemoteConfig(e){var t,r,i;if("errorTracking"in e){var s=null!=(t=null==(r=e.errorTracking)?void 0:r.suppressionRules)?t:[],n=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this.io=s,this._instance.persistence&&this._instance.persistence.register({[tf]:this.io,[t_]:n})}}get so(){var e,t=!!this._instance.get_property(t_),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=r?r:t)&&e}buildProperties(e,t){return this.no.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.oo(t)){if(this.ao(t))return void ny.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(t))return void ny.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(t))return void ny.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}ao(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:r,value:i}=t;return $(r)&&r.length>0&&e.$exception_types.push(r),$(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.io.some(e=>{var r=e.values.map(e=>{var r,i=iY[e.operator],s=F(e.value)?e.value:[e.value],n=null!=(r=t[e.key])?r:[];return s.length>0&&i(s,n)});return"OR"===e.type?r.some(Boolean):r.every(Boolean)})}lo(e){return e.flatMap(e=>{var t,r;return null!=(t=null==(r=e.stacktrace)?void 0:r.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}uo(e){if(e.length>0){var t,r,i,s,n=null!=(t=null==(r=e[0].stacktrace)?void 0:r.frames)?t:[],o=n[n.length-1];return null!=(i=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&i}return!1}oo(e){return!A(e)&&F(e)}}},nP,{siteApps:class{constructor(e){this._instance=e,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(e,t){if(t){var r=this.globalsForEvent(t);this.vo.push(r),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{e(),this.vo=[],this.po=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,r,i,s,n,o,a,l={},u=this._instance.get_property("$groups")||[];for(var[c,d]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:d};var{$set_once:h,$set:p}=e;return{event:_({},m(e,s6),{properties:_({},e.properties,p?{$set:_({},null!=(t=null==(r=e.properties)?void 0:r.$set)?t:{},p)}:{},h?{$set_once:_({},null!=(i=null==(s=e.properties)?void 0:s.$set_once)?i:{},h)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this.vo.length&&(s9.info("Processing "+this.vo.length+" events for site app with id "+e.id),this.vo.forEach(e
1=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(r=this.po)||r.call(this))},i=!1,s=s=>{t.errored=!s,t.loaded=!0,s9.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&r()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){s(e)}});n&&(t.processEvent=n),i=!0}catch(t){s9.error(s7+e.id,t),s(!1)}if(i&&t.loaded)try{r()}catch(r){s9.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}mo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}yo(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{null==r.processEvent||r.processEvent(t)}catch(t){s9.error("Error while processing event "+e.event+" for site app "+r.id,t)}}}onRemoteConfig(e){var t,r,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",e=>this.yo(e))):void s9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this.po)||r.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var n=function(e){var t;h["__$$ph_site_app_"+e]=s._instance,null==(t=h.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return s9.error(s7+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else s9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},nR,{tracingHeaders:class{constructor(e){this.bo=void 0,this.wo=void 0,this.Us=()=>{var e,t;O(this.bo)&&(null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),O(this.wo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}nr(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return sY.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(e=this.bo)||e.call(this),null==(t=this.wo)||t.call(this),this.bo=void 0,this.wo=void 0)}}},{toolbar:class{constructor(e){this.instance=e}Ro(e){h.ph_toolbar_state=e}No(){var e;return null!=(e=h.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),rr(this.instance.config)||!r||!n)return!1;e=null!=e?e:r.location,i=null!=i?i:r.history;try{if(!t){try{r.localStorage.setItem("test","test"),r.localStorage.removeItem("test")}catch(e){return!1}t=null==r?void 0:r.localStorage}var s,o=no||rO(e.hash,"__posthog")||rO(e.hash,"state"),a=o?t6(()=>JSON.parse(atob(decodeURIComponent(o))))||t6(()=>JSON.parse(decodeURIComponent(o))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(na)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Mo(e){var t=h.ph_load_toolbar||h.ph_load_editor;!A(t)&&T(t)?t(e,this.instance):nl.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==n||!n.getElementById(tz));if(!r||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=_({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});return(r.localStorage.setItem(na,JSON.stringify(_({},o,{source:void 0}))),2===this.No())?this.Mo(o):0===this.No()&&(this.Ro(1),null==(t=h.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{e?(nl.error("[Toolbar] Failed to load",e),this.Ro(0)):(this.Ro(2),this.Mo(o))}),rt(r,"turbolinks:load",()=>{this.Ro(0),this.loadToolbar(o)})),!0}Fo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},nC,{conversations:class{constructor(e){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;A(t)||(D(t)?this.Oo=t:(this.Oo=t.enabled,this.Lo=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||rr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==h?void 0:h.__PosthogExtensions__;if(e&&!O(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var t=e.initConversations;if(t)return this.Do(t),void(this.Po=!1);var r=e.loadExternalDependency;if(!r)return void this.Bo(tB);r(this._instance,"conversations",t=>{t||!e.initConversations?this.Bo("Could not load conversations script",t):this.Do(e.initConversations),this.Po=!1})}catch(e){this.Bo("Error initializing conversations",e),this.Po=!1}}else nE.error("Conversations enabled but missing token in remote config.")}}Do(e){if(this.Lo)try{this._conversationsManager=e(this.Lo,this._instance),nE.info("Conversations loaded successfully")}catch(e){this.Bo("Error completing conversations initialization",e)}else nE.error("Cannot complete initialization: remote config is null")}Bo(e,t){nE.error(e,t),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():nE.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&null!==this._conversationsManager}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,r){var i=this;return f(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(nE.warn(nk),null)})()}getMessages(e,t){var r=this;return f(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(nE.warn(nk),null)})()}markAsRead(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(nE.warn(nk),null)})()}getTickets(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(nE.warn(nk),null)})()}requestRestoreLink(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(nE.warn(nk),null)})()}restoreFromToken(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(nE.warn(nk),null)})()}restoreFromUrlToken(){var e=this;return f(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(nE.warn(nk),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Ki(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Qi(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.jo=!1,this.qo=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=null==(t=e.logs)?void 0:t.captureConsoleLogs;!A(r)&&r&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var e=to("[logs]"),t=null==h?void 0:h.__PosthogExtensions__;if(t){var r=t.loadExternalDependency;r?r(this._instance,"logs",r=>{var i;r||null==(i=t.logs)||!i.initializeLogs?e.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.qo=!0)}):e.error(tB)}else e.error("PostHog Extensions not found.")}}}});sp.__defaultExtensionClasses=_({},nF);var nT,nI,nM=(nI=i7[sa]=new sp,function(){function e(){e.done||(e.done=!0,sl=!1,t4(i7,function(e){e._dom_loaded()}))}null!=n&&n.addEventListener?"complete"===n.readyState?e():rt(n,"DOMContentLoaded",e,{capture:!1}):r&&tn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nI);e.s(["default",()=>nM],69150);var nO=e.i(48897),n$=(0,nO.createContext)({get client(){return t},bootstrap:void 0});function nj(e){var r,i,s=e.children,n=e.client,o=e.apiKey,a=e.options,l=(0,nO.useRef)(null),u=(0,nO.useMemo)(function(){if(n)return o&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),a&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n;var e=t;return o||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),e},[n,o,JSON.stringify(a)]);return(0,nO.useEffect)(function(){if(!n){var e=t,r=l.current;r?(o!==r.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),a&&!function e(t,r,i){if(void 0===i&&(i=new WeakMap),t===r)return!0;
1if("object"!=typeof t||null===t||"object"!=typeof r||null===r)return!1;if(i.has(t)&&i.get(t)===r)return!0;i.set(t,r);var s=Object.keys(t),n=Object.keys(r);if(s.length!==n.length)return!1;for(var o=0;o<s.length;o++){var a=s[o];if(!n.includes(a)||!e(t[a],r[a],i))return!1}return!0}(a,r.options)&&e.set_config(a)):(e.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),e.init(o,a)),l.current={apiKey:o,options:null!=a?a:{}}}},[n,o,JSON.stringify(a)]),nO.default.createElement(n$.Provider,{value:{client:u,bootstrap:null!=(r=null==a?void 0:a.bootstrap)?r:null==(i=null==n?void 0:n.config)?void 0:i.bootstrap}},s)}var nA=function(e){return"function"==typeof e},nL=function(){return(0,nO.useContext)(n$).client},nN=function(e,t){return(nN=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var nD={componentStack:null,exceptionEvent:null,error:null};!function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=r}function r(t){var r=e.call(this,t)||this;return r.state=nD,r}nN(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r.prototype.componentDidCatch=function(e,t){var r,i=this.props.additionalProperties;nA(i)?r=i(e):"object"==typeof i&&(r=i);var s=this.context.client.captureException(e,r),n=t.componentStack;this.setState({error:e,componentStack:null!=n?n:null,exceptionEvent:s})},r.prototype.render=function(){var e=this.props,t=e.children,r=e.fallback,i=this.state;if(null==i.componentStack)return nA(t)?t():t;var s=nA(r)?nO.default.createElement(r,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent}):r;return nO.default.isValidElement(s)?s:(console.warn("[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."),nO.default.createElement(nO.default.Fragment,null))},r.contextType=n$}(nO.default.Component),t=nM,e.s(["PostHogProvider",()=>nj,"usePostHog",()=>nL],2115)},22106,e=>{"use strict";var t=e.i(43171),r=e.i(69150),i=e.i(2115),s=e.i(48897);function n({children:e}){return(0,s.useEffect)(()=>{r.default.init("phc_BeAuSV4pQbRYYAjATU8xhGPvpzei36wbmJLo6fVcyoU8",{api_host:"https://eu.i.posthog.com",person_profiles:"identified_only",capture_pageview:!1,capture_pageleave:!0})},[]),(0,t.jsx)(i.PostHogProvider,{client:r.default,children:e})}e.s(["PHProvider",()=>n])},87636,e=>{"use strict";var t=e.i(91716),r=e.i(48897),i=e.i(2115);function s(){let e=(0,t.usePathname)(),s=(0,t.useSearchParams)(),n=(0,i.usePostHog)();return(0,r.useEffect)(()=>{if(e&&n){let t=window.origin+e;s&&s.toString()&&(t+=`?${s.toString()}`),n.capture("$pageview",{$current_url:t})}},[e,s,n]),null}e.s(["PostHogPageView",()=>s])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.