Release of @iterate-com/ui from b22794d07c154c8c27875d3fe8c4eb4c948d469b
ui release builder, 2026-11-27 06:57 UTC · e5f945f207fcf199bd8b924a3def5378f23dd63a · parent 0923252
8 files changed
- M dist/chunks/app-shell.mjs
- D dist/chunks/vendor-posthog.mjs
- D dist/components/not-recorded.mjs
- D dist/components/posthog.mjs
- M dist/components/route-defaults.mjs
- M files.json
- M package.json
- M release.json
M dist/chunks/app-shell.mjs
@@ -1,1 +1,1 @@ -import{r as e}from"./rolldown-runtime.mjs";import{a as t,i as n,n as r}from"./vendor-react";import{wipeSavedLogTails as i}from"../lib/saved-log-tail";import{C as a,Dt as o,Et as s,Mt as c,mt as l,q as u}from"./vendor-icons";import{c as d,i as f}from"./ui-base";import{I as p,J as m,K as h,N as g,P as _,a as v,g as y,h as b,i as x,j as S,o as C,r as w,t as T,u as E,z as D}from"./ui-shell";import{t as O}from"./iterate-logo.mjs";import{i as ee,l as te,o as ne,r as k,s as A,t as j,u as M}from"./command.mjs";import{C as N,b as P,c as re,d as F,h as I,m as L,n as ie,r as ae,t as R,u as z,w as B,x as V}from"./sidebar.mjs";import{plainLeftClick as H}from"../lib/plain-left-click";import{resetPosthog as U}from"../components/posthog";var W=/* @__PURE__ */ e(t(),1),G=/* @__PURE__ */ e(n(),1);function K(e,t){let n=t.trim().toLowerCase(),r=n.split(/\s+/).filter(Boolean),i=e.filter(e=>{let t=`${e.label} ${e.detail||``}`.toLowerCase();return r.every(e=>t.includes(e))}),a=/* @__PURE__ */ new Map;for(let e of i)a.set(e.group,[...a.get(e.group)||[],e]);return[...a].map(([e,t])=>({group:e,entries:n?[...t.filter(e=>e.label.toLowerCase().startsWith(n)),...t.filter(e=>!e.label.toLowerCase().startsWith(n))]:t}))}function q(e){return!e||e.closest(`[data-mobile]`)?[]:[...e.querySelectorAll(`[data-slot="sidebar-menu-button"], [data-slot="sidebar-menu-sub-button"]`)].flatMap(e=>{if(e.matches(`:disabled, [aria-disabled="true"]`))return[];let[t,...n]=J(e),r=t||e.getAttribute(`aria-label`)?.trim();if(!r)return[];let i=e.closest(`[data-slot="sidebar-group"]`),a=e.dataset.slot===`sidebar-menu-sub-button`?e.closest(`[data-slot="sidebar-menu-sub"]`)?.closest(`[data-slot="sidebar-menu-item"]`)?.querySelector(`[data-slot="sidebar-menu-button"]`):null;return[{element:e,label:r,group:J(i?.querySelector(`[data-slot="sidebar-group-label"]`))[0]||`Pages`,detail:J(a)[0]||n.join(` · `)||void 0,active:e.hasAttribute(`data-active`),href:e instanceof HTMLAnchorElement?e.href:void 0}]})}function J(e){if(!e)return[];let t=/* @__PURE__ */ new Map,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let r=n.nextNode();r;r=n.nextNode()){let n=r.parentNode||e;t.set(n,`${t.get(n)||``}${r.nodeValue||``}`)}return[...t.values()].map(e=>e.replace(/\s+/g,` `).trim()).filter(Boolean)}var Y=/* @__PURE__ */ e(r(),1);const oe=()=>()=>{};function se(){return(0,W.useSyncExternalStore)(oe,()=>/Mac|iPhone|iPad/.test(navigator.platform)?`⌘K`:`Ctrl K`,()=>`⌘K`)}function ce(e){(0,W.useEffect)(()=>{if(!e)return;function t(t){t.defaultPrevented||t.altKey||t.shiftKey||(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e?.())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function le({onOpen:e}){let t=se();return/* @__PURE__ */ (0,Y.jsx)(F,{children:/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsxs)(L,{type:`button`,tooltip:`Search (${t})`,onClick:e,children:[/* @__PURE__ */ (0,Y.jsx)(a,{}),/* @__PURE__ */ (0,Y.jsx)(`span`,{children:`Search`}),/* @__PURE__ */ (0,Y.jsx)(`kbd`,{className:`ml-auto font-sans text-xs text-muted-foreground`,children:t})]})})})}function ue({onOpen:e}){return/* @__PURE__ */ (0,Y.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":`Search`,title:`Search`,onClick:e,children:/* @__PURE__ */ (0,Y.jsx)(a,{})})}function de({nav:e,entries:t,onClose:n}){return/* @__PURE__ */ (0,Y.jsx)(S,{open:!!e,onOpenChange:e=>{e||n()},children:/* @__PURE__ */ (0,Y.jsxs)(g,{showCloseButton:!1,className:`top-[12svh] translate-y-0 overflow-hidden p-0 sm:max-w-lg`,children:[/* @__PURE__ */ (0,Y.jsxs)(p,{className:`sr-only`,children:[/* @__PURE__ */ (0,Y.jsx)(D,{children:`Search`}),/* @__PURE__ */ (0,Y.jsx)(_,{children:`Go to a page`})]}),e?/* @__PURE__ */ (0,Y.jsx)(fe,{nav:e,entries:t,onClose:n}):null]})})}function fe({nav:e,entries:t,onClose:n}){let[r,i]=(0,W.useState)(``),o=e.map(({element:e,label:t,group:n,detail:r,active:i},a)=>({kind:`nav`,id:`nav:${a}`,label:t,group:n,detail:r,active:i,element:e})),s=t.map((e,t)=>({kind:`app`,id:`app:${t}`,...e})),c=K([...o,...s],r);return/* @__PURE__ */ (0,Y.jsxs)(j,{shouldFilter:!1,loop:!0,className:`p-0`,children:[/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[/* @__PURE__ */ (0,Y.jsx)(a,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),/* @__PURE__ */ (0,Y.jsx)(M.Input,{"data-slot":`command-input`,className:`flex h-8 w-full min-w-0 bg-transparent text-sm outline-hidden placeholder:text-muted-foreground`,placeholder:`Search…`,"aria-label":`Search`,value:r,onValueChange:i})]}),/* @__PURE__ */ (0,Y.jsxs)(A,{className:`max-h-[min(24rem,60svh)] border-t`,children:[/* @__PURE__ */ (0,Y.jsx)(k,{className:`text-muted-foreground`,children:`Nothing matches.`}),c.map(({group:e,entries:t})=>/* @__PURE__ */ (0,Y.jsx)(ee,{heading:e,className:`p-0 **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2`,children:t.map(e=>/* @__PURE__ */ (0,Y.jsx)(ne,{value:e.id,className:`rounded-none px-3 py-2 in-data-[slot=dialog-content]:rounded-none!`,onSelect:()=>{n(),e.kind===`app`?e.onSelect():e.element.click()},children:/* @__PURE__ */ (0,Y.jsx)(pe,{row:e})},e.id))},e))]})]})}function pe({row:e}){return/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.detail}):null,e.active?/* @__PURE__ */ (0,Y.jsx)(te,{children:/* @__PURE__ */ (0,Y.jsx)(c,{"aria-label":`current`})}):null]})}const me=()=>()=>{};function he(){let e=document.cookie.split(`; `);if(e.includes(`sidebar_state=false`))return!1;if(e.includes(`sidebar_state=true`))return!0}function ge({app:e,mind:t,switcher:n,nav:r,paletteEntries:i,palette:a,commandPalette:o=!0,searchRow:s=!0,header:c,sidebarDefaultOpen:l=!0,phoneHeader:u=`row`,account:d,accountActions:f,sidebarAlert:p=!1,locationKey:m,children:h}){let g=(0,W.useSyncExternalStore)(me,()=>he()??l,()=>l),_=u===`floating`,v=(0,W.useRef)(null),[y,b]=(0,W.useState)(null),x=(0,W.useCallback)(()=>b(q(v.current)),[]),S=(0,W.useCallback)(()=>b(null),[]),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(null),D=(0,W.useCallback)(()=>b(e=>e?null:q(v.current)),[]);ce(o?D:null),Ee();let O=(0,W.useMemo)(()=>({header:C,menu:T,openPalette:o?x:void 0,appHeader:c}),[C,T,o,x,c]);return/* @__PURE__ */ (0,Y.jsxs)(P,{defaultOpen:g,className:`h-(--app-height,100svh) min-h-0`,children:[/* @__PURE__ */ (0,Y.jsx)(Ce,{locationKey:m}),/* @__PURE__ */ (0,Y.jsxs)(R,{collapsible:`icon`,children:[/* @__PURE__ */ (0,Y.jsxs)(re,{children:[n??/* @__PURE__ */ (0,Y.jsx)(Z,{app:e,line:t}),o&&s?/* @__PURE__ */ (0,Y.jsx)(le,{onOpen:x}):null]}),/* @__PURE__ */ (0,Y.jsx)(we,{navRef:v,children:r}),/* @__PURE__ */ (0,Y.jsxs)(ae,{children:[/* @__PURE__ */ (0,Y.jsx)(De,{}),d===!1?null:d===void 0?/* @__PURE__ */ (0,Y.jsx)(F,{children:/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)($,{className:`h-12 group-data-[collapsible=icon]:h-8`})})}):/* @__PURE__ */ (0,Y.jsx)(Oe,{name:d?.email||d?.actor||t||e,mind:t,actions:f})]}),/* @__PURE__ */ (0,Y.jsx)(V,{})]}),/* @__PURE__ */ (0,Y.jsxs)(ve,{floatingHeader:_,locationKey:m,children:[/* @__PURE__ */ (0,Y.jsx)(_e,{header:c,floating:_,sidebarAlert:p,onOpenPalette:o?x:void 0,pageHeaderRef:w,pageMenuRef:E}),/* @__PURE__ */ (0,Y.jsx)(X,{value:O,children:/* @__PURE__ */ (0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:h})})]}),o?/* @__PURE__ */ (0,Y.jsx)(be,{appPalette:a,nav:y,entries:i||[],onClose:S}):null]})}function _e({header:e,floating:t,sidebarAlert:n,onOpenPalette:r,pageHeaderRef:i,pageMenuRef:a}){return/* @__PURE__ */ (0,Y.jsxs)(`header`,{className:d(`group/header flex shrink-0 items-center gap-3 px-4 pt-2.5 pb-1`,`has-[[data-page-header]]:border-b has-[[data-page-header]]:py-1.5`,!e&&`md:hidden md:has-[[data-page-header]]:flex`,t&&`max-md:pointer-events-none max-md:absolute max-md:inset-x-0 max-md:top-0 max-md:z-20 max-md:bg-linear-to-b max-md:from-background max-md:from-40% max-md:to-transparent max-md:*:pointer-events-auto max-md:motion-safe:transition-transform max-md:motion-safe:duration-200 max-md:group-data-[phone-header=hidden]/inset:not-focus-within:-translate-y-full`),children:[/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`relative -ml-1 inline-flex md:hidden`,children:[/* @__PURE__ */ (0,Y.jsx)(N,{title:n?`Toggle sidebar (requests wait for approval)`:`Toggle sidebar`,"aria-label":n?`Toggle sidebar (requests wait for approval)`:`Toggle sidebar`}),n?/* @__PURE__ */ (0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-alert":!0,className:`pointer-events-none absolute top-0.5 right-0.5 size-2 rounded-full bg-warning ring-2 ring-background`}):null]}),/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:d(`flex min-w-0 items-center gap-3 max-md:group-has-[[data-page-menu]]/header:hidden`,!e&&`md:hidden`),children:[r?/* @__PURE__ */ (0,Y.jsx)(ue,{onOpen:r}):null,e]}),/* @__PURE__ */ (0,Y.jsx)(`div`,{ref:i,className:`flex min-w-0 flex-1 items-center empty:hidden`}),/* @__PURE__ */ (0,Y.jsx)(`div`,{ref:a,className:`ml-auto flex items-center empty:hidden md:hidden`})]})}function ve({floatingHeader:e,locationKey:t,children:n}){let[r,i]=(0,W.useState)(null),a=r!==t,o=(0,W.useRef)(null),s=(0,W.useRef)(0),c=(e,n,r)=>{e?ye(n,r)&&i(t):i(null)};return/* @__PURE__ */ (0,Y.jsx)(z,{className:`group/inset min-w-0 overflow-hidden`,"data-phone-header":e?a?`shown`:`hidden`:void 0,...e&&{onTouchStartCapture:e=>{let t=e.touches[0];o.current=t?{x:t.clientX,y:t.clientY}:null},onTouchMoveCapture:e=>{let t=e.touches[0],n=o.current;if(!t||!n)return;let r=t.clientY-n.y;Math.abs(r)<16||Math.abs(r)<Math.abs(t.clientX-n.x)||(o.current={x:t.clientX,y:t.clientY},c(r<0,e.target,e.currentTarget))},onWheelCapture:e=>{let t=Math.sign(e.deltaY)===Math.sign(s.current)?s.current+e.deltaY:e.deltaY;s.current=Math.abs(t)<16?t:0,Math.abs(t)>=16&&c(t>0,e.target,e.currentTarget)}},children:n})}function ye(e,t){for(let n=e instanceof Element?e:null;n&&n!==t;n=n.parentElement){let{overflowY:e}=getComputedStyle(n);if((e===`auto`||e===`scroll`)&&n.scrollHeight-n.clientHeight-n.scrollTop>1)return!0}return!1}function be({appPalette:e,...t}){return e?e({open:!!t.nav,onClose:t.onClose}):/* @__PURE__ */ (0,Y.jsx)(de,{...t})}const X=(0,W.createContext)(null);function xe(){return!!(0,W.useContext)(X)}function Z({app:e,line:t,logo:n,href:r,onClick:i}){let{isMobile:a,setOpenMobile:o}=B(),s=/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`flex aspect-square size-8 items-center justify-center rounded-md bg-black`,children:n??/* @__PURE__ */ (0,Y.jsx)(O,{alt:``,className:`size-6`})}),/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e}),t?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]});return/* @__PURE__ */ (0,Y.jsx)(F,{children:/* @__PURE__ */ (0,Y.jsx)(I,{children:r?/* @__PURE__ */ (0,Y.jsx)(L,{size:`lg`,tooltip:e,render:/* @__PURE__ */ (0,Y.jsx)(`a`,{href:r,onClick:e=>{let t=a&&H(e);i?.(e),t&&o(!1)}}),children:s}):/* @__PURE__ */ (0,Y.jsx)(L,{size:`lg`,className:`pointer-events-none`,children:s})})})}function Q({children:e}){let t=(0,W.useContext)(X);if(!t)throw Error(`AppShellPageHeader is drawn inside an AppShell`);return t.header?(0,G.createPortal)(/* @__PURE__ */ (0,Y.jsx)(`div`,{"data-page-header":!0,className:`flex min-w-0 flex-1 items-center gap-x-4 gap-y-1 md:flex-wrap`,children:e}),t.header):null}function Se({children:e}){let t=(0,W.useContext)(X);if(!t)throw Error(`AppShellPageMenu is drawn inside an AppShell`);return t.menu?(0,G.createPortal)(/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{"data-page-menu":!0,render:/* @__PURE__ */ (0,Y.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":`More`,title:`More`}),children:/* @__PURE__ */ (0,Y.jsx)(l,{})}),/* @__PURE__ */ (0,Y.jsxs)(w,{align:`end`,className:`min-w-56 rounded-lg`,children:[t.appHeader?/* @__PURE__ */ (0,Y.jsx)(`div`,{className:`px-1.5 py-1`,children:t.appHeader}):null,t.openPalette?/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(x,{children:/* @__PURE__ */ (0,Y.jsxs)(v,{onClick:t.openPalette,children:[/* @__PURE__ */ (0,Y.jsx)(a,{}),`Search`]})}),/* @__PURE__ */ (0,Y.jsx)(E,{})]}):null,e]})]}),t.menu):null}function $({className:e}){return/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:d(`flex h-8 items-center gap-2 px-2`,e),children:[/* @__PURE__ */ (0,Y.jsx)(y,{className:`size-4 rounded-md`}),/* @__PURE__ */ (0,Y.jsx)(y,{className:`h-4 w-2/3`})]})}function Ce({locationKey:e}){let{setOpenMobile:t}=B(),n=(0,W.useRef)(e);return(0,W.useEffect)(()=>{n.current!==e&&(n.current=e,t(!1))},[e,t]),null}function we({navRef:e,children:t}){let{isMobile:n,setOpenMobile:r}=B();return/* @__PURE__ */ (0,Y.jsx)(ie,{ref:e,onClick:e=>{if(!n||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(!t||!e.currentTarget.contains(t)||t.hasAttribute(`download`))return;let i=t.getAttribute(`target`);i&&i!==`_self`||r(!1)},children:t})}function Te({app:e,logo:t,value:n,items:r,label:i,href:a,mono:o=!1,onSelect:l}){let{isMobile:u,setOpenMobile:f}=B(),p=r.map(e=>typeof e==`string`?{value:e,label:e,href:void 0}:{value:e.value,label:e.label||e.value,href:e.href}),m=p.find(e=>e.value===n)?.label||n;return p.length<=1?/* @__PURE__ */ (0,Y.jsx)(Z,{app:e,line:o?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`font-mono`,children:m}):m,logo:t,href:a}):/* @__PURE__ */ (0,Y.jsx)(F,{children:/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{render:/* @__PURE__ */ (0,Y.jsxs)(L,{size:`lg`,className:`data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground`,"aria-label":i?`${i}: ${m}`:`Switch ${e}`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`flex aspect-square size-8 items-center justify-center rounded-md bg-black`,children:t??/* @__PURE__ */ (0,Y.jsx)(O,{alt:``,className:`size-6`})}),/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate text-xs text-muted-foreground`,o&&`font-mono`),children:m})]}),/* @__PURE__ */ (0,Y.jsx)(s,{className:`ml-auto`})]})}),/* @__PURE__ */ (0,Y.jsx)(w,{align:`start`,side:u?`bottom`:`right`,sideOffset:4,className:`min-w-56 rounded-lg`,children:/* @__PURE__ */ (0,Y.jsxs)(x,{children:[i?/* @__PURE__ */ (0,Y.jsx)(C,{children:i}):null,p.map(e=>{let t=e.value===n;return e.href?/* @__PURE__ */ (0,Y.jsxs)(v,{className:`gap-2`,render:/* @__PURE__ */ (0,Y.jsx)(`a`,{href:e.href,"aria-current":t?`page`:void 0,onClick:t=>{H(t)&&(l?.(e.value,t),u&&f(!1))}}),children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate`,o&&`font-mono`),children:e.label}),t?/* @__PURE__ */ (0,Y.jsx)(c,{className:`ml-auto`}):null]},e.value):/* @__PURE__ */ (0,Y.jsxs)(v,{className:`gap-2`,onClick:t=>{l?.(e.value,t),u&&f(!1)},children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate`,o&&`font-mono`),children:e.label}),t?/* @__PURE__ */ (0,Y.jsx)(c,{className:`ml-auto`}):null]},e.value)})]})})]})})})}function Ee(){(0,W.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=()=>{let t=Math.round(e.height*e.scale*100)/100;document.documentElement.style.setProperty(`--app-height`,`${String(t)}px`),e.scale<=1&&window.scrollTo(0,0)};return e.addEventListener(`resize`,t),window.addEventListener(`pageshow`,t),document.addEventListener(`visibilitychange`,t),()=>{e.removeEventListener(`resize`,t),window.removeEventListener(`pageshow`,t),document.removeEventListener(`visibilitychange`,t)}},[])}function De(){let{state:e,toggleSidebar:t}=B(),n=e===`collapsed`;return/* @__PURE__ */ (0,Y.jsx)(F,{children:/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsxs)(L,{type:`button`,size:`sm`,className:`text-sidebar-foreground/70`,tooltip:n?`Expand sidebar`:`Collapse sidebar`,onClick:t,children:[/* @__PURE__ */ (0,Y.jsx)(o,{className:n?`rotate-180`:void 0}),/* @__PURE__ */ (0,Y.jsx)(`span`,{children:`Collapse sidebar`})]})})})}function Oe({name:e,mind:t,actions:n}){let{isMobile:r,state:a}=B(),o=a===`collapsed`&&!r,c=(0,W.useRef)(null),l=e.slice(0,2).toUpperCase(),d=o||!!n;return/* @__PURE__ */ (0,Y.jsxs)(F,{children:[/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{render:/* @__PURE__ */ (0,Y.jsxs)(L,{size:`lg`,className:`h-auto min-h-12 group-data-[collapsible=icon]:min-h-0 data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground`,"aria-label":`Account`,children:[/* @__PURE__ */ (0,Y.jsx)(h,{className:`size-8 rounded-lg`,children:/* @__PURE__ */ (0,Y.jsx)(m,{className:`rounded-lg`,children:l})}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left text-sm font-medium group-data-[collapsible=icon]:hidden`,children:e}),/* @__PURE__ */ (0,Y.jsx)(s,{className:`ml-auto`})]})}),/* @__PURE__ */ (0,Y.jsxs)(w,{className:`min-w-56 rounded-lg`,side:r?`bottom`:`right`,align:`end`,sideOffset:4,children:[d?/* @__PURE__ */ (0,Y.jsxs)(x,{children:[o?/* @__PURE__ */ (0,Y.jsx)(C,{className:`truncate font-normal`,children:e}):null,n]}):null,t?/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[d?/* @__PURE__ */ (0,Y.jsx)(E,{}):null,/* @__PURE__ */ (0,Y.jsx)(x,{children:/* @__PURE__ */ (0,Y.jsxs)(v,{onClick:()=>{U(),i().then(()=>c.current?.requestSubmit())},children:[/* @__PURE__ */ (0,Y.jsx)(u,{}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate`,children:`Sign out`})]})})]}):null]})]})}),t?/* @__PURE__ */ (0,Y.jsx)(`form`,{ref:c,method:`post`,action:`/.auth/logout?${new URLSearchParams({mind:t})}`,hidden:!0}):null]})}export{Te as a,Se as i,Z as n,$ as o,Q as r,xe as s,ge as t}; +import{r as e}from"./rolldown-runtime.mjs";import{a as t,i as n,n as r}from"./vendor-react";import{wipeSavedLogTails as i}from"../lib/saved-log-tail";import{C as a,Dt as o,Et as s,Mt as c,mt as l,q as u}from"./vendor-icons";import{c as d,i as f}from"./ui-base";import{I as p,J as m,K as h,N as g,P as _,a as v,g as y,h as b,i as x,j as S,o as C,r as w,t as T,u as E,z as D}from"./ui-shell";import{t as O}from"./iterate-logo.mjs";import{i as ee,l as te,o as ne,r as k,s as A,t as j,u as M}from"./command.mjs";import{C as N,b as P,c as F,d as I,h as L,m as R,n as re,r as ie,t as z,u as B,w as V,x as H}from"./sidebar.mjs";import{plainLeftClick as U}from"../lib/plain-left-click";var W=/* @__PURE__ */ e(t(),1),G=/* @__PURE__ */ e(n(),1);function K(e,t){let n=t.trim().toLowerCase(),r=n.split(/\s+/).filter(Boolean),i=e.filter(e=>{let t=`${e.label} ${e.detail||``}`.toLowerCase();return r.every(e=>t.includes(e))}),a=/* @__PURE__ */ new Map;for(let e of i)a.set(e.group,[...a.get(e.group)||[],e]);return[...a].map(([e,t])=>({group:e,entries:n?[...t.filter(e=>e.label.toLowerCase().startsWith(n)),...t.filter(e=>!e.label.toLowerCase().startsWith(n))]:t}))}function q(e){return!e||e.closest(`[data-mobile]`)?[]:[...e.querySelectorAll(`[data-slot="sidebar-menu-button"], [data-slot="sidebar-menu-sub-button"]`)].flatMap(e=>{if(e.matches(`:disabled, [aria-disabled="true"]`))return[];let[t,...n]=J(e),r=t||e.getAttribute(`aria-label`)?.trim();if(!r)return[];let i=e.closest(`[data-slot="sidebar-group"]`),a=e.dataset.slot===`sidebar-menu-sub-button`?e.closest(`[data-slot="sidebar-menu-sub"]`)?.closest(`[data-slot="sidebar-menu-item"]`)?.querySelector(`[data-slot="sidebar-menu-button"]`):null;return[{element:e,label:r,group:J(i?.querySelector(`[data-slot="sidebar-group-label"]`))[0]||`Pages`,detail:J(a)[0]||n.join(` · `)||void 0,active:e.hasAttribute(`data-active`),href:e instanceof HTMLAnchorElement?e.href:void 0}]})}function J(e){if(!e)return[];let t=/* @__PURE__ */ new Map,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let r=n.nextNode();r;r=n.nextNode()){let n=r.parentNode||e;t.set(n,`${t.get(n)||``}${r.nodeValue||``}`)}return[...t.values()].map(e=>e.replace(/\s+/g,` `).trim()).filter(Boolean)}var Y=/* @__PURE__ */ e(r(),1);const ae=()=>()=>{};function oe(){return(0,W.useSyncExternalStore)(ae,()=>/Mac|iPhone|iPad/.test(navigator.platform)?`⌘K`:`Ctrl K`,()=>`⌘K`)}function se(e){(0,W.useEffect)(()=>{if(!e)return;function t(t){t.defaultPrevented||t.altKey||t.shiftKey||(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e?.())}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function ce({onOpen:e}){let t=oe();return/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)(L,{children:/* @__PURE__ */ (0,Y.jsxs)(R,{type:`button`,tooltip:`Search (${t})`,onClick:e,children:[/* @__PURE__ */ (0,Y.jsx)(a,{}),/* @__PURE__ */ (0,Y.jsx)(`span`,{children:`Search`}),/* @__PURE__ */ (0,Y.jsx)(`kbd`,{className:`ml-auto font-sans text-xs text-muted-foreground`,children:t})]})})})}function le({onOpen:e}){return/* @__PURE__ */ (0,Y.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":`Search`,title:`Search`,onClick:e,children:/* @__PURE__ */ (0,Y.jsx)(a,{})})}function ue({nav:e,entries:t,onClose:n}){return/* @__PURE__ */ (0,Y.jsx)(S,{open:!!e,onOpenChange:e=>{e||n()},children:/* @__PURE__ */ (0,Y.jsxs)(g,{showCloseButton:!1,className:`top-[12svh] translate-y-0 overflow-hidden p-0 sm:max-w-lg`,children:[/* @__PURE__ */ (0,Y.jsxs)(p,{className:`sr-only`,children:[/* @__PURE__ */ (0,Y.jsx)(D,{children:`Search`}),/* @__PURE__ */ (0,Y.jsx)(_,{children:`Go to a page`})]}),e?/* @__PURE__ */ (0,Y.jsx)(de,{nav:e,entries:t,onClose:n}):null]})})}function de({nav:e,entries:t,onClose:n}){let[r,i]=(0,W.useState)(``),o=e.map(({element:e,label:t,group:n,detail:r,active:i},a)=>({kind:`nav`,id:`nav:${a}`,label:t,group:n,detail:r,active:i,element:e})),s=t.map((e,t)=>({kind:`app`,id:`app:${t}`,...e})),c=K([...o,...s],r);return/* @__PURE__ */ (0,Y.jsxs)(j,{shouldFilter:!1,loop:!0,className:`p-0`,children:[/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[/* @__PURE__ */ (0,Y.jsx)(a,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),/* @__PURE__ */ (0,Y.jsx)(M.Input,{"data-slot":`command-input`,className:`flex h-8 w-full min-w-0 bg-transparent text-sm outline-hidden placeholder:text-muted-foreground`,placeholder:`Search…`,"aria-label":`Search`,value:r,onValueChange:i})]}),/* @__PURE__ */ (0,Y.jsxs)(A,{className:`max-h-[min(24rem,60svh)] border-t`,children:[/* @__PURE__ */ (0,Y.jsx)(k,{className:`text-muted-foreground`,children:`Nothing matches.`}),c.map(({group:e,entries:t})=>/* @__PURE__ */ (0,Y.jsx)(ee,{heading:e,className:`p-0 **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2`,children:t.map(e=>/* @__PURE__ */ (0,Y.jsx)(ne,{value:e.id,className:`rounded-none px-3 py-2 in-data-[slot=dialog-content]:rounded-none!`,onSelect:()=>{n(),e.kind===`app`?e.onSelect():e.element.click()},children:/* @__PURE__ */ (0,Y.jsx)(fe,{row:e})},e.id))},e))]})]})}function fe({row:e}){return/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.detail}):null,e.active?/* @__PURE__ */ (0,Y.jsx)(te,{children:/* @__PURE__ */ (0,Y.jsx)(c,{"aria-label":`current`})}):null]})}const pe=()=>()=>{};function me(){let e=document.cookie.split(`; `);if(e.includes(`sidebar_state=false`))return!1;if(e.includes(`sidebar_state=true`))return!0}function he({app:e,mind:t,switcher:n,nav:r,paletteEntries:i,palette:a,commandPalette:o=!0,searchRow:s=!0,header:c,sidebarDefaultOpen:l=!0,phoneHeader:u=`row`,account:d,accountActions:f,sidebarAlert:p=!1,locationKey:m,children:h}){let g=(0,W.useSyncExternalStore)(pe,()=>me()??l,()=>l),_=u===`floating`,v=(0,W.useRef)(null),[y,b]=(0,W.useState)(null),x=(0,W.useCallback)(()=>b(q(v.current)),[]),S=(0,W.useCallback)(()=>b(null),[]),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(null),D=(0,W.useCallback)(()=>b(e=>e?null:q(v.current)),[]);se(o?D:null),Te();let O=(0,W.useMemo)(()=>({header:C,menu:T,openPalette:o?x:void 0,appHeader:c}),[C,T,o,x,c]);return/* @__PURE__ */ (0,Y.jsxs)(P,{defaultOpen:g,className:`h-(--app-height,100svh) min-h-0`,children:[/* @__PURE__ */ (0,Y.jsx)(Ce,{locationKey:m}),/* @__PURE__ */ (0,Y.jsxs)(z,{collapsible:`icon`,children:[/* @__PURE__ */ (0,Y.jsxs)(F,{children:[n??/* @__PURE__ */ (0,Y.jsx)(Z,{app:e,line:t}),o&&s?/* @__PURE__ */ (0,Y.jsx)(ce,{onOpen:x}):null]}),/* @__PURE__ */ (0,Y.jsx)($,{navRef:v,children:r}),/* @__PURE__ */ (0,Y.jsxs)(ie,{children:[/* @__PURE__ */ (0,Y.jsx)(Ee,{}),d===!1?null:d===void 0?/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)(L,{children:/* @__PURE__ */ (0,Y.jsx)(Q,{className:`h-12 group-data-[collapsible=icon]:h-8`})})}):/* @__PURE__ */ (0,Y.jsx)(De,{name:d?.email||d?.actor||t||e,mind:t,actions:f})]}),/* @__PURE__ */ (0,Y.jsx)(H,{})]}),/* @__PURE__ */ (0,Y.jsxs)(_e,{floatingHeader:_,locationKey:m,children:[/* @__PURE__ */ (0,Y.jsx)(ge,{header:c,floating:_,sidebarAlert:p,onOpenPalette:o?x:void 0,pageHeaderRef:w,pageMenuRef:E}),/* @__PURE__ */ (0,Y.jsx)(X,{value:O,children:/* @__PURE__ */ (0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:h})})]}),o?/* @__PURE__ */ (0,Y.jsx)(ye,{appPalette:a,nav:y,entries:i||[],onClose:S}):null]})}function ge({header:e,floating:t,sidebarAlert:n,onOpenPalette:r,pageHeaderRef:i,pageMenuRef:a}){return/* @__PURE__ */ (0,Y.jsxs)(`header`,{className:d(`group/header flex shrink-0 items-center gap-3 px-4 pt-2.5 pb-1`,`has-[[data-page-header]]:border-b has-[[data-page-header]]:py-1.5`,!e&&`md:hidden md:has-[[data-page-header]]:flex`,t&&`max-md:pointer-events-none max-md:absolute max-md:inset-x-0 max-md:top-0 max-md:z-20 max-md:bg-linear-to-b max-md:from-background max-md:from-40% max-md:to-transparent max-md:*:pointer-events-auto max-md:motion-safe:transition-transform max-md:motion-safe:duration-200 max-md:group-data-[phone-header=hidden]/inset:not-focus-within:-translate-y-full`),children:[/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`relative -ml-1 inline-flex md:hidden`,children:[/* @__PURE__ */ (0,Y.jsx)(N,{title:n?`Toggle sidebar (requests wait for approval)`:`Toggle sidebar`,"aria-label":n?`Toggle sidebar (requests wait for approval)`:`Toggle sidebar`}),n?/* @__PURE__ */ (0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-alert":!0,className:`pointer-events-none absolute top-0.5 right-0.5 size-2 rounded-full bg-warning ring-2 ring-background`}):null]}),/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:d(`flex min-w-0 items-center gap-3 max-md:group-has-[[data-page-menu]]/header:hidden`,!e&&`md:hidden`),children:[r?/* @__PURE__ */ (0,Y.jsx)(le,{onOpen:r}):null,e]}),/* @__PURE__ */ (0,Y.jsx)(`div`,{ref:i,className:`flex min-w-0 flex-1 items-center empty:hidden`}),/* @__PURE__ */ (0,Y.jsx)(`div`,{ref:a,className:`ml-auto flex items-center empty:hidden md:hidden`})]})}function _e({floatingHeader:e,locationKey:t,children:n}){let[r,i]=(0,W.useState)(null),a=r!==t,o=(0,W.useRef)(null),s=(0,W.useRef)(0),c=(e,n,r)=>{e?ve(n,r)&&i(t):i(null)};return/* @__PURE__ */ (0,Y.jsx)(B,{className:`group/inset min-w-0 overflow-hidden`,"data-phone-header":e?a?`shown`:`hidden`:void 0,...e&&{onTouchStartCapture:e=>{let t=e.touches[0];o.current=t?{x:t.clientX,y:t.clientY}:null},onTouchMoveCapture:e=>{let t=e.touches[0],n=o.current;if(!t||!n)return;let r=t.clientY-n.y;Math.abs(r)<16||Math.abs(r)<Math.abs(t.clientX-n.x)||(o.current={x:t.clientX,y:t.clientY},c(r<0,e.target,e.currentTarget))},onWheelCapture:e=>{let t=Math.sign(e.deltaY)===Math.sign(s.current)?s.current+e.deltaY:e.deltaY;s.current=Math.abs(t)<16?t:0,Math.abs(t)>=16&&c(t>0,e.target,e.currentTarget)}},children:n})}function ve(e,t){for(let n=e instanceof Element?e:null;n&&n!==t;n=n.parentElement){let{overflowY:e}=getComputedStyle(n);if((e===`auto`||e===`scroll`)&&n.scrollHeight-n.clientHeight-n.scrollTop>1)return!0}return!1}function ye({appPalette:e,...t}){return e?e({open:!!t.nav,onClose:t.onClose}):/* @__PURE__ */ (0,Y.jsx)(ue,{...t})}const X=(0,W.createContext)(null);function be(){return!!(0,W.useContext)(X)}function Z({app:e,line:t,logo:n,href:r,onClick:i}){let{isMobile:a,setOpenMobile:o}=V(),s=/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`flex aspect-square size-8 items-center justify-center rounded-md bg-black`,children:n??/* @__PURE__ */ (0,Y.jsx)(O,{alt:``,className:`size-6`})}),/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e}),t?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]});return/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)(L,{children:r?/* @__PURE__ */ (0,Y.jsx)(R,{size:`lg`,tooltip:e,render:/* @__PURE__ */ (0,Y.jsx)(`a`,{href:r,onClick:e=>{let t=a&&U(e);i?.(e),t&&o(!1)}}),children:s}):/* @__PURE__ */ (0,Y.jsx)(R,{size:`lg`,className:`pointer-events-none`,children:s})})})}function xe({children:e}){let t=(0,W.useContext)(X);if(!t)throw Error(`AppShellPageHeader is drawn inside an AppShell`);return t.header?(0,G.createPortal)(/* @__PURE__ */ (0,Y.jsx)(`div`,{"data-page-header":!0,className:`flex min-w-0 flex-1 items-center gap-x-4 gap-y-1 md:flex-wrap`,children:e}),t.header):null}function Se({children:e}){let t=(0,W.useContext)(X);if(!t)throw Error(`AppShellPageMenu is drawn inside an AppShell`);return t.menu?(0,G.createPortal)(/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{"data-page-menu":!0,render:/* @__PURE__ */ (0,Y.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":`More`,title:`More`}),children:/* @__PURE__ */ (0,Y.jsx)(l,{})}),/* @__PURE__ */ (0,Y.jsxs)(w,{align:`end`,className:`min-w-56 rounded-lg`,children:[t.appHeader?/* @__PURE__ */ (0,Y.jsx)(`div`,{className:`px-1.5 py-1`,children:t.appHeader}):null,t.openPalette?/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[/* @__PURE__ */ (0,Y.jsx)(x,{children:/* @__PURE__ */ (0,Y.jsxs)(v,{onClick:t.openPalette,children:[/* @__PURE__ */ (0,Y.jsx)(a,{}),`Search`]})}),/* @__PURE__ */ (0,Y.jsx)(E,{})]}):null,e]})]}),t.menu):null}function Q({className:e}){return/* @__PURE__ */ (0,Y.jsxs)(`div`,{className:d(`flex h-8 items-center gap-2 px-2`,e),children:[/* @__PURE__ */ (0,Y.jsx)(y,{className:`size-4 rounded-md`}),/* @__PURE__ */ (0,Y.jsx)(y,{className:`h-4 w-2/3`})]})}function Ce({locationKey:e}){let{setOpenMobile:t}=V(),n=(0,W.useRef)(e);return(0,W.useEffect)(()=>{n.current!==e&&(n.current=e,t(!1))},[e,t]),null}function $({navRef:e,children:t}){let{isMobile:n,setOpenMobile:r}=V();return/* @__PURE__ */ (0,Y.jsx)(re,{ref:e,onClick:e=>{if(!n||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(!t||!e.currentTarget.contains(t)||t.hasAttribute(`download`))return;let i=t.getAttribute(`target`);i&&i!==`_self`||r(!1)},children:t})}function we({app:e,logo:t,value:n,items:r,label:i,href:a,mono:o=!1,onSelect:l}){let{isMobile:u,setOpenMobile:f}=V(),p=r.map(e=>typeof e==`string`?{value:e,label:e,href:void 0}:{value:e.value,label:e.label||e.value,href:e.href}),m=p.find(e=>e.value===n)?.label||n;return p.length<=1?/* @__PURE__ */ (0,Y.jsx)(Z,{app:e,line:o?/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`font-mono`,children:m}):m,logo:t,href:a}):/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)(L,{children:/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{render:/* @__PURE__ */ (0,Y.jsxs)(R,{size:`lg`,className:`data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground`,"aria-label":i?`${i}: ${m}`:`Switch ${e}`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`flex aspect-square size-8 items-center justify-center rounded-md bg-black`,children:t??/* @__PURE__ */ (0,Y.jsx)(O,{alt:``,className:`size-6`})}),/* @__PURE__ */ (0,Y.jsxs)(`span`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate text-xs text-muted-foreground`,o&&`font-mono`),children:m})]}),/* @__PURE__ */ (0,Y.jsx)(s,{className:`ml-auto`})]})}),/* @__PURE__ */ (0,Y.jsx)(w,{align:`start`,side:u?`bottom`:`right`,sideOffset:4,className:`min-w-56 rounded-lg`,children:/* @__PURE__ */ (0,Y.jsxs)(x,{children:[i?/* @__PURE__ */ (0,Y.jsx)(C,{children:i}):null,p.map(e=>{let t=e.value===n;return e.href?/* @__PURE__ */ (0,Y.jsxs)(v,{className:`gap-2`,render:/* @__PURE__ */ (0,Y.jsx)(`a`,{href:e.href,"aria-current":t?`page`:void 0,onClick:t=>{U(t)&&(l?.(e.value,t),u&&f(!1))}}),children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate`,o&&`font-mono`),children:e.label}),t?/* @__PURE__ */ (0,Y.jsx)(c,{className:`ml-auto`}):null]},e.value):/* @__PURE__ */ (0,Y.jsxs)(v,{className:`gap-2`,onClick:t=>{l?.(e.value,t),u&&f(!1)},children:[/* @__PURE__ */ (0,Y.jsx)(`span`,{className:d(`truncate`,o&&`font-mono`),children:e.label}),t?/* @__PURE__ */ (0,Y.jsx)(c,{className:`ml-auto`}):null]},e.value)})]})})]})})})}function Te(){(0,W.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=()=>{let t=Math.round(e.height*e.scale*100)/100;document.documentElement.style.setProperty(`--app-height`,`${String(t)}px`),e.scale<=1&&window.scrollTo(0,0)};return e.addEventListener(`resize`,t),window.addEventListener(`pageshow`,t),document.addEventListener(`visibilitychange`,t),()=>{e.removeEventListener(`resize`,t),window.removeEventListener(`pageshow`,t),document.removeEventListener(`visibilitychange`,t)}},[])}function Ee(){let{state:e,toggleSidebar:t}=V(),n=e===`collapsed`;return/* @__PURE__ */ (0,Y.jsx)(I,{children:/* @__PURE__ */ (0,Y.jsx)(L,{children:/* @__PURE__ */ (0,Y.jsxs)(R,{type:`button`,size:`sm`,className:`text-sidebar-foreground/70`,tooltip:n?`Expand sidebar`:`Collapse sidebar`,onClick:t,children:[/* @__PURE__ */ (0,Y.jsx)(o,{className:n?`rotate-180`:void 0}),/* @__PURE__ */ (0,Y.jsx)(`span`,{children:`Collapse sidebar`})]})})})}function De({name:e,mind:t,actions:n}){let{isMobile:r,state:a}=V(),o=a===`collapsed`&&!r,c=(0,W.useRef)(null),l=e.slice(0,2).toUpperCase(),d=o||!!n;return/* @__PURE__ */ (0,Y.jsxs)(I,{children:[/* @__PURE__ */ (0,Y.jsx)(L,{children:/* @__PURE__ */ (0,Y.jsxs)(T,{children:[/* @__PURE__ */ (0,Y.jsx)(b,{render:/* @__PURE__ */ (0,Y.jsxs)(R,{size:`lg`,className:`h-auto min-h-12 group-data-[collapsible=icon]:min-h-0 data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground`,"aria-label":`Account`,children:[/* @__PURE__ */ (0,Y.jsx)(h,{className:`size-8 rounded-lg`,children:/* @__PURE__ */ (0,Y.jsx)(m,{className:`rounded-lg`,children:l})}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left text-sm font-medium group-data-[collapsible=icon]:hidden`,children:e}),/* @__PURE__ */ (0,Y.jsx)(s,{className:`ml-auto`})]})}),/* @__PURE__ */ (0,Y.jsxs)(w,{className:`min-w-56 rounded-lg`,side:r?`bottom`:`right`,align:`end`,sideOffset:4,children:[d?/* @__PURE__ */ (0,Y.jsxs)(x,{children:[o?/* @__PURE__ */ (0,Y.jsx)(C,{className:`truncate font-normal`,children:e}):null,n]}):null,t?/* @__PURE__ */ (0,Y.jsxs)(Y.Fragment,{children:[d?/* @__PURE__ */ (0,Y.jsx)(E,{}):null,/* @__PURE__ */ (0,Y.jsx)(x,{children:/* @__PURE__ */ (0,Y.jsxs)(v,{onClick:()=>{i().then(()=>c.current?.requestSubmit())},children:[/* @__PURE__ */ (0,Y.jsx)(u,{}),/* @__PURE__ */ (0,Y.jsx)(`span`,{className:`truncate`,children:`Sign out`})]})})]}):null]})]})}),t?/* @__PURE__ */ (0,Y.jsx)(`form`,{ref:c,method:`post`,action:`/.auth/logout?${new URLSearchParams({mind:t})}`,hidden:!0}):null]})}export{we as a,Se as i,Z as n,Q as o,xe as r,be as s,he as t};
D dist/chunks/vendor-posthog.mjs
@@ -1,2 +0,0 @@ -import{n as e}from"./rolldown-runtime.mjs";var t=/* @__PURE__ */ e({Compression:()=>zo,DEFAULT_PRODUCT_TOUR_APPEARANCE:()=>Qo,DisplaySurveyType:()=>Xo,PostHog:()=>nl,ProductTourEventName:()=>$o,ProductTourEventProperties:()=>es,SurveyEventName:()=>Jo,SurveyEventProperties:()=>Yo,SurveyEventType:()=>Bo,SurveyPosition:()=>Ho,SurveyQuestionBranchingType:()=>Ko,SurveyQuestionType:()=>Go,SurveySchedule:()=>qo,SurveyTabPosition:()=>Uo,SurveyType:()=>Wo,SurveyWidgetType:()=>Vo,default:()=>Bu,posthog:()=>zu,severityLevels:()=>as});const n=`u`>typeof window?window:void 0,r=`u`>typeof globalThis?globalThis:n,i=r?.navigator,a=r?.document,o=r?.location,s=r?.fetch,c=r?.XMLHttpRequest&&`withCredentials`in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,l=r?.AbortController,u=r?.CompressionStream,d=i?.userAgent;function f(){return!(!n||!1===n.navigator.onLine)}const p=typeof globalThis<`u`?globalThis:n;p&&typeof self>`u`&&(p.self=p),p&&typeof File>`u`&&(p.File=function(){});const m=n??{},h=`0.9.0`,g={DEBUG:!1,LIB_VERSION:h,LIB_NAME:`browser-common`,JS_SDK_VERSION:h};var _=function(e){return e.AnonymousId=`anonymous_id`,e.DistinctId=`distinct_id`,e.Props=`props`,e.EnablePersonProcessing=`enable_person_processing`,e.PersonMode=`person_mode`,e.FeatureFlagDetails=`feature_flag_details`,e.FeatureFlags=`feature_flags`,e.FeatureFlagPayloads=`feature_flag_payloads`,e.BootstrapFeatureFlagDetails=`bootstrap_feature_flag_details`,e.BootstrapFeatureFlags=`bootstrap_feature_flags`,e.BootstrapFeatureFlagPayloads=`bootstrap_feature_flag_payloads`,e.OverrideFeatureFlags=`override_feature_flags`,e.Queue=`queue`,e.AiQueue=`ai_queue`,e.AiCaptureQueue=`ai_capture_queue`,e.LogsQueue=`logs_queue`,e.OptedOut=`opted_out`,e.SessionId=`session_id`,e.SessionStartTimestamp=`session_start_timestamp`,e.SessionLastTimestamp=`session_timestamp`,e.PersonProperties=`person_properties`,e.GroupProperties=`group_properties`,e.InstalledAppBuild=`installed_app_build`,e.InstalledAppVersion=`installed_app_version`,e.SessionReplay=`session_replay`,e.PushRegistered=`push_registered`,e.SessionReplayEventTriggerActivatedSession=`session_replay_event_trigger_activated_session`,e.SurveyLastSeenDate=`survey_last_seen_date`,e.SurveysInProgress=`surveys_in_progress`,e.SurveysSeen=`surveys_seen`,e.Surveys=`surveys`,e.RemoteConfig=`remote_config`,e.FlagsEndpointWasHit=`flags_endpoint_was_hit`,e.DeviceId=`device_id`,e}({}),v=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({});const y=[`$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`],b=[`token`];function x(e,t){return e.indexOf(t)!==-1}const S=function(e){return e.trim()},C=function(e){return e.replace(/^\$/,``)};function w(e){let t=[];return JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return n.toString();if(typeof n!=`function`&&typeof n!=`symbol`){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n==`object`){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n}})??`null`}const ee=Object.prototype,T=ee.hasOwnProperty,te=ee.toString,E=Array.isArray||function(e){return te.call(e)===`[object Array]`},D=e=>typeof e==`function`,O=e=>e===Object(e)&&!E(e),k=e=>{if(O(e)){for(let t in e)if(T.call(e,t))return!1;return!0}return!1},A=e=>e===void 0,j=e=>te.call(e)==`[object String]`,M=e=>j(e)&&e.trim().length===0,N=e=>e===null,P=e=>A(e)||N(e),F=e=>te.call(e)==`[object Number]`&&e==e,ne=e=>F(e)&&e>0,I=e=>te.call(e)===`[object Boolean]`,re=e=>x(y,e),ie=e=>x(b,e);function ae(e){return typeof e!=`object`||!e}function oe(e,t){return{}.toString.call(e)===`[object ${t}]`}function se(e){switch({}.toString.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object DOMError]`:case`[object WebAssembly.Exception]`:return!0;default:return le(e,Error)}}function ce(e){return`u`>typeof Event&&le(e,Event)}function le(e,t){try{return e instanceof t}catch{return!1}}const ue=[!0,`true`,1,`1`,`yes`],de=e=>x(ue,e),fe=[!1,`false`,0,`0`,`no`];function pe(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function L(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){pe(a,r,i,o,s,`next`,e)}function s(e){pe(a,r,i,o,s,`throw`,e)}o(void 0)})}}const me=/* @__PURE__ */ `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,pinterestbot,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`.split(`,`),he=function(e,t=[]){if(!e)return!1;let n=e.toLowerCase();return me.concat(t).some(e=>{let t=e.toLowerCase();return n.indexOf(t)!==-1})};function ge(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),F(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),ge(i??n,t,n,r))}var _e=class{constructor(e){this.C={},this.I=e.I,this.R=ge(e.bucketSize,0,100,e.$),this.A=ge(e.refillRate,0,this.R,e.$),this.O=ge(e.refillInterval,0,864e5,e.$)}F(e,t){let n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.A,this.R),e.lastAccess+=n*this.O)}consumeRateLimit(e){var t;let n=Date.now(),r=String(e),i=this.C[r];return i?this.F(i,n):(i={tokens:this.R,lastAccess:n},this.C[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.I)==null||t.call(this,e)),i.tokens===0)}stop(){this.C={}}};const ve=`Mobile`,ye=`Android`,be=`Tablet`,xe=`Android Tablet`,Se=`iPad`,Ce=`Apple Watch`,we=`Safari`,Te=`BlackBerry`,Ee=`Samsung Internet`,De=`Chrome`,Oe=`Chrome iOS`,ke=`Internet Explorer`,Ae=`Internet Explorer Mobile`,je=`Opera`,Me=`Microsoft Edge`,Ne=`Firefox`,Pe=`Firefox iOS`,Fe=`Nintendo`,Ie=`PlayStation`,Le=`Xbox`,Re=`Android Mobile`,ze=`Mobile Safari`,Be=`Windows`,Ve=`Windows Phone`,He=`Nokia`,Ue=`Ouya`,We=`Generic tablet`,Ge=`Konqueror`,Ke=`Oculus Browser`,qe=`Vivaldi`,Je=`Yandex`,Ye=`Whale`,Xe=`DuckDuckGo`,Ze=`Pale Moon`,Qe=`Waterfox`,$e=`Brave`,et=`Claude`,tt=`Codex`,nt=`ChatGPT`,rt=`Google Search App`,it=/* @__PURE__ */ RegExp(`Version/(\\d+(\\.\\d+)?)`),at=/* @__PURE__ */ RegExp(`(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)`),ot=RegExp(Le,`i`),st=/* @__PURE__ */ RegExp(`PlayStation \\w+`,`i`),ct=/* @__PURE__ */ RegExp(`Nintendo \\w+`,`i`),lt=/* @__PURE__ */ RegExp(`BlackBerry|PlayBook|BB10`,`i`),ut={"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`},dt=function(e,t,n,r){return t||=``,function(e){return e?.brave?$e:null}(n)||(r?.detectGoogleSearchApp&&x(e,`GSA/`)?rt:x(e,` OPR/`)&&x(e,`Mini`)?`Opera Mini`:x(e,` OPR/`)?je:lt.test(e)?Te:x(e,`IEMobile`)||x(e,`WPDesktop`)?Ae:x(e,`OculusBrowser`)?Ke:x(e,`SamsungBrowser`)?Ee:x(e,`Edge`)||x(e,`Edg/`)?Me:x(e,`Vivaldi/`)?qe:x(e,`YaBrowser/`)?Je:x(e,`Whale/`)?Ye:x(e,`DuckDuckGo/`)||x(e,`Ddg/`)?Xe:x(e,`Claude/`)?et:x(e,`Codex/`)?tt:x(e,`ChatGPT/`)?nt:x(e,`FBIOS`)?`Facebook Mobile`:x(e,`UCWEB`)||x(e,`UCBrowser`)?`UC Browser`:x(e,`CriOS`)?Oe:x(e,`CrMo`)||x(e,De)?De:x(e,ye)&&x(e,we)?Re:x(e,`FxiOS`)?Pe:x(e.toLowerCase(),`konqueror`)?Ge:x(e,`Brave/`)?$e:((e,t)=>t&&x(t,`Apple`)||function(e){return x(e,we)&&!x(e,De)&&!x(e,ye)}(e))(e,t)?x(e,ve)?ze:we:x(e,`PaleMoon/`)?Ze:x(e,`Waterfox/`)?Qe:x(e,Ne)?Ne:x(e,`MSIE`)||x(e,`Trident/`)?ke:x(e,`Gecko`)?Ne:``)},ft={[Ae]:[/* @__PURE__ */ RegExp(`rv:(\\d+(\\.\\d+)?)`)],[Me]:[/* @__PURE__ */ RegExp(`Edge?\\/(\\d+(\\.\\d+)?)`)],[De]:[/* @__PURE__ */ RegExp(`(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)`)],[Oe]:[/* @__PURE__ */ RegExp(`CriOS\\/(\\d+(\\.\\d+)?)`)],"UC Browser":[/* @__PURE__ */ RegExp(`(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)`)],[we]:[it],[ze]:[it],[je]:[/* @__PURE__ */ RegExp(`(Opera|OPR)\\/(\\d+(\\.\\d+)?)`)],[Ne]:[/* @__PURE__ */ RegExp(`Firefox\\/(\\d+(\\.\\d+)?)`)],[Pe]:[/* @__PURE__ */ RegExp(`FxiOS\\/(\\d+(\\.\\d+)?)`)],[Ge]:[/* @__PURE__ */ RegExp(`Konqueror[:/]?(\\d+(\\.\\d+)?)`,`i`)],[Te]:[/* @__PURE__ */ RegExp(`BlackBerry (\\d+(\\.\\d+)?)`),it],[Re]:[/* @__PURE__ */ RegExp(`android\\s(\\d+(\\.\\d+)?)`,`i`)],[Ee]:[/* @__PURE__ */ RegExp(`SamsungBrowser\\/(\\d+(\\.\\d+)?)`)],[Ke]:[/* @__PURE__ */ RegExp(`OculusBrowser\\/(\\d+(\\.\\d+)?)`)],[qe]:[/* @__PURE__ */ RegExp(`Vivaldi\\/(\\d+(\\.\\d+)?)`)],[Je]:[/* @__PURE__ */ RegExp(`YaBrowser\\/(\\d+(\\.\\d+)?)`)],[Ye]:[/* @__PURE__ */ RegExp(`Whale\\/(\\d+(\\.\\d+)?)`)],[$e]:[/* @__PURE__ */ RegExp(`Brave\\/(\\d+(\\.\\d+)?)`)],[et]:[at],[tt]:[at],[nt]:[at],[Xe]:[/* @__PURE__ */ RegExp(`(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)`)],[Ze]:[/* @__PURE__ */ RegExp(`PaleMoon\\/(\\d+(\\.\\d+)?)`)],[Qe]:[/* @__PURE__ */ RegExp(`Waterfox\\/(\\d+(\\.\\d+)?)`)],[rt]:[/* @__PURE__ */ RegExp(`GSA\\/(\\d+(\\.\\d+)?)`)],[ke]:[/* @__PURE__ */ RegExp(`(rv:|MSIE )(\\d+(\\.\\d+)?)`)],Mozilla:[/* @__PURE__ */ RegExp(`rv:(\\d+(\\.\\d+)?)`)]},pt=function(e,t,n,r){let i=dt(e,t,n,r),a=ft[i];if(A(a))return null;for(let t=0;a.length>t;t++){let n=e.match(a[t]);if(n)return parseFloat(n[n.length-2])}return null},mt=[[/* @__PURE__ */ RegExp(`Xbox; Xbox (.*?)[);]`,`i`),e=>[Le,e&&e[1]||``]],[RegExp(Fe,`i`),[Fe,``]],[RegExp(Ie,`i`),[Ie,``]],[lt,[Te,``]],[RegExp(Be,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ve,``];if(RegExp(ve).test(t)&&!/IEMobile\b/.test(t))return[`Windows Mobile`,``];let n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let e=ut[n[1]]||``;return/arm/i.test(t)&&(e=`RT`),[Be,e]}return[Be,``]}],[/((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=>{let t=``;return e&&e.length>=3&&(t=A(e[2])?e[3]:e[2]),[`watchOS`,t]}],[/* @__PURE__ */ RegExp(`(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)`,`i`),e=>e&&e[2]?[ye,[e[2],e[3],e[4]||`0`].join(`.`)]:[ye,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let 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/,[`Chrome OS`,``]],[/Linux|debian/i,[`Linux`,``]]],ht=function(e){for(let t=0;mt.length>t;t++){let[n,r]=mt[t],i=n.exec(e),a=i&&(D(r)?r(i,e):r);if(a)return a}return[``,``]},gt=function(e){return ct.test(e)?Fe:st.test(e)?Ie:ot.test(e)?Le:RegExp(Ue,`i`).test(e)?Ue:(/* @__PURE__ */ RegExp(`(Windows Phone|WPDesktop)`,`i`)).test(e)?Ve:/iPad/.test(e)?Se:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ce:lt.test(e)?Te:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:RegExp(He,`i`).test(e)?He:/(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)?RegExp(ve).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)?ye:xe:(/* @__PURE__ */ RegExp(`(pda|Mobile)`,`i`)).test(e)?`Generic mobile`:RegExp(be,`i`).test(e)&&!(/* @__PURE__ */ RegExp(`Tablet pc`,`i`)).test(e)?We:``},_t=function(e,t){let n=gt(e);return n===Se||n===xe||n===`Kobo`||n===`Kindle Fire`||n===We?be:n===Fe||n===Le||n===Ie||n===Ue?`Console`:n===Ce?`Wearable`:n?ve:t?.userAgentDataPlatform===`Android`&&(t?.maxTouchPoints??0)>0?600>Math.min((r=t?.screenWidth)??0,(i=t?.screenHeight)??0)/((a=t?.devicePixelRatio)??1)?ve:be:`Desktop`;var r,i,a},vt=/\bFBAV\/(\d+(?:\.\d+)*)/i,yt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,`Instagram`],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,`Threads`],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,`Messenger`,vt],[/\bFBAN\/EMA\b/i,`Facebook Lite`,vt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,`Facebook`,vt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,`LinkedIn`],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,`Twitter`],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,`TikTok`,/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,`WeChat`],[/\bLine\/(\d+(?:\.\d+)*)?/i,`Line`],[/\bGSA\/(\d+(?:\.\d+)*)?/i,`Google`],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,`Pinterest`],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,`WhatsApp`],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,`Snapchat`],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,`Bing`],[/\bNAVER\(inapp; search;/i,`Naver`,/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,`KakaoTalk`]],bt=`[Truncated]`,xt=`[Unserializable]`;function St(e){let t=``;for(let n=0;e.length>n;n++){let r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:`�`;else{let r=e.charCodeAt(n+1);56320>r||r>57343?t+=`�`:(t+=e[n]+e[n+1],n++)}}return t}function Ct(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(let r of n){let n;try{n=t[r]}catch{n=xt}Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}const wt=3e5;var Tt=class{record(e){if(e.kind===`too-large`)return;if(e.kind!==`retry-later`)return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),n=Date.now(),r=Math.min(e.retryAfterMs,wt);if(!t)return this.ts=n,void(this.es=n+r);this.es=Math.max(this.es,Math.min(n+r,this.ts+wt))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(wt,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const Et=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Dt(e,t){return typeof(n=e)==`string`&&Et.test(n)?e:t();var n}function Ot(e,t){let n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function kt(e){return e&&e.split(`#`)[0]}function At(e){try{return e()}catch{return}}function jt(e,t){let n=setTimeout(e,t);return n!=null&&n.unref&&n?.unref(),n}function Mt(e,t,n){return Nt.apply(this,arguments)}function Nt(){return(Nt=L(function*(e,t,n){let r;try{return yield Promise.race([e,new Promise((e,i)=>{r=jt(()=>{try{n?.(),e()}catch(e){i(e)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}let Pt,Ft,It;function Lt(e){let t=globalThis._posthogChunkIds;if(!t)return;let n=Object.keys(t);return It&&n.length===Ft||(Ft=n.length,It=n.reduce((n,r)=>{Pt||={};let i=Pt[r];if(i)n[i[0]]=i[1];else{let i=e(r);for(let e=i.length-1;e>=0;e--){let a=i[e]?.filename,o=t[r];if(a&&o){n[a]=o,Pt[r]=[a,o];break}}}return n},{})),It}function Rt(e){return Rt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Rt(e)}function zt(e,t,n){return(t=function(e){var t=function(e){if(Rt(e)!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(Rt(n)!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return Rt(t)==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Bt(Object(n),!0).forEach(function(t){zt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Vt=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){let n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return L(function*(){for(let n of e)n.stacktrace&&n.stacktrace.frames&&E(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let n,r;if(e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return R(R({},e),{},{cause:n,stack:r,errors:e.errors?.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return L(function*(){let n=e;for(let e of t.modifiers)n=yield e(n);return n})()}convertToExceptionList(e,t){let n=[],r=(e,i,a)=>{let o=n.length,s=i===void 0?R(R({type:typeof t.type==`string`&&t.type.length>0?t.type:`generic`},typeof t.handled==`boolean`?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic==`boolean`?t.synthetic:e.synthetic,exception_id:o}):{type:`chained`,source:a,synthetic:e.synthetic,exception_id:o,parent_id:i},c={type:e.type,value:e.value,mechanism:s};e.stack&&(c.stacktrace={type:`raw`,frames:e.stack}),n.push(c),e.cause&&r(e.cause,o,`cause`);for(let t of e.errors??[])r(t,o,`member`)};return r(e),n}buildParsingContext(e){return{chunkIdMap:Lt(this.stackParser),skipFirstLines:e.skipFirstLines??1}}getAggregateErrors(e){try{if(se(e)){let t=Object.getPrototypeOf(e);for(let n=0;t&&100>n;n++){let n=Object.getOwnPropertyDescriptor(t,`constructor`)?.value;if(typeof n==`function`&&n.name===`AggregateError`){let t=e.errors;return E(t)?t:void 0}t=Object.getPrototypeOf(t)}}}catch{}}buildCoercingContext(e,t,n=0){let r=0,i=0,a=!1,o=/* @__PURE__ */ new Set,s=[],c={},l=(e,t,n=0)=>{let l=u(t,n),d=l.apply;if(l.apply=t=>{s.push(e);try{return d(t)}finally{s.pop()}},n>4||n>0&&s.indexOf(e)!==-1)return this.coerceFallback(l);let f=typeof e==`object`&&!!e||typeof e==`function`;if(n===0&&r>=50||f&&o.has(e))return;f&&o.add(e),n===0&&r++;let p=this.getAggregateErrors(e),m,h;a||=!!p;try{if(m=this.applyCoercers(e,l),!m)throw c}catch(e){if(e===c)return void(n===0&&r--);if(!a)throw e;m=this.coerceFallback(l)}if(!p||r>=50)return m;try{h=p.length}catch{return m}if(!Number.isInteger(h)||0>h||h>4294967295)return m;let g=[];for(let e=0;50>r&&1e3>i&&h>e;e++){let n;i++;try{n=l.next(p[e])}catch{r++,n=this.coerceFallback(u(t+1))}n&&g.push(n)}return R(R({},m),{},{errors:g})},u=(n,r=0)=>R(R({},t),{},{syntheticException:n==0?t.syntheticException:void 0,mechanism:n==0?e:{},apply(e){let t=l(e,n,r+1);if(!t)throw c;return t},next:e=>l(e,n+1)}),d=u(n);return R(R({},d),{},{apply:e=>l(e,n)??this.coerceFallback(d)})}};const Ht=/^([a-z][a-z0-9.+-]+):/i,Ut=[`http`,`https`,`file`,`blob`,`app`,`capacitor`,`ionic`,`webpack`,`webpack-internal`,`ng`];function Wt(e){if(!e||e===`<anonymous>`)return!1;let t=Ht.exec(e);return!t||Ut.includes(t[1].toLowerCase())}function Gt(e,t,n,r,i){let a={platform:e,filename:t,function:n===`<anonymous>`?`?`:n,in_app:Wt(t)};return A(r)||(a.lineno=r),A(i)||(a.colno=i),a}const Kt=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},qt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Jt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xt=(e,t)=>{let n=qt.exec(e);if(n){let[,e,r,i]=n;return Gt(t,e,`?`,+r,+i)}let r=Jt.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){let e=Yt.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,n]=Kt(r[1]||`?`,r[2]);return Gt(t,n,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Zt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Qt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$t=(e,t)=>{let n=Zt.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){let e=Qt.exec(n[3]);e&&(n[1]=n[1]||`eval`,n[3]=e[1],n[4]=e[2],n[5]=``)}let e=n[3],r=n[1]||`?`;return[r,e]=Kt(r,e),Gt(t,e,r,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},en=/\(error: (.*)\)/;function tn(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function nn(e){for(let t=1;10>=t;t++){let n=e.length-2*t;if(0>n)break;let r=!0;for(let i=0;t>i;i++)if(!tn(e[n+i],e[n+t+i])){r=!1;break}if(r){for(let r=0;t>r;r++)e[n+r]=e[n+t+r];return e.length=n+t,{start:n,length:t}}}}function rn(e,t){let n=t.start+t.length,r=on(e,t);r&&e.splice(n+r===e.length?n:t.start,r)}function an(e,t){let n=t.start;for(;n>0&&tn(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function on(e,t){let n=t.start+t.length,r=n;for(;e.length>r&&tn(e[r],e[r-t.length]);)r++;return r-n}function sn(e,t){let n=t[0],r=e.length-(n?an(e,n):0);for(let n of t)r-=on(e,n);return r}function cn(e,t,n){for(let r=0;e.length>r;r++){let i=e[(t+r)%e.length],a=e[(n+r)%e.length];if(i!==a)return a>i}return!1}var ln=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let n=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?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){let t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?`${t}: ${e.message}`:t}isDOMException(e){return oe(e,`DOMException`)}isDOMError(e){return oe(e,`DOMError`)}},un=class{match(e){return se(e)}coerce(e,t){let n=this.getStack(e),r=n===void 0?t.syntheticException?.stack:void 0,i=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:n??r,cause:e.cause?t.next(e.cause):void 0,synthetic:i}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let n=e.message;return String(n.error&&typeof n.error.message==`string`?n.error.message:n)}getStack(e){try{let t=e.stacktrace;if(typeof t==`string`&&t.length>0)return t;let n=e.stack;return typeof n==`string`&&n.length>0?n:void 0}catch{return}}},dn=class{match(e){return!!oe(e,`ErrorEvent`)&&(e.error!=null||this.ur(e))}coerce(e,t){if(e.error!=null)return t.apply(e.error);let n=t.apply(e.message);return R(R({},n),{},{stack:this.cr(e)??n.stack,synthetic:!0})}ur(e){return j(e.message)&&e.message.length>0}cr(e){let t=e,n=t.lineno??0,r=t.colno??0;if(j(t.filename)&&t.filename.length!==0&&n!==0)return`Error\n at ${t.filename}:${n}:${r}`}};const fn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var pn=class{match(e){return typeof e==`string`}coerce(e,t){let[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t=`Error`,n=e,r=e.match(fn);return r&&(t=r[1],n=r[2]),[t,n]}};const mn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function hn(e,t=40){let n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(let e=n.length;e>0;e--){let r=n.slice(0,e).join(`, `);if(t>=r.length)return e===n.length?r:r.length>t?`${r.slice(0,t)}...`:r}return``}var gn=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:this.getStack(e)??t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){if(ce(e))return e.constructor.name;let t=`name`in e?e.name:void 0;return j(t)&&!M(t)?t:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '${e.message}'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;let t=this.getObjectClassName(e);return`${t&&t!==`Object`?`'${t}'`:`Object`} captured as exception with keys: ${hn(e)}`}isSeverityLevel(e){return j(e)&&!M(e)&&mn.indexOf(e)>=0}getStack(e){try{return j(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:j(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let n=e[t];if(se(n))return n}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},_n=class{match(e){return ce(e)}coerce(e,t){let n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${hn(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},vn=class{match(e){return ae(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},yn=class{match(e){return oe(e,`PromiseRejectionEvent`)||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ce(e))return!1;try{let t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){let n=this.getUnhandledRejectionReason(e);return ae(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if(`reason`in e)return e.reason;if(`detail`in e&&e.detail!=null&&typeof e.detail==`object`&&`reason`in e.detail)return e.detail.reason}catch{}return e}};const bn=`$message`,xn=`$timestamp`,Sn=/* @__PURE__ */ new Set([bn,xn]),Cn={enabled:!0,max_bytes:32768};function wn(e){return e?{enabled:e.enabled??Cn.enabled,max_bytes:En(e.max_bytes,Cn.max_bytes)}:R({},Cn)}var Tn=class{constructor(e){this.ns=[],this.ss=0,this.Rr=wn(e)}setConfig(e){this.Rr=wn(e),this.rs()}add(e){let t=function(e){let t;try{t=w(e)}catch{return}try{let e=JSON.parse(t);if(!O(e))return;let n=e,r=n[bn],i=n[xn];return!j(r)||r.trim().length===0||!j(i)&&!F(i)?void 0:{step:n,json:t}}catch{return}}(e);if(!t)return;let n=function(e){if(`u`>typeof TextEncoder)return new TextEncoder().encode(e).length;let t=encodeURIComponent(e),n=0;for(let e=0;t.length>e;e++)t[e]===`%`?(n+=1,e+=2):n+=1;return n}(t.json);n>this.Rr.max_bytes||(this.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function En(e,t){if(!F(e)||1/0===e||-1/0===e)return t;let n=Math.floor(e);return 0>n?t:n}const Dn=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function On(e){return typeof e==`string`||e}function kn(e){return typeof e==`string`?e:void 0}const An=/* @__PURE__ */ `$feature_flag.$feature_flag_response.$feature_flag_has_experiment.$feature_flag_id.$feature_flag_version.$feature_flag_reason.$feature_flag_request_id.$feature_flag_evaluated_at.$feature_flag_error.locally_evaluated.$groups.$process_person_profile.$geoip_disable.$current_url.$pathname.$referring_domain.utm_source.utm_medium.utm_campaign.utm_content.utm_term.gad_source.mc_cid.gclid.gclsrc.dclid.gbraid.wbraid.fbclid.msclkid.twclid.li_fat_id.igshid.ttclid.rdt_cid.epik.qclid.sccid.irclid._kx.$session_id.$window_id.$lib.$lib_version.$device_id.$is_server`.split(`.`),jn=`NativeGzipValidationError`,Mn=e=>e.length>=2&&e[0]===31&&e[1]===139,Nn=(e,t)=>e===v.GZipJS||t===v.GZipJS||t===`gzip`,Pn=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`;let Fn;const In=e=>{throw Ot(jn,`Native gzip produced invalid output: ${e}`)},Ln=(Rn=L(function*(e,t){18>e.size&&In(`too-short`);let n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Mn(n)&&n[2]===8||In(`invalid-header`);let r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{let t=(()=>{if(Fn)return Fn;Fn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;Fn[e]=t>>>0}return Fn})(),n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&In(`invalid-crc`);let i=t.length>>>0;r.getUint32(4,!0)!==i&&In(`invalid-size`)}),function(e,t){return Rn.apply(this,arguments)});var Rn;function zn(){return zn=L(function*(e,t=!0,n){try{let t=new TextEncoder().encode(e),n=new globalThis.CompressionStream(`gzip`),i=n.writable.getWriter(),a=i.write(t).then(()=>i.close()).catch((r=L(function*(e){try{yield i.abort(e)}catch{}throw e}),function(e){return r.apply(this,arguments)})),o=new Response(n.readable).blob(),[s]=yield Promise.all([o,a]);return yield Ln(s,t),s}catch(e){if(n?.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}var r}),zn.apply(this,arguments)}function Bn(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;a.length>r;r++)t.includes(n=a[r])||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}const Vn={}.propertyIsEnumerable;function Hn(e,t){try{return Gn(e,t,{ancestors:/* @__PURE__ */ new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Un(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:bt};if(n.remainingNodes--,I(e))return{boolValue:e};if(typeof e==`bigint`)return function(e,t){let n=e.toString(),r=BigInt(`9223372036854775808`);return e>=r||-r>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}(e,t);if(typeof e==`number`){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>`u`)return{stringValue:String(e)};let n=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e==`string`)return{stringValue:St(e)};if(typeof e==`function`)return{stringValue:`[Function]`};if(typeof e==`symbol`)return{stringValue:String(e)};if(typeof e==`object`&&e){if(n.ancestors.has(e))return{stringValue:`[Circular]`};if(r>=20)return{stringValue:bt};if(e instanceof Date){let t=e.getTime(),n=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:typeof n==`string`?St(n):String(n)}}n.ancestors.add(e);try{try{let i=e.toJSON;if(typeof i==`function`)return Un(i.call(e),t,n,r+1)}catch{}return E(e)?{arrayValue:{values:Wn(e,t,n,r+1)}}:{kvlistValue:{values:Gn(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:St(String(e))}}function Wn(e,t,n,r){let i=[],a=Math.min(e.length,1e3),o=0;for(;a>o&&n.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(P(a))continue;i.push(Un(a,t,n,r))}catch{i.push({stringValue:xt})}return e.length>o&&i.push({stringValue:bt}),i}function Gn(e,t,n,r){let i=[];for(let a in e)if(Vn.call(e,a)){if(!a){t?.debug(`Dropping an attribute with an empty key`);continue}if(i.length>=1e3||0>=n.remainingNodes){t?.debug(`Attributes truncated: the value exceeds the OTLP encoder budget`);break}try{let o=e[a];if(N(o)||A(o))continue;i.push({key:St(a),value:Un(o,t,n,r)})}catch{i.push({key:St(a),value:{stringValue:xt}})}}return i}function Kn(e,t,n){return R(R(R(R({},Ct({},e.resourceAttributes)),{},{"service.name":e.serviceName||`unknown_service`},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}const qn=[`service.name`,`deployment.environment`,`service.version`,`telemetry.sdk.name`,`telemetry.sdk.version`];function Jn(e,t){let n=Ct({},e),r={};for(let e of qn)({}).hasOwnProperty.call(n,e)&&(r[e]=n[e],delete n[e]);return[...Hn(n,t),...Hn(r,t)]}const Yn={darwin:`macOS`,win32:`Windows`,cygwin:`Windows`,linux:`Linux`,android:`Android`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,netbsd:`NetBSD`,sunos:`SunOS`,aix:`AIX`,haiku:`Haiku`,"Mac OS X":`macOS`},Xn={trace:{text:`TRACE`,number:1},debug:{text:`DEBUG`,number:5},info:{text:`INFO`,number:9},warn:{text:`WARN`,number:13},error:{text:`ERROR`,number:17},fatal:{text:`FATAL`,number:21}},Zn=Xn.info;function Qn(e){try{return St(String(e))}catch{return xt}}function $n(e,t,n,r){let i=e.level||`info`,{text:a,number:o}=Xn[i]||Zn,s=function(e=Date.now()){return String(e)+`000000`}(F(r)?r:void 0),c={};t.distinctId&&(c.posthogDistinctId=t.distinctId),t.sessionId&&(c.sessionId=t.sessionId),t.windowId&&(c[`window.id`]=t.windowId),P(t.sessionStartTimestamp)||(c.sessionStartTimestamp=String(t.sessionStartTimestamp)),P(t.lastActivityTimestamp)||(c.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(c[`url.full`]=t.currentUrl),t.screenName&&(c[`screen.name`]=t.screenName),t.appState&&(c[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(c.feature_flags=t.activeFeatureFlags);let l=R({},c),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch{e=[]}for(let t of e){let e;try{e=u[t]}catch{e=xt}Object.defineProperty(l,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let d={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:o,severityText:a,body:{stringValue:Qn(e.body)},attributes:Hn(l,n)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),A(e.trace_flags)||(d.flags=e.trace_flags),d}function er(e,t,n){return Kn(e,t,n)}function tr(e,t,n,r){return{resourceLogs:[{resource:{attributes:Jn(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var nr=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=jt(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&=(clearTimeout(this.hs),void 0)}};function rr(){return .75+.5*Math.random()}function ir(e,t,n,r){let i=e*2**Math.min(Math.max(0,t-1),6);return Math.round((r===void 0?i:Math.min(i,Math.max(r,e)))*n)}var ar=class{constructor(e,t,n,r,i,a=()=>Promise.resolve(),o){this._instance=e,this.Rr=t,this.$=n,this.cs=r,this.ds=i,this.vs=a,this.fs=o,this.ps=new nr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Tt,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max(t.maxQueueSize??t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(_.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;let n=this.Os(e);if(n===null)return;if(!n.body)return void this.$.info(`Log was rejected in beforeSend function`);if(!this.Ds())return;let r={record:$n(n,t?.context??this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Log was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for log:`,e),null}return r}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||=(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),!0),!1)}flush(){var e=this;return L(function*(){if(!e._instance.isDisabled)return e.ys||=e.Ns().finally(()=>{e.ys=null}),e.ys})()}Ns(){var e=this;return L(function*(){e.ps.clear();let t=e._instance.getPersistedProperty(_.LogsQueue)??[];if(t.length===0)return;let n=t.length,r=0;for(;t.length>0&&n>r;){let n=e._s;e.bs=0;let i=Math.min(t.length,e.Es),a=t.slice(0,i),o=tr(a.map(e=>e.record),e.qs(),e.fs??e._instance.getLibraryId(),e._instance.getLibraryVersion()),s=yield e._instance.js(o);if(e._s!==n)return;if(s.kind===`too-large`&&a.length>1)e.Es=Math.max(1,Math.floor(a.length/2)),e.$.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(s),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),s.kind===`retry-later`||(s.kind===`too-large`?e.$.warn(`Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further.`):s.kind===`ok`&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),t=e._instance.getPersistedProperty(_.LogsQueue)??[],r+=a.length,s.kind===`fatal`))throw s.error}})()}Bs(e){var t=this;return L(function*(){let n=Math.max(0,e-t.bs),r=t._instance.getPersistedProperty(_.LogsQueue)??[];t._instance.setPersistedProperty(_.LogsQueue,r.slice(n)),yield t.vs()})()}qs(){return er(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){if(this._instance.optedOut)return;let t=this._instance.getPersistedProperty(_.LogsQueue)??[];this.Is>t.length||(t.shift(),this.bs++,this.$.info(`Logs queue is full, dropping oldest record.`)),t.push(e),this._instance.setPersistedProperty(_.LogsQueue,t),this.Ts>t.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(ir(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(_.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return L(function*(){t.ps.clear();let n=t.flush().catch(()=>{});e===void 0?yield n:yield Mt(n,e)})()}flushWithTimeout(e){var t=this;return L(function*(){let n=t.flush();yield Mt(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=rr(),this.$.error(`PostHog logs flush failed:`,e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const or=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function sr(e){return String(e)+`000000`}function cr(e,t,n,r){let i=``;return r&&(i=Object.keys(r).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(r[e])}`).join(`,`)),`${e}\0${t}\0${n??``}\0${i}`}var lr=class{constructor(e,t,n){this._instance=e,this.Rr=t,this.$=n,this.zs=/* @__PURE__ */ new Map,this.ps=new nr(()=>this.flush().catch(e=>{this.$.error(`Metrics flush failed:`,e)})),this.ys=null,this.Us=!1,this.Ws=/* @__PURE__ */ new Map,this.Vs=/* @__PURE__ */ new Set,this.ws=new Tt,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({name:e,type:`count`,value:t,unit:n?.unit,attributes:n?.attributes})}gauge(e,t,n){this.Zs({name:e,type:`gauge`,value:t,unit:n?.unit,attributes:n?.attributes})}histogram(e,t,n){this.Zs({name:e,type:`histogram`,value:t,unit:n?.unit,attributes:n?.attributes})}flush(){var e=this;let t=this.ys,n=function(){var n=L(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return n.apply(this,arguments)}}()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.zs.size===0)return null;let e=this.zs;return this.zs=/* @__PURE__ */ new Map,this.Us=!1,this.Ws=/* @__PURE__ */ new Map,this.Vs=/* @__PURE__ */ new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=/* @__PURE__ */ new Map,this.ys=null,this.Us=!1,this.Ws=/* @__PURE__ */ new Map,this.Vs=/* @__PURE__ */ new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!=`string`)return void this.$.warn(`Dropping metric with empty name`);if(typeof t.value!=`number`||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type===`count`&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,r;try{n=t.attributes?R({},t.attributes):void 0,r=cr(t.type,t.name,t.unit,n)}catch(e){this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e);return}let i=this.zs.get(r);if(!i){if(!this.Ks())return;i={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.zs.set(r,i)}let a=this.Ws.get(t.name);a===void 0?this.Ws.set(t.name,t.type):a===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${a}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(i,t.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case`count`:e.total=(e.total??0)+t;break;case`gauge`:e.last=t;break;case`histogram`:{e.hist||={count:0,sum:0,min:t,max:t,bucketCounts:Array(or.length+1).fill(0)};let n=e.hist;n.count+=1,n.sum+=t,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.bucketCounts[function(e,t){for(let n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}(t,or)]+=1;break}}}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Metric was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for metric:`,e),null}return r}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(ir(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return L(function*(){if(e.ps.clear(),e.zs.size===0)return;let t=e.zs;e.zs=/* @__PURE__ */ new Map,e.Us=!1,e.Ws=/* @__PURE__ */ new Map,e.Vs=/* @__PURE__ */ new Set;let n=e.Gs,r=yield e._instance.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(r),r.kind===`retry-later`?(e.ks++,e.Ss=rr()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),r.kind){case`ok`:return;case`retry-later`:e.ho(t),e.ps.armNoEarlierThan(e.Hs());return;case`too-large`:e.$.warn(`Metrics batch exceeded the server size limit and was dropped`);return;case`fatal`:e.$.error(`Failed to send metrics batch:`,r.error);return}})()}Js(e){return t=this.vo(e),n=function(e,t,n){return Kn(e,t,n)}(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Jn(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}vo(e){let t=sr(Date.now()),n=/* @__PURE__ */ new Map;for(let r of e.values()){let e=cr(r.type,r.name,r.unit,void 0),i=n.get(e);i||(i=R({name:r.name},r.unit&&{unit:r.unit}),r.type===`count`?i.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type===`gauge`?i.gauge={dataPoints:[]}:i.histogram={aggregationTemporality:1,dataPoints:[]},n.set(e,i));let a=Hn(r.attributes??{},this.$),o=sr(r.windowStartMs);if(r.type===`count`){let e={attributes:a,startTimeUnixNano:o,timeUnixNano:t,asDouble:r.total??0};i.sum.dataPoints.push(e)}else if(r.type===`gauge`){let e={attributes:a,timeUnixNano:t,asDouble:r.last??0};i.gauge.dataPoints.push(e)}else r.hist&&i.histogram.dataPoints.push({attributes:a,startTimeUnixNano:o,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:or})}return Array.from(n.values())}ho(e){for(let[t,n]of e){let e=this.zs.get(t);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case`count`:e.total=(e.total??0)+(n.total??0);break;case`gauge`:break;case`histogram`:if(n.hist){if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}}else this.Ks()&&this.zs.set(t,n)}}};const ur=(e,{debugEnabled:t}={})=>{let r={N(r,...i){n&&(g.DEBUG||n.POSTHOG_DEBUG||t)&&!A(n.console)&&n.console&&(`__rrweb_original__`in n.console[r]?n.console[r].__rrweb_original__:n.console[r])(e,...i)},debug(...e){r.N(`debug`,...e)},info(...e){r.N(`log`,...e)},warn(...e){r.N(`warn`,...e)},error(...e){r.N(`error`,...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){r.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,n)=>ur(`${e} ${t}`,n)};return r},z=ur(`[PostHog.js]`),B=z.createLogger,dr=B(`[ExternalScriptsLoader]`),fr=e=>{let t=a?.querySelectorAll(`script`);if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute(`src`)===e)return t[n]}},pr=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return dr.warn(`${t} was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);let r=fr(t);if(r){if(r.__posthog_loading_callback_fired)return n();let e=r.__posthog_loading_error;return e?n(e):(r.addEventListener(`load`,e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)}),void r.addEventListener(`error`,e=>{r.__posthog_loading_error=e,n(e)}))}let i=()=>{if(!a)return n(`document not found`);if(fr(t))return pr(e,t,n);let r=a.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>{r.__posthog_loading_error=e,n(e)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)a.head.appendChild(r);else{let e=a.querySelectorAll(`body > script`);var i;e.length>0?(i=e[0].parentNode)==null||i.insertBefore(r,e[0]):a.body.appendChild(r)}};a?.body?i():a?.addEventListener(`DOMContentLoaded`,i)},mr={},hr=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;if(t===`toolbar`){let e=3e5;n=`${n}&t=${Math.floor(Date.now()/e)*e}`}return e.requestRouter.endpointFor(`assets`,n)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t===`remote-config`){let t=e.requestRouter.endpointFor(`assets`,`/array/${e.config.token}/config.js`);pr(e,t,n);return}let r=e.config.strict_script_versioning;if(r){let i=e.requestRouter.endpointFor(`assets`,`/static/${e.version}/${t}.js`),a=mr[i];if(r===`fallback`&&a){if(fr(a))return void pr(e,a,n);delete mr[i]}pr(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o;let r=hr(e,t);mr[i]=r;let a=fr(i);a==null||(o=a.parentNode)==null||o.removeChild(a),pr(e,r,n)}}else n(void 0,a)}:n);return}pr(e,hr(e,t),n)},m.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{let r=e.requestRouter.endpointFor(`api`,t);pr(e,r,n)},g.DEBUG=!1,g.LIB_VERSION=`1.434.12`,g.LIB_NAME=`web`;var V=g;const gr=`distinct_id`,_r=`$device_id`,vr=`$device_model`,yr=`__alias`,br=`$fbc`,xr=`$fbc_persistence`,Sr=`$fbp`,Cr=`$fbp_persistence`,wr=`__timers`,Tr=`$autocapture_disabled_server_side`,Er=`$heatmaps_enabled_server_side`,Dr=`$exception_capture_enabled_server_side`,Or=`$error_tracking_suppression_rules`,kr=`$error_tracking_capture_extension_exceptions`,Ar=`$web_vitals_enabled_server_side`,jr=`$dead_clicks_enabled_server_side`,Mr=`$product_tours_enabled_server_side`,Nr=`$logs_capture_enabled_server_side`,Pr=`$web_vitals_allowed_metrics`,Fr=`$session_recording_remote_config`,Ir=`$sesid`,Lr=`$session_is_sampled`,Rr=`$enabled_feature_flags`,zr=`$active_feature_flags`,Br=`$early_access_features`,Vr=`$feature_flag_details`,Hr=`$feature_flag_payloads`,Ur=`$feature_flag_request_id`,Wr=`$minimal_flag_called_events`,Gr=`$override_feature_flags`,Kr=`$override_feature_flag_payloads`,qr=`$stored_person_properties`,Jr=`$stored_group_properties`,Yr=`$groups`,Xr=`$surveys`,Zr=`$surveys_loaded_at`,Qr=`$surveys_activated`,$r=`$surveys_activated_session`,ei=`$surveys_activated_timestamps`,ti=`ph_product_tours`,ni=`$flag_call_reported`,ri=`$flag_call_reported_session_id`,ii=`$feature_flag_errors`,ai=`$feature_flag_evaluated_at`,H=`$user_state`,oi=`$client_session_props`,si=`$initial_campaign_params`,ci=`$initial_referrer_info`,li=`$initial_person_info`,ui=`$epp`,di=`$posthog_cookieless`,fi=`$cookieless_mode`,pi=`$sdk_debug_extensions_init_method`,mi=`$sdk_debug_extensions_init_time_ms`,hi=`$sdk_debug_recording_script_not_loaded`,gi=`$sdk_debug_replay_stale_config`,_i=`PostHog loadExternalDependency extension not found.`,vi=`anonymous`,yi=`identified`,bi=`identified_only`,xi=`visibilitychange`,Si=`beforeunload`,Ci=`$pageview`,wi=`$pageleave`,Ti=`$identify`,Ei=`$groupidentify`;function Di(e,t){E(e)&&e.forEach(t)}function U(e,t){if(!P(e)){if(E(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(let n in e)T.call(e,n)&&t(e[n],n)}}const W=function(e,...t){for(let n of t)for(let t in n)n[t]!==void 0&&(e[t]=n[t]);return e};function Oi(e){let t=Object.keys(e),n=t.length,r=Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}const ki=function(e){return function(...t){try{return e.apply(this,t)}catch(e){z.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),z.critical(e)}}},Ai=function(e){let t={};return U(e,function(e,n){(j(e)&&e.length>0||F(e))&&(t[n]=e)}),t};function ji(e){let t=R({},e);for(let n of[`name`,`message`,`stack`,`cause`,`errors`])try{n in e&&(t[n]=e[n])}catch{}return t}const Mi=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Ni(e){let t=e?.hostname;if(!j(t))return!1;let n=t.split(`.`).slice(-2).join(`.`);for(let e of Mi)if(n===e)return!1;return!0}function G(e,t,n,r){let{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function Pi(e){return e.name===`ph_toolbar_internal`}const Fi=e=>{if(a){try{let t=e+`=`,n=a.cookie.split(`;`).filter(e=>e.length);for(let e=0;n.length>e;e++){let r=n[e];for(;r.charAt(0)==` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return F(e)&&isFinite(e)&&Math.floor(e)===e});var Ii=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);let a=/* @__PURE__ */ new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/256,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){let e=``;for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let t=0;16>t;t++){let n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Li=class{generate(){let e=this.generateOrAbort();if(!A(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(A(e))throw Error(`Could not generate UUID after timestamp reset`);return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return F(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Ii.fromFieldsV7(this.Ct,Math.trunc(this.It/2**30),this.It&2**30-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new zi}};let Ri=e=>{if(`u`>typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};n&&!A(n.crypto)&&crypto.getRandomValues&&(Ri=e=>crypto.getRandomValues(e));var zi=class{nextUint32(){return this.Rt.length>this.$t||(Ri(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=/* @__PURE__ */ new Uint32Array(8),this.$t=1/0}};let Bi;const Vi=()=>Hi().toString(),Hi=()=>(Bi||=new Li).generate();let Ui=``;const Wi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Gi=null;const K={Et(){if(!N(Gi))return Gi;if(Gi=!1,a)try{let e=`__ph_cookie_support_${Vi()}`;K.At(e,`xyz`),Gi=Fi(e)===`"xyz"`,K.Lt(e)}catch{Gi=!1}return Gi},Pt(e){z.error(`cookieStore error: `+e)},Ot:Fi,Dt(e){let t;try{t=JSON.parse(K.Ot(e))||{}}catch{}return t},At(e,t,n,r,i){if(!a)return!1;try{let o=``,s=``,c=function(e,t){if(t){let t=function(e,t=a){if(Ui)return Ui;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;let n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Vi();for(;!Ui&&r--;){let e=n.slice(r).join(`.`),a=i+`=1;domain=.`+e+`;path=/`;t.cookie=a+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=a+`;max-age=0`,Ui=e)}return Ui}(e);if(!t){let n=(e=>{let t=e.match(Wi);return t?t[0]:``})(e);n!==t&&z.info(`Warning: cookie subdomain discovery mismatch`,n,t),t=n}return t?`; domain=.`+t:``}return``}(a.location.hostname,r);if(n){let e=/* @__PURE__ */ new Date;e.setTime(e.getTime()+864e5*n),o=`; expires=`+e.toUTCString()}i&&(s=`; secure`);let l=e+`=`+encodeURIComponent(JSON.stringify(t))+o+`; SameSite=Lax; path=/`+c+s;return l.length>3686.4&&z.warn(`cookieStore warning: large cookie, len=`+l.length),a.cookie=l,!0}catch{return!1}},Lt(e,t){if(a?.cookie&&(!t||!N(Fi(e))))try{K.At(e,``,-1,t)}catch{return}}};let Ki=null;const q={Et(){if(!N(Ki))return Ki;let e=!0;if(A(n))e=!1;else try{let t=`__mplssupport__`;q.At(t,`xyz`),q.Ot(t)!==`"xyz"`&&(e=!1),q.Lt(t)}catch{e=!1}return e||z.error(`localStorage unsupported; falling back to cookie store`),Ki=e,e},Pt(e){z.error(`localStorage error: `+e)},Ot(e){try{return n?.localStorage.getItem(e)}catch(e){q.Pt(e)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||{}}catch{}return null},At(e,t){try{return n?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){q.Pt(e)}return!1},Lt(e){try{n?.localStorage.removeItem(e)}catch(e){q.Pt(e)}}},qi=[qr,zr,Rr,Vr,Hr,Ur,ai,ii,ni],Ji=[_r,gr,Ir,Lr,ui,li,xr,H],Yi=e=>e+`_cpm`,Xi=[`__proto__`,`constructor`,`prototype`],Zi=e=>{if(!O(e))return{};let t={};return Object.keys(e).forEach(n=>{Xi.indexOf(n)===-1&&(t[n]=e[n])}),t},Qi=(e,t=[])=>{let n={};return[...Ji,...t].forEach(t=>{let r=e[t];A(r)||N(r)||r===``||(n[t]=r)}),n},$i=e=>{let t=5381,n=2166136261;for(let r=0;e.length>r;r++){let i=e.charCodeAt(r);t=33*t^i,n=Math.imul(n^i,16777619)}return e.length.toString(36)+`.`+(t>>>0).toString(36)+`.`+(n>>>0).toString(36)},ea=(e,t)=>({p:t,f:$i(JSON.stringify(e))}),ta=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let n=K.Dt(Yi(e)),r=n?.f===$i(t)&&E(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},na=(e,t)=>t+`|`+(K.Ot(Yi(e))||``),ra={},ia={Et:()=>!0,Pt(e){z.error(`memoryStorage error: `+e)},Ot:e=>e in ra?ra[e]:null,Dt:e=>e in ra?ra[e]:null,At:(e,t)=>(ra[e]=t,!0),Lt(e){delete ra[e]}};let aa=null;const J={Et(){if(!N(aa))return aa;if(aa=!0,A(n))aa=!1;else try{let e=`__support__`;J.At(e,`xyz`),J.Ot(e)!==`"xyz"`&&(aa=!1),J.Lt(e)}catch{aa=!1}return aa},Pt(e){z.error(`sessionStorage error: `,e)},Ot(e){try{return n?.sessionStorage.getItem(e)}catch(e){J.Pt(e)}return null},Dt(e){try{return JSON.parse(J.Ot(e))||null}catch{}return null},At(e,t){try{return n?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){J.Pt(e)}return!1},Lt(e){try{n?.sessionStorage.removeItem(e)}catch(e){J.Pt(e)}}};var oa=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode===`always`||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode===`on_reject`}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,+!!e,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){let{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get No(){let e=this.qo.Ot(this.jo);return de(e)?1:x(fe,e)?0:-1}get qo(){let e=this.Rr.opt_out_capturing_persistence_type,t=e===`localStorage`?q:K,n=t.Et()?t:ia;if(!this.Bo||this.Bo!==n){this.Bo=n;let t=e===`localStorage`?K:q;t.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(de(t.Ot(this.jo))),t.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[i?.doNotTrack,i?.msDoNotTrack,m.doNotTrack,i?.globalPrivacyControl].some(e=>de(e))}};function sa(e,t){var n;let r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!D(r))return t;try{let e=r(t);return j(e)&&e?e:t}catch(e){return z.error(`Error in get_current_url, falling back to window.location.href`,e),t}}function ca(e){return e instanceof Element&&(e.id===`__POSTHOG_TOOLBAR__`||!!e.closest?.call(e,`.toolbar-global-fade-container`))}function la(e){return!!e&&e.nodeType===1}function Y(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ua(e){return!!e&&e.nodeType===3}function da(e){return!!e&&e.nodeType===11&&la(e.host)}function fa(e){return e?S(e).split(/\s+/):[]}function pa(e,t){let r=function(e){var t;let r=n==null||(t=n.location)==null?void 0:t.href;return A(r)?void 0:sa(e,r)}(t);return!!(r&&e&&e.some(e=>r.match(e)))}function ma(e){let 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 fa(t)}function ha(e){return P(e)?null:S(e).split(/(\s+)/).filter(e=>Ba(e)).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function ga(e){let t=``;return ja(e)&&!Ma(e)&&e.childNodes&&e.childNodes.length&&U(e.childNodes,function(e){ua(e)&&e.textContent&&(t+=ha(e.textContent)??``)}),S(t)}function _a(e){return A(e.target)?e.srcElement||null:e.target?.shadowRoot?e.composedPath()[0]||null:e.target||null}const va=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function ya(e,t){let n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function ba(e,t){if(A(t))return!0;for(let n of e)if(t.some(e=>ya(n,e)))return!0;return!1}function xa(e){let t=e.parentNode;return!(!t||!la(t))&&t}const Sa=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],Ca=[`next`,`previous`,`prev`,`>`,`<`],wa=[...Ca,`+`,`-`,`−`,`–`],Ta=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Ea=[`.ph-no-rageclick`,`.ph-no-capture`],Da=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function Oa(e,t){if(!n||ka(e))return!1;let r,i,a;var o;if(I(t)?(r=!!t&&Ea,i=void 0,a=!1):(r=t?.css_selector_ignorelist??Ea,i=t?.content_ignorelist,a=(o=t?.ignore_text_selection)!=null&&o),!1===r||a&&function(e){return!(!e||!la(e))&&(!!Y(e,`textarea`)||(Y(e,`input`)?x(Da,(e.getAttribute(`type`)||``).toLowerCase()):function(e){if(e.isContentEditable)return!0;let t=e.getAttribute?.call(e,`contenteditable`);return t===`true`||t===``}(e)))}(e))return!1;let{targetElementList:s}=Aa(e,!1);return!function(e,t){if(!1===e||A(e))return!1;let n;if(!0===e)n=Ca;else{if(!E(e))return!1;if(e.length>10)return z.error(`[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>n.some(n=>Ta(e,n)||Ta(t,n)))}(i,s.map(e=>({safeText:ga(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``})))&&!ba(s,r)}const ka=e=>!e||Y(e,`html`)||!la(e),Aa=(e,t)=>{if(!n||ka(e))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1,i=[e],a=e;for(;a.parentNode&&!Y(a,`body`);){if(da(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}let e=xa(a);if(!e)break;if(t||va.indexOf(e.tagName.toLowerCase())>-1)r=!0;else try{let t=n.getComputedStyle(e);t&&t.getPropertyValue(`cursor`)===`pointer`&&(r=!0)}catch{}i.push(e),a=e}return{parentIsUsefulElement:r,targetElementList:i}};function ja(e){let t=/* @__PURE__ */ new Set,n=0;for(let r=e;r.parentNode&&!Y(r,`body`);r=r.parentNode){if(n++>=1e3||t.has(r))return!1;t.add(r);let e=ma(r);if(x(e,`ph-sensitive`)||x(e,`ph-no-capture`))return!1}if(x(ma(e),`ph-include`))return!0;let r=e.type||``;if(j(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}let i=e.name||e.id||``;return!j(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``))}function Ma(e){return!!(Y(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||Y(e,`select`)||Y(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}const Na=/* @__PURE__ */ RegExp(`^(?:(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}))$`),Pa=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Fa=[16,15,14,13],Ia=/* @__PURE__ */ RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),La=/* @__PURE__ */ RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),Ra=/[0-9A-Za-z_]/;function za(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}function Ba(e,t=!0){return!(P(e)||j(e)&&(e=S(e),(t?Na.test((e||``).replace(/[- ]/g,``)):function(e){let t;for(Pa.lastIndex=0;t=Pa.exec(e);){let e=t[2];if(!e)continue;let n=e.replace(/[- ]/g,``);for(let e=0;n.length>e;e++)for(let t of Fa){let r=e+t;if(n.length>=r){let t=n.slice(e,r);if(Na.test(t)&&za(t))return!0}}}return!1}(e))||(t?Ia.test(e):function(e){let t;for(La.lastIndex=0;t=La.exec(e);){let e=t[1],n=t[3];if(!(e&&n&&Ra.test(e)&&Ra.test(n)))return!0}return!1}(e))))}function Va(e){let t=ga(e);return t=`${t} ${Ha(e)}`.trim(),Ba(t)?t:``}function Ha(e){let t=``;return e&&e.childNodes&&e.childNodes.length&&U(e.childNodes,function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{let n=ga(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Ha(e)}`.trim())}catch(e){z.error(`[AutoCapture]`,e)}}),t}function Ua(e){return e.replace(/"|\\"/g,`\\"`)}function Wa(e){let t=e.attr__class;if(t)return E(t)?t:fa(t)}const Ga=B(`[Dead Clicks]`),Ka=()=>!0,qa=e=>{let t=!!e.instance.persistence?.get_property(jr),n=e.instance.config.capture_dead_clicks;return I(n)?n:!!O(n)||t};var Ja=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;`captureDeadClicks`in t&&(this.instance.persistence&&this.instance.persistence.register({[jr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var t,n;m.__PosthogExtensions__?.initDeadClicksAutocapture?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this.instance,`dead-clicks-autocapture`,t=>{t?Ga.error(`failed to load script`,t):e()})}Uo(){if(a){if(!this.Ho&&m.__PosthogExtensions__?.initDeadClicksAutocapture){let e=O(this.instance.config.capture_dead_clicks)?R({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Ho=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Ho.start(a),Ga.info(`starting...`)}}else Ga.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,Ga.info(`stopping...`))}};const Ya=B(`[SegmentIntegration]`);function Xa(e,t,n=!0){let r=e.config.segment;if(!r)return t();let{analytics:i,filterProperties:a}=(e=>D(e.register))(o=r)?{analytics:o}:o;var o;(function(e,t,n,r){let i=t=>{let i=()=>t.anonymousId()||Vi();e.config.get_device_id=i,r&&t.id()&&(e.register({distinct_id:t.id(),$device_id:i()}),e.persistence.set_property(H,yi)),n(r?void 0:t.anonymousId()||void 0)},a=t.user();`then`in a&&D(a.then)?a.then(i):i(a)})(e,i,n=>{i.register(((e,t,{filterProperties:n}={})=>{typeof Promise<`u`&&Promise.resolve||Ya.warn(`This browser does not have Promise support, and can not use the segment integration`);let r=(r,i)=>{if(!i)return r;let a=!!t&&r.event.anonymousId===t&&!r.event.userId;a||r.event.userId||r.event.anonymousId===e.get_distinct_id()||(Ya.info(`No userId set, resetting PostHog`),e.reset()),a||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Ya.info(`UserId set, identifying with PostHog`),e.identify(r.event.userId));let o=e.calculateEventProperties(i,r.event.properties);if(!P(n)){let e=r.event.properties||{},t={};for(let n of Object.keys(o))T.call(e,n)||(t[n]=o[n]);let i=((e,t)=>{let n=E(e)?e:[e],r=R({},t);for(let e of n)try{if(r=e(r),P(r))return null}catch(e){return Ya.error(`Error in Segment filterProperties:`,e),null}return r})(n,t);if(P(i))return r;o=i}return r.event.properties=Object.assign({},o,r.event.properties),r};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded(){return!0},load(){return Promise.resolve()},track(e){return r(e,e.event.event)},page(e){return r(e,Ci)},identify(e){return r(e,Ti)},screen(e){return r(e,`$screen`)}}})(e,n,{filterProperties:a})).then(()=>{t()},e=>{Ya.error(`Failed to register the Segment integration`,e),t()})},n)}const Za=`posthog-js`;function Qa(e,{organization:t,projectId:n,prefix:r,severityAllowList:i=[`error`],sendExceptionsToPostHog:a=!0}={}){return o=>{if(i!==`*`&&!i.includes(o.level)||!e.__loaded)return o;o.tags||={};let s=e.requestRouter.endpointFor(`ui`,`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(o.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));let c=o.exception?.values||[],l=c.map(e=>R(R({},e),{},{stacktrace:e.stacktrace?R(R({},e.stacktrace),{},{type:`raw`,frames:(e.stacktrace.frames||[]).map(e=>R(R({},e),{},{platform:`web:javascript`}))}):void 0})),u={$exception_message:c[0]?.value||o.message,$exception_type:c[0]?.type,$exception_level:o.level,$exception_list:l,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:c[0]?.value||o.message,$sentry_exception_type:c[0]?.type,$sentry_tags:o.tags};var d;return t&&n&&(u.$sentry_url=(r||`https://sentry.io/organizations/`)+t+`/issues/?project=`+n+`&query=`+o.event_id),a&&((d=e.exceptions)==null||d.sendExceptionEvent(u)),o}}var $a=class{constructor(e,t,n,r,i,a){this.name=Za,this.setupOnce=function(o){o(Qa(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},eo=class{constructor(e){this.Wo=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(z.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){this.Zo=this._instance.sessionManager?.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)==null||e.call(this),this.Zo=void 0}doPageView(e,t){let r=this.Qo(e,t);return this.Vo={pathname:n?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){return this.Qo(e,this.Vo?.pageViewId)}doEvent(){return{$pageview_id:this.Vo?.pageViewId}}Qo(e,t){let n=this.Vo;if(!n)return{$pageview_id:t};let r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:n,maxContentHeight:a,lastContentY:o,maxContentY:s}=i;if(!(A(e)||A(t)||A(n)||A(a)||A(o)||A(s))){e=Math.ceil(e),t=Math.ceil(t),n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s);let i=e>1?ge(t/e,0,1,z):1,c=e>1?ge(n/e,0,1,z):1,l=a>1?ge(o/a,0,1,z):1,u=a>1?ge(s/a,0,1,z):1;r=W(r,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:i,$prev_pageview_max_scroll:n,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:l,$prev_pageview_max_content:s,$prev_pageview_max_content_percentage:u})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}};const to=[`flags`,`surveys`],no={$people_distinct_id:{exposure:`hidden`},[yr]:{exposure:`hidden`},__cmpns:{exposure:`hidden`},[wr]:{exposure:`hidden`},[xr]:{exposure:`hidden`},[Cr]:{exposure:`hidden`},[Tr]:{exposure:`event`},[Er]:{exposure:`hidden`},[Nr]:{exposure:`hidden`},[Dr]:{exposure:`event`},[Or]:{exposure:`hidden`},[kr]:{exposure:`event`},[Ar]:{exposure:`event`},[jr]:{exposure:`event`},[Mr]:{exposure:`hidden`},[Pr]:{exposure:`event`},[Fr]:{exposure:`hidden`},$session_recording_enabled_server_side:{exposure:`hidden`},[Ir]:{exposure:`hidden`},[Lr]:{exposure:`event`},$replay_sample_rate:{exposure:`event`,shouldSkipFromEventProperties:e=>N(e)},$session_past_minimum_duration:{exposure:`event`},$session_recording_url_trigger_activated_session:{exposure:`event`},$session_recording_event_trigger_activated_session:{exposure:`event`},$debug_first_full_snapshot_timestamp:{exposure:`event`},$sess_rec_flush_size:{exposure:`hidden`},[Rr]:{exposure:`hidden`,storageGroup:`flags`},[zr]:{exposure:`hidden`,storageGroup:`flags`},[Br]:{exposure:`hidden`},[Vr]:{exposure:`hidden`,storageGroup:`flags`},[Hr]:{exposure:`hidden`,storageGroup:`flags`},[Ur]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[Wr]:{exposure:`hidden`,storageGroup:`flags`},[Gr]:{exposure:`hidden`},[Kr]:{exposure:`hidden`},[qr]:{exposure:`hidden`},[Jr]:{exposure:`hidden`},[Xr]:{exposure:`hidden`,storageGroup:`surveys`},[Zr]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[Qr]:{exposure:`event`},[$r]:{exposure:`hidden`},[ei]:{exposure:`hidden`},[ti]:{exposure:`hidden`},$product_tours_activated:{exposure:`hidden`},$product_tours_activated_session:{exposure:`hidden`},$conversations_widget_session_id:{exposure:`event`},$conversations_ticket_id:{exposure:`event`},$conversations_widget_state:{exposure:`event`},$conversations_user_traits:{exposure:`event`},[ni]:{exposure:`hidden`},[ri]:{exposure:`hidden`},[Yr]:{exposure:`event`},[ii]:{exposure:`hidden`},[ai]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[H]:{exposure:`hidden`},[oi]:{exposure:`hidden`},$capture_rate_limit:{exposure:`hidden`},[si]:{exposure:`hidden`},[ci]:{exposure:`hidden`},[li]:{exposure:`hidden`},[ui]:{exposure:`hidden`},$replay_override_sampling:{exposure:`event`},$replay_override_linked_flag:{exposure:`event`},$replay_override_url_trigger:{exposure:`event`},$replay_override_event_trigger:{exposure:`event`},[pi]:{exposure:`event`},[mi]:{exposure:`event`},[hi]:{exposure:`event`},[gi]:{exposure:`event`},$sdk_debug_replay_event_trigger_status:{exposure:`event`},$sdk_debug_replay_linked_flag_trigger_status:{exposure:`event`},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:`event`},$sdk_debug_replay_pending_trigger_conditions:{exposure:`event`},$sdk_debug_replay_remote_trigger_matching_config:{exposure:`event`},$sdk_debug_replay_trigger_groups_count:{exposure:`event`},$sdk_debug_replay_url_trigger_status:{exposure:`event`},$session_recording_start_reason:{exposure:`event`}},ro=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],X=e=>{let t=no[e];if(t)return t;for(let[t,n]of ro)if(e.indexOf(t)===0)return n},io=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>se(t)?(n??=/* @__PURE__ */ new WeakMap,n.has(t)||n.set(t,ji(t)),n.get(t)):typeof t==`bigint`?t.toString():t,t)}catch{return w(e)}},ao=e=>{let t=a?.createElement(`a`);return A(t)?null:(t.href=e,t)},oo=function(e,t){let n=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),r;for(let e=0;n.length>e;e++){let i=n[e].split(`=`);if(i[0]===t){r=i;break}}if(!E(r)||2>r.length)return``;{let e=r[1];try{e=decodeURIComponent(e)}catch{z.error(`Skipping decoding for malformed query param: `+e)}return e.replace(/\+/g,` `)}},so=function(e,t,n){if(!e||!t||!t.length)return e;let r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[];for(let e=0;c.length>e;e++){let r=c[e].split(`=`);E(r)&&(t.includes(r[0])?l.push(r[0]+`=`+n):l.push(c[e]))}let u=s;return o!=null&&(u+=`?`+l.join(`&`)),i!=null&&(u+=`#`+i),u},co=function(e,t){let n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},lo=(e,t)=>e>=t&&f(),uo=(e,t,n,r)=>{if(e===0){if(f()){let e=t+1;return e===n&&r(),e}return t}return 0},fo=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],po=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...fo],mo=`<masked>`,ho=[`li_fat_id`];function go(e,t,n){if(!a)return{};let r=t?[...fo,...n||[]]:[],i=_o(so(a.URL,r,mo),e),o=function(){let e={};return U(ho,function(t){let n=Fi(t);e[t]=n||null}),e}();return W(o,i)}function _o(e,t){let n=po.concat(t||[]),r={};return U(n,function(t){let n=oo(e,t);r[t]=n||null}),r}function vo(e){let t=function(e){return e?e.search(`https?://(.*)google.([^/?]*)`)===0?`google`:e.search(`https?://(.*)bing.com`)===0?`bing`:e.search(`https?://(.*)yahoo.com`)===0?`yahoo`:e.search(`https?://(.*)duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!N(t)){r.$search_engine=t;let e=a?oo(a.referrer,n):``;e.length&&(r.ph_keyword=e)}return r}function yo(){return navigator.language||navigator.userLanguage}function bo(){let e=yo();return typeof e==`string`?e.split(`-`)[0]:void 0}const xo=`$direct`;function So(){return a?.referrer||xo}function Co(e,t,n=!1){let r=e?[...fo,...t||[]]:[],i=(n?kt(o?.href):o?.href)?.substring(0,1e3);return{r:So().substring(0,1e3),u:i?so(i,r,mo):void 0}}function wo(e,t=!1){let{r:n,u:r}=e,i=t?kt(r):r,a={$referrer:n,$referring_domain:n==null?void 0:n==xo?xo:ao(n)?.host};if(i){a.$current_url=i;let e=ao(i);a.$host=e?.host,a.$pathname=e?.pathname;let t=_o(i);W(a,t)}if(n){let e=vo(n);W(a,e)}return a}function To(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Eo(){try{return(/* @__PURE__ */ new Date()).getTimezoneOffset()}catch{return}}const Do={flags:ai,surveys:Zr},Oo=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],ko=e=>`${e}_cookie_identity_change_pending`,Ao=e=>{let t=``,n=0;for(let r of e){let e=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+e>1e3)break;t+=r,n+=e}return t},Z=`main`,jo=[Rr,zr,Vr,Hr,Ur,ai,Wr,qr],Mo=e=>jo.indexOf(e)!==-1,No=[xr,Cr],Po=e=>No.indexOf(e)!==-1,Fo=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Io=e=>{if(!e)return{};let t=JSON.parse(e);return O(t)?t:{}},Lo=(e,t)=>{U(e,(n,r)=>{let i=X(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]})};var Ro=class{constructor(e,t,r=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=/* @__PURE__ */ new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=/* @__PURE__ */ new Set,this.aa=/* @__PURE__ */ new Set,this.Rr=e,this.la=r,this.props={},this.ua=void 0,this.ha=(e=>{let 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.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&z.info(`Persistence loaded`,e.persistence,R({},this.props)),this.update_config(e,e,t),this.save(),n){let e=()=>this.flush();G(n,`beforeunload`,e,{capture:!1}),G(n,`pagehide`,e,{capture:!1}),this.fa=e=>{if(this.Ko&&(!e.storageArea||e.storageArea===n?.localStorage)&&e.key){if(e.key!==this.ha){if(this.Yo){let t=to.find(t=>e.key===this.pa(t));t&&this.ga(e.key,t)}}else this.ga(e.key,Z)}},G(n,`storage`,this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let n=this.ia.get(e);if(!Mo(e)||!0===n)return;if(!0===t)return void this.ma(e,!0);let r=new Set(n||[]);t.forEach(e=>r.add(e)),r.size&&this.ma(e,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&n&&(n.removeEventListener(`storage`,this.fa),this.fa=void 0),this.aa.clear()}ga(e,t,n=!0){if(this.mi)return!1;let r,i;try{if(i=q.Ot(e),N(i)){let e=this.ya(t);return e.storageValue=null,t!==Z&&(e.persisted=!1),!1}r=Io(i)}catch{return!1}let a=t===Z?r:q.Dt(this.ha);if(a&&this.ba(a))return!1;let o=this._a(r,t,n);return t===Z&&this.Yo&&!Fo(this.wa().main,r)||this.ka(r,t,!0,i),o}ba(e){let t=this.props[gr],n=e[gr];return!A(t)&&!A(n)&&t!==n}ka(e,t,n,r){let i=this.ya(t);i.storageValue=r,t!==Z&&(i.persisted=n);try{i.fingerprint=this.Sa(e,t)}catch{i.fingerprint=void 0}}_a(e,t,n){let r=!1;return jo.forEach(n=>{let i=X(n)?.storageGroup;if(t===Z&&this.Yo&&i||t!==Z&&i!==t)return;let a=n in e,o=this.xa(n,a?e[n]:void 0),s=this.ia.has(n)?n in this.props:a;s===n in this.props&&Fo(o,this.props[n])||(s?this.Ca(n,o,!1):this.$a(n,!1),r=!0)}),r&&n&&this.aa.forEach(e=>e()),r}Ta(){if(!this.Ko)return!1;try{this.ra=!1;let e=q.Ot(this.ha),t=this.ya(Z),n,r=!1,i=!1;if(e!==t.storageValue){if(N(e))t.storageValue=null;else{if(n=Io(e),this.ra=!this.sa&&this.ba(n),this.ra)return!1;i=this._a(n,Z,!1),!this.Yo||Fo(this.wa().main,n)?this.ka(n,Z,!0,e):t.storageValue=e,r=!0}}return this.Yo&&to.forEach(e=>{let t=q.Ot(this.pa(e)),a=this.ya(e),o=n||{},s=r&&jo.some(t=>X(t)?.storageGroup===e&&t in o);if(t===a.storageValue&&!s)return;if(N(t))return a.storageValue=null,a.persisted=!1,void(s&&(i=this._a(o,e,!1)||i));let c=Io(t);i=this._a(c,e,!1)||i,this.ka(c,e,!0,t)}),i}catch{return!1}}ma(e,t){this.ia.set(e,t);let n=X(e);n!=null&&n.volatile||(this.ya((this.Yo?n?.storageGroup:void 0)||Z).fingerprint=void 0,this.Ia(e))}Ma(){jo.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{let e=q.Ot(this.ha),t=Io(e);this.ya(Z).storageValue=e,jo.forEach(e=>{let n=this.Yo?X(e)?.storageGroup:void 0,r=n?q.Ot(this.pa(n)):null;if(n){let e=this.ya(n);e.storageValue=r,e.persisted=!N(r)}let i=n&&!N(r)?Io(r):t;e in this.props?this.Ea(e,i[e],this.props[e]):e in i&&this.ma(e,!0)})}catch{}}xa(e,t){let n=this.ia.get(e);if(!n)return t;if(!0===n)return this.props[e];if(e===`$active_feature_flags`){let r=new Set(E(t)?t:[]),i=new Set(E(this.props[e])?this.props[e]:[]);return n.forEach(e=>i.has(e)?r.add(e):r.delete(e)),Array.from(r)}let r=O(t)?R({},t):{},i=O(this.props[e])?this.props[e]:{};return n.forEach(e=>{e in i?r[e]=i[e]:delete r[e]}),r}Ea(e,t,n){if(!Mo(e))return;let r=this.ia.get(e);if(!0===r)return;let i=t;if(this.Ko)try{let t=this.Yo?X(e)?.storageGroup:void 0,n=t?this.pa(t):this.ha;i=Io(q.Ot(n))[e]}catch{}let a=new Set(r||[]);if(e===`$active_feature_flags`){if(!A(t)&&!E(t)||!A(i)&&!E(i)||!E(n))return void this.ma(e,!0);let r=new Set(t||[]),o=new Set(i||[]),s=new Set(n);(/* @__PURE__ */ new Set([...r,...s])).forEach(e=>{r.has(e)!==s.has(e)&&a.add(e)}),a.forEach(e=>{o.has(e)===s.has(e)&&a.delete(e)})}else{if(!O(n))return void(Fo(i,n)?this.ia.delete(e):this.ma(e,!0));{if(!A(t)&&!O(t)||A(t)&&k(n)&&A(i))return void this.ma(e,!0);let r=O(t)?t:{},o=O(i)?i:{};(/* @__PURE__ */ new Set([...Object.keys(r),...Object.keys(n)])).forEach(e=>{e in r==e in n&&Fo(r[e],n[e])||a.add(e)}),a.forEach(e=>{e in o==e in n&&Fo(o[e],n[e])&&a.delete(e)})}}a.size?this.ma(e,a):this.ia.delete(e)}Pa(){let e=this.Rr?.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{let t=Qi(e,this.Rr.cookie_persisted_properties||[]),n=ea(t,this.Rr.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=K.Ot(this.ha)||void 0;i&&na(this.ha,i)===r&&(this.Aa=r,this.Fa=i)}catch{}else try{let e=K.Ot(this.ha)||void 0;this.Aa=e?na(this.ha,e):void 0,this.Fa=e}catch{}}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,t=!1){if(this.mi&&!t||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!==`localstorage+cookie`)return!1;let n;try{n=K.Ot(this.ha)||void 0}catch{}if(!n||n===this.Fa)return!1;let r=na(this.ha,n),i;try{i=Zi(JSON.parse(n))}catch{return!1}if((K.Ot(this.ha)||void 0)!==n)return!1;this.Aa=r,this.Fa=n;let a=ta(this.ha,n),o=[...Ji,...a.properties],s={};if(Object.keys(i).forEach(e=>{let t=i[e];(A(t)||N(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`)&&(s[e]=!0,delete i[e])}),k(i))return!1;let c=`distinct_id`in i||i.$user_state===`anonymous`||i.$user_state===`identified`,l=this.props,u=l[gr],d=l[H],f=W({},l);[...Ji,...e.cookie_persisted_properties||[]].forEach(e=>{if(o.indexOf(e)!==-1&&!(e in i)&&!s[e]&&(c||e!==`distinct_id`&&e!==`$user_state`)){let t=f[e];(a.isValid||Ji.indexOf(e)===-1||!1!==t&&t!==0)&&delete f[e]}}),this.props=W(f,i),jo.forEach(e=>{let t=e in this.props;e in l===t&&Fo(l[e],this.props[e])||(t?this.Ea(e,l[e],this.props[e]):this.ma(e,!0))}),!c||`$user_state`in i||`$user_state`in this.props||this.Ca(H,vi);let p=this.props[gr],m=this.props[H];return!c||p===u&&m===d||(this.sa=!0,this.ta=!0,J.At(ko(this.ha),!0),this.$a(qr),this.$a(zr),this.$a(Rr),this.$a(Vr),this.$a(Hr),this.$a(Ur),this.$a(ai),this.$a(ii),this.$a(ni),m!==`anonymous`||d!==`identified`&&i.$user_state!==`anonymous`&&(A(u)||p===u)||(Lo(this.props,i),this.$a(Jr)),m===`identified`?this.props.$user_id=p:delete this.props.$user_id,this.$a(yr)),!0}consumeCookieIdentityChange(){let e=ko(this.ha),t=this.ta||!!J.Ot(e);return this.ta=!1,t&&J.Lt(e),t}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!==`localstorage+cookie`||(this.ea=!0,0))}La(){this.ea&&(A(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[Z],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():A(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){Oo.indexOf(e.persistence.toLowerCase())===-1&&(z.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);let t=((e=[],t=!1)=>{let r=[...Ji,...e];return R(R({},q),{},{Dt(e){try{let n,i={};try{n=K.Ot(e)||void 0,i=n?Zi(JSON.parse(n)):{}}catch{}let a=JSON.parse(q.Ot(e)||`{}`),o;if(t){let t=ta(e,n),s=[...Ji,...t.properties],c={};Object.keys(i).forEach(e=>{let t=i[e];N(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`||(c[e]=t)});let l=`distinct_id`in c||c.$user_state===`anonymous`||c.$user_state===`identified`;if(Object.keys(c).length>0){let e=a[gr],n=a.$user_state??vi;r.forEach(e=>{if(s.indexOf(e)!==-1&&!(e in i)&&(l||e!==`distinct_id`&&e!==`$user_state`)){let n=a[e];(t.isValid||Ji.indexOf(e)===-1||!1!==n&&n!==0)&&delete a[e]}}),!l||`$user_state`in i||`$user_state`in a||(a[H]=vi),!l||(`distinct_id`in c?c[gr]:a[gr])===e&&(`$user_state`in c?c[H]:a[H])===n||(qi.forEach(e=>delete a[e]),c.$user_state===`identified`&&`distinct_id`in c?a.$user_id=c[gr]:delete a.$user_id,c.$user_state!==`identified`&&(delete a[Yr],delete a[Jr]),delete a.__alias)}o=W(a,c)}else o=W(i,a);return q.At(e,o),o}catch{}return null},At(n,r,i,a,o,s){let c=q.At(n,r,void 0,void 0,s);try{let l=Qi(r,e);if(Object.keys(l).length){if(t){let t=Yi(n),u=ea(l,e);if(K.At(t,u,i,a,o,s),K.Ot(t)!==JSON.stringify(u)){K.Lt(t,a);let e=Qi(r);return K.At(n,e,i,a,o,s),c}}K.At(n,l,i,a,o,s)}}catch(e){q.Pt(e)}return c},Lt(e,t){try{n?.localStorage.removeItem(e),K.Lt(e,t),K.Lt(Yi(e),t)}catch(e){q.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r,i=!1,a=!1,o=e.persistence.toLowerCase();return o===`localstorage`&&q.Et()?(r=q,a=!0):o===`localstorage+cookie`&&t.Et()?(r=t,a=!0,i=!0):o===`sessionstorage`&&J.Et()?r=J:o===`memory`?r=ia:o===`cookie`&&K.Et()?(r=K,i=!0):t.Et()?(r=t,a=!0,i=!0):K.Et()?(r=K,i=!0):r=ia,this.Ko=a,this.Xo=i,r}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){let e={};return U(this.props,(t,n)=>{let r=X(n);if(!r||r.exposure===`event`){var i;if(r!=null&&(i=r.shouldSkipFromEventProperties)!=null&&i.call(r,t))return;e[n]=t}}),e}load(e=!1){if(this.mi&&!e)return;let t=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()===`localstorage+cookie`,n=t?q.Dt(this.ha):null,r={};if(t)try{r=Zi(K.Dt(this.ha)),U(r,(e,t)=>{(A(e)||N(e)||e===``)&&delete r[t]})}catch{}let i=this.qo.Dt(this.ha);if(i&&(this.props=W({},i)),this.Yo&&this.Ba(),t&&i){let e=n?.[gr],t=n?.$user_state??vi,a=i[gr],o=i.$user_state??vi;if(a!==e||o!==t){this.ta=!0,J.At(ko(this.ha),!0);let n=W({},this.props);qi.forEach(e=>delete n[e]),o!==`anonymous`||t!==`identified`&&r.$user_state!==`anonymous`&&(A(e)||a===e)||(Lo(n,r),delete n[Jr]),this.props=n;let i=/* @__PURE__ */ new Set;qi.forEach(e=>{let t=X(e)?.storageGroup;t&&i.add(t)}),i.forEach(e=>{let t={};U(this.props,(n,r)=>{X(r)?.storageGroup===e&&(t[r]=n)}),k(t)?(q.Lt(this.pa(e)),this.Jo[e]={}):q.At(this.pa(e),t)&&(this.Jo[e]={persisted:!0,fingerprint:this.Sa(t,e)})})}}J.Ot(ko(this.ha))&&(this.ta=!0)}Ba(){for(let e of to){let t=q.Dt(this.pa(e));if(t&&!k(t)){let n=this.ya(e);n.persisted=!0,this.Ha(e)||(n.fingerprint=this.Sa(t,e)),this.za(e,t)||W(this.props,t)}}}Ha(e){return Object.keys(this.props).some(t=>X(t)?.storageGroup===e)}za(e,t){let n=Do[e];if(!n)return!1;let r=t[n],i=this.props[n];return F(r)&&F(i)&&i>r}refreshKey(e){if(this.mi||this.oa.has(e))return;let t=this.Yo?X(e)?.storageGroup:void 0,n=t?q.Dt(this.pa(t)):this.qo.Dt(this.ha);if(n&&e in n)this.Ca(e,n[e],!1);else{if(t){let t=this.qo.Dt(this.ha);if(t&&e in t)return void this.Ca(e,t[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;let e=this.Pa();e>0?A(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){A(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()===`localstorage+cookie`||No.forEach(e=>this.refreshKey(e)));let t=!e&&!this.na;t||(this.ra=!1);let n=!!t&&this.Ta();if(this.ra)return void(this.Rr.debug&&z.warn(`skipping persistence write because storage belongs to a different distinct ID`));if(this.Yo)return this.Ua(),void(n&&this.aa.forEach(e=>e()));let r=this.Wa(this.qo,this.ha,this.props,Z);r===`written`&&this.Ra(this.props),r!==`failed`&&(this.ia.clear(),this.sa=!1,this.oa.clear()),n&&this.aa.forEach(e=>e())}Ua(){let{main:e,groups:t}=this.wa(),n=this.Wa(this.qo,this.ha,e,Z);n===`written`&&this.Ra(e),n!==`failed`&&(this.sa=!1,this.oa.clear(),jo.forEach(e=>{var t;(t=X(e))!=null&&t.storageGroup||this.ia.delete(e)}));for(let e of to){let n=t[e];if(k(n)&&!this.Jo[e]?.persisted){jo.forEach(t=>{X(t)?.storageGroup===e&&this.ia.delete(t)});continue}let r=this.Wa(q,this.pa(e),n,e);r!==`failed`&&jo.forEach(t=>{let n=X(t);n?.storageGroup!==e||r!==`written`&&n.volatile||this.ia.delete(t)})}}wa(){let e={},t={flags:{},surveys:{}};return U(this.props,(n,r)=>{let i=X(r)?.storageGroup;i?t[i][r]=n:e[r]=n}),{main:e,groups:t}}Sa(e,t){if(t===Z)return JSON.stringify(e)+`|`+this.Va+`|`+this.Ga+`|`+this.Za;let n={};return U(e,(e,t)=>{n[t]=X(t)?.volatile?`__volatile__`:e}),JSON.stringify(n)}Wa(e,t,n,r){let i=this.ya(r);if(r!==Z&&!i.dirty&&!A(i.fingerprint))return`skipped`;let a;try{if(a=this.Sa(n,r),a===i.fingerprint)return i.dirty=!1,`skipped`}catch{a=void 0}return e.At(t,n,this.Va,this.Ga,this.Za,this.Rr.debug)?(i.dirty=!1,r!==Z&&(i.persisted=!0),A(a)||(i.fingerprint=a),this.Ko&&(i.storageValue=q.Ot(t)),`written`):(this.Rr.debug&&z.warn(`failed to persist storage entry "${t}"; will retry on next save`),`failed`)}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),A(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(let e of to)q.Lt(this.pa(e));e?delete this.Jo[Z]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(O(e)){this.syncCookieProperties(),A(t)&&(t=`None`),this.Va=A(n)?this.Qa:n;let r=!1;if(U(e,(e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Ca(n,e),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(O(e)){this.syncCookieProperties(),this.Va=A(t)?this.Qa:t;let n=!1;if(U(e,(t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||O(t)||E(t))&&(this.Ca(r,t),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e==`string`?[e]:e,n=!1;for(let e of t)e in this.props&&(this.$a(e),n=!0);n&&this.save()}update_campaign_params(){let e=a?.URL;if(e===this.ua)return;let t=go(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),n=!k(Ai(t));return n&&this.register(t),this.ua=e,n?t:void 0}update_search_keyword(){this.register(function(){let e=a?.referrer;return e?vo(e):{}}())}update_referrer_info(){this.register_once({$referrer:So(),$referring_domain:a?.referrer&&ao(a.referrer)?.host||xo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=Co(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[li]:this.Xo?{r:Ao(e.r),u:e.u?Ao(e.u):void 0}:e},void 0)}get_initial_props(){let e={};U([ci,si],t=>{let n=this.props[t];n&&U(n,function(t,n){e[`$initial_`+C(n)]=t})});let t=this.props[li];if(t){let n=function(e,t=!1){let n=wo(e,t),r={};return U(n,function(e,t){r[`$initial_${C(t)}`]=e}),r}(t,this.Rr.disable_capture_url_hashes);W(e,n)}return e}safe_merge(e){return U(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){let r=e.persistence!==t.persistence,i=!((e,t)=>{if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||i,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,s=e.disable_persistence||!!n,c=!!this.mi&&!s;s||this.Oa(t,c),this.Rr=e,!s&&(r||i||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(R(R({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));let l=a||o?this.ca(e):this.qo;this.Ja();let u=this.da(e),d=a||u!==this.Yo,f=!s&&(d||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=d;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){let e=this.props;this.clear(),this.qo=l,this.Yo=u,this.props=e,this.save()}else o&&(this.qo=l,s||(delete this.Jo[Z],this.qa()))}finally{this.na=!1,f&&this.ja()}}Ja(){let e=this.props[li];if(!this.Xo||!O(e)||typeof e.r!=`string`)return;let t=Ao(e.r),n=typeof e.u==`string`?Ao(e.u):e.u;t===e.r&&n===e.u||this.Ca(li,R(R({},e),{},{r:t,u:n}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let n=this.props.__timers||{};n[e]=t,this.Ca(wr,n),this.save()}remove_event_timer(e){let t=this.props.__timers||{},n=t[e];return A(n)||(delete t[e],this.Ca(wr,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.Ca(e,t),this.save()}Ca(e,t,n=!0){var r;let i=this.props[e];this.props[e]=t,n&&(e!==`distinct_id`&&e!==`$user_state`||i===t||(this.sa=!0),Po(e)&&!Fo(i,t)&&this.oa.add(e),this.Ea(e,i,t),(r=X(e))!=null&&r.volatile||this.Ia(e))}$a(e,t=!0){delete this.props[e],t&&(Mo(e)&&this.ma(e,!0),Po(e)&&this.oa.add(e),this.Ia(e))}Ia(e){let t=X(e)?.storageGroup;t&&(this.ya(t).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const zo={GZipJS:`gzip-js`,Base64:`base64`},Bo={Activation:`events`,Cancellation:`cancelEvents`},Vo={Button:`button`,Tab:`tab`,Selector:`selector`},Ho={TopLeft:`top_left`,TopRight:`top_right`,TopCenter:`top_center`,MiddleLeft:`middle_left`,MiddleRight:`middle_right`,MiddleCenter:`middle_center`,Left:`left`,Center:`center`,Right:`right`,NextToTrigger:`next_to_trigger`},Uo={Top:`top`,Left:`left`,Right:`right`,Bottom:`bottom`},Wo={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},Go={Open:`open`,MultipleChoice:`multiple_choice`,SingleChoice:`single_choice`,Rating:`rating`,Link:`link`},Ko={NextQuestion:`next_question`,End:`end`,ResponseBased:`response_based`,SpecificQuestion:`specific_question`},qo={Once:`once`,Recurring:`recurring`,Always:`always`},Jo={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},Yo={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_START_DATE:`$survey_iteration_start_date`,SURVEY_PARTIALLY_COMPLETED:`$survey_partially_completed`,SURVEY_SUBMISSION_ID:`$survey_submission_id`,SURVEY_QUESTIONS:`$survey_questions`,SURVEY_COMPLETED:`$survey_completed`,PRODUCT_TOUR_ID:`$product_tour_id`,SURVEY_LAST_SEEN_DATE:`$survey_last_seen_date`,SURVEY_LANGUAGE:`$survey_language`},Xo={Popover:`popover`,Inline:`inline`};function Zo(e){let t=!0;return{dispose(){if(t){t=!1;let n=e();n&&D(n.then)&&n.then(void 0,()=>{})}}}}const Qo={backgroundColor:`#ffffff`,textColor:`#1d1f27`,buttonColor:`#1d1f27`,borderRadius:8,buttonBorderRadius:6,borderColor:`#e5e7eb`,fontFamily:`system-ui`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},$o={SHOWN:`product tour shown`,DISMISSED:`product tour dismissed`,COMPLETED:`product tour completed`,STEP_SHOWN:`product tour step shown`,STEP_COMPLETED:`product tour step completed`,BUTTON_CLICKED:`product tour button clicked`,STEP_SELECTOR_FAILED:`product tour step selector failed`,BANNER_CONTAINER_SELECTOR_FAILED:`product tour banner container selector failed`,BANNER_ACTION_CLICKED:`product tour banner action clicked`},es={TOUR_ID:`$product_tour_id`,TOUR_NAME:`$product_tour_name`,TOUR_ITERATION:`$product_tour_iteration`,TOUR_RENDER_REASON:`$product_tour_render_reason`,TOUR_STEP_ID:`$product_tour_step_id`,TOUR_STEP_ORDER:`$product_tour_step_order`,TOUR_STEP_TYPE:`$product_tour_step_type`,TOUR_DISMISS_REASON:`$product_tour_dismiss_reason`,TOUR_BUTTON_TEXT:`$product_tour_button_text`,TOUR_BUTTON_ACTION:`$product_tour_button_action`,TOUR_BUTTON_LINK:`$product_tour_button_link`,TOUR_BUTTON_TOUR_ID:`$product_tour_button_tour_id`,TOUR_STEPS_COUNT:`$product_tour_steps_count`,TOUR_STEP_SELECTOR:`$product_tour_step_selector`,TOUR_STEP_SELECTOR_FOUND:`$product_tour_step_selector_found`,TOUR_STEP_ELEMENT_TAG:`$product_tour_step_element_tag`,TOUR_STEP_ELEMENT_ID:`$product_tour_step_element_id`,TOUR_STEP_ELEMENT_CLASSES:`$product_tour_step_element_classes`,TOUR_STEP_ELEMENT_TEXT:`$product_tour_step_element_text`,TOUR_ERROR:`$product_tour_error`,TOUR_MATCHES_COUNT:`$product_tour_matches_count`,TOUR_FAILURE_PHASE:`$product_tour_failure_phase`,TOUR_WAITED_FOR_ELEMENT:`$product_tour_waited_for_element`,TOUR_WAIT_DURATION_MS:`$product_tour_wait_duration_ms`,TOUR_BANNER_SELECTOR:`$product_tour_banner_selector`,TOUR_LINKED_SURVEY_ID:`$product_tour_linked_survey_id`,USE_MANUAL_SELECTOR:`$use_manual_selector`,INFERENCE_DATA_PRESENT:`$inference_data_present`,TOUR_LAST_SEEN_DATE:`$product_tour_last_seen_date`,TOUR_TYPE:`$product_tour_type`},ts=B(`[RateLimiter]`);var ns=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{let t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{ts.info(`${e||`events`} is quota limited.`),this.serverLimits[e]=(/* @__PURE__ */ new Date()).getTime()+6e4})}catch(e){ts.warn(`could not rate limit - continuing. Error: "${e?.message}"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=(/* @__PURE__ */ new Date()).getTime(),a=this.instance.persistence?.get_property(`$capture_rate_limit`)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);let o=1>a.tokens;if(o||e||(a.tokens=Math.max(0,a.tokens-1)),o&&!e){let e=(F(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Ka(e)&&(a.dropped=0)}return this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(`$capture_rate_limit`,a),{isRateLimited:o,remainingTokens:a.tokens}}Xa(e){let t=this.instance.config.property_denylist;return!E(t)||!t.includes(e)}Ya(){if(this.Xa(`$current_url`)&&this.Xa(`$pathname`)&&o?.pathname)return`${o.origin??``}${o.pathname}`}Ka(e){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=this.Ya(),a=this.Xa(`$session_id`)?(t=this.instance).get_session_id?.call(t):void 0,o=[`${e} event(s) dropped since the last warning`,i?`triggered on ${i}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(`, `);return!!this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited: ${o}. Config is set to ${r} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||`events`]||!1;return!1!==t&&(/* @__PURE__ */ new Date()).getTime()<t}};const rs=B(`[RemoteConfig]`);var is=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=m._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}tl(e){var t,n;m.__PosthogExtensions__?.loadExternalDependency?(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`remote-config`,()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return rs.info(`Using preloaded remote config`,this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void rs.warn(`Remote config is disabled. Falling back to local config.`);this.tl(e=>{if(!e)return rs.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.el(e=>{this.il(e.json,e)});this.il(e)})}catch(e){rs.error(`Error loading remote config`,e),this.il()}}il(e,t){!e&&t&&(t.statusCode===0?t.error||rs.warn(`Failed to fetch remote config from PostHog.`):rs.error(`Failed to fetch remote config from PostHog.`));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(e){rs.error(`Error applying remote config`,e)}if(!1!==e?.hasFeatureFlags&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(e){rs.error(`Error loading feature flags`,e)}}};const as=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];var os=Uint8Array,ss=Uint16Array,cs=Uint32Array,ls=new os([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]),us=new os([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]),ds=new os([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fs=function(e,t){for(var n=new ss(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new cs(n[30]);for(r=1;30>r;++r)for(var a=n[r];n[r+1]>a;++a)i[a]=a-n[r]<<5|r;return[n,i]},ps=fs(ls,2),ms=ps[1];ps[0][28]=258,ms[258]=28;for(var hs=fs(us,0)[1],gs=new ss(32768),Q=0;32768>Q;++Q){var _s=(43690&Q)>>>1|(21845&Q)<<1;gs[Q]=((65280&(_s=(61680&(_s=(52428&_s)>>>2|(13107&_s)<<2))>>>4|(3855&_s)<<4))>>>8|(255&_s)<<8)>>>1}var vs=function(e,t,n){for(var r=e.length,i=0,a=new ss(t);r>i;++i)++a[e[i]-1];var o,s=new ss(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new ss(1<<t);var c=15-t;for(i=0;r>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;f>=d;++d)o[gs[d]>>>c]=l}else for(o=new ss(r),i=0;r>i;++i)o[i]=gs[s[e[i]-1]++]>>>15-e[i];return o},ys=new os(288);for(Q=0;144>Q;++Q)ys[Q]=8;for(Q=144;256>Q;++Q)ys[Q]=9;for(Q=256;280>Q;++Q)ys[Q]=7;for(Q=280;288>Q;++Q)ys[Q]=8;var bs=new os(32);for(Q=0;32>Q;++Q)bs[Q]=5;var xs=vs(ys,9,0),Ss=vs(bs,5,0),Cs=function(e){return(e/8|0)+(7&e&&1)},ws=function(e,t,n){(t==null||0>t)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof ss?ss:e instanceof cs?cs:os)(n-t);return r.set(e.subarray(t,n)),r},Ts=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Es=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Ds=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new os(0),0];if(i==1){var o=new os(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[d].f>n[l].f?l++:d++],c=n[l!=u&&n[d].f>n[l].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;i>r;++r)a[r].s>f&&(f=a[r].s);var p=new ss(f+1),m=Os(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});i>r;++r){var v=a[r].s;if(t>=p[v])break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;t>p[y]?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new os(p),m]},Os=function(e,t,n){return e.s==-1?Math.max(Os(e.l,t,n+1),Os(e.r,t,n+1)):t[e.s]=n},ks=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ss(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;t>=s;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},As=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},js=function(e,t,n){var r=n.length,i=Cs(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;r>a;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Ms=function(e,t,n,r,i,a,o,s,c,l,u){Ts(t,u++,n),++i[256];for(var d=Ds(i,15),f=d[0],p=d[1],m=Ds(a,15),h=m[0],g=m[1],_=ks(f),v=_[0],y=_[1],b=ks(h),x=b[0],S=b[1],C=new ss(19),w=0;v.length>w;++w)C[31&v[w]]++;for(w=0;x.length>w;++w)C[31&x[w]]++;for(var ee=Ds(C,7),T=ee[0],te=ee[1],E=19;E>4&&!T[ds[E-1]];--E);var D,O,k,A,j=l+5<<3,M=As(i,ys)+As(a,bs)+o,N=As(i,f)+As(a,h)+o+14+3*E+As(C,T)+(2*C[16]+3*C[17]+7*C[18]);if(M>=j&&N>=j)return js(t,u,e.subarray(c,c+l));if(Ts(t,u,1+(M>N)),u+=2,M>N){D=vs(f,p,0),O=f,k=vs(h,g,0),A=h;var P=vs(T,te,0);for(Ts(t,u,y-257),Ts(t,u+5,S-1),Ts(t,u+10,E-4),u+=14,w=0;E>w;++w)Ts(t,u+3*w,T[ds[w]]);u+=3*E;for(var F=[v,x],ne=0;2>ne;++ne){var I=F[ne];for(w=0;I.length>w;++w)Ts(t,u,P[re=31&I[w]]),u+=T[re],re>15&&(Ts(t,u,I[w]>>>5&127),u+=I[w]>>>12)}}else D=xs,O=ys,k=Ss,A=bs;for(w=0;s>w;++w)if(r[w]>255){var re;Es(t,u,D[257+(re=r[w]>>>18&31)]),u+=O[re+257],re>7&&(Ts(t,u,r[w]>>>23&31),u+=ls[re]);var ie=31&r[w];Es(t,u,k[ie]),u+=A[ie],ie>3&&(Es(t,u,r[w]>>>5&8191),u+=us[ie])}else Es(t,u,D[r[w]]),u+=O[r[w]];return Es(t,u,D[256]),u+O[256]},Ns=new cs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ps=new os(0),Fs=function(){for(var e=new cs(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Is=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ls(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,r=0;t.length>r;++r)n=Fs[255&n^t[r]]^n>>>8;e=n},d(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a,o,s,c,l,u=(s=10+((i=t).filename&&i.filename.length+1||0),c=8,function(e,t,n,r,i,a){var o=e.length,s=new os(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=js(c,l,e.subarray(u,d)):(c[u]=a,l=js(c,l,e.subarray(u,o)))}else{for(var f=Ns[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new ss(32768),_=new ss(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new cs(25e3),S=new ss(288),C=new ss(32),w=0,ee=0,T=(u=0,0),te=0,E=0;o>u;++u){var D=b(u),O=32767&u,k=_[D];if(g[O]=k,_[D]=O,u>=te){var A=o-u;if((w>7e3||T>24576)&&A>423){l=Ms(e,c,0,x,S,C,ee,T,E,u-E,l),T=w=ee=0,E=u;for(var j=0;286>j;++j)S[j]=0;for(j=0;30>j;++j)C[j]=0}var M=2,N=0,P=m,F=O-k&32767;if(A>2&&D==b(u-F))for(var ne=Math.min(p,A)-1,I=Math.min(32767,u),re=Math.min(258,A);I>=F&&--P&&O!=k;){if(e[u+M]==e[u+M-F]){for(var ie=0;re>ie&&e[u+ie]==e[u+ie-F];++ie);if(ie>M){if(M=ie,N=F,ie>ne)break;var ae=Math.min(F,ie-2),oe=0;for(j=0;ae>j;++j){var se=u-F+j+32768&32767,ce=se-g[se]+32768&32767;ce>oe&&(oe=ce,k=se)}}}F+=(O=k)-(k=g[O])+32768&32767}if(N){x[T++]=268435456|ms[M]<<18|hs[N];var le=31&ms[M],ue=31&hs[N];ee+=ls[le]+us[ue],++S[257+le],++C[ue],te=u+M,++w}else x[T++]=e[u],++S[e[u]]}}l=Ms(e,c,a,x,S,C,ee,T,E,u-E,l),a||(l=js(c,l,Ps))}return ws(s,0,r+Cs(l)+i)}(a=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+o.mem,s,c,!l)),d=u.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Is(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;n.length>=r;++r)e[r+10]=n.charCodeAt(r)}}(u,t),Is(u,d-8,n.d()),Is(u,d-4,r),u}const Rs=!!c||!!s,zs=/* @__PURE__ */ new WeakMap,Bs=`text/plain`;let Vs=0,Hs=!1;const Us=(e,t)=>{let[n,r]=e.split(`#`),[i,a]=n.split(`?`);if(!a)return e;let o=a.split(`&`).filter(e=>e.split(`=`)[0]!==t).join(`&`);return`${i}${o?`?${o}`:``}${r?`#${r}`:``}`},Ws=(e,t,n=!0)=>{let[r,i]=e.split(`?`),a=R({},t),o=i?.split(`&`).map(e=>{var t;let[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],`${r}=${o}`})??[],s=function(e,t=`&`){let n,r,i=[];return U(e,function(e,t){A(e)||A(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)}),i.join(t)}(a);return s&&o.push(s),o.length>0?`${r}?${o.join(`&`)}`:r},Gs=e=>{if(e.sl)return e.sl;let{data:t,compression:n}=e;if(!t)return;if(n===zo.GZipJS){let e=Ls(function(e){var t=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var n=new os(e.length+(e.length>>>1)),r=0,i=function(e){n[r++]=e},a=0;t>a;++a){if(r+5>n.length){var o=new os(r+8+(t-a<<1));o.set(n),n=o}var s=e.charCodeAt(a);128>s?i(s):2048>s?(i(192|s>>>6),i(128|63&s)):s>55295&&57344>s?(i(240|(s=65536+(1047552&s)|1023&e.charCodeAt(++a))>>>18),i(128|s>>>12&63),i(128|s>>>6&63),i(128|63&s)):(i(224|s>>>12),i(128|s>>>6&63),i(128|63&s))}return ws(n,0,r)}(io(t)),{mtime:0});return{contentType:Bs,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(n===zo.Base64){let e=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:io(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))))}(io(t)));return{contentType:`application/x-www-form-urlencoded`,body:e,estimatedSize:new Blob([e]).size}}let r=io(t);return{contentType:`application/json`,body:r,estimatedSize:new Blob([r]).size}},Ks=e=>{let t=()=>e.transport===`sendBeacon`?{url:Ws(e.url,{compression:zo.Base64}),encodedBody:Gs(R(R({},e),{},{compression:zo.Base64,sl:void 0}))}:{url:Us(e.url,`compression`),encodedBody:Gs(R(R({},e),{},{compression:void 0,sl:void 0}))},n;try{n=Gs(e)}catch(n){if(Nn(e.compression,oo(e.url,`compression`)))return z.error(`Failed to gzip request body, sending uncompressed payload`,n),t();throw n}return n&&Nn(e.compression,oo(e.url,`compression`))&&!((r=n.body)instanceof ArrayBuffer?Mn(new Uint8Array(r)):ArrayBuffer.isView(r)&&Mn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Hs=!0,t()):{url:e.url,encodedBody:n};var r},qs=e=>{try{return Ks(e)}catch(n){var t;z.error(n),(t=e.callback)==null||t.call(e,{statusCode:0,error:n});return}},Js=function(){var e=L(function*(e){let t=yield function(e){return zn.apply(this,arguments)}(io(e.data),V.DEBUG,{rethrow:!0});if(!t)return e;let n=yield t.arrayBuffer();return R(R({},e),{},{sl:{contentType:Bs,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Ys=/Failed to fetch|NetworkError|Load failed/i,Xs=e=>e?.name===`TypeError`&&Ys.test(e?.message||``),Zs=e=>{try{let t=function(e,t=Date.now()){if(typeof e!=`string`||!e)return;let n=e.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(`,`)).trim():n;if(/^\d+$/.test(r)){let e=1e3*Math.min(Number(r),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let i=/^\w{3} \w{3} /.test(r)?r+` GMT`:r,a=Date.parse(i)-t;return Number.isFinite(a)&&a>0?Math.min(a,wt):void 0}(e());return A(t)?void 0:Math.min(t,3e4)}catch{return}},Qs=e=>{let t=qs(e);if(!t)return;let n=new c;zs.set(n,!0);let{url:r,encodedBody:i}=t;n.open(e.method||`GET`,r,!0);let{contentType:a,body:o}=i??{};U(e.headers,function(e,t){n.setRequestHeader(t,e)}),a&&n.setRequestHeader(`Content-Type`,a),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var t;let r={statusCode:n.status,text:n.responseText};if(n.status===200)try{r.json=JSON.parse(n.responseText)}catch{}(t=e.callback)==null||t.call(e,r,Zs(()=>n.getResponseHeader(`Retry-After`)))}},n.send(o)},$s=e=>{let t=qs(e);if(!t)return;let{url:n,encodedBody:r}=t,{contentType:i,body:a,estimatedSize:o}=r??{},c=new Headers;U(e.headers,function(e,t){c.append(t,e)}),i&&c.append(`Content-Type`,i);let u=null,d=!1;if(l){let t=new l;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(Ot(`AbortError`,`PostHog request timed out`+((n=e.timeout)?` after ${n}ms`:``)))}catch(e){p(e)}var n},e.timeout)}}let f=!1,p=t=>{var n;f||(f=!0,d&&t?.name===`AbortError`||Xs(t)?z.warn(t):z.error(t),(n=e.callback)==null||n.call(e,{statusCode:0,error:t}))},m=0,h=()=>{Vs-=m,m=0,u&&clearTimeout(u.timeout)};try{let t=R({method:e?.method||`GET`,headers:c,referrerPolicy:`strict-origin`,body:a,signal:u?.signal},e.fetchOptions),r=o??(A(a)?0:void 0);t.keepalive=t.method===`POST`&&!e.rl&&!1!==t.keepalive&&t.body===a&&!A(r)&&r>=0&&52428.8>Vs+r,t.keepalive&&(m=r,Vs+=m),s(n,t).then(t=>t.text().then(n=>{var r;if(f)return;let i={statusCode:t.status,text:n};if(t.status===200)try{i.json=JSON.parse(n)}catch(e){z.error(e)}f=!0,h(),(r=e.callback)==null||r.call(e,i,Zs(()=>t.headers.get(`Retry-After`)))})).catch(e=>{h(),p(e)}).finally(h)}catch(e){h(),p(e)}},ec=e=>{try{let{url:t,encodedBody:n}=Ks(e),{contentType:r,body:a,estimatedSize:o}=n??{};if(!a)return;let c=a instanceof Blob?a:new Blob([a],{type:r});if(i.sendBeacon(t,c))return;let l=E(e.data)?e.data:e.data?.batch;if(E(l)&&l.length>1&&(o??0)>16384){let t=Math.ceil(l.length/2),n=t=>E(e.data)?t:R(R({},e.data),{},{batch:t});ec(R(R({},e),{},{data:n(l.slice(0,t))})),ec(R(R({},e),{},{data:n(l.slice(t))}));return}z.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${s?`fetch`:`XHR`}`),s?$s(R(R({},e),{},{rl:!0})):Qs(e)}catch(e){z.warn(`Beacon send failed`,e)}},tc=(e,t,n,r)=>{let i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return Ws(n===zo.GZipJS?Us(e,`compression`):e,R(R({},i?{[i]:Date.now().toString()}:{}),n===zo.GZipJS?{}:{compression:n}))},nc=(()=>{let e=[];return s&&e.push({transport:`fetch`,method:$s}),c&&e.push({transport:`XHR`,method:Qs}),i!=null&&i.sendBeacon&&e.push({transport:`sendBeacon`,method:ec}),e})();let rc=!Rs&&d?.indexOf(`MSIE`)===-1&&d?.indexOf(`Mozilla`)===-1;function ic(e,t,n){var r,i;n&&(t=R(R({},t),{},{callback:e=>n(e)})),e.__loaded?rc?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)==null||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=R(R({},e.config.request_headers),t.headers),t.compression=t.compression===`best-available`?e.compression??t.compressionFallback:t.compression,(A(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=[`sendBeacon`]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((e,t)=>{let n=R(R({},e),{},{callback:t??(t=>e.callback?.call(e,t))});n.timeout=n.timeout||6e4;let r=n.transport??`fetch`;r===`sendBeacon`&&A(n.compression)&&n.data&&(n.compression=zo.Base64),n.method===`POST`&&n.data&&(n.timestampMode===`capture-body`?n.data=(e=>{var t;let n=(E(e)?e:[e]).map(e=>R(R({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),r=n[0];return{api_key:(r==null||(t=r.properties)==null?void 0:t.token)??r?.token,batch:n,sent_at:(/* @__PURE__ */ new Date()).toISOString()}})(n.data):n.timestampMode===`body`&&(n.data=((e,t=(/* @__PURE__ */ new Date()).toISOString())=>E(e)?e.map(e=>R(R({},e),{},{sent_at:t})):R(R({},e),{},{sent_at:t}))(n.data))),n.url=tc(n.url,n.method,n.compression,n.timestampMode);let i=nc.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=function(e,t){for(let n=0;e.length>n;n++)if(t(e[n]))return e[n]}(i,e=>e.transport===r)?.method??i[0].method;if(!a)throw Error(`No available transport method`);let o=e=>{try{a(e)}catch(e){var t;Xs(e)?z.warn(e):z.error(e),(t=n.callback)==null||t.call(n,{statusCode:0,error:e})}};r!==`sendBeacon`&&!n.preferSyncCompression&&n.data&&n.compression===zo.GZipJS&&u&&typeof Promise<`u`&&!Hs?Js(n).then(e=>{o(e)}).catch(t=>{if(Pn(t))return Hs=!0,void o(R(R({},n),{},{compression:void 0,url:tc(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return Pn(e)||t===jn})(t)&&(Hs=!0),o(n)}):o(n)})(t,(r,i)=>{var a,o,s;e.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(o=e.config).on_request_error)==null||a.call(o,r),n?n(r,i):(s=t.callback)==null||s.call(t,r)})):t.fireCallbackOnDrop&&((i=t.callback)==null||i.call(t,{statusCode:0}))}var ac=class{constructor(e,t){this.ol=!0,this.al=[],this.ll=ge(t?.flush_interval_ms||3e3,250,5e3,z.createLogger(`flush interval`),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();let e=this.al.length>0?this.vl():{},t=Object.values(e);[...t.filter(e=>e.url.indexOf(`/e`)===0),...t.filter(e=>e.url.indexOf(`/e`)!==0)].map(e=>{this.fl(e,`sendBeacon`)})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){let e=this.vl();for(let t in e)this.fl(e[t])}},this.ll))}fl(e,t){try{this.ul(e,t)}catch(e){z.error(e)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){let e={};return U(this.al,t=>{var n;let r=t,i=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:``);A(e[i])&&(e[i]=R(R({},r),{},{data:[]})),(n=e[i].data)==null||n.push(r.data)}),this.al=[],e}};const oc=[`retriesPerformedSoFar`];var sc=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!A(n)&&`onLine`in n.navigator){if(this.ml=n.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},G(n,`online`,this.yl),G(n,`offline`,this._l)}}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,r=Bn(e,oc);ne(n)&&(r.url=Ws(r.url,{retry_count:n})),ic(this._instance,t?R(R({},r),{},{transport:t}):r,(e,t)=>{var i;if(e.statusCode!==200&&(400>e.statusCode||e.statusCode>=500)){if((e.statusCode===0?3:10)>(n??0))return void this.Ls(R({retriesPerformedSoFar:n},r),t);e.statusCode===0&&z.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${n??0} retries.`)}(i=r.callback)==null||i.call(r,e)})}Ls(e,t){let n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;let r=Math.max(function(e){let t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(n),t??0),i=Date.now()+r;this.al.push({retryAt:i,requestOptions:e});let a=`Enqueued failed request for retry in ${r}`;navigator.onLine||(a+=` (Browser is offline)`),z.warn(a),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){let e=Date.now(),t=[],n=this.al.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.al=t,n.length>0)for(let{requestOptions:e}of n)this.retriableRequest(e)}unload(){this.kl&&=(clearTimeout(this.kl),void 0),this.pl=!1,A(n)||(this.yl&&=(n.removeEventListener(`online`,this.yl),void 0),this._l&&=(n.removeEventListener(`offline`,this._l),void 0));for(let{requestOptions:e}of this.al)try{this._instance._send_request(R(R({},e),{},{transport:`sendBeacon`}))}catch(e){z.error(e)}this.al=[]}},cc=class{constructor(e){this._instance=e,this.Sl=()=>{this.xl||={};let e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(t),this.xl.maxScrollY=Math.max(t,this.xl.maxScrollY??0),this.xl.maxScrollHeight=Math.max(n,this.xl.maxScrollHeight??0),this.xl.lastContentY=r,this.xl.maxContentY=Math.max(r,this.xl.maxContentY??0),this.xl.maxContentHeight=Math.max(i,this.xl.maxContentHeight??0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){let e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){G(n,`scroll`,this.Sl,{capture:!0}),G(n,`scrollend`,this.Sl,{capture:!0}),G(n,`resize`,this.Sl)}scrollElement(){if(this.Cl){let t=E(this.Cl)?this.Cl:[this.Cl];for(let r of t){var e;let t=n==null||(e=n.document)==null?void 0:e.querySelector(r);if(t)return t}return}var t;return n==null||(t=n.document)==null?void 0:t.documentElement}$l(e){var t,r;let i=e===`y`?`scrollTop`:`scrollLeft`;if(this.Cl){let e=this.scrollElement();return e&&e[i]||0}return n?e===`y`?n.scrollY||n.pageYOffset||((t=n.document)==null||(t=t.documentElement)==null?void 0:t.scrollTop)||0:n.scrollX||n.pageXOffset||((r=n.document)==null||(r=r.documentElement)==null?void 0:r.scrollLeft)||0:0}scrollY(){return this.$l(`y`)}scrollX(){return this.$l(`x`)}};const lc=e=>Co(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes);var uc=class{constructor(e,t,n,r){this.Be=e=>{let t=this.Tl();if(t&&t.sessionId===e)return;let n={sessionId:e,props:this.Il(this._instance)};this.Ml.register({[oi]:n})},this._instance=e,this.El=t,this.Ml=n,this.Il=r||lc,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[oi]}getSetOnceProps(){let e=this.Tl()?.props;return e?`r`in e?wo(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){let e={};return U(Ai(this.getSetOnceProps()),(t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_${C(n)}`]=t}),e}},dc=class{on(e,t){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(t),()=>{this.Pl[e]=this.Pl[e].filter(e=>e!==t)}}emit(e,t){for(let n of this.Pl[e]||[])n(t);for(let n of this.Pl[`*`]||[])n(e,t)}constructor(){this.Pl={}}};const fc=B(`[SessionId]`),pc=864e5;var mc=class{on(e,t){return this.Rl.on(e,t)}constructor(e,t,n){var r;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new dc,this.Nl=(e,t)=>!(!ne(e)||!ne(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||Vi,this.Bl=n||Vi;let i=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*ge(this.Rr.session_idle_timeout_seconds||1800,60,36e3,fc.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl=`ph_`+i+`_window_id`,this.Ul=`ph_`+i+`_primary_window_exists`,this.Wl()){let e=J.Dt(this.zl),t=J.Dt(this.Ul);e&&!t?this.He=e:J.Lt(this.zl),J.At(this.Ul,!0)}(r=this.Rr.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return A(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return this.Rr.persistence!==`memory`&&!this.Ml.mi&&J.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&J.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?J.Dt(this.zl):null}Ql(e){let t=this.Al;return!N(t)&&!N(e)&&5e3>Math.abs(e-t)}Jl(e,t,n){let r=t!==this._sessionActivityTimestamp,i=e===this.Xt&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,i&&!r||i&&this.Ql(t)||(this.Al=t,this.Ml.register({[Ir]:[t,e,n]}))}Kl(){let e=this.Rr?.persistence_save_debounce_ms;return ne(e)&&e>0}Xl(){this.Kl()?this.Ml.refreshKey(Ir):(this.Ml.flush(),this.Ml.load())}Yl(){if(N(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();let[,e,t]=this.tu();e===this.Xt&&t===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[Ir]:[this._sessionActivityTimestamp,this.Xt??null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){let[e]=this.tu(),t=ne(e)?e:0,n=ne(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){let e=this.Ml.props[Ir];return E(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,t=!1){let n=((e,t=(/* @__PURE__ */ new Date()).getTime())=>{try{let n=(e=>{let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(e);return n>t+6e4?void fc.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){fc.error(`Invalid sessionID in bootstrap`,e);return}})(e);return!A(n)&&(t?this.ql={sessionId:e,sessionStartTimestamp:n}:this.Jl(e,(/* @__PURE__ */ new Date()).getTime(),n),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&n&&(n.removeEventListener(Si,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&J.Lt(this.Ul)},G(n,Si,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Rr.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);let r=t||(/* @__PURE__ */ new Date()).getTime(),i=this.Xt;if(n)this.Fl=r;else if(N(this.Fl)||this.Fl>r||r-this.Fl>=1e3){var a,o;(a=(o=this.Ml).syncCookieProperties)==null||a.call(o),this.Fl=r}let[,s,c]=this.tu(),l=!A(i)&&s!==i,u=this.eu(),d=this.Zl(),f=this.ql,p=!!f&&(f.sessionStartTimestamp>r+6e4||r-f.sessionStartTimestamp>pc),m=f?p:ne(c)&&Math.abs(r-c)>pc,h=!1,g=l,_=!s||!!f,v=s,y=!_&&!e&&this.Nl(r,u);if(y&&(y=this.iu(r),y||fc.info(`cross-tab refresh kept the session alive`,{sessionId:s}),[,s,c]=this.tu(),y||(_=!s||!!f)),_||y||m){g=!1;let e=f&&!p;s=e?f.sessionId:this.jl(),d=this.Bl(),fc.info(`new session ID assigned`,{sessionId:s,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m}}),c=e?f.sessionStartTimestamp:r,this.ql=void 0,h=!0}else d||(d=this.Bl(),h=!0),g||=s!==v,g&&(fc.info(`adopted cross-tab session id`,{sessionId:s,windowId:d}),h=!0);let b=ne(u)&&e&&!m?u:r,x=ne(c)?c:(/* @__PURE__ */ new Date()).getTime();this.Gl(d),this.Jl(s,b,x),e||this.Hl();let S={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m,crossTabAdoption:g};return h&&this.Ol.forEach(e=>e(s,d,S)),{sessionId:s,windowId:d,sessionStartTimestamp:x,changeReason:h?S:void 0,lastActivityTimestamp:u}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll){if(this.iu((/* @__PURE__ */ new Date()).getTime())){let e=this.Xt;this.resetSessionId(),this.Rl.emit(`forcedIdleReset`,{idleSessionId:e})}else this.Hl()}},1.1*this.sessionTimeoutMs))}};const hc=function(e,t){if(!e)return!1;let n=e.userAgent;if(n&&he(n,t))return!0;try{let n=e?.userAgentData;if(n?.brands&&n.brands.some(e=>he(e?.brand,t)))return!0}catch{}return!!e.webdriver};function gc(){return(gc=L(function*(){let e=i?.userAgentData;if(e?.getHighEntropyValues)try{let t=(yield e.getHighEntropyValues([`model`]))?.model;return j(t)&&t.length>0?t:void 0}catch(e){z.info(`Unable to resolve $device_model from userAgentData.getHighEntropyValues`,e);return}})).apply(this,arguments)}function _c(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function vc(e){var t;return!!((t=e.conditions)!=null&&(t=t.events)!=null&&(t=t.values)!=null&&t.length)}const yc=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},bc=e=>e.toLowerCase(),xc={exact:(e,t)=>t.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=>yc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!yc(t,e))),icontains:(e,t)=>t.map(bc).some(t=>e.map(bc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(bc).every(t=>e.map(bc).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{let n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{let n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})};function Sc(e,t){return!e||Object.entries(e).every(([e,n])=>{let r=t?.[e];if(r==null)return!1;let i=xc[n.operator];return!!i&&i(n.values.map(String),[String(r)])})}function Cc(e,t,n){return io({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const wc=`custom`,Tc=`i.posthog.com`,Ec=/^\/static\//,Dc=[`/s/`,`/e/`,`/i/`];var Oc=class{constructor(e){this.su={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){let e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.${Tc}`,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.su[this.apiHost]||(this.su[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`:wc),this.su[this.apiHost]}ru(e){if(!Ec.test(e))return;let t=this.instance.config.asset_host;return typeof t==`string`&&t.trim().replace(/\/$/,``)||void 0}ou(e){let t=ao(e);return t?t.protocol+`//`+t.host+t.pathname:void 0}au(e,t,n){if(e===`ui`)return n;let r=n,i=this.instance.config.rewriteRequestPath;if(i){let e=ao(n)?.href||n;r=i(new URL(e)).toString()}if(i&&e===`api`&&Dc.some(e=>t.indexOf(e)===0)){let e=this.ou(r);if(e){let t=this.apiHost,n=this.lu;n?.apiHost===t&&n.rewriteRequestPath===i||(n={apiHost:t,rewriteRequestPath:i,urls:/* @__PURE__ */ new Set},this.lu=n),n.urls.add(e)}}return r}isIngestionEndpoint(e){let t=this.lu,n=this.ou(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=``){if(t&&=t[0]===`/`?t:`/${t}`,e===`ui`)return this.au(e,t,this.uiHost+t);if(e===`flags`)return this.au(e,t,this.flagsApiHost+t);if(e===`assets`){let n=this.ru(t);if(n)return this.au(e,t,`${n}${t}`)}if(this.region===wc)return this.au(e,t,this.apiHost+t);let n=Tc+t;switch(e){case`assets`:return this.au(e,t,`https://${this.region}-assets.${n}`);case`api`:return this.au(e,t,`https://${this.region}.${n}`)}}};const $=B(`[Surveys]`),kc=e=>{try{let t=(e=>((e,t)=>`seenSurvey_${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`)(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,`true`)}catch(e){$.error(`Failed to persist survey seen state`,e)}},Ac=[Wo.Popover,Wo.Widget,Wo.API],jc={ignoreConditions:!1,ignoreDelay:!1,displayType:Xo.Popover},Mc=B(`[PostHog ExternalIntegrations]`),Nc={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`};var Pc=class{constructor(e){this._instance=e}zo(e,t){var n,r;(n=m.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,e,e=>{if(e)return Mc.error(`failed to load script`,e);t()})}startIfEnabledOrStop(){for(let[r,i]of Object.entries(this._instance.config.integrations??{})){var e,t,n;i&&!((e=m.__PosthogExtensions__)!=null&&(e=e.integrations)!=null&&e[r])&&this.zo(Nc[r],()=>{var e;(e=m.__PosthogExtensions__)==null||(e=e.integrations)==null||(e=e[r])==null||e.start(this._instance)}),!i&&(t=m.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[r]&&((n=m.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[r])==null||n.stop())}}},Fc=class{constructor(e,t){this.$=e,this.wo=t,this.uu=/* @__PURE__ */ new Map,this.Io=!1}add(e){var t=this;return L(function*(){if(t.Io)throw Error(`Cannot add an extension to a disposed ExtensionRuntime`);if(t.uu.has(e.name))throw Error(`Browser extension "${e.name}" is already registered`);t.uu.set(e.name,e);try{let n=e.setup(t.wo);n&&(yield n)}catch(n){let r=t.uu.get(e.name)===e;r&&t.uu.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),r&&t.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;let e=Array.from(this.uu.values()).reverse();this.uu.clear();for(let t of e)this.hu(t)}hu(e){try{let t=e.dispose?.call(e);t&&D(t.then)&&t.then(void 0,t=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this.$.error(`Failed to dispose browser extension "${e.name}"`,t)}}},Ic=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e==`string`)return t?.get_property(e);let n={};for(let r of e){let e=t?.get_property(r);A(e)||(n[r]=e)}return n}set(e,t){var n;(n=this._instance.persistence)==null||n.register(typeof e==`string`?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}};const Lc=`extensionsRemoteConfig`;var Rc=class{constructor(e){this.instance=e,this.Io=!1,this.$=z,this.cu=e.du,this.kv=new Ic(e),this.onEvent=e=>Zo(this.instance.on(`eventCaptured`,t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.$.error(`Browser extension event listener failed`,e)}})),this.onRemoteConfig=e=>{if(this.Io)return Zo(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error(`Browser extension remote config listener failed`,e)}},n=this.instance.vu.on(Lc,t);return this.cu&&t(this.cu),Zo(n)},this.fu=new Fc(z.createLogger(`[BrowserExtensions]`),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){return this.instance.get_property(`$device_id`)??this.distinctId}get deviceId(){let e=this.instance.get_property(_r);return typeof e==`string`?e:void 0}get library(){return{name:V.LIB_NAME,version:V.LIB_VERSION}}get initialPersonProperties(){return this.instance.persistence?.get_initial_props()??{}}get groups(){return this.instance.getGroups()}get session(){try{let e=this.instance.sessionManager?.checkAndGetSessionAndWindowId(!0);return{sessionId:e?.sessionId??``,windowId:e?.windowId??``,sessionStartTimestamp:e?.sessionStartTimestamp??0}}catch{return{sessionId:``,windowId:``,sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}capture(e,t,n){n?this.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Zo(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(Lc,e))}sendRequest(e){var t=this;return L(function*(e,n={}){let r=t.instance.requestRouter.endpointFor(n.target??`api`,e),i={method:n.method,url:n.query?Ws(r,n.query):r,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target===`flags`&&n.compression===`best-available`?v.Base64:void 0,timestampMode:n.sentAt};return n.transport===`sendBeacon`?(t.instance._send_request(i),{statusCode:202}):new Promise(e=>{i.callback=e,t.instance._send_request(i)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const zc={};let Bc=0;const Vc=()=>{},Hc=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,Uc=`Surveys module not available`,Wc=`sanitize_properties is deprecated. Use before_send instead`,Gc=`Invalid value for property_denylist config: `,Kc=/^[A-Za-z0-9_-]{1,400}$/,qc=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Jc=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Yc=[`token`,`distinct_id`,fi],Xc=`posthog`,Zc=e=>{let t={};return e&&e!==`unset`?(`2025-11-30`>e||(t.strictMinimumDuration=!0),`2026-05-30`>e||(t.canvasCapture={resolutionScale:.6}),`2026-06-25`>e||(t.streamNetworkBody=!0),`2026-08-30`>e||(t.captureJsonLd=!0),t):t},Qc=e=>{var t;return R({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,asset_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Ni(a?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:Vc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e??`unset`,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:o&&j(o?.search)&&o.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:`fallback`,enable_recording_console_log:void 0,secure_cookie:(n==null||(t=n.location)==null?void 0:t.protocol)===`https:`,ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(e){z.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:bi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Vc},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:wa,ignore_text_selection:!0}:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:Zc(e),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,persistence_save_debounce_ms:e&&e>=`2026-05-30`?250:0,split_storage:!(!e||`2026-05-30`>e),detect_google_search_app:!(!e||`2026-05-30`>e),disable_capture_url_hashes:!(!e||`2026-06-25`>e),cookieWinsOnConflict:!(!e||e===`unset`||`2026-08-29`>e)}))(e))},$c=[[`process_person`,`person_profiles`],[`xhr_headers`,`request_headers`],[`cookie_name`,`persistence_name`],[`disable_cookie`,`disable_persistence`],[`__preview_disable_beacon`,`disable_beacon`],[`store_google`,`save_campaign_params`],[`verbose`,`debug`],[`__preview_cookie_wins_on_conflict`,`cookieWinsOnConflict`]],el=e=>{let t={};for(let[n,r]of $c)A(e[n])||(t[r]=e[n]);let n=W({},t,e),r=e.__preview_external_dependency_versioned_paths;return A(r)||(A(e.strict_script_versioning)&&(n.strict_script_versioning=!!r),j(r)&&A(e.asset_host)&&(n.asset_host=r)),E(e.property_blacklist)&&(A(e.property_denylist)?n.property_denylist=e.property_blacklist:E(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:z.error(Gc+e.property_denylist)),n};var tl=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},nl=class e{mu(e){if(!e)return;let t=this.uu.indexOf(e);t!==-1&&this.uu.splice(t,1)}yu(e,t){var n;return this.mu(e),this.uu.push(t),(n=t.initialize)==null||n.call(t),t}bu(){return this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;let e=this.config.persistence===`memory`||this.config.persistence===`sessionStorage`;if(!e&&!this.config.disable_persistence||this.ku)return;let t,n,r;e?(t=`persistence is set to '${this.config.persistence}'`,n=this.config.persistence===`memory`?`on every page load`:`for every new browser tab or window`,r=`Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId.`):(t=`persistence is disabled (disable_persistence is true)`,n=`on every page load`,r=`Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId.`),this.wu=!0,console.warn(`[PostHog.js]`,`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${n}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${r}`)}Su(){if(this.bu()||this.get_distinct_id()!==`$posthog_cookieless`)return;let e=this.persistence;if(!e)return;this.xu()||e.load(!0);let t=this.get_distinct_id();if(!t||t===`$posthog_cookieless`){let t=this.config.get_device_id(Vi());this.register({distinct_id:t,$device_id:t}),e.set_property(H,vi)}this.Cu()}get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.$u=!1,this.Tu=!1,this.webPerformance=new tl,this.Iu=!1,this.version=V.LIB_VERSION,this.Mu=/* @__PURE__ */ new Set,this.Eu=``,this.vu=new dc,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qc(),this.SentryIntegration=$a,this.sentryIntegration=e=>function(e,t){let n=Qa(e,t);return{name:Za,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new cc(this),this.pageViewManager=new eo(this),this.rateLimiter=new ns(this),this.requestRouter=new Oc(this),this.consent=new oa(this),this.externalIntegrations=new Pc(this);let t=e.__defaultExtensionClasses??{};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.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,e=>z.info(`send "${e?.event}"`,e))}init(t,n,r){if(r&&r!==Xc){let i=zc[r]??new e;return i._init(t,n,r),zc[r]=i,zc[Xc][r]=i,i}return this._init(t,n,r)}_init(e,t={},r){var i;let a=j(e)?e.trim():``;if(!a)return z.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return a===this.config?.token?console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`):console.warn(`[PostHog.js]`,`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`),this;this.__loaded=!0,this.config=Qc(t.defaults),t.debug=this.Du(t.debug),this.Lu=t,this.Nu=[],t.person_profiles?this.Fu=t.person_profiles:t.process_person&&(this.Fu=t.process_person);let o=Qc(t.defaults),s=el(t),c=W({},o,s,{name:r,token:a});O(o.rageclick)&&O(s.rageclick)&&(c.rageclick=W({},o.rageclick,s.rageclick)),O(o.session_recording)&&O(s.session_recording)&&(c.session_recording=W({},o.session_recording,s.session_recording)),this.set_config(c),this.config.on_xhr_error&&z.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:zo.GZipJS;let l=this.xu();if(this.persistence=new Ro(this.config,l),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ro(R(R({},this.config),{},{persistence:`sessionStorage`}),l,!1),this.Eu=`ph_`+(this.config.persistence_name||this.config.token)+`_session_registered_properties`,this.config.persistence!==`memory`&&!l&&J.Et()){let e=J.Dt(this.Eu);E(e)&&e.forEach(e=>{j(e)&&this.Mu.add(e)})}else J.Lt(this.Eu);let u=R({},this.persistence.props),d=R({},this.sessionPersistence.props);this.register({$initialization_time:(/* @__PURE__ */ new Date()).toISOString()}),this.qu=new ac((e,t)=>this.ju(e,t),this.config.request_queue_config),this.Bu=new sc(this),this.__request_queue=[];let f=this.bu();f||(this.sessionManager=new mc(this),this.sessionPropsManager=new uc(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,n)=>{(n!=null&&n.activityTimeout||n!=null&&n.sessionPastMaximumLength||n!=null&&n.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(z.info(`Deferring extension initialization to improve startup performance`),setTimeout(()=>{this.Uu(f)},0)):(z.info(`Initializing extensions synchronously`),this.Uu(f)),V.DEBUG=V.DEBUG||this.config.debug,V.DEBUG&&z.info(`Starting in debug mode`,{this:this,config:t,thisC:R({},this.config),p:u,s:d}),this.config.identity_distinct_id&&!((i=t.bootstrap)!=null&&i.distinctID)&&(t.bootstrap=R(R({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let p=t.bootstrap?.distinctID;if(this.ku=!!p&&!M(p),t.bootstrap?.distinctID){let e=t.bootstrap.distinctID,n=this.get_distinct_id(),r=this.persistence.get_property(H);if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`anonymous`)this.identify(e);else if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`identified`)z.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{let n=this.config.get_device_id(Vi()),r=t.bootstrap.isIdentifiedID?n:e;this.persistence.set_property(H,t.bootstrap.isIdentifiedID?yi:vi),this.register({distinct_id:e,$device_id:r})}}if(f)this.register_once({distinct_id:di,$device_id:null},``);else if(!this.get_distinct_id()){let e=this.config.get_device_id(Vi());this.register_once({distinct_id:e,$device_id:e},``),this.persistence.set_property(H,vi)}return G(n,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),G(n,`pageshow`,()=>{var e;this.$u=!1,this.Tu||(e=this.Bu)==null||e.resume()}),t.segment?Xa(this,()=>this.Wu()):this.Wu(),D(this.config._onCapture)&&this.config._onCapture!==Vc&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,e=>this.config._onCapture(e.event,e))),this.config.ip&&z.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return gc.apply(this,arguments)}().then(e=>{e&&this.register({[vr]:e})}).catch(Vc),this}Vu(e){let t=e;return j(t.name)&&D(t.setup)}Gu(e,t){this.Vu(e)?t.push(()=>{this.Zu().add(e).catch(()=>e.dispose?.call(e)).catch(t=>{z.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.uu.push(e)}zu(){let t=this.config.__extensionClasses?.featureFlags??e.__defaultExtensionClasses?.featureFlags;var n,r,i;t&&(this.featureFlags&&this.featureFlags instanceof t||((n=this.Qu)==null||n.call(this),this.Qu=void 0,this.featureFlags=new t(this)),D(this.featureFlags.onReloading)&&D(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit(`featureFlagsReloading`,!0)}),this.Zu().add(this.featureFlags)):(r=(i=this.featureFlags).initialize)==null||r.call(i))}Uu(t){let n=performance.now(),r=R(R({},e.__defaultExtensionClasses),this.config.__extensionClasses),i=[];r.exceptions&&this.uu.push(this.exceptions=this.exceptions??new r.exceptions(this)),r.historyAutocapture&&this.uu.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.uu.push(this.tracingHeaders=new r.tracingHeaders(this)),r.siteApps&&this.uu.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),r.autocapture&&this.Gu(this.autocapture=new r.autocapture(this),i),r.surveys&&this.Gu(this.surveys=this.surveys??new r.surveys(this),i),r.logs&&this.Gu(this.logs=this.logs??new r.logs(this),i),r.metrics&&this.uu.push(this.metrics=this.metrics??new r.metrics(this)),r.conversations&&this.uu.push(this.conversations=this.conversations??new r.conversations(this)),r.productTours&&this.uu.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.uu.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.uu.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,qa)),r.toolbar&&this.uu.push(this.toolbar=this.toolbar??new r.toolbar(this)),r.experiments&&this.uu.push(this.experiments=this.experiments??new r.experiments(this)),this.uu.forEach(e=>{e.initialize&&i.push(()=>{var t;(t=e.initialize)==null||t.call(e)})}),i.push(()=>{if(this.Ju){let e=this.Ju;this.Ju=void 0,this.uu.forEach(t=>t.onRemoteConfig?.call(t,e))}}),this.Ku(i,n)}Ku(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,t)},0);let n=e.shift();if(n)try{n()}catch(e){z.error(`Error initializing extension:`,e)}}let n=Math.round(performance.now()-t);this.register_for_session({[pi]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[mi]:n}),this.config.__preview_deferred_init_extensions&&z.info(`PostHog extensions initialized (${n}ms)`)}il(e){var t;if(!a||!a.body)return z.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var n;let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=x(t.supportedCompression,zo.GZipJS)?zo.GZipJS:x(t.supportedCompression,zo.Base64)?zo.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:bi}),(t=this.Xu)==null||t.handleRemoteConfig(e),this.uu.forEach(t=>t.onRemoteConfig?.call(t,e))}Wu(){try{this.config.loaded(this)}catch(e){z.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&o?.hostname){let e=o.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new is(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Di(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,t,n,r,i,a;this.$u=!0,(e=this.surveys)==null||(t=e.handlePageUnload)==null||t.call(e),(n=this.metrics)==null||n.flush(`sendBeacon`),this.config.request_batching?(this.ih()&&this.capture(wi),(r=this.logs)==null||r.flushLogs(`sendBeacon`),(i=this.qu)==null||i.unload(),(a=this.Bu)==null||a.unload()):this.ih()&&this.capture(wi,null,{transport:`sendBeacon`})}_send_request(e){ic(this,e)}ju(e,t){this.Bu?this.Bu.retriableRequest(e,t):this._send_request(t?R(R({},e),{},{transport:t}):e)}_execute_array(e){Bc++;try{let t,n=[],r=[],i=[];Di(e,e=>{if(e){if(t=e[0],E(t))i.push(e);else if(D(e))try{e.call(this)}catch(t){z.error(`Error executing queued PostHog call`,e,t)}else E(e)&&t===`alias`?n.push(e):E(e)&&t.indexOf(`capture`)!==-1&&D(this[t])?i.push(e):r.push(e)}});let a=function(e,t){Di(e,function(e){try{if(E(e[0])){let n=t;U(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){z.error(`Error executing queued PostHog call`,e,t)}})};a(n,this),a(r,this),a(i,this)}finally{Bc--}}push(t){if(Bc>0&&E(t)&&j(t[0])){let n=e.prototype[t[0]];D(n)&&n.apply(this,t.slice(1));return}this._execute_array([t])}get nh(){return{property:br,persistenceKey:xr,cookieName:`_fbc`,pattern:qc,register:(e,t)=>this.persistence?.register({[xr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(xr)}}get sh(){return{property:Sr,persistenceKey:Cr,cookieName:`_fbp`,pattern:Jc,register:(e,t)=>this.persistence?.register({[Cr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(Cr)}}rh(e){let t=this.persistence?.get_property(e.persistenceKey);return j(t)&&e.pattern.test(t)?{value:t,delivered:!1}:O(t)&&j(t.value)&&e.pattern.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}oh(e,t,n){return t===n?.value?{value:t,pending:!n.delivered}:(e.register(t,!1),{value:t,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;let t=Fi(e.cookieName);return j(t)&&e.pattern.test(t)?t:void 0}uh(e,t,n,r){if(!this.persistence)return;let i=this.nh;this.persistence.refreshKey(i.persistenceKey);let a=this.rh(i);if(r)return void i.unregister();if(n)return j(t)&&qc.test(t)?this.oh(i,t,a):void i.unregister();let o=j(e)&&Kc.test(e)?e:void 0,s=this.ah(i);return s&&((e,t,n)=>{let r=e.split(`.`);if(t)return r[3]===t;if(!n)return!0;let i=n.value.split(`.`);return r[3]===i[3]||Number(r[2])>Number(i[2])})(s,o,a)?this.oh(i,s,a):o?a?.value.split(`.`)[3]===o?{value:a.value,pending:!a.delivered}:this.oh(i,`fb.1.${Date.now()}.${o}`,a):a?{value:a.value,pending:!a.delivered}:void 0}hh(e,t,n){if(!this.persistence)return;let r=this.sh;this.persistence.refreshKey(r.persistenceKey);let i=this.rh(r);if(n)return void r.unregister();if(t)return j(e)&&Jc.test(e)?this.oh(r,e,i):void r.unregister();let a=this.ah(r);return a?this.oh(r,a,i):i?{value:i.value,pending:!i.delivered}:void 0}dh(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);let n=this.rh(e);n?.value!==t||n.delivered||e.register(t,!0)}capture(e,t,n){if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void z.uninitializedWarning(`posthog.capture`);if(!this.is_capturing())return;if(A(e)||!j(e))return void z.error(`No event name provided to posthog.capture`);this.Su();let r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;let i=n?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i?.isRateLimited)return void z.critical(`This capture call is ignored due to client rate limiting.`);let a;t!=null&&t.$current_url&&!j(t?.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.fh||z.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(a=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();let o=/* @__PURE__ */ new Date,s=n?.timestamp||o,c=Dt(n?.uuid,Vi),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},s,c)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(l.event=`$bot_pageview`,l.properties.$browser_type=`bot`),i&&(l.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens);let u=e===`$feature_flag_called`&&!1===l.properties.$feature_flag_has_experiment&&!0===this.get_property(`$minimal_flag_called_events`);n!=null&&n.$set&&!u&&(l.$set=n?.$set);let d=O(t?.$set)?t.$set:void 0,f=E(t?.$unset)?t.$unset:[],p=n?.$unset||[],m=e=>{var t;let r=!!n?.$set&&e in n.$set;return{hasProvided:r||!!d&&e in d,provided:r?n==null||(t=n.$set)==null?void 0:t[e]:d?.[e],unset:f.indexOf(e)!==-1||p.indexOf(e)!==-1}},h=m(br),g=m(Sr),_=[{channel:this.nh,hasProvided:h.hasProvided,update:this.uh(a?.fbclid,h.provided,h.hasProvided,h.unset)},{channel:this.sh,hasProvided:g.hasProvided,update:this.hh(g.provided,g.hasProvided,g.unset)}];for(let{channel:e,hasProvided:t,update:n}of _)n&&!0===l.properties.$process_person_profile&&n.pending&&!t&&!u&&(l.$set=R({[e.property]:n.value},l.$set));let v=n?.$unset;v&&(l.$unset=v);let y=u?void 0:this.ph(n?.$set_once,e!==Ei,e===Ti);if(y&&(l.$set_once=y),n!=null&&n._noTruncate||(b=this.config.properties_string_max_length,l=function(e,t){let n=/* @__PURE__ */ new Set;return function e(r,i){if(r!==Object(r))return t?t(r):r;if(n.has(r))return;let a;if(n.add(r),E(r))a=[],Di(r,t=>{a.push(e(t))});else{let t={};U(se(r)?ji(r):r,(r,i)=>{n.has(r)||(t[i]=e(r,i))}),a=t}return a}(e)}(l,e=>j(e)?e.slice(0,b):e)),l.timestamp=s,A(n?.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=o),u&&(l.properties=((e,t=[])=>{let n={},r=t=>{e[t]!==void 0&&(n[t]=e[t])};return An.forEach(r),t.forEach(r),n})(l.properties,Yc)),e===Jo.DISMISSED||e===Jo.SENT){let n=t?.[Yo.SURVEY_ID],r=t?.[Yo.SURVEY_ITERATION];kc({id:n,current_iteration:r}),l.$set=R(R({},l.$set),{},{[_c({id:n,current_iteration:r},e===Jo.SENT?`responded`:`dismissed`)]:!0})}else e===Jo.SHOWN&&(l.$set=R(R({},l.$set),{},{[Yo.SURVEY_LAST_SEEN_DATE]:(/* @__PURE__ */ new Date()).toISOString()}));var b;if(e===$o.SHOWN){let e=t?.[es.TOUR_TYPE];e&&(l.$set=R(R({},l.$set),{},{[`${es.TOUR_LAST_SEEN_DATE}/${e}`]:(/* @__PURE__ */ new Date()).toISOString()}))}let x=R(R({},l.properties.$set),l.$set);if(k(x)||this.setPersonPropertiesForFlags(x),!P(this.config.before_send)){let e=this.Os(l);if(!e)return;l=e,l.uuid=Dt(l.uuid,Vi)}let S=_.filter(({channel:e,update:t})=>{let n=l.$set?.[e.property]??(O(l.properties?.$set)?l.properties.$set[e.property]:void 0);return t?.pending&&n===t.value});this.vu.emit(`eventCaptured`,l);let C=n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),w=n?._batchKey===`recordings`||/\/s\/(?:\?|$)/.test(C),ee=R(R(R({method:`POST`,url:C,data:l,compression:`best-available`,preferSyncCompression:n?.send_instantly,timestampMode:w?`body`:`capture-body`,batchKey:n?._batchKey},w&&l.properties?.$session_id?{batchGroup:l.properties.$session_id+(l.properties.$window_id?`-${l.properties.$window_id}`:``)}:{}),n?.transport?{transport:n.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(let{channel:e,update:t}of S)this.dh(e,t.value)}}:{});if(!this.config.request_batching||n&&!n?._batchKey||n?.send_instantly||S.length){let e;!ee.transport&&!ee.callback&&k(this.config.request_headers??{})&&this.$u&&(e=`sendBeacon`),this.ju(ee,e)}else this.qu.enqueue(ee);return l}_addCaptureHook(e){return this.on(`eventCaptured`,t=>e(t.event,t))}getExtension(e){return this.Xu?.getExtension(e)}Zu(){return this.Xu??=new Rc(this)}pu(e){this.Pu.push(e);let t=!0;return()=>{if(!t)return;t=!1;let n=this.Pu.indexOf(e);n!==-1&&this.Pu.splice(n,1)}}gh(e=!0){var t,n;return!!this.persistence?.consumeCookieIdentityChange()&&(this.Ou=null,this.persistence.get_property(`$user_state`)===`anonymous`&&((n=this.sessionPersistence)==null||n.clear(),this.Mu.clear(),this.mh()),(t=this.featureFlags)==null||t.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,r,i,s){if(r||=/* @__PURE__ */ new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.gh();let c=s?void 0:this.persistence.remove_event_timer(e),l=R({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.bu()&&(l[fi]=!0),e===`$snapshot`){let e=R(R({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=e.distinct_id,(!j(l.distinct_id)&&!F(l.distinct_id)||M(l.distinct_id))&&z.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),l}let u=function(e,t,r,i=!1){var a,s,c;if(!d)return{};let l=e?[...fo,...t||[]]:[],[u,f]=ht(d),[p,m]=function(e){for(let t=0;yt.length>t;t++){let[n,r,i]=yt[t],a=e.match(n);if(a)return[r,(i&&e.match(i)||a)?.[1]||``]}return[``,``]}(d),h=function(){return(`u`>typeof navigator?navigator:void 0)?.brave?{brave:!0}:{}}(),_={};A(r)||(_.detectGoogleSearchApp=r);let v={},y=(a=navigator)==null||(a=a.userAgentData)==null?void 0:a.platform,b=navigator?.maxTouchPoints,x=n==null||(s=n.screen)==null?void 0:s.width,S=n==null||(c=n.screen)==null?void 0:c.height,C=n?.devicePixelRatio;A(y)||(v.userAgentDataPlatform=y),A(b)||(v.maxTouchPoints=b),A(x)||(v.screenWidth=x),A(S)||(v.screenHeight=S),A(C)||(v.devicePixelRatio=C);let w=W(Ai({$os:u,$os_version:f,$browser:dt(d,navigator.vendor,h,_),$webview_app:p,$webview_app_version:m,$device:gt(d),$device_type:_t(d,v),$timezone:To(),$timezone_offset:Eo()}),{$current_url:so(i?kt(o?.href):o?.href,l,mo),$host:o?.host,$pathname:o?.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+`...`:d,$browser_version:pt(d,navigator.vendor,h,_),$browser_language:yo(),$browser_language_prefix:bo(),$screen_height:n?.screen.height,$screen_width:n?.screen.width,$viewport_height:n?.innerHeight,$viewport_width:n?.innerWidth,$lib:g.LIB_NAME,$lib_version:g.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return g.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=g.SDK_DIST_CHANNEL),w}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){let{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0);l.$session_id=e,l.$window_id=t}this.sessionPropsManager&&W(l,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&W(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=this.Bu?.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}let f;if(this.requestRouter.region===wc&&(l.$lib_custom_api_host=this.config.api_host),f=e!==`$pageview`||s?e!==`$pageleave`||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),l=W(l,f),e===`$pageview`&&a&&(l.title=a.title),!A(c)){let e=r.getTime()-c;l.$duration=parseFloat((e/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?`bot`:`browser`);let p=this.persistence.properties(),m=this.sessionPersistence.properties(),h=l.$groups,_=p.$groups;O(h)&&!k(h)&&(l.$groups=R(R({},O(_)?_:{}),h)),U([`$referrer`,`$referring_domain`],e=>{e in p&&delete m[e]});let v={};if(this.Pu.length>0)for(let e of this.Pu.slice())try{W(v,e())}catch(e){z.error(`Failed to produce browser extension event properties`,e)}l=W({},u,p,m,R(R({},v),l)),l.$is_identified=this._isIdentified(),E(this.config.property_denylist)?U(this.config.property_denylist,function(e){delete l[e]}):z.error(Gc+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);let y=this.config.sanitize_properties;y&&(z.error(Wc),l=y(l,e));let b=this.yh();return l.$process_person_profile=b,b&&!s&&this.bh(`_calculate_event_properties`),l}ph(e,t=!0,n=!1){if(!this.persistence||!this.yh()||this.Iu&&!n)return e;let r=this.persistence.get_initial_props(),i=this.sessionPropsManager?.getSetOnceProps(),a=W({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(z.error(Wc),a=o(a,`$set_once`)),t&&(this.Iu=!0),k(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t,n;(t=this.persistence)==null||t.syncCookieProperties(),this.gh(),(n=this.sessionPersistence)==null||n.register(e),Object.keys(e).forEach(e=>this.Mu.add(e)),this.mh()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.Mu.delete(e),this.mh()}_h(e,t){this.register({[e]:t})}Hu(){this.Mu.forEach(e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)}),this.Mu.clear(),this.mh()}mh(){if(!this.Eu)return;if(this.config.persistence===`memory`||this.sessionPersistence?.mi||!J.Et())return void J.Lt(this.Eu);let e=[];this.Mu.forEach(t=>e.push(t)),e.length>0?J.At(this.Eu,e):J.Lt(this.Eu)}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}getAllFeatureFlags(){return this.featureFlags?.getAllFeatureFlags()??[]}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)??t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t=!1,n){return this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.vu.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:Uc}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Uc})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Uc})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t=jc){var n;(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys?.canRenderSurvey(e)??{visible:!1,disabledReason:Uc}}canRenderSurveyAsync(e,t=!1){return this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:Uc})}wh(e){return!e||M(e)?(z.critical(`Unique user id has not been set in posthog.identify`),!1):e===`$posthog_cookieless`?(z.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())||(z.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning(`posthog.identify`);if(F(e)&&(e=e.toString(),z.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),!this.wh(e)||!this.bh(`posthog.identify`))return;this.Su();let r=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.gh(!1),o=this.persistence.Da(),s=!1;try{let r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(`$device_id`)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},``),e!==r&&e!==this.get_property(`__alias`)&&(this.unregister(yr),this.register({distinct_id:e}));let o=(this.persistence.get_property(`$user_state`)||`anonymous`)===vi,l=e!==r,u=!l&&o;if(l&&o){var c;let i=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:r};this.persistence.set_property(H,yi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture(`$identify`,i,{$set:t||{},$set_once:n||{}})&&(this.Ou=Cc(e,t,n)),(c=this.featureFlags)==null||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:r)}else if(u){this.persistence.set_property(H,yi);let r=t||{},i=n||{};this.setPersonPropertiesForFlags({$set:r,$set_once:i},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture(`$set`,{$set:r,$set_once:i})&&(this.Ou=Cc(e,t,n))}else(t||n)&&this.setPersonProperties(t,n);l||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ni)):u&&(t||n)&&this.reloadFeatureFlags(),s=!0}finally{o&&this.persistence.ja(s)}}setPersonProperties(e,t){if(!e&&!t||!this.bh(`posthog.setPersonProperties`))return;let n=Cc(this.get_distinct_id(),e,t);this.Ou===n?z.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}})&&(this.Ou=n))}unsetPersonProperties(e){var t;let n=(E(e)?e:[e]).filter(e=>j(e)&&e.length>0);n.length!==0&&this.bh(`posthog.unsetPersonProperties`)&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(n,!0),this.capture(`$set`,{$unset:n}),this.Ou=null)}group(e,t,n){var r;if(!e||!t)return void z.error(`posthog.group requires a group type and group key`);(r=this.persistence)==null||r.syncCookieProperties(),this.gh();let i=this.getGroups(),a=i[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:R(R({},i),{},{[e]:t})}),(a||n)&&this.yh()){let r={$group_type:e,$group_key:t};n&&(r.$group_set=n),this.capture(Ei,r)}n&&this.setGroupPropertiesForFlags({[e]:n}),a&&!n&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var n;(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var n;this.bh(`posthog.setGroupPropertiesForFlags`)&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){let t=I(e)?e:e?.resetDeviceID,n=I(e)||e==null?void 0:e.bootstrap;this.kh(t,!1,n)}kh(e,t=!1,n){var r,i,a,o,s;if(z.info(`reset`),!this.__loaded)return z.uninitializedWarning(`posthog.reset`);let c=n?.sessionID;this.config.bootstrap=n||this.Lu?.bootstrap||{},(r=this.featureFlags)==null||(i=r.updateConfig)==null||i.call(r,this.config,this.nl());let l=this.get_property(_r),u=this.get_property(vr),d=this.get_property(Fr);(a=this.sessionRecording)==null||a.flushBeforeIdentityReset();let f=this.is_capturing();this.consent.reset(),t||!f||this.is_capturing()||console.warn(`[PostHog.js]`,"reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");let p=(o=this.persistence)==null||(s=o.Da)==null?void 0:s.call(o),m=!1;try{var h,g,_,v,y,b,x,S,C,w,ee,T;if((h=this.persistence)==null||h.clear(),(g=this.sessionPersistence)==null||g.clear(),this.Mu.clear(),this.mh(),A(d)||(w=this.persistence)==null||w.register({$session_recording_remote_config:d}),(_=this.surveys)==null||_.reset(),(v=this.featureFlags)==null||v.reset(),(y=this.conversations)==null||y.reset(),(b=this.logs)==null||b.reset(),(x=this.metrics)==null||x.reset(),(S=this.persistence)==null||S.set_property(`$user_state`,`anonymous`),(C=this.sessionManager)==null||C.resetSessionId(),this.Ou=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:di,$device_id:null},``);else{let t=this.config.get_device_id(Vi());this.register_once({distinct_id:t,$device_id:e?t:l},``),e||A(u)||this.register({[vr]:u})}if(this.register({$last_posthog_reset:(/* @__PURE__ */ new Date()).toISOString()},1),n&&(n.distinctID&&!this.bu()&&((T=this.persistence)==null||T.set_property(`$user_state`,n.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:n.distinctID})),(ee=this.featureFlags)==null||ee.initialize(),!P(c)&&!this.sessionManager?.setBootstrapSessionId(c,!0))){let e=R({},n);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var te,E;p&&((te=this.persistence)==null||(E=te.ja)==null||E.call(te,m))}this.reloadFeatureFlags()}shutdown(e){var t=this;return L(function*(){var e,n,r,i,a,o,s,c;if(t.__loaded){t.Tu=!0,t.Zu().dispose(),(e=t.sessionRecording)==null||e.dispose(),(n=t.logs)==null||n.flushLogs(`sendBeacon`),(r=t.metrics)==null||r.flush(`sendBeacon`),(i=t.metrics)==null||i.dispose(),(a=t.qu)==null||a.unload(),(o=t.Bu)==null||o.unload();try{var l;(l=t.featureFlags)==null||l.destroy()}catch(e){z.error(`Error while destroying feature flags`,e)}(s=t.persistence)==null||s.destroy(),(c=t.sessionPersistence)==null||c.destroy()}else z.uninitializedWarning(`posthog.shutdown`)})()}setIdentity(e,t){var n;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(n=this.conversations)==null||n.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)==null||e.xh()}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;let{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/${this.config.token}/replay/${t}`);if(e?.withTimestamp&&n){let t=e.timestampLookBack??10;if(!n)return r;r+=`?t=${Math.max(Math.floor(((/* @__PURE__ */ new Date()).getTime()-n)/1e3)-t,0)}`}return r}alias(e,t){return e===this.get_property(`$people_distinct_id`)?(z.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.bh(`posthog.alias`)?(A(t)&&(t=this.get_distinct_id()),e===t?(z.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this._h(yr,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){let t=R({},this.config);if(O(e)){var n,r,i,a,o,s,c,l,u,d,f,p,m,h;W(this.config,el(e));let _=this.xu();(n=this.persistence)==null||n.update_config(this.config,t,_),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ro(R(R({},this.config),{},{persistence:`sessionStorage`}),_,!1);let v=this.Du(this.config.debug);var g;I(v)&&(this.config.debug=v),I(this.config.debug)&&(this.config.debug?(V.DEBUG=!0,q.Et()&&q.At(`ph_debug`,!0),z.info(`set_config`,{config:e,oldConfig:t,newConfig:R({},this.config)})):(V.DEBUG=!1,q.Et()&&q.Lt(`ph_debug`))),(r=this.featureFlags)==null||(i=r.updateConfig)==null||i.call(r,this.config,this.nl()),(a=this.exceptionObserver)==null||a.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(s=this.metrics)==null||s.onConfigChange(),(c=this.sessionRecording)==null||c.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(d=this.heatmaps)==null||d.startIfEnabled(),(`capture_pageview`in e||`disable_capture_url_hashes`in e)&&((g=this.historyAutocapture)==null||g.startIfEnabledOrStop()),(f=this.exceptionObserver)==null||f.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(m=this.surveys)==null||m.loadIfEnabled(),this.Cu(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Xa(this,Vc,!1)}}_overrideSDKInfo(e,t){V.LIB_NAME=e,V.LIB_VERSION=t}startSessionRecording(e){let t=!0===e,n={sampling:t||!!e?.sampling,linked_flag:t||!!e?.linked_flag,url_trigger:t||!!e?.url_trigger,event_trigger:t||!!e?.event_trigger};var r,i,a,o,s;Object.values(n).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger(`event`))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){return!!this.sessionRecording?.started}captureException(e,t){try{if(!this.exceptions)return;let n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:/* @__PURE__ */ Error(`PostHog syntheticException`)});return this.exceptions.sendExceptionEvent(R(R({},n),t))}catch{return}}addExceptionStep(e,t){var n;(n=this.exceptions)==null||n.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){return this.logs?.logger??e.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t;return(t=this.toolbar?.loadToolbar(e))!=null&&t}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){let e=this.config.name??Xc;return e!==Xc&&(e=`posthog.`+e),e}_isIdentified(){return this.persistence?.get_property(`$user_state`)===`identified`||this.sessionPersistence?.get_property(`$user_state`)===`identified`}yh(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&k(this.getGroups())&&!((e=this.persistence)!=null&&(e=e.props)!=null&&e.__alias)&&!((t=this.persistence)!=null&&(t=t.props)!=null&&t.$epp))}ih(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles===`never`?(z.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this._u(),this._h(ui,!0),!0)}xu(){if(this.config.cookieless_mode===`always`)return!0;let e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==`on_reject`)}Cu(){let e=this.xu();var t,n,r;return this.is_capturing()||(t=this.logs)==null||t.$h(),this.persistence?.mi!==e&&((n=this.persistence)==null||n.set_disabled(e)),this.sessionPersistence?.mi!==e&&((r=this.sessionPersistence)==null||r.set_disabled(e)),e&&(this.Mu.clear(),this.mh()),e}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==`always`){if(this.bu()){var r,i,a;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new mc(this),this.pageViewManager=new eo(this),this.persistence&&(this.sessionPropsManager=new uc(this,this.sessionManager,this.persistence));let t=this.config.__extensionClasses?.sessionRecording??e.__defaultExtensionClasses?.sessionRecording;var o,s;t&&(this.sessionRecording=this.yu(this.sessionRecording,new t(this)),this.du&&((o=this.sessionRecording)==null||(s=o.onRemoteConfig)==null||s.call(o,this.du)))}var c;this.consent.optInOut(!0),this.Cu(),this.Yu(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&((c=this.surveys)==null||c.loadIfEnabled()),(A(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else z.warn(Hc)}opt_out_capturing(){if(this.config.cookieless_mode===`always`)return void z.warn(Hc);let e=this.config.cookieless_mode===`on_reject`?this.sessionRecording:void 0;var t,n;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===`on_reject`&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode===`on_reject`&&(this.register({distinct_id:di,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return i?hc(i,this.config.custom_blocked_useragents):void 0}th(){a&&(a.visibilityState===`visible`?this.Ru||(this.Ru=!0,this.capture(Ci,{title:a.title},{send_instantly:!0}),this.Au&&=(a.removeEventListener(xi,this.Au),null)):this.Au||(this.Au=this.th.bind(this),G(a,xi,this.Au)))}debug(e){!1===e?(n?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(n?.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}))}nl(){let e=this.Lu||{};return`advanced_disable_flags`in e?!!e.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(z.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):function(e,t,n,r,i){let a=t in e&&!P(e[t]),o=n in e&&!P(e[n]);return a?e[t]:!!o&&(i&&i.warn(`Config field '${n}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[n])}(e,`advanced_disable_flags`,`advanced_disable_decide`,0,z):!!this.config.advanced_disable_flags}Os(e){if(P(this.config.before_send))return e;let t=Object.keys(e.properties??{}).filter(ie),n=E(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(let t of n)try{if(r=t(r),P(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return re(e.event)?z.warn(`${t}. This can cause unexpected behavior.`):z.info(t),null}r.properties&&!k(r.properties)||z.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return z.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(let n of t)if(r.properties&&P(r.properties[n]))return z.warn(`Event '${e.event}' had its '${n}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){return this.pageViewManager.Vo?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Du(e){let t=I(e)&&!e,n=q.Et()&&q.Ot(`ph_debug`)===`true`;return!t&&(!!n||e)}};nl.__defaultExtensionClasses={},nl.Ch=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=ki(e.prototype[t[n]])}(nl,[`identify`]);var rl=class{constructor(e){this.disabled=!1===e;let t=O(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,n){if(this.disabled)return!1;let r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}};const il=`$copy_autocapture`,al=B(`[AutoCapture]`);function ol(e,t){return t.length>e?t.slice(0,e)+`...`:t}function sl(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!la(t));return t}function cl(e,{e:t,maskAllElementAttributes:r,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:o,disableCaptureUrlHashes:s}){if(!la(e))return{props:{}};let c=[e],l=/* @__PURE__ */ new Set([e]),u=e;for(;u.parentNode&&!Y(u,`body`)&&1e3>c.length;){if(da(u.parentNode)){let e=u.parentNode.host;if(l.has(e))break;l.add(e),c.push(e),u=e;continue}if(!la(u.parentNode)||l.has(u.parentNode))break;l.add(u.parentNode),c.push(u.parentNode),u=u.parentNode}let d=t.type===`click`&&e.namespaceURI===`http://www.w3.org/2000/svg`?c.findIndex(e=>Y(e,`button`)||Y(e,`a`)):-1;d>0&&(i||=c.slice(0,d+1).some(e=>!ja(e)||Ma(e)));let f=[],p={},m,h=!1,g=!1;if(U(c,e=>{let t=ja(e);if(Y(e,`a`)&&!r&&!a?.includes(`href`)){let n=e.getAttribute(`href`);h=!!(t&&n&&Ba(n))&&(s?kt(n):n)}x(ma(e),`ph-no-capture`)&&(g=!0),f.push(function(e,t,n,r,i=!1){let a=e.tagName.toLowerCase(),o={tag_name:a};va.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?ol(1024,Va(e)):ol(1024,ga(e)));let s=ma(e);t||r!=null&&r.includes(`class`)||0>=s.length||(o.classes=s.filter(function(e){return e!==``})),U(e.attributes,function(n){var a;if((!Ma(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&!r?.includes(n.name)&&!t&&Ba(n.value)&&(!j(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){let e=n.value;n.name===`class`&&(e=fa(e).join(` `)),o[`attr__`+n.name]=ol(1024,n.name===`href`&&i?kt(e):e)}});let c=1,l=1,u=e;for(;u=sl(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,r,i,a,s)),U(function(e){if(!ja(e))return{};let t={};return U(e.attributes,function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){let n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&Ba(r)&&(t[n]=r)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(p,t)||(p[t]=e)})}),g)return{props:{},explicitNoCapture:g};if(d>0&&(e=c[d],f.splice(0,d)),i||(f[0].$el_text=Y(e,`a`)||Y(e,`button`)?Va(e):ga(e)),h){var _;f[0].attr__href=h;let e=ao(h)?.host,t=n==null||(_=n.location)==null?void 0:_.host;e&&t&&e!==t&&(m=h)}return{props:W((y=t.type,{$event_type:y,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(v=f,E(v)?function(e){return e.map(e=>{let t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class){e.attr_class.sort();for(let n of e.attr_class)t+=`.${n.replace(/"/g,``)}`}let n=R(R(R(R({},e.text?{text:e.text}:{}),{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Oi(n).sort(([e],[t])=>function(e,t){return t>e?-1:+(e>t)}(e,t)).forEach(([e,t])=>r[Ua(e.toString())]=Ua(t.toString())),t+=`:`,t+=Oi(r).map(([e,t])=>`${e}="${t}"`).join(``),t}).join(`;`)}(function(e){return e.map(e=>{let t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:Wa(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Oi(e).filter(([e])=>e.indexOf(`attr__`)===0).forEach(([e,n])=>t.attributes[e]=n),t})}(v)):``)},f[0]?.$el_text?{$el_text:f[0]?.$el_text}:{},m&&t.type===`click`?{$external_click_url:m}:{},p),target:e};var v,y}var ll=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){if(!ja(e))return!0;let t=this.bo().css_selector_ignorelist??Sa,n=/* @__PURE__ */ new Set,r=e;for(;r;){if(n.size>=1e3||n.has(r))return!0;n.add(r);let e=r,i=ma(e);if(x(i,`ph-no-capture`)||x(i,`ph-sensitive`)||Ma(e)||t.some(t=>ya(e,t)))return!0;let a=r.parentNode;r=da(a)?a.host:a&&la(a)?a:null}return!1}_o(e){if(!this.isEnabled||e.type===`pointercancel`)return void this.fo();if(e.type===`pointerdown`){this.fo();let t=_a(e);e.isPrimary&&e.button===0&&!e.ctrlKey&&t&&la(t)&&(this.po={target:t,excluded:this.yo(t),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:this.wo?.distinctId});return}let t=this.po;t&&(e.pointerId!==t.id||Math.abs(e.clientX-t.x)>5||Math.abs(e.clientY-t.y)>5?this.fo():e.type===`pointerup`&&(t.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){let t=this.po;this.fo();let n=_a(e);if(t?.released&&t.target.isConnected&&t.distinctId===this.wo?.distinctId&&e.pointerId===t.id&&(e.detail>0||e.pointerType===`touch`||e.pointerType===`pen`)&&e.button===0&&5>=Math.abs(e.clientX-t.x)&&5>=Math.abs(e.clientY-t.y)&&n&&(Y(n,`html`)||Y(n,`body`))){if(t.excluded)return null;let e=this.bo().css_selector_ignorelist??Sa;return[n,a?.documentElement,a?.body].some(t=>{if(!t)return!1;let n=ma(t);return x(n,`ph-no-capture`)||x(n,`ph-sensitive`)||!ja(t)||Ma(t)||e.some(e=>ya(t,e))})?null:t.target}}constructor(e){this.So=e,this.name=`autocapture`,this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new rl(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?t.dispose():(this.Po=t,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,(e=this.Po)==null||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){return this.bo(),this.Rr.url_allowlist=this.Rr.url_allowlist?.map(e=>new RegExp(e)),this.Rr.url_ignorelist=this.Rr.url_ignorelist?.map(e=>new RegExp(e)),this.Rr}Ao(){if(!this.isBrowserSupported())return void al.info(`Disabling Automatic Event Collection because this browser is not supported`);if(!n||!a)return;let e=this.Fo=e=>{e||=n?.event;try{if(e.type===`blur`)return void this.fo();if(e.type.indexOf(`pointer`)===0)return void this._o(e);let t=e.type===`click`?this.ko(e):void 0;if(N(t))return;this.Oo(e,`$autocapture`,t)}catch(e){al.error(`Failed to capture event`,e)}};if(G(n,`blur`,e),G(a,`submit`,e,{capture:!0}),G(a,`change`,e,{capture:!0}),G(a,`click`,e,{capture:!0}),U([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],t=>{G(a,t,e,{capture:!0})}),this.bo().capture_copied_text){let e=this.Do=e=>{e||=n?.event;try{this.Oo(e,il)}catch(e){al.error(`Failed to capture clipboard event`,e)}};G(a,`copy`,e,{capture:!0}),G(a,`cut`,e,{capture:!0}),G(a,`paste`,e,{capture:!0})}}Ro(){this.fo(),this.Fo&&=(n?.removeEventListener(`blur`,this.Fo),U([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],e=>{a?.removeEventListener(e,this.Fo,!0)}),a?.removeEventListener(`submit`,this.Fo,!0),a?.removeEventListener(`change`,this.Fo,!0),a?.removeEventListener(`click`,this.Fo,!0),void 0),this.Do&&=(a?.removeEventListener(`copy`,this.Do,!0),a?.removeEventListener(`cut`,this.Do,!0),a?.removeEventListener(`paste`,this.Do,!0),void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();let t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);let n=t.autocapture_opt_out;var r;I(n)&&((r=this.wo)==null||r.kv.set(`$autocapture_disabled_server_side`,n),this.Co=n),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,t){var n;let r=[];return(n=this.Mo)==null||n.forEach(n=>{(a?.querySelectorAll(n))?.forEach(i=>{e!==i&&t!==i||x(r,n)||r.push(n)})}),r}get isEnabled(){if(this.Io)return!1;let e=this.wo?.kv.get(Tr),t=this.Co,n=this.bo();if(!n.remoteRequestsDisabled&&!this.$o)return!1;let r=n.remoteRequestsDisabled&&!this.$o;if(N(t)&&!I(e)&&!r)return!1;let i=this.Co??!!e;return!!n.enabled&&!i}Oo(e,t=`$autocapture`,r){if(!this.isEnabled)return void this.fo();let i=r||_a(e);ua(i)&&(i=i.parentNode||null);let a=this.Eo();var o;t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&a.rageclick&&(o=this.rageclicks)!=null&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||(/* @__PURE__ */ new Date()).getTime())&&Oa(i,a.rageclick)&&this.Oo(e,`$rageclick`,r);let s=t===il,c=s?R(R({},a),{},{dom_event_allowlist:void 0}):a;if(i&&function(e,t,r,i,a,o){if(!n||ka(e)||r?.url_allowlist&&!pa(r.url_allowlist,o)||r?.url_ignorelist&&pa(r.url_ignorelist,o))return!1;if(r?.dom_event_allowlist){let e=r.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}let{parentIsUsefulElement:s,targetElementList:c}=Aa(e,i);if(!function(e,t){let n=t?.element_allowlist;if(A(n))return!0;for(let t of e)if(n.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,r)||!ba(c,r?.css_selector_allowlist)||ba(c,r?.css_selector_ignorelist??Sa))return!1;try{let r=n.getComputedStyle(e);if(r&&r.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0}catch{}let l=e.tagName.toLowerCase();switch(l){case`html`:return!1;case`form`:return(a||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(a||[`change`,`click`]).indexOf(t.type)>=0;default:return s?(a||[`click`]).indexOf(t.type)>=0:(a||[`click`]).indexOf(t.type)>=0&&(va.indexOf(l)>-1||e.getAttribute(`contenteditable`)===`true`)}}(i,e,c,s,s?[`copy`,`cut`,`paste`]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var l;let{props:r,explicitNoCapture:o,target:s}=cl(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(o)return!1;let c=this.getElementSelectors(i,s);if(c&&c.length>0&&(r.$element_selectors=c),t===il){let t=e.type||`clipboard`;if(t!==`paste`){var u;let e=n==null||(u=n.getSelection())==null?void 0:u.toString(),t=ha(e);if(!t)return!1;r.$selected_content=t,r.$clipboard_text_length=e?.length??0}r.$copy_type=t}return(l=this.wo)==null||l.capture(t,r),!0}}isBrowserSupported(){return D(a?.querySelectorAll)}},ul=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,n=O(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=n?.url_allowlist,e.url_ignorelist=n?.url_ignorelist,e.dom_event_allowlist=n?.dom_event_allowlist,e.element_allowlist=n?.element_allowlist,e.css_selector_allowlist=n?.css_selector_allowlist,e.css_selector_ignorelist=n?.css_selector_ignorelist,e.element_attribute_ignorelist=n?.element_attribute_ignorelist,e.capture_copied_text=n?.capture_copied_text}};const dl=B(`[ExceptionAutocapture]`),fl=()=>{},pl=e=>{if(D(e))return e.__posthog_layer__??e.__rrweb_layer__};function ml(e,t,n){try{if(!(t in e))return fl;let r={next:e[t]},i=n(function(...e){return r.next.apply(this,e)});return D(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=i,()=>{if(e[t]===i)return void(e[t]=r.next);let n=e[t],a=pl(n);for(;a;){if(a.next===i)return void(a.next=r.next);n=a.next,a=pl(n)}}}catch{return fl}}const hl=B(`[TracingHeaders]`),gl=B(`[Web Vitals]`),_l=9e5,vl=[`CLS`,`FCP`,`INP`,`LCP`],yl=[`INP`,`LCP`],bl=[`interactionTarget`,`interactionType`,`inputDelay`,`processingDuration`,`presentationDelay`,`loadState`,`target`,`url`,`timeToFirstByte`,`resourceLoadDelay`,`resourceLoadDuration`,`elementRenderDelay`,`largestShiftTarget`,`largestShiftTime`,`largestShiftValue`,`firstByteToFCP`],xl=`disabled`,Sl=`lazy_loading`,Cl=B(`[SessionRecording]`),wl=B(`[Heatmaps]`);function Tl(e){return O(e)&&`clientX`in e&&`clientY`in e&&F(e.clientX)&&F(e.clientY)}const El=B(`[Product Tours]`),Dl=e=>!e.config.disable_product_tours&&!!e.persistence?.get_property(Mr),Ol=[`$set_once`,`$set`],kl=B(`[SiteApps]`),Al=`Error while initializing PostHog app with config id `,jl=(e,t)=>e?.then?e.then(t):t(e),Ml=`SDK is not enabled or survey functionality is not yet loaded`,Nl=`Disabled. Not loading surveys.`;var Pl=class{constructor(e,t){this.So=e,this.Th=t,this.name=`surveys`,this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=/* @__PURE__ */ new Set,this.onRemoteConfig=e=>{if(this.Io||this.Rr.disableSurveys)return;if(!e.ok)return $.warn(`Remote config unavailable. Not loading surveys.`);let t=e.config.surveys;if(P(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.Ah=I(t)?t:t.length>0,$.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,jl(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,n,r;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)==null||e.dispose(),this.Po=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)==null||(r=n.dispose)==null||r.call(n),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(e=>clearTimeout(e)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)==null||(t=e.clearInMemoryInProgressSurveyState)==null||t.call(e);try{var n;(n=this._surveyEventReceiver)==null||n.reset(),localStorage.removeItem(`lastSeenSurveyDate`);let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);(n!=null&&n.startsWith(`seenSurvey_`)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;let e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void $.info(`Already initializing surveys, skipping...`);if(e.disableSurveys)return void $.info(Nl);if(e.cookielessMode&&this.So.isOptedOut())return void $.info(`Not loading surveys in cookieless mode without consent.`);let t=this.So.getExtensions();if(!t)return void $.error(`PostHog Extensions not found.`);if(A(this.Ah)&&!e.advancedEnableSurveys)return;let n=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{let e=t.generateSurveys;if(e)return this.Oh(e,n),void(this.Ih=!1);let r=t.loadExternalDependency;if(!r)return this.Dh(_i),void(this.Ih=!1);r(e=>{try{if(this.Io)return;let t=this.So.getExtensions();e||!t?.generateSurveys?this.Dh(`Could not load surveys script`,e):this.Oh(t.generateSurveys,n)}finally{this.Ih=!1}})}catch(e){throw this.Ih=!1,this.Dh(`Error initializing surveys`,e),e}}Oh(e,t){this.Io||(this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(),$.info(`Surveys loaded successfully`),this.Lh({isLoaded:!0}))}Dh(e,t){$.error(e,t),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(t=>t!==e)}}getSurveys(e,t=!1){let n=this.wo??this.Th;if(!n||this.Io)return;if(this.Rr.disableSurveys)return $.info(Nl),e([]);let r=n.kv.get(Xr);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:t,context:n})=>{this.Io||e(t,n)}).catch(e=>$.error(`Error in survey callback`,e));let i=this.qh(`/api/surveys/`,{method:`GET`,query:{token:n.projectToken},sentAt:`query`,timeoutMs:this.Rr.requestTimeoutMs}).then(e=>{try{return this.jh(n,e)}catch(e){return $.error(`Error processing surveys response`,e),this.jh(n,{statusCode:0,error:e})}},e=>this.jh(n,{statusCode:0,error:e}));this.Eh=i;let a=()=>{this.Eh===i&&(this.Eh=null)};i.then(t=>{a(),this.Io||e(t.surveys,t.context)},a).catch(e=>$.error(`Error in survey callback`,e))}qh(e,t){let n=this.wo;return n?n.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:/* @__PURE__ */ Error(Ml)}))}jh(e,t){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:Ml}};let n=t.statusCode;if(n!==200||!t.json){let e=`Surveys API could not be loaded, status: ${n}`;return n===0?t.error||$.warn(e):$.error(e),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.Ph=null;let r=t.json.surveys||[],i=r.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(vc(e)||function(e){var t;return!!((t=e.conditions)!=null&&(t=t.actions)!=null&&(t=t.values)!=null&&t.length)}(e)));var a;return i.length>0&&((a=this._surveyEventReceiver)==null||a.register(i)),e.kv.set({[Xr]:r,[Zr]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){let e=(this.wo??this.Th)?.kv.get(Zr);return F(e)&&Date.now()-e>3e5}Hh(){return F(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,t){let n={id:e,current_iteration:t?.iteration??null};kc(n);try{localStorage.setItem(`lastSeenSurveyDate`,(/* @__PURE__ */ new Date()).toISOString())}catch{}}Lh(e){for(let t of this.Mh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){$.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t=!1){if(!P(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);$.warn(`init was not called`)}zh(e){let t=null;return this.getSurveys(n=>{t=n.find(t=>t.id===e)??null}),t}Uh(e){if(P(this._surveyManager))return{eligible:!1,reason:Ml};let t=typeof e==`string`?this.zh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:`PostHog is not capturing, so a survey response cannot be recorded`};if(P(this._surveyManager))return{eligible:!1,reason:Ml};let t=typeof e==`string`?this.zh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(P(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:Ml};let t=this.Wh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return P(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:Ml})):new Promise(n=>{this.getSurveys(t=>{let r=t.find(t=>t.id===e)??null;if(r){let e=this.Wh(r);n({visible:e.eligible,disabledReason:e.reason})}else n({visible:!1,disabledReason:`Survey not found`})},t)})}renderSurvey(e,t,n){if(!this.So.isCapturing())return;if(P(this._surveyManager))return void $.warn(`init was not called`);let r=typeof e==`string`?this.zh(e):e;if(!r?.id)return void $.warn(`Survey not found`);if(!Ac.includes(r.type))return void $.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let i=a?.querySelector(t);if(i){if(r.appearance?.surveyPopupDelaySeconds){$.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);let e=setTimeout(()=>{var t;this.Rh.delete(e),!this.Io&&this.So.isCapturing()&&($.info(`Rendering survey ${r.id} with delay of ${r.appearance?.surveyPopupDelaySeconds} seconds`),(t=this._surveyManager)==null||t.renderSurvey(r,i,n),$.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);this.Rh.add(e);return}this._surveyManager.renderSurvey(r,i,n)}else $.warn(`Survey element not found`)}displaySurvey(e,t){var n;if(!this.So.isCapturing())return;if(P(this._surveyManager))return void $.warn(`init was not called`);let r=this.zh(e);if(!r)return void $.warn(`Survey not found`);let i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=R(R({},r),{},{appearance:R(R({},r.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Xo.Popover&&t.initialResponses&&$.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){let e=this.Uh(r);if(!e.eligible)return void $.warn(`Survey is not eligible to be displayed: `,e.reason)}t.displayType===Xo.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}cancelPendingSurvey(e){P(this._surveyManager)?$.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)==null||(t=e.handlePageUnload)==null||t.call(e)}};function Fl(e,t,n){if(P(e))return!1;switch(n){case`exact`:return e===t;case`contains`:{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(n,`i`).test(e)}case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Il=class{constructor(e){this._instance=e,this.Vh=/* @__PURE__ */ new Set,this.Gh=/* @__PURE__ */ new Set,this.Zh=new dc,this.Qh=(e,t)=>this.Jh(e,t)&&this.Kh(e,t)&&this.Xh(e,t)&&this.Yh(e,t),this.Jh=(e,t)=>!t?.event||e?.event===t?.event}init(){A(this._instance?._addCaptureHook)||(this.tc=this._instance?._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;(e=this.tc)==null||e.call(this),this.tc=void 0,this.Zh=new dc}register(e){if(!A(this._instance?._addCaptureHook)&&(e.forEach(e=>{var t;this.Vh.add(e),(t=e.steps)==null||t.forEach(e=>{this.Gh.add(e?.event||``)})}),this._instance?.autocapture)){let e=/* @__PURE__ */ new Set;this.Vh.forEach(t=>{var n;(n=t.steps)==null||n.forEach(t=>{t!=null&&t.selector&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(t.event))&&this.Vh.forEach(e=>{this.ec(t,e)&&this.Zh.emit(`actionCaptured`,e.name)})}nc(e){this.onAction(`actionCaptured`,t=>e(t))}ec(e,t){if(t?.steps==null)return!1;for(let n of t.steps)if(this.Qh(e,n))return!0;return!1}onAction(e,t){return this.Zh.on(e,t)}Kh(e,t){if(t?.url){var n;let r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!Fl(r,t.url,t.url_matching||`contains`))return!1}return!0}Xh(e,t){return!!this.sc(e,t)&&!!this.rc(e,t)&&!!this.oc(e,t)}sc(e,t){var n;if(!t?.href)return!0;let r=this.ac(e);if(r.length>0)return r.some(e=>Fl(e.href,t.href,t.href_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&Fl(function(e){let t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:``}(i),t.href,t.href_matching||`exact`)}rc(e,t){var n;if(!t?.text)return!0;let r=this.ac(e);if(r.length>0)return r.some(e=>Fl(e.text,t.text,t.text_matching||`exact`)||Fl(e.$el_text,t.text,t.text_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&(a=function(e){let t=[],n=/(?::|")text="(.*?)"/g,r;for(;!P(r=n.exec(e));)t.includes(r[1])||t.push(r[1]);return t}(i),o=t.text,s=t.text_matching||`exact`,a.some(e=>Fl(e,o,s)));var a,o,s}oc(e,t){var n,r;if(!t?.selector||(e==null||(n=e.properties)==null?void 0:n.$element_selectors)?.includes(t.selector))return!0;let i=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&i)try{return new RegExp(t.selector_regex).test(i)}catch{return!1}return!1}ac(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Yh(e,t){return!t?.properties||t.properties.length===0||Sc(t.properties.reduce((e,t)=>{let n=E(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e},{}),e?.properties)}},Ll=class{constructor(e){var t,n;this.lc=[],this._instance=e,this.uc=/* @__PURE__ */ new Map,this.hc=/* @__PURE__ */ new Map,this.cc=/* @__PURE__ */ new Map,this.dc=(t=this._instance)==null||(n=t.onSessionId)==null?void 0:n.call(t,e=>this.vc(e))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,t){return!!e&&Sc(e.propertyFilters,t?.properties)}_c(e,t){let n=/* @__PURE__ */ new Map;return e.forEach(e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach(t=>{if(t?.name){let r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}})}),n}wc(e,t,n){let r=(n===Bo.Activation?this.uc:this.hc).get(e),i=[];return this.kc(e=>{i=e.filter(e=>r?.includes(e.id))}),i.filter(r=>{var i;let a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find(t=>t.name===e);return this.bc(a,t)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,t){A(this._instance?._addCaptureHook)||(this.xc(e,t),this.Cc(e,t))}Cc(e,t){let n=e.filter(e=>{var t;return(t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length});var r;if(t&&this.cc.clear(),n.length===0)return void(t&&((r=this.$c)==null||r.replace([])));this.$c||(this.$c=new Il(this._instance),this.$c.init(),this.$c.nc(e=>this.onAction(e)));let i=[];n.forEach(e=>{var t;(t=e.conditions)==null||(t=t.actions)==null||t.values.forEach(t=>{if(i.push(t),t.name){let n=this.cc.get(t.name)??[];n.includes(e.id)||n.push(e.id),this.cc.set(t.name,n)}})}),t?this.$c.replace(i):this.$c.register(i)}Tc(e,t){t.forEach((t,n)=>{let r=e.get(n)??[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(n,r)})}xc(e,t){let n=e.filter(e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0}),r=e.filter(e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}),i=this._c(e,Bo.Activation),a=this._c(e,Bo.Cancellation);t?(this.uc=i,this.hc=a):(this.Tc(this.uc,i),this.Tc(this.hc,a)),(n.length!==0||r.length!==0)&&(this.tc??=this._instance?._addCaptureHook((e,t)=>{this.onEvent(e,t)}))}onEvent(e,t){var n,r;let i=this.Ic(),a=(t==null||(n=t.properties)==null?void 0:n.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){let t=this.Mc(e,a);if(t===`consume`)return i.info(`event consumed activated item, removing it`,{event:e,itemId:a}),void this.Ec([a]);if(t===`persist`)return i.info(`shown item promoted to persisted activation`,{event:e,itemId:a}),this.Pc(a),void this.Rc([a])}if(this.hc.has(e)){let n=this.wc(e,t,Bo.Cancellation);n.length>0&&(i.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:n.map(e=>e.id)}),this.Ec(n.map(e=>e.id)),n.forEach(e=>this.Ac(e.id)))}if(!this.uc.has(e))return;i.info(`event name matched`,{event:e,eventPayload:t,items:this.uc.get(e)});let o=this.wc(e,t,Bo.Activation);this.Fc(o.map(e=>e.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var t,n;if(e.length===0)return;let r=!!((t=this._instance)!=null&&(n=t.get_session_id)!=null&&n.call(t)),i=[];for(let t of e)r&&this.fc(t)?this.Pc(t)&&this.Oc(t):i.push(t);i.length>0&&(this.lc=[.../* @__PURE__ */ new Set([...this.lc,...i])]),this.Ic().info(`updating activated items`,{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(t=>t!==e);let t=this.Dc();return!t.includes(e)&&(this.Lc([...t,e]),this.Nc(),!0)}Ec(e){let t=new Set(e);this.lc=this.lc.filter(e=>!t.has(e));let n=this.qc(),r=n.filter(e=>!t.has(e));r.length!==n.length&&(this.Lc(r),r.length===0&&this.jc()),this.Rc(e)}Bc(){var e;let t=this.gc();if(!t)return{};let n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n&&typeof n==`object`?n:{}}Oc(e){if(!this.gc())return;let t=this.Bc();this.mc(R(R({},t),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;let t=this.Bc(),n={},r=!1;for(let[i,a]of Object.entries(t))e.includes(i)?r=!0:n[i]=a;r&&(k(n)?this.yc():this.mc(n))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;let t=this.Bc()[e];return F(t)?t:void 0}qc(){var e;let t=this.zc();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Dc(){var e,t,n;let r=this.qc();if(r.length===0)return[];let i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Uc()],a=(t=this._instance)==null||(n=t.get_session_id)==null?void 0:n.call(t);return a&&i===a?r:[]}Nc(){var e,t;let n=(e=this._instance)==null||(t=e.get_session_id)==null?void 0:t.call(e);n&&this.Wc(n)}jc(){this.Vc()}vc(e){var t;let n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Uc()];if(n&&n!==e){let e=this.qc(),t=this.Bc();e.length>0&&(this.Lc([]),e.filter(e=>F(t[e])).forEach(e=>this.Ac(e))),this.jc(),this.Hc()}}getActivatedIds(){return[.../* @__PURE__ */ new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,t,n;(e=this.dc)==null||e.call(this),this.dc=void 0,(t=this.tc)==null||t.call(this),this.tc=void 0,(n=this.$c)==null||n.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},Rl=class extends Ll{constructor(e){super(e)}zc(){return Qr}Uc(){return $r}gc(){return ei}mc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(`$surveys_activated_timestamps`)}fc(e){var t;let n;this.kc(t=>{n=t.find(t=>t.id===e)});let r=n==null||(t=n.appearance)==null?void 0:t.surveyPopupDelaySeconds;return F(r)&&r>0}Qc(){return Jo.SHOWN}kc(e){var t;(t=this._instance)==null||t.getSurveys(e)}Ac(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Ic(){return $}Lc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated:e})}Wc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(`$surveys_activated_session`)}Gc(){return!1}Mc(e,t){let n;return this.kc(e=>{n=e.find(e=>e.id===t)}),!n||function(e){var t;return vc(e)&&!!((t=e.conditions)!=null&&(t=t.events)!=null&&t.repeatedActivation)||e.schedule===`always`}(n)?e===Jo.SHOWN?`consume`:`ignore`:e===Jo.SHOWN?`persist`:e===Jo.DISMISSED||e===Jo.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},zl=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e==`string`)return this._instance.get_property(e);let t={};for(let n of e){let e=this._instance.get_property(n);A(e)||(t[n]=e)}return t}set(e,t){this._instance.register(typeof e==`string`?{[e]:t}:e)}remove(e){typeof e==`string`?this._instance.unregister(e):e.forEach(e=>this._instance.unregister(e))}},Bl=class{constructor(e){this._instance=e}get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=m?.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:n?e=>n(this._instance,`surveys`,e):void 0}}createEventReceiver(){return new Rl(this._instance)}};const Vl=n?.location?co(n.location.hash,`__posthog`)||co(location.hash,`state`):null,Hl=`_postHogToolbarParams`,Ul=B(`[Toolbar]`),Wl=B(`[FeatureFlags]`);var Gl=class{constructor(e,t=!1){this.Jc=!1,this.update(e,t)}update(e,t){this.Kc=((e,t)=>({bootstrap:{featureFlags:e.bootstrap?.featureFlags??void 0,featureFlagPayloads:e.bootstrap?.featureFlagPayloads??void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:e.remote_config_refresh_interval_ms??3e5,idleRefreshBackoff:A(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,e.feature_flag_request_max_retries??1),compression:e.disable_compression?void 0:`best-available`,evaluationContexts:e.evaluation_contexts??e.evaluation_environments??[],flagKeys:E(e.flag_keys)?e.flag_keys:void 0}))(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(Wl.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.Jc=!0),A(e.flag_keys)||E(e.flag_keys)||Wl.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.Kc}};const Kl=B(`[FeatureFlags]`),ql=B(`[FeatureFlags]`,{debugEnabled:!0}),Jl=`" failed. Feature flags didn't load in time.`,Yl=[502,504],Xl=[`click`,`keydown`,`wheel`,`touchstart`,`pointerdown`],Zl=`connection_error`,Ql=e=>{let t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},$l=e=>{let t={};for(let[n,r]of Oi(e||{}))r&&(t[n]=r);return t},eu=e=>se(e)&&(e.name===`RangeError`&&e.message.indexOf(`Maximum call stack size exceeded`)===0||e.name===`InternalError`&&e.message===`too much recursion`),tu=B(`[Error tracking]`),nu=`webkit-masked-url:`,ru=[{value:`isolatedAPI.contexts.topHostname`,exact:!1},{value:`No response from target`,exact:!0}],iu=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`,nu],au=[`__firefox__`,`__gCrWeb`],ou=`Refusing to render web experiment since the viewer is a likely bot`,su={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>yc(t,e),not_regex:(e,t)=>!yc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},cu=B(`[Conversations]`),lu=`Conversations not available yet.`;function uu(e,t){let n=e?.flushIntervalMs??3e3,r=e?.maxBufferSize??100,a=t?.consoleCapture?void 0:e?.maxLogsPerInterval??1e3,o=A(a)?Math.max(r,2048):Math.max(r,a),s=R(R({},function(){let e=``,t=``;try{let n=i?.userAgent;n&&([e,t]=ht(n))}catch{}return function(e,t){let n=function(e){if(e)return{}.hasOwnProperty.call(Yn,e)?Yn[e]:e}(e);return R(R({},n?{"os.name":n}:{}),t?{"os.version":t}:{})}(e,t)}()),e?.resourceAttributes);return{serviceName:s?.[`service.name`]??e?.serviceName??t?.serviceNameDefault,serviceVersion:s?.[`service.version`]??e?.serviceVersion,environment:s?.[`deployment.environment`]??e?.environment,resourceAttributes:s,beforeSend:e?.beforeSend,flushIntervalMs:n,maxBufferSize:r,maxQueueSize:o,maxBatchRecordsPerPost:100,rateCapWindowMs:n,maxLogsPerInterval:a,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const du=[`debug`,`log`,`warn`,`error`,`info`],fu=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},pu=`console`,mu=`__posthogHandledLogsRequestError`,hu=(e,t)=>{let n=e instanceof Error?e:Error(t);return n[mu]=!0,n},gu=e=>!!e&&typeof e==`object`&&!0===e[mu],_u=B(`[NetworkMetrics]`),vu=()=>{var e;return n!=null&&(e=n.performance)!=null&&e.now?n.performance.now():Date.now()},yu={"http:":80,"https:":443},bu=/* @__PURE__ */ new Set([`CONNECT`,`DELETE`,`GET`,`HEAD`,`OPTIONS`,`PATCH`,`POST`,`PUT`,`TRACE`]),xu=(e,t)=>{let n=String(t);return{method:String(e).toUpperCase(),url:ao(n)?.href||n}},Su=(e,t,n,r,i,a,o=!1)=>{try{var s;let c=i();if(!c)return;let l=n||void 0,u=vu()-r,d=ao(t.url);if(d&&d.protocol!==`http:`&&d.protocol!==`https:`)return;let f={url:d?.href||t.url,method:t.method},p=D(c.name)?c.name(f):j(c.name)?c.name:`http.client.request.duration`;if(!p)return;let m=o&&!l?void 0:((e,t)=>e?400>e?void 0:String(e):t?.name||`_OTHER`)(l,a),h=R(R(R(R(R({},(e=>{let t=bu.has(e)?e:`_OTHER`;return R({"http.request.method":t},t===`_OTHER`&&e!==t?{"http.request.method_original":e}:{})})(f.method)),d?(e=>{return{"server.address":e.hostname.startsWith(`[`)&&e.hostname.endsWith(`]`)?e.hostname.slice(1,-1):e.hostname,"server.port":Number(e.port)||yu[e.protocol],"url.scheme":e.protocol.slice(0,-1),"url.template":(t=e.pathname,t.split(`/`).map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?`:id`:e).join(`/`))};var t})(d):{}),l?{"http.response.status_code":l}:{}),m?{"error.type":m}:{}),c.attributes?.call(c,f,{status:l,durationMs:u}));(s=e.metrics)==null||s.histogram(p,u,{unit:`ms`,attributes:h})}catch(e){_u.error(`Failed to record network metric`,e)}},Cu=()=>{},wu=(e,t)=>D(n?.fetch)?ml(n,`fetch`,n=>function(...r){let i=vu(),a=n.apply(this,r);if(!t())return a;try{let[n,o]=r,s=xu(o?.method??n?.method??`GET`,n?.url??n);return a.then(n=>(Su(e,s,n?.status,i,t,void 0,!0),n),n=>{throw Su(e,s,void 0,i,t,n),n})}catch(e){return _u.error(`Failed to observe fetch`,e),a}}):Cu,Tu=(e,t)=>{var r;let i=n==null||(r=n.XMLHttpRequest)==null?void 0:r.prototype;if(!i)return Cu;let a=/* @__PURE__ */ new WeakMap,o=ml(i,`open`,e=>function(...t){try{zs.has(this)||a.set(this,xu(t[0],t[1]))}catch(e){_u.error(`Failed to observe XHR open`,e)}return e.apply(this,t)}),s=ml(i,`send`,n=>function(...r){let i;try{let n=a.get(this);if(n&&t()){let r=vu();i=()=>{this.removeEventListener(`loadend`,i),Su(e,n,this.status,r,t)},G(this,`loadend`,i)}}catch(e){_u.error(`Failed to observe XHR send`,e)}try{return n.apply(this,r)}catch(e){throw i&&this.removeEventListener(`loadend`,i),e}});return()=>{o(),s()}},Eu={featureFlags:class{constructor(e){this.name=`featureFlags`,this.Xc=!1,this.featureFlagEventHandlers=[],this.$=Kl,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{let e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{let e=this.pd,t=this.gd??e;A(e)||A(t)||this.Rr.remoteRequestsDisabled||!a||a.visibilityState===`hidden`||Date.now()-(this.md??0)<t||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?e:Math.min(2*t,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{a?.visibilityState===`visible`&&this._d()},`get`in e?this.So=e:(this._instance=e,this.wd=new Gl(e.config,e.nl()),this.So=this.wd)}updateConfig(e,t){var n;(n=this.wd)==null||n.update(e,t),this.wo&&this.kd()}setup(e){return this.Fh=e,this.$=e.logger.createLogger(`[FeatureFlags]`),jl(e.kv.initialize(),()=>{this.Fh===e&&(this.Fh=void 0,this.wo=e,this.Sd(e))})}Sd(e){var t;if(this.wo===e)return n&&G(n,`online`,this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){let e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&a&&!A(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.gd=t),t!==this.pd&&(this.Ed(),A(t)||(this.pd=t,this.gd=t,this.yd(),a!=null&&a.addEventListener&&(G(a,xi,this.ln),Di(Xl,e=>{G(a,e,this.bd,{capture:!0})}))))}yd(){A(this.pd)||(A(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var e;A(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,a==null||(e=a.removeEventListener)==null||e.call(a,`visibilitychange`,this.ln),Di(Xl,e=>{var t;a==null||(t=a.removeEventListener)==null||t.call(a,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,t;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&=(this.Ad(),(e=this.xd)==null||e.dispose(),this.xd=void 0,(t=this.$d)==null||t.call(this),this.$d=void 0,this.ed=[],n?.removeEventListener(`online`,this.an),void 0)}get Rr(){return this.So.get()}Fd(e){return this.Od&&e in this.Od?this.Od[e]:this.wo?.kv.get(e)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){return!A(this.wo?.kv.get(`$enabled_feature_flags`))&&this.Td()}At(e){this.Ld(()=>this.wo?.kv.set(e))}Nd(e,t,n){if(!this._instance?.persistence||!e.$enabled_feature_flags)return;let r=this.Fd(`$enabled_feature_flags`)||{},i=e.$enabled_feature_flags||{},a=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,e])=>!e?.failed).map(([e])=>e):[],s=!!t.errorsWhileComputingFlags&&!!t.flags,c=s?o:n&&!E(a)?Object.keys(a||{}):Array.from(/* @__PURE__ */ new Set([...Object.keys(r),...Object.keys(i)])),l=this.Fd(`$feature_flag_payloads`)||{},u=e.$feature_flag_payloads||{},d=s||n?c:Array.from(/* @__PURE__ */ new Set([...Object.keys(l),...Object.keys(u)])),f=!s&&!n,p=!!f||c,m=!!f||d,h={[zr]:p,[Rr]:p,[Hr]:m};e.$feature_flag_details&&(h[Vr]=p);for(let t of[Ur,ai,Wr])A(e[t])||(h[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(h)}Lt(e){this.Ld(()=>this.wo?.kv.remove(e))}Ld(e){try{e()}catch(e){this.$.error(`Failed to update feature flag persistence`,e)}}Id(){let e={};for(let t of[zr,Hr,Ur,Gr]){let n=this.Fd(t);A(n)||(e[t]=n)}this.Yc=e;let t=R({},e),n=this.Fd(Rr);if(n)for(let[e,r]of Object.entries(n))t[`$feature/${e}`]=r;this.td=t}Cd(){let e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Fd(ai);return typeof t!=`number`||Date.now()-t>e}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}jd(){let e=this.Rr.evaluationContexts;return e?.length?e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t}):[]}Bd(){let e=this.Rr.flagKeys;if(!A(e))return e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid flag key found:`,e,`Expected non-empty string`),t})}initialize(){let e=this.Rr,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){let n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter(e=>!A(t[e])).reduce((e,n)=>(e[n]=t[n],e),{}),i=Object.keys(n).filter(e=>r[e]).reduce((e,t)=>(e[t]=n[t],e),{});return this.Hd({featureFlags:r,featureFlagPayloads:i},void 0,{persist:!1})}}updateFlags(e,t,n){var r,i;let a=n?.merge&&(r=this.Fd(`$enabled_feature_flags`))!=null?r:{},o=n?.merge&&(i=this.Fd(`$feature_flag_payloads`))!=null?i:{},s=R(R({},a),e),c=R(R({},o),t),l={};for(let[e,t]of Object.entries(s))l[e]={key:e,enabled:On(t),variant:kn(t),reason:void 0,metadata:A(c?.[e])?void 0:{id:0,version:void 0,description:void 0,payload:c[e]}};this.Hd({flags:l})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Fd(Vr),t=this.Fd(Gr),n=this.Fd(Kr);if(!n&&!t)return e||{};let r=W({},e||{}),i=[.../* @__PURE__ */ new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(let e of i){var a;let i=r[e],s=t?.[e],c=A(s)?(a=i?.enabled)!=null&&a:!!s,l=A(s)?i?.variant:typeof s==`string`?s:void 0,u=n?.[e],d=R(R({},i),{},{enabled:c,variant:c?l??i?.variant:void 0});var o;c!==i?.enabled&&(d.original_enabled=i?.enabled),l!==i?.variant&&(d.original_variant=i?.variant),u&&(d.metadata=R(R({},i?.metadata),{},{payload:u,original_payload:i==null||(o=i.metadata)==null?void 0:o.payload})),r[e]=d}return this.Xc||=(this.$.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{let r=e[n];return{key:n,enabled:On(r),variant:kn(r),payload:Dn(t[n])}})}getFlagVariants(){let e=this.Fd(Rr),t=this.Fd(Gr);if(!t)return e||{};let n=W({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Xc||=(this.$.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){let e=this.Fd(Hr),t=this.Fd(Kr);if(!t)return e||{};let n=W({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Xc||=(this.$.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||=(this.ed.slice().forEach(e=>{try{e()}catch(e){this.$.error(`Error while running feature flags reloading callback`,e)}}),setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(e){return this.ed.push(e),()=>{this.ed=this.ed.filter(t=>t!==e)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.od=e}resetFlagCallReported(){this.Lt(ni)}Ud(e){this.Ad();let t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);let n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:R(R(R({},t.initialPersonProperties),this.Fd(`$stored_person_properties`)||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fd(Jr),timezone:To()};A(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);let r=this.jd();r.length&&(n.evaluation_contexts=r);let i=this.Bd();A(i)||(n.flag_keys=i);let a=this.Rr.onlyEvaluateSurveyFeatureFlags,o=`/flags/?v=2`+(a?`&only_evaluate_survey_feature_flags=true`:``),s=this.rd;this.sd=!0;let c=()=>{this.ad&&(this.ad=!1,this.Ud())},l=e=>{let t=e.json??{},r=e.statusCode!==200;if(this.sd=!1,s!==this.rd)return void c();if(this.Wd(e.statusCode),r||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!r;let i=[];e.error?i.push(e.error instanceof Error&&e.error.name===`AbortError`?`timeout`:e.error instanceof Error?Zl:`unknown_error`):e.statusCode!==200&&i.push(`api_error_${e.statusCode}`),t.errorsWhileComputingFlags&&i.push(`errors_while_computing_flags`);let o=!!t.quotaLimited?.includes(`feature_flags`);o&&i.push(`quota_limited`),this.At({[ii]:i}),o?this.$.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.`):n.disable_flags||this.Hd(t,r,{partialResponse:a}),c()},u=e=>{this.sd=!1,s===this.rd?(this.At({[ii]:[Zl]}),this.$.error(`Feature flag request failed`,e),this.Dd()&&this.Md(!0),c()):c()},d=this.Rr.requestMaxRetries,f=()=>d>0&&s===this.rd,p=()=>{if(s!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void c();try{t.sendRequest(o,{target:`flags`,method:`POST`,body:n,compression:this.Rr.compression,sentAt:`body`,timeoutMs:this.Rr.requestTimeoutMs}).then(e=>{if((e=>Yl.includes(e.statusCode)||(e=>e.statusCode===0&&e.error instanceof Error&&e.error.name===`AbortError`)(e))(e)&&f())return d--,void setTimeout(p,500);l(e)}).catch(u)}catch(e){u(e)}};p()}vd(){return lo(this.hd,3)}Wd(e){this.hd=uo(e,this.hd,3,()=>this.$.warn(`Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.`))}getFeatureFlag(e,t={}){if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn(`getFeatureFlag for key "`+e+Jl);if(this.qd())return;let n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn(`getFeatureFlagResult for key "`+e+Jl);if(this.qd())return;let n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this.Fd(`$feature_flag_request_id`)||void 0,c=this.Fd(`$feature_flag_evaluated_at`)||void 0,l,u=this.Fd(`$flag_call_reported`)||{};if(this.Rr.deduplicateCallsPerSession){let e=this.wo?.session.sessionId,t=this.Fd(ri);e&&e!==t&&(u={},l=e)}if(t.send_event||!(`send_event`in t)){if(e in u&&u[e].includes(o))l&&this.At({[ni]:u,[ri]:l});else{var d,f,p,m,h,g,_,v;E(u[e])?u[e].push(o):u[e]=[o],this.At(R({[ni]:u},l?{[ri]:l}:{}));let t=this.getFeatureFlagDetails(e),n=[...this.Fd(`$feature_flag_errors`)??[]];A(i)&&n.push(`flag_missing`);let r={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a??null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((d=this.Rr.bootstrap)==null||(d=d.featureFlags)==null?void 0:d[e])??null,$feature_flag_bootstrapped_payload:((f=this.Rr.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])??null,$used_bootstrap_value:!this.ld};A(t==null||(p=t.metadata)==null?void 0:p.has_experiment)||(r.$feature_flag_has_experiment=t.metadata.has_experiment),A(t==null||(m=t.metadata)==null?void 0:m.version)||(r.$feature_flag_version=t.metadata.version);let b=(t==null||(h=t.reason)==null?void 0:h.description)??(t==null||(g=t.reason)==null?void 0:g.code);var y;b&&(r.$feature_flag_reason=b),t!=null&&(_=t.metadata)!=null&&_.id&&(r.$feature_flag_id=t.metadata.id),A(t?.original_variant)&&A(t?.original_enabled)||(r.$feature_flag_original_response=A(t.original_variant)?t.original_enabled:t.original_variant),t!=null&&(v=t.metadata)!=null&&v.original_payload&&(r.$feature_flag_original_payload=t==null||(y=t.metadata)==null?void 0:y.original_payload),n.length&&(r.$feature_flag_error=n.join(`,`)),this.Vd(r)}}else l&&this.At({[ni]:u,[ri]:l});return r?{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:Dn(a)}:void 0}Vd(e){try{var t;(t=this.wo)==null||t.capture(`$feature_flag_called`,e)}catch(e){this.$.error(`Failed to capture feature flag call`,e)}}getRemoteConfigPayload(e,t){this.Gd(e,t)}Gd(e,t){var n=this;return L(function*(){let r=n.wo;if(!r)return;let i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},a=n.jd();a.length&&(i.evaluation_contexts=a);let o=n.Bd(),s;A(o)||(i.flag_keys=o);try{s=(yield r.sendRequest(`/flags/?v=2`,{target:`flags`,method:`POST`,body:i,compression:n.Rr.compression,sentAt:`body`,timeoutMs:n.Rr.requestTimeoutMs})).json?.featureFlagPayloads?.[e]||void 0}catch(e){n.$.error(`Remote config feature flag request failed`,e);return}try{t(s)}catch(e){n.$.error(`Remote config feature flag callback failed`,e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.ld)return t.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn(`isFeatureEnabled for key "`+e+Jl),t.defaultValue;let n=this.getFeatureFlag(e,t);return A(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.Hd(e,t,n)}Hd(e,t,n){if(!this.wo)return;this.nd=!0;let r=((e,t={},n={},r={},i,a=Kl)=>{let o=((e,t)=>{let n=e.flags;if(n){let t=Object.fromEntries(Object.keys(n).map(e=>[e,n[e].variant??n[e].enabled])),r=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>!A(n[e].metadata?.payload)).map(e=>[e,n[e].metadata?.payload]));return R(R({},e),{},{featureFlags:t,featureFlagPayloads:r})}return e.featureFlags&&t.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e})(e,a),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(!c)return;let u=e.requestId,d=e.evaluatedAt;if(E(c)){a.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);let e={};if(c)for(let t=0;c.length>t;t++)e[c[t]]=!0;return{[zr]:c,[Rr]:e,[Wr]:!1}}let f=c,p=l,m=s;if(i?.partialResponse){let e=Object.keys(f),i=p||{};f=R(R({},t),f),p=R(R({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=R(R({},r),m)}else if(e.errorsWhileComputingFlags){if(s){let e=new Set(Object.keys(s).filter(e=>!s[e]?.failed));f=R(R({},t),Object.fromEntries(Object.entries(f).filter(([t])=>e.has(t))));let i=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=R(R({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=R(R({},r),Object.fromEntries(Object.entries(m||{}).filter(([t])=>e.has(t))))}else f=R(R({},t),f),p=R(R({},n),p),m=R(R({},r),m)}return R(R({[zr]:Object.keys($l(f)),[Rr]:f||{},[Hr]:p||{},[Vr]:m||{},[Wr]:!0===e.minimalFlagCalledEvents},u?{[Ur]:u}:{}),d?{[ai]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(r){if(!1===n?.persist){let e=!A(this.wo.kv.get(Rr));this.Od=r,e||this.At(r)}else this.Td(),this.Nd(r,e,!!n?.partialResponse),this.At(r)}else t&&this.Dd();t||(this.ud=!1),this.Md(t)}override(e,t=!1){this.$.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Zd(e)}Zd(e){if(this.wo){if(!1===e)return this.Lt([Gr,Kr]),this.Md(),void ql.info(`All overrides cleared`);if(E(e))return this.At({[Gr]:Ql(e)}),this.Md(),void ql.info(`Flag overrides set`,{flags:e});if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t;let n=e;this.Xc=!!((t=n.suppressWarning)!=null&&t);let r={},i=n.flags,a=n.payloads;i&&(r[Gr]=E(i)?Ql(i):i),a&&(r[Kr]=a),Object.keys(r).length&&this.At(r),!1===i&&!1===a?this.Lt([Gr,Kr]):!1===i?this.Lt(Gr):!1===a&&this.Lt(Kr),this.Md(),!1===i?ql.info(`Flag overrides cleared`):i&&ql.info(`Flag overrides set`,{flags:i}),!1===a?ql.info(`Payload overrides cleared`):a&&ql.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.At({[Gr]:e}),this.Md(),void ql.info(`Flag overrides set`,{flags:e});this.$.warn(`Invalid overrideOptions provided to overrideFeatureFlags`,{overrideOptions:e})}else this.$.warn(`posthog.featureFlags.overrideFeatureFlags called before feature flags were ready`)}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.nd){let{flags:t,flagVariants:n}=this.Qd();try{e(t,n)}catch(e){this.$.error(`Error while running feature flags callback`,e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;let i=(this.Fd(`$early_access_features`)||[]).find(t=>t.flagKey===e),a={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n);let s=R(R({},this.getFlagVariants()),{},{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(a)}),this.At({[zr]:Object.keys($l(s)),[Rr]:s,[qr]:R(R({},this.Fd(`$stored_person_properties`)||{}),a)}),this.Md();try{var c;(c=this.wo)==null||c.capture(`$feature_enrollment_update`,o)}catch(e){this.$.error(`Failed to capture early access feature enrollment`,e)}}getEarlyAccessFeatures(e,t=!1,n){let r=this.Fd(Br);!r||t?this.Jd(e,n):e(r)}Jd(e,t){var n=this;return L(function*(){let r=n.wo;if(!r)return;let i=t?`&${t.map(e=>`stage=${e}`).join(`&`)}`:``,a;try{let e=yield r.sendRequest(`/api/early_access_features/?token=${r.projectToken}${i}`,{target:`api`,method:`GET`,sentAt:`query`});if(!e.json)return;a=e.json.earlyAccessFeatures,n.At({[Br]:a})}catch(e){n.$.error(`Early access feature request failed`,e);return}try{e(a)}catch(e){n.$.error(`Early access feature callback failed`,e)}})()}Qd(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,n)=>(e[n]=t[n],e),{})}}Md(e){this.Id();let{flags:t,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(r=>{try{r(t,n,{errorsLoading:e})}catch(e){this.$.error(`Error while running feature flags callback`,e)}})}setPersonPropertiesForFlags(e,t=!0){this.Kd(e,t)}Kd(e,t=!0){let n=this.Fd(`$stored_person_properties`)||{},r=e?.$set||(e?.$set_once?{}:e),i=e?.$set_once,a={};if(i)for(let e in i)({}).hasOwnProperty.call(i,e)&&(e in n||(a[e]=i[e]));this.At({[qr]:R(R(R({},n),a),r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let n=R({},this.Fd(`$stored_person_properties`)||{});e.forEach(e=>{delete n[e]}),this.At({[qr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(qr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let n=this.Fd(`$stored_group_properties`)||{},r=R({},n);for(let t of Object.keys(e))r[t]=R(R({},n[t]),e[t]);this.At({[Jr]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Fd(`$stored_group_properties`)||{};this.At({[Jr]:R(R({},t),{},{[e]:{}})})}else this.Lt(Jr)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},Du={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){return!!this.Xd?.isStarted}get status(){return this.Yd===`awaiting_config`||this.Yd===`missing_config`?this.Yd:this.Xd?.status??this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=xl,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,t;if(!a?.visibilityState||a.visibilityState===`visible`)return!0;let r=n==null||(e=n.performance)==null||(t=e.getEntriesByType)==null?void 0:t.call(e,`visibility-state`);return!r?.length||r.some(e=>e.name===`visible`)})(),this.ln=()=>{var e,t;a?.visibilityState===`visible`&&(this.Xe=!0,(e=this.Xd)==null||(t=e.setDocumentWasEverVisible)==null||t.call(e,!0))},!this._instance.sessionManager)throw Cl.error(`started without valid sessionManager`),/* @__PURE__ */ Error(`[SessionRecording] started without valid sessionManager. This is a bug.`);if(this.Rr.cookieless_mode===`always`)throw Error(`[SessionRecording] cannot be used with cookieless_mode="always"`);a!=null&&a.addEventListener&&G(a,`visibilitychange`,this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.ev=!0,a==null||(t=a.removeEventListener)==null||t.call(a,`visibilitychange`,this.ln),e?this.iv(!0):this.stopRecording()}get nv(){let e=!!this._instance.get_property(`$session_recording_remote_config`)?.enabled,t=!this.Rr.disable_session_recording,r=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return n&&e&&t&&!r}startIfEnabledOrStop(e){if(this.ev||this.nv&&this.Xd?.isStarted)return;let t=!A(Object.assign)&&!A(Array.from);this.nv&&t?(this.sv(e),Cl.info(`starting`)):(this.Yd=xl,this.stopRecording())}sv(e){var t;if(this.nv){if(this.Yd!==`awaiting_config`&&this.Yd!==`missing_config`&&(this.Yd=Sl),m!=null&&(t=m.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&m.__PosthogExtensions__?.initSessionRecording)this.rv(e);else{var n,r;let t=this._instance.sessionManager;(n=m.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,this.ov,n=>{if(!this.ev&&this.nv&&this._instance.sessionManager===t)return n?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Cl.error(`could not load recorder`,n)):void this.rv(e);this.Yd=`disabled`})}}}stopRecording(){var e,t;(e=this.tv)==null||e.call(this),this.tv=void 0,(t=this.Xd)==null||t.stop()}iv(e=!1){var t,n;(t=this.tv)==null||t.call(this),this.tv=void 0,(n=this.Xd)==null||n.discard({discardProducerEvents:e})}av(){var e,t;(e=this.Ml)==null||e.unregister(`$session_is_sampled`),(t=this.Ml)==null||t.unregister(`$replay_sample_rate`)}lv(e,t){if(P(e))return null;let n=F(e)?e:parseFloat(e);return typeof(r=n)!=`number`||!Number.isFinite(r)||0>r||r>1?(Cl.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var r}uv(e){if(this.Ml){var t;let n=this.Ml,r=()=>{let t=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.lv(this.Rr.session_recording?.sampleRate,`session_recording.sampleRate`),i=this.lv(t?.sampleRate,`remote config sampleRate`),a=r??i;P(a)&&this.av();let o=t?.minimumDurationMilliseconds;n.register({[Fr]:R(R({cache_timestamp:Date.now(),enabled:!!t},t),{},{networkPayloadCapture:R({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:a,minimumDurationMilliseconds:A(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this.tv)==null||t.call(this),this.tv=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;t&&`sessionRecording`in t?!1===t.sessionRecording?(this.uv(t),this.iv()):(this.uv(t),this.startIfEnabledOrStop()):(this.Yd===`awaiting_config`&&(this.Yd=`missing_config`,this._instance.register_for_session({[gi]:!0}),Cl.warn(`config refresh failed, recording will not start until page reload`)),this.startIfEnabledOrStop())}log(e,t=`log`){this.Xd?.log?this.Xd.log(e,t):Cl.warn(`log called before recorder was ready`)}get ov(){var e,t;let n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Fr);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}hv(){let e=this._instance.get_property(Fr);if(!e)return!1;let t;try{t=typeof e==`object`?e:JSON.parse(e)}catch(e){return Cl.warn(`persisted remote config for session recording is invalid and will be ignored`,e),!1}return!P(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}rv(e){var t,n;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!m.__PosthogExtensions__?.initSessionRecording)return Cl.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[hi]:!0});if(this.Xd||(this.Xd=m.__PosthogExtensions__?.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if(this.Yd===`missing_config`||this.Yd===`awaiting_config`)return;this.Yd=`awaiting_config`,Cl.info(`persisted remote config is stale, requesting fresh config before starting`),new is(this._instance).load();return}this.Yd=Sl,(t=(n=this.Xd).setDocumentWasEverVisible)==null||t.call(n,this.Xe),this.Xd.start(e)}else this.Yd=xl}onRRwebEmit(e){var t,n;(t=this.Xd)==null||(n=t.onRRwebEmit)==null||n.call(t,e)}overrideLinkedFlag(){var e,t;this.Xd||(t=this.Ml)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Xd)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Xd||(t=this.Ml)==null||t.register({$replay_override_sampling:!0}),(e=this.Xd)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Xd||(n=this.Ml)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this.Xd)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.Xd?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){return!!this.Xd?.tryAddCustomEvent(e,t)}flushBeforeIdentityReset(){var e,t;(e=this.Xd)==null||(t=e.flushBeforeIdentityReset)==null||t.call(e)}}},Ou={autocapture:class extends ll{constructor(e){super(new ul(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.fv();return!!(e.path||e.search||this.pv(e))}startIfEnabled(){this.isEnabled&&(z.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,z.info(`History API monitoring stopped`)}monitorHistoryChanges(){n&&n.history&&(this.yv(`pushState`),this.yv(`replaceState`),this.bv(),this.pv()&&this._v())}yv(e){if(!n||n.history[e]?.__posthog_wrapped__)return;let t=this;ml(n.history,e,n=>function(r,i,a){n.call(this,r,i,a),t.wv(e)})}vv(){let e=n?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){let e=this._instance.config.capture_pageview;return e===`history_change`?{path:!0}:O(e)?e:{}}pv(e=this.fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Sv(e){let t=this.fv(),n=this.dv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.pv(t)&&e.hash!==n.hash))}wv(e){try{let t=this.vv();if(!t)return;this.Sv(t)&&this._instance.capture(Ci,{navigation_type:e}),this.dv=t}catch(t){z.error(`Error capturing ${e} pageview`,t)}}bv(){if(this.gv)return;let e=()=>{this.wv(`popstate`)};G(n,`popstate`,e),this.gv=()=>{n&&n.removeEventListener(`popstate`,e)}}_v(){if(this.mv)return;let e=()=>{this.wv(`hashchange`)};G(n,`hashchange`,e),this.mv=()=>{n&&n.removeEventListener(`hashchange`,e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(e){this.xv=!1,this.xo=!1,this.Cv=null,this.instance=e,this.xv=!!this.instance.persistence?.props[Er],this.rageclicks=new rl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return O(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return P(this.Rr.capture_heatmaps)?P(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:!1!==this.Rr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.xo)return;wl.info(`starting...`),this.$v(),this.ln()}else clearInterval(this.Cv??void 0),this.Tv(),this.getAndClearBuffer()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`heatmaps`in t))return;let n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Er]:n}),this.xv=n,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Iv(e){Tl(e.originalEvent)&&this.Tr(e.originalEvent,`deadclick`)}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=a?.visibilityState===`visible`?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){n&&a&&(this.Mv=this.bl.bind(this),G(n,Si,this.Mv),this.Ev=e=>this.Tr(e||n?.event),G(a,`click`,this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||n?.event),G(a,`mousemove`,this.Pv,{capture:!0}),this.Av=new Ja(this.instance,Ka,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),G(a,xi,this.Fv),this.xo=!0)}Tv(){var e;n&&a&&(this.Mv&&n.removeEventListener(Si,this.Mv),this.Ev&&a.removeEventListener(`click`,this.Ev,{capture:!0}),this.Pv&&a.removeEventListener(`mousemove`,this.Pv,{capture:!0}),this.Fv&&a.removeEventListener(xi,this.Fv),clearTimeout(this.Ov),(e=this.Av)==null||e.stop(),this.xo=!1)}Dv(e,t){let r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(e,t,r){let i=e;for(;i&&la(i)&&!Y(i,`body`);){if(i===r)return!1;let e;try{e=(i.ownerDocument?.defaultView??n)?.getComputedStyle(i).position}catch{return!1}if(x(t,e))return!0;i=xa(i)}return!1}(_a(e),[`fixed`,`sticky`],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:t}}Tr(e,t=`click`){var n;if(ca(e.target)||!Tl(e))return;let r=this.Dv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,(/* @__PURE__ */ new Date()).getTime())&&Oa(_a(e),this.instance.config.rageclick)&&this.Zs(R(R({},r),{},{type:`rageclick`})),this.Zs(r)}Rv(e){!ca(e.target)&&Tl(e)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(e,`mousemove`))},500))}Zs(e){if(!n)return;let t=this.Rr.disable_capture_url_hashes?kt(n.location.href):n.location.href,r=this.Rr.custom_personal_data_properties,i=this.Rr.mask_personal_data_properties?[...fo,...r||[]]:[],a=so(t,i,mo);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}bl(){this.Rt&&!k(this.Rt)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ja,webVitalsAutocapture:class{constructor(e){this._instance=e,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture(`$web_vitals`,R({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>R(R({},e),{},{[`$web_vitals_${t.name}_event`]:R({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=e=>{if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},P(e?.name)||P(e?.value))return void gl.error(`Invalid metric received`,e);let t=typeof e.navigationURL==`string`?e.navigationURL:void 0,n=this.jv(t);if(A(n))return;let r=F(e.navigationId)||typeof e.navigationId==`string`?`navigation:${e.navigationId}`:`url:${n}`;if(this.Bv&&e.value>=this.Bv)return void gl.error(`Ignoring metric with value >= `+this.Bv,e);this.Rt.navigationKey!==r&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),A(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=n),this.Rt.firstMetricTimestamp=A(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let i=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0),a=R(R(R({},e),t?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete a.entries,O(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let n of bl){let r=n===`url`&&typeof e.attribution[n]==`string`?this.jv(e.attribution[n]):e.attribution[n];A(r)||(t[n]=r)}a.attribution=t}else delete a.attribution;A(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.Rt.metrics.push(a),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let e,t,n,r,i=!1,a=m.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,s=o?.[this.zv]||(this.zv===`web-vitals`&&A(o)?a?.postHogWebVitalsCallbacks:void 0);if(!A(s)){let a=s.withoutAttribution,o=this.attributionMetrics;i=!A(a),e=o.indexOf(`LCP`)>-1?s.onLCP:a?.onLCP||s.onLCP,t=o.indexOf(`CLS`)>-1?s.onCLS:a?.onCLS||s.onCLS,n=o.indexOf(`FCP`)>-1?s.onFCP:a?.onFCP||s.onFCP,r=o.indexOf(`INP`)>-1?s.onINP:a?.onINP||s.onINP}if(!(e&&t&&n&&r))return void gl.error(`web vitals callbacks not loaded - not starting`);let c={reportSoftNavs:this.useSoftNavs},l=i&&this.attributionMetrics.indexOf(`INP`)>-1?R(R({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.qv.bind(this),c),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.qv.bind(this),c),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.qv.bind(this),c),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.qv.bind(this),l),this.xo=!0},this.xv=!!this._instance.persistence?.props[Ar],this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){let e=O(this.Uv)?this.Uv?.web_vitals_allowed_metrics:void 0;return P(e)?this._instance.persistence?.props.$web_vitals_allowed_metrics||vl:e}get flushToCaptureTimeoutMs(){return(O(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=O(this.Uv)?this.Uv.web_vitals_attribution:void 0;return I(e)?e?vl:[]:E(e)?e:yl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=O(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Bv(){let e=O(this.Uv)&&F(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:_l;return e>0&&6e4>=e?_l:e}get isEnabled(){let e=o?.protocol;if(e!==`http:`&&e!==`https:`)return gl.info(`Web Vitals are disabled on non-http/https protocols`),!1;let t=O(this.Uv)?this.Uv.web_vitals:I(this.Uv)?this.Uv:void 0;return I(t)?t:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(gl.info(`enabled, starting...`),this.zo(this.Hv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`capturePerformance`in t))return;let n=O(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=O(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ar]:n}),this._instance.persistence.register({[Pr]:r})),this.xv=n,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?`web-vitals-with-attribution-soft-navs`:`web-vitals-soft-navs`:this.useAttribution?`web-vitals-with-attribution`:`web-vitals`}zo(e){var t;let n=m.__PosthogExtensions__,r=this.zv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[r]||r===`web-vitals`&&A(i)&&n?.postHogWebVitalsCallbacks?e():n==null||(t=n.loadExternalDependency)==null||t.call(n,this._instance,r,t=>{t?gl.error(`failed to load script`,t):e()})}jv(e){let t=e||n?.location.href;if(!t)return void gl.error(`Could not determine current URL`);let r=this._instance.config.disable_capture_url_hashes?kt(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...fo,...i||[]]:[];return so(r,a,mo)}}},ku={exceptionObserver:class{constructor(e){this.Hv=()=>{if(!n||!this.isEnabled||!m.__PosthogExtensions__?.errorWrappingFunctions)return;let e=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=e(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=t(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=r(this.captureException.bind(this)))}catch(e){dl.error(`failed to start`,e),this.Zv()}},this._instance=e,this.Qv=!!this._instance.persistence?.props[Dr],this.wt=new _e(R(R({},function(e={}){return{refillRate:e.exceptionRateLimiterRefillRate??e.__exceptionRateLimiterRefillRate??1,bucketSize:e.exceptionRateLimiterBucketSize??e.__exceptionRateLimiterBucketSize??10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:dl})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return O(e)?t=R(R({},t),e):(A(e)?this.Qv:e)&&(t=R(R({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(dl.info(`enabled`),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(e){var t,n;m.__PosthogExtensions__?.errorWrappingFunctions?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`exception-autocapture`,t=>{if(t)return dl.error(`failed to load script`,t);e()})}Zv(){var e,t,n;(e=this.Wv)==null||e.call(this),this.Wv=void 0,(t=this.Vv)==null||t.call(this),this.Vv=void 0,(n=this.Gv)==null||n.call(this),this.Gv=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;`autocaptureExceptions`in t&&(this.Qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Dr]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(e){try{var t,n;let r=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;if(this.wt.consumeRateLimit(r))return void dl.info(`Skipping exception capture because of client rate limiting.`,{exception:r});(n=this._instance.exceptions)==null||n.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){this.Kv=[],this.Xv=new Vt([new ln,new yn,new dn,new un,new _n,new gn,new pn,new vn],function(e,...t){return(n,r=0)=>{let i=[],a=n.split(` -`),o=Math.min(a.length,r+1e3),s=[];for(let n=r;o>n;n++){let r=a[n];if(r.length>1024)continue;let o=en.test(r)?r.replace(en,`$1`):r;if(!o.match(/\S*Error: /)){for(let n of t){let t=n(o,e);if(t){i.push(t);let e=nn(i);if(e){for(let t=s.length-1;t>=0;t--){let n=s[t];if(e.start>=n.start+n.length)break;s.pop()}s.push(e)}break}}if(sn(i,s)>=50)break}}let c=[...s].sort((e,t)=>t.start-e.start),l=c[c.length-1];if(l){let e=an(i,l);i.splice(l.start-e,e);for(let t of c)t.start-=e}for(let e of c)rn(i,e);return s.some(e=>e.start===0&&i.length===e.length)&&function(e){let t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`),n=0;for(let e=1;t.length>e;e++)cn(t,e,n)&&(n=e);e.push(...e.splice(0,n))}(i),function(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return R(R({},e),{},{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||`?`});var n})}(i)}}(`web:javascript`,Xt,$t)),this._instance=e,this.Kv=this._instance.persistence?.get_property(`$error_tracking_suppression_rules`)??[],this.Yv=wn(this.tf()),this.ef=new Tn(this.Yv)}onConfigChange(){this.Yv=wn(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`errorTracking`in t))return;let n=t.errorTracking?.suppressionRules??[],r=t.errorTracking?.captureExtensionExceptions;this.Kv=n,this._instance.persistence&&this._instance.persistence.register({[Or]:this.Kv,[kr]:r})}get if(){var e;let t=!!this._instance.get_property(kr);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.Xv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Yv.enabled)try{if(!j(e)||e.trim().length===0)return void tu.warn(`Ignoring exception step because message must be a non-empty string`);let{sanitizedProperties:n,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((n,r)=>Sn.has(r)?(t.push(r),n):(n[r]=e[r],n),{}),droppedKeys:t}}(this.nf(t));r.length>0&&tu.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.ef.add(R({[bn]:e,[xn]:(/* @__PURE__ */ new Date()).toISOString()},n))}catch(e){tu.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.sf(t)){if(this.rf(t))return this.af(`Exception dropped: matched a suppression rule`),void tu.info(`Skipping exception capture because a suppression rule matched`);if(!this.if&&this.lf(t))return this.af(`Exception dropped: thrown by a browser extension`),void tu.info(`Skipping exception capture because it was thrown by an extension`);if(!this.if&&this.uf(t))return this.af(`Exception dropped: thrown by an injected browser script`),void tu.info(`Skipping exception capture because it was thrown by an injected browser script`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(t))return this.af(`Exception dropped: thrown by the PostHog SDK`),void tu.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}let n=this.Yv.enabled&&P(e.$exception_steps)?this.cf(e):e,r=function(){let e=globalThis._posthogReleaseId;return typeof e==`string`&&e.length>0?e:void 0}();r&&(n.$release_id=r);try{let e=this._instance.capture(`$exception`,n,{_noTruncate:!0,_batchKey:`exceptionEvent`,fh:!0});return e&&this.ef.clear(),e}catch(e){eu(e)||tu.error(`Failed to capture exception event. Dropping this exception.`,e),this.ef.clear();return}}catch(e){eu(e)||tu.error(`Failed to process exception event. Ignoring this exception.`,e);return}}cf(e){try{let t=this.ef.getAttachable();return t.length===0?e:R(R({},e),{},{$exception_steps:t})}catch(t){return tu.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}af(e){this.Yv.enabled&&this.ef.add({[bn]:e,[xn]:(/* @__PURE__ */ new Date()).toISOString()})}nf(e){return O(e)?R({},e):{}}tf(){return this._instance.config.error_tracking?.exception_steps??{}}rf(e){if(e.length===0)return!1;try{let t=e.reduce((e,{type:t,value:n})=>(j(t)&&t.length>0&&e.$exception_types.push(t),j(n)&&n.length>0&&e.$exception_values.push(n),e),{$exception_types:[],$exception_values:[]});return this.Kv.some(e=>{let n=e.values.map(e=>{let n=xc[e.operator],r=t[e.key];if(!n||!r)return!1;let i=E(e.value)?e.value:[e.value];return i.length>0&&n(i,r)});return e.type===`OR`?n.some(Boolean):n.every(Boolean)})}catch(e){return tu.warn(`Failed to evaluate suppression rules. Capturing the exception.`,e),!1}}lf(e){let t=e.flatMap(e=>e.stacktrace?.frames??[]),n=t.filter(({filename:e})=>!!e&&iu.some(t=>e.startsWith(t)));return n.length!==0&&(!n.every(({filename:e})=>!!e&&e.startsWith(nu))||e.some(({type:e,value:t})=>e===`NoResponse`||j(t)&&ru.some(({value:e,exact:n})=>n?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!t?.startsWith(nu)))}uf(e){return e.some(({value:e})=>j(e)&&au.some(t=>e.includes(t)))}hf(e){if(e.length>0){var t,n;let r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}sf(e){return!P(e)&&E(e)}}},Au=R({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.df=null,this.vf=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(`productTours`in t){var n;if(this.Ml&&this.Ml.register({[Mr]:!!t.productTours}),!Dl(this._instance))return!this.df&&P(this.Ml?.props.ph_product_tours)||El.info(`product tours disabled; stopping and clearing cached tours`),(n=this.df)==null||n.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&Dl(this._instance)&&this.zo(()=>this.ff())}zo(e){var t,n;m.__PosthogExtensions__?.generateProductTours?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`product-tours`,t=>{t?El.error(`Could not load product tours script`,t):e()})}ff(){var e;!this.df&&(e=m.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.df=m.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(E(this.vf)&&!t)return void e(this.vf,{isLoaded:!0});let n=this.Ml;if(n){let r=n.props[ti];if(E(r)&&!t)return this.vf=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=${this._instance.config.token}`),method:`GET`,timestampMode:`query`,callback:t=>{if(!Dl(this._instance))return void e([],{isLoaded:!0});let r=t.statusCode;if(r!==200||!t.json){let n=`Product Tours API could not be loaded, status: ${r}`;r===0?t.error||El.warn(n):El.error(n),e([],{isLoaded:!1,error:n});return}let i=E(t.json.product_tours)?t.json.product_tours:[];this.vf=i,n&&n.register({[ti]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){P(this.df)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.df.getActiveProductTours(e)}showProductTour(e){var t;(t=this.df)==null||t.showTourById(e)}previewTour(e){this.df?this.df.previewTour(e):this.zo(()=>{var t;this.ff(),(t=this.df)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.df)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.df)==null||e.nextStep()}previousStep(){var e;(e=this.df)==null||e.previousStep()}clearCache(){var e;this.vf=null,(e=this.Ml)==null||e.unregister(`ph_product_tours`)}resetTour(e){var t;(t=this.df)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.df)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.df)==null||t.cancelPendingTour(e)}}},Eu),ju={siteApps:class{constructor(e){this._instance=e,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(e,t){if(!t)return;let n=this.globalsForEvent(t);this.gf.push(n),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var e;return(e=m._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.mf.bind(this));this.yf=()=>{e(),this.gf=[],this.yf=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);let t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(let[e,i]of Object.entries(r))t[e]={id:n[e],type:e,properties:i};let{$set_once:i,$set:a}=e;return{event:R(R({},Bn(e,Ol)),{},{properties:R(R(R({},e.properties),a?{$set:R(R({},e.properties?.$set??{}),a)}:{}),i?{$set_once:R(R({},e.properties?.$set_once??{}),i)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}bf(e){let t=e.tagName?.toLowerCase();return t===`style`&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(kl.error(`prepare_external_dependency_stylesheet returned null`),null):t===`script`&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(kl.error(`prepare_external_dependency_script returned null`),null):e}_f(){var e;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let t=a?.defaultView,n=t==null||(e=t.Node)==null?void 0:e.prototype;if(!t||!n)return()=>{};if(this.pf++,this.wf)return this.kf();let r=[],i=this,o=/* @__PURE__ */ new WeakSet,s=(e,t,n)=>{if(!e?.[t])return;let i=e[t];e[t]=n(i),r.push(()=>{e[t]=i})},c=e=>{if(o.has(e))return e;let t=i.bf(e);return t&&o.add(t),t},l=e=>e.map(e=>typeof e==`string`?e:c(e)).filter(e=>!N(e));return s(n,`appendChild`,e=>function(t){let n=c(t);return n?e.call(this,n):t}),s(n,`insertBefore`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):t}),s(n,`replaceChild`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):n}),[t.Element?.prototype,t.Document?.prototype,t.DocumentFragment?.prototype].forEach(e=>{s(e,`append`,e=>function(...t){return e.apply(this,l(t))}),s(e,`prepend`,e=>function(...t){return e.apply(this,l(t))})}),[t.Element?.prototype,t.CharacterData?.prototype,t.DocumentType?.prototype].forEach(e=>{s(e,`before`,e=>function(...t){return e.apply(this,l(t))}),s(e,`after`,e=>function(...t){return e.apply(this,l(t))}),s(e,`replaceWith`,e=>function(...t){let n=l(t);return t.length&&!n.length?void 0:e.apply(this,n)})}),s(t.Element?.prototype,`insertAdjacentElement`,e=>function(t,n){let r=c(n);return r?e.call(this,t,r):null}),this.wf=()=>{r.forEach(e=>e()),this.wf=void 0},this.kf()}kf(){let e=!1;return()=>{var t;e||(e=!0,this.pf--,this.pf===0&&((t=this.wf)==null||t.call(this)))}}Sf(e,t=!0){let n=this._f();try{let r=e(n);return t&&n(),r}catch(e){throw n(),e}}setupSiteApp(e){let t=this.apps[e.id],n=()=>{var n;!t.errored&&this.gf.length&&(kl.info(`Processing ${this.gf.length} events for site app with id ${e.id}`),this.gf.forEach(e=>this.Sf(()=>t.processEvent?.call(t,e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&((n=this.yf)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,kl.info(`Site app with id ${e.id} ${i?`loaded`:`errored`}`),r&&n()};try{let{processEvent:n}=this.Sf(t=>e.init({posthog:this._instance,callback(e){t(),i(e)}}),!1);n&&(t.processEvent=n),r=!0}catch(t){kl.error(Al+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){kl.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}xf(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}Cf(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let n of Object.values(this.apps))try{this.Sf(()=>n.processEvent?.call(n,t))}catch(t){kl.error(`Error while processing event ${e.event} for site app ${n.id}`,t)}}onRemoteConfig(e){var t;if(this.siteAppLoaders?.length)return this.isEnabled?(this.xf(),void this._instance.on(`eventCaptured`,e=>this.Cf(e))):void kl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((t=this.yf)==null||t.call(this),!e.ok)return;let n=e.config;if(n.siteApps?.length){if(this.isEnabled)for(let{id:e,url:t}of n.siteApps){var r,i;m[`__$$ph_site_app_${e}`]=this._instance,(r=m.__PosthogExtensions__)==null||(i=r.loadSiteApp)==null||i.call(r,this._instance,t,t=>{if(t)return kl.error(Al+e,t)})}else kl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}},Mu={tracingHeaders:class{constructor(e){this._instance=e,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{let e=this.Mf();var t,n;e?(A(this.$f)&&(this.$f=(t=m.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.Tf)&&(this.Tf=(n=m.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,n;m.__PosthogExtensions__?.tracingHeadersPatchFns?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`tracing-headers`,t=>{if(t)return hl.error(`failed to load script`,t);e()})}Ef(){return this._instance.config.tracing_headers??this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}Mf(){let e=this.Ef();return E(e)?(E(this.If)?this.If.splice(0,this.If.length,...e):this.If=[...e],e.length>0?this.If:void 0):(E(this.If)&&this.If.splice(0),this.If=e||void 0,this.If)}Zv(){var e,t;(e=this.$f)==null||e.call(this),(t=this.Tf)==null||t.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},Nu=R({surveys:class extends Pl{constructor(e){var t;super(new Bl(e),(t=e,{get projectToken(){return t.config.token},kv:new zl(t)})),this._instance=e}qh(e,t){let n=t.query?Ws(e,t.query):e;return new Promise(e=>{this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(t.target??`api`,n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},Eu),Pu={toolbar:class{constructor(e){this.instance=e}Pf(e){m.ph_toolbar_state=e}Rf(){return m.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,r=void 0){if(Pi(this.instance.config)||!n||!a)return!1;e??=n.location,r??=n.history;try{if(!t){try{n.localStorage.setItem(`test`,`test`),n.localStorage.removeItem(`test`)}catch{return!1}t=n?.localStorage}let i=Vl||co(e.hash,`__posthog`)||co(e.hash,`state`),a,o=i?At(()=>JSON.parse(atob(decodeURIComponent(i))))||At(()=>JSON.parse(decodeURIComponent(i))):null;return o&&o.action===`ph_authorize`?(a=o,a.source=`url`,a&&Object.keys(a).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,``,e.pathname+e.search):e.hash=``)):(a=JSON.parse(t.getItem(Hl)||`{}`),a.source=`localstorage`,delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}Af(e){let t=m.ph_load_toolbar||m.ph_load_editor;!P(t)&&D(t)?t(e,this.instance):Ul.warn(`No toolbar load function found`)}loadToolbar(e){let t=!!a?.getElementById(`__POSTHOG_TOOLBAR__`);if(!n||t)return!1;let r=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,i=R(R({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor(`ui`)},r?{instrument:!1}:{});if(n.localStorage.setItem(Hl,JSON.stringify(R(R({},i),{},{source:void 0}))),this.Rf()===2)this.Af(i);else if(this.Rf()===0){var o,s;this.Pf(1),(o=m.__PosthogExtensions__)==null||(s=o.loadExternalDependency)==null||s.call(o,this.instance,`toolbar`,e=>{if(e)return Ul.error(`[Toolbar] Failed to load`,e),void this.Pf(0);this.Pf(2),this.Af(i)}),G(n,`turbolinks:load`,()=>{this.Pf(0),this.loadToolbar(i)})}return!0}Ff(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},Fu=R({experiments:class e{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Of(`retrieved web experiments from the server`),this.Df=/* @__PURE__ */ new Map,t.forEach(t=>{if(t.feature_flag_key){var n;this.Df&&(e.Of(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(n=this.Df)==null||n.set(t.feature_flag_key,t));let r=this._instance.getFeatureFlag(t.feature_flag_key);j(r)&&t.variants[r]&&this.Lf(t.name,r,t.variants[r].transforms)}else if(t.variants)for(let n in t.variants){let r=t.variants[n];e.Nf(r,this._instance)&&this.Lf(t.name,n,r.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Of(ou);else if(!this.Rr.disable_web_experiments){if(P(this.Df))return this.Df=/* @__PURE__ */ new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Of(`applying feature flags`,t),t.forEach(e=>{if(this.Df&&this.Df?.has(e)){let t=this._instance.getFeatureFlag(e),n=this.Df?.get(e);t&&n!=null&&n.variants[t]&&this.Lf(n.name,t,n.variants[t].transforms)}})}}previewWebExperiment(){let t=e.getWindowLocation();if(t?.search){let n=oo(t?.search,`__experiment_id`),r=oo(t?.search,`__experiment_variant`);n&&r&&(e.Of(`previewing web experiments ${n} && ${r}`),this.getWebExperiments(e=>{this.qf(parseInt(n),r,e)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.Rr.disable_web_experiments&&!n)return e([]);let r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=${this.Rr.token}`),method:`GET`,timestampMode:`query`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}qf(t,n,r){let i=r.filter(e=>e.id===t);i&&i.length>0&&(e.Of(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Lf(i[0].name,n,i[0].variants[n].transforms))}static Nf(t,n){return!P(t.conditions)&&e.jf(t,n)&&e.Bf(t)}static jf(t,n){if(P(t.conditions)||P(t.conditions?.url))return!0;let r=e.getWindowLocation();if(r){let e=sa(n,r.href);return!t.conditions?.url||su[t.conditions?.urlMatchType??`icontains`](t.conditions.url,e)}return!1}static getWindowLocation(){return n?.location}static Bf(e){if(P(e.conditions)||P(e.conditions?.utm))return!0;let t=go();if(t.utm_source){var n,r,i,a,o,s,c,l;let u=!((n=e.conditions)!=null&&(n=n.utm)!=null&&n.utm_campaign)||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=!((i=e.conditions)!=null&&(i=i.utm)!=null&&i.utm_source)||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=!((o=e.conditions)!=null&&(o=o.utm)!=null&&o.utm_medium)||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=!((c=e.conditions)!=null&&(c=c.utm)!=null&&c.utm_term)||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static Of(e,...t){z.info(`[WebExperiments] ${e}`,t)}Lf(t,n,r){this._is_bot()?e.Of(ou):n===`control`?e.Of(`Control variants leave the page unmodified.`):r.forEach(r=>{r.selector&&(e.Of(`applying transform of variant ${n} for experiment ${t} `,r),(document?.querySelectorAll(r.selector))?.forEach(e=>{let t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)}))})}_is_bot(){return i&&this._instance?hc(i,this.Rr.custom_blocked_useragents):void 0}}},Eu),Iu={conversations:class{constructor(e){this._instance=e,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Wf=e.ok,!e.ok))return;let t=e.config.conversations;P(t)||(I(t)?this.Hf=t:(this.Hf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||Pi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=m?.__PosthogExtensions__;if(e&&!A(this.Hf)&&this.Hf){if(this.ne&&this.ne.token){this.zf=!0;try{let t=e.initConversations;if(t)return this.Vf(t),void(this.zf=!1);let n=e.loadExternalDependency;if(!n)return void this.Gf(_i);n(this._instance,`conversations`,t=>{t||!e.initConversations?this.Gf(`Could not load conversations script`,t):this.Vf(e.initConversations),this.zf=!1})}catch(e){this.Gf(`Error initializing conversations`,e),this.zf=!1}}else cu.error(`Conversations enabled but missing token in remote config.`)}}Vf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Uf=!1,cu.info(`Conversations loaded successfully`)}catch(e){this.Gf(`Error completing conversations initialization`,e)}else cu.error(`Cannot complete initialization: remote config is null`)}Gf(e,t){cu.error(e,t),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():cu.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Hf&&!N(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:Pi(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.Wf?`remote_config_failed`:A(this.Hf)?this.Wf?`disabled_in_project`:`remote_config_pending`:this.Hf?P(this.ne)||!this.ne.token?`missing_token`:m?.__PosthogExtensions__?this.zf?`initializing`:this.Uf?`load_failed`:`not_loaded`:`extensions_unavailable`:`disabled_in_project`}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return L(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(cu.warn(lu),null)})()}getMessages(e,t){var n=this;return L(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(cu.warn(lu),null)})()}markAsRead(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(cu.warn(lu),null)})()}getTickets(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(cu.warn(lu),null)})()}requestRestoreLink(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(cu.warn(lu),null)})()}restoreFromToken(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(cu.warn(lu),null)})()}restoreFromUrlToken(){var e=this;return L(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(cu.warn(lu),null)})()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}Sh(){var e;(e=this._conversationsManager)==null||e.setIdentity()}xh(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},Lu={logs:class{constructor(e){var t;this._instance=e,this.name=`logs`,this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=B(`[logs]`),this.Kf=R(R({},this.$),{},{error:(...e)=>{e.some(gu)||this.$.error(...e)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var e,t;this.Io||(this.hd=0,(e=this.rp)==null||e.onReconnect(),(t=this.op)==null||t.onReconnect())},this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Zf=!0),n&&G(n,`online`,this.sp)}ap(e,t,n,r){var i;let a=uu((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new ar(this.lp(e,t),a,this.Kf,()=>this.up(),e=>e(),void 0,r),a]}hp(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;var n;return this.rp&&this.cp===t||((n=this.rp)==null||n.reset(),this.cp=t,[this.rp,this.dp]=this.ap(()=>this.al,e=>{this.al=e})),this.rp}vp(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;var n;return this.op&&this.fp===t||((n=this.op)==null||n.reset(),this.fp=t,[this.op,this.pp]=this.ap(()=>this.Xf,e=>{this.Xf=e},{serviceNameDefault:`posthog-browser-logs`,consoleCapture:!0},pu)),this.op}setup(e){var t;if(this.Io)return;this.wo=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let n=!1,r=e.onRemoteConfig(e=>{n=e.ok&&!0===e.config.logs?.captureConsoleLogs,this.onRemoteConfig(e)});this.Io?r.dispose():(this.Po=r,n||this.loadIfEnabled())}dispose(){var e,t,r,i;this.Io||(this.Io=!0,this.bp(),(e=this.Po)==null||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,n?.removeEventListener(`online`,this.sp),(t=this._p)==null||t.call(this),this._p=void 0,(r=this.rp)==null||r.reset(),(i=this.op)==null||i.reset())}onRemoteConfig(e){var t;if(this.Io)return;let n=e.ok?e.config.logs?.captureConsoleLogs:void 0;P(n)?this.wp():((t=this._instance)==null||(t=t.persistence)==null||t.register({$logs_capture_enabled_server_side:!!n}),n?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var e,t,n,r;this.bp(),(e=this.rp)==null||e.clearQueue(),this.al=[],(t=this.rp)==null||t.reset(),(n=this.op)==null||n.clearQueue(),this.Xf=[],(r=this.op)==null||r.reset(),this.hd=0}captureLog(e){this.Io||this.hp().captureLog(e)}captureConsoleLog(e){this.Io||this.vp().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Io||this.vp().captureLog(e,{context:t,occurredAtMs:n})}mp(){var e;return!!((e=this._instance)!=null&&(e=e.persistence)!=null&&(e=e.props)!=null&&e[Nr])}gp(){var e,t,n;return!((e=this._instance)!=null&&(t=e.nl)!=null&&t.call(e))||!!((n=m._POSTHOG_REMOTE_CONFIG)!=null&&(n=n[this._instance.config.token])!=null&&n.config)}$h(){var e;this.bp(),(e=this.op)==null||e.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var e;if(this.ep||!m?.console)return;let t=uu((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,n=!0;this.tp.push(()=>{n=!1});for(let e of du){let r;try{r=fu(m.console[e])}catch{continue}r&&this.tp.push(ml(m.console,e,i=>{let a=(...r)=>{try{n&&this.kp(e,r,t)}catch{}return i.apply(m.console,r)};return a.__rrweb_original__=r,a}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(e,t,n){if(this.ep&&!this.np&&t.length!==0){if(this._instance?.is_capturing()){if(n>this.Yf.length){this.np=!0;try{this.Yf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&=(clearTimeout(this.Sp),void 0);for(let e of this.tp)e();this.tp=[]}}xp(){let e=this.Yf;return this.bp(),e}get logger(){return this.Cp||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.Cp}flushLogs(e){e?this.$p(e):(this.rp&&this.rp.flush().catch(e=>this.Tp(e)),this.op&&this.op.flush().catch(e=>this.Tp(e)))}Tp(e){gu(e)||this.$.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;let e=m?.__PosthogExtensions__;if(!e)return this.$.error(`PostHog Extensions not found.`),void this.bp();let t=e.loadExternalDependency;if(!t)return this.$.error(_i),void this.bp();this.Jf=!0;try{t(this._instance,`logs`,t=>{if(this.Jf=!1,this.Io||!this.Zf)return;let n=e.logs;if(t||!n?.initializeLogs)this.$.error(`Could not load logs script`,t),this.bp();else{let e=this.xp();var r;this._p=n.initializeLogs(this.wo??this._instance),this.Qf=!0,e.length>0&&((r=n.replayConsoleBuffer)==null||r.call(n,this.wo??this._instance,e))}})}catch(e){throw this.Jf=!1,e}}lp(e,t){let n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:t=>t===_.LogsQueue?e():void 0,setPersistedProperty(e,n){e===_.LogsQueue&&t(n??[])},js:e=>this.js(e),getLibraryId:()=>V.LIB_NAME,getLibraryVersion:()=>V.LIB_VERSION}}js(e){return new Promise(t=>{if(lo(this.hd,3))return void t({kind:`fatal`,error:hu(void 0,`logs endpoint is unreachable, dropping batch`)});let n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout(()=>{this.$.warn(`Logs request timed out before receiving a response`),r({kind:`retry-later`,error:hu(void 0,`logs request timed out`)})},9e4);this._instance._send_request({method:`POST`,url:this.Ip(),data:e,compression:`best-available`,batchKey:`logs`,fireCallbackOnDrop:!0,callback:e=>{let t=e.statusCode;this.Mp(t),t>=200&&300>t?r({kind:`ok`}):t===413?r({kind:`too-large`}):t!==0&&t!==408&&t!==429&&500>t?r({kind:`fatal`,error:/* @__PURE__ */ Error(`logs request failed with status ${t}`)}):t===0?(e.error||this.$.warn(`Logs request failed before receiving an HTTP response`),r({kind:`retry-later`,error:hu(e.error,`logs request failed before receiving an HTTP response`)})):r({kind:`retry-later`,error:e.error??/* @__PURE__ */ Error(`logs request failed with status ${t}`)})}})})}Mp(e){(e!==0||this._instance.__loaded)&&(this.hd=uo(e,this.hd,3,()=>this.$.warn(`Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.`)))}$p(e){this.al.length>0&&this.Ep(e,this.al,this.dp,V.LIB_NAME,e=>{this.al=e}),this.Xf.length>0&&this.Ep(e,this.Xf,this.pp,pu,e=>{this.Xf=e})}Ep(e,t,n,r,i){if(t.length===0)return;let a=t.map(e=>e.record);i([]);let o=tr(a,er(n,V.LIB_NAME,V.LIB_VERSION),r,V.LIB_VERSION);this._instance._send_request({method:`POST`,url:this.Ip(),data:o,compression:`best-available`,batchKey:`logs`,transport:e})}Ip(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token)}up(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:e,windowId:n,sessionStartTimestamp:r,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=n,P(r)||(t.sessionStartTimestamp=r),P(i)||(t.lastActivityTimestamp=i)}if(m!=null&&(e=m.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?kt(m.location.href):m.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},Ru={metrics:class{constructor(e){this._instance=e,this.$=B(`[metrics]`),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){if(this.Io)return;let e=!!this._instance.config.metrics?.network;e&&!this.Pp?this.Pp=(e=>{let t=!0,n=()=>t?(e=>{let t=e.config.metrics?.network;return!0===t?{}:t||void 0})(e):void 0,r=wu(e,n),i=Tu(e,n);return()=>{t=!1,r(),i()}})(this._instance):!e&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;var n;return this.rp&&this.cp===t||((n=this.rp)==null||n.reset(),this.cp=t,this.rp=new lr(this.lp(),function(e){let t=e?.resourceAttributes;return{serviceName:t?.[`service.name`]??e?.serviceName,serviceVersion:t?.[`service.version`]??e?.serviceVersion,environment:t?.[`deployment.environment`]??e?.environment,resourceAttributes:t,beforeSend:e?.beforeSend,flushIntervalMs:e?.flushIntervalMs??1e4,maxSeriesPerFlush:e?.maxSeriesPerFlush??1e3}}(t),this.$)),this.rp}count(e,t=1,n){this.hp().count(e,t,n)}gauge(e,t,n){this.hp().gauge(e,t,n)}histogram(e,t,n){this.hp().histogram(e,t,n)}flush(e){if(!this.rp)return Promise.resolve();if(e){let t=this.rp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.rp.flush().catch(e=>this.$.error(`PostHog metrics flush failed:`,e))}reset(){var e;(e=this.rp)==null||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.Pp)==null||e.call(this),this.Pp=void 0,(t=this.rp)==null||t.reset()}lp(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:e=>t.Ys(e),getLibraryId:()=>V.LIB_NAME,getLibraryVersion:()=>V.LIB_VERSION}}Ys(e,t){return new Promise(n=>{let r=!1,i=e=>{r||(r=!0,clearTimeout(a),n(e))},a=setTimeout(()=>i({kind:`retry-later`,error:/* @__PURE__ */ Error(`metrics request timed out`)}),9e4);this._instance._send_request(R(R({method:`POST`,url:this.Rp(),data:e,compression:`best-available`,batchKey:`metrics`},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){let t=e.statusCode;i(t>=200&&300>t?{kind:`ok`}:t===413?{kind:`too-large`}:t!==0&&t!==408&&t!==429&&500>t?{kind:`fatal`,error:/* @__PURE__ */ Error(`metrics request failed with status ${t}`)}:{kind:`retry-later`,error:e.error??/* @__PURE__ */ Error(`metrics request failed with status ${t}`)})}}))})}Rp(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/metrics`)+`?token=`+encodeURIComponent(this._instance.config.token)}}};nl.__defaultExtensionClasses=R({},R(R(R(R(R(R(R(R(R(R(R(R(R({},Eu),Du),Ou),ku),Au),ju),Nu),Mu),Pu),Fu),Iu),Lu),Ru));const zu=function(){V.SDK_DIST_CHANNEL=`npm`;let e=zc[Xc]=new nl;return function(){function e(){e.done||(e.done=!0,rc=!1,U(zc,function(e){e._dom_loaded()}))}a?.addEventListener?a.readyState===`complete`?e():G(a,`DOMContentLoaded`,e,{capture:!1}):n&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var Bu=zu;export{t};
D dist/components/not-recorded.mjs
@@ -1,1 +0,0 @@ -import{r as e}from"../chunks/rolldown-runtime.mjs";import{n as t}from"../chunks/vendor-react";import{c as n}from"../chunks/ui-base";var r=/* @__PURE__ */ e(t(),1);function i({className:e,...t}){return/* @__PURE__ */ (0,r.jsx)(`div`,{...t,className:n(`ph-no-capture`,e)})}export{i as NotRecorded};
D dist/components/posthog.mjs
@@ -1,1 +0,0 @@ -import{r as e}from"../chunks/rolldown-runtime.mjs";import{a as t}from"../chunks/vendor-react";var n=/* @__PURE__ */ e(t(),1);const r=()=>import(`../chunks/vendor-posthog`).then(e=>e.t);function i(){return{api_host:`/e`,ui_host:`https://eu.posthog.com`,defaults:`2026-08-30`,capture_exceptions:!0,strict_script_versioning:!0,session_recording:{maskCapturedNetworkRequestFn:e=>({...e,name:a(e.name)}),recordHeaders:!1,recordBody:!1},before_send:e=>e&&o(e)}}function a(e){return e.replace(/((?:\/|%2F)invitations(?:\/|%2F))[^/?#&"'\s%]+/gi,`$1:token`)}function o(e){return typeof e==`string`?a(e):Array.isArray(e)?e.map(o):e&&typeof e==`object`&&!(e instanceof Date)?Object.fromEntries(Object.entries(e).map(([e,t])=>[a(e),e===`$snapshot_data`?t:o(t)])):e}let s=!1,c;function l(e){if(s||!r||!e)return;s=!0;let t=r().then(t=>(t.default.init(e,i()),t.default));c=t,t.catch(e=>{c===t&&(s=!1,c=void 0),console.error(`PostHog browser SDK failed to load`,e)})}function u(e){let t=c;t&&t.then(e,()=>void 0)}const d=[];function f(e,t=d){let{actor:r,email:i}=e.impersonatedBy||e;(0,n.useEffect)(()=>{u(e=>{let n=e.get_property(`$user_id`);typeof n==`string`&&n!==r&&e.reset(),e.identify(r,i?{email:i}:void 0);let a=new Set(t.map(e=>e.type));Object.keys(e.getGroups()).some(e=>!a.has(e))&&e.resetGroups();for(let n of t)e.group(n.type,n.key,n.properties)})},[r,i,t])}function p(){u(e=>e.reset())}function m(e){u(t=>t.captureException(e))}export{m as capturePosthogException,l as initPosthog,i as posthogInitOptions,p as resetPosthog,f as usePosthogIdentity};
M dist/components/route-defaults.mjs
@@ -1,1 +1,1 @@ -import{r as e}from"../chunks/rolldown-runtime.mjs";import{a as t,n}from"../chunks/vendor-react";import{i as r}from"../chunks/ui-base";import{Spinner as i}from"./ui/spinner";import{capturePosthogException as a}from"./posthog";import{t as o}from"../chunks/useRouter.mjs";var s=/* @__PURE__ */ e(t(),1),c=/* @__PURE__ */ e(n(),1);function l(){return/* @__PURE__ */ (0,c.jsx)(`div`,{className:`flex min-h-screen items-center justify-center`,children:/* @__PURE__ */ (0,c.jsx)(i,{className:`size-8`})})}function u({action:e}={}){return/* @__PURE__ */ (0,c.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-4 p-4 text-center`,children:[/* @__PURE__ */ (0,c.jsxs)(`div`,{className:`space-y-1`,children:[/* @__PURE__ */ (0,c.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Page not found`}),/* @__PURE__ */ (0,c.jsx)(`p`,{className:`font-readme max-w-md text-sm text-muted-foreground`,children:`The page you're looking for doesn't exist.`})]}),e]})}function d({error:e,title:t=`Something went wrong`,secondaryAction:n}){let i=o(),l=e instanceof Error?e.message:`An unexpected error occurred`;return(0,s.useEffect)(()=>a(e),[e]),/* @__PURE__ */ (0,c.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-4 p-4 text-center`,children:[/* @__PURE__ */ (0,c.jsxs)(`div`,{className:`space-y-1`,children:[/* @__PURE__ */ (0,c.jsx)(`h1`,{className:`text-xl font-semibold`,children:t}),/* @__PURE__ */ (0,c.jsx)(`p`,{"data-type":`error`,className:`font-readme max-w-md text-sm text-muted-foreground`,children:l})]}),/* @__PURE__ */ (0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[/* @__PURE__ */ (0,c.jsx)(r,{size:`sm`,onClick:()=>void i.invalidate(),children:`Try again`}),n]})]})}export{d as DefaultErrorComponent,u as DefaultNotFoundComponent,l as DefaultPendingComponent}; +import{r as e}from"../chunks/rolldown-runtime.mjs";import{n as t}from"../chunks/vendor-react";import{i as n}from"../chunks/ui-base";import{Spinner as r}from"./ui/spinner";import{t as i}from"../chunks/useRouter.mjs";var a=/* @__PURE__ */ e(t(),1);function o(){return/* @__PURE__ */ (0,a.jsx)(`div`,{className:`flex min-h-screen items-center justify-center`,children:/* @__PURE__ */ (0,a.jsx)(r,{className:`size-8`})})}function s({action:e}={}){return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-4 p-4 text-center`,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`space-y-1`,children:[/* @__PURE__ */ (0,a.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Page not found`}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:`font-readme max-w-md text-sm text-muted-foreground`,children:`The page you're looking for doesn't exist.`})]}),e]})}function c({error:e,title:t=`Something went wrong`,secondaryAction:r}){let o=i(),s=e instanceof Error?e.message:`An unexpected error occurred`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center gap-4 p-4 text-center`,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`space-y-1`,children:[/* @__PURE__ */ (0,a.jsx)(`h1`,{className:`text-xl font-semibold`,children:t}),/* @__PURE__ */ (0,a.jsx)(`p`,{"data-type":`error`,className:`font-readme max-w-md text-sm text-muted-foreground`,children:s})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[/* @__PURE__ */ (0,a.jsx)(n,{size:`sm`,onClick:()=>void o.invalidate(),children:`Try again`}),r]})]})}export{c as DefaultErrorComponent,s as DefaultNotFoundComponent,o as DefaultPendingComponent};
M files.json
@@ -11,7 +11,7 @@ "dist/chunks/agent-shell.mjs": "sha256-HNkyOR+5jCEur0rveeoilaoWpC2EHB0Rm6p5qTiEjAc=", "dist/chunks/agent-strip.mjs": "sha256-3CvrUvpFPAFcJzikoWKGhqCRXC1JQvvkL+oG5xJElDw=", "dist/chunks/agent-summary.mjs": "sha256-0x/Q8DCkftHRkKFz6lwjGPg8lj6M6byO4LRO1emPXsA=", - "dist/chunks/app-shell.mjs": "sha256-MLlsavr8hY7mBr4TTgdeSTyNgTsD6QGVYUojNbJLQFI=", + "dist/chunks/app-shell.mjs": "sha256-j3l+WWA5TV6oxOiqLrRfkGpg9VGSrfLVnDP/4XRarLY=", "dist/chunks/call-presence.mjs": "sha256-XmrhmIrjlspj3c4q4Qj/rMC10YeOeT/rY00MwMTdE6c=", "dist/chunks/call-share.mjs": "sha256-Du0Lh+D/NAQhbSHDYj6rZ0QxPK3DXmWcgaI3LKsNpl8=", "dist/chunks/code-block.client.mjs": "sha256-UpTLhQdxF1EmySCnGO0O7ZQJf3pBn1CvKA/ujDw/eUE=", @@ -62,7 +62,6 @@ "dist/chunks/vendor-codemirror.mjs": "sha256-Ikp4igrFK2FTkvs6bvPk6ux0bI7jyAl6+ppCYQ9PFMU=", "dist/chunks/vendor-db.mjs": "sha256-+lh/bbQoiYMKStAWvwehzncZgwdYpYCJqst9MlGix3I=", "dist/chunks/vendor-icons.mjs": "sha256-1OD2iMhfMs6rdnU3BRPggnvTG7hnOaY0wUmByZ6kGM4=", - "dist/chunks/vendor-posthog.mjs": "sha256-g8D/ONH9z3fLcEPCKlg+aRcexVxrRNTAg4T2rk6BzwU=", "dist/chunks/vendor-prettier.mjs": "sha256-GRbltWXsLieImeYCu5l+XiZiDwEvYvj/PauWvB298Hk=", "dist/chunks/vendor-query.mjs": "sha256-9AY2Yn52YMxO4Vs1Qnd2JVhdkG5Pzc9On5OlQD+3MXc=", "dist/chunks/vendor-react.mjs": "sha256-fSze/9NVKEhDOxe4sRPK3IK/19mJVz8fJrA1vDvd8ec=", @@ -118,12 +117,10 @@ "dist/components/log-in-with-iterate.mjs": "sha256-XpwtHxck1/o9MDzYH7Wr1HBGgm75ucM3eLMdpEGC2s8=", "dist/components/mcp-connect.mjs": "sha256-1T/0j6RXrVsPKgUoNFyLlEI+I4CUhsdetKSvwe5ylxk=", "dist/components/mind-app-shell.mjs": "sha256-hrYw+EcFbhINJOTZJljM6eaFOckXeJHHIznZnAVPRGQ=", - "dist/components/not-recorded.mjs": "sha256-GZe0I0F+/OPtevtipdCh3kDce+WnX4dsVV09HHaKOEg=", "dist/components/page-tools.mjs": "sha256-fEth7zX58Fh9IqE/MJLycj1jEFf0IfFJN7thTY3DnLo=", - "dist/components/posthog.mjs": "sha256-kY5DQB8Yn8gEV+IoS662pqSEOJKfvo5P8PTtHtEgEpQ=", "dist/components/reconnecting-mark.mjs": "sha256-Fh3cbCS4KyIzYwq1eqrR5GapvGiP8PBXfN9v0SN7wo4=", "dist/components/repo-ide/repo-ide.mjs": "sha256-usZKMlHkf2nUMhrFLg2wYTbS973ZGCmBlyTz8RKu6J0=", - "dist/components/route-defaults.mjs": "sha256-0U0HzYVKt5HRBu/r1nu9kuZSR4zyeDUUXkl+ZJYOlEs=", + "dist/components/route-defaults.mjs": "sha256-rzQtBMUxwnDhhrCeCk6cqB0m56i7WJjAj0dyPqTYGVk=", "dist/components/secrets-page.mjs": "sha256-Sjc3t62h0GyXblDLX38YMxg6bYdq4A8uw7kABMLiCQM=", "dist/components/setup-steps.mjs": "sha256-yoVPX4vhBP6bV6cyrmVJWaPe7kkPUrovO3r9ELfxslo=", "dist/components/standalone-page.mjs": "sha256-iKl3Q0c2cEIz00VnewPy1Rr1GX746hBpFPcqqxWjDX4=",
M package.json
@@ -63,9 +63,7 @@ "./components/log-in-with-iterate": "./dist/components/log-in-with-iterate.mjs", "./components/mcp-connect": "./dist/components/mcp-connect.mjs", "./components/mind-app-shell": "./dist/components/mind-app-shell.mjs", - "./components/not-recorded": "./dist/components/not-recorded.mjs", "./components/page-tools": "./dist/components/page-tools.mjs", - "./components/posthog": "./dist/components/posthog.mjs", "./components/reconnecting-mark": "./dist/components/reconnecting-mark.mjs", "./components/repo-ide/repo-ide": "./dist/components/repo-ide/repo-ide.mjs", "./components/route-defaults": "./dist/components/route-defaults.mjs", @@ -134,7 +132,6 @@ "./chunks/vendor-db": "./dist/chunks/vendor-db.mjs", "./chunks/vendor-yjs": "./dist/chunks/vendor-yjs.mjs", "./chunks/vendor-atomic": "./dist/chunks/vendor-atomic.mjs", - "./chunks/vendor-posthog": "./dist/chunks/vendor-posthog.mjs", "./chunks/vendor-prettier": "./dist/chunks/vendor-prettier.mjs", "./chunks/vendor-icons": "./dist/chunks/vendor-icons.mjs", "./chunks/ui-base": "./dist/chunks/ui-base.mjs",
M release.json
@@ -1,7 +1,7 @@ { "package": "@iterate-com/ui", - "source": "203f7da6d0f81d840c6d78b2681d26bb3f13c6ff", - "workspace": "262a86d8745055d818c58c448ca226b407e0fc2a", - "modules": 189, - "rewritten": 529 + "source": "b22794d07c154c8c27875d3fe8c4eb4c948d469b", + "workspace": "fd6fe9d2f647d32bd610e1a3564d5e79167b576e", + "modules": 186, + "rewritten": 523 }