posthog-js 1.301.1 → 1.301.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.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function e(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function t(t){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=t.apply(i,r);function a(t){e(o,s,n,a,l,"next",t)}function l(t){e(o,s,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}function r(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var s="undefined"!=typeof window?window:void 0,n="undefined"!=typeof globalThis?globalThis:s;"undefined"==typeof self&&(n.self=n),"undefined"==typeof File&&(n.File=function(){});var o=Array.prototype,a=o.forEach,l=o.indexOf,c=null==n?void 0:n.navigator,u=null==n?void 0:n.document,d=null==n?void 0:n.location,_=null==n?void 0:n.fetch,h=null!=n&&n.XMLHttpRequest&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,p=null==n?void 0:n.AbortController,g=null==c?void 0:c.userAgent,v=null!=s?s:{},f={DEBUG:!1,LIB_VERSION:"1.301.1"},m=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],y=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return m.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},b=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function w(e,t){return-1!==e.indexOf(t)}var E=function(e){return e.trim()},S=function(e){return e.replace(/^\$/,"")};var x=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,I=k.toString,C=x||function(e){return"[object Array]"===I.call(e)},F=e=>"function"==typeof e,R=e=>e===Object(e)&&!C(e),T=e=>{if(R(e)){for(var t in e)if(P.call(e,t))return!1;return!0}return!1},L=e=>void 0===e,O=e=>"[object String]"==I.call(e),M=e=>O(e)&&0===e.trim().length,A=e=>null===e,D=e=>L(e)||A(e),N=e=>"[object Number]"==I.call(e),q=e=>"[object Boolean]"===I.call(e),H=e=>e instanceof FormData,j=e=>w(b,e);function U(e){return null===e||"object"!=typeof e}function z(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function B(e){return!L(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var V=[!0,"true",1,"1","yes"],W=e=>w(V,e),G=[!1,"false",0,"0","no"];function Y(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),N(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Y(s||i,t,i,r))}class J{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Y(e.bucketSize,0,100,e._logger),this._refillRate=Y(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Y(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=t-e.lastAccess,r=Math.floor(i/this._refillInterval);if(r>0){var s=r*this._refillRate;e.tokens=Math.min(e.tokens+s,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this._buckets[r];return s?this._applyRefill(s,i):(s={tokens:this._bucketSize,lastAccess:i},this._buckets[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var K,X,Q,Z=e=>e instanceof Error;function ee(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Q&&i.length===X||(X=i.length,Q=i.reduce(((i,r)=>{K||(K={});var s=K[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,K[r]=[l,c];break}}return i}),{})),Q}}class te{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&C(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,s;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),i({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var i=this;return t((function*(){var t=e;for(var r of i.modifiers)t=yield r(t);return t}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:ee(this.stackParser)}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var s=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return i({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,r),next:e=>s(e,r+1)})}}var ie="?";function re(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?ie:i,in_app:!0};return L(r)||(n.lineno=r),L(s)||(n.colno=s),n}var se=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:ie,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},ne=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,oe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ae=/\((\S*)(?::(\d+))(?::(\d+))\)/,le=(e,t)=>{var i=ne.exec(e);if(i){var[,r,s,n]=i;return re(t,r,ie,+s,+n)}var o=oe.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ae.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=se(o[1]||ie,o[2]);return re(t,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,de=(e,t)=>{var i=ce.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ue.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||ie;return[n,s]=se(n,s),re(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},_e=/\(error: (.*)\)/,he=50;function pe(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var n=[],o=t.split("\n"),a=s;a<o.length;a++){var l=o[a];if(!(l.length>1024)){var c=_e.test(l)?l.replace(_e,"$1"):l;if(!c.match(/\S*Error: /)){for(var u of r){var d=u(c,e);if(d){n.push(d);break}}if(n.length>=he)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,he).map((e=>{return i({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||ie});var r}))}(n)}}class ge{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=O(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class ve{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class fe{constructor(){}match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i,r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var me=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ye{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(me);return r&&(t=r[1],i=r[2]),[t,i]}}var be=["fatal","error","warning","log","info","debug"];function we(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class Ee{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return B(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+we(e)}isSeverityLevel(e){return O(e)&&!M(e)&&be.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Z(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Se{match(e){return B(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+we(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class xe{match(e){return U(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class ke{match(e){return z(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return U(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(U(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Pe=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={_log:function(t){if(s&&(f.DEBUG||v.POSTHOG_DEBUG||i)&&!L(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t]?s.console[t].__rrweb_original__:s.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];r(e,...o)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("error",...t)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Pe(e+" "+t,i)};return r},Ie=Pe("[PostHog.js]"),Ce=Ie.createLogger,Fe={};function Re(e,t,i){if(C(e))if(a&&e.forEach===a)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Fe)return}function Te(e,t,i){if(!D(e)){if(C(e))return Re(e,t,i);if(H(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Fe)return}else for(var s in e)if(P.call(e,s)&&t.call(i,e[s],s)===Fe)return}}var $e=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Re(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e},Le=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Re(i,(function(t){Re(t,(function(t){e.push(t)}))})),e};function Oe(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Me=function(e){try{return e()}catch(e){return}},Ae=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Ie.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ie.critical(e)}}},De=function(e){var t={};return Te(e,(function(e,i){(O(e)&&e.length>0||N(e))&&(t[i]=e)})),t};function Ne(e,t){return i=e,r=e=>O(e)&&!A(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t,i):t:s.has(t)?void 0:(s.add(t),C(t)?(n=[],Re(t,(t=>{n.push(e(t))}))):(n={},Te(t,((t,i)=>{s.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,r,s}var qe=["herokuapp.com","vercel.app","netlify.app"];function He(e){var t=null==e?void 0:e.hostname;if(!O(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of qe)if(i===r)return!1;return!0}function je(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function Ue(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var ze="$people_distinct_id",Be="__alias",Ve="__timers",We="$autocapture_disabled_server_side",Ge="$heatmaps_enabled_server_side",Ye="$exception_capture_enabled_server_side",Je="$error_tracking_suppression_rules",Ke="$error_tracking_capture_extension_exceptions",Xe="$web_vitals_enabled_server_side",Qe="$dead_clicks_enabled_server_side",Ze="$web_vitals_allowed_metrics",et="$session_recording_remote_config",tt="$sesid",it="$session_is_sampled",rt="$enabled_feature_flags",st="$early_access_features",nt="$feature_flag_details",ot="$stored_person_properties",at="$stored_group_properties",lt="$surveys",ct="$surveys_activated",ut="$flag_call_reported",dt="$user_state",_t="$client_session_props",ht="$capture_rate_limit",pt="$initial_campaign_params",gt="$initial_referrer_info",vt="$initial_person_info",ft="$epp",mt="__POSTHOG_TOOLBAR__",yt="$posthog_cookieless",bt=[ze,Be,"__cmpns",Ve,"$session_recording_enabled_server_side",Ge,tt,rt,Je,dt,st,nt,at,ot,lt,ut,_t,ht,pt,gt,ft,vt];function wt(e){return e instanceof Element&&(e.id===mt||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Et(e){return!!e&&1===e.nodeType}function St(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function xt(e){return!!e&&3===e.nodeType}function kt(e){return!!e&&11===e.nodeType}function Pt(e){return e?E(e).split(/\s+/):[]}function It(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Ct(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 Pt(t)}function Ft(e){return D(e)?null:E(e).split(/(\s+)/).filter((e=>Kt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t="";return Ut(e)&&!zt(e)&&e.childNodes&&e.childNodes.length&&Te(e.childNodes,(function(e){var i;xt(e)&&e.textContent&&(t+=null!==(i=Ft(e.textContent))&&void 0!==i?i:"")})),E(t)}function Tt(e){return L(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var $t=["a","button","form","input","select","textarea","label"];function Lt(e,t){if(L(t))return!0;var i,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Ot(e){var t=e.parentNode;return!(!t||!Et(t))&&t}var Mt=["next","previous","prev",">","<"],At=10;var Dt=[".ph-no-rageclick",".ph-no-capture"];function Nt(e,t){if(!s||qt(e))return!1;var i,r,n;q(t)?(i=!!t&&Dt,r=void 0):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Dt,r=null==t?void 0:t.content_ignorelist);if(!1===i)return!1;var{targetElementList:o}=Ht(e,!1);return!function(e,t){if(!1===e||L(e))return!1;var i;if(!0===e)i=Mt;else{if(!C(e))return!1;if(e.length>At)return Ie.error("[PostHog] content_ignorelist array cannot exceed "+At+" items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return i.some((e=>t.includes(e)||r.includes(e)))}))}(r,o.map((e=>{var t;return{safeText:Rt(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Lt(o,i)}var qt=e=>!e||St(e,"html")||!Et(e),Ht=(e,t)=>{if(!s||qt(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!St(n,"body");)if(kt(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=Ot(n);if(!o)break;if(t||$t.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=s.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:r}};function jt(e,t,i,r,n){var o,a,l,c;if(void 0===i&&(i=void 0),!s||qt(e))return!1;if(null!=(o=i)&&o.url_allowlist&&!It(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&It(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:d,targetElementList:_}=Ht(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(L(i))return!0;var r,s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(_,i))return!1;if(!Lt(_,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var h=s.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return d?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&($t.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}function Ut(e){for(var t=e;t.parentNode&&!St(t,"body");t=t.parentNode){var i=Ct(t);if(w(i,"ph-sensitive")||w(i,"ph-no-capture"))return!1}if(w(Ct(e),"ph-include"))return!0;var r=e.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";if(O(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function zt(e){return!!(St(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||St(e,"select")||St(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Bt="(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})",Vt=new RegExp("^(?:"+Bt+")$"),Wt=new RegExp(Bt),Gt="\\d{3}-?\\d{2}-?\\d{4}",Yt=new RegExp("^("+Gt+")$"),Jt=new RegExp("("+Gt+")");function Kt(e,t){if(void 0===t&&(t=!0),D(e))return!1;if(O(e)){if(e=E(e),(t?Vt:Wt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Yt:Jt).test(e))return!1}return!0}function Xt(e){var t=Rt(e);return Kt(t=(t+" "+Qt(e)).trim())?t:""}function Qt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Te(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Rt(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Qt(e)).trim())}catch(e){Ie.error("[AutoCapture]",e)}})),t}function Zt(e){return function(e){var t=e.map((e=>{var t,r,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))s+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Oe(o).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return a[ei(t.toString())]=ei(i.toString())})),s+=":",s+=Oe(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:ti(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Oe(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function ei(e){return e.replace(/"|\\"/g,'\\"')}function ti(e){var t=e.attr__class;return t?C(t)?t:Pt(t):void 0}class ii{constructor(e){this.disabled=!1===e;var t=R(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&i-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ri="$copy_autocapture",si=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ni=e=>{var t=null==u?void 0:u.createElement("a");return L(t)?null:(t.href=e,t)},oi=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Te(e,(function(e,t){L(e)||L(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)})),s.join(t)},ai=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!C(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Ie.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},li=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var _=c[d].split("=");C(_)&&(t.includes(_[0])?u.push(_[0]+"="+i):u.push(c[d]))}var h=l;return null!=a&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},ci=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ui=Ce("[AutoCapture]");function di(e,t){return t.length>e?t.slice(0,e)+"...":t}function _i(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Et(t));return t}function hi(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};$t.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=di(1024,Xt(e)):n.$el_text=di(1024,Rt(e)));var o=Ct(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),Te(e.attributes,(function(i){var s;if((!zt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==r||!r.includes(i.name))&&!t&&Kt(i.value)&&(s=i.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=i.value;"class"===i.name&&(o=Pt(o).join(" ")),n["attr__"+i.name]=di(1024,o)}}));for(var a=1,l=1,c=e;c=_i(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function pi(e,t){for(var i,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!St(d,"body");)kt(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var _,h=[],p={},g=!1,v=!1;if(Te(u,(e=>{var t=Ut(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&Kt(g)&&g),w(Ct(e),"ph-no-capture")&&(v=!0),h.push(hi(e,o,a,l));var i=function(e){if(!Ut(e))return{};var t={};return Te(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Kt(r)&&(t[i]=r)}})),t}(e);$e(p,i)})),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?h[0].$el_text=Xt(e):h[0].$el_text=Rt(e)),g){var f,m;h[0].attr__href=g;var y=null==(f=ni(g))?void 0:f.host,b=null==s||null==(m=s.location)?void 0:m.host;y&&b&&y!==b&&(_=g)}return{props:$e({$event_type:n.type,$ce_version:1},c?{}:{$elements:h},{$elements_chain:Zt(h)},null!=(i=h[0])&&i.$el_text?{$el_text:null==(r=h[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},p)}}class gi{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new ii(e.config.rageclick),this._elementSelectors=null}get _config(){var e,t,i=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(s&&u){var e=e=>{e=e||(null==s?void 0:s.event);try{this._captureEvent(e)}catch(e){ui.error("Failed to capture event",e)}};if(Ue(u,"submit",e,{capture:!0}),Ue(u,"change",e,{capture:!0}),Ue(u,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==s?void 0:s.event),this._captureEvent(e,ri)};Ue(u,"copy",t,{capture:!0}),Ue(u,"cut",t,{capture:!0})}}}else ui.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[We]:!!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)||t.forEach((t=>{var r=null==u?void 0:u.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[We],r=this._isDisabledServerSide;if(A(r)&&!q(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=Tt(e);if(xt(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&Nt(r,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===ri;if(r&&jt(r,e,this._config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=pi(r,{e:e,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),t===ri){var c,u=Ft(null==s||null==(c=s.getSelection())?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return F(null==u?void 0:u.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return N(e)&&isFinite(e)&&Math.floor(e)===e});var vi="0123456789abcdef";class fi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fi(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+vi.charAt(this.bytes[t]>>>4)+vi.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 fi(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 mi{constructor(){this._timestamp=0,this._counter=0,this._random=new wi}generate(){var e=this.generateOrAbort();if(L(e)){this._timestamp=0;var t=this.generateOrAbort();if(L(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 fi.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 yi,bi=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};s&&!L(s.crypto)&&crypto.getRandomValues&&(bi=e=>crypto.getRandomValues(e));class wi{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._cursor>=this._buffer.length&&(bi(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var Ei=()=>Si().toString(),Si=()=>(yi||(yi=new mi)).generate(),xi="";var ki=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Pi(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=u),xi)return xi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Ei();!xi&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",xi=n)}return xi}(e);if(!i){var r=(e=>{var t=e.match(ki);return t?t[0]:""})(e);r!==i&&Ie.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var Ii={_is_supported:()=>!!u,_error:function(e){Ie.error("cookieStore error: "+e)},_get:function(e){if(u){try{for(var t=e+"=",i=u.cookie.split(";").filter((e=>e.length)),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},_parse:function(e){var t;try{t=JSON.parse(Ii._get(e))||{}}catch(e){}return t},_set:function(e,t,i,r,s){if(u)try{var n="",o="",a=Pi(u.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&Ie.warn("cookieStore warning: large cookie, len="+c.length),u.cookie=c,c}catch(e){return}},_remove:function(e,t){if(null!=u&&u.cookie)try{Ii._set(e,"",-1,t)}catch(e){return}}},Ci=null,Fi={_is_supported:function(){if(!A(Ci))return Ci;var e=!0;if(L(s))e=!1;else try{var t="__mplssupport__";Fi._set(t,"xyz"),'"xyz"'!==Fi._get(t)&&(e=!1),Fi._remove(t)}catch(t){e=!1}return e||Ie.error("localStorage unsupported; falling back to cookie store"),Ci=e,e},_error:function(e){Ie.error("localStorage error: "+e)},_get:function(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){Fi._error(e)}return null},_parse:function(e){try{return JSON.parse(Fi._get(e))||{}}catch(e){}return null},_set:function(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){Fi._error(e)}},_remove:function(e){try{null==s||s.localStorage.removeItem(e)}catch(e){Fi._error(e)}}},Ri=["distinct_id",tt,it,ft,vt],Ti=i({},Fi,{_parse:function(e){try{var t={};try{t=Ii._parse(e)||{}}catch(e){}var i=$e(t,JSON.parse(Fi._get(e)||"{}"));return Fi._set(e,i),i}catch(e){}return null},_set:function(e,t,i,r,s,n){try{Fi._set(e,t,void 0,void 0,n);var o={};Ri.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&Ii._set(e,o,i,r,s,n)}catch(e){Fi._error(e)}},_remove:function(e,t){try{null==s||s.localStorage.removeItem(e),Ii._remove(e,t)}catch(e){Fi._error(e)}}}),$i={},Li={_is_supported:function(){return!0},_error:function(e){Ie.error("memoryStorage error: "+e)},_get:function(e){return $i[e]||null},_parse:function(e){return $i[e]||null},_set:function(e,t){$i[e]=t},_remove:function(e){delete $i[e]}},Oi=null,Mi={_is_supported:function(){if(!A(Oi))return Oi;if(Oi=!0,L(s))Oi=!1;else try{var e="__support__";Mi._set(e,"xyz"),'"xyz"'!==Mi._get(e)&&(Oi=!1),Mi._remove(e)}catch(e){Oi=!1}return Oi},_error:function(e){Ie.error("sessionStorage error: ",e)},_get:function(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){Mi._error(e)}return null},_parse:function(e){try{return JSON.parse(Mi._get(e))||null}catch(e){}return null},_set:function(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Mi._error(e)}},_remove:function(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){Mi._error(e)}}},Ai=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Di{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?Ai.DENIED:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||(this.consent===Ai.DENIED||this.consent===Ai.PENDING&&(this._config.opt_out_capturing_by_default||"on_reject"===this._config.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ai.DENIED}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,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return W(e)?Ai.GRANTED:w(G,e)?Ai.DENIED:Ai.PENDING}get _storage(){if(!this._persistentStore){var e=this._config.opt_out_capturing_persistence_type;this._persistentStore="localStorage"===e?Fi:Ii;var t="localStorage"===e?Ii:Fi;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(W(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&!!je([null==c?void 0:c.doNotTrack,null==c?void 0:c.msDoNotTrack,v.doNotTrack],(e=>W(e)))}}var Ni=Ce("[Dead Clicks]"),qi=()=>!0,Hi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Qe)),r=e.instance.config.capture_dead_clicks;return q(r)?r:!!R(r)||i};class ji{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Qe]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this._loadScript((()=>{this._start()}))}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Ni.error("failed to load script",t):e()}))}_start(){var e;if(u){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(u),Ni.info("starting...")}}else Ni.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Ni.info("stopping..."))}}var Ui=Ce("[ExceptionAutocapture]");class zi{constructor(e){var t,i,r;this._startCapturing=()=>{var e;if(s&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=r(this.captureException.bind(this)))}catch(e){Ui.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Ye]),this._config=this._requiredConfig(),this._rateLimiter=new J({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,_logger:Ui}),this.startIfEnabled()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(e)?t=i({},t,e):(L(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Ui.info("enabled"),this._loadScript(this._startCapturing))}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Ui.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this._remoteEnabled=!!t||!1,this._config=this._requiredConfig(),this._instance.persistence&&this._instance.persistence.register({[Ye]:this._remoteEnabled}),this.startIfEnabled()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Ui.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Bi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return F(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}class Vi{constructor(e){var t;this._instance=e,this._lastPathname=(null==s||null==(t=s.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ie.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,Ie.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(s&&s.history){var i=this;null!=(e=s.history.pushState)&&e.__posthog_wrapped__||Bi(s.history,"pushState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("pushState")})),null!=(t=s.history.replaceState)&&t.__posthog_wrapped__||Bi(s.history,"replaceState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._lastPathname=i}catch(t){Ie.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Ue(s,"popstate",e),this._popstateListener=()=>{s&&s.removeEventListener("popstate",e)}}}}var Wi=Ce("[SegmentIntegration]");function Gi(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Ei();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(dt,"identified")),t()},s=i.user();"then"in s&&F(s.then)?s.then((e=>r(e))):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Wi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Wi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Wi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);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()}))}))}var Yi="posthog-js";function Ji(e,t){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,c,u,d,_;if(!("*"===o||o.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(l=t.exception)?void 0:l.values)||[],g=p.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),v={$exception_message:(null==(c=p[0])?void 0:c.value)||t.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=p[0])?void 0:_.type,$sentry_tags:t.tags};return r&&s&&(v.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+t.event_id),a&&e.exceptions.sendExceptionEvent(v),t}}class Ki{constructor(e,t,i,r,s,n){this.name=Yi,this.setupOnce=function(o){o(Ji(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Xi=null!=s&&s.location?ci(s.location.hash,"__posthog")||ci(location.hash,"state"):null,Qi="_postHogToolbarParams",Zi=Ce("[Toolbar]"),er=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(er||{});class tr{constructor(e){this.instance=e}_setToolbarState(e){v.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=v.ph_toolbar_state)&&void 0!==e?e:er.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!s||!u)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=Xi||ci(e.hash,"__posthog")||ci(e.hash,"state"),o=n?Me((()=>JSON.parse(atob(decodeURIComponent(n)))))||Me((()=>JSON.parse(decodeURIComponent(n)))):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(Qi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}_callLoadToolbar(e){var t=v.ph_load_toolbar||v.ph_load_editor;!D(t)&&F(t)?t(e,this.instance):Zi.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==u||!u.getElementById(mt));if(!s||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(s.localStorage.setItem(Qi,JSON.stringify(i({},n,{source:void 0}))),this._getToolbarState()===er.LOADED)this._callLoadToolbar(n);else if(this._getToolbarState()===er.UNINITIALIZED){var o;this._setToolbarState(er.LOADING),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return Zi.error("[Toolbar] Failed to load",e),void this._setToolbarState(er.UNINITIALIZED);this._setToolbarState(er.LOADED),this._callLoadToolbar(n)})),Ue(s,"turbolinks:load",(()=>{this._setToolbarState(er.UNINITIALIZED),this.loadToolbar(n)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var ir=Ce("[TracingHeaders]");class rr{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t;L(this._restoreXHRPatch)&&(null==(e=v.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));L(this._restoreFetchPatch)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return ir.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var sr="Mobile",nr="iOS",or="Android",ar="Tablet",lr=or+" "+ar,cr="iPad",ur="Apple",dr=ur+" Watch",_r="Safari",hr="BlackBerry",pr="Samsung",gr=pr+"Browser",vr=pr+" Internet",fr="Chrome",mr=fr+" OS",yr=fr+" "+nr,br="Internet Explorer",wr=br+" "+sr,Er="Opera",Sr=Er+" Mini",xr="Edge",kr="Microsoft "+xr,Pr="Firefox",Ir=Pr+" "+nr,Cr="Nintendo",Fr="PlayStation",Rr="Xbox",Tr=or+" "+sr,$r=sr+" "+_r,Lr="Windows",Or=Lr+" Phone",Mr="Nokia",Ar="Ouya",Dr="Generic",Nr=Dr+" "+sr.toLowerCase(),qr=Dr+" "+ar.toLowerCase(),Hr="Konqueror",jr="(\\d+(\\.\\d+)?)",Ur=new RegExp("Version/"+jr),zr=new RegExp(Rr,"i"),Br=new RegExp(Fr+" \\w+","i"),Vr=new RegExp(Cr+" \\w+","i"),Wr=new RegExp(hr+"|PlayBook|BB10","i"),Gr={"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 Yr=(e,t)=>t&&w(t,ur)||function(e){return w(e,_r)&&!w(e,fr)&&!w(e,or)}(e),Jr=function(e,t){return t=t||"",w(e," OPR/")&&w(e,"Mini")?Sr:w(e," OPR/")?Er:Wr.test(e)?hr:w(e,"IE"+sr)||w(e,"WPDesktop")?wr:w(e,gr)?vr:w(e,xr)||w(e,"Edg/")?kr:w(e,"FBIOS")?"Facebook "+sr:w(e,"UCWEB")||w(e,"UCBrowser")?"UC Browser":w(e,"CriOS")?yr:w(e,"CrMo")||w(e,fr)?fr:w(e,or)&&w(e,_r)?Tr:w(e,"FxiOS")?Ir:w(e.toLowerCase(),Hr.toLowerCase())?Hr:Yr(e,t)?w(e,sr)?$r:_r:w(e,Pr)?Pr:w(e,"MSIE")||w(e,"Trident/")?br:w(e,"Gecko")?Pr:""},Kr={[wr]:[new RegExp("rv:"+jr)],[kr]:[new RegExp(xr+"?\\/"+jr)],[fr]:[new RegExp("("+fr+"|CrMo)\\/"+jr)],[yr]:[new RegExp("CriOS\\/"+jr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+jr)],[_r]:[Ur],[$r]:[Ur],[Er]:[new RegExp("(Opera|OPR)\\/"+jr)],[Pr]:[new RegExp(Pr+"\\/"+jr)],[Ir]:[new RegExp("FxiOS\\/"+jr)],[Hr]:[new RegExp("Konqueror[:/]?"+jr,"i")],[hr]:[new RegExp(hr+" "+jr),Ur],[Tr]:[new RegExp("android\\s"+jr,"i")],[vr]:[new RegExp(gr+"\\/"+jr)],[br]:[new RegExp("(rv:|MSIE )"+jr)],Mozilla:[new RegExp("rv:"+jr)]},Xr=function(e,t){var i=Jr(e,t),r=Kr[i];if(L(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},Qr=[[new RegExp(Rr+"; "+Rr+" (.*?)[);]","i"),e=>[Rr,e&&e[1]||""]],[new RegExp(Cr,"i"),[Cr,""]],[new RegExp(Fr,"i"),[Fr,""]],[Wr,[hr,""]],[new RegExp(Lr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Or,""];if(new RegExp(sr).test(t)&&!/IEMobile\b/.test(t))return[Lr+" "+sr,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=Gr[r]||"";return/arm/i.test(t)&&(s="RT"),[Lr,s]}return[Lr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[nr,t.join(".")]}return[nr,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=L(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+or+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+or+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[or,t.join(".")]}return[or,""]}],[/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/,[mr,""]],[/Linux|debian/i,["Linux",""]]],Zr=function(e){return Vr.test(e)?Cr:Br.test(e)?Fr:zr.test(e)?Rr:new RegExp(Ar,"i").test(e)?Ar:new RegExp("("+Or+"|WPDesktop)","i").test(e)?Or:/iPad/.test(e)?cr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?dr:Wr.test(e)?hr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Mr,"i").test(e)?Mr:/(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(sr).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)?or:lr:or:new RegExp("(pda|"+sr+")","i").test(e)?Nr:new RegExp(ar,"i").test(e)&&!new RegExp(ar+" pc","i").test(e)?qr:""},es="https?://(.*)",ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],is=Le(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ts),rs="<masked>",ss=["li_fat_id"];function ns(e,t,i){if(!u)return{};var r,s=t?Le([],ts,i||[]):[],n=os(li(u.URL,s,rs),e),o=(r={},Te(ss,(function(e){var t=Ii._get(e);r[e]=t||null})),r);return $e(o,n)}function os(e,t){var i=is.concat(t||[]),r={};return Te(i,(function(t){var i=ai(e,t);r[t]=i||null})),r}function as(e){var t=function(e){return e?0===e.search(es+"google.([^/?]*)")?"google":0===e.search(es+"bing.com")?"bing":0===e.search(es+"yahoo.com")?"yahoo":0===e.search(es+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!A(t)){r.$search_engine=t;var s=u?ai(u.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function ls(){return navigator.language||navigator.userLanguage}function cs(){return(null==u?void 0:u.referrer)||"$direct"}function us(e,t){var i=e?Le([],ts,t||[]):[],r=null==d?void 0:d.href.substring(0,1e3);return{r:cs().substring(0,1e3),u:r?li(r,i,rs):void 0}}function ds(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=ni(i))?void 0:t.host};if(r){s.$current_url=r;var n=ni(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=os(r);$e(s,o)}if(i){var a=as(i);$e(s,a)}return s}function _s(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function hs(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function ps(e,t){if(!g)return{};var i,r,n,o=e?Le([],ts,t||[]):[],[a,l]=function(e){for(var t=0;t<Qr.length;t++){var[i,r]=Qr[t],s=i.exec(e),n=s&&(F(r)?r(s,e):r);if(n)return n}return["",""]}(g);return $e(De({$os:a,$os_version:l,$browser:Jr(g,navigator.vendor),$device:Zr(g),$device_type:(r=g,n=Zr(r),n===cr||n===lr||"Kobo"===n||"Kindle Fire"===n||n===qr?ar:n===Cr||n===Rr||n===Fr||n===Ar?"Console":n===dr?"Wearable":n?sr:"Desktop"),$timezone:_s(),$timezone_offset:hs()}),{$current_url:li(null==d?void 0:d.href,o,rs),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:Xr(g,navigator.vendor),$browser_language:ls(),$browser_language_prefix:(i=ls(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var gs=Ce("[Web Vitals]"),vs=9e5;class fs{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t,r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(L(r))gs.error("Could not read session ID. Dropping metrics!");else{this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();if(!L(s))if(D(null==e?void 0:e.name)||D(null==e?void 0:e.value))gs.error("Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)gs.error("Ignoring metric with value >= "+this._maxAllowedValue,e);else this._buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),L(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=L(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this._buffer.metrics.push(i({},e,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}},this._startCapturing=()=>{var e,t,i,r,s=v.__PosthogExtensions__;L(s)||L(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(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&&r(this._addToBuffer.bind(this)),this._initialized=!0):gs.error("web vitals callbacks not loaded - not starting")},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Xe]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=R(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?(null==(t=this._instance.persistence)?void 0:t.props[Ze])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=R(this._instance.config.capture_performance)&&N(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:vs;return 0<e&&e<=6e4?vs:e}get isEnabled(){var e=null==d?void 0:d.protocol;if("http:"!==e&&"https:"!==e)return gs.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:q(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return q(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(gs.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){var t=R(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=R(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xe]:t}),this._instance.persistence.register({[Ze]:i})),this._enabledServerSide=t,this.startIfEnabled()}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",(t=>{t?gs.error("failed to load script",t):e()}))}_currentURL(){var e=s?s.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,r=t?Le([],ts,i||[]):[];return li(e,r,rs)}gs.error("Could not determine current URL")}}var ms=Ce("[Heatmaps]");function ys(e){return R(e)&&"clientX"in e&&"clientY"in e&&N(e.clientX)&&N(e.clientY)}class bs{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[Ge]),this.rageclicks=new ii(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return R(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 L(this.instance.config.capture_heatmaps)?L(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;ms.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ge]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(u)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){s&&u&&(this._flushHandler=this._flush.bind(this),Ue(s,"beforeunload",this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==s?void 0:s.event)),Ue(u,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==s?void 0:s.event)),Ue(u,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new ji(this.instance,qi,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabled(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Ue(u,"visibilitychange",this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;s&&u&&(this._flushHandler&&s.removeEventListener("beforeunload",this._flushHandler),this._onClickHandler&&u.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&u.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&u.removeEventListener("visibilitychange",this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&Et(r)&&!St(r,"body");){if(r===i)return!1;if(w(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=Ot(r)}return!1}(Tt(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!wt(e.target)&&ys(e)){var s=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},s,{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){!wt(e.target)&&ys(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(s){var t=s.location.href,i=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,n=i?Le([],ts,r||[]):[],o=li(t,n,rs);this._buffer=this._buffer||{},this._buffer[o]||(this._buffer[o]=[]),this._buffer[o].push(e)}}_flush(){this._buffer&&!T(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class ws{constructor(e){this._instance=e}doPageView(e,t){var i,r=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==s?void 0:s.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(L(n)||L(o)||L(a)||L(l)||L(c)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var d=n<=1?1:Y(o/n,0,1,Ie),_=n<=1?1:Y(a/n,0,1,Ie),h=l<=1?1:Y(c/l,0,1,Ie),p=l<=1?1:Y(u/l,0,1,Ie);r=$e(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var Es=Uint8Array,Ss=Uint16Array,xs=Uint32Array,ks=new Es([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]),Ps=new Es([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]),Is=new Es([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 Ss(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new xs(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},Fs=Cs(ks,2),Rs=Fs[0],Ts=Fs[1];Rs[28]=258,Ts[258]=28;for(var $s=Cs(Ps,0)[1],Ls=new Ss(32768),Os=0;Os<32768;++Os){var Ms=(43690&Os)>>>1|(21845&Os)<<1;Ms=(61680&(Ms=(52428&Ms)>>>2|(13107&Ms)<<2))>>>4|(3855&Ms)<<4,Ls[Os]=((65280&Ms)>>>8|(255&Ms)<<8)>>>1}var As=function(e,t,i){for(var r=e.length,s=0,n=new Ss(t);s<r;++s)++n[e[s]-1];var o,a=new Ss(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Ss(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,_=d|(1<<u)-1;d<=_;++d)o[Ls[d]>>>l]=c}else for(o=new Ss(r),s=0;s<r;++s)o[s]=Ls[a[e[s]-1]++]>>>15-e[s];return o},Ds=new Es(288);for(Os=0;Os<144;++Os)Ds[Os]=8;for(Os=144;Os<256;++Os)Ds[Os]=9;for(Os=256;Os<280;++Os)Ds[Os]=7;for(Os=280;Os<288;++Os)Ds[Os]=8;var Ns=new Es(32);for(Os=0;Os<32;++Os)Ns[Os]=5;var qs=As(Ds,9,0),Hs=As(Ns,5,0),js=function(e){return(e/8>>0)+(7&e&&1)},Us=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof Ss?Ss:e instanceof xs?xs:Es)(i-t);return r.set(e.subarray(t,i)),r},zs=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8},Bs=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Vs=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new Es(0),0];if(1==s){var o=new Es(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!=s-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 _=n[0].s;for(r=1;r<s;++r)n[r].s>_&&(_=n[r].s);var h=new Ss(_+1),p=Ws(i[u-1],h,0);if(p>t){r=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r<s;++r){var m=n[r].s;if(!(h[m]>t))break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[r].s;h[y]<t?g-=1<<t-h[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;h[b]==t&&(--h[b],++g)}p=t}return[new Es(h),p]},Ws=function(e,t,i){return-1==e.s?Math.max(Ws(e.l,t,i+1),Ws(e.r,t,i+1)):t[e.s]=i},Gs=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Ss(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Ys=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Js=function(e,t,i){var r=i.length,s=js(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Ks=function(e,t,i,r,s,n,o,a,l,c,u){zs(t,u++,i),++s[256];for(var d=Vs(s,15),_=d[0],h=d[1],p=Vs(n,15),g=p[0],v=p[1],f=Gs(_),m=f[0],y=f[1],b=Gs(g),w=b[0],E=b[1],S=new Ss(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<w.length;++x)S[31&w[x]]++;for(var k=Vs(S,7),P=k[0],I=k[1],C=19;C>4&&!P[Is[C-1]];--C);var F,R,T,L,O=c+5<<3,M=Ys(s,Ds)+Ys(n,Ns)+o,A=Ys(s,_)+Ys(n,g)+o+14+3*C+Ys(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O<=M&&O<=A)return Js(t,u,e.subarray(l,l+c));if(zs(t,u,1+(A<M)),u+=2,A<M){F=As(_,h,0),R=_,T=As(g,v,0),L=g;var D=As(P,I,0);zs(t,u,y-257),zs(t,u+5,E-1),zs(t,u+10,C-4),u+=14;for(x=0;x<C;++x)zs(t,u+3*x,P[Is[x]]);u+=3*C;for(var N=[m,w],q=0;q<2;++q){var H=N[q];for(x=0;x<H.length;++x){var j=31&H[x];zs(t,u,D[j]),u+=P[j],j>15&&(zs(t,u,H[x]>>>5&127),u+=H[x]>>>12)}}}else F=qs,R=Ds,T=Hs,L=Ns;for(x=0;x<a;++x)if(r[x]>255){j=r[x]>>>18&31;Bs(t,u,F[j+257]),u+=R[j+257],j>7&&(zs(t,u,r[x]>>>23&31),u+=ks[j]);var U=31&r[x];Bs(t,u,T[U]),u+=L[U],U>3&&(Bs(t,u,r[x]>>>5&8191),u+=Ps[U])}else Bs(t,u,F[r[x]]),u+=R[r[x]];return Bs(t,u,F[256]),u+R[256]},Xs=new xs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qs=function(){for(var e=new xs(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Zs=function(e,t,i,r,s){return function(e,t,i,r,s,n){var o=e.length,a=new Es(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?c=Js(l,c,e.subarray(u,d)):(l[u]=n,c=Js(l,c,e.subarray(u,o)))}else{for(var _=Xs[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new Ss(32768),f=new Ss(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 xs(25e3),E=new Ss(288),S=new Ss(32),x=0,k=0,P=(u=0,0),I=0,C=0;u<o;++u){var F=b(u),R=32767&u,T=f[F];if(v[R]=T,f[F]=R,I<=u){var L=o-u;if((x>7e3||P>24576)&&L>423){c=Ks(e,l,0,w,E,S,k,P,C,u-C,c),P=x=k=0,C=u;for(var O=0;O<286;++O)E[O]=0;for(O=0;O<30;++O)S[O]=0}var M=2,A=0,D=p,N=R-T&32767;if(L>2&&F==b(u-N))for(var q=Math.min(h,L)-1,H=Math.min(32767,u),j=Math.min(258,L);N<=H&&--D&&R!=T;){if(e[u+M]==e[u+M-N]){for(var U=0;U<j&&e[u+U]==e[u+U-N];++U);if(U>M){if(M=U,A=N,U>q)break;var z=Math.min(N,U-2),B=0;for(O=0;O<z;++O){var V=u-N+O+32768&32767,W=V-v[V]+32768&32767;W>B&&(B=W,T=V)}}}N+=(R=T)-(T=v[R])+32768&32767}if(A){w[P++]=268435456|Ts[M]<<18|$s[A];var G=31&Ts[M],Y=31&$s[A];k+=ks[G]+Ps[Y],++E[257+G],++S[Y],I=u+M,++x}else w[P++]=e[u],++E[e[u]]}}c=Ks(e,l,n,w,E,S,k,P,C,u-C,c)}return Us(a,0,r+js(c)+s)}(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,r,!0)},en=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function tn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Qs[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=Zs(e,t,10+((s=t).filename&&s.filename.length+1||0),8),o=n.length;return 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&&en(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),en(n,o-8,i.d()),en(n,o-4,r),n}var rn=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),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),A(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},sn=!!h||!!_,nn="text/plain",on=function(e,t,r){var s;void 0===r&&(r=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(s=null==o?void 0:o.split("&").map((e=>{var t,[i,s]=e.split("="),n=r&&null!==(t=a[i])&&void 0!==t?t:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],c=oi(a);return c&&l.push(c),n+"?"+l.join("&")},an=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),ln=e=>{var{data:t,compression:i}=e;if(t){if(i===si.GZipJS){var r=tn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Es(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;o<i;++o){if(s+5>r.length){var a=new Es(s+8+(i-o<<1));a.set(r),r=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 Us(r,0,s)}(an(t)),{mtime:0}),s=new Blob([r],{type:nn});return{contentType:nn,body:s,estimatedSize:s.size}}if(i===si.Base64){var n=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=rn(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(an(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:an(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=an(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},cn=[];_&&cn.push({transport:"fetch",method:e=>{var t,r,{contentType:s,body:n,estimatedSize:o}=null!==(t=ln(e))&&void 0!==t?t:{},a=new Headers;Te(e.headers,(function(e,t){a.append(t,e)})),s&&a.append("Content-Type",s);var l=e.url,c=null;if(p){var u=new p;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}_(l,i({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&(o||0)<52428.8,body:n,signal:null==(r=c)?void 0:r.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Ie.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{Ie.error(t),null==e.callback||e.callback({statusCode:0,text:t})})).finally((()=>c?clearTimeout(c.timeout):null))}}),h&&cn.push({transport:"XHR",method:e=>{var t,i=new h;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=ln(e))&&void 0!==t?t:{};Te(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=c&&c.sendBeacon&&cn.push({transport:"sendBeacon",method:e=>{var t=on(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=ln(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;c.sendBeacon(t,n)}catch(e){}}});var un=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function dn(e,t,i){return an({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var _n={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>un(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!un(t,e))))),icontains:(e,t)=>t.map(hn).some((t=>e.map(hn).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(hn).every((t=>e.map(hn).every((e=>!t.includes(e)))))},hn=e=>e.toLowerCase();function pn(e,t){return!e||Object.entries(e).every((e=>{var[i,r]=e,s=null==t?void 0:t[i];if(L(s)||A(s))return!1;var n=[String(s)],o=_n[r.operator];return!!o&&o(r.values,n)}))}var gn=Ce("[Error tracking]");class vn{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=new te([new ge,new ke,new fe,new ve,new Se,new Ee,new ye,new xe],pe("web:javascript",le,de)),this._instance=e,this._suppressionRules=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Je))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[Je]:this._suppressionRules,[Ke]:n})}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Ke),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return void gn.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return void gn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return void gn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:r}=t;return O(i)&&i.length>0&&e.$exception_types.push(i),O(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,r=_n[e.operator],s=C(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}_isExceptionList(e){return!D(e)&&C(e)}}var fn=Ce("[FeatureFlags]"),mn=Ce("[FeatureFlags]",{debugEnabled:!0}),yn="$active_feature_flags",bn="$override_feature_flags",wn="$feature_flag_payloads",En="$override_feature_flag_payloads",Sn="$feature_flag_request_id",xn="$feature_flag_evaluated_at",kn=e=>{var t={};for(var[i,r]of Oe(e||{}))r&&(t[i]=r);return t},Pn=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):fn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},In=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class Cn{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsCalled=!1,this._flagsLoadedFromRemote=!1,this._instance=e,this.featureFlagEventHandlers=[]}_getValidEvaluationEnvironments(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||fn.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}flags(){if(this._instance.config.__preview_remote_config)this._flagsCalled=!0;else{var e=!this._reloadDebouncer&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this._callFlagsEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(nt),t=this._instance.get_property(bn),r=this._instance.get_property(En);if(!r&&!t)return e||{};var s=$e({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of n){var a,l,c=s[o],u=null==t?void 0:t[o],d=L(u)?null!==(a=null==c?void 0:c.enabled)&&void 0!==a&&a:!!u,_=L(u)?c.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[o],p=i({},c,{enabled:d,variant:d?null!=_?_:null==c?void 0:c.variant:void 0});if(d!==(null==c?void 0:c.enabled)&&(p.original_enabled=null==c?void 0:c.enabled),_!==(null==c?void 0:c.variant)&&(p.original_variant=null==c?void 0:c.variant),h)p.metadata=i({},null==c?void 0:c.metadata,{payload:h,original_payload:null==c||null==(l=c.metadata)?void 0:l.payload});s[o]=p}return this._override_warning||(fn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var e=this._instance.get_property(rt),t=this._instance.get_property(bn);if(!t)return e||{};for(var i=$e({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(fn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._instance.get_property(wn),t=this._instance.get_property(En);if(!t)return e||{};for(var i=$e({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(fn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ot)||{}),group_properties:this._instance.get_property(at)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_environments=this._getValidEvaluationEnvironments());var s=this._instance.config.__preview_remote_config,n=s?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("flags",n+o);s&&(r.timezone=_s()),this._requestInFlight=!0,this._instance._send_request({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s=!0;(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),s=!1),this._requestInFlight=!1,this._flagsCalled)||(this._flagsCalled=!0,this._instance._onRemoteConfig(null!==(i=e.json)&&void 0!==i?i:{}));if(!r.disable_flags||this._additionalReloadRequested)if(this._flagsLoadedFromRemote=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(In.FeatureFlags))fn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;if(!r.disable_flags)this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},s);this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(Sn)||void 0,n=this._instance.get_property(xn)||void 0,o=this._instance.get_property(ut)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var a,l,c,u,d,_,h,p,g;C(o[e])?o[e].push(r):o[e]=[r],null==(a=this._instance.persistence)||a.register({[ut]:o});var v=this.getFeatureFlagDetails(e),f={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(c=c.featureFlagPayloads)?void 0:c[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};L(null==v||null==(u=v.metadata)?void 0:u.version)||(f.$feature_flag_version=v.metadata.version);var m,y=null!==(d=null==v||null==(_=v.reason)?void 0:_.description)&&void 0!==d?d:null==v||null==(h=v.reason)?void 0:h.code;if(y&&(f.$feature_flag_reason=y),null!=v&&null!=(p=v.metadata)&&p.id&&(f.$feature_flag_id=v.metadata.id),L(null==v?void 0:v.original_variant)&&L(null==v?void 0:v.original_enabled)||(f.$feature_flag_original_response=L(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(g=v.metadata)&&g.original_payload)f.$feature_flag_original_payload=null==v||null==(m=v.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",f)}return i}fn.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_environments=this._getValidEvaluationEnvironments()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return L(i)?void 0:!!i}fn.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._hasLoadedFlags=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,r,s,n){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=Pn(e),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(l){var u=e.requestId,d=e.evaluatedAt;if(C(l)){fn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(l)for(var h=0;h<l.length;h++)_[l[h]]=!0;t&&t.register({[yn]:l,[rt]:_})}else{var p=l,g=c,v=a;e.errorsWhileComputingFlags&&(p=i({},r,p),g=i({},s,g),v=i({},n,v)),t&&t.register(i({[yn]:Object.keys(kn(p)),[rt]:p||{},[wn]:g||{},[nt]:v||{}},u?{[Sn]:u}:{},d?{[xn]:d}:{}))}}}(e,this._instance.persistence,r,s,n),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),fn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return fn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(bn),this._instance.persistence.unregister(En),this._fireFeatureFlagsCallbacks(),mn.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(bn),mn.info("Flag overrides cleared");else if(i.flags){if(C(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[bn]:r})}else this._instance.persistence.register({[bn]:i.flags});mn.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._instance.persistence.unregister(En),mn.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[En]:i.payloads}),mn.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var s,n=(this._instance.get_property(st)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(s=this._instance.persistence)||s.register({[yn]:Object.keys(kn(l)),[rt]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(st),s=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(st),null==(r=this._instance.persistence)||r.register({[st]: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((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._instance.get_property(ot)||{};this._instance.register({[ot]:i({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ot)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._instance.get_property(at)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((t=>{r[t]=i({},r[t],e[t]),delete e[t]})),this._instance.register({[at]:i({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(at)||{};this._instance.register({[at]:i({},t,{[e]:{}})})}else this._instance.unregister(at)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsCalled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}var Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Rn{constructor(e,t){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&&Ie.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Fn.indexOf(e.persistence.toLowerCase())&&(Ie.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Fi._is_supported()?Fi:"localstorage+cookie"===t&&Ti._is_supported()?Ti:"sessionstorage"===t&&Mi._is_supported()?Mi:"memory"===t?Li:"cookie"===t?Ii:Ti._is_supported()?Ti:Ii}properties(){var e={};return Te(this.props,(function(t,i){if(i===rt&&R(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else o=i,a=!1,(A(n=bt)?a:l&&n.indexOf===l?-1!=n.indexOf(o):(Te(n,(function(e){if(a||(a=e===o))return Fe})),a))||(e[i]=t);var n,o,a})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=$e({},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(R(e)){L(t)&&(t="None"),this._expire_days=L(i)?this._default_expiry:i;var r=!1;if(Te(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(R(e)){this._expire_days=L(t)?this._default_expiry:t;var i=!1;if(Te(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=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=ns(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);T(De(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==u?void 0:u.referrer)?as(e):{})}update_referrer_info(){var e;this.register_once({$referrer:cs(),$referring_domain:null!=u&&u.referrer&&(null==(e=ni(u.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[pt]||this.props[gt]||this.register_once({[vt]:us(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Te([gt,pt],(t=>{var i=this.props[t];i&&Te(i,(function(t,i){e["$initial_"+S(i)]=t}))}));var t,i,r=this.props[vt];if(r){var s=(t=ds(r),i={},Te(t,(function(e,t){i["$initial_"+S(t)]=e})),i);$e(e,s)}return e}safe_merge(e){return Te(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this._buildStorage(e),s=this.props;this.clear(),this._storage=r,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())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ve]||{};i[e]=t,this.props[Ve]=i,this.save()}remove_event_timer(e){var t=(this.props[Ve]||{})[e];return L(t)||(delete this.props[Ve][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var Tn=function(e){return e.Activation="events",e.Cancellation="cancelEvents",e}({}),$n=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({}),Ln=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),On=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),Mn=function(e){return e.Popover="popover",e.Inline="inline",e}({});class An{constructor(){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 r of this._events["*"]||[])r(e,t)}}function Dn(e,t,i){if(D(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Nn{constructor(e){this._debugEventEmitter=new An,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),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(!L(null==(e=this._instance)?void 0:e._addCaptureHook)){var t;null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,i;if(!L(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}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.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,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Dn(r,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&(!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t))}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Dn(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Dn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Dn(e.text,t.text,t.text_matching||"exact")||Dn(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!D(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some((e=>Dn(e,n,o))))}_checkStepSelector(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||pn(t.properties.reduce(((e,t)=>{var i=C(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}var qn=Ce("[Surveys]");var Hn="seenSurvey_",jn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Un=e=>{var t=""+Hn+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+Hn+e.id+"_"+e.current_iteration),t},zn=[$n.Popover,$n.Widget,$n.API],Bn={ignoreConditions:!1,ignoreDelay:!1,displayType:Mn.Popover};class Vn{constructor(e){this._instance=e,this._eventToSurveys=new Map,this._cancelEventToSurveys=new Map,this._actionToSurveys=new Map}_doesEventMatchFilter(e,t){return!!e&&pn(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToSurveyMap(e,t){var i=new Map;return e.forEach((e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach((t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}}))})),i}_getMatchingSurveys(e,t,i){var r,s=(i===Tn.Activation?this._eventToSurveys:this._cancelEventToSurveys).get(e),n=[];return null==(r=this._instance)||r.getSurveys((e=>{n=e.filter((e=>null==s?void 0:s.includes(e.id)))})),n.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;L(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedSurveys(e),this._setupActionBasedSurveys(e))}_setupActionBasedSurveys(e){var t=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));if(0!==t.length){if(null==this._actionMatcher){this._actionMatcher=new Nn(this._instance),this._actionMatcher.init();this._actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this._actionMatcher)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((t=>{if(t&&t.name){var i=this._actionToSurveys.get(t.name);i&&i.push(e.id),this._actionToSurveys.set(t.name,i||[e.id])}})))}))}}_setupEventBasedSurveys(e){var t,i=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));if(0!==i.length||0!==r.length){null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToSurveys=this._buildEventToSurveyMap(e,Tn.Activation),this._cancelEventToSurveys=this._buildEventToSurveyMap(e,Tn.Cancellation)}}onEvent(e,t){var i,r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[ct])||[];if(Ln.SHOWN===e&&t&&r.length>0){var s;qn.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var n=null==t||null==(s=t.properties)?void 0:s.$survey_id;if(n){var o=r.indexOf(n);o>=0&&(r.splice(o,1),this._updateActivatedSurveys(r))}}else{if(this._cancelEventToSurveys.has(e)){var a=this._getMatchingSurveys(e,t,Tn.Cancellation);a.length>0&&(qn.info("cancel event matched, cancelling surveys",{event:e,surveysToCancel:a.map((e=>e.id))}),a.forEach((e=>{var t,i=r.indexOf(e.id);i>=0&&r.splice(i,1),null==(t=this._instance)||t.cancelPendingSurvey(e.id)})),this._updateActivatedSurveys(r))}if(this._eventToSurveys.has(e)){qn.info("survey event name matched",{event:e,eventPayload:t,surveys:this._eventToSurveys.get(e)});var l=this._getMatchingSurveys(e,t,Tn.Activation);this._updateActivatedSurveys(r.concat(l.map((e=>e.id))||[]))}}}onAction(e){var t,i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[ct])||[];this._actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this._actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t;qn.info("updating activated surveys",{activatedSurveys:e}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[ct]:[...new Set(e)]})}getSurveys(){var e,t=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[ct];return t||[]}getEventToSurveys(){return this._eventToSurveys}_getActionMatcher(){return this._actionMatcher}}class Wn{constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isFetchingSurveys=!1,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(D(t))return qn.warn("Flags not loaded yet. Not loading surveys.");var i=C(t);this._isSurveysEnabled=i?t.length>0:t,qn.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(Hn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)qn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)qn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())qn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==v?void 0:v.__PosthogExtensions__;if(e){if(!L(this._isSurveysEnabled)||this._instance.config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._instance.config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var r=e.loadExternalDependency;if(!r)return void this._handleSurveyLoadError("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else qn.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Vn(this._instance),qn.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){qn.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return qn.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(lt);if(i&&!t)return e(i,{isLoaded:!0});if(this._isFetchingSurveys)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this._isFetchingSurveys=!1;var r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: "+r;return qn.error(s),e([],{isLoaded:!1,error:s})}var n,o=t.json.surveys||[],a=o.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(i=this._instance.persistence)||i.register({[lt]:o}),e(o,{isLoaded:!0})}})}catch(e){throw this._isFetchingSurveys=!1,e}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){qn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qn.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}_checkSurveyEligibility(e){if(D(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(D(this._surveyManager))return qn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return D(this._surveyManager)?(qn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((t=>{var r,s=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(s){var n=this._checkSurveyEligibility(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){var i;if(D(this._surveyManager))qn.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(zn.includes(r.type)){var s=null==u?void 0:u.querySelector(t);if(s)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(qn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;qn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,s),qn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);qn.warn("Survey element not found")}else qn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else qn.warn("Survey not found")}}displaySurvey(e,t){var r;if(D(this._surveyManager))qn.warn("init was not called");else{var s=this._getSurveyById(e);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void qn.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Mn.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else qn.warn("Survey not found")}}cancelPendingSurvey(e){D(this._surveyManager)?qn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}}var Gn=Ce("[RateLimiter]");class Yn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Gn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Gn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(ht))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||e||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||e||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==(r=this.instance.persistence)||r.set_property(ht,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Jn=Ce("[RemoteConfig]");class Kn{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Jn.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Jn.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Jn.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Jn.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e)}));this._onRemoteConfig(e)}))}catch(e){Jn.error("Error loading remote config",e)}}_onRemoteConfig(e){e?this._instance.config.__preview_remote_config?(this._instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Jn.info("__preview_remote_config is disabled. Logging config instead",e):Jn.error("Failed to fetch remote config from PostHog.")}}var Xn=3e3;class Qn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Y((null==t?void 0:t.flush_interval_ms)||Xn,250,5e3,Ie.createLogger("flush interval"),Xn),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);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},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(){var i=t[r],s=(new Date).getTime();i.data&&C(i.data)&&Te(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequest(i)};for(var r in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Te(this._queue,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;L(e[n])&&(e[n]=i({},s,{data:[]})),null==(r=e[n].data)||r.push(s.data)})),this._queue=[],e}}var Zn=["retriesPerformedSoFar"];class eo{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!L(s)&&"onLine"in s.navigator&&(this._areWeOnline=s.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Ue(s,"online",this._onlineListener),Ue(s,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=r(e,Zn);N(t)&&t>0&&(s.url=on(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this._enqueue(i({retriesPerformedSoFar:t},s)):null==s.callback||s.callback(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,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this._queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ie.warn(s),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);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:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,L(s)||(this._onlineListener&&(s.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(s.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Ie.error(e)}this._queue=[]}}class to{constructor(e){this._updateScrollData=()=>{var e,t,i,r;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._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!==(r=this._context.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Ue(s,"scroll",this._updateScrollData,{capture:!0}),Ue(s,"scrollend",this._updateScrollData,{capture:!0}),Ue(s,"resize",this._updateScrollData)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==s?void 0:s.document.documentElement;var e=C(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==s?void 0:s.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var io=e=>us(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ro{constructor(e,t,i,r){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[_t]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=r||io,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[_t]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?ds(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Te(De(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+S(i)]=t})),e}}var so=Ce("[SessionId]");class no{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var r;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new An,this._sessionHasBeenIdleTooLong=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Ei,this._windowIdGenerator=i||Ei;var s=this._config.persistence_name||this._config.token,n=this._config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Y(n,60,36e3,so.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=Mi._parse(this._window_id_storage_key),a=Mi._parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:Mi._remove(this._window_id_storage_key),Mi._set(this._primary_window_exists_storage_key,!0)}if(null!=(r=this._config.bootstrap)&&r.sessionID)try{var l=(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(),l)}catch(e){so.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return L(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&&Mi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Mi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Mi._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({[tt]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[tt];return C(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&s&&(s.removeEventListener("beforeunload",this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&Mi._remove(this._primary_window_exists_storage_key)},Ue(s,"beforeunload",this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this._getSessionId(),o=this._getWindowId(),a=N(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!c&&!e&&this._sessionHasBeenIdleTooLong(i,r);c||u||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),so.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=0===r||!e||a?i:r,_=0===n?(new Date).getTime():n;return this._setWindowId(o),this._setSessionId(s,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var oo=["$set_once","$set"],ao=Ce("[SiteApps]");class lo{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,s,n,o,a,l,c;if(!e)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))u[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},r(e,oo),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(s=e.properties)?void 0:s.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(c=e.properties)?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;(!t.errored&&this._bufferedInvocations.length&&(ao.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored)))&&(null==(i=this._stopBuffering)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,ao.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(t){ao.error("Error while initializing PostHog app with config id "+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){ao.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}_onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){ao.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;v["__$$ph_site_app_"+e]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,(t=>{if(t)return ao.error("Error while initializing PostHog app with config id "+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var co=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&y(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>y(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},uo=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),_o="i.posthog.com";class ho{constructor(e){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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+_o,".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]=uo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=uo.EU:this._regionCache[this.apiHost]=uo.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===uo.CUSTOM)return this.apiHost+t;var i=_o+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var po={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&un(t.href,e),not_regex:(e,t)=>!!s&&!un(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class go{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{go._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;if(t._flagToExperiments)go._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e);var r=t._instance.getFeatureFlag(e.feature_flag_key);O(r)&&e.variants[r]&&t._applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];go._matchesTestVariant(n)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())go._logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(D(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();go._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this._flagToExperiments)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this._applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=go.getWindowLocation();if(null!=e&&e.search){var t=ai(null==e?void 0:e.search,"__experiment_id"),i=ai(null==e?void 0:e.search,"__experiment_variant");t&&i&&(go._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()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}_showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(go._logInfo("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this._applyTransforms(r[0].name,t,r[0].variants[t].transforms))}static _matchesTestVariant(e){return!D(e.conditions)&&(go._matchUrlConditions(e)&&go._matchUTMConditions(e))}static _matchUrlConditions(e){var t;if(D(e.conditions)||D(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=go.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||po[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==s?void 0:s.location}static _matchUTMConditions(e){var t;if(D(e.conditions)||D(null==(t=e.conditions)?void 0:t.utm))return!0;var i=ns();if(i.utm_source){var r,s,n,o,a,l,c,u,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Ie.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?go._logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var r;go._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):go._logInfo("Control variants leave the page unmodified.")}_is_bot(){return c&&this._instance?co(c,this._instance.config.custom_blocked_useragents):void 0}}var vo=Ce("[PostHog ExternalIntegrations]"),fo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class mo{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return vo.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;(!r||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(fo[t],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var yo="[SessionRecording]",bo=Ce(yo);class wo{get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){return this._lazyLoadedSessionRecording?this._lazyLoadedSessionRecording.status:this._receivedFlags&&!this._isRecordingEnabled?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._receivedFlags=!1,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw bo.error("started without valid sessionManager"),new Error(yo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(yo+' cannot be used with cookieless_mode="always"')}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(et))||!e.enabled),i=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!L(Object.assign)&&!L(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),bo.info("starting")):this.stopRecording()}}_lazyLoadAndStart(e){var t,i,r;this._isRecordingEnabled&&(null!=v&&null!=(t=v.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=v.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return bo.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_resetSampling(){var e;null==(e=this._instance.persistence)||e.unregister(it)}_persistRemoteConfig(e){if(this._instance.persistence){var t,r,s=this._instance.persistence,n=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=null==t?void 0:t.sampleRate,n=D(r)?null:parseFloat(r);D(n)&&this._resetSampling();var o=null==t?void 0:t.minimumDurationMilliseconds;s.register({[et]:i({enabled:!!t},t,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:n,minimumDurationMilliseconds:L(o)?null:o,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this._persistRemoteConfig(e),this._receivedFlags=!0,this.startIfEnabledOrStop()):this._receivedFlags=!0:bo.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):bo.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(et);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_onScriptLoaded(e){var t,i;if(null==(t=v.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=v.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||(null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}));null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||(null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}));null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||(null==(i=this._instance.persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}var Eo={},So=()=>{},xo="posthog",ko=!sn&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla")),Po=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:He(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",loaded:So,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:d&&O(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Ie.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Xn},error_tracking:{},_onCapture:So,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},Io=e=>{var t={};L(e.process_person)||(t.person_profiles=e.process_person),L(e.xhr_headers)||(t.request_headers=e.xhr_headers),L(e.cookie_name)||(t.persistence_name=e.cookie_name),L(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),L(e.store_google)||(t.save_campaign_params=e.store_google),L(e.verbose)||(t.debug=e.verbose);var i=$e({},t,e);return C(e.property_blacklist)&&(L(e.property_denylist)?i.property_denylist=e.property_blacklist:C(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ie.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Co{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ie.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fo{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new Co,this._personProcessingSetOncePropertiesSent=!1,this.version=f.LIB_VERSION,this._internalEventEmitter=new An,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=Ki,this.sentryIntegration=e=>function(e,t){var i=Ji(e,t);return{name:Yi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new Cn(this),this.toolbar=new tr(this),this.scrollManager=new to(this),this.pageViewManager=new ws(this),this.surveys=new Wn(this),this.experiments=new go(this),this.exceptions=new vn(this),this.rateLimiter=new Yn(this),this.requestRouter=new ho(this),this.consent=new Di(this),this.externalIntegrations=new mo(this),this.people={set:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Ie.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==xo){var r,s=null!==(r=Eo[i])&&void 0!==r?r:new Fo;return s._init(e,t,i),Eo[i]=s,Eo[xo][i]=s,s}return this._init(e,t,i)}_init(e,t,r){var n;if(void 0===t&&(t={}),L(e)||M(e))return Ie.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles&&(this._initialPersonProfilesConfig=t.person_profiles),this.set_config($e({},Po(t.defaults),Io(t),{name:r,token:e})),this.config.on_xhr_error&&Ie.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:si.GZipJS;var o=this._is_persistence_disabled();this.persistence=new Rn(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Rn(i({},this.config,{persistence:"sessionStorage"}),o);var a=i({},this.persistence.props),l=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Qn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new eo(this),this.__request_queue=[];var c="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new no(this),this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ie.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(Ie.info("Initializing extensions synchronously"),this._initExtensions(c)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&Ie.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:a,s:l}),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var u,d,_=this.config.get_device_id(Ei()),h=null!=(u=t.bootstrap)&&u.isIdentifiedID?_:t.bootstrap.distinctID;this.persistence.set_property(dt,null!=(d=t.bootstrap)&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var p,g,v=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlags)||{}).filter((e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])})).reduce(((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e}),{}),m=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlagPayloads)||{}).filter((e=>v[e])).reduce(((e,i)=>{var r,s;null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:m})}if(c)this.register_once({distinct_id:yt,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Ei());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(dt,"anonymous")}return Ue(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Gi(this,(()=>this._loaded())):this._loaded(),F(this.config._onCapture)&&this.config._onCapture!==So&&(Ie.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Ie.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}_initExtensions(e){var t=performance.now();this.historyAutocapture=new Vi(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new rr(this).startIfEnabledOrStop()})),i.push((()=>{var e;this.siteApps=new lo(this),null==(e=this.siteApps)||e.init()})),e||i.push((()=>{this.sessionRecording=new wo(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new gi(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.heatmaps=new bs(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new fs(this)})),i.push((()=>{this.exceptionObserver=new zi(this),this.exceptionObserver.startIfEnabled()})),i.push((()=>{this.deadClicksAutocapture=new ji(this,Hi),this.deadClicksAutocapture.startIfEnabled()})),i.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(i,t)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Ie.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Ie.info("PostHog extensions initialized ("+r+"ms)")}_onRemoteConfig(e){var t,i,r,s,n,o,a,l;if(!u||!u.body)return Ie.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=w(e.supportedCompression,si.GZipJS)?si.GZipJS:w(e.supportedCompression,si.Base64)?si.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(o=this.webVitalsAutocapture)||o.onRemoteConfig(e),null==(a=this.exceptionObserver)||a.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){Ie.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this._captureInitialPageview()}),1),new Kn(this).load(),this.featureFlags.flags()}_start_queue_if_opted_in(){var e;this.is_capturing()&&(this.config.request_batching&&(null==(e=this._requestQueue)||e.enable()))}_dom_loaded(){this.is_capturing()&&Re(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)||e.unload(),null==(t=this._retryQueue)||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ko?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=on(e.url,{ip:this.config.ip?1:0}),e.headers=i({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,s,n=i({},e);n.timeout=n.timeout||6e4,n.url=on(n.url,{_:(new Date).getTime().toString(),ver:f.LIB_VERSION,compression:n.compression});var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=cn.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(r=null==(s=je(a,(e=>e.transport===o)))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");l(n)})(i({},e,{callback:t=>{var i,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null==(i=(r=this.config).on_request_error)||i.call(r,t));null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],s=[];Re(e,(e=>{e&&(t=e[0],C(t)?s.push(e):F(e)?e.call(this):C(e)&&"alias"===t?i.push(e):C(e)&&-1!==t.indexOf("capture")&&F(this[t])?s.push(e):r.push(e))}));var n=function(e,t){Re(e,(function(e){if(C(e[0])){var i=t;Te(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(r,this),n(s,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!L(e)&&O(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){null!=t&&t.$current_url&&!O(null==t?void 0:t.$current_url)&&(Ie.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=(null==r?void 0:r.timestamp)||a,c=Ei(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==r?void 0:r.$set)&&(u.$set=null==r?void 0:r.$set);var d,_=this._calculate_set_once_properties(null==r?void 0:r.$set_once);if(_&&(u.$set_once=_),(u=Ne(u,null!=r&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,L(null==r?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Ln.DISMISSED||e===Ln.SENT){var h=null==t?void 0:t[On.SURVEY_ID],p=null==t?void 0:t[On.SURVEY_ITERATION];d={id:h,current_iteration:p},localStorage.getItem(Un(d))||localStorage.setItem(Un(d),"true"),u.$set=i({},u.$set,{[jn({id:h,current_iteration:p},e===Ln.SENT?"responded":"dismissed")]:!0})}var g=i({},u.properties.$set,u.$set);if(T(g)||this.setPersonPropertiesForFlags(g),!D(this.config.before_send)){var v=this._runBeforeSend(u);if(!v)return;u=v}this._internalEventEmitter.emit("eventCaptured",u);var f={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(f):this._requestQueue.enqueue(f),u}Ie.critical("This capture call is ignored due to client rate limiting.")}}else Ie.error("No event name provided to posthog.capture")}else Ie.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=i({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===e){var l=i({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!N(a.distinct_id)||M(a.distinct_id))&&Ie.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,d=ps(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=_,a.$window_id=h}this.sessionPropsManager&&$e(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===uo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=$e(a,c),"$pageview"===e&&u&&(a.title=u.title),!L(o)){var v=r.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=$e({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?Te(this.config.property_denylist,(function(e){delete a[e]})):Ie.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(Ie.error("sanitize_properties is deprecated. Use before_send instead"),a=f(a,e));var m=this._hasPersonProcessing();return a.$process_person_profile=m,m&&!n&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e){var t;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),s=$e({},i,r||{},e||{}),n=this.config.sanitize_properties;return n&&(Ie.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,T(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_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,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Bn),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,r){if(!this.__loaded||!this.persistence)return Ie.uninitializedWarning("posthog.identify");if(N(e)&&(e=e.toString(),Ie.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()))Ie.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==yt){if(this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(Be)&&(this.unregister(Be),this.register({distinct_id:e}));var o="anonymous"===(this.persistence.get_property(dt)||"anonymous");e!==s&&o?(this.persistence.set_property(dt,"identified"),this.setPersonPropertiesForFlags(i({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=dn(e,t,r),this.featureFlags.setAnonymousDistinctId(s)):(t||r)&&this.setPersonProperties(t,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(ut))}}else Ie.critical('The string "'+yt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ie.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=dn(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(i({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):Ie.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},s,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===t||r||this.reloadFeatureFlags()}}else Ie.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if(Ie.info("reset"),!this.__loaded)return Ie.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(dt,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:yt,$device_id:null},"");else{var o=this.config.get_device_id(Ei());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?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),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(ze)?(Ie.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(L(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Be,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ie.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(R(e)){var r,s,n,o,a;$e(this.config,Io(e));var l=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Rn(i({},this.config,{persistence:"sessionStorage"}),l);var c=this._checkLocalStorageForDebug(this.config.debug);q(c)&&(this.config.debug=c),q(this.config.debug)&&(this.config.debug?(f.DEBUG=!0,Fi._is_supported()&&Fi._set("ph_debug","true"),Ie.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(f.DEBUG=!1,Fi._is_supported()&&Fi._remove("ph_debug"))),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(a=this.externalIntegrations)||a.startIfEnabledOrStop()}}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 r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),i.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(i.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(i.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(i.event_trigger)null==(a=this.sessionRecording)||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)||!e.started)}captureException(e,t){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:xo;return t!==xo&&(t=xo+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(dt))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(dt))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&T(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Be])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ft]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ie.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ft,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}_sync_opt_out_with_persistence(){var e,t,i,r,s=this._is_persistence_disabled();(null==(e=this.persistence)?void 0:e._disabled)!==s&&(null==(i=this.persistence)||i.set_disabled(s));(null==(t=this.sessionPersistence)?void 0:t._disabled)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(e){if("always"!==this.config.cookieless_mode){var t,i;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=new no(this),this.persistence&&(this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.sessionRecording=new wo(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),L(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}else Ie.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:yt,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this._captureInitialPageview())):Ie.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ai.GRANTED?"granted":e===Ai.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return c?co(c,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){u&&("visible"===u.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:u.title},{send_instantly:!0}),this._visibilityStateListener&&(u.removeEventListener("visibilitychange",this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Ue(u,"visibilitychange",this._visibilityStateListener)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e,t,i,r,s,n,o,a=this._originalUserConfig||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ie.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=!1,s=Ie,n=(t="advanced_disable_flags")in(e=a)&&!L(e[t]),o=i in e&&!L(e[i]),n?e[t]:o?(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):r)}_runBeforeSend(e){if(D(this.config.before_send))return e;var t=C(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),D(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return j(e.event)?Ie.warn(s+". This can cause unexpected behavior."):Ie.info(s),null}i.properties&&!T(i.properties)||Ie.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=q(e)&&!e,i=Fi._is_supported()&&"true"===Fi._get("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Ae(e.prototype[t[i]])}(Fo,["identify"]);var Ro,To;Ro=Eo[xo]=new Fo,(To=v.posthog)&&Te(To._i,(function(e){if(e&&C(e)){var t=Ro.init(e[0],e[1],e[2]),i=To[e[2]]||To;t&&(t._execute_array.call(t.people,i.people),t._execute_array(i))}})),v.posthog=Ro,function(){function e(){e.done||(e.done=!0,ko=!1,Te(Eo,(function(e){e._dom_loaded()})))}null!=u&&u.addEventListener?"complete"===u.readyState?e():Ue(u,"DOMContentLoaded",e,{capture:!1}):s&&Ie.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
1
+ !function(){"use strict";function e(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function t(t){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=t.apply(i,r);function a(t){e(o,s,n,a,l,"next",t)}function l(t){e(o,s,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}function r(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var s="undefined"!=typeof window?window:void 0,n="undefined"!=typeof globalThis?globalThis:s;"undefined"==typeof self&&(n.self=n),"undefined"==typeof File&&(n.File=function(){});var o=Array.prototype,a=o.forEach,l=o.indexOf,c=null==n?void 0:n.navigator,u=null==n?void 0:n.document,d=null==n?void 0:n.location,_=null==n?void 0:n.fetch,h=null!=n&&n.XMLHttpRequest&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,p=null==n?void 0:n.AbortController,g=null==c?void 0:c.userAgent,v=null!=s?s:{},f={DEBUG:!1,LIB_VERSION:"1.301.2"},m=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],y=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return m.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},b=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function w(e,t){return-1!==e.indexOf(t)}var E=function(e){return e.trim()},S=function(e){return e.replace(/^\$/,"")};var x=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,I=k.toString,C=x||function(e){return"[object Array]"===I.call(e)},F=e=>"function"==typeof e,R=e=>e===Object(e)&&!C(e),T=e=>{if(R(e)){for(var t in e)if(P.call(e,t))return!1;return!0}return!1},L=e=>void 0===e,O=e=>"[object String]"==I.call(e),M=e=>O(e)&&0===e.trim().length,A=e=>null===e,D=e=>L(e)||A(e),N=e=>"[object Number]"==I.call(e),q=e=>"[object Boolean]"===I.call(e),H=e=>e instanceof FormData,j=e=>w(b,e);function U(e){return null===e||"object"!=typeof e}function z(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function B(e){return!L(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var V=[!0,"true",1,"1","yes"],W=e=>w(V,e),G=[!1,"false",0,"0","no"];function Y(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),N(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Y(s||i,t,i,r))}class J{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Y(e.bucketSize,0,100,e._logger),this._refillRate=Y(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Y(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=t-e.lastAccess,r=Math.floor(i/this._refillInterval);if(r>0){var s=r*this._refillRate;e.tokens=Math.min(e.tokens+s,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this._buckets[r];return s?this._applyRefill(s,i):(s={tokens:this._bucketSize,lastAccess:i},this._buckets[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var K,X,Q,Z=e=>e instanceof Error;function ee(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Q&&i.length===X||(X=i.length,Q=i.reduce(((i,r)=>{K||(K={});var s=K[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,K[r]=[l,c];break}}return i}),{})),Q}}class te{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&C(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,s;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),i({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var i=this;return t((function*(){var t=e;for(var r of i.modifiers)t=yield r(t);return t}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:ee(this.stackParser)}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var s=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return i({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,r),next:e=>s(e,r+1)})}}var ie="?";function re(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?ie:i,in_app:!0};return L(r)||(n.lineno=r),L(s)||(n.colno=s),n}var se=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:ie,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},ne=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,oe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ae=/\((\S*)(?::(\d+))(?::(\d+))\)/,le=(e,t)=>{var i=ne.exec(e);if(i){var[,r,s,n]=i;return re(t,r,ie,+s,+n)}var o=oe.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ae.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=se(o[1]||ie,o[2]);return re(t,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,de=(e,t)=>{var i=ce.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ue.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||ie;return[n,s]=se(n,s),re(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},_e=/\(error: (.*)\)/,he=50;function pe(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var n=[],o=t.split("\n"),a=s;a<o.length;a++){var l=o[a];if(!(l.length>1024)){var c=_e.test(l)?l.replace(_e,"$1"):l;if(!c.match(/\S*Error: /)){for(var u of r){var d=u(c,e);if(d){n.push(d);break}}if(n.length>=he)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,he).map((e=>{return i({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||ie});var r}))}(n)}}class ge{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=O(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class ve{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class fe{constructor(){}match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i,r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var me=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ye{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(me);return r&&(t=r[1],i=r[2]),[t,i]}}var be=["fatal","error","warning","log","info","debug"];function we(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class Ee{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return B(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+we(e)}isSeverityLevel(e){return O(e)&&!M(e)&&be.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Z(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Se{match(e){return B(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+we(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class xe{match(e){return U(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class ke{match(e){return z(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return U(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(U(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var Pe=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={_log:function(t){if(s&&(f.DEBUG||v.POSTHOG_DEBUG||i)&&!L(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t]?s.console[t].__rrweb_original__:s.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];r(e,...o)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r._log("error",...t)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Pe(e+" "+t,i)};return r},Ie=Pe("[PostHog.js]"),Ce=Ie.createLogger,Fe={};function Re(e,t,i){if(C(e))if(a&&e.forEach===a)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Fe)return}function Te(e,t,i){if(!D(e)){if(C(e))return Re(e,t,i);if(H(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Fe)return}else for(var s in e)if(P.call(e,s)&&t.call(i,e[s],s)===Fe)return}}var $e=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Re(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e},Le=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Re(i,(function(t){Re(t,(function(t){e.push(t)}))})),e};function Oe(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Me=function(e){try{return e()}catch(e){return}},Ae=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Ie.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ie.critical(e)}}},De=function(e){var t={};return Te(e,(function(e,i){(O(e)&&e.length>0||N(e))&&(t[i]=e)})),t};function Ne(e,t){return i=e,r=e=>O(e)&&!A(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t,i):t:s.has(t)?void 0:(s.add(t),C(t)?(n=[],Re(t,(t=>{n.push(e(t))}))):(n={},Te(t,((t,i)=>{s.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,r,s}var qe=["herokuapp.com","vercel.app","netlify.app"];function He(e){var t=null==e?void 0:e.hostname;if(!O(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of qe)if(i===r)return!1;return!0}function je(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function Ue(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var ze="$people_distinct_id",Be="__alias",Ve="__timers",We="$autocapture_disabled_server_side",Ge="$heatmaps_enabled_server_side",Ye="$exception_capture_enabled_server_side",Je="$error_tracking_suppression_rules",Ke="$error_tracking_capture_extension_exceptions",Xe="$web_vitals_enabled_server_side",Qe="$dead_clicks_enabled_server_side",Ze="$web_vitals_allowed_metrics",et="$session_recording_remote_config",tt="$sesid",it="$session_is_sampled",rt="$enabled_feature_flags",st="$early_access_features",nt="$feature_flag_details",ot="$stored_person_properties",at="$stored_group_properties",lt="$surveys",ct="$surveys_activated",ut="$flag_call_reported",dt="$user_state",_t="$client_session_props",ht="$capture_rate_limit",pt="$initial_campaign_params",gt="$initial_referrer_info",vt="$initial_person_info",ft="$epp",mt="__POSTHOG_TOOLBAR__",yt="$posthog_cookieless",bt=[ze,Be,"__cmpns",Ve,"$session_recording_enabled_server_side",Ge,tt,rt,Je,dt,st,nt,at,ot,lt,ut,_t,ht,pt,gt,ft,vt];function wt(e){return e instanceof Element&&(e.id===mt||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Et(e){return!!e&&1===e.nodeType}function St(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function xt(e){return!!e&&3===e.nodeType}function kt(e){return!!e&&11===e.nodeType}function Pt(e){return e?E(e).split(/\s+/):[]}function It(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Ct(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 Pt(t)}function Ft(e){return D(e)?null:E(e).split(/(\s+)/).filter((e=>Kt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t="";return Ut(e)&&!zt(e)&&e.childNodes&&e.childNodes.length&&Te(e.childNodes,(function(e){var i;xt(e)&&e.textContent&&(t+=null!==(i=Ft(e.textContent))&&void 0!==i?i:"")})),E(t)}function Tt(e){return L(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var $t=["a","button","form","input","select","textarea","label"];function Lt(e,t){if(L(t))return!0;var i,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Ot(e){var t=e.parentNode;return!(!t||!Et(t))&&t}var Mt=["next","previous","prev",">","<"],At=10;var Dt=[".ph-no-rageclick",".ph-no-capture"];function Nt(e,t){if(!s||qt(e))return!1;var i,r,n;q(t)?(i=!!t&&Dt,r=void 0):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Dt,r=null==t?void 0:t.content_ignorelist);if(!1===i)return!1;var{targetElementList:o}=Ht(e,!1);return!function(e,t){if(!1===e||L(e))return!1;var i;if(!0===e)i=Mt;else{if(!C(e))return!1;if(e.length>At)return Ie.error("[PostHog] content_ignorelist array cannot exceed "+At+" items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return i.some((e=>t.includes(e)||r.includes(e)))}))}(r,o.map((e=>{var t;return{safeText:Rt(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Lt(o,i)}var qt=e=>!e||St(e,"html")||!Et(e),Ht=(e,t)=>{if(!s||qt(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!St(n,"body");)if(kt(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=Ot(n);if(!o)break;if(t||$t.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=s.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:r}};function jt(e,t,i,r,n){var o,a,l,c;if(void 0===i&&(i=void 0),!s||qt(e))return!1;if(null!=(o=i)&&o.url_allowlist&&!It(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&It(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:d,targetElementList:_}=Ht(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(L(i))return!0;var r,s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(_,i))return!1;if(!Lt(_,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var h=s.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return d?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&($t.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}function Ut(e){for(var t=e;t.parentNode&&!St(t,"body");t=t.parentNode){var i=Ct(t);if(w(i,"ph-sensitive")||w(i,"ph-no-capture"))return!1}if(w(Ct(e),"ph-include"))return!0;var r=e.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";if(O(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function zt(e){return!!(St(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||St(e,"select")||St(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Bt="(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})",Vt=new RegExp("^(?:"+Bt+")$"),Wt=new RegExp(Bt),Gt="\\d{3}-?\\d{2}-?\\d{4}",Yt=new RegExp("^("+Gt+")$"),Jt=new RegExp("("+Gt+")");function Kt(e,t){if(void 0===t&&(t=!0),D(e))return!1;if(O(e)){if(e=E(e),(t?Vt:Wt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Yt:Jt).test(e))return!1}return!0}function Xt(e){var t=Rt(e);return Kt(t=(t+" "+Qt(e)).trim())?t:""}function Qt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Te(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Rt(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Qt(e)).trim())}catch(e){Ie.error("[AutoCapture]",e)}})),t}function Zt(e){return function(e){var t=e.map((e=>{var t,r,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))s+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Oe(o).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return a[ei(t.toString())]=ei(i.toString())})),s+=":",s+=Oe(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:ti(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Oe(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function ei(e){return e.replace(/"|\\"/g,'\\"')}function ti(e){var t=e.attr__class;return t?C(t)?t:Pt(t):void 0}class ii{constructor(e){this.disabled=!1===e;var t=R(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&i-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ri="$copy_autocapture",si=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ni=e=>{var t=null==u?void 0:u.createElement("a");return L(t)?null:(t.href=e,t)},oi=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Te(e,(function(e,t){L(e)||L(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)})),s.join(t)},ai=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!C(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Ie.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},li=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var _=c[d].split("=");C(_)&&(t.includes(_[0])?u.push(_[0]+"="+i):u.push(c[d]))}var h=l;return null!=a&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},ci=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ui=Ce("[AutoCapture]");function di(e,t){return t.length>e?t.slice(0,e)+"...":t}function _i(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Et(t));return t}function hi(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};$t.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=di(1024,Xt(e)):n.$el_text=di(1024,Rt(e)));var o=Ct(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),Te(e.attributes,(function(i){var s;if((!zt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&((null==r||!r.includes(i.name))&&!t&&Kt(i.value)&&(s=i.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=i.value;"class"===i.name&&(o=Pt(o).join(" ")),n["attr__"+i.name]=di(1024,o)}}));for(var a=1,l=1,c=e;c=_i(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function pi(e,t){for(var i,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!St(d,"body");)kt(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var _,h=[],p={},g=!1,v=!1;if(Te(u,(e=>{var t=Ut(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&Kt(g)&&g),w(Ct(e),"ph-no-capture")&&(v=!0),h.push(hi(e,o,a,l));var i=function(e){if(!Ut(e))return{};var t={};return Te(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Kt(r)&&(t[i]=r)}})),t}(e);$e(p,i)})),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?h[0].$el_text=Xt(e):h[0].$el_text=Rt(e)),g){var f,m;h[0].attr__href=g;var y=null==(f=ni(g))?void 0:f.host,b=null==s||null==(m=s.location)?void 0:m.host;y&&b&&y!==b&&(_=g)}return{props:$e({$event_type:n.type,$ce_version:1},c?{}:{$elements:h},{$elements_chain:Zt(h)},null!=(i=h[0])&&i.$el_text?{$el_text:null==(r=h[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},p)}}class gi{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new ii(e.config.rageclick),this._elementSelectors=null}get _config(){var e,t,i=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(s&&u){var e=e=>{e=e||(null==s?void 0:s.event);try{this._captureEvent(e)}catch(e){ui.error("Failed to capture event",e)}};if(Ue(u,"submit",e,{capture:!0}),Ue(u,"change",e,{capture:!0}),Ue(u,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==s?void 0:s.event),this._captureEvent(e,ri)};Ue(u,"copy",t,{capture:!0}),Ue(u,"cut",t,{capture:!0})}}}else ui.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[We]:!!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)||t.forEach((t=>{var r=null==u?void 0:u.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[We],r=this._isDisabledServerSide;if(A(r)&&!q(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=Tt(e);if(xt(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&Nt(r,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var n=t===ri;if(r&&jt(r,e,this._config,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=pi(r,{e:e,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),t===ri){var c,u=Ft(null==s||null==(c=s.getSelection())?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return F(null==u?void 0:u.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return N(e)&&isFinite(e)&&Math.floor(e)===e});var vi="0123456789abcdef";class fi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fi(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+vi.charAt(this.bytes[t]>>>4)+vi.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 fi(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 mi{constructor(){this._timestamp=0,this._counter=0,this._random=new wi}generate(){var e=this.generateOrAbort();if(L(e)){this._timestamp=0;var t=this.generateOrAbort();if(L(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 fi.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 yi,bi=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};s&&!L(s.crypto)&&crypto.getRandomValues&&(bi=e=>crypto.getRandomValues(e));class wi{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._cursor>=this._buffer.length&&(bi(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var Ei=()=>Si().toString(),Si=()=>(yi||(yi=new mi)).generate(),xi="";var ki=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Pi(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=u),xi)return xi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+Ei();!xi&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",xi=n)}return xi}(e);if(!i){var r=(e=>{var t=e.match(ki);return t?t[0]:""})(e);r!==i&&Ie.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var Ii={_is_supported:()=>!!u,_error:function(e){Ie.error("cookieStore error: "+e)},_get:function(e){if(u){try{for(var t=e+"=",i=u.cookie.split(";").filter((e=>e.length)),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},_parse:function(e){var t;try{t=JSON.parse(Ii._get(e))||{}}catch(e){}return t},_set:function(e,t,i,r,s){if(u)try{var n="",o="",a=Pi(u.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&Ie.warn("cookieStore warning: large cookie, len="+c.length),u.cookie=c,c}catch(e){return}},_remove:function(e,t){if(null!=u&&u.cookie)try{Ii._set(e,"",-1,t)}catch(e){return}}},Ci=null,Fi={_is_supported:function(){if(!A(Ci))return Ci;var e=!0;if(L(s))e=!1;else try{var t="__mplssupport__";Fi._set(t,"xyz"),'"xyz"'!==Fi._get(t)&&(e=!1),Fi._remove(t)}catch(t){e=!1}return e||Ie.error("localStorage unsupported; falling back to cookie store"),Ci=e,e},_error:function(e){Ie.error("localStorage error: "+e)},_get:function(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){Fi._error(e)}return null},_parse:function(e){try{return JSON.parse(Fi._get(e))||{}}catch(e){}return null},_set:function(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){Fi._error(e)}},_remove:function(e){try{null==s||s.localStorage.removeItem(e)}catch(e){Fi._error(e)}}},Ri=["distinct_id",tt,it,ft,vt],Ti=i({},Fi,{_parse:function(e){try{var t={};try{t=Ii._parse(e)||{}}catch(e){}var i=$e(t,JSON.parse(Fi._get(e)||"{}"));return Fi._set(e,i),i}catch(e){}return null},_set:function(e,t,i,r,s,n){try{Fi._set(e,t,void 0,void 0,n);var o={};Ri.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&Ii._set(e,o,i,r,s,n)}catch(e){Fi._error(e)}},_remove:function(e,t){try{null==s||s.localStorage.removeItem(e),Ii._remove(e,t)}catch(e){Fi._error(e)}}}),$i={},Li={_is_supported:function(){return!0},_error:function(e){Ie.error("memoryStorage error: "+e)},_get:function(e){return $i[e]||null},_parse:function(e){return $i[e]||null},_set:function(e,t){$i[e]=t},_remove:function(e){delete $i[e]}},Oi=null,Mi={_is_supported:function(){if(!A(Oi))return Oi;if(Oi=!0,L(s))Oi=!1;else try{var e="__support__";Mi._set(e,"xyz"),'"xyz"'!==Mi._get(e)&&(Oi=!1),Mi._remove(e)}catch(e){Oi=!1}return Oi},_error:function(e){Ie.error("sessionStorage error: ",e)},_get:function(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){Mi._error(e)}return null},_parse:function(e){try{return JSON.parse(Mi._get(e))||null}catch(e){}return null},_set:function(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Mi._error(e)}},_remove:function(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){Mi._error(e)}}},Ai=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Di{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?Ai.DENIED:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||(this.consent===Ai.DENIED||this.consent===Ai.PENDING&&(this._config.opt_out_capturing_by_default||"on_reject"===this._config.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ai.DENIED}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,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return W(e)?Ai.GRANTED:w(G,e)?Ai.DENIED:Ai.PENDING}get _storage(){if(!this._persistentStore){var e=this._config.opt_out_capturing_persistence_type;this._persistentStore="localStorage"===e?Fi:Ii;var t="localStorage"===e?Ii:Fi;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(W(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&!!je([null==c?void 0:c.doNotTrack,null==c?void 0:c.msDoNotTrack,v.doNotTrack],(e=>W(e)))}}var Ni=Ce("[Dead Clicks]"),qi=()=>!0,Hi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Qe)),r=e.instance.config.capture_dead_clicks;return q(r)?r:!!R(r)||i};class ji{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Qe]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this._loadScript((()=>{this._start()}))}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Ni.error("failed to load script",t):e()}))}_start(){var e;if(u){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(u),Ni.info("starting...")}}else Ni.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Ni.info("stopping..."))}}var Ui=Ce("[ExceptionAutocapture]");class zi{constructor(e){var t,i,r;this._startCapturing=()=>{var e;if(s&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=r(this.captureException.bind(this)))}catch(e){Ui.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[Ye]),this._config=this._requiredConfig(),this._rateLimiter=new J({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,_logger:Ui}),this.startIfEnabled()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(e)?t=i({},t,e):(L(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Ui.info("enabled"),this._loadScript(this._startCapturing))}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Ui.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this._remoteEnabled=!!t||!1,this._config=this._requiredConfig(),this._instance.persistence&&this._instance.persistence.register({[Ye]:this._remoteEnabled}),this.startIfEnabled()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Ui.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Bi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return F(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}class Vi{constructor(e){var t;this._instance=e,this._lastPathname=(null==s||null==(t=s.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ie.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,Ie.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(s&&s.history){var i=this;null!=(e=s.history.pushState)&&e.__posthog_wrapped__||Bi(s.history,"pushState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("pushState")})),null!=(t=s.history.replaceState)&&t.__posthog_wrapped__||Bi(s.history,"replaceState",(e=>function(t,r,s){e.call(this,t,r,s),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._lastPathname=i}catch(t){Ie.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Ue(s,"popstate",e),this._popstateListener=()=>{s&&s.removeEventListener("popstate",e)}}}}var Wi=Ce("[SegmentIntegration]");function Gi(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Ei();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(dt,"identified")),t()},s=i.user();"then"in s&&F(s.then)?s.then((e=>r(e))):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Wi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Wi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Wi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);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()}))}))}var Yi="posthog-js";function Ji(e,t){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,c,u,d,_;if(!("*"===o||o.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(l=t.exception)?void 0:l.values)||[],g=p.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),v={$exception_message:(null==(c=p[0])?void 0:c.value)||t.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=p[0])?void 0:_.type,$sentry_tags:t.tags};return r&&s&&(v.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+t.event_id),a&&e.exceptions.sendExceptionEvent(v),t}}class Ki{constructor(e,t,i,r,s,n){this.name=Yi,this.setupOnce=function(o){o(Ji(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Xi=null!=s&&s.location?ci(s.location.hash,"__posthog")||ci(location.hash,"state"):null,Qi="_postHogToolbarParams",Zi=Ce("[Toolbar]"),er=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(er||{});class tr{constructor(e){this.instance=e}_setToolbarState(e){v.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=v.ph_toolbar_state)&&void 0!==e?e:er.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!s||!u)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=Xi||ci(e.hash,"__posthog")||ci(e.hash,"state"),o=n?Me((()=>JSON.parse(atob(decodeURIComponent(n)))))||Me((()=>JSON.parse(decodeURIComponent(n)))):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(Qi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}_callLoadToolbar(e){var t=v.ph_load_toolbar||v.ph_load_editor;!D(t)&&F(t)?t(e,this.instance):Zi.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==u||!u.getElementById(mt));if(!s||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(s.localStorage.setItem(Qi,JSON.stringify(i({},n,{source:void 0}))),this._getToolbarState()===er.LOADED)this._callLoadToolbar(n);else if(this._getToolbarState()===er.UNINITIALIZED){var o;this._setToolbarState(er.LOADING),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return Zi.error("[Toolbar] Failed to load",e),void this._setToolbarState(er.UNINITIALIZED);this._setToolbarState(er.LOADED),this._callLoadToolbar(n)})),Ue(s,"turbolinks:load",(()=>{this._setToolbarState(er.UNINITIALIZED),this.loadToolbar(n)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var ir=Ce("[TracingHeaders]");class rr{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t;L(this._restoreXHRPatch)&&(null==(e=v.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));L(this._restoreFetchPatch)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return ir.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var sr="Mobile",nr="iOS",or="Android",ar="Tablet",lr=or+" "+ar,cr="iPad",ur="Apple",dr=ur+" Watch",_r="Safari",hr="BlackBerry",pr="Samsung",gr=pr+"Browser",vr=pr+" Internet",fr="Chrome",mr=fr+" OS",yr=fr+" "+nr,br="Internet Explorer",wr=br+" "+sr,Er="Opera",Sr=Er+" Mini",xr="Edge",kr="Microsoft "+xr,Pr="Firefox",Ir=Pr+" "+nr,Cr="Nintendo",Fr="PlayStation",Rr="Xbox",Tr=or+" "+sr,$r=sr+" "+_r,Lr="Windows",Or=Lr+" Phone",Mr="Nokia",Ar="Ouya",Dr="Generic",Nr=Dr+" "+sr.toLowerCase(),qr=Dr+" "+ar.toLowerCase(),Hr="Konqueror",jr="(\\d+(\\.\\d+)?)",Ur=new RegExp("Version/"+jr),zr=new RegExp(Rr,"i"),Br=new RegExp(Fr+" \\w+","i"),Vr=new RegExp(Cr+" \\w+","i"),Wr=new RegExp(hr+"|PlayBook|BB10","i"),Gr={"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 Yr=(e,t)=>t&&w(t,ur)||function(e){return w(e,_r)&&!w(e,fr)&&!w(e,or)}(e),Jr=function(e,t){return t=t||"",w(e," OPR/")&&w(e,"Mini")?Sr:w(e," OPR/")?Er:Wr.test(e)?hr:w(e,"IE"+sr)||w(e,"WPDesktop")?wr:w(e,gr)?vr:w(e,xr)||w(e,"Edg/")?kr:w(e,"FBIOS")?"Facebook "+sr:w(e,"UCWEB")||w(e,"UCBrowser")?"UC Browser":w(e,"CriOS")?yr:w(e,"CrMo")||w(e,fr)?fr:w(e,or)&&w(e,_r)?Tr:w(e,"FxiOS")?Ir:w(e.toLowerCase(),Hr.toLowerCase())?Hr:Yr(e,t)?w(e,sr)?$r:_r:w(e,Pr)?Pr:w(e,"MSIE")||w(e,"Trident/")?br:w(e,"Gecko")?Pr:""},Kr={[wr]:[new RegExp("rv:"+jr)],[kr]:[new RegExp(xr+"?\\/"+jr)],[fr]:[new RegExp("("+fr+"|CrMo)\\/"+jr)],[yr]:[new RegExp("CriOS\\/"+jr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+jr)],[_r]:[Ur],[$r]:[Ur],[Er]:[new RegExp("(Opera|OPR)\\/"+jr)],[Pr]:[new RegExp(Pr+"\\/"+jr)],[Ir]:[new RegExp("FxiOS\\/"+jr)],[Hr]:[new RegExp("Konqueror[:/]?"+jr,"i")],[hr]:[new RegExp(hr+" "+jr),Ur],[Tr]:[new RegExp("android\\s"+jr,"i")],[vr]:[new RegExp(gr+"\\/"+jr)],[br]:[new RegExp("(rv:|MSIE )"+jr)],Mozilla:[new RegExp("rv:"+jr)]},Xr=function(e,t){var i=Jr(e,t),r=Kr[i];if(L(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},Qr=[[new RegExp(Rr+"; "+Rr+" (.*?)[);]","i"),e=>[Rr,e&&e[1]||""]],[new RegExp(Cr,"i"),[Cr,""]],[new RegExp(Fr,"i"),[Fr,""]],[Wr,[hr,""]],[new RegExp(Lr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Or,""];if(new RegExp(sr).test(t)&&!/IEMobile\b/.test(t))return[Lr+" "+sr,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=Gr[r]||"";return/arm/i.test(t)&&(s="RT"),[Lr,s]}return[Lr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[nr,t.join(".")]}return[nr,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=L(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+or+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+or+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[or,t.join(".")]}return[or,""]}],[/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/,[mr,""]],[/Linux|debian/i,["Linux",""]]],Zr=function(e){return Vr.test(e)?Cr:Br.test(e)?Fr:zr.test(e)?Rr:new RegExp(Ar,"i").test(e)?Ar:new RegExp("("+Or+"|WPDesktop)","i").test(e)?Or:/iPad/.test(e)?cr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?dr:Wr.test(e)?hr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Mr,"i").test(e)?Mr:/(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(sr).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)?or:lr:or:new RegExp("(pda|"+sr+")","i").test(e)?Nr:new RegExp(ar,"i").test(e)&&!new RegExp(ar+" pc","i").test(e)?qr:""},es="https?://(.*)",ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],is=Le(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ts),rs="<masked>",ss=["li_fat_id"];function ns(e,t,i){if(!u)return{};var r,s=t?Le([],ts,i||[]):[],n=os(li(u.URL,s,rs),e),o=(r={},Te(ss,(function(e){var t=Ii._get(e);r[e]=t||null})),r);return $e(o,n)}function os(e,t){var i=is.concat(t||[]),r={};return Te(i,(function(t){var i=ai(e,t);r[t]=i||null})),r}function as(e){var t=function(e){return e?0===e.search(es+"google.([^/?]*)")?"google":0===e.search(es+"bing.com")?"bing":0===e.search(es+"yahoo.com")?"yahoo":0===e.search(es+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!A(t)){r.$search_engine=t;var s=u?ai(u.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function ls(){return navigator.language||navigator.userLanguage}function cs(){return(null==u?void 0:u.referrer)||"$direct"}function us(e,t){var i=e?Le([],ts,t||[]):[],r=null==d?void 0:d.href.substring(0,1e3);return{r:cs().substring(0,1e3),u:r?li(r,i,rs):void 0}}function ds(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=ni(i))?void 0:t.host};if(r){s.$current_url=r;var n=ni(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=os(r);$e(s,o)}if(i){var a=as(i);$e(s,a)}return s}function _s(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function hs(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function ps(e,t){if(!g)return{};var i,r,n,o=e?Le([],ts,t||[]):[],[a,l]=function(e){for(var t=0;t<Qr.length;t++){var[i,r]=Qr[t],s=i.exec(e),n=s&&(F(r)?r(s,e):r);if(n)return n}return["",""]}(g);return $e(De({$os:a,$os_version:l,$browser:Jr(g,navigator.vendor),$device:Zr(g),$device_type:(r=g,n=Zr(r),n===cr||n===lr||"Kobo"===n||"Kindle Fire"===n||n===qr?ar:n===Cr||n===Rr||n===Fr||n===Ar?"Console":n===dr?"Wearable":n?sr:"Desktop"),$timezone:_s(),$timezone_offset:hs()}),{$current_url:li(null==d?void 0:d.href,o,rs),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:Xr(g,navigator.vendor),$browser_language:ls(),$browser_language_prefix:(i=ls(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var gs=Ce("[Web Vitals]"),vs=9e5;class fs{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t,r=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(L(r))gs.error("Could not read session ID. Dropping metrics!");else{this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();if(!L(s))if(D(null==e?void 0:e.name)||D(null==e?void 0:e.value))gs.error("Invalid metric received",e);else if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)gs.error("Ignoring metric with value >= "+this._maxAllowedValue,e);else this._buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),L(this._buffer.url)&&(this._buffer.url=s),this._buffer.firstMetricTimestamp=L(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this._buffer.metrics.push(i({},e,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}},this._startCapturing=()=>{var e,t,i,r,s=v.__PosthogExtensions__;L(s)||L(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(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&&r(this._addToBuffer.bind(this)),this._initialized=!0):gs.error("web vitals callbacks not loaded - not starting")},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Xe]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=R(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?(null==(t=this._instance.persistence)?void 0:t.props[Ze])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=R(this._instance.config.capture_performance)&&N(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:vs;return 0<e&&e<=6e4?vs:e}get isEnabled(){var e=null==d?void 0:d.protocol;if("http:"!==e&&"https:"!==e)return gs.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:q(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return q(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(gs.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){var t=R(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=R(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xe]:t}),this._instance.persistence.register({[Ze]:i})),this._enabledServerSide=t,this.startIfEnabled()}_loadScript(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",(t=>{t?gs.error("failed to load script",t):e()}))}_currentURL(){var e=s?s.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,r=t?Le([],ts,i||[]):[];return li(e,r,rs)}gs.error("Could not determine current URL")}}var ms=Ce("[Heatmaps]");function ys(e){return R(e)&&"clientX"in e&&"clientY"in e&&N(e.clientX)&&N(e.clientY)}class bs{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[Ge]),this.rageclicks=new ii(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return R(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 L(this.instance.config.capture_heatmaps)?L(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;ms.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ge]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(u)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){s&&u&&(this._flushHandler=this._flush.bind(this),Ue(s,"beforeunload",this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==s?void 0:s.event)),Ue(u,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==s?void 0:s.event)),Ue(u,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new ji(this.instance,qi,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabled(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Ue(u,"visibilitychange",this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;s&&u&&(this._flushHandler&&s.removeEventListener("beforeunload",this._flushHandler),this._onClickHandler&&u.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&u.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&u.removeEventListener("visibilitychange",this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&Et(r)&&!St(r,"body");){if(r===i)return!1;if(w(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=Ot(r)}return!1}(Tt(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!wt(e.target)&&ys(e)){var s=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},s,{type:"rageclick"})),this._capture(s)}}_onMouseMove(e){!wt(e.target)&&ys(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(s){var t=s.location.href,i=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,n=i?Le([],ts,r||[]):[],o=li(t,n,rs);this._buffer=this._buffer||{},this._buffer[o]||(this._buffer[o]=[]),this._buffer[o].push(e)}}_flush(){this._buffer&&!T(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class ws{constructor(e){this._instance=e}doPageView(e,t){var i,r=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==s?void 0:s.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(L(n)||L(o)||L(a)||L(l)||L(c)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var d=n<=1?1:Y(o/n,0,1,Ie),_=n<=1?1:Y(a/n,0,1,Ie),h=l<=1?1:Y(c/l,0,1,Ie),p=l<=1?1:Y(u/l,0,1,Ie);r=$e(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var Es=Uint8Array,Ss=Uint16Array,xs=Uint32Array,ks=new Es([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]),Ps=new Es([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]),Is=new Es([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 Ss(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new xs(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},Fs=Cs(ks,2),Rs=Fs[0],Ts=Fs[1];Rs[28]=258,Ts[258]=28;for(var $s=Cs(Ps,0)[1],Ls=new Ss(32768),Os=0;Os<32768;++Os){var Ms=(43690&Os)>>>1|(21845&Os)<<1;Ms=(61680&(Ms=(52428&Ms)>>>2|(13107&Ms)<<2))>>>4|(3855&Ms)<<4,Ls[Os]=((65280&Ms)>>>8|(255&Ms)<<8)>>>1}var As=function(e,t,i){for(var r=e.length,s=0,n=new Ss(t);s<r;++s)++n[e[s]-1];var o,a=new Ss(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Ss(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,_=d|(1<<u)-1;d<=_;++d)o[Ls[d]>>>l]=c}else for(o=new Ss(r),s=0;s<r;++s)o[s]=Ls[a[e[s]-1]++]>>>15-e[s];return o},Ds=new Es(288);for(Os=0;Os<144;++Os)Ds[Os]=8;for(Os=144;Os<256;++Os)Ds[Os]=9;for(Os=256;Os<280;++Os)Ds[Os]=7;for(Os=280;Os<288;++Os)Ds[Os]=8;var Ns=new Es(32);for(Os=0;Os<32;++Os)Ns[Os]=5;var qs=As(Ds,9,0),Hs=As(Ns,5,0),js=function(e){return(e/8>>0)+(7&e&&1)},Us=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof Ss?Ss:e instanceof xs?xs:Es)(i-t);return r.set(e.subarray(t,i)),r},zs=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8},Bs=function(e,t,i){i<<=7&t;var r=t/8>>0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Vs=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new Es(0),0];if(1==s){var o=new Es(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!=s-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 _=n[0].s;for(r=1;r<s;++r)n[r].s>_&&(_=n[r].s);var h=new Ss(_+1),p=Ws(i[u-1],h,0);if(p>t){r=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r<s;++r){var m=n[r].s;if(!(h[m]>t))break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[r].s;h[y]<t?g-=1<<t-h[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;h[b]==t&&(--h[b],++g)}p=t}return[new Es(h),p]},Ws=function(e,t,i){return-1==e.s?Math.max(Ws(e.l,t,i+1),Ws(e.r,t,i+1)):t[e.s]=i},Gs=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Ss(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Ys=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Js=function(e,t,i){var r=i.length,s=js(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Ks=function(e,t,i,r,s,n,o,a,l,c,u){zs(t,u++,i),++s[256];for(var d=Vs(s,15),_=d[0],h=d[1],p=Vs(n,15),g=p[0],v=p[1],f=Gs(_),m=f[0],y=f[1],b=Gs(g),w=b[0],E=b[1],S=new Ss(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<w.length;++x)S[31&w[x]]++;for(var k=Vs(S,7),P=k[0],I=k[1],C=19;C>4&&!P[Is[C-1]];--C);var F,R,T,L,O=c+5<<3,M=Ys(s,Ds)+Ys(n,Ns)+o,A=Ys(s,_)+Ys(n,g)+o+14+3*C+Ys(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O<=M&&O<=A)return Js(t,u,e.subarray(l,l+c));if(zs(t,u,1+(A<M)),u+=2,A<M){F=As(_,h,0),R=_,T=As(g,v,0),L=g;var D=As(P,I,0);zs(t,u,y-257),zs(t,u+5,E-1),zs(t,u+10,C-4),u+=14;for(x=0;x<C;++x)zs(t,u+3*x,P[Is[x]]);u+=3*C;for(var N=[m,w],q=0;q<2;++q){var H=N[q];for(x=0;x<H.length;++x){var j=31&H[x];zs(t,u,D[j]),u+=P[j],j>15&&(zs(t,u,H[x]>>>5&127),u+=H[x]>>>12)}}}else F=qs,R=Ds,T=Hs,L=Ns;for(x=0;x<a;++x)if(r[x]>255){j=r[x]>>>18&31;Bs(t,u,F[j+257]),u+=R[j+257],j>7&&(zs(t,u,r[x]>>>23&31),u+=ks[j]);var U=31&r[x];Bs(t,u,T[U]),u+=L[U],U>3&&(Bs(t,u,r[x]>>>5&8191),u+=Ps[U])}else Bs(t,u,F[r[x]]),u+=R[r[x]];return Bs(t,u,F[256]),u+R[256]},Xs=new xs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qs=function(){for(var e=new xs(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Zs=function(e,t,i,r,s){return function(e,t,i,r,s,n){var o=e.length,a=new Es(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?c=Js(l,c,e.subarray(u,d)):(l[u]=n,c=Js(l,c,e.subarray(u,o)))}else{for(var _=Xs[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new Ss(32768),f=new Ss(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 xs(25e3),E=new Ss(288),S=new Ss(32),x=0,k=0,P=(u=0,0),I=0,C=0;u<o;++u){var F=b(u),R=32767&u,T=f[F];if(v[R]=T,f[F]=R,I<=u){var L=o-u;if((x>7e3||P>24576)&&L>423){c=Ks(e,l,0,w,E,S,k,P,C,u-C,c),P=x=k=0,C=u;for(var O=0;O<286;++O)E[O]=0;for(O=0;O<30;++O)S[O]=0}var M=2,A=0,D=p,N=R-T&32767;if(L>2&&F==b(u-N))for(var q=Math.min(h,L)-1,H=Math.min(32767,u),j=Math.min(258,L);N<=H&&--D&&R!=T;){if(e[u+M]==e[u+M-N]){for(var U=0;U<j&&e[u+U]==e[u+U-N];++U);if(U>M){if(M=U,A=N,U>q)break;var z=Math.min(N,U-2),B=0;for(O=0;O<z;++O){var V=u-N+O+32768&32767,W=V-v[V]+32768&32767;W>B&&(B=W,T=V)}}}N+=(R=T)-(T=v[R])+32768&32767}if(A){w[P++]=268435456|Ts[M]<<18|$s[A];var G=31&Ts[M],Y=31&$s[A];k+=ks[G]+Ps[Y],++E[257+G],++S[Y],I=u+M,++x}else w[P++]=e[u],++E[e[u]]}}c=Ks(e,l,n,w,E,S,k,P,C,u-C,c)}return Us(a,0,r+js(c)+s)}(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,r,!0)},en=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function tn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Qs[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=Zs(e,t,10+((s=t).filename&&s.filename.length+1||0),8),o=n.length;return 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&&en(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),en(n,o-8,i.d()),en(n,o-4,r),n}var rn=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),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),A(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n},sn=!!h||!!_,nn="text/plain",on=function(e,t,r){var s;void 0===r&&(r=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(s=null==o?void 0:o.split("&").map((e=>{var t,[i,s]=e.split("="),n=r&&null!==(t=a[i])&&void 0!==t?t:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],c=oi(a);return c&&l.push(c),n+"?"+l.join("&")},an=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),ln=e=>{var{data:t,compression:i}=e;if(t){if(i===si.GZipJS){var r=tn(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Es(e.length+(e.length>>>1)),s=0,n=function(e){r[s++]=e},o=0;o<i;++o){if(s+5>r.length){var a=new Es(s+8+(i-o<<1));a.set(r),r=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 Us(r,0,s)}(an(t)),{mtime:0}),s=new Blob([r],{type:nn});return{contentType:nn,body:s,estimatedSize:s.size}}if(i===si.Base64){var n=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=rn(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(an(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:an(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=an(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},cn=[];_&&cn.push({transport:"fetch",method:e=>{var t,r,{contentType:s,body:n,estimatedSize:o}=null!==(t=ln(e))&&void 0!==t?t:{},a=new Headers;Te(e.headers,(function(e,t){a.append(t,e)})),s&&a.append("Content-Type",s);var l=e.url,c=null;if(p){var u=new p;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}_(l,i({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&(o||0)<52428.8,body:n,signal:null==(r=c)?void 0:r.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Ie.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{Ie.error(t),null==e.callback||e.callback({statusCode:0,text:t})})).finally((()=>c?clearTimeout(c.timeout):null))}}),h&&cn.push({transport:"XHR",method:e=>{var t,i=new h;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=ln(e))&&void 0!==t?t:{};Te(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=c&&c.sendBeacon&&cn.push({transport:"sendBeacon",method:e=>{var t=on(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=ln(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;c.sendBeacon(t,n)}catch(e){}}});var un=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function dn(e,t,i){return an({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var _n={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>un(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!un(t,e))))),icontains:(e,t)=>t.map(hn).some((t=>e.map(hn).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(hn).every((t=>e.map(hn).every((e=>!t.includes(e)))))},hn=e=>e.toLowerCase();function pn(e,t){return!e||Object.entries(e).every((e=>{var[i,r]=e,s=null==t?void 0:t[i];if(L(s)||A(s))return!1;var n=[String(s)],o=_n[r.operator];return!!o&&o(r.values,n)}))}var gn=Ce("[Error tracking]");class vn{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=new te([new ge,new ke,new fe,new ve,new Se,new Ee,new ye,new xe],pe("web:javascript",le,de)),this._instance=e,this._suppressionRules=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Je))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[Je]:this._suppressionRules,[Ke]:n})}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Ke),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return void gn.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return void gn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return void gn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:r}=t;return O(i)&&i.length>0&&e.$exception_types.push(i),O(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,r=_n[e.operator],s=C(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}_isExceptionList(e){return!D(e)&&C(e)}}var fn=Ce("[FeatureFlags]"),mn=Ce("[FeatureFlags]",{debugEnabled:!0}),yn="$active_feature_flags",bn="$override_feature_flags",wn="$feature_flag_payloads",En="$override_feature_flag_payloads",Sn="$feature_flag_request_id",xn="$feature_flag_evaluated_at",kn=e=>{var t={};for(var[i,r]of Oe(e||{}))r&&(t[i]=r);return t},Pn=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):fn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},In=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class Cn{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsCalled=!1,this._flagsLoadedFromRemote=!1,this._instance=e,this.featureFlagEventHandlers=[]}_getValidEvaluationEnvironments(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||fn.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}flags(){if(this._instance.config.__preview_remote_config)this._flagsCalled=!0;else{var e=!this._reloadDebouncer&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this._callFlagsEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(nt),t=this._instance.get_property(bn),r=this._instance.get_property(En);if(!r&&!t)return e||{};var s=$e({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of n){var a,l,c=s[o],u=null==t?void 0:t[o],d=L(u)?null!==(a=null==c?void 0:c.enabled)&&void 0!==a&&a:!!u,_=L(u)?c.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[o],p=i({},c,{enabled:d,variant:d?null!=_?_:null==c?void 0:c.variant:void 0});if(d!==(null==c?void 0:c.enabled)&&(p.original_enabled=null==c?void 0:c.enabled),_!==(null==c?void 0:c.variant)&&(p.original_variant=null==c?void 0:c.variant),h)p.metadata=i({},null==c?void 0:c.metadata,{payload:h,original_payload:null==c||null==(l=c.metadata)?void 0:l.payload});s[o]=p}return this._override_warning||(fn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var e=this._instance.get_property(rt),t=this._instance.get_property(bn);if(!t)return e||{};for(var i=$e({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(fn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._instance.get_property(wn),t=this._instance.get_property(En);if(!t)return e||{};for(var i=$e({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this._override_warning||(fn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ot)||{}),group_properties:this._instance.get_property(at)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_environments=this._getValidEvaluationEnvironments());var s=this._instance.config.__preview_remote_config,n=s?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("flags",n+o);s&&(r.timezone=_s()),this._requestInFlight=!0,this._instance._send_request({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s=!0;(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),s=!1),this._requestInFlight=!1,this._flagsCalled)||(this._flagsCalled=!0,this._instance._onRemoteConfig(null!==(i=e.json)&&void 0!==i?i:{}));if(!r.disable_flags||this._additionalReloadRequested)if(this._flagsLoadedFromRemote=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(In.FeatureFlags))fn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;if(!r.disable_flags)this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},s);this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(Sn)||void 0,n=this._instance.get_property(xn)||void 0,o=this._instance.get_property(ut)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var a,l,c,u,d,_,h,p,g;C(o[e])?o[e].push(r):o[e]=[r],null==(a=this._instance.persistence)||a.register({[ut]:o});var v=this.getFeatureFlagDetails(e),f={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(c=c.featureFlagPayloads)?void 0:c[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};L(null==v||null==(u=v.metadata)?void 0:u.version)||(f.$feature_flag_version=v.metadata.version);var m,y=null!==(d=null==v||null==(_=v.reason)?void 0:_.description)&&void 0!==d?d:null==v||null==(h=v.reason)?void 0:h.code;if(y&&(f.$feature_flag_reason=y),null!=v&&null!=(p=v.metadata)&&p.id&&(f.$feature_flag_id=v.metadata.id),L(null==v?void 0:v.original_variant)&&L(null==v?void 0:v.original_enabled)||(f.$feature_flag_original_response=L(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(g=v.metadata)&&g.original_payload)f.$feature_flag_original_payload=null==v||null==(m=v.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",f)}return i}fn.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(r.evaluation_environments=this._getValidEvaluationEnvironments()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return L(i)?void 0:!!i}fn.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._hasLoadedFlags=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,r,s,n){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=Pn(e),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(l){var u=e.requestId,d=e.evaluatedAt;if(C(l)){fn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(l)for(var h=0;h<l.length;h++)_[l[h]]=!0;t&&t.register({[yn]:l,[rt]:_})}else{var p=l,g=c,v=a;e.errorsWhileComputingFlags&&(p=i({},r,p),g=i({},s,g),v=i({},n,v)),t&&t.register(i({[yn]:Object.keys(kn(p)),[rt]:p||{},[wn]:g||{},[nt]:v||{}},u?{[Sn]:u}:{},d?{[xn]:d}:{}))}}}(e,this._instance.persistence,r,s,n),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),fn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return fn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(bn),this._instance.persistence.unregister(En),this._fireFeatureFlagsCallbacks(),mn.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(bn),mn.info("Flag overrides cleared");else if(i.flags){if(C(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[bn]:r})}else this._instance.persistence.register({[bn]:i.flags});mn.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._instance.persistence.unregister(En),mn.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[En]:i.payloads}),mn.info("Payload overrides set",{payloads:i.payloads}))),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var s,n=(this._instance.get_property(st)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(s=this._instance.persistence)||s.register({[yn]:Object.keys(kn(l)),[rt]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(st),s=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(st),null==(r=this._instance.persistence)||r.register({[st]: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((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._instance.get_property(ot)||{};this._instance.register({[ot]:i({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ot)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._instance.get_property(at)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((t=>{r[t]=i({},r[t],e[t]),delete e[t]})),this._instance.register({[at]:i({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(at)||{};this._instance.register({[at]:i({},t,{[e]:{}})})}else this._instance.unregister(at)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsCalled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}var Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Rn{constructor(e,t){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&&Ie.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Fn.indexOf(e.persistence.toLowerCase())&&(Ie.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Fi._is_supported()?Fi:"localstorage+cookie"===t&&Ti._is_supported()?Ti:"sessionstorage"===t&&Mi._is_supported()?Mi:"memory"===t?Li:"cookie"===t?Ii:Ti._is_supported()?Ti:Ii}properties(){var e={};return Te(this.props,(function(t,i){if(i===rt&&R(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else o=i,a=!1,(A(n=bt)?a:l&&n.indexOf===l?-1!=n.indexOf(o):(Te(n,(function(e){if(a||(a=e===o))return Fe})),a))||(e[i]=t);var n,o,a})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=$e({},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(R(e)){L(t)&&(t="None"),this._expire_days=L(i)?this._default_expiry:i;var r=!1;if(Te(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(R(e)){this._expire_days=L(t)?this._default_expiry:t;var i=!1;if(Te(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=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=ns(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);T(De(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==u?void 0:u.referrer)?as(e):{})}update_referrer_info(){var e;this.register_once({$referrer:cs(),$referring_domain:null!=u&&u.referrer&&(null==(e=ni(u.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[pt]||this.props[gt]||this.register_once({[vt]:us(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Te([gt,pt],(t=>{var i=this.props[t];i&&Te(i,(function(t,i){e["$initial_"+S(i)]=t}))}));var t,i,r=this.props[vt];if(r){var s=(t=ds(r),i={},Te(t,(function(e,t){i["$initial_"+S(t)]=e})),i);$e(e,s)}return e}safe_merge(e){return Te(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this._buildStorage(e),s=this.props;this.clear(),this._storage=r,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())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ve]||{};i[e]=t,this.props[Ve]=i,this.save()}remove_event_timer(e){var t=(this.props[Ve]||{})[e];return L(t)||(delete this.props[Ve][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var Tn=function(e){return e.Activation="events",e.Cancellation="cancelEvents",e}({}),$n=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({}),Ln=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),On=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),Mn=function(e){return e.Popover="popover",e.Inline="inline",e}({});class An{constructor(){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 r of this._events["*"]||[])r(e,t)}}function Dn(e,t,i){if(D(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Nn{constructor(e){this._debugEventEmitter=new An,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),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(!L(null==(e=this._instance)?void 0:e._addCaptureHook)){var t;null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,i;if(!L(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}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.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,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Dn(r,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&(!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t))}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Dn(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Dn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var r=this._getElementsList(e);if(r.length>0)return r.some((e=>Dn(e.text,t.text,t.text_matching||"exact")||Dn(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!D(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some((e=>Dn(e,n,o))))}_checkStepSelector(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||pn(t.properties.reduce(((e,t)=>{var i=C(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}var qn=Ce("[Surveys]");var Hn="seenSurvey_",jn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Un=e=>{var t=""+Hn+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+Hn+e.id+"_"+e.current_iteration),t},zn=[$n.Popover,$n.Widget,$n.API],Bn={ignoreConditions:!1,ignoreDelay:!1,displayType:Mn.Popover};class Vn{constructor(e){this._instance=e,this._eventToSurveys=new Map,this._cancelEventToSurveys=new Map,this._actionToSurveys=new Map}_doesEventMatchFilter(e,t){return!!e&&pn(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToSurveyMap(e,t){var i=new Map;return e.forEach((e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach((t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}}))})),i}_getMatchingSurveys(e,t,i){var r,s=(i===Tn.Activation?this._eventToSurveys:this._cancelEventToSurveys).get(e),n=[];return null==(r=this._instance)||r.getSurveys((e=>{n=e.filter((e=>null==s?void 0:s.includes(e.id)))})),n.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,t)}))}register(e){var t;L(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedSurveys(e),this._setupActionBasedSurveys(e))}_setupActionBasedSurveys(e){var t=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));if(0!==t.length){if(null==this._actionMatcher){this._actionMatcher=new Nn(this._instance),this._actionMatcher.init();this._actionMatcher._addActionHook((e=>{this.onAction(e)}))}t.forEach((e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this._actionMatcher)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((t=>{if(t&&t.name){var i=this._actionToSurveys.get(t.name);i&&i.push(e.id),this._actionToSurveys.set(t.name,i||[e.id])}})))}))}}_setupEventBasedSurveys(e){var t,i=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));if(0!==i.length||0!==r.length){null==(t=this._instance)||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._eventToSurveys=this._buildEventToSurveyMap(e,Tn.Activation),this._cancelEventToSurveys=this._buildEventToSurveyMap(e,Tn.Cancellation)}}onEvent(e,t){var i,r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[ct])||[];if(Ln.SHOWN===e&&t&&r.length>0){var s;qn.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var n=null==t||null==(s=t.properties)?void 0:s.$survey_id;if(n){var o=r.indexOf(n);o>=0&&(r.splice(o,1),this._updateActivatedSurveys(r))}}else{if(this._cancelEventToSurveys.has(e)){var a=this._getMatchingSurveys(e,t,Tn.Cancellation);a.length>0&&(qn.info("cancel event matched, cancelling surveys",{event:e,surveysToCancel:a.map((e=>e.id))}),a.forEach((e=>{var t,i=r.indexOf(e.id);i>=0&&r.splice(i,1),null==(t=this._instance)||t.cancelPendingSurvey(e.id)})),this._updateActivatedSurveys(r))}if(this._eventToSurveys.has(e)){qn.info("survey event name matched",{event:e,eventPayload:t,surveys:this._eventToSurveys.get(e)});var l=this._getMatchingSurveys(e,t,Tn.Activation);this._updateActivatedSurveys(r.concat(l.map((e=>e.id))||[]))}}}onAction(e){var t,i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[ct])||[];this._actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this._actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t;qn.info("updating activated surveys",{activatedSurveys:e}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[ct]:[...new Set(e)]})}getSurveys(){var e,t=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[ct];return t||[]}getEventToSurveys(){return this._eventToSurveys}_getActionMatcher(){return this._actionMatcher}}class Wn{constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isFetchingSurveys=!1,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(D(t))return qn.warn("Flags not loaded yet. Not loading surveys.");var i=C(t);this._isSurveysEnabled=i?t.length>0:t,qn.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(Hn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)qn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)qn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())qn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==v?void 0:v.__PosthogExtensions__;if(e){if(!L(this._isSurveysEnabled)||this._instance.config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._instance.config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var r=e.loadExternalDependency;if(!r)return void this._handleSurveyLoadError("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else qn.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Vn(this._instance),qn.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){qn.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return qn.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(lt);if(i&&!t)return e(i,{isLoaded:!0});if(this._isFetchingSurveys)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this._isFetchingSurveys=!1;var r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: "+r;return qn.error(s),e([],{isLoaded:!1,error:s})}var n,o=t.json.surveys||[],a=o.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(i=this._instance.persistence)||i.register({[lt]:o}),e(o,{isLoaded:!0})}})}catch(e){throw this._isFetchingSurveys=!1,e}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){qn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qn.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}_checkSurveyEligibility(e){if(D(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(D(this._surveyManager))return qn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return D(this._surveyManager)?(qn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((t=>{var r,s=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(s){var n=this._checkSurveyEligibility(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){var i;if(D(this._surveyManager))qn.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(zn.includes(r.type)){var s=null==u?void 0:u.querySelector(t);if(s)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(qn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;qn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,s),qn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);qn.warn("Survey element not found")}else qn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else qn.warn("Survey not found")}}displaySurvey(e,t){var r;if(D(this._surveyManager))qn.warn("init was not called");else{var s=this._getSurveyById(e);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void qn.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Mn.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else qn.warn("Survey not found")}}cancelPendingSurvey(e){D(this._surveyManager)?qn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}}var Gn=Ce("[RateLimiter]");class Yn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Gn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Gn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(ht))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||e||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||e||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==(r=this.instance.persistence)||r.set_property(ht,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Jn=Ce("[RemoteConfig]");class Kn{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Jn.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Jn.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Jn.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Jn.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e)}));this._onRemoteConfig(e)}))}catch(e){Jn.error("Error loading remote config",e)}}_onRemoteConfig(e){e?this._instance.config.__preview_remote_config?(this._instance._onRemoteConfig(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Jn.info("__preview_remote_config is disabled. Logging config instead",e):Jn.error("Failed to fetch remote config from PostHog.")}}var Xn=3e3;class Qn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Y((null==t?void 0:t.flush_interval_ms)||Xn,250,5e3,Ie.createLogger("flush interval"),Xn),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);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},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(){var i=t[r],s=(new Date).getTime();i.data&&C(i.data)&&Te(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequest(i)};for(var r in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Te(this._queue,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;L(e[n])&&(e[n]=i({},s,{data:[]})),null==(r=e[n].data)||r.push(s.data)})),this._queue=[],e}}var Zn=["retriesPerformedSoFar"];class eo{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!L(s)&&"onLine"in s.navigator&&(this._areWeOnline=s.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Ue(s,"online",this._onlineListener),Ue(s,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=r(e,Zn);N(t)&&t>0&&(s.url=on(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this._enqueue(i({retriesPerformedSoFar:t},s)):null==s.callback||s.callback(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,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this._queue.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ie.warn(s),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);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:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,L(s)||(this._onlineListener&&(s.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(s.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Ie.error(e)}this._queue=[]}}class to{constructor(e){this._updateScrollData=()=>{var e,t,i,r;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._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!==(r=this._context.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Ue(s,"scroll",this._updateScrollData,{capture:!0}),Ue(s,"scrollend",this._updateScrollData,{capture:!0}),Ue(s,"resize",this._updateScrollData)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==s?void 0:s.document.documentElement;var e=C(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==s?void 0:s.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var io=e=>us(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ro{constructor(e,t,i,r){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[_t]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=r||io,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[_t]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?ds(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Te(De(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+S(i)]=t})),e}}var so=Ce("[SessionId]");class no{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var r;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new An,this._sessionHasBeenIdleTooLong=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Ei,this._windowIdGenerator=i||Ei;var s=this._config.persistence_name||this._config.token,n=this._config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Y(n,60,36e3,so.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=Mi._parse(this._window_id_storage_key),a=Mi._parse(this._primary_window_exists_storage_key);o&&!a?this._windowId=o:Mi._remove(this._window_id_storage_key),Mi._set(this._primary_window_exists_storage_key,!0)}if(null!=(r=this._config.bootstrap)&&r.sessionID)try{var l=(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(),l)}catch(e){so.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return L(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&&Mi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Mi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Mi._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({[tt]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[tt];return C(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&s&&(s.removeEventListener("beforeunload",this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&Mi._remove(this._primary_window_exists_storage_key)},Ue(s,"beforeunload",this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this._getSessionId(),o=this._getWindowId(),a=N(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!c&&!e&&this._sessionHasBeenIdleTooLong(i,r);c||u||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),so.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=0===r||!e||a?i:r,_=0===n?(new Date).getTime():n;return this._setWindowId(o),this._setSessionId(s,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var oo=["$set_once","$set"],ao=Ce("[SiteApps]");class lo{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,s,n,o,a,l,c;if(!e)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))u[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},r(e,oo),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(s=e.properties)?void 0:s.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(c=e.properties)?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;(!t.errored&&this._bufferedInvocations.length&&(ao.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored)))&&(null==(i=this._stopBuffering)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,ao.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(t){ao.error("Error while initializing PostHog app with config id "+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){ao.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}_onCapturedEvent(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){ao.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;v["__$$ph_site_app_"+e]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,(t=>{if(t)return ao.error("Error while initializing PostHog app with config id "+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var co=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&y(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>y(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},uo=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),_o="i.posthog.com";class ho{constructor(e){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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+_o,".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]=uo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=uo.EU:this._regionCache[this.apiHost]=uo.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===uo.CUSTOM)return this.apiHost+t;var i=_o+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var po={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&un(t.href,e),not_regex:(e,t)=>!!s&&!un(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class go{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{go._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;if(t._flagToExperiments)go._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e);var r=t._instance.getFeatureFlag(e.feature_flag_key);O(r)&&e.variants[r]&&t._applyTransforms(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];go._matchesTestVariant(n)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())go._logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(D(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();go._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this._flagToExperiments)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this._applyTransforms(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=go.getWindowLocation();if(null!=e&&e.search){var t=ai(null==e?void 0:e.search,"__experiment_id"),i=ai(null==e?void 0:e.search,"__experiment_variant");t&&i&&(go._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()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}_showPreviewWebExperiment(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(go._logInfo("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this._applyTransforms(r[0].name,t,r[0].variants[t].transforms))}static _matchesTestVariant(e){return!D(e.conditions)&&(go._matchUrlConditions(e)&&go._matchUTMConditions(e))}static _matchUrlConditions(e){var t;if(D(e.conditions)||D(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=go.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||po[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==s?void 0:s.location}static _matchUTMConditions(e){var t;if(D(e.conditions)||D(null==(t=e.conditions)?void 0:t.utm))return!0;var i=ns();if(i.utm_source){var r,s,n,o,a,l,c,u,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Ie.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?go._logInfo("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var r;go._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):go._logInfo("Control variants leave the page unmodified.")}_is_bot(){return c&&this._instance?co(c,this._instance.config.custom_blocked_useragents):void 0}}var vo=Ce("[PostHog ExternalIntegrations]"),fo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class mo{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return vo.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;(!r||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(fo[t],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var yo="[SessionRecording]",bo=Ce(yo);class wo{get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){return this._lazyLoadedSessionRecording?this._lazyLoadedSessionRecording.status:this._receivedFlags&&!this._isRecordingEnabled?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._receivedFlags=!1,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw bo.error("started without valid sessionManager"),new Error(yo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(yo+' cannot be used with cookieless_mode="always"')}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(et))||!e.enabled),i=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!L(Object.assign)&&!L(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),bo.info("starting")):this.stopRecording()}}_lazyLoadAndStart(e){var t,i,r;this._isRecordingEnabled&&(null!=v&&null!=(t=v.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=v.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return bo.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_resetSampling(){var e;null==(e=this._instance.persistence)||e.unregister(it)}_persistRemoteConfig(e){if(this._instance.persistence){var t,r,s=this._instance.persistence,n=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=null==t?void 0:t.sampleRate,n=D(r)?null:parseFloat(r);D(n)&&this._resetSampling();var o=null==t?void 0:t.minimumDurationMilliseconds;s.register({[et]:i({enabled:!!t},t,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:n,minimumDurationMilliseconds:L(o)?null:o,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this._persistRemoteConfig(e),this._receivedFlags=!0,this.startIfEnabledOrStop()):this._receivedFlags=!0:bo.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):bo.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(et);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_onScriptLoaded(e){var t,i;if(null==(t=v.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=v.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||(null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}));null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||(null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}));null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||(null==(i=this._instance.persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}var Eo={},So=()=>{},xo="posthog",ko=!sn&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla")),Po=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:He(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",loaded:So,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:d&&O(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Ie.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Xn},error_tracking:{},_onCapture:So,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},Io=e=>{var t={};L(e.process_person)||(t.person_profiles=e.process_person),L(e.xhr_headers)||(t.request_headers=e.xhr_headers),L(e.cookie_name)||(t.persistence_name=e.cookie_name),L(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),L(e.store_google)||(t.save_campaign_params=e.store_google),L(e.verbose)||(t.debug=e.verbose);var i=$e({},t,e);return C(e.property_blacklist)&&(L(e.property_denylist)?i.property_denylist=e.property_blacklist:C(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ie.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Co{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ie.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fo{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new Co,this._personProcessingSetOncePropertiesSent=!1,this.version=f.LIB_VERSION,this._internalEventEmitter=new An,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=Ki,this.sentryIntegration=e=>function(e,t){var i=Ji(e,t);return{name:Yi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new Cn(this),this.toolbar=new tr(this),this.scrollManager=new to(this),this.pageViewManager=new ws(this),this.surveys=new Wn(this),this.experiments=new go(this),this.exceptions=new vn(this),this.rateLimiter=new Yn(this),this.requestRouter=new ho(this),this.consent=new Di(this),this.externalIntegrations=new mo(this),this.people={set:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=O(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>Ie.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==xo){var r,s=null!==(r=Eo[i])&&void 0!==r?r:new Fo;return s._init(e,t,i),Eo[i]=s,Eo[xo][i]=s,s}return this._init(e,t,i)}_init(e,t,r){var n;if(void 0===t&&(t={}),L(e)||M(e))return Ie.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles&&(this._initialPersonProfilesConfig=t.person_profiles),this.set_config($e({},Po(t.defaults),Io(t),{name:r,token:e})),this.config.on_xhr_error&&Ie.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:si.GZipJS;var o=this._is_persistence_disabled();this.persistence=new Rn(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Rn(i({},this.config,{persistence:"sessionStorage"}),o);var a=i({},this.persistence.props),l=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Qn((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new eo(this),this.__request_queue=[];var c="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new no(this),this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ie.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(Ie.info("Initializing extensions synchronously"),this._initExtensions(c)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&Ie.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:a,s:l}),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var u,d,_=this.config.get_device_id(Ei()),h=null!=(u=t.bootstrap)&&u.isIdentifiedID?_:t.bootstrap.distinctID;this.persistence.set_property(dt,null!=(d=t.bootstrap)&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var p,g,v=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlags)||{}).filter((e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])})).reduce(((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e}),{}),m=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlagPayloads)||{}).filter((e=>v[e])).reduce(((e,i)=>{var r,s;null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:m})}if(c)this.register_once({distinct_id:yt,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Ei());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(dt,"anonymous")}return Ue(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Gi(this,(()=>this._loaded())):this._loaded(),F(this.config._onCapture)&&this.config._onCapture!==So&&(Ie.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Ie.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}_initExtensions(e){var t=performance.now();this.historyAutocapture=new Vi(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new rr(this).startIfEnabledOrStop()})),i.push((()=>{var e;this.siteApps=new lo(this),null==(e=this.siteApps)||e.init()})),e||i.push((()=>{this.sessionRecording=new wo(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new gi(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.heatmaps=new bs(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new fs(this)})),i.push((()=>{this.exceptionObserver=new zi(this),this.exceptionObserver.startIfEnabled()})),i.push((()=>{this.deadClicksAutocapture=new ji(this,Hi),this.deadClicksAutocapture.startIfEnabled()})),i.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(i,t)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Ie.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Ie.info("PostHog extensions initialized ("+r+"ms)")}_onRemoteConfig(e){var t,i,r,s,n,o,a,l;if(!u||!u.body)return Ie.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=w(e.supportedCompression,si.GZipJS)?si.GZipJS:w(e.supportedCompression,si.Base64)?si.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(o=this.webVitalsAutocapture)||o.onRemoteConfig(e),null==(a=this.exceptionObserver)||a.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){Ie.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this._captureInitialPageview()}),1),new Kn(this).load(),this.featureFlags.flags()}_start_queue_if_opted_in(){var e;this.is_capturing()&&(this.config.request_batching&&(null==(e=this._requestQueue)||e.enable()))}_dom_loaded(){this.is_capturing()&&Re(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)||e.unload(),null==(t=this._retryQueue)||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ko?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=on(e.url,{ip:this.config.ip?1:0}),e.headers=i({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,s,n=i({},e);n.timeout=n.timeout||6e4,n.url=on(n.url,{_:(new Date).getTime().toString(),ver:f.LIB_VERSION,compression:n.compression});var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=cn.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(r=null==(s=je(a,(e=>e.transport===o)))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");l(n)})(i({},e,{callback:t=>{var i,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&(null==(i=(r=this.config).on_request_error)||i.call(r,t));null==e.callback||e.callback(t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],s=[];Re(e,(e=>{e&&(t=e[0],C(t)?s.push(e):F(e)?e.call(this):C(e)&&"alias"===t?i.push(e):C(e)&&-1!==t.indexOf("capture")&&F(this[t])?s.push(e):r.push(e))}));var n=function(e,t){Re(e,(function(e){if(C(e[0])){var i=t;Te(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(r,this),n(s,this)}_hasBootstrappedFeatureFlags(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!L(e)&&O(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){null!=t&&t.$current_url&&!O(null==t?void 0:t.$current_url)&&(Ie.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=(null==r?void 0:r.timestamp)||a,c=Ei(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==r?void 0:r.$set)&&(u.$set=null==r?void 0:r.$set);var d,_=this._calculate_set_once_properties(null==r?void 0:r.$set_once);if(_&&(u.$set_once=_),(u=Ne(u,null!=r&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,L(null==r?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Ln.DISMISSED||e===Ln.SENT){var h=null==t?void 0:t[On.SURVEY_ID],p=null==t?void 0:t[On.SURVEY_ITERATION];d={id:h,current_iteration:p},localStorage.getItem(Un(d))||localStorage.setItem(Un(d),"true"),u.$set=i({},u.$set,{[jn({id:h,current_iteration:p},e===Ln.SENT?"responded":"dismissed")]:!0})}var g=i({},u.properties.$set,u.$set);if(T(g)||this.setPersonPropertiesForFlags(g),!D(this.config.before_send)){var v=this._runBeforeSend(u);if(!v)return;u=v}this._internalEventEmitter.emit("eventCaptured",u);var f={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(f):this._requestQueue.enqueue(f),u}Ie.critical("This capture call is ignored due to client rate limiting.")}}else Ie.error("No event name provided to posthog.capture")}else Ie.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=i({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===e){var l=i({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!N(a.distinct_id)||M(a.distinct_id))&&Ie.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,d=ps(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=_,a.$window_id=h}this.sessionPropsManager&&$e(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===uo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=$e(a,c),"$pageview"===e&&u&&(a.title=u.title),!L(o)){var v=r.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=$e({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?Te(this.config.property_denylist,(function(e){delete a[e]})):Ie.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(Ie.error("sanitize_properties is deprecated. Use before_send instead"),a=f(a,e));var m=this._hasPersonProcessing();return a.$process_person_profile=m,m&&!n&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e){var t;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),s=$e({},i,r||{},e||{}),n=this.config.sanitize_properties;return n&&(Ie.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,T(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_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,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Bn),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,r){if(!this.__loaded||!this.persistence)return Ie.uninitializedWarning("posthog.identify");if(N(e)&&(e=e.toString(),Ie.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()))Ie.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==yt){if(this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(Be)&&(this.unregister(Be),this.register({distinct_id:e}));var o="anonymous"===(this.persistence.get_property(dt)||"anonymous");e!==s&&o?(this.persistence.set_property(dt,"identified"),this.setPersonPropertiesForFlags(i({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=dn(e,t,r),this.featureFlags.setAnonymousDistinctId(s)):(t||r)&&this.setPersonProperties(t,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(ut))}}else Ie.critical('The string "'+yt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ie.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=dn(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(i({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):Ie.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},s,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===t||r||this.reloadFeatureFlags()}}else Ie.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if(Ie.info("reset"),!this.__loaded)return Ie.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(dt,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:yt,$device_id:null},"");else{var o=this.config.get_device_id(Ei());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?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),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(ze)?(Ie.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(L(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Be,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ie.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(R(e)){var r,s,n,o,a;$e(this.config,Io(e));var l=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Rn(i({},this.config,{persistence:"sessionStorage"}),l);var c=this._checkLocalStorageForDebug(this.config.debug);q(c)&&(this.config.debug=c),q(this.config.debug)&&(this.config.debug?(f.DEBUG=!0,Fi._is_supported()&&Fi._set("ph_debug","true"),Ie.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(f.DEBUG=!1,Fi._is_supported()&&Fi._remove("ph_debug"))),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(a=this.externalIntegrations)||a.startIfEnabledOrStop()}}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 r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),i.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(i.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(i.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(i.event_trigger)null==(a=this.sessionRecording)||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)||!e.started)}captureException(e,t){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:xo;return t!==xo&&(t=xo+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(dt))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(dt))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&T(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Be])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ft]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ie.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ft,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}_sync_opt_out_with_persistence(){var e,t,i,r,s=this._is_persistence_disabled();(null==(e=this.persistence)?void 0:e._disabled)!==s&&(null==(i=this.persistence)||i.set_disabled(s));(null==(t=this.sessionPersistence)?void 0:t._disabled)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(e){if("always"!==this.config.cookieless_mode){var t,i;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=new no(this),this.persistence&&(this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence)),this.sessionRecording=new wo(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),L(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this._captureInitialPageview()}else Ie.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:yt,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this._captureInitialPageview())):Ie.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ai.GRANTED?"granted":e===Ai.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return c?co(c,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){u&&("visible"===u.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:u.title},{send_instantly:!0}),this._visibilityStateListener&&(u.removeEventListener("visibilitychange",this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Ue(u,"visibilitychange",this._visibilityStateListener)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e,t,i,r,s,n,o,a=this._originalUserConfig||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ie.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=!1,s=Ie,n=(t="advanced_disable_flags")in(e=a)&&!L(e[t]),o=i in e&&!L(e[i]),n?e[t]:o?(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):r)}_runBeforeSend(e){if(D(this.config.before_send))return e;var t=C(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),D(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return j(e.event)?Ie.warn(s+". This can cause unexpected behavior."):Ie.info(s),null}i.properties&&!T(i.properties)||Ie.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=q(e)&&!e,i=Fi._is_supported()&&"true"===Fi._get("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Ae(e.prototype[t[i]])}(Fo,["identify"]);var Ro,To;Ro=Eo[xo]=new Fo,(To=v.posthog)&&Te(To._i,(function(e){if(e&&C(e)){var t=Ro.init(e[0],e[1],e[2]),i=To[e[2]]||To;t&&(t._execute_array.call(t.people,i.people),t._execute_array(i))}})),v.posthog=Ro,function(){function e(){e.done||(e.done=!0,ko=!1,Te(Eo,(function(e){e._dom_loaded()})))}null!=u&&u.addEventListener?"complete"===u.readyState?e():Ue(u,"DOMContentLoaded",e,{capture:!1}):s&&Ie.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
2
2
  //# sourceMappingURL=array.no-external.js.map