@hyperdrive.bot/fleet-server 0.3.142 → 0.3.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -849,7 +849,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v
849
849
  __d(function(g,r,i,a,m,e,d){"use strict";var t=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.shouldAppendSitemap=u,e.shouldAppendNotFound=s,e.getRootStackRouteNames=function(){const t=[n.INTERNAL_SLOT_NAME];s()&&t.push(n.NOT_FOUND_ROUTE_NAME);u()&&t.push(n.SITEMAP_ROUTE_NAME);return t};const o=t(r(d[0])),n=r(d[1]);function u(){const t=o.default.expoConfig?.extra?.router;return!1!==t?.sitemap}function s(){const t=o.default.expoConfig?.extra?.router;return!1!==t?.notFound}},717,[718,721]);
850
850
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"AppOwnership",{enumerable:!0,get:function(){return l.AppOwnership}}),Object.defineProperty(_e,"ExecutionEnvironment",{enumerable:!0,get:function(){return l.ExecutionEnvironment}}),Object.defineProperty(_e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return l.UserInterfaceIdiom}});var n=e(r(d[0])),t=r(d[1]);r(d[2]);var u=e(r(d[3])),l=r(d[4]),o=e(r(d[5]));o.default||console.warn("No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?");const s=(0,t.requireOptionalNativeModule)('ExpoUpdates');let f=null;if(s){let e;s.manifest?e=s.manifest:s.manifestString&&(e=JSON.parse(s.manifestString)),e&&Object.keys(e).length>0&&(f=e)}let c=null;if(u.default.EXDevLauncher){let e;u.default.EXDevLauncher.manifestString&&(e=JSON.parse(u.default.EXDevLauncher.manifestString)),e&&Object.keys(e).length>0&&(c=e)}let p=null;if(o.default&&o.default.manifest){const e=o.default.manifest;p='string'==typeof e?JSON.parse(e):e}let b=f??c??p;const E=o.default||{},{appOwnership:O}=E,x=(0,n.default)(E,["name","appOwnership"]),v=Object.assign({},x,{appOwnership:O??null});function _(e){return!h(e)}function h(e){return'metadata'in e}function S(e=!1){if(!b){const e=null===b?'null':'undefined';if(x.executionEnvironment,l.ExecutionEnvironment.Bare,x.executionEnvironment===l.ExecutionEnvironment.StoreClient||x.executionEnvironment===l.ExecutionEnvironment.Standalone)throw new t.CodedError('ERR_CONSTANTS_MANIFEST_UNAVAILABLE',`Constants.manifest is ${e}, must be an object.`)}return b}Object.defineProperties(v,{__unsafeNoWarnManifest:{get(){const e=S(!0);return e&&_(e)?e:null},enumerable:!1},__unsafeNoWarnManifest2:{get(){const e=S(!0);return e&&h(e)?e:null},enumerable:!1},manifest:{get(){const e=S();return e&&_(e)?e:null},enumerable:!0},manifest2:{get(){const e=S();return e&&h(e)?e:null},enumerable:!0},expoConfig:{get(){const e=S(!0);return e?s&&s.isEmbeddedLaunch?p:h(e)?e.extra?.expoClient??null:_(e)?e:null:null},enumerable:!0},expoGoConfig:{get(){const e=S(!0);return e?h(e)?e.extra?.expoGo??null:_(e)?e:null:null},enumerable:!0},easConfig:{get(){const e=S(!0);return e?h(e)?e.extra?.eas??null:_(e)?e:null:null},enumerable:!0},__rawManifest_TEST:{get:()=>b,set(e){b=e},enumerable:!1}});var N=v},718,[35,4,25,637,719,720]);
851
851
  __d(function(g,r,i,a,m,e,d){"use strict";var t,n,o;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AppOwnership",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ExecutionEnvironment",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return o}}),(function(t){t.Expo="expo"})(t||(t={})),(function(t){t.Bare="bare",t.Standalone="standalone",t.StoreClient="storeClient"})(n||(n={})),(function(t){t.Handset="handset",t.Tablet="tablet",t.Desktop="desktop",t.TV="tv",t.Unsupported="unsupported"})(o||(o={}))},719,[]);
852
- __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"Paseo\",\"slug\":\"paseo-hyperdrive\",\"version\":\"0.3.142\",\"orientation\":\"portrait\",\"icon\":\"./assets/images/icon.png\",\"scheme\":\"paseo\",\"userInterfaceStyle\":\"automatic\",\"newArchEnabled\":true,\"web\":{\"output\":\"single\",\"favicon\":\"./assets/images/favicon.png\",\"shortName\":\"Paseo\",\"orientation\":\"portrait\",\"name\":\"Paseo\"},\"autolinking\":{\"searchPaths\":[\"../../node_modules\",\"./node_modules\"]},\"experiments\":{\"typedRoutes\":true,\"reactCompiler\":true,\"autolinkingModuleResolution\":true},\"extra\":{\"router\":{},\"eas\":{\"build\":{\"experimental\":{\"ios\":{\"appExtensions\":[{\"bundleIdentifier\":\"bot.hyperdrive.paseo.AgentActivity\",\"targetName\":\"AgentActivity\"}]}}}}},\"sdkVersion\":\"54.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"]}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},720,[719]);
852
+ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"Paseo\",\"slug\":\"paseo-hyperdrive\",\"version\":\"0.3.144\",\"orientation\":\"portrait\",\"icon\":\"./assets/images/icon.png\",\"scheme\":\"paseo\",\"userInterfaceStyle\":\"automatic\",\"newArchEnabled\":true,\"web\":{\"output\":\"single\",\"favicon\":\"./assets/images/favicon.png\",\"shortName\":\"Paseo\",\"orientation\":\"portrait\",\"name\":\"Paseo\"},\"autolinking\":{\"searchPaths\":[\"../../node_modules\",\"./node_modules\"]},\"experiments\":{\"typedRoutes\":true,\"reactCompiler\":true,\"autolinkingModuleResolution\":true},\"extra\":{\"router\":{},\"eas\":{\"build\":{\"experimental\":{\"ios\":{\"appExtensions\":[{\"bundleIdentifier\":\"bot.hyperdrive.paseo.AgentActivity\",\"targetName\":\"AgentActivity\"}]}}}}},\"sdkVersion\":\"54.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"]}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},720,[719]);
853
853
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SITEMAP_ROUTE_NAME=e.NOT_FOUND_ROUTE_NAME=e.INTERNAL_SLOT_NAME=void 0,e.INTERNAL_SLOT_NAME='__root',e.NOT_FOUND_ROUTE_NAME='+not-found',e.SITEMAP_ROUTE_NAME='_sitemap'},721,[]);
854
854
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveHref=void 0,e.resolveHrefStringWithSegments=function(t,{segments:n=[],params:s={}}={},{relativeToDirectory:o}={}){if(t.startsWith('.')){let c=n?.map(t=>{if(!t.startsWith('['))return t;if(t.startsWith('[...')){t=t.slice(4,-1);const n=s[t];return Array.isArray(n)?n.join('/'):n?.split(',')?.join('/')??''}return t=t.slice(1,-1),s[t]}).filter(Boolean).join('/')??'/';o&&(c=`${c}/`);const f=new URL(t,`http://hostname/${c}`);t=`${f.pathname}${f.search}`}return t};function t(t,s){for(const[o,c=""]of Object.entries(s)){const f=`[${o}]`,l=`[...${o}]`;if(t.includes(f))t=t.replace(f,n(c));else{if(!t.includes(l))continue;t=t.replace(l,n(c))}delete s[o]}return{pathname:t,params:s}}function n(t){return Array.isArray(t)?t.map(t=>n(t)).join('/'):encodeURIComponent(t.toString())}function s(t){return Object.entries(t).filter(([,t])=>null!=t).map(([t,n])=>`${t}=${encodeURIComponent(n.toString())}`).join('&')}e.resolveHref=n=>{if('string'==typeof n)return(0,e.resolveHref)({pathname:n});const o=n.pathname??'';if(!n?.params)return o;const{pathname:c,params:f}=t(o,Object.assign({},n.params)),l=s(f);return c+(l?`?${l}`:'')}},722,[]);
855
855
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isRoutePreloadedInStack=function(t,o){if(!t||'stack'!==t.type)return!1;return t.preloadedRoutes.some(t=>t.key===o.key)}},723,[]);
@@ -15057,7 +15057,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
15057
15057
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"decodeOfferFragmentPayload",{enumerable:!0,get:function(){return n.decodeOfferFragmentPayload}}),Object.defineProperty(e,"buildDaemonWebSocketUrl",{enumerable:!0,get:function(){return t.buildDaemonWebSocketUrl}}),Object.defineProperty(e,"deriveLabelFromEndpoint",{enumerable:!0,get:function(){return t.deriveLabelFromEndpoint}}),Object.defineProperty(e,"extractHostPortFromWebSocketUrl",{enumerable:!0,get:function(){return t.extractHostPortFromWebSocketUrl}}),Object.defineProperty(e,"normalizeHostPort",{enumerable:!0,get:function(){return t.normalizeHostPort}}),Object.defineProperty(e,"parseConnectionUri",{enumerable:!0,get:function(){return t.parseConnectionUri}}),Object.defineProperty(e,"parseHostPort",{enumerable:!0,get:function(){return t.parseHostPort}}),Object.defineProperty(e,"serializeConnectionUri",{enumerable:!0,get:function(){return t.serializeConnectionUri}}),Object.defineProperty(e,"serializeConnectionUriForStorage",{enumerable:!0,get:function(){return t.serializeConnectionUriForStorage}}),Object.defineProperty(e,"shouldUseTlsForDefaultHostedRelay",{enumerable:!0,get:function(){return t.shouldUseTlsForDefaultHostedRelay}}),e.buildRelayWebSocketUrl=function(n){return(0,t.buildRelayWebSocketUrl)(Object.assign({},n,{role:"client"}))};var t=r(d[0]),n=r(d[1])},3412,[3392,3413]);
15058
15058
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ConnectionOfferV2Schema",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ConnectionOfferSchema",{enumerable:!0,get:function(){return o}}),e.decodeOfferFragmentPayload=l,e.parseConnectionOfferFromUrl=function(n){const t=f(n);if(!t)return null;const c=l(t);return o.parse(c)};var n=r(d[0]);const t=n.z.object({v:n.z.literal(2),serverId:n.z.string().min(1),daemonPublicKeyB64:n.z.string().min(1),relay:n.z.object({endpoint:n.z.string().min(1),useTls:n.z.boolean().optional()})}),o=t;function c(n){const t=n.replace(/-/g,"+").replace(/_/g,"/"),o=t.padEnd(t.length+(4-t.length%4)%4,"="),c=globalThis.atob(o),l=Uint8Array.from(c,n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!0}).decode(l)}function l(n){const t=c(n);return JSON.parse(t)}const u="#offer=";function f(n){const t=n.trim();if(!t)return null;const o=t.indexOf(u);if(-1===o)return null;const c=t.slice(o+u.length).trim();return c.length>0?c:null}},3413,[3285]);
15059
15059
  __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.resolveAppVersion=function(){const e=u(t.default?.version);if(e)return e;const o=u(n.default.expoConfig?.version);if(o)return o;const f=u(n.default.manifest?.version);if(f)return f;return null};var n=e(r(d[0])),t=e(r(d[1]));function u(e){if("string"!=typeof e)return null;const n=e.trim();return 0===n.length?null:n}},3414,[718,3415]);
15060
- __d(function(e,t,r,a,o,i,n){o.exports={name:"@hyperdrive.bot/fleet-app",version:"0.3.142",private:!0,main:"index.ts",scripts:{start:"npm run start:expo","start:expo":"cross-env APP_VARIANT=development expo start","reset-project":"node ./scripts/reset-project.js","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","eas-build-post-install":"npm --prefix ../.. run build:app-deps && npm run build:terminal-webview",android:"npm run android:development","android:development":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=development expo run:android --variant=debug","android:production":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=production expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=production expo run:android --variant=release","android:release":"npm run android:production","android:clear":"node -e \"require('node:fs').rmSync('android', { recursive: true, force: true })\"",ios:"npm --prefix ../.. run build:client && expo run:ios","ios:release":"npm --prefix ../.. run build:client && expo run:ios --configuration Release",web:"npm --prefix ../.. run build:client && concurrently --kill-others --names protocol,client,expo --prefix-colors yellow,blue,magenta \"npm --prefix ../.. run watch:protocol\" \"npm --prefix ../.. run watch:client\" \"npm run web:expo\"","web:expo":"expo start --web",lint:"expo lint",typecheck:"tsgo --noEmit",test:"vitest run","test:browser":"vitest run --project browser","test:e2e":"playwright test --project='Desktop Chrome'","test:e2e:reels":"cross-env NODE_ENV=development playwright test --config playwright.reels.config.ts","test:e2e:real":"cross-env E2E_FORK_PASEO_HOME_FROM=../../.dev/paseo-home playwright test --project=real-provider","test:e2e:ui":"playwright test --ui","test:coverage":"vitest run --project unit --coverage",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web --source-maps","profile:workspace-tabs":"node ./scripts/profile-workspace-tabs.mjs","deploy:web":"npm run build:web && wrangler pages deploy dist --project-name paseo-app --branch main"},dependencies:{"@bacons/apple-targets":"4.0.6","@datadog/browser-rum":"^6.23.0","@datadog/browser-rum-react":"^6.23.0","@datadog/mobile-react-native":"^2.7.0","@datadog/mobile-react-native-session-replay":"^2.14.8","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@expo/image-utils":"0.8.8","@expo/plist":"0.4.9","@expo/prebuild-config":"54.0.8","@floating-ui/react-native":"^0.10.7","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@hyperdrive.bot/fleet-client":"*","@hyperdrive.bot/fleet-expo-two-way-audio":"*","@hyperdrive.bot/fleet-extension-sdk":"*","@hyperdrive.bot/fleet-highlight":"*","@react-native-async-storage/async-storage":"2.2.0","@react-native-masked-view/masked-view":"^0.3.2","@react-native/normalize-colors":"^0.81.5","@react-navigation/native":"^7.1.8","@sentry/electron":"^6.11.0","@sentry/react-native":"^6.20.0","@tanstack/react-query":"^5.90.11","@tanstack/react-virtual":"^3.13.21","@xterm/addon-clipboard":"^0.3.0-beta.213","@xterm/addon-fit":"^0.12.0-beta.213","@xterm/addon-image":"^0.10.0-beta.213","@xterm/addon-ligatures":"0.11.0-beta.213","@xterm/addon-search":"^0.17.0-beta.213","@xterm/addon-unicode11":"^0.10.0-beta.213","@xterm/addon-web-links":"^0.13.0-beta.213","@xterm/addon-webgl":"^0.20.0-beta.212","@xterm/xterm":"^6.1.0-beta.213",buffer:"^6.0.3",expo:"^54.0.18","expo-asset":"~12.0.12","expo-audio":"~1.0.13","expo-background-fetch":"~14.0.9","expo-build-properties":"^1.0.9","expo-camera":"~17.0.10","expo-clipboard":"~8.0.7","expo-constants":"~18.0.9","expo-crypto":"^15.0.8","expo-dev-client":"^6.0.15","expo-document-picker":"~14.0.8","expo-file-system":"~19.0.17","expo-haptics":"~15.0.7","expo-image":"~3.0.10","expo-image-manipulator":"~14.0.8","expo-image-picker":"^17.0.8","expo-keep-awake":"^15.0.7","expo-linking":"~8.0.8","expo-localization":"~17.0.9","expo-notifications":"^0.32.16","expo-router":"~6.0.13","expo-sharing":"^14.0.8","expo-speech":"~14.0.8","expo-speech-recognition":"^56.0.1","expo-splash-screen":"~31.0.10","expo-system-ui":"~6.0.7","expo-task-manager":"~14.0.9","expo-video":"~3.0.16","fast-deep-equal":"^3.1.3",htmlparser2:"^12.0.0",i18next:"^26.3.0","lucide-react-native":"^0.546.0","markdown-it":"^10.0.0","mnemonic-id":"^3.2.7","posthog-js":"^1.431.2",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-i18next":"^17.0.8","react-native":"0.81.5","react-native-draggable-flatlist":"^4.0.3","react-native-edge-to-edge":"^1.7.0","react-native-gesture-handler":"~2.28.0","react-native-keyboard-controller":"^1.21.7","react-native-markdown-display":"^7.0.2","react-native-nitro-modules":"0.35.5","react-native-reanimated":"~4.3.1","react-native-safe-area-context":"~5.6.0","react-native-screens":"~4.16.0","react-native-svg":"^15.14.0","react-native-uitextview":"^2.2.0","react-native-unistyles":"^3.2.4","react-native-web":"~0.21.0","react-native-webview":"^13.16.0","react-native-worklets":"~0.8.3","tiny-invariant":"^1.3.3","use-sync-external-store":"^1.6.0",zod:"^4.4.3",zustand:"^5.0.9"},devDependencies:{"@playwright/test":"^1.56.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/chai":"^5.2.2","@types/markdown-it":"^14.1.2","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/ws":"^8.18.1","@vitest/browser":"^4.1.7","@vitest/browser-playwright":"^4.1.7","@vitest/coverage-v8":"^4.1.7","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3",eslint:"^9.25.0","eslint-config-expo":"~10.0.0",jsdom:"^20.0.3","material-icon-theme":"^5.32.0",playwright:"^1.56.1","serve-sim":"^0.1.40",typescript:"~5.9.2",vitest:"^4.1.6",wrangler:"^4.105.0",ws:"^8.20.0"}}},3415,[]);
15060
+ __d(function(e,t,r,a,o,i,n){o.exports={name:"@hyperdrive.bot/fleet-app",version:"0.3.144",private:!0,main:"index.ts",scripts:{start:"npm run start:expo","start:expo":"cross-env APP_VARIANT=development expo start","reset-project":"node ./scripts/reset-project.js","build:terminal-webview":"node ./scripts/build-terminal-webview-html.mjs","eas-build-post-install":"npm --prefix ../.. run build:app-deps && npm run build:terminal-webview",android:"npm run android:development","android:development":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=development expo run:android --variant=debug","android:production":"npm --prefix ../.. run build:client && cross-env APP_VARIANT=production expo prebuild --platform android --non-interactive && cross-env APP_VARIANT=production expo run:android --variant=release","android:release":"npm run android:production","android:clear":"node -e \"require('node:fs').rmSync('android', { recursive: true, force: true })\"",ios:"npm --prefix ../.. run build:client && expo run:ios","ios:release":"npm --prefix ../.. run build:client && expo run:ios --configuration Release",web:"npm --prefix ../.. run build:client && concurrently --kill-others --names protocol,client,expo --prefix-colors yellow,blue,magenta \"npm --prefix ../.. run watch:protocol\" \"npm --prefix ../.. run watch:client\" \"npm run web:expo\"","web:expo":"expo start --web",lint:"expo lint",typecheck:"tsgo --noEmit",test:"vitest run","test:browser":"vitest run --project browser","test:e2e":"playwright test --project='Desktop Chrome'","test:e2e:reels":"cross-env NODE_ENV=development playwright test --config playwright.reels.config.ts","test:e2e:real":"cross-env E2E_FORK_PASEO_HOME_FROM=../../.dev/paseo-home playwright test --project=real-provider","test:e2e:ui":"playwright test --ui","test:coverage":"vitest run --project unit --coverage",build:"npm run build:web","build:web":"npm --prefix ../.. run build:app-deps && expo export --platform web --source-maps","profile:workspace-tabs":"node ./scripts/profile-workspace-tabs.mjs","deploy:web":"npm run build:web && wrangler pages deploy dist --project-name paseo-app --branch main"},dependencies:{"@bacons/apple-targets":"4.0.6","@datadog/browser-rum":"^6.23.0","@datadog/browser-rum-react":"^6.23.0","@datadog/mobile-react-native":"^2.7.0","@datadog/mobile-react-native-session-replay":"^2.14.8","@dnd-kit/core":"^6.3.1","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@expo/image-utils":"0.8.8","@expo/plist":"0.4.9","@expo/prebuild-config":"54.0.8","@floating-ui/react-native":"^0.10.7","@gorhom/bottom-sheet":"^5.2.14","@gorhom/portal":"^1.0.14","@hyperdrive.bot/fleet-client":"*","@hyperdrive.bot/fleet-expo-two-way-audio":"*","@hyperdrive.bot/fleet-extension-sdk":"*","@hyperdrive.bot/fleet-highlight":"*","@react-native-async-storage/async-storage":"2.2.0","@react-native-masked-view/masked-view":"^0.3.2","@react-native/normalize-colors":"^0.81.5","@react-navigation/native":"^7.1.8","@sentry/electron":"^6.11.0","@sentry/react-native":"^6.20.0","@tanstack/react-query":"^5.90.11","@tanstack/react-virtual":"^3.13.21","@xterm/addon-clipboard":"^0.3.0-beta.213","@xterm/addon-fit":"^0.12.0-beta.213","@xterm/addon-image":"^0.10.0-beta.213","@xterm/addon-ligatures":"0.11.0-beta.213","@xterm/addon-search":"^0.17.0-beta.213","@xterm/addon-unicode11":"^0.10.0-beta.213","@xterm/addon-web-links":"^0.13.0-beta.213","@xterm/addon-webgl":"^0.20.0-beta.212","@xterm/xterm":"^6.1.0-beta.213",buffer:"^6.0.3",expo:"^54.0.18","expo-asset":"~12.0.12","expo-audio":"~1.0.13","expo-background-fetch":"~14.0.9","expo-build-properties":"^1.0.9","expo-camera":"~17.0.10","expo-clipboard":"~8.0.7","expo-constants":"~18.0.9","expo-crypto":"^15.0.8","expo-dev-client":"^6.0.15","expo-document-picker":"~14.0.8","expo-file-system":"~19.0.17","expo-haptics":"~15.0.7","expo-image":"~3.0.10","expo-image-manipulator":"~14.0.8","expo-image-picker":"^17.0.8","expo-keep-awake":"^15.0.7","expo-linking":"~8.0.8","expo-localization":"~17.0.9","expo-notifications":"^0.32.16","expo-router":"~6.0.13","expo-sharing":"^14.0.8","expo-speech":"~14.0.8","expo-speech-recognition":"^56.0.1","expo-splash-screen":"~31.0.10","expo-system-ui":"~6.0.7","expo-task-manager":"~14.0.9","expo-video":"~3.0.16","fast-deep-equal":"^3.1.3",htmlparser2:"^12.0.0",i18next:"^26.3.0","lucide-react-native":"^0.546.0","markdown-it":"^10.0.0","mnemonic-id":"^3.2.7","posthog-js":"^1.431.2","posthog-react-native":"^4.72.0",qrcode:"^1.5.4",react:"19.1.0","react-dom":"19.1.0","react-i18next":"^17.0.8","react-native":"0.81.5","react-native-draggable-flatlist":"^4.0.3","react-native-edge-to-edge":"^1.7.0","react-native-gesture-handler":"~2.28.0","react-native-keyboard-controller":"^1.21.7","react-native-markdown-display":"^7.0.2","react-native-nitro-modules":"0.35.5","react-native-reanimated":"~4.3.1","react-native-safe-area-context":"~5.6.0","react-native-screens":"~4.16.0","react-native-svg":"^15.14.0","react-native-uitextview":"^2.2.0","react-native-unistyles":"^3.2.4","react-native-web":"~0.21.0","react-native-webview":"^13.16.0","react-native-worklets":"~0.8.3","tiny-invariant":"^1.3.3","use-sync-external-store":"^1.6.0",zod:"^4.4.3",zustand:"^5.0.9"},devDependencies:{"@playwright/test":"^1.56.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/chai":"^5.2.2","@types/markdown-it":"^14.1.2","@types/qrcode":"^1.5.6","@types/react":"~19.2.0","@types/ws":"^8.18.1","@vitest/browser":"^4.1.7","@vitest/browser-playwright":"^4.1.7","@vitest/coverage-v8":"^4.1.7","@xterm/headless":"^6.1.0-beta.213",dotenv:"^17.2.3",eslint:"^9.25.0","eslint-config-expo":"~10.0.0",jsdom:"^20.0.3","material-icon-theme":"^5.32.0",playwright:"^1.56.1","serve-sim":"^0.1.40",typescript:"~5.9.2",vitest:"^4.1.6",wrangler:"^4.105.0",ws:"^8.20.0"}}},3415,[]);
15061
15061
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shouldUseDesktopDaemon=function(){return(0,n.isElectronRuntime)()},e.getDesktopDaemonStatus=async function(){return c(await(0,t.invokeDesktopCommand)("desktop_daemon_status"))},e.startDesktopDaemon=async function(){return c(await(0,t.invokeDesktopCommand)("start_desktop_daemon"))},e.stopDesktopDaemon=async function(n="manual_ipc"){return c(await(0,t.invokeDesktopCommand)("stop_desktop_daemon",{reason:n}))},e.restartDesktopDaemon=async function(){return c(await(0,t.invokeDesktopCommand)("restart_desktop_daemon"))},e.getDesktopDaemonLogs=async function(){return p(await(0,t.invokeDesktopCommand)("desktop_daemon_logs"))},e.getDesktopDaemonPairing=async function(){return k(await(0,t.invokeDesktopCommand)("desktop_daemon_pairing"))},e.getCliDaemonStatus=async function(){const n=await(0,t.invokeDesktopCommand)("cli_daemon_status");if("string"!=typeof n)throw new Error("Unexpected CLI daemon status response.");return n},e.listenToLocalTransportEvents=async function(t){const u=(0,n.getDesktopHost)()?.events?.on;if("function"!=typeof u)throw new Error("Desktop events API is unavailable.");const c=await u("local-daemon-transport-event",n=>{o(n)&&t({sessionId:s(n.sessionId)??"",kind:s(n.kind)??"error",text:s(n.text),binaryBase64:s(n.binaryBase64),code:l(n.code),reason:s(n.reason),error:s(n.error)})});return"function"==typeof c?c:()=>{}},e.openLocalTransportSession=async function(n){const o=await(0,t.invokeDesktopCommand)("open_local_daemon_transport",n);if("string"!=typeof o||0===o.trim().length)throw new Error("Unexpected local transport session response.");return o},e.sendLocalTransportMessage=async function(n){await(0,t.invokeDesktopCommand)("send_local_daemon_transport_message",Object.assign({sessionId:n.sessionId},n.text?{text:n.text}:{},n.binaryBase64?{binaryBase64:n.binaryBase64}:{}))},e.closeLocalTransportSession=async function(n){await(0,t.invokeDesktopCommand)("close_local_daemon_transport",{sessionId:n})},e.getCliInstallStatus=async function(){return f(await(0,t.invokeDesktopCommand)("get_cli_install_status"))},e.installCli=async function(){return f(await(0,t.invokeDesktopCommand)("install_cli"))},e.getSkillsStatus=async function(){return y(await(0,t.invokeDesktopCommand)("get_skills_status"))},e.installSkills=async function(){return y(await(0,t.invokeDesktopCommand)("install_skills"))},e.updateSkills=async function(){return y(await(0,t.invokeDesktopCommand)("update_skills"))},e.uninstallSkills=async function(){return y(await(0,t.invokeDesktopCommand)("uninstall_skills"))};var n=r(d[0]),t=r(d[1]);function o(n){return"object"==typeof n&&null!==n}function s(n){return"string"==typeof n&&n.trim().length>0?n:null}function l(n){return"number"==typeof n&&Number.isFinite(n)?n:null}function u(n){const t=s(n)?.toLowerCase();switch(t){case"starting":return"starting";case"running":return"running";case"errored":case"error":return"errored";default:return"stopped"}}function c(n){if(!o(n))throw new Error("Unexpected desktop daemon status response.");return{serverId:s(n.serverId)??"",status:u(n.status),listen:s(n.listen),hostname:s(n.hostname),pid:l(n.pid),home:s(n.home)??"",version:s(n.version),desktopManaged:!0===n.desktopManaged,error:s(n.error)}}function p(n){if(!o(n))throw new Error("Unexpected desktop daemon logs response.");return{logPath:s(n.logPath)??"",contents:"string"==typeof n.contents?n.contents:""}}function k(n){if(!o(n))throw new Error("Unexpected desktop daemon pairing response.");return{relayEnabled:!0===n.relayEnabled,url:s(n.url),qr:s(n.qr)}}function f(n){if(!o(n))throw new Error("Unexpected install status response.");return{installed:!0===n.installed}}function w(n){switch(n){case"not-installed":case"up-to-date":case"drift":return n;default:throw new Error(`Unexpected skills status state: ${String(n)}`)}}function _(n){if(!o(n))throw new Error("Unexpected skill op response.");const t=s(n.name);if(!t)throw new Error("Skill op missing name.");switch(n.kind){case"add":return{kind:"add",name:t};case"update":return{kind:"update",name:t};case"delete":return{kind:"delete",name:t};default:throw new Error(`Unexpected skill op kind: ${String(n.kind)}`)}}function y(n){if(!o(n))throw new Error("Unexpected skills status response.");const t=Array.isArray(n.ops)?n.ops.map(_):[];return{state:w(n.state),ops:t}}},3416,[3417,3419]);
15062
15062
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getDesktopHost=n,e.isElectronRuntime=o,e.isElectronRuntimeMac=function(){if(!o())return!1;if("undefined"==typeof navigator)return!1;const t=n()?.platform?.toLowerCase();if("darwin"===t||"mac"===t||"macos"===t)return!0;const u=navigator.userAgent;return u.includes("Mac OS")||u.includes("Macintosh")},r(d[0]);var t=r(d[1]);function n(){return(0,t.getElectronHost)()}function o(){return null!==n()}},3417,[25,3418]);
15063
15063
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getElectronHost=function(){if("undefined"==typeof window)return null;const t=window.paseoDesktop;if(!t||"object"!=typeof t)return null;return t}},3418,[]);
@@ -16236,7 +16236,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
16236
16236
  __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"UNSTABLE_ReactComponentTracker",{enumerable:!0,get:function(){return o}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t.default=e,t})(r(_d[0])),t=r(_d[1]),n=r(_d[2]);const o=({name:o,children:u})=>{const f=e.useRef(!0),s=(0,t.createTimer)(),d=(0,t.createTimer)(),l=(0,t.createTimer)(),_=()=>{var e,t,c;const u=null!==(e=s.getDuration())&&void 0!==e?e:0,_=null!==(t=d.getDuration())&&void 0!==t?t:0,p=null!==(c=l.getDuration())&&void 0!==c?c:0,E=u+_+p;(0,n.addDurationVital)('reactComponentRender',{description:o,startTime:s.getStartTime(),duration:E,context:{is_first_render:f.current,render_phase_duration:u,effect_phase_duration:_,layout_effect_phase_duration:p,framework:'react'}}),f.current=!1};return e.createElement(e.Fragment,null,e.createElement(c,{onRender:s.startTimer,onLayoutEffect:l.startTimer,onEffect:d.startTimer}),u,e.createElement(c,{onRender:s.stopTimer,onLayoutEffect:l.stopTimer,onEffect:()=>{d.stopTimer(),_()}}))};function c({onRender:t,onLayoutEffect:n,onEffect:o}){return t(),e.useLayoutEffect(n),e.useEffect(o),null}},4477,[36,4478,4479]);
