posthog-js 1.187.1 → 1.187.2
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.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -10
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -10
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -10
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -10
- package/dist/array.no-external.js.map +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/external-scripts-loader.js +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/main.js +1 -10
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -10
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -10
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -10
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.js +1 -10
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder-v2.js +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/dist/tracing-headers.js +1 -1
- package/dist/tracing-headers.js.map +1 -1
- package/dist/web-vitals.js +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,i=Array.prototype,s=i.forEach,n=i.indexOf,r=null==t?void 0:t.navigator,o=null==t?void 0:t.document,a=null==t?void 0:t.location,l=null==t?void 0:t.fetch,c=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,u=null==t?void 0:t.AbortController,d=null==r?void 0:r.userAgent,h=null!=e?e:{};const p={DEBUG:!1,LIB_VERSION:"1.187.1"},_={},g=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function f(e,t,i){if(D(e))if(s&&e.forEach===s)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(let s=0,n=e.length;s<n;s++)if(s in e&&t.call(i,e[s],s)===_)return}function v(e,t,i){if(!V(e)){if(D(e))return f(e,t,i);if(Q(e)){for(const s of e.entries())if(t.call(i,s[1],s[0])===_)return}else for(const s in e)if(L.call(e,s)&&t.call(i,e[s],s)===_)return}}const m=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return f(i,(function(t){for(const i in t)void 0!==t[i]&&(e[i]=t[i])})),e};function y(e,t){return-1!==e.indexOf(t)}function b(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 w=function(e){try{return e()}catch{return}},S=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){X.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),X.critical(e)}}},E=function(e){const t={};return v(e,(function(e,i){U(e)&&e.length>0&&(t[i]=e)})),t},k=function(e){return e.replace(/^\$/,"")};function x(e,t){return function(e,t){const i=new Set;return function e(s,n){if(s!==Object(s))return t?t(s,n):s;if(i.has(s))return;let r;return i.add(s),D(s)?(r=[],f(s,(t=>{r.push(e(t))}))):(r={},v(s,((t,s)=>{i.has(t)||(r[s]=e(t,s))}))),r}(e)}(e,(e=>U(e)&&!z(t)?e.slice(0,t):e))}const I=function(e){let t,i,s,n="",r=0;for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){const r=e.charCodeAt(s);let o=null;r<128?i++:o=r>127&&r<2048?String.fromCharCode(r>>6|192,63&r|128):String.fromCharCode(r>>12|224,r>>6&63|128,63&r|128),z(o)||(i>t&&(n+=e.substring(t,i)),n+=o,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},C=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(i,s,n,r,o){if(i)if(i.addEventListener&&!r)i.addEventListener(s,n,!!o);else{const r="on"+s,o=i[r];i[r]=function(i,s,n){return function(r){if(!(r=r||t(null==e?void 0:e.event)))return;let o,a=!0;N(n)&&(o=n(r));const l=s.call(i,r);return!1!==o&&!1!==l||(a=!1),a}}(i,n,o)}else X.error("No valid element provided to register_event")}}();function T(e){const t=null==e?void 0:e.hostname;return!!U(t)&&"herokuapp.com"!==t.split(".").slice(-2).join(".")}function P(e,t){for(let i=0;i<e.length;i++)if(t(e[i]))return e[i]}const R="$copy_autocapture",F=["$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"];var $;exports.Compression=void 0,($=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",$.Base64="base64";const M=Array.isArray,A=Object.prototype,L=A.hasOwnProperty,O=A.toString,D=M||function(e){return"[object Array]"===O.call(e)},N=e=>"function"==typeof e,q=e=>e===Object(e)&&!D(e),B=e=>{if(q(e)){for(const t in e)if(L.call(e,t))return!1;return!0}return!1},H=e=>void 0===e,U=e=>"[object String]"==O.call(e),W=e=>U(e)&&0===e.trim().length,z=e=>null===e,V=e=>H(e)||z(e),G=e=>"[object Number]"==O.call(e),j=e=>"[object Boolean]"===O.call(e),Q=e=>e instanceof FormData,J=e=>y(F,e),Y="[PostHog.js]",X={_log:function(t){if(e&&(p.DEBUG||h.POSTHOG_DEBUG)&&!H(e.console)&&e.console){const r="__rrweb_original__"in e.console[t]?e.console[t].__rrweb_original__:e.console[t];for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];r(Y,...s)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];X._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];X._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];X._log("error",...t)},critical:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.error(Y,...t)},uninitializedWarning:e=>{X.error(`You must initialize PostHog before calling ${e}`)}},K=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return X.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=()=>{if(!o)return i("document not found");const e=o.createElement("script");e.type="text/javascript",e.crossOrigin="anonymous",e.src=t,e.onload=e=>i(void 0,e),e.onerror=e=>i(e);const s=o.querySelectorAll("body > script");var n;s.length>0?null===(n=s[0].parentNode)||void 0===n||n.insertBefore(e,s[0]):o.body.appendChild(e)};null!=o&&o.body?s():null==o||o.addEventListener("DOMContentLoaded",s)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{let s=`/static/${t}.js?v=${e.version}`;if("toolbar"===t){const e=3e5;s=`${s}&t=${Math.floor(Date.now()/e)*e}`}const n=e.requestRouter.endpointFor("assets",s);K(e,n,i)},h.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{const s=e.requestRouter.endpointFor("api",t);K(e,s,i)};const Z="$people_distinct_id",ee="__alias",te="__timers",ie="$autocapture_disabled_server_side",se="$heatmaps_enabled_server_side",ne="$exception_capture_enabled_server_side",re="$web_vitals_enabled_server_side",oe="$dead_clicks_enabled_server_side",ae="$web_vitals_allowed_metrics",le="$session_recording_enabled_server_side",ce="$console_log_recording_enabled_server_side",ue="$session_recording_network_payload_capture",de="$session_recording_canvas_recording",he="$replay_sample_rate",pe="$replay_minimum_duration",_e="$sesid",ge="$session_is_sampled",fe="$session_recording_url_trigger_activated_session",ve="$session_recording_event_trigger_activated_session",me="$enabled_feature_flags",ye="$early_access_features",be="$stored_person_properties",we="$stored_group_properties",Se="$surveys",Ee="$surveys_activated",ke="$flag_call_reported",xe="$user_state",Ie="$client_session_props",Ce="$capture_rate_limit",Te="$initial_campaign_params",Pe="$initial_referrer_info",Re="$initial_person_info",Fe="$epp",$e="__POSTHOG_TOOLBAR__",Me=[Z,ee,"__cmpns",te,le,se,_e,me,xe,ye,we,be,Se,ke,Ie,Ce,Te,Pe,Fe],Ae="$active_feature_flags",Le="$override_feature_flags",Oe="$feature_flag_payloads",De=e=>{const t={};for(const[i,s]of b(e||{}))s&&(t[i]=s);return t};class Ne{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){const e=this.instance.get_property(me),t=this.instance.get_property(Le);if(!t)return e||{};const i=m({},e),s=Object.keys(t);for(let e=0;e<s.length;e++)i[s[e]]=t[s[e]];return this._override_warning||(X.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){return this.instance.get_property(Oe)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())}),5)}_reloadFeatureFlagsRequest(){if(this.instance.config.advanced_disable_feature_flags)return;this.setReloadingPaused(!0);const e=this.instance.config.token,t=this.instance.get_property(be),i=this.instance.get_property(we),s={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:i,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:s,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var t;this.setReloadingPaused(!1);let i=!0;200===e.statusCode&&(this.$anon_distinct_id=void 0,i=!1),this.receivedFeatureFlags(null!==(t=e.json)&&void 0!==t?t:{},i),this._startReloadTimer()}})}getFeatureFlag(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0))return void X.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.");const i=this.getFlagVariants()[e],s=`${i}`,n=this.instance.get_property(ke)||{};var r;!t.send_event&&"send_event"in t||(e in n&&n[e].includes(s)||(D(n[e])?n[e].push(s):n[e]=[s],null===(r=this.instance.persistence)||void 0===r||r.register({[ke]:n}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:i})));return i}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);X.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(!this.instance.persistence)return;this.instance.decideEndpointWasHit=!0;const i=this.getFlagVariants(),s=this.getFlagPayloads();!function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=e.featureFlags,r=e.featureFlagPayloads;if(!n)return;if(D(n)){const e={};if(n)for(let t=0;t<n.length;t++)e[n[t]]=!0;return void(t&&t.register({[Ae]:n,[me]:e}))}let o=n,a=r;e.errorsWhileComputingFlags&&(o={...i,...o},a={...s,...a}),t&&t.register({[Ae]:Object.keys(De(o)),[me]:o||{},[Oe]:a||{}})}(e,this.instance.persistence,i,s),this._fireFeatureFlagsCallbacks(t)}override(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return X.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(Le);else if(D(e)){const t={};for(let i=0;i<e.length;i++)t[e[i]]=!0;this.instance.persistence.register({[Le]:t})}else this.instance.persistence.register({[Le]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i;const s={[`$feature_enrollment/${e}`]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:s}),this.setPersonPropertiesForFlags(s,!1);const n={...this.getFlagVariants(),[e]:t};null===(i=this.instance.persistence)||void 0===i||i.register({[Ae]:Object.keys(De(n)),[me]:n}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.instance.get_property(ye);if(i&&!t)return e(i);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api",`/api/early_access_features/?token=${this.instance.config.token}`),method:"GET",callback:t=>{var i;if(!t.json)return;const s=t.json.earlyAccessFeatures;return null===(i=this.instance.persistence)||void 0===i||i.register({[ye]:s}),e(s)}})}_prepareFeatureFlagsForCallbacks(){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)),{})}}_fireFeatureFlagsCallbacks(e){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.instance.get_property(be)||{};this.instance.register({[be]:{...i,...e}}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(be)}setGroupPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.instance.get_property(we)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]={...i[t],...e[t]},delete e[t]})),this.instance.register({[we]:{...i,...e}}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.instance.get_property(we)||{};this.instance.register({[we]:{...t,[e]:{}}})}else this.instance.unregister(we)}}
|
|
2
|
-
/**
|
|
3
|
-
* uuidv7: An experimental implementation of the proposed UUID Version 7
|
|
4
|
-
*
|
|
5
|
-
* @license Apache-2.0
|
|
6
|
-
* @copyright 2021-2023 LiosK
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*
|
|
9
|
-
* from https://github.com/LiosK/uuidv7/blob/e501462ea3d23241de13192ceae726956f9b3b7d/src/index.ts
|
|
10
|
-
*/Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return G(e)&&isFinite(e)&&Math.floor(e)===e});const qe="0123456789abcdef";class Be{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");const n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Be(n)}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e=e+qe.charAt(this.bytes[t]>>>4)+qe.charAt(15&this.bytes[t]),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 Be(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class He{timestamp=0;counter=0;random=new ze;generate(){const e=this.generateOrAbort();if(H(e)){this.timestamp=0;const e=this.generateOrAbort();if(H(e))throw new Error("Could not generate UUID after timestamp reset");return e}return e}generateOrAbort(){const e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Be.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}let Ue,We=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!H(e.crypto)&&crypto.getRandomValues&&(We=e=>crypto.getRandomValues(e));class ze{buffer=new Uint32Array(8);cursor=1/0;nextUint32(){return this.cursor>=this.buffer.length&&(We(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}const Ve=()=>Ge().toString(),Ge=()=>(Ue||(Ue=new He)).generate(),je="Thu, 01 Jan 1970 00:00:00 GMT";let Qe="";const Je=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ye(e,t){if(t){let t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if(Qe)return Qe;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_"+Ve(),r=new RegExp("(^|;)\\s*"+n+"=1");for(;!Qe&&s--;){const e=i.slice(s).join("."),o=n+"=1;domain=."+e;t.cookie=o,r.test(t.cookie)&&(t.cookie=o+";expires="+je,Qe=e)}return Qe}(e);if(!t){const i=(e=>{const t=e.match(Je);return t?t[0]:""})(e);i!==t&&X.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}const Xe={is_supported:()=>!!o,error:function(e){X.error("cookieStore error: "+e)},get:function(e){if(o){try{const t=e+"=",i=o.cookie.split(";").filter((e=>e.length));for(let e=0;e<i.length;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{}return null}},parse:function(e){let t;try{t=JSON.parse(Xe.get(e))||{}}catch{}return t},set:function(e,t,i,s,n){if(o)try{let r="",a="";const l=Ye(o.location.hostname,s);if(i){const e=new Date;e.setTime(e.getTime()+24*i*60*60*1e3),r="; expires="+e.toUTCString()}n&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&X.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,c}catch{return}},remove:function(e,t){try{Xe.set(e,"",-1,t)}catch{return}}};let Ke=null;const Ze={is_supported:function(){if(!z(Ke))return Ke;let t=!0;if(H(e))t=!1;else try{const e="__mplssupport__",i="xyz";Ze.set(e,i),'"xyz"'!==Ze.get(e)&&(t=!1),Ze.remove(e)}catch{t=!1}return t||X.error("localStorage unsupported; falling back to cookie store"),Ke=t,t},error:function(e){X.error("localStorage error: "+e)},get:function(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Ze.error(e)}return null},parse:function(e){try{return JSON.parse(Ze.get(e))||{}}catch{}return null},set:function(t,i){try{null==e||e.localStorage.setItem(t,JSON.stringify(i))}catch(e){Ze.error(e)}},remove:function(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Ze.error(e)}}},et=["distinct_id",_e,ge,Fe],tt={...Ze,parse:function(e){try{let t={};try{t=Xe.parse(e)||{}}catch{}const i=m(t,JSON.parse(Ze.get(e)||"{}"));return Ze.set(e,i),i}catch{}return null},set:function(e,t,i,s,n,r){try{Ze.set(e,t,void 0,void 0,r);const o={};et.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&Xe.set(e,o,i,s,n,r)}catch(e){Ze.error(e)}},remove:function(t,i){try{null==e||e.localStorage.removeItem(t),Xe.remove(t,i)}catch(e){Ze.error(e)}}},it={},st={is_supported:function(){return!0},error:function(e){X.error("memoryStorage error: "+e)},get:function(e){return it[e]||null},parse:function(e){return it[e]||null},set:function(e,t){it[e]=t},remove:function(e){delete it[e]}};let nt=null;const rt={is_supported:function(){if(!z(nt))return nt;if(nt=!0,H(e))nt=!1;else try{const e="__support__",t="xyz";rt.set(e,t),'"xyz"'!==rt.get(e)&&(nt=!1),rt.remove(e)}catch{nt=!1}return nt},error:function(e){X.error("sessionStorage error: ",e)},get:function(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){rt.error(e)}return null},parse:function(e){try{return JSON.parse(rt.get(e))||null}catch{}return null},set:function(t,i){try{null==e||e.sessionStorage.setItem(t,JSON.stringify(i))}catch(e){rt.error(e)}},remove:function(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){rt.error(e)}}},ot=["localhost","127.0.0.1"],at=e=>{const t=null==o?void 0:o.createElement("a");return H(t)?null:(t.href=e,t)},lt=function(e,t){return!!function(e){try{new RegExp(e)}catch{return!1}return!0}(t)&&new RegExp(t).test(e)},ct=function(e){let t,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&";const n=[];return v(e,(function(e,s){H(e)||H(s)||"undefined"===s||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(s),n[n.length]=i+"="+t)})),n.join(s)},ut=function(e,t){const i=((e.split("#")[0]||"").split("?")[1]||"").split("&");let s;for(let e=0;e<i.length;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!D(s)||s.length<2)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch{X.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},dt=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ht="Mobile",pt="iOS",_t="Android",gt="Tablet",ft=_t+" "+gt,vt="iPad",mt="Apple",yt=mt+" Watch",bt="Safari",wt="BlackBerry",St="Samsung",Et=St+"Browser",kt=St+" Internet",xt="Chrome",It=xt+" OS",Ct=xt+" "+pt,Tt="Internet Explorer",Pt=Tt+" "+ht,Rt="Opera",Ft=Rt+" Mini",$t="Edge",Mt="Microsoft "+$t,At="Firefox",Lt=At+" "+pt,Ot="Nintendo",Dt="PlayStation",Nt="Xbox",qt=_t+" "+ht,Bt=ht+" "+bt,Ht="Windows",Ut=Ht+" Phone",Wt="Nokia",zt="Ouya",Vt="Generic",Gt=Vt+" "+ht.toLowerCase(),jt=Vt+" "+gt.toLowerCase(),Qt="Konqueror",Jt="(\\d+(\\.\\d+)?)",Yt=new RegExp("Version/"+Jt),Xt=new RegExp(Nt,"i"),Kt=new RegExp(Dt+" \\w+","i"),Zt=new RegExp(Ot+" \\w+","i"),ei=new RegExp(wt+"|PlayBook|BB10","i"),ti={"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"};const ii=(e,t)=>t&&y(t,mt)||function(e){return y(e,bt)&&!y(e,xt)&&!y(e,_t)}(e),si=function(e,t){return t=t||"",y(e," OPR/")&&y(e,"Mini")?Ft:y(e," OPR/")?Rt:ei.test(e)?wt:y(e,"IE"+ht)||y(e,"WPDesktop")?Pt:y(e,Et)?kt:y(e,$t)||y(e,"Edg/")?Mt:y(e,"FBIOS")?"Facebook "+ht:y(e,"UCWEB")||y(e,"UCBrowser")?"UC Browser":y(e,"CriOS")?Ct:y(e,"CrMo")?xt:y(e,_t)&&y(e,bt)?qt:y(e,xt)?xt:y(e,"FxiOS")?Lt:y(e.toLowerCase(),Qt.toLowerCase())?Qt:ii(e,t)?y(e,ht)?Bt:bt:y(e,At)?At:y(e,"MSIE")||y(e,"Trident/")?Tt:y(e,"Gecko")?At:""},ni={[Pt]:[new RegExp("rv:"+Jt)],[Mt]:[new RegExp($t+"?\\/"+Jt)],[xt]:[new RegExp("("+xt+"|CrMo)\\/"+Jt)],[Ct]:[new RegExp("CriOS\\/"+Jt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Jt)],[bt]:[Yt],[Bt]:[Yt],[Rt]:[new RegExp("(Opera|OPR)\\/"+Jt)],[At]:[new RegExp(At+"\\/"+Jt)],[Lt]:[new RegExp("FxiOS\\/"+Jt)],[Qt]:[new RegExp("Konqueror[:/]?"+Jt,"i")],[wt]:[new RegExp(wt+" "+Jt),Yt],[qt]:[new RegExp("android\\s"+Jt,"i")],[kt]:[new RegExp(Et+"\\/"+Jt)],[Tt]:[new RegExp("(rv:|MSIE )"+Jt)],Mozilla:[new RegExp("rv:"+Jt)]},ri=[[new RegExp(Nt+"; "+Nt+" (.*?)[);]","i"),e=>[Nt,e&&e[1]||""]],[new RegExp(Ot,"i"),[Ot,""]],[new RegExp(Dt,"i"),[Dt,""]],[ei,[wt,""]],[new RegExp(Ht,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ut,""];if(new RegExp(ht).test(t)&&!/IEMobile\b/.test(t))return[Ht+" "+ht,""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){const e=i[1];let s=ti[e]||"";return/arm/i.test(t)&&(s="RT"),[Ht,s]}return[Ht,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){const t=[e[3],e[4],e[5]||"0"];return[pt,t.join(".")]}return[pt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=H(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+_t+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+_t+")","i"),e=>{if(e&&e[2]){const t=[e[2],e[3],e[4]||"0"];return[_t,t.join(".")]}return[_t,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];if(e&&e[1]){const i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[It,""]],[/Linux|debian/i,["Linux",""]]],oi=function(e){return Zt.test(e)?Ot:Kt.test(e)?Dt:Xt.test(e)?Nt:new RegExp(zt,"i").test(e)?zt:new RegExp("("+Ut+"|WPDesktop)","i").test(e)?Ut:/iPad/.test(e)?vt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?yt:ei.test(e)?wt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Wt,"i").test(e)?Wt:/(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(ht).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)?_t:ft:_t:new RegExp("(pda|"+ht+")","i").test(e)?Gt:new RegExp(gt,"i").test(e)&&!new RegExp(gt+" pc","i").test(e)?jt:""},ai="https?://(.*)",li=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],ci={campaignParams:function(e){return o?this._campaignParamsFromUrl(o.URL,e):{}},_campaignParamsFromUrl:function(e,t){const i=li.concat(t||[]),s={};return v(i,(function(t){const i=ut(e,t);s[t]=i||null})),s},_searchEngine:function(e){return e?0===e.search(ai+"google.([^/?]*)")?"google":0===e.search(ai+"bing.com")?"bing":0===e.search(ai+"yahoo.com")?"yahoo":0===e.search(ai+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){const t=ci._searchEngine(e),i="yahoo"!=t?"q":"p",s={};if(!z(t)){s.$search_engine=t;const e=o?ut(o.referrer,i):"";e.length&&(s.ph_keyword=e)}return s},searchInfo:function(){const e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:si,browserVersion:function(e,t){const i=si(e,t),s=ni[i];if(H(s))return null;for(let t=0;t<s.length;t++){const i=s[t],n=e.match(i);if(n)return parseFloat(n[n.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(let t=0;t<ri.length;t++){const[i,s]=ri[t],n=i.exec(e),r=n&&(N(s)?s(n,e):s);if(r)return r}return["",""]},device:oi,deviceType:function(e){const t=oi(e);return t===vt||t===ft||"Kobo"===t||"Kindle Fire"===t||t===jt?gt:t===Ot||t===Nt||t===Dt||t===zt?"Console":t===yt?"Wearable":t?ht:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=at(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:null==a?void 0:a.href}},initialPersonPropsFromInfo:function(e){var t;const{r:i,u:s}=e,n={$initial_referrer:i,$initial_referring_domain:null==i?void 0:"$direct"==i?"$direct":null===(t=at(i))||void 0===t?void 0:t.host};if(s){n.$initial_current_url=s;const e=at(s);n.$initial_host=null==e?void 0:e.host,n.$initial_pathname=null==e?void 0:e.pathname;v(this._campaignParamsFromUrl(s),(function(e,t){n["$initial_"+k(t)]=e}))}if(i){v(this._searchInfoFromReferrer(i),(function(e,t){n["$initial_"+k(t)]=e}))}return n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},properties:function(){if(!d)return{};const[t,i]=ci.os(d);return m(E({$os:t,$os_version:i,$browser:ci.browser(d,navigator.vendor),$device:ci.device(d),$device_type:ci.deviceType(d),$timezone:ci.timezone()}),{$current_url:null==a?void 0:a.href,$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:ci.browserVersion(d,navigator.vendor),$browser_language:ci.browserLanguage(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:p.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!d)return{};const[e,t]=ci.os(d);return m(E({$os:e,$os_version:t,$browser:ci.browser(d,navigator.vendor)}),{$browser_version:ci.browserVersion(d,navigator.vendor)})}},ui=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class di{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(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.storage=this.buildStorage(e),this.load(),e.debug&&X.info("Persistence loaded",e.persistence,{...this.props}),this.update_config(e,e),this.save()}buildStorage(e){let t;-1===ui.indexOf(e.persistence.toLowerCase())&&(X.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=e.persistence.toLowerCase();return t="localstorage"===i&&Ze.is_supported()?Ze:"localstorage+cookie"===i&&tt.is_supported()?tt:"sessionstorage"===i&&rt.is_supported()?rt:"memory"===i?st:"cookie"===i?Xe:tt.is_supported()?tt:Xe,t}properties(){const e={};return v(this.props,(function(t,i){if(i===me&&q(t)){const i=Object.keys(t);for(let s=0;s<i.length;s++)e[`$feature/${i[s]}`]=t[i[s]]}else(function(e,t){let i=!1;return z(e)?i:n&&e.indexOf===n?-1!=e.indexOf(t):(v(e,(function(e){if(i||(i=e===t))return _})),i)})(Me,i)||(e[i]=t)})),e}load(){if(this.disabled)return;const e=this.storage.parse(this.name);e&&(this.props=m({},e))}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){H(t)&&(t="None"),this.expire_days=H(i)?this.default_expiry:i;let s=!1;if(v(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.expire_days=H(t)?this.default_expiry:t;let i=!1;if(v(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){const e=ci.campaignParams(this.config.custom_campaign_params);B(E(e))||this.register(ci.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0}}update_search_keyword(){this.register(ci.searchInfo())}update_referrer_info(){this.register_once(ci.referrerInfo(),void 0)}set_initial_person_info(){this.props[Te]||this.props[Pe]||this.register_once({[Re]:ci.initialPersonInfo()},void 0)}get_referrer_info(){return E({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){const e={};v([Pe,Te],(t=>{const i=this.props[t];i&&v(i,(function(t,i){e["$initial_"+k(i)]=t}))}));const t=this.props[Re];if(t){const i=ci.initialPersonPropsFromInfo(t);m(e,i)}return e}safe_merge(e){return v(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){const t=this.buildStorage(e),i=this.props;this.clear(),this.storage=t,this.props=i,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){const i=this.props[te]||{};i[e]=t,this.props[te]=i,this.save()}remove_event_timer(e){const t=(this.props[te]||{})[e];return H(t)||(delete this.props[te][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function hi(e){var t;return(null===(t=JSON.stringify(e,function(){const e=[];return function(t,i){if(q(i)){for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}()))||void 0===t?void 0:t.length)||0}function pi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.data.slice(0,t),s=e.data.slice(t);return[pi({size:hi(i),data:i,sessionId:e.sessionId,windowId:e.windowId}),pi({size:hi(s),data:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var _i=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(_i||{}),gi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(gi||{});function fi(e){var t;return e.id===$e||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function vi(e){return!!e&&1===e.nodeType}function mi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function yi(e){return!!e&&3===e.nodeType}function bi(e){return!!e&&11===e.nodeType}function wi(e){return e?g(e).split(/\s+/):[]}function Si(t){const i=null==e?void 0:e.location.href;return!!(i&&t&&t.some((e=>i.match(e))))}function Ei(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 wi(t)}function ki(e){return V(e)?null:g(e).split(/(\s+)/).filter((e=>Ni(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xi(e){let t="";return Ri(e)&&!Fi(e)&&e.childNodes&&e.childNodes.length&&v(e.childNodes,(function(e){var i;yi(e)&&e.textContent&&(t+=null!==(i=ki(e.textContent))&&void 0!==i?i:"")})),g(t)}function Ii(e){return H(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}const Ci=["a","button","form","input","select","textarea","label"];function Ti(e){const t=e.parentNode;return!(!t||!vi(t))&&t}function Pi(t,i){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!e||!t||mi(t,"html")||!vi(t))return!1;if(null!=s&&s.url_allowlist&&!Si(s.url_allowlist))return!1;if(null!=s&&s.url_ignorelist&&Si(s.url_ignorelist))return!1;if(null!=s&&s.dom_event_allowlist){const e=s.dom_event_allowlist;if(e&&!e.some((e=>i.type===e)))return!1}let o=!1;const a=[t];let l=!0,c=t;for(;c.parentNode&&!mi(c,"body");)if(bi(c.parentNode))a.push(c.parentNode.host),c=c.parentNode.host;else{if(l=Ti(c),!l)break;if(n||Ci.indexOf(l.tagName.toLowerCase())>-1)o=!0;else{const t=e.getComputedStyle(l);t&&"pointer"===t.getPropertyValue("cursor")&&(o=!0)}a.push(l),c=l}if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(H(i))return!0;for(const t of e)if(i.some((e=>t.tagName.toLowerCase()===e)))return!0;return!1}(a,s))return!1;if(!function(e,t){const i=null==t?void 0:t.css_selector_allowlist;if(H(i))return!0;for(const t of e)if(i.some((e=>t.matches(e))))return!0;return!1}(a,s))return!1;const u=e.getComputedStyle(t);if(u&&"pointer"===u.getPropertyValue("cursor")&&"click"===i.type)return!0;const d=t.tagName.toLowerCase();switch(d){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return o?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Ci.indexOf(d)>-1||"true"===t.getAttribute("contenteditable"))}}function Ri(e){for(let t=e;t.parentNode&&!mi(t,"body");t=t.parentNode){const e=Ei(t);if(y(e,"ph-sensitive")||y(e,"ph-no-capture"))return!1}if(y(Ei(e),"ph-include"))return!0;const t=e.type||"";if(U(t))switch(t.toLowerCase()){case"hidden":case"password":return!1}const i=e.name||e.id||"";if(U(i)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Fi(e){return!!(mi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||mi(e,"select")||mi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const $i="(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})",Mi=new RegExp(`^(?:${$i})$`),Ai=new RegExp($i),Li="\\d{3}-?\\d{2}-?\\d{4}",Oi=new RegExp(`^(${Li})$`),Di=new RegExp(`(${Li})`);function Ni(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(V(e))return!1;if(U(e)){e=g(e);if((t?Mi:Ai).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Oi:Di).test(e))return!1}return!0}function qi(e){let t=xi(e);return t=`${t} ${Bi(e)}`.trim(),Ni(t)?t:""}function Bi(e){let t="";return e&&e.childNodes&&e.childNodes.length&&v(e.childNodes,(function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=xi(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Bi(e)}`.trim())}catch(e){X.error(e)}})),t}function Hi(e){return function(e){const t=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={...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 b(n).sort(((e,t)=>{let[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{let[t,i]=e;return r[Ui(t.toString())]=Ui(i.toString())})),s+=":",s+=b(n).map((e=>{let[t,i]=e;return`${t}="${i}"`})).join(""),s}));return t.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:Wi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return b(e).filter((e=>{let[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{let[t,i]=e;return s.attributes[t]=i})),s}))}(e))}function Ui(e){return e.replace(/"|\\"/g,'\\"')}function Wi(e){const t=e.attr__class;return t?D(t)?t:wi(t):void 0}const zi="[SessionRecording]",Vi="redacted",Gi={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ji=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Qi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Ji=["/s/","/e/","/i/"];function Yi(e,t,i,s){if(V(e))return e;let n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return U(n)&&(n=parseInt(n)),n>i?zi+` ${s} body too large to record (${n} bytes)`:e}function Xi(e,t){if(V(e))return e;let i=e;return Ni(i,!1)||(i=zi+" "+t+" body "+Vi),v(Qi,(e=>{var s,n;null!==(s=i)&&void 0!==s&&s.length&&-1!==(null===(n=i)||void 0===n?void 0:n.indexOf(e))&&(i=zi+" "+t+" body "+Vi+" as might contain: "+e)})),i}const Ki=(e,t)=>{const i={payloadSizeLimitBytes:Gi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Gi.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Gi.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,n=!1!==e.session_recording.recordBody&&t.recordBody,r=!1!==e.capture_performance&&t.recordPerformance,o=(e=>{var t;const i=Math.min(1e6,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:1e6);return e=>(null!=e&&e.requestBody&&(e.requestBody=Yi(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=Yi(e.responseBody,e.responseHeaders,i,"Response")),e)})(i),a=e=>o((e=>{const t=at(e.name);if(!(t&&t.pathname&&Ji.some((e=>0===t.pathname.indexOf(e)))))return e})((e=>{const t=e.requestHeaders;return V(t)||v(Object.keys(null!=t?t:{}),(e=>{ji.includes(e.toLowerCase())&&(t[e]=Vi)})),e})(e))),l=N(e.session_recording.maskNetworkRequestFn);return l&&N(e.session_recording.maskCapturedNetworkRequestFn)&&X.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),l&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});return{...t,name:null==i?void 0:i.url}}),i.maskRequestFn=N(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s,n;const r=a(t);return r&&null!==(i=null===(s=(n=e.session_recording).maskCapturedNetworkRequestFn)||void 0===s?void 0:s.call(n,r))&&void 0!==i?i:void 0}:e=>function(e){if(!H(e))return e.requestBody=Xi(e.requestBody,"Request"),e.responseBody=Xi(e.responseBody,"Response"),e}(a(e)),{...Gi,...i,recordHeaders:s,recordBody:n,recordPerformance:r,recordInitialRequests:r}};function Zi(e,t,i,s){return t>i&&(X.warn("min cannot be greater than max."),t=i),G(e)?e>i?(s&&X.warn(s+" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(s&&X.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&X.warn(s+" must be a number. Defaulting to max value:"+i),i)}class es{bucketSize=100;refillRate=10;mutationBuckets={};loggedTracker={};constructor(e){var t,i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rrweb=e,this.options=s,this.refillRate=Zi(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Zi(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}refillBuckets=()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))};getNodeOrRelevantParent=e=>{const t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this.rrweb.mirror.getId(e),e]}return[e,t]};numberOfChanges=e=>{var t,i,s,n,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(n=e.attributes)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)};throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t;const[i,s]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[i])return!1;var n,r;(this.mutationBuckets[i]=null!==(t=this.mutationBuckets[i])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[i]=Math.max(this.mutationBuckets[i]-1,0),0===this.mutationBuckets[i])&&(this.loggedTracker[i]||(this.loggedTracker[i]=!0,null===(n=(r=this.options).onBlockedNode)||void 0===n||n.call(r,i,s)));return e})));const s=this.numberOfChanges(t);return 0!==s||i===s?e:void 0}}var ts=Uint8Array,is=Uint16Array,ss=Uint32Array,ns=new ts([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]),rs=new ts([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]),os=new ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),as=function(e,t){for(var i=new is(31),s=0;s<31;++s)i[s]=t+=1<<e[s-1];var n=new ss(i[30]);for(s=1;s<30;++s)for(var r=i[s];r<i[s+1];++r)n[r]=r-i[s]<<5|s;return[i,n]},ls=as(ns,2),cs=ls[0],us=ls[1];cs[28]=258,us[258]=28;for(var ds=as(rs,0)[1],hs=new is(32768),ps=0;ps<32768;++ps){var _s=(43690&ps)>>>1|(21845&ps)<<1;_s=(61680&(_s=(52428&_s)>>>2|(13107&_s)<<2))>>>4|(3855&_s)<<4,hs[ps]=((65280&_s)>>>8|(255&_s)<<8)>>>1}var gs=function(e,t,i){for(var s=e.length,n=0,r=new is(t);n<s;++n)++r[e[n]-1];var o,a=new is(t);for(n=0;n<t;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new is(1<<t);var l=15-t;for(n=0;n<s;++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;d<=h;++d)o[hs[d]>>>l]=c}else for(o=new is(s),n=0;n<s;++n)o[n]=hs[a[e[n]-1]++]>>>15-e[n];return o},fs=new ts(288);for(ps=0;ps<144;++ps)fs[ps]=8;for(ps=144;ps<256;++ps)fs[ps]=9;for(ps=256;ps<280;++ps)fs[ps]=7;for(ps=280;ps<288;++ps)fs[ps]=8;var vs=new ts(32);for(ps=0;ps<32;++ps)vs[ps]=5;var ms=gs(fs,9,0),ys=gs(vs,5,0),bs=function(e){return(e/8>>0)+(7&e&&1)},ws=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof is?is:e instanceof ss?ss:ts)(i-t);return s.set(e.subarray(t,i)),s},Ss=function(e,t,i){i<<=7&t;var s=t/8>>0;e[s]|=i,e[s+1]|=i>>>8},Es=function(e,t,i){i<<=7&t;var s=t/8>>0;e[s]|=i,e[s+1]|=i>>>8,e[s+2]|=i>>>16},ks=function(e,t){for(var i=[],s=0;s<e.length;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new ts(0),0];if(1==n){var o=new ts(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[c].f<i[d].f?c++:d++],l=i[c!=u&&i[c].f<i[d].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;s<n;++s)r[s].s>h&&(h=r[s].s);var p=new is(h+1),_=xs(i[u-1],p,0);if(_>t){s=0;var g=0,f=_-t,v=1<<f;for(r.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));s<n;++s){var m=r[s].s;if(!(p[m]>t))break;g+=v-(1<<_-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=r[s].s;p[y]<t?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=r[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new ts(p),_]},xs=function(e,t,i){return-1==e.s?Math.max(xs(e.l,t,i+1),xs(e.r,t,i+1)):t[e.s]=i},Is=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new is(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;a<=t;++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]},Cs=function(e,t){for(var i=0,s=0;s<t.length;++s)i+=e[s]*t[s];return i},Ts=function(e,t,i){var s=i.length,n=bs(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;r<s;++r)e[n+r+4]=i[r];return 8*(n+4+s)},Ps=function(e,t,i,s,n,r,o,a,l,c,u){Ss(t,u++,i),++n[256];for(var d=ks(n,15),h=d[0],p=d[1],_=ks(r,15),g=_[0],f=_[1],v=Is(h),m=v[0],y=v[1],b=Is(g),w=b[0],S=b[1],E=new is(19),k=0;k<m.length;++k)E[31&m[k]]++;for(k=0;k<w.length;++k)E[31&w[k]]++;for(var x=ks(E,7),I=x[0],C=x[1],T=19;T>4&&!I[os[T-1]];--T);var P,R,F,$,M=c+5<<3,A=Cs(n,fs)+Cs(r,vs)+o,L=Cs(n,h)+Cs(r,g)+o+14+3*T+Cs(E,I)+(2*E[16]+3*E[17]+7*E[18]);if(M<=A&&M<=L)return Ts(t,u,e.subarray(l,l+c));if(Ss(t,u,1+(L<A)),u+=2,L<A){P=gs(h,p,0),R=h,F=gs(g,f,0),$=g;var O=gs(I,C,0);Ss(t,u,y-257),Ss(t,u+5,S-1),Ss(t,u+10,T-4),u+=14;for(k=0;k<T;++k)Ss(t,u+3*k,I[os[k]]);u+=3*T;for(var D=[m,w],N=0;N<2;++N){var q=D[N];for(k=0;k<q.length;++k){var B=31&q[k];Ss(t,u,O[B]),u+=I[B],B>15&&(Ss(t,u,q[k]>>>5&127),u+=q[k]>>>12)}}}else P=ms,R=fs,F=ys,$=vs;for(k=0;k<a;++k)if(s[k]>255){B=s[k]>>>18&31;Es(t,u,P[B+257]),u+=R[B+257],B>7&&(Ss(t,u,s[k]>>>23&31),u+=ns[B]);var H=31&s[k];Es(t,u,F[H]),u+=$[H],H>3&&(Es(t,u,s[k]>>>5&8191),u+=rs[H])}else Es(t,u,P[s[k]]),u+=R[s[k]];return Es(t,u,P[256]),u+R[256]},Rs=new ss([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fs=function(){for(var e=new ss(256),t=0;t<256;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),$s=function(){var e=4294967295;return{p:function(t){for(var i=e,s=0;s<t.length;++s)i=Fs[255&i^t[s]]^i>>>8;e=i},d:function(){return 4294967295^e}}},Ms=function(e,t,i,s,n){return function(e,t,i,s,n,r){var o=e.length,a=new ts(s+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(s,a.length-n),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?c=Ts(l,c,e.subarray(u,d)):(l[u]=r,c=Ts(l,c,e.subarray(u,o)))}else{for(var h=Rs[t-1],p=h>>>13,_=8191&h,g=(1<<i)-1,f=new is(32768),v=new is(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new ss(25e3),S=new is(288),E=new is(32),k=0,x=0,I=(u=0,0),C=0,T=0;u<o;++u){var P=b(u),R=32767&u,F=v[P];if(f[R]=F,v[P]=R,C<=u){var $=o-u;if((k>7e3||I>24576)&&$>423){c=Ps(e,l,0,w,S,E,x,I,T,u-T,c),I=k=x=0,T=u;for(var M=0;M<286;++M)S[M]=0;for(M=0;M<30;++M)E[M]=0}var A=2,L=0,O=_,D=R-F&32767;if($>2&&P==b(u-D))for(var N=Math.min(p,$)-1,q=Math.min(32767,u),B=Math.min(258,$);D<=q&&--O&&R!=F;){if(e[u+A]==e[u+A-D]){for(var H=0;H<B&&e[u+H]==e[u+H-D];++H);if(H>A){if(A=H,L=D,H>N)break;var U=Math.min(D,H-2),W=0;for(M=0;M<U;++M){var z=u-D+M+32768&32767,V=z-f[z]+32768&32767;V>W&&(W=V,F=z)}}}D+=(R=F)-(F=f[R])+32768&32767}if(L){w[I++]=268435456|us[A]<<18|ds[L];var G=31&us[A],j=31&ds[L];x+=ns[G]+rs[j],++S[257+G],++E[j],C=u+A,++k}else w[I++]=e[u],++S[e[u]]}}c=Ps(e,l,r,w,S,E,x,I,T,u-T,c)}return ws(a,0,s+bs(c)+n)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,s,!n)},As=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},Ls=function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&As(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;s<=i.length;++s)e[s+10]=i.charCodeAt(s)}},Os=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Ds(e,t){void 0===t&&(t={});var i=$s(),s=e.length;i.p(e);var n=Ms(e,t,Os(t),8),r=n.length;return Ls(n,t),As(n,r-8,i.d()),As(n,r-4,s),n}function Ns(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ts(e.length+(e.length>>>1)),n=0,r=function(e){s[n++]=e},o=0;o<i;++o){if(n+5>s.length){var a=new ts(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);l<128||t?r(l):l<2048?(r(192|l>>>6),r(128|63&l)):l>55295&&l<57344?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return ws(s,0,n)}const qs=3e5,Bs=[gi.MouseMove,gi.MouseInteraction,gi.Scroll,gi.ViewportResize,gi.Input,gi.TouchMove,gi.MediaInteraction,gi.Drag],Hs=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}),Us="[SessionRecording]";function Ws(e){return function(e,t){for(var i="",s=0;s<e.length;){var n=e[s++];n<128||t?i+=String.fromCharCode(n):n<224?i+=String.fromCharCode((31&n)<<6|63&e[s++]):n<240?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}(Ds(Ns(JSON.stringify(e))),!0)}function zs(e){return e.type===_i.Custom&&"sessionIdle"===e.data.tag}function Vs(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class Gs{queuedRRWebEvents=[];isIdle=!1;_linkedFlagSeen=!1;_lastActivityTimestamp=Date.now();_linkedFlag=null;_removePageViewCaptureHook=void 0;_onSessionIdListener=void 0;_persistDecideOnSessionListener=void 0;_samplingSessionListener=void 0;_urlTriggers=[];_urlBlocklist=[];_urlBlocked=!1;_eventTriggers=[];_removeEventTriggerCaptureHook=void 0;_forceAllowLocalhostNetworkCapture=!1;get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Us+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:qs}get isSampled(){const e=this.instance.get_property(ge);return j(e)?e:null}get sessionDuration(){var e,t;const i=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],{sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-s:null}get isRecordingEnabled(){const t=!!this.instance.get_property(le),i=!this.instance.config.disable_session_recording;return e&&t&&i}get isConsoleLogCaptureEnabled(){const e=!!this.instance.get_property(ce),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,i,s,n,r;const o=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(de),l=null!==(e=null!==(t=null==o?void 0:o.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,c=null!==(i=null!==(s=null==o?void 0:o.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==i?i:0,u=null!==(n=null!==(r=null==o?void 0:o.canvasQuality)&&void 0!==r?r:null==a?void 0:a.quality)&&void 0!==n?n:0;return{enabled:l,fps:Zi(c,0,12,"canvas recording fps"),quality:Zi(u,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t;const i=this.instance.get_property(ue),s={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},n=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),r=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),o=q(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(j(o)?o:null==i?void 0:i.capturePerformance);return n||r||a?{recordHeaders:n,recordBody:r,recordPerformance:a}:void 0}get sampleRate(){const e=this.instance.get_property(he);return G(e)?e:null}get minimumDuration(){const e=this.instance.get_property(pe);return G(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?V(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":this._urlBlocked?"paused":j(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;if(0===this._urlTriggers.length)return"trigger_disabled";return(null===(e=this.instance)||void 0===e?void 0:e.get_property(fe))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;if(0===this._eventTriggers.length)return"trigger_disabled";return(null===(e=this.instance)||void 0===e?void 0:e.get_property(ve))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){const e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw X.error(Us+" started without valid sessionManager"),new Error(Us+" started without valid sessionManager. This is a bug.");const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=i,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&X.warn(Us+` session_idle_threshold_ms (${this.sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this.sessionManager.sessionTimeoutMs}). Session will never be detected as idle`)}_onBeforeUnload=()=>{this._flushBuffer()};_onOffline=()=>{this._tryAddCustomEvent("browser offline",{})};_onOnline=()=>{this._tryAddCustomEvent("browser online",{})};_onVisibilityChange=()=>{if(null!=o&&o.visibilityState){const e="window "+o.visibilityState;this._tryAddCustomEvent(e,{})}};startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),null==e||e.addEventListener("beforeunload",this._onBeforeUnload),null==e||e.addEventListener("offline",this._onOffline),null==e||e.addEventListener("online",this._onOnline),null==e||e.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),V(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance._addCaptureHook((t=>{try{if("$pageview"===t){const t=e?this._maskUrl(e.location.href):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){X.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,i)=>{var s,n,r,o;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),null===(s=this.instance)||void 0===s||null===(n=s.persistence)||void 0===n||n.unregister(ve),null===(r=this.instance)||void 0===r||null===(o=r.persistence)||void 0===o||o.unregister(fe))})))):this.stopRecording()}stopRecording(){var t,i,s,n;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==e||e.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(s=this._onSessionIdListener)||void 0===s||s.call(this),this._onSessionIdListener=void 0,null===(n=this._samplingSessionListener)||void 0===n||n.call(this),this._samplingSessionListener=void 0,X.info(Us+" stopped"))}makeSamplingDecision(e){var t;const i=this.sessionId!==e,s=this.sampleRate;var n;if(!G(s))return void(null===(n=this.instance.persistence)||void 0===n||n.register({[ge]:null}));const r=this.isSampled;let o;const a=i||!j(r);if(a){o=Math.random()<s}else o=r;a&&(o?this._reportStarted("sampled"):X.warn(Us+` Sample rate (${s}) has determined that this sessionId (${e}) will not be sent to the server.`),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:s,isSampled:o})),null===(t=this.instance.persistence)||void 0===t||t.register({[ge]:o})}afterDecideResponse(e){var t,i,s,n,r,o;(this._persistDecideResponse(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(o=e.sessionRecording)||void 0===o?void 0:o.endpoint);if(this._setupSampling(),!V(this._linkedFlag)&&!this._linkedFlagSeen){const e=U(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,t=U(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((i,s)=>{const n=q(s)&&e in s,r=t?s[e]===t:n;r&&this._reportStarted("linked_flag_matched",{linkedFlag:e,linkedVariant:t}),this._linkedFlagSeen=r}))}null!==(s=e.sessionRecording)&&void 0!==s&&s.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(n=e.sessionRecording)&&void 0!==n&&n.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(r=e.sessionRecording)&&void 0!==r&&r.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){G(this.sampleRate)&&V(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistDecideResponse(e){if(this.instance.persistence){var t;const i=this.instance.persistence,s=()=>{var t,s,n,r,o,a,l;const c=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,u=V(c)?null:parseFloat(c),d=null===(s=e.sessionRecording)||void 0===s?void 0:s.minimumDurationMilliseconds;i.register({[le]:!!e.sessionRecording,[ce]:null===(n=e.sessionRecording)||void 0===n?void 0:n.consoleLogRecordingEnabled,[ue]:{capturePerformance:e.capturePerformance,...null===(r=e.sessionRecording)||void 0===r?void 0:r.networkPayloadCapture},[de]:{enabled:null===(o=e.sessionRecording)||void 0===o?void 0:o.recordCanvas,fps:null===(a=e.sessionRecording)||void 0===a?void 0:a.canvasFps,quality:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasQuality},[he]:u,[pe]:H(d)?null:d})};s(),null===(t=this._persistDecideOnSessionListener)||void 0===t||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(s)}}log(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!H(Object.assign)&&!H(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"recorder",(e=>{if(e)return X.error(Us+" could not load recorder",e);this._onScriptLoaded()}));X.info(Us+" starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}isInteractiveEvent(e){var t;return 3===e.type&&-1!==Bs.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this.isInteractiveEvent(e);if(!t&&!this.isIdle){e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer())}let i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)),this.isIdle)return;const{windowId:s,sessionId:n}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),r=this.sessionId!==n,o=this.windowId!==s;this.windowId=s,this.sessionId=n,r||o?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):X.warn(Us+" could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Hs((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Hs((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e;const t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording;for(const[e,s]of Object.entries(i||{}))e in t&&("maskInputOptions"===e?t.maskInputOptions={password:!0,...s}:t[e]=s);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),!this.rrwebRecord)return void X.error(Us+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new es(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;X.info(i,{node:t}),this.log(Us+" "+i,"warn")}});const s=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord({emit:e=>{this.onRRwebEmit(e)},plugins:s,...t}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:s.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle)return;const e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}_gatherRRWebPlugins(){var e,t,i,s;const n=[],r=null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;r&&this.isConsoleLogCaptureEnabled&&n.push(r());const o=null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.rrwebPlugins)||void 0===s?void 0:s.getRecordNetworkPlugin;if(this.networkPayloadCapture&&N(o)){!ot.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(o(Ki(this.instance.config,this.networkPayloadCapture))):X.info(Us+" NetworkCapture not started because we are on localhost.")}return n}onRRwebEmit(e){var t;if(this._processQueuedEvents(),!e||!q(e))return;if(e.type===_i.Meta){const t=this._maskUrl(e.data.href);if(this._lastHref=t,!t)return;e.data.href=t}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"===this.status&&!function(e){return e.type===_i.Custom&&"recording paused"===e.data.tag}(e))return;e.type===_i.FullSnapshot&&this._scheduleFullSnapshot(),e.type===_i.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();const i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(!i)return;const s=function(e){const t=e;if(t&&q(t)&&6===t.type&&q(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));const i=[];for(let e=0;e<t.data.payload.payload.length;e++)t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?i.push(t.data.payload.payload[e].slice(0,2e3)+"...[truncated]"):i.push(t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(i);if(this._updateWindowAndSessionIds(s),this.isIdle&&!zs(s))return;if(zs(s)){const e=s.data.payload;if(e){const t=e.lastActivityTimestamp,i=e.threshold;s.timestamp=t+i}}const n=null===(t=this.instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(hi(e)<1024)return e;try{if(e.type===_i.FullSnapshot)return{...e,data:Ws(e.data),cv:"2024-10"};if(e.type===_i.IncrementalSnapshot&&e.data.source===gi.Mutation)return{...e,cv:"2024-10",data:{...e.data,texts:Ws(e.data.texts),attributes:Ws(e.data.attributes),removes:Ws(e.data.removes),adds:Ws(e.data.adds)}};if(e.type===_i.IncrementalSnapshot&&e.data.source===gi.StyleSheetRule)return{...e,cv:"2024-10",data:{...e.data,adds:Ws(e.data.adds),removes:Ws(e.data.removes)}}}catch(e){X.error(Us+" could not compress event - will use uncompressed event",e)}return e}(s):s,r={$snapshot_bytes:hi(n),$snapshot_data:n,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(r):this.clearBuffer()}_pageViewFallBack(){if(this.instance.config.capture_pageview||!e)return;const t=this._maskUrl(e.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}_processQueuedEvents(){if(this.queuedRRWebEvents.length){const e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(e){const t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var i;let s={url:e};return s=t.maskNetworkRequestFn(s),null===(i=s)||void 0===i?void 0:i.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);const e=this.minimumDuration,t=this.sessionDuration,i=G(t)&&t>=0,s=G(e)&&i&&t<e;if("buffering"===this.status||s)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;if(this.buffer.data.length>0){pi(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId})}))}return this.clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0===e||!e.location.href)return;const t=e.location.href,i="paused"===this.status,s=Vs(t,this._urlBlocklist);s&&!i?this._pauseRecording():!s&&i&&this._resumeRecording(),Vs(t,this._urlTriggers)&&this._activateTrigger("url")}_activateTrigger(e){var t,i;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({["url"===e?fe:ve]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),X.info(Us+" recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),X.info(Us+" recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&V(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){X.error(Us+"Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[ge]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),X.info(Us+" "+e.replace("_"," "),t),y(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}class js{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}call(){const e={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(be),group_properties:this.instance.get_property(we),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:e,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>this.parseDecideResponse(e.json)})}parseDecideResponse(e){this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();const t=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(null!=e?e:{},t),t)X.error("Failed to fetch feature flags from PostHog.");else{if(!o||!o.body)return X.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.parseDecideResponse(e)}),500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps)for(const{id:t,url:r}of e.siteApps){var i,s,n;h[`__$$ph_site_app_${t}`]=this.instance,null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=(n=i).loadSiteApp)||void 0===s||s.call(n,this.instance,r,(e=>{if(e)return X.error(`Error while initializing PostHog app with config id ${t}`,e)}))}else e.siteApps.length>0&&X.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}const Qs=null!=e&&e.location?dt(e.location.hash,"__posthog")||dt(location.hash,"state"):null,Js="_postHogToolbarParams";var Ys;!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Ys||(Ys={}));class Xs{constructor(e){this.instance=e}setToolbarState(e){h.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:Ys.UNINITIALIZED}maybeLoadToolbar(){var t,i;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||!o)return!1;s=null!==(t=s)&&void 0!==t?t:e.location,r=null!==(i=r)&&void 0!==i?i:e.history;try{if(!n){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch{return!1}n=null==e?void 0:e.localStorage}const t=Qs||dt(s.hash,"__posthog")||dt(s.hash,"state");let i;const o=t?w((()=>JSON.parse(atob(decodeURIComponent(t)))))||w((()=>JSON.parse(decodeURIComponent(t)))):null;return o&&"ph_authorize"===o.action?(i=o,i.source="url",i&&Object.keys(i).length>0&&(o.desiredHash?s.hash=o.desiredHash:r?r.replaceState(r.state,"",s.pathname+s.search):s.hash="")):(i=JSON.parse(n.getItem(Js)||"{}"),i.source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}_callLoadToolbar(e){(h.ph_load_toolbar||h.ph_load_editor)(e,this.instance)}loadToolbar(t){const i=!(null==o||!o.getElementById($e));if(!e||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n={token:this.instance.config.token,...t,apiURL:this.instance.requestRouter.endpointFor("ui"),...s?{instrument:!1}:{}};if(e.localStorage.setItem(Js,JSON.stringify({...n,source:void 0})),this.getToolbarState()===Ys.LOADED)this._callLoadToolbar(n);else if(this.getToolbarState()===Ys.UNINITIALIZED){var r,a;this.setToolbarState(Ys.LOADING),null===(r=h.__PosthogExtensions__)||void 0===r||null===(a=r.loadExternalDependency)||void 0===a||a.call(r,this.instance,"toolbar",(e=>{if(e)return X.error("Failed to load toolbar",e),void this.setToolbarState(Ys.UNINITIALIZED);this.setToolbarState(Ys.LOADED),this._callLoadToolbar(n)})),C(e,"turbolinks:load",(()=>{this.setToolbarState(Ys.UNINITIALIZED),this.loadToolbar(n)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}class Ks{isPaused=!0;queue=[];flushTimeoutMs=3e3;constructor(e){this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();const e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this.sendRequest({...e,transport:"sendBeacon"})}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){const e=this.formatQueue();for(const t in e){const i=e[t],s=(new Date).getTime();i.data&&D(i.data)&&v(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),this.sendRequest(i)}}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){const e={};return v(this.queue,(t=>{var i;const s=t,n=(s?s.batchKey:null)||s.url;H(e[n])&&(e[n]={...s,data:[]}),null===(i=e[n].data)||void 0===i||i.push(s.data)})),this.queue=[],e}}const Zs=!!c||!!l,en="text/plain",tn=(e,t)=>{const[i,s]=e.split("?"),n={...t};null==s||s.split("&").forEach((e=>{const[t]=e.split("=");delete n[t]}));let r=ct(n);return r=r?(s?s+"&":"")+r:s,`${i}?${r}`},sn=e=>{let{data:t,compression:i}=e;if(!t)return;if(i===exports.Compression.GZipJS){const e=Ds(Ns(JSON.stringify(t)),{mtime:0}),i=new Blob([e],{type:en});return{contentType:en,body:i,estimatedSize:i.size}}if(i===exports.Compression.Base64){const e=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i,s,n,r,o,a,l,c,u=0,d=0,h="";const p=[];if(!e)return e;e=I(e);do{i=e.charCodeAt(u++),s=e.charCodeAt(u++),n=e.charCodeAt(u++),c=i<<16|s<<8|n,r=c>>18&63,o=c>>12&63,a=c>>6&63,l=63&c,p[d++]=t.charAt(r)+t.charAt(o)+t.charAt(a)+t.charAt(l)}while(u<e.length);switch(h=p.join(""),e.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"="}return h}(JSON.stringify(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=JSON.stringify(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},nn=e=>{var t;const i=new c;i.open(e.method||"GET",e.url,!0);const{contentType:s,body:n}=null!==(t=sn(e))&&void 0!==t?t:{};v(e.headers,(function(e,t){i.setRequestHeader(t,e)})),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),i.withCredentials=!0,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{}null===(t=e.callback)||void 0===t||t.call(e,s)}},i.send(n)},rn=e=>{var t,i;const{contentType:s,body:n,estimatedSize:r}=null!==(t=sn(e))&&void 0!==t?t:{},o=new Headers;v(e.headers,(function(e,t){o.append(t,e)})),s&&o.append("Content-Type",s);const a=e.url;let c=null;if(u){const t=new u;c={signal:t.signal,timeout:setTimeout((()=>t.abort()),e.timeout)}}l(a,{method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(r||0)<52428.8,body:n,signal:null===(i=c)||void 0===i?void 0:i.signal}).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){X.error(e)}null===(s=e.callback)||void 0===s||s.call(e,n)})))).catch((t=>{var i;X.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,text:t})})).finally((()=>c?clearTimeout(c.timeout):null))},on=e=>{const t=tn(e.url,{beacon:"1"});try{var i;const{contentType:s,body:n}=null!==(i=sn(e))&&void 0!==i?i:{},o="string"==typeof n?new Blob([n],{type:s}):n;r.sendBeacon(t,o)}catch{}},an=[];c&&an.push({transport:"XHR",method:nn}),l&&an.push({transport:"fetch",method:rn}),null!=r&&r.sendBeacon&&an.push({transport:"sendBeacon",method:on});class ln{isPolling=!1;pollIntervalMs=3e3;queue=[];constructor(t){this.instance=t,this.queue=[],this.areWeOnline=!0,!H(e)&&"onLine"in e.navigator&&(this.areWeOnline=e.navigator.onLine,e.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),e.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){let{retriesPerformedSoFar:t,...i}=e;G(t)&&t>0&&(i.url=tn(i.url,{retry_count:t})),this.instance._send_request({...i,callback:e=>{var s;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue({retriesPerformedSoFar:t,...i}):null===(s=i.callback)||void 0===s||s.call(i,e)}})}enqueue(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.queue.push({retryAt:s,requestOptions:e});let n=`Enqueued failed request for retry in ${i}`;navigator.onLine||(n+=" (Browser is offline)"),X.warn(n),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){const e=Date.now(),t=[],i=this.queue.filter((i=>i.retryAt<e||(t.push(i),!1)));if(this.queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);for(const{requestOptions:e}of this.queue)try{this.instance._send_request({...e,transport:"sendBeacon"})}catch(e){X.error(e)}this.queue=[]}}class cn{_sessionIdChangedHandlers=[];constructor(e,t,i,s){var n;this.config=e,this.persistence=t,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=i||Ve,this._windowIdGenerator=s||Ve;const r=e.persistence_name||e.token,o=e.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zi(o,60,1800,"session_idle_timeout_seconds"),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){const e=rt.parse(this._window_id_storage_key),t=rt.parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:rt.remove(this._window_id_storage_key),rt.set(this._primary_window_exists_storage_key,!0)}if(null!==(n=this.config.bootstrap)&&void 0!==n&&n.sessionID)try{const e=(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)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),e)}catch(e){X.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&&rt.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&rt.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?rt.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[_e]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];const e=this.persistence.props[_e];return D(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==e||e.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&&rt.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime();let[i,s,n]=this._getSessionId(),r=this._getWindowId();const o=G(n)&&n>0&&Math.abs(t-n)>864e5;let a=!1;const l=!s,c=!e&&Math.abs(t-i)>this.sessionTimeoutMs;l||c||o?(s=this._sessionIdGenerator(),r=this._windowIdGenerator(),X.info("[SessionId] new session ID generated",{sessionId:s,windowId:r,changeReason:{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:o}}),n=t,a=!0):r||(r=this._windowIdGenerator(),a=!0);const u=0===i||!e||o?t:i,d=0===n?(new Date).getTime():n;return this._setWindowId(r),this._setSessionId(s,u,d),a&&this._sessionIdChangedHandlers.forEach((e=>e(s,r,a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:o}:void 0))),{sessionId:s,windowId:r,sessionStartTimestamp:d,changeReason:a?{noSessionId:l,activityTimeout:c,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:i}}}let un;!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(un||(un={}));const dn="i.posthog.com";class hn{_regionCache={};constructor(e){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 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(`.${dn}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=un.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=un.EU:this._regionCache[this.apiHost]=un.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this.uiHost+t;if(this.region===un.CUSTOM)return this.apiHost+t;const i=dn+t;switch(e){case"assets":return`https://${this.region}-assets.${i}`;case"api":return`https://${this.region}.${i}`}}}const pn="posthog-js";function _n(e){let{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=>{var o,a,l,c,u;if(!("*"===n||n.includes(r.level))||!e.__loaded)return r;r.tags||(r.tags={});const d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);r.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(r.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const h=(null===(o=r.exception)||void 0===o?void 0:o.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));const p={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||r.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:r.level,$exception_list:h,$sentry_event_id:r.event_id,$sentry_exception:r.exception,$sentry_exception_message:(null===(c=h[0])||void 0===c?void 0:c.value)||r.message,$sentry_exception_type:null===(u=h[0])||void 0===u?void 0:u.type,$sentry_tags:r.tags,$level:r.level};return t&&i&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+r.event_id),e.exceptions.sendExceptionEvent(p),r}}class gn{constructor(e,t,i,s,n){this.name=pn,this.setupOnce=function(r){r(_n(e,{organization:t,projectId:i,prefix:s,severityAllowList:n}))}}}function fn(e,t){const i=e.config.segment;if(!i)return t();!function(e,t){const i=e.config.segment;if(!i)return t();const s=i=>{const s=()=>i.anonymousId()||Ve();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(xe,"identified")),t()},n=i.user();"then"in n&&N(n.then)?n.then((e=>s(e))):s(n)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||X.warn("This browser does not have Promise support, and can not use the segment integration");const t=(t,i)=>{var s;if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(X.info("Segment integration does not have a userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(X.info("Segment integration has a userId set, identifying with PostHog"),e.identify(t.event.userId));const n=e._calculate_event_properties(i,null!==(s=t.event.properties)&&void 0!==s?s:{},new Date);return t.event.properties=Object.assign({},n,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class vn{constructor(e){this._instance=e}doPageView(t){var i;const s=this._previousPageViewProperties(t);return this._currentPath=null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=t,s}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){const t=this._currentPath,i=this._prevPageviewTimestamp,s=this._instance.scrollManager.getContext();if(!i)return{};let n={};if(s){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(H(e)||H(t)||H(i)||H(r)||H(o)||H(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);n={$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:e<=1?1:Zi(t/e,0,1),$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:e<=1?1:Zi(i/e,0,1),$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:r<=1?1:Zi(o/r,0,1),$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:r<=1?1:Zi(a/r,0,1)}}}return t&&(n.$prev_pageview_pathname=t),i&&(n.$prev_pageview_duration=(e.getTime()-i.getTime())/1e3),n}}var mn,yn,bn;exports.SurveyType=void 0,(mn=exports.SurveyType||(exports.SurveyType={})).Popover="popover",mn.API="api",mn.Widget="widget",exports.SurveyQuestionType=void 0,(yn=exports.SurveyQuestionType||(exports.SurveyQuestionType={})).Open="open",yn.MultipleChoice="multiple_choice",yn.SingleChoice="single_choice",yn.Rating="rating",yn.Link="link",exports.SurveyQuestionBranchingType=void 0,(bn=exports.SurveyQuestionBranchingType||(exports.SurveyQuestionBranchingType={})).NextQuestion="next_question",bn.End="end",bn.ResponseBased="response_based",bn.SpecificQuestion="specific_question";class wn{events={};constructor(){this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(const i of this.events[e]||[])i(t);for(const i of this.events["*"]||[])i(e,t)}}class Sn{_debugEventEmitter=new wn;constructor(e){this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!H(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;const e=(e,t)=>{this.on(e,t)};null===(t=this.instance)||void 0===t||t._addCaptureHook(e)}}register(e){var t,i;if(!H(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(i=e.steps)||void 0===i||i.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(i=this.instance)&&void 0!==i&&i.autocapture)){var s;const t=new Set;e.forEach((e=>{var i;null===(i=e.steps)||void 0===i||i.forEach((e=>{null!=e&&e.selector&&t.add(null==e?void 0:e.selector)}))})),null===(s=this.instance)||void 0===s||s.autocapture.setElementSelectors(t)}}on(e,t){var i;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(i=this.actionRegistry)||void 0===i?void 0:i.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this.checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStep=(e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t);checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event);checkStepUrl(e,t){if(null!=t&&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(!Sn.matchString(s,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(t,i,s){switch(s){case"regex":return!!e&<(t,i);case"exact":return i===t;case"contains":const s=Sn.escapeStringRegexp(i).replace(/_/g,".").replace(/%/g,".*");return lt(t,s);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if(null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text){if(!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!Sn.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!Sn.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!Sn.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1}if(null!=t&&t.selector){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(!s)return!1;if(!s.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class En{static SURVEY_SHOWN_EVENT_NAME="survey shown";constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;H(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){const t=e.filter((e=>{var t,i,s,n;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(i=e.conditions)||void 0===i||null===(s=i.actions)||void 0===s||null===(n=s.values)||void 0===n?void 0:n.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new Sn(this.instance),this.actionMatcher.init();const e=e=>{this.onAction(e)};this.actionMatcher._addActionHook(e)}t.forEach((e=>{var t,i,s,n,r,o,a,l,c,u;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(s=i.actions)&&void 0!==s&&s.values&&(null===(n=e.conditions)||void 0===n||null===(r=n.actions)||void 0===r||null===(o=r.values)||void 0===o?void 0:o.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c||null===(u=c.values)||void 0===u||u.forEach((t=>{if(t&&t.name){const i=this.actionToSurveys.get(t.name);i&&i.push(e.id),this.actionToSurveys.set(t.name,i||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0===e.filter((e=>{var t,i,s,n;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s||null===(n=s.values)||void 0===n?void 0:n.length)>0})).length)return;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,i,s;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(s=i.values)||void 0===s||s.forEach((t=>{if(t&&t.name){const i=this.eventToSurveys.get(t.name);i&&i.push(e.id),this.eventToSurveys.set(t.name,i||[e.id])}}))}))}onEvent(e,t){var i,s;const n=(null===(i=this.instance)||void 0===i||null===(s=i.persistence)||void 0===s?void 0:s.props[Ee])||[];if(En.SURVEY_SHOWN_EVENT_NAME==e&&t&&n.length>0){var r;const e=null==t||null===(r=t.properties)||void 0===r?void 0:r.$survey_id;if(e){const t=n.indexOf(e);t>=0&&(n.splice(t,1),this._updateActivatedSurveys(n))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(n.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,i;const s=(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i?void 0:i.props[Ee])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({[Ee]:[...new Set(e)]})}getSurveys(){var e,t;const i=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Ee];return i||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}var kn,xn,In,Cn,Tn,Pn,Rn,Fn,$n={},Mn=[],An=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ln=Array.isArray;function On(e,t){for(var i in t)e[i]=t[i];return e}function Dn(e){var t=e.parentNode;t&&t.removeChild(e)}function Nn(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==n?++In:n,__i:-1,__u:0};return null==n&&null!=xn.vnode&&xn.vnode(r),r}function qn(e){return e.children}function Bn(e,t){this.props=e,this.context=t}function Hn(e,t){if(null==t)return e.__?Hn(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?Hn(e):null}function Un(e){var t,i;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e){e.__e=e.__c.base=i.__e;break}return Un(e)}}function Wn(e){(!e.__d&&(e.__d=!0)&&Cn.push(e)&&!zn.__r++||Tn!==xn.debounceRendering)&&((Tn=xn.debounceRendering)||Pn)(zn)}function zn(){var e,t,i,s,n,r,o,a,l;for(Cn.sort(Rn);e=Cn.shift();)e.__d&&(t=Cn.length,s=void 0,r=(n=(i=e).__v).__e,a=[],l=[],(o=i.__P)&&((s=On({},n)).__v=n.__v+1,xn.vnode&&xn.vnode(s),Zn(o,s,n,i.__n,void 0!==o.ownerSVGElement,32&n.__u?[r]:null,a,null==r?Hn(n):r,!!(32&n.__u),l),s.__.__k[s.__i]=s,er(a,s,l),s.__e!=r&&Un(s)),Cn.length>t&&Cn.sort(Rn));zn.__r=0}function Vn(e,t,i,s,n,r,o,a,l,c,u){var d,h,p,_,g,f=s&&s.__k||Mn,v=t.length;for(i.__d=l,Gn(i,t,f),l=i.__d,d=0;d<v;d++)null!=(p=i.__k[d])&&"boolean"!=typeof p&&"function"!=typeof p&&(h=-1===p.__i?$n:f[p.__i]||$n,p.__i=d,Zn(e,p,h,n,r,o,a,l,c,u),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&ir(h.ref,null,p),u.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),65536&p.__u||h.__k===p.__k?l=jn(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:_&&(l=_.nextSibling),p.__d=void 0,p.__u&=-196609);i.__d=l,i.__e=g}function Gn(e,t,i){var s,n,r,o,a,l=t.length,c=i.length,u=c,d=0;for(e.__k=[],s=0;s<l;s++)null!=(n=e.__k[s]=null==(n=t[s])||"boolean"==typeof n||"function"==typeof n?null:"string"==typeof n||"number"==typeof n||"bigint"==typeof n||n.constructor==String?Nn(null,n,null,null,n):Ln(n)?Nn(qn,{children:n},null,null,null):void 0===n.constructor&&n.__b>0?Nn(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)?(n.__=e,n.__b=e.__b+1,a=Qn(n,i,o=s+d,u),n.__i=a,r=null,-1!==a&&(u--,(r=i[a])&&(r.__u|=131072)),null==r||null===r.__v?(-1==a&&d--,"function"!=typeof n.type&&(n.__u|=65536)):a!==o&&(a===o+1?d++:a>o?u>l-o?d+=a-o:d--:d=a<o&&a==o-1?a-o:0,a!==s+d&&(n.__u|=65536))):(r=i[s])&&null==r.key&&r.__e&&(r.__e==e.__d&&(e.__d=Hn(r)),sr(r,r,!1),i[s]=null,u--);if(u)for(s=0;s<c;s++)null!=(r=i[s])&&0==(131072&r.__u)&&(r.__e==e.__d&&(e.__d=Hn(r)),sr(r,r))}function jn(e,t,i){var s,n;if("function"==typeof e.type){for(s=e.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=e,t=jn(s[n],t,i));return t}return e.__e!=t&&(i.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Qn(e,t,i,s){var n=e.key,r=e.type,o=i-1,a=i+1,l=t[i];if(null===l||l&&n==l.key&&r===l.type)return i;if(s>(null!=l&&0==(131072&l.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((l=t[o])&&0==(131072&l.__u)&&n==l.key&&r===l.type)return o;o--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&n==l.key&&r===l.type)return a;a++}}return-1}function Jn(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||An.test(t)?i:i+"px"}function Yn(e,t,i,s,n){var r;e:if("style"===t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||Jn(e.style,t,"");if(i)for(t in i)s&&i[t]===s[t]||Jn(e.style,t,i[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?s?i.u=s.u:(i.u=Date.now(),e.addEventListener(t,r?Kn:Xn,r)):e.removeEventListener(t,r?Kn:Xn,r);else{if(n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,i))}}function Xn(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(xn.event?xn.event(e):e)}function Kn(e){return this.l[e.type+!0](xn.event?xn.event(e):e)}function Zn(e,t,i,s,n,r,o,a,l,c){var u,d,h,p,_,g,f,v,m,y,b,w,S,E,k,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=xn.__b)&&u(t);e:if("function"==typeof x)try{if(v=t.props,m=(u=x.contextType)&&s[u.__c],y=u?m?m.props.value:u.__:s,i.__c?f=(d=t.__c=i.__c).__=d.__E:("prototype"in x&&x.prototype.render?t.__c=d=new x(v,y):(t.__c=d=new Bn(v,y),d.constructor=x,d.render=nr),m&&m.sub(d),d.props=v,d.state||(d.state={}),d.context=y,d.__n=s,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=On({},d.__s)),On(d.__s,x.getDerivedStateFromProps(v,d.__s))),p=d.props,_=d.state,d.__v=t,h)null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==x.getDerivedStateFromProps&&v!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(v,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(v,d.__s,y)||t.__v===i.__v)){for(t.__v!==i.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(v,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,_,g)}))}if(d.context=y,d.props=v,d.__P=e,d.__e=!1,w=xn.__r,S=0,"prototype"in x&&x.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do{d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(s=On(On({},s),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(g=d.getSnapshotBeforeUpdate(p,_)),Vn(e,Ln(k=null!=u&&u.type===qn&&null==u.key?u.props.children:u)?k:[k],t,i,s,n,r,o,a,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),f&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=r?(t.__e=a,t.__u|=l?160:32,r[r.indexOf(a)]=null):(t.__e=i.__e,t.__k=i.__k),xn.__e(e,t,i)}else null==r&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=tr(i.__e,t,i,s,n,r,o,l,c);(u=xn.diffed)&&u(t)}function er(e,t,i){t.__d=void 0;for(var s=0;s<i.length;s++)ir(i[s],i[++s],i[++s]);xn.__c&&xn.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){xn.__e(e,t.__v)}}))}function tr(e,t,i,s,n,r,o,a,l){var c,u,d,h,p,_,g,f=i.props,v=t.props,m=t.type;if("svg"===m&&(n=!0),null!=r)for(c=0;c<r.length;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName===m:3===p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null===m)return document.createTextNode(v);e=n?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,v.is&&v),r=null,a=!1}if(null===m)f===v||a&&e.data===v||(e.data=v);else{if(r=r&&kn.call(e.childNodes),f=i.props||$n,!a&&null!=r)for(f={},c=0;c<e.attributes.length;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"children"==c||("dangerouslySetInnerHTML"==c?d=p:"key"===c||c in v||Yn(e,c,null,p,n));for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?_=p:"checked"==c?g=p:"key"===c||a&&"function"!=typeof p||f[c]===p||Yn(e,c,p,f[c],n);if(u)a||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),Vn(e,Ln(h)?h:[h],t,i,s,n&&"foreignObject"!==m,r,o,r?r[0]:i.__k&&Hn(i,0),a,l),null!=r)for(c=r.length;c--;)null!=r[c]&&Dn(r[c]);a||(c="value",void 0!==_&&(_!==e[c]||"progress"===m&&!_||"option"===m&&_!==f[c])&&Yn(e,c,_,f[c],!1),c="checked",void 0!==g&&g!==e[c]&&Yn(e,c,g,f[c],!1))}return e}function ir(e,t,i){try{"function"==typeof e?e(t):e.current=t}catch(e){xn.__e(e,i)}}function sr(e,t,i){var s,n;if(xn.unmount&&xn.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||ir(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){xn.__e(e,t)}s.base=s.__P=null,e.__c=void 0}if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&sr(s[n],t,i||"function"!=typeof e.type);i||null==e.__e||Dn(e.__e),e.__=e.__e=e.__d=void 0}function nr(e,t,i){return this.constructor(e,i)}kn=Mn.slice,xn={__e:function(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},In=0,Bn.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=On({},this.state),"function"==typeof e&&(e=e(On({},i),this.props)),e&&On(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),Wn(this))},Bn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wn(this))},Bn.prototype.render=qn,Cn=[],Pn="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rn=function(e,t){return e.__v.__b-t.__v.__b},zn.__r=0,Fn=0;!function(e,t){var i={__c:t="__cC"+Fn++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&i.some((function(e){e.__e=!0,Wn(e)}))},this.sub=function(e){i.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i.splice(i.indexOf(e),1),t&&t.call(e)}}),e.children}};i.Provider.__=i.Consumer.contextType=i}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});const rr="[Surveys]",or={icontains:t=>!!e&&e.location.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:t=>!!e&&-1===e.location.href.toLowerCase().indexOf(t.toLowerCase()),regex:t=>!!e&<(e.location.href,t),not_regex:t=>!!e&&!lt(e.location.href,t),exact:t=>(null==e?void 0:e.location.href)===t,is_not:t=>(null==e?void 0:e.location.href)!==t};class ar{constructor(e){this.instance=e,this._surveyEventReceiver=null}afterDecideResponse(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");const e=(()=>{const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);null!=i&&i.startsWith("seenSurvey_")&&e.push(i)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e;const t=null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;var i,s;this.instance.config.disable_surveys||!this._decideServerResponse||t||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new En(this.instance)),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"surveys",(e=>{var t,i;if(e)return X.error(rr,"Could not load surveys script",e);this._surveyManager=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,this.instance)})))}getSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new En(this.instance));const i=this.instance.get_property(Se);if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api",`/api/surveys/?token=${this.instance.config.token}`),method:"GET",transport:"XHR",callback:t=>{var i;if(200!==t.statusCode||!t.json)return e([]);const s=t.json.surveys||[],n=s.filter((e=>{var t,i,s,n,r,o,a,l,c,u,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s?void 0:s.values)&&(null===(n=e.conditions)||void 0===n||null===(r=n.events)||void 0===r||null===(o=r.values)||void 0===o?void 0:o.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));var r;n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n));return null===(i=this.instance.persistence)||void 0===i||i.register({[Se]:s}),e(s)}})}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var i;const s=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,i,s,n;if(!e.conditions)return!0;const r=null===(t=e.conditions)||void 0===t||!t.url||or[null!==(i=null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType)&&void 0!==i?i:"icontains"](e.conditions.url),a=null===(n=e.conditions)||void 0===n||!n.selector||(null==o?void 0:o.querySelector(e.conditions.selector));return r&&a})),n=null===(i=this._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),r=s.filter((e=>{var t,i,s,r,o,a,l,c,u,d;if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;const h=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),p=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),_=(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s?void 0:s.values)&&(null===(r=e.conditions)||void 0===r||null===(o=r.events)||void 0===o?void 0:o.values.length)>0,g=(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(c=l.actions)||void 0===c?void 0:c.values)&&(null===(u=e.conditions)||void 0===u||null===(d=u.actions)||void 0===d?void 0:d.values.length)>0,f=!_&&!g||(null==n?void 0:n.includes(e.id)),v=this._canActivateRepeatedly(e),m=!(e.internal_targeting_flag_key&&!v)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return h&&p&&m&&f}));return e(r)}),t)}getNextSurveyStep(e,t,i){var s;const n=e.questions[t],r=t+1;if(null===(s=n.branching)||void 0===s||!s.type)return t===e.questions.length-1?exports.SurveyQuestionBranchingType.End:r;if(n.branching.type===exports.SurveyQuestionBranchingType.End)return exports.SurveyQuestionBranchingType.End;if(n.branching.type===exports.SurveyQuestionBranchingType.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===exports.SurveyQuestionBranchingType.ResponseBased){if(n.type===exports.SurveyQuestionType.SingleChoice){var o,a;const e=n.choices.indexOf(`${i}`);if(null!==(o=n.branching)&&void 0!==o&&null!==(a=o.responseValues)&&void 0!==a&&a.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:r}}else if(n.type===exports.SurveyQuestionType.Rating){var l,c;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,n.scale);if(null!==(l=n.branching)&&void 0!==l&&null!==(c=l.responseValues)&&void 0!==c&&c.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:r}}return r}return X.warn(rr,"Falling back to next question index due to unexpected branching type"),r}_canActivateRepeatedly(e){var t;return V(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(X.warn(rr,"canActivateRepeatedly is not defined, must init before calling"),!1):h.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){V(this._surveyManager)?X.warn(rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((t=>{const i=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(i)}))}renderSurvey(e,t){V(this._surveyManager)?X.warn(rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((i=>{const s=i.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(s,null==o?void 0:o.querySelector(t))}))}}class lr{serverLimits={};lastEventRateLimited=!1;constructor(e){var t,i;this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(i=e.config.rate_limiting)||void 0===i?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i;let s=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=(new Date).getTime(),r=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Ce))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:n};r.tokens+=(n-r.last)/1e3*this.captureEventsPerSecond,r.last=n,r.tokens>this.captureEventsBurstLimit&&(r.tokens=this.captureEventsBurstLimit);const o=r.tokens<1;return o||s||(r.tokens=Math.max(0,r.tokens-1)),!o||this.lastEventRateLimited||s||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to ${this.captureEventsPerSecond} events per second and ${this.captureEventsBurstLimit} events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null===(i=this.instance.persistence)||void 0===i||i.set_property(Ce,r),{isRateLimited:o,remainingTokens:r.tokens}}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{const e=JSON.parse(t);(e.quota_limited||[]).forEach((e=>{X.info(`[RateLimiter] ${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void X.warn(`[RateLimiter] could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}}}const cr=()=>({initialPathName:(null==a?void 0:a.pathname)||"",referringDomain:ci.referringDomain(),...ci.campaignParams()});class ur{constructor(e,t,i){this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=i||cr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[Ie]}_onSessionIdCallback=e=>{const t=this._getStoredProps();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[Ie]:i})};getSessionProps(){var e;const t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}const dr=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],hr=function(e,t){if(!e)return!1;const i=e.toLowerCase();return dr.concat(t||[]).some((e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)}))},pr=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&hr(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>hr(null==e?void 0:e.brand,t))))return!0}catch{}return!!e.webdriver};class _r{constructor(){this.clicks=[]}isRageClick(e,t,i){const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<30&&i-s.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}const gr="[Dead Clicks]",fr=()=>!0,vr=e=>{var t;const i=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(oe)),s=e.instance.config.capture_dead_clicks;return j(s)?s:i};class mr{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}afterDecideResponse(e){this.instance.persistence&&this.instance.persistence.register({[oe]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",(t=>{t?X.error(gr+" failed to load script",t):e()}))}start(){var e;if(o){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=h.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){const e=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(o),X.info(`${gr} starting...`)}}else X.error(gr+" `document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,X.info(`${gr} stopping...`))}}class yr{rageclicks=new _r;_enabledServerSide=!1;_initialized=!1;_flushInterval=null;constructor(t){var i;this.instance=t,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[se]),null==e||e.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){let e=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return H(this.instance.config.capture_heatmaps)?H(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;X.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}afterDecideResponse(e){const t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[se]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){const e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){e&&o&&(C(o,"click",(t=>this._onClick(t||(null==e?void 0:e.event))),!1,!0),C(o,"mousemove",(t=>this._onMouseMove(t||(null==e?void 0:e.event))),!1,!0),this.deadClicksCapture=new mr(this.instance,fr,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,i){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,s){let n=t;for(;n&&vi(n)&&!mi(n,"body");){if(n===s)return!1;if(y(i,null==e?void 0:e.getComputedStyle(n).position))return!0;n=Ti(n)}return!1}(Ii(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(fi(e.target))return;const s=this._getProperties(e,i);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture({...s,type:"rageclick"}),this._capture(s)}_onMouseMove(e){fi(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(!e)return;const i=e.location.href;this.buffer=this.buffer||{},this.buffer[i]||(this.buffer[i]=[]),this.buffer[i].push(t)}flush(){this.buffer&&!B(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class br{constructor(e){this.instance=e}getContext(){return this.context}resetContext(){const e=this.context;return setTimeout(this._updateScrollData,0),e}_updateScrollData=()=>{var e,t,i,s;this.context||(this.context={});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.context.lastScrollY=Math.ceil(r),this.context.maxScrollY=Math.max(r,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(o,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(i=this.context.maxContentY)&&void 0!==i?i:0),this.context.maxContentHeight=Math.max(l,null!==(s=this.context.maxContentHeight)&&void 0!==s?s:0)};startMeasuringScrollPosition(){null==e||e.addEventListener("scroll",this._updateScrollData,!0),null==e||e.addEventListener("scrollend",this._updateScrollData,!0),null==e||e.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==e?void 0:e.document.documentElement;{const t=D(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(const i of t){const t=null==e?void 0:e.document.querySelector(i);if(t)return t}}}scrollY(){if(this.instance.config.scroll_root_selector){const e=this.scrollElement();return e&&e.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){const e=this.scrollElement();return e&&e.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}}function wr(e,t){return t.length>e?t.slice(0,e)+"...":t}function Sr(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!vi(t));return t}function Er(e,t,i,s){const n=e.tagName.toLowerCase(),r={tag_name:n};Ci.indexOf(n)>-1&&!i&&("a"===n.toLowerCase()||"button"===n.toLowerCase()?r.$el_text=wr(1024,qi(e)):r.$el_text=wr(1024,xi(e)));const o=Ei(e);o.length>0&&(r.classes=o.filter((function(e){return""!==e}))),v(e.attributes,(function(i){var n;if((!Fi(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==s||!s.includes(i.name))&&!t&&Ni(i.value)&&(n=i.name,!U(n)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7)))){let e=i.value;"class"===i.name&&(e=wi(e).join(" ")),r["attr__"+i.name]=wr(1024,e)}}));let a=1,l=1,c=e;for(;c=Sr(c);)a++,c.tagName===e.tagName&&l++;return r.nth_child=a,r.nth_of_type=l,r}function kr(t,i){var s,n;let{e:r,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=i;const u=[t];let d=t;for(;d.parentNode&&!mi(d,"body");)bi(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);const h=[],p={};let _,g=!1,f=!1;if(v(u,(e=>{const t=Ri(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&Ni(g)&&g);y(Ei(e),"ph-no-capture")&&(f=!0),h.push(Er(e,o,a,l));const i=function(e){if(!Ri(e))return{};const t={};return v(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&&Ni(s)&&(t[i]=s)}})),t}(e);m(p,i)})),f)return{props:{},explicitNoCapture:f};if(a||("a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?h[0].$el_text=qi(t):h[0].$el_text=xi(t)),g){var b,w;h[0].attr__href=g;const t=null===(b=at(g))||void 0===b?void 0:b.host,i=null==e||null===(w=e.location)||void 0===w?void 0:w.host;t&&i&&t!==i&&(_=g)}return{props:m({$event_type:r.type,$ce_version:1},c?{$elements_chain:Hi(h)}:{$elements:h},null!==(s=h[0])&&void 0!==s&&s.$el_text?{$el_text:null===(n=h[0])||void 0===n?void 0:n.$el_text}:{},_&&"click"===r.type?{$external_click_url:_}:{},p)}}class xr{_initialized=!1;_isDisabledServerSide=null;rageclicks=new _r;_elementsChainAsString=!1;constructor(e){this.instance=e,this._elementSelectors=null}get config(){var e,t;const i=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null===(e=i.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null===(t=i.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(!this.isBrowserSupported())return void X.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!o)return;const t=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){X.error("Failed to capture event",e)}},i=t=>{t=t||(null==e?void 0:e.event),this._captureEvent(t,R)};C(o,"submit",t,!1,!0),C(o,"change",t,!1,!0),C(o,"click",t,!1,!0),this.config.capture_copied_text&&(C(o,"copy",i,!1,!0),C(o,"cut",i,!1,!0))}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}afterDecideResponse(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ie]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t;const i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{const s=null==o?void 0:o.querySelectorAll(t);null==s||s.forEach((s=>{e===s&&i.push(t)}))})),i}get isEnabled(){var e,t;const i=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ie],s=this._isDisabledServerSide;if(z(s)&&!j(i)&&!this.instance.config.advanced_disable_decide)return!1;const n=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!n}_captureEvent(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(!this.isEnabled)return;let s=Ii(t);var n;(yi(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent)&&(this.instance.config.rageclick&&null!==(n=this.rageclicks)&&void 0!==n&&n.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this._captureEvent(t,"$rageclick"));const r=i===R;if(s&&Pi(s,t,this.config,r,r?["copy","cut"]:void 0)){const{props:n,explicitNoCapture:r}=kr(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(r)return!1;const a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),i===R){var o;const i=ki(null==e||null===(o=e.getSelection())||void 0===o?void 0:o.toString()),s=t.type||"clipboard";if(!i)return!1;n.$selected_content=i,n.$copy_type=s}return this.instance.capture(i,n),!0}}isBrowserSupported(){return N(null==o?void 0:o.querySelectorAll)}}class Ir{_restoreXHRPatch=void 0;_restoreFetchPatch=void 0;constructor(e){this.instance=e}_loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"tracing-headers",(t=>{if(t)return X.error("[TRACING-HEADERS] failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}_startCapturing=()=>{var e,t,i,s;H(this._restoreXHRPatch)&&(null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));H(this._restoreFetchPatch)&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.tracingHeadersPatchFns)||void 0===s||s._patchFetch(this.instance.sessionManager))}}let Cr;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Cr||(Cr={}));class Tr{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Cr.DENIED:this.storedConsent}isOptedOut(){return this.consent===Cr.DENIED||this.consent===Cr.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){const e=this.storage.get(this.storageKey);return"1"===e?Cr.GRANTED:"0"===e?Cr.DENIED:Cr.PENDING}get storage(){if(!this._storage){const e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?Ze:Xe;const t="localStorage"===e?Xe:Ze;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!P([null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,h.doNotTrack],(e=>y([!0,1,"1","yes"],e)))}}const Pr="[Exception Autocapture]";class Rr{originalOnUnhandledRejectionHandler=void 0;constructor(e){var t;this.instance=e,this.remoteEnabled=!(null===(t=this.instance.persistence)||void 0===t||!t.props[ne]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var t;return!(null==e||null===(t=e.onerror)||void 0===t||!t.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(X.info(Pr+" enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,i;this.hasHandlers&&e(),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"exception-autocapture",(t=>{if(t)return X.error(Pr+" failed to load script",t);e()}))}startCapturing=()=>{var t,i,s,n;if(!e||!this.isEnabled||this.hasHandlers||this.isCapturing)return;const r=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.errorWrappingFunctions)||void 0===i?void 0:i.wrapOnError,o=null===(s=h.__PosthogExtensions__)||void 0===s||null===(n=s.errorWrappingFunctions)||void 0===n?void 0:n.wrapUnhandledRejection;if(r&&o)try{this.unwrapOnError=r(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){X.error(Pr+" failed to start",e),this.stopCapturing()}else X.error(Pr+" failed to load error wrapping functions - cannot start")};stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}afterDecideResponse(e){const t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[ne]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){const t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL=`${t}/project/${this.instance.config.token}/person/${this.instance.get_distinct_id()}`,this.instance.exceptions.sendExceptionEvent(e)}}const Fr=9e5,$r="[Web Vitals]";class Mr{_enabledServerSide=!1;_initialized=!1;buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0};constructor(e){var t;this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[re]),this.startIfEnabled()}get allowedMetrics(){var e,t;const i=q(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return H(i)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[ae])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(q(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){const e=q(this.instance.config.capture_performance)&&G(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Fr;return 0<e&&e<=6e4?Fr:e}get isEnabled(){const e=q(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return j(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(X.info($r+" enabled, starting..."),this.loadScript(this._startCapturing))}afterDecideResponse(e){const t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[re]:t}),this.instance.persistence.register({[ae]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"web-vitals",(t=>{t?X.error($r+" failed to load script",t):e()}))}_currentURL(){const t=e?e.location.href:void 0;return t||X.error($r+"Could not determine current URL"),t}_flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,t)=>({...e,[`$web_vitals_${t.name}_event`]:{...t},[`$web_vitals_${t.name}_value`]:t.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})};_addToBuffer=e=>{var t;const i=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if(H(i))return void X.error($r+"Could not read session ID. Dropping metrics!");this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};const s=this._currentURL();if(H(s))return;if(V(null==e?void 0:e.name)||V(null==e?void 0:e.value))return void X.error($r+"Invalid metric received",e);if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void X.error($r+"Ignoring metric with value >= "+this._maxAllowedValue,e);this.buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),H(this.buffer.url)&&(this.buffer.url=s),this.buffer.firstMetricTimestamp=H(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push({...e,$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()}),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()};_startCapturing=()=>{let e,t,i,s;const n=h.__PosthogExtensions__;H(n)||H(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=n.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):X.error($r+"web vitals callbacks not loaded - not starting")}}const Ar={icontains:(t,i)=>!!e&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!e&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!e&<(i.href,t),not_regex:(t,i)=>!!e&&!lt(i.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Lr{constructor(e){this.instance=e;const t=e=>{this.applyFeatureFlagChanges(e)};this.instance.onFeatureFlags&&this.instance.onFeatureFlags(t),this._flagToExperiments=new Map}applyFeatureFlagChanges(e){V(this._flagToExperiments)||this.instance.config.disable_web_experiments||(Lr.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var i;const t=this.instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&null!=s&&s.variants[t]&&this.applyTransforms(s.name,t,s.variants[t].transforms)}})))}afterDecideResponse(e){this._is_bot()?Lr.logInfo("Refusing to render web experiment since the viewer is a likely bot"):(this._featureFlags=e.featureFlags,this.loadIfEnabled(),this.previewWebExperiment())}previewWebExperiment(){const e=Lr.getWindowLocation();if(null!=e&&e.search){const t=ut(null==e?void 0:e.search,"__experiment_id"),i=ut(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Lr.logInfo(`previewing web experiments ${t} && ${i}`),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperimentsAndEvaluateDisplayLogic=(()=>{var e=this;return function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e.getWebExperiments((t=>{Lr.logInfo("retrieved web experiments from the server"),e._flagToExperiments=new Map,t.forEach((t=>{if(t.feature_flag_key&&e._featureFlags&&e._featureFlags[t.feature_flag_key]){var i;if(e._flagToExperiments)Lr.logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=e._flagToExperiments)||void 0===i||i.set(t.feature_flag_key,t);const s=e._featureFlags[t.feature_flag_key];s&&t.variants[s]&&e.applyTransforms(t.name,s,t.variants[s].transforms)}else if(t.variants)for(const i in t.variants){const s=t.variants[i];Lr.matchesTestVariant(s)&&e.applyTransforms(t.name,i,s.transforms)}}))}),t)}})();getWebExperiments(e,t,i){if(this.instance.config.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.instance.config.token}`),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);const i=t.json.experiments||[];return e(i)}})}showPreviewWebExperiment(e,t,i){const s=i.filter((t=>t.id===e));s&&s.length>0&&(Lr.logInfo(`Previewing web experiment [${s[0].name}] with variant [${t}]`),this.applyTransforms(s[0].name,t,s[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!V(e.conditions)&&(Lr.matchUrlConditions(e)&&Lr.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(V(e.conditions)||V(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;const i=Lr.getWindowLocation();if(i){var s,n,r;return null===(s=e.conditions)||void 0===s||!s.url||Ar[null!==(n=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url,i)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static matchUTMConditions(e){var t;if(V(e.conditions)||V(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=ci.campaignParams();if(i.utm_source){var s,n,r,o,a,l,c,u,d,h,p,_,g,f,v,m;const t=null===(s=e.conditions)||void 0===s||null===(n=s.utm)||void 0===n||!n.utm_campaign||(null===(r=e.conditions)||void 0===r||null===(o=r.utm)||void 0===o?void 0:o.utm_campaign)==i.utm_campaign,y=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(c=e.conditions)||void 0===c||null===(u=c.utm)||void 0===u?void 0:u.utm_source)==i.utm_source,b=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(p=e.conditions)||void 0===p||null===(_=p.utm)||void 0===_?void 0:_.utm_medium)==i.utm_medium,w=null===(g=e.conditions)||void 0===g||null===(f=g.utm)||void 0===f||!f.utm_term||(null===(v=e.conditions)||void 0===v||null===(m=v.utm)||void 0===m?void 0:m.utm_term)==i.utm_term;return t&&b&&w&&y}return!1}static logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];X.info(`[WebExperiments] ${e}`,i)}applyTransforms(e,t,i,s){var n;this._is_bot()?Lr.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var n;Lr.logInfo(`applying transform of variant ${t} for experiment ${e} `,i);let o=0;const a=null===(n=document)||void 0===n?void 0:n.querySelectorAll(i.selector);var r;if(null==a||a.forEach((e=>{const t=e;o+=1,i.attributes&&i.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),i.text&&(t.innerText=i.text),i.html&&(t.parentElement?t.parentElement.innerHTML=i.html:t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:s,$web_experiment_document_url:null===(r=Lr.getWindowLocation())||void 0===r?void 0:r.href,$web_experiment_elements_modified:o})}})):(Lr.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:s,$web_experiment_variant:t,$web_experiment_document_url:null===(n=Lr.getWindowLocation())||void 0===n?void 0:n.href,$web_experiment_elements_modified:0}))}_is_bot(){return r&&this.instance?pr(r,this.instance.config.custom_blocked_useragents):void 0}}class Or{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}const Dr={},Nr=()=>{},qr="posthog";let Br=!Zs&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla"));const Hr=()=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:T(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Nr,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:a&&U(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null===(t=e.location)||void 0===t?void 0:t.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:e=>{const t="Bad HTTP status: "+e.statusCode+" "+e.text;X.error(t)},get_device_id:e=>e,_onCapture:Nr,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},Ur=e=>{const t={};H(e.process_person)||(t.person_profiles=e.process_person),H(e.xhr_headers)||(t.request_headers=e.xhr_headers),H(e.cookie_name)||(t.persistence_name=e.cookie_name),H(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);const i=m({},t,e);return D(e.property_blacklist)&&(H(e.property_denylist)?i.property_denylist=e.property_blacklist:D(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:X.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Wr{get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){X.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}__forceAllowLocalhost=!1}class zr{webPerformance=new Wr;version=p.LIB_VERSION;_internalEventEmitter=new wn;constructor(){this.config=Hr(),this.decideEndpointWasHit=!1,this.SentryIntegration=gn,this.sentryIntegration=e=>function(e,t){const i=_n(e,t);return{name:pn,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new Ne(this),this.toolbar=new Xs(this),this.scrollManager=new br(this),this.pageViewManager=new vn(this),this.surveys=new ar(this),this.experiments=new Lr(this),this.exceptions=new Or(this),this.rateLimiter=new lr(this),this.requestRouter=new hn(this),this.consent=new Tr(this),this.people={set:(e,t,i)=>{const s=U(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=U(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>X.info(`send "${null==e?void 0:e.event}"`,e)))}init(e,t,i){if(i&&i!==qr){var s;const n=null!==(s=Dr[i])&&void 0!==s?s:new zr;return n._init(e,t,i),Dr[i]=n,Dr[qr][i]=n,n}return this._init(e,t,i)}_init(t){var i,s;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(H(t)||W(t))return X.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return X.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],n.person_profiles&&(this._initialPersonProfilesConfig=n.person_profiles),this.set_config(m({},Hr(),Ur(n),{name:r,token:t})),this.config.on_xhr_error&&X.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:exports.Compression.GZipJS,this.persistence=new di(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new di({...this.config,persistence:"sessionStorage"});const o={...this.persistence.props},a={...this.sessionPersistence.props};if(this._requestQueue=new Ks((e=>this._send_retriable_request(e))),this._retryQueue=new ln(this),this.__request_queue=[],this.sessionManager=new cn(this.config,this.persistence),this.sessionPropsManager=new ur(this.sessionManager,this.persistence),new Ir(this).startIfEnabledOrStop(),this.sessionRecording=new Gs(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new xr(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new yr(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Mr(this),this.exceptionObserver=new Rr(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new mr(this,vr),this.deadClicksAutocapture.startIfEnabled(),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&X.info("Starting in debug mode",{this:this,config:n,thisC:{...this.config},p:o,s:a}),this._sync_opt_out_with_persistence(),void 0!==(null===(i=n.bootstrap)||void 0===i?void 0:i.distinctID)){var l,c;const e=this.config.get_device_id(Ve()),t=null!==(l=n.bootstrap)&&void 0!==l&&l.isIdentifiedID?e:n.bootstrap.distinctID;this.persistence.set_property(xe,null!==(c=n.bootstrap)&&void 0!==c&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:t})}if(this._hasBootstrappedFeatureFlags()){var u,d;const e=Object.keys((null===(u=n.bootstrap)||void 0===u?void 0:u.featureFlags)||{}).filter((e=>{var t,i;return!(null===(t=n.bootstrap)||void 0===t||null===(i=t.featureFlags)||void 0===i||!i[e])})).reduce(((e,t)=>{var i,s;return e[t]=(null===(i=n.bootstrap)||void 0===i||null===(s=i.featureFlags)||void 0===s?void 0:s[t])||!1,e}),{}),t=Object.keys((null===(d=n.bootstrap)||void 0===d?void 0:d.featureFlagPayloads)||{}).filter((t=>e[t])).reduce(((e,t)=>{var i,s,r,o;null!==(i=n.bootstrap)&&void 0!==i&&null!==(s=i.featureFlagPayloads)&&void 0!==s&&s[t]&&(e[t]=null===(r=n.bootstrap)||void 0===r||null===(o=r.featureFlagPayloads)||void 0===o?void 0:o[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:e,featureFlagPayloads:t})}if(!this.get_distinct_id()){const e=this.config.get_device_id(Ve());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(xe,"anonymous")}return null==e||null===(s=e.addEventListener)||void 0===s||s.call(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),n.segment?fn(this,(()=>this._loaded())):this._loaded(),N(this.config._onCapture)&&this.config._onCapture!==Nr&&(X.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_afterDecideResponse(e){var t,i,s,n,r,o,a,l,c;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=y(e.supportedCompression,exports.Compression.GZipJS)?exports.Compression.GZipJS:y(e.supportedCompression,exports.Compression.Base64)?exports.Compression.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(i=this.sessionRecording)||void 0===i||i.afterDecideResponse(e),null===(s=this.autocapture)||void 0===s||s.afterDecideResponse(e),null===(n=this.heatmaps)||void 0===n||n.afterDecideResponse(e),null===(r=this.experiments)||void 0===r||r.afterDecideResponse(e),null===(o=this.surveys)||void 0===o||o.afterDecideResponse(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.afterDecideResponse(e),null===(l=this.exceptionObserver)||void 0===l||l.afterDecideResponse(e),null===(c=this.deadClicksAutocapture)||void 0===c||c.afterDecideResponse(e)}_loaded(){const e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){X.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),e||(new js(this).call(),this.featureFlags.resetRequestQueue())}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||f(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Br?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=tn(e.url,{ip:this.config.ip?1:0}),e.headers={...this.config.request_headers},e.compression="best-available"===e.compression?this.compression:e.compression,(e=>{var t,i,s;const n={...e};n.timeout=n.timeout||6e4,n.url=tn(n.url,{_:(new Date).getTime().toString(),ver:p.LIB_VERSION,compression:n.compression});const r=null!==(t=n.transport)&&void 0!==t?t:"XHR",o=null!==(i=null===(s=P(an,(e=>e.transport===r)))||void 0===s?void 0:s.method)&&void 0!==i?i:an[0].method;if(!o)throw new Error("No available transport method");o(n)})({...e,callback:t=>{var i,s,n;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(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)}})))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){let t;const i=[],s=[],n=[];f(e,(e=>{e&&(t=e[0],D(t)?n.push(e):N(e)?e.call(this):D(e)&&"alias"===t?i.push(e):D(e)&&-1!==t.indexOf("capture")&&N(this[t])?n.push(e):s.push(e))}));const r=function(e,t){f(e,(function(e){if(D(e[0])){let i=t;v(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};r(i,this),r(s,this),r(n,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void X.uninitializedWarning("posthog.capture");if(this.consent.isOptedOut())return;if(H(e)||!U(e))return void X.error("No event name provided to posthog.capture");if(!this.config.opt_out_useragent_filter&&this._is_bot())return;const n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null!=n&&n.isRateLimited)return void X.critical("This capture call is ignored due to client rate limiting.");this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();const r=new Date,o=(null==i?void 0:i.timestamp)||r;let a={uuid:Ve(),event:e,properties:this._calculate_event_properties(e,t||{},o)};n&&(a.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens);(null==i?void 0:i.$set)&&(a.$set=null==i?void 0:i.$set);const l=this._calculate_set_once_properties(null==i?void 0:i.$set_once);l&&(a.$set_once=l),a=x(a,null!=i&&i._noTruncate?null:this.config.properties_string_max_length),a.timestamp=o,H(null==i?void 0:i.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=r);const c={...a.properties.$set,...a.$set};if(B(c)||this.setPersonPropertiesForFlags(c),!V(this.config.before_send)){const e=this._runBeforeSend(a);if(!e)return;a=e}this._internalEventEmitter.emit("eventCaptured",a);const u={method:"POST",url:null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(u):this._requestQueue.enqueue(u),a}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,t,i){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;const s=this.persistence.remove_event_timer(e);let n={...t};if(n.token=this.config.token,"$snapshot"===e){const e={...this.persistence.properties(),...this.sessionPersistence.properties()};return n.distinct_id=e.distinct_id,(!U(n.distinct_id)&&!G(n.distinct_id)||W(n.distinct_id))&&X.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),n}const r=ci.properties();if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId();n.$session_id=e,n.$window_id=t}if(this.requestRouter.region===un.CUSTOM&&(n.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){const e=this.sessionPropsManager.getSessionProps();n=m(n,e)}if(!this.config.disable_scroll_properties){let t={};"$pageview"===e?t=this.pageViewManager.doPageView(i):"$pageleave"===e&&(t=this.pageViewManager.doPageLeave(i)),n=m(n,t)}if("$pageview"===e&&o&&(n.title=o.title),!H(s)){const e=i.getTime()-s;n.$duration=parseFloat((e/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(n.$browser_type=this._is_bot()?"bot":"browser"),n=m({},r,this.persistence.properties(),this.sessionPersistence.properties(),n),n.$is_identified=this._isIdentified(),D(this.config.property_denylist)?v(this.config.property_denylist,(function(e){delete n[e]})):X.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const a=this.config.sanitize_properties;a&&(n=a(n,e));const l=this._hasPersonProcessing();return n.$process_person_profile=l,l&&this._requirePersonProcessing("_calculate_event_properties"),n}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;let t=m({},this.persistence.get_initial_props(),e||{});const i=this.config.sanitize_properties;return i&&(t=i(t,"$set_once")),B(t)?void 0:t}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;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}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)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){const t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,i){return this.surveys.getNextSurveyStep(e,t,i)}identify(e,t,i){if(!this.__loaded||!this.persistence)return X.uninitializedWarning("posthog.identify");if(G(e)&&(e=e.toString(),X.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!e)return void X.error("Unique user id has not been set in posthog.identify");if(["distinct_id","distinctid"].includes(e.toLowerCase()))return void X.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.`);if(!this._requirePersonProcessing("posthog.identify"))return;const s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){const e=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:e},"")}e!==s&&e!==this.get_property(ee)&&(this.unregister(ee),this.register({distinct_id:e}));const n="anonymous"===(this.persistence.get_property(xe)||"anonymous");e!==s&&n?(this.persistence.set_property(xe,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(ke))}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,i){if(!e||!t)return void X.error("posthog.group requires a group type and group key");if(!this._requirePersonProcessing("posthog.group"))return;const s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:{...s,[e]:t}}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n,r;if(X.info("reset"),!this.__loaded)return X.uninitializedWarning("posthog.reset");const o=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(i=this.sessionPersistence)||void 0===i||i.clear(),null===(s=this.surveys)||void 0===s||s.reset(),null===(n=this.persistence)||void 0===n||n.set_property(xe,"anonymous"),null===(r=this.sessionManager)||void 0===r||r.resetSessionId();const a=this.config.get_device_id(Ve());this.register_once({distinct_id:a,$device_id:e?a:o},"")}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&&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(Z)?(X.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ee,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(X.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t={...this.config};var i,s,n,r;q(e)&&(m(this.config,Ur(e)),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 di({...this.config,persistence:"sessionStorage"}),Ze.is_supported()&&"true"===Ze.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(p.DEBUG=!0,X.info("set_config",{config:e,oldConfig:t,newConfig:{...this.config}})),null===(s=this.sessionRecording)||void 0===s||s.startIfEnabledOrStop(),null===(n=this.autocapture)||void 0===n||n.startIfEnabled(),null===(r=this.heatmaps)||void 0===r||r.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){const t=!0===e,i={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,r,o,a;if(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling)null===(n=this.sessionRecording)||void 0===n||n.overrideSampling();if(i.linked_flag)null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag();if(i.url_trigger)null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url");if(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||!e.started)}captureException(e,t){var i;const s=new Error("PostHog syntheticException"),n=N(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?h.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:s}):{$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}],...t};this.exceptions.sendExceptionEvent(n)}loadToolbar(e){return this.toolbar.loadToolbar(e)}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:qr;return t!==qr&&(t=qr+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(xe))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(xe))}_hasPersonProcessing(){var e,t,i,s;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&B(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[ee])&&(null===(i=this.persistence)||void 0===i||null===(s=i.props)||void 0===s||!s[Fe]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(X.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Fe,!0),!0)}_sync_opt_out_with_persistence(){var e,t;const i=this.consent.isOptedOut(),s=this.config.opt_out_persistence_by_default,n=this.config.disable_persistence||i&&!!s;var r,o;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==n&&(null===(r=this.persistence)||void 0===r||r.set_disabled(n));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==n&&(null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(n))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),H(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return r?pr(r,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){o&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==e||e.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(V(this.config.before_send))return e;const t=D(this.config.before_send)?this.config.before_send:[this.config.before_send];let i=e;for(const s of t){if(i=s(i),V(i)){const t=`Event '${e.event}' was rejected in beforeSend function`;return J(e.event)?X.warn(`${t}. This can cause unexpected behavior.`):X.info(t),null}i.properties&&!B(i.properties)||X.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}return i}}!function(e,t){for(let i=0;i<t.length;i++)e.prototype[t[i]]=S(e.prototype[t[i]])}(zr,["identify"]);const Vr=function(){const t=Dr[qr]=new zr;return function(){function t(){t.done||(t.done=!0,Br=!1,v(Dr,(function(e){e._dom_loaded()})))}null!=o&&o.addEventListener&&("complete"===o.readyState?t():o.addEventListener("DOMContentLoaded",t,!1)),e&&C(e,"load",t,!0)}(),t}();exports.COPY_AUTOCAPTURE_EVENT=R,exports.PostHog=zr,exports.default=Vr,exports.knownUnsafeEditableEvent=F,exports.posthog=Vr,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,i=Array.prototype,s=i.forEach,r=i.indexOf,n=null==t?void 0:t.navigator,o=null==t?void 0:t.document,a=null==t?void 0:t.location,l=null==t?void 0:t.fetch,u=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,c=null==t?void 0:t.AbortController,d=null==n?void 0:n.userAgent,h=null!=e?e:{},p={DEBUG:!1,LIB_VERSION:"1.187.2"},_={},v=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function g(e,t,i){if(L(e))if(s&&e.forEach===s)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,n=e.length;r<n;r++)if(r in e&&t.call(i,e[r],r)===_)return}function f(e,t,i){if(!z(e)){if(L(e))return g(e,t,i);if(G(e)){for(var s of e.entries())if(t.call(i,s[1],s[0])===_)return}else for(var r in e)if(A.call(e,r)&&t.call(i,e[r],r)===_)return}}var m=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return g(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e};function y(e,t){return-1!==e.indexOf(t)}function b(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var w=function(e){try{return e()}catch(e){return}},S=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Y.critical(e)}}},E=function(e){var t={};return f(e,(function(e,i){H(e)&&e.length>0&&(t[i]=e)})),t},k=function(e){return e.replace(/^\$/,"")};function x(e,t){return i=e,s=e=>H(e)&&!W(t)?e.slice(0,t):e,r=new Set,function e(t,i){return t!==Object(t)?s?s(t,i):t:r.has(t)?void 0:(r.add(t),L(t)?(n=[],g(t,(t=>{n.push(e(t))}))):(n={},f(t,((t,i)=>{r.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,s,r}var I=function(e){var t,i,s,r,n="";for(t=i=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,r=0;r<s;r++){var o=e.charCodeAt(r),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),W(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=r+1)}return i>t&&(n+=e.substring(t,e.length)),n},P=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(i,s,r,n,o){if(i)if(i.addEventListener&&!n)i.addEventListener(s,r,!!o);else{var a="on"+s,l=i[a];i[a]=function(i,s,r){return function(n){if(n=n||t(null==e?void 0:e.event)){var o,a=!0;D(r)&&(o=r(n));var l=s.call(i,n);return!1!==o&&!1!==l||(a=!1),a}}}(i,r,l)}else Y.error("No valid element provided to register_event")}}();function C(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}var T,R="$copy_autocapture",F=["$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"];exports.Compression=void 0,(T=exports.Compression||(exports.Compression={})).GZipJS="gzip-js",T.Base64="base64";var $=Array.isArray,M=Object.prototype,A=M.hasOwnProperty,O=M.toString,L=$||function(e){return"[object Array]"===O.call(e)},D=e=>"function"==typeof e,N=e=>e===Object(e)&&!L(e),q=e=>{if(N(e)){for(var t in e)if(A.call(e,t))return!1;return!0}return!1},B=e=>void 0===e,H=e=>"[object String]"==O.call(e),U=e=>H(e)&&0===e.trim().length,W=e=>null===e,z=e=>B(e)||W(e),j=e=>"[object Number]"==O.call(e),V=e=>"[object Boolean]"===O.call(e),G=e=>e instanceof FormData,Q=e=>y(F,e),J="[PostHog.js]",Y={_log:function(t){if(e&&(p.DEBUG||h.POSTHOG_DEBUG)&&!B(e.console)&&e.console){for(var i=("__rrweb_original__"in e.console[t]?e.console[t].__rrweb_original__:e.console[t]),s=arguments.length,r=new Array(s>1?s-1:0),n=1;n<s;n++)r[n-1]=arguments[n];i(J,...r)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];Y._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];Y._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];Y._log("error",...t)},critical:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.error(J,...t)},uninitializedWarning:e=>{Y.error("You must initialize PostHog before calling ".concat(e))}},X=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Y.warn("".concat(t," was requested but loading of external scripts is disabled.")),i("Loading of external scripts is disabled");var s=()=>{if(!o)return i("document not found");var e=o.createElement("script");e.type="text/javascript",e.crossOrigin="anonymous",e.src=t,e.onload=e=>i(void 0,e),e.onerror=e=>i(e);var s,r=o.querySelectorAll("body > script");r.length>0?null===(s=r[0].parentNode)||void 0===s||s.insertBefore(e,r[0]):o.body.appendChild(e)};null!=o&&o.body?s():null==o||o.addEventListener("DOMContentLoaded",s)};function K(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 Z(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?K(Object(i),!0).forEach((function(t){ee(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):K(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ee(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function te(e,t){if(null==e)return{};var i,s,r=function(e,t){if(null==e)return{};var i,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)i=n[s],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)i=n[s],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if("toolbar"===t){var r=3e5,n=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(n)}var o=e.requestRouter.endpointFor("assets",s);X(e,o,i)},h.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);X(e,s,i)};var ie="$people_distinct_id",se="__alias",re="__timers",ne="$autocapture_disabled_server_side",oe="$heatmaps_enabled_server_side",ae="$exception_capture_enabled_server_side",le="$web_vitals_enabled_server_side",ue="$dead_clicks_enabled_server_side",ce="$web_vitals_allowed_metrics",de="$session_recording_enabled_server_side",he="$console_log_recording_enabled_server_side",pe="$session_recording_network_payload_capture",_e="$session_recording_canvas_recording",ve="$replay_sample_rate",ge="$replay_minimum_duration",fe="$sesid",me="$session_is_sampled",ye="$session_recording_url_trigger_activated_session",be="$session_recording_event_trigger_activated_session",we="$enabled_feature_flags",Se="$early_access_features",Ee="$stored_person_properties",ke="$stored_group_properties",xe="$surveys",Ie="$surveys_activated",Pe="$flag_call_reported",Ce="$user_state",Te="$client_session_props",Re="$capture_rate_limit",Fe="$initial_campaign_params",$e="$initial_referrer_info",Me="$initial_person_info",Ae="$epp",Oe="__POSTHOG_TOOLBAR__",Le=[ie,se,"__cmpns",re,de,oe,fe,we,Ce,Se,ke,Ee,xe,Pe,Te,Re,Fe,$e,Ae],De="$active_feature_flags",Ne="$override_feature_flags",qe="$feature_flag_payloads",Be=e=>{var t={};for(var[i,s]of b(e||{}))s&&(t[i]=s);return t};class He{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(we),t=this.instance.get_property(Ne);if(!t)return e||{};for(var i=m({},e),s=Object.keys(t),r=0;r<s.length;r++)i[s[r]]=t[s[r]];return this._override_warning||(Y.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){return this.instance.get_property(qe)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout((()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())}),5)}_reloadFeatureFlagsRequest(){if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var e=this.instance.config.token,t=this.instance.get_property(Ee),i=this.instance.get_property(ke),s={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:i,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:s,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>{var t;this.setReloadingPaused(!1);var i=!0;200===e.statusCode&&(this.$anon_distinct_id=void 0,i=!1),this.receivedFeatureFlags(null!==(t=e.json)&&void 0!==t?t:{},i),this._startReloadTimer()}})}}getFeatureFlag(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var i,s=this.getFlagVariants()[e],r="".concat(s),n=this.instance.get_property(Pe)||{};if(t.send_event||!("send_event"in t))if(!(e in n)||!n[e].includes(r))L(n[e])?n[e].push(r):n[e]=[r],null===(i=this.instance.persistence)||void 0===i||i.register({[Pe]:n}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:s});return s}Y.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);Y.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads();!function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=e.featureFlags,n=e.featureFlagPayloads;if(r)if(L(r)){var o={};if(r)for(var a=0;a<r.length;a++)o[r[a]]=!0;t&&t.register({[De]:r,[we]:o})}else{var l=r,u=n;e.errorsWhileComputingFlags&&(l=Z(Z({},i),l),u=Z(Z({},s),u)),t&&t.register({[De]:Object.keys(Be(l)),[we]:l||{},[qe]:u||{}})}}(e,this.instance.persistence,i,s),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return Y.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,!1===e)this.instance.persistence.unregister(Ne);else if(L(e)){for(var i={},s=0;s<e.length;s++)i[e[s]]=!0;this.instance.persistence.register({[Ne]:i})}else this.instance.persistence.register({[Ne]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,s={["$feature_enrollment/".concat(e)]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:s}),this.setPersonPropertiesForFlags(s,!1);var r=Z(Z({},this.getFlagVariants()),{},{[e]:t});null===(i=this.instance.persistence)||void 0===i||i.register({[De]:Object.keys(Be(r)),[we]:r}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.instance.get_property(Se);if(i&&!t)return e(i);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:t=>{var i;if(t.json){var s=t.json.earlyAccessFeatures;return null===(i=this.instance.persistence)||void 0===i||i.register({[Se]:s}),e(s)}}})}_prepareFeatureFlagsForCallbacks(){var 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)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(Ee)||{};this.instance.register({[Ee]:Z(Z({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Ee)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.instance.get_property(ke)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=Z(Z({},i[t]),e[t]),delete e[t]})),this.instance.register({[ke]:Z(Z({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(ke)||{};this.instance.register({[ke]:Z(Z({},t),{},{[e]:{}})})}else this.instance.unregister(ke)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return j(e)&&isFinite(e)&&Math.floor(e)===e});var Ue="0123456789abcdef";class We{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new We(r)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Ue.charAt(this.bytes[t]>>>4)+Ue.charAt(15&this.bytes[t]),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 We(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class ze{constructor(){ee(this,"timestamp",0),ee(this,"counter",0),ee(this,"random",new Ge)}generate(){var e=this.generateOrAbort();if(B(e)){this.timestamp=0;var t=this.generateOrAbort();if(B(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return We.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var je,Ve=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!B(e.crypto)&&crypto.getRandomValues&&(Ve=e=>crypto.getRandomValues(e));class Ge{constructor(){ee(this,"buffer",new Uint32Array(8)),ee(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(Ve(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Qe=()=>Je().toString(),Je=()=>(je||(je=new ze)).generate(),Ye="Thu, 01 Jan 1970 00:00:00 GMT",Xe="";var Ke=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ze(e,t){if(t){var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if(Xe)return Xe;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+Qe(),n=new RegExp("(^|;)\\s*"+r+"=1");!Xe&&s--;){var a=i.slice(s).join("."),l=r+"=1;domain=."+a;t.cookie=l,n.test(t.cookie)&&(t.cookie=l+";expires="+Ye,Xe=a)}return Xe}(e);if(!i){var s=(e=>{var t=e.match(Ke);return t?t[0]:""})(e);s!==i&&Y.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}var et={is_supported:()=>!!o,error:function(e){Y.error("cookieStore error: "+e)},get:function(e){if(o){try{for(var t=e+"=",i=o.cookie.split(";").filter((e=>e.length)),s=0;s<i.length;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},parse:function(e){var t;try{t=JSON.parse(et.get(e))||{}}catch(e){}return t},set:function(e,t,i,s,r){if(o)try{var n="",a="",l=Ze(o.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+24*i*60*60*1e3),n="; expires="+u.toUTCString()}r&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Y.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,c}catch(e){return}},remove:function(e,t){try{et.set(e,"",-1,t)}catch(e){return}}},tt=null,it={is_supported:function(){if(!W(tt))return tt;var t=!0;if(B(e))t=!1;else try{var i="__mplssupport__";it.set(i,"xyz"),'"xyz"'!==it.get(i)&&(t=!1),it.remove(i)}catch(e){t=!1}return t||Y.error("localStorage unsupported; falling back to cookie store"),tt=t,t},error:function(e){Y.error("localStorage error: "+e)},get:function(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){it.error(e)}return null},parse:function(e){try{return JSON.parse(it.get(e))||{}}catch(e){}return null},set:function(t,i){try{null==e||e.localStorage.setItem(t,JSON.stringify(i))}catch(e){it.error(e)}},remove:function(t){try{null==e||e.localStorage.removeItem(t)}catch(e){it.error(e)}}},st=["distinct_id",fe,me,Ae],rt=Z(Z({},it),{},{parse:function(e){try{var t={};try{t=et.parse(e)||{}}catch(e){}var i=m(t,JSON.parse(it.get(e)||"{}"));return it.set(e,i),i}catch(e){}return null},set:function(e,t,i,s,r,n){try{it.set(e,t,void 0,void 0,n);var o={};st.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&et.set(e,o,i,s,r,n)}catch(e){it.error(e)}},remove:function(t,i){try{null==e||e.localStorage.removeItem(t),et.remove(t,i)}catch(e){it.error(e)}}}),nt={},ot={is_supported:function(){return!0},error:function(e){Y.error("memoryStorage error: "+e)},get:function(e){return nt[e]||null},parse:function(e){return nt[e]||null},set:function(e,t){nt[e]=t},remove:function(e){delete nt[e]}},at=null,lt={is_supported:function(){if(!W(at))return at;if(at=!0,B(e))at=!1;else try{var t="__support__";lt.set(t,"xyz"),'"xyz"'!==lt.get(t)&&(at=!1),lt.remove(t)}catch(e){at=!1}return at},error:function(e){Y.error("sessionStorage error: ",e)},get:function(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){lt.error(e)}return null},parse:function(e){try{return JSON.parse(lt.get(e))||null}catch(e){}return null},set:function(t,i){try{null==e||e.sessionStorage.setItem(t,JSON.stringify(i))}catch(e){lt.error(e)}},remove:function(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){lt.error(e)}}},ut=["localhost","127.0.0.1"],ct=e=>{var t=null==o?void 0:o.createElement("a");return B(t)?null:(t.href=e,t)},dt=function(e,t){return!!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t)&&new RegExp(t).test(e)},ht=function(e){var t,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return f(e,(function(e,s){B(e)||B(s)||"undefined"===s||(t=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(s),r[r.length]=i+"="+t)})),r.join(s)},pt=function(e,t){for(var i,s=((e.split("#")[0]||"").split("?")[1]||"").split("&"),r=0;r<s.length;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!L(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Y.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},_t=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},vt="Mobile",gt="iOS",ft="Android",mt="Tablet",yt=ft+" "+mt,bt="iPad",wt="Apple",St=wt+" Watch",Et="Safari",kt="BlackBerry",xt="Samsung",It=xt+"Browser",Pt=xt+" Internet",Ct="Chrome",Tt=Ct+" OS",Rt=Ct+" "+gt,Ft="Internet Explorer",$t=Ft+" "+vt,Mt="Opera",At=Mt+" Mini",Ot="Edge",Lt="Microsoft "+Ot,Dt="Firefox",Nt=Dt+" "+gt,qt="Nintendo",Bt="PlayStation",Ht="Xbox",Ut=ft+" "+vt,Wt=vt+" "+Et,zt="Windows",jt=zt+" Phone",Vt="Nokia",Gt="Ouya",Qt="Generic",Jt=Qt+" "+vt.toLowerCase(),Yt=Qt+" "+mt.toLowerCase(),Xt="Konqueror",Kt="(\\d+(\\.\\d+)?)",Zt=new RegExp("Version/"+Kt),ei=new RegExp(Ht,"i"),ti=new RegExp(Bt+" \\w+","i"),ii=new RegExp(qt+" \\w+","i"),si=new RegExp(kt+"|PlayBook|BB10","i"),ri={"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"};var ni=(e,t)=>t&&y(t,wt)||function(e){return y(e,Et)&&!y(e,Ct)&&!y(e,ft)}(e),oi=function(e,t){return t=t||"",y(e," OPR/")&&y(e,"Mini")?At:y(e," OPR/")?Mt:si.test(e)?kt:y(e,"IE"+vt)||y(e,"WPDesktop")?$t:y(e,It)?Pt:y(e,Ot)||y(e,"Edg/")?Lt:y(e,"FBIOS")?"Facebook "+vt:y(e,"UCWEB")||y(e,"UCBrowser")?"UC Browser":y(e,"CriOS")?Rt:y(e,"CrMo")?Ct:y(e,ft)&&y(e,Et)?Ut:y(e,Ct)?Ct:y(e,"FxiOS")?Nt:y(e.toLowerCase(),Xt.toLowerCase())?Xt:ni(e,t)?y(e,vt)?Wt:Et:y(e,Dt)?Dt:y(e,"MSIE")||y(e,"Trident/")?Ft:y(e,"Gecko")?Dt:""},ai={[$t]:[new RegExp("rv:"+Kt)],[Lt]:[new RegExp(Ot+"?\\/"+Kt)],[Ct]:[new RegExp("("+Ct+"|CrMo)\\/"+Kt)],[Rt]:[new RegExp("CriOS\\/"+Kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Kt)],[Et]:[Zt],[Wt]:[Zt],[Mt]:[new RegExp("(Opera|OPR)\\/"+Kt)],[Dt]:[new RegExp(Dt+"\\/"+Kt)],[Nt]:[new RegExp("FxiOS\\/"+Kt)],[Xt]:[new RegExp("Konqueror[:/]?"+Kt,"i")],[kt]:[new RegExp(kt+" "+Kt),Zt],[Ut]:[new RegExp("android\\s"+Kt,"i")],[Pt]:[new RegExp(It+"\\/"+Kt)],[Ft]:[new RegExp("(rv:|MSIE )"+Kt)],Mozilla:[new RegExp("rv:"+Kt)]},li=[[new RegExp(Ht+"; "+Ht+" (.*?)[);]","i"),e=>[Ht,e&&e[1]||""]],[new RegExp(qt,"i"),[qt,""]],[new RegExp(Bt,"i"),[Bt,""]],[si,[kt,""]],[new RegExp(zt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[jt,""];if(new RegExp(vt).test(t)&&!/IEMobile\b/.test(t))return[zt+" "+vt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=i[1],r=ri[s]||"";return/arm/i.test(t)&&(r="RT"),[zt,r]}return[zt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[gt,t.join(".")]}return[gt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=B(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ft+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ft+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ft,t.join(".")]}return[ft,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Tt,""]],[/Linux|debian/i,["Linux",""]]],ui=function(e){return ii.test(e)?qt:ti.test(e)?Bt:ei.test(e)?Ht:new RegExp(Gt,"i").test(e)?Gt:new RegExp("("+jt+"|WPDesktop)","i").test(e)?jt:/iPad/.test(e)?bt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?St:si.test(e)?kt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Vt,"i").test(e)?Vt:/(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(vt).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)?ft:yt:ft:new RegExp("(pda|"+vt+")","i").test(e)?Jt:new RegExp(mt,"i").test(e)&&!new RegExp(mt+" pc","i").test(e)?Yt:""},ci="https?://(.*)",di=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],hi={campaignParams:function(e){return o?this._campaignParamsFromUrl(o.URL,e):{}},_campaignParamsFromUrl:function(e,t){var i=di.concat(t||[]),s={};return f(i,(function(t){var i=pt(e,t);s[t]=i||null})),s},_searchEngine:function(e){return e?0===e.search(ci+"google.([^/?]*)")?"google":0===e.search(ci+"bing.com")?"bing":0===e.search(ci+"yahoo.com")?"yahoo":0===e.search(ci+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=hi._searchEngine(e),i="yahoo"!=t?"q":"p",s={};if(!W(t)){s.$search_engine=t;var r=o?pt(o.referrer,i):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:oi,browserVersion:function(e,t){var i=oi(e,t),s=ai[i];if(B(s))return null;for(var r=0;r<s.length;r++){var n=s[r],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(e){for(var t=0;t<li.length;t++){var[i,s]=li[t],r=i.exec(e),n=r&&(D(s)?s(r,e):s);if(n)return n}return["",""]},device:ui,deviceType:function(e){var t=ui(e);return t===bt||t===yt||"Kobo"===t||"Kindle Fire"===t||t===Yt?mt:t===qt||t===Ht||t===Bt||t===Gt?"Console":t===St?"Wearable":t?vt:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=ct(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:null==a?void 0:a.href}},initialPersonPropsFromInfo:function(e){var t,{r:i,u:s}=e,r={$initial_referrer:i,$initial_referring_domain:null==i?void 0:"$direct"==i?"$direct":null===(t=ct(i))||void 0===t?void 0:t.host};if(s){r.$initial_current_url=s;var n=ct(s);r.$initial_host=null==n?void 0:n.host,r.$initial_pathname=null==n?void 0:n.pathname,f(this._campaignParamsFromUrl(s),(function(e,t){r["$initial_"+k(t)]=e}))}i&&f(this._searchInfoFromReferrer(i),(function(e,t){r["$initial_"+k(t)]=e}));return r},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},properties:function(){if(!d)return{};var[t,i]=hi.os(d);return m(E({$os:t,$os_version:i,$browser:hi.browser(d,navigator.vendor),$device:hi.device(d),$device_type:hi.deviceType(d),$timezone:hi.timezone()}),{$current_url:null==a?void 0:a.href,$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:hi.browserVersion(d,navigator.vendor),$browser_language:hi.browserLanguage(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:p.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!d)return{};var[e,t]=hi.os(d);return m(E({$os:e,$os_version:t,$browser:hi.browser(d,navigator.vendor)}),{$browser_version:hi.browserVersion(d,navigator.vendor)})}},pi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class _i{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&Y.info("Persistence loaded",e.persistence,Z({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){-1===pi.indexOf(e.persistence.toLowerCase())&&(Y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&it.is_supported()?it:"localstorage+cookie"===t&&rt.is_supported()?rt:"sessionstorage"===t&<.is_supported()?lt:"memory"===t?ot:"cookie"===t?et:rt.is_supported()?rt:et}properties(){var e={};return f(this.props,(function(t,i){if(i===we&&N(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/".concat(s[n])]=t[s[n]];else a=i,l=!1,(W(o=Le)?l:r&&o.indexOf===r?-1!=o.indexOf(a):(f(o,(function(e){if(l||(l=e===a))return _})),l))||(e[i]=t);var o,a,l})),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=m({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(N(e)){B(t)&&(t="None"),this.expire_days=B(i)?this.default_expiry:i;var s=!1;if(f(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(N(e)){this.expire_days=B(t)?this.default_expiry:t;var i=!1;if(f(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=hi.campaignParams(this.config.custom_campaign_params);q(E(e))||this.register(hi.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0}}update_search_keyword(){this.register(hi.searchInfo())}update_referrer_info(){this.register_once(hi.referrerInfo(),void 0)}set_initial_person_info(){this.props[Fe]||this.props[$e]||this.register_once({[Me]:hi.initialPersonInfo()},void 0)}get_referrer_info(){return E({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};f([$e,Fe],(t=>{var i=this.props[t];i&&f(i,(function(t,i){e["$initial_"+k(i)]=t}))}));var t=this.props[Me];if(t){var i=hi.initialPersonPropsFromInfo(t);m(e,i)}return e}safe_merge(e){return f(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var i=this.buildStorage(e),s=this.props;this.clear(),this.storage=i,this.props=s,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[re]||{};i[e]=t,this.props[re]=i,this.save()}remove_event_timer(e){var t=(this.props[re]||{})[e];return B(t)||(delete this.props[re][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function vi(e){var t,i;return(null===(t=JSON.stringify(e,(i=[],function(e,t){if(N(t)){for(;i.length>0&&i.at(-1)!==this;)i.pop();return i.includes(t)?"[Circular]":(i.push(t),t)}return t})))||void 0===t?void 0:t.length)||0}function gi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6606028.8;if(e.size>=t&&e.data.length>1){var i=Math.floor(e.data.length/2),s=e.data.slice(0,i),r=e.data.slice(i);return[gi({size:vi(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),gi({size:vi(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var fi=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(fi||{}),mi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(mi||{});function yi(e){var t;return e.id===Oe||!(null===(t=e.closest)||void 0===t||!t.call(e,".toolbar-global-fade-container"))}function bi(e){return!!e&&1===e.nodeType}function wi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Si(e){return!!e&&3===e.nodeType}function Ei(e){return!!e&&11===e.nodeType}function ki(e){return e?v(e).split(/\s+/):[]}function xi(t){var i=null==e?void 0:e.location.href;return!!(i&&t&&t.some((e=>i.match(e))))}function Ii(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ki(t)}function Pi(e){return z(e)?null:v(e).split(/(\s+)/).filter((e=>Hi(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ci(e){var t="";return Mi(e)&&!Ai(e)&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;Si(e)&&e.textContent&&(t+=null!==(i=Pi(e.textContent))&&void 0!==i?i:"")})),v(t)}function Ti(e){return B(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ri=["a","button","form","input","select","textarea","label"];function Fi(e){var t=e.parentNode;return!(!t||!bi(t))&&t}function $i(t,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!e||!t||wi(t,"html")||!bi(t))return!1;if(null!=s&&s.url_allowlist&&!xi(s.url_allowlist))return!1;if(null!=s&&s.url_ignorelist&&xi(s.url_ignorelist))return!1;if(null!=s&&s.dom_event_allowlist){var o=s.dom_event_allowlist;if(o&&!o.some((e=>i.type===e)))return!1}for(var a=!1,l=[t],u=!0,c=t;c.parentNode&&!wi(c,"body");)if(Ei(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(u=Fi(c)))break;if(r||Ri.indexOf(u.tagName.toLowerCase())>-1)a=!0;else{var d=e.getComputedStyle(u);d&&"pointer"===d.getPropertyValue("cursor")&&(a=!0)}l.push(u),c=u}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(B(i))return!0;var s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var r of e){var n=s(r);if("object"==typeof n)return n.v}return!1}(l,s))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(B(i))return!0;var s=function(e){if(i.some((t=>e.matches(t))))return{v:!0}};for(var r of e){var n=s(r);if("object"==typeof n)return n.v}return!1}(l,s))return!1;var h=e.getComputedStyle(t);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===i.type)return!0;var p=t.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Ri.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}function Mi(e){for(var t=e;t.parentNode&&!wi(t,"body");t=t.parentNode){var i=Ii(t);if(y(i,"ph-sensitive")||y(i,"ph-no-capture"))return!1}if(y(Ii(e),"ph-include"))return!0;var s=e.type||"";if(H(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(H(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Ai(e){return!!(wi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||wi(e,"select")||wi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Oi="(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})",Li=new RegExp("^(?:".concat(Oi,")$")),Di=new RegExp(Oi),Ni="\\d{3}-?\\d{2}-?\\d{4}",qi=new RegExp("^(".concat(Ni,")$")),Bi=new RegExp("(".concat(Ni,")"));function Hi(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(z(e))return!1;if(H(e)){if(e=v(e),(t?Li:Di).test((e||"").replace(/[- ]/g,"")))return!1;if((t?qi:Bi).test(e))return!1}return!0}function Ui(e){var t=Ci(e);return Hi(t="".concat(t," ").concat(Wi(e)).trim())?t:""}function Wi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&f(e.childNodes,(function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{var s=Ci(e);t="".concat(t," ").concat(s).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(Wi(e)).trim())}catch(e){Y.error(e)}})),t}function zi(e){return function(e){var t=e.map((e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+=".".concat(r.replace(/"/g,""));var n=Z(Z(Z(Z({},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),o={};return b(n).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return o[ji(t.toString())]=ji(i.toString())})),s+=":",s+=b(n).map((e=>{var[t,i]=e;return"".concat(t,'="').concat(i,'"')})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,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:Vi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return b(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return s.attributes[t]=i})),s}))}(e))}function ji(e){return e.replace(/"|\\"/g,'\\"')}function Vi(e){var t=e.attr__class;return t?L(t)?t:ki(t):void 0}var Gi="[SessionRecording]",Qi="redacted",Ji={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},Yi=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Xi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Ki=["/s/","/e/","/i/"];function Zi(e,t,i,s){if(z(e))return e;var r=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return H(r)&&(r=parseInt(r)),r>i?Gi+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function es(e,t){if(z(e))return e;var i=e;return Hi(i,!1)||(i=Gi+" "+t+" body "+Qi),f(Xi,(e=>{var s,r;null!==(s=i)&&void 0!==s&&s.length&&-1!==(null===(r=i)||void 0===r?void 0:r.indexOf(e))&&(i=Gi+" "+t+" body "+Qi+" as might contain: "+e)})),i}var ts=(e,t)=>{var i,s,r,n={payloadSizeLimitBytes:Ji.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Ji.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Ji.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,u=(i=n,r=Math.min(1e6,null!==(s=i.payloadSizeLimitBytes)&&void 0!==s?s:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=Zi(e.requestBody,e.requestHeaders,r,"Request")),null!=e&&e.responseBody&&(e.responseBody=Zi(e.responseBody,e.responseHeaders,r,"Response")),e)),c=e=>{return u((e=>{var t=ct(e.name);if(!(t&&t.pathname&&Ki.some((e=>0===t.pathname.indexOf(e)))))return e})((i=(t=e).requestHeaders,z(i)||f(Object.keys(null!=i?i:{}),(e=>{Yi.includes(e.toLowerCase())&&(i[e]=Qi)})),t)));var t,i},d=D(e.session_recording.maskNetworkRequestFn);return d&&D(e.session_recording.maskCapturedNetworkRequestFn)&&Y.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return Z(Z({},t),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=D(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s,r,n=c(t);return n&&null!==(i=null===(s=(r=e.session_recording).maskCapturedNetworkRequestFn)||void 0===s?void 0:s.call(r,n))&&void 0!==i?i:void 0}:e=>function(e){if(!B(e))return e.requestBody=es(e.requestBody,"Request"),e.responseBody=es(e.responseBody,"Response"),e}(c(e)),Z(Z(Z({},Ji),n),{},{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};function is(e,t,i,s){return t>i&&(Y.warn("min cannot be greater than max."),t=i),j(e)?e>i?(s&&Y.warn(s+" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(s&&Y.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&Y.warn(s+" must be a number. Defaulting to max value:"+i),i)}class ss{constructor(e){var t,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ee(this,"bucketSize",100),ee(this,"refillRate",10),ee(this,"mutationBuckets",{}),ee(this,"loggedTracker",{}),ee(this,"refillBuckets",(()=>{Object.keys(this.mutationBuckets).forEach((e=>{this.mutationBuckets[e]=this.mutationBuckets[e]+this.refillRate,this.mutationBuckets[e]>=this.bucketSize&&delete this.mutationBuckets[e]}))})),ee(this,"getNodeOrRelevantParent",(e=>{var t=this.rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var i=t.closest("svg");if(i)return[this.rrweb.mirror.getId(i),i]}return[e,t]})),ee(this,"numberOfChanges",(e=>{var t,i,s,r,n,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(r=e.attributes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)+(null!==(n=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)})),ee(this,"throttleMutations",(e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,i=this.numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t,i,s,[r,n]=this.getNodeOrRelevantParent(e.id);if(0===this.mutationBuckets[r])return!1;(this.mutationBuckets[r]=null!==(t=this.mutationBuckets[r])&&void 0!==t?t:this.bucketSize,this.mutationBuckets[r]=Math.max(this.mutationBuckets[r]-1,0),0===this.mutationBuckets[r])&&(this.loggedTracker[r]||(this.loggedTracker[r]=!0,null===(i=(s=this.options).onBlockedNode)||void 0===i||i.call(s,r,n)));return e})));var s=this.numberOfChanges(t);return 0!==s||i===s?e:void 0})),this.rrweb=e,this.options=s,this.refillRate=is(null!==(t=this.options.refillRate)&&void 0!==t?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=is(null!==(i=this.options.bucketSize)&&void 0!==i?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval((()=>{this.refillBuckets()}),1e3)}}var rs=Uint8Array,ns=Uint16Array,os=Uint32Array,as=new rs([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]),ls=new rs([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]),us=new rs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cs=function(e,t){for(var i=new ns(31),s=0;s<31;++s)i[s]=t+=1<<e[s-1];var r=new os(i[30]);for(s=1;s<30;++s)for(var n=i[s];n<i[s+1];++n)r[n]=n-i[s]<<5|s;return[i,r]},ds=cs(as,2),hs=ds[0],ps=ds[1];hs[28]=258,ps[258]=28;for(var _s=cs(ls,0)[1],vs=new ns(32768),gs=0;gs<32768;++gs){var fs=(43690&gs)>>>1|(21845&gs)<<1;fs=(61680&(fs=(52428&fs)>>>2|(13107&fs)<<2))>>>4|(3855&fs)<<4,vs[gs]=((65280&fs)>>>8|(255&fs)<<8)>>>1}var ms=function(e,t,i){for(var s=e.length,r=0,n=new ns(t);r<s;++r)++n[e[r]-1];var o,a=new ns(t);for(r=0;r<t;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new ns(1<<t);var l=15-t;for(r=0;r<s;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,h=d|(1<<c)-1;d<=h;++d)o[vs[d]>>>l]=u}else for(o=new ns(s),r=0;r<s;++r)o[r]=vs[a[e[r]-1]++]>>>15-e[r];return o},ys=new rs(288);for(gs=0;gs<144;++gs)ys[gs]=8;for(gs=144;gs<256;++gs)ys[gs]=9;for(gs=256;gs<280;++gs)ys[gs]=7;for(gs=280;gs<288;++gs)ys[gs]=8;var bs=new rs(32);for(gs=0;gs<32;++gs)bs[gs]=5;var ws=ms(ys,9,0),Ss=ms(bs,5,0),Es=function(e){return(e/8>>0)+(7&e&&1)},ks=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof ns?ns:e instanceof os?os:rs)(i-t);return s.set(e.subarray(t,i)),s},xs=function(e,t,i){i<<=7&t;var s=t/8>>0;e[s]|=i,e[s+1]|=i>>>8},Is=function(e,t,i){i<<=7&t;var s=t/8>>0;e[s]|=i,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Ps=function(e,t){for(var i=[],s=0;s<e.length;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new rs(0),0];if(1==r){var o=new rs(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],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[u].f<i[d].f?u++:d++],l=i[u!=c&&i[u].f<i[d].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(s=1;s<r;++s)n[s].s>h&&(h=n[s].s);var p=new ns(h+1),_=Cs(i[c-1],p,0);if(_>t){s=0;var v=0,g=_-t,f=1<<g;for(n.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));s<r;++s){var m=n[s].s;if(!(p[m]>t))break;v+=f-(1<<_-p[m]),p[m]=t}for(v>>>=g;v>0;){var y=n[s].s;p[y]<t?v-=1<<t-p[y]++-1:++s}for(;s>=0&&v;--s){var b=n[s].s;p[b]==t&&(--p[b],++v)}_=t}return[new rs(p),_]},Cs=function(e,t,i){return-1==e.s?Math.max(Cs(e.l,t,i+1),Cs(e.r,t,i+1)):t[e.s]=i},Ts=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ns(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Rs=function(e,t){for(var i=0,s=0;s<t.length;++s)i+=e[s]*t[s];return i},Fs=function(e,t,i){var s=i.length,r=Es(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;n<s;++n)e[r+n+4]=i[n];return 8*(r+4+s)},$s=function(e,t,i,s,r,n,o,a,l,u,c){xs(t,c++,i),++r[256];for(var d=Ps(r,15),h=d[0],p=d[1],_=Ps(n,15),v=_[0],g=_[1],f=Ts(h),m=f[0],y=f[1],b=Ts(v),w=b[0],S=b[1],E=new ns(19),k=0;k<m.length;++k)E[31&m[k]]++;for(k=0;k<w.length;++k)E[31&w[k]]++;for(var x=Ps(E,7),I=x[0],P=x[1],C=19;C>4&&!I[us[C-1]];--C);var T,R,F,$,M=u+5<<3,A=Rs(r,ys)+Rs(n,bs)+o,O=Rs(r,h)+Rs(n,v)+o+14+3*C+Rs(E,I)+(2*E[16]+3*E[17]+7*E[18]);if(M<=A&&M<=O)return Fs(t,c,e.subarray(l,l+u));if(xs(t,c,1+(O<A)),c+=2,O<A){T=ms(h,p,0),R=h,F=ms(v,g,0),$=v;var L=ms(I,P,0);xs(t,c,y-257),xs(t,c+5,S-1),xs(t,c+10,C-4),c+=14;for(k=0;k<C;++k)xs(t,c+3*k,I[us[k]]);c+=3*C;for(var D=[m,w],N=0;N<2;++N){var q=D[N];for(k=0;k<q.length;++k){var B=31&q[k];xs(t,c,L[B]),c+=I[B],B>15&&(xs(t,c,q[k]>>>5&127),c+=q[k]>>>12)}}}else T=ws,R=ys,F=Ss,$=bs;for(k=0;k<a;++k)if(s[k]>255){B=s[k]>>>18&31;Is(t,c,T[B+257]),c+=R[B+257],B>7&&(xs(t,c,s[k]>>>23&31),c+=as[B]);var H=31&s[k];Is(t,c,F[H]),c+=$[H],H>3&&(Is(t,c,s[k]>>>5&8191),c+=ls[H])}else Is(t,c,T[s[k]]),c+=R[s[k]];return Is(t,c,T[256]),c+R[256]},Ms=new os([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),As=function(){for(var e=new os(256),t=0;t<256;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Os=function(){var e=4294967295;return{p:function(t){for(var i=e,s=0;s<t.length;++s)i=As[255&i^t[s]]^i>>>8;e=i},d:function(){return 4294967295^e}}},Ls=function(e,t,i,s,r){return function(e,t,i,s,r,n){var o=e.length,a=new rs(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var d=c+65535;d<o?u=Fs(l,u,e.subarray(c,d)):(l[c]=n,u=Fs(l,u,e.subarray(c,o)))}else{for(var h=Ms[t-1],p=h>>>13,_=8191&h,v=(1<<i)-1,g=new ns(32768),f=new ns(v+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},w=new os(25e3),S=new ns(288),E=new ns(32),k=0,x=0,I=(c=0,0),P=0,C=0;c<o;++c){var T=b(c),R=32767&c,F=f[T];if(g[R]=F,f[T]=R,P<=c){var $=o-c;if((k>7e3||I>24576)&&$>423){u=$s(e,l,0,w,S,E,x,I,C,c-C,u),I=k=x=0,C=c;for(var M=0;M<286;++M)S[M]=0;for(M=0;M<30;++M)E[M]=0}var A=2,O=0,L=_,D=R-F&32767;if($>2&&T==b(c-D))for(var N=Math.min(p,$)-1,q=Math.min(32767,c),B=Math.min(258,$);D<=q&&--L&&R!=F;){if(e[c+A]==e[c+A-D]){for(var H=0;H<B&&e[c+H]==e[c+H-D];++H);if(H>A){if(A=H,O=D,H>N)break;var U=Math.min(D,H-2),W=0;for(M=0;M<U;++M){var z=c-D+M+32768&32767,j=z-g[z]+32768&32767;j>W&&(W=j,F=z)}}}D+=(R=F)-(F=g[R])+32768&32767}if(O){w[I++]=268435456|ps[A]<<18|_s[O];var V=31&ps[A],G=31&_s[O];x+=as[V]+ls[G],++S[257+V],++E[G],P=c+A,++k}else w[I++]=e[c],++S[e[c]]}}u=$s(e,l,n,w,S,E,x,I,C,c-C,u)}return ks(a,0,s+Es(u)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,s,!r)},Ds=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},Ns=function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Ds(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;s<=i.length;++s)e[s+10]=i.charCodeAt(s)}},qs=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Bs(e,t){void 0===t&&(t={});var i=Os(),s=e.length;i.p(e);var r=Ls(e,t,qs(t),8),n=r.length;return Ns(r,t),Ds(r,n-8,i.d()),Ds(r,n-4,s),r}function Hs(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new rs(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;o<i;++o){if(r+5>s.length){var a=new rs(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);l<128||t?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return ks(s,0,r)}var Us=3e5,Ws=[mi.MouseMove,mi.MouseInteraction,mi.Scroll,mi.ViewportResize,mi.Input,mi.TouchMove,mi.MediaInteraction,mi.Drag],zs=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1}),js="[SessionRecording]";function Vs(e){return function(e,t){for(var i="",s=0;s<e.length;){var r=e[s++];r<128||t?i+=String.fromCharCode(r):r<224?i+=String.fromCharCode((31&r)<<6|63&e[s++]):r<240?i+=String.fromCharCode((15&r)<<12|(63&e[s++])<<6|63&e[s++]):(r=((15&r)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|r>>10,56320|1023&r))}return i}(Bs(Hs(JSON.stringify(e))),!0)}function Gs(e){return e.type===fi.Custom&&"sessionIdle"===e.data.tag}function Qs(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class Js{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrweb)||void 0===t?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(js+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return"trigger_pending"===this.triggerStatus?6e4:null!==(e=null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.full_snapshot_interval_millis)&&void 0!==e?e:Us}get isSampled(){var e=this.instance.get_property(me);return V(e)?e:null}get sessionDuration(){var e,t,i=null===(e=this.buffer)||void 0===e?void 0:e.data[(null===(t=this.buffer)||void 0===t?void 0:t.data.length)-1],{sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-s:null}get isRecordingEnabled(){var t=!!this.instance.get_property(de),i=!this.instance.config.disable_session_recording;return e&&t&&i}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(he),t=this.instance.config.enable_recording_console_log;return null!=t?t:e}get canvasRecording(){var e,t,i,s,r,n,o=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(_e),l=null!==(e=null!==(t=null==o?void 0:o.recordCanvas)&&void 0!==t?t:null==a?void 0:a.enabled)&&void 0!==e&&e,u=null!==(i=null!==(s=null==o?void 0:o.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==i?i:0,c=null!==(r=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==r?r:0;return{enabled:l,fps:is(u,0,12,"canvas recording fps"),quality:is(c,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(pe),s={recordHeaders:null===(e=this.instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(t=this.instance.config.session_recording)||void 0===t?void 0:t.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),n=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),o=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(V(o)?o:null==i?void 0:i.capturePerformance);return r||n||a?{recordHeaders:r,recordBody:n,recordPerformance:a}:void 0}get sampleRate(){var e=this.instance.get_property(ve);return j(e)?e:null}get minimumDuration(){var e=this.instance.get_property(ge);return j(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?z(this._linkedFlag)||this._linkedFlagSeen?"trigger_pending"===this.triggerStatus?"buffering":this._urlBlocked?"paused":V(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return 0===this._urlTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(ye))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return 0===this._eventTriggers.length?"trigger_disabled":(null===(e=this.instance)||void 0===e?void 0:e.get_property(be))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e="trigger_activated"===this.eventTriggerStatus||"trigger_activated"===this.urlTriggerStatus,t="trigger_pending"===this.eventTriggerStatus||"trigger_pending"===this.urlTriggerStatus;return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(ee(this,"queuedRRWebEvents",[]),ee(this,"isIdle",!1),ee(this,"_linkedFlagSeen",!1),ee(this,"_lastActivityTimestamp",Date.now()),ee(this,"_linkedFlag",null),ee(this,"_removePageViewCaptureHook",void 0),ee(this,"_onSessionIdListener",void 0),ee(this,"_persistDecideOnSessionListener",void 0),ee(this,"_samplingSessionListener",void 0),ee(this,"_urlTriggers",[]),ee(this,"_urlBlocklist",[]),ee(this,"_urlBlocked",!1),ee(this,"_eventTriggers",[]),ee(this,"_removeEventTriggerCaptureHook",void 0),ee(this,"_forceAllowLocalhostNetworkCapture",!1),ee(this,"_onBeforeUnload",(()=>{this._flushBuffer()})),ee(this,"_onOffline",(()=>{this._tryAddCustomEvent("browser offline",{})})),ee(this,"_onOnline",(()=>{this._tryAddCustomEvent("browser online",{})})),ee(this,"_onVisibilityChange",(()=>{if(null!=o&&o.visibilityState){var e="window "+o.visibilityState;this._tryAddCustomEvent(e,{})}})),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Y.error(js+" started without valid sessionManager"),new Error(js+" started without valid sessionManager. This is a bug.");var{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=i,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Y.warn(js+" session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),null==e||e.addEventListener("beforeunload",this._onBeforeUnload),null==e||e.addEventListener("offline",this._onOffline),null==e||e.addEventListener("online",this._onOnline),null==e||e.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),z(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance._addCaptureHook((t=>{try{if("$pageview"===t){var i=e?this._maskUrl(e.location.href):"";if(!i)return;this._tryAddCustomEvent("$pageview",{href:i})}}catch(e){Y.error("Could not add $pageview to rrweb session",e)}}))),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId(((e,t,i)=>{var s,r,n,o;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),null===(s=this.instance)||void 0===s||null===(r=s.persistence)||void 0===r||r.unregister(be),null===(n=this.instance)||void 0===n||null===(o=n.persistence)||void 0===o||o.unregister(ye))})))):this.stopRecording()}stopRecording(){var t,i,s,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==e||e.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(s=this._onSessionIdListener)||void 0===s||s.call(this),this._onSessionIdListener=void 0,null===(r=this._samplingSessionListener)||void 0===r||r.call(this),this._samplingSessionListener=void 0,Y.info(js+" stopped"))}makeSamplingDecision(e){var t,i=this.sessionId!==e,s=this.sampleRate;if(j(s)){var r,n=this.isSampled,o=i||!V(n);if(o)r=Math.random()<s;else r=n;o&&(r?this._reportStarted("sampled"):Y.warn(js+" Sample rate (".concat(s,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:s,isSampled:r})),null===(t=this.instance.persistence)||void 0===t||t.register({[me]:r})}else{var a;null===(a=this.instance.persistence)||void 0===a||a.register({[me]:null})}}afterDecideResponse(e){var t,i,s,r,n,o;(this._persistDecideResponse(e),this._linkedFlag=(null===(t=e.sessionRecording)||void 0===t?void 0:t.linkedFlag)||null,null!==(i=e.sessionRecording)&&void 0!==i&&i.endpoint)&&(this._endpoint=null===(o=e.sessionRecording)||void 0===o?void 0:o.endpoint);if(this._setupSampling(),!z(this._linkedFlag)&&!this._linkedFlagSeen){var a=H(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,l=H(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(((e,t)=>{var i=N(t)&&a in t,s=l?t[a]===l:i;s&&this._reportStarted("linked_flag_matched",{linkedFlag:a,linkedVariant:l}),this._linkedFlagSeen=s}))}null!==(s=e.sessionRecording)&&void 0!==s&&s.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),null!==(r=e.sessionRecording)&&void 0!==r&&r.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),null!==(n=e.sessionRecording)&&void 0!==n&&n.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){j(this.sampleRate)&&z(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId((e=>{this.makeSamplingDecision(e)})))}_persistDecideResponse(e){if(this.instance.persistence){var t,i=this.instance.persistence,s=()=>{var t,s,r,n,o,a,l,u=null===(t=e.sessionRecording)||void 0===t?void 0:t.sampleRate,c=z(u)?null:parseFloat(u),d=null===(s=e.sessionRecording)||void 0===s?void 0:s.minimumDurationMilliseconds;i.register({[de]:!!e.sessionRecording,[he]:null===(r=e.sessionRecording)||void 0===r?void 0:r.consoleLogRecordingEnabled,[pe]:Z({capturePerformance:e.capturePerformance},null===(n=e.sessionRecording)||void 0===n?void 0:n.networkPayloadCapture),[_e]:{enabled:null===(o=e.sessionRecording)||void 0===o?void 0:o.recordCanvas,fps:null===(a=e.sessionRecording)||void 0===a?void 0:a.canvasFps,quality:null===(l=e.sessionRecording)||void 0===l?void 0:l.canvasQuality},[ve]:c,[ge]:B(d)?null:d})};s(),null===(t=this._persistDecideOnSessionListener)||void 0===t||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(s)}}log(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";null===(t=this.instance.sessionRecording)||void 0===t||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!B(Object.assign)&&!B(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;if(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord)this._onScriptLoaded();else null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"recorder",(e=>{if(e)return Y.error(js+" could not load recorder",e);this._onScriptLoaded()}));Y.info(js+" starting"),"active"===this.status&&this._reportStarted(e||"recording_initialized")}}isInteractiveEvent(e){var t;return 3===e.type&&-1!==Ws.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)),!this.isIdle){var{windowId:s,sessionId:r}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=this.sessionId!==r,o=this.windowId!==s;this.windowId=s,this.sessionId=r,n||o?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Y.warn(js+" could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(zs((()=>this.rrwebRecord.addCustomEvent(e,t))))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(zs((()=>this.rrwebRecord.takeFullSnapshot())))}_onScriptLoaded(){var e,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording;for(var[s,r]of Object.entries(i||{}))s in t&&("maskInputOptions"===s?t.maskInputOptions=Z({password:!0},r):t[s]=r);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=null!==(e=this.mutationRateLimiter)&&void 0!==e?e:new ss(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{var i="Too many mutations on node '".concat(e,"'. Rate limiting. This could be due to SVG animations or something similar");Y.info(i,{node:t}),this.log(js+" "+i,"warn")}});var n=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(Z({emit:e=>{this.onRRwebEmit(e)},plugins:n},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:n.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Y.error(js+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_gatherRRWebPlugins(){var e,t,i,s,r=[],n=null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.isConsoleLogCaptureEnabled&&r.push(n());var o=null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.rrwebPlugins)||void 0===s?void 0:s.getRecordNetworkPlugin;this.networkPayloadCapture&&D(o)&&(!ut.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(o(ts(this.instance.config,this.networkPayloadCapture))):Y.info(js+" NetworkCapture not started because we are on localhost."));return r}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&N(e)){if(e.type===fi.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),"paused"!==this.status||function(e){return e.type===fi.Custom&&"recording paused"===e.data.tag}(e)){e.type===fi.FullSnapshot&&this._scheduleFullSnapshot(),e.type===fi.FullSnapshot&&"trigger_pending"===this.triggerStatus&&this.clearBuffer();var s=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(s){var r=function(e){var t=e;if(t&&N(t)&&6===t.type&&N(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var i=[],s=0;s<t.data.payload.payload.length;s++)t.data.payload.payload[s]&&t.data.payload.payload[s].length>2e3?i.push(t.data.payload.payload[s].slice(0,2e3)+"...[truncated]"):i.push(t.data.payload.payload[s]);return t.data.payload.payload=i,e}return e}(s);if(this._updateWindowAndSessionIds(r),!this.isIdle||Gs(r)){if(Gs(r)){var n=r.data.payload;if(n){var o=n.lastActivityTimestamp,a=n.threshold;r.timestamp=o+a}}var l=null===(t=this.instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(vi(e)<1024)return e;try{if(e.type===fi.FullSnapshot)return Z(Z({},e),{},{data:Vs(e.data),cv:"2024-10"});if(e.type===fi.IncrementalSnapshot&&e.data.source===mi.Mutation)return Z(Z({},e),{},{cv:"2024-10",data:Z(Z({},e.data),{},{texts:Vs(e.data.texts),attributes:Vs(e.data.attributes),removes:Vs(e.data.removes),adds:Vs(e.data.adds)})});if(e.type===fi.IncrementalSnapshot&&e.data.source===mi.StyleSheetRule)return Z(Z({},e),{},{cv:"2024-10",data:Z(Z({},e.data),{},{adds:Vs(e.data.adds),removes:Vs(e.data.removes)})})}catch(e){Y.error(js+" could not compress event - will use uncompressed event",e)}return e}(r):r,u={$snapshot_bytes:vi(l),$snapshot_data:l,$session_id:this.sessionId,$window_id:this.windowId};"disabled"!==this.status?this._captureSnapshotBuffered(u):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&e){var t=this._maskUrl(e.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this._tryRRWebMethod(e)}))}}_maskUrl(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var i,s={url:e};return null===(i=s=t.maskNetworkRequestFn(s))||void 0===i?void 0:i.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,i=j(t)&&t>=0,s=j(e)&&i&&t<e;if("buffering"===this.status||s)return this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3),this.buffer;this.buffer.data.length>0&&gi(this.buffer).forEach((e=>{this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId})}));return this.clearBuffer()}_captureSnapshotBuffered(e){var t,i=2+((null===(t=this.buffer)||void 0===t?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(void 0!==e&&e.location.href){var t=e.location.href,i="paused"===this.status,s=Qs(t,this._urlBlocklist);s&&!i?this._pauseRecording():!s&&i&&this._resumeRecording(),Qs(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,i;"trigger_pending"===this.triggerStatus&&(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({["url"===e?ye:be]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;"paused"!==this.status&&(this._urlBlocked=!0,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout((()=>{this._flushBuffer()}),100),Y.info(js+" recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;"paused"===this.status&&(this._urlBlocked=!1,null==o||null===(e=o.body)||void 0===e||null===(t=e.classList)||void 0===t||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Y.info(js+" recording resumed"))}_addEventTriggerListener(){0!==this._eventTriggers.length&&z(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",(e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(e){Y.error(js+"Could not activate event trigger",e)}})))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this.instance.persistence)||void 0===e||e.register({[me]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),Y.info(js+" "+e.replace("_"," "),t),y(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}class Ys{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}call(){var e={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Ee),group_properties:this.instance.get_property(ke),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:e,compression:this.instance.config.disable_compression?void 0:exports.Compression.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:e=>this.parseDecideResponse(e.json)})}parseDecideResponse(e){var t=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var i=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(null!=e?e:{},i),i)Y.error("Failed to fetch feature flags from PostHog.");else{if(!o||!o.body)return Y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.parseDecideResponse(e)}),500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps){var s=function(e,i){var s,r;h["__$$ph_site_app_".concat(e)]=t.instance,null===(s=h.__PosthogExtensions__)||void 0===s||null===(r=s.loadSiteApp)||void 0===r||r.call(s,t.instance,i,(t=>{if(t)return Y.error("Error while initializing PostHog app with config id ".concat(e),t)}))};for(var{id:r,url:n}of e.siteApps)s(r,n)}else e.siteApps.length>0&&Y.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}var Xs,Ks=null!=e&&e.location?_t(e.location.hash,"__posthog")||_t(location.hash,"state"):null,Zs="_postHogToolbarParams";!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Xs||(Xs={}));class er{constructor(e){this.instance=e}setToolbarState(e){h.ph_toolbar_state=e}getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:Xs.UNINITIALIZED}maybeLoadToolbar(){var t,i,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!e||!o)return!1;s=null!==(t=s)&&void 0!==t?t:e.location,n=null!==(i=n)&&void 0!==i?i:e.history;try{if(!r){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}r=null==e?void 0:e.localStorage}var a,l=Ks||_t(s.hash,"__posthog")||_t(s.hash,"state"),u=l?w((()=>JSON.parse(atob(decodeURIComponent(l)))))||w((()=>JSON.parse(decodeURIComponent(l)))):null;return u&&"ph_authorize"===u.action?((a=u).source="url",a&&Object.keys(a).length>0&&(u.desiredHash?s.hash=u.desiredHash:n?n.replaceState(n.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(r.getItem(Zs)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch(e){return!1}}_callLoadToolbar(e){(h.ph_load_toolbar||h.ph_load_editor)(e,this.instance)}loadToolbar(t){var i=!(null==o||!o.getElementById(Oe));if(!e||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=Z(Z({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(e.localStorage.setItem(Zs,JSON.stringify(Z(Z({},r),{},{source:void 0}))),this.getToolbarState()===Xs.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===Xs.UNINITIALIZED){var n,a;this.setToolbarState(Xs.LOADING),null===(n=h.__PosthogExtensions__)||void 0===n||null===(a=n.loadExternalDependency)||void 0===a||a.call(n,this.instance,"toolbar",(e=>{if(e)return Y.error("Failed to load toolbar",e),void this.setToolbarState(Xs.UNINITIALIZED);this.setToolbarState(Xs.LOADED),this._callLoadToolbar(r)})),P(e,"turbolinks:load",(()=>{this.setToolbarState(Xs.UNINITIALIZED),this.loadToolbar(r)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}class tr{constructor(e){ee(this,"isPaused",!0),ee(this,"queue",[]),ee(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),i=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];i.map((e=>{this.sendRequest(Z(Z({},e),{},{transport:"sendBeacon"}))}))}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout((()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),i=function(i){var s=t[i],r=(new Date).getTime();s.data&&L(s.data)&&f(s.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e.sendRequest(s)};for(var s in t)i(s)}}),this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return f(this.queue,(t=>{var i,s=t,r=(s?s.batchKey:null)||s.url;B(e[r])&&(e[r]=Z(Z({},s),{},{data:[]})),null===(i=e[r].data)||void 0===i||i.push(s.data)})),this.queue=[],e}}var ir=!!u||!!l,sr="text/plain",rr=(e,t)=>{var[i,s]=e.split("?"),r=Z({},t);null==s||s.split("&").forEach((e=>{var[t]=e.split("=");delete r[t]}));var n=ht(r);return n=n?(s?s+"&":"")+n:s,"".concat(i,"?").concat(n)},nr=e=>{var{data:t,compression:i}=e;if(t){if(i===exports.Compression.GZipJS){var s=Bs(Hs(JSON.stringify(t)),{mtime:0}),r=new Blob([s],{type:sr});return{contentType:sr,body:r,estimatedSize:r.size}}if(i===exports.Compression.Base64){var n=function(e){var t,i,s,r,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",c=[];if(!e)return e;e=I(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,s=n>>6&63,r=63&n,c[l++]=o.charAt(t)+o.charAt(i)+o.charAt(s)+o.charAt(r)}while(a<e.length);switch(u=c.join(""),e.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(JSON.stringify(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=JSON.stringify(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},or=[];u&&or.push({transport:"XHR",method:e=>{var t,i=new u;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!==(t=nr(e))&&void 0!==t?t:{};f(e.headers,(function(e,t){i.setRequestHeader(t,e)})),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),i.withCredentials=!0,i.onreadystatechange=()=>{if(4===i.readyState){var t,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(r)}}),l&&or.push({transport:"fetch",method:e=>{var t,i,{contentType:s,body:r,estimatedSize:n}=null!==(t=nr(e))&&void 0!==t?t:{},o=new Headers;f(e.headers,(function(e,t){o.append(t,e)})),s&&o.append("Content-Type",s);var a=e.url,u=null;if(c){var d=new c;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),e.timeout)}}l(a,{method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:r,signal:null===(i=u)||void 0===i?void 0:i.signal}).then((t=>t.text().then((i=>{var s,r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Y.error(e)}null===(s=e.callback)||void 0===s||s.call(e,r)})))).catch((t=>{var i;Y.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,text:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),null!=n&&n.sendBeacon&&or.push({transport:"sendBeacon",method:e=>{var t=rr(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!==(i=nr(e))&&void 0!==i?i:{},o="string"==typeof r?new Blob([r],{type:s}):r;n.sendBeacon(t,o)}catch(e){}}});var ar=["retriesPerformedSoFar"];class lr{constructor(t){ee(this,"isPolling",!1),ee(this,"pollIntervalMs",3e3),ee(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!B(e)&&"onLine"in e.navigator&&(this.areWeOnline=e.navigator.onLine,e.addEventListener("online",(()=>{this.areWeOnline=!0,this.flush()})),e.addEventListener("offline",(()=>{this.areWeOnline=!1})))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=te(e,ar);j(t)&&t>0&&(i.url=rr(i.url,{retry_count:t})),this.instance._send_request(Z(Z({},i),{},{callback:e=>{var s;200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.enqueue(Z({retriesPerformedSoFar:t},i)):null===(s=i.callback)||void 0===s||s.call(i,e)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=(Math.random()-.5)*(s-i);return Math.ceil(s+r)}(t),s=Date.now()+i;this.queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in ".concat(i);navigator.onLine||(r+=" (Browser is offline)"),Y.warn(r),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout((()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()}),this.pollIntervalMs)}flush(){var e=Date.now(),t=[],i=this.queue.filter((i=>i.retryAt<e||(t.push(i),!1)));if(this.queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(Z(Z({},e),{},{transport:"sendBeacon"}))}catch(e){Y.error(e)}this.queue=[]}}var ur;class cr{constructor(e,t,i,s){var r;ee(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=t,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=i||Qe,this._windowIdGenerator=s||Qe;var n=e.persistence_name||e.token,o=e.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*is(o,60,1800,"session_idle_timeout_seconds"),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var a=lt.parse(this._window_id_storage_key),l=lt.parse(this._primary_window_exists_storage_key);a&&!l?this._windowId=a:lt.remove(this._window_id_storage_key),lt.set(this._primary_window_exists_storage_key,!0)}if(null!==(r=this.config.bootstrap)&&void 0!==r&&r.sessionID)try{var u=(e=>{var 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)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,(new Date).getTime(),u)}catch(e){Y.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return B(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this.config.persistence&&!this.persistence.disabled&<.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&<.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?lt.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[fe]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[fe];return L(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){null==e||e.addEventListener("beforeunload",(()=>{this._canUseSessionStorage()&<.remove(this._primary_window_exists_storage_key)}))}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||(new Date).getTime(),[i,s,r]=this._getSessionId(),n=this._getWindowId(),o=j(r)&&r>0&&Math.abs(t-r)>864e5,a=!1,l=!s,u=!e&&Math.abs(t-i)>this.sessionTimeoutMs;l||u||o?(s=this._sessionIdGenerator(),n=this._windowIdGenerator(),Y.info("[SessionId] new session ID generated",{sessionId:s,windowId:n,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}}),r=t,a=!0):n||(n=this._windowIdGenerator(),a=!0);var c=0===i||!e||o?t:i,d=0===r?(new Date).getTime():r;return this._setWindowId(n),this._setSessionId(s,c,d),a&&this._sessionIdChangedHandlers.forEach((e=>e(s,n,a?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}:void 0))),{sessionId:s,windowId:n,sessionStartTimestamp:d,changeReason:a?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:i}}}!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(ur||(ur={}));var dr="i.posthog.com";class hr{constructor(e){ee(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(dr),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.EU:this._regionCache[this.apiHost]=ur.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return this.uiHost+t;if(this.region===ur.CUSTOM)return this.apiHost+t;var i=dr+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var pr="posthog-js";function _r(e){var{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{var o,a,l,u,c;if(!("*"===r||r.includes(n.level))||!e.__loaded)return n;n.tags||(n.tags={});var d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));n.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(n.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h=(null===(o=n.exception)||void 0===o?void 0:o.values)||[];h.map((e=>{e.stacktrace&&(e.stacktrace.type="raw")}));var p={$exception_message:(null===(a=h[0])||void 0===a?void 0:a.value)||n.message,$exception_type:null===(l=h[0])||void 0===l?void 0:l.type,$exception_personURL:d,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:(null===(u=h[0])||void 0===u?void 0:u.value)||n.message,$sentry_exception_type:null===(c=h[0])||void 0===c?void 0:c.type,$sentry_tags:n.tags,$level:n.level};return t&&i&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+n.event_id),e.exceptions.sendExceptionEvent(p),n}}class vr{constructor(e,t,i,s,r){this.name=pr,this.setupOnce=function(n){n(_r(e,{organization:t,projectId:i,prefix:s,severityAllowList:r}))}}}var gr,fr,mr;function yr(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||Qe();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(Ce,"identified")),t()},r=i.user();"then"in r&&D(r.then)?r.then((e=>s(e))):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Y.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{var s;if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Y.info("Segment integration does not have a userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Y.info("Segment integration has a userId set, identifying with PostHog"),e.identify(t.event.userId));var r=e._calculate_event_properties(i,null!==(s=t.event.properties)&&void 0!==s?s:{},new Date);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}class br{constructor(e){this._instance=e}doPageView(t){var i,s=this._previousPageViewProperties(t);return this._currentPath=null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=t,s}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,i=this._prevPageviewTimestamp,s=this._instance.scrollManager.getContext();if(!i)return{};var r={};if(s){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=s;if(!(B(n)||B(o)||B(a)||B(l)||B(u)||B(c)))n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),r={$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:n<=1?1:is(o/n,0,1),$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:n<=1?1:is(a/n,0,1),$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:l<=1?1:is(u/l,0,1),$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:l<=1?1:is(c/l,0,1)}}return t&&(r.$prev_pageview_pathname=t),i&&(r.$prev_pageview_duration=(e.getTime()-i.getTime())/1e3),r}}exports.SurveyType=void 0,(gr=exports.SurveyType||(exports.SurveyType={})).Popover="popover",gr.API="api",gr.Widget="widget",exports.SurveyQuestionType=void 0,(fr=exports.SurveyQuestionType||(exports.SurveyQuestionType={})).Open="open",fr.MultipleChoice="multiple_choice",fr.SingleChoice="single_choice",fr.Rating="rating",fr.Link="link",exports.SurveyQuestionBranchingType=void 0,(mr=exports.SurveyQuestionBranchingType||(exports.SurveyQuestionBranchingType={})).NextQuestion="next_question",mr.End="end",mr.ResponseBased="response_based",mr.SpecificQuestion="specific_question";class wr{constructor(){ee(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this.events[e]||[])i(t);for(var s of this.events["*"]||[])s(e,t)}}class Sr{constructor(e){ee(this,"_debugEventEmitter",new wr),ee(this,"checkStep",((e,t)=>this.checkStepEvent(e,t)&&this.checkStepUrl(e,t)&&this.checkStepElement(e,t))),ee(this,"checkStepEvent",((e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event))),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!B(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var t;null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,i;if(!B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null===(t=this.actionRegistry)||void 0===t||t.add(e),null===(i=e.steps)||void 0===i||i.forEach((e=>{var t;null===(t=this.actionEvents)||void 0===t||t.add((null==e?void 0:e.event)||"")}))})),null!==(i=this.instance)&&void 0!==i&&i.autocapture)){var s,r=new Set;e.forEach((e=>{var t;null===(t=e.steps)||void 0===t||t.forEach((e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)}))})),null===(s=this.instance)||void 0===s||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==t?void 0:t.event))&&this.actionRegistry&&(null===(i=this.actionRegistry)||void 0===i?void 0:i.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(null!=t&&t.url){var i,s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!Sr.matchString(s,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(t,i,s){switch(s){case"regex":return!!e&&dt(t,i);case"exact":return i===t;case"contains":var r=Sr.escapeStringRegexp(i).replace(/_/g,".").replace(/%/g,".*");return dt(t,r);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.getElementsList(e).some((e=>!(null!=t&&t.href&&!Sr.matchString(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&((null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!Sr.matchString(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!Sr.matchString(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))))return!1;if(null!=t&&t.selector){var i,s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(!s)return!1;if(!s.includes(null==t?void 0:t.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class Er{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;B(null===(t=this.instance)||void 0===t?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter((e=>{var t,i,s,r;return(null===(t=e.conditions)||void 0===t?void 0:t.actions)&&(null===(i=e.conditions)||void 0===i||null===(s=i.actions)||void 0===s||null===(r=s.values)||void 0===r?void 0:r.length)>0}));if(0!==t.length){if(null==this.actionMatcher){this.actionMatcher=new Sr(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,i,s,r,n,o,a,l,u,c;e.conditions&&null!==(t=e.conditions)&&void 0!==t&&t.actions&&null!==(i=e.conditions)&&void 0!==i&&null!==(s=i.actions)&&void 0!==s&&s.values&&(null===(r=e.conditions)||void 0===r||null===(n=r.actions)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0&&(null===(a=this.actionMatcher)||void 0===a||a.register(e.conditions.actions.values),null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u||null===(c=u.values)||void 0===c||c.forEach((t=>{if(t&&t.name){var i=this.actionToSurveys.get(t.name);i&&i.push(e.id),this.actionToSurveys.set(t.name,i||[e.id])}})))}))}}setupEventBasedSurveys(e){var t;if(0!==e.filter((e=>{var t,i,s,r;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s||null===(r=s.values)||void 0===r?void 0:r.length)>0})).length){null===(t=this.instance)||void 0===t||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,i,s;null===(t=e.conditions)||void 0===t||null===(i=t.events)||void 0===i||null===(s=i.values)||void 0===s||s.forEach((t=>{if(t&&t.name){var i=this.eventToSurveys.get(t.name);i&&i.push(e.id),this.eventToSurveys.set(t.name,i||[e.id])}}))}))}}onEvent(e,t){var i,s,r=(null===(i=this.instance)||void 0===i||null===(s=i.persistence)||void 0===s?void 0:s.props[Ie])||[];if(Er.SURVEY_SHOWN_EVENT_NAME==e&&t&&r.length>0){var n,o=null==t||null===(n=t.properties)||void 0===n?void 0:n.$survey_id;if(o){var a=r.indexOf(o);a>=0&&(r.splice(a,1),this._updateActivatedSurveys(r))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,i,s=(null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i?void 0:i.props[Ie])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;null===(t=this.instance)||void 0===t||null===(i=t.persistence)||void 0===i||i.register({[Ie]:[...new Set(e)]})}getSurveys(){var e,t,i=null===(e=this.instance)||void 0===e||null===(t=e.persistence)||void 0===t?void 0:t.props[Ie];return i||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}ee(Er,"SURVEY_SHOWN_EVENT_NAME","survey shown");var kr,xr,Ir,Pr,Cr,Tr,Rr,Fr,$r={},Mr=[],Ar=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Or=Array.isArray;function Lr(e,t){for(var i in t)e[i]=t[i];return e}function Dr(e){var t=e.parentNode;t&&t.removeChild(e)}function Nr(e,t,i,s,r){var n={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Ir:r,__i:-1,__u:0};return null==r&&null!=xr.vnode&&xr.vnode(n),n}function qr(e){return e.children}function Br(e,t){this.props=e,this.context=t}function Hr(e,t){if(null==t)return e.__?Hr(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?Hr(e):null}function Ur(e){var t,i;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(i=e.__k[t])&&null!=i.__e){e.__e=e.__c.base=i.__e;break}return Ur(e)}}function Wr(e){(!e.__d&&(e.__d=!0)&&Pr.push(e)&&!zr.__r++||Cr!==xr.debounceRendering)&&((Cr=xr.debounceRendering)||Tr)(zr)}function zr(){var e,t,i,s,r,n,o,a,l;for(Pr.sort(Rr);e=Pr.shift();)e.__d&&(t=Pr.length,s=void 0,n=(r=(i=e).__v).__e,a=[],l=[],(o=i.__P)&&((s=Lr({},r)).__v=r.__v+1,xr.vnode&&xr.vnode(s),Zr(o,s,r,i.__n,void 0!==o.ownerSVGElement,32&r.__u?[n]:null,a,null==n?Hr(r):n,!!(32&r.__u),l),s.__.__k[s.__i]=s,en(a,s,l),s.__e!=n&&Ur(s)),Pr.length>t&&Pr.sort(Rr));zr.__r=0}function jr(e,t,i,s,r,n,o,a,l,u,c){var d,h,p,_,v,g=s&&s.__k||Mr,f=t.length;for(i.__d=l,Vr(i,t,g),l=i.__d,d=0;d<f;d++)null!=(p=i.__k[d])&&"boolean"!=typeof p&&"function"!=typeof p&&(h=-1===p.__i?$r:g[p.__i]||$r,p.__i=d,Zr(e,p,h,r,n,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&sn(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==v&&null!=_&&(v=_),65536&p.__u||h.__k===p.__k?l=Gr(p,l,e):"function"==typeof p.type&&void 0!==p.__d?l=p.__d:_&&(l=_.nextSibling),p.__d=void 0,p.__u&=-196609);i.__d=l,i.__e=v}function Vr(e,t,i){var s,r,n,o,a,l=t.length,u=i.length,c=u,d=0;for(e.__k=[],s=0;s<l;s++)null!=(r=e.__k[s]=null==(r=t[s])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?Nr(null,r,null,null,r):Or(r)?Nr(qr,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?Nr(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=Qr(r,i,o=s+d,c),r.__i=a,n=null,-1!==a&&(c--,(n=i[a])&&(n.__u|=131072)),null==n||null===n.__v?(-1==a&&d--,"function"!=typeof r.type&&(r.__u|=65536)):a!==o&&(a===o+1?d++:a>o?c>l-o?d+=a-o:d--:d=a<o&&a==o-1?a-o:0,a!==s+d&&(r.__u|=65536))):(n=i[s])&&null==n.key&&n.__e&&(n.__e==e.__d&&(e.__d=Hr(n)),rn(n,n,!1),i[s]=null,c--);if(c)for(s=0;s<u;s++)null!=(n=i[s])&&0==(131072&n.__u)&&(n.__e==e.__d&&(e.__d=Hr(n)),rn(n,n))}function Gr(e,t,i){var s,r;if("function"==typeof e.type){for(s=e.__k,r=0;s&&r<s.length;r++)s[r]&&(s[r].__=e,t=Gr(s[r],t,i));return t}return e.__e!=t&&(i.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Qr(e,t,i,s){var r=e.key,n=e.type,o=i-1,a=i+1,l=t[i];if(null===l||l&&r==l.key&&n===l.type)return i;if(s>(null!=l&&0==(131072&l.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((l=t[o])&&0==(131072&l.__u)&&r==l.key&&n===l.type)return o;o--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&r==l.key&&n===l.type)return a;a++}}return-1}function Jr(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||Ar.test(t)?i:i+"px"}function Yr(e,t,i,s,r){var n;e:if("style"===t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||Jr(e.style,t,"");if(i)for(t in i)s&&i[t]===s[t]||Jr(e.style,t,i[t])}else if("o"===t[0]&&"n"===t[1])n=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+n]=i,i?s?i.u=s.u:(i.u=Date.now(),e.addEventListener(t,n?Kr:Xr,n)):e.removeEventListener(t,n?Kr:Xr,n);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,i))}}function Xr(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(xr.event?xr.event(e):e)}function Kr(e){return this.l[e.type+!0](xr.event?xr.event(e):e)}function Zr(e,t,i,s,r,n,o,a,l,u){var c,d,h,p,_,v,g,f,m,y,b,w,S,E,k,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),n=[a=t.__e=i.__e]),(c=xr.__b)&&c(t);e:if("function"==typeof x)try{if(f=t.props,m=(c=x.contextType)&&s[c.__c],y=c?m?m.props.value:c.__:s,i.__c?g=(d=t.__c=i.__c).__=d.__E:("prototype"in x&&x.prototype.render?t.__c=d=new x(f,y):(t.__c=d=new Br(f,y),d.constructor=x,d.render=nn),m&&m.sub(d),d.props=f,d.state||(d.state={}),d.context=y,d.__n=s,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=x.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Lr({},d.__s)),Lr(d.__s,x.getDerivedStateFromProps(f,d.__s))),p=d.props,_=d.state,d.__v=t,h)null==x.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==x.getDerivedStateFromProps&&f!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(f,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(f,d.__s,y)||t.__v===i.__v)){for(t.__v!==i.__v&&(d.props=f,d.state=d.__s,d.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<d._sb.length;b++)d.__h.push(d._sb[b]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(f,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,_,v)}))}if(d.context=y,d.props=f,d.__P=e,d.__e=!1,w=xr.__r,S=0,"prototype"in x&&x.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do{d.__d=!1,w&&w(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(s=Lr(Lr({},s),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(p,_)),jr(e,Or(k=null!=c&&c.type===qr&&null==c.key?c.props.children:c)?k:[k],t,i,s,r,n,o,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,l||null!=n?(t.__e=a,t.__u|=l?160:32,n[n.indexOf(a)]=null):(t.__e=i.__e,t.__k=i.__k),xr.__e(e,t,i)}else null==n&&t.__v===i.__v?(t.__k=i.__k,t.__e=i.__e):t.__e=tn(i.__e,t,i,s,r,n,o,l,u);(c=xr.diffed)&&c(t)}function en(e,t,i){t.__d=void 0;for(var s=0;s<i.length;s++)sn(i[s],i[++s],i[++s]);xr.__c&&xr.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){xr.__e(e,t.__v)}}))}function tn(e,t,i,s,r,n,o,a,l){var u,c,d,h,p,_,v,g=i.props,f=t.props,m=t.type;if("svg"===m&&(r=!0),null!=n)for(u=0;u<n.length;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName===m:3===p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null===m)return document.createTextNode(f);e=r?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,f.is&&f),n=null,a=!1}if(null===m)g===f||a&&e.data===f||(e.data=f);else{if(n=n&&kr.call(e.childNodes),g=i.props||$r,!a&&null!=n)for(g={},u=0;u<e.attributes.length;u++)g[(p=e.attributes[u]).name]=p.value;for(u in g)p=g[u],"children"==u||("dangerouslySetInnerHTML"==u?d=p:"key"===u||u in f||Yr(e,u,null,p,r));for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?_=p:"checked"==u?v=p:"key"===u||a&&"function"!=typeof p||g[u]===p||Yr(e,u,p,g[u],r);if(c)a||d&&(c.__html===d.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),jr(e,Or(h)?h:[h],t,i,s,r&&"foreignObject"!==m,n,o,n?n[0]:i.__k&&Hr(i,0),a,l),null!=n)for(u=n.length;u--;)null!=n[u]&&Dr(n[u]);a||(u="value",void 0!==_&&(_!==e[u]||"progress"===m&&!_||"option"===m&&_!==g[u])&&Yr(e,u,_,g[u],!1),u="checked",void 0!==v&&v!==e[u]&&Yr(e,u,v,g[u],!1))}return e}function sn(e,t,i){try{"function"==typeof e?e(t):e.current=t}catch(e){xr.__e(e,i)}}function rn(e,t,i){var s,r;if(xr.unmount&&xr.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||sn(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){xr.__e(e,t)}s.base=s.__P=null,e.__c=void 0}if(s=e.__k)for(r=0;r<s.length;r++)s[r]&&rn(s[r],t,i||"function"!=typeof e.type);i||null==e.__e||Dr(e.__e),e.__=e.__e=e.__d=void 0}function nn(e,t,i){return this.constructor(e,i)}kr=Mr.slice,xr={__e:function(e,t,i,s){for(var r,n,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((n=r.constructor)&&null!=n.getDerivedStateFromError&&(r.setState(n.getDerivedStateFromError(e)),o=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,s||{}),o=r.__d),o)return r.__E=r}catch(t){e=t}throw e}},Ir=0,Br.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Lr({},this.state),"function"==typeof e&&(e=e(Lr({},i),this.props)),e&&Lr(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),Wr(this))},Br.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wr(this))},Br.prototype.render=qr,Pr=[],Tr="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rr=function(e,t){return e.__v.__b-t.__v.__b},zr.__r=0,Fr=0;!function(e,t){var i={__c:t="__cC"+Fr++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&i.some((function(e){e.__e=!0,Wr(e)}))},this.sub=function(e){i.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i.splice(i.indexOf(e),1),t&&t.call(e)}}),e.children}};i.Provider.__=i.Consumer.contextType=i}({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var on="[Surveys]",an={icontains:t=>!!e&&e.location.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:t=>!!e&&-1===e.location.href.toLowerCase().indexOf(t.toLowerCase()),regex:t=>!!e&&dt(e.location.href,t),not_regex:t=>!!e&&!dt(e.location.href,t),exact:t=>(null==e?void 0:e.location.href)===t,is_not:t=>(null==e?void 0:e.location.href)!==t};class ln{constructor(e){this.instance=e,this._surveyEventReceiver=null}afterDecideResponse(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);null!=i&&i.startsWith("seenSurvey_")&&e.push(i)}return e})();e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){var e,t,i,s=null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||s||(null==this._surveyEventReceiver&&(this._surveyEventReceiver=new Er(this.instance)),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"surveys",(e=>{var t,i;if(e)return Y.error(on,"Could not load surveys script",e);this._surveyManager=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.generateSurveys)||void 0===i?void 0:i.call(t,this.instance)})))}getSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instance.config.disable_surveys)return e([]);null==this._surveyEventReceiver&&(this._surveyEventReceiver=new Er(this.instance));var i=this.instance.get_property(xe);if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{var i;if(200!==t.statusCode||!t.json)return e([]);var s,r=t.json.surveys||[],n=r.filter((e=>{var t,i,s,r,n,o,a,l,u,c,d,h;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s?void 0:s.values)&&(null===(r=e.conditions)||void 0===r||null===(n=r.events)||void 0===n||null===(o=n.values)||void 0===o?void 0:o.length)>0||(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d||null===(h=d.values)||void 0===h?void 0:h.length)>0}));n.length>0&&(null===(s=this._surveyEventReceiver)||void 0===s||s.register(n));return null===(i=this.instance.persistence)||void 0===i||i.register({[xe]:r}),e(r)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.getSurveys((t=>{var i,s=t.filter((e=>!(!e.start_date||e.end_date))).filter((e=>{var t,i,s,r;if(!e.conditions)return!0;var n=null===(t=e.conditions)||void 0===t||!t.url||an[null!==(i=null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType)&&void 0!==i?i:"icontains"](e.conditions.url),a=null===(r=e.conditions)||void 0===r||!r.selector||(null==o?void 0:o.querySelector(e.conditions.selector));return n&&a})),r=null===(i=this._surveyEventReceiver)||void 0===i?void 0:i.getSurveys(),n=s.filter((e=>{var t,i,s,n,o,a,l,u,c,d;if(!e.linked_flag_key&&!e.targeting_flag_key&&!e.internal_targeting_flag_key)return!0;var h=!e.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),p=!e.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),_=(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(s=i.events)||void 0===s?void 0:s.values)&&(null===(n=e.conditions)||void 0===n||null===(o=n.events)||void 0===o?void 0:o.values.length)>0,v=(null===(a=e.conditions)||void 0===a?void 0:a.actions)&&(null===(l=e.conditions)||void 0===l||null===(u=l.actions)||void 0===u?void 0:u.values)&&(null===(c=e.conditions)||void 0===c||null===(d=c.actions)||void 0===d?void 0:d.values.length)>0,g=!_&&!v||(null==r?void 0:r.includes(e.id)),f=this._canActivateRepeatedly(e),m=!(e.internal_targeting_flag_key&&!f)||this.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);return h&&p&&m&&g}));return e(n)}),t)}getNextSurveyStep(e,t,i){var s,r=e.questions[t],n=t+1;if(null===(s=r.branching)||void 0===s||!s.type)return t===e.questions.length-1?exports.SurveyQuestionBranchingType.End:n;if(r.branching.type===exports.SurveyQuestionBranchingType.End)return exports.SurveyQuestionBranchingType.End;if(r.branching.type===exports.SurveyQuestionBranchingType.SpecificQuestion){if(Number.isInteger(r.branching.index))return r.branching.index}else if(r.branching.type===exports.SurveyQuestionBranchingType.ResponseBased){if(r.type===exports.SurveyQuestionType.SingleChoice){var o,a,l=r.choices.indexOf("".concat(i));if(null!==(o=r.branching)&&void 0!==o&&null!==(a=o.responseValues)&&void 0!==a&&a.hasOwnProperty(l)){var u=r.branching.responseValues[l];return Number.isInteger(u)?u:u===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}else if(r.type===exports.SurveyQuestionType.Rating){var c,d;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");var h=function(e,t){if(3===t){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===t){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===t){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,r.scale);if(null!==(c=r.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(h)){var p=r.branching.responseValues[h];return Number.isInteger(p)?p:p===exports.SurveyQuestionBranchingType.End?exports.SurveyQuestionBranchingType.End:n}}return n}return Y.warn(on,"Falling back to next question index due to unexpected branching type"),n}_canActivateRepeatedly(e){var t;return z(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.canActivateRepeatedly)?(Y.warn(on,"canActivateRepeatedly is not defined, must init before calling"),!1):h.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){z(this._surveyManager)?Y.warn(on,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((t=>{var i=t.filter((t=>t.id===e))[0];this._surveyManager.canRenderSurvey(i)}))}renderSurvey(e,t){z(this._surveyManager)?Y.warn(on,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys((i=>{var s=i.filter((t=>t.id===e))[0];this._surveyManager.renderSurvey(s,null==o?void 0:o.querySelector(t))}))}}class un{constructor(e){var t,i;ee(this,"serverLimits",{}),ee(this,"lastEventRateLimited",!1),ee(this,"checkForLimiting",(e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Y.info("[RateLimiter] ".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Y.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}})),this.instance=e,this.captureEventsPerSecond=(null===(t=e.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null===(i=e.config.rate_limiting)||void 0===i?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i,s=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=(new Date).getTime(),n=null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Re))&&void 0!==e?e:{tokens:this.captureEventsBurstLimit,last:r};n.tokens+=(r-n.last)/1e3*this.captureEventsPerSecond,n.last=r,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||s||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||s||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null===(i=this.instance.persistence)||void 0===i||i.set_property(Re,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var cn=()=>Z({initialPathName:(null==a?void 0:a.pathname)||"",referringDomain:hi.referringDomain()},hi.campaignParams());class dn{constructor(e,t,i){ee(this,"_onSessionIdCallback",(e=>{var t=this._getStoredProps();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator()};this._persistence.register({[Te]:i})}})),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=i||cn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[Te]}getSessionProps(){var e,t=null===(e=this._getStoredProps())||void 0===e?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}var hn=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],pn=function(e,t){if(!e)return!1;var i=e.toLowerCase();return hn.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},_n=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&pn(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>pn(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};class vn{constructor(){this.clicks=[]}isRageClick(e,t,i){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<30&&i-s.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var gn="[Dead Clicks]",fn=()=>!0,mn=e=>{var t,i=!(null===(t=e.instance.persistence)||void 0===t||!t.get_property(ue)),s=e.instance.config.capture_dead_clicks;return V(s)?s:i};class yn{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}afterDecideResponse(e){this.instance.persistence&&this.instance.persistence.register({[ue]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript((()=>{this.start()}))}loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.initDeadClicksAutocapture&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",(t=>{t?Y.error(gn+" failed to load script",t):e()}))}start(){var e;if(o){if(!this._lazyLoadedDeadClicksAutocapture&&null!==(e=h.__PosthogExtensions__)&&void 0!==e&&e.initDeadClicksAutocapture){var t=N(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(o),Y.info("".concat(gn," starting..."))}}else Y.error(gn+" `document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Y.info("".concat(gn," stopping...")))}}class bn{constructor(t){var i;ee(this,"rageclicks",new vn),ee(this,"_enabledServerSide",!1),ee(this,"_initialized",!1),ee(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!(null===(i=this.instance.persistence)||void 0===i||!i.props[oe]),null==e||e.addEventListener("beforeunload",(()=>{this.flush()}))}get flushIntervalMilliseconds(){var e=5e3;return N(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return B(this.instance.config.capture_heatmaps)?B(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Y.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),null===(t=this.deadClicksCapture)||void 0===t||t.stop(),this.getAndClearBuffer()}}afterDecideResponse(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[oe]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){e&&o&&(P(o,"click",(t=>this._onClick(t||(null==e?void 0:e.event))),!1,!0),P(o,"mousemove",(t=>this._onMouseMove(t||(null==e?void 0:e.event))),!1,!0),this.deadClicksCapture=new yn(this.instance,fn,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,i){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(t,i,s){for(var r=t;r&&bi(r)&&!wi(r,"body");){if(r===s)return!1;if(y(i,null==e?void 0:e.getComputedStyle(r).position))return!0;r=Fi(r)}return!1}(Ti(t),["fixed","sticky"],n);return{x:t.clientX+(o?0:r),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!yi(e.target)){var s=this._getProperties(e,i);null!==(t=this.rageclicks)&&void 0!==t&&t.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(Z(Z({},s),{},{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){yi(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(e){var i=e.location.href;this.buffer=this.buffer||{},this.buffer[i]||(this.buffer[i]=[]),this.buffer[i].push(t)}}flush(){this.buffer&&!q(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class wn{constructor(e){ee(this,"_updateScrollData",(()=>{var e,t,i,s;this.context||(this.context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.context.lastScrollY=Math.ceil(n),this.context.maxScrollY=Math.max(n,null!==(e=this.context.maxScrollY)&&void 0!==e?e:0),this.context.maxScrollHeight=Math.max(o,null!==(t=this.context.maxScrollHeight)&&void 0!==t?t:0),this.context.lastContentY=a,this.context.maxContentY=Math.max(a,null!==(i=this.context.maxContentY)&&void 0!==i?i:0),this.context.maxContentHeight=Math.max(l,null!==(s=this.context.maxContentHeight)&&void 0!==s?s:0)})),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){null==e||e.addEventListener("scroll",this._updateScrollData,!0),null==e||e.addEventListener("scrollend",this._updateScrollData,!0),null==e||e.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return null==e?void 0:e.document.documentElement;var t=L(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var i of t){var s=null==e?void 0:e.document.querySelector(i);if(s)return s}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}}function Sn(e,t){return t.length>e?t.slice(0,e)+"...":t}function En(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!bi(t));return t}function kn(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Ri.indexOf(r)>-1&&!i&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?n.$el_text=Sn(1024,Ui(e)):n.$el_text=Sn(1024,Ci(e)));var o=Ii(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),f(e.attributes,(function(i){var r;if((!Ai(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==s||!s.includes(i.name))&&!t&&Hi(i.value)&&(r=i.name,!H(r)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7)))){var o=i.value;"class"===i.name&&(o=ki(o).join(" ")),n["attr__"+i.name]=Sn(1024,o)}}));for(var a=1,l=1,u=e;u=En(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function xn(t,i){for(var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i,c=[t],d=t;d.parentNode&&!wi(d,"body");)Ei(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,p=[],_={},v=!1,g=!1;if(f(c,(e=>{var t=Mi(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Hi(v)&&v),y(Ii(e),"ph-no-capture")&&(g=!0),p.push(kn(e,o,a,l));var i=function(e){if(!Mi(e))return{};var t={};return f(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&Hi(s)&&(t[i]=s)}})),t}(e);m(_,i)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?p[0].$el_text=Ui(t):p[0].$el_text=Ci(t)),v){var b,w;p[0].attr__href=v;var S=null===(b=ct(v))||void 0===b?void 0:b.host,E=null==e||null===(w=e.location)||void 0===w?void 0:w.host;S&&E&&S!==E&&(h=v)}return{props:m({$event_type:n.type,$ce_version:1},u?{$elements_chain:zi(p)}:{$elements:p},null!==(s=p[0])&&void 0!==s&&s.$el_text?{$el_text:null===(r=p[0])||void 0===r?void 0:r.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},_)}}class In{constructor(e){ee(this,"_initialized",!1),ee(this,"_isDisabledServerSide",null),ee(this,"rageclicks",new vn),ee(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,i=N(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null===(e=i.url_allowlist)||void 0===e?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null===(t=i.url_ignorelist)||void 0===t?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(e&&o){var t=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){Y.error("Failed to capture event",e)}},i=t=>{t=t||(null==e?void 0:e.event),this._captureEvent(t,R)};P(o,"submit",t,!1,!0),P(o,"change",t,!1,!0),P(o,"click",t,!1,!0),this.config.capture_copied_text&&(P(o,"copy",i,!1,!0),P(o,"cut",i,!1,!0))}}else Y.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}afterDecideResponse(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ne]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach((t=>{var s=null==o?void 0:o.querySelectorAll(t);null==s||s.forEach((s=>{e===s&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ne],s=this._isDisabledServerSide;if(W(s)&&!V(i)&&!this.instance.config.advanced_disable_decide)return!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!r}_captureEvent(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=Ti(t);if(Si(r)&&(r=r.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent)this.instance.config.rageclick&&null!==(s=this.rageclicks)&&void 0!==s&&s.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this._captureEvent(t,"$rageclick");var n=i===R;if(r&&$i(r,t,this.config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=xn(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),i===R){var u,c=Pi(null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString()),d=t.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return D(null==o?void 0:o.querySelectorAll)}}class Pn{constructor(e){ee(this,"_restoreXHRPatch",void 0),ee(this,"_restoreFetchPatch",void 0),ee(this,"_startCapturing",(()=>{var e,t,i,s;B(this._restoreXHRPatch)&&(null===(e=h.__PosthogExtensions__)||void 0===e||null===(t=e.tracingHeadersPatchFns)||void 0===t||t._patchXHR(this.instance.sessionManager));B(this._restoreFetchPatch)&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.tracingHeadersPatchFns)||void 0===s||s._patchFetch(this.instance.sessionManager))})),this.instance=e}_loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.tracingHeadersPatchFns&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"tracing-headers",(t=>{if(t)return Y.error("[TRACING-HEADERS] failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Cn;!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Cn||(Cn={}));class Tn{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Cn.DENIED:this.storedConsent}isOptedOut(){return this.consent===Cn.DENIED||this.consent===Cn.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return"1"===e?Cn.GRANTED:"0"===e?Cn.DENIED:Cn.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage="localStorage"===e?it:et;var t="localStorage"===e?et:it;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut("1"===t.get(this.storageKey)),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!C([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,h.doNotTrack],(e=>y([!0,1,"1","yes"],e)))}}var Rn="[Exception Autocapture]";class Fn{constructor(t){var i;ee(this,"originalOnUnhandledRejectionHandler",void 0),ee(this,"startCapturing",(()=>{var t,i,s,r;if(e&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.errorWrappingFunctions)||void 0===i?void 0:i.wrapOnError,o=null===(s=h.__PosthogExtensions__)||void 0===s||null===(r=s.errorWrappingFunctions)||void 0===r?void 0:r.wrapUnhandledRejection;if(n&&o)try{this.unwrapOnError=n(this.captureException.bind(this)),this.unwrapUnhandledRejection=o(this.captureException.bind(this))}catch(e){Y.error(Rn+" failed to start",e),this.stopCapturing()}else Y.error(Rn+" failed to load error wrapping functions - cannot start")}})),this.instance=t,this.remoteEnabled=!(null===(i=this.instance.persistence)||void 0===i||!i.props[ae]),this.startIfEnabled()}get isEnabled(){var e;return null!==(e=this.remoteEnabled)&&void 0!==e&&e}get isCapturing(){var t;return!(null==e||null===(t=e.onerror)||void 0===t||!t.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(Y.info(Rn+" enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,i;this.hasHandlers&&e(),null===(t=h.__PosthogExtensions__)||void 0===t||null===(i=t.loadExternalDependency)||void 0===i||i.call(t,this.instance,"exception-autocapture",(t=>{if(t)return Y.error(Rn+" failed to load script",t);e()}))}stopCapturing(){var e,t;null===(e=this.unwrapOnError)||void 0===e||e.call(this),null===(t=this.unwrapUnhandledRejection)||void 0===t||t.call(this)}afterDecideResponse(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[ae]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}var $n=9e5,Mn="[Web Vitals]";class An{constructor(e){var t;ee(this,"_enabledServerSide",!1),ee(this,"_initialized",!1),ee(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),ee(this,"_flushToCapture",(()=>{clearTimeout(this._delayedFlushTimer),0!==this.buffer.metrics.length&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce(((e,t)=>Z(Z({},e),{},{["$web_vitals_".concat(t.name,"_event")]:Z({},t),["$web_vitals_".concat(t.name,"_value")]:t.value})),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})})),ee(this,"_addToBuffer",(e=>{var t,i=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);if(B(i))Y.error(Mn+"Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();if(!B(s))if(z(null==e?void 0:e.name)||z(null==e?void 0:e.value))Y.error(Mn+"Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)Y.error(Mn+"Ignoring metric with value >= "+this._maxAllowedValue,e);else this.buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),B(this.buffer.url)&&(this.buffer.url=s),this.buffer.firstMetricTimestamp=B(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(Z(Z({},e),{},{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}})),ee(this,"_startCapturing",(()=>{var e,t,i,s,r=h.__PosthogExtensions__;B(r)||B(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):Y.error(Mn+"web vitals callbacks not loaded - not starting")})),this.instance=e,this._enabledServerSide=!(null===(t=this.instance.persistence)||void 0===t||!t.props[le]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=N(this.instance.config.capture_performance)?null===(e=this.instance.config.capture_performance)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return B(i)?(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[ce])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=N(this.instance.config.capture_performance)&&j(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:$n;return 0<e&&e<=6e4?$n:e}get isEnabled(){var e=N(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return V(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Y.info(Mn+" enabled, starting..."),this.loadScript(this._startCapturing))}afterDecideResponse(e){var t=N(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=N(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[le]:t}),this.instance.persistence.register({[ce]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,s;null!==(t=h.__PosthogExtensions__)&&void 0!==t&&t.postHogWebVitalsCallbacks&&e(),null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"web-vitals",(t=>{t?Y.error(Mn+" failed to load script",t):e()}))}_currentURL(){var t=e?e.location.href:void 0;return t||Y.error(Mn+"Could not determine current URL"),t}}var On={icontains:(t,i)=>!!e&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!e&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!e&&dt(i.href,t),not_regex:(t,i)=>!!e&&!dt(i.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Ln{constructor(e){var t=this;ee(this,"getWebExperimentsAndEvaluateDisplayLogic",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.getWebExperiments((e=>{Ln.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key&&t._featureFlags&&t._featureFlags[e.feature_flag_key]){var i;if(t._flagToExperiments)Ln.logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=t._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e);var s=t._featureFlags[e.feature_flag_key];s&&e.variants[s]&&t.applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];Ln.matchesTestVariant(n)&&t.applyTransforms(e.name,r,n.transforms)}}))}),e)})),this.instance=e;this.instance.onFeatureFlags&&this.instance.onFeatureFlags((e=>{this.applyFeatureFlagChanges(e)})),this._flagToExperiments=new Map}applyFeatureFlagChanges(e){z(this._flagToExperiments)||this.instance.config.disable_web_experiments||(Ln.logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!==(t=this._flagToExperiments)&&void 0!==t&&t.has(e)){var i,s=this.instance.getFeatureFlag(e),r=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.applyTransforms(r.name,s,r.variants[s].transforms)}})))}afterDecideResponse(e){this._is_bot()?Ln.logInfo("Refusing to render web experiment since the viewer is a likely bot"):(this._featureFlags=e.featureFlags,this.loadIfEnabled(),this.previewWebExperiment())}previewWebExperiment(){var e=Ln.getWindowLocation();if(null!=e&&e.search){var t=pt(null==e?void 0:e.search,"__experiment_id"),i=pt(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Ln.logInfo("previewing web experiments ".concat(t," && ").concat(i)),this.getWebExperiments((e=>{this.showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.instance.config.disable_web_experiments&&!i)return e([]);var 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=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}showPreviewWebExperiment(e,t,i){var s=i.filter((t=>t.id===e));s&&s.length>0&&(Ln.logInfo("Previewing web experiment [".concat(s[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(s[0].name,t,s[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!z(e.conditions)&&(Ln.matchUrlConditions(e)&&Ln.matchUTMConditions(e))}static matchUrlConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.url))return!0;var i,s,r,n=Ln.getWindowLocation();return!!n&&(null===(i=e.conditions)||void 0===i||!i.url||On[null!==(s=null===(r=e.conditions)||void 0===r?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==e?void 0:e.location}static matchUTMConditions(e){var t;if(z(e.conditions)||z(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;var i=hi.campaignParams();if(i.utm_source){var s,r,n,o,a,l,u,c,d,h,p,_,v,g,f,m,y=null===(s=e.conditions)||void 0===s||null===(r=s.utm)||void 0===r||!r.utm_campaign||(null===(n=e.conditions)||void 0===n||null===(o=n.utm)||void 0===o?void 0:o.utm_campaign)==i.utm_campaign,b=null===(a=e.conditions)||void 0===a||null===(l=a.utm)||void 0===l||!l.utm_source||(null===(u=e.conditions)||void 0===u||null===(c=u.utm)||void 0===c?void 0:c.utm_source)==i.utm_source,w=null===(d=e.conditions)||void 0===d||null===(h=d.utm)||void 0===h||!h.utm_medium||(null===(p=e.conditions)||void 0===p||null===(_=p.utm)||void 0===_?void 0:_.utm_medium)==i.utm_medium,S=null===(v=e.conditions)||void 0===v||null===(g=v.utm)||void 0===g||!g.utm_term||(null===(f=e.conditions)||void 0===f||null===(m=f.utm)||void 0===m?void 0:m.utm_term)==i.utm_term;return y&&w&&S&&b}return!1}static logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];Y.info("[WebExperiments] ".concat(e),i)}applyTransforms(e,t,i,s){var r;this._is_bot()?Ln.logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var r;Ln.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),i);var n,o=0,a=null===(r=document)||void 0===r?void 0:r.querySelectorAll(i.selector);if(null==a||a.forEach((e=>{var t=e;o+=1,i.attributes&&i.attributes.forEach((e=>{switch(e.name){case"text":t.innerText=e.value;break;case"html":t.innerHTML=e.value;break;case"cssClass":t.className=e.value;break;default:t.setAttribute(e.name,e.value)}})),i.text&&(t.innerText=i.text),i.html&&(t.parentElement?t.parentElement.innerHTML=i.html:t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})),this.instance&&this.instance.capture)this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:s,$web_experiment_document_url:null===(n=Ln.getWindowLocation())||void 0===n?void 0:n.href,$web_experiment_elements_modified:o})}})):(Ln.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:s,$web_experiment_variant:t,$web_experiment_document_url:null===(r=Ln.getWindowLocation())||void 0===r?void 0:r.href,$web_experiment_elements_modified:0}))}_is_bot(){return n&&this.instance?_n(n,this.instance.config.custom_blocked_useragents):void 0}}class Dn{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Nn={},qn=()=>{},Bn="posthog",Hn=!ir&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),Un=()=>{var t,i,s;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(i=null==o?void 0:o.location,s=null==i?void 0:i.hostname,!!H(s)&&"herokuapp.com"!==s.split(".").slice(-2).join(".")),persistence:"localStorage+cookie",persistence_name:"",loaded:qn,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:a&&H(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null===(t=e.location)||void 0===t?void 0:t.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Y.error(t)},get_device_id:e=>e,_onCapture:qn,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},Wn=e=>{var t={};B(e.process_person)||(t.person_profiles=e.process_person),B(e.xhr_headers)||(t.request_headers=e.xhr_headers),B(e.cookie_name)||(t.persistence_name=e.cookie_name),B(e.disable_cookie)||(t.disable_persistence=e.disable_cookie);var i=m({},t,e);return L(e.property_blacklist)&&(B(e.property_denylist)?i.property_denylist=e.property_blacklist:L(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Y.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class zn{constructor(){ee(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class jn{constructor(){ee(this,"webPerformance",new zn),ee(this,"version",p.LIB_VERSION),ee(this,"_internalEventEmitter",new wr),this.config=Un(),this.decideEndpointWasHit=!1,this.SentryIntegration=vr,this.sentryIntegration=e=>function(e,t){var i=_r(e,t);return{name:pr,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new He(this),this.toolbar=new er(this),this.scrollManager=new wn(this),this.pageViewManager=new br(this),this.surveys=new ln(this),this.experiments=new Ln(this),this.exceptions=new Dn(this),this.rateLimiter=new un(this),this.requestRouter=new hr(this),this.consent=new Tn(this),this.people={set:(e,t,i)=>{var s=H(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=H(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Y.info('send "'.concat(null==e?void 0:e.event,'"'),e)))}init(e,t,i){if(i&&i!==Bn){var s,r=null!==(s=Nn[i])&&void 0!==s?s:new jn;return r._init(e,t,i),Nn[i]=r,Nn[Bn][i]=r,r}return this._init(e,t,i)}_init(t){var i,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(B(t)||U(t))return Y.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return Y.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],r.person_profiles&&(this._initialPersonProfilesConfig=r.person_profiles),this.set_config(m({},Un(),Wn(r),{name:n,token:t})),this.config.on_xhr_error&&Y.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:exports.Compression.GZipJS,this.persistence=new _i(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _i(Z(Z({},this.config),{},{persistence:"sessionStorage"}));var o=Z({},this.persistence.props),a=Z({},this.sessionPersistence.props);if(this._requestQueue=new tr((e=>this._send_retriable_request(e))),this._retryQueue=new lr(this),this.__request_queue=[],this.sessionManager=new cr(this.config,this.persistence),this.sessionPropsManager=new dn(this.sessionManager,this.persistence),new Pn(this).startIfEnabledOrStop(),this.sessionRecording=new Js(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new In(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new bn(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new An(this),this.exceptionObserver=new Fn(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new yn(this,mn),this.deadClicksAutocapture.startIfEnabled(),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&Y.info("Starting in debug mode",{this:this,config:r,thisC:Z({},this.config),p:o,s:a}),this._sync_opt_out_with_persistence(),void 0!==(null===(i=r.bootstrap)||void 0===i?void 0:i.distinctID)){var l,u,c=this.config.get_device_id(Qe()),d=null!==(l=r.bootstrap)&&void 0!==l&&l.isIdentifiedID?c:r.bootstrap.distinctID;this.persistence.set_property(Ce,null!==(u=r.bootstrap)&&void 0!==u&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:d})}if(this._hasBootstrappedFeatureFlags()){var h,_,v=Object.keys((null===(h=r.bootstrap)||void 0===h?void 0:h.featureFlags)||{}).filter((e=>{var t,i;return!(null===(t=r.bootstrap)||void 0===t||null===(i=t.featureFlags)||void 0===i||!i[e])})).reduce(((e,t)=>{var i,s;return e[t]=(null===(i=r.bootstrap)||void 0===i||null===(s=i.featureFlags)||void 0===s?void 0:s[t])||!1,e}),{}),g=Object.keys((null===(_=r.bootstrap)||void 0===_?void 0:_.featureFlagPayloads)||{}).filter((e=>v[e])).reduce(((e,t)=>{var i,s,n,o;null!==(i=r.bootstrap)&&void 0!==i&&null!==(s=i.featureFlagPayloads)&&void 0!==s&&s[t]&&(e[t]=null===(n=r.bootstrap)||void 0===n||null===(o=n.featureFlagPayloads)||void 0===o?void 0:o[t]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:g})}if(!this.get_distinct_id()){var f=this.config.get_device_id(Qe());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(Ce,"anonymous")}return null==e||null===(s=e.addEventListener)||void 0===s||s.call(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),r.segment?yr(this,(()=>this._loaded())):this._loaded(),D(this.config._onCapture)&&this.config._onCapture!==qn&&(Y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_afterDecideResponse(e){var t,i,s,r,n,o,a,l,u;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=y(e.supportedCompression,exports.Compression.GZipJS)?exports.Compression.GZipJS:y(e.supportedCompression,exports.Compression.Base64)?exports.Compression.Base64:void 0),null!==(t=e.analytics)&&void 0!==t&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),null===(i=this.sessionRecording)||void 0===i||i.afterDecideResponse(e),null===(s=this.autocapture)||void 0===s||s.afterDecideResponse(e),null===(r=this.heatmaps)||void 0===r||r.afterDecideResponse(e),null===(n=this.experiments)||void 0===n||n.afterDecideResponse(e),null===(o=this.surveys)||void 0===o||o.afterDecideResponse(e),null===(a=this.webVitalsAutocapture)||void 0===a||a.afterDecideResponse(e),null===(l=this.exceptionObserver)||void 0===l||l.afterDecideResponse(e),null===(u=this.deadClicksAutocapture)||void 0===u||u.afterDecideResponse(e)}_loaded(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){Y.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this._captureInitialPageview()}),1),e||(new Ys(this).call(),this.featureFlags.resetRequestQueue())}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||g(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),null===(e=this._requestQueue)||void 0===e||e.unload(),null===(t=this._retryQueue)||void 0===t||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Hn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=rr(e.url,{ip:this.config.ip?1:0}),e.headers=Z({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,(e=>{var t,i,s,r=Z({},e);r.timeout=r.timeout||6e4,r.url=rr(r.url,{_:(new Date).getTime().toString(),ver:p.LIB_VERSION,compression:r.compression});var n=null!==(t=r.transport)&&void 0!==t?t:"XHR",o=null!==(i=null===(s=C(or,(e=>e.transport===n)))||void 0===s?void 0:s.method)&&void 0!==i?i:or[0].method;if(!o)throw new Error("No available transport method");o(r)})(Z(Z({},e),{},{callback:t=>{var i,s,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null===(s=(r=this.config).on_request_error)||void 0===s||s.call(r,t));null===(i=e.callback)||void 0===i||i.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],r=[];g(e,(e=>{e&&(t=e[0],L(t)?r.push(e):D(e)?e.call(this):L(e)&&"alias"===t?i.push(e):L(e)&&-1!==t.indexOf("capture")&&D(this[t])?r.push(e):s.push(e))}));var n=function(e,t){g(e,(function(e){if(L(e[0])){var i=t;f(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};n(i,this),n(s,this),n(r,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null===(e=this.config.bootstrap)||void 0===e?void 0:e.featureFlags)&&Object.keys(null===(t=this.config.bootstrap)||void 0===t?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!B(e)&&H(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var r=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==r||!r.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var n=new Date,o=(null==i?void 0:i.timestamp)||n,a={uuid:Qe(),event:e,properties:this._calculate_event_properties(e,t||{},o)};r&&(a.properties.$lib_rate_limit_remaining_tokens=r.remainingTokens),(null==i?void 0:i.$set)&&(a.$set=null==i?void 0:i.$set);var l=this._calculate_set_once_properties(null==i?void 0:i.$set_once);l&&(a.$set_once=l),(a=x(a,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,B(null==i?void 0:i.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=n);var u=Z(Z({},a.properties.$set),a.$set);if(q(u)||this.setPersonPropertiesForFlags(u),!z(this.config.before_send)){var c=this._runBeforeSend(a);if(!c)return;a=c}this._internalEventEmitter.emit("eventCaptured",a);var d={method:"POST",url:null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this._send_retriable_request(d):this._requestQueue.enqueue(d),a}Y.critical("This capture call is ignored due to client rate limiting.")}}else Y.error("No event name provided to posthog.capture")}else Y.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}_calculate_event_properties(e,t,i){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s=this.persistence.remove_event_timer(e),r=Z({},t);if(r.token=this.config.token,"$snapshot"===e){var n=Z(Z({},this.persistence.properties()),this.sessionPersistence.properties());return r.distinct_id=n.distinct_id,(!H(r.distinct_id)&&!j(r.distinct_id)||U(r.distinct_id))&&Y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),r}var a=hi.properties();if(this.sessionManager){var{sessionId:l,windowId:u}=this.sessionManager.checkAndGetSessionAndWindowId();r.$session_id=l,r.$window_id=u}if(this.requestRouter.region===ur.CUSTOM&&(r.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&("$pageview"===e||"$pageleave"===e||"$autocapture"===e)){var c=this.sessionPropsManager.getSessionProps();r=m(r,c)}if(!this.config.disable_scroll_properties){var h={};"$pageview"===e?h=this.pageViewManager.doPageView(i):"$pageleave"===e&&(h=this.pageViewManager.doPageLeave(i)),r=m(r,h)}if("$pageview"===e&&o&&(r.title=o.title),!B(s)){var p=i.getTime()-s;r.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(r.$browser_type=this._is_bot()?"bot":"browser"),(r=m({},a,this.persistence.properties(),this.sessionPersistence.properties(),r)).$is_identified=this._isIdentified(),L(this.config.property_denylist)?f(this.config.property_denylist,(function(e){delete r[e]})):Y.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(r=_(r,e));var v=this._hasPersonProcessing();return r.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),r}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=m({},this.persistence.get_initial_props(),e||{}),i=this.config.sanitize_properties;return i&&(t=i(t,"$set_once")),q(t)?void 0:t}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;null===(t=this.sessionPersistence)||void 0===t||t.register(e)}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)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}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){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,i){return this.surveys.getNextSurveyStep(e,t,i)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Y.uninitializedWarning("posthog.identify");if(j(e)&&(e=e.toString(),Y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))Y.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var r=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:r},"")}e!==s&&e!==this.get_property(se)&&(this.unregister(se),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(Ce)||"anonymous");e!==s&&n?(this.persistence.set_property(Ce,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Pe))}}else Y.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,i){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Z(Z({},s),{},{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}}else Y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n;if(Y.info("reset"),!this.__loaded)return Y.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");this.consent.reset(),null===(t=this.persistence)||void 0===t||t.clear(),null===(i=this.sessionPersistence)||void 0===i||i.clear(),null===(s=this.surveys)||void 0===s||s.reset(),null===(r=this.persistence)||void 0===r||r.set_property(Ce,"anonymous"),null===(n=this.sessionManager)||void 0===n||n.resetSessionId();var a=this.config.get_device_id(Qe());this.register_once({distinct_id:a,$device_id:e?a:o},"")}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"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;var o=Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0);s+="?t=".concat(o)}return s}alias(e,t){return e===this.get_property(ie)?(Y.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(B(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(se,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,s,r,n=Z({},this.config);N(e)&&(m(this.config,Wn(e)),null===(t=this.persistence)||void 0===t||t.update_config(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new _i(Z(Z({},this.config),{},{persistence:"sessionStorage"})),it.is_supported()&&"true"===it.get("ph_debug")&&(this.config.debug=!0),this.config.debug&&(p.DEBUG=!0,Y.info("set_config",{config:e,oldConfig:n,newConfig:Z({},this.config)})),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),null===(s=this.autocapture)||void 0===s||s.startIfEnabled(),null===(r=this.heatmaps)||void 0===r||r.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=!0===e,i={sampling:t||!(null==e||!e.sampling),linked_flag:t||!(null==e||!e.linked_flag),url_trigger:t||!(null==e||!e.url_trigger),event_trigger:t||!(null==e||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,r,n,o,a;if(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling)null===(r=this.sessionRecording)||void 0===r||r.overrideSampling();if(i.linked_flag)null===(n=this.sessionRecording)||void 0===n||n.overrideLinkedFlag();if(i.url_trigger)null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url");if(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||!e.started)}captureException(e,t){var i,s=new Error("PostHog syntheticException"),r=D(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.parseErrorAsProperties)?h.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:s}):Z({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},t);this.exceptions.sendExceptionEvent(r)}loadToolbar(e){return this.toolbar.loadToolbar(e)}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,t=null!==(e=this.config.name)&&void 0!==e?e:Bn;return t!==Bn&&(t=Bn+"."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property(Ce))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property(Ce))}_hasPersonProcessing(){var e,t,i,s;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&q(this.getGroups())&&(null===(e=this.persistence)||void 0===e||null===(t=e.props)||void 0===t||!t[se])&&(null===(i=this.persistence)||void 0===i||null===(s=i.props)||void 0===s||!s[Ae]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Ae,!0),!0)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||r&&!!n;(null===(e=this.persistence)||void 0===e?void 0:e.disabled)!==o&&(null===(i=this.persistence)||void 0===i||i.set_disabled(o));(null===(t=this.sessionPersistence)||void 0===t?void 0:t.disabled)!==o&&(null===(s=this.sessionPersistence)||void 0===s||s.set_disabled(o))}opt_in_capturing(e){var t;(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),B(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return n?_n(n,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){o&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==e||e.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(z(this.config.before_send))return e;var t=L(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),z(i)){var r="Event '".concat(e.event,"' was rejected in beforeSend function");return Q(e.event)?Y.warn("".concat(r,". This can cause unexpected behavior.")):Y.info(r),null}i.properties&&!q(i.properties)||Y.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=S(e.prototype[t[i]])}(jn,["identify"]);var Vn,Gn=(Vn=Nn[Bn]=new jn,function(){function t(){t.done||(t.done=!0,Hn=!1,f(Nn,(function(e){e._dom_loaded()})))}null!=o&&o.addEventListener&&("complete"===o.readyState?t():o.addEventListener("DOMContentLoaded",t,!1)),e&&P(e,"load",t,!0)}(),Vn);exports.COPY_AUTOCAPTURE_EVENT=R,exports.PostHog=jn,exports.default=Gn,exports.knownUnsafeEditableEvent=F,exports.posthog=Gn,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
11
2
|
//# sourceMappingURL=main.js.map
|