16237
16237
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createTimer=function(){let o,n,u;return{startTimer(){n=(0,t.timeStampNow)(),u=(0,t.relativeNow)()},stopTimer(){o=(0,t.elapsed)(u,(0,t.relativeNow)())},getDuration:()=>o,getStartTime:()=>n}};var t=r(d[0])},4478,[4256]);
16238
16238
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDurationVital",{enumerable:!0,get:function(){return n}});var t=r(d[0]);const n=(n,u)=>{(0,t.onRumInit)((t,o)=>{o.addDurationVital(n,u)})}},4479,[4475]);
16239
- __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.initializePostHog=function(){if(s)return!0;if("undefined"==typeof window||"undefined"==typeof document)return!1;try{const c="phc_tbTqBgZgqNyuMQ6R2ZBXnpGtWKMNTZwhSKLLZxb7KTmj",u=n;return o.posthog.init(c,{api_host:u,disable_session_recording:!0,autocapture:!1,persistence:"localStorage",cross_subdomain_cookie:!1,person_profiles:"identified_only",capture_pageview:"history_change",loaded:o=>{o.register({paseo_app_version:(0,t.resolveAppVersion)()??"unknown"})}}),s=!0,console.log(`[PostHog] initialized (host=${u}, recording=off, autocapture=off)`),!0}catch(o){return console.error("[PostHog] failed to initialize:",o),!1}},e.captureEvent=function(t,n){if(!s)return;try{o.posthog.capture(t,n)}catch(o){console.error("[PostHog] capture failed:",o)}},e.identifyUser=function(t,n){if(!s)return;try{o.posthog.identify(t,n)}catch(o){console.error("[PostHog] identify failed:",o)}},e.resetAnalytics=function(){if(!s)return;try{o.posthog.reset()}catch(o){console.error("[PostHog] reset failed:",o)}};var o=r(d[0]),t=r(d[1]);const n="https://eu.i.posthog.com";let s=!1},4480,[4481,3414]);
16239
+ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.initializePostHog=function(){if(s)return!0;if("undefined"==typeof window||"undefined"==typeof document)return!1;try{const c="phc_tbTqBgZgqNyuMQ6R2ZBXnpGtWKMNTZwhSKLLZxb7KTmj",u=n;return o.posthog.init(c,{api_host:u,disable_session_recording:!0,autocapture:!0,persistence:"localStorage",cross_subdomain_cookie:!1,person_profiles:"identified_only",capture_pageview:"history_change",loaded:o=>{o.register({paseo_app_version:(0,t.resolveAppVersion)()??"unknown"})}}),s=!0,console.log(`[PostHog] initialized (host=${u}, recording=off, autocapture=ON (trial))`),!0}catch(o){return console.error("[PostHog] failed to initialize:",o),!1}},e.captureEvent=function(t,n){if(!s)return;try{o.posthog.capture(t,n)}catch(o){console.error("[PostHog] capture failed:",o)}},e.identifyUser=function(t,n){if(!s)return;try{o.posthog.identify(t,n)}catch(o){console.error("[PostHog] identify failed:",o)}},e.resetAnalytics=function(){if(!s)return;try{o.posthog.reset()}catch(o){console.error("[PostHog] reset failed:",o)}};var o=r(d[0]),t=r(d[1]);const n="https://eu.i.posthog.com";let s=!1},4480,[4481,3414]);
16240
16240
  __d(function(e,t,i,s,n,r,o){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"Compression",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(r,"DEFAULT_PRODUCT_TOUR_APPEARANCE",{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(r,"DisplaySurveyType",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(r,"PostHog",{enumerable:!0,get:function(){return kc}}),Object.defineProperty(r,"ProductTourEventName",{enumerable:!0,get:function(){return ka}}),Object.defineProperty(r,"ProductTourEventProperties",{enumerable:!0,get:function(){return Pa}}),Object.defineProperty(r,"SurveyEventName",{enumerable:!0,get:function(){return wa}}),Object.defineProperty(r,"SurveyEventProperties",{enumerable:!0,get:function(){return xa}}),Object.defineProperty(r,"SurveyEventType",{enumerable:!0,get:function(){return pa}}),Object.defineProperty(r,"SurveyPosition",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(r,"SurveyQuestionBranchingType",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(r,"SurveyQuestionType",{enumerable:!0,get:function(){return ma}}),Object.defineProperty(r,"SurveySchedule",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(r,"SurveyTabPosition",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(r,"SurveyType",{enumerable:!0,get:function(){return _a}}),Object.defineProperty(r,"SurveyWidgetType",{enumerable:!0,get:function(){return va}}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return ld}}),Object.defineProperty(r,"posthog",{enumerable:!0,get:function(){return ad}}),Object.defineProperty(r,"severityLevels",{enumerable:!0,get:function(){return Ca}});const a="u">typeof window?window:void 0,l="u">typeof globalThis?globalThis:a,c=null==l?void 0:l.navigator,u=null==l?void 0:l.document,d=null==l?void 0:l.location,h=null==l?void 0:l.fetch,p=(null==l?void 0:l.XMLHttpRequest)&&"withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:void 0,v=null==l?void 0:l.AbortController,f=null==l?void 0:l.CompressionStream,g=null==c?void 0:c.userAgent;function _(){return!(!a||!1===a.navigator.onLine)}const m="undefined"!=typeof globalThis?globalThis:a;m&&"undefined"==typeof self&&(m.self=m),m&&"undefined"==typeof File&&(m.File=function(){});const y=null!=a?a:{},b="0.8.3",w={DEBUG:!1,LIB_VERSION:b,LIB_NAME:"browser-common",JS_SDK_VERSION:b};var x=(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.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),E=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const $=["$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"],S=["token"];function k(e,t){return-1!==e.indexOf(t)}const P=function(e){return e.trim()},M=function(e){return e.replace(/^\$/,"")};function O(e){var t;const i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const T=Object.prototype,F=T.hasOwnProperty,C=T.toString,I=Array.isArray||function(e){return"[object Array]"===C.call(e)},R=e=>"function"==typeof e,A=e=>e===Object(e)&&!I(e),L=e=>{if(A(e)){for(const t in e)if(F.call(e,t))return!1;return!0}return!1},D=e=>void 0===e,N=e=>"[object String]"==C.call(e),j=e=>N(e)&&0===e.trim().length,B=e=>null===e,U=e=>D(e)||B(e),H=e=>"[object Number]"==C.call(e)&&e==e,z=e=>H(e)&&e>0,q=e=>"[object Boolean]"===C.call(e),V=e=>k($,e),W=e=>k(S,e);function G(e){return null===e||"object"!=typeof e}function K(e,t){return{}.toString.call(e)===`[object ${t}]`}function Y(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 Z(e,Error)}}function J(e){return"u">typeof Event&&Z(e,Event)}function Z(e,t){try{return e instanceof t}catch(e){return!1}}const X=[!0,"true",1,"1","yes"],Q=e=>k(X,e),ee=[!1,"false",0,"0","no"];function te(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,n)}function ie(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(e){te(r,s,n,o,a,"next",e)}function a(e){te(r,s,n,o,a,"throw",e)}o(void 0)})}}const se=["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"],ne=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return se.concat(t).some(e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)})};function re(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),H(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),re(null!=n?n:i,t,i,s))}var oe=class{constructor(e){this.C={},this.I=e.I,this.R=re(e.bucketSize,0,100,e.$),this.A=re(e.refillRate,0,this.R,e.$),this.O=re(e.refillInterval,0,864e5,e.$)}F(e,t){const i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.A,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let n=this.C[s];return n?this.F(n,i):(n={tokens:this.R,lastAccess:i},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(t=this.I)||void 0===t||t.call(this,e)),0===n.tokens)}stop(){this.C={}}};const ae="Mobile",le="Android",ce="Tablet",ue="Android Tablet",de="iPad",he="Apple Watch",pe="Safari",ve="BlackBerry",fe="Samsung Internet",ge="Chrome",_e="Chrome iOS",me="Internet Explorer",ye="Internet Explorer Mobile",be="Opera",we="Microsoft Edge",xe="Firefox",Ee="Firefox iOS",$e="Nintendo",Se="PlayStation",ke="Xbox",Pe="Android Mobile",Me="Mobile Safari",Oe="Windows",Te="Windows Phone",Fe="Nokia",Ce="Ouya",Ie="Generic "+ae.toLowerCase(),Re="Generic "+ce.toLowerCase(),Ae="Konqueror",Le="Oculus Browser",De="Vivaldi",Ne="Yandex",je="Whale",Be="DuckDuckGo",Ue="Pale Moon",He="Waterfox",ze="Brave",qe="Claude",Ve="Codex",We="ChatGPT",Ge="Google Search App",Ke=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ye=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Je=new RegExp(ke,"i"),Ze=new RegExp("PlayStation \\w+","i"),Xe=new RegExp("Nintendo \\w+","i"),Qe=new RegExp("BlackBerry|PlayBook|BB10","i"),et={"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"},tt=function(e,t,i,s){t=t||"";const n=(function(e){return(null==e?void 0:e.brave)?ze:null})(i);return n||((null==s?void 0:s.detectGoogleSearchApp)&&k(e,"GSA/")?Ge:k(e," OPR/")&&k(e,"Mini")?"Opera Mini":k(e," OPR/")?be:Qe.test(e)?ve:k(e,"IEMobile")||k(e,"WPDesktop")?ye:k(e,"OculusBrowser")?Le:k(e,"SamsungBrowser")?fe:k(e,"Edge")||k(e,"Edg/")?we:k(e,"Vivaldi/")?De:k(e,"YaBrowser/")?Ne:k(e,"Whale/")?je:k(e,"DuckDuckGo/")||k(e,"Ddg/")?Be:k(e,"Claude/")?qe:k(e,"Codex/")?Ve:k(e,"ChatGPT/")?We:k(e,"FBIOS")?"Facebook Mobile":k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?_e:k(e,"CrMo")||k(e,ge)?ge:k(e,le)&&k(e,pe)?Pe:k(e,"FxiOS")?Ee:k(e.toLowerCase(),Ae.toLowerCase())?Ae:k(e,"Brave/")?ze:((e,t)=>t&&k(t,"Apple")||(function(e){return k(e,pe)&&!k(e,ge)&&!k(e,le)})(e))(e,t)?k(e,ae)?Me:pe:k(e,"PaleMoon/")?Ue:k(e,"Waterfox/")?He:k(e,xe)?xe:k(e,"MSIE")||k(e,"Trident/")?me:k(e,"Gecko")?xe:"")},it={[ye]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ge]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[pe]:[Ke],[Me]:[Ke],[be]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[xe]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ae]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ve]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ke],[Pe]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[fe]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Le]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[De]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ne]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[je]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[ze]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[qe]:[Ye],[Ve]:[Ye],[We]:[Ye],[Be]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ue]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[He]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ge]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},st=function(e,t,i,s){const n=tt(e,t,i,s),r=it[n];if(D(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},nt=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ke,e&&e[1]||""]],[new RegExp($e,"i"),[$e,""]],[new RegExp(Se,"i"),[Se,""]],[Qe,[ve,""]],[new RegExp(Oe,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Te,""];if(new RegExp(ae).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=et[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[Oe,e]}return[Oe,""]}],[/((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=D(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[le,[e[2],e[3],e[4]||"0"].join(".")]:[le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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",""]]],rt=function(e){for(let t=0;nt.length>t;t++){const[i,s]=nt[t],n=i.exec(e),r=n&&(R(s)?s(n,e):s);if(r)return r}return["",""]},ot=function(e){return Xe.test(e)?$e:Ze.test(e)?Se:Je.test(e)?ke:new RegExp(Ce,"i").test(e)?Ce:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Te:/iPad/.test(e)?de:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?he:Qe.test(e)?ve:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Fe,"i").test(e)?Fe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ae).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)?le:ue:new RegExp("(pda|Mobile)","i").test(e)?Ie:new RegExp(ce,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Re:""},at=function(e,t){var i;const s=ot(e);return s===de||s===ue||"Kobo"===s||"Kindle Fire"===s||s===Re?ce:s===$e||s===ke||s===Se||s===Ce?"Console":s===he?"Wearable":s?ae:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(n=null==t?void 0:t.screenWidth)&&void 0!==n?n:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?ae:ce:"Desktop";var n,r,o},lt=/\bFBAV\/(\d+(?:\.\d+)*)/i,ct=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",lt],[/\bFBAN\/EMA\b/i,"Facebook Lite",lt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",lt],[/\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"]],ut="[Truncated]",dt="[Unserializable]";function ht(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"\ufffd";else{const s=e.charCodeAt(i+1);56320>s||s>57343?t+="\ufffd":(t+=e[i]+e[i+1],i++)}}return t}function pt(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(const s of i){let i;try{i=t[s]}catch(e){i=dt}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}Date,Date;const vt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ft(e,t){return"string"==typeof(i=e)&&vt.test(i)?e:t();var i}function gt(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function _t(e){return e?e.split("#")[0]:e}function mt(e){try{return e()}catch(e){return}}function yt(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function bt(e,t,i){return wt.apply(this,arguments)}function wt(){return(wt=ie(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,n)=>{s=yt(()=>{try{null==i||i(),e()}catch(e){n(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let xt,Et,$t;function St(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return $t&&i.length===Et||(Et=i.length,$t=i.reduce((i,s)=>{xt||(xt={});const n=xt[s];if(n)i[n[0]]=n[1];else{const n=e(s);for(let e=n.length-1;e>=0;e--){const r=n[e],o=null==r?void 0:r.filename,a=t[s];if(o&&a){i[o]=a,xt[s]=[o,a];break}}}return i},{})),$t}function kt(e){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kt(e)}function Pt(e,t,i){return(t=(function(e){var t=(function(e){if("object"!=kt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=kt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)})(e);return"symbol"==kt(t)?t:t+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Mt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function Ot(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Mt(Object(i),!0).forEach(function(t){Pt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Mt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var Tt=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ie(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&I(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),Ot(Ot({},e),{},{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ie(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){var i,s,n;const r={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});const o=[r];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,Ot(Ot({},t),{},{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:St(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i=0){const s=(i,s)=>{if(4>=s){const n=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,n)}};return Ot(Ot({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}};const Ft=/^([a-z][a-z0-9.+-]+):/i,Ct=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function It(e){if(!e||"<anonymous>"===e)return!1;const t=Ft.exec(e);return!t||Ct.includes(t[1].toLowerCase())}function Rt(e,t,i,s,n){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:It(t)};return D(s)||(r.lineno=s),D(n)||(r.colno=n),r}const At=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Lt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Dt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Nt=/\((\S*)(?::(\d+))(?::(\d+))\)/,jt=(e,t)=>{const i=Lt.exec(e);if(i){const[,e,s,n]=i;return Rt(t,e,"?",+s,+n)}const s=Dt.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){const e=Nt.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}const[e,i]=At(s[1]||"?",s[2]);return Rt(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Bt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ut=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ht=(e,t)=>{const i=Bt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=Ut.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=At(s,e),Rt(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},zt=/\(error: (.*)\)/;function qt(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Vt(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!qt(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}function Wt(e,t){const i=t.start+t.length,s=Kt(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function Gt(e,t){let i=t.start;for(;i>0&&qt(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Kt(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&qt(e[s],e[s-t.length]);)s++;return s-i}function Yt(e,t){const i=t[0];let s=e.length-(i?Gt(e,i):0);for(const i of t)s-=Kt(e,i);return s}function Jt(e,t,i){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Zt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=N(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return K(e,"DOMException")}isDOMError(e){return K(e,"DOMError")}},Xt=class{match(e){return Y(e)}coerce(e,t){var i;const s=this.getStack(e),n=void 0===s;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Qt=class{match(e){return!!K(e,"ErrorEvent")&&(null!=e.error||this.lr(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const s=t.apply(e.message);return Ot(Ot({},s),{},{stack:null!==(i=this.ur(e))&&void 0!==i?i:s.stack,synthetic:!0})}lr(e){return N(e.message)&&e.message.length>0}ur(e){var t,i;const s=e,n=null!==(t=s.lineno)&&void 0!==t?t:0,r=null!==(i=s.colno)&&void 0!==i?i:0;if(N(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const ei=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var ti=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[s,n]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(ei);return s&&(t=s[1],i=s[2]),[t,i]}};const ii=["fatal","error","warning","log","info","debug"];function si(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var ni=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(J(e))return e.constructor.name;const t="name"in e?e.name:void 0;return N(t)&&!j(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${si(e)}`}isSeverityLevel(e){return N(e)&&!j(e)&&ii.indexOf(e)>=0}getStack(e){try{return N(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:N(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(Y(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},ri=class{match(e){return J(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${si(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},oi=class{match(e){return G(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},ai=class{match(e){return K(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!J(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return G(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};const li="$message",ci="$timestamp",ui=new Set([li,ci]),di={enabled:!0,max_bytes:32768};function hi(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:di.enabled,max_bytes:vi(e.max_bytes,di.max_bytes)}:Ot({},di)}var pi=class{constructor(e){this.ts=[],this.es=0,this.Mr=hi(e)}setConfig(e){this.Mr=hi(e),this.ns()}add(e){const t=(function(e){let t;try{t=O(e)}catch(e){return}try{const e=JSON.parse(t);if(!A(e))return;const i=e,s=i[li],n=i[ci];if(!N(s)||0===s.trim().length)return;if(!N(n)&&!H(n))return;return{step:i,json:t}}catch(e){return}})(e);if(!t)return;const i=(function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i})(t.json);i>this.Mr.max_bytes||(this.ts.push({step:t.step,bytes:i}),this.es+=i,this.ns())}getAttachable(){return this.ts.map(e=>e.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const e=this.ts.shift();e&&(this.es-=e.bytes)}}};function vi(e,t){if(!H(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const fi=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function gi(e){return"string"==typeof e||e}function _i(e){return"string"==typeof e?e:void 0}const mi=["$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"],yi="NativeGzipValidationError",bi=e=>e.length>=2&&31===e[0]&&139===e[1],wi=(e,t)=>e===E.GZipJS||t===E.GZipJS||"gzip"===t,xi=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):"");let Ei;const $i=e=>{throw gt(yi,`Native gzip produced invalid output: ${e}`)},Si=(ki=ie(function*(e,t){18>e.size&&$i("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());bi(i)&&8===i[2]||$i("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{const t=(()=>{if(Ei)return Ei;Ei=[];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;Ei[e]=t>>>0}return Ei})();let i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&$i("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&$i("invalid-size")}),function(e,t){return ki.apply(this,arguments)});var ki;function Pi(){return Pi=ie(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),n=i.writable.getWriter(),r=n.write(t).then(()=>n.close()).catch((s=ie(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield Si(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var s}),Pi.apply(this,arguments)}const Mi=3e5;var Oi=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Mi);if(!t)return this.ss=i,void(this.rs=i+s);this.rs=Math.max(this.rs,Math.min(i+s,this.ss+Mi))}remainingMs(){const e=Date.now();if(this.ss-5e3>e)return this.reset(),0;const t=Math.min(Mi,Math.max(0,this.rs-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function Ti(e,t){if(null==e)return{};var i,s,n=(function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i})(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}const Fi={}.propertyIsEnumerable;function Ci(e,t){try{return Ai(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function Ii(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:ut};if(i.remainingNodes--,q(e))return{boolValue:e};if("bigint"==typeof e)return(function(e,t){const i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}})(e,t);if("number"==typeof e){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)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:ht(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:ut};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?ht(i):String(i)}}i.ancestors.add(e);try{try{const n=e.toJSON;if("function"==typeof n)return Ii(n.call(e),t,i,s+1)}catch(e){}return I(e)?{arrayValue:{values:Ri(e,t,i,s+1)}}:{kvlistValue:{values:Ai(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:ht(String(e))}}function Ri(e,t,i,s){const n=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(U(r))continue;n.push(Ii(r,t,i,s))}catch(e){n.push({stringValue:dt})}return e.length>o&&n.push({stringValue:ut}),n}function Ai(e,t,i,s){const n=[];for(const r in e)if(Fi.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(B(o)||D(o))continue;n.push({key:ht(r),value:Ii(o,t,i,s)})}catch(e){n.push({key:ht(r),value:{stringValue:dt}})}}return n}function Li(e,t,i){return Ot(Ot(Ot(Ot({},pt({},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":i})}const Di=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Ni(e,t){const i=pt({},e),s={};for(const e of Di)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);return[...Ci(i,t),...Ci(s,t)]}const ji={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"},Bi={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}},Ui=Bi.info;function Hi(e){try{return ht(String(e))}catch(e){return dt}}function zi(e,t,i,s){const n=e.level||"info",{text:r,number:o}=Bi[n]||Ui,a=(function(e=Date.now()){return String(e)+"000000"})(H(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),U(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),U(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=Ot({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const i of e){let e;try{e=u[i]}catch(t){e=dt}Object.defineProperty(c,i,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Hi(e.body)},attributes:Ci(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),D(e.trace_flags)||(d.flags=e.trace_flags),d}function qi(e,t,i){return Li(e,t,i)}function Vi(e,t,i,s){return{resourceLogs:[{resource:{attributes:Ni(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var Wi=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=yt(()=>{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),this.hs=void 0)}};function Gi(){return.75+.5*Math.random()}function Ki(e,t,i,s){const n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,e)))*i)}var Yi=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.$=i,this.cs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new Wi(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Oi,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a: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(x.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.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const s=this.Os(e);if(null===s)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:zi(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this.cs(),this.$,null==t?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const i=I(t)?t:[t];let s=e;for(const t of i)try{const e=t(s);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;s=e}catch(e){return this.$.error("Error in beforeSend function for log:",e),null}return s}Ds(){if(void 0===this.Rs)return!0;const 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`),this.$s=!0),!1)}flush(){var e=this;return ie(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return ie(function*(){var t;e.ps.clear();let i=null!==(t=e._instance.getPersistedProperty(x.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const s=i.length;let n=0;for(;i.length>0&&s>n;){var r,o;const t=e._s;e.bs=0;const s=Math.min(i.length,e.Es),a=i.slice(0,s),l=Vi(a.map(e=>e.record),e.qs(),null!==(r=e.fs)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.js(l);if(e._s!==t)return;if("too-large"===c.kind&&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(c),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),"retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e.$.warn("Dropping a single log record with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),i=null!==(o=e._instance.getPersistedProperty(x.LogsQueue))&&void 0!==o?o:[],n+=a.length,"fatal"===c.kind)throw c.error}}})()}Bs(e){var t=this;return ie(function*(){var i;const s=Math.max(0,e-t.bs),n=null!==(i=t._instance.getPersistedProperty(x.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(x.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return qi(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(x.LogsQueue))&&void 0!==t?t:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(x.LogsQueue,i),this.Ts>i.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(Ki(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(x.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ie(function*(){t.ps.clear();const i=t.flush().catch(()=>{});void 0!==e?yield bt(i,e):yield i})()}flushWithTimeout(e){var t=this;return ie(function*(){const i=t.flush();yield bt(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Gi(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Ji=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Zi(e){return String(e)+"000000"}function Xi(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${n}`}var Qi=class{constructor(e,t,i){this._instance=e,this.Mr=t,this.$=i,this.zs=new Map,this.ps=new Wi(()=>this.flush().catch(e=>{this.$.error("Metrics flush failed:",e)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Oi,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Zs({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this.ys,i=(function(){var i=ie(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?Ot({},t.attributes):void 0,s=Xi(t.type,t.name,t.unit,i)}catch(e){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let n=this.zs.get(s);if(!n){if(!this.Ks())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(s,n)}const r=this.Ws.get(t.name);void 0===r?this.Ws.set(t.name,t.type):r===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Ji.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length})(t,Ji)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const i=I(t)?t:[t];let s=e;for(const t of i)try{const e=t(s);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;s=e}catch(e){return this.$.error("Error in beforeSend function for metric:",e),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ki(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return ie(function*(){if(e.ps.clear(),0===e.zs.size)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),"retry-later"===s.kind?(e.ks++,e.Ss=Gi()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":return e.lo(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",s.error)}})()}Js(e){return t=this.ao(e),i=(function(e,t,i){return Li(e,t,i)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ni(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}ao(e){const t=Zi(Date.now()),i=new Map;for(const o of e.values()){var s;const e=Xi(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=Ot({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=Ci(null!==(s=o.attributes)&&void 0!==s?s:{},this.$),c=Zi(o.windowStartMs);if("count"===o.type){var n;const e={attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(n=o.total)&&void 0!==n?n:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e={attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Ji})}return Array.from(i.values())}lo(e){for(const[s,n]of e){const e=this.zs.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case"count":var t,i;e.total=(null!==(t=e.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i: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(s,n)}}};const es=(e,{debugEnabled:t}={})=>{const i={N(i,...s){a&&(w.DEBUG||a.POSTHOG_DEBUG||t)&&!D(a.console)&&a.console&&("__rrweb_original__"in a.console[i]?a.console[i].__rrweb_original__:a.console[i])(e,...s)},debug(...e){i.N("debug",...e)},info(...e){i.N("log",...e)},warn(...e){i.N("warn",...e)},error(...e){i.N("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,i)=>es(`${e} ${t}`,i)};return i},ts=es("[PostHog.js]"),is=ts.createLogger,ss=is("[ExternalScriptsLoader]"),ns=e=>{const t=null==u?void 0:u.querySelectorAll("script");if(t)for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]},rs=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ss.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=ns(t);if(s){if(s.__posthog_loading_callback_fired)return i();const e=s.__posthog_loading_error;return e?i(e):(s.addEventListener("load",e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)}),void s.addEventListener("error",e=>{s.__posthog_loading_error=e,i(e)}))}const n=()=>{if(!u)return i("document not found");if(ns(t))return rs(e,t,i);let s=u.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>{s.__posthog_loading_error=e,i(e)},e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)u.head.appendChild(s);else{const e=u.querySelectorAll("body > script");var n;e.length>0?null===(n=e[0].parentNode)||void 0===n||n.insertBefore(s,e[0]):u.body.appendChild(s)}};(null==u?void 0:u.body)?n():null==u||u.addEventListener("DOMContentLoaded",n)},os={},as=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;if("toolbar"===t){const e=3e5;i=`${i}&t=${Math.floor(Date.now()/e)*e}`}return e.requestRouter.endpointFor("assets",i)};y.__PosthogExtensions__=y.__PosthogExtensions__||{},y.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"===t){const t=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void rs(e,t,i)}const s=e.config.strict_script_versioning;if(s){const n=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),r=os[n];if("fallback"===s&&r){if(ns(r))return void rs(e,r,i);delete os[n]}return void rs(e,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)i(s);else{var o;const s=as(e,t);os[n]=s;const r=ns(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),rs(e,s,i)}else i(void 0,r)}:i)}rs(e,as(e,t),i)},y.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{const s=e.requestRouter.endpointFor("api",t);rs(e,s,i)},w.DEBUG=!1,w.LIB_VERSION="1.431.2",w.LIB_NAME="web";var ls=w;const cs="$people_distinct_id",us="distinct_id",ds="$device_id",hs="$device_model",ps="__alias",vs="__cmpns",fs="$fbc",gs="$fbc_persistence",_s="__timers",ms="$autocapture_disabled_server_side",ys="$heatmaps_enabled_server_side",bs="$exception_capture_enabled_server_side",ws="$error_tracking_suppression_rules",xs="$error_tracking_capture_extension_exceptions",Es="$web_vitals_enabled_server_side",$s="$dead_clicks_enabled_server_side",Ss="$product_tours_enabled_server_side",ks="$logs_capture_enabled_server_side",Ps="$web_vitals_allowed_metrics",Ms="$session_recording_remote_config",Os="$session_recording_enabled_server_side",Ts="$replay_sample_rate",Fs="$replay_override_sampling",Cs="$replay_override_linked_flag",Is="$replay_override_url_trigger",Rs="$replay_override_event_trigger",As="$sesid",Ls="$session_is_sampled",Ds="$session_past_minimum_duration",Ns="$session_recording_url_trigger_activated_session",js="$session_recording_event_trigger_activated_session",Bs="$debug_first_full_snapshot_timestamp",Us="$sess_rec_flush_size",Hs="$enabled_feature_flags",zs="$active_feature_flags",qs="$early_access_features",Vs="$feature_flag_details",Ws="$feature_flag_payloads",Gs="$feature_flag_request_id",Ks="$minimal_flag_called_events",Ys="$override_feature_flags",Js="$override_feature_flag_payloads",Zs="$stored_person_properties",Xs="$stored_group_properties",Qs="$groups",en="$surveys",tn="$surveys_loaded_at",sn="$surveys_activated",nn="$surveys_activated_session",rn="$surveys_activated_timestamps",on="ph_product_tours",an="$product_tours_activated",ln="$product_tours_activated_session",cn="$conversations_widget_session_id",un="$conversations_ticket_id",dn="$conversations_widget_state",hn="$conversations_user_traits",pn="$flag_call_reported",vn="$flag_call_reported_session_id",fn="$feature_flag_errors",gn="$feature_flag_evaluated_at",_n="$user_state",mn="$client_session_props",yn="$capture_rate_limit",bn="$initial_campaign_params",wn="$initial_referrer_info",xn="$initial_person_info",En="$epp",$n="$posthog_cookieless",Sn="$cookieless_mode",kn="$sdk_debug_extensions_init_method",Pn="$sdk_debug_extensions_init_time_ms",Mn="$sdk_debug_recording_script_not_loaded",On="$sdk_debug_replay_event_trigger_status",Tn="$sdk_debug_replay_linked_flag_trigger_status",Fn="$sdk_debug_replay_matched_recording_trigger_groups",Cn="$sdk_debug_replay_pending_trigger_conditions",In="$sdk_debug_replay_remote_trigger_matching_config",Rn="$sdk_debug_replay_trigger_groups_count",An="$sdk_debug_replay_url_trigger_status",Ln="$session_recording_start_reason",Dn="PostHog loadExternalDependency extension not found.",Nn="anonymous",jn="identified",Bn="identified_only",Un="visibilitychange",Hn="beforeunload",zn="$pageview",qn="$pageleave",Vn="$identify",Wn="$groupidentify";function Gn(e,t){I(e)&&e.forEach(t)}function Kn(e,t){if(!U(e))if(I(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(const i in e)F.call(e,i)&&t(e[i],i)}const Yn=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function Jn(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const Zn=function(e){return function(...t){try{return e.apply(this,t)}catch(e){ts.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ts.critical(e)}}},Xn=function(e){const t={};return Kn(e,function(e,i){(N(e)&&e.length>0||H(e))&&(t[i]=e)}),t};function Qn(e){const t=Ot({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const er=["herokuapp.com","vercel.app","netlify.app"];function tr(e){const t=null==e?void 0:e.hostname;if(!N(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of er)if(i===e)return!1;return!0}function ir(e,t,i,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:n,passive:r})}function sr(e){return"ph_toolbar_internal"===e.name}const nr=e=>{if(u){try{const t=e+"=",i=u.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return H(e)&&isFinite(e)&&Math.floor(e)===e});var rr=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new e(r)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},or=class{generate(){const e=this.generateOrAbort();if(!D(e))return e;{this.Ct=0;const e=this.generateOrAbort();if(D(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return H(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 rr.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(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 lr}};let ar=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};a&&!D(a.crypto)&&crypto.getRandomValues&&(ar=e=>crypto.getRandomValues(e));var lr=class{nextUint32(){return this.Rt.length>this.$t||(ar(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let cr;const ur=()=>dr().toString(),dr=()=>(cr||(cr=new or)).generate();let hr="";const pr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let vr=null;const fr={Et(){if(!B(vr))return vr;if(vr=!1,u)try{const e=`__ph_cookie_support_${ur()}`;fr.At(e,"xyz"),vr='"xyz"'===nr(e),fr.Lt(e)}catch(e){vr=!1}return vr},Pt(e){ts.error("cookieStore error: "+e)},Ot:nr,Dt(e){let t;try{t=JSON.parse(fr.Ot(e))||{}}catch(e){}return t},At(e,t,i,s,n){if(!u)return!1;try{let r="",o="";const a=(function(e,t){if(t){let t=(function(e,t=u){if(hr)return hr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let s=Math.min(i.length,8);const n="dmn_chk_"+ur();for(;!hr&&s--;){const e=i.slice(s).join("."),r=n+"=1;domain=."+e+";path=/";t.cookie=r+";max-age=3",t.cookie.includes(n)&&(t.cookie=r+";max-age=0",hr=e)}return hr})(e);if(!t){const i=(e=>{const t=e.match(pr);return t?t[0]:""})(e);i!==t&&ts.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""})(u.location.hostname,s);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),r="; expires="+e.toUTCString()}n&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&ts.warn("cookieStore warning: large cookie, len="+l.length),u.cookie=l,!0}catch(e){return!1}},Lt(e,t){if(null==u?void 0:u.cookie)try{fr.At(e,"",-1,t)}catch(e){return}}};let gr=null;const _r={Et(){if(!B(gr))return gr;let e=!0;if(D(a))e=!1;else try{const t="__mplssupport__";_r.At(t,"xyz"),'"xyz"'!==_r.Ot(t)&&(e=!1),_r.Lt(t)}catch(t){e=!1}return e||ts.error("localStorage unsupported; falling back to cookie store"),gr=e,e},Pt(e){ts.error("localStorage error: "+e)},Ot(e){try{return null==a?void 0:a.localStorage.getItem(e)}catch(e){_r.Pt(e)}return null},Dt(e){try{return JSON.parse(_r.Ot(e))||{}}catch(e){}return null},At(e,t){try{return null==a||a.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){_r.Pt(e)}return!1},Lt(e){try{null==a||a.localStorage.removeItem(e)}catch(e){_r.Pt(e)}}},mr=[Zs,zs,Hs,Vs,Ws,Gs,gn,fn,pn],yr=[ds,us,As,Ls,En,xn,gs,_n],br=e=>e+"_cpm",wr=["__proto__","constructor","prototype"],xr=e=>{if(!A(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===wr.indexOf(i)&&(t[i]=e[i])}),t},Er=(e,t=[])=>{const i={};return[...yr,...t].forEach(t=>{const s=e[t];D(s)||B(s)||""===s||(i[t]=s)}),i},$r=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Sr=(e,t)=>({p:t,f:$r(JSON.stringify(e))}),kr=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=fr.Dt(br(e)),s=(null==i?void 0:i.f)===$r(t)&&I(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Pr=(e,t)=>t+"|"+(fr.Ot(br(e))||""),Mr={},Or={Et:()=>!0,Pt(e){ts.error("memoryStorage error: "+e)},Ot:e=>e in Mr?Mr[e]:null,Dt:e=>e in Mr?Mr[e]:null,At:(e,t)=>(Mr[e]=t,!0),Lt(e){delete Mr[e]}};let Tr=null;const Fr={Et(){if(!B(Tr))return Tr;if(Tr=!0,D(a))Tr=!1;else try{const e="__support__";Fr.At(e,"xyz"),'"xyz"'!==Fr.Ot(e)&&(Tr=!1),Fr.Lt(e)}catch(e){Tr=!1}return Tr},Pt(e){ts.error("sessionStorage error: ",e)},Ot(e){try{return null==a?void 0:a.sessionStorage.getItem(e)}catch(e){Fr.Pt(e)}return null},Dt(e){try{return JSON.parse(Fr.Ot(e))||null}catch(e){}return null},At(e,t){try{return null==a||a.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Fr.Pt(e)}return!1},Lt(e){try{null==a||a.sessionStorage.removeItem(e)}catch(e){Fr.Pt(e)}}};var Cr=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.Fo.At(this.Oo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get Ao(){const e=this.Fo.Ot(this.Oo);return Q(e)?1:k(ee,e)?0:-1}get Fo(){const e=this.Mr.opt_out_capturing_persistence_type,t="localStorage"===e?_r:fr,i=t.Et()?t:Or;if(!this.Do||this.Do!==i){this.Do=i;const t="localStorage"===e?fr:_r;t.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(Q(t.Ot(this.Oo))),t.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==c?void 0:c.doNotTrack,null==c?void 0:c.msDoNotTrack,y.doNotTrack,null==c?void 0:c.globalPrivacyControl].some(e=>Q(e))}};function Ir(e,t){var i;const s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!R(s))return t;try{const e=s(t);return N(e)&&e?e:t}catch(e){return ts.error("Error in get_current_url, falling back to window.location.href",e),t}}function Rr(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function Ar(e){return!!e&&1===e.nodeType}function Lr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Dr(e){return!!e&&3===e.nodeType}function Nr(e){return!!e&&11===e.nodeType&&Ar(e.host)}function jr(e){return e?P(e).split(/\s+/):[]}function Br(e,t){const i=(function(e){var t;const i=null==a||null===(t=a.location)||void 0===t?void 0:t.href;return D(i)?void 0:Ir(e,i)})(t);return!!(i&&e&&e.some(e=>i.match(e)))}function Ur(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 jr(t)}function Hr(e){return U(e)?null:P(e).split(/(\s+)/).filter(e=>vo(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function zr(e){let t="";return no(e)&&!ro(e)&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;Dr(e)&&e.textContent&&(t+=null!==(i=Hr(e.textContent))&&void 0!==i?i:"")}),P(t)}function qr(e){var t;return D(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const Vr=["a","button","form","input","select","textarea","label"];function Wr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function Gr(e,t){if(D(t))return!0;for(const i of e)if(t.some(e=>Wr(i,e)))return!0;return!1}function Kr(e){const t=e.parentNode;return!(!t||!Ar(t))&&t}const Yr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Jr=["next","previous","prev",">","<"],Zr=[...Jr,"+","-","\u2212","\u2013"],Xr=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Qr=[".ph-no-rageclick",".ph-no-capture"],eo=["","text","search","email","password","url","tel","number"];function to(e,t){if(!a||io(e))return!1;let i,s,n;var r,o;if(q(t)?(i=!!t&&Qr,s=void 0,n=!1):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Qr,s=null==t?void 0:t.content_ignorelist,n=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(n&&(function(e){return!(!e||!Ar(e))&&(!!Lr(e,"textarea")||(Lr(e,"input")?k(eo,(e.getAttribute("type")||"").toLowerCase()):(function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i})(e)))})(e))return!1;const{targetElementList:l}=so(e,!1);return!(function(e,t){if(!1===e||D(e))return!1;let i;if(!0===e)i=Jr;else{if(!I(e))return!1;if(e.length>10)return ts.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>Xr(e,i)||Xr(t,i)))})(s,l.map(e=>{var t;return{safeText:zr(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!Gr(l,i)}const io=e=>!e||Lr(e,"html")||!Ar(e),so=(e,t)=>{if(!a||io(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1;const s=[e];let n=e;for(;n.parentNode&&!Lr(n,"body");){if(Nr(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}const e=Kr(n);if(!e)break;if(t||Vr.indexOf(e.tagName.toLowerCase())>-1)i=!0;else try{const t=a.getComputedStyle(e);t&&"pointer"===t.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(e),n=e}return{parentIsUsefulElement:i,targetElementList:s}};function no(e){const t=new Set;let i=0;for(let s=e;s.parentNode&&!Lr(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);const e=Ur(s);if(k(e,"ph-sensitive")||k(e,"ph-no-capture"))return!1}if(k(Ur(e),"ph-include"))return!0;const s=e.type||"";if(N(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!N(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function ro(e){return!!(Lr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Lr(e,"select")||Lr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const oo=new 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}))$"),ao=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,lo=[16,15,14,13],co=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),uo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ho=/[0-9A-Za-z_]/;function po(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function vo(e,t=!0){if(U(e))return!1;if(N(e)){if(e=P(e),t?oo.test((e||"").replace(/[- ]/g,"")):(function(e){let t;for(ao.lastIndex=0;t=ao.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of lo){const s=e+t;if(i.length>=s){const t=i.slice(e,s);if(oo.test(t)&&po(t))return!0}}}return!1})(e))return!1;if(t?co.test(e):(function(e){let t;for(uo.lastIndex=0;t=uo.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&ho.test(e)&&ho.test(i)))return!0}return!1})(e))return!1}return!0}function fo(e){let t=zr(e);return t=`${t} ${go(e)}`.trim(),vo(t)?t:""}function go(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=zr(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${go(e)}`.trim())}catch(e){ts.error("[AutoCapture]",e)}}),t}function _o(e){return e.replace(/"|\\"/g,'\\"')}function mo(e){const t=e.attr__class;if(t)return I(t)?t:jr(t)}const yo=is("[Dead Clicks]"),bo=()=>!0,wo=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property($s)),s=e.instance.config.capture_dead_clicks;return q(s)?s:!!A(s)||i};var xo=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[$s]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(e){var t,i,s;(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?yo.error("failed to load script",t):e()})}qo(){var e;if(u){if(!this.Lo&&(null===(e=y.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=A(this.instance.config.capture_dead_clicks)?Ot({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Lo=y.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Lo.start(u),yo.info("starting...")}}else yo.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,yo.info("stopping..."))}};const Eo=is("[SegmentIntegration]");function $o(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:r}=(e=>R(e.register))(o=s)?{analytics:o}:o;var o;!(function(e,t,i,s){const n=t=>{const n=()=>t.anonymousId()||ur();e.config.get_device_id=n,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:n()}),e.persistence.set_property(_n,jn)),i(s?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&R(r.then)?r.then(n):n(r)})(e,n,i=>{n.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Eo.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!t&&s.event.anonymousId===t&&!s.event.userId;r||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Eo.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Eo.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(n,s.event.properties);if(!U(i)){const e=s.event.properties||{},t={};for(const i of Object.keys(o))F.call(e,i)||(t[i]=o[i]);const n=((e,t)=>{const i=I(e)?e:[e];let s=Ot({},t);for(const t of i)try{if(s=t(s),U(s))return null}catch(e){return Eo.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(U(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,zn),identify:e=>s(e,Vn),screen:e=>s(e,"$screen")}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{Eo.error("Failed to register the Segment integration",e),t()})},i)}const So="posthog-js";function ko(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==n&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],v=p.map(e=>Ot(Ot({},e),{},{stacktrace:e.stacktrace?Ot(Ot({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>Ot(Ot({},e),{},{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var g;return t&&i&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=e.exceptions)||void 0===g||g.sendExceptionEvent(f)),o}}var Po=class{constructor(e,t,i,s,n,r){this.name=So,this.setupOnce=function(o){o(ko(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},Mo=class{constructor(e){this.jo=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ts.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ho()}Ho(){var e;this.zo=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this.jo)}destroy(){var e;null===(e=this.zo)||void 0===e||e.call(this),this.zo=void 0}doPageView(e,t){var i;const s=this.Uo(e,t);return this.Bo={pathname:null!==(i=null==a?void 0:a.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Uo(e,null===(t=this.Bo)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this.Bo)||void 0===e?void 0:e.pageViewId}}Uo(e,t){const i=this.Bo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=n;if(!(D(e)||D(t)||D(i)||D(r)||D(o)||D(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const n=e>1?re(t/e,0,1,ts):1,l=e>1?re(i/e,0,1,ts):1,c=r>1?re(o/r,0,1,ts):1,u=r>1?re(a/r,0,1,ts):1;s=Yn(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const Oo=["flags","surveys"],To={[cs]:{exposure:"hidden"},[ps]:{exposure:"hidden"},[vs]:{exposure:"hidden"},[_s]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[ms]:{exposure:"event"},[ys]:{exposure:"hidden"},[ks]:{exposure:"hidden"},[bs]:{exposure:"event"},[ws]:{exposure:"hidden"},[xs]:{exposure:"event"},[Es]:{exposure:"event"},[$s]:{exposure:"event"},[Ss]:{exposure:"hidden"},[Ps]:{exposure:"event"},[Ms]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[As]:{exposure:"hidden"},[Ls]:{exposure:"event"},[Ts]:{exposure:"event",shouldSkipFromEventProperties:e=>B(e)},[Ds]:{exposure:"event"},[Ns]:{exposure:"event"},[js]:{exposure:"event"},[Bs]:{exposure:"event"},[Us]:{exposure:"hidden"},[Hs]:{exposure:"hidden",storageGroup:"flags"},[zs]:{exposure:"hidden",storageGroup:"flags"},[qs]:{exposure:"hidden"},[Vs]:{exposure:"hidden",storageGroup:"flags"},[Ws]:{exposure:"hidden",storageGroup:"flags"},[Gs]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ks]:{exposure:"hidden",storageGroup:"flags"},[Ys]:{exposure:"hidden"},[Js]:{exposure:"hidden"},[Zs]:{exposure:"hidden"},[Xs]:{exposure:"hidden"},[en]:{exposure:"hidden",storageGroup:"surveys"},[tn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[sn]:{exposure:"event"},[nn]:{exposure:"hidden"},[rn]:{exposure:"hidden"},[on]:{exposure:"hidden"},[an]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[cn]:{exposure:"event"},[un]:{exposure:"event"},[dn]:{exposure:"event"},[hn]:{exposure:"event"},[pn]:{exposure:"hidden"},[vn]:{exposure:"hidden"},[Qs]:{exposure:"event"},[fn]:{exposure:"hidden"},[gn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_n]:{exposure:"hidden"},[mn]:{exposure:"hidden"},[yn]:{exposure:"hidden"},[bn]:{exposure:"hidden"},[wn]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[En]:{exposure:"hidden"},[Fs]:{exposure:"event"},[Cs]:{exposure:"event"},[Is]:{exposure:"event"},[Rs]:{exposure:"event"},[kn]:{exposure:"event"},[Pn]:{exposure:"event"},[Mn]:{exposure:"event"},[On]:{exposure:"event"},[Tn]:{exposure:"event"},[Fn]:{exposure:"event"},[Cn]:{exposure:"event"},[In]:{exposure:"event"},[Rn]:{exposure:"event"},[An]:{exposure:"event"},[Ln]:{exposure:"event"}},Fo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Co=e=>{const t=To[e];if(t)return t;for(const[t,i]of Fo)if(0===e.indexOf(t))return i},Io=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var s;return Y(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,Qn(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return O(e)}},Ro=e=>{const t=null==u?void 0:u.createElement("a");return D(t)?null:(t.href=e,t)},Ao=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let e=0;i.length>e;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!I(s)||2>s.length)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch(t){ts.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},Lo=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const s=l[e].split("=");I(s)&&(t.includes(s[0])?c.push(s[0]+"="+i):c.push(l[e]))}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=n&&(u+="#"+n),u},Do=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},No=(e,t)=>e>=t&&_(),jo=(e,t,i,s)=>{if(0===e){if(_()){const e=t+1;return e===i&&s(),e}return t}return 0},Bo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Uo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Bo],Ho="<masked>",zo=["li_fat_id"];function qo(e,t,i){if(!u)return{};const s=t?[...Bo,...i||[]]:[],n=Vo(Lo(u.URL,s,Ho),e),r=(function(){const e={};return Kn(zo,function(t){const i=nr(t);e[t]=i||null}),e})();return Yn(r,n)}function Vo(e,t){const i=Uo.concat(t||[]),s={};return Kn(i,function(t){const i=Ao(e,t);s[t]=i||null}),s}function Wo(e){const t=(function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null})(e),i="yahoo"!=t?"q":"p",s={};if(!B(t)){s.$search_engine=t;const e=u?Ao(u.referrer,i):"";e.length&&(s.ph_keyword=e)}return s}function Go(){return navigator.language||navigator.userLanguage}function Ko(){const e=Go();return"string"==typeof e?e.split("-")[0]:void 0}const Yo="$direct";function Jo(){return(null==u?void 0:u.referrer)||Yo}function Zo(e,t,i=!1){const s=e?[...Bo,...t||[]]:[],n=i?_t(null==d?void 0:d.href):null==d?void 0:d.href,r=null==n?void 0:n.substring(0,1e3);return{r:Jo().substring(0,1e3),u:r?Lo(r,s,Ho):void 0}}function Xo(e,t=!1){var i;const{r:s,u:n}=e,r=t?_t(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Yo?Yo:null===(i=Ro(s))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=Ro(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=Vo(r);Yn(o,t)}if(s){const e=Wo(s);Yn(o,e)}return o}function Qo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ea(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const ta={flags:gn,surveys:tn},ia=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sa=e=>`${e}_cookie_identity_change_pending`,na=e=>{let t="",i=0;for(const s of e){const e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},ra="main",oa=[Hs,zs,Vs,Ws,Gs,gn,Ks,Zs],aa=e=>-1!==oa.indexOf(e),la=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},ca=e=>{if(!e)return{};const t=JSON.parse(e);return A(t)?t:{}},ua=(e,t)=>{Kn(e,(i,s)=>{const n=Co(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};var da=class{constructor(e,t,i=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=i,this.props={},this.sl=void 0,this.rl=(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.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&ts.info("Persistence loaded",e.persistence,Ot({},this.props)),this.update_config(e,e,t),this.save(),a){const e=()=>this.flush();ir(a,"beforeunload",e,{capture:!1}),ir(a,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==a?void 0:a.localStorage))&&e.key)if(e.key!==this.rl){if(this.Zo){const t=Oo.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,ra)},ir(a,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this.Ko.get(e);if(!aa(e)||!0===i)return;if(!0===t)return void this.dl(e,!0);const s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this.dl(e,s)})}onCrossTabFeatureFlagChange(e){return this.il.add(e),()=>this.il.delete(e)}destroy(){this.ul&&a&&(a.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(e,t,i=!0){if(this.pi)return!1;let s,n;try{if(n=_r.Ot(e),B(n)){const e=this.vl(t);return e.storageValue=null,t!==ra&&(e.persisted=!1),!1}s=ca(n)}catch(e){return!1}const r=t===ra?s:_r.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(s,t,i);return t===ra&&this.Zo&&!la(this.gl().main,s)||this.ml(s,t,!0,n),o}fl(e){const t=this.props[us],i=e[us];return!D(t)&&!D(i)&&t!==i}ml(e,t,i,s){const n=this.vl(t);n.storageValue=s,t!==ra&&(n.persisted=i);try{n.fingerprint=this.yl(e,t)}catch(e){n.fingerprint=void 0}}pl(e,t,i){let s=!1;return oa.forEach(i=>{var n;const r=null===(n=Co(i))||void 0===n?void 0:n.storageGroup;if(t===ra&&this.Zo&&r||t!==ra&&r!==t)return;const o=i in e,a=this.bl(i,o?e[i]:void 0),l=this.Ko.has(i)?i in this.props:o;l===i in this.props&&la(a,this.props[i])||(l?this._l(i,a,!1):this.wl(i,!1),s=!0)}),s&&i&&this.il.forEach(e=>e()),s}kl(){if(!this.Vo)return!1;try{this.tl=!1;const e=_r.Ot(this.rl),t=this.vl(ra);let i,s=!1,n=!1;if(e!==t.storageValue)if(B(e))t.storageValue=null;else{if(i=ca(e),this.tl=!this.Yo&&this.fl(i),this.tl)return!1;n=this.pl(i,ra,!1),!this.Zo||la(this.gl().main,i)?this.ml(i,ra,!0,e):t.storageValue=e,s=!0}return this.Zo&&Oo.forEach(e=>{const t=_r.Ot(this.hl(e)),r=this.vl(e),o=i||{},a=s&&oa.some(t=>{var i;return(null===(i=Co(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(B(t))return r.storageValue=null,r.persisted=!1,void(a&&(n=this.pl(o,e,!1)||n));const l=ca(t);n=this.pl(l,e,!1)||n,this.ml(l,e,!0,t)}),n}catch(e){return!1}}dl(e,t){this.Ko.set(e,t);const i=Co(e);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||ra).fingerprint=void 0,this.Sl(e))}xl(){oa.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{const e=_r.Ot(this.rl),t=ca(e);this.vl(ra).storageValue=e,oa.forEach(e=>{var i;const s=this.Zo?null===(i=Co(e))||void 0===i?void 0:i.storageGroup:void 0,n=s?_r.Ot(this.hl(s)):null;if(s){const e=this.vl(s);e.storageValue=n,e.persisted=!B(n)}const r=s&&!B(n)?ca(n):t;e in this.props?this.Cl(e,r[e],this.props[e]):e in r&&this.dl(e,!0)})}catch(e){}}bl(e,t){const i=this.Ko.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const s=new Set(I(t)?t:[]),n=new Set(I(this.props[e])?this.props[e]:[]);return i.forEach(e=>n.has(e)?s.add(e):s.delete(e)),Array.from(s)}const s=A(t)?Ot({},t):{},n=A(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in n?s[e]=n[e]:delete s[e]}),s}Cl(e,t,i){if(!aa(e))return;const s=this.Ko.get(e);if(!0===s)return;let n=t;if(this.Vo)try{var r;const t=this.Zo?null===(r=Co(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this.hl(t):this.rl;n=ca(_r.Ot(i))[e]}catch(e){}const o=new Set(s||[]);if("$active_feature_flags"===e){if(!D(t)&&!I(t)||!D(n)&&!I(n)||!I(i))return void this.dl(e,!0);const s=new Set(t||[]),r=new Set(n||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!A(i))return void(la(n,i)?this.Ko.delete(e):this.dl(e,!0));{if(!D(t)&&!A(t)||D(t)&&L(i)&&D(n))return void this.dl(e,!0);const s=A(t)?t:{},r=A(n)?n:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&la(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&la(r[e],i[e])&&o.delete(e)})}}o.size?this.dl(e,o):this.Ko.delete(e)}$l(){var e;const t=null===(e=this.Mr)||void 0===e?void 0:e.persistence_save_debounce_ms;return H(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(e)try{const t=Er(e,this.Mr.cookie_persisted_properties||[]),i=Sr(t,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=fr.Ot(this.rl)||void 0;n&&Pr(this.rl,n)===s&&(this.Il=s,this.Ml=n)}catch(e){}else try{const e=fr.Ot(this.rl)||void 0;this.Il=e?Pr(this.rl,e):void 0,this.Ml=e}catch(e){}}syncCookieProperties(){return this.El(this.Mr)}El(e,t=!1){if(this.pi&&!t||this.Jo||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=fr.Ot(this.rl)||void 0}catch(e){}if(!i||i===this.Ml)return!1;const s=Pr(this.rl,i);let n;try{n=xr(JSON.parse(i))}catch(e){return!1}if((fr.Ot(this.rl)||void 0)!==i)return!1;this.Il=s,this.Ml=i;const r=kr(this.rl,i),o=[...yr,...r.properties],a={};if(Object.keys(n).forEach(e=>{const t=n[e];(D(t)||B(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete n[e])}),L(n))return!1;const l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,u=c[us],d=c[_n],h=Yn({},c);[...yr,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in n)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===yr.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Yn(h,n),oa.forEach(e=>{const t=e in this.props;e in c===t&&la(c[e],this.props[e])||(t?this.Cl(e,c[e],this.props[e]):this.dl(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._l(_n,Nn);const p=this.props[us],v=this.props[_n];return!l||p===u&&v===d||(this.Yo=!0,this.Qo=!0,Fr.At(sa(this.rl),!0),this.wl(Zs),this.wl(zs),this.wl(Hs),this.wl(Vs),this.wl(Ws),this.wl(Gs),this.wl(gn),this.wl(fn),this.wl(pn),"anonymous"!==v||"identified"!==d&&"anonymous"!==n.$user_state&&(D(u)||p===u)||(ua(this.props,n),this.wl(Xs)),"identified"===v?this.props.$user_id=p:delete this.props.$user_id,this.wl(ps)),!0}consumeCookieIdentityChange(){const e=sa(this.rl),t=this.Qo||!!Fr.Ot(e);return this.Qo=!1,t&&Fr.Lt(e),t}Pl(e=!1){return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(D(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[ra],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():D(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===ia.indexOf(e.persistence.toLowerCase())&&(ts.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((e=[],t=!1)=>{const i=[...yr,...e];return Ot(Ot({},_r),{},{Dt(e){try{let n,r={};try{n=fr.Ot(e)||void 0,r=n?xr(JSON.parse(n)):{}}catch(e){}const o=JSON.parse(_r.Ot(e)||"{}");let a;if(t){const t=kr(e,n),l=[...yr,...t.properties],c={};Object.keys(r).forEach(e=>{const t=r[e];B(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var s;const e=o[us],n=null!==(s=o.$user_state)&&void 0!==s?s:Nn;i.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const i=o[e];(t.isValid||-1===yr.indexOf(e)||!1!==i&&0!==i)&&delete o[e]}}),!u||"$user_state"in r||"$user_state"in o||(o[_n]=Nn),!u||("distinct_id"in c?c[us]:o[us])===e&&("$user_state"in c?c[_n]:o[_n])===n||(mr.forEach(e=>delete o[e]),"identified"===c.$user_state&&"distinct_id"in c?o.$user_id=c[us]:delete o.$user_id,"identified"!==c.$user_state&&(delete o[Qs],delete o[Xs]),delete o.__alias)}a=Yn(o,c)}else a=Yn(r,o);return _r.At(e,a),a}catch(e){}return null},At(i,s,n,r,o,a){const l=_r.At(i,s,void 0,void 0,a);try{const c=Er(s,e);if(Object.keys(c).length){if(t){const t=br(i),u=Sr(c,e);if(fr.At(t,u,n,r,o,a),fr.Ot(t)!==JSON.stringify(u)){fr.Lt(t,r);const e=Er(s);return fr.At(i,e,n,r,o,a),l}}fr.At(i,c,n,r,o,a)}}catch(i){_r.Pt(i)}return l},Lt(e,t){try{null==a||a.localStorage.removeItem(e),fr.Lt(e,t),fr.Lt(br(e),t)}catch(e){_r.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let i,s=!1,n=!1;const r=e.persistence.toLowerCase();return"localstorage"===r&&_r.Et()?(i=_r,n=!0):"localstorage+cookie"===r&&t.Et()?(i=t,n=!0,s=!0):"sessionstorage"===r&&Fr.Et()?i=Fr:"memory"===r?i=Or:"cookie"===r&&fr.Et()?(i=fr,s=!0):t.Et()?(i=t,n=!0,s=!0):fr.Et()?(i=fr,s=!0):i=Or,this.Vo=n,this.Go=s,i}hl(e){return`${this.rl}__${e}`}ll(e){return this.Vo&&!!e.split_storage}properties(){const e={};return Kn(this.props,(t,i)=>{const s=Co(i);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.pi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=t?_r.Dt(this.rl):null;let s={};if(t)try{s=xr(fr.Dt(this.rl)),Kn(s,(e,t)=>{(D(e)||B(e)||""===e)&&delete s[t]})}catch(e){}const n=this.Fo.Dt(this.rl);if(n&&(this.props=Yn({},n)),this.Zo&&this.Dl(),t&&n){var r,o;const e=null==i?void 0:i[us],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Nn,a=n[us],l=null!==(o=n.$user_state)&&void 0!==o?o:Nn;if(a!==e||l!==t){this.Qo=!0,Fr.At(sa(this.rl),!0);const i=Yn({},this.props);mr.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(D(e)||a===e)||(ua(i,s),delete i[Xs]),this.props=i;const n=new Set;mr.forEach(e=>{var t;const i=null===(t=Co(e))||void 0===t?void 0:t.storageGroup;i&&n.add(i)}),n.forEach(e=>{const t={};Kn(this.props,(i,s)=>{var n;(null===(n=Co(s))||void 0===n?void 0:n.storageGroup)===e&&(t[s]=i)}),L(t)?(_r.Lt(this.hl(e)),this.Wo[e]={}):_r.At(this.hl(e),t)&&(this.Wo[e]={persisted:!0,fingerprint:this.yl(t,e)})})}}Fr.Ot(sa(this.rl))&&(this.Qo=!0)}Dl(){for(const e of Oo){const t=_r.Dt(this.hl(e));if(t&&!L(t)){const i=this.vl(e);i.persisted=!0,this.Ll(e)||(i.fingerprint=this.yl(t,e)),this.Nl(e,t)||Yn(this.props,t)}}}Ll(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Co(t))||void 0===i?void 0:i.storageGroup)===e})}Nl(e,t){const i=ta[e];if(!i)return!1;const s=t[i],n=this.props[i];return H(s)&&H(n)&&n>s}refreshKey(e){var t;if(this.pi)return;if("$fbc_persistence"===e&&this.el)return;const i=this.Zo?null===(t=Co(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?_r.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(s&&e in s)this._l(e,s[e],!1);else{if(i){const t=this.Fo.Dt(this.rl);if(t&&e in t)return void this._l(e,t[e],!1)}this.wl(e,!1)}}save(){if(this.pi)return;const e=this.$l();e>0?D(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){D(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(e=!1){if(this.pi||this.Jo&&!e)return;e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(gs));const t=!e&&!this.Xo;t||(this.tl=!1);const i=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&ts.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(e=>e()));const s=this.jl(this.Fo,this.rl,this.props,ra);"written"===s&&this.Tl(this.props),"failed"!==s&&(this.Ko.clear(),this.Yo=!1,this.el=!1),i&&this.il.forEach(e=>e())}ql(){const{main:e,groups:t}=this.gl(),i=this.jl(this.Fo,this.rl,e,ra);"written"===i&&this.Tl(e),"failed"!==i&&(this.Yo=!1,this.el=!1,oa.forEach(e=>{var t;(null===(t=Co(e))||void 0===t?void 0:t.storageGroup)||this.Ko.delete(e)}));for(const e of Oo){var s;const i=t[e];if(L(i)&&!(null===(s=this.Wo[e])||void 0===s?void 0:s.persisted)){oa.forEach(t=>{var i;(null===(i=Co(t))||void 0===i?void 0:i.storageGroup)===e&&this.Ko.delete(t)});continue}const n=this.jl(_r,this.hl(e),i,e);"failed"!==n&&oa.forEach(t=>{const i=Co(t);(null==i?void 0:i.storageGroup)!==e||"written"!==n&&i.volatile||this.Ko.delete(t)})}}gl(){const e={},t={flags:{},surveys:{}};return Kn(this.props,(i,s)=>{var n;const r=null===(n=Co(s))||void 0===n?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}yl(e,t){if(t===ra)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const i={};return Kn(e,(e,t)=>{var s;i[t]=(null===(s=Co(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}jl(e,t,i,s){const n=this.vl(s);if(s!==ra&&!n.dirty&&!D(n.fingerprint))return"skipped";let r;try{if(r=this.yl(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e.At(t,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,s!==ra&&(n.persisted=!0),D(r)||(n.fingerprint=r),this.Vo&&(n.storageValue=_r.Ot(t)),"written"):(this.Mr.debug&&ts.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),D(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!e&&this.nl)for(const e of Oo)_r.Lt(this.hl(e));e?delete this.Wo[ra]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(A(e)){this.syncCookieProperties(),D(t)&&(t="None"),this.Bl=D(i)?this.Ul:i;let s=!1;if(Kn(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._l(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(A(e)){this.syncCookieProperties(),this.Bl=D(t)?this.Ul:t;let i=!1;if(Kn(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||A(t)||I(t))&&(this._l(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this.wl(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==u?void 0:u.URL;if(e===this.sl)return;const t=qo(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!L(Xn(t));return i&&this.register(t),this.sl=e,i?t:void 0}update_search_keyword(){this.register((function(){const e=null==u?void 0:u.referrer;return e?Wo(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Jo(),$referring_domain:(null==u?void 0:u.referrer)&&(null===(e=Ro(u.referrer))||void 0===e?void 0:e.host)||Yo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Zo(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[xn]:this.Go?{r:na(e.r),u:e.u?na(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Kn([wn,bn],t=>{const i=this.props[t];i&&Kn(i,function(t,i){e["$initial_"+M(i)]=t})});const t=this.props[xn];if(t){const i=(function(e,t=!1){const i=Xo(e,t),s={};return Kn(i,function(e,t){s[`$initial_${M(t)}`]=e}),s})(t,this.Mr.disable_capture_url_hashes);Yn(e,i)}return e}safe_merge(e){return Kn(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.pi&&!a;a||this.El(t,l),this.Mr=e,!a&&(s||n||o)&&(this.Il=void 0,this.Ml=void 0,this.El(Ot(Ot({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this.ol(e):this.Fo;this.Wl();const u=this.ll(e),d=r||u!==this.Zo,h=!a&&(d||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(l);this.Xo=d;try{if(this.Ul=this.Bl=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this.Fo=c,this.Zo=u,this.props=e,this.save()}else o&&(this.Fo=c,a||(delete this.Wo[ra],this.Fl()))}finally{this.Xo=!1,h&&this.Ol()}}Wl(){const e=this.props[xn];if(!this.Go||!A(e)||"string"!=typeof e.r)return;const t=na(e.r),i="string"==typeof e.u?na(e.u):e.u;t===e.r&&i===e.u||this._l(xn,Ot(Ot({},e),{},{r:t,u:i}))}set_disabled(e){this.pi=e,this.pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this._l(_s,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return D(i)||(delete t[e],this._l(_s,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._l(e,t),this.save()}_l(e,t,i=!0){var s;const n=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||n===t||(this.Yo=!0),"$fbc_persistence"!==e||la(n,t)||(this.el=!0),this.Cl(e,n,t),(null===(s=Co(e))||void 0===s?void 0:s.volatile)||this.Sl(e))}wl(e,t=!0){delete this.props[e],t&&(aa(e)&&this.dl(e,!0),"$fbc_persistence"===e&&(this.el=!0),this.Sl(e))}Sl(e){var t;const i=null===(t=Co(e))||void 0===t?void 0:t.storageGroup;i&&(this.vl(i).dirty=!0)}vl(e){return this.Wo[e]||(this.Wo[e]={})}};const ha={GZipJS:"gzip-js",Base64:"base64"},pa={Activation:"events",Cancellation:"cancelEvents"},va={Button:"button",Tab:"tab",Selector:"selector"},fa={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"},ga={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},_a={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ma={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},ya={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ba={Once:"once",Recurring:"recurring",Always:"always"},wa={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},xa={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"},Ea={Popover:"popover",Inline:"inline"};function $a(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&R(i.then)&&i.then(void 0,()=>{})}}}}const Sa={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},ka={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"},Pa={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"},Ma=is("[RateLimiter]");var Oa=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Ma.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ma.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(H(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Vl(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(e){const t=this.instance.config.property_denylist;return!I(t)||!t.includes(e)}Zl(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==d?void 0:d.pathname))return`${null!==(e=d.origin)&&void 0!==e?e:""}${d.pathname}`}Vl(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Zl(),o=this.Gl("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const Ta=is("[RemoteConfig]");var Fa=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=y._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}Ql(e){var t,i,s;(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Jl(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 Ta.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void Ta.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return Ta.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(e=>{this.Kl(e.json,e)});this.Kl(e)})}catch(e){Ta.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(0===t.statusCode?t.error||Ta.warn("Failed to fetch remote config from PostHog."):Ta.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(e){Ta.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){Ta.error("Error loading feature flags",e)}}};const Ca=["fatal","error","warning","log","info","debug"];var Ia=Uint8Array,Ra=Uint16Array,Aa=Uint32Array,La=new Ia([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]),Da=new Ia([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]),Na=new Ia([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ja=function(e,t){for(var i=new Ra(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Aa(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},Ba=ja(La,2),Ua=Ba[1];Ba[0][28]=258,Ua[258]=28;for(var Ha=ja(Da,0)[1],za=new Ra(32768),qa=0;32768>qa;++qa){var Va=(43690&qa)>>>1|(21845&qa)<<1;za[qa]=((65280&(Va=(61680&(Va=(52428&Va)>>>2|(13107&Va)<<2))>>>4|(3855&Va)<<4))>>>8|(255&Va)<<8)>>>1}var Wa=function(e,t,i){for(var s=e.length,n=0,r=new Ra(t);s>n;++n)++r[e[n]-1];var o,a=new Ra(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new Ra(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[za[d]>>>l]=c}else for(o=new Ra(s),n=0;s>n;++n)o[n]=za[a[e[n]-1]++]>>>15-e[n];return o},Ga=new Ia(288);for(qa=0;144>qa;++qa)Ga[qa]=8;for(qa=144;256>qa;++qa)Ga[qa]=9;for(qa=256;280>qa;++qa)Ga[qa]=7;for(qa=280;288>qa;++qa)Ga[qa]=8;var Ka=new Ia(32);for(qa=0;32>qa;++qa)Ka[qa]=5;var Ya=Wa(Ga,9,0),Ja=Wa(Ka,5,0),Za=function(e){return(e/8|0)+(7&e&&1)},Xa=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Ra?Ra:e instanceof Aa?Aa:Ia)(i-t);return s.set(e.subarray(t,i)),s},Qa=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},el=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},tl=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Ia(0),0];if(1==n){var o=new Ia(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new Ra(h+1),v=il(i[u-1],p,0);if(v>t){s=0;var f=0,g=v-t,_=1<<g;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;f+=_-(1<<v-p[m]),p[m]=t}for(f>>>=g;f>0;){var y=r[s].s;t>p[y]?f-=1<<t-p[y]++-1:++s}for(;s>=0&&f;--s){var b=r[s].s;p[b]==t&&(--p[b],++f)}v=t}return[new Ia(p),v]},il=function(e,t,i){return-1==e.s?Math.max(il(e.l,t,i+1),il(e.r,t,i+1)):t[e.s]=i},sl=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Ra(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},nl=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},rl=function(e,t,i){var s=i.length,n=Za(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ol=function(e,t,i,s,n,r,o,a,l,c,u){Qa(t,u++,i),++n[256];for(var d=tl(n,15),h=d[0],p=d[1],v=tl(r,15),f=v[0],g=v[1],_=sl(h),m=_[0],y=_[1],b=sl(f),w=b[0],x=b[1],E=new Ra(19),$=0;m.length>$;++$)E[31&m[$]]++;for($=0;w.length>$;++$)E[31&w[$]]++;for(var S=tl(E,7),k=S[0],P=S[1],M=19;M>4&&!k[Na[M-1]];--M);var O,T,F,C,I=c+5<<3,R=nl(n,Ga)+nl(r,Ka)+o,A=nl(n,h)+nl(r,f)+o+14+3*M+nl(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(R>=I&&A>=I)return rl(t,u,e.subarray(l,l+c));if(Qa(t,u,1+(R>A)),u+=2,R>A){O=Wa(h,p,0),T=h,F=Wa(f,g,0),C=f;var L=Wa(k,P,0);for(Qa(t,u,y-257),Qa(t,u+5,x-1),Qa(t,u+10,M-4),u+=14,$=0;M>$;++$)Qa(t,u+3*$,k[Na[$]]);u+=3*M;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for($=0;j.length>$;++$)Qa(t,u,L[B=31&j[$]]),u+=k[B],B>15&&(Qa(t,u,j[$]>>>5&127),u+=j[$]>>>12)}}else O=Ya,T=Ga,F=Ja,C=Ka;for($=0;a>$;++$)if(s[$]>255){var B;el(t,u,O[257+(B=s[$]>>>18&31)]),u+=T[B+257],B>7&&(Qa(t,u,s[$]>>>23&31),u+=La[B]);var U=31&s[$];el(t,u,F[U]),u+=C[U],U>3&&(el(t,u,s[$]>>>5&8191),u+=Da[U])}else el(t,u,O[s[$]]),u+=T[s[$]];return el(t,u,O[256]),u+T[256]},al=new Aa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ll=(new Ia(0),(function(){for(var e=new Aa(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})()),cl=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function ul(e,t){void 0===t&&(t={});var i=(function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=ll[255&i^t[s]]^i>>>8;e=i},d:()=>4294967295^e}})(),s=e.length;i.p(e);var n,r,o,a,l=(a=10+((n=t).filename&&n.filename.length+1||0),(function(e,t,i,s,n,r){var o=e.length,a=new Ia(s+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(s,a.length-8),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=rl(l,c,e.subarray(u,d)):(l[u]=r,c=rl(l,c,e.subarray(u,o)))}else{for(var h=al[t-1],p=h>>>13,v=8191&h,f=(1<<i)-1,g=new Ra(32768),_=new Ra(f+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&f},w=new Aa(25e3),x=new Ra(288),E=new Ra(32),$=0,S=0,k=(u=0,0),P=0,M=0;o>u;++u){var O=b(u),T=32767&u,F=_[O];if(g[T]=F,_[O]=T,u>=P){var C=o-u;if(($>7e3||k>24576)&&C>423){c=ol(e,l,0,w,x,E,S,k,M,u-M,c),k=$=S=0,M=u;for(var I=0;286>I;++I)x[I]=0;for(I=0;30>I;++I)E[I]=0}var R=2,A=0,L=v,D=T-F&32767;if(C>2&&O==b(u-D))for(var N=Math.min(p,C)-1,j=Math.min(32767,u),B=Math.min(258,C);j>=D&&--L&&T!=F;){if(e[u+R]==e[u+R-D]){for(var U=0;B>U&&e[u+U]==e[u+U-D];++U);if(U>R){if(R=U,A=D,U>N)break;var H=Math.min(D,U-2),z=0;for(I=0;H>I;++I){var q=u-D+I+32768&32767,V=q-g[q]+32768&32767;V>z&&(z=V,F=q)}}}D+=(T=F)-(F=g[T])+32768&32767}if(A){w[k++]=268435456|Ua[R]<<18|Ha[A];var W=31&Ua[R],G=31&Ha[A];S+=La[W]+Da[G],++x[257+W],++E[G],P=u+R,++$}else w[k++]=e[u],++x[e[u]]}}c=ol(e,l,r,w,x,E,S,k,M,u-M,c)}return Xa(a,0,s+Za(c)+8)})(r=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,a,0,!0)),c=l.length;return(function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&cl(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}})(l,t),cl(l,c-8,i.d()),cl(l,c-4,s),l}const dl=!!p||!!h,hl=new WeakMap,pl="text/plain";let vl=!1;const fl=(e,t)=>{const[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},gl=(e,t,i=!0)=>{var s;const[n,r]=e.split("?"),o=Ot({},t),a=null!==(s=null==r?void 0:r.split("&").map(e=>{var t;const[s,n]=e.split("="),r=i&&null!==(t=o[s])&&void 0!==t?t:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],l=(function(e,t="&"){let i,s;const n=[];return Kn(e,function(e,t){D(e)||D(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),n[n.length]=s+"="+i)}),n.join(t)})(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},_l=e=>{if(e.Yl)return e.Yl;const{data:t,compression:i}=e;if(!t)return;if(i===ha.GZipJS){const e=ul((function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Ia(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},r=0;t>r;++r){if(s+5>i.length){var o=new Ia(s+8+(t-r<<1));o.set(i),i=o}var a=e.charCodeAt(r);128>a?n(a):2048>a?(n(192|a>>>6),n(128|63&a)):a>55295&&57344>a?(n(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++r))>>>18),n(128|a>>>12&63),n(128|a>>>6&63),n(128|63&a)):(n(224|a>>>12),n(128|a>>>6&63),n(128|63&a))}return Xa(i,0,s)})(Io(t)),{mtime:0});return{contentType:pl,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===ha.Base64){const e=(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e})(Io(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:Io(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=Io(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},ml=e=>{const t=()=>"sendBeacon"===e.transport?{url:gl(e.url,{compression:ha.Base64}),encodedBody:_l(Ot(Ot({},e),{},{compression:ha.Base64,Yl:void 0}))}:{url:fl(e.url,"compression"),encodedBody:_l(Ot(Ot({},e),{},{compression:void 0,Yl:void 0}))};let i;try{i=_l(e)}catch(i){if(wi(e.compression,Ao(e.url,"compression")))return ts.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&wi(e.compression,Ao(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?bi(new Uint8Array(s)):ArrayBuffer.isView(s)&&bi(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(vl=!0,t()):{url:e.url,encodedBody:i};var s},yl=e=>{try{return ml(e)}catch(i){var t;return ts.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},bl=(function(){var e=ie(function*(e){const t=yield(function(e){return Pi.apply(this,arguments)})(Io(e.data),ls.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return Ot(Ot({},e),{},{Yl:{contentType:pl,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),wl=/Failed to fetch|NetworkError|Load failed/i,xl=e=>"TypeError"===(null==e?void 0:e.name)&&wl.test((null==e?void 0:e.message)||""),El=e=>{const t=yl(e);if(!t)return;const i=new p;hl.set(i,!0);const{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);const{contentType:r,body:o}=null!=n?n:{};Kn(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,s)}},i.send(o)},$l=e=>{const t=yl(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},a=new Headers;Kn(e.headers,function(e,t){a.append(t,e)}),n&&a.append("Content-Type",n);let l=null,c=!1;if(v){const t=new v;l={signal:t.signal,timeout:setTimeout(()=>{var i;c=!0,t.abort(gt("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))},e.timeout)}}const u=t=>{var i;c&&"AbortError"===(null==t?void 0:t.name)||xl(t)?ts.warn(t):ts.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t})};try{h(i,Ot({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&!e.ta&&52428.8>(o||0),body:r,signal:null==l?void 0:l.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s;const n={statusCode:t.status,text:i};if(200===t.status)try{n.json=JSON.parse(i)}catch(e){ts.error(e)}null===(s=e.callback)||void 0===s||s.call(e,n)})).catch(u).finally(()=>l?clearTimeout(l.timeout):null)}catch(e){l&&clearTimeout(l.timeout),u(e)}},Sl=e=>{try{var t;const{url:i,encodedBody:s}=ml(e),{contentType:n,body:r,estimatedSize:o}=null!=s?s:{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:n});if(c.sendBeacon(i,a))return;const l=I(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(I(l)&&l.length>1&&(null!=o?o:0)>16384){const t=Math.ceil(l.length/2),i=t=>I(e.data)?t:Ot(Ot({},e.data),{},{batch:t});return Sl(Ot(Ot({},e),{},{data:i(l.slice(0,t))})),void Sl(Ot(Ot({},e),{},{data:i(l.slice(t))}))}ts.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${h?"fetch":"XHR"}`),h?$l(Ot(Ot({},e),{},{ta:!0})):El(e)}catch(e){ts.warn("Beacon send failed",e)}},kl=(e,t,i,s)=>{const n="query"===s?"POST"===t?"sent_at":"_":void 0;return gl(i===ha.GZipJS?fl(e,"compression"):e,Ot(Ot({},n?{[n]:Date.now().toString()}:{}),i===ha.GZipJS?{}:{compression:i}))},Pl=(()=>{const e=[];return h&&e.push({transport:"fetch",method:$l}),p&&e.push({transport:"XHR",method:El}),(null==c?void 0:c.sendBeacon)&&e.push({transport:"sendBeacon",method:Sl}),e})();var Ml=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=re((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,ts.createLogger("flush interval"),3e3),this.sa=e}enqueue(e){this.ia.push(e),this.ra||this.oa()}unload(){this.la();const e=this.ia.length>0?this.aa():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ua(Ot(Ot({},e),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const e=this.aa();for(const t in e)this.ua(e[t])}},this.na))}ua(e){try{this.sa(e)}catch(e){ts.error(e)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const e={};return Kn(this.ia,t=>{var i;const s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");D(e[n])&&(e[n]=Ot(Ot({},s),{},{data:[]})),null===(i=e[n].data)||void 0===i||i.push(s.data)}),this.ia=[],e}};const Ol=["retriesPerformedSoFar"];var Tl=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!D(a)&&"onLine"in a.navigator){if(this.da=a.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},ir(a,"online",this.va),ir(a,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,i=Ti(e,Ol);z(t)&&(i.url=gl(i.url,{retry_count:t})),this._instance._send_request(Ot(Ot({},i),{},{callback:e=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.Ls(Ot({retriesPerformedSoFar:t},i));0===e.statusCode&&ts.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=t?t:0} retries.`)}null===(s=i.callback)||void 0===s||s.call(i,e)}}))}Ls(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const i=(function(e){const t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),n=(Math.random()-.5)*(s-i);return Math.ceil(s+n)})(t),s=Date.now()+i;this.ia.push({retryAt:s,requestOptions:e});let n=`Enqueued failed request for retry in ${i}`;navigator.onLine||(n+=" (Browser is offline)"),ts.warn(n),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const e=Date.now(),t=[],i=this.ia.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ia=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,D(a)||(this.va&&(a.removeEventListener("online",this.va),this.va=void 0),this.pa&&(a.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:e}of this.ia)try{this._instance._send_request(Ot(Ot({},e),{},{transport:"sendBeacon"}))}catch(e){ts.error(e)}this.ia=[]}},Fl=class{constructor(e){this._instance=e,this.ya=()=>{var e,t,i,s;this.ba||(this.ba={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=r+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(e=this.ba.maxScrollY)&&void 0!==e?e:0),this.ba.maxScrollHeight=Math.max(o,null!==(t=this.ba.maxScrollHeight)&&void 0!==t?t:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(l,null!==(s=this.ba.maxContentHeight)&&void 0!==s?s:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const e=this.ba;return this.ba=void 0,setTimeout(this.ya,0),e}startMeasuringScrollPosition(){ir(a,"scroll",this.ya,{capture:!0}),ir(a,"scrollend",this.ya,{capture:!0}),ir(a,"resize",this.ya)}scrollElement(){if(this._a){const t=I(this._a)?this._a:[this._a];for(const i of t){var e;const t=null==a||null===(e=a.document)||void 0===e?void 0:e.querySelector(i);if(t)return t}return}var t;return null==a||null===(t=a.document)||void 0===t?void 0:t.documentElement}wa(e){var t,i;const s="y"===e?"scrollTop":"scrollLeft";if(this._a){const e=this.scrollElement();return e&&e[s]||0}return a?"y"===e?a.scrollY||a.pageYOffset||(null===(t=a.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.scrollTop)||0:a.scrollX||a.pageXOffset||(null===(i=a.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const Cl=e=>Zo(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var Il=class{constructor(e,t,i,s){this.je=e=>{const t=this.ka();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this.Sa(this._instance)};this.xa.register({[mn]:i})},this._instance=e,this.Ca=t,this.xa=i,this.Sa=s||Cl,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[mn]}getSetOnceProps(){var e;const t=null===(e=this.ka())||void 0===e?void 0:e.props;return t?"r"in t?Xo(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return Kn(Xn(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${M(i)}`]=t}),e}},Rl=class{on(e,t){return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),()=>{this.$a[e]=this.$a[e].filter(e=>e!==t)}}emit(e,t){for(const i of this.$a[e]||[])i(t);for(const i of this.$a["*"]||[])i(e,t)}constructor(){this.$a={}}};const Al=is("[SessionId]"),Ll=864e5;var Dl=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,i){var s;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Rl,this.Aa=(e,t)=>!(!z(e)||!z(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.xa=e.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||ur,this.Da=i||ur;const n=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*re(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Al.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+n+"_window_id",this.qa="ph_"+n+"_primary_window_exists",this.ja()){const e=Fr.Dt(this.Na),t=Fr.Dt(this.qa);e&&!t?this.Be=e:Fr.Lt(this.Na),Fr.At(this.qa,!0)}(null===(s=this.Mr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return D(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Fr.Et()}Ha(e){e!==this.Be&&(this.Be=e,this.ja()&&Fr.At(this.Na,e))}za(){return this.Be?this.Be:this.ja()?Fr.Dt(this.Na):null}Ua(e){const t=this.Ia;return!B(t)&&!B(e)&&5e3>Math.abs(e-t)}Wa(e,t,i){const s=t!==this._sessionActivityTimestamp,n=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,n&&!s||n&&this.Ua(t)||(this.Ia=t,this.xa.register({[As]:[t,e,i]}))}Va(){var e;const t=null===(e=this.Mr)||void 0===e?void 0:e.persistence_save_debounce_ms;return z(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(As):(this.xa.flush(),this.xa.load())}Za(){var e;if(B(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,t,i]=this.Qa();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[As]:[this._sessionActivityTimestamp,null!==(e=this.Xt)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[e]=this.Qa(),t=z(e)?e:0,i=z(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}Ka(e){return this.Ga(),this.Aa(e,this.Ja())}Qa(){const e=this.xa.props[As];return I(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void Al.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Al.error("Invalid sessionID in bootstrap",e)}})(e);return!D(i)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:i}:this.Wa(e,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&a&&(a.removeEventListener(Hn,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Fr.Lt(this.qa)},ir(a,Hn,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||(new Date).getTime(),n=this.Xt;if(i)this.Ma=s;else if(B(this.Ma)||this.Ma>s||s-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=s}let[,a,l]=this.Qa();const c=!D(n)&&a!==n,u=this.Ja();let d=this.za();const h=this.Fa,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Ll),v=h?p:z(l)&&Math.abs(s-l)>Ll;let f=!1,g=c;const _=!a||!!h,m=a;let y=!_&&!e&&this.Aa(s,u);if(y&&(y=this.Ka(s),y||Al.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Qa()),_||y||v){g=!1;const e=h&&!p;a=e?h.sessionId:this.Oa(),d=this.Da(),Al.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:v}}),l=e?h.sessionStartTimestamp:s,this.Fa=void 0,f=!0}else d||(d=this.Da(),f=!0),g=g||a!==m,g&&(Al.info("adopted cross-tab session id",{sessionId:a,windowId:d}),f=!0);const b=z(u)&&e&&!v?u:s,w=z(l)?l:(new Date).getTime();this.Ha(d),this.Wa(a,b,w),e||this.La();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:v,crossTabAdoption:g};return f&&this.Ea.forEach(e=>e(a,d,x)),{sessionId:a,windowId:d,sessionStartTimestamp:w,changeReason:f?x:void 0,lastActivityTimestamp:u}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.La()},1.1*this.sessionTimeoutMs))}};const Nl=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&ne(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>ne(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function jl(){return(jl=ie(function*(){const e=null==c?void 0:c.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return N(i)&&i.length>0?i:void 0}catch(e){return void ts.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function Bl(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Ul(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const Hl=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},zl=e=>e.toLowerCase(),ql={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=>Hl(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Hl(t,e))),icontains:(e,t)=>t.map(zl).some(t=>e.map(zl).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(zl).every(t=>e.map(zl).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function Vl(e,t){return!e||Object.entries(e).every(([e,i])=>{const s=null==t?void 0:t[e];if(null==s)return!1;const n=ql[i.operator];return!!n&&n(i.values,[String(s)])})}function Wl(e,t,i){return Io({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const Gl="custom",Kl="i.posthog.com",Yl=/^\/static\//,Jl=["/s/","/e/","/i/"];var Zl=class{constructor(e){this.Ya={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${Kl}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ya[this.apiHost]||(this.Ya[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":Gl),this.Ya[this.apiHost]}tu(e){if(!Yl.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}eu(e){const t=Ro(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}iu(e,t,i){if("ui"===e)return i;let s=i;const n=this.instance.config.rewriteRequestPath;if(n){var r;const e=(null===(r=Ro(i))||void 0===r?void 0:r.href)||i;s=n(new URL(e)).toString()}if(n&&"api"===e&&Jl.some(e=>0===t.indexOf(e))){const e=this.eu(s);if(e){const t=this.apiHost;let i=this.nu;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===n||(i={apiHost:t,rewriteRequestPath:n,urls:new Set},this.nu=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){const t=this.nu,i=this.eu(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this.iu(e,t,this.uiHost+t);if("flags"===e)return this.iu(e,t,this.flagsApiHost+t);if("assets"===e){const i=this.tu(t);if(i)return this.iu(e,t,`${i}${t}`)}if(this.region===Gl)return this.iu(e,t,this.apiHost+t);const i=Kl+t;switch(e){case"assets":return this.iu(e,t,`https://${this.region}-assets.${i}`);case"api":return this.iu(e,t,`https://${this.region}.${i}`)}}};const Xl=is("[Surveys]"),Ql=e=>{try{const 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){Xl.error("Failed to persist survey seen state",e)}},ec=[_a.Popover,_a.Widget,_a.API],tc={ignoreConditions:!1,ignoreDelay:!1,displayType:Ea.Popover},ic=is("[PostHog ExternalIntegrations]"),sc={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var nc=class{constructor(e){this._instance=e}No(e,t){var i,s;null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return ic.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[n,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,s;r&&!(null===(t=y.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[n])&&this.No(sc[n],()=>{var e;null===(e=y.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[n])||void 0===e||e.start(this._instance)}),!r&&(null===(i=y.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&(null===(s=y.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},rc=class{constructor(e,t){this.$=e,this.po=t,this.su=new Map,this.So=!1}add(e){var t=this;return ie(function*(){if(t.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.su.set(e.name,e);try{const i=e.setup(t.po);i&&(yield i)}catch(i){const s=t.su.get(e.name)===e;s&&t.su.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.ru(e)}})()}getExtension(e){return this.su.get(e)}dispose(){if(this.So)return;this.So=!0;const e=Array.from(this.su.values()).reverse();this.su.clear();for(const t of e)this.ru(t)}ru(e){try{var t;const i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&R(i.then)&&i.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)}}},oc=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const s of e){const e=null==t?void 0:t.get_property(s);D(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};const ac="extensionsRemoteConfig";var lc=class{constructor(e){this.instance=e,this.So=!1,this.$=ts,this.ou=e.lu,this.kv=new oc(e),this.onEvent=e=>$a(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.So)return $a(()=>{});const t=t=>{try{e(t)}catch(e){this.$.error("Browser extension remote config listener failed",e)}},i=this.instance.au.on(ac,t);return this.ou&&t(this.ou),$a(i)},this.uu=new rc(ts.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property(ds);return"string"==typeof e?e:void 0}get library(){return{name:ls.LIB_NAME,version:ls.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const n=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.uu.add(e)}getExtension(e){return this.uu.getExtension(e)}capture(e,t,i){var s=this;return ie(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return $a(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(ac,e))}sendRequest(e){var t=this;return ie(function*(e,i={}){var s;const n=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),r={method:i.method,url:i.query?gl(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?E.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(r),{statusCode:202}):new Promise(e=>{r.callback=e,t.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const cc={};let uc=0;const dc=()=>{},hc='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',pc="Surveys module not available",vc="sanitize_properties is deprecated. Use before_send instead",fc="Invalid value for property_denylist config: ",gc=/^[A-Za-z0-9_-]{1,400}$/,_c=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,mc=["token","distinct_id",Sn],yc="posthog";let bc=!dl&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla"));const wc=e=>{const t={};return e&&"unset"!==e?("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},xc=e=>{var t;return Ot({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:tr(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:dc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:d&&N(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==a||null===(t=a.location)||void 0===t?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){ts.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:Bn,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:dc},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Zr,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:wc(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||"unset"===e||"2026-08-29">e)}))(e))},Ec=[["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"]],$c=e=>{const t={};for(const[i,s]of Ec)D(e[i])||(t[s]=e[i]);const i=Yn({},t,e),s=e.__preview_external_dependency_versioned_paths;return D(s)||(D(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),N(s)&&D(e.asset_host)&&(i.asset_host=s)),I(e.property_blacklist)&&(D(e.property_denylist)?i.property_denylist=e.property_blacklist:I(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:ts.error(fc+e.property_denylist)),i};var Sc=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){ts.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},kc=class e{du(e){if(!e)return;const t=this.su.indexOf(e);-1!==t&&this.su.splice(t,1)}vu(e,t){var i;return this.du(e),this.su.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this.mu)return;let t,i,s;e?(t=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="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)",i="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, 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. ${s}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const e=this.persistence;if(!e)return;this.bu()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(ur());this.register({distinct_id:t,$device_id:t}),e.set_property(_n,Nn)}this._u()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new Sc,this.Su=!1,this.version=ls.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Rl,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xc(),this.SentryIntegration=Po,this.sentryIntegration=e=>(function(e,t){const i=ko(e,t);return{name:So,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Fl(this),this.pageViewManager=new Mo(this),this.rateLimiter=new Oa(this),this.requestRouter=new Zl(this),this.consent=new Cr(this),this.externalIntegrations=new nc(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const s=N(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=N(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>ts.info(`send "${null==e?void 0:e.event}"`,e))}init(t,i,s){if(s&&s!==yc){var n;const r=null!==(n=cc[s])&&void 0!==n?n:new e;return r._init(t,i,s),cc[s]=r,cc[yc][s]=r,r}return this._init(t,i,s)}_init(e,t={},i){var s,n,r;const o=N(e)?e.trim():"";if(!o)return ts.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return o!==(null===(l=this.config)||void 0===l?void 0:l.token)?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('${o}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=xc(t.defaults),t.debug=this.Pu(t.debug),this.Ru=t,this.Au=[],t.person_profiles?this.Mu=t.person_profiles:t.process_person&&(this.Mu=t.process_person);const c=xc(t.defaults),u=$c(t),d=Yn({},c,u,{name:i,token:o});A(c.rageclick)&&A(u.rageclick)&&(d.rageclick=Yn({},c.rageclick,u.rageclick)),A(c.session_recording)&&A(u.session_recording)&&(d.session_recording=Yn({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&ts.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ha.GZipJS;const h=this.bu();if(this.persistence=new da(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new da(Ot(Ot({},this.config),{},{persistence:"sessionStorage"}),h,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Fr.Et()){const e=Fr.Dt(this.Cu);I(e)&&e.forEach(e=>{N(e)&&this.xu.add(e)})}else Fr.Lt(this.Cu);const p=Ot({},this.persistence.props),v=Ot({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Ml(e=>this.Ou(e),this.config.request_queue_config),this.Du=new Tl(this),this.__request_queue=[];const f=this.fu();f||(this.sessionManager=new Dl(this),this.sessionPropsManager=new Il(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ts.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(f)},0)):(ts.info("Initializing extensions synchronously"),this.qu(f)),ls.DEBUG=ls.DEBUG||this.config.debug,ls.DEBUG&&ts.info("Starting in debug mode",{this:this,config:t,thisC:Ot({},this.config),p:p,s:v}),this.config.identity_distinct_id&&!(null===(s=t.bootstrap)||void 0===s?void 0:s.distinctID)&&(t.bootstrap=Ot(Ot({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const g=null===(n=t.bootstrap)||void 0===n?void 0:n.distinctID;if(this.mu=!!g&&!j(g),null===(r=t.bootstrap)||void 0===r?void 0:r.distinctID){const e=t.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(_n);if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"anonymous"===s)this.identify(e);else if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"identified"===s)ts.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{const i=this.config.get_device_id(ur()),s=t.bootstrap.isIdentifiedID?i:e;this.persistence.set_property(_n,t.bootstrap.isIdentifiedID?jn:Nn),this.register({distinct_id:e,$device_id:s})}}if(f)this.register_once({distinct_id:$n,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(ur());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(_n,Nn)}return ir(a,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ir(a,"pageshow",()=>{var e;this.wu=!1,this.ku||null===(e=this.Du)||void 0===e||e.resume()}),t.segment?$o(this,()=>this.ju()):this.ju(),R(this.config._onCapture)&&this.config._onCapture!==dc&&(ts.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&ts.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 jl.apply(this,arguments)})().then(e=>{e&&this.register({[hs]:e})}).catch(dc),this}Bu(e){const t=e;return N(t.name)&&R(t.setup)}Hu(e,t){this.Bu(e)?t.push(()=>{this.zu().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{ts.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.su.push(e)}Nu(){var t,i,s;const n=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(s=e.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new n(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}qu(t){const i=performance.now(),s=Ot(Ot({},e.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d;s.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.su.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.su.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.su.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.su.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Hu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Hu(this.logs=null!==(a=this.logs)&&void 0!==a?a:new s.logs(this),n),s.metrics&&this.su.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new s.metrics(this)),s.conversations&&this.su.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new s.conversations(this)),s.productTours&&this.su.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.su.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.su.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,wo)),s.toolbar&&this.su.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new s.toolbar(this)),s.experiments&&this.su.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this.su.forEach(e=>{e.initialize&&n.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),n.push(()=>{if(this.Wu){const e=this.Wu;this.Wu=void 0,this.su.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this.Vu(n,i)}Vu(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Vu(e,t)},0);const i=e.shift();if(i)try{i()}catch(e){ts.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[kn]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Pn]:i}),this.config.__preview_deferred_init_extensions&&ts.info(`PostHog extensions initialized (${i}ms)`)}Kl(e){var t;if(!u||!u.body)return ts.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=e),this.lu=e,this.compression=void 0,e.ok){var i;const t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=k(t.supportedCompression,ha.GZipJS)?ha.GZipJS:k(t.supportedCompression,ha.Base64)?ha.Base64:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Bn}),null===(t=this.Gu)||void 0===t||t.handleRemoteConfig(e),this.su.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}ju(){try{this.config.loaded(this)}catch(e){ts.critical("`loaded` function failed",e)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==d?void 0:d.hostname)){const e=d.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new Fa(this),this.Ju.load()}Zu(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this.Fu)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&Gn(this.__request_queue,e=>this.Ou(e)),this.__request_queue=[],this.Zu()}_handle_unload(){var e,t,i,s,n,r;this.wu=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(qn),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Fu)||void 0===n||n.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(qn,null,{transport:"sendBeacon"})}_send_request(e){var t,i,s;this.__loaded?bc?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=Ot(Ot({},this.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(D(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s;const n=Ot({},e);n.timeout=n.timeout||6e4;const r=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===r&&D(n.compression)&&n.data&&(n.compression=ha.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(e=>{var t,i;const s=(I(e)?e:[e]).map(e=>Ot(Ot({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(t=null==n||null===(i=n.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(n.data):"body"===n.timestampMode&&(n.data=((e,t=(new Date).toISOString())=>I(e)?e.map(e=>Ot(Ot({},e),{},{sent_at:t})):Ot(Ot({},e),{},{sent_at:t}))(n.data))),n.url=kl(n.url,n.method,n.compression,n.timestampMode);const o=Pl.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=null!==(i=null===(s=(function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]})(o,e=>e.transport===r))||void 0===s?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");const l=e=>{try{a(e)}catch(e){var t;xl(e)?ts.warn(e):ts.error(e),null===(t=n.callback)||void 0===t||t.call(n,{statusCode:0,error:e})}};"sendBeacon"!==r&&n.data&&n.compression===ha.GZipJS&&f&&"undefined"!=typeof Promise&&!vl?bl(n).then(e=>{l(e)}).catch(t=>{if(xi(t))return vl=!0,void l(Ot(Ot({},n),{},{compression:void 0,url:kl(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return xi(e)||t===yi})(t)&&(vl=!0),l(n)}):a(n)})(Ot(Ot({},e),{},{callback:t=>{var i,s,n;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null===(s=(n=this.config).on_request_error)||void 0===s||s.call(n,t),null===(i=e.callback)||void 0===i||i.call(e,t)}}))):e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:0}))}Ou(e){this.Du?this.Du.retriableRequest(e):this._send_request(e)}_execute_array(e){uc++;try{let t;const i=[],s=[],n=[];Gn(e,e=>{if(e)if(t=e[0],I(t))n.push(e);else if(R(e))try{e.call(this)}catch(t){ts.error("Error executing queued PostHog call",e,t)}else I(e)&&"alias"===t?i.push(e):I(e)&&-1!==t.indexOf("capture")&&R(this[t])?n.push(e):s.push(e)});const r=function(e,t){Gn(e,function(e){try{if(I(e[0])){let i=t;Kn(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ts.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(s,this),r(n,this)}finally{uc--}}push(t){if(uc>0&&I(t)&&N(t[0])){const i=e.prototype[t[0]];return void(R(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}Xu(){var e;const t=null===(e=this.persistence)||void 0===e?void 0:e.get_property(gs);return N(t)&&_c.test(t)?{value:t,delivered:!1}:A(t)&&N(t.value)&&_c.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}Yu(e,t,i,s){if(!this.persistence)return;this.persistence.refreshKey(gs);const n=this.Xu();if(!s){if(i)return N(t)&&_c.test(t)?(t!==(null==n?void 0:n.value)&&this.persistence.register({[gs]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==n?void 0:n.value)||!n.delivered}):void this.persistence.unregister(gs);if(N(e)&&gc.test(e)){if((null==n?void 0:n.value.split(".")[3])===e)return{value:n.value,pending:!n.delivered};const t=`fb.1.${Date.now()}.${e}`;return this.persistence.register({[gs]:{value:t,delivered:!1}}),{value:t,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(gs)}th(e){if(!this.persistence)return;this.persistence.refreshKey(gs);const t=this.Xu();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[gs]:{value:e,delivered:!0}})}capture(e,t,i){var s,n,r,o,a,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void ts.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(D(e)||!N(e))return void ts.error("No event name provided to posthog.capture");this.yu();const c=!this.config.opt_out_useragent_filter&&this._is_bot();if(c&&!this.config.__preview_capture_bot_pageviews)return;const u=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==u?void 0:u.isRateLimited)return void ts.critical("This capture call is ignored due to client rate limiting.");let d;(null==t?void 0:t.$current_url)&&!N(null==t?void 0:t.$current_url)&&(ts.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i.eh)||ts.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&&(d=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();const h=new Date,p=(null==i?void 0:i.timestamp)||h,v=ft(null==i?void 0:i.uuid,ur);let f={uuid:v,event:e,properties:this.calculateEventProperties(e,t||{},p,v)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&c&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);const g="$feature_flag_called"===e&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!g&&(f.$set=null==i?void 0:i.$set);const _=A(null==t?void 0:t.$set)?t.$set:void 0,m=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,y=m||!!_&&"$fbc"in _,b=m?null==i||null===(s=i.$set)||void 0===s?void 0:s[fs]:null==_?void 0:_[fs],w=I(null==t?void 0:t.$unset)?t.$unset:[],x=(null==i?void 0:i.$unset)||[],E=-1!==w.indexOf("$fbc")||-1!==x.indexOf("$fbc"),$=this.Yu(null==d?void 0:d.fbclid,b,y,E);$&&!0===f.properties.$process_person_profile&&$.pending&&!y&&!g&&(f.$set=Ot({[fs]:$.value},f.$set));const S=null==i?void 0:i.$unset;S&&(f.$unset=S);const k=g?void 0:this.ih(null==i?void 0:i.$set_once,e!==Wn,e===Vn);if(k&&(f.$set_once=k),(null==i?void 0:i._noTruncate)||(P=this.config.properties_string_max_length,f=(function(e,t){const i=new Set;return(function e(s,n){if(s!==Object(s))return t?t(s):s;if(i.has(s))return;let r;if(i.add(s),I(s))r=[],Gn(s,t=>{r.push(e(t))});else{const t={};Kn(Y(s)?Qn(s):s,(s,n)=>{i.has(s)||(t[n]=e(s,n))}),r=t}return r})(e)})(f,e=>N(e)?e.slice(0,P):e)),f.timestamp=p,D(null==i?void 0:i.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=h),g&&(f.properties=((e,t=[])=>{const i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return mi.forEach(s),t.forEach(s),i})(f.properties,mc)),e===wa.DISMISSED||e===wa.SENT){const i=null==t?void 0:t[xa.SURVEY_ID],s=null==t?void 0:t[xa.SURVEY_ITERATION];Ql({id:i,current_iteration:s}),f.$set=Ot(Ot({},f.$set),{},{[Bl({id:i,current_iteration:s},e===wa.SENT?"responded":"dismissed")]:!0})}else e===wa.SHOWN&&(f.$set=Ot(Ot({},f.$set),{},{[xa.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var P;if(e===ka.SHOWN){const e=null==t?void 0:t[Pa.TOUR_TYPE];e&&(f.$set=Ot(Ot({},f.$set),{},{[`${Pa.TOUR_LAST_SEEN_DATE}/${e}`]:(new Date).toISOString()}))}const M=Ot(Ot({},f.properties.$set),f.$set);if(L(M)||this.setPersonPropertiesForFlags(M),!U(this.config.before_send)){const e=this.Os(f);if(!e)return;f=e,f.uuid=ft(f.uuid,ur)}const O=null!==(n=null===(r=f.$set)||void 0===r?void 0:r.$fbc)&&void 0!==n?n:A(null===(o=f.properties)||void 0===o?void 0:o.$set)?f.properties.$set[fs]:void 0,T=(null==$?void 0:$.pending)&&O===$.value?$.value:void 0;this.au.emit("eventCaptured",f);const F=null!==(a=null==i?void 0:i._url)&&void 0!==a?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),C="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(F),R=Ot(Ot(Ot({method:"POST",url:F,data:f,compression:"best-available",timestampMode:C?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},C&&(null===(l=f.properties)||void 0===l?void 0:l.$session_id)?{batchGroup:f.properties.$session_id}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),T?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this.th(T)}}:{});var j;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||T?(!R.transport&&!R.callback&&L(null!==(j=this.config.request_headers)&&void 0!==j?j:{})&&this.wu&&(R.transport="sendBeacon"),this.Ou(R)):this.Fu.enqueue(R),f}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this.Gu)||void 0===t?void 0:t.getExtension(e)}zu(){var e;return null!==(e=this.Gu)&&void 0!==e?e:this.Gu=new lc(this)}hu(e){this.$u.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this.$u.indexOf(e);-1!==i&&this.$u.splice(i,1)}}nh(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.xu.clear(),this.sh()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.nh();const r=n?void 0:this.persistence.remove_event_timer(e);let o=Ot({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.fu()&&(o[Sn]=!0),"$snapshot"===e){const e=Ot(Ot({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=e.distinct_id,(!N(o.distinct_id)&&!H(o.distinct_id)||j(o.distinct_id))&&ts.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}const l=(function(e,t,i,s=!1){var n,r,o,l;if(!g)return{};const c=e?[...Bo,...t||[]]:[],[u,h]=rt(g),[p,v]=(function(e){for(let t=0;ct.length>t;t++){const[i,s,n]=ct[t],r=e.match(i);if(r){const t=n&&e.match(n)||r;return[s,(null==t?void 0:t[1])||""]}}return["",""]})(g),f=(function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}})(),_={};D(i)||(_.detectGoogleSearchApp=i);const m={},y=null===(n=navigator)||void 0===n||null===(n=n.userAgentData)||void 0===n?void 0:n.platform,b=null===(r=navigator)||void 0===r?void 0:r.maxTouchPoints,x=null==a||null===(o=a.screen)||void 0===o?void 0:o.width,E=null==a||null===(l=a.screen)||void 0===l?void 0:l.height,$=null==a?void 0:a.devicePixelRatio;D(y)||(m.userAgentDataPlatform=y),D(b)||(m.maxTouchPoints=b),D(x)||(m.screenWidth=x),D(E)||(m.screenHeight=E),D($)||(m.devicePixelRatio=$);const S=Yn(Xn({$os:u,$os_version:h,$browser:tt(g,navigator.vendor,f,_),$webview_app:p,$webview_app_version:v,$device:ot(g),$device_type:at(g,m),$timezone:Qo(),$timezone_offset:ea()}),{$current_url:Lo(s?_t(null==d?void 0:d.href):null==d?void 0:d.href,c,Ho),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:st(g,navigator.vendor,f,_),$browser_language:Go(),$browser_language_prefix:Ko(),$screen_height:null==a?void 0:a.screen.height,$screen_width:null==a?void 0:a.screen.width,$viewport_height:null==a?void 0:a.innerHeight,$viewport_width:null==a?void 0:a.innerWidth,$lib:w.LIB_NAME,$lib_version:w.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return w.SDK_DIST_CHANNEL&&(S.$sdk_dist_channel=w.SDK_DIST_CHANNEL),S})(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){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0);o.$session_id=e,o.$window_id=t}this.sessionPropsManager&&Yn(o,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Yn(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null===(c=this.Du)||void 0===c?void 0:c.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}let h;if(this.requestRouter.region===Gl&&(o.$lib_custom_api_host=this.config.api_host),h="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=Yn(o,h),"$pageview"===e&&u&&(o.title=u.title),!D(r)){const e=i.getTime()-r;o.$duration=parseFloat((e/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),v=this.sessionPersistence.properties(),f=o.$groups,_=p.$groups;A(f)&&!L(f)&&(o.$groups=Ot(Ot({},A(_)?_:{}),f)),Kn(["$referrer","$referring_domain"],e=>{e in p&&delete v[e]});const m={};if(this.$u.length>0)for(const e of this.$u.slice())try{Yn(m,e())}catch(e){ts.error("Failed to produce browser extension event properties",e)}o=Yn({},l,p,v,Ot(Ot({},m),o)),o.$is_identified=this._isIdentified(),I(this.config.property_denylist)?Kn(this.config.property_denylist,function(e){delete o[e]}):ts.error(fc+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(ts.error(vc),o=y(o,e));const b=this.rh();return o.$process_person_profile=b,b&&!n&&this.oh("_calculate_event_properties"),o}ih(e,t=!0,i=!1){var s;if(!this.persistence||!this.rh())return e;if(this.Su&&!i)return e;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Yn({},n,r||{},e||{});const a=this.config.sanitize_properties;return a&&(ts.error(vc),o=a(o,"$set_once")),t&&(this.Su=!0),L(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this.nh(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this.xu.add(e)),this.sh()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this.xu.delete(e),this.sh()}ah(e,t){this.register({[e]:t})}Lu(){this.xu.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this.xu.clear(),this.sh()}sh(){var e;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)||!Fr.Et())return void Fr.Lt(this.Cu);const t=[];this.xu.forEach(e=>t.push(e)),t.length>0?Fr.At(this.Cu,t):Fr.Lt(this.Cu)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.au.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:pc}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:pc})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:pc})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=tc){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:pc}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:pc})}uh(e){return!e||j(e)?(ts.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(ts.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())||(ts.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,i){if(!this.__loaded||!this.persistence)return ts.uninitializedWarning("posthog.identify");if(H(e)&&(e=e.toString(),ts.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(e))return;if(!this.oh("posthog.identify"))return;this.yu();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.nh(!1),o=this.persistence.Pl();let a=!1;try{const s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(ps),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Nn,c=e!==s,u=!c&&o;if(c&&o){var l;const n=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(_n,jn),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(Vn,n,{$set:t||{},$set_once:i||{}}),this.Eu=Wl(e,t,i),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(u){this.persistence.set_property(_n,jn);const s=t||{},n=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:s,$set_once:n}),this.Eu=Wl(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(pn)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this.oh("posthog.setPersonProperties"))return;const i=Wl(this.get_distinct_id(),e,t);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Eu=i):ts.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(I(e)?e:[e]).filter(e=>N(e)&&e.length>0);0!==i.length&&this.oh("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(e,t,i){var s;if(!e||!t)return void ts.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.nh();const n=this.getGroups(),r=n[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Ot(Ot({},n),{},{[e]:t})}),(r||i)&&this.rh()){const s={$group_type:e,$group_key:t};i&&(s.$group_set=i),this.capture(Wn,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this.oh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=q(e)?e:null==e?void 0:e.resetDeviceID,i=q(e)||null==e?void 0:e.bootstrap;this.hh(t,!1,i)}hh(e,t=!1,i){var s,n,r,o,a,l;if(ts.info("reset"),!this.__loaded)return ts.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this.Ru)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Xl());const u=this.get_property(ds),d=this.get_property(hs),h=this.get_property(Ms);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),t||!p||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.");const v=null===(a=this.persistence)||void 0===a||null===(l=a.Pl)||void 0===l?void 0:l.call(a);let f=!1;try{var g,_,m,y,b,w,x,E,$,S,k,P,M;if(null===(g=this.persistence)||void 0===g||g.clear(),null===(_=this.sessionPersistence)||void 0===_||_.clear(),this.xu.clear(),this.sh(),D(h)||null===(S=this.persistence)||void 0===S||S.register({$session_recording_remote_config:h}),null===(m=this.surveys)||void 0===m||m.reset(),null===(y=this.featureFlags)||void 0===y||y.reset(),null===(b=this.conversations)||void 0===b||b.reset(),null===(w=this.logs)||void 0===w||w.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===($=this.sessionManager)||void 0===$||$.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$n,$device_id:null},"");else{const t=this.config.get_device_id(ur());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||D(d)||this.register({[hs]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i&&(i.distinctID&&!this.fu()&&(null===(M=this.persistence)||void 0===M||M.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(k=this.featureFlags)||void 0===k||k.initialize(),!U(c)&&!(null===(P=this.sessionManager)||void 0===P?void 0:P.setBootstrapSessionId(c,!0)))){const e=Ot({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var O,T;v&&(null===(O=this.persistence)||void 0===O||null===(T=O.Ol)||void 0===T||T.call(O,f))}this.reloadFeatureFlags()}shutdown(e){var t=this;return ie(function*(){var e,i,s,n,r,o,a,l;if(t.__loaded){t.ku=!0,t.zu().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=t.metrics)||void 0===n||n.dispose(),null===(r=t.Fu)||void 0===r||r.unload(),null===(o=t.Du)||void 0===o||o.unload();try{var c;null===(c=t.featureFlags)||void 0===c||c.destroy()}catch(e){ts.error("Error while destroying feature flags",e)}null===(a=t.persistence)||void 0===a||a.destroy(),null===(l=t.sessionPersistence)||void 0===l||l.destroy()}else ts.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i.dh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e.fh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var n;const t=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(ts.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(D(t)&&(t=this.get_distinct_id()),e!==t?(this.ah(ps,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ts.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=Ot({},this.config);if(A(e)){var i,s,n,r,o,a,l,c,u,d,h,p,v,f;Yn(this.config,$c(e));const _=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new da(Ot(Ot({},this.config),{},{persistence:"sessionStorage"}),_,!1);const m=this.Pu(this.config.debug);var g;q(m)&&(this.config.debug=m),q(this.config.debug)&&(this.config.debug?(ls.DEBUG=!0,_r.Et()&&_r.At("ph_debug",!0),ts.info("set_config",{config:e,oldConfig:t,newConfig:Ot({},this.config)})):(ls.DEBUG=!1,_r.Et()&&_r.Lt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this.Xl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(c=this.tracingHeaders)||void 0===c||c.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.deadClicksAutocapture)||void 0===p||p.startIfEnabledOrStop(),null===(v=this.surveys)||void 0===v||v.loadIfEnabled(),this._u(),null===(f=this.externalIntegrations)||void 0===f||f.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&$o(this,dc,!1)}}_overrideSDKInfo(e,t){ls.LIB_NAME=e,ls.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var s,n,r,o,a;Object.values(i).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(Ot(Ot({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.ph}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:yc;return t!==yc&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}rh(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&L(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(e){return"never"===this.config.person_profiles?(ts.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(En,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var e,t;const i=this.bu();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.gh(),(null===(e=this.persistence)||void 0===e?void 0:e.pi)!==i&&(null===(n=this.persistence)||void 0===n||n.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.fu()){var s,n,r,o,a,l;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Dl(this),this.pageViewManager=new Mo(this),this.persistence&&(this.sessionPropsManager=new Il(this,this.sessionManager,this.persistence));const t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this.lu)))}var d,h;this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(D(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ts.warn(hc)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void ts.warn(hc);const e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var t,i;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:$n,$device_id:null}),this.du(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return c?Nl(c,this.config.custom_blocked_useragents):void 0}Qu(){u&&("visible"===u.visibilityState?this.Tu||(this.Tu=!0,this.capture(zn,{title:u.title},{send_instantly:!0}),this.Iu&&(u.removeEventListener(Un,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),ir(u,Un,this.Iu)))}debug(e){!1===e?(null==a||a.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==a||a.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){const e=this.Ru||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ts.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,i,s,n){const r=t in e&&!U(e[t]),o=i in e&&!U(e[i]);return r?e[t]:!!o&&(n&&n.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,ts)}Os(e){var t;if(U(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(W),s=I(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const i of s)try{if(n=i(n),U(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return V(e.event)?ts.warn(`${t}. This can cause unexpected behavior.`):ts.info(t),null}n.properties&&!L(n.properties)||ts.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return ts.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(n.properties&&U(n.properties[t]))return ts.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var e;return null===(e=this.pageViewManager.Bo)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Pu(e){const t=q(e)&&!e,i=_r.Et()&&"true"===_r.Ot("ph_debug");return!t&&(!!i||e)}};kc.__defaultExtensionClasses={},kc.ph=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Zn(e.prototype[t[i]])})(kc,["identify"]);var Pc=class{constructor(e){this.disabled=!1===e;const t=A(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,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const Mc="$copy_autocapture",Oc=is("[AutoCapture]");function Tc(e,t){return t.length>e?t.slice(0,e)+"...":t}function Fc(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!Ar(t));return t}function Cc(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,c;if(!Ar(e))return{props:{}};const u=[e],d=new Set([e]);let h=e;for(;h.parentNode&&!Lr(h,"body")&&1e3>u.length;){if(Nr(h.parentNode)){const e=h.parentNode.host;if(d.has(e))break;d.add(e),u.push(e),h=e;continue}if(!Ar(h.parentNode))break;if(d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p="click"===t.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?u.findIndex(e=>Lr(e,"button")||Lr(e,"a")):-1;p>0&&(s=s||u.slice(0,p+1).some(e=>!no(e)||ro(e)));const v=[],f={};let g,_=!1,m=!1;if(Kn(u,e=>{const t=no(e);if(Lr(e,"a")){const i=e.getAttribute("href");_=!!(t&&i&&vo(i))&&(o?_t(i):i)}k(Ur(e),"ph-no-capture")&&(m=!0),v.push((function(e,t,i,s,n=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};Vr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Tc(1024,fo(e)):Tc(1024,zr(e)));const a=Ur(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),Kn(e.attributes,function(i){var r;if((!ro(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&vo(i.value)&&(!N(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=jr(e).join(" ")),o["attr__"+i.name]=Tc(1024,"href"===i.name&&n?_t(e):e)}});let l=1,c=1,u=e;for(;u=Fc(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o})(e,i,s,n,o)),Kn((function(e){if(!no(e))return{};const t={};return Kn(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&vo(s)&&(t[i]=s)}}),t})(e),(e,t)=>{({}).hasOwnProperty.call(f,t)||(f[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(p>0&&(e=u[p],v.splice(0,p)),s||(v[0].$el_text=Lr(e,"a")||Lr(e,"button")?fo(e):zr(e)),_){var y,b;v[0].attr__href=_;const e=null===(y=Ro(_))||void 0===y?void 0:y.host,t=null==a||null===(b=a.location)||void 0===b?void 0:b.host;e&&t&&e!==t&&(g=_)}return{props:Yn((x=t.type,{$event_type:x,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(w=v,I(w)?(function(e){return e.map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)s+=`.${t.replace(/"/g,"")}`}const n=Ot(Ot(Ot(Ot({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Jn(n).sort(([e],[t])=>(function(e,t){return t>e?-1:e>t?1:0})(e,t)).forEach(([e,t])=>r[_o(e.toString())]=_o(t.toString())),s+=":",s+=Jn(r).map(([e,t])=>`${e}="${t}"`).join(""),s}).join(";")})((function(e){return e.map(e=>{var t,i;const s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:mo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Jn(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s})})(w)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(c=v[0])||void 0===c?void 0:c.$el_text}:{},g&&"click"===t.type?{$external_click_url:g}:{},f),target:e};var w,x}var Ic=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!no(e))return!0;const i=null!==(t=this.vo().css_selector_ignorelist)&&void 0!==t?t:Yr,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const e=n,t=Ur(e);if(k(t,"ph-no-capture")||k(t,"ph-sensitive")||ro(e)||i.some(t=>Wr(e,t)))return!0;const r=n.parentNode;n=Nr(r)?r.host:r&&Ar(r)?r:null}return!1}fo(e){if(!this.isEnabled||"pointercancel"===e.type)return void this.uo();if("pointerdown"===e.type){this.uo();const i=qr(e);var t;return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&Ar(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this.po)||void 0===t?void 0:t.distinctId}))}const i=this.ho;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.uo():"pointerup"===e.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(e){var t;const i=this.ho;this.uo();const s=qr(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this.po)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(Lr(s,"html")||Lr(s,"body"))){var n;if(i.excluded)return null;const e=null!==(n=this.vo().css_selector_ignorelist)&&void 0!==n?n:Yr;return[s,null==u?void 0:u.documentElement,null==u?void 0:u.body].some(t=>{if(!t)return!1;const i=Ur(t);return k(i,"ph-no-capture")||k(i,"ph-sensitive")||!no(t)||ro(t)||e.some(e=>Wr(t,e))})?null:i.target}}constructor(e){this.yo=e,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new Pc(this.Mr.rageclick),this.xo=null}setup(e){this.Co(),this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}dispose(){var e;this.So||(this.So=!0,this.po=void 0,null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var e,t;return this.vo(),this.Mr.url_allowlist=null===(e=this.Mr.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this.Mr.url_ignorelist=null===(t=this.Mr.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this.Mr}Io(){if(!this.isBrowserSupported())return void Oc.info("Disabling Automatic Event Collection because this browser is not supported");if(!a||!u)return;const e=this.Mo=e=>{e=e||(null==a?void 0:a.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);const t="click"===e.type?this.mo(e):void 0;if(B(t))return;this.Eo(e,"$autocapture",t)}catch(e){Oc.error("Failed to capture event",e)}};if(ir(a,"blur",e),ir(u,"submit",e,{capture:!0}),ir(u,"change",e,{capture:!0}),ir(u,"click",e,{capture:!0}),Kn(["pointerdown","pointermove","pointerup","pointercancel"],t=>{ir(u,t,e,{capture:!0})}),this.vo().capture_copied_text){const e=this.Po=e=>{e=e||(null==a?void 0:a.event);try{this.Eo(e,Mc)}catch(e){Oc.error("Failed to capture clipboard event",e)}};ir(u,"copy",e,{capture:!0}),ir(u,"cut",e,{capture:!0}),ir(u,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==a||a.removeEventListener("blur",this.Mo),Kn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==u||u.removeEventListener(e,this.Mo,!0)}),null==u||u.removeEventListener("submit",this.Mo,!0),null==u||u.removeEventListener("change",this.Mo,!0),null==u||u.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==u||u.removeEventListener("copy",this.Po,!0),null==u||u.removeEventListener("cut",this.Po,!0),null==u||u.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(e){if(this.So)return;if(this.wo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.ko=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;q(i)&&(null===(s=this.po)||void 0===s||s.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}setElementSelectors(e){this.xo=e}getElementSelectors(e,t){var i;const s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{const n=null==u?void 0:u.querySelectorAll(i);null==n||n.forEach(n=>{e!==n&&t!==n||k(s,i)||s.push(i)})}),s}get isEnabled(){var e,t;if(this.So)return!1;const i=null===(e=this.po)||void 0===e?void 0:e.kv.get(ms),s=this._o,n=this.vo();if(!n.remoteRequestsDisabled&&!this.wo)return!1;const r=n.remoteRequestsDisabled&&!this.wo;if(B(s)&&!q(i)&&!r)return!1;const o=null!==(t=this._o)&&void 0!==t?t:!!i;return!!n.enabled&&!o}Eo(e,t="$autocapture",i){if(!this.isEnabled)return void this.uo();let s=i||qr(e);Dr(s)&&(s=s.parentNode||null);const n=this.Co();var r;"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&to(s,n.rageclick)&&this.Eo(e,"$rageclick",i);const o=t===Mc,l=o?Ot(Ot({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(e,t,i,s,n,r){var o;if(!a||io(e))return!1;if((null==i?void 0:i.url_allowlist)&&!Br(i.url_allowlist,r))return!1;if((null==i?void 0:i.url_ignorelist)&&Br(i.url_ignorelist,r))return!1;if(null==i?void 0:i.dom_event_allowlist){const e=i.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=so(e,s);if(!(function(e,t){const i=null==t?void 0:t.element_allowlist;if(D(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1})(c,i))return!1;if(!Gr(c,null==i?void 0:i.css_selector_allowlist))return!1;if(Gr(c,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Yr))return!1;try{const i=a.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}const u=e.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return l?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(Vr.indexOf(u)>-1||"true"===e.getAttribute("contenteditable"))}})(s,e,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var c;const{props:i,explicitNoCapture:r,target:o}=Cc(s,{e:e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(i.$element_selectors=l),t===Mc){const t=e.type||"clipboard";if("paste"!==t){var u,d;const e=null==a||null===(u=a.getSelection())||void 0===u?void 0:u.toString(),t=Hr(e);if(!t)return!1;i.$selected_content=t,i.$clipboard_text_length=null!==(d=null==e?void 0:e.length)&&void 0!==d?d:0}i.$copy_type=t}return null===(c=this.po)||void 0===c||c.capture(t,i).catch(e=>Oc.error("Failed to capture event",e)),!0}}isBrowserSupported(){return R(null==u?void 0:u.querySelectorAll)}},Rc=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=A(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.Xl(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Ac=is("[ExceptionAutocapture]"),Lc=()=>{},Dc=e=>{var t;if(R(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function Nc(e,t,i){try{if(!(t in e))return Lc;const s={next:e[t]},n=i(function(...e){return s.next.apply(this,e)});return R(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],r=Dc(i);for(;r;){if(r.next===n)return void(r.next=s.next);i=r.next,r=Dc(i)}}}catch(e){return Lc}}const jc=is("[TracingHeaders]"),Bc=is("[Web Vitals]"),Uc=9e5,Hc=["CLS","FCP","INP","LCP"],zc=["INP","LCP"],qc=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Vc="disabled",Wc="lazy_loading",Gc=is("[SessionRecording]"),Kc=is("[Heatmaps]");function Yc(e){return A(e)&&"clientX"in e&&"clientY"in e&&H(e.clientX)&&H(e.clientY)}const Jc=is("[Product Tours]"),Zc=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(Ss))},Xc=["$set_once","$set"],Qc=is("[SiteApps]"),eu="Error while initializing PostHog app with config id ",tu=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),iu="SDK is not enabled or survey functionality is not yet loaded",su="Disabled. Not loading surveys.";var nu=class{constructor(e,t){this.yo=e,this.mh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=e=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!e.ok)return Xl.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(U(t))return Xl.warn("Flags not loaded yet. Not loading surveys.");this.Sh=q(t)?t:t.length>0,Xl.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.xh=e,tu(e.kv.initialize(),()=>{if(this.xh!==e||this.So)return;this.xh=void 0,this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.So?t.dispose():(this.$o=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(e=>clearTimeout(e)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this.So||!this.po)return;const e=this.Mr;if(this._surveyManager)return;if(this.yh)return void Xl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Xl.info(su);if(e.cookielessMode&&this.yo.isOptedOut())return void Xl.info("Not loading surveys in cookieless mode without consent.");const t=this.yo.getExtensions();if(!t)return void Xl.error("PostHog Extensions not found.");if(D(this.Sh)&&!e.advancedEnableSurveys)return;const i=this.Sh||e.advancedEnableSurveys;this.yh=!0;try{const e=t.generateSurveys;if(e)return this.Ch(e,i),void(this.yh=!1);const s=t.loadExternalDependency;if(!s)return this.$h(Dn),void(this.yh=!1);s(e=>{try{if(this.So)return;const t=this.yo.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this.$h("Could not load surveys script",e):this.Ch(t.generateSurveys,i)}finally{this.yh=!1}})}catch(e){throw this.yh=!1,this.$h("Error initializing surveys",e),e}}Ch(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),Xl.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(e,t){Xl.error(e,t),this.Th({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;const s=null!==(i=this.po)&&void 0!==i?i:this.mh;if(!s||this.So)return;if(this.Mr.disableSurveys)return Xl.info(su),e([]);const n=s.kv.get(en);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:t,context:i})=>{this.So||e(t,i)}).catch(e=>Xl.error("Error in survey callback",e));const r=this.Mh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(e=>{try{return this.Eh(s,e)}catch(e){return Xl.error("Error processing surveys response",e),this.Eh(s,{statusCode:0,error:e})}},e=>this.Eh(s,{statusCode:0,error:e}));this._h=r;const o=()=>{this._h===r&&(this._h=null)};r.then(t=>{o(),this.So||e(t.surveys,t.context)},o).catch(e=>Xl.error("Error in survey callback",e))}Mh(e,t){const i=this.po;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(iu)}))}Eh(e,t){if(this.So)return{surveys:[],context:{isLoaded:!1,error:iu}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Xl.error(e):t.error||Xl.warn(e),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.wh=null;const s=t.json.surveys||[],n=s.filter(e=>(function(e){return!(!e.start_date||e.end_date)})(e)&&(Ul(e)||(function(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)})(e)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),e.kv.set({[en]:s,[tn]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var e,t;const i=null===(e=null!==(t=this.po)&&void 0!==t?t:this.mh)||void 0===e?void 0:e.kv.get(tn);return H(i)&&Date.now()-i>3e5}Rh(){return H(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};Ql(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}Th(e){for(const t of this.bh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Xl.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!U(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Xl.warn("init was not called")}Ah(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}Fh(e){if(U(this._surveyManager))return{eligible:!1,reason:iu};const t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Oh(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(U(this._surveyManager))return{eligible:!1,reason:iu};const t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(U(this._surveyManager))return Xl.warn("init was not called"),{visible:!1,disabledReason:iu};const t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return U(this._surveyManager)?(Xl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:iu})):new Promise(i=>{this.getSurveys(t=>{var s;const n=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(n){const e=this.Oh(n);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.yo.isCapturing())return;if(U(this._surveyManager))return void Xl.warn("init was not called");const n="string"==typeof e?this.Ah(e):e;if(!(null==n?void 0:n.id))return void Xl.warn("Survey not found");if(!ec.includes(n.type))return void Xl.warn(`Surveys of type ${n.type} cannot be rendered in the app`);const r=null==u?void 0:u.querySelector(t);if(r){if(null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Xl.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,s;this.kh.delete(e),!this.So&&this.yo.isCapturing()&&(Xl.info(`Rendering survey ${n.id} with delay of ${null===(t=n.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(n,r,i),Xl.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.kh.add(e)}this._surveyManager.renderSurvey(n,r,i)}else Xl.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.yo.isCapturing())return;if(U(this._surveyManager))return void Xl.warn("init was not called");const s=this.Ah(e);if(!s)return void Xl.warn("Survey not found");let n=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(n=Ot(Ot({},s),{},{appearance:Ot(Ot({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Ea.Popover&&t.initialResponses&&Xl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this.Fh(s);if(!e.eligible)return void Xl.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==Ea.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){U(this._surveyManager)?Xl.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function ru(e,t,i){if(U(e))return!1;switch(i){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var ou=class{constructor(e){this._instance=e,this.Dh=new Set,this.Lh=new Set,this.Nh=new Rl,this.qh=(e,t)=>this.jh(e,t)&&this.Bh(e,t)&&this.Hh(e,t)&&this.zh(e,t),this.jh=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;D(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this.Uh=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this.Uh)||void 0===e||e.call(this),this.Uh=void 0,this.Nh=new Rl}register(e){var t,i;if(!D(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this.Dh.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this.Lh.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const e=new Set;this.Dh.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(e=>{this.Wh(t,e)&&this.Nh.emit("actionCaptured",e.name)})}Vh(e){this.onAction("actionCaptured",t=>e(t))}Wh(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this.qh(e,i))return!0;return!1}onAction(e,t){return this.Nh.on(e,t)}Bh(e,t){if(null==t?void 0:t.url){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!ru(s,t.url,t.url_matching||"contains"))return!1}return!0}Hh(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}Gh(e,t){var i;if(!(null==t?void 0:t.href))return!0;const s=this.Jh(e);if(s.length>0)return s.some(e=>ru(e.href,t.href,t.href_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&ru((function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""})(n),t.href,t.href_matching||"exact")}Zh(e,t){var i;if(!(null==t?void 0:t.text))return!0;const s=this.Jh(e);if(s.length>0)return s.some(e=>ru(e.text,t.text,t.text_matching||"exact")||ru(e.$el_text,t.text,t.text_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&(r=(function(e){const t=[],i=/(?::|")text="(.*?)"/g;let s;for(;!U(s=i.exec(e));)t.includes(s[1])||t.push(s[1]);return t})(n),o=t.text,a=t.text_matching||"exact",r.some(e=>ru(e,o,a)));var r,o,a}Qh(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;const n=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==n?void 0:n.includes(t.selector))return!0;const r=(null==e||null===(s=e.properties)||void 0===s?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){return!1}return!1}Jh(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}zh(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||Vl(t.properties.reduce((e,t)=>{const i=I(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},au=class{constructor(e){var t,i;this.Kh=[],this._instance=e,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this.nc(e))}sc(e){return!1}rc(){return null}oc(e){}lc(){}ac(e,t){return!!e&&Vl(e.propertyFilters,null==t?void 0:t.properties)}uc(e,t){const i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(t=>{if(null==t?void 0:t.name){const s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}hc(e,t,i){const s=(i===pa.Activation?this.Xh:this.Yh).get(e);let n=[];return this.cc(e=>{n=e.filter(e=>null==s?void 0:s.includes(e.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[i])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(t=>t.name===e);return this.ac(r,t)})}register(e){this.dc(e,!1)}replace(e){this.dc(e,!0)}dc(e,t){var i;D(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}fc(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var s;if(t&&this.tc.clear(),0===i.length)return void(t&&(null===(s=this.gc)||void 0===s||s.replace([])));this.gc||(this.gc=new ou(this._instance),this.gc.init(),this.gc.Vh(e=>this.onAction(e)));const n=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(n.push(t),t.name){var i;const s=null!==(i=this.tc.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this.tc.set(t.name,s)}})}),t?this.gc.replace(n):this.gc.register(n)}mc(e,t){t.forEach((t,i)=>{var s;const n=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{n.includes(e)||n.push(e)}),e.set(i,n)})}vc(e,t){var i,s;const n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.uc(e,pa.Activation),a=this.uc(e,pa.Cancellation);t?(this.Xh=o,this.Yh=a):(this.mc(this.Xh,o),this.mc(this.Yh,a)),(0!==n.length||0!==r.length)&&(null!==(i=this.Uh)&&void 0!==i||(this.Uh=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;const n=this.yc(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const t=this.bc(e,r);if("consume"===t)return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._c([r]);if("persist"===t)return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this.wc(r),void this.kc([r])}if(this.Yh.has(e)){const i=this.hc(e,t,pa.Cancellation);i.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._c(i.map(e=>e.id)),i.forEach(e=>this.Sc(e.id)))}if(!this.Xh.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this.Xh.get(e)});const o=this.hc(e,t,pa.Activation);this.xc(o.map(e=>e.id))}onAction(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}xc(e){var t,i;if(0===e.length)return;const s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),n=[];for(const t of e)s&&this.sc(t)?this.wc(t)&&this.Cc(t):n.push(t);n.length>0&&(this.Kh=[...new Set([...this.Kh,...n])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(e){this.Kh=this.Kh.filter(t=>t!==e);const t=this.$c();return!t.includes(e)&&(this.Tc([...t,e]),this.Ic(),!0)}_c(e){const t=new Set(e);this.Kh=this.Kh.filter(e=>!t.has(e));const i=this.Mc(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Tc(s),0===s.length&&this.Ec()),this.kc(e)}Pc(){var e;const t=this.rc();if(!t)return{};const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}Cc(e){if(!this.rc())return;const t=this.Pc();this.oc(Ot(Ot({},t),{},{[e]:Date.now()}))}kc(e){if(!this.rc())return;const t=this.Pc(),i={};let s=!1;for(const[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(L(i)?this.lc():this.oc(i))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(e){if(!this.$c().includes(e))return;const t=this.Pc()[e];return H(t)?t:void 0}Mc(){var e;const t=this.Ac();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}$c(){var e,t,i;const s=this.Mc();if(0===s.length)return[];const n=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Fc()],r=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return r&&n===r?s:[]}Ic(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this.Oc(i)}Ec(){this.Dc()}nc(e){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Fc()];if(i&&i!==e){const e=this.Mc(),t=this.Pc();e.length>0&&(this.Tc([]),e.filter(e=>H(t[e])).forEach(e=>this.Sc(e))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(e=>!this.Lc(e))}dispose(){var e,t,i;null===(e=this.ec)||void 0===e||e.call(this),this.ec=void 0,null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,null===(i=this.gc)||void 0===i||i.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},lu=class extends au{constructor(e){super(e)}Ac(){return sn}Fc(){return nn}rc(){return rn}oc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}lc(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}sc(e){var t;let i;this.cc(t=>{i=t.find(t=>t.id===e)});const s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return H(s)&&s>0}qc(){return wa.SHOWN}cc(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}Sc(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}yc(){return Xl}Tc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}Oc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}Dc(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}Lc(){return!1}bc(e,t){let i;return this.cc(e=>{i=e.find(e=>e.id===t)}),!i||(function(e){var t;return Ul(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule})(i)?e===wa.SHOWN?"consume":"ignore":e===wa.SHOWN?"persist":e===wa.DISMISSED||e===wa.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},cu=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);const t={};for(const i of e){const e=this._instance.get_property(i);D(e)||(t[i]=e)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},uu=class{constructor(e){this._instance=e}get(){const 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(){const e=null==y?void 0:y.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new lu(this._instance)}};const du=(null==a?void 0:a.location)?Do(a.location.hash,"__posthog")||Do(location.hash,"state"):null,hu="_postHogToolbarParams",pu=is("[Toolbar]"),vu=is("[FeatureFlags]");var fu=class{constructor(e,t=!1){this.jc=!1,this.update(e,t)}update(e,t){this.Bc=((e,t)=>{var i,s,n,r,o,a,l;return{bootstrap:{featureFlags:null!==(i=null===(s=e.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n: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:null!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:D(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(l=e.evaluation_contexts)&&void 0!==l?l:e.evaluation_environments)&&void 0!==a?a:[],flagKeys:I(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.jc||(vu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),D(e.flag_keys)||I(e.flag_keys)||vu.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const gu=is("[FeatureFlags]"),_u=is("[FeatureFlags]",{debugEnabled:!0}),mu="\" failed. Feature flags didn't load in time.",yu=["click","keydown","wheel","touchstart","pointerdown"],bu="connection_error",wu=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},xu=e=>{const t={};for(const[i,s]of Jn(e||{}))s&&(t[i]=s);return t},Eu=e=>Y(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),$u=is("[Error tracking]"),Su="webkit-masked-url:",ku=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Pu=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Su],Mu=["__firefox__","__gCrWeb"],Ou="Refusing to render web experiment since the viewer is a likely bot",Tu={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Hl(t,e),not_regex:(e,t)=>!Hl(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Fu=is("[Conversations]"),Cu="Conversations not available yet.";function Iu(e,t){var i,s,n,r,o,a,l;const u=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,d=null!==(s=null==e?void 0:e.maxBufferSize)&&void 0!==s?s:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,p=D(h)?Math.max(d,2048):Math.max(d,h),v=Ot(Ot({},(function(){let e="",t="";try{const i=null==c?void 0:c.userAgent;i&&([e,t]=rt(i))}catch(e){}return(function(e,t){const i=(function(e){if(e)return{}.hasOwnProperty.call(ji,e)?ji[e]:e})(e);return Ot(Ot({},i?{"os.name":i}:{}),t?{"os.version":t}:{})})(e,t)})()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==r?r:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==v?void 0:v["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==v?void 0:v["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:v,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Ru=["debug","log","warn","error","info"],Au=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},Lu="console",Du="__posthogHandledLogsRequestError",Nu=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[Du]=!0,i},ju=e=>!!e&&"object"==typeof e&&!0===e[Du],Bu=is("[NetworkMetrics]"),Uu=()=>{var e;return(null==a||null===(e=a.performance)||void 0===e?void 0:e.now)?a.performance.now():Date.now()},Hu=e=>e?`${Math.floor(e/100)}xx`:"missing",zu=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:(null===(i=Ro(s))||void 0===i?void 0:i.href)||s}},qu=(e,t,i,s,n)=>{try{var r,o,a;const c=n();if(!c)return;const u=i||void 0,d=Uu()-s,h=Ro(t.url);if(h&&"http:"!==h.protocol&&"https:"!==h.protocol)return;const p={url:(null==h?void 0:h.href)||t.url,method:t.method},v=R(c.name)?c.name(p):N(c.name)?c.name:"http.client.request.duration";if(!v)return;const f=Ot({method:p.method,host:null!==(r=null==h?void 0:h.hostname)&&void 0!==r?r:"",path:h?(l=h.pathname,l.split("/").map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?":id":e).join("/")):"",status_class:Hu(u)},null===(o=c.attributes)||void 0===o?void 0:o.call(c,p,{status:u,durationMs:d}));null===(a=e.metrics)||void 0===a||a.histogram(v,d,{unit:"ms",attributes:f})}catch(e){Bu.error("Failed to record network metric",e)}var l},Vu=()=>{},Wu=(e,t)=>R(null==a?void 0:a.fetch)?Nc(a,"fetch",i=>function(...s){const n=Uu(),r=i.apply(this,s);if(!t())return r;try{var o,a,l;const[i,c]=s,u=zu(null!==(o=null!==(a=null==c?void 0:c.method)&&void 0!==a?a:null==i?void 0:i.method)&&void 0!==o?o:"GET",null!==(l=null==i?void 0:i.url)&&void 0!==l?l:i);return r.then(i=>(qu(e,u,null==i?void 0:i.status,n,t),i),i=>{throw qu(e,u,void 0,n,t),i})}catch(e){return Bu.error("Failed to observe fetch",e),r}}):Vu,Gu=(e,t)=>{var i;const s=null==a||null===(i=a.XMLHttpRequest)||void 0===i?void 0:i.prototype;if(!s)return Vu;const n=new WeakMap,r=Nc(s,"open",e=>function(...t){try{(()=>hl.has(this))()||n.set(this,zu(t[0],t[1]))}catch(e){Bu.error("Failed to observe XHR open",e)}return e.apply(this,t)}),o=Nc(s,"send",i=>function(...s){let r;try{const i=n.get(this);if(i&&t()){const s=Uu();r=()=>{this.removeEventListener("loadend",r),qu(e,i,this.status,s,t)},ir(this,"loadend",r)}}catch(e){Bu.error("Failed to observe XHR send",e)}try{return i.apply(this,s)}catch(e){throw r&&this.removeEventListener("loadend",r),e}});return()=>{r(),o()}},Ku={featureFlags:class{constructor(e){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=gu,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const e=this.ed();this.Yc=0,e&&this.reloadFeatureFlags()},this.nd=()=>{var e,t;const i=this.sd,s=null!==(e=this.rd)&&void 0!==e?e:i;D(i)||D(s)||this.Mr.remoteRequestsDisabled||!u||"hidden"===u.visibilityState||Date.now()-(null!==(t=this.od)&&void 0!==t?t:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==u?void 0:u.visibilityState)&&this.ud()},"get"in e?this.yo=e:(this._instance=e,this.hd=new fu(e.config,e.Xl()),this.yo=this.hd)}updateConfig(e,t){var i;null===(i=this.hd)||void 0===i||i.update(e,t),this.po&&this.dd()}setup(e){return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),tu(e.kv.initialize(),()=>{this.xh===e&&(this.xh=void 0,this.po=e,this.vd(e))})}vd(e){var t;if(this.po===e)return a&&ir(a,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&u&&!D(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.rd=t),t!==this.sd&&(this._d(),D(t)||(this.sd=t,this.rd=t,this.ld(),(null==u?void 0:u.addEventListener)&&(ir(u,Un,this.an),Gn(yu,e=>{ir(u,e,this.ad,{capture:!0})}))))}ld(){D(this.sd)||(D(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var e;D(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==u||null===(e=u.removeEventListener)||void 0===e||e.call(u,"visibilitychange",this.an),Gn(yu,e=>{var t;null==u||null===(t=u.removeEventListener)||void 0===t||t.call(u,e,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,t;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(e=this.fd)||void 0===e||e.dispose(),this.fd=void 0,null===(t=this.gd)||void 0===t||t.call(this),this.gd=void 0,this.Wc=[],null==a||a.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(e){var t;return this.Cd&&e in this.Cd?this.Cd[e]:null===(t=this.po)||void 0===t?void 0:t.kv.get(e)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var e;return!D(null===(e=this.po)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this.md()}At(e){this.Td(()=>{var t;return null===(t=this.po)||void 0===t?void 0:t.kv.set(e)})}Id(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;const n=this.xd("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!I(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),u=this.xd("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?c:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),p=!l&&!i,v=!!p||c,f=!!p||h,g={[zs]:v,[Hs]:v,[Ws]:f};e.$feature_flag_details&&(g[Vs]=v);for(const t of[Gs,gn,Ks])D(e[t])||(g[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(e){this.Td(()=>{var t;return null===(t=this.po)||void 0===t?void 0:t.kv.remove(e)})}Td(e){try{e()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}yd(){const e={};for(const t of[zs,Ws,Gs,Ys]){const i=this.xd(t);D(i)||(e[t]=i)}this.zc=e;const t=Ot({},e),i=this.xd(Hs);if(i)for(const[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this.Uc=t}pd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.xd(gn);return"number"!=typeof t||Date.now()-t>e}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){const e=this.Mr.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Pd(){const e=this.Mr.flagKeys;if(!D(e))return e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t;const i=this.Mr,s=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var n,r;const e=null!==(n=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},t=Object.keys(s).filter(e=>!D(s[e])).reduce((e,t)=>(e[t]=s[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this.Rd({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;const r=(null==i?void 0:i.merge)&&null!==(s=this.xd("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(n=this.xd("$feature_flag_payloads"))&&void 0!==n?n:{},a=Ot(Ot({},r),e),l=Ot(Ot({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:gi(t),variant:_i(t),reason:void 0,metadata:D(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this.Rd({flags:c})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.xd(Vs),t=this.xd(Ys),i=this.xd(Js);if(!i&&!t)return e||{};const s=Yn({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of n){var r;const n=s[e],a=null==t?void 0:t[e],l=D(a)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!a,c=D(a)?null==n?void 0:n.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=Ot(Ot({},n),{},{enabled:l,variant:l?null!=c?c:null==n?void 0:n.variant:void 0});var o;l!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),c!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),u&&(d.metadata=Ot(Ot({},null==n?void 0:n.metadata),{},{payload:u,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[e]=d}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Hc=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:gi(s),variant:_i(s),payload:fi(t[i])}})}getFlagVariants(){const e=this.xd(Hs),t=this.xd(Ys);if(!t)return e||{};const i=Yn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Hc=!0),i}getFlagPayloads(){const e=this.xd(Ws),t=this.xd(Js);if(!t)return e||{};const i=Yn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Hc=!0),i}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(e=>{try{e()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(e){return this.Wc.push(e),()=>{this.Wc=this.Wc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Qc=e}resetFlagCallReported(){this.Lt(pn)}Fd(e){this.Sd();const t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:Ot(Ot(Ot({},t.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.xd(Xs),timezone:Qo()};D(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this.Ed();s.length&&(i.evaluation_contexts=s);const n=this.Pd();D(n)||(i.flag_keys=n);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.Zc;this.Gc=!0;const l=()=>{this.Jc&&(this.Jc=!1,this.Fd())},c=e=>{var t,s;const n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this.Gc=!1,a!==this.Zc)return void l();if(this.Od(e.statusCode),o||this.Jc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Jc)return;this.Kc=!o;const c=[];e.error?c.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?bu:"unknown_error"):200!==e.statusCode&&c.push(`api_error_${e.statusCode}`),n.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");const u=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));u&&c.push("quota_limited"),this.At({[fn]:c}),u?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."):i.disable_flags||this.Rd(n,o,{partialResponse:r}),l()},u=e=>{this.Gc=!1,a===this.Zc?(this.At({[fn]:[bu]}),this.$.error("Feature flag request failed",e),this.$d()&&this.bd(!0),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(c).catch(u)}catch(e){u(e)}}ed(){return No(this.Yc,3)}Od(e){this.Yc=jo(e,this.Yc,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={}){var i;if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+mu);if(this.Md())return;const s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+mu);if(this.Md())return;const i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this.xd("$feature_flag_request_id")||void 0,l=this.xd("$feature_flag_evaluated_at")||void 0;let c,u=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var d;const e=null===(d=this.po)||void 0===d?void 0:d.session.sessionId,t=this.xd(vn);e&&e!==t&&(u={},c=e)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))c&&this.At({[pn]:u,[vn]:c});else{var h,p,v,f,g,_,m,y,b,w,x,E;I(u[e])?u[e].push(o):u[e]=[o],this.At(Ot({[pn]:u},c?{[vn]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(h=this.xd("$feature_flag_errors"))&&void 0!==h?h:[]];D(n)&&i.push("flag_missing");const s={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(p=null===(v=this.Mr.bootstrap)||void 0===v||null===(v=v.featureFlags)||void 0===v?void 0:v[e])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(f=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[e])&&void 0!==f?f:null,$used_bootstrap_value:!this.Kc};D(null==t||null===(_=t.metadata)||void 0===_?void 0:_.has_experiment)||(s.$feature_flag_has_experiment=t.metadata.has_experiment),D(null==t||null===(m=t.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=t.metadata.version);const d=null!==(y=null==t||null===(b=t.reason)||void 0===b?void 0:b.description)&&void 0!==y?y:null==t||null===(w=t.reason)||void 0===w?void 0:w.code;var $;d&&(s.$feature_flag_reason=d),(null==t||null===(x=t.metadata)||void 0===x?void 0:x.id)&&(s.$feature_flag_id=t.metadata.id),D(null==t?void 0:t.original_variant)&&D(null==t?void 0:t.original_enabled)||(s.$feature_flag_original_response=D(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(E=t.metadata)||void 0===E?void 0:E.original_payload)&&(s.$feature_flag_original_payload=null==t||null===($=t.metadata)||void 0===$?void 0:$.original_payload),i.length&&(s.$feature_flag_error=i.join(",")),this.Dd(s)}else c&&this.At({[pn]:u,[vn]:c});return s?{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:fi(r)}:void 0}Dd(e){try{var t;null===(t=this.po)||void 0===t||t.capture("$feature_flag_called",e).catch(e=>{this.$.error("Failed to capture feature flag call",e)})}catch(e){this.$.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this.Ld(e,t)}Ld(e,t){var i=this;return ie(function*(){const s=i.po;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i.Ed();r.length&&(n.evaluation_contexts=r);const o=i.Pd();let a;D(o)||(n.flag_keys=o);try{var l;const t=null===(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i.$.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i.$.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+mu),t.defaultValue;const i=this.getFeatureFlag(e,t);return D(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Rd(e,t,i)}Rd(e,t,i){if(!this.po)return;this.Vc=!0;const s=((e,t={},i={},s={},n,r=gu)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!D(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return Ot(Ot({},e),{},{featureFlags:t,featureFlagPayloads:s})}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,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(I(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[zs]:l,[Hs]:e,[Ks]:!1}}let h=l,p=c,v=a;if(null==n?void 0:n.partialResponse){const e=Object.keys(h),n=p||{};h=Ot(Ot({},t),h),p=Ot(Ot({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),v=Ot(Ot({},s),v)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=Ot(Ot({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const n=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=Ot(Ot({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),v=Ot(Ot({},s),Object.fromEntries(Object.entries(v||{}).filter(([t])=>e.has(t))))}else h=Ot(Ot({},t),h),p=Ot(Ot({},i),p),v=Ot(Ot({},s),v);return Ot(Ot({[zs]:Object.keys(xu(h)),[Hs]:h||{},[Ws]:p||{},[Vs]:v||{},[Ks]:!0===e.minimalFlagCalledEvents},u?{[Gs]:u}:{}),d?{[gn]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s)if(!1===(null==i?void 0:i.persist)){const e=!D(this.po.kv.get(Hs));this.Cd=s,e||this.At(s)}else this.md(),this.Id(s,e,!!(null==i?void 0:i.partialResponse)),this.At(s);else t&&this.$d();t||(this.Xc=!1),this.bd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Nd(e)}Nd(e){if(this.po){if(!1===e)return this.Lt([Ys,Js]),this.bd(),void _u.info("All overrides cleared");if(I(e))return this.At({[Ys]:wu(e)}),this.bd(),void _u.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this.Hc=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const s={},n=i.flags,r=i.payloads;return n&&(s[Ys]=I(n)?wu(n):n),r&&(s[Js]=r),Object.keys(s).length&&this.At(s),!1===n&&!1===r?this.Lt([Ys,Js]):!1===n?this.Lt(Ys):!1===r&&this.Lt(Js),this.bd(),!1===n?_u.info("Flag overrides cleared"):n&&_u.info("Flag overrides set",{flags:n}),void(!1===r?_u.info("Payload overrides cleared"):r&&_u.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this.At({[Ys]:e}),this.bd(),void _u.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.Vc){const{flags:t,flagVariants:i}=this.qd();try{e(t,i)}catch(e){this.$.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const n=(this.xd("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);const a=Ot(Ot({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this.At({[zs]:Object.keys(xu(a)),[Hs]:a,[Zs]:Ot(Ot({},this.xd("$stored_person_properties")||{}),r)}),this.bd();try{var l;null===(l=this.po)||void 0===l||l.capture("$feature_enrollment_update",o).catch(e=>{this.$.error("Failed to capture early access feature enrollment",e)})}catch(e){this.$.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){const s=this.xd(qs);!s||t?this.jd(e,i):e(s)}jd(e,t){var i=this;return ie(function*(){const s=i.po;if(!s)return;const n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i.At({[qs]:r})}catch(e){return void i.$.error("Early access feature request failed",e)}try{e(r)}catch(e){i.$.error("Early access feature callback failed",e)}})()}qd(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}bd(e){this.yd();const{flags:t,flagVariants:i}=this.qd();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this.$.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this.Bd(e,t)}Bd(e,t=!0){const i=this.xd("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),n=null==e?void 0:e.$set_once,r={};if(n)for(const e in n)({}).hasOwnProperty.call(n,e)&&(e in i||(r[e]=n[e]));this.At({[Zs]:Ot(Ot(Ot({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=Ot({},this.xd("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this.At({[Zs]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(Zs),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this.xd("$stored_group_properties")||{},s=Ot({},i);for(const t of Object.keys(e))s[t]=Ot(Ot({},i[t]),e[t]);this.At({[Xs]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.xd("$stored_group_properties")||{};this.At({[Xs]:Ot(Ot({},t),{},{[e]:{}})})}else this.Lt(Xs)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Yu={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(null===(e=this.Hd)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(e=null===(t=this.Hd)||void 0===t?void 0:t.status)&&void 0!==e?e:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=Vc,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var e,t;if(!(null==u?void 0:u.visibilityState)||"visible"===u.visibilityState)return!0;const i=null==a||null===(e=a.performance)||void 0===e||null===(t=e.getEntriesByType)||void 0===t?void 0:t.call(e,"visibility-state");return!(null==i?void 0:i.length)||i.some(e=>"visible"===e.name)})(),this.an=()=>{var e,t;"visible"===(null==u?void 0:u.visibilityState)&&(this.Ke=!0,null===(e=this.Hd)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw Gc.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==u?void 0:u.addEventListener)&&ir(u,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Wd=!0,null==u||null===(t=u.removeEventListener)||void 0===t||t.call(u,"visibilitychange",this.an),e?this.Vd(!0):this.stopRecording()}get Gd(){var e;const t=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),i=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return a&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.Wd)return;if(this.Gd&&(null===(t=this.Hd)||void 0===t?void 0:t.isStarted))return;const i=!D(Object.assign)&&!D(Array.from);this.Gd&&i?(this.Zd(e),Gc.info("starting")):(this.zd=Vc,this.stopRecording())}Zd(e){var t,i;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=Wc),(null==y||null===(t=y.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=y.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.Qd(e);else{var s,n;const t=this._instance.sessionManager;null===(s=y.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Jd,i=>{if(!this.Wd&&this.Gd&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Gc.error("could not load recorder",i)):void this.Qd(e);this.zd="disabled"})}}stopRecording(){var e,t;null===(e=this.Ud)||void 0===e||e.call(this),this.Ud=void 0,null===(t=this.Hd)||void 0===t||t.stop()}Vd(e=!1){var t,i;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.discard({discardProducerEvents:e})}Kd(){var e,t;null===(e=this.xa)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this.xa)||void 0===t||t.unregister("$replay_sample_rate")}Xd(e,t){if(U(e))return null;const i=H(e)?e:parseFloat(e);return"number"!=typeof(s=i)||!Number.isFinite(s)||0>s||s>1?(Gc.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}Yd(e){if(this.xa){var t,i;const s=this.xa,n=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,n=this.Xd(null===(t=this.Mr.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this.Xd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=n?n:r;U(o)&&this.Kd();const a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[Ms]:Ot(Ot({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:Ot({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:D(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};n(),null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(n)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.Yd(t),void this.Vd()):(this.Yd(t),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",Gc.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this.Hd)||void 0===i?void 0:i.log)?this.Hd.log(e,t):Gc.warn("log called before recorder was ready")}get Jd(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(Ms);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}tv(){const e=this._instance.get_property(Ms);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return Gc.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!U(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Qd(e){var t,i,s;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return Gc.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Mn]:!0});var n;if(this.Hd||(this.Hd=null===(n=y.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",Gc.info("persisted remote config is stale, requesting fresh config before starting"),void new Fa(this._instance).load()}this.zd=Wc,null===(i=(s=this.Hd).setDocumentWasEverVisible)||void 0===i||i.call(s,this.Ke),this.Hd.start(e)}else this.zd=Vc}onRRwebEmit(e){var t,i;null===(t=this.Hd)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this.Hd||null===(t=this.xa)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this.Hd)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Hd||null===(t=this.xa)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this.Hd)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this.Hd)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this.Hd)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this.Hd)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this.Hd)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},Ju={autocapture:class extends Ic{constructor(e){super(new Rc(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.nv();return!!(e.path||e.search||this.sv(e))}startIfEnabled(){this.isEnabled&&(ts.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,ts.info("History API monitoring stopped")}monitorHistoryChanges(){a&&a.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var t;if(!a||(null===(t=a.history[e])||void 0===t?void 0:t.__posthog_wrapped__))return;const i=this;Nc(a.history,e,t=>function(s,n,r){t.call(this,s,n,r),i.hv(e)})}iv(){const e=null==a?void 0:a.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}nv(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:A(e)?e:{}}sv(e=this.nv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}dv(e){const t=this.nv(),i=this.ev;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.sv(t)&&e.hash!==i.hash))}hv(e){try{const t=this.iv();if(!t)return;this.dv(t)&&this._instance.capture(zn,{navigation_type:e}),this.ev=t}catch(t){ts.error(`Error capturing ${e} pageview`,t)}}av(){if(this.rv)return;const e=()=>{this.hv("popstate")};ir(a,"popstate",e),this.rv=()=>{a&&a.removeEventListener("popstate",e)}}uv(){if(this.ov)return;const e=()=>{this.hv("hashchange")};ir(a,"hashchange",e),this.ov=()=>{a&&a.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.vv=!1,this.bo=!1,this.fv=null,this.instance=e,this.vv=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[ys]),this.rageclicks=new Pc(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return A(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return U(this.Mr.capture_heatmaps)?U(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Kc.info("starting..."),this.pv(),this.an()}else{var e;clearInterval(null!==(e=this.fv)&&void 0!==e?e:void 0),this.gv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ys]:i}),this.vv=i,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}mv(e){Yc(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==u?void 0:u.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){a&&u&&(this.yv=this.fa.bind(this),ir(a,Hn,this.yv),this.bv=e=>this.Cr(e||(null==a?void 0:a.event)),ir(u,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||(null==a?void 0:a.event)),ir(u,"mousemove",this._v,{capture:!0}),this.Sv=new xo(this.instance,bo,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),ir(u,Un,this.xv),this.bo=!0)}gv(){var e;a&&u&&(this.yv&&a.removeEventListener(Hn,this.yv),this.bv&&u.removeEventListener("click",this.bv,{capture:!0}),this._v&&u.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&u.removeEventListener(Un,this.xv),clearTimeout(this.Cv),null===(e=this.Sv)||void 0===e||e.stop(),this.bo=!1)}$v(e,t){const i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=(function(e,t,i){let s=e;for(;s&&Ar(s)&&!Lr(s,"body");){if(s===i)return!1;let e;try{var n,r,o;e=null===(n=null!==(r=null===(o=s.ownerDocument)||void 0===o?void 0:o.defaultView)&&void 0!==r?r:a)||void 0===n?void 0:n.getComputedStyle(s).position}catch(e){return!1}if(k(t,e))return!0;s=Kr(s)}return!1})(qr(e),["fixed","sticky"],n);return{x:e.clientX+(r?0:s),y:e.clientY+(r?0:i),target_fixed:r,type:t}}Cr(e,t="click"){var i;if(Rr(e.target)||!Yc(e))return;const s=this.$v(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&to(qr(e),this.instance.config.rageclick)&&this.Zs(Ot(Ot({},s),{},{type:"rageclick"})),this.Zs(s)}wv(e){!Rr(e.target)&&Yc(e)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(e,"mousemove"))},500))}Zs(e){if(!a)return;const t=this.Mr.disable_capture_url_hashes?_t(a.location.href):a.location.href,i=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Bo,...i||[]]:[],n=Lo(t,s,Ho);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}fa(){this.Rt&&!L(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:xo,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",Ot({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>Ot(Ot({},e),{},{[`$web_vitals_${t.name}_event`]:Ot({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=e=>{var t;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},U(null==e?void 0:e.name)||U(null==e?void 0:e.value))return void Bc.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this.Ev(i);if(D(s))return;const n=H(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this.Pv&&e.value>=this.Pv)return void Bc.error("Ignoring metric with value >= "+this.Pv,e);this.Rt.navigationKey!==n&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),D(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=D(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=Ot(Ot(Ot({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,A(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of qc){const s="url"===i&&"string"==typeof e.attribution[i]?this.Ev(e.attribution[i]):e.attribution[i];D(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;D(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)return;let e,t,i,s,n=!1;const r=y.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Av])||("web-vitals"===this.Av&&D(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!D(a)){const r=a.withoutAttribution,o=this.attributionMetrics;n=!D(r),e=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(e&&t&&i&&s))return void Bc.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},c=n&&this.attributionMetrics.indexOf("INP")>-1?Ot(Ot({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this.Mv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Mv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Mv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this.Mv.bind(this),c),this.bo=!0},this.vv=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[Es]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=A(this.Fv)?null===(e=this.Fv)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return U(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||Hc:i}get flushToCaptureTimeoutMs(){return(A(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=A(this.Fv)?this.Fv.web_vitals_attribution:void 0;return q(e)?e?Hc:[]:I(e)?e:zc}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=A(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get Pv(){const e=A(this.Fv)&&H(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Uc;return e>0&&6e4>=e?Uc:e}get isEnabled(){const e=null==d?void 0:d.protocol;if("http:"!==e&&"https:"!==e)return Bc.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=A(this.Fv)?this.Fv.web_vitals:q(this.Fv)?this.Fv:void 0;return q(t)?t:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(Bc.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=A(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=A(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Es]:i}),this._instance.persistence.register({[Ps]:s})),this.vv=i,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(e){var t;const i=y.__PosthogExtensions__,s=this.Av,n=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&D(n)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?Bc.error("failed to load script",t):e()})}Ev(e){const t=e||(null==a?void 0:a.location.href);if(!t)return void Bc.error("Could not determine current URL");const i=this._instance.config.disable_capture_url_hashes?_t(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Bo,...s||[]]:[];return Lo(i,n,Ho)}}},Zu={exceptionObserver:class{constructor(e){var t;this.Rv=()=>{var e;if(!a||!this.isEnabled||!(null===(e=y.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const t=y.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=y.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=y.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=t(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=i(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(e){Ac.error("failed to start",e),this.Nv()}},this._instance=e,this.qv=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[bs]),this.wt=new oe(Ot(Ot({},(function(e={}){var t,i,s,n;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Ac})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return A(e)?t=Ot(Ot({},t),e):(D(e)?this.qv:e)&&(t=Ot(Ot({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ac.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(e){var t,i,s;(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return Ac.error("failed to load script",t);e()})}Nv(){var e,t,i;null===(e=this.Ov)||void 0===e||e.call(this),this.Ov=void 0,null===(t=this.Dv)||void 0===t||t.call(this),this.Dv=void 0,null===(i=this.Lv)||void 0===i||i.call(this),this.Lv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[bs]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}captureException(e){try{var t,i,s;const n=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this.wt.consumeRateLimit(n))return void Ac.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this.Bv=[],this.Hv=new Tt([new Zt,new ai,new Qt,new Xt,new ri,new ni,new ti,new oi],(function(e,...t){return(i,s=0)=>{const n=[],r=i.split("\n"),o=Math.min(r.length,s+1e3),a=[];for(let i=s;o>i;i++){const s=r[i];if(s.length>1024)continue;const o=zt.test(s)?s.replace(zt,"$1"):s;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){n.push(t);const e=Vt(n);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(Yt(n,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=Gt(n,c);n.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)Wt(n,e);return a.some(e=>0===e.start&&n.length===e.length)&&(function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Jt(t,e,i)&&(i=e);e.push(...e.splice(0,i))})(n),(function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return Ot(Ot({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})})(n)}})("web:javascript",jt,Ht)),this._instance=e,this.Bv=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this.zv=hi(this.Uv()),this.Wv=new pi(this.zv)}onConfigChange(){this.zv=hi(this.Uv()),this.Wv.setConfig(this.zv)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const r=null!==(t=null===(i=n.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.Bv=r,this._instance.persistence&&this._instance.persistence.register({[ws]:this.Bv,[xs]:o})}get Vv(){var e;const t=!!this._instance.get_property(xs),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.Hv.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.zv.enabled)try{if(!N(e)||0===e.trim().length)return void $u.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=(function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>ui.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}})(this.Gv(t));s.length>0&&$u.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Wv.add(Ot({[li]:e,[ci]:(new Date).toISOString()},i))}catch(e){$u.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Zv(t)){if(this.Qv(t))return this.Jv("Exception dropped: matched a suppression rule"),void $u.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(t))return this.Jv("Exception dropped: thrown by a browser extension"),void $u.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(t))return this.Jv("Exception dropped: thrown by an injected browser script"),void $u.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(t))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void $u.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.zv.enabled&&U(e.$exception_steps)?this.tf(e):e,s=(function(){const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0})();s&&(i.$release_id=s);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return e&&this.Wv.clear(),e}catch(e){return Eu(e)||$u.error("Failed to capture exception event. Dropping this exception.",e),void this.Wv.clear()}}catch(e){return void(Eu(e)||$u.error("Failed to process exception event. Ignoring this exception.",e))}}tf(e){try{const t=this.Wv.getAttachable();return 0===t.length?e:Ot(Ot({},e),{},{$exception_steps:t})}catch(t){return $u.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Jv(e){this.zv.enabled&&this.Wv.add({[li]:e,[ci]:(new Date).toISOString()})}Gv(e){return A(e)?Ot({},e):{}}Uv(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}Qv(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(N(t)&&t.length>0&&e.$exception_types.push(t),N(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this.Bv.some(e=>{const i=e.values.map(e=>{const i=ql[e.operator],s=t[e.key];if(!i||!s)return!1;const n=I(e.value)?e.value:[e.value];return n.length>0&&i(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return $u.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}Kv(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&Pu.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(Su))||e.some(({type:e,value:t})=>"NoResponse"===e||N(t)&&ku.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(Su))))}Xv(e){return e.some(({value:e})=>N(e)&&Mu.some(t=>e.includes(t)))}Yv(e){if(e.length>0){var t,i,s,n;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Zv(e){return!U(e)&&I(e)}}},Xu=Ot({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.ef=null,this.if=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this.xa&&this.xa.register({[Ss]:!!t.productTours}),!Zc(this._instance))return!this.ef&&U(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||Jc.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.ef)||void 0===s||s.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Zc(this._instance)&&this.No(()=>this.nf())}No(e){var t,i,s;(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?Jc.error("Could not load product tours script",t):e()})}nf(){var e;!this.ef&&(null===(e=y.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this.ef=y.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(I(this.if)&&!t)return void e(this.if,{isLoaded:!0});const i=this.xa;if(i){const s=i.props[on];if(I(s)&&!t)return this.if=s,void e(s,{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(!Zc(this._instance))return void e([],{isLoaded:!0});const s=t.statusCode;if(200!==s||!t.json){const i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||Jc.warn(i):Jc.error(i),void e([],{isLoaded:!1,error:i})}const n=I(t.json.product_tours)?t.json.product_tours:[];this.if=n,i&&i.register({[on]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){U(this.ef)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this.ef)||void 0===t||t.showTourById(e)}previewTour(e){this.ef?this.ef.previewTour(e):this.No(()=>{var t;this.nf(),null===(t=this.ef)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this.ef)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this.ef)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this.ef)||void 0===e||e.previousStep()}clearCache(){var e;this.if=null,null===(e=this.xa)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this.ef)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this.ef)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this.ef)||void 0===t||t.cancelPendingTour(e)}}},Ku),Qu={siteApps:class{constructor(e){this._instance=e,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(e,t){if(!t)return;const i=this.globalsForEvent(t);this.rf.push(i),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var e;return null===(e=y._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{e(),this.rf=[],this.af=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:Ot(Ot({},Ti(e,Xc)),{},{properties:Ot(Ot(Ot({},e.properties),h?{$set:Ot(Ot({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:Ot(Ot({},null!==(s=null===(n=e.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}uf(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Qc.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Qc.error("prepare_external_dependency_script returned null"),null):e}hf(){var e,t,i,s,n,r,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=null==u?void 0:u.defaultView,c=null==l||null===(e=l.Node)||void 0===e?void 0:e.prototype;if(!l||!c)return()=>{};if(this.sf++,this.cf)return this.df();const d=[],h=this,p=new WeakSet,v=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},f=e=>{if(p.has(e))return e;const t=h.uf(e);return t&&p.add(t),t},g=e=>e.map(e=>"string"==typeof e?e:f(e)).filter(e=>!B(e));return v(c,"appendChild",e=>function(t){const i=f(t);return i?e.call(this,i):t}),v(c,"insertBefore",e=>function(t,i){const s=f(t);return s?e.call(this,s,i):t}),v(c,"replaceChild",e=>function(t,i){const s=f(t);return s?e.call(this,s,i):i}),[null===(t=l.Element)||void 0===t?void 0:t.prototype,null===(i=l.Document)||void 0===i?void 0:i.prototype,null===(s=l.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(e=>{v(e,"append",e=>function(...t){return e.apply(this,g(t))}),v(e,"prepend",e=>function(...t){return e.apply(this,g(t))})}),[null===(n=l.Element)||void 0===n?void 0:n.prototype,null===(r=l.CharacterData)||void 0===r?void 0:r.prototype,null===(o=l.DocumentType)||void 0===o?void 0:o.prototype].forEach(e=>{v(e,"before",e=>function(...t){return e.apply(this,g(t))}),v(e,"after",e=>function(...t){return e.apply(this,g(t))}),v(e,"replaceWith",e=>function(...t){const i=g(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),v(null===(a=l.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",e=>function(t,i){const s=f(i);return s?e.call(this,t,s):null}),this.cf=()=>{d.forEach(e=>e()),this.cf=void 0},this.df()}df(){let e=!1;return()=>{var t;e||(e=!0,this.sf--,0===this.sf&&(null===(t=this.cf)||void 0===t||t.call(this)))}}vf(e,t=!0){const i=this.hf();try{const s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this.rf.length&&(Qc.info(`Processing ${this.rf.length} events for site app with id ${e.id}`),this.rf.forEach(e=>this.vf(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this.af)||void 0===i||i.call(this))};let s=!1;const n=n=>{t.errored=!n,t.loaded=!0,Qc.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:i}=this.vf(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){Qc.error(eu+e.id,t),n(!1)}if(s&&t.loaded)try{i()}catch(i){Qc.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}ff(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}pf(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this.vf(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){Qc.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this.ff(),void this._instance.on("eventCaptured",e=>this.pf(e))):void Qc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.af)||void 0===i||i.call(this),!e.ok)return;const n=e.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:e,url:t}of n.siteApps){var r,o;y[`__$$ph_site_app_${e}`]=this._instance,null===(r=y.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return Qc.error(eu+e,t)})}else Qc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ed={tracingHeaders:class{constructor(e){this._instance=e,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const e=this.bf();var t,i;e?(D(this.gf)&&(this.gf=null===(t=y.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),D(this.mf)&&(this.mf=null===(i=y.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(e){var t,i,s;(null===(t=y.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=y.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return jc.error("failed to load script",t);e()})}_f(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}bf(){const e=this._f();return I(e)?(I(this.yf)?this.yf.splice(0,this.yf.length,...e):this.yf=[...e],e.length>0?this.yf:void 0):(I(this.yf)&&this.yf.splice(0),this.yf=e||void 0,this.yf)}Nv(){var e,t;null===(e=this.gf)||void 0===e||e.call(this),null===(t=this.mf)||void 0===t||t.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},td=Ot({surveys:class extends nu{constructor(e){var t;super(new uu(e),(t=e,{get projectToken(){return t.config.token},kv:new cu(t)})),this._instance=e}Mh(e,t){const i=t.query?gl(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},Ku),id={toolbar:class{constructor(e){this.instance=e}wf(e){y.ph_toolbar_state=e}kf(){var e;return null!==(e=y.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,n;if(sr(this.instance.config))return!1;if(!a||!u)return!1;e=null!==(s=e)&&void 0!==s?s:a.location,i=null!==(n=i)&&void 0!==n?n:a.history;try{if(!t){try{a.localStorage.setItem("test","test"),a.localStorage.removeItem("test")}catch(e){return!1}t=null==a?void 0:a.localStorage}const s=du||Do(e.hash,"__posthog")||Do(e.hash,"state");let n;const r=s?mt(()=>JSON.parse(atob(decodeURIComponent(s))))||mt(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?(n=r,n.source="url",n&&Object.keys(n).length>0&&(r.desiredHash?e.hash=r.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(n=JSON.parse(t.getItem(hu)||"{}"),n.source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(e){return!1}}Sf(e){const t=y.ph_load_toolbar||y.ph_load_editor;!U(t)&&R(t)?t(e,this.instance):pu.warn("No toolbar load function found")}loadToolbar(e){const t=!!(null==u?void 0:u.getElementById("__POSTHOG_TOOLBAR__"));if(!a||t)return!1;const i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=Ot(Ot({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(a.localStorage.setItem(hu,JSON.stringify(Ot(Ot({},s),{},{source:void 0}))),2===this.kf())this.Sf(s);else if(0===this.kf()){var n,r;this.wf(1),null===(n=y.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"toolbar",e=>{if(e)return pu.error("[Toolbar] Failed to load",e),void this.wf(0);this.wf(2),this.Sf(s)}),ir(a,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(s)})}return!0}xf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},sd=Ot({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Cf("retrieved web experiments from the server"),this.$f=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.$f&&(e.Cf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.$f)||void 0===i||i.set(t.feature_flag_key,t));const s=this._instance.getFeatureFlag(t.feature_flag_key);N(s)&&t.variants[s]&&this.Tf(t.name,s,t.variants[s].transforms)}else if(t.variants)for(const i in t.variants){const s=t.variants[i];e.If(s,this._instance)&&this.Tf(t.name,i,s.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Cf(Ou);else if(!this.Mr.disable_web_experiments){if(U(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Cf("applying feature flags",t),t.forEach(e=>{var t;if(this.$f&&(null===(t=this.$f)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),s=null===(i=this.$f)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this.Tf(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=Ao(null==t?void 0:t.search,"__experiment_id"),s=Ao(null==t?void 0:t.search,"__experiment_variant");i&&s&&(e.Cf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this.Mf(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Mr.disable_web_experiments&&!i)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Mf(t,i,s){const n=s.filter(e=>e.id===t);n&&n.length>0&&(e.Cf(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this.Tf(n[0].name,i,n[0].variants[i].transforms))}static If(t,i){return!U(t.conditions)&&e.Ef(t,i)&&e.Pf(t)}static Ef(t,i){var s;if(U(t.conditions)||U(null===(s=t.conditions)||void 0===s?void 0:s.url))return!0;const n=e.getWindowLocation();if(n){var r,o,a;const e=Ir(i,n.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||Tu[null!==(o=null===(a=t.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==a?void 0:a.location}static Pf(e){var t;if(U(e.conditions)||U(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=qo();if(i.utm_source){var s,n,r,o,a,l,c,u;const t=!(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static Cf(e,...t){ts.info(`[WebExperiments] ${e}`,t)}Tf(t,i,s){this._is_bot()?e.Cf(Ou):"control"!==i?s.forEach(s=>{if(s.selector){var n;e.Cf(`applying transform of variant ${i} for experiment ${t} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(e=>{const t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):e.Cf("Control variants leave the page unmodified.")}_is_bot(){return c&&this._instance?Nl(c,this.Mr.custom_blocked_useragents):void 0}}},Ku),nd={conversations:class{constructor(e){this._instance=e,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return;if(this.Of=e.ok,!e.ok)return;const t=e.config.conversations;U(t)||(q(t)?this.Rf=t:(this.Rf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Af)return;if(this._instance.config.disable_conversations)return;if(sr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==y?void 0:y.__PosthogExtensions__;if(e&&!D(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const t=e.initConversations;if(t)return this.Df(t),void(this.Af=!1);const i=e.loadExternalDependency;if(!i)return void this.Lf(Dn);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Lf("Could not load conversations script",t):this.Df(e.initConversations),this.Af=!1})}catch(e){this.Lf("Error initializing conversations",e),this.Af=!1}}else Fu.error("Conversations enabled but missing token in remote config.")}Df(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ff=!1,Fu.info("Conversations loaded successfully")}catch(e){this.Lf("Error completing conversations initialization",e)}else Fu.error("Cannot complete initialization: remote config is null")}Lf(e,t){Fu.error(e,t),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():Fu.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!B(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":D(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?U(this.ne)||!this.ne.token?"missing_token":(null==y?void 0:y.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return ie(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Fu.warn(Cu),null)})()}getMessages(e,t){var i=this;return ie(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Fu.warn(Cu),null)})()}markAsRead(e){var t=this;return ie(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Fu.warn(Cu),null)})()}getTickets(e){var t=this;return ie(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Fu.warn(Cu),null)})()}requestRestoreLink(e){var t=this;return ie(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Fu.warn(Cu),null)})()}restoreFromToken(e){var t=this;return ie(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Fu.warn(Cu),null)})()}restoreFromUrlToken(){var e=this;return ie(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Fu.warn(Cu),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}dh(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}fh(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},rd={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=is("[logs]"),this.Bf=Ot(Ot({},this.$),{},{error:(...e)=>{e.some(ju)||this.$.error(...e)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var e,t;this.So||(this.Yc=0,null===(e=this.Zf)||void 0===e||e.onReconnect(),null===(t=this.Qf)||void 0===t||t.onReconnect())},this._instance&&(null===(t=this._instance.config.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this.Nf=!0),a&&ir(a,"online",this.Gf)}Jf(e,t,i,s){var n;const r=Iu(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,i);return[new Yi(this.Kf(e,t),r,this.Bf,()=>this.Xf(),e=>e(),void 0,s),r]}Yf(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this.Zf&&this.tp===t||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=t,[this.Zf,this.ep]=this.Jf(()=>this.ia,e=>{this.ia=e})),this.Zf}np(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this.Qf&&this.sp===t||(null===(i=this.Qf)||void 0===i||i.reset(),this.sp=t,[this.Qf,this.rp]=this.Jf(()=>this.Hf,e=>{this.Hf=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Lu)),this.Qf}setup(e){var t;if(this.So)return;this.po=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let i=!1;const s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this.So?s.dispose():(this.$o=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.So||(this.So=!0,this.up(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==a||a.removeEventListener("online",this.Gf),null===(t=this.hp)||void 0===t||t.call(this),this.hp=void 0,null===(i=this.Zf)||void 0===i||i.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(e){var t,i;if(this.So)return;const s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;U(s)?this.cp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var e,t,i,s;this.up(),null===(e=this.Zf)||void 0===e||e.clearQueue(),this.ia=[],null===(t=this.Zf)||void 0===t||t.reset(),null===(i=this.Qf)||void 0===i||i.clearQueue(),this.Hf=[],null===(s=this.Qf)||void 0===s||s.reset(),this.Yc=0}captureLog(e){this.So||this.Yf().captureLog(e)}captureConsoleLog(e){this.So||this.np().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.So||this.np().captureLog(e,{context:t,occurredAtMs:i})}lp(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[ks])}op(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e.Xl)||void 0===t?void 0:t.call(e))||!!(null===(i=y._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}gh(){var e;this.up(),null===(e=this.Qf)||void 0===e||e.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var e;if(this.Wf||!(null==y?void 0:y.console))return;const t=Iu(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize;let i=!0;this.Uf.push(()=>{i=!1});for(const s of Ru){let n;try{n=Au(y.console[s])}catch(e){continue}n&&this.Uf.push(Nc(y.console,s,e=>{const r=(...n)=>{try{i&&this.dp(s,n,t)}catch(e){}return e.apply(y.console,n)};return r.__rrweb_original__=n,r}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(e,t,i){var s;if(this.Wf&&!this.Vf&&0!==t.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>this.zf.length){this.Vf=!0;try{this.zf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const e of this.Uf)e();this.Uf=[]}}fp(){const e=this.zf;return this.up(),e}get logger(){return this.pp||(this.pp={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.pp}flushLogs(e){e?this.gp(e):(this.Zf&&this.Zf.flush().catch(e=>this.mp(e)),this.Qf&&this.Qf.flush().catch(e=>this.mp(e)))}mp(e){ju(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const e=null==y?void 0:y.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.up();const t=e.loadExternalDependency;if(!t)return this.$.error(Dn),void this.up();this.jf=!0;try{t(this._instance,"logs",t=>{if(this.jf=!1,this.So||!this.Nf)return;const i=e.logs;if(t||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",t),this.up();else{var s;const e=this.fp();var n,r;this.hp=i.initializeLogs(null!==(s=this.po)&&void 0!==s?s:this._instance),this.qf=!0,e.length>0&&(null===(n=i.replayConsoleBuffer)||void 0===n||n.call(i,null!==(r=this.po)&&void 0!==r?r:this._instance,e))}})}catch(e){throw this.jf=!1,e}}Kf(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===x.LogsQueue?e():void 0,setPersistedProperty(e,i){var s;e===x.LogsQueue&&t(null!==(s=i)&&void 0!==s?s:[])},js:e=>this.js(e),getLibraryId:()=>ls.LIB_NAME,getLibraryVersion:()=>ls.LIB_VERSION}}js(e){return new Promise(t=>{if(No(this.Yc,3))return void t({kind:"fatal",error:Nu(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=e=>{i||(i=!0,clearTimeout(n),t(e))},n=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Nu(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{const t=e.statusCode;if(this.bp(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Nu(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`logs request failed with status ${t}`)})}}})})}bp(e){(0!==e||this._instance.__loaded)&&(this.Yc=jo(e,this.Yc,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.")))}gp(e){this.ia.length>0&&this._p(e,this.ia,this.ep,ls.LIB_NAME,e=>{this.ia=e}),this.Hf.length>0&&this._p(e,this.Hf,this.rp,Lu,e=>{this.Hf=e})}_p(e,t,i,s,n){if(0===t.length)return;const r=t.map(e=>e.record);n([]);const o=Vi(r,qi(i,ls.LIB_NAME,ls.LIB_VERSION),s,ls.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,U(s)||(t.sessionStartTimestamp=s),U(n)||(t.lastActivityTimestamp=n)}if((null==y||null===(e=y.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?_t(y.location.href):y.location.href),this._instance.featureFlags){const e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},od={metrics:class{constructor(e){this._instance=e,this.$=is("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.So)return;const t=!!(null===(e=this._instance.config.metrics)||void 0===e?void 0:e.network);t&&!this.wp?this.wp=(e=>{let t=!0;const i=()=>t?(e=>{var t;const i=null===(t=e.config.metrics)||void 0===t?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,s=Wu(e,i),n=Gu(e,i);return()=>{t=!1,s(),n()}})(this._instance):!t&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this.Zf&&this.tp===t||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=t,this.Zf=new Qi(this.Kf(),(function(e){var t,i,s,n,r;const o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}})(t),this.$)),this.Zf}count(e,t=1,i){this.Yf().count(e,t,i)}gauge(e,t,i){this.Yf().gauge(e,t,i)}histogram(e,t,i){this.Yf().histogram(e,t,i)}flush(e){if(!this.Zf)return Promise.resolve();if(e){const t=this.Zf.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Zf.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this.Zf)||void 0===e||e.reset()}dispose(){var e,t;this.So=!0,null===(e=this.wp)||void 0===e||e.call(this),this.wp=void 0,null===(t=this.Zf)||void 0===t||t.reset()}Kf(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:e=>t.Ys(e),getLibraryId:()=>ls.LIB_NAME,getLibraryVersion:()=>ls.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1;const n=e=>{s||(s=!0,clearTimeout(r),i(e))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(Ot(Ot({method:"POST",url:this.kp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;n({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};kc.__defaultExtensionClasses=Ot({},Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot(Ot({},Ku),Yu),Ju),Zu),Xu),Qu),td),ed),id),sd),nd),rd),od));const ad=(function(){ls.SDK_DIST_CHANNEL="npm";const e=cc[yc]=new kc;return(function(){function e(){e.done||(e.done=!0,bc=!1,Kn(cc,function(e){e._dom_loaded()}))}(null==u?void 0:u.addEventListener)?"complete"===u.readyState?e():ir(u,"DOMContentLoaded",e,{capture:!1}):a&&ts.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var ld=ad},4481,[]);
16241
16241
  __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return v}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),c=r(d[4]);r(d[5]);var o,u=r(d[6]),l=(o=u)&&o.__esModule?o:{default:o};r(d[7]);var f=r(d[8]),S=r(d[9]),_=r(d[10]),b=r(d[11]),y=r(d[12]);const h=12e3;function j(e){const t=S.useSessionStore.getState().sessions;for(const n of Object.keys(t))if(t[n]?.agents.has(e))return n;return null}function v(){const o=(0,n.c)(17),u=(0,s.useLocalSearchParams)(),l=Array.isArray(u.agentId)?u.agentId[0]:u.agentId,v=(0,s.usePathname)();let x;o[0]!==l?(x=()=>l?j(l):null,o[0]=l,o[1]=x):x=o[1];const[P,R]=(0,c.useState)(x),[A,O]=(0,c.useState)(!1),p=(0,c.useRef)(!1);let E,H,T,w,M;if(o[2]!==l||o[3]!==P?(E=()=>{if(!l||P)return;const e=()=>{const e=j(l);e&&R(e)};e();const t=S.useSessionStore.subscribe(e),n=setTimeout(()=>O(!0),h);return()=>{t(),clearTimeout(n)}},H=[l,P],o[2]=l,o[3]=P,o[4]=E,o[5]=H):(E=o[4],H=o[5]),(0,c.useEffect)(E,H),o[6]!==l||o[7]!==v||o[8]!==P?(T=()=>{!p.current&&l&&P&&(p.current=!0,(0,b.navigateToAgent)({serverId:P,agentId:l,currentPathname:v,pin:!0}))},w=[l,P,v],o[6]=l,o[7]=v,o[8]=P,o[9]=T,o[10]=w):(T=o[9],w=o[10]),(0,c.useEffect)(T,w),!l){let e;return o[11]===Symbol.for("react.memo_cache_sentinel")?(e=(0,y.jsx)(s.Redirect,{href:"/"}),o[11]=e):e=o[11],e}if(A&&!P){let e,t,n;if(o[12]===Symbol.for("react.memo_cache_sentinel")){const n=(0,f.getHostRuntimeStore)().getEarliestOnlineHostServerId();e=s.Redirect,t=n?(0,_.buildHostKanbanRoute)(n):"/welcome",o[12]=e,o[13]=t}else e=o[12],t=o[13];return o[14]!==t?(n=(0,y.jsx)(e,{href:t}),o[14]=t,o[15]=n):n=o[15],n}return o[16]===Symbol.for("react.memo_cache_sentinel")?(M=(0,y.jsx)(e.View,{style:I.container,children:(0,y.jsx)(t.ActivityIndicator,{})}),o[16]=M):M=o[16],M}const I=l.default.create({container:{alignItems:"center",flex:1,justifyContent:"center"}})},4482,[348,2477,350,379,36,654,59,146,3274,3427,3492,3499,279]);
16242
16242
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]);const S={headerShown:!1,animation:"none"},f={gestureEnabled:!1};function k(){const s=(0,t.c)(1);let n;return s[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)(p,{}),s[0]=n):n=s[0],n}function p(){const k=(0,t.c)(10),p=(0,s.useLocalSearchParams)(),h=(0,u.useHosts)(),j=(0,u.useHostRegistryStatus)(),x=(0,n.useHostRuntimeBootstrapState)(),v="string"==typeof p.serverId?p.serverId:null;let _;k[0]!==x.startupBlocker||k[1]!==j||k[2]!==h||k[3]!==v?(_=(0,c.resolveStartupRoute)({route:{kind:"host",serverId:v},startupBlocker:x.startupBlocker,hostRegistryStatus:j,hosts:h}),k[0]=x.startupBlocker,k[1]=j,k[2]=h,k[3]=v,k[4]=_):_=k[4];const y=_;if("redirect"===y.kind){let t;return k[5]!==y.href?(t=(0,l.jsx)(s.Redirect,{href:y.href}),k[5]=y.href,k[6]=t):t=k[6],t}let b;k[7]===Symbol.for("react.memo_cache_sentinel")?(b=(0,l.jsxs)(s.Stack,{screenOptions:S,children:[(0,l.jsx)(s.Stack.Screen,{name:"index"}),(0,l.jsx)(s.Stack.Screen,{name:"workspace/[workspaceId]/index"}),(0,l.jsx)(s.Stack.Screen,{name:"agent/[agentId]",options:f}),(0,l.jsx)(s.Stack.Screen,{name:"sessions"}),(0,l.jsx)(s.Stack.Screen,{name:"open-project"}),(0,l.jsx)(s.Stack.Screen,{name:"settings"})]}),k[7]=b):b=k[7];const I=b;if(!v)return I;let R;return k[8]!==v?(R=(0,l.jsx)(o.HostRouteProvider,{serverId:v,children:I}),k[8]=v,k[9]=R):R=k[9],R}},4483,[350,379,2478,4484,4196,3274,279]);
@@ -16706,5 +16706,5 @@ __d(function(g,r,_i,a,_m,_e,d){"use strict";var e,t=r(d[0]),n=this&&this.__creat
16706
16706
  __r(694);
16707
16707
  __r(341);
16708
16708
  __r(0);
16709
- //# sourceMappingURL=/_expo/static/js/web/index-7f4b61b4899728e465ae27f2a860906b.js.map
16710
- //# debugId=614ded33-551e-44e6-86f4-3a3449c00f7a
16709
+ //# sourceMappingURL=/_expo/static/js/web/index-983aab32d837ec9881e4472b1a85046b.js.map
16710
+ //# debugId=faa48941-9f06-48dd-9b14-0f2193390511
@@ -191,6 +191,6 @@
191
191
  <body>
192
192
  <noscript>You need to enable JavaScript to run this app.</noscript>
193
193
  <div id="root"></div>
194
- <script src="/_expo/static/js/web/index-7f4b61b4899728e465ae27f2a860906b.js" defer></script>
194
+ <script src="/_expo/static/js/web/index-983aab32d837ec9881e4472b1a85046b.js" defer></script>
195
195
  </body>
196
196
  </html>
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperdrive.bot/fleet-server",
3
- "version": "0.3.142",
3
+ "version": "0.3.144",
4
4
  "description": "Paseo backend server",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -66,11 +66,11 @@
66
66
  "@agentclientprotocol/sdk": "^0.17.1",
67
67
  "@anthropic-ai/claude-agent-sdk": "^0.3.195",
68
68
  "@anthropic-ai/sdk": "^0.104.2",
69
- "@hyperdrive.bot/fleet-client": "0.3.142",
70
- "@hyperdrive.bot/fleet-extension-sdk": "0.3.142",
71
- "@hyperdrive.bot/fleet-highlight": "0.3.142",
72
- "@hyperdrive.bot/fleet-protocol": "0.3.142",
73
- "@hyperdrive.bot/fleet-relay": "0.3.142",
69
+ "@hyperdrive.bot/fleet-client": "0.3.144",
70
+ "@hyperdrive.bot/fleet-extension-sdk": "0.3.144",
71
+ "@hyperdrive.bot/fleet-highlight": "0.3.144",
72
+ "@hyperdrive.bot/fleet-protocol": "0.3.144",
73
+ "@hyperdrive.bot/fleet-relay": "0.3.144",
74
74
  "@isaacs/ttlcache": "^2.1.4",
75
75
  "@modelcontextprotocol/sdk": "^1.20.1",
76
76
  "@opencode-ai/sdk": "1.2.6